version 1.2, 2019/07/16 01:29:22 |
version 1.3, 2019/09/26 04:15:35 |
|
|
/* $OpenXM: OpenXM_contrib2/asir2018/lib/glib,v 1.1 2018/09/19 05:45:08 noro Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2018/lib/glib,v 1.2 2019/07/16 01:29:22 takayama Exp $ */ |
|
|
/* 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_loaded$ |
|
extern Cfep_use_opengl$ |
|
|
#define DO_NOT_START_SERVER_EXPLICITLY |
#define DO_NOT_START_SERVER_EXPLICITLY |
|
|
Line 36 def glib_ox_get_errors(P) { |
|
Line 37 def glib_ox_get_errors(P) { |
|
} |
} |
|
|
def reset_plot() { |
def reset_plot() { |
/* It is no longer used. See, oxrfc103.rr */ |
/* It is no longer used. See, oxrfc103.rr */ |
extern Glib_process; |
extern Glib_process; |
if (!Cfep_loaded) { |
if ((!Cfep_loaded) || (!Cfep_use_opengl)) { |
print(" Sending signal to ox_plot",0); |
print(" Sending signal to ox_plot",0); |
ox_reset(Glib_process); |
ox_reset(Glib_process); |
print(" Done."); |
print(" Done."); |
Line 66 Glib_ps_sy=2$ /* mag=1/2 for PS picture */ |
|
Line 67 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; |
/* print("open_Canvas: ",0);print(S); */ |
/* print("open_Canvas: ",0);print(S); */ |
if (!Cfep_loaded) { |
if ((!Cfep_loaded) || (!Cfep_use_opengl)) { |
if (P < 0) P=open_canvas(S); /* BUG, get process No. */ |
if (P < 0) P=open_canvas(S); /* BUG, get process No. */ |
else open_canvas(P,S); |
else open_canvas(P,S); |
Glib_process = P; |
Glib_process = P; |
Line 78 def open_Canvas(P,S) { |
|
Line 79 def open_Canvas(P,S) { |
|
debug; |
debug; |
} |
} |
*/ |
*/ |
}else{ |
}else { |
R=cfep.open_canvas(S); |
R=cfep.open_canvas(S); |
} |
} |
return(R); |
return(R); |
Line 96 def glib_open() { |
|
Line 97 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) return glib_openx11(); |
if ((!Cfep_loaded) || (!Cfep_use_opengl)) return glib_openx11(); |
else { |
else { |
Glib_canvas = open_Canvas(-1,[Glib_canvas_x,Glib_canvas_y])$ |
Glib_canvas = open_Canvas(-1,[Glib_canvas_x,Glib_canvas_y])$ |
Glib_server_started = 1$ |
Glib_server_started = 1$ |
Line 110 def glib_openx11() { |
|
Line 111 def glib_openx11() { |
|
#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$ |
}$ |
}$ |
Glib_canvas = open_Canvas(Glib_process,[Glib_canvas_x,Glib_canvas_y])$ |
Glib_canvas = open_Canvas(Glib_process,[Glib_canvas_x,Glib_canvas_y])$ |
#else |
#else |
Glib_canvas = open_Canvas(-1,[Glib_canvas_x,Glib_canvas_y])$ |
Glib_canvas = open_Canvas(-1,[Glib_canvas_x,Glib_canvas_y])$ |
/* register_handler(reset_plot); */ |
/* register_handler(reset_plot); */ |
Glib_server_started = 1$ |
Glib_server_started = 1$ |
#endif |
#endif |
glib_check_strict(); |
glib_check_strict(); |
Line 145 def glib_check_strict() { |
|
Line 146 def glib_check_strict() { |
|
if (Glib_canvas < 0) { |
if (Glib_canvas < 0) { |
glib_open(); |
glib_open(); |
} |
} |
if (Cfep_loaded) return ; |
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); |
|
|
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(); |
if (!Cfep_loaded) clear_canvas(Glib_process,Glib_canvas); |
if ((!Cfep_loaded) || (!Cfep_use_opengl)) clear_canvas(Glib_process,Glib_canvas); |
else cfep.glib_clear(); |
else cfep.glib_clear(); |
} |
} |
|
|
Line 226 def glib_putpixel(X,Y) { |
|
Line 227 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 ) { |
if (!Cfep_loaded) 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); |
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{ |
if (!Cfep_loaded) 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); |
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]); |
} |
} |
|
|
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 ) { |
if (!Cfep_loaded) 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); |
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{ |
if (!Cfep_loaded) 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); |
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 394 def glib_print(X,Y,Text) { |
|
Line 395 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 ) { |
if (!Cfep_loaded) 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); |
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{ |
if (!Cfep_loaded) 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); |
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]); |
} |
} |
|
|
def glib_flush() { |
def glib_flush() { |
extern Glib_canvas; |
extern Glib_canvas; |
if (Glib_canvas < 0) glib_open(); |
if (Glib_canvas < 0) glib_open(); |
if (Cfep_loaded) cfep.draw_flush(Glib_canvas); |
if (Cfep_loaded && Cfep_use_opengl) cfep.draw_flush(Glib_canvas); |
} |
} |
/*&usage begin: glib_set_pixel_size(P) |
/*&usage begin: glib_set_pixel_size(P) |
Set the size of putpixel to P. 1.0 is the default. |
Set the size of putpixel to P. 1.0 is the default. |
|
|
def glib_set_pixel_size(X) { |
def glib_set_pixel_size(X) { |
extern Glib_canvas; |
extern Glib_canvas; |
if (Glib_canvas < 0) glib_open(); |
if (Glib_canvas < 0) glib_open(); |
if (!Cfep_loaded) /*Not implemented.*/ ; |
if ((!Cfep_loaded) || (!Cfep_use_opengl)) /*Not implemented.*/ ; |
else cfep.glib_set_pixel_size(X); |
else cfep.glib_set_pixel_size(X); |
} |
} |
|
|
|
|
def glib_remove_last() { |
def glib_remove_last() { |
extern Glib_canvas; |
extern Glib_canvas; |
if (Glib_canvas < 0) glib_open(); |
if (Glib_canvas < 0) glib_open(); |
if (!Cfep_loaded) /*Not implemented.*/ ; |
if ((!Cfep_loaded) || (!Cfep_use_opengl)) /*Not implemented.*/ ; |
else cfep.glib_remove_last(); |
else cfep.glib_remove_last(); |
} |
} |
|
|
end$ |
if (Cfep_loaded && (!Cfep_use_opengl)) { |
|
printf("OpenGL is no longer supported on cfep.asir. Use X11 instead.\n")$ |
|
}else{;}$ |
|
|
|
end$ |