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