Annotation of OpenXM_contrib2/asir2000/plot/plotf.c, Revision 1.15
1.4 noro 1: /*
2: * Copyright (c) 1994-2000 FUJITSU LABORATORIES LIMITED
3: * All rights reserved.
4: *
5: * FUJITSU LABORATORIES LIMITED ("FLL") hereby grants you a limited,
6: * non-exclusive and royalty-free license to use, copy, modify and
7: * redistribute, solely for non-commercial and non-profit purposes, the
8: * computer program, "Risa/Asir" ("SOFTWARE"), subject to the terms and
9: * conditions of this Agreement. For the avoidance of doubt, you acquire
10: * only a limited right to use the SOFTWARE hereunder, and FLL or any
11: * third party developer retains all rights, including but not limited to
12: * copyrights, in and to the SOFTWARE.
13: *
14: * (1) FLL does not grant you a license in any way for commercial
15: * purposes. You may use the SOFTWARE only for non-commercial and
16: * non-profit purposes only, such as academic, research and internal
17: * business use.
18: * (2) The SOFTWARE is protected by the Copyright Law of Japan and
19: * international copyright treaties. If you make copies of the SOFTWARE,
20: * with or without modification, as permitted hereunder, you shall affix
21: * to all such copies of the SOFTWARE the above copyright notice.
22: * (3) An explicit reference to this SOFTWARE and its copyright owner
23: * shall be made on your publication or presentation in any form of the
24: * results obtained by use of the SOFTWARE.
25: * (4) In the event that you modify the SOFTWARE, you shall notify FLL by
1.5 noro 26: * e-mail at risa-admin@sec.flab.fujitsu.co.jp of the detailed specification
1.4 noro 27: * for such modification or the source code of the modified part of the
28: * SOFTWARE.
29: *
30: * THE SOFTWARE IS PROVIDED AS IS WITHOUT ANY WARRANTY OF ANY KIND. FLL
31: * MAKES ABSOLUTELY NO WARRANTIES, EXPRESSED, IMPLIED OR STATUTORY, AND
32: * EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS
33: * FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT OF THIRD PARTIES'
34: * RIGHTS. NO FLL DEALER, AGENT, EMPLOYEES IS AUTHORIZED TO MAKE ANY
35: * MODIFICATIONS, EXTENSIONS, OR ADDITIONS TO THIS WARRANTY.
36: * UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, TORT, CONTRACT,
37: * OR OTHERWISE, SHALL FLL BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY
38: * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL
39: * DAMAGES OF ANY CHARACTER, INCLUDING, WITHOUT LIMITATION, DAMAGES
40: * ARISING OUT OF OR RELATING TO THE SOFTWARE OR THIS AGREEMENT, DAMAGES
41: * FOR LOSS OF GOODWILL, WORK STOPPAGE, OR LOSS OF DATA, OR FOR ANY
42: * DAMAGES, EVEN IF FLL SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF
43: * SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. EVEN IF A PART
44: * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY
45: * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
46: * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.
47: *
1.15 ! noro 48: * $OpenXM: OpenXM_contrib2/asir2000/plot/plotf.c,v 1.14 2002/08/02 05:39:22 noro Exp $
1.4 noro 49: */
1.1 noro 50: #include "ca.h"
51: #include "parse.h"
52: #include "ox.h"
53: #include "ifplot.h"
54:
55: void Pifplot(), Pconplot(), Pplotover(), Pplot(), Parrayplot(), Pdrawcircle();
1.15 ! noro 56: void Ppolarplot();
1.10 noro 57: void Pmemory_ifplot();
1.12 noro 58: void Popen_canvas(), Pclear_canvas(), Pdraw_obj(), Pdraw_string();
1.11 noro 59: void Pox_rpc();
60: void Pox_cmo_rpc();
1.1 noro 61:
62: struct ftab plot_tab[] = {
63: {"ifplot",Pifplot,-7},
1.10 noro 64: {"memory_ifplot",Pmemory_ifplot,-7},
1.1 noro 65: {"conplot",Pconplot,-8},
66: {"plot",Pplot,-6},
1.15 ! noro 67: {"polarplot",Ppolarplot,-6},
1.1 noro 68: {"plotover",Pplotover,3},
69: {"drawcircle",Pdrawcircle,5},
1.6 noro 70: {"open_canvas",Popen_canvas,-3},
71: {"clear_canvas",Pclear_canvas,2},
1.7 noro 72: {"draw_obj",Pdraw_obj,-4},
1.12 noro 73: {"draw_string",Pdraw_string,-5},
1.1 noro 74: /*
75: {"arrayplot",Parrayplot,2},
76: */
77: {0,0,0},
78: };
79:
1.11 noro 80: void Popen_canvas(NODE arg,Obj *rp)
1.6 noro 81: {
1.9 noro 82: Q w300,s_id;
1.6 noro 83: LIST geom;
1.11 noro 84: int stream;
1.6 noro 85: NODE n,n0;
86: STRING fname,wname;
87:
88: geom = 0; wname = 0; stream = -1;
89: for ( ; arg; arg = NEXT(arg) )
90: if ( !BDY(arg) )
91: stream = 0;
92: else
93: switch ( OID(BDY(arg)) ) {
94: case O_LIST:
95: geom = (LIST)BDY(arg);
96: break;
97: case O_N:
98: stream = QTOS((Q)BDY(arg)); break;
99: case O_STR:
100: wname = (STRING)BDY(arg); break;
101: default:
102: error("open_canvas : invalid argument"); break;
103: }
104: /* open_canvas in ox_plot requires
1.9 noro 105: [s_id (Q),
1.6 noro 106: geom=[xsize,ysize] (LIST),
107: wname=name (STRING)]
108: */
109:
1.13 noro 110: stream = validate_ox_plot_stream(stream);
1.9 noro 111: STOQ(stream,s_id);
1.6 noro 112: if ( !geom ) {
113: STOQ(300,w300);
114: MKNODE(n0,w300,0); MKNODE(n,w300,n0); MKLIST(geom,n);
115: }
116: MKSTR(fname,"open_canvas");
1.9 noro 117: arg = mknode(4,s_id,fname,geom,wname);
1.6 noro 118: Pox_cmo_rpc(arg,rp);
119: }
120:
1.13 noro 121: void Pifplot(NODE arg,Q *rp)
1.1 noro 122: {
1.9 noro 123: Q m2,p2,w300,s_id;
1.1 noro 124: NODE defrange;
125: LIST xrange,yrange,range[2],list,geom;
126: VL vl,vl0;
127: V v[2],av[2];
1.11 noro 128: int stream,ri,i;
1.1 noro 129: P poly;
130: P var;
131: NODE n,n0;
132: STRING fname,wname;
1.13 noro 133: Obj t;
1.1 noro 134:
135: STOQ(-2,m2); STOQ(2,p2);
136: MKNODE(n,p2,0); MKNODE(defrange,m2,n);
137: poly = 0; vl = 0; geom = 0; wname = 0; stream = -1; ri = 0;
1.14 noro 138: v[0] = v[1] = 0;
1.1 noro 139: for ( ; arg; arg = NEXT(arg) )
140: if ( !BDY(arg) )
141: stream = 0;
142: else
143: switch ( OID(BDY(arg)) ) {
144: case O_P:
145: poly = (P)BDY(arg);
1.11 noro 146: get_vars_recursive((Obj)poly,&vl);
1.1 noro 147: for ( vl0 = vl, i = 0; vl0; vl0 = NEXT(vl0) )
1.11 noro 148: if ( vl0->v->attr == (pointer)V_IND )
1.1 noro 149: if ( i >= 2 )
150: error("ifplot : invalid argument");
151: else
152: v[i++] = vl0->v;
153: break;
154: case O_LIST:
155: list = (LIST)BDY(arg);
156: if ( OID(BDY(BDY(list))) == O_P )
157: if ( ri > 1 )
158: error("ifplot : invalid argument");
159: else
160: range[ri++] = list;
161: else
162: geom = list;
163: break;
164: case O_N:
165: stream = QTOS((Q)BDY(arg)); break;
166: case O_STR:
167: wname = (STRING)BDY(arg); break;
168: default:
169: error("ifplot : invalid argument"); break;
170: }
171: if ( !poly )
172: error("ifplot : invalid argument");
173: switch ( ri ) {
174: case 0:
175: if ( !v[1] )
176: error("ifplot : please specify all variables");
177: MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(xrange,n);
178: MKV(v[1],var); MKNODE(n,var,defrange); MKLIST(yrange,n);
179: break;
180: case 1:
181: if ( !v[1] )
182: error("ifplot : please specify all variables");
183: av[0] = VR((P)BDY(BDY(range[0])));
184: if ( v[0] == av[0] ) {
185: xrange = range[0];
186: MKV(v[1],var); MKNODE(n,var,defrange); MKLIST(yrange,n);
187: } else if ( v[1] == av[0] ) {
188: MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(xrange,n);
189: yrange = range[0];
190: } else
191: error("ifplot : invalid argument");
192: break;
193: case 2:
194: av[0] = VR((P)BDY(BDY(range[0])));
195: av[1] = VR((P)BDY(BDY(range[1])));
196: if ( ((v[0] == av[0]) && (!v[1] || v[1] == av[1])) ||
197: ((v[0] == av[1]) && (!v[1] || v[1] == av[0])) ) {
198: xrange = range[0]; yrange = range[1];
199: } else
200: error("ifplot : invalid argument");
201: break;
202: default:
203: error("ifplot : cannot happen"); break;
204: }
205: /* ifplot in ox_plot requires
1.9 noro 206: [s_id (Q),
1.1 noro 207: formula (Obj),
208: xrange=[x,xmin,xmax] (LIST),
209: yrange=[y,ymin,ymax] (LIST),
210: zrange=0,
211: geom=[xsize,ysize] (LIST),
212: wname=name (STRING)]
213: */
214:
1.13 noro 215: stream = validate_ox_plot_stream(stream);
1.9 noro 216: STOQ(stream,s_id);
1.1 noro 217: if ( !geom ) {
218: STOQ(300,w300);
219: MKNODE(n0,w300,0); MKNODE(n,w300,n0); MKLIST(geom,n);
220: }
221: MKSTR(fname,"plot");
1.9 noro 222: arg = mknode(8,s_id,fname,poly,xrange,yrange,0,geom,wname);
1.13 noro 223: Pox_rpc(arg,&t);
224: *rp = s_id;
1.10 noro 225: }
226:
1.13 noro 227: void Pmemory_ifplot(NODE arg,Q *rp)
1.10 noro 228: {
229: Q m2,p2,w300,s_id;
230: NODE defrange;
231: LIST xrange,yrange,range[2],list,geom;
232: VL vl,vl0;
233: V v[2],av[2];
1.11 noro 234: int stream,ri,i;
1.10 noro 235: P poly;
236: P var;
237: NODE n,n0;
1.11 noro 238: STRING fname;
1.13 noro 239: Obj t;
1.10 noro 240:
241: STOQ(-2,m2); STOQ(2,p2);
242: MKNODE(n,p2,0); MKNODE(defrange,m2,n);
243: poly = 0; vl = 0; geom = 0; stream = -1; ri = 0;
244: for ( ; arg; arg = NEXT(arg) )
245: if ( !BDY(arg) )
246: stream = 0;
247: else
248: switch ( OID(BDY(arg)) ) {
249: case O_P:
250: poly = (P)BDY(arg);
1.11 noro 251: get_vars_recursive((Obj)poly,&vl);
1.10 noro 252: for ( vl0 = vl, i = 0; vl0; vl0 = NEXT(vl0) )
1.11 noro 253: if ( vl0->v->attr == (pointer)V_IND )
1.10 noro 254: if ( i >= 2 )
255: error("ifplot : invalid argument");
256: else
257: v[i++] = vl0->v;
258: break;
259: case O_LIST:
260: list = (LIST)BDY(arg);
261: if ( OID(BDY(BDY(list))) == O_P )
262: if ( ri > 1 )
263: error("ifplot : invalid argument");
264: else
265: range[ri++] = list;
266: else
267: geom = list;
268: break;
269: case O_N:
270: stream = QTOS((Q)BDY(arg)); break;
271: default:
272: error("memory_ifplot : invalid argument"); break;
273: }
274: if ( !poly )
275: error("memory_ifplot : invalid argument");
276: switch ( ri ) {
277: case 0:
278: if ( !v[1] )
279: error("memory_ifplot : please specify all variables");
280: MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(xrange,n);
281: MKV(v[1],var); MKNODE(n,var,defrange); MKLIST(yrange,n);
282: break;
283: case 1:
284: if ( !v[1] )
285: error("memory_ifplot : please specify all variables");
286: av[0] = VR((P)BDY(BDY(range[0])));
287: if ( v[0] == av[0] ) {
288: xrange = range[0];
289: MKV(v[1],var); MKNODE(n,var,defrange); MKLIST(yrange,n);
290: } else if ( v[1] == av[0] ) {
291: MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(xrange,n);
292: yrange = range[0];
293: } else
294: error("memory_ifplot : invalid argument");
295: break;
296: case 2:
297: av[0] = VR((P)BDY(BDY(range[0])));
298: av[1] = VR((P)BDY(BDY(range[1])));
299: if ( ((v[0] == av[0]) && (!v[1] || v[1] == av[1])) ||
300: ((v[0] == av[1]) && (!v[1] || v[1] == av[0])) ) {
301: xrange = range[0]; yrange = range[1];
302: } else
303: error("memory_ifplot : invalid argument");
304: break;
305: default:
306: error("memory_ifplot : cannot happen"); break;
307: }
308: /* memory_ifplot in ox_plot requires
309: [s_id (Q),
310: formula (Obj),
311: xrange=[x,xmin,xmax] (LIST),
312: yrange=[y,ymin,ymax] (LIST),
313: zrange=0,
314: geom=[xsize,ysize] (LIST)]
315: */
316:
1.13 noro 317: stream = validate_ox_plot_stream(stream);
1.10 noro 318: STOQ(stream,s_id);
319: if ( !geom ) {
320: STOQ(300,w300);
321: MKNODE(n0,w300,0); MKNODE(n,w300,n0); MKLIST(geom,n);
322: }
323: MKSTR(fname,"memory_plot");
324: arg = mknode(7,s_id,fname,poly,xrange,yrange,0,geom);
1.13 noro 325: Pox_rpc(arg,&t);
326: *rp = s_id;
1.1 noro 327: }
328:
1.13 noro 329: void Pconplot(NODE arg,Q *rp)
1.1 noro 330: {
1.9 noro 331: Q m2,p2,w300,s_id;
1.1 noro 332: NODE defrange;
333: LIST xrange,yrange,zrange,range[3],list,geom;
334: VL vl,vl0;
335: V v[2],av[2];
1.11 noro 336: int stream,ri,i;
1.1 noro 337: P poly;
338: P var;
339: NODE n,n0;
340: STRING fname,wname;
1.13 noro 341: Obj t;
1.1 noro 342:
343: STOQ(-2,m2); STOQ(2,p2);
344: MKNODE(n,p2,0); MKNODE(defrange,m2,n);
345: poly = 0; vl = 0; geom = 0; wname = 0; stream = -1; ri = 0;
1.14 noro 346: v[0] = v[1] = 0;
1.1 noro 347: for ( ; arg; arg = NEXT(arg) )
348: if ( !BDY(arg) )
349: stream = 0;
350: else
351: switch ( OID(BDY(arg)) ) {
352: case O_P:
353: poly = (P)BDY(arg);
1.11 noro 354: get_vars_recursive((Obj)poly,&vl);
1.1 noro 355: for ( vl0 = vl, i = 0; vl0; vl0 = NEXT(vl0) )
1.11 noro 356: if ( vl0->v->attr == (pointer)V_IND )
1.1 noro 357: if ( i >= 2 )
358: error("ifplot : invalid argument");
359: else
360: v[i++] = vl0->v;
361: break;
362: case O_LIST:
363: list = (LIST)BDY(arg);
364: if ( OID(BDY(BDY(list))) == O_P )
365: if ( ri > 2 )
366: error("ifplot : invalid argument");
367: else
368: range[ri++] = list;
369: else
370: geom = list;
371: break;
372: case O_N:
373: stream = QTOS((Q)BDY(arg)); break;
374: case O_STR:
375: wname = (STRING)BDY(arg); break;
376: default:
377: error("ifplot : invalid argument"); break;
378: }
379: if ( !poly )
380: error("ifplot : invalid argument");
381: switch ( ri ) {
382: case 0:
383: if ( !v[1] )
384: error("ifplot : please specify all variables");
385: MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(xrange,n);
386: MKV(v[1],var); MKNODE(n,var,defrange); MKLIST(yrange,n);
387: MKNODE(n,0,defrange); MKLIST(zrange,n);
388: break;
389: case 1:
390: if ( !v[1] )
391: error("ifplot : please specify all variables");
392: av[0] = VR((P)BDY(BDY(range[0])));
393: if ( v[0] == av[0] ) {
394: xrange = range[0];
395: MKV(v[1],var); MKNODE(n,var,defrange); MKLIST(yrange,n);
396: MKNODE(n,0,defrange); MKLIST(zrange,n);
397: } else if ( v[1] == av[0] ) {
398: MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(xrange,n);
399: yrange = range[0];
400: MKNODE(n,0,defrange); MKLIST(zrange,n);
401: } else {
402: MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(xrange,n);
403: MKV(v[1],var); MKNODE(n,var,defrange); MKLIST(yrange,n);
404: zrange = range[0];
405: }
406: break;
407: case 2: case 3:
408: av[0] = VR((P)BDY(BDY(range[0])));
409: av[1] = VR((P)BDY(BDY(range[1])));
410: if ( ((v[0] == av[0]) && (!v[1] || v[1] == av[1])) ||
411: ((v[0] == av[1]) && (!v[1] || v[1] == av[0])) ) {
412: xrange = range[0]; yrange = range[1];
413: if ( ri == 3 )
414: zrange = range[2];
415: else {
416: MKNODE(n,0,defrange); MKLIST(zrange,n);
417: }
418: } else
419: error("ifplot : invalid argument");
420: break;
421: default:
422: error("ifplot : cannot happen"); break;
423: }
424: /* conplot in ox_plot requires
1.9 noro 425: [s_id (Q),
1.1 noro 426: formula (Obj),
427: xrange=[x,xmin,xmax] (LIST),
428: yrange=[y,ymin,ymax] (LIST),
429: zrange=[z,zmin,zmax] (LIST),
430: geom=[xsize,ysize] (LIST),
431: wname=name (STRING)]
432: */
433:
1.13 noro 434: stream = validate_ox_plot_stream(stream);
1.9 noro 435: STOQ(stream,s_id);
1.1 noro 436: if ( !geom ) {
437: STOQ(300,w300);
438: MKNODE(n0,w300,0); MKNODE(n,w300,n0); MKLIST(geom,n);
439: }
440: MKSTR(fname,"plot");
1.9 noro 441: arg = mknode(8,s_id,fname,poly,xrange,yrange,zrange,geom,wname);
1.13 noro 442: Pox_rpc(arg,&t);
443: *rp = s_id;
1.1 noro 444: }
445:
1.13 noro 446: void Pplot(NODE arg,Q *rp)
1.1 noro 447: {
1.9 noro 448: Q m2,p2,w300,s_id;
1.1 noro 449: NODE defrange;
450: LIST xrange,range[1],list,geom;
451: VL vl,vl0;
452: V v[1],av[1];
1.11 noro 453: int stream,ri,i;
1.1 noro 454: P poly;
455: P var;
456: NODE n,n0;
457: STRING fname,wname;
1.13 noro 458: Obj t;
1.1 noro 459:
460: STOQ(-2,m2); STOQ(2,p2);
461: MKNODE(n,p2,0); MKNODE(defrange,m2,n);
462: poly = 0; vl = 0; geom = 0; wname = 0; stream = -1; ri = 0;
1.14 noro 463: v[0] = 0;
1.1 noro 464: for ( ; arg; arg = NEXT(arg) )
465: if ( !BDY(arg) )
466: stream = 0;
467: else
468: switch ( OID(BDY(arg)) ) {
469: case O_P: case O_R:
470: poly = (P)BDY(arg);
1.11 noro 471: get_vars_recursive((Obj)poly,&vl);
1.1 noro 472: for ( vl0 = vl, i = 0; vl0; vl0 = NEXT(vl0) )
1.11 noro 473: if ( vl0->v->attr == (pointer)V_IND )
1.1 noro 474: if ( i >= 1 )
475: error("ifplot : invalid argument");
476: else
477: v[i++] = vl0->v;
1.8 noro 478: if ( i != 1 )
479: error("ifplot : invalid argument");
1.1 noro 480: break;
481: case O_LIST:
482: list = (LIST)BDY(arg);
483: if ( OID(BDY(BDY(list))) == O_P )
484: if ( ri > 0 )
485: error("plot : invalid argument");
486: else
487: range[ri++] = list;
488: else
489: geom = list;
490: break;
491: case O_N:
492: stream = QTOS((Q)BDY(arg)); break;
493: case O_STR:
494: wname = (STRING)BDY(arg); break;
495: default:
496: error("plot : invalid argument"); break;
497: }
498: if ( !poly )
499: error("plot : invalid argument");
500: switch ( ri ) {
501: case 0:
502: MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(xrange,n);
503: break;
504: case 1:
505: av[0] = VR((P)BDY(BDY(range[0])));
506: if ( v[0] == av[0] )
507: xrange = range[0];
508: else
509: error("plot : invalid argument");
510: break;
511: default:
512: error("plot : cannot happen"); break;
513: }
514: /* conplot in ox_plot requires
1.9 noro 515: [s_id (Q),
1.1 noro 516: formula (Obj),
517: xrange=[x,xmin,xmax] (LIST),
518: yrange=0,
519: zrange=0,
520: geom=[xsize,ysize] (LIST),
521: wname=name (STRING)]
522: */
1.13 noro 523: stream = validate_ox_plot_stream(stream);
1.9 noro 524: STOQ(stream,s_id);
1.1 noro 525: if ( !geom ) {
526: STOQ(300,w300);
527: MKNODE(n0,w300,0); MKNODE(n,w300,n0); MKLIST(geom,n);
528: }
529: MKSTR(fname,"plot");
1.9 noro 530: arg = mknode(8,s_id,fname,poly,xrange,0,0,geom,wname);
1.15 ! noro 531: Pox_rpc(arg,&t);
! 532: *rp = s_id;
! 533: }
! 534:
! 535: #define Pi 3.14159265358979323846264
! 536:
! 537: void Ppolarplot(NODE arg,Q *rp)
! 538: {
! 539: Q m2,p2,w300,s_id;
! 540: NODE defrange;
! 541: LIST zrange,range[1],list,geom;
! 542: VL vl,vl0;
! 543: V v[1],av[1];
! 544: int stream,ri,i;
! 545: P poly;
! 546: P var;
! 547: NODE n,n0;
! 548: STRING fname,wname;
! 549: Real pi2;
! 550: Obj t;
! 551:
! 552: MKReal(2*Pi,pi2);
! 553: MKNODE(n,pi2,0); MKNODE(defrange,0,n);
! 554: poly = 0; vl = 0; geom = 0; wname = 0; stream = -1; ri = 0;
! 555: v[0] = 0;
! 556: for ( ; arg; arg = NEXT(arg) )
! 557: if ( !BDY(arg) )
! 558: stream = 0;
! 559: else
! 560: switch ( OID(BDY(arg)) ) {
! 561: case O_P: case O_R:
! 562: poly = (P)BDY(arg);
! 563: get_vars_recursive((Obj)poly,&vl);
! 564: for ( vl0 = vl, i = 0; vl0; vl0 = NEXT(vl0) )
! 565: if ( vl0->v->attr == (pointer)V_IND )
! 566: if ( i >= 1 )
! 567: error("polarplot : invalid argument");
! 568: else
! 569: v[i++] = vl0->v;
! 570: if ( i != 1 )
! 571: error("polarplot : invalid argument");
! 572: break;
! 573: case O_LIST:
! 574: list = (LIST)BDY(arg);
! 575: if ( OID(BDY(BDY(list))) == O_P )
! 576: if ( ri > 0 )
! 577: error("polarplot : invalid argument");
! 578: else
! 579: range[ri++] = list;
! 580: else
! 581: geom = list;
! 582: break;
! 583: case O_N:
! 584: stream = QTOS((Q)BDY(arg)); break;
! 585: case O_STR:
! 586: wname = (STRING)BDY(arg); break;
! 587: default:
! 588: error("polarplot : invalid argument"); break;
! 589: }
! 590: if ( !poly )
! 591: error("polarplot : invalid argument");
! 592: switch ( ri ) {
! 593: case 0:
! 594: MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(zrange,n);
! 595: break;
! 596: case 1:
! 597: av[0] = VR((P)BDY(BDY(range[0])));
! 598: if ( v[0] == av[0] )
! 599: zrange = range[0];
! 600: else
! 601: error("polarplot : invalid argument");
! 602: break;
! 603: default:
! 604: error("polarplot : cannot happen"); break;
! 605: }
! 606: stream = validate_ox_plot_stream(stream);
! 607: STOQ(stream,s_id);
! 608: if ( !geom ) {
! 609: STOQ(300,w300);
! 610: MKNODE(n0,w300,0); MKNODE(n,w300,n0); MKLIST(geom,n);
! 611: }
! 612: MKSTR(fname,"plot");
! 613: arg = mknode(8,s_id,fname,poly,0,0,zrange,geom,wname);
1.13 noro 614: Pox_rpc(arg,&t);
615: *rp = s_id;
1.1 noro 616: }
617:
1.13 noro 618: void Pplotover(NODE arg,Q *rp)
1.1 noro 619: {
1.9 noro 620: Q s_id,index;
1.1 noro 621: P poly;
622: STRING fname;
1.13 noro 623: Obj t;
1.1 noro 624:
625: poly = (P)ARG0(arg);
1.9 noro 626: s_id = (Q)ARG1(arg);
1.1 noro 627: index = (Q)ARG2(arg);
628: MKSTR(fname,"plotover");
1.9 noro 629: arg = mknode(4,s_id,fname,index,poly);
1.13 noro 630: Pox_rpc(arg,&t);
631: *rp = s_id;
1.1 noro 632: }
633:
1.9 noro 634: /* arg = [x,y,r,s_id,index] */
1.1 noro 635:
1.13 noro 636: void Pdrawcircle(NODE arg,Q *rp)
1.1 noro 637: {
1.9 noro 638: Q s_id,index;
1.1 noro 639: Obj x,y,r;
640: STRING fname;
641: NODE n;
642: LIST pos;
1.13 noro 643: Obj t;
1.1 noro 644:
645: x = (Obj)ARG0(arg);
646: y = (Obj)ARG1(arg);
647: r = (Obj)ARG2(arg);
1.9 noro 648: s_id = (Q)ARG3(arg);
1.1 noro 649: index = (Q)ARG4(arg);
650: MKSTR(fname,"drawcircle");
651: n = mknode(3,x,y,r); MKLIST(pos,n);
1.9 noro 652: arg = mknode(4,s_id,fname,index,pos);
1.13 noro 653: Pox_rpc(arg,&t);
654: *rp = s_id;
1.6 noro 655: }
656:
1.9 noro 657: /* draw_obj(s_id,cindex,point|line); point = [x,y], line = [xa,ya,xb,yb] */
1.13 noro 658: void Pdraw_obj(NODE arg,Q *rp)
1.6 noro 659: {
660: static STRING fname;
1.9 noro 661: Q s_id,index;
1.6 noro 662: LIST obj;
1.13 noro 663: Obj t;
1.6 noro 664:
665: if ( !fname ) {
666: MKSTR(fname,"draw_obj");
667: }
1.9 noro 668: s_id = (Q)ARG0(arg);
1.6 noro 669: index = (Q)ARG1(arg);
670: obj = (LIST)ARG2(arg);
1.7 noro 671: /* ARG3(arg) = color */
672: if ( argc(arg) == 4 )
1.9 noro 673: arg = mknode(5,s_id,fname,index,obj,ARG3(arg));
1.7 noro 674: else
1.9 noro 675: arg = mknode(4,s_id,fname,index,obj);
1.13 noro 676: Pox_cmo_rpc(arg,&t);
677: *rp = s_id;
1.12 noro 678: }
679:
680: /* draw_string(s_id,cindex,pos,string,[,color]); pos=[x,y] */
1.13 noro 681: void Pdraw_string(NODE arg,Q *rp)
1.12 noro 682: {
683: static STRING fname;
684: STRING str;
685: Q s_id,index;
686: LIST pos;
1.13 noro 687: Obj t;
1.12 noro 688:
689: if ( !fname ) {
690: MKSTR(fname,"draw_string");
691: }
692: s_id = (Q)ARG0(arg);
693: index = (Q)ARG1(arg);
694: pos = (LIST)ARG2(arg);
695: str = (STRING)ARG3(arg);
696: /* ARG4(arg) = color */
697: if ( argc(arg) == 5 )
698: arg = mknode(6,s_id,fname,index,pos,str,ARG4(arg));
699: else
700: arg = mknode(5,s_id,fname,index,pos,str);
1.13 noro 701: Pox_cmo_rpc(arg,&t);
702: *rp = s_id;
1.6 noro 703: }
704:
1.13 noro 705: void Pclear_canvas(NODE arg,Q *rp)
1.6 noro 706: {
707: static STRING fname;
1.9 noro 708: Q s_id,index;
1.13 noro 709: Obj t;
1.6 noro 710:
711: if ( !fname ) {
712: MKSTR(fname,"clear_canvas");
713: }
1.9 noro 714: s_id = (Q)ARG0(arg);
1.6 noro 715: index = (Q)ARG1(arg);
1.9 noro 716: arg = mknode(3,s_id,fname,index);
1.13 noro 717: Pox_cmo_rpc(arg,&t);
718: *rp = s_id;
1.1 noro 719: }
720:
721: #if 0
1.11 noro 722: void Parrayplot(NODE arg,Obj *rp)
1.1 noro 723: {
724: int s;
725: int id;
726:
727: if ( ID((Obj)ARG0(arg)) == O_VECT && ID((Obj)ARG1(arg)) == O_LIST ) {
728: s = current_s;
729: gensend(s,C_APLOT,0);
730: gensend(s,C_OBJ,ARG0(arg)); gensend(s,C_OBJ,ARG1(arg)); genflush(s);
731: }
732: genrecv(s,&id,rp);
733: }
734: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>