version 1.15, 2004/03/11 21:59:36 |
version 1.16, 2004/03/14 12:56:47 |
|
|
/* $OpenXM: OpenXM_contrib2/asir2000/lib/glib,v 1.14 2004/03/11 12:25:20 takayama Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2000/lib/glib,v 1.15 2004/03/11 21:59:36 takayama Exp $ */ |
/* $Id$ */ |
/* $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 |
Line 54 Glib_xmag = 1$ Glib_ymag=1$ Glib_xoffset=0$ Glib_yoffs |
|
Line 54 Glib_xmag = 1$ Glib_ymag=1$ Glib_xoffset=0$ Glib_yoffs |
|
Glib_safe_mode = 2 $ |
Glib_safe_mode = 2 $ |
Glib_counter = 100$ |
Glib_counter = 100$ |
|
|
|
extern Glib_ps_sx$ |
|
extern Glib_ps_sy$ |
|
Glib_ps_sx=2$ /* mag=1/2 for PS picture. cf. glib_ps_form, glib_tops */ |
|
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. */ |
if (P < 0) P=open_canvas(S); /* BUG, get process No. */ |
Line 371 def glib_history(L) { |
|
Line 376 def glib_history(L) { |
|
return 0; |
return 0; |
} |
} |
|
|
|
#define xxx(x) idiv(x,Glib_ps_sx) |
|
#define yyy(y) idiv(y,Glib_ps_sy) |
|
|
/*&usage begin: glib_tops() |
/*&usage begin: glib_tops() |
If Glib_ps is set to 1, |
If Glib_ps is set to 1, |
it returns a postscript program to draw the picture on the canvas. |
it returns a postscript program to draw the picture on the canvas. |
Line 381 def glib_tops() { |
|
Line 389 def glib_tops() { |
|
return glib_ps(Glib_h); |
return glib_ps(Glib_h); |
} |
} |
def glib_ps(L) { |
def glib_ps(L) { |
|
extern Glib_ps_sx; |
|
extern Glib_ps_sy; |
PS = string_to_tb(""); |
PS = string_to_tb(""); |
Prev_color = 0; |
Prev_color = 0; |
/* Prolog */ |
/* Prolog */ |
write_to_tb("%%!PS-Adobe-1.0\n",PS); |
write_to_tb("%%!PS-Adobe-1.0\n",PS); |
write_to_tb("%%BoundingBox: 0 0 " + |
write_to_tb("%%BoundingBox: 0 0 " + |
rtostr(Glib_canvas_x) + " " + rtostr(Glib_canvas_y) + "\n",PS); |
rtostr(xxx(Glib_canvas_x)) + " " + rtostr(yyy(Glib_canvas_y)) + "\n",PS); |
write_to_tb("%%Creator: This is generated by ifplot\n",PS); |
write_to_tb("%%Creator: This is generated by ifplot\n",PS); |
write_to_tb("%%Title: ifplot\n",PS); |
write_to_tb("%%Title: ifplot\n",PS); |
write_to_tb("%%EndComments: \n",PS); |
write_to_tb("%%EndComments: \n",PS); |
Line 410 def glib_ps(L) { |
|
Line 420 def glib_ps(L) { |
|
rtostr(deval(iand(Prev_color,0xff)/256)) + " setrgbcolor \n",PS); |
rtostr(deval(iand(Prev_color,0xff)/256)) + " setrgbcolor \n",PS); |
} |
} |
if (C[0] == "putpixel") { |
if (C[0] == "putpixel") { |
write_to_tb(rtostr(C[1][0]) + " " + rtostr(C[1][1]) + " ifplot_putpixel \n",PS); |
write_to_tb(rtostr(xxx(C[1][0])) + " " + rtostr(yyy(C[1][1])) + " ifplot_putpixel \n",PS); |
} |
} |
if (C[0] == "line") { |
if (C[0] == "line") { |
write_to_tb(" newpath ",PS); |
write_to_tb(" newpath ",PS); |
write_to_tb(rtostr(C[1][0]) + " " + rtostr(C[1][1]) + " moveto " + |
write_to_tb(rtostr(xxx(C[1][0])) + " " + rtostr(yyy(C[1][1])) + " moveto " + |
rtostr(C[1][2]) + " " + rtostr(C[1][3]) + " lineto stroke \n",PS); |
rtostr(xxx(C[1][2])) + " " + rtostr(yyy(C[1][3])) + " lineto stroke \n",PS); |
} |
} |
if (C[0] == "print") { |
if (C[0] == "print") { |
write_to_tb("/Times-Roman findfont 10 scalefont setfont \n",PS); |
write_to_tb("/Times-Roman findfont 10 scalefont setfont \n",PS); |
write_to_tb(rtostr(C[1][0]) + " " + rtostr(C[1][1]) + " moveto ",PS); |
write_to_tb(rtostr(xxx(C[1][0])) + " " + rtostr(yyy(C[1][1])) + " moveto ",PS); |
write_to_tb("(" + C[2] + ") show \n",PS); |
write_to_tb("(" + C[2] + ") show \n",PS); |
} |
} |
} |
} |
Line 446 def glib_ps_form(F) { |
|
Line 456 def glib_ps_form(F) { |
|
P = Glib_ps; /* push Glib_ps */ |
P = Glib_ps; /* push Glib_ps */ |
|
|
Glib_ps=1; Glib_h = []; |
Glib_ps=1; Glib_h = []; |
|
if (type(F) != 17) { |
|
return "Error: argument should be quote(...)."; |
|
} |
eval_quote(F); |
eval_quote(F); |
/* bug. eval_str causes seg fault for ccurve.rr main(8) */ |
/* bug. eval_str causes seg fault for ccurve.rr main(8) */ |
R = glib_tops(); |
R = glib_tops(); |