Term-Gnuplot

 view release on metacpan or  search on metacpan

gnuterm/term/grass.trm  view on Meta::CPAN

{
  int R_move_abs ();
  /* R_move_abs (grass_xoffset+x, grass_yoffset-y + y_max); */
  R_move_abs (grass_xoffset+x, grass_yoffset-y);
}

static void
cont_abs(x, y)
int x, y;
{
  int R_cont_abs ();
  /* R_cont_abs (grass_xoffset+x, grass_xoffset-y + y_max); */
  R_cont_abs (grass_xoffset+x, grass_yoffset-y);
}

TERM_PUBLIC void
GRASS_options ()
{
  options_null ();		/* no options to begin with */
}

TERM_PUBLIC void
GRASS_init ()
{
  /* char buff[128]; */
  char window_name[64];
  float size = 3.0;
  /* int backcolor; */
  int dots_per_line;
  int top, b, l, r;
  /* int textcolor; */
  struct termentry *t = term;
  int G_gisinit();
  int R_open_driver();
  int D_setup();
  int D_get_cur_wind();
  int G_fatal_error();
  int D_set_cur_wind();
  int D_get_screen_window();
  int R_set_window();
  int R_text_size();
  int R_font();
  int R_screen_top();
  int R_screen_bot();
  int D_erase_window();

  G_gisinit ("g.gnuplot");

  R_open_driver ();

  D_setup (0); 

  if (D_get_cur_wind (window_name))
    G_fatal_error ("No current window");

  if (D_set_cur_wind (window_name))
    G_fatal_error ("Current window not available");

  /* Set up the screen, conversions, and graphics */
  D_get_screen_window (&top, &b, &l, &r);
  /* D_set_overlay_mode (1); */

  /* Figure out where to put text */

  R_set_window (top, b, l, r);
  t->xmax = r-l;
  t->ymax = b-top;
  grass_xoffset=l;
  grass_yoffset=b;

  dots_per_line = (int) (size / 100.0 * (float) (t->ymax));
  t->v_char = t->h_char = (int) (.8 * (float) dots_per_line);
  R_text_size (t->h_char, t->v_char);
  R_font("romans");

  t->v_tic = t->h_tic = 4;

  y_max = t->ymax; /* kludge? */

  R__curx = R_screen_top ();
  R__cury = R_screen_bot () + grass_yoffset;

  D_erase_window();
/*
fprintf(stderr,"**********************************************\n");
fprintf(stderr,"DIAGNOSTIC TERMINAL SETUP\n");
fprintf(stderr,"top = %d\tb = %d\tl = %d\tr = %d\n", top,b,l,r);
fprintf(stderr,"name = %s\n", t->name);
fprintf(stderr,"description = %s\n", t->description);
fprintf(stderr,"xmax = %d\t", (int)t->xmax);
fprintf(stderr,"ymax = %d\n", (int)t->ymax);
fprintf(stderr,"v_char = %d\t", (int)t->v_char);
fprintf(stderr,"h_char = %d\n", (int)t->h_char);
fprintf(stderr,"v_tic = %d\t", (int)t->v_tic);
fprintf(stderr,"h_tic = %d\n", (int)t->h_tic);
fprintf(stderr,"**********************************************\n\n");
*/
}

TERM_PUBLIC void
GRASS_reset ()
{
  int R_standard_color();
  int D_translate_color();
  int R_flush();
  int R_stabilize();
  int R_close_driver();

  R_standard_color (D_translate_color ("black"));
  /* D_erase_window(); .* don't clear after g.gnuplot is finished */ 
  R_flush ();
  R_stabilize ();
  R_close_driver ();
}

TERM_PUBLIC void
GRASS_graphics ()
{
  int D_erase_window();
  int R_flush();
  int R_stabilize();



( run in 0.789 second using v1.01-cache-2.11-cpan-df04353d9ac )