Annotation of OpenXM_contrib2/asir2000/plot/plotf.c, Revision 1.17
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.17 ! noro 48: * $OpenXM: OpenXM_contrib2/asir2000/plot/plotf.c,v 1.16 2002/10/02 01:38:04 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.17 ! noro 68: {"plotover",Pplotover,-4},
1.1 noro 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.16 noro 80: void Popen_canvas(NODE arg,Q *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);
1.16 noro 119: *rp = s_id;
1.6 noro 120: }
121:
1.13 noro 122: void Pifplot(NODE arg,Q *rp)
1.1 noro 123: {
1.9 noro 124: Q m2,p2,w300,s_id;
1.1 noro 125: NODE defrange;
126: LIST xrange,yrange,range[2],list,geom;
127: VL vl,vl0;
128: V v[2],av[2];
1.11 noro 129: int stream,ri,i;
1.1 noro 130: P poly;
131: P var;
132: NODE n,n0;
133: STRING fname,wname;
1.13 noro 134: Obj t;
1.1 noro 135:
136: STOQ(-2,m2); STOQ(2,p2);
137: MKNODE(n,p2,0); MKNODE(defrange,m2,n);
138: poly = 0; vl = 0; geom = 0; wname = 0; stream = -1; ri = 0;
1.14 noro 139: v[0] = v[1] = 0;
1.1 noro 140: for ( ; arg; arg = NEXT(arg) )
141: if ( !BDY(arg) )
142: stream = 0;
143: else
144: switch ( OID(BDY(arg)) ) {
145: case O_P:
146: poly = (P)BDY(arg);
1.11 noro 147: get_vars_recursive((Obj)poly,&vl);
1.1 noro 148: for ( vl0 = vl, i = 0; vl0; vl0 = NEXT(vl0) )
1.11 noro 149: if ( vl0->v->attr == (pointer)V_IND )
1.1 noro 150: if ( i >= 2 )
151: error("ifplot : invalid argument");
152: else
153: v[i++] = vl0->v;
154: break;
155: case O_LIST:
156: list = (LIST)BDY(arg);
157: if ( OID(BDY(BDY(list))) == O_P )
158: if ( ri > 1 )
159: error("ifplot : invalid argument");
160: else
161: range[ri++] = list;
162: else
163: geom = list;
164: break;
165: case O_N:
166: stream = QTOS((Q)BDY(arg)); break;
167: case O_STR:
168: wname = (STRING)BDY(arg); break;
169: default:
170: error("ifplot : invalid argument"); break;
171: }
172: if ( !poly )
173: error("ifplot : invalid argument");
174: switch ( ri ) {
175: case 0:
176: if ( !v[1] )
177: error("ifplot : please specify all variables");
178: MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(xrange,n);
179: MKV(v[1],var); MKNODE(n,var,defrange); MKLIST(yrange,n);
180: break;
181: case 1:
182: if ( !v[1] )
183: error("ifplot : please specify all variables");
184: av[0] = VR((P)BDY(BDY(range[0])));
185: if ( v[0] == av[0] ) {
186: xrange = range[0];
187: MKV(v[1],var); MKNODE(n,var,defrange); MKLIST(yrange,n);
188: } else if ( v[1] == av[0] ) {
189: MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(xrange,n);
190: yrange = range[0];
191: } else
192: error("ifplot : invalid argument");
193: break;
194: case 2:
195: av[0] = VR((P)BDY(BDY(range[0])));
196: av[1] = VR((P)BDY(BDY(range[1])));
197: if ( ((v[0] == av[0]) && (!v[1] || v[1] == av[1])) ||
198: ((v[0] == av[1]) && (!v[1] || v[1] == av[0])) ) {
199: xrange = range[0]; yrange = range[1];
200: } else
201: error("ifplot : invalid argument");
202: break;
203: default:
204: error("ifplot : cannot happen"); break;
205: }
206: /* ifplot in ox_plot requires
1.9 noro 207: [s_id (Q),
1.1 noro 208: formula (Obj),
209: xrange=[x,xmin,xmax] (LIST),
210: yrange=[y,ymin,ymax] (LIST),
211: zrange=0,
212: geom=[xsize,ysize] (LIST),
213: wname=name (STRING)]
214: */
215:
1.13 noro 216: stream = validate_ox_plot_stream(stream);
1.9 noro 217: STOQ(stream,s_id);
1.1 noro 218: if ( !geom ) {
219: STOQ(300,w300);
220: MKNODE(n0,w300,0); MKNODE(n,w300,n0); MKLIST(geom,n);
221: }
222: MKSTR(fname,"plot");
1.9 noro 223: arg = mknode(8,s_id,fname,poly,xrange,yrange,0,geom,wname);
1.13 noro 224: Pox_rpc(arg,&t);
225: *rp = s_id;
1.10 noro 226: }
227:
1.13 noro 228: void Pmemory_ifplot(NODE arg,Q *rp)
1.10 noro 229: {
230: Q m2,p2,w300,s_id;
231: NODE defrange;
232: LIST xrange,yrange,range[2],list,geom;
233: VL vl,vl0;
234: V v[2],av[2];
1.11 noro 235: int stream,ri,i;
1.10 noro 236: P poly;
237: P var;
238: NODE n,n0;
1.11 noro 239: STRING fname;
1.13 noro 240: Obj t;
1.10 noro 241:
242: STOQ(-2,m2); STOQ(2,p2);
243: MKNODE(n,p2,0); MKNODE(defrange,m2,n);
244: poly = 0; vl = 0; geom = 0; stream = -1; ri = 0;
245: for ( ; arg; arg = NEXT(arg) )
246: if ( !BDY(arg) )
247: stream = 0;
248: else
249: switch ( OID(BDY(arg)) ) {
250: case O_P:
251: poly = (P)BDY(arg);
1.11 noro 252: get_vars_recursive((Obj)poly,&vl);
1.10 noro 253: for ( vl0 = vl, i = 0; vl0; vl0 = NEXT(vl0) )
1.11 noro 254: if ( vl0->v->attr == (pointer)V_IND )
1.10 noro 255: if ( i >= 2 )
256: error("ifplot : invalid argument");
257: else
258: v[i++] = vl0->v;
259: break;
260: case O_LIST:
261: list = (LIST)BDY(arg);
262: if ( OID(BDY(BDY(list))) == O_P )
263: if ( ri > 1 )
264: error("ifplot : invalid argument");
265: else
266: range[ri++] = list;
267: else
268: geom = list;
269: break;
270: case O_N:
271: stream = QTOS((Q)BDY(arg)); break;
272: default:
273: error("memory_ifplot : invalid argument"); break;
274: }
275: if ( !poly )
276: error("memory_ifplot : invalid argument");
277: switch ( ri ) {
278: case 0:
279: if ( !v[1] )
280: error("memory_ifplot : please specify all variables");
281: MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(xrange,n);
282: MKV(v[1],var); MKNODE(n,var,defrange); MKLIST(yrange,n);
283: break;
284: case 1:
285: if ( !v[1] )
286: error("memory_ifplot : please specify all variables");
287: av[0] = VR((P)BDY(BDY(range[0])));
288: if ( v[0] == av[0] ) {
289: xrange = range[0];
290: MKV(v[1],var); MKNODE(n,var,defrange); MKLIST(yrange,n);
291: } else if ( v[1] == av[0] ) {
292: MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(xrange,n);
293: yrange = range[0];
294: } else
295: error("memory_ifplot : invalid argument");
296: break;
297: case 2:
298: av[0] = VR((P)BDY(BDY(range[0])));
299: av[1] = VR((P)BDY(BDY(range[1])));
300: if ( ((v[0] == av[0]) && (!v[1] || v[1] == av[1])) ||
301: ((v[0] == av[1]) && (!v[1] || v[1] == av[0])) ) {
302: xrange = range[0]; yrange = range[1];
303: } else
304: error("memory_ifplot : invalid argument");
305: break;
306: default:
307: error("memory_ifplot : cannot happen"); break;
308: }
309: /* memory_ifplot in ox_plot requires
310: [s_id (Q),
311: formula (Obj),
312: xrange=[x,xmin,xmax] (LIST),
313: yrange=[y,ymin,ymax] (LIST),
314: zrange=0,
315: geom=[xsize,ysize] (LIST)]
316: */
317:
1.13 noro 318: stream = validate_ox_plot_stream(stream);
1.10 noro 319: STOQ(stream,s_id);
320: if ( !geom ) {
321: STOQ(300,w300);
322: MKNODE(n0,w300,0); MKNODE(n,w300,n0); MKLIST(geom,n);
323: }
324: MKSTR(fname,"memory_plot");
325: arg = mknode(7,s_id,fname,poly,xrange,yrange,0,geom);
1.13 noro 326: Pox_rpc(arg,&t);
327: *rp = s_id;
1.1 noro 328: }
329:
1.13 noro 330: void Pconplot(NODE arg,Q *rp)
1.1 noro 331: {
1.9 noro 332: Q m2,p2,w300,s_id;
1.1 noro 333: NODE defrange;
334: LIST xrange,yrange,zrange,range[3],list,geom;
335: VL vl,vl0;
336: V v[2],av[2];
1.11 noro 337: int stream,ri,i;
1.1 noro 338: P poly;
339: P var;
340: NODE n,n0;
341: STRING fname,wname;
1.13 noro 342: Obj t;
1.1 noro 343:
344: STOQ(-2,m2); STOQ(2,p2);
345: MKNODE(n,p2,0); MKNODE(defrange,m2,n);
346: poly = 0; vl = 0; geom = 0; wname = 0; stream = -1; ri = 0;
1.14 noro 347: v[0] = v[1] = 0;
1.1 noro 348: for ( ; arg; arg = NEXT(arg) )
349: if ( !BDY(arg) )
350: stream = 0;
351: else
352: switch ( OID(BDY(arg)) ) {
353: case O_P:
354: poly = (P)BDY(arg);
1.11 noro 355: get_vars_recursive((Obj)poly,&vl);
1.1 noro 356: for ( vl0 = vl, i = 0; vl0; vl0 = NEXT(vl0) )
1.11 noro 357: if ( vl0->v->attr == (pointer)V_IND )
1.1 noro 358: if ( i >= 2 )
359: error("ifplot : invalid argument");
360: else
361: v[i++] = vl0->v;
362: break;
363: case O_LIST:
364: list = (LIST)BDY(arg);
365: if ( OID(BDY(BDY(list))) == O_P )
366: if ( ri > 2 )
367: error("ifplot : invalid argument");
368: else
369: range[ri++] = list;
370: else
371: geom = list;
372: break;
373: case O_N:
374: stream = QTOS((Q)BDY(arg)); break;
375: case O_STR:
376: wname = (STRING)BDY(arg); break;
377: default:
378: error("ifplot : invalid argument"); break;
379: }
380: if ( !poly )
381: error("ifplot : invalid argument");
382: switch ( ri ) {
383: case 0:
384: if ( !v[1] )
385: error("ifplot : please specify all variables");
386: MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(xrange,n);
387: MKV(v[1],var); MKNODE(n,var,defrange); MKLIST(yrange,n);
388: MKNODE(n,0,defrange); MKLIST(zrange,n);
389: break;
390: case 1:
391: if ( !v[1] )
392: error("ifplot : please specify all variables");
393: av[0] = VR((P)BDY(BDY(range[0])));
394: if ( v[0] == av[0] ) {
395: xrange = range[0];
396: MKV(v[1],var); MKNODE(n,var,defrange); MKLIST(yrange,n);
397: MKNODE(n,0,defrange); MKLIST(zrange,n);
398: } else if ( v[1] == av[0] ) {
399: MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(xrange,n);
400: yrange = range[0];
401: MKNODE(n,0,defrange); MKLIST(zrange,n);
402: } else {
403: MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(xrange,n);
404: MKV(v[1],var); MKNODE(n,var,defrange); MKLIST(yrange,n);
405: zrange = range[0];
406: }
407: break;
408: case 2: case 3:
409: av[0] = VR((P)BDY(BDY(range[0])));
410: av[1] = VR((P)BDY(BDY(range[1])));
411: if ( ((v[0] == av[0]) && (!v[1] || v[1] == av[1])) ||
412: ((v[0] == av[1]) && (!v[1] || v[1] == av[0])) ) {
413: xrange = range[0]; yrange = range[1];
414: if ( ri == 3 )
415: zrange = range[2];
416: else {
417: MKNODE(n,0,defrange); MKLIST(zrange,n);
418: }
419: } else
420: error("ifplot : invalid argument");
421: break;
422: default:
423: error("ifplot : cannot happen"); break;
424: }
425: /* conplot in ox_plot requires
1.9 noro 426: [s_id (Q),
1.1 noro 427: formula (Obj),
428: xrange=[x,xmin,xmax] (LIST),
429: yrange=[y,ymin,ymax] (LIST),
430: zrange=[z,zmin,zmax] (LIST),
431: geom=[xsize,ysize] (LIST),
432: wname=name (STRING)]
433: */
434:
1.13 noro 435: stream = validate_ox_plot_stream(stream);
1.9 noro 436: STOQ(stream,s_id);
1.1 noro 437: if ( !geom ) {
438: STOQ(300,w300);
439: MKNODE(n0,w300,0); MKNODE(n,w300,n0); MKLIST(geom,n);
440: }
441: MKSTR(fname,"plot");
1.9 noro 442: arg = mknode(8,s_id,fname,poly,xrange,yrange,zrange,geom,wname);
1.13 noro 443: Pox_rpc(arg,&t);
444: *rp = s_id;
1.1 noro 445: }
446:
1.13 noro 447: void Pplot(NODE arg,Q *rp)
1.1 noro 448: {
1.9 noro 449: Q m2,p2,w300,s_id;
1.1 noro 450: NODE defrange;
451: LIST xrange,range[1],list,geom;
452: VL vl,vl0;
453: V v[1],av[1];
1.11 noro 454: int stream,ri,i;
1.1 noro 455: P poly;
456: P var;
457: NODE n,n0;
458: STRING fname,wname;
1.13 noro 459: Obj t;
1.1 noro 460:
461: STOQ(-2,m2); STOQ(2,p2);
462: MKNODE(n,p2,0); MKNODE(defrange,m2,n);
463: poly = 0; vl = 0; geom = 0; wname = 0; stream = -1; ri = 0;
1.14 noro 464: v[0] = 0;
1.1 noro 465: for ( ; arg; arg = NEXT(arg) )
466: if ( !BDY(arg) )
467: stream = 0;
468: else
469: switch ( OID(BDY(arg)) ) {
470: case O_P: case O_R:
471: poly = (P)BDY(arg);
1.11 noro 472: get_vars_recursive((Obj)poly,&vl);
1.1 noro 473: for ( vl0 = vl, i = 0; vl0; vl0 = NEXT(vl0) )
1.11 noro 474: if ( vl0->v->attr == (pointer)V_IND )
1.1 noro 475: if ( i >= 1 )
476: error("ifplot : invalid argument");
477: else
478: v[i++] = vl0->v;
1.8 noro 479: if ( i != 1 )
480: error("ifplot : invalid argument");
1.1 noro 481: break;
482: case O_LIST:
483: list = (LIST)BDY(arg);
484: if ( OID(BDY(BDY(list))) == O_P )
485: if ( ri > 0 )
486: error("plot : invalid argument");
487: else
488: range[ri++] = list;
489: else
490: geom = list;
491: break;
492: case O_N:
493: stream = QTOS((Q)BDY(arg)); break;
494: case O_STR:
495: wname = (STRING)BDY(arg); break;
496: default:
497: error("plot : invalid argument"); break;
498: }
499: if ( !poly )
500: error("plot : invalid argument");
501: switch ( ri ) {
502: case 0:
503: MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(xrange,n);
504: break;
505: case 1:
506: av[0] = VR((P)BDY(BDY(range[0])));
507: if ( v[0] == av[0] )
508: xrange = range[0];
509: else
510: error("plot : invalid argument");
511: break;
512: default:
513: error("plot : cannot happen"); break;
514: }
515: /* conplot in ox_plot requires
1.9 noro 516: [s_id (Q),
1.1 noro 517: formula (Obj),
518: xrange=[x,xmin,xmax] (LIST),
519: yrange=0,
520: zrange=0,
521: geom=[xsize,ysize] (LIST),
522: wname=name (STRING)]
523: */
1.13 noro 524: stream = validate_ox_plot_stream(stream);
1.9 noro 525: STOQ(stream,s_id);
1.1 noro 526: if ( !geom ) {
527: STOQ(300,w300);
528: MKNODE(n0,w300,0); MKNODE(n,w300,n0); MKLIST(geom,n);
529: }
530: MKSTR(fname,"plot");
1.9 noro 531: arg = mknode(8,s_id,fname,poly,xrange,0,0,geom,wname);
1.15 noro 532: Pox_rpc(arg,&t);
533: *rp = s_id;
534: }
535:
536: #define Pi 3.14159265358979323846264
537:
538: void Ppolarplot(NODE arg,Q *rp)
539: {
540: Q m2,p2,w300,s_id;
541: NODE defrange;
542: LIST zrange,range[1],list,geom;
543: VL vl,vl0;
544: V v[1],av[1];
545: int stream,ri,i;
546: P poly;
547: P var;
548: NODE n,n0;
549: STRING fname,wname;
550: Real pi2;
551: Obj t;
552:
553: MKReal(2*Pi,pi2);
554: MKNODE(n,pi2,0); MKNODE(defrange,0,n);
555: poly = 0; vl = 0; geom = 0; wname = 0; stream = -1; ri = 0;
556: v[0] = 0;
557: for ( ; arg; arg = NEXT(arg) )
558: if ( !BDY(arg) )
559: stream = 0;
560: else
561: switch ( OID(BDY(arg)) ) {
562: case O_P: case O_R:
563: poly = (P)BDY(arg);
564: get_vars_recursive((Obj)poly,&vl);
565: for ( vl0 = vl, i = 0; vl0; vl0 = NEXT(vl0) )
566: if ( vl0->v->attr == (pointer)V_IND )
567: if ( i >= 1 )
568: error("polarplot : invalid argument");
569: else
570: v[i++] = vl0->v;
571: if ( i != 1 )
572: error("polarplot : invalid argument");
573: break;
574: case O_LIST:
575: list = (LIST)BDY(arg);
576: if ( OID(BDY(BDY(list))) == O_P )
577: if ( ri > 0 )
578: error("polarplot : invalid argument");
579: else
580: range[ri++] = list;
581: else
582: geom = list;
583: break;
584: case O_N:
585: stream = QTOS((Q)BDY(arg)); break;
586: case O_STR:
587: wname = (STRING)BDY(arg); break;
588: default:
589: error("polarplot : invalid argument"); break;
590: }
591: if ( !poly )
592: error("polarplot : invalid argument");
593: switch ( ri ) {
594: case 0:
595: MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(zrange,n);
596: break;
597: case 1:
598: av[0] = VR((P)BDY(BDY(range[0])));
599: if ( v[0] == av[0] )
600: zrange = range[0];
601: else
602: error("polarplot : invalid argument");
603: break;
604: default:
605: error("polarplot : cannot happen"); break;
606: }
607: stream = validate_ox_plot_stream(stream);
608: STOQ(stream,s_id);
609: if ( !geom ) {
610: STOQ(300,w300);
611: MKNODE(n0,w300,0); MKNODE(n,w300,n0); MKLIST(geom,n);
612: }
613: MKSTR(fname,"plot");
614: arg = mknode(8,s_id,fname,poly,0,0,zrange,geom,wname);
1.13 noro 615: Pox_rpc(arg,&t);
616: *rp = s_id;
1.1 noro 617: }
618:
1.13 noro 619: void Pplotover(NODE arg,Q *rp)
1.1 noro 620: {
1.9 noro 621: Q s_id,index;
1.1 noro 622: P poly;
623: STRING fname;
1.13 noro 624: Obj t;
1.1 noro 625:
626: poly = (P)ARG0(arg);
1.9 noro 627: s_id = (Q)ARG1(arg);
1.1 noro 628: index = (Q)ARG2(arg);
629: MKSTR(fname,"plotover");
1.17 ! noro 630: if ( argc(arg) == 4 )
! 631: arg = mknode(5,s_id,fname,index,poly,(Q)ARG3(arg));
! 632: else
! 633: arg = mknode(4,s_id,fname,index,poly);
1.13 noro 634: Pox_rpc(arg,&t);
635: *rp = s_id;
1.1 noro 636: }
637:
1.9 noro 638: /* arg = [x,y,r,s_id,index] */
1.1 noro 639:
1.13 noro 640: void Pdrawcircle(NODE arg,Q *rp)
1.1 noro 641: {
1.9 noro 642: Q s_id,index;
1.1 noro 643: Obj x,y,r;
644: STRING fname;
645: NODE n;
646: LIST pos;
1.13 noro 647: Obj t;
1.1 noro 648:
649: x = (Obj)ARG0(arg);
650: y = (Obj)ARG1(arg);
651: r = (Obj)ARG2(arg);
1.9 noro 652: s_id = (Q)ARG3(arg);
1.1 noro 653: index = (Q)ARG4(arg);
654: MKSTR(fname,"drawcircle");
655: n = mknode(3,x,y,r); MKLIST(pos,n);
1.9 noro 656: arg = mknode(4,s_id,fname,index,pos);
1.13 noro 657: Pox_rpc(arg,&t);
658: *rp = s_id;
1.6 noro 659: }
660:
1.9 noro 661: /* draw_obj(s_id,cindex,point|line); point = [x,y], line = [xa,ya,xb,yb] */
1.13 noro 662: void Pdraw_obj(NODE arg,Q *rp)
1.6 noro 663: {
664: static STRING fname;
1.9 noro 665: Q s_id,index;
1.6 noro 666: LIST obj;
1.13 noro 667: Obj t;
1.6 noro 668:
669: if ( !fname ) {
670: MKSTR(fname,"draw_obj");
671: }
1.9 noro 672: s_id = (Q)ARG0(arg);
1.6 noro 673: index = (Q)ARG1(arg);
674: obj = (LIST)ARG2(arg);
1.7 noro 675: /* ARG3(arg) = color */
676: if ( argc(arg) == 4 )
1.9 noro 677: arg = mknode(5,s_id,fname,index,obj,ARG3(arg));
1.7 noro 678: else
1.9 noro 679: arg = mknode(4,s_id,fname,index,obj);
1.13 noro 680: Pox_cmo_rpc(arg,&t);
681: *rp = s_id;
1.12 noro 682: }
683:
684: /* draw_string(s_id,cindex,pos,string,[,color]); pos=[x,y] */
1.13 noro 685: void Pdraw_string(NODE arg,Q *rp)
1.12 noro 686: {
687: static STRING fname;
688: STRING str;
689: Q s_id,index;
690: LIST pos;
1.13 noro 691: Obj t;
1.12 noro 692:
693: if ( !fname ) {
694: MKSTR(fname,"draw_string");
695: }
696: s_id = (Q)ARG0(arg);
697: index = (Q)ARG1(arg);
698: pos = (LIST)ARG2(arg);
699: str = (STRING)ARG3(arg);
700: /* ARG4(arg) = color */
701: if ( argc(arg) == 5 )
702: arg = mknode(6,s_id,fname,index,pos,str,ARG4(arg));
703: else
704: arg = mknode(5,s_id,fname,index,pos,str);
1.13 noro 705: Pox_cmo_rpc(arg,&t);
706: *rp = s_id;
1.6 noro 707: }
708:
1.13 noro 709: void Pclear_canvas(NODE arg,Q *rp)
1.6 noro 710: {
711: static STRING fname;
1.9 noro 712: Q s_id,index;
1.13 noro 713: Obj t;
1.6 noro 714:
715: if ( !fname ) {
716: MKSTR(fname,"clear_canvas");
717: }
1.9 noro 718: s_id = (Q)ARG0(arg);
1.6 noro 719: index = (Q)ARG1(arg);
1.9 noro 720: arg = mknode(3,s_id,fname,index);
1.13 noro 721: Pox_cmo_rpc(arg,&t);
722: *rp = s_id;
1.1 noro 723: }
724:
725: #if 0
1.11 noro 726: void Parrayplot(NODE arg,Obj *rp)
1.1 noro 727: {
728: int s;
729: int id;
730:
731: if ( ID((Obj)ARG0(arg)) == O_VECT && ID((Obj)ARG1(arg)) == O_LIST ) {
732: s = current_s;
733: gensend(s,C_APLOT,0);
734: gensend(s,C_OBJ,ARG0(arg)); gensend(s,C_OBJ,ARG1(arg)); genflush(s);
735: }
736: genrecv(s,&id,rp);
737: }
738: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>