Annotation of OpenXM_contrib2/asir2000/plot/if.c, Revision 1.25
1.2 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.3 noro 26: * e-mail at risa-admin@sec.flab.fujitsu.co.jp of the detailed specification
1.2 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.25 ! noro 48: * $OpenXM: OpenXM_contrib2/asir2000/plot/if.c,v 1.24 2013/12/19 05:48:24 saito Exp $
1.2 noro 49: */
1.1 noro 50: #include "ca.h"
51: #include "parse.h"
52: #include "ox.h"
53: #include "ifplot.h"
54:
1.22 saito 55: #if defined(INTERVAL)
1.24 saito 56: // Time message and func
1.22 saito 57: #include <sys/types.h>
58: #include <sys/resource.h>
59: #include <sys/time.h>
60:
61: static struct oEGT ltime;
62: static double r0;
63: double get_rtime();
64: #if defined(ITV_TIME_CHECK)
65: void tstart()
66: {
67: get_eg(<ime);
1.24 saito 68: r0=get_rtime();
1.22 saito 69: }
70:
71: void tstop(struct canvas *can)
72: {
73: struct oEGT egt1;
74: double e, g, r;
75: char ts[100];
76: void popdown_warning();
77: Widget warnshell,warndialog;
78:
79: get_eg(&egt1);
1.24 saito 80: e=egt1.exectime - ltime.exectime;
81: g=egt1.gctime - ltime.gctime;
82: r=get_rtime() - r0;
1.22 saito 83: sprintf(ts,"(%8.6f + gc %8.6f) total %8.6f \n",e,g,r);
84: create_popup(can->shell,"Message",&ts,&warnshell,&warndialog);
85: XawDialogAddButton(warndialog,"OK",popdown_warning,warnshell);
86: XtPopup(warnshell,XtGrabNone);
87: SetWM_Proto(warnshell);
88: }
89: #else
90: #define tstart()
91: #define tstop(a)
92: #endif
93: #endif
94:
1.8 noro 95: extern JMP_BUF ox_env;
1.1 noro 96:
1.24 saito 97: int open_canvas(NODE arg){
1.4 noro 98: int id;
99: struct canvas *can;
100: LIST wsize;
101: STRING wname;
102:
1.24 saito 103: wsize=(LIST)ARG0(arg);
104: wname=(STRING)ARG1(arg);
105: can=canvas[id=search_canvas()];
106: can->mode=MODE_INTERACTIVE;
107: if(!wsize){
108: can->width=DEFAULTWIDTH;
109: can->height=DEFAULTHEIGHT;
1.4 noro 110: } else {
1.24 saito 111: can->width=QTOS((Q)BDY(BDY(wsize)));
112: can->height=QTOS((Q)BDY(NEXT(BDY(wsize))));
1.4 noro 113: }
1.24 saito 114: if(wname)can->wname=BDY(wname);
115: else can->wname="";
1.4 noro 116: create_canvas(can);
117: return id;
118: }
119:
1.24 saito 120:
121: int plot(NODE arg,int fn){
1.1 noro 122: int id;
123: NODE n;
124: struct canvas *can;
125: P formula;
126: LIST xrange,yrange,zrange,wsize;
127: STRING wname;
1.12 noro 128: V v;
1.1 noro 129:
1.24 saito 130: formula=(P)ARG0(arg);
131: xrange=(LIST)ARG1(arg);
132: yrange=(LIST)ARG2(arg);
133: zrange=(LIST)ARG3(arg);
134: wsize=(LIST)ARG4(arg);
135: wname=(STRING)ARG5(arg);
136: can=canvas[id=search_canvas()];
137: if(xrange){
138: n=BDY(xrange);can->vx=VR((P)BDY(n));n=NEXT(n);
139: can->qxmin=(Q)BDY(n);n=NEXT(n);can->qxmax=(Q)BDY(n);
140: can->xmin=ToReal(can->qxmin);can->xmax=ToReal(can->qxmax);
141: }
142: if(yrange){
143: n=BDY(yrange);can->vy=VR((P)BDY(n));n=NEXT(n);
144: can->qymin=(Q)BDY(n);n=NEXT(n);can->qymax=(Q)BDY(n);
145: can->ymin=ToReal(can->qymin);can->ymax=ToReal(can->qymax);
146: }
147: can->mode=fn;
148: if(zrange){
149: n=BDY(zrange); can->zmin=ToReal(BDY(n));
150: n=NEXT(n);can->zmax=ToReal(BDY(n));
151: n=NEXT(n);
152: if(can->mode==MODE_CONPLOT)can->nzstep=QTOS((Q)BDY(n));
1.12 noro 153: else {
1.24 saito 154: can->vx=VR((P)BDY(BDY(zrange)));
155: can->nzstep=QTOS((Q)BDY(n));
1.12 noro 156: }
157: }
1.24 saito 158: if(!wsize){
159: can->width=DEFAULTWIDTH;
160: can->height=DEFAULTHEIGHT;
1.1 noro 161: } else {
1.24 saito 162: can->width=QTOS((Q)BDY(BDY(wsize)));
163: can->height=QTOS((Q)BDY(NEXT(BDY(wsize))));
1.1 noro 164: }
1.24 saito 165: if(wname) can->wname = BDY(wname);
166: else can->wname="";
167: can->formula=formula;
168: if(can->mode==MODE_PLOT){
169: //plot
1.1 noro 170: plotcalc(can);
1.14 noro 171: create_canvas(can);
1.1 noro 172: plot_print(display,can);
1.24 saito 173: } else if(can->mode==MODE_POLARPLOT){
174: //polarplot
1.12 noro 175: polarplotcalc(can);
1.14 noro 176: create_canvas(can);
1.12 noro 177: plot_print(display,can);
1.14 noro 178: } else {
1.24 saito 179: //ifplot,conplot
1.14 noro 180: create_canvas(can);
1.24 saito 181: ifplotmainOld(can);
1.12 noro 182: }
1.1 noro 183: copy_to_canvas(can);
184: return id;
185: }
186:
1.24 saito 187: void ifplotmainOld(struct canvas *can){
188: int i,width,height;
189: double ** tabe;
190:
191: width=can->width;height=can->height;
192: tabe=(double **)ALLOCA((width+1)*sizeof(double *));
193: for(i=0;i<width;i++)tabe[i]=(double *)ALLOCA((height+1)*sizeof(double));
194: define_cursor(can->window,runningcur);
195: set_busy(can); set_selection();
196: calc(tabe,can,0);
197: if_printOld(display,tabe,can);
198: reset_selection(); reset_busy(can);
199: define_cursor(can->window,normalcur);
200: }
201:
202: int memory_plot(NODE arg,LIST *bytes){
1.6 noro 203: NODE n;
204: struct canvas tmp_can;
205: struct canvas *can;
206: P formula;
207: LIST xrange,yrange,zrange,wsize;
208: int width,height;
209: double **tabe;
210: int i;
211: BYTEARRAY barray;
212: Q qw,qh;
213:
1.24 saito 214: formula=(P)ARG0(arg);
215: xrange=(LIST)ARG1(arg);
216: yrange=(LIST)ARG2(arg);
217: zrange=(LIST)ARG3(arg);
218: wsize=(LIST)ARG4(arg);
1.6 noro 219:
1.19 noro 220: bzero((char *)&tmp_can,sizeof(tmp_can));
1.24 saito 221: can=&tmp_can;
222: n=BDY(xrange); can->vx=VR((P)BDY(n)); n=NEXT(n);
223: can->qxmin=(Q)BDY(n); n=NEXT(n); can->qxmax=(Q)BDY(n);
224: can->xmin=ToReal(can->qxmin); can->xmax=ToReal(can->qxmax);
225: if( yrange ){
226: n=BDY(yrange); can->vy=VR((P)BDY(n)); n=NEXT(n);
227: can->qymin=(Q)BDY(n); n=NEXT(n); can->qymax=(Q)BDY(n);
228: can->ymin=ToReal(can->qymin); can->ymax=ToReal(can->qymax);
229: if( zrange ){
230: n=NEXT(BDY(zrange));
231: can->zmin=ToReal(BDY(n)); n=NEXT(n); can->zmax=ToReal(BDY(n));
232: if(n=NEXT(n)) can->nzstep=QTOS((Q)BDY(n));
233: else can->nzstep=MAXGC;
234: can->mode=MODE_CONPLOT;
1.6 noro 235: } else
1.24 saito 236: can->mode=MODE_IFPLOT;
1.6 noro 237: } else
1.24 saito 238: can->mode=MODE_PLOT;
239: if( !wsize ){
240: can->width=DEFAULTWIDTH; can->height=DEFAULTHEIGHT;
1.6 noro 241: } else {
1.24 saito 242: can->width=QTOS((Q)BDY(BDY(wsize)));
243: can->height=QTOS((Q)BDY(NEXT(BDY(wsize))));
1.6 noro 244: }
1.24 saito 245: can->wname="";
246: can->formula=formula;
247: if( can->mode == MODE_PLOT ){
1.6 noro 248: plotcalc(can);
1.19 noro 249: memory_print(can,&barray);
250: STOQ(can->width,qw); STOQ(can->height,qh);
1.24 saito 251: n=mknode(3,qw,qh,barray);
1.19 noro 252: MKLIST(*bytes,n);
253: } else {
1.24 saito 254: width=can->width; height=can->height;
255: tabe=(double **)ALLOCA(width*sizeof(double *));
256: for( i=0; i<width; i++ )
257: tabe[i]=(double *)ALLOCA(height*sizeof(double));
1.6 noro 258: calc(tabe,can,1);
259: memory_if_print(tabe,can,&barray);
260: STOQ(width,qw); STOQ(height,qh);
1.24 saito 261: n=mknode(3,qw,qh,barray);
1.6 noro 262: MKLIST(*bytes,n);
263: }
264: }
265:
1.24 saito 266: int plotover(NODE arg){
267: int id,orgcolor,color;
1.1 noro 268: P formula;
269: struct canvas *can;
270: VL vl,vl0;
271:
1.24 saito 272: id=QTOS((Q)ARG0(arg));
273: formula=(P)ARG1(arg);
274: color=QTOS((Q)ARG2(arg));
275:
276: can=canvas[id];
277: orgcolor=can->color;
278: can->color=color;
1.7 noro 279: get_vars_recursive((Obj)formula,&vl);
1.24 saito 280: for(vl0=vl;vl0;vl0=NEXT(vl0))
281: if(vl0->v->attr==(pointer)V_IND)
282: if(vl->v!=can->vx && vl->v!=can->vy)return -1;
283: if(argc(arg)==3) can->color=QTOS((Q)ARG2(arg));
284: else can->color=0;
1.18 noro 285: #if !defined(VISUAL)
1.17 noro 286: set_drawcolor(can->color);
1.18 noro 287: #endif
1.24 saito 288: current_can=can;
289: can->formula=formula;
290: if(can->mode==MODE_PLOT){
1.21 saito 291: plotcalc(can);
292: plot_print(display,can);
1.24 saito 293: } else ifplotmainOld(can);
1.21 saito 294: copy_to_canvas(can);
1.24 saito 295: can->color=color;
1.21 saito 296: #if !defined(VISUAL)
297: set_drawcolor(can->color);
298: #endif
1.1 noro 299: return index;
300: }
301:
1.24 saito 302: int drawcircle(NODE arg){
1.4 noro 303: #if !defined(VISUAL)
1.24 saito 304: int id,index,wx,wy,wr,c;
1.1 noro 305: pointer ptr;
306: Q ret;
307: LIST xyr;
308: Obj x,y,r;
309: struct canvas *can;
310:
1.24 saito 311: index=QTOS((Q)ARG0(arg));
312: xyr=(LIST)ARG1(arg);
313: x=(Obj)ARG0(BDY(xyr)); y=(Obj)ARG1(BDY(xyr)); r=(Obj)ARG2(BDY(xyr));
314: c=QTOS((Q)ARG2(arg));
315: can=canvas[index];
316: if(!can->window)return -1;
1.1 noro 317: else {
1.24 saito 318: current_can=can;
1.21 saito 319: set_drawcolor(c);
1.24 saito 320: wx=(ToReal(x)-can->xmin)*can->width/(can->xmax-can->xmin);
321: wy=(can->ymax-ToReal(y))*can->height/(can->ymax-can->ymin);
322: wr=ToReal(r);
1.21 saito 323: XFillArc(display,can->pix,cdrawGC,wx-wr/2,wy-wr/2,wr,wr,0,360*64);
1.1 noro 324: copy_to_canvas(can);
1.21 saito 325: set_drawcolor(can->color);
1.1 noro 326: return index;
327: }
1.4 noro 328: #endif
329: }
330:
1.24 saito 331: int draw_obj(NODE arg){
332: int index,color,x,y,u,v,len,r;
1.4 noro 333: NODE obj,n;
334: RealVect *vect;
335: struct canvas *can;
336:
1.24 saito 337: index=QTOS((Q)ARG0(arg));
338: can=canvas[index];
339: if(!can && closed_canvas[index]){
340: canvas[index]=closed_canvas[index];
341: closed_canvas[index]=0;
342: can=canvas[index];
1.10 noro 343: popup_canvas(index);
1.24 saito 344: current_can=can;
345: } else if(!can||(can && !can->window)){
1.5 noro 346: set_lasterror("draw_obj : canvas does not exist");
1.4 noro 347: return -1;
1.5 noro 348: }
1.4 noro 349:
1.24 saito 350: obj=BDY((LIST)ARG1(arg));
351: if(argc(arg)== 3) color=QTOS((Q)ARG2(arg));
352: else color=0; // black
353: switch(len=length(obj)){
354: case 2: // point
355: x=(int)ToReal((Q)ARG0(obj)); y=(int)ToReal((Q)ARG1(obj));
1.5 noro 356: draw_point(display,can,x,y,color);
1.16 noro 357: MKRVECT3(vect,x,y,color); MKNODE(n,vect,can->history);
1.24 saito 358: can->history=n;
1.5 noro 359: break;
1.24 saito 360: case 3: // circle
361: x=(int)ToReal((Q)ARG0(obj)); y=(int)ToReal((Q)ARG1(obj));
362: r=(int)ToReal((Q)ARG2(obj));
1.16 noro 363: MKRVECT4(vect,x,y,r,color); MKNODE(n,vect,can->history);
1.24 saito 364: can->history=n;
1.4 noro 365: break;
1.24 saito 366: case 4: // line
367: x=(int)ToReal((Q)ARG0(obj)); y=(int)ToReal((Q)ARG1(obj));
368: u=(int)ToReal((Q)ARG2(obj)); v=(int)ToReal((Q)ARG3(obj));
1.5 noro 369: draw_line(display,can,x,y,u,v,color);
1.16 noro 370: MKRVECT5(vect,x,y,u,v,color); MKNODE(n,vect,can->history);
1.24 saito 371: can->history=n;
1.4 noro 372: break;
373: default:
1.5 noro 374: set_lasterror("draw_obj : invalid request");
1.4 noro 375: return -1;
376: }
1.21 saito 377: #if !defined(VISUAL)
378: set_drawcolor(can->color);
379: #endif
1.9 noro 380: return 0;
381: }
382:
1.24 saito 383: int draw_string(NODE arg){
384: int index,x,y,color;
1.9 noro 385: char *str;
386: NODE pos;
387: struct canvas *can;
388:
1.24 saito 389: index=QTOS((Q)ARG0(arg));
390: can=canvas[index];
391: if(!can && closed_canvas[index]){
392: canvas[index]=closed_canvas[index];
393: closed_canvas[index]=0;
394: can=canvas[index];
1.11 noro 395: popup_canvas(index);
1.24 saito 396: current_can=can;
397: } else if(!can||(can && !can->window)){
1.11 noro 398: set_lasterror("draw_obj : canvas does not exist");
1.9 noro 399: return -1;
400: }
401:
1.24 saito 402: pos=BDY((LIST)ARG1(arg));
403: str=BDY((STRING)ARG2(arg));
404: if(argc(arg)==4)color=QTOS((Q)ARG3(arg));
405: else color=0; // black
406: x=(int)ToReal((Q)ARG0(pos));
407: y=(int)ToReal((Q)ARG1(pos));
1.9 noro 408: draw_character_string(display,can,x,y,str,color);
1.21 saito 409: #if !defined(VISUAL)
410: set_drawcolor(can->color);
411: #endif
1.4 noro 412: return 0;
413: }
414:
1.24 saito 415: int clear_canvas(NODE arg){
1.4 noro 416: int index;
417: struct canvas *can;
418:
1.24 saito 419: index=QTOS((Q)ARG0(arg));
420: can=canvas[index];
421: if(!can||!can->window) return -1;
1.4 noro 422: clear_pixmap(can);
423: copy_to_canvas(can);
1.24 saito 424: // clear the history
425: can->history=0;
1.1 noro 426: }
427:
428: #define RealtoDbl(r) ((r)?BDY(r):0.0)
429:
1.24 saito 430: int arrayplot(NODE arg){
1.1 noro 431: int id,ix,w,h;
432: VECT array;
433: LIST xrange,wsize;
434: char *wname;
435: NODE n;
436: double ymax,ymin,dy,xstep;
437: Real *tab;
438: struct canvas *can;
439: POINT *pa;
440:
1.24 saito 441: array=(VECT)ARG0(arg);
442: xrange=(LIST)ARG1(arg);
443: can=canvas[id=search_canvas()];
444: n=BDY(xrange); can->vx=VR((P)BDY(n)); n=NEXT(n);
445: can->qxmin=(Q)BDY(n); n=NEXT(n); can->qxmax=(Q)BDY(n);
446: can->xmin=ToReal(can->qxmin); can->xmax=ToReal(can->qxmax);
447: if(!wsize){
448: can->width=DEFAULTWIDTH;
449: can->height=DEFAULTHEIGHT;
1.1 noro 450: } else {
1.24 saito 451: can->width=QTOS((Q)BDY(BDY(wsize)));
452: can->height=QTOS((Q)BDY(NEXT(BDY(wsize))));
1.1 noro 453: }
1.24 saito 454: can->wname=wname; can->formula=0; can->mode=MODE_PLOT;
1.1 noro 455: create_canvas(can);
1.24 saito 456: w=array->len;
457: h=can->height;
458: tab=(Real *)BDY(array);
459: if(can->ymax==can->ymin){
460: for(ymax=ymin=RealtoDbl(tab[0]),ix=1; ix<w; ix++){
461: if(RealtoDbl(tab[ix])>ymax)ymax=RealtoDbl(tab[ix]);
462: if(RealtoDbl(tab[ix])<ymin)ymin=RealtoDbl(tab[ix]);
1.1 noro 463: }
1.24 saito 464: can->ymax=ymax;
465: can->ymin=ymin;
1.1 noro 466: } else {
1.24 saito 467: ymax=can->ymax;
468: ymin=can->ymin;
1.1 noro 469: }
1.24 saito 470: dy=ymax-ymin;
471: can->pa=(struct pa *)MALLOC(sizeof(struct pa));
472: can->pa[0].length=w;
473: can->pa[0].pos=pa=(POINT *)MALLOC(w*sizeof(POINT));
474: xstep=(double)can->width/(double)(w-1);
475: for(ix=0;ix<w;ix++){
1.1 noro 476: #ifndef MAXSHORT
477: #define MAXSHORT ((short)0x7fff)
478: #endif
479: double t;
480:
1.24 saito 481: pa[ix].x=(int)(ix*xstep);
482: t=(h - 1)*(ymax - RealtoDbl(tab[ix]))/dy;
483: if(t>MAXSHORT)pa[ix].y=MAXSHORT;
484: else if(t<-MAXSHORT)pa[ix].y=-MAXSHORT;
485: else pa[ix].y=(long)t;
1.1 noro 486: }
487: plot_print(display,can);
488: copy_to_canvas(can);
489: return id;
490: }
491:
1.24 saito 492: void ifplot_resize(struct canvas *can,POINT spos,POINT epos){
1.1 noro 493: struct canvas *ncan;
494: struct canvas fakecan;
495: Q dx,dy,dx2,dy2,xmin,xmax,ymin,ymax,xmid,ymid;
496: Q sx,sy,ex,ey,cw,ch,ten,two;
497: Q s,t;
498: int new;
499: int w,h,m;
500:
1.24 saito 501: if(XC(spos)<XC(epos) && YC(spos)<YC(epos)){
502: if(can->precise && !can->wide){
503: fakecan=*can;
504: ncan=&fakecan;
1.1 noro 505: } else {
1.24 saito 506: new=search_canvas();
507: ncan=canvas[new];
1.1 noro 508: }
1.24 saito 509: ncan->mode=can->mode;
510: ncan->zmin=can->zmin; ncan->zmax=can->zmax;
511: ncan->nzstep=can->nzstep;
512: ncan->wname=can->wname;
513: ncan->vx=can->vx; ncan->vy=can->vy;
514: ncan->formula=can->formula;
515: w=XC(epos)-XC(spos);
516: h=YC(epos)-YC(spos);
517: m=MAX(can->width,can->height);
518: if(can->precise){
519: ncan->width=w;
520: ncan->height=h;
521: } else if(w>h){
522: ncan->width=m;
523: ncan->height=m*h/w;
1.1 noro 524: } else {
1.24 saito 525: ncan->width=m*w/h;
526: ncan->height=m;
1.1 noro 527: }
1.24 saito 528: if(can->wide){
529: STOQ(10,ten);
530: STOQ(2,two);
531: subq(can->qxmax,can->qxmin,&t);
532: mulq(t,ten,&dx);
533: subq(can->qymax,can->qymin,&t);
534: mulq(t,ten,&dy);
535: addq(can->qxmax,can->qxmin,&t);
536: divq(t,two,&xmid);
537: addq(can->qymax,can->qymin,&t);
538: divq(t,two,&ymid);
539: divq(dx,two,&dx2);
540: divq(dy,two,&dy2);
541: subq(xmid,dx2,&xmin);
542: addq(xmid,dx2,&xmax);
543: subq(ymid,dy2,&ymin);
544: addq(ymid,dy2,&ymax);
1.1 noro 545: } else {
1.24 saito 546: subq(can->qxmax,can->qxmin,&dx);
547: subq(can->qymax,can->qymin,&dy);
548: xmin=can->qxmin;
549: xmax=can->qxmax;
550: ymin=can->qymin;
551: ymax=can->qymax;
1.1 noro 552: }
553: STOQ(XC(spos),sx); STOQ(YC(spos),sy); STOQ(XC(epos),ex); STOQ(YC(epos),ey);
554: STOQ(can->width,cw); STOQ(can->height,ch);
555: mulq(sx,dx,&t); divq(t,cw,&s); addq(xmin,s,&ncan->qxmin);
556: mulq(ex,dx,&t); divq(t,cw,&s); addq(xmin,s,&ncan->qxmax);
557: mulq(ey,dy,&t); divq(t,ch,&s); subq(ymax,s,&ncan->qymin);
558: mulq(sy,dy,&t); divq(t,ch,&s); subq(ymax,s,&ncan->qymax);
1.24 saito 559: ncan->xmin=ToReal(ncan->qxmin); ncan->xmax=ToReal(ncan->qxmax);
560: ncan->ymin=ToReal(ncan->qymin); ncan->ymax=ToReal(ncan->qymax);
561: if(can->precise && !can->wide){
562: current_can=can;
1.1 noro 563: alloc_pixmap(ncan);
1.4 noro 564: #if defined(VISUAL)
1.24 saito 565: ncan->real_can=can;
1.4 noro 566: #endif
1.1 noro 567: qifplotmain(ncan);
568: copy_subimage(ncan,can,spos);
569: copy_to_canvas(can);
570: } else {
571: create_canvas(ncan);
1.24 saito 572: if( can->precise ) qifplotmain(ncan);
573: else ifplotmain(ncan);
1.1 noro 574: copy_to_canvas(ncan);
575: }
576: }
577: }
578:
1.24 saito 579: void plot_resize(struct canvas *can,POINT spos,POINT epos){
1.1 noro 580: struct canvas *ncan;
581: Q dx,dx2,xmin,xmax,xmid;
1.7 noro 582: double dy,ymin,ymax,ymid;
1.1 noro 583: Q sx,ex,cw,ten,two;
584: Q s,t;
585: int new;
586: int w,h,m;
587:
1.24 saito 588: if( XC(spos)<XC(epos) && YC(spos)<YC(epos) ){
589: new=search_canvas(); ncan=canvas[new];
590: ncan->mode=can->mode;
591: ncan->zmin=can->zmin; ncan->zmax=can->zmax;
592: ncan->nzstep=can->nzstep;
593: ncan->wname=can->wname;
594: ncan->vx=can->vx; ncan->vy=can->vy;
595: ncan->formula=can->formula;
596: w=XC(epos)-XC(spos);
597: h=YC(epos)-YC(spos);
598: m=MAX(can->width,can->height);
599: if( w>h ){
600: ncan->width=m; ncan->height=m * h/w;
1.1 noro 601: } else {
1.24 saito 602: ncan->width=m * w/h; ncan->height=m;
1.1 noro 603: }
1.24 saito 604: if( can->wide ){
1.1 noro 605: STOQ(10,ten); STOQ(2,two);
606: subq(can->qxmax,can->qxmin,&t); mulq(t,ten,&dx);
607: addq(can->qxmax,can->qxmin,&t); divq(t,two,&xmid);
608: divq(dx,two,&dx2); subq(xmid,dx2,&xmin); addq(xmid,dx2,&xmax);
609:
1.24 saito 610: dy=(can->ymax-can->ymin)*10;
611: ymid=(can->ymax+can->ymin)/2;
612: ymin=ymid-dy/2; ymax=ymid+dy/2;
1.1 noro 613: } else {
614: subq(can->qxmax,can->qxmin,&dx);
1.24 saito 615: xmin=can->qxmin; xmax=can->qxmax;
1.1 noro 616:
1.24 saito 617: dy=can->ymax-can->ymin;
618: ymin=can->ymin; ymax=can->ymax;
1.1 noro 619: }
620: STOQ(XC(spos),sx); STOQ(XC(epos),ex); STOQ(can->width,cw);
621: mulq(sx,dx,&t); divq(t,cw,&s); addq(xmin,s,&ncan->qxmin);
622: mulq(ex,dx,&t); divq(t,cw,&s); addq(xmin,s,&ncan->qxmax);
1.24 saito 623: ncan->xmin=ToReal(ncan->qxmin); ncan->xmax=ToReal(ncan->qxmax);
1.1 noro 624:
1.24 saito 625: ncan->ymin=ymax-YC(epos)*dy/can->height;
626: ncan->ymax=ymax-YC(spos)*dy/can->height;
1.1 noro 627:
628: create_canvas(ncan);
629: plotcalc(ncan);
630: plot_print(display,ncan);
631: copy_to_canvas(ncan);
632: }
633: }
634:
1.24 saito 635: void qifplotmain(struct canvas *can)
1.1 noro 636: {
637: int width,height;
1.24 saito 638: char **tabe,*tabeb;
1.1 noro 639: int i;
640:
1.24 saito 641: width=can->width; height=can->height;
642: tabe=(char **)ALLOCA(width*sizeof(char *)+width*height*sizeof(char));
643: bzero((void *)tabe,width*sizeof(char *)+width*height*sizeof(char));
644: for( i=0, tabeb=(char *)(tabe+width); i<width; i++ )
645: tabe[i]=tabeb + height*i;
1.1 noro 646: define_cursor(can->window,runningcur);
647: set_busy(can); set_selection();
1.24 saito 648: qcalc(tabe,can); qif_print(display,tabe,can);
1.1 noro 649: reset_selection(); reset_busy(can);
650: define_cursor(can->window,normalcur);
651: }
652:
1.24 saito 653: //*******************ifplotNG
654: int ifplotNG(NODE arg,char *func){
655: int id,orgcolor,color,op_code;
656: NODE n;
657: struct canvas *can;
658: P formula;
659: LIST xrange,yrange,zrange,wsize;
660: STRING wname;
661:
662: formula=(P)ARG0(arg);
663: color=QTOS((Q)ARG1(arg));
664: xrange=(LIST)ARG2(arg);
665: yrange=(LIST)ARG3(arg);
666: zrange=(LIST)ARG4(arg);
667: wsize=(LIST)ARG5(arg);
668: wname=(STRING)ARG6(arg);
669:
670: can=canvas[id=search_canvas()];
671: orgcolor=can->color;
672: can->color=color;
673: can->division=0;
674: // set canvas data
675: if(xrange){
676: n=BDY(xrange); can->vx=VR((P)BDY(n)); n=NEXT(n);
677: can->qxmin=(Q)BDY(n); n=NEXT(n); can->qxmax=(Q)BDY(n);
678: can->xmin=ToReal(can->qxmin); can->xmax=ToReal(can->qxmax);
679: }
680: if(yrange){
681: n=BDY(yrange); can->vy=VR((P)BDY(n)); n=NEXT(n);
682: can->qymin=(Q)BDY(n); n=NEXT(n); can->qymax=(Q)BDY(n);
683: can->ymin=ToReal(can->qymin); can->ymax=ToReal(can->qymax);
684: }
685: if(zrange){
686: n=BDY(zrange); can->zmin=ToReal(BDY(n));
687: n=NEXT(n); can->zmax=ToReal(BDY(n));
688: n=NEXT(n); can->nzstep=QTOS((Q)BDY(n));
689: }
690: if(!wsize){
691: can->width=DEFAULTWIDTH;
692: can->height=DEFAULTHEIGHT;
693: } else {
694: can->width=QTOS((Q)BDY(BDY(wsize)));
695: can->height=QTOS((Q)BDY(NEXT(BDY(wsize))));
696: }
697: if(wname) can->wname=BDY(wname);
698: else can->wname="";
699: can->formula=formula;
700: set_drawcolor(color);
701: if(!strcmp(func,"ifplot"))can->mode=MODE_IFPLOT;
702: else if(!strcmp(func,"ifplotD"))can->mode=MODE_IFPLOTD;
703: else if(!strcmp(func,"ifplotQ"))can->mode=MODE_IFPLOTQ;
704: else if(!strcmp(func,"ifplotB"))can->mode=MODE_IFPLOTB;
705: else if(!strcmp(func,"ineqnD"))can->mode=MODE_INEQND;
706: else if(!strcmp(func,"ineqnQ"))can->mode=MODE_INEQNQ;
707: else if(!strcmp(func,"ineqnB"))can->mode=MODE_INEQNB;
708: else if(!strcmp(func,"conplotD"))can->mode=MODE_CONPLOTD;
709: else if(!strcmp(func,"conplotQ"))can->mode=MODE_CONPLOTQ;
710: else if(!strcmp(func,"conplotB"))can->mode=MODE_CONPLOTB;
711: else if(!strcmp(func,"itvifplot")){
712: can->mode=MODE_ITVIFPLOT;
713: can->division=QTOS((Q)ARG7(arg));
714: }
715: else can->mode=MODE_IFPLOTD;
716: create_canvas(can);
717: ifplotmain(can);
718: set_drawcolor(orgcolor);
719: copy_to_canvas(can);
720: can->color=orgcolor;
721: return id;
722: }
723:
724: int ifplotOP(NODE arg,char *func){
725: //ineqnor[D,Q,B],ineqnand[D,Q,B],ineqnxor[D,Q,b]
726: int index,orgcolor,color,op_code;
727: NODE n;
728: struct canvas *can;
729: P formula;
730: //s_id,fname,w_id,poly,color
731: index=QTOS((Q)ARG0(arg));
732: formula=(P)ARG1(arg);
733: color=QTOS((Q)ARG2(arg));
734: can=canvas[index];
735: orgcolor=can->color;
736: can->color=color;
737: // set canvas data
738: can->formula=formula;
739: if(!strcmp(func,"ineqnandD"))can->mode=MODE_INEQNANDD;
740: else if(!strcmp(func,"ineqnandQ"))can->mode=MODE_INEQNANDQ;
741: else if(!strcmp(func,"ineqnandB"))can->mode=MODE_INEQNANDB;
742: else if(!strcmp(func,"ineqnorD"))can->mode=MODE_INEQNORD;
743: else if(!strcmp(func,"ineqnorQ"))can->mode=MODE_INEQNORQ;
744: else if(!strcmp(func,"ineqnorB"))can->mode=MODE_INEQNORB;
745: else if(!strcmp(func,"ineqnxorD"))can->mode=MODE_INEQNXORD;
746: else if(!strcmp(func,"ineqnxorQ"))can->mode=MODE_INEQNXORQ;
747: else if(!strcmp(func,"ineqnxorB"))can->mode=MODE_INEQNXORB;
748: else if(!strcmp(func,"plotoverD"))can->mode=MODE_PLOTOVERD;
749: else if(!strcmp(func,"plotoverQ"))can->mode=MODE_PLOTOVERQ;
750: else if(!strcmp(func,"plotoverB"))can->mode=MODE_PLOTOVERB;
751: else can->mode=MODE_IFPLOTD;
752: set_drawcolor(color);
753: ifplotmain(can);
754: set_drawcolor(orgcolor);
755: copy_to_canvas(can);
756: can->color=orgcolor;
757: return index;
758: }
759:
760: void ifplotmain(struct canvas *can){
761: int width,height,i,j,ix,iy,**mask;
762: double **tabe;
1.1 noro 763:
1.24 saito 764: width=can->width; height=can->height;
765: tabe=(double **)ALLOCA((width+1)*sizeof(double *));
766: for(i=0;i<width;i++)tabe[i]=(double *)ALLOCA((height+1)*sizeof(double));
1.1 noro 767: define_cursor(can->window,runningcur);
768: set_busy(can); set_selection();
1.24 saito 769: set_drawcolor(can->color);
770: switch(can->mode){
771: case MODE_IFPLOTD:
772: calc(tabe,can,0);
773: if_print(display,tabe,can,1);
774: break;
775: case MODE_IFPLOTQ:
776: calcq(tabe,can,0);
777: if_print(display,tabe,can,1);
778: break;
779: case MODE_IFPLOTB:
780: calcb(tabe,can,0);
781: if_print(display,tabe,can,0);
782: break;
1.25 ! noro 783: #if defined(INTERVAL)
1.24 saito 784: case MODE_INEQND:
785: calc(tabe,can,0);
786: area_print(display,tabe,can,0);
787: break;
788: case MODE_INEQNQ:
789: calcq(tabe,can,0);
790: area_print(display,tabe,can,0);
791: break;
792: case MODE_INEQNB:
793: calcb(tabe,can,0);
794: area_print(display,tabe,can,0);
795: break;
796: case MODE_INEQNANDD:
797: calc(tabe,can,0);
798: area_print(display,tabe,can,0);
799: break;
800: case MODE_INEQNANDQ:
801: calcq(tabe,can,0);
802: area_print(display,tabe,can,2);
803: break;
804: case MODE_INEQNANDB:
805: calcb(tabe,can,0);
806: area_print(display,tabe,can,2);
807: break;
808: case MODE_INEQNORD:
809: calc(tabe,can,0);
810: area_print(display,tabe,can,3);
811: break;
812: case MODE_INEQNORQ:
813: calcq(tabe,can,0);
814: area_print(display,tabe,can,3);
815: break;
816: case MODE_INEQNORB:
817: calcb(tabe,can,0);
818: area_print(display,tabe,can,3);
819: break;
820: case MODE_INEQNXORD:
821: calc(tabe,can,0);
822: area_print(display,tabe,can,4);
823: break;
824: case MODE_INEQNXORQ:
825: calcq(tabe,can,0);
826: area_print(display,tabe,can,4);
827: break;
828: case MODE_INEQNXORB:
829: calcb(tabe,can,0);
830: area_print(display,tabe,can,4);
831: break;
832: case MODE_CONPLOTD:
833: calc(tabe,can,0);
834: con_print(display,tabe,can);
835: break;
836: case MODE_CONPLOTB:
837: calcb(tabe,can,0);
838: con_print(display,tabe,can);
839: break;
840: case MODE_CONPLOTQ:
841: calcq(tabe,can,0);
842: con_print(display,tabe,can);
843: break;
844: case MODE_PLOTOVERD:
845: calc(tabe,can,0);
846: over_print(display,tabe,can,0);
847: break;
848: case MODE_PLOTOVERQ:
849: calcq(tabe,can,0);
850: over_print(display,tabe,can,0);
851: break;
852: case MODE_PLOTOVERB:
853: calcb(tabe,can,0);
854: over_print(display,tabe,can,0);
855: break;
856: case MODE_ITVIFPLOT:
857: itvcalc(tabe,can,1);
858: if_print(display,tabe,can,1);
859: break;
860: #endif
861: }
862: set_drawcolor(can->color);
1.1 noro 863: reset_selection(); reset_busy(can);
864: define_cursor(can->window,normalcur);
865: }
1.22 saito 866:
1.25 ! noro 867: #if defined(INTERVAL)
1.24 saito 868: int objcp(NODE arg){
1.22 saito 869: int idsrc, idtrg, op_code;
870: struct canvas *cansrc, *cantrg;
871:
1.24 saito 872: idsrc=QTOS((Q)ARG0(arg));
873: idtrg=QTOS((Q)ARG1(arg));
874: op_code=QTOS((Q)ARG2(arg));
875: cansrc=canvas[idsrc];
876: cantrg=canvas[idtrg];
1.22 saito 877: obj_op(cansrc, cantrg, op_code);
878: return idsrc;
879: }
880:
1.24 saito 881: void obj_op(struct canvas *cansrc, struct canvas *cantrg, int op){
1.22 saito 882: XImage *imgsrc, *imgtrg;
883: int width, height, i, j;
884: unsigned long src, trg, black, white;
885:
1.24 saito 886: width=cansrc->width; height=cansrc->height;
887: imgsrc=XGetImage(display, cansrc->pix, 0, 0, width, height, -1, ZPixmap);
888: imgtrg=XGetImage(display, cantrg->pix, 0, 0, width, height, -1, ZPixmap);
1.22 saito 889: black=GetColor(display, "black");
890: white=GetColor(display, "white");
891: flush();
892: define_cursor(cantrg->window,runningcur);
893: set_busy(cantrg); set_selection();
1.24 saito 894: cantrg->precise=cansrc->precise;
895: cantrg->noaxis=cansrc->noaxis;
896: cantrg->noaxisb=cansrc->noaxisb;
897: cantrg->vx=cansrc->vx;
898: cantrg->vy=cansrc->vy;
899: cantrg->formula=cansrc->formula;
900: cantrg->width=cansrc->width;
901: cantrg->height=cansrc->height;
902: cantrg->xmin=cansrc->xmin;
903: cantrg->xmax=cansrc->xmax;
904: cantrg->ymin=cansrc->ymin;
905: cantrg->ymax=cansrc->ymax;
906: cantrg->zmin=cansrc->zmin;
907: cantrg->zmax=cansrc->zmax;
908: cantrg->nzstep=cansrc->nzstep;
909: cantrg->qxmin=cansrc->qxmin;
910: cantrg->qxmax=cansrc->qxmax;
911: cantrg->qymin=cansrc->qymin;
912: cantrg->qymax=cansrc->qymax;
913: cantrg->pa=cansrc->pa;
914: switch(op){
1.22 saito 915: case 1:/* and case */
916: for(i=0;i<width;i++)for(j=0;j<height;j++){
1.24 saito 917: src=XGetPixel(imgsrc,i,j);
918: trg=XGetPixel(imgtrg,i,j);
919: if( (src == black) || (trg == black) )
1.22 saito 920: XPutPixel(imgtrg,i,j,black);
1.24 saito 921: else if( (src == white) || (trg == white) )
1.22 saito 922: XPutPixel(imgtrg,i,j,white);
923: else XPutPixel(imgtrg,i,j,(src & trg));
924: }
925: break;
926: case 3:/* copy case */
1.24 saito 927: imgtrg->data=imgsrc->data;
1.22 saito 928: break;
929: case 6:/* xor case */
930: for(i=0;i<width;i++)for(j=0;j<height;j++){
1.24 saito 931: src=XGetPixel(imgsrc,i,j);
932: trg=XGetPixel(imgtrg,i,j);
933: if( (src == black) || (trg == black) )
1.22 saito 934: XPutPixel(imgtrg,i,j,black);
1.24 saito 935: else if( (src == white) && (trg == white) )
1.22 saito 936: XPutPixel(imgtrg,i,j,trg|src);
1.24 saito 937: else if( (src != white) && (trg != white) )
1.22 saito 938: XPutPixel(imgtrg,i,j,white);
1.24 saito 939: else if( src == white )
1.22 saito 940: XPutPixel(imgtrg,i,j,src);
941: }
942: break;
943: case 7:/* or case */
944: for(i=0;i<width;i++)for(j=0;j<height;j++){
1.24 saito 945: src=XGetPixel(imgsrc,i,j);
946: trg=XGetPixel(imgtrg,i,j);
947: if( (src == black) || (trg == black) )
1.22 saito 948: XPutPixel(imgtrg,i,j,black);
1.24 saito 949: else if(src == white)
1.22 saito 950: XPutPixel(imgtrg,i,j,trg);
1.24 saito 951: else if(trg == white)
1.22 saito 952: XPutPixel(imgtrg,i,j,src);
953: }
954: break;
955: default:
956: break;
957: }
958: XPutImage(display, cantrg->pix, drawGC, imgtrg, 0, 0, 0, 0, width, height);
959: reset_selection(); reset_busy(cantrg);
960: define_cursor(cantrg->window,normalcur);
961: copy_to_canvas(cantrg);
962: count_and_flush();
963: flush();
964: }
965:
1.24 saito 966: //ifplotNG
967: /*
1.22 saito 968: int ineqnover(NODE arg)
969: {
1.24 saito 970: int id;
971: struct canvas *can;
972: int orgcolor, op_code;
973:
974: id = QTOS((Q)ARG0(arg));
975: can = canvas[id];
976: orgcolor = can->color;
977: can->formula = (P)ARG1(arg);
978: can->color = QTOS((Q)ARG2(arg));
979: op_code = QTOS((Q)ARG3(arg));
980: can->mode = MODE_INEQNP;
981: ineqnmain(can, orgcolor, op_code);
982: return id;
1.22 saito 983: }
984: void ineqnmain(struct canvas *can, int orgcolor, int op_code)
985: {
1.24 saito 986: int **mask;
987: double **tbl;
988: int i,j;
989:
990: current_can = can;
991: tbl = (double **)ALLOCA((can->height+1)*sizeof(double *));
992: for ( i = 0; i <= can->height; i++ )
993: tbl[i] = (double *)ALLOCA((can->width+1)*sizeof(double));
994: mask = (int **)ALLOCA(can->height*sizeof(int *));
995: for ( i = 0; i < can->height; i++)
996: mask[i] = (int *)ALLOCA(can->width*sizeof(int));
997:
998: define_cursor(can->window,runningcur);
999: set_busy(can); set_selection();
1000: // ineqncalc(tbl, can, 1);
1001: calc(tab,can,1);
1002: for (j = 0; j < can->height; j++){
1003: for (i = 0; i < can->width; i++){
1004: if ( tbl[j][i] >= 0 ){
1005: if ( (tbl[j+1][i] <= 0 ) ||
1006: (tbl[j][i+1] <= 0) ||
1007: (tbl[j+1][i+1] <= 0) ) mask[j][i] = 0;
1008: else mask[j][i] = 1;
1009: } else {
1010: if( (tbl[j+1][i] >= 0) ||
1011: (tbl[j][i+1] >= 0) ||
1012: (tbl[j+1][i+1] >= 0) ) mask[j][i] = 0;
1013: else mask[j][i] = -1;
1014: }
1015: }
1016: }
1017: area_print(display, mask, can, op_code);
1018: reset_selection();
1019: reset_busy(can);
1020: define_cursor(can->window,normalcur);
1.22 saito 1021: #if !defined(VISUAL)
1.24 saito 1022: set_drawcolor(orgcolor);
1023: can->color = orgcolor;
1.22 saito 1024: #endif
1.24 saito 1025: copy_to_canvas(can);
1.22 saito 1026: }
1.24 saito 1027: */
1028: int polarplotNG(NODE arg){
1029: int id,color,orgcolor;
1.22 saito 1030: NODE n;
1031: struct canvas *can;
1.24 saito 1032: P formula;
1033: LIST xrange,wsize;
1.22 saito 1034: STRING wname;
1.24 saito 1035: V v;
1.22 saito 1036:
1.24 saito 1037: formula=(P)ARG0(arg);
1038: xrange=(LIST)ARG1(arg);
1039: color=QTOS((Q)ARG2(arg));
1040: wsize=(LIST)ARG3(arg);
1041: wname=(STRING)ARG4(arg);
1042:
1043: can=canvas[id=search_canvas()];
1044: if(xrange){
1045: n=BDY(xrange); can->vx=VR((P)BDY(n)); n=NEXT(n);
1046: can->qxmin=(Q)BDY(n); n=NEXT(n); can->qxmax=(Q)BDY(n);
1047: can->xmin=ToReal(can->qxmin); can->xmax=ToReal(can->qxmax);
1048: }
1049: can->mode=MODE_POLARPLOT;
1050: if(!wsize){
1051: can->width=DEFAULTWIDTH;
1052: can->height=DEFAULTHEIGHT;
1053: } else {
1054: can->width=QTOS((Q)BDY(BDY(wsize)));
1055: can->height=QTOS((Q)BDY(NEXT(BDY(wsize))));
1.22 saito 1056: }
1.24 saito 1057: if(wname)can->wname=BDY(wname);
1058: else can->wname="";
1059: can->formula=formula;
1060: orgcolor=can->color;
1061: can->color=color;
1062: polarplotcalc(can);
1.22 saito 1063: create_canvas(can);
1.24 saito 1064: plot_print(display,can);
1065: can->color=orgcolor;
1.22 saito 1066: copy_to_canvas(can);
1067: return id;
1068: }
1069:
1.24 saito 1070: int plotoverD(NODE arg){
1071: int index, color;
1072: P formula;
1.22 saito 1073: struct canvas *can;
1.24 saito 1074: VL vl,vl0;
1.22 saito 1075:
1.24 saito 1076: index=QTOS((Q)ARG0(arg));
1077: formula=(P)ARG1(arg);
1078: can=canvas[index];
1079: color=can->color;
1080: if(!can->window)return -1;
1081: get_vars_recursive((Obj)formula,&vl);
1082: for(vl0=vl;vl0;vl0=NEXT(vl0))
1083: if(vl0->v->attr==(pointer)V_IND)
1084: if(vl->v!=can->vx && vl->v!=can->vy) return -1;
1085: if(argc(arg)== 3)can->color=QTOS((Q)ARG2(arg));
1086: else can->color=0;
1.22 saito 1087: #if !defined(VISUAL)
1.24 saito 1088: set_drawcolor(can->color);
1.22 saito 1089: #endif
1.24 saito 1090: current_can=can;
1091: can->formula=formula;
1092: if(can->mode==MODE_PLOT){
1093: calcq(can);
1094: plot_print(display,can);
1095: } else ifplotmain(can);
1.22 saito 1096: copy_to_canvas(can);
1.24 saito 1097: can->color=color;
1.22 saito 1098: #if !defined(VISUAL)
1.24 saito 1099: set_drawcolor(can->color);
1.22 saito 1100: #endif
1.24 saito 1101: return index;
1.22 saito 1102: }
1.25 ! noro 1103: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>