Annotation of OpenXM_contrib2/asir2000/plot/ifplot.h, Revision 1.19
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.19 ! ohara 48: * $OpenXM: OpenXM_contrib2/asir2000/plot/ifplot.h,v 1.18 2014/05/13 20:02:40 ohara Exp $
1.2 noro 49: */
1.7 noro 50: #if defined(VISUAL)
1.4 noro 51: /* for Visual C++ */
52: #include <windows.h>
1.1 noro 53: #else
54: #include <sys/types.h>
55: #include <X11/Xlib.h>
56: #include <X11/Xutil.h>
57: #include <X11/Xatom.h>
58: #include <X11/Intrinsic.h>
59: #include <X11/StringDefs.h>
60: #include <X11/Shell.h>
61: #include <X11/Xaw/Form.h>
62: #include <X11/Xaw/Command.h>
63: #include <X11/Xaw/Label.h>
64: #include <X11/Xaw/Simple.h>
65: #include <X11/Xaw/Dialog.h>
66: #include <X11/Xaw/Box.h>
67: #ifndef OLDX11
68: #include <X11/Xaw/Toggle.h>
69: #include <X11/Xaw/Scrollbar.h>
70: #else
71: #include <X11/Xaw/Scroll.h>
72: #define toggleWidgetClass commandWidgetClass
73: #define XtPointer pointer
74: #define XawDialogAddButton XtDialogAddButton
75: #define XawScrollbarSetThumb XtScrollBarSetThumb
76: #endif
77: #endif
78:
79: #define C_IFPLOT C_PRIV
80: #define C_BMPLOT C_PRIV+1
81: #define C_CLEAR C_PRIV+2
82: #define C_PMFLUSH C_PRIV+3
83: #define C_CONPLOT C_PRIV+4
84: #define C_PLOTOVER C_PRIV+5
85: #define C_PLOT C_PRIV+6
86: #define C_APLOT C_PRIV+7
87: #define C_DRAWCIRCLE C_PRIV+8
88:
1.5 noro 89: #define MAXCANVAS 64
1.1 noro 90: #define MAXGC 16
1.11 noro 91: #define DEFAULTPOLARSTEP 400
1.1 noro 92: #define DEFAULTWIDTH 400
93: #define DEFAULTHEIGHT 400
94:
1.17 saito 95: #define IFPLOT "ifplot"
96: #define CONPLOT "conplot"
97: #define PLOT "plot"
98: #define INTERACTIVE "interactive"
99: #define POLARPLOT "polarplot"
100: #define PLOTOVER "plotover"
101: #define IFPLOTD "ifplotD"
102: #define IFPLOTQ "ifplotQ"
103: #define IFPLOTB "ifplotB"
104: #define INEQN "ineqn"
105: #define INEQND "ineqnD"
106: #define INEQNQ "ineqnQ"
107: #define INEQNB "ineqnB"
108: #define INEQNAND "ineqnand"
109: #define INEQNDAND "ineqnDand"
110: #define INEQNQAND "ineqnQand"
111: #define INEQNBAND "ineqnBand"
112: #define INEQNOR "ineqnor"
113: #define INEQNDOR "ineqnDor"
114: #define INEQNQOR "ineqnQor"
115: #define INEQNBOR "ineqnBor"
116: #define INEQNXOR "ineqnxor"
117: #define INEQNDXOR "ineqnDxor"
118: #define INEQNQXOR "ineqnQxor"
119: #define INEQNBXOR "ineqnBxor"
120: #define CONPLOTD "conplotD"
121: #define CONPLOTQ "conplotQ"
122: #define CONPLOTB "conplotB"
123: #define ITVIFPLOT "itvifplot"
124: #define PLOTOVERD "plotoverD"
125: #define PLOTOVERQ "plotoverQ"
126: #define PLOTOVERB "plotoverB"
127: #define MEMORY_IFPLOT "memory_ifplot"
128: #define MEMORY_CONPLOT "memory_conplot"
129: #define MEMORY_PLOT "memory_plot"
130: #define ARRAYPLOT "arrayplot"
131: #define OPEN_CANVAS "open_canvas"
132: #define DRAWCIRCLE "drawcircle"
1.19 ! ohara 133: #define DRAW_OBJ "draw_obj"
1.17 saito 134: #define DRAW_STRING "draw_string"
135: #define OBJ_CP "obj_cp"
136: #define CLEAR_CANVAS "clear_canvas"
137:
138: /*
139: #define IFPLOT 0
140: #define CONPLOT 1
141: #define PLOT 2
142: #define INTERACTIVE 3
143: #define POLARPLOT 4
144: #define PLOTOVER 5
145: #define IFPLOTD 6
146: #define IFPLOTQ 7
147: #define IFPLOTB 8
148: #define INEQND 9
149: #define INEQNQ 10
150: #define INEQNB 11
151: #define INEQNANDD 12
152: #define INEQNANDQ 13
153: #define INEQNANDB 14
154: #define INEQNORD 15
155: #define INEQNORQ 16
156: #define INEQNORB 17
157: #define INEQNXORD 18
158: #define INEQNXORQ 19
159: #define INEQNXORB 20
160: #define CONPLOTD 21
161: #define CONPLOTQ 22
162: #define CONPLOTB 23
163: #define ITVIFPLOT 24
164: #define PLOTOVERD 25
165: #define PLOTOVERQ 26
166: #define PLOTOVERB 27
167: #define MEMORY_IFPLOT 28
168: #define MEMORY_CONPLOT 29
169: #define MEMORY_PLOT 30
170: #define ARRAYPLOT 31
171: #define OPEN_CANVAS 32
172: #define DRAWCIRCLE 33
173: #define DRAW_OBJ 34
174: #define DRAW_STRING 35
175: #define OBJ_CP 36
176: #define CLEAR_CANVAS 37
177: */
1.1 noro 178:
179: #define DIR_X 0
180: #define DIR_Y 1
181: #define DIR_Z 2
182:
1.7 noro 183: #if defined(VISUAL)
1.4 noro 184: /* for Visual C++ */
185: #define XC(a) ((a).x)
186: #define YC(a) ((a).y)
187: #define DISPLAY int
1.8 noro 188: #define WINDOW void *
1.4 noro 189: #define CURSOR int
190: #define DRAWABLE HDC
191:
192: /* XXX : use GC argument as the color */
193: #define DRAWPOINT(d,p,g,x,y) SetPixel(p,x,y,0)
194:
195: #define DRAWLINE(d,p,g,x,y,u,v) MoveToEx(p,x,y,&oldpos); LineTo(p,u,v)
1.5 noro 196: #define DRAWSTRING(d,p,g,x,y,s,l) TextOut(p,x,y,s,l)
197: /* #define TEXTWIDTH(f,s,l) */
1.1 noro 198: #else
1.4 noro 199: /* for UNIX */
1.1 noro 200: #define POINT XPoint
201: #define XC(a) ((a).x)
202: #define YC(a) ((a).y)
203: #define DRAWPOINT(d,p,g,x,y) (count_and_flush(),XDrawPoint(d,p,g,x,y))
204: #define DRAWLINE(d,p,g,x,y,u,v) XDrawLine(d,p,g,x,y,u,v)
205: #define DRAWSTRING(d,p,g,x,y,s,l) XDrawString(d,p,g,x,y,s,l)
206: #define TEXTWIDTH(f,s,l) XTextWidth(f,s,l)
207: #define DISPLAY Display
208: #define WINDOW Window
209: #define CURSOR Cursor
210: #define DRAWABLE Drawable
211: #endif
212:
213: struct pa {
214: int length;
215: POINT *pos;
216: };
217:
1.4 noro 218: typedef struct RealVect {
219: int len;
220: int body[1];
221: } RealVect;
222:
223: #define MKRVECT2(v,x,y)\
224: ((v)=(RealVect *)MALLOC_ATOMIC(sizeof(RealVect)+sizeof(int)),\
225: (v)->len=2,(v)->body[0]=(x),(v)->body[1]=(y))
1.5 noro 226: #define MKRVECT3(v,x,y,z)\
227: ((v)=(RealVect *)MALLOC_ATOMIC(sizeof(RealVect)+2*sizeof(int)),\
228: (v)->len=3,(v)->body[0]=(x),(v)->body[1]=(y),(v)->body[2]=(z))
229: #define MKRVECT4(v,x,y,z,u)\
1.4 noro 230: ((v)=(RealVect *)MALLOC_ATOMIC(sizeof(RealVect)+3*sizeof(int)),\
1.5 noro 231: (v)->len=4,(v)->body[0]=(x),(v)->body[1]=(y),(v)->body[2]=(z),(v)->body[3]=(u))
1.12 noro 232: #define MKRVECT5(v,x,y,z,u,w)\
233: ((v)=(RealVect *)MALLOC_ATOMIC(sizeof(RealVect)+4*sizeof(int)),\
234: (v)->len=4,(v)->body[0]=(x),(v)->body[1]=(y),(v)->body[2]=(z),(v)->body[3]=(u),(v)->body[4]=(w))
1.5 noro 235:
236: #define RV_POINT 1
237: #define RV_LINE 2
238: #define RV_ARC 3
1.4 noro 239:
1.1 noro 240: struct canvas {
241: int index;
1.7 noro 242: #if defined(VISUAL)
1.4 noro 243: /* for Visual C++ */
244: void *window; /* pointer to CMainFrame */
245: HWND hwnd; /* handle to the canvas window */
246: HDC pix; /* shadow DC on memory */
247: char *prefix;
248: int percentage;
249: struct canvas *real_can;
1.1 noro 250: #else
251: Widget shell,xcoord,ycoord,xdone,ydone,level,wideb,preciseb,noaxisb;
252: Window window;
253: Pixmap pix;
254: #endif
255: char *wname;
256: char mode;
257: char wide;
258: char precise;
259: char noaxis;
260: V vx,vy;
261: P formula;
262: int width,height;
263: double xmin,xmax;
264: double ymin,ymax;
265: double zmin,zmax;
1.15 saito 266: double vmin,vmax;
1.1 noro 267: int nzstep;
268: Q qxmin,qxmax;
269: Q qymin,qymax;
270: struct pa *pa;
1.4 noro 271: /* to register the history in the interactive mode */
272: NODE history;
1.13 noro 273: int color;
1.15 saito 274: int division;
1.1 noro 275: };
276:
277: extern struct canvas *canvas[];
1.10 noro 278: extern struct canvas *closed_canvas[];
1.1 noro 279: extern struct canvas *current_can;
1.17 saito 280: extern char* pfn[];
281:
1.14 saito 282: #if defined(INTERVAL)
283: extern Pixel BackPixel;
284: extern int Itvplot;
285: #endif
1.1 noro 286:
287: extern VL CO;
288: extern int stream;
289:
290: extern DISPLAY *display;
291: extern CURSOR normalcur,runningcur,errorcur;
292:
1.4 noro 293: #if defined(VISUAL)
294: extern POINT start_point,end_point;
295: extern SIZE cansize;
296: #else
1.1 noro 297: extern Window rootwin;
1.6 noro 298: extern GC drawGC,dashGC,hlGC,scaleGC,clearGC,xorGC,colorGC,cdrawGC;
1.1 noro 299: extern XFontStruct *sffs;
1.8 noro 300: #endif
1.9 takayama 301:
302: struct xcolorForPS {
1.14 saito 303: unsigned long pixel;
304: double r,g,b;
305: int print;
1.9 takayama 306: };
1.8 noro 307:
308: /* prototypes */
1.17 saito 309: int modeNO(char *);
1.14 saito 310: void calc(double **,struct canvas *,int);
311: double usubstrp(P,double);
312: void qcalc(char **,struct canvas *);
1.16 ohara 313: void calcb(double **,struct canvas *,int);
314: void calcq(double **,struct canvas *,int);
1.17 saito 315: void polarcalc(struct canvas *);
1.14 saito 316: void sturmseq(VL,P,VECT *);
317: void seproot(VECT,int,int,int *);
318: int numch(VECT,Q,Q);
319: void usubstqp(P,Q,Q *);
320: void plotcalc(struct canvas *);
321: int open_canvas(NODE);
1.17 saito 322: int plot(NODE,char *);
1.15 saito 323: int ifplotold(NODE);
324: int polarplot(NODE);
325: int conplotD(NODE);
1.14 saito 326: int memory_plot(NODE,LIST *);
327: int plotover(NODE);
1.15 saito 328: int plotoverD(NODE);
1.14 saito 329: int drawcircle(NODE);
330: int draw_obj(NODE);
1.17 saito 331: int draw_string(NODE);
1.14 saito 332: int clear_canvas(NODE);
1.16 ohara 333: void popup_canvas(int);
1.14 saito 334: int arrayplot(NODE);
335: int ineqnover(NODE);
336: int ineqnand(NODE);
337: int ineqnor(NODE);
338: int ineqnxor(NODE);
1.17 saito 339: int ifplotOP(NODE,int);
340: int ifplotNG(NODE,int);
341: int polarplotNG(NODE);
1.14 saito 342: void ineqnmain(struct canvas *, int, int);
1.15 saito 343: void conplotmainD(struct canvas *);
1.14 saito 344: void obj_op(struct canvas *, struct canvas *, int);
1.15 saito 345: void area_print(DISPLAY *,double **, struct canvas *, int);
1.17 saito 346: void memory_print(struct canvas *,BYTEARRAY *);
347: void over_print(DISPLAY *,double **,struct canvas *,int);
348: void polar_print(DISPLAY *,struct canvas *);
1.18 ohara 349: unsigned long GetColor(DISPLAY *,char *);
1.17 saito 350: void Pox_pop_local(NODE,Obj *);
351: void Pox_pop_cmo(NODE,Obj *);
352:
1.15 saito 353: #if defined(INTERVAL)
354: int itvifplot(NODE);
355: //int itvplot1(NODE);
356: //int itvplot2(NODE);
357: //int itvplot3(NODE);
358: //int itvplot4(NODE);
359: int objcp(NODE);
360: int ineqn(NODE);
1.17 saito 361: void obj_cp(struct canvas *,struct canvas *,int);
1.15 saito 362: void itvcalc(double **, struct canvas *, int);
1.14 saito 363: void itvplotmain(struct canvas *, int);
364: void itvplotmain1(struct canvas *);
365: #endif
366: void ifplot_resize(struct canvas *,POINT,POINT);
367: void plot_resize(struct canvas *,POINT,POINT);
1.15 saito 368: void ifplotmainOld(struct canvas *);
1.14 saito 369: void ifplotmain(struct canvas *);
1.15 saito 370: void ifplotmains(struct canvas *);
1.14 saito 371: void qifplotmain(struct canvas *);
1.15 saito 372: void if_print(DISPLAY *,double **,struct canvas *,int);
373: void if_printOld(DISPLAY *,double **,struct canvas *);
1.14 saito 374: void memory_if_print(double **,struct canvas *,BYTEARRAY *);
375: void con_print(DISPLAY *,double **,struct canvas *);
376: void memory_con_print(double **,struct canvas *,BYTEARRAY *);
377: void qif_print(DISPLAY *,char **,struct canvas *);
378: void plot_print(DISPLAY *,struct canvas *);
1.16 ohara 379: void set_drawcolor(unsigned int);
380: void draw_character_string(DISPLAY *,struct canvas *,int,int,char *,int);
1.14 saito 381: void draw_point(DISPLAY *,struct canvas *,int,int,int);
382: void draw_line(DISPLAY *,struct canvas *,int,int,int,int,int);
383: void pline(DISPLAY *,struct canvas *,DRAWABLE);
384: double adjust_scale(double,double);
385: void initmarker(struct canvas *,char *);
386: void marker(struct canvas *,int,int);
387: void define_cursor(WINDOW,CURSOR);
1.8 noro 388: void count_and_flush();
389: void flush();
390: int search_canvas();
391: void create_canvas(struct canvas *can);
1.17 saito 392: void copy_to_canvas(struct canvas *can);
393: void set_selection();
394: void reset_selection();
395: void set_busy();
396: void reset_busy();
1.8 noro 397: void clear_pixmap(struct canvas *can);
398: void alloc_pixmap(struct canvas *can);
399: void copy_subimage(struct canvas *subcan,struct canvas *can,POINT pos);
1.17 saito 400: int init_plot_display(int,char **);
401: void reset_current_computation();
402: void process_xevent();
403:
404: #if defined(VISUAL)
405: int search_active_canvas();
406: void destroy_canvas(struct canvas *can);
1.8 noro 407: void draw_wideframe(struct canvas *can,DRAWABLE d);
408: void create_brushes();
409: void draw_frame0(DRAWABLE d,POINT spos,POINT epos);
410:
1.1 noro 411: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>