Annotation of OpenXM_contrib2/asir2000/plot/ifplot.h, Revision 1.16
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.16 ! ohara 48: * $OpenXM: OpenXM_contrib2/asir2000/plot/ifplot.h,v 1.15 2013/12/19 05:48:24 saito 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:
95: #define MODE_IFPLOT 0
96: #define MODE_CONPLOT 1
97: #define MODE_PLOT 2
1.4 noro 98: #define MODE_INTERACTIVE 3
1.11 noro 99: #define MODE_POLARPLOT 4
1.15 saito 100: #define MODE_PLOTOVER 5
101: #define MODE_IFPLOTD 6
102: #define MODE_IFPLOTQ 7
103: #define MODE_IFPLOTB 8
104: #define MODE_INEQND 9
105: #define MODE_INEQNQ 10
106: #define MODE_INEQNB 11
107: #define MODE_INEQNANDD 12
108: #define MODE_INEQNANDQ 13
109: #define MODE_INEQNANDB 14
110: #define MODE_INEQNORD 15
111: #define MODE_INEQNORQ 16
112: #define MODE_INEQNORB 17
113: #define MODE_INEQNXORD 18
114: #define MODE_INEQNXORQ 19
115: #define MODE_INEQNXORB 20
116: #define MODE_CONPLOTD 21
117: #define MODE_CONPLOTQ 22
118: #define MODE_CONPLOTB 23
119: #define MODE_ITVIFPLOT 24
120: #define MODE_PLOTOVERD 25
121: #define MODE_PLOTOVERQ 26
122: #define MODE_PLOTOVERB 27
1.1 noro 123:
124: #define DIR_X 0
125: #define DIR_Y 1
126: #define DIR_Z 2
127:
1.7 noro 128: #if defined(VISUAL)
1.4 noro 129: /* for Visual C++ */
130: #define XC(a) ((a).x)
131: #define YC(a) ((a).y)
132: #define DISPLAY int
1.8 noro 133: #define WINDOW void *
1.4 noro 134: #define CURSOR int
135: #define DRAWABLE HDC
136:
137: /* XXX : use GC argument as the color */
138: #define DRAWPOINT(d,p,g,x,y) SetPixel(p,x,y,0)
139:
140: #define DRAWLINE(d,p,g,x,y,u,v) MoveToEx(p,x,y,&oldpos); LineTo(p,u,v)
1.5 noro 141: #define DRAWSTRING(d,p,g,x,y,s,l) TextOut(p,x,y,s,l)
142: /* #define TEXTWIDTH(f,s,l) */
1.1 noro 143: #else
1.4 noro 144: /* for UNIX */
1.1 noro 145: #define POINT XPoint
146: #define XC(a) ((a).x)
147: #define YC(a) ((a).y)
148: #define DRAWPOINT(d,p,g,x,y) (count_and_flush(),XDrawPoint(d,p,g,x,y))
149: #define DRAWLINE(d,p,g,x,y,u,v) XDrawLine(d,p,g,x,y,u,v)
150: #define DRAWSTRING(d,p,g,x,y,s,l) XDrawString(d,p,g,x,y,s,l)
151: #define TEXTWIDTH(f,s,l) XTextWidth(f,s,l)
152: #define DISPLAY Display
153: #define WINDOW Window
154: #define CURSOR Cursor
155: #define DRAWABLE Drawable
156: #endif
157:
158: struct pa {
159: int length;
160: POINT *pos;
161: };
162:
1.4 noro 163: typedef struct RealVect {
164: int len;
165: int body[1];
166: } RealVect;
167:
168: #define MKRVECT2(v,x,y)\
169: ((v)=(RealVect *)MALLOC_ATOMIC(sizeof(RealVect)+sizeof(int)),\
170: (v)->len=2,(v)->body[0]=(x),(v)->body[1]=(y))
1.5 noro 171: #define MKRVECT3(v,x,y,z)\
172: ((v)=(RealVect *)MALLOC_ATOMIC(sizeof(RealVect)+2*sizeof(int)),\
173: (v)->len=3,(v)->body[0]=(x),(v)->body[1]=(y),(v)->body[2]=(z))
174: #define MKRVECT4(v,x,y,z,u)\
1.4 noro 175: ((v)=(RealVect *)MALLOC_ATOMIC(sizeof(RealVect)+3*sizeof(int)),\
1.5 noro 176: (v)->len=4,(v)->body[0]=(x),(v)->body[1]=(y),(v)->body[2]=(z),(v)->body[3]=(u))
1.12 noro 177: #define MKRVECT5(v,x,y,z,u,w)\
178: ((v)=(RealVect *)MALLOC_ATOMIC(sizeof(RealVect)+4*sizeof(int)),\
179: (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 180:
181: #define RV_POINT 1
182: #define RV_LINE 2
183: #define RV_ARC 3
1.4 noro 184:
1.1 noro 185: struct canvas {
186: int index;
1.7 noro 187: #if defined(VISUAL)
1.4 noro 188: /* for Visual C++ */
189: void *window; /* pointer to CMainFrame */
190: HWND hwnd; /* handle to the canvas window */
191: HDC pix; /* shadow DC on memory */
192: char *prefix;
193: int percentage;
194: struct canvas *real_can;
1.1 noro 195: #else
196: Widget shell,xcoord,ycoord,xdone,ydone,level,wideb,preciseb,noaxisb;
197: Window window;
198: Pixmap pix;
199: #endif
200: char *wname;
201: char mode;
202: char wide;
203: char precise;
204: char noaxis;
205: V vx,vy;
206: P formula;
207: int width,height;
208: double xmin,xmax;
209: double ymin,ymax;
210: double zmin,zmax;
1.15 saito 211: double vmin,vmax;
1.1 noro 212: int nzstep;
213: Q qxmin,qxmax;
214: Q qymin,qymax;
215: struct pa *pa;
1.4 noro 216: /* to register the history in the interactive mode */
217: NODE history;
1.13 noro 218: int color;
1.15 saito 219: int division;
1.1 noro 220: };
221:
222: extern struct canvas *canvas[];
1.10 noro 223: extern struct canvas *closed_canvas[];
1.1 noro 224: extern struct canvas *current_can;
1.14 saito 225: #if defined(INTERVAL)
226: extern Pixel BackPixel;
227: extern int Itvplot;
228: #endif
1.1 noro 229:
230: extern VL CO;
231: extern int stream;
232:
233: extern DISPLAY *display;
234: extern CURSOR normalcur,runningcur,errorcur;
235:
1.4 noro 236: #if defined(VISUAL)
237: extern POINT start_point,end_point;
238: extern SIZE cansize;
239: #else
1.1 noro 240: extern Window rootwin;
1.6 noro 241: extern GC drawGC,dashGC,hlGC,scaleGC,clearGC,xorGC,colorGC,cdrawGC;
1.1 noro 242: extern XFontStruct *sffs;
1.8 noro 243: #endif
1.9 takayama 244:
245: struct xcolorForPS {
1.14 saito 246: unsigned long pixel;
247: double r,g,b;
248: int print;
1.9 takayama 249: };
1.8 noro 250:
251: /* prototypes */
1.14 saito 252: void calc(double **,struct canvas *,int);
253: double usubstrp(P,double);
254: void qcalc(char **,struct canvas *);
1.16 ! ohara 255: void calcb(double **,struct canvas *,int);
! 256: void calcq(double **,struct canvas *,int);
! 257: void polarplotcalc(struct canvas *);
1.14 saito 258: void sturmseq(VL,P,VECT *);
259: void seproot(VECT,int,int,int *);
260: int numch(VECT,Q,Q);
261: void usubstqp(P,Q,Q *);
262: void plotcalc(struct canvas *);
263: int open_canvas(NODE);
1.15 saito 264: int plot(NODE,int);
265: int ifplotold(NODE);
266: int polarplot(NODE);
267: int conplotD(NODE);
1.14 saito 268: int memory_plot(NODE,LIST *);
269: int plotover(NODE);
1.15 saito 270: int plotoverD(NODE);
1.14 saito 271: int drawcircle(NODE);
272: int draw_obj(NODE);
273: int clear_canvas(NODE);
1.16 ! ohara 274: void popup_canvas(int);
1.14 saito 275: int arrayplot(NODE);
276: int ineqnover(NODE);
277: int ineqnand(NODE);
278: int ineqnor(NODE);
279: int ineqnxor(NODE);
280: void ineqnmain(struct canvas *, int, int);
1.15 saito 281: void conplotmainD(struct canvas *);
1.14 saito 282: void obj_op(struct canvas *, struct canvas *, int);
1.15 saito 283: void area_print(DISPLAY *,double **, struct canvas *, int);
284: #if defined(INTERVAL)
285: int itvifplot(NODE);
286: //int itvplot1(NODE);
287: //int itvplot2(NODE);
288: //int itvplot3(NODE);
289: //int itvplot4(NODE);
290: int objcp(NODE);
291: int ineqn(NODE);
292: void itvcalc(double **, struct canvas *, int);
1.14 saito 293: void itvplotmain(struct canvas *, int);
294: void itvplotmain1(struct canvas *);
295: #endif
296: void ifplot_resize(struct canvas *,POINT,POINT);
297: void plot_resize(struct canvas *,POINT,POINT);
1.15 saito 298: void ifplotmainOld(struct canvas *);
1.14 saito 299: void ifplotmain(struct canvas *);
1.15 saito 300: void ifplotmains(struct canvas *);
1.14 saito 301: void qifplotmain(struct canvas *);
1.15 saito 302: void if_print(DISPLAY *,double **,struct canvas *,int);
303: void if_printOld(DISPLAY *,double **,struct canvas *);
1.14 saito 304: void memory_if_print(double **,struct canvas *,BYTEARRAY *);
305: void con_print(DISPLAY *,double **,struct canvas *);
306: void memory_con_print(double **,struct canvas *,BYTEARRAY *);
307: void qif_print(DISPLAY *,char **,struct canvas *);
308: void plot_print(DISPLAY *,struct canvas *);
1.16 ! ohara 309: void set_drawcolor(unsigned int);
! 310: void draw_character_string(DISPLAY *,struct canvas *,int,int,char *,int);
1.14 saito 311: void draw_point(DISPLAY *,struct canvas *,int,int,int);
312: void draw_line(DISPLAY *,struct canvas *,int,int,int,int,int);
313: void pline(DISPLAY *,struct canvas *,DRAWABLE);
314: double adjust_scale(double,double);
315: void initmarker(struct canvas *,char *);
316: void marker(struct canvas *,int,int);
317: void define_cursor(WINDOW,CURSOR);
1.8 noro 318: void count_and_flush();
319: void flush();
320:
321: #if defined(VISUAL)
322: int search_canvas();
323: int search_active_canvas();
324: void create_canvas(struct canvas *can);
325: void destroy_canvas(struct canvas *can);
326: void clear_pixmap(struct canvas *can);
327: void alloc_pixmap(struct canvas *can);
328: void copy_to_canvas(struct canvas *can);
329: void copy_subimage(struct canvas *subcan,struct canvas *can,POINT pos);
330: void draw_wideframe(struct canvas *can,DRAWABLE d);
331: void create_brushes();
332: void draw_frame0(DRAWABLE d,POINT spos,POINT epos);
333:
334: void reset_current_computation();
335: void set_selection();
336: void reset_selection();
337: void set_busy();
338: void reset_busy();
1.1 noro 339: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>