[BACK]Return to glib CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / lib

Diff for /OpenXM_contrib2/asir2000/lib/glib between version 1.16 and 1.21

version 1.16, 2004/03/14 12:56:47 version 1.21, 2018/10/22 07:05:55
Line 1 
Line 1 
 /* $OpenXM: OpenXM_contrib2/asir2000/lib/glib,v 1.15 2004/03/11 21:59:36 takayama Exp $ */  /* $OpenXM: OpenXM_contrib2/asir2000/lib/glib,v 1.20 2008/08/07 06:00:34 takayama Exp $ */
 /* $Id$ */  
   
 /* BUG: this library has not yet been adapted to the new automatic launcher  /* BUG: this library has not yet been adapted to the new automatic launcher
         of ox_plot. 2002, Aug, 4.  Do not load glib more than twice.          of ox_plot. 2002, Aug, 4.  Do not load glib more than twice.
 */  */
   
   extern Cfep_loaded$
   extern Cfep_use_opengl$
   
 #define DO_NOT_START_SERVER_EXPLICITLY  #define DO_NOT_START_SERVER_EXPLICITLY
   
 /* #define CLIP  1 */  /* #define CLIP  1 */
Line 36  def glib_ox_get_errors(P) {
Line 38  def glib_ox_get_errors(P) {
   
 def reset_plot() {  def reset_plot() {
   extern Glib_process;    extern Glib_process;
   print("  Sending signal to ox_plot",0);    if ((!Cfep_loaded) || (!Cfep_use_opengl)) {
   ox_reset(Glib_process);      print("  Sending signal to ox_plot",0);
   print("  Done.");      ox_reset(Glib_process);
       print("  Done.");
     }
 }  }
 Glib_ps = 0$  Glib_ps = 0$
 Glib_h = []$  Glib_h = []$
Line 61  Glib_ps_sy=2$  /* mag=1/2 for PS picture */ 
Line 65  Glib_ps_sy=2$  /* mag=1/2 for PS picture */ 
   
 def open_Canvas(P,S) {  def open_Canvas(P,S) {
   extern Glib_process;    extern Glib_process;
   if (P < 0) P=open_canvas(S); /* BUG, get process No. */    /* print("open_Canvas: ",0);print(S); */
   else open_canvas(P,S);    if ((!Cfep_loaded) || (!Cfep_use_opengl)) {
   Glib_process = P;      if (P < 0) P=open_canvas(S); /* BUG, get process No. */
   R = ox_pop_cmo(P);      else open_canvas(P,S);
 /*      Glib_process = P;
   if (glib_ox_get_errors(P) == []) {  
     R = ox_pop_cmo(P);      R = ox_pop_cmo(P);
   }else{      /*
     debug;      if (glib_ox_get_errors(P) == []) {
         R = ox_pop_cmo(P);
       }else{
         debug;
       }
       */
     }else {
       R=cfep.open_canvas(S);
   }    }
 */  
   return(R);    return(R);
 }  }
   
Line 87  def glib_open() {
Line 96  def glib_open() {
   extern Glib_canvas_x, Glib_canvas_y,    extern Glib_canvas_x, Glib_canvas_y,
          Glib_process, Glib_canvas,           Glib_process, Glib_canvas,
          Glib_server_started, Glib_process$           Glib_server_started, Glib_process$
     if ((!Cfep_loaded) || (!Cfep_use_opengl)) return glib_openx11();
     else {
       Glib_canvas = open_Canvas(-1,[Glib_canvas_x,Glib_canvas_y])$
       Glib_server_started = 1$
       return(Glib_canvas);
     }
   }
   def glib_openx11() {
     extern Glib_canvas_x, Glib_canvas_y,
            Glib_process, Glib_canvas,
            Glib_server_started, Glib_process$
 #ifndef DO_NOT_START_SERVER_EXPLICITLY  #ifndef DO_NOT_START_SERVER_EXPLICITLY
 if (type(Glib_server_started) == 0) {    if (type(Glib_server_started) == 0) {
     Glib_process = ox_launch_nox(0,"ox_plot")$      Glib_process = ox_launch_nox(0,"ox_plot")$
     register_handler(reset_plot);      register_handler(reset_plot);
     Glib_server_started = 1$      Glib_server_started = 1$
Line 125  def glib_check_strict() {
Line 145  def glib_check_strict() {
   if (Glib_canvas < 0) {    if (Glib_canvas < 0) {
     glib_open();      glib_open();
   }    }
     if (Cfep_loaded && Cfep_use_opengl) return ;
   E = glib_ox_get_errors(Glib_process);    E = glib_ox_get_errors(Glib_process);
   if (E != []) {    if (E != []) {
     ox_pops(Glib_process,200);      ox_pops(Glib_process,200);
Line 137  def glib_check_strict() {
Line 158  def glib_check_strict() {
   }    }
 }  }
   
   /*&usage begin: glib_clear()
     Clear the screen.
   end: */
 def glib_clear() {  def glib_clear() {
   extern Glib_process, Glib_canvas;    extern Glib_process, Glib_canvas;
   if (Glib_canvas < 0) glib_open();    if (Glib_canvas < 0) glib_open();
   clear_canvas(Glib_process,Glib_canvas);    if ((!Cfep_loaded) || (!Cfep_use_opengl)) clear_canvas(Glib_process,Glib_canvas);
     else cfep.glib_clear();
 }  }
   
 /*&usage begin: glib_window(Xmin,Ymin,Xmax,Ymax)  /*&usage begin: glib_window(Xmin,Ymin,Xmax,Ymax)
Line 201  def glib_putpixel(X,Y) {
Line 226  def glib_putpixel(X,Y) {
            Glib_canvas_y-glib_floor(Glib_ymag*(Y+Glib_yoffset))];             Glib_canvas_y-glib_floor(Glib_ymag*(Y+Glib_yoffset))];
   }    }
   if ( type(C) != -1 ) {    if ( type(C) != -1 ) {
     draw_obj(Glib_process,Glib_canvas,Pos,C);      if ((!Cfep_loaded) || (!Cfep_use_opengl)) draw_obj(Glib_process,Glib_canvas,Pos,C);
       else cfep.draw_obj2(Glib_process,Glib_canvas,Pos,C);
     if (Glib_ps) glib_history(["putpixel",Pos2,C]);      if (Glib_ps) glib_history(["putpixel",Pos2,C]);
   }else{    }else{
     draw_obj(Glib_process,Glib_canvas,Pos);      if ((!Cfep_loaded) || (!Cfep_use_opengl)) draw_obj(Glib_process,Glib_canvas,Pos);
       else cfep.draw_obj(Glib_process,Glib_canvas,Pos);
     if (Glib_ps) glib_history(["putpixel",Pos2,0]);      if (Glib_ps) glib_history(["putpixel",Pos2,0]);
   }    }
 }  }
   
 /*&usage begin: glib_line(X0,Y0,X1,Y1|color)  /*&usage begin: glib_line(X0,Y0,X1,Y1|color,shape)
   It draws the line [{X0},{Y0}]-- [{X1},{Y1}] with {color}    It draws the line [{X0},{Y0}]-- [{X1},{Y1}] with {color} and {shape}
   example: glib_line(0,0,5,3/2 | color=0xff00ff);    example: glib_line(0,0,5,3/2 | color=0xff00ff);
              glib_line(0,0,10,0 | shape=arrow);
 end: */  end: */
 def glib_line(X0,Y0,X1,Y1) {  def glib_line(X0,Y0,X1,Y1) {
   extern Glib_xmag, Glib_ymag, Glib_xoffset, Glib_yoffset;    extern Glib_xmag, Glib_ymag, Glib_xoffset, Glib_yoffset;
Line 222  def glib_line(X0,Y0,X1,Y1) {
Line 250  def glib_line(X0,Y0,X1,Y1) {
                  glib_floor(Glib_ymag*(Y0+Glib_yoffset)),                   glib_floor(Glib_ymag*(Y0+Glib_yoffset)),
                  glib_floor(Glib_xmag*(X1+Glib_xoffset)),                   glib_floor(Glib_xmag*(X1+Glib_xoffset)),
                  glib_floor(Glib_ymag*(Y1+Glib_yoffset)),C);                   glib_floor(Glib_ymag*(Y1+Glib_yoffset)),C);
     Shape = getopt(shape);
     if (type(Shape) != 2) return;
     Px = X0+(7/8)*(X1-X0);
     Py = Y0+(7/8)*(Y1-Y0);
     Qx = (Y0-Y1)/8;
     Qy = (X1-X0)/8;
     if (type(C)>0) glib_line(X1,Y1,Px+Qx,Py+Qy | color=C);
     else glib_line(X1,Y1,Px+Qx,Py+Qy);
     if (type(C)>0) glib_line(X1,Y1,Px-Qx,Py-Qy | color=C);
     else glib_line(X1,Y1,Px-Qx,Py-Qy);
 }  }
   
 def glib_clip_line(X0,Y0,X1,Y1,Color) {  def glib_clip_line(X0,Y0,X1,Y1,Color) {
Line 280  if (Glib_ps) {
Line 318  if (Glib_ps) {
            glib_floor(X1),Glib_canvas_y-glib_floor(Y1)];             glib_floor(X1),Glib_canvas_y-glib_floor(Y1)];
   }    }
   if ( type(Color) != -1 ) {    if ( type(Color) != -1 ) {
     draw_obj(Glib_process,Glib_canvas,Pos,Color);      if ((!Cfep_loaded) || (!Cfep_use_opengl)) draw_obj(Glib_process,Glib_canvas,Pos,Color);
       else cfep.draw_obj2(Glib_process,Glib_canvas,Pos,Color);
     if (Glib_ps) glib_history(["line",Pos2,Color]);      if (Glib_ps) glib_history(["line",Pos2,Color]);
   }else{    }else{
     draw_obj(Glib_process,Glib_canvas,Pos);      if ((!Cfep_loaded) || (!Cfep_use_opengl)) draw_obj(Glib_process,Glib_canvas,Pos);
       else cfep.draw_obj(Glib_process,Glib_canvas,Pos);
     if (Glib_ps) glib_history(["line",Pos2,0]);      if (Glib_ps) glib_history(["line",Pos2,0]);
   }    }
 }  }
Line 354  def glib_print(X,Y,Text) {
Line 394  def glib_print(X,Y,Text) {
            Glib_canvas_y-glib_floor(Glib_ymag*(Y+Glib_yoffset))];             Glib_canvas_y-glib_floor(Glib_ymag*(Y+Glib_yoffset))];
   }    }
   if ( type(C) != -1 ) {    if ( type(C) != -1 ) {
     draw_string(Glib_process,Glib_canvas,Pos,Text,C);      if ((!Cfep_loaded) || (!Cfep_use_opengl)) draw_string(Glib_process,Glib_canvas,Pos,Text,C);
       else cfep.draw_string2(Glib_process,Glib_canvas,Pos,Text,C);
     if (Glib_ps) glib_history(["print",Pos2,Text,C]);      if (Glib_ps) glib_history(["print",Pos2,Text,C]);
   }else{    }else{
     draw_string(Glib_process,Glib_canvas,Pos,Text);      if ((!Cfep_loaded) || (!Cfep_use_opengl)) draw_string(Glib_process,Glib_canvas,Pos,Text);
       else cfep.draw_string(Glib_process,Glib_canvas,Pos,Text);
     if (Glib_ps) glib_history(["print",Pos2,Text,0]);      if (Glib_ps) glib_history(["print",Pos2,Text,0]);
   }    }
 }  }
Line 477  def glib_plot(F) {
Line 519  def glib_plot(F) {
   Opt = getopt();    Opt = getopt();
   taka_glib_plot(F,Opt);    taka_glib_plot(F,Opt);
 }  }
   
   /*&usage begin: glib_flush();
     Flush the output.
    (Cfep only. It also set initGL to 1.).
   end: */
   def glib_flush() {
     extern Glib_canvas;
     if (Glib_canvas < 0) glib_open();
     if (Cfep_loaded && Cfep_use_opengl) cfep.draw_flush(Glib_canvas);
   }
   /*&usage begin: glib_set_pixel_size(P)
     Set the size of putpixel to P. 1.0 is the default.
    (cfep only).
   end: */
   def glib_set_pixel_size(X) {
     extern  Glib_canvas;
     if (Glib_canvas < 0) glib_open();
     if ((!Cfep_loaded) || (!Cfep_use_opengl)) /*Not implemented.*/ ;
     else cfep.glib_set_pixel_size(X);
   }
   
   /*&usage begin: glib_remove_last()
     Remove the last object.  glib_flush() should also be called to remove
     the last object.
    (cfep only).
   end: */
   def glib_remove_last() {
     extern  Glib_canvas;
     if (Glib_canvas < 0) glib_open();
     if ((!Cfep_loaded) || (!Cfep_use_opengl)) /*Not implemented.*/ ;
     else cfep.glib_remove_last();
   }
   
   if (Cfep_loaded && (!Cfep_use_opengl)) {
     printf("OpenGL is no longer supported on cfep.asir. Use X11 instead.\n")$
   }else{;}$
   
 end$  end$
   

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.21

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>