version 1.24, 2013/12/19 05:48:25 |
version 1.31, 2017/08/31 02:36:21 |
|
|
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* |
* |
* $OpenXM: OpenXM_contrib2/asir2000/plot/plotf.c,v 1.23 2012/10/04 04:56:39 saito Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/plot/plotf.c,v 1.30 2014/07/31 15:52:13 saito Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "parse.h" |
#include "parse.h" |
#include "ox.h" |
#include "ox.h" |
#include "ifplot.h" |
#include "ifplot.h" |
|
|
|
int validate_ox_plot_stream(int); |
void ListCheck(char *,LIST); |
void ListCheck(char *,LIST); |
void Pplot(NODE, Obj *); |
void Pplot(NODE,Obj *); |
void Ppolarplot(NODE, Obj *); |
void Ppolarplot(NODE,Obj *); |
void Pobj_cp(NODE, Obj *),Parrayplot(NODE,Obj*),Pdrawcircle(NODE,Obj*); |
void Pobj_cp(NODE,Obj *),Parrayplot(NODE,Obj*),Pdrawcircle(NODE,Obj*); |
void Pifplot(NODE,Obj *),Pconplot(NODE,Obj *),Pplotover(NODE,Obj *); |
void Pifplot(NODE,Obj *),Pconplot(NODE,Obj *),Pplotover(NODE,Obj *); |
void Pmemory_ifplot(NODE, Obj *),Pmemory_conplot(NODE, Obj *); |
void Pmemory_ifplot(NODE,Obj *),Pmemory_conplot(NODE,Obj *); |
void Pmemory_plot(NODE, Obj *); |
void Pmemory_plot(NODE,Obj *); |
void ifplot_main(NODE, int, int, Obj *); |
void ifplot_main(NODE,int,char *,Obj *); |
void plot_main(NODE, int, int, Obj *); |
void plot_main(NODE,int,char *,Obj *); |
void conplot_main(NODE, int, Obj *); |
void conplot_main(NODE,int,Obj *); |
|
|
void Popen_canvas(NODE,Obj *),Pclear_canvas(NODE,Obj *),Pdraw_obj(NODE,Obj *); |
void Popen_canvas(NODE,Obj *),Pclear_canvas(NODE,Obj *),Pdraw_obj(NODE,Obj *); |
void Pdraw_string(NODE,Obj *); |
void Pdraw_string(NODE,Obj *); |
void Pox_rpc(), Pox_cmo_rpc(); |
void Pox_rpc(NODE,Obj *), Pox_cmo_rpc(NODE,Obj *); |
|
|
//NG |
//NG |
#if defined(INTERVAL) |
#if defined(INTERVAL) |
Line 77 void PineqnandD(NODE,Obj *), PineqnandQ(NODE,Obj *), P |
|
Line 78 void PineqnandD(NODE,Obj *), PineqnandQ(NODE,Obj *), P |
|
void PineqnorD(NODE,Obj *), PineqnorQ(NODE,Obj *), PineqnorB(NODE,Obj *); |
void PineqnorD(NODE,Obj *), PineqnorQ(NODE,Obj *), PineqnorB(NODE,Obj *); |
void PineqnxorD(NODE,Obj *), PineqnxorQ(NODE,Obj *), PineqnxorB(NODE,Obj *); |
void PineqnxorD(NODE,Obj *), PineqnxorQ(NODE,Obj *), PineqnxorB(NODE,Obj *); |
void PconplotD(NODE,Obj *),PconplotQ(NODE,Obj *),PconplotB(NODE,Obj *); |
void PconplotD(NODE,Obj *),PconplotQ(NODE,Obj *),PconplotB(NODE,Obj *); |
|
void PpolarplotD(NODE,Obj *); |
void PplotoverD(NODE,Obj *),PplotoverQ(NODE,Obj *),PplotoverB(NODE,Obj *); |
void PplotoverD(NODE,Obj *),PplotoverQ(NODE,Obj *),PplotoverB(NODE,Obj *); |
void ifplot_mainNG(NODE,int,Obj *); |
void ifplot_mainNG(NODE,char *,Obj *); |
void ifplot_mainOP(NODE,int,Obj *); |
void conplot_mainNG(NODE,char *,Obj *); |
void conplot_mainNG(NODE,int,Obj *); |
void plotover_mainNG(NODE,char *,Obj *); |
void plotover_mainNG(NODE,int,Obj *); |
|
//void PplotD(NODE, Obj *); |
|
|
|
char *pfunc[]={ |
|
"ifplot","conplot","plot","interactive","polarplot","plotover", |
|
"ifplotD","ifplotQ","ifplotB","ineqnD","ineqnQ","ineqnB", |
|
"ineqnandD","ineqnandQ","ineqnandB","ineqnorD","ineqnorQ","ineqnorB", |
|
"ineqnxorD","ineqnxorQ","ineqnxorB", |
|
"conplotD","conplotQ","conplotB","itvifplot", |
|
"plotoverD","plotoverQ","plotoverB"}; |
|
// end NG |
|
|
|
struct ftab plot_tab[]={ |
struct ftab plot_tab[]={ |
{"plot",Pplot,-6}, |
{PLOT,Pplot,-7}, |
#if defined(INTERVAL) |
#if defined(INTERVAL) |
{"itvifplot",Pitvifplot,-8}, |
{ITVIFPLOT,Pitvifplot,-8}, |
#endif |
#endif |
{"polarplot",Ppolarplot,-7}, |
{OBJ_CP,Pobj_cp,4}, |
{"obj_cp",Pobj_cp,4}, |
{POLARPLOT,Ppolarplot,-6}, |
{"ifplot",Pifplot,-7}, |
{POLARPLOTD,PpolarplotD,-7}, |
{"ifplotD",PifplotD,-8}, |
{IFPLOT,Pifplot,-7}, |
{"ifplotQ",PifplotQ,-8}, |
{IFPLOTD,PifplotD,-8}, |
{"ifplotB",PifplotB,-8}, |
{IFPLOTQ,PifplotQ,-8}, |
{"ineqn",PineqnD,-8}, |
{IFPLOTB,PifplotB,-8}, |
{"ineqnD",PineqnD,-8}, |
{INEQN,PineqnD,-8}, |
{"ineqnQ",PineqnQ,-8}, |
{INEQND,PineqnD,-8}, |
{"ineqnB",PineqnB,-8}, |
{INEQNQ,PineqnQ,-8}, |
{"ineqnand",PineqnandD,4},//ifplot_mainOP :argc is const |
{INEQNB,PineqnB,-8}, |
{"ineqnandD",PineqnandD,4}, |
{INEQNAND,PineqnandD,-4}, |
{"ineqnandQ",PineqnandQ,4}, |
{INEQNDAND,PineqnandD,-4}, |
{"ineqnandB",PineqnandB,4}, |
{INEQNQAND,PineqnandQ,-4}, |
{"ineqnor",PineqnorD,4}, |
{INEQNBAND,PineqnandB,-4}, |
{"ineqnorD",PineqnorD,4}, |
{INEQNOR,PineqnorD,-4}, |
{"ineqnorQ",PineqnorQ,4}, |
{INEQNDOR,PineqnorD,-4}, |
{"ineqnorB",PineqnorB,4}, |
{INEQNQOR,PineqnorQ,-4}, |
{"ineqnxor",PineqnxorD,4}, |
{INEQNBOR,PineqnorB,-4}, |
{"ineqnxorD",PineqnxorD,4}, |
{INEQNXOR,PineqnxorD,-4}, |
{"ineqnxorQ",PineqnxorQ,4}, |
{INEQNDXOR,PineqnxorD,-4}, |
{"ineqnxorB",PineqnxorB,4}, |
{INEQNQXOR,PineqnxorQ,-4}, |
{"conplot",Pconplot,-8}, |
{INEQNBXOR,PineqnxorB,-4}, |
{"conplotD",PconplotD,-9}, |
{CONPLOT,Pconplot,-7}, |
{"conplotB",PconplotB,-9}, |
{CONPLOTD,PconplotD,-8}, |
{"conplotQ",PconplotQ,-9}, |
{CONPLOTB,PconplotB,-8}, |
{"plotover",Pplotover,-5}, |
{CONPLOTQ,PconplotQ,-8}, |
{"plotoverD",PplotoverD,-5}, |
{PLOTOVER,Pplotover,-4}, |
{"plotoverQ",PplotoverQ,-5}, |
{PLOTOVERD,PplotoverD,-4}, |
{"plotoverB",PplotoverB,-5}, |
{PLOTOVERQ,PplotoverQ,-4}, |
{"memory_ifplot",Pmemory_ifplot,-6}, |
{PLOTOVERB,PplotoverB,-4}, |
{"memory_conplot",Pmemory_conplot,-7}, |
{MEMORY_IFPLOT,Pmemory_ifplot,-7}, |
{"memory_plot",Pmemory_plot,-5}, |
{MEMORY_CONPLOT,Pmemory_conplot,-7}, |
{"drawcircle",Pdrawcircle,6}, |
{MEMORY_PLOT,Pmemory_plot,-7}, |
{"open_canvas",Popen_canvas,-3}, |
{DRAWCIRCLE,Pdrawcircle,6}, |
{"clear_canvas",Pclear_canvas,2}, |
{OPEN_CANVAS,Popen_canvas,-3}, |
{"draw_obj",Pdraw_obj,-4}, |
{CLEAR_CANVAS,Pclear_canvas,2}, |
{"draw_string",Pdraw_string,-5}, |
{DRAW_OBJ,Pdraw_obj,-4}, |
|
{DRAW_STRING,Pdraw_string,-5}, |
{0,0,0}, |
{0,0,0}, |
}; |
}; |
|
char *pfn[]={ |
|
IFPLOT,CONPLOT,PLOT,INTERACTIVE,POLARPLOT,PLOTOVER, |
|
IFPLOTD,IFPLOTQ,IFPLOTB,INEQND,INEQNQ,INEQNB, |
|
INEQNDAND,INEQNQAND,INEQNBAND, |
|
INEQNDOR,INEQNQOR,INEQNBOR, |
|
INEQNDXOR,INEQNQXOR,INEQNBXOR, |
|
CONPLOTD,CONPLOTQ,CONPLOTB,ITVIFPLOT, |
|
PLOTOVERD,PLOTOVERQ,PLOTOVERB, |
|
MEMORY_IFPLOT,MEMORY_CONPLOT,MEMORY_PLOT,ARRAYPLOT,OPEN_CANVAS, |
|
DRAWCIRCLE,DRAW_OBJ,DRAW_STRING,OBJ_CP,CLEAR_CANVAS,POLARPLOTD}; |
|
/* |
|
IFPLOT:0,CONPLOT:1,PLOT:2,INTERACTIVE:3,POLARPLOT:4,PLOTOVER:5, |
|
IFPLOTD:6,IFPLOTQ:7,IFPLOTB:8,INEQND:9,INEQNQ:10,INEQNB:11, |
|
INEQNDAND:12,INEQNQAND:13,INEQNBAND:14, |
|
INEQNDOR:15,INEQNQOR:16,INEQNBOR:17, |
|
INEQNDXOR:18,INEQNQXOR:19,INEQNBXOR:20, |
|
CONPLOTD:21,CONPLOTQ:22,CONPLOTB:23,ITVIFPLOT:24, |
|
PLOTOVERD:25,PLOTOVERQ:26,PLOTOVERB:27, |
|
MEMORY_IFPLOT:28,MEMORY_CONPLOT:29,MEMORY_PLOT:30,ARRAYPLOT:31, |
|
OPEN_CANVAS:32,DRAWCIRCLE:33,DRAW_OBJ:34,DRAW_STRING:35,OBJ_CP:36, |
|
CLEAR_CANVAS:37,POLARPLOTD:38 |
|
*/ |
|
int modeNO(char *fn){ |
|
int i; |
|
char **z; |
|
for(i=0,z=pfn;*z!=NULL;z++,i++)if(!strcmp(fn,*z))return i; |
|
return -1; |
|
} |
|
|
void Popen_canvas(NODE arg,Obj *rp){ |
void Popen_canvas(NODE arg,Obj *rp){ |
Q w300,s_id; |
Q w300,s_id; |
Line 171 void Popen_canvas(NODE arg,Obj *rp){ |
|
Line 191 void Popen_canvas(NODE arg,Obj *rp){ |
|
MKNODE(n,w300,n0); |
MKNODE(n,w300,n0); |
MKLIST(geom,n); |
MKLIST(geom,n); |
} |
} |
MKSTR(fname,"open_canvas"); |
MKSTR(fname,OPEN_CANVAS); |
arg=mknode(4,s_id,fname,geom,wname); |
arg=mknode(4,s_id,fname,geom,wname); |
Pox_cmo_rpc(arg,rp); |
Pox_cmo_rpc(arg,rp); |
*rp=(Obj)s_id; |
*rp=(Obj)s_id; |
} |
} |
|
|
void Pifplot(NODE arg,Obj *rp){ifplot_main(arg,0,MODE_IFPLOT,rp);} |
void Pifplot(NODE arg,Obj *rp){ifplot_main(arg,0,IFPLOT,rp);} |
void Pmemory_ifplot(NODE arg,Obj *rp){ifplot_main(arg,1,MODE_IFPLOT,rp);} |
void Pmemory_ifplot(NODE arg,Obj *rp){ifplot_main(arg,1,IFPLOT,rp);} |
|
|
void ifplot_main(NODE arg,int is_memory,int fn,Obj *rp){ |
void ifplot_main(NODE arg,int is_memory,char *fn,Obj *rp){ |
Q m2,p2,w300,s_id; |
Q m2,p2,w300,s_id; |
NODE defrange; |
NODE defrange; |
LIST xrange,yrange,range[2],list,geom; |
LIST xrange,yrange,zrange,range[2],list,geom; |
VL vl,vl0; |
VL vl,vl0; |
V v[2],av[2]; |
V v[2],av[2]; |
int stream,ri,i,sign; |
int stream,ri,i,sign; |
Line 193 void ifplot_main(NODE arg,int is_memory,int fn,Obj *rp |
|
Line 213 void ifplot_main(NODE arg,int is_memory,int fn,Obj *rp |
|
Obj t; |
Obj t; |
|
|
STOQ(-2,m2);STOQ(2,p2);MKNODE(n,p2,0);MKNODE(defrange,m2,n); |
STOQ(-2,m2);STOQ(2,p2);MKNODE(n,p2,0);MKNODE(defrange,m2,n); |
poly=0;vl=0;geom=0;wname=0;stream=-1;ri=0; |
poly=0;vl=0;geom=0;wname=0;stream=-1;ri=0;xrange=0;yrange=0;zrange=0; |
v[0]=v[1]=0; |
v[0]=v[1]=0; |
for(;arg;arg=NEXT(arg)) |
for(;arg;arg=NEXT(arg)) |
if(!BDY(arg))stream=0; |
if(!BDY(arg))stream=0; |
Line 202 void ifplot_main(NODE arg,int is_memory,int fn,Obj *rp |
|
Line 222 void ifplot_main(NODE arg,int is_memory,int fn,Obj *rp |
|
case O_P: |
case O_P: |
poly=(P)BDY(arg); |
poly=(P)BDY(arg); |
get_vars_recursive((Obj)poly,&vl); |
get_vars_recursive((Obj)poly,&vl); |
for(vl0=vl,i=0;vl0;vl0=NEXT(vl0)) |
for(vl0=vl,i=0;vl0;vl0=NEXT(vl0)){ |
if(vl0->v->attr==(pointer)V_IND) |
if(vl0->v->attr==(pointer)V_IND){ |
if(i>=2)error("ifplot : invalid argument"); |
if(i>=2)error("ifplot : invalid argument"); |
else v[i++]=vl0->v; |
else v[i++]=vl0->v; |
|
} |
|
} |
break; |
break; |
case O_LIST: |
case O_LIST: |
list=(LIST)BDY(arg); |
list=(LIST)BDY(arg); |
Line 265 void ifplot_main(NODE arg,int is_memory,int fn,Obj *rp |
|
Line 287 void ifplot_main(NODE arg,int is_memory,int fn,Obj *rp |
|
STOQ(300,w300);MKNODE(n0,w300,0);MKNODE(n,w300,n0);MKLIST(geom,n); |
STOQ(300,w300);MKNODE(n0,w300,0);MKNODE(n,w300,n0);MKLIST(geom,n); |
} |
} |
if(is_memory){ |
if(is_memory){ |
MKSTR(fname,"memory_plot"); |
MKSTR(fname,MEMORY_PLOT); |
arg=mknode(8,s_id,fname,poly,xrange,yrange,0,geom); |
arg=mknode(8,s_id,fname,poly,xrange,yrange,zrange,geom); |
Pox_rpc(arg,&t); |
Pox_rpc(arg,&t); |
arg=mknode(1,s_id); |
arg=mknode(1,s_id); |
Pox_pop_cmo(arg,rp); |
Pox_pop_cmo(arg,rp); |
} else { |
} else { |
MKSTR(fname,pfunc[fn]); |
MKSTR(fname,fn); |
arg=mknode(8,s_id,fname,poly,xrange,yrange,0,geom,wname); |
arg=mknode(8,s_id,fname,poly,xrange,yrange,zrange,geom,wname); |
Pox_rpc(arg,&t); |
Pox_rpc(arg,&t); |
*rp=(Obj)s_id; |
*rp=(Obj)s_id; |
} |
} |
} |
} |
|
|
void Pobj_cp(NODE arg,Obj *rp){ |
|
//copy canvas |
|
//1:and,3:copy,6:xor,7:or |
|
Q sysid,index_A,index_B,op_code; |
|
STRING fname; |
|
Obj t; |
|
sysid=(Q)ARG0(arg); |
|
index_A=(Q)ARG1(arg); |
|
index_B=(Q)ARG2(arg); |
|
op_code=(Q)ARG3(arg); |
|
MKSTR(fname,"objcp"); |
|
arg=mknode(5,sysid,fname,index_A,index_B,op_code); |
|
Pox_rpc(arg,&t); |
|
*rp=(Obj)sysid; |
|
} |
|
|
|
void Pconplot(NODE arg,Obj *rp){conplot_main(arg, 0, rp);} |
void Pconplot(NODE arg,Obj *rp){conplot_main(arg, 0, rp);} |
void Pmemory_conplot(NODE arg,Obj *rp){conplot_main(arg,1,rp);} |
void Pmemory_conplot(NODE arg,Obj *rp){conplot_main(arg,1,rp);} |
|
|
void conplot_main(NODE arg,int is_memory,Obj *rp){ |
void conplot_main(NODE arg,int is_memory,Obj *rp){ |
int stream,ri,i; |
Q m2,p2,w300,s_id; |
Q m2,p2,w300,s_id,mxgc; |
NODE defrange; |
NODE defrange,n,n0,n1,n2,n3; |
|
LIST xrange,yrange,zrange,range[3],list,geom; |
LIST xrange,yrange,zrange,range[3],list,geom; |
VL vl,vl0; |
VL vl,vl0; |
V v[2],av[2]; |
V v[2],av[2]; |
P poly,var; |
int stream,ri,i; |
|
P poly; |
|
P var; |
|
NODE n,n0; |
STRING fname,wname; |
STRING fname,wname; |
Obj t; |
Obj t; |
|
|
STOQ(-2,m2);STOQ(2,p2);MKNODE(n,p2,0);MKNODE(defrange,m2,n); |
STOQ(-2,m2); STOQ(2,p2); |
poly=0;vl=0;geom=0;wname=0;stream=-1;ri=0;v[0]=v[1]=0; |
MKNODE(n,p2,0); MKNODE(defrange,m2,n); |
for(;arg;arg=NEXT(arg)) |
poly = 0; vl = 0; geom = 0; wname = 0; stream = -1; ri = 0; |
if(!BDY(arg)) stream=0; |
v[0] = v[1] = 0; |
else switch (OID(BDY(arg))){ |
for ( ; arg; arg = NEXT(arg) ) |
|
if ( !BDY(arg) ) |
|
stream = 0; |
|
else |
|
switch ( OID(BDY(arg)) ) { |
case O_P: |
case O_P: |
poly=(P)BDY(arg); |
poly = (P)BDY(arg); |
get_vars_recursive((Obj)poly,&vl); |
get_vars_recursive((Obj)poly,&vl); |
for(vl0=vl,i=0;vl0;vl0=NEXT(vl0)) |
for ( vl0 = vl, i = 0; vl0; vl0 = NEXT(vl0) ) |
if(vl0->v->attr==(pointer)V_IND) |
if ( vl0->v->attr == (pointer)V_IND ) |
if(i>=2) error("conplot : invalid argument"); |
if ( i >= 2 ) |
else v[i++]=vl0->v; |
error("ifplot : invalid argument"); |
|
else |
|
v[i++] = vl0->v; |
break; |
break; |
case O_LIST: |
case O_LIST: |
list=(LIST)BDY(arg); |
list = (LIST)BDY(arg); |
if(OID(BDY(BDY(list)))==O_P) |
if ( OID(BDY(BDY(list))) == O_P ) |
if(ri>2) error("conplot : invalid argument"); |
if ( ri > 2 ) |
else range[ri++]=list; |
error("ifplot : invalid argument"); |
else geom=list; |
else |
|
range[ri++] = list; |
|
else |
|
geom = list; |
break; |
break; |
case O_N: |
case O_N: |
stream=QTOS((Q)BDY(arg)); |
stream = QTOS((Q)BDY(arg)); break; |
break; |
|
case O_STR: |
case O_STR: |
wname=(STRING)BDY(arg); |
wname = (STRING)BDY(arg); break; |
break; |
|
default: |
default: |
error("conplot : invalid argument"); |
error("ifplot : invalid argument"); break; |
break; |
|
} |
} |
if(!poly) error("conplot : invalid argument"); |
if ( !poly ) |
// list format var,num,num[,num] |
error("ifplot : invalid argument"); |
switch (ri){ |
switch ( ri ) { |
case 0: |
case 0: |
if(!v[1]) error("conplot : please specify all variables"); |
if ( !v[1] ) |
MKV(v[0],var);MKNODE(n,var,defrange);MKLIST(xrange,n); |
error("ifplot : please specify all variables"); |
MKV(v[1],var);MKNODE(n,var,defrange);MKLIST(yrange,n); |
MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(xrange,n); |
STOQ(MAXGC,mxgc);MKNODE(n1,mxgc,0);MKNODE(n2,p2,n1);MKNODE(n3,p2,n2); |
MKV(v[1],var); MKNODE(n,var,defrange); MKLIST(yrange,n); |
MKLIST(zrange,n3); |
MKNODE(n,0,defrange); MKLIST(zrange,n); |
break; |
break; |
case 1: |
case 1: |
if(!v[1]) error("conplot : please specify all variables"); |
if ( !v[1] ) |
av[0]=VR((P)BDY(BDY(range[0]))); |
error("ifplot : please specify all variables"); |
if(v[0]==av[0]){ |
av[0] = VR((P)BDY(BDY(range[0]))); |
xrange=range[0]; |
if ( v[0] == av[0] ) { |
MKV(v[1],var);MKNODE(n,var,defrange);MKLIST(yrange,n); |
xrange = range[0]; |
STOQ(MAXGC,mxgc);MKNODE(n1,mxgc,0);MKNODE(n2,p2,n1);MKNODE(n3,p2,n2); |
MKV(v[1],var); MKNODE(n,var,defrange); MKLIST(yrange,n); |
MKLIST(zrange,n3); |
MKNODE(n,0,defrange); MKLIST(zrange,n); |
} else if(v[1]==av[0]){ |
} else if ( v[1] == av[0] ) { |
MKV(v[0],var);MKNODE(n,var,defrange);MKLIST(xrange,n); |
MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(xrange,n); |
yrange=range[0]; |
yrange = range[0]; |
STOQ(MAXGC,mxgc);MKNODE(n1,mxgc,0);MKNODE(n2,p2,n1);MKNODE(n3,p2,n2); |
MKNODE(n,0,defrange); MKLIST(zrange,n); |
MKLIST(zrange,n3); |
|
} else { |
} else { |
MKV(v[0],var);MKNODE(n,var,defrange);MKLIST(xrange,n); |
MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(xrange,n); |
MKV(v[1],var);MKNODE(n,var,defrange);MKLIST(yrange,n); |
MKV(v[1],var); MKNODE(n,var,defrange); MKLIST(yrange,n); |
n=NEXT((NODE)BDY(range[0])); |
zrange = range[0]; |
for(i=0,n1=n;n1;n1=NEXT(n1),i++); |
|
if(i==3)MKLIST(zrange,n); |
|
else if(i==2){ |
|
n1=(NODE)BDY(n); |
|
n2=(NODE)(BDY(NEXT(n))); |
|
STOQ(MAXGC,mxgc);MKNODE(n,mxgc,0); |
|
MKNODE(n3,n1,n); |
|
MKNODE(n1,n2,n3); |
|
MKLIST(zrange,n1); |
|
} else error("conplot : zrange error"); |
|
} |
} |
break; |
break; |
case 2: |
case 2: case 3: |
case 3: |
av[0] = VR((P)BDY(BDY(range[0]))); |
av[0]=VR((P)BDY(BDY(range[0]))); |
av[1] = VR((P)BDY(BDY(range[1]))); |
av[1]=VR((P)BDY(BDY(range[1]))); |
if ( ((v[0] == av[0]) && (!v[1] || v[1] == av[1])) || |
if(((v[0]==av[0])&&(!v[1]||v[1]==av[1]))|| |
((v[0] == av[1]) && (!v[1] || v[1] == av[0])) ) { |
((v[0]==av[1])&&(!v[1]||v[1]==av[0]))){ |
xrange = range[0]; yrange = range[1]; |
xrange=range[0]; |
if ( ri == 3 ) |
yrange=range[1]; |
zrange = range[2]; |
if(ri==3) MKLIST(zrange,NEXT(BDY(range[2]))); |
|
else { |
else { |
for(i=0,n=(NODE)BDY(range[0]);n;n=NEXT(n),i++); |
MKNODE(n,0,defrange); MKLIST(zrange,n); |
MKNODE(n,0,defrange); |
|
MKLIST(zrange,n); |
|
} |
} |
} else error("conplot : invalid argument"); |
} else |
|
error("ifplot : invalid argument"); |
break; |
break; |
default: |
default: |
error("conplot : cannot happen"); |
error("ifplot : cannot happen"); break; |
break; |
|
} |
} |
/* conplot in ox_plot requires |
/* conplot in ox_plot requires |
[s_id (Q), |
[s_id (Q), |
formula (Obj), |
formula (Obj), |
xrange=[x,xmin,xmax] (LIST), |
xrange=[x,xmin,xmax] (LIST), |
yrange=[y,ymin,ymax] (LIST), |
yrange=[y,ymin,ymax] (LIST), |
zrange=[z,zmin,zmax,nstep] (LIST),z:dummy var |
zrange=[z,zmin,zmax] (LIST), |
geom=[xsize,ysize] (LIST), |
geom=[xsize,ysize] (LIST), |
wname=name (STRING)] |
wname=name (STRING)] |
*/ |
*/ |
stream=validate_ox_plot_stream(stream); |
|
|
stream = validate_ox_plot_stream(stream); |
STOQ(stream,s_id); |
STOQ(stream,s_id); |
if(!geom){ |
if ( !geom ) { |
STOQ(300,w300); |
STOQ(300,w300); |
MKNODE(n0,w300,0); |
MKNODE(n0,w300,0); MKNODE(n,w300,n0); MKLIST(geom,n); |
MKNODE(n,w300,n0); |
|
MKLIST(geom,n); |
|
} |
} |
if(is_memory){ |
if ( is_memory ) { |
MKSTR(fname,"memory_plot"); |
MKSTR(fname,"memory_plot"); |
arg=mknode(7,s_id,fname,poly,xrange,yrange,zrange,geom); |
arg = mknode(7,s_id,fname,poly,xrange,yrange,zrange,geom); |
Pox_rpc(arg,&t); |
Pox_rpc(arg,&t); |
arg=mknode(1,s_id); |
arg = mknode(1,s_id); |
Pox_pop_cmo(arg,rp); |
Pox_pop_cmo(arg,rp); |
} else { |
} else { |
//list check |
MKSTR(fname,CONPLOT); |
for(i=0,n=(NODE)BDY(xrange);n;i++,n=NEXT(n)); |
arg = mknode(8,s_id,fname,poly,xrange,yrange,zrange,geom,wname); |
if(i!=3)error("conplot : xrange error"); |
|
for(i=0,n=(NODE)BDY(yrange);n;i++,n=NEXT(n)); |
|
if(i!=3)error("conplot : yrange error"); |
|
for(i=0,n=(NODE)BDY(zrange);n;i++,n=NEXT(n)); |
|
if(i!=3)error("conplot : xrange error"); |
|
MKSTR(fname,pfunc[MODE_CONPLOT]); |
|
arg=mknode(8,s_id,fname,poly,xrange,yrange,zrange,geom,wname); |
|
Pox_rpc(arg,&t); |
Pox_rpc(arg,&t); |
*rp=(Obj)s_id; |
*rp = (Obj)s_id; |
} |
} |
} |
} |
|
|
void Pplot(NODE arg,Obj *rp){plot_main(arg,0,MODE_PLOT,rp);} |
void Pplot(NODE arg,Obj *rp){plot_main(arg,0,PLOT,rp);} |
void Pmemory_plot(NODE arg,Obj *rp){plot_main(arg,1,MODE_PLOT,rp);} |
void Pmemory_plot(NODE arg,Obj *rp){plot_main(arg,1,PLOT,rp);} |
|
|
void plot_main(NODE arg,int is_memory,int fn,Obj *rp){ |
void plot_main(NODE arg,int is_memory,char *fn,Obj *rp){ |
Q m2,p2,w300,s_id; |
Q m2,p2,w300,s_id; |
NODE defrange; |
NODE defrange; |
LIST xrange,range[1],list,geom; |
LIST xrange,range[1],list,geom; |
VL vl,vl0; |
VL vl,vl0; |
V v[1],av[1]; |
V v[1],av[1]; |
int stream,ri,i; |
int stream,ri,i,found_f; |
P poly; |
P poly; |
P var; |
P var; |
NODE n,n0; |
NODE n,n0; |
Line 455 void plot_main(NODE arg,int is_memory,int fn,Obj *rp){ |
|
Line 447 void plot_main(NODE arg,int is_memory,int fn,Obj *rp){ |
|
MKNODE(n,p2,0);MKNODE(defrange,m2,n); |
MKNODE(n,p2,0);MKNODE(defrange,m2,n); |
poly=0;vl=0;geom=0;wname=0;stream=-1;ri=0; |
poly=0;vl=0;geom=0;wname=0;stream=-1;ri=0; |
v[0]=0; |
v[0]=0; |
|
found_f = 0; |
for(;arg;arg=NEXT(arg) ) |
for(;arg;arg=NEXT(arg) ) |
if(!BDY(arg) ) |
if(!BDY(arg) ) |
stream=0; |
stream=0; |
Line 463 void plot_main(NODE arg,int is_memory,int fn,Obj *rp){ |
|
Line 456 void plot_main(NODE arg,int is_memory,int fn,Obj *rp){ |
|
case O_P: case O_R: |
case O_P: case O_R: |
poly=(P)BDY(arg); |
poly=(P)BDY(arg); |
get_vars_recursive((Obj)poly,&vl); |
get_vars_recursive((Obj)poly,&vl); |
for(vl0=vl, i=0;vl0;vl0=NEXT(vl0) ) |
for(vl0=vl, i=0;vl0;vl0=NEXT(vl0) ){ |
if(vl0->v->attr==(pointer)V_IND ) |
if(vl0->v->attr==(pointer)V_IND ){ |
if(i >= 1 ) |
if(i >= 1 ) error("ifplot : invalid argument"); |
error("ifplot : invalid argument"); |
else v[i++]=vl0->v; |
else |
} |
v[i++]=vl0->v; |
} |
if(i != 1 ) |
if(i != 1 ) error("ifplot : invalid argument"); |
error("ifplot : invalid argument"); |
found_f = 1; |
break; |
break; |
case O_LIST: |
case O_LIST: |
list=(LIST)BDY(arg); |
list=(LIST)BDY(arg); |
if(OID(BDY(BDY(list)))==O_P ) |
if(OID(BDY(BDY(list)))==O_P ){ |
if(ri > 0 ) |
if(ri > 0 ) error("plot : invalid argument"); |
error("plot : invalid argument"); |
else range[ri++]=list; |
else |
} else geom=list; |
range[ri++]=list; |
|
else |
|
geom=list; |
|
break; |
break; |
case O_N: |
case O_N: |
stream=QTOS((Q)BDY(arg));break; |
if ( !found_f ) { |
|
poly = (P)BDY(arg); |
|
makevar("x",&var); |
|
v[0] = VR(var); |
|
} else |
|
stream=QTOS((Q)BDY(arg)); |
|
break; |
case O_STR: |
case O_STR: |
wname=(STRING)BDY(arg);break; |
wname=(STRING)BDY(arg);break; |
default: |
default: |
Line 497 void plot_main(NODE arg,int is_memory,int fn,Obj *rp){ |
|
Line 493 void plot_main(NODE arg,int is_memory,int fn,Obj *rp){ |
|
break; |
break; |
case 1: |
case 1: |
av[0]=VR((P)BDY(BDY(range[0]))); |
av[0]=VR((P)BDY(BDY(range[0]))); |
if(v[0]==av[0] ) |
if(NUM(poly) || v[0]==av[0] ) |
xrange=range[0]; |
xrange=range[0]; |
else |
else |
error("plot : invalid argument"); |
error("plot : invalid argument"); |
Line 521 void plot_main(NODE arg,int is_memory,int fn,Obj *rp){ |
|
Line 517 void plot_main(NODE arg,int is_memory,int fn,Obj *rp){ |
|
MKNODE(n0,w300,0);MKNODE(n,w300,n0);MKLIST(geom,n); |
MKNODE(n0,w300,0);MKNODE(n,w300,n0);MKLIST(geom,n); |
} |
} |
if(is_memory ){ |
if(is_memory ){ |
MKSTR(fname,"memory_plot"); |
MKSTR(fname,MEMORY_PLOT); |
arg=mknode(7,s_id,fname,poly,xrange,NULLP,NULLP,geom); |
arg=mknode(7,s_id,fname,poly,xrange,NULLP,NULLP,geom); |
Pox_rpc(arg,&t); |
Pox_rpc(arg,&t); |
arg=mknode(1,s_id); |
arg=mknode(1,s_id); |
Pox_pop_cmo(arg,rp); |
Pox_pop_cmo(arg,rp); |
} else { |
} else { |
MKSTR(fname,pfunc[fn]); |
MKSTR(fname,fn); |
arg=mknode(8,s_id,fname,poly,xrange,NULLP,NULLP,geom,wname); |
arg=mknode(8,s_id,fname,poly,xrange,NULLP,NULLP,geom,wname); |
Pox_rpc(arg,&t); |
Pox_rpc(arg,&t); |
*rp=(Obj)s_id; |
*rp=(Obj)s_id; |
Line 538 void plot_main(NODE arg,int is_memory,int fn,Obj *rp){ |
|
Line 534 void plot_main(NODE arg,int is_memory,int fn,Obj *rp){ |
|
|
|
void Ppolarplot(NODE arg,Obj *rp){ |
void Ppolarplot(NODE arg,Obj *rp){ |
Q m2,p2,w300,s_id; |
Q m2,p2,w300,s_id; |
NODE defrange; |
NODE defrange,n,n0; |
LIST zrange,range[1],list,geom; |
LIST zrange,range[1],geom,list; |
VL vl,vl0; |
VL vl,vl0; |
V v[1],av[1]; |
V v[1],av[1]; |
int stream,ri,i; |
int stream,ri,i; |
P poly; |
P poly,var; |
P var; |
|
NODE n,n0; |
|
STRING fname,wname; |
STRING fname,wname; |
Real pi2; |
Real pi2; |
Obj t; |
Obj t; |
|
|
MKReal(2*Pi,pi2); |
MKReal(2*Pi,pi2);MKNODE(n,pi2,0); MKNODE(defrange,0,n); |
MKNODE(n,pi2,0);MKNODE(defrange,0,n); |
poly=0;vl=0;geom=0;wname=0;stream=-1;ri=0;v[0]=0; |
poly=0;vl=0;geom=0;wname=0;stream=-1;ri=0; |
for(;arg;arg=NEXT(arg)){ |
v[0]=0; |
if(!BDY(arg)) stream=0; |
for(;arg;arg=NEXT(arg) ) |
else switch(OID(BDY(arg))){ |
if(!BDY(arg) ) |
case O_P: case O_R://formular |
stream=0; |
poly=(P)BDY(arg); |
else |
get_vars_recursive((Obj)poly,&vl); |
switch ( OID(BDY(arg)) ){ |
for(vl0=vl,i=0;vl0;vl0=NEXT(vl0)) |
case O_P: case O_R: |
if(vl0->v->attr==(pointer)V_IND) |
poly=(P)BDY(arg); |
if(i>=1)error("polarplot : invalid argument"); |
get_vars_recursive((Obj)poly,&vl); |
else v[i++]=vl0->v; |
for(vl0=vl, i=0;vl0;vl0=NEXT(vl0) ) |
if(i!=1)error("polarplot : invalid argument"); |
if(vl0->v->attr==(pointer)V_IND ) |
|
if(i >= 1 ) |
|
error("polarplot : invalid argument"); |
|
else |
|
v[i++]=vl0->v; |
|
if(i != 1 ) |
|
error("polarplot : invalid argument"); |
|
break; |
|
case O_LIST: |
|
list=(LIST)BDY(arg); |
|
if(OID(BDY(BDY(list)))==O_P ) |
|
if(ri > 0 ) |
|
error("polarplot : invalid argument"); |
|
else |
|
range[ri++]=list; |
|
else |
|
geom=list; |
|
break; |
|
case O_N: |
|
stream=QTOS((Q)BDY(arg));break; |
|
case O_STR: |
|
wname=(STRING)BDY(arg);break; |
|
default: |
|
error("polarplot : invalid argument");break; |
|
} |
|
if(!poly ) |
|
error("polarplot : invalid argument"); |
|
switch ( ri ){ |
|
case 0: |
|
MKV(v[0],var);MKNODE(n,var,defrange);MKLIST(zrange,n); |
|
break; |
break; |
case 1: |
case O_LIST://range,geomerty |
av[0]=VR((P)BDY(BDY(range[0]))); |
list=(LIST)BDY(arg); |
if(v[0]==av[0] ) |
if(OID(BDY(BDY(list)))==O_P) |
zrange=range[0]; |
if(ri>0)error("polarplot : invalid argument"); |
else |
else range[ri++]=list; |
error("polarplot : invalid argument"); |
else geom=list; |
break; |
break; |
|
case O_N: |
|
stream=QTOS((Q)BDY(arg)); |
|
break; |
|
case O_STR://wname |
|
wname=(STRING)BDY(arg); |
|
break; |
default: |
default: |
error("polarplot : cannot happen");break; |
error("polarplot : invalid argument"); |
|
break; |
|
} |
} |
} |
|
//formular check |
|
if(!poly)error("polarplot : invalid argument"); |
|
switch (ri){ |
|
case 0: |
|
MKV(v[0],var); MKNODE(n,var,defrange); MKLIST(zrange,n); |
|
break; |
|
case 1: |
|
av[0]=VR((P)BDY(BDY(range[0]))); |
|
if(v[0]==av[0]) zrange = range[0]; |
|
else error("polarplot : invalid argument"); |
|
break; |
|
default: |
|
error("polarplot : cannot happen"); |
|
break; |
|
} |
stream=validate_ox_plot_stream(stream); |
stream=validate_ox_plot_stream(stream); |
STOQ(stream,s_id); |
STOQ(stream,s_id); |
if(!geom){ |
if(!geom){ |
STOQ(300,w300); |
STOQ(300,w300); |
MKNODE(n0,w300,0);MKNODE(n,w300,n0);MKLIST(geom,n); |
MKNODE(n0,w300,0); MKNODE(n,w300,n0); MKLIST(geom,n); |
} |
} |
MKSTR(fname,pfunc[MODE_POLARPLOT]); |
MKSTR(fname,POLARPLOT); |
arg=mknode(8,s_id,fname,poly,NULLP,NULLP,zrange,geom,wname); |
arg=mknode(8,s_id,fname,poly,NULLP,NULLP,zrange,geom,wname); |
Pox_rpc(arg,&t); |
Pox_rpc(arg,&t); |
*rp=(Obj)s_id; |
*rp=s_id; |
} |
} |
|
|
void Pplotover(NODE arg,Obj *rp){ |
void Pplotover(NODE arg,Obj *rp){ |
Line 626 void Pplotover(NODE arg,Obj *rp){ |
|
Line 613 void Pplotover(NODE arg,Obj *rp){ |
|
w_id=(Q)ARG2(arg); |
w_id=(Q)ARG2(arg); |
if(argc(arg)==4)color=(Q)ARG3(arg); |
if(argc(arg)==4)color=(Q)ARG3(arg); |
else color=0; |
else color=0; |
MKSTR(fname,"plotover"); |
MKSTR(fname,PLOTOVER); |
arg=mknode(5,s_id,fname,w_id,poly,color); |
arg=mknode(5,s_id,fname,w_id,poly,color); |
Pox_rpc(arg,&t); |
Pox_rpc(arg,&t); |
*rp=(Obj)s_id; |
*rp=(Obj)s_id; |
Line 645 void Pdrawcircle(NODE arg,Obj *rp){ |
|
Line 632 void Pdrawcircle(NODE arg,Obj *rp){ |
|
c=(Obj)ARG3(arg); |
c=(Obj)ARG3(arg); |
s_id=(Q)ARG4(arg); |
s_id=(Q)ARG4(arg); |
index=(Q)ARG5(arg); |
index=(Q)ARG5(arg); |
MKSTR(fname,"drawcircle"); |
MKSTR(fname,DRAWCIRCLE); |
n=mknode(3,x,y,r,c); |
n=mknode(3,x,y,r,c); |
MKLIST(pos,n); |
MKLIST(pos,n); |
arg=mknode(5,s_id,fname,index,pos,c); |
arg=mknode(5,s_id,fname,index,pos,c); |
Line 659 void Pdraw_obj(NODE arg,Obj *rp){ |
|
Line 646 void Pdraw_obj(NODE arg,Obj *rp){ |
|
LIST obj; |
LIST obj; |
Obj t; |
Obj t; |
|
|
if(!fname)MKSTR(fname,"draw_obj"); |
if(!fname)MKSTR(fname,DRAW_OBJ); |
s_id=(Q)ARG0(arg); |
s_id=(Q)ARG0(arg); |
index=(Q)ARG1(arg); |
index=(Q)ARG1(arg); |
obj=(LIST)ARG2(arg); |
obj=(LIST)ARG2(arg); |
Line 677 void Pdraw_string(NODE arg,Obj *rp){ |
|
Line 664 void Pdraw_string(NODE arg,Obj *rp){ |
|
LIST pos; |
LIST pos; |
Obj t; |
Obj t; |
|
|
if(!fname)MKSTR(fname,"draw_string"); |
if(!fname)MKSTR(fname,DRAW_STRING); |
s_id=(Q)ARG0(arg); |
s_id=(Q)ARG0(arg); |
index=(Q)ARG1(arg); |
index=(Q)ARG1(arg); |
pos=(LIST)ARG2(arg); |
pos=(LIST)ARG2(arg); |
Line 694 void Pclear_canvas(NODE arg,Obj *rp){ |
|
Line 681 void Pclear_canvas(NODE arg,Obj *rp){ |
|
Q s_id,index; |
Q s_id,index; |
Obj t; |
Obj t; |
|
|
if(!fname) MKSTR(fname,"clear_canvas"); |
if(!fname) MKSTR(fname,CLEAR_CANVAS); |
s_id=(Q)ARG0(arg); |
s_id=(Q)ARG0(arg); |
index=(Q)ARG1(arg); |
index=(Q)ARG1(arg); |
arg=mknode(3,s_id,fname,index); |
arg=mknode(3,s_id,fname,index); |
Line 712 void Pclear_canvas(NODE arg,Obj *rp){ |
|
Line 699 void Pclear_canvas(NODE arg,Obj *rp){ |
|
void ListCheck(char * head,LIST list){ |
void ListCheck(char * head,LIST list){ |
int i; |
int i; |
NODE n; |
NODE n; |
printf("%s\n",head); |
|
if(!list){ |
if(!list){ |
printf("zero list\n"); |
printf("%s zero \n",head); |
return; |
return; |
} |
} |
|
for(i=0,n=(NODE)BDY(list);n;i++,n=NEXT(n)); |
|
printf("%s length %d\n",head,i); |
for(i=0,n=(NODE)BDY(list);n;i++,n=NEXT(n)){ |
for(i=0,n=(NODE)BDY(list);n;i++,n=NEXT(n)){ |
if(!BDY(n))printf("%d 0\n",i); |
if(!BDY(n))printf("%d 0\n",i); |
else if(OID(BDY(n))==O_P) printf("%d poly\n",i); |
else if(OID(BDY(n))==O_P) printf("%d poly\n",i); |
else printf("%d %d\n",i,QTOS((Q)BDY(n))); |
else if(OID(BDY(n))==O_R) printf("%d real\n",i); |
|
else if(OID(BDY(n))==O_N) printf("%d %d\n",i,QTOS((Q)BDY(n))); |
} |
} |
} |
} |
|
|
void PifplotD(NODE arg,Obj *rp){ifplot_mainNG(arg,MODE_IFPLOTD,rp);} |
void PifplotD(NODE arg,Obj *rp){ifplot_mainNG(arg,IFPLOTD,rp);} |
void PifplotQ(NODE arg,Obj *rp){ifplot_mainNG(arg,MODE_IFPLOTQ,rp);} |
void PifplotQ(NODE arg,Obj *rp){ifplot_mainNG(arg,IFPLOTQ,rp);} |
void PifplotB(NODE arg,Obj *rp){ifplot_mainNG(arg,MODE_IFPLOTB,rp);} |
void PifplotB(NODE arg,Obj *rp){ifplot_mainNG(arg,IFPLOTB,rp);} |
|
|
void PconplotD(NODE arg,Obj *rp){ifplot_mainNG(arg,MODE_CONPLOTD,rp);} |
void PconplotD(NODE arg,Obj *rp){ifplot_mainNG(arg,CONPLOTD,rp);} |
void PconplotQ(NODE arg,Obj *rp){ifplot_mainNG(arg,MODE_CONPLOTQ,rp);} |
void PconplotQ(NODE arg,Obj *rp){ifplot_mainNG(arg,CONPLOTQ,rp);} |
void PconplotB(NODE arg,Obj *rp){ifplot_mainNG(arg,MODE_CONPLOTB,rp);} |
void PconplotB(NODE arg,Obj *rp){ifplot_mainNG(arg,CONPLOTB,rp);} |
|
|
void PineqnD(NODE arg,Obj *rp){ifplot_mainNG(arg,MODE_INEQND,rp);} |
void PineqnD(NODE arg,Obj *rp){ifplot_mainNG(arg,INEQND,rp);} |
void PineqnQ(NODE arg,Obj *rp){ifplot_mainNG(arg,MODE_INEQNQ,rp);} |
void PineqnQ(NODE arg,Obj *rp){ifplot_mainNG(arg,INEQNQ,rp);} |
void PineqnB(NODE arg,Obj *rp){ifplot_mainNG(arg,MODE_INEQNB,rp);} |
void PineqnB(NODE arg,Obj *rp){ifplot_mainNG(arg,INEQNB,rp);} |
|
|
#if defined(INTERVAL) |
#if defined(INTERVAL) |
void Pitvifplot(NODE arg,Obj *rp){ifplot_mainNG(arg,MODE_ITVIFPLOT,rp);} |
void Pitvifplot(NODE arg,Obj *rp){ifplot_mainNG(arg,ITVIFPLOT,rp);} |
#endif |
#endif |
|
|
void PineqnorD(NODE arg,Obj *rp){ifplot_mainOP(arg,MODE_INEQNORD,rp);} |
void PineqnorD(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNDOR,rp);} |
void PineqnorQ(NODE arg,Obj *rp){ifplot_mainOP(arg,MODE_INEQNORQ,rp);} |
void PineqnorQ(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNQOR,rp);} |
void PineqnorB(NODE arg,Obj *rp){ifplot_mainOP(arg,MODE_INEQNORB,rp);} |
void PineqnorB(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNBOR,rp);} |
|
|
void PineqnandD(NODE arg,Obj *rp){ifplot_mainOP(arg,MODE_INEQNANDD,rp);} |
void PineqnandD(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNDAND,rp);} |
void PineqnandQ(NODE arg,Obj *rp){ifplot_mainOP(arg,MODE_INEQNANDQ,rp);} |
void PineqnandQ(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNQAND,rp);} |
void PineqnandB(NODE arg,Obj *rp){ifplot_mainOP(arg,MODE_INEQNANDB,rp);} |
void PineqnandB(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNBAND,rp);} |
|
|
void PineqnxorD(NODE arg,Obj *rp){ifplot_mainOP(arg,MODE_INEQNXORD,rp);} |
void PineqnxorD(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNDXOR,rp);} |
void PineqnxorQ(NODE arg,Obj *rp){ifplot_mainOP(arg,MODE_INEQNXORQ,rp);} |
void PineqnxorQ(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNQXOR,rp);} |
void PineqnxorB(NODE arg,Obj *rp){ifplot_mainOP(arg,MODE_INEQNXORB,rp);} |
void PineqnxorB(NODE arg,Obj *rp){plotover_mainNG(arg,INEQNBXOR,rp);} |
|
|
void PplotoverD(NODE arg,Obj *rp){plotover_mainNG(arg,MODE_PLOTOVERD,rp);} |
void PplotoverD(NODE arg,Obj *rp){plotover_mainNG(arg,PLOTOVERD,rp);} |
void PplotoverQ(NODE arg,Obj *rp){plotover_mainNG(arg,MODE_PLOTOVERQ,rp);} |
void PplotoverQ(NODE arg,Obj *rp){plotover_mainNG(arg,PLOTOVERQ,rp);} |
void PplotoverB(NODE arg,Obj *rp){plotover_mainNG(arg,MODE_PLOTOVERB,rp);} |
void PplotoverB(NODE arg,Obj *rp){plotover_mainNG(arg,PLOTOVERB,rp);} |
|
|
void ifplot_mainNG(NODE arg,int fn,Obj *rp){ |
void Pobj_cp(NODE arg,Obj *rp){ |
Q m2,p2,w300,mxgc,s_id,color,idv; |
//copy canvas |
|
//1:and,3:copy,6:xor,7:or |
|
Q sysid,index_A,index_B,op_code; |
|
STRING fname; |
|
Obj t; |
|
sysid=(Q)ARG0(arg); |
|
index_A=(Q)ARG1(arg); |
|
index_B=(Q)ARG2(arg); |
|
op_code=(Q)ARG3(arg); |
|
MKSTR(fname,OBJ_CP); |
|
arg=mknode(5,sysid,fname,index_A,index_B,op_code); |
|
Pox_rpc(arg,&t); |
|
*rp=(Obj)sysid; |
|
} |
|
|
|
void PpolarplotD(NODE arg,Obj *rp){ |
|
Q m2,p2,w300,defstep,s_id,color; |
NODE defrange,n,n0,n1,n2; |
NODE defrange,n,n0,n1,n2; |
|
LIST range,geom,list[2]; |
|
VL vl,vl0; |
|
V v[1],av; |
|
int stream,ri,i,len,iNo,lNo,vNo,sNo,pfine,findG; |
P poly,var; |
P poly,var; |
|
STRING fname,wname; |
|
Real pi2; |
|
Obj t,frst,sec,thr; |
|
char ebuf[BUFSIZ]; |
|
|
|
iNo=lNo=sNo=findG=0;pfine=TRUE; |
|
poly=0;vl=0;geom=0;wname=0;color=0;stream=-1;ri=0;v[0]=0; |
|
for(;arg;arg=NEXT(arg)){ |
|
if(!BDY(arg)) iNo++; |
|
else switch(OID(BDY(arg))){ |
|
case O_P: case O_R://formular |
|
poly=(P)BDY(arg); |
|
get_vars_recursive((Obj)poly,&vl); |
|
for(vl0=vl,vNo=0;vl0;vl0=NEXT(vl0)){ |
|
if(vl0->v->attr==(pointer)V_IND){ |
|
if(vNo>=1){ |
|
sprintf(ebuf,"%s : invalaid argument",POLARPLOT); |
|
error(ebuf); |
|
} else v[vNo++]=vl0->v; |
|
} |
|
} |
|
if(vNo!=1){ |
|
sprintf(ebuf,"%s : only uni-variate formular",POLARPLOT); |
|
error(ebuf); |
|
} |
|
break; |
|
case O_N://color,id,idx,division |
|
switch (iNo){ |
|
case 0://color arg |
|
color=(Q)BDY(arg); |
|
iNo++; |
|
break; |
|
case 1://stream arg |
|
stream=QTOS((Q)BDY(arg)); |
|
iNo++; |
|
break; |
|
default://error |
|
sprintf(ebuf,"%s : invalid number arguments",POLARPLOT); |
|
error(ebuf); |
|
break; |
|
} |
|
break; |
|
case O_LIST://range,geomerty |
|
if(lNo<2)list[lNo++]=(LIST)BDY(arg); |
|
else { |
|
sprintf(ebuf,"%s : invalid list argument",POLARPLOT); |
|
error(ebuf); |
|
} |
|
break; |
|
case O_STR://wname |
|
wname=(STRING)BDY(arg); |
|
sNo++; |
|
break; |
|
default: |
|
break; |
|
} |
|
} |
|
//formular check |
|
if(!poly){ |
|
sprintf(ebuf,"%s : invalid plot argument",POLARPLOT); |
|
error(ebuf); |
|
} |
|
//vars check |
|
get_vars_recursive((Obj)poly,&vl); |
|
for(vl0=vl,vNo=0;vl0;vNo++,vl0=NEXT(vl0)){ |
|
if(vl0->v->attr==(pointer)V_IND){ |
|
if(vNo>=2){ |
|
sprintf(ebuf,"%s : invalid plot argument",POLARPLOT); |
|
error(ebuf); |
|
} else v[vNo]=vl0->v; |
|
} |
|
} |
|
//list check |
|
for(i=0;i<lNo;i++){ |
|
if(OID(BDY(BDY(list[i])))!=O_P){ |
|
// list first value is number (geometry) |
|
for(len=0,n=(NODE)BDY(list[i]);n;len++,n=NEXT(n)){ |
|
if(len==0) frst=BDY(n); |
|
else if(len==1) sec=BDY(n); |
|
else { |
|
sprintf(ebuf,"%s : geometry list too long",POLARPLOT); |
|
error(ebuf); |
|
} |
|
} |
|
if(len!=2){ |
|
sprintf(ebuf,"%s : geometry requierd 2 numbers", POLARPLOT); |
|
error(ebuf); |
|
} else geom=list[i]; |
|
} else { |
|
//list first value is var (range) |
|
av=VR((P)BDY(BDY(list[i]))); |
|
if(v[0]==av)range=list[i]; |
|
else { |
|
sprintf(ebuf,"%s : invalid list length",POLARPLOT); |
|
error(ebuf); |
|
} |
|
} |
|
} |
|
// set default |
|
if(!range){ |
|
STOQ(DEFAULTPOLARSTEP,defstep);MKReal(2*Pi,pi2);MKV(v[0],var); |
|
MKNODE(n,defstep,0);MKNODE(n1,pi2,n);MKNODE(n2,0,n1); |
|
MKNODE(defrange,var,n2);MKLIST(range,defrange); |
|
} |
|
if(!geom){ |
|
STOQ(300,w300);MKNODE(n0,w300,0);MKNODE(n,w300,n0);MKLIST(geom,n); |
|
} |
|
stream=validate_ox_plot_stream(stream); |
|
STOQ(stream,s_id); |
|
MKSTR(fname,POLARPLOTD); |
|
arg=mknode(7,s_id,fname,poly,color,range,geom,wname); |
|
Pox_rpc(arg,&t); |
|
*rp=(Obj)s_id; |
|
} |
|
|
|
void ifplot_mainNG(NODE arg,char *fn,Obj *rp){ |
|
Q m2,p2,w300,mxgc,s_id,color; |
|
NODE defrange,n,n0,n1,n2; |
|
P poly,var; |
VL vl,vl0; |
VL vl,vl0; |
V v[2],av; |
V v[2],av; |
LIST xrange,yrange,zrange,geom,range[2],list[4]; |
LIST xrange,yrange,zrange,geom,range[2],list[4]; |
Line 769 void ifplot_mainNG(NODE arg,int fn,Obj *rp){ |
|
Line 897 void ifplot_mainNG(NODE arg,int fn,Obj *rp){ |
|
char ebuf[BUFSIZ]; |
char ebuf[BUFSIZ]; |
|
|
iNo=lNo=sNo=findG=0;pfine=TRUE; |
iNo=lNo=sNo=findG=0;pfine=TRUE; |
poly=0;stream=-1;wname=0;color=0;idv=0;stream=0; |
poly=0;stream=-1;wname=0;color=0;stream=0; |
STOQ(-2,m2);STOQ(2,p2);MKNODE(n,p2,0);MKNODE(defrange,m2,n); |
STOQ(-2,m2);STOQ(2,p2);MKNODE(n,p2,0);MKNODE(defrange,m2,n); |
STOQ(MAXGC,mxgc); |
STOQ(MAXGC,mxgc); |
for(;arg;arg=NEXT(arg)){ |
for(;arg;arg=NEXT(arg)){ |
Line 780 void ifplot_mainNG(NODE arg,int fn,Obj *rp){ |
|
Line 908 void ifplot_mainNG(NODE arg,int fn,Obj *rp){ |
|
poly=(P)BDY(arg); |
poly=(P)BDY(arg); |
pfine=FALSE; |
pfine=FALSE; |
} else { |
} else { |
sprintf(ebuf,"%s : to many ploy arguments",pfunc[fn]); |
sprintf(ebuf,"%s : to many plot arguments",fn); |
error(ebuf); |
error(ebuf); |
} |
} |
break; |
break; |
Line 794 void ifplot_mainNG(NODE arg,int fn,Obj *rp){ |
|
Line 922 void ifplot_mainNG(NODE arg,int fn,Obj *rp){ |
|
stream=QTOS((Q)BDY(arg)); |
stream=QTOS((Q)BDY(arg)); |
iNo++; |
iNo++; |
break; |
break; |
case 2: //division arg |
default: |
if(fn==MODE_ITVIFPLOT){//itvifplot |
sprintf(ebuf,"%s : invalid number arguments",fn); |
idv=(Q)BDY(arg); |
|
iNo++; |
|
} else {//others |
|
sprintf(ebuf,"%s : invalid number arguments",pfunc[fn]); |
|
error(ebuf); |
|
} |
|
break; |
|
case 3:// error |
|
sprintf(ebuf,"%s : invalid number arguments",pfunc[fn]); |
|
error(ebuf); |
error(ebuf); |
break; |
break; |
} |
} |
Line 812 void ifplot_mainNG(NODE arg,int fn,Obj *rp){ |
|
Line 931 void ifplot_mainNG(NODE arg,int fn,Obj *rp){ |
|
case O_LIST://xrange,yrange,zrange,geometry |
case O_LIST://xrange,yrange,zrange,geometry |
if(lNo<4) list[lNo++]=(LIST)BDY(arg); |
if(lNo<4) list[lNo++]=(LIST)BDY(arg); |
else { |
else { |
sprintf(ebuf,"%s : invalid list argument",pfunc[fn]); |
sprintf(ebuf,"%s : invalid list argument",fn); |
error(ebuf); |
error(ebuf); |
} |
} |
break; |
break; |
Line 826 void ifplot_mainNG(NODE arg,int fn,Obj *rp){ |
|
Line 945 void ifplot_mainNG(NODE arg,int fn,Obj *rp){ |
|
} |
} |
// formular check |
// formular check |
if(!poly){ |
if(!poly){ |
sprintf(ebuf,"%s : invalid ploy argument",pfunc[fn]); |
sprintf(ebuf,"%s : invalid plot argument",fn); |
error(ebuf); |
error(ebuf); |
} |
} |
// vars check |
// vars check |
get_vars_recursive((Obj)poly,&vl); |
get_vars_recursive((Obj)poly,&vl); |
for(vl0=vl,vNo=0;vl0;vl0=NEXT(vl0)) |
for(vl0=vl,vNo=0;vl0;vl0=NEXT(vl0)){ |
if(vl0->v->attr==(pointer)V_IND) |
if(vl0->v->attr==(pointer)V_IND){ |
if(vNo>=2){ |
if(vNo>=2){ |
sprintf(ebuf,"%s : invalid ploy argument",pfunc[fn]); |
sprintf(ebuf,"%s : invalid plot argument",fn); |
error(ebuf); |
error(ebuf); |
} else v[vNo++]=vl0->v; |
} else v[vNo++]=vl0->v; |
|
} |
|
} |
//list check |
//list check |
xrange=yrange=zrange=geom=0;frst=sec=thr=0; |
xrange=yrange=zrange=geom=0;frst=sec=thr=0; |
for(i=0;i<lNo;i++){ |
for(i=0;i<lNo;i++){ |
for(llen=0,n=(NODE)BDY(list[i]);n;llen++,n=NEXT(n)); |
for(llen=0,n=(NODE)BDY(list[i]);n;llen++,n=NEXT(n)); |
if(llen>4){ |
if(llen>4){ |
sprintf(ebuf,"%s : invalid list length",pfunc[fn]); |
sprintf(ebuf,"%s : invalid list length",fn); |
error(ebuf); |
error(ebuf); |
} |
} |
if(OID(BDY(BDY(list[i])))!=O_P){ |
if(OID(BDY(BDY(list[i])))!=O_P){ |
Line 854 void ifplot_mainNG(NODE arg,int fn,Obj *rp){ |
|
Line 975 void ifplot_mainNG(NODE arg,int fn,Obj *rp){ |
|
} |
} |
switch(len){ |
switch(len){ |
case 2: |
case 2: |
if(!zrange){ |
if(!strcmp(fn,CONPLOT)){ |
if(thr==0)thr=(Obj)mxgc; |
if(thr==0)thr=(Obj)mxgc; |
MKNODE(n,thr,0);MKNODE(n1,sec,n);MKNODE(n2,frst,n1);MKLIST(zrange,n2); |
MKNODE(n,thr,0);MKNODE(n1,sec,n);MKNODE(n2,frst,n1);MKLIST(zrange,n2); |
} else geom=list[i]; |
} else geom=list[i]; |
Line 865 void ifplot_mainNG(NODE arg,int fn,Obj *rp){ |
|
Line 986 void ifplot_mainNG(NODE arg,int fn,Obj *rp){ |
|
case 0: |
case 0: |
case 1: |
case 1: |
default: |
default: |
sprintf(ebuf,"%s : invalid list length",pfunc[fn]); |
sprintf(ebuf,"%s : invalid list length",fn); |
error(ebuf); |
error(ebuf); |
break; |
break; |
} |
} |
Line 889 void ifplot_mainNG(NODE arg,int fn,Obj *rp){ |
|
Line 1010 void ifplot_mainNG(NODE arg,int fn,Obj *rp){ |
|
if(!geom){ |
if(!geom){ |
STOQ(300,w300);MKNODE(n0,w300,0);MKNODE(n,w300,n0);MKLIST(geom,n); |
STOQ(300,w300);MKNODE(n0,w300,0);MKNODE(n,w300,n0);MKLIST(geom,n); |
} |
} |
if(fn==MODE_CONPLOTD||fn==MODE_CONPLOTQ||fn==MODE_CONPLOTB) if(!zrange){ |
if(!(strcmp(fn,CONPLOTD)&strcmp(fn,CONPLOTQ)&strcmp(fn,CONPLOTB))&!zrange){ |
MKNODE(n,mxgc,0);MKNODE(n1,m2,n);MKNODE(n2,m2,n1);MKLIST(zrange,n2); |
MKNODE(n,mxgc,0);MKNODE(n1,m2,n);MKNODE(n2,m2,n1);MKLIST(zrange,n2); |
} |
} |
/*new ifplot in ox_plot requires |
/*new ifplot in ox_plot requires |
Line 901 void ifplot_mainNG(NODE arg,int fn,Obj *rp){ |
|
Line 1022 void ifplot_mainNG(NODE arg,int fn,Obj *rp){ |
|
yrange=[y,ymin,ymax] (LIST optional), |
yrange=[y,ymin,ymax] (LIST optional), |
zrange=[zmin,zmax,zstep] (LIST optional), |
zrange=[zmin,zmax,zstep] (LIST optional), |
wname=name (STRING optional)], |
wname=name (STRING optional)], |
itvstep (Q) if MODE_ITVIFPLOT */ |
itvstep (Q) if ITVIFPLOT */ |
stream=validate_ox_plot_stream(stream); |
stream=validate_ox_plot_stream(stream); |
STOQ(stream,s_id); |
STOQ(stream,s_id); |
MKSTR(fname,pfunc[fn]); |
MKSTR(fname,fn); |
/* |
arg=mknode(9,s_id,fname,poly,color,xrange,yrange,zrange,geom,wname); |
printf("%s\n",pfunc[fn]); |
|
ListCheck("xrange",xrange); |
|
ListCheck("yrange",yrange); |
|
ListCheck("zrange",zrange); |
|
ListCheck("geom",geom); |
|
*/ |
|
if(fn==MODE_ITVIFPLOT) |
|
arg=mknode(10,s_id,fname,poly,color,xrange,yrange,zrange,geom,wname,idv); |
|
else arg=mknode(9,s_id,fname,poly,color,xrange,yrange,zrange,geom,wname); |
|
Pox_rpc(arg,&t); |
Pox_rpc(arg,&t); |
*rp=(Obj)s_id; |
*rp=(Obj)s_id; |
} |
} |
|
|
void ifplot_mainOP(NODE arg,int fn,Obj *rp){ |
void plotover_mainNG(NODE arg,char *fn,Obj *rp){ |
/* |
|
new ineqnXX in ox_plot requires |
|
[s_id (Q), |
|
w_id (Q), |
|
formula (Obj), |
|
color (Q)] |
|
*/ |
|
Q s_id,w_id,color; |
Q s_id,w_id,color; |
P poly; |
P poly; |
STRING fname; |
STRING fname; |
Line 944 void ifplot_mainOP(NODE arg,int fn,Obj *rp){ |
|
Line 1049 void ifplot_mainOP(NODE arg,int fn,Obj *rp){ |
|
poly=(P)BDY(arg); |
poly=(P)BDY(arg); |
pfine=FALSE; |
pfine=FALSE; |
} else { |
} else { |
sprintf(ebuf,"%s : to many ploy arguments",pfunc[fn]); |
sprintf(ebuf,"%s : to many plot arguments",fn); |
error(ebuf); |
error(ebuf); |
} |
} |
break; |
break; |
Line 963 void ifplot_mainOP(NODE arg,int fn,Obj *rp){ |
|
Line 1068 void ifplot_mainOP(NODE arg,int fn,Obj *rp){ |
|
iNo++; |
iNo++; |
break; |
break; |
default://error |
default://error |
sprintf(ebuf,"%s : to many numbers",pfunc[fn]); |
sprintf(ebuf,"%s : to many numbers",fn); |
error(ebuf); |
error(ebuf); |
break; |
break; |
} |
} |
break; |
break; |
default: |
default: |
sprintf(ebuf,"%s : arguments type miss match",pfunc[fn]); |
sprintf(ebuf,"%s : arguments type miss match",fn); |
error(ebuf); |
error(ebuf); |
} |
} |
} |
} |
MKSTR(fname,pfunc[fn]); |
MKSTR(fname,fn); |
/* |
//[s_id (Q), w_id (Q), formula (Obj), color (Q)] |
printf("fname %s\n",BDY(fname)); |
|
printf("s_id %d\n",QTOS((Q)s_id)); |
|
printf("w_id %d\n",QTOS((Q)w_id)); |
|
printf("color %d\n",QTOS((Q)color)); |
|
*/ |
|
arg=mknode(5,s_id,fname,w_id,poly,color); |
|
Pox_rpc(arg,&t); |
|
*rp=(Obj)s_id; |
|
} |
|
|
|
void plotover_mainNG(NODE arg,int fn,Obj *rp){ |
|
/* |
|
[s_id (Q), |
|
w_id (Q), |
|
formula (Obj), |
|
color (Q)] |
|
*/ |
|
Q s_id,w_id,color; |
|
P poly; |
|
STRING fname; |
|
Obj t; |
|
int iNo,pfine,sfine; |
|
char ebuf[BUFSIZ]; |
|
|
|
pfine=sfine=TRUE; |
|
iNo=0;poly=0;color=s_id=w_id=0; |
|
for(;arg;arg=NEXT(arg)){ |
|
if(!BDY(arg)) iNo++; |
|
else switch(OID(BDY(arg))){ |
|
case O_P://formular |
|
if(pfine){ |
|
poly=(P)BDY(arg); |
|
pfine=FALSE; |
|
} else { |
|
sprintf(ebuf,"%s : to many ploy arguments",pfunc[fn]); |
|
error(ebuf); |
|
} |
|
break; |
|
case O_N://color,s_id,w_id |
|
switch(iNo){ |
|
case 0://color arg |
|
color=(Q)BDY(arg); |
|
iNo++; |
|
break; |
|
case 1://stream arg |
|
s_id=(Q)BDY(arg); |
|
iNo++; |
|
break; |
|
case 2://window arg |
|
w_id=(Q)BDY(arg); |
|
iNo++; |
|
break; |
|
default://error |
|
sprintf(ebuf,"%s : to many numbers",pfunc[fn]); |
|
error(ebuf); |
|
break; |
|
} |
|
break; |
|
default: |
|
sprintf(ebuf,"%s : arguments type miss match",pfunc[fn]); |
|
error(ebuf); |
|
} |
|
} |
|
MKSTR(fname,pfunc[fn]); |
|
/* |
|
printf("fname %s\n",BDY(fname)); |
|
printf("s_id %d\n",QTOS((Q)s_id)); |
|
printf("w_id %d\n",QTOS((Q)w_id)); |
|
printf("color %d\n",QTOS((Q)color)); |
|
*/ |
|
arg=mknode(5,s_id,fname,w_id,poly,color); |
arg=mknode(5,s_id,fname,w_id,poly,color); |
Pox_rpc(arg,&t); |
Pox_rpc(arg,&t); |
*rp=(Obj)s_id; |
*rp=(Obj)s_id; |