Annotation of OpenXM_contrib2/asir2000/plot/if.c, Revision 1.10
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.10 ! noro 48: * $OpenXM: OpenXM_contrib2/asir2000/plot/if.c,v 1.9 2002/07/10 05:29:35 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];
323: if ( !can || !can->window ) {
324: set_lasterror("draw_string : canvas does not exist");
325: return -1;
326: }
327:
328: pos = BDY((LIST)ARG1(arg));
329: str = BDY((STRING)ARG2(arg));
330: if ( argc(arg) == 4 )
331: color = QTOS((Q)ARG3(arg));
332: else
333: color = 0; /* black */
334: x = (int)ToReal((Q)ARG0(pos));
335: y = (int)ToReal((Q)ARG1(pos));
336: draw_character_string(display,can,x,y,str,color);
1.4 noro 337: return 0;
338: }
339:
340: int clear_canvas(NODE arg)
341: {
342: int index;
343: struct canvas *can;
344:
345: index = QTOS((Q)ARG0(arg));
346: can = canvas[index];
347: if ( !can || !can->window )
348: return -1;
349: clear_pixmap(can);
350: copy_to_canvas(can);
351: /* clear the history */
352: can->history = 0;
1.1 noro 353: }
354:
355: #define RealtoDbl(r) ((r)?BDY(r):0.0)
356:
357: int arrayplot(NODE arg)
358: {
359: int id,ix,w,h;
360: VECT array;
361: LIST xrange,wsize;
362: char *wname;
363: NODE n;
364: double ymax,ymin,dy,xstep;
365: Real *tab;
366: struct canvas *can;
367: POINT *pa;
368:
369: array = (VECT)ARG0(arg);
370: xrange = (LIST)ARG1(arg);
371: can = canvas[id = search_canvas()];
372: n = BDY(xrange); can->vx = VR((P)BDY(n)); n = NEXT(n);
373: can->qxmin = (Q)BDY(n); n = NEXT(n); can->qxmax = (Q)BDY(n);
374: can->xmin = ToReal(can->qxmin); can->xmax = ToReal(can->qxmax);
375: if ( !wsize ) {
376: can->width = DEFAULTWIDTH; can->height = DEFAULTHEIGHT;
377: } else {
378: can->width = QTOS((Q)BDY(BDY(wsize)));
379: can->height = QTOS((Q)BDY(NEXT(BDY(wsize))));
380: }
381: can->wname = wname; can->formula = 0; can->mode = MODE_PLOT;
382: create_canvas(can);
383: w = array->len;
384: h = can->height;
385: tab = (Real *)BDY(array);
386: if ( can->ymax == can->ymin ) {
387: for ( ymax = ymin = RealtoDbl(tab[0]), ix = 1; ix < w; ix++ ) {
388: if ( RealtoDbl(tab[ix]) > ymax )
389: ymax = RealtoDbl(tab[ix]);
390: if ( RealtoDbl(tab[ix]) < ymin )
391: ymin = RealtoDbl(tab[ix]);
392: }
393: can->ymax = ymax; can->ymin = ymin;
394: } else {
395: ymax = can->ymax; ymin = can->ymin;
396: }
397: dy = ymax-ymin;
398: can->pa = (struct pa *)MALLOC(sizeof(struct pa));
399: can->pa[0].length = w;
400: can->pa[0].pos = pa = (POINT *)MALLOC(w*sizeof(POINT));
401: xstep = (double)can->width/(double)(w-1);
402: for ( ix = 0; ix < w; ix++ ) {
403: #ifndef MAXSHORT
404: #define MAXSHORT ((short)0x7fff)
405: #endif
406: double t;
407:
408: pa[ix].x = (int)(ix*xstep);
409: t = (h - 1)*(ymax - RealtoDbl(tab[ix]))/dy;
410: if ( t > MAXSHORT )
411: pa[ix].y = MAXSHORT;
412: else if ( t < -MAXSHORT )
413: pa[ix].y = -MAXSHORT;
414: else
1.7 noro 415: pa[ix].y = (long)t;
1.1 noro 416: }
417: plot_print(display,can);
418: copy_to_canvas(can);
419: return id;
420: }
421:
1.7 noro 422: void ifplot_resize(struct canvas *can,POINT spos,POINT epos)
1.1 noro 423: {
424: struct canvas *ncan;
425: struct canvas fakecan;
426: Q dx,dy,dx2,dy2,xmin,xmax,ymin,ymax,xmid,ymid;
427: Q sx,sy,ex,ey,cw,ch,ten,two;
428: Q s,t;
429: int new;
430: int w,h,m;
431:
432: if ( XC(spos) < XC(epos) && YC(spos) < YC(epos) ) {
433: if ( can->precise && !can->wide ) {
434: fakecan = *can; ncan = &fakecan;
435: } else {
436: new = search_canvas(); ncan = canvas[new];
437: }
438: ncan->mode = can->mode;
439: ncan->zmin = can->zmin; ncan->zmax = can->zmax;
440: ncan->nzstep = can->nzstep;
441: ncan->wname = can->wname;
442: ncan->vx = can->vx; ncan->vy = can->vy;
443: ncan->formula = can->formula;
444: w = XC(epos)-XC(spos);
445: h = YC(epos)-YC(spos);
446: m = MAX(can->width,can->height);
447: if ( can->precise ) {
448: ncan->width = w; ncan->height = h;
449: } else if ( w > h ) {
450: ncan->width = m; ncan->height = m * h/w;
451: } else {
452: ncan->width = m * w/h; ncan->height = m;
453: }
454: if ( can->wide ) {
455: STOQ(10,ten); STOQ(2,two);
456: subq(can->qxmax,can->qxmin,&t); mulq(t,ten,&dx);
457: subq(can->qymax,can->qymin,&t); mulq(t,ten,&dy);
458: addq(can->qxmax,can->qxmin,&t); divq(t,two,&xmid);
459: addq(can->qymax,can->qymin,&t); divq(t,two,&ymid);
460: divq(dx,two,&dx2); divq(dy,two,&dy2);
461: subq(xmid,dx2,&xmin); addq(xmid,dx2,&xmax);
462: subq(ymid,dy2,&ymin); addq(ymid,dy2,&ymax);
463: } else {
464: subq(can->qxmax,can->qxmin,&dx); subq(can->qymax,can->qymin,&dy);
465: xmin = can->qxmin; xmax = can->qxmax;
466: ymin = can->qymin; ymax = can->qymax;
467: }
468: STOQ(XC(spos),sx); STOQ(YC(spos),sy); STOQ(XC(epos),ex); STOQ(YC(epos),ey);
469: STOQ(can->width,cw); STOQ(can->height,ch);
470: mulq(sx,dx,&t); divq(t,cw,&s); addq(xmin,s,&ncan->qxmin);
471: mulq(ex,dx,&t); divq(t,cw,&s); addq(xmin,s,&ncan->qxmax);
472: mulq(ey,dy,&t); divq(t,ch,&s); subq(ymax,s,&ncan->qymin);
473: mulq(sy,dy,&t); divq(t,ch,&s); subq(ymax,s,&ncan->qymax);
474: ncan->xmin = ToReal(ncan->qxmin); ncan->xmax = ToReal(ncan->qxmax);
475: ncan->ymin = ToReal(ncan->qymin); ncan->ymax = ToReal(ncan->qymax);
476: if ( can->precise && !can->wide ) {
477: current_can = can;
478: alloc_pixmap(ncan);
1.4 noro 479: #if defined(VISUAL)
480: ncan->real_can = can;
481: #endif
1.1 noro 482: qifplotmain(ncan);
483: copy_subimage(ncan,can,spos);
484: copy_to_canvas(can);
485: } else {
486: create_canvas(ncan);
487: if ( can->precise )
488: qifplotmain(ncan);
489: else
490: ifplotmain(ncan);
491: copy_to_canvas(ncan);
492: }
493: }
494: }
495:
1.7 noro 496: void plot_resize(struct canvas *can,POINT spos,POINT epos)
1.1 noro 497: {
498: struct canvas *ncan;
499: Q dx,dx2,xmin,xmax,xmid;
1.7 noro 500: double dy,ymin,ymax,ymid;
1.1 noro 501: Q sx,ex,cw,ten,two;
502: Q s,t;
503: int new;
504: int w,h,m;
505:
506: if ( XC(spos) < XC(epos) && YC(spos) < YC(epos) ) {
507: new = search_canvas(); ncan = canvas[new];
508: ncan->mode = can->mode;
509: ncan->zmin = can->zmin; ncan->zmax = can->zmax;
510: ncan->nzstep = can->nzstep;
511: ncan->wname = can->wname;
512: ncan->vx = can->vx; ncan->vy = can->vy;
513: ncan->formula = can->formula;
514: w = XC(epos)-XC(spos);
515: h = YC(epos)-YC(spos);
516: m = MAX(can->width,can->height);
517: if ( w > h ) {
518: ncan->width = m; ncan->height = m * h/w;
519: } else {
520: ncan->width = m * w/h; ncan->height = m;
521: }
522: if ( can->wide ) {
523: STOQ(10,ten); STOQ(2,two);
524: subq(can->qxmax,can->qxmin,&t); mulq(t,ten,&dx);
525: addq(can->qxmax,can->qxmin,&t); divq(t,two,&xmid);
526: divq(dx,two,&dx2); subq(xmid,dx2,&xmin); addq(xmid,dx2,&xmax);
527:
528: dy = (can->ymax-can->ymin)*10;
529: ymid = (can->ymax+can->ymin)/2;
530: ymin = ymid-dy/2; ymax = ymid+dy/2;
531: } else {
532: subq(can->qxmax,can->qxmin,&dx);
533: xmin = can->qxmin; xmax = can->qxmax;
534:
535: dy = can->ymax-can->ymin;
536: ymin = can->ymin; ymax = can->ymax;
537: }
538: STOQ(XC(spos),sx); STOQ(XC(epos),ex); STOQ(can->width,cw);
539: mulq(sx,dx,&t); divq(t,cw,&s); addq(xmin,s,&ncan->qxmin);
540: mulq(ex,dx,&t); divq(t,cw,&s); addq(xmin,s,&ncan->qxmax);
541: ncan->xmin = ToReal(ncan->qxmin); ncan->xmax = ToReal(ncan->qxmax);
542:
543: ncan->ymin = ymax-YC(epos)*dy/can->height;
544: ncan->ymax = ymax-YC(spos)*dy/can->height;
545:
546: create_canvas(ncan);
547: plotcalc(ncan);
548: plot_print(display,ncan);
549: copy_to_canvas(ncan);
550: }
551: }
552:
1.7 noro 553: void ifplotmain(struct canvas *can)
1.1 noro 554: {
555: int width,height;
1.7 noro 556: double **tabe;
1.1 noro 557: int i;
558:
559: width = can->width; height = can->height;
560: tabe = (double **)ALLOCA(width*sizeof(double *));
561: for ( i = 0; i < width; i++ )
562: tabe[i] = (double *)ALLOCA(height*sizeof(double));
563: define_cursor(can->window,runningcur);
564: set_busy(can); set_selection();
1.6 noro 565: calc(tabe,can,0); if_print(display,tabe,can);
1.1 noro 566: reset_selection(); reset_busy(can);
567: define_cursor(can->window,normalcur);
568: }
569:
1.7 noro 570: void qifplotmain(struct canvas *can)
1.1 noro 571: {
572: int width,height;
573: char **tabe,*tabeb;
574: int i;
575:
576: width = can->width; height = can->height;
577: tabe = (char **)ALLOCA(width*sizeof(char *)+width*height*sizeof(char));
1.8 noro 578: bzero((void *)tabe,width*sizeof(char *)+width*height*sizeof(char));
1.1 noro 579: for ( i = 0, tabeb = (char *)(tabe+width); i < width; i++ )
580: tabe[i] = tabeb + height*i;
581: define_cursor(can->window,runningcur);
582: set_busy(can); set_selection();
583: qcalc(tabe,can); qif_print(display,tabe,can);
584: reset_selection(); reset_busy(can);
585: define_cursor(can->window,normalcur);
586: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>