Annotation of OpenXM_contrib2/asir2000/plot/plotf.c, Revision 1.29
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.29 ! saito 48: * $OpenXM: OpenXM_contrib2/asir2000/plot/plotf.c,v 1.28 2014/05/16 08:49:53 ohara 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.11 noro 439: int stream,ri,i;
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;
450: for(;arg;arg=NEXT(arg) )
451: if(!BDY(arg) )
452: stream=0;
1.1 noro 453: else
1.24 saito 454: switch ( OID(BDY(arg)) ){
1.1 noro 455: case O_P: case O_R:
1.24 saito 456: poly=(P)BDY(arg);
1.11 noro 457: get_vars_recursive((Obj)poly,&vl);
1.26 saito 458: for(vl0=vl, i=0;vl0;vl0=NEXT(vl0) ){
459: if(vl0->v->attr==(pointer)V_IND ){
460: if(i >= 1 ) error("ifplot : invalid argument");
461: else v[i++]=vl0->v;
462: }
463: }
464: if(i != 1 ) error("ifplot : invalid argument");
1.1 noro 465: break;
466: case O_LIST:
1.24 saito 467: list=(LIST)BDY(arg);
1.26 saito 468: if(OID(BDY(BDY(list)))==O_P ){
469: if(ri > 0 ) error("plot : invalid argument");
470: else range[ri++]=list;
471: } else geom=list;
1.1 noro 472: break;
473: case O_N:
1.24 saito 474: stream=QTOS((Q)BDY(arg));break;
1.1 noro 475: case O_STR:
1.24 saito 476: wname=(STRING)BDY(arg);break;
1.1 noro 477: default:
1.24 saito 478: error("plot : invalid argument");break;
1.1 noro 479: }
1.24 saito 480: if(!poly )
1.1 noro 481: error("plot : invalid argument");
1.24 saito 482: switch ( ri ){
1.1 noro 483: case 0:
1.24 saito 484: MKV(v[0],var);MKNODE(n,var,defrange);MKLIST(xrange,n);
1.1 noro 485: break;
486: case 1:
1.24 saito 487: av[0]=VR((P)BDY(BDY(range[0])));
488: if(v[0]==av[0] )
489: xrange=range[0];
1.1 noro 490: else
491: error("plot : invalid argument");
492: break;
493: default:
1.24 saito 494: error("plot : cannot happen");break;
1.1 noro 495: }
496: /* conplot in ox_plot requires
1.9 noro 497: [s_id (Q),
1.1 noro 498: formula (Obj),
499: xrange=[x,xmin,xmax] (LIST),
500: yrange=0,
501: zrange=0,
502: geom=[xsize,ysize] (LIST),
503: wname=name (STRING)]
504: */
1.24 saito 505: stream=validate_ox_plot_stream(stream);
1.9 noro 506: STOQ(stream,s_id);
1.24 saito 507: if(!geom ){
1.1 noro 508: STOQ(300,w300);
1.24 saito 509: MKNODE(n0,w300,0);MKNODE(n,w300,n0);MKLIST(geom,n);
1.1 noro 510: }
1.24 saito 511: if(is_memory ){
1.26 saito 512: MKSTR(fname,MEMORY_PLOT);
1.24 saito 513: arg=mknode(7,s_id,fname,poly,xrange,NULLP,NULLP,geom);
1.18 noro 514: Pox_rpc(arg,&t);
1.24 saito 515: arg=mknode(1,s_id);
1.18 noro 516: Pox_pop_cmo(arg,rp);
517: } else {
1.26 saito 518: MKSTR(fname,fn);
1.24 saito 519: arg=mknode(8,s_id,fname,poly,xrange,NULLP,NULLP,geom,wname);
1.18 noro 520: Pox_rpc(arg,&t);
1.24 saito 521: *rp=(Obj)s_id;
1.18 noro 522: }
1.15 noro 523: }
524:
525: #define Pi 3.14159265358979323846264
526:
1.24 saito 527: void Ppolarplot(NODE arg,Obj *rp){
1.29 ! saito 528: Q m2,p2,w300,s_id;
! 529: NODE defrange,n,n0;
! 530: LIST zrange,range[1],geom,list;
1.15 noro 531: VL vl,vl0;
1.29 ! saito 532: V v[1],av[1];
! 533: int stream,ri,i;
1.26 saito 534: P poly,var;
1.15 noro 535: STRING fname,wname;
536: Real pi2;
1.29 ! saito 537: Obj t;
1.15 noro 538:
1.29 ! saito 539: MKReal(2*Pi,pi2);MKNODE(n,pi2,0); MKNODE(defrange,0,n);
! 540: poly=0;vl=0;geom=0;wname=0;stream=-1;ri=0;v[0]=0;
1.26 saito 541: for(;arg;arg=NEXT(arg)){
1.29 ! saito 542: if(!BDY(arg)) stream=0;
1.26 saito 543: else switch(OID(BDY(arg))){
544: case O_P: case O_R://formular
545: poly=(P)BDY(arg);
546: get_vars_recursive((Obj)poly,&vl);
1.29 ! saito 547: for(vl0=vl,i=0;vl0;vl0=NEXT(vl0))
! 548: if(vl0->v->attr==(pointer)V_IND)
! 549: if(i>=1)error("polarplot : invalid argument");
! 550: else v[i++]=vl0->v;
! 551: if(i!=1)error("polarplot : invalid argument");
1.26 saito 552: break;
1.29 ! saito 553: case O_LIST://range,geomerty
! 554: list=(LIST)BDY(arg);
! 555: if(OID(BDY(BDY(list)))==O_P)
! 556: if(ri>0)error("polarplot : invalid argument");
! 557: else range[ri++]=list;
! 558: else geom=list;
1.26 saito 559: break;
1.29 ! saito 560: case O_N:
! 561: stream=QTOS((Q)BDY(arg));
1.15 noro 562: break;
1.26 saito 563: case O_STR://wname
564: wname=(STRING)BDY(arg);
1.15 noro 565: break;
566: default:
1.29 ! saito 567: error("polarplot : invalid argument");
1.26 saito 568: break;
569: }
570: }
571: //formular check
1.29 ! saito 572: if(!poly)error("polarplot : invalid argument");
! 573: switch (ri){
! 574: case 0:
! 575: MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(zrange,n);
! 576: break;
! 577: case 1:
! 578: av[0]=VR((P)BDY(BDY(range[0])));
! 579: if(v[0]==av[0]) zrange = range[0];
! 580: else error("polarplot : invalid argument");
! 581: break;
! 582: default:
! 583: error("polarplot : cannot happen");
! 584: break;
1.26 saito 585: }
1.29 ! saito 586: stream=validate_ox_plot_stream(stream);
! 587: STOQ(stream,s_id);
1.26 saito 588: if(!geom){
1.29 ! saito 589: STOQ(300,w300);
! 590: MKNODE(n0,w300,0); MKNODE(n,w300,n0); MKLIST(geom,n);
1.15 noro 591: }
1.26 saito 592: MKSTR(fname,POLARPLOT);
1.29 ! saito 593: arg=mknode(8,s_id,fname,poly,NULLP,NULLP,zrange,geom,wname);
1.13 noro 594: Pox_rpc(arg,&t);
1.29 ! saito 595: *rp=s_id;
1.1 noro 596: }
597:
1.24 saito 598: void Pplotover(NODE arg,Obj *rp){
599: Q s_id,w_id,color;
1.1 noro 600: P poly;
601: STRING fname;
1.13 noro 602: Obj t;
1.24 saito 603: poly=(P)ARG0(arg);
604: s_id=(Q)ARG1(arg);
605: w_id=(Q)ARG2(arg);
606: if(argc(arg)==4)color=(Q)ARG3(arg);
607: else color=0;
1.26 saito 608: MKSTR(fname,PLOTOVER);
1.24 saito 609: arg=mknode(5,s_id,fname,w_id,poly,color);
1.13 noro 610: Pox_rpc(arg,&t);
1.24 saito 611: *rp=(Obj)s_id;
1.1 noro 612: }
613:
1.24 saito 614: void Pdrawcircle(NODE arg,Obj *rp){
1.9 noro 615: Q s_id,index;
1.24 saito 616: Obj x,y,r,c,t;
1.1 noro 617: STRING fname;
618: NODE n;
619: LIST pos;
620:
1.24 saito 621: x=(Obj)ARG0(arg);
622: y=(Obj)ARG1(arg);
623: r=(Obj)ARG2(arg);
624: c=(Obj)ARG3(arg);
625: s_id=(Q)ARG4(arg);
626: index=(Q)ARG5(arg);
1.26 saito 627: MKSTR(fname,DRAWCIRCLE);
1.24 saito 628: n=mknode(3,x,y,r,c);
629: MKLIST(pos,n);
630: arg=mknode(5,s_id,fname,index,pos,c);
1.13 noro 631: Pox_rpc(arg,&t);
1.24 saito 632: *rp=(Obj)s_id;
1.6 noro 633: }
634:
1.24 saito 635: void Pdraw_obj(NODE arg,Obj *rp){
1.6 noro 636: static STRING fname;
1.9 noro 637: Q s_id,index;
1.6 noro 638: LIST obj;
1.13 noro 639: Obj t;
1.6 noro 640:
1.26 saito 641: if(!fname)MKSTR(fname,DRAW_OBJ);
1.24 saito 642: s_id=(Q)ARG0(arg);
643: index=(Q)ARG1(arg);
644: obj=(LIST)ARG2(arg);
645: // ARG3(arg)=color
646: if(argc(arg)==4) arg=mknode(5,s_id,fname,index,obj,ARG3(arg));
647: else arg=mknode(4,s_id,fname,index,obj);
1.13 noro 648: Pox_cmo_rpc(arg,&t);
1.24 saito 649: *rp=(Obj)s_id;
1.12 noro 650: }
651:
1.24 saito 652: void Pdraw_string(NODE arg,Obj *rp){
1.12 noro 653: static STRING fname;
654: STRING str;
655: Q s_id,index;
656: LIST pos;
1.13 noro 657: Obj t;
1.12 noro 658:
1.26 saito 659: if(!fname)MKSTR(fname,DRAW_STRING);
1.24 saito 660: s_id=(Q)ARG0(arg);
661: index=(Q)ARG1(arg);
662: pos=(LIST)ARG2(arg);
663: str=(STRING)ARG3(arg);
664: // ARG4(arg)=color
665: if(argc(arg)==5) arg=mknode(6,s_id,fname,index,pos,str,ARG4(arg));
666: else arg=mknode(5,s_id,fname,index,pos,str);
1.13 noro 667: Pox_cmo_rpc(arg,&t);
1.24 saito 668: *rp=(Obj)s_id;
1.6 noro 669: }
670:
1.24 saito 671: void Pclear_canvas(NODE arg,Obj *rp){
1.6 noro 672: static STRING fname;
1.9 noro 673: Q s_id,index;
1.13 noro 674: Obj t;
1.6 noro 675:
1.26 saito 676: if(!fname) MKSTR(fname,CLEAR_CANVAS);
1.24 saito 677: s_id=(Q)ARG0(arg);
678: index=(Q)ARG1(arg);
679: arg=mknode(3,s_id,fname,index);
680: Pox_cmo_rpc(arg,&t);
681: *rp=(Obj)s_id;
682: }
683: //****************************ifplotNG
684: /*
685: * name ifplot,ineqn,ineqnor,ineqnand,ineqnxor,conplot
686: * type
687: * D:sign character using double
688: * Q:sign character use rational
689: * B:Boundary character use sturm theorem
690: */
691: void ListCheck(char * head,LIST list){
692: int i;
693: NODE n;
694: if(!list){
1.26 saito 695: printf("%s zero \n",head);
1.24 saito 696: return;
697: }
1.26 saito 698: for(i=0,n=(NODE)BDY(list);n;i++,n=NEXT(n));
699: printf("%s length %d\n",head,i);
1.24 saito 700: for(i=0,n=(NODE)BDY(list);n;i++,n=NEXT(n)){
701: if(!BDY(n))printf("%d 0\n",i);
702: else if(OID(BDY(n))==O_P) printf("%d poly\n",i);
1.26 saito 703: else if(OID(BDY(n))==O_R) printf("%d real\n",i);
704: else if(OID(BDY(n))==O_N) printf("%d %d\n",i,QTOS((Q)BDY(n)));
1.6 noro 705: }
1.1 noro 706: }
707:
1.26 saito 708: void PifplotD(NODE arg,Obj *rp){ifplot_mainNG(arg,IFPLOTD,rp);}
709: void PifplotQ(NODE arg,Obj *rp){ifplot_mainNG(arg,IFPLOTQ,rp);}
710: void PifplotB(NODE arg,Obj *rp){ifplot_mainNG(arg,IFPLOTB,rp);}
1.24 saito 711:
1.26 saito 712: void PconplotD(NODE arg,Obj *rp){ifplot_mainNG(arg,CONPLOTD,rp);}
713: void PconplotQ(NODE arg,Obj *rp){ifplot_mainNG(arg,CONPLOTQ,rp);}
714: void PconplotB(NODE arg,Obj *rp){ifplot_mainNG(arg,CONPLOTB,rp);}
1.24 saito 715:
1.26 saito 716: void PineqnD(NODE arg,Obj *rp){ifplot_mainNG(arg,INEQND,rp);}
717: void PineqnQ(NODE arg,Obj *rp){ifplot_mainNG(arg,INEQNQ,rp);}
718: void PineqnB(NODE arg,Obj *rp){ifplot_mainNG(arg,INEQNB,rp);}
1.24 saito 719:
720: #if defined(INTERVAL)
1.26 saito 721: void Pitvifplot(NODE arg,Obj *rp){ifplot_mainNG(arg,ITVIFPLOT,rp);}
1.24 saito 722: #endif
723:
1.26 saito 724: void PineqnorD(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNDOR,rp);}
725: void PineqnorQ(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNQOR,rp);}
726: void PineqnorB(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNBOR,rp);}
727:
728: void PineqnandD(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNDAND,rp);}
729: void PineqnandQ(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNQAND,rp);}
730: void PineqnandB(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNBAND,rp);}
731:
732: void PineqnxorD(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNDXOR,rp);}
733: void PineqnxorQ(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNQXOR,rp);}
734: void PineqnxorB(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNBXOR,rp);}
735:
736: void PplotoverD(NODE arg,Obj *rp){plotover_mainNG(arg,PLOTOVERD,rp);}
737: void PplotoverQ(NODE arg,Obj *rp){plotover_mainNG(arg,PLOTOVERQ,rp);}
738: void PplotoverB(NODE arg,Obj *rp){plotover_mainNG(arg,PLOTOVERB,rp);}
1.24 saito 739:
1.29 ! saito 740: void Pobj_cp(NODE arg,Obj *rp){
! 741: //copy canvas
! 742: //1:and,3:copy,6:xor,7:or
! 743: Q sysid,index_A,index_B,op_code;
! 744: STRING fname;
! 745: Obj t;
! 746: sysid=(Q)ARG0(arg);
! 747: index_A=(Q)ARG1(arg);
! 748: index_B=(Q)ARG2(arg);
! 749: op_code=(Q)ARG3(arg);
! 750: MKSTR(fname,OBJ_CP);
! 751: arg=mknode(5,sysid,fname,index_A,index_B,op_code);
! 752: Pox_rpc(arg,&t);
! 753: *rp=(Obj)sysid;
! 754: }
! 755:
! 756: void PpolarplotD(NODE arg,Obj *rp){
! 757: Q m2,p2,w300,defstep,s_id,color;
! 758: NODE defrange,n,n0,n1,n2;
! 759: LIST range,geom,list[2];
! 760: VL vl,vl0;
! 761: V v[1],av;
! 762: int stream,ri,i,len,iNo,lNo,vNo,sNo,pfine,findG;
! 763: P poly,var;
! 764: STRING fname,wname;
! 765: Real pi2;
! 766: Obj t,frst,sec,thr;
! 767: char ebuf[BUFSIZ];
! 768:
! 769: iNo=lNo=sNo=findG=0;pfine=TRUE;
! 770: poly=0;vl=0;geom=0;wname=0;color=0;stream=-1;ri=0;v[0]=0;
! 771: for(;arg;arg=NEXT(arg)){
! 772: if(!BDY(arg)) iNo++;
! 773: else switch(OID(BDY(arg))){
! 774: case O_P: case O_R://formular
! 775: poly=(P)BDY(arg);
! 776: get_vars_recursive((Obj)poly,&vl);
! 777: for(vl0=vl,vNo=0;vl0;vl0=NEXT(vl0)){
! 778: if(vl0->v->attr==(pointer)V_IND){
! 779: if(vNo>=1){
! 780: sprintf(ebuf,"%s : invalaid argument",POLARPLOT);
! 781: error(ebuf);
! 782: } else v[vNo++]=vl0->v;
! 783: }
! 784: }
! 785: if(vNo!=1){
! 786: sprintf(ebuf,"%s : only uni-variate formular",POLARPLOT);
! 787: error(ebuf);
! 788: }
! 789: break;
! 790: case O_N://color,id,idx,division
! 791: switch (iNo){
! 792: case 0://color arg
! 793: color=(Q)BDY(arg);
! 794: iNo++;
! 795: break;
! 796: case 1://stream arg
! 797: stream=QTOS((Q)BDY(arg));
! 798: iNo++;
! 799: break;
! 800: default://error
! 801: sprintf(ebuf,"%s : invalid number arguments",POLARPLOT);
! 802: error(ebuf);
! 803: break;
! 804: }
! 805: break;
! 806: case O_LIST://range,geomerty
! 807: if(lNo<2)list[lNo++]=(LIST)BDY(arg);
! 808: else {
! 809: sprintf(ebuf,"%s : invalid list argument",POLARPLOT);
! 810: error(ebuf);
! 811: }
! 812: break;
! 813: case O_STR://wname
! 814: wname=(STRING)BDY(arg);
! 815: sNo++;
! 816: break;
! 817: default:
! 818: break;
! 819: }
! 820: }
! 821: //formular check
! 822: if(!poly){
! 823: sprintf(ebuf,"%s : invalid ploy argument",POLARPLOT);
! 824: error(ebuf);
! 825: }
! 826: //vars check
! 827: get_vars_recursive((Obj)poly,&vl);
! 828: for(vl0=vl,vNo=0;vl0;vNo++,vl0=NEXT(vl0)){
! 829: if(vl0->v->attr==(pointer)V_IND){
! 830: if(vNo>=2){
! 831: sprintf(ebuf,"%s : invalid ploy argument",POLARPLOT);
! 832: error(ebuf);
! 833: } else v[vNo]=vl0->v;
! 834: }
! 835: }
! 836: //list check
! 837: for(i=0;i<lNo;i++){
! 838: if(OID(BDY(BDY(list[i])))!=O_P){
! 839: // list first value is number (geometry)
! 840: for(len=0,n=(NODE)BDY(list[i]);n;len++,n=NEXT(n)){
! 841: if(len==0) frst=BDY(n);
! 842: else if(len==1) sec=BDY(n);
! 843: else {
! 844: sprintf(ebuf,"%s : geometry list too long",POLARPLOT);
! 845: error(ebuf);
! 846: }
! 847: }
! 848: if(len!=2){
! 849: sprintf(ebuf,"%s : geometry requierd 2 numbers", POLARPLOT);
! 850: error(ebuf);
! 851: } else geom=list[i];
! 852: } else {
! 853: //list first value is var (range)
! 854: av=VR((P)BDY(BDY(list[i])));
! 855: if(v[0]==av)range=list[i];
! 856: else {
! 857: sprintf(ebuf,"%s : invalid list length",POLARPLOT);
! 858: error(ebuf);
! 859: }
! 860: }
! 861: }
! 862: // set default
! 863: if(!range){
! 864: STOQ(DEFAULTPOLARSTEP,defstep);MKReal(2*Pi,pi2);MKV(v[0],var);
! 865: MKNODE(n,defstep,0);MKNODE(n1,pi2,n);MKNODE(n2,0,n1);
! 866: MKNODE(defrange,var,n2);MKLIST(range,defrange);
! 867: }
! 868: if(!geom){
! 869: STOQ(300,w300);MKNODE(n0,w300,0);MKNODE(n,w300,n0);MKLIST(geom,n);
! 870: }
! 871: stream=validate_ox_plot_stream(stream);
! 872: STOQ(stream,s_id);
! 873: MKSTR(fname,POLARPLOTD);
! 874: arg=mknode(7,s_id,fname,poly,color,range,geom,wname);
! 875: Pox_rpc(arg,&t);
! 876: *rp=(Obj)s_id;
! 877: }
! 878:
1.26 saito 879: void ifplot_mainNG(NODE arg,char *fn,Obj *rp){
880: Q m2,p2,w300,mxgc,s_id,color;
1.24 saito 881: NODE defrange,n,n0,n1,n2;
882: P poly,var;
883: VL vl,vl0;
884: V v[2],av;
885: LIST xrange,yrange,zrange,geom,range[2],list[4];
886: int stream,ri,i,j,sign,llen,len,iNo,lNo,vNo,sNo,pfine,findG;
887: STRING fname,wname;
888: Obj t,frst,sec,thr;
889: char ebuf[BUFSIZ];
890:
891: iNo=lNo=sNo=findG=0;pfine=TRUE;
1.26 saito 892: poly=0;stream=-1;wname=0;color=0;stream=0;
1.24 saito 893: STOQ(-2,m2);STOQ(2,p2);MKNODE(n,p2,0);MKNODE(defrange,m2,n);
894: STOQ(MAXGC,mxgc);
895: for(;arg;arg=NEXT(arg)){
896: if(!BDY(arg)) iNo++;
897: else switch(OID(BDY(arg))){
898: case O_P://formular
899: if(pfine){
900: poly=(P)BDY(arg);
901: pfine=FALSE;
902: } else {
1.26 saito 903: sprintf(ebuf,"%s : to many ploy arguments",fn);
1.24 saito 904: error(ebuf);
905: }
906: break;
907: case O_N://color,id,idx,division
908: switch (iNo){
909: case 0: //color arg
910: color=(Q)BDY(arg);
911: iNo++;
912: break;
913: case 1: //stream arg
914: stream=QTOS((Q)BDY(arg));
915: iNo++;
916: break;
1.26 saito 917: default:
918: sprintf(ebuf,"%s : invalid number arguments",fn);
1.24 saito 919: error(ebuf);
920: break;
921: }
922: break;
923: case O_LIST://xrange,yrange,zrange,geometry
924: if(lNo<4) list[lNo++]=(LIST)BDY(arg);
925: else {
1.26 saito 926: sprintf(ebuf,"%s : invalid list argument",fn);
1.24 saito 927: error(ebuf);
928: }
929: break;
930: case O_STR://wname
931: wname=(STRING)BDY(arg);
932: sNo++;
933: break;
934: default:
935: break;
936: }
937: }
938: // formular check
939: if(!poly){
1.26 saito 940: sprintf(ebuf,"%s : invalid ploy argument",fn);
1.24 saito 941: error(ebuf);
942: }
943: // vars check
944: get_vars_recursive((Obj)poly,&vl);
1.26 saito 945: for(vl0=vl,vNo=0;vl0;vl0=NEXT(vl0)){
946: if(vl0->v->attr==(pointer)V_IND){
1.24 saito 947: if(vNo>=2){
1.26 saito 948: sprintf(ebuf,"%s : invalid ploy argument",fn);
1.24 saito 949: error(ebuf);
950: } else v[vNo++]=vl0->v;
1.26 saito 951: }
952: }
1.24 saito 953: //list check
954: xrange=yrange=zrange=geom=0;frst=sec=thr=0;
955: for(i=0;i<lNo;i++){
956: for(llen=0,n=(NODE)BDY(list[i]);n;llen++,n=NEXT(n));
957: if(llen>4){
1.26 saito 958: sprintf(ebuf,"%s : invalid list length",fn);
1.24 saito 959: error(ebuf);
960: }
961: if(OID(BDY(BDY(list[i])))!=O_P){
962: // First list value is number
963: for(len=0,n=(NODE)BDY(list[i]);n;len++,n=NEXT(n)){
964: if(len==0)frst=BDY(n);
965: else if(len==1)sec=BDY(n);
966: else thr=BDY(n);
967: }
968: switch(len){
969: case 2:
1.26 saito 970: if(!strcmp(fn,CONPLOT)){
1.24 saito 971: if(thr==0)thr=(Obj)mxgc;
972: MKNODE(n,thr,0);MKNODE(n1,sec,n);MKNODE(n2,frst,n1);MKLIST(zrange,n2);
973: } else geom=list[i];
974: break;
975: case 3:
976: zrange=list[i];
977: break;
978: case 0:
979: case 1:
980: default:
1.26 saito 981: sprintf(ebuf,"%s : invalid list length",fn);
1.24 saito 982: error(ebuf);
983: break;
984: }
985: } else {
986: //xrange,yrange
987: av=VR((P)BDY(BDY(list[i])));
988: if(v[0]==av)xrange=list[i];
989: else if(v[1]==av)yrange=list[i];
990: else {
991: MKLIST(zrange,NEXT(BDY(list[i])));
992: }
993: }
994: }
995: //set default
996: if(!xrange){
997: MKV(v[0],var);MKNODE(n,var,defrange);MKLIST(xrange,n);
998: }
999: if(!yrange){
1000: MKV(v[1],var);MKNODE(n,var,defrange);MKLIST(yrange,n);
1001: }
1002: if(!geom){
1003: STOQ(300,w300);MKNODE(n0,w300,0);MKNODE(n,w300,n0);MKLIST(geom,n);
1004: }
1.26 saito 1005: if(!(strcmp(fn,CONPLOTD)&strcmp(fn,CONPLOTQ)&strcmp(fn,CONPLOTB))&!zrange){
1.24 saito 1006: MKNODE(n,mxgc,0);MKNODE(n1,m2,n);MKNODE(n2,m2,n1);MKLIST(zrange,n2);
1007: }
1008: /*new ifplot in ox_plot requires
1009: [s_id (Q),
1010: formula (Obj),
1011: color (Q),
1012: geom=[xsize,ysize] (LIST optional),
1013: xrange=[x,xmin,xmax] (LIST optional),
1014: yrange=[y,ymin,ymax] (LIST optional),
1015: zrange=[zmin,zmax,zstep] (LIST optional),
1016: wname=name (STRING optional)],
1.26 saito 1017: itvstep (Q) if ITVIFPLOT */
1.24 saito 1018: stream=validate_ox_plot_stream(stream);
1019: STOQ(stream,s_id);
1.26 saito 1020: MKSTR(fname,fn);
1021: arg=mknode(9,s_id,fname,poly,color,xrange,yrange,zrange,geom,wname);
1.24 saito 1022: Pox_rpc(arg,&t);
1023: *rp=(Obj)s_id;
1024: }
1025:
1.26 saito 1026: void plotover_mainNG(NODE arg,char *fn,Obj *rp){
1.24 saito 1027: Q s_id,w_id,color;
1028: P poly;
1029: STRING fname;
1030: Obj t;
1031: int iNo,pfine,sfine;
1032: char ebuf[BUFSIZ];
1033:
1034: pfine=sfine=TRUE;
1035: iNo=0;poly=0;color=s_id=w_id=0;
1036: for(;arg;arg=NEXT(arg)){
1037: if(!BDY(arg)) iNo++;
1038: else switch(OID(BDY(arg))){
1039: case O_P://formular
1040: if(pfine){
1041: poly=(P)BDY(arg);
1042: pfine=FALSE;
1043: } else {
1.26 saito 1044: sprintf(ebuf,"%s : to many ploy arguments",fn);
1.24 saito 1045: error(ebuf);
1046: }
1047: break;
1048: case O_N://color,s_id,w_id
1049: switch(iNo){
1050: case 0://color arg
1051: color=(Q)BDY(arg);
1052: iNo++;
1053: break;
1054: case 1://stream arg
1055: s_id=(Q)BDY(arg);
1056: iNo++;
1057: break;
1058: case 2://window arg
1059: w_id=(Q)BDY(arg);
1060: iNo++;
1061: break;
1062: default://error
1.26 saito 1063: sprintf(ebuf,"%s : to many numbers",fn);
1.24 saito 1064: error(ebuf);
1065: break;
1066: }
1067: break;
1068: default:
1.26 saito 1069: sprintf(ebuf,"%s : arguments type miss match",fn);
1.24 saito 1070: error(ebuf);
1071: }
1072: }
1.26 saito 1073: MKSTR(fname,fn);
1.29 ! saito 1074: //[s_id (Q), w_id (Q), formula (Obj), color (Q)]
1.24 saito 1075: arg=mknode(5,s_id,fname,w_id,poly,color);
1076: Pox_rpc(arg,&t);
1077: *rp=(Obj)s_id;
1.1 noro 1078: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>