=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/lib/glib,v retrieving revision 1.6 retrieving revision 1.10 diff -u -p -r1.6 -r1.10 --- OpenXM_contrib2/asir2000/lib/glib 2002/07/14 07:10:01 1.6 +++ OpenXM_contrib2/asir2000/lib/glib 2002/08/08 08:56:31 1.10 @@ -1,6 +1,9 @@ -/* $OpenXM: OpenXM_contrib2/asir2000/lib/glib,v 1.5 2002/07/14 03:57:24 takayama Exp $ */ -/* $Id: glib,v 1.6 2002/07/14 07:10:01 takayama Exp $ */ +/* $OpenXM: OpenXM_contrib2/asir2000/lib/glib,v 1.9 2002/08/04 00:11:25 takayama Exp $ */ +/* $Id: glib,v 1.10 2002/08/08 08:56:31 takayama Exp $ */ +/* 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. +*/ /* #define CLIP 1 */ /* #define DEBUG 1 */ @@ -24,7 +27,7 @@ def roots(F) { */ /* ---------------------------------------------- */ -def ox_get_errors(P) { +def glib_ox_get_errors(P) { ox_push_cmd(P,276); return(ox_pop_cmo(P)); } @@ -58,7 +61,7 @@ def open_Canvas(P,S) { open_canvas(P,S); R = ox_pop_cmo(P); /* - if (ox_get_errors(P) == []) { + if (glib_ox_get_errors(P) == []) { R = ox_pop_cmo(P); }else{ debug; @@ -67,6 +70,14 @@ def open_Canvas(P,S) { return(R); } +/*&usage begin: glib_open() + It starts the ox_plot server and opens a canvas. + The canvas size is set to {Glib_canvas_x} X {Glib_canvas_y} + (the default value is 400). + This function is automatically called when the user calls glib + functions. +end: */ + def glib_open() { extern Glib_canvas_x, Glib_canvas_y, Glib_process, Glib_canvas; @@ -98,7 +109,7 @@ def glib_check_strict() { if (Glib_canvas < 0) { glib_open(); } - E = ox_get_errors(Glib_process); + E = glib_ox_get_errors(Glib_process); if (E != []) { ox_pops(Glib_process,200); print(E); @@ -170,7 +181,7 @@ def glib_putpixel(X,Y) { } /*&usage begin: glib_line(X0,Y0,X1,Y1|color) - It draw the line [{X0},{Y0}]-- [{X1},{Y1}]with {color} + It draws the line [{X0},{Y0}]-- [{X1},{Y1}] with {color} example: glib_line(0,0,5,3/2 | color=0xff00ff); end: */ def glib_line(X0,Y0,X1,Y1) { @@ -320,6 +331,7 @@ def glib_history(L) { /*&usage begin: glib_tops() If Glib_ps is set to 1, it returns a postscript program to draw the picture on the canvas. + ref: print_output end: */ def glib_tops() { extern Glib_h; @@ -375,5 +387,17 @@ def glib_ps(L) { return PS; } + +/*&usage begin: glib_plot(F) + It plots an object {F} on the glib canvas. + example: glib_plot([[0,1],[0.1,0.9],[0.2,0.7],[0.3,0.5],[0.4,0.8]]); + example: glib_plot(tan(x)); +end: */ +/* bug, xmin, xmax, color should be optional variables. */ +def glib_plot(F) { + Opt = getopt(); + taka_glib_plot(F,Opt); +} + end$