=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/lib/glib,v retrieving revision 1.12 retrieving revision 1.13 diff -u -p -r1.12 -r1.13 --- OpenXM_contrib2/asir2000/lib/glib 2002/10/02 01:30:08 1.12 +++ OpenXM_contrib2/asir2000/lib/glib 2004/03/11 05:16:11 1.13 @@ -1,5 +1,5 @@ -/* $OpenXM: OpenXM_contrib2/asir2000/lib/glib,v 1.11 2002/09/10 06:18:46 takayama Exp $ */ -/* $Id: glib,v 1.12 2002/10/02 01:30:08 takayama Exp $ */ +/* $OpenXM: OpenXM_contrib2/asir2000/lib/glib,v 1.12 2002/10/02 01:30:08 takayama Exp $ */ +/* $Id: glib,v 1.13 2004/03/11 05:16:11 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. @@ -381,23 +381,23 @@ def glib_tops() { return glib_ps(Glib_h); } def glib_ps(L) { - PS = ""; + PS = string_to_tb(""); Prev_color = 0; /* Prolog */ - PS += "%%!PS-Adobe-1.0\n"; - PS += "%%BoundingBox: 0 0 " + - rtostr(Glib_canvas_x) + " " + rtostr(Glib_canvas_y) + "\n"; - PS += "%%Creator: This is generated by ifplot\n"; - PS += "%%Title: ifplot\n"; - PS += "%%EndComments: \n"; - PS += "0.1 setlinewidth \n"; - PS += "2 setlinecap \n"; - PS += "2 setlinejoin \n"; - PS += "/ifplot_putpixel { \n"; - PS += " /yyy 2 1 roll def /xxx 2 1 roll def \n"; - PS += " gsave newpath xxx yyy .5 0 360 arc \n"; - PS += " fill grestore \n"; - PS += "} def \n"; + write_to_tb("%%!PS-Adobe-1.0\n",PS); + write_to_tb("%%BoundingBox: 0 0 " + + rtostr(Glib_canvas_x) + " " + rtostr(Glib_canvas_y) + "\n",PS); + write_to_tb("%%Creator: This is generated by ifplot\n",PS); + write_to_tb("%%Title: ifplot\n",PS); + write_to_tb("%%EndComments: \n",PS); + write_to_tb("0.1 setlinewidth \n",PS); + write_to_tb("2 setlinecap \n",PS); + write_to_tb("2 setlinejoin \n",PS); + write_to_tb("/ifplot_putpixel { \n",PS); + write_to_tb(" /yyy 2 1 roll def /xxx 2 1 roll def \n",PS); + write_to_tb(" gsave newpath xxx yyy .5 0 360 arc \n",PS); + write_to_tb(" fill grestore \n",PS); + write_to_tb("} def \n",PS); L = reverse(L); N = length(L); @@ -405,30 +405,30 @@ def glib_ps(L) { C = L[I]; if (C[length(C)-1] != Prev_color) { Prev_color = C[length(C)-1]; - PS += rtostr(deval(ishift(Prev_color,16)/256)) + " " + + write_to_tb(rtostr(deval(ishift(Prev_color,16)/256)) + " " + rtostr(deval(iand(ishift(Prev_color,8),0xff)/256)) + " " + - rtostr(deval(iand(Prev_color,0xff)/256)) + " setrgbcolor \n"; + rtostr(deval(iand(Prev_color,0xff)/256)) + " setrgbcolor \n",PS); } if (C[0] == "putpixel") { - PS += rtostr(C[1][0]) + " " + rtostr(C[1][1]) + " ifplot_putpixel \n"; + write_to_tb(rtostr(C[1][0]) + " " + rtostr(C[1][1]) + " ifplot_putpixel \n",PS); } if (C[0] == "line") { - PS += " newpath "; - PS += rtostr(C[1][0]) + " " + rtostr(C[1][1]) + " moveto " + - rtostr(C[1][2]) + " " + rtostr(C[1][3]) + " lineto stroke \n"; + write_to_tb(" newpath ",PS); + write_to_tb(rtostr(C[1][0]) + " " + rtostr(C[1][1]) + " moveto " + + rtostr(C[1][2]) + " " + rtostr(C[1][3]) + " lineto stroke \n",PS); } if (C[0] == "print") { - PS += "/Times-Roman findfont 10 scalefont setfont \n"; - PS += rtostr(C[1][0]) + " " + rtostr(C[1][1]) + " moveto "; - PS += "(" + C[2] + ") show \n"; + 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("(" + C[2] + ") show \n",PS); } } /* Epilog */ - PS += "0 0 0 setrgbcolor \n"; - PS += "showpage \n"; + write_to_tb("0 0 0 setrgbcolor \n",PS); + write_to_tb("showpage \n",PS); - return PS; + return tb_to_string(PS); } /*&usage begin: glib_plot(F)