Annotation of OpenXM_contrib2/asir2000/plot/if.c, Revision 1.11
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.11 ! noro 48: * $OpenXM: OpenXM_contrib2/asir2000/plot/if.c,v 1.10 2002/07/29 03:08:16 noro 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.8 noro 55: extern JMP_BUF ox_env;
1.1 noro 56:
1.4 noro 57: int open_canvas(NODE arg)
58: {
59: int id;
60: struct canvas *can;
61: LIST wsize;
62: STRING wname;
63:
64: wsize = (LIST)ARG0(arg);
65: wname = (STRING)ARG1(arg);
66:
67: can = canvas[id = search_canvas()];
68: can->mode = MODE_INTERACTIVE;
69: if ( !wsize ) {
70: can->width = DEFAULTWIDTH; can->height = DEFAULTHEIGHT;
71: } else {
72: can->width = QTOS((Q)BDY(BDY(wsize)));
73: can->height = QTOS((Q)BDY(NEXT(BDY(wsize))));
74: }
75: if ( wname )
76: can->wname = BDY(wname);
77: else
78: can->wname = "";
79: create_canvas(can);
80: return id;
81: }
82:
1.1 noro 83: int plot(NODE arg)
84: {
85: int id;
86: NODE n;
87: struct canvas *can;
88: P formula;
89: LIST xrange,yrange,zrange,wsize;
90: STRING wname;
91:
92: formula = (P)ARG0(arg);
93: xrange = (LIST)ARG1(arg);
94: yrange = (LIST)ARG2(arg);
95: zrange = (LIST)ARG3(arg);
96: wsize = (LIST)ARG4(arg);
97: wname = (STRING)ARG5(arg);
98:
99: can = canvas[id = search_canvas()];
100: n = BDY(xrange); can->vx = VR((P)BDY(n)); n = NEXT(n);
101: can->qxmin = (Q)BDY(n); n = NEXT(n); can->qxmax = (Q)BDY(n);
102: can->xmin = ToReal(can->qxmin); can->xmax = ToReal(can->qxmax);
103: if ( yrange ) {
104: n = BDY(yrange); can->vy = VR((P)BDY(n)); n = NEXT(n);
105: can->qymin = (Q)BDY(n); n = NEXT(n); can->qymax = (Q)BDY(n);
106: can->ymin = ToReal(can->qymin); can->ymax = ToReal(can->qymax);
107: if ( zrange ) {
108: n = NEXT(BDY(zrange));
109: can->zmin = ToReal(BDY(n)); n = NEXT(n); can->zmax = ToReal(BDY(n));
110: if ( n = NEXT(n) )
111: can->nzstep = QTOS((Q)BDY(n));
112: else
113: can->nzstep = MAXGC;
114: can->mode = MODE_CONPLOT;
115: } else
116: can->mode = MODE_IFPLOT;
117: } else
118: can->mode = MODE_PLOT;
119: if ( !wsize ) {
120: can->width = DEFAULTWIDTH; can->height = DEFAULTHEIGHT;
121: } else {
122: can->width = QTOS((Q)BDY(BDY(wsize)));
123: can->height = QTOS((Q)BDY(NEXT(BDY(wsize))));
124: }
125: if ( wname )
126: can->wname = BDY(wname);
127: else
128: can->wname = "";
129: can->formula = formula;
130: create_canvas(can);
131: if ( can->mode == MODE_PLOT ) {
132: plotcalc(can);
133: plot_print(display,can);
134: } else
135: ifplotmain(can);
136: copy_to_canvas(can);
137: return id;
138: }
139:
1.6 noro 140: int memory_plot(NODE arg,LIST *bytes)
141: {
142: NODE n;
143: struct canvas tmp_can;
144: struct canvas *can;
145: P formula;
146: LIST xrange,yrange,zrange,wsize;
147: int width,height;
148: double **tabe;
149: int i;
150: BYTEARRAY barray;
151: Q qw,qh;
152:
153: formula = (P)ARG0(arg);
154: xrange = (LIST)ARG1(arg);
155: yrange = (LIST)ARG2(arg);
156: zrange = (LIST)ARG3(arg);
157: wsize = (LIST)ARG4(arg);
158:
159: can = &tmp_can;
160: n = BDY(xrange); can->vx = VR((P)BDY(n)); n = NEXT(n);
161: can->qxmin = (Q)BDY(n); n = NEXT(n); can->qxmax = (Q)BDY(n);
162: can->xmin = ToReal(can->qxmin); can->xmax = ToReal(can->qxmax);
163: if ( yrange ) {
164: n = BDY(yrange); can->vy = VR((P)BDY(n)); n = NEXT(n);
165: can->qymin = (Q)BDY(n); n = NEXT(n); can->qymax = (Q)BDY(n);
166: can->ymin = ToReal(can->qymin); can->ymax = ToReal(can->qymax);
167: if ( zrange ) {
168: n = NEXT(BDY(zrange));
169: can->zmin = ToReal(BDY(n)); n = NEXT(n); can->zmax = ToReal(BDY(n));
170: if ( n = NEXT(n) )
171: can->nzstep = QTOS((Q)BDY(n));
172: else
173: can->nzstep = MAXGC;
174: can->mode = MODE_CONPLOT;
175: } else
176: can->mode = MODE_IFPLOT;
177: } else
178: can->mode = MODE_PLOT;
179: if ( !wsize ) {
180: can->width = DEFAULTWIDTH; can->height = DEFAULTHEIGHT;
181: } else {
182: can->width = QTOS((Q)BDY(BDY(wsize)));
183: can->height = QTOS((Q)BDY(NEXT(BDY(wsize))));
184: }
185: can->wname = "";
186: can->formula = formula;
187: if ( can->mode == MODE_PLOT )
188: plotcalc(can);
189: else {
190: width = can->width; height = can->height;
191: tabe = (double **)ALLOCA(width*sizeof(double *));
192: for ( i = 0; i < width; i++ )
193: tabe[i] = (double *)ALLOCA(height*sizeof(double));
194: calc(tabe,can,1);
195: memory_if_print(tabe,can,&barray);
196: STOQ(width,qw); STOQ(height,qh);
197: n = mknode(3,qw,qh,barray);
198: MKLIST(*bytes,n);
199: }
200: }
201:
1.1 noro 202: int plotover(NODE arg)
203: {
204: int index;
205: P formula;
206: struct canvas *can;
207: struct canvas fakecan;
208: VL vl,vl0;
209:
210: index = QTOS((Q)ARG0(arg));
211: formula = (P)ARG1(arg);
212: can = canvas[index];
213: if ( !can->window )
214: return -1;
1.7 noro 215: get_vars_recursive((Obj)formula,&vl);
1.1 noro 216: for ( vl0 = vl; vl0; vl0 = NEXT(vl0) )
1.7 noro 217: if ( vl0->v->attr == (pointer)V_IND )
1.1 noro 218: if ( vl->v != can->vx && vl->v != can->vy )
219: return -1;
220: current_can = can;
221: fakecan = *can; fakecan.formula = formula;
222: if ( can->mode == MODE_PLOT ) {
223: plotcalc(&fakecan);
224: plot_print(display,&fakecan);
225: } else
226: ifplotmain(&fakecan);
227: copy_to_canvas(&fakecan);
228: return index;
229: }
230:
231: int drawcircle(NODE arg)
232: {
1.4 noro 233: #if !defined(VISUAL)
1.1 noro 234: int id;
235: int index;
236: pointer ptr;
237: Q ret;
238: LIST xyr;
239: Obj x,y,r;
240: int wx,wy,wr;
241: struct canvas *can;
242: struct canvas fakecan;
243:
244: index = QTOS((Q)ARG0(arg));
245: xyr = (LIST)ARG1(arg);
246: x = (Obj)ARG0(BDY(xyr)); y = (Obj)ARG1(BDY(xyr)); r = (Obj)ARG2(BDY(xyr));
247: can = canvas[index];
248: if ( !can->window )
249: return -1;
250: else {
251: current_can = can;
252: wx = (ToReal(x)-can->xmin)*can->width/(can->xmax-can->xmin);
253: wy = (can->ymax-ToReal(y))*can->height/(can->ymax-can->ymin);
254: wr = ToReal(r);
255: XFillArc(display,can->pix,colorGC,wx-wr/2,wy-wr/2,wr,wr,0,360*64);
256: copy_to_canvas(can);
257: return index;
258: }
1.4 noro 259: #endif
260: }
261:
262: int draw_obj(NODE arg)
263: {
264: int index;
1.5 noro 265: int x,y,u,v,len,r;
1.4 noro 266: NODE obj,n;
267: RealVect *vect;
268: struct canvas *can;
1.5 noro 269: int color;
1.4 noro 270:
271: index = QTOS((Q)ARG0(arg));
272: can = canvas[index];
1.10 noro 273: if ( !can && closed_canvas[index] ) {
274: canvas[index] = closed_canvas[index];
275: closed_canvas[index] = 0;
276: can = canvas[index];
277: popup_canvas(index);
278: current_can = can;
279: } else if ( !can || (can && !can->window) ) {
1.5 noro 280: set_lasterror("draw_obj : canvas does not exist");
1.4 noro 281: return -1;
1.5 noro 282: }
1.4 noro 283:
284: obj = BDY((LIST)ARG1(arg));
1.5 noro 285: if ( argc(arg) == 3 )
286: color = QTOS((Q)ARG2(arg));
287: else
288: color = 0; /* black */
289: switch ( len = length(obj) ) {
1.4 noro 290: case 2: /* point */
291: x = (int)ToReal((Q)ARG0(obj)); y = (int)ToReal((Q)ARG1(obj));
1.5 noro 292: draw_point(display,can,x,y,color);
293: MKRVECT2(vect,x,y); MKNODE(n,vect,can->history); can->history = n;
294: break;
295: case 3: /* circle */
296: x = (int)ToReal((Q)ARG0(obj)); y = (int)ToReal((Q)ARG1(obj));
297: r = (int)ToReal((Q)ARG2(obj));
298: MKRVECT3(vect,x,y,r); MKNODE(n,vect,can->history); can->history = n;
1.4 noro 299: break;
300: case 4: /* line */
301: x = (int)ToReal((Q)ARG0(obj)); y = (int)ToReal((Q)ARG1(obj));
302: u = (int)ToReal((Q)ARG2(obj)); v = (int)ToReal((Q)ARG3(obj));
1.5 noro 303: draw_line(display,can,x,y,u,v,color);
1.4 noro 304: MKRVECT4(vect,x,y,u,v); MKNODE(n,vect,can->history); can->history = n;
305: break;
306: default:
1.5 noro 307: set_lasterror("draw_obj : invalid request");
1.4 noro 308: return -1;
309: }
1.9 noro 310: return 0;
311: }
312:
313: int draw_string(NODE arg)
314: {
315: int index,x,y;
316: char *str;
317: NODE pos;
318: struct canvas *can;
319: int color;
320:
321: index = QTOS((Q)ARG0(arg));
322: can = canvas[index];
1.11 ! noro 323: if ( !can && closed_canvas[index] ) {
! 324: canvas[index] = closed_canvas[index];
! 325: closed_canvas[index] = 0;
! 326: can = canvas[index];
! 327: popup_canvas(index);
! 328: current_can = can;
! 329: } else if ( !can || (can && !can->window) ) {
! 330: set_lasterror("draw_obj : canvas does not exist");
1.9 noro 331: return -1;
332: }
333:
334: pos = BDY((LIST)ARG1(arg));
335: str = BDY((STRING)ARG2(arg));
336: if ( argc(arg) == 4 )
337: color = QTOS((Q)ARG3(arg));
338: else
339: color = 0; /* black */
340: x = (int)ToReal((Q)ARG0(pos));
341: y = (int)ToReal((Q)ARG1(pos));
342: draw_character_string(display,can,x,y,str,color);
1.4 noro 343: return 0;
344: }
345:
346: int clear_canvas(NODE arg)
347: {
348: int index;
349: struct canvas *can;
350:
351: index = QTOS((Q)ARG0(arg));
352: can = canvas[index];
353: if ( !can || !can->window )
354: return -1;
355: clear_pixmap(can);
356: copy_to_canvas(can);
357: /* clear the history */
358: can->history = 0;
1.1 noro 359: }
360:
361: #define RealtoDbl(r) ((r)?BDY(r):0.0)
362:
363: int arrayplot(NODE arg)
364: {
365: int id,ix,w,h;
366: VECT array;
367: LIST xrange,wsize;
368: char *wname;
369: NODE n;
370: double ymax,ymin,dy,xstep;
371: Real *tab;
372: struct canvas *can;
373: POINT *pa;
374:
375: array = (VECT)ARG0(arg);
376: xrange = (LIST)ARG1(arg);
377: can = canvas[id = search_canvas()];
378: n = BDY(xrange); can->vx = VR((P)BDY(n)); n = NEXT(n);
379: can->qxmin = (Q)BDY(n); n = NEXT(n); can->qxmax = (Q)BDY(n);
380: can->xmin = ToReal(can->qxmin); can->xmax = ToReal(can->qxmax);
381: if ( !wsize ) {
382: can->width = DEFAULTWIDTH; can->height = DEFAULTHEIGHT;
383: } else {
384: can->width = QTOS((Q)BDY(BDY(wsize)));
385: can->height = QTOS((Q)BDY(NEXT(BDY(wsize))));
386: }
387: can->wname = wname; can->formula = 0; can->mode = MODE_PLOT;
388: create_canvas(can);
389: w = array->len;
390: h = can->height;
391: tab = (Real *)BDY(array);
392: if ( can->ymax == can->ymin ) {
393: for ( ymax = ymin = RealtoDbl(tab[0]), ix = 1; ix < w; ix++ ) {
394: if ( RealtoDbl(tab[ix]) > ymax )
395: ymax = RealtoDbl(tab[ix]);
396: if ( RealtoDbl(tab[ix]) < ymin )
397: ymin = RealtoDbl(tab[ix]);
398: }
399: can->ymax = ymax; can->ymin = ymin;
400: } else {
401: ymax = can->ymax; ymin = can->ymin;
402: }
403: dy = ymax-ymin;
404: can->pa = (struct pa *)MALLOC(sizeof(struct pa));
405: can->pa[0].length = w;
406: can->pa[0].pos = pa = (POINT *)MALLOC(w*sizeof(POINT));
407: xstep = (double)can->width/(double)(w-1);
408: for ( ix = 0; ix < w; ix++ ) {
409: #ifndef MAXSHORT
410: #define MAXSHORT ((short)0x7fff)
411: #endif
412: double t;
413:
414: pa[ix].x = (int)(ix*xstep);
415: t = (h - 1)*(ymax - RealtoDbl(tab[ix]))/dy;
416: if ( t > MAXSHORT )
417: pa[ix].y = MAXSHORT;
418: else if ( t < -MAXSHORT )
419: pa[ix].y = -MAXSHORT;
420: else
1.7 noro 421: pa[ix].y = (long)t;
1.1 noro 422: }
423: plot_print(display,can);
424: copy_to_canvas(can);
425: return id;
426: }
427:
1.7 noro 428: void ifplot_resize(struct canvas *can,POINT spos,POINT epos)
1.1 noro 429: {
430: struct canvas *ncan;
431: struct canvas fakecan;
432: Q dx,dy,dx2,dy2,xmin,xmax,ymin,ymax,xmid,ymid;
433: Q sx,sy,ex,ey,cw,ch,ten,two;
434: Q s,t;
435: int new;
436: int w,h,m;
437:
438: if ( XC(spos) < XC(epos) && YC(spos) < YC(epos) ) {
439: if ( can->precise && !can->wide ) {
440: fakecan = *can; ncan = &fakecan;
441: } else {
442: new = search_canvas(); ncan = canvas[new];
443: }
444: ncan->mode = can->mode;
445: ncan->zmin = can->zmin; ncan->zmax = can->zmax;
446: ncan->nzstep = can->nzstep;
447: ncan->wname = can->wname;
448: ncan->vx = can->vx; ncan->vy = can->vy;
449: ncan->formula = can->formula;
450: w = XC(epos)-XC(spos);
451: h = YC(epos)-YC(spos);
452: m = MAX(can->width,can->height);
453: if ( can->precise ) {
454: ncan->width = w; ncan->height = h;
455: } else if ( w > h ) {
456: ncan->width = m; ncan->height = m * h/w;
457: } else {
458: ncan->width = m * w/h; ncan->height = m;
459: }
460: if ( can->wide ) {
461: STOQ(10,ten); STOQ(2,two);
462: subq(can->qxmax,can->qxmin,&t); mulq(t,ten,&dx);
463: subq(can->qymax,can->qymin,&t); mulq(t,ten,&dy);
464: addq(can->qxmax,can->qxmin,&t); divq(t,two,&xmid);
465: addq(can->qymax,can->qymin,&t); divq(t,two,&ymid);
466: divq(dx,two,&dx2); divq(dy,two,&dy2);
467: subq(xmid,dx2,&xmin); addq(xmid,dx2,&xmax);
468: subq(ymid,dy2,&ymin); addq(ymid,dy2,&ymax);
469: } else {
470: subq(can->qxmax,can->qxmin,&dx); subq(can->qymax,can->qymin,&dy);
471: xmin = can->qxmin; xmax = can->qxmax;
472: ymin = can->qymin; ymax = can->qymax;
473: }
474: STOQ(XC(spos),sx); STOQ(YC(spos),sy); STOQ(XC(epos),ex); STOQ(YC(epos),ey);
475: STOQ(can->width,cw); STOQ(can->height,ch);
476: mulq(sx,dx,&t); divq(t,cw,&s); addq(xmin,s,&ncan->qxmin);
477: mulq(ex,dx,&t); divq(t,cw,&s); addq(xmin,s,&ncan->qxmax);
478: mulq(ey,dy,&t); divq(t,ch,&s); subq(ymax,s,&ncan->qymin);
479: mulq(sy,dy,&t); divq(t,ch,&s); subq(ymax,s,&ncan->qymax);
480: ncan->xmin = ToReal(ncan->qxmin); ncan->xmax = ToReal(ncan->qxmax);
481: ncan->ymin = ToReal(ncan->qymin); ncan->ymax = ToReal(ncan->qymax);
482: if ( can->precise && !can->wide ) {
483: current_can = can;
484: alloc_pixmap(ncan);
1.4 noro 485: #if defined(VISUAL)
486: ncan->real_can = can;
487: #endif
1.1 noro 488: qifplotmain(ncan);
489: copy_subimage(ncan,can,spos);
490: copy_to_canvas(can);
491: } else {
492: create_canvas(ncan);
493: if ( can->precise )
494: qifplotmain(ncan);
495: else
496: ifplotmain(ncan);
497: copy_to_canvas(ncan);
498: }
499: }
500: }
501:
1.7 noro 502: void plot_resize(struct canvas *can,POINT spos,POINT epos)
1.1 noro 503: {
504: struct canvas *ncan;
505: Q dx,dx2,xmin,xmax,xmid;
1.7 noro 506: double dy,ymin,ymax,ymid;
1.1 noro 507: Q sx,ex,cw,ten,two;
508: Q s,t;
509: int new;
510: int w,h,m;
511:
512: if ( XC(spos) < XC(epos) && YC(spos) < YC(epos) ) {
513: new = search_canvas(); ncan = canvas[new];
514: ncan->mode = can->mode;
515: ncan->zmin = can->zmin; ncan->zmax = can->zmax;
516: ncan->nzstep = can->nzstep;
517: ncan->wname = can->wname;
518: ncan->vx = can->vx; ncan->vy = can->vy;
519: ncan->formula = can->formula;
520: w = XC(epos)-XC(spos);
521: h = YC(epos)-YC(spos);
522: m = MAX(can->width,can->height);
523: if ( w > h ) {
524: ncan->width = m; ncan->height = m * h/w;
525: } else {
526: ncan->width = m * w/h; ncan->height = m;
527: }
528: if ( can->wide ) {
529: STOQ(10,ten); STOQ(2,two);
530: subq(can->qxmax,can->qxmin,&t); mulq(t,ten,&dx);
531: addq(can->qxmax,can->qxmin,&t); divq(t,two,&xmid);
532: divq(dx,two,&dx2); subq(xmid,dx2,&xmin); addq(xmid,dx2,&xmax);
533:
534: dy = (can->ymax-can->ymin)*10;
535: ymid = (can->ymax+can->ymin)/2;
536: ymin = ymid-dy/2; ymax = ymid+dy/2;
537: } else {
538: subq(can->qxmax,can->qxmin,&dx);
539: xmin = can->qxmin; xmax = can->qxmax;
540:
541: dy = can->ymax-can->ymin;
542: ymin = can->ymin; ymax = can->ymax;
543: }
544: STOQ(XC(spos),sx); STOQ(XC(epos),ex); STOQ(can->width,cw);
545: mulq(sx,dx,&t); divq(t,cw,&s); addq(xmin,s,&ncan->qxmin);
546: mulq(ex,dx,&t); divq(t,cw,&s); addq(xmin,s,&ncan->qxmax);
547: ncan->xmin = ToReal(ncan->qxmin); ncan->xmax = ToReal(ncan->qxmax);
548:
549: ncan->ymin = ymax-YC(epos)*dy/can->height;
550: ncan->ymax = ymax-YC(spos)*dy/can->height;
551:
552: create_canvas(ncan);
553: plotcalc(ncan);
554: plot_print(display,ncan);
555: copy_to_canvas(ncan);
556: }
557: }
558:
1.7 noro 559: void ifplotmain(struct canvas *can)
1.1 noro 560: {
561: int width,height;
1.7 noro 562: double **tabe;
1.1 noro 563: int i;
564:
565: width = can->width; height = can->height;
566: tabe = (double **)ALLOCA(width*sizeof(double *));
567: for ( i = 0; i < width; i++ )
568: tabe[i] = (double *)ALLOCA(height*sizeof(double));
569: define_cursor(can->window,runningcur);
570: set_busy(can); set_selection();
1.6 noro 571: calc(tabe,can,0); if_print(display,tabe,can);
1.1 noro 572: reset_selection(); reset_busy(can);
573: define_cursor(can->window,normalcur);
574: }
575:
1.7 noro 576: void qifplotmain(struct canvas *can)
1.1 noro 577: {
578: int width,height;
579: char **tabe,*tabeb;
580: int i;
581:
582: width = can->width; height = can->height;
583: tabe = (char **)ALLOCA(width*sizeof(char *)+width*height*sizeof(char));
1.8 noro 584: bzero((void *)tabe,width*sizeof(char *)+width*height*sizeof(char));
1.1 noro 585: for ( i = 0, tabeb = (char *)(tabe+width); i < width; i++ )
586: tabe[i] = tabeb + height*i;
587: define_cursor(can->window,runningcur);
588: set_busy(can); set_selection();
589: qcalc(tabe,can); qif_print(display,tabe,can);
590: reset_selection(); reset_busy(can);
591: define_cursor(can->window,normalcur);
592: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>