Annotation of OpenXM_contrib2/asir2000/plot/plotf.c, Revision 1.31
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.31 ! noro 48: * $OpenXM: OpenXM_contrib2/asir2000/plot/plotf.c,v 1.30 2014/07/31 15:52:13 saito 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:
1.26 saito 55: int validate_ox_plot_stream(int);
1.24 saito 56: void ListCheck(char *,LIST);
1.26 saito 57: void Pplot(NODE,Obj *);
58: void Ppolarplot(NODE,Obj *);
59: void Pobj_cp(NODE,Obj *),Parrayplot(NODE,Obj*),Pdrawcircle(NODE,Obj*);
1.24 saito 60: void Pifplot(NODE,Obj *),Pconplot(NODE,Obj *),Pplotover(NODE,Obj *);
1.26 saito 61: void Pmemory_ifplot(NODE,Obj *),Pmemory_conplot(NODE,Obj *);
62: void Pmemory_plot(NODE,Obj *);
63: void ifplot_main(NODE,int,char *,Obj *);
64: void plot_main(NODE,int,char *,Obj *);
65: void conplot_main(NODE,int,Obj *);
1.24 saito 66:
67: void Popen_canvas(NODE,Obj *),Pclear_canvas(NODE,Obj *),Pdraw_obj(NODE,Obj *);
68: void Pdraw_string(NODE,Obj *);
1.26 saito 69: void Pox_rpc(NODE,Obj *), Pox_cmo_rpc(NODE,Obj *);
1.1 noro 70:
1.24 saito 71: //NG
72: #if defined(INTERVAL)
73: void Pitvifplot(NODE, Obj *);
74: #endif
75: void PifplotD(NODE,Obj *),PifplotQ(NODE,Obj *),PifplotB(NODE,Obj *);
76: void PineqnD(NODE,Obj *), PineqnQ(NODE,Obj *), PineqnB(NODE,Obj *);
77: void PineqnandD(NODE,Obj *), PineqnandQ(NODE,Obj *), PineqnandB(NODE,Obj *);
78: void PineqnorD(NODE,Obj *), PineqnorQ(NODE,Obj *), PineqnorB(NODE,Obj *);
79: void PineqnxorD(NODE,Obj *), PineqnxorQ(NODE,Obj *), PineqnxorB(NODE,Obj *);
80: void PconplotD(NODE,Obj *),PconplotQ(NODE,Obj *),PconplotB(NODE,Obj *);
1.29 saito 81: void PpolarplotD(NODE,Obj *);
1.24 saito 82: void PplotoverD(NODE,Obj *),PplotoverQ(NODE,Obj *),PplotoverB(NODE,Obj *);
1.26 saito 83: void ifplot_mainNG(NODE,char *,Obj *);
84: void conplot_mainNG(NODE,char *,Obj *);
85: void plotover_mainNG(NODE,char *,Obj *);
1.24 saito 86:
87: struct ftab plot_tab[]={
1.26 saito 88: {PLOT,Pplot,-7},
1.22 saito 89: #if defined(INTERVAL)
1.26 saito 90: {ITVIFPLOT,Pitvifplot,-8},
1.24 saito 91: #endif
1.29 saito 92: {OBJ_CP,Pobj_cp,4},
1.26 saito 93: {POLARPLOT,Ppolarplot,-6},
1.29 saito 94: {POLARPLOTD,PpolarplotD,-7},
1.26 saito 95: {IFPLOT,Pifplot,-7},
96: {IFPLOTD,PifplotD,-8},
97: {IFPLOTQ,PifplotQ,-8},
98: {IFPLOTB,PifplotB,-8},
99: {INEQN,PineqnD,-8},
100: {INEQND,PineqnD,-8},
101: {INEQNQ,PineqnQ,-8},
102: {INEQNB,PineqnB,-8},
103: {INEQNAND,PineqnandD,-4},
104: {INEQNDAND,PineqnandD,-4},
105: {INEQNQAND,PineqnandQ,-4},
106: {INEQNBAND,PineqnandB,-4},
107: {INEQNOR,PineqnorD,-4},
108: {INEQNDOR,PineqnorD,-4},
109: {INEQNQOR,PineqnorQ,-4},
110: {INEQNBOR,PineqnorB,-4},
111: {INEQNXOR,PineqnxorD,-4},
112: {INEQNDXOR,PineqnxorD,-4},
113: {INEQNQXOR,PineqnxorQ,-4},
114: {INEQNBXOR,PineqnxorB,-4},
115: {CONPLOT,Pconplot,-7},
116: {CONPLOTD,PconplotD,-8},
117: {CONPLOTB,PconplotB,-8},
118: {CONPLOTQ,PconplotQ,-8},
119: {PLOTOVER,Pplotover,-4},
120: {PLOTOVERD,PplotoverD,-4},
121: {PLOTOVERQ,PplotoverQ,-4},
122: {PLOTOVERB,PplotoverB,-4},
1.29 saito 123: {MEMORY_IFPLOT,Pmemory_ifplot,-7},
1.26 saito 124: {MEMORY_CONPLOT,Pmemory_conplot,-7},
1.29 saito 125: {MEMORY_PLOT,Pmemory_plot,-7},
1.28 ohara 126: {DRAWCIRCLE,Pdrawcircle,6},
1.26 saito 127: {OPEN_CANVAS,Popen_canvas,-3},
128: {CLEAR_CANVAS,Pclear_canvas,2},
1.28 ohara 129: {DRAW_OBJ,Pdraw_obj,-4},
130: {DRAW_STRING,Pdraw_string,-5},
1.1 noro 131: {0,0,0},
132: };
1.26 saito 133: char *pfn[]={
134: IFPLOT,CONPLOT,PLOT,INTERACTIVE,POLARPLOT,PLOTOVER,
135: IFPLOTD,IFPLOTQ,IFPLOTB,INEQND,INEQNQ,INEQNB,
136: INEQNDAND,INEQNQAND,INEQNBAND,
137: INEQNDOR,INEQNQOR,INEQNBOR,
138: INEQNDXOR,INEQNQXOR,INEQNBXOR,
139: CONPLOTD,CONPLOTQ,CONPLOTB,ITVIFPLOT,
140: PLOTOVERD,PLOTOVERQ,PLOTOVERB,
141: MEMORY_IFPLOT,MEMORY_CONPLOT,MEMORY_PLOT,ARRAYPLOT,OPEN_CANVAS,
1.29 saito 142: DRAWCIRCLE,DRAW_OBJ,DRAW_STRING,OBJ_CP,CLEAR_CANVAS,POLARPLOTD};
1.26 saito 143: /*
144: IFPLOT:0,CONPLOT:1,PLOT:2,INTERACTIVE:3,POLARPLOT:4,PLOTOVER:5,
145: IFPLOTD:6,IFPLOTQ:7,IFPLOTB:8,INEQND:9,INEQNQ:10,INEQNB:11,
146: INEQNDAND:12,INEQNQAND:13,INEQNBAND:14,
147: INEQNDOR:15,INEQNQOR:16,INEQNBOR:17,
148: INEQNDXOR:18,INEQNQXOR:19,INEQNBXOR:20,
149: CONPLOTD:21,CONPLOTQ:22,CONPLOTB:23,ITVIFPLOT:24,
150: PLOTOVERD:25,PLOTOVERQ:26,PLOTOVERB:27,
151: MEMORY_IFPLOT:28,MEMORY_CONPLOT:29,MEMORY_PLOT:30,ARRAYPLOT:31,
152: OPEN_CANVAS:32,DRAWCIRCLE:33,DRAW_OBJ:34,DRAW_STRING:35,OBJ_CP:36,
1.29 saito 153: CLEAR_CANVAS:37,POLARPLOTD:38
1.26 saito 154: */
155: int modeNO(char *fn){
156: int i;
157: char **z;
158: for(i=0,z=pfn;*z!=NULL;z++,i++)if(!strcmp(fn,*z))return i;
159: return -1;
160: }
1.1 noro 161:
1.24 saito 162: void Popen_canvas(NODE arg,Obj *rp){
1.9 noro 163: Q w300,s_id;
1.6 noro 164: LIST geom;
1.11 noro 165: int stream;
1.6 noro 166: NODE n,n0;
167: STRING fname,wname;
168:
1.24 saito 169: geom=0;wname=0;stream=-1;
170: for(;arg;arg=NEXT(arg))
171: if(!BDY(arg)) stream=0;
172: else switch (OID(BDY(arg))){
173: case O_LIST:
174: geom=(LIST)BDY(arg);
175: break;
176: case O_N:
177: stream=QTOS((Q)BDY(arg));
178: break;
179: case O_STR:
180: wname=(STRING)BDY(arg);
181: break;
182: default:
183: error("open_canvas : invalid argument");
184: break;
1.6 noro 185: }
1.24 saito 186: stream=validate_ox_plot_stream(stream);
1.9 noro 187: STOQ(stream,s_id);
1.24 saito 188: if(!geom){
1.6 noro 189: STOQ(300,w300);
1.24 saito 190: MKNODE(n0,w300,0);
191: MKNODE(n,w300,n0);
192: MKLIST(geom,n);
1.6 noro 193: }
1.26 saito 194: MKSTR(fname,OPEN_CANVAS);
1.24 saito 195: arg=mknode(4,s_id,fname,geom,wname);
1.6 noro 196: Pox_cmo_rpc(arg,rp);
1.24 saito 197: *rp=(Obj)s_id;
1.6 noro 198: }
199:
1.26 saito 200: void Pifplot(NODE arg,Obj *rp){ifplot_main(arg,0,IFPLOT,rp);}
201: void Pmemory_ifplot(NODE arg,Obj *rp){ifplot_main(arg,1,IFPLOT,rp);}
1.18 noro 202:
1.26 saito 203: void ifplot_main(NODE arg,int is_memory,char *fn,Obj *rp){
1.9 noro 204: Q m2,p2,w300,s_id;
1.1 noro 205: NODE defrange;
1.26 saito 206: LIST xrange,yrange,zrange,range[2],list,geom;
1.1 noro 207: VL vl,vl0;
208: V v[2],av[2];
1.22 saito 209: int stream,ri,i,sign;
1.24 saito 210: P poly,var;
1.22 saito 211: NODE n,n0;
212: STRING fname,wname;
213: Obj t;
214:
1.24 saito 215: STOQ(-2,m2);STOQ(2,p2);MKNODE(n,p2,0);MKNODE(defrange,m2,n);
1.26 saito 216: poly=0;vl=0;geom=0;wname=0;stream=-1;ri=0;xrange=0;yrange=0;zrange=0;
1.24 saito 217: v[0]=v[1]=0;
218: for(;arg;arg=NEXT(arg))
219: if(!BDY(arg))stream=0;
1.22 saito 220: else
1.24 saito 221: switch(OID(BDY(arg))){
1.22 saito 222: case O_P:
1.24 saito 223: poly=(P)BDY(arg);
1.22 saito 224: get_vars_recursive((Obj)poly,&vl);
1.26 saito 225: for(vl0=vl,i=0;vl0;vl0=NEXT(vl0)){
226: if(vl0->v->attr==(pointer)V_IND){
1.24 saito 227: if(i>=2)error("ifplot : invalid argument");
228: else v[i++]=vl0->v;
1.26 saito 229: }
230: }
1.22 saito 231: break;
232: case O_LIST:
1.24 saito 233: list=(LIST)BDY(arg);
234: if(OID(BDY(BDY(list)))==O_P)
235: if(ri>1) error("ifplot : invalid argument");
236: else range[ri++]=list;
237: else geom=list;
1.22 saito 238: break;
239: case O_N:
1.24 saito 240: stream=QTOS((Q)BDY(arg));break;
1.22 saito 241: case O_STR:
1.24 saito 242: wname=(STRING)BDY(arg);break;
1.22 saito 243: default:
1.24 saito 244: error("ifplot : invalid argument");break;
1.22 saito 245: }
1.24 saito 246: if(!poly) error("ifplot : invalid argument");
247: switch(ri){
1.22 saito 248: case 0:
1.24 saito 249: if(!v[1]) error("ifplot : please specify all variables");
250: MKV(v[0],var);MKNODE(n,var,defrange);MKLIST(xrange,n);
251: MKV(v[1],var);MKNODE(n,var,defrange);MKLIST(yrange,n);
1.22 saito 252: break;
253: case 1:
1.24 saito 254: if(!v[1]) error("ifplot : please specify all variables");
255: av[0]=VR((P)BDY(BDY(range[0])));
256: if(v[0]==av[0]){
257: xrange=range[0];
258: MKV(v[1],var);MKNODE(n,var,defrange);MKLIST(yrange,n);
259: } else if(v[1]==av[0]){
260: MKV(v[0],var);MKNODE(n,var,defrange);MKLIST(xrange,n);
261: yrange=range[0];
1.22 saito 262: } else error("ifplot : invalid argument");
263: break;
264: case 2:
1.24 saito 265: av[0]=VR((P)BDY(BDY(range[0])));
266: av[1]=VR((P)BDY(BDY(range[1])));
267: if(((v[0]==av[0])&&(!v[1]||v[1]==av[1]))||
268: ((v[0]==av[1])&&(!v[1]||v[1]==av[0]))){
269: xrange=range[0];yrange=range[1];
1.22 saito 270: } else error("ifplot : invalid argument");
271: break;
272: default:
1.24 saito 273: error("ifplot : cannot happen");break;
1.22 saito 274: }
275: /* ifplot in ox_plot requires
276: [s_id (Q),
277: formula (Obj),
278: xrange=[x,xmin,xmax] (LIST),
279: yrange=[y,ymin,ymax] (LIST),
280: zrange=0,
281: geom=[xsize,ysize] (LIST),
282: wname=name (STRING)]
283: */
1.24 saito 284: stream=validate_ox_plot_stream(stream);
1.22 saito 285: STOQ(stream,s_id);
1.24 saito 286: if(!geom){
287: STOQ(300,w300);MKNODE(n0,w300,0);MKNODE(n,w300,n0);MKLIST(geom,n);
1.22 saito 288: }
1.24 saito 289: if(is_memory){
1.26 saito 290: MKSTR(fname,MEMORY_PLOT);
291: arg=mknode(8,s_id,fname,poly,xrange,yrange,zrange,geom);
1.22 saito 292: Pox_rpc(arg,&t);
1.24 saito 293: arg=mknode(1,s_id);
1.22 saito 294: Pox_pop_cmo(arg,rp);
295: } else {
1.26 saito 296: MKSTR(fname,fn);
297: arg=mknode(8,s_id,fname,poly,xrange,yrange,zrange,geom,wname);
1.22 saito 298: Pox_rpc(arg,&t);
1.24 saito 299: *rp=(Obj)s_id;
1.22 saito 300: }
301: }
302:
1.24 saito 303: void Pconplot(NODE arg,Obj *rp){conplot_main(arg, 0, rp);}
304: void Pmemory_conplot(NODE arg,Obj *rp){conplot_main(arg,1,rp);}
1.22 saito 305:
1.24 saito 306: void conplot_main(NODE arg,int is_memory,Obj *rp){
1.29 saito 307: Q m2,p2,w300,s_id;
308: NODE defrange;
1.24 saito 309: LIST xrange,yrange,zrange,range[3],list,geom;
1.22 saito 310: VL vl,vl0;
311: V v[2],av[2];
1.29 saito 312: int stream,ri,i;
313: P poly;
314: P var;
315: NODE n,n0;
1.22 saito 316: STRING fname,wname;
317: Obj t;
318:
1.29 saito 319: STOQ(-2,m2); STOQ(2,p2);
320: MKNODE(n,p2,0); MKNODE(defrange,m2,n);
321: poly = 0; vl = 0; geom = 0; wname = 0; stream = -1; ri = 0;
322: v[0] = v[1] = 0;
323: for ( ; arg; arg = NEXT(arg) )
324: if ( !BDY(arg) )
325: stream = 0;
326: else
327: switch ( OID(BDY(arg)) ) {
1.22 saito 328: case O_P:
1.29 saito 329: poly = (P)BDY(arg);
1.22 saito 330: get_vars_recursive((Obj)poly,&vl);
1.29 saito 331: for ( vl0 = vl, i = 0; vl0; vl0 = NEXT(vl0) )
332: if ( vl0->v->attr == (pointer)V_IND )
333: if ( i >= 2 )
334: error("ifplot : invalid argument");
335: else
336: v[i++] = vl0->v;
1.22 saito 337: break;
338: case O_LIST:
1.29 saito 339: list = (LIST)BDY(arg);
340: if ( OID(BDY(BDY(list))) == O_P )
341: if ( ri > 2 )
342: error("ifplot : invalid argument");
343: else
344: range[ri++] = list;
345: else
346: geom = list;
1.22 saito 347: break;
348: case O_N:
1.29 saito 349: stream = QTOS((Q)BDY(arg)); break;
1.22 saito 350: case O_STR:
1.29 saito 351: wname = (STRING)BDY(arg); break;
1.1 noro 352: default:
1.29 saito 353: error("ifplot : invalid argument"); break;
1.1 noro 354: }
1.29 saito 355: if ( !poly )
356: error("ifplot : invalid argument");
357: switch ( ri ) {
1.1 noro 358: case 0:
1.29 saito 359: if ( !v[1] )
360: error("ifplot : please specify all variables");
361: MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(xrange,n);
362: MKV(v[1],var); MKNODE(n,var,defrange); MKLIST(yrange,n);
363: MKNODE(n,0,defrange); MKLIST(zrange,n);
1.1 noro 364: break;
365: case 1:
1.29 saito 366: if ( !v[1] )
367: error("ifplot : please specify all variables");
368: av[0] = VR((P)BDY(BDY(range[0])));
369: if ( v[0] == av[0] ) {
370: xrange = range[0];
371: MKV(v[1],var); MKNODE(n,var,defrange); MKLIST(yrange,n);
372: MKNODE(n,0,defrange); MKLIST(zrange,n);
373: } else if ( v[1] == av[0] ) {
374: MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(xrange,n);
375: yrange = range[0];
376: MKNODE(n,0,defrange); MKLIST(zrange,n);
1.1 noro 377: } else {
1.29 saito 378: MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(xrange,n);
379: MKV(v[1],var); MKNODE(n,var,defrange); MKLIST(yrange,n);
380: zrange = range[0];
1.1 noro 381: }
382: break;
1.29 saito 383: case 2: case 3:
384: av[0] = VR((P)BDY(BDY(range[0])));
385: av[1] = VR((P)BDY(BDY(range[1])));
386: if ( ((v[0] == av[0]) && (!v[1] || v[1] == av[1])) ||
387: ((v[0] == av[1]) && (!v[1] || v[1] == av[0])) ) {
388: xrange = range[0]; yrange = range[1];
389: if ( ri == 3 )
390: zrange = range[2];
1.1 noro 391: else {
1.29 saito 392: MKNODE(n,0,defrange); MKLIST(zrange,n);
1.1 noro 393: }
1.29 saito 394: } else
395: error("ifplot : invalid argument");
1.1 noro 396: break;
397: default:
1.29 saito 398: error("ifplot : cannot happen"); break;
1.1 noro 399: }
400: /* conplot in ox_plot requires
1.9 noro 401: [s_id (Q),
1.1 noro 402: formula (Obj),
403: xrange=[x,xmin,xmax] (LIST),
404: yrange=[y,ymin,ymax] (LIST),
1.29 saito 405: zrange=[z,zmin,zmax] (LIST),
1.1 noro 406: geom=[xsize,ysize] (LIST),
407: wname=name (STRING)]
408: */
1.29 saito 409:
410: stream = validate_ox_plot_stream(stream);
1.9 noro 411: STOQ(stream,s_id);
1.29 saito 412: if ( !geom ) {
1.1 noro 413: STOQ(300,w300);
1.29 saito 414: MKNODE(n0,w300,0); MKNODE(n,w300,n0); MKLIST(geom,n);
1.1 noro 415: }
1.29 saito 416: if ( is_memory ) {
417: MKSTR(fname,"memory_plot");
418: arg = mknode(7,s_id,fname,poly,xrange,yrange,zrange,geom);
1.18 noro 419: Pox_rpc(arg,&t);
1.29 saito 420: arg = mknode(1,s_id);
1.18 noro 421: Pox_pop_cmo(arg,rp);
422: } else {
1.26 saito 423: MKSTR(fname,CONPLOT);
1.29 saito 424: arg = mknode(8,s_id,fname,poly,xrange,yrange,zrange,geom,wname);
1.18 noro 425: Pox_rpc(arg,&t);
1.29 saito 426: *rp = (Obj)s_id;
1.18 noro 427: }
428: }
429:
1.26 saito 430: void Pplot(NODE arg,Obj *rp){plot_main(arg,0,PLOT,rp);}
431: void Pmemory_plot(NODE arg,Obj *rp){plot_main(arg,1,PLOT,rp);}
1.1 noro 432:
1.26 saito 433: void plot_main(NODE arg,int is_memory,char *fn,Obj *rp){
1.9 noro 434: Q m2,p2,w300,s_id;
1.1 noro 435: NODE defrange;
436: LIST xrange,range[1],list,geom;
437: VL vl,vl0;
438: V v[1],av[1];
1.31 ! noro 439: int stream,ri,i,found_f;
1.1 noro 440: P poly;
441: P var;
442: NODE n,n0;
443: STRING fname,wname;
1.13 noro 444: Obj t;
1.1 noro 445:
1.24 saito 446: STOQ(-2,m2);STOQ(2,p2);
447: MKNODE(n,p2,0);MKNODE(defrange,m2,n);
448: poly=0;vl=0;geom=0;wname=0;stream=-1;ri=0;
449: v[0]=0;
1.31 ! noro 450: found_f = 0;
1.24 saito 451: for(;arg;arg=NEXT(arg) )
452: if(!BDY(arg) )
453: stream=0;
1.1 noro 454: else
1.24 saito 455: switch ( OID(BDY(arg)) ){
1.1 noro 456: case O_P: case O_R:
1.24 saito 457: poly=(P)BDY(arg);
1.11 noro 458: get_vars_recursive((Obj)poly,&vl);
1.26 saito 459: for(vl0=vl, i=0;vl0;vl0=NEXT(vl0) ){
460: if(vl0->v->attr==(pointer)V_IND ){
461: if(i >= 1 ) error("ifplot : invalid argument");
462: else v[i++]=vl0->v;
463: }
464: }
465: if(i != 1 ) error("ifplot : invalid argument");
1.31 ! noro 466: found_f = 1;
1.1 noro 467: break;
468: case O_LIST:
1.24 saito 469: list=(LIST)BDY(arg);
1.26 saito 470: if(OID(BDY(BDY(list)))==O_P ){
471: if(ri > 0 ) error("plot : invalid argument");
472: else range[ri++]=list;
473: } else geom=list;
1.1 noro 474: break;
475: case O_N:
1.31 ! noro 476: if ( !found_f ) {
! 477: poly = (P)BDY(arg);
! 478: makevar("x",&var);
! 479: v[0] = VR(var);
! 480: } else
! 481: stream=QTOS((Q)BDY(arg));
! 482: break;
1.1 noro 483: case O_STR:
1.24 saito 484: wname=(STRING)BDY(arg);break;
1.1 noro 485: default:
1.24 saito 486: error("plot : invalid argument");break;
1.1 noro 487: }
1.24 saito 488: if(!poly )
1.1 noro 489: error("plot : invalid argument");
1.24 saito 490: switch ( ri ){
1.1 noro 491: case 0:
1.24 saito 492: MKV(v[0],var);MKNODE(n,var,defrange);MKLIST(xrange,n);
1.1 noro 493: break;
494: case 1:
1.24 saito 495: av[0]=VR((P)BDY(BDY(range[0])));
1.31 ! noro 496: if(NUM(poly) || v[0]==av[0] )
1.24 saito 497: xrange=range[0];
1.1 noro 498: else
499: error("plot : invalid argument");
500: break;
501: default:
1.24 saito 502: error("plot : cannot happen");break;
1.1 noro 503: }
504: /* conplot in ox_plot requires
1.9 noro 505: [s_id (Q),
1.1 noro 506: formula (Obj),
507: xrange=[x,xmin,xmax] (LIST),
508: yrange=0,
509: zrange=0,
510: geom=[xsize,ysize] (LIST),
511: wname=name (STRING)]
512: */
1.24 saito 513: stream=validate_ox_plot_stream(stream);
1.9 noro 514: STOQ(stream,s_id);
1.24 saito 515: if(!geom ){
1.1 noro 516: STOQ(300,w300);
1.24 saito 517: MKNODE(n0,w300,0);MKNODE(n,w300,n0);MKLIST(geom,n);
1.1 noro 518: }
1.24 saito 519: if(is_memory ){
1.26 saito 520: MKSTR(fname,MEMORY_PLOT);
1.24 saito 521: arg=mknode(7,s_id,fname,poly,xrange,NULLP,NULLP,geom);
1.18 noro 522: Pox_rpc(arg,&t);
1.24 saito 523: arg=mknode(1,s_id);
1.18 noro 524: Pox_pop_cmo(arg,rp);
525: } else {
1.26 saito 526: MKSTR(fname,fn);
1.24 saito 527: arg=mknode(8,s_id,fname,poly,xrange,NULLP,NULLP,geom,wname);
1.18 noro 528: Pox_rpc(arg,&t);
1.24 saito 529: *rp=(Obj)s_id;
1.18 noro 530: }
1.15 noro 531: }
532:
533: #define Pi 3.14159265358979323846264
534:
1.24 saito 535: void Ppolarplot(NODE arg,Obj *rp){
1.29 saito 536: Q m2,p2,w300,s_id;
537: NODE defrange,n,n0;
538: LIST zrange,range[1],geom,list;
1.15 noro 539: VL vl,vl0;
1.29 saito 540: V v[1],av[1];
541: int stream,ri,i;
1.26 saito 542: P poly,var;
1.15 noro 543: STRING fname,wname;
544: Real pi2;
1.29 saito 545: Obj t;
1.15 noro 546:
1.29 saito 547: MKReal(2*Pi,pi2);MKNODE(n,pi2,0); MKNODE(defrange,0,n);
548: poly=0;vl=0;geom=0;wname=0;stream=-1;ri=0;v[0]=0;
1.26 saito 549: for(;arg;arg=NEXT(arg)){
1.29 saito 550: if(!BDY(arg)) stream=0;
1.26 saito 551: else switch(OID(BDY(arg))){
552: case O_P: case O_R://formular
553: poly=(P)BDY(arg);
554: get_vars_recursive((Obj)poly,&vl);
1.29 saito 555: for(vl0=vl,i=0;vl0;vl0=NEXT(vl0))
556: if(vl0->v->attr==(pointer)V_IND)
557: if(i>=1)error("polarplot : invalid argument");
558: else v[i++]=vl0->v;
559: if(i!=1)error("polarplot : invalid argument");
1.26 saito 560: break;
1.29 saito 561: case O_LIST://range,geomerty
562: list=(LIST)BDY(arg);
563: if(OID(BDY(BDY(list)))==O_P)
564: if(ri>0)error("polarplot : invalid argument");
565: else range[ri++]=list;
566: else geom=list;
1.26 saito 567: break;
1.29 saito 568: case O_N:
569: stream=QTOS((Q)BDY(arg));
1.15 noro 570: break;
1.26 saito 571: case O_STR://wname
572: wname=(STRING)BDY(arg);
1.15 noro 573: break;
574: default:
1.29 saito 575: error("polarplot : invalid argument");
1.26 saito 576: break;
577: }
578: }
579: //formular check
1.29 saito 580: if(!poly)error("polarplot : invalid argument");
581: switch (ri){
582: case 0:
583: MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(zrange,n);
584: break;
585: case 1:
586: av[0]=VR((P)BDY(BDY(range[0])));
587: if(v[0]==av[0]) zrange = range[0];
588: else error("polarplot : invalid argument");
589: break;
590: default:
591: error("polarplot : cannot happen");
592: break;
1.26 saito 593: }
1.29 saito 594: stream=validate_ox_plot_stream(stream);
595: STOQ(stream,s_id);
1.26 saito 596: if(!geom){
1.29 saito 597: STOQ(300,w300);
598: MKNODE(n0,w300,0); MKNODE(n,w300,n0); MKLIST(geom,n);
1.15 noro 599: }
1.26 saito 600: MKSTR(fname,POLARPLOT);
1.29 saito 601: arg=mknode(8,s_id,fname,poly,NULLP,NULLP,zrange,geom,wname);
1.13 noro 602: Pox_rpc(arg,&t);
1.29 saito 603: *rp=s_id;
1.1 noro 604: }
605:
1.24 saito 606: void Pplotover(NODE arg,Obj *rp){
607: Q s_id,w_id,color;
1.1 noro 608: P poly;
609: STRING fname;
1.13 noro 610: Obj t;
1.24 saito 611: poly=(P)ARG0(arg);
612: s_id=(Q)ARG1(arg);
613: w_id=(Q)ARG2(arg);
614: if(argc(arg)==4)color=(Q)ARG3(arg);
615: else color=0;
1.26 saito 616: MKSTR(fname,PLOTOVER);
1.24 saito 617: arg=mknode(5,s_id,fname,w_id,poly,color);
1.13 noro 618: Pox_rpc(arg,&t);
1.24 saito 619: *rp=(Obj)s_id;
1.1 noro 620: }
621:
1.24 saito 622: void Pdrawcircle(NODE arg,Obj *rp){
1.9 noro 623: Q s_id,index;
1.24 saito 624: Obj x,y,r,c,t;
1.1 noro 625: STRING fname;
626: NODE n;
627: LIST pos;
628:
1.24 saito 629: x=(Obj)ARG0(arg);
630: y=(Obj)ARG1(arg);
631: r=(Obj)ARG2(arg);
632: c=(Obj)ARG3(arg);
633: s_id=(Q)ARG4(arg);
634: index=(Q)ARG5(arg);
1.26 saito 635: MKSTR(fname,DRAWCIRCLE);
1.24 saito 636: n=mknode(3,x,y,r,c);
637: MKLIST(pos,n);
638: arg=mknode(5,s_id,fname,index,pos,c);
1.13 noro 639: Pox_rpc(arg,&t);
1.24 saito 640: *rp=(Obj)s_id;
1.6 noro 641: }
642:
1.24 saito 643: void Pdraw_obj(NODE arg,Obj *rp){
1.6 noro 644: static STRING fname;
1.9 noro 645: Q s_id,index;
1.6 noro 646: LIST obj;
1.13 noro 647: Obj t;
1.6 noro 648:
1.26 saito 649: if(!fname)MKSTR(fname,DRAW_OBJ);
1.24 saito 650: s_id=(Q)ARG0(arg);
651: index=(Q)ARG1(arg);
652: obj=(LIST)ARG2(arg);
653: // ARG3(arg)=color
654: if(argc(arg)==4) arg=mknode(5,s_id,fname,index,obj,ARG3(arg));
655: else arg=mknode(4,s_id,fname,index,obj);
1.13 noro 656: Pox_cmo_rpc(arg,&t);
1.24 saito 657: *rp=(Obj)s_id;
1.12 noro 658: }
659:
1.24 saito 660: void Pdraw_string(NODE arg,Obj *rp){
1.12 noro 661: static STRING fname;
662: STRING str;
663: Q s_id,index;
664: LIST pos;
1.13 noro 665: Obj t;
1.12 noro 666:
1.26 saito 667: if(!fname)MKSTR(fname,DRAW_STRING);
1.24 saito 668: s_id=(Q)ARG0(arg);
669: index=(Q)ARG1(arg);
670: pos=(LIST)ARG2(arg);
671: str=(STRING)ARG3(arg);
672: // ARG4(arg)=color
673: if(argc(arg)==5) arg=mknode(6,s_id,fname,index,pos,str,ARG4(arg));
674: else arg=mknode(5,s_id,fname,index,pos,str);
1.13 noro 675: Pox_cmo_rpc(arg,&t);
1.24 saito 676: *rp=(Obj)s_id;
1.6 noro 677: }
678:
1.24 saito 679: void Pclear_canvas(NODE arg,Obj *rp){
1.6 noro 680: static STRING fname;
1.9 noro 681: Q s_id,index;
1.13 noro 682: Obj t;
1.6 noro 683:
1.26 saito 684: if(!fname) MKSTR(fname,CLEAR_CANVAS);
1.24 saito 685: s_id=(Q)ARG0(arg);
686: index=(Q)ARG1(arg);
687: arg=mknode(3,s_id,fname,index);
688: Pox_cmo_rpc(arg,&t);
689: *rp=(Obj)s_id;
690: }
691: //****************************ifplotNG
692: /*
693: * name ifplot,ineqn,ineqnor,ineqnand,ineqnxor,conplot
694: * type
695: * D:sign character using double
696: * Q:sign character use rational
697: * B:Boundary character use sturm theorem
698: */
699: void ListCheck(char * head,LIST list){
700: int i;
701: NODE n;
702: if(!list){
1.26 saito 703: printf("%s zero \n",head);
1.24 saito 704: return;
705: }
1.26 saito 706: for(i=0,n=(NODE)BDY(list);n;i++,n=NEXT(n));
707: printf("%s length %d\n",head,i);
1.24 saito 708: for(i=0,n=(NODE)BDY(list);n;i++,n=NEXT(n)){
709: if(!BDY(n))printf("%d 0\n",i);
710: else if(OID(BDY(n))==O_P) printf("%d poly\n",i);
1.26 saito 711: else if(OID(BDY(n))==O_R) printf("%d real\n",i);
712: else if(OID(BDY(n))==O_N) printf("%d %d\n",i,QTOS((Q)BDY(n)));
1.6 noro 713: }
1.1 noro 714: }
715:
1.26 saito 716: void PifplotD(NODE arg,Obj *rp){ifplot_mainNG(arg,IFPLOTD,rp);}
717: void PifplotQ(NODE arg,Obj *rp){ifplot_mainNG(arg,IFPLOTQ,rp);}
718: void PifplotB(NODE arg,Obj *rp){ifplot_mainNG(arg,IFPLOTB,rp);}
1.24 saito 719:
1.26 saito 720: void PconplotD(NODE arg,Obj *rp){ifplot_mainNG(arg,CONPLOTD,rp);}
721: void PconplotQ(NODE arg,Obj *rp){ifplot_mainNG(arg,CONPLOTQ,rp);}
722: void PconplotB(NODE arg,Obj *rp){ifplot_mainNG(arg,CONPLOTB,rp);}
1.24 saito 723:
1.26 saito 724: void PineqnD(NODE arg,Obj *rp){ifplot_mainNG(arg,INEQND,rp);}
725: void PineqnQ(NODE arg,Obj *rp){ifplot_mainNG(arg,INEQNQ,rp);}
726: void PineqnB(NODE arg,Obj *rp){ifplot_mainNG(arg,INEQNB,rp);}
1.24 saito 727:
728: #if defined(INTERVAL)
1.26 saito 729: void Pitvifplot(NODE arg,Obj *rp){ifplot_mainNG(arg,ITVIFPLOT,rp);}
1.24 saito 730: #endif
731:
1.26 saito 732: void PineqnorD(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNDOR,rp);}
733: void PineqnorQ(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNQOR,rp);}
734: void PineqnorB(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNBOR,rp);}
735:
736: void PineqnandD(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNDAND,rp);}
737: void PineqnandQ(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNQAND,rp);}
738: void PineqnandB(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNBAND,rp);}
739:
740: void PineqnxorD(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNDXOR,rp);}
741: void PineqnxorQ(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNQXOR,rp);}
742: void PineqnxorB(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNBXOR,rp);}
743:
744: void PplotoverD(NODE arg,Obj *rp){plotover_mainNG(arg,PLOTOVERD,rp);}
745: void PplotoverQ(NODE arg,Obj *rp){plotover_mainNG(arg,PLOTOVERQ,rp);}
746: void PplotoverB(NODE arg,Obj *rp){plotover_mainNG(arg,PLOTOVERB,rp);}
1.24 saito 747:
1.29 saito 748: void Pobj_cp(NODE arg,Obj *rp){
749: //copy canvas
750: //1:and,3:copy,6:xor,7:or
751: Q sysid,index_A,index_B,op_code;
752: STRING fname;
753: Obj t;
754: sysid=(Q)ARG0(arg);
755: index_A=(Q)ARG1(arg);
756: index_B=(Q)ARG2(arg);
757: op_code=(Q)ARG3(arg);
758: MKSTR(fname,OBJ_CP);
759: arg=mknode(5,sysid,fname,index_A,index_B,op_code);
760: Pox_rpc(arg,&t);
761: *rp=(Obj)sysid;
762: }
763:
764: void PpolarplotD(NODE arg,Obj *rp){
765: Q m2,p2,w300,defstep,s_id,color;
766: NODE defrange,n,n0,n1,n2;
767: LIST range,geom,list[2];
768: VL vl,vl0;
769: V v[1],av;
770: int stream,ri,i,len,iNo,lNo,vNo,sNo,pfine,findG;
771: P poly,var;
772: STRING fname,wname;
773: Real pi2;
774: Obj t,frst,sec,thr;
775: char ebuf[BUFSIZ];
776:
777: iNo=lNo=sNo=findG=0;pfine=TRUE;
778: poly=0;vl=0;geom=0;wname=0;color=0;stream=-1;ri=0;v[0]=0;
779: for(;arg;arg=NEXT(arg)){
780: if(!BDY(arg)) iNo++;
781: else switch(OID(BDY(arg))){
782: case O_P: case O_R://formular
783: poly=(P)BDY(arg);
784: get_vars_recursive((Obj)poly,&vl);
785: for(vl0=vl,vNo=0;vl0;vl0=NEXT(vl0)){
786: if(vl0->v->attr==(pointer)V_IND){
787: if(vNo>=1){
788: sprintf(ebuf,"%s : invalaid argument",POLARPLOT);
789: error(ebuf);
790: } else v[vNo++]=vl0->v;
791: }
792: }
793: if(vNo!=1){
794: sprintf(ebuf,"%s : only uni-variate formular",POLARPLOT);
795: error(ebuf);
796: }
797: break;
798: case O_N://color,id,idx,division
799: switch (iNo){
800: case 0://color arg
801: color=(Q)BDY(arg);
802: iNo++;
803: break;
804: case 1://stream arg
805: stream=QTOS((Q)BDY(arg));
806: iNo++;
807: break;
808: default://error
809: sprintf(ebuf,"%s : invalid number arguments",POLARPLOT);
810: error(ebuf);
811: break;
812: }
813: break;
814: case O_LIST://range,geomerty
815: if(lNo<2)list[lNo++]=(LIST)BDY(arg);
816: else {
817: sprintf(ebuf,"%s : invalid list argument",POLARPLOT);
818: error(ebuf);
819: }
820: break;
821: case O_STR://wname
822: wname=(STRING)BDY(arg);
823: sNo++;
824: break;
825: default:
826: break;
827: }
828: }
829: //formular check
830: if(!poly){
1.30 saito 831: sprintf(ebuf,"%s : invalid plot argument",POLARPLOT);
1.29 saito 832: error(ebuf);
833: }
834: //vars check
835: get_vars_recursive((Obj)poly,&vl);
836: for(vl0=vl,vNo=0;vl0;vNo++,vl0=NEXT(vl0)){
837: if(vl0->v->attr==(pointer)V_IND){
838: if(vNo>=2){
1.30 saito 839: sprintf(ebuf,"%s : invalid plot argument",POLARPLOT);
1.29 saito 840: error(ebuf);
841: } else v[vNo]=vl0->v;
842: }
843: }
844: //list check
845: for(i=0;i<lNo;i++){
846: if(OID(BDY(BDY(list[i])))!=O_P){
847: // list first value is number (geometry)
848: for(len=0,n=(NODE)BDY(list[i]);n;len++,n=NEXT(n)){
849: if(len==0) frst=BDY(n);
850: else if(len==1) sec=BDY(n);
851: else {
852: sprintf(ebuf,"%s : geometry list too long",POLARPLOT);
853: error(ebuf);
854: }
855: }
856: if(len!=2){
857: sprintf(ebuf,"%s : geometry requierd 2 numbers", POLARPLOT);
858: error(ebuf);
859: } else geom=list[i];
860: } else {
861: //list first value is var (range)
862: av=VR((P)BDY(BDY(list[i])));
863: if(v[0]==av)range=list[i];
864: else {
865: sprintf(ebuf,"%s : invalid list length",POLARPLOT);
866: error(ebuf);
867: }
868: }
869: }
870: // set default
871: if(!range){
872: STOQ(DEFAULTPOLARSTEP,defstep);MKReal(2*Pi,pi2);MKV(v[0],var);
873: MKNODE(n,defstep,0);MKNODE(n1,pi2,n);MKNODE(n2,0,n1);
874: MKNODE(defrange,var,n2);MKLIST(range,defrange);
875: }
876: if(!geom){
877: STOQ(300,w300);MKNODE(n0,w300,0);MKNODE(n,w300,n0);MKLIST(geom,n);
878: }
879: stream=validate_ox_plot_stream(stream);
880: STOQ(stream,s_id);
881: MKSTR(fname,POLARPLOTD);
882: arg=mknode(7,s_id,fname,poly,color,range,geom,wname);
883: Pox_rpc(arg,&t);
884: *rp=(Obj)s_id;
885: }
886:
1.26 saito 887: void ifplot_mainNG(NODE arg,char *fn,Obj *rp){
888: Q m2,p2,w300,mxgc,s_id,color;
1.24 saito 889: NODE defrange,n,n0,n1,n2;
890: P poly,var;
891: VL vl,vl0;
892: V v[2],av;
893: LIST xrange,yrange,zrange,geom,range[2],list[4];
894: int stream,ri,i,j,sign,llen,len,iNo,lNo,vNo,sNo,pfine,findG;
895: STRING fname,wname;
896: Obj t,frst,sec,thr;
897: char ebuf[BUFSIZ];
898:
899: iNo=lNo=sNo=findG=0;pfine=TRUE;
1.26 saito 900: poly=0;stream=-1;wname=0;color=0;stream=0;
1.24 saito 901: STOQ(-2,m2);STOQ(2,p2);MKNODE(n,p2,0);MKNODE(defrange,m2,n);
902: STOQ(MAXGC,mxgc);
903: for(;arg;arg=NEXT(arg)){
904: if(!BDY(arg)) iNo++;
905: else switch(OID(BDY(arg))){
906: case O_P://formular
907: if(pfine){
908: poly=(P)BDY(arg);
909: pfine=FALSE;
910: } else {
1.30 saito 911: sprintf(ebuf,"%s : to many plot arguments",fn);
1.24 saito 912: error(ebuf);
913: }
914: break;
915: case O_N://color,id,idx,division
916: switch (iNo){
917: case 0: //color arg
918: color=(Q)BDY(arg);
919: iNo++;
920: break;
921: case 1: //stream arg
922: stream=QTOS((Q)BDY(arg));
923: iNo++;
924: break;
1.26 saito 925: default:
926: sprintf(ebuf,"%s : invalid number arguments",fn);
1.24 saito 927: error(ebuf);
928: break;
929: }
930: break;
931: case O_LIST://xrange,yrange,zrange,geometry
932: if(lNo<4) list[lNo++]=(LIST)BDY(arg);
933: else {
1.26 saito 934: sprintf(ebuf,"%s : invalid list argument",fn);
1.24 saito 935: error(ebuf);
936: }
937: break;
938: case O_STR://wname
939: wname=(STRING)BDY(arg);
940: sNo++;
941: break;
942: default:
943: break;
944: }
945: }
946: // formular check
947: if(!poly){
1.30 saito 948: sprintf(ebuf,"%s : invalid plot argument",fn);
1.24 saito 949: error(ebuf);
950: }
951: // vars check
952: get_vars_recursive((Obj)poly,&vl);
1.26 saito 953: for(vl0=vl,vNo=0;vl0;vl0=NEXT(vl0)){
954: if(vl0->v->attr==(pointer)V_IND){
1.24 saito 955: if(vNo>=2){
1.30 saito 956: sprintf(ebuf,"%s : invalid plot argument",fn);
1.24 saito 957: error(ebuf);
958: } else v[vNo++]=vl0->v;
1.26 saito 959: }
960: }
1.24 saito 961: //list check
962: xrange=yrange=zrange=geom=0;frst=sec=thr=0;
963: for(i=0;i<lNo;i++){
964: for(llen=0,n=(NODE)BDY(list[i]);n;llen++,n=NEXT(n));
965: if(llen>4){
1.26 saito 966: sprintf(ebuf,"%s : invalid list length",fn);
1.24 saito 967: error(ebuf);
968: }
969: if(OID(BDY(BDY(list[i])))!=O_P){
970: // First list value is number
971: for(len=0,n=(NODE)BDY(list[i]);n;len++,n=NEXT(n)){
972: if(len==0)frst=BDY(n);
973: else if(len==1)sec=BDY(n);
974: else thr=BDY(n);
975: }
976: switch(len){
977: case 2:
1.26 saito 978: if(!strcmp(fn,CONPLOT)){
1.24 saito 979: if(thr==0)thr=(Obj)mxgc;
980: MKNODE(n,thr,0);MKNODE(n1,sec,n);MKNODE(n2,frst,n1);MKLIST(zrange,n2);
981: } else geom=list[i];
982: break;
983: case 3:
984: zrange=list[i];
985: break;
986: case 0:
987: case 1:
988: default:
1.26 saito 989: sprintf(ebuf,"%s : invalid list length",fn);
1.24 saito 990: error(ebuf);
991: break;
992: }
993: } else {
994: //xrange,yrange
995: av=VR((P)BDY(BDY(list[i])));
996: if(v[0]==av)xrange=list[i];
997: else if(v[1]==av)yrange=list[i];
998: else {
999: MKLIST(zrange,NEXT(BDY(list[i])));
1000: }
1001: }
1002: }
1003: //set default
1004: if(!xrange){
1005: MKV(v[0],var);MKNODE(n,var,defrange);MKLIST(xrange,n);
1006: }
1007: if(!yrange){
1008: MKV(v[1],var);MKNODE(n,var,defrange);MKLIST(yrange,n);
1009: }
1010: if(!geom){
1011: STOQ(300,w300);MKNODE(n0,w300,0);MKNODE(n,w300,n0);MKLIST(geom,n);
1012: }
1.26 saito 1013: if(!(strcmp(fn,CONPLOTD)&strcmp(fn,CONPLOTQ)&strcmp(fn,CONPLOTB))&!zrange){
1.24 saito 1014: MKNODE(n,mxgc,0);MKNODE(n1,m2,n);MKNODE(n2,m2,n1);MKLIST(zrange,n2);
1015: }
1016: /*new ifplot in ox_plot requires
1017: [s_id (Q),
1018: formula (Obj),
1019: color (Q),
1020: geom=[xsize,ysize] (LIST optional),
1021: xrange=[x,xmin,xmax] (LIST optional),
1022: yrange=[y,ymin,ymax] (LIST optional),
1023: zrange=[zmin,zmax,zstep] (LIST optional),
1024: wname=name (STRING optional)],
1.26 saito 1025: itvstep (Q) if ITVIFPLOT */
1.24 saito 1026: stream=validate_ox_plot_stream(stream);
1027: STOQ(stream,s_id);
1.26 saito 1028: MKSTR(fname,fn);
1029: arg=mknode(9,s_id,fname,poly,color,xrange,yrange,zrange,geom,wname);
1.24 saito 1030: Pox_rpc(arg,&t);
1031: *rp=(Obj)s_id;
1032: }
1033:
1.26 saito 1034: void plotover_mainNG(NODE arg,char *fn,Obj *rp){
1.24 saito 1035: Q s_id,w_id,color;
1036: P poly;
1037: STRING fname;
1038: Obj t;
1039: int iNo,pfine,sfine;
1040: char ebuf[BUFSIZ];
1041:
1042: pfine=sfine=TRUE;
1043: iNo=0;poly=0;color=s_id=w_id=0;
1044: for(;arg;arg=NEXT(arg)){
1045: if(!BDY(arg)) iNo++;
1046: else switch(OID(BDY(arg))){
1047: case O_P://formular
1048: if(pfine){
1049: poly=(P)BDY(arg);
1050: pfine=FALSE;
1051: } else {
1.30 saito 1052: sprintf(ebuf,"%s : to many plot arguments",fn);
1.24 saito 1053: error(ebuf);
1054: }
1055: break;
1056: case O_N://color,s_id,w_id
1057: switch(iNo){
1058: case 0://color arg
1059: color=(Q)BDY(arg);
1060: iNo++;
1061: break;
1062: case 1://stream arg
1063: s_id=(Q)BDY(arg);
1064: iNo++;
1065: break;
1066: case 2://window arg
1067: w_id=(Q)BDY(arg);
1068: iNo++;
1069: break;
1070: default://error
1.26 saito 1071: sprintf(ebuf,"%s : to many numbers",fn);
1.24 saito 1072: error(ebuf);
1073: break;
1074: }
1075: break;
1076: default:
1.26 saito 1077: sprintf(ebuf,"%s : arguments type miss match",fn);
1.24 saito 1078: error(ebuf);
1079: }
1080: }
1.26 saito 1081: MKSTR(fname,fn);
1.29 saito 1082: //[s_id (Q), w_id (Q), formula (Obj), color (Q)]
1.24 saito 1083: arg=mknode(5,s_id,fname,w_id,poly,color);
1084: Pox_rpc(arg,&t);
1085: *rp=(Obj)s_id;
1.1 noro 1086: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>