Annotation of OpenXM_contrib2/asir2000/plot/ifplot.h, Revision 1.9
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.9 ! takayama 48: * $OpenXM: OpenXM_contrib2/asir2000/plot/ifplot.h,v 1.8 2001/10/09 01:36:27 noro 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
91: #define DEFAULTWIDTH 400
92: #define DEFAULTHEIGHT 400
93:
94: #define MODE_IFPLOT 0
95: #define MODE_CONPLOT 1
96: #define MODE_PLOT 2
1.4 noro 97: #define MODE_INTERACTIVE 3
1.1 noro 98:
99: #define DIR_X 0
100: #define DIR_Y 1
101: #define DIR_Z 2
102:
1.7 noro 103: #if defined(VISUAL)
1.4 noro 104: /* for Visual C++ */
105: #define XC(a) ((a).x)
106: #define YC(a) ((a).y)
107: #define DISPLAY int
1.8 noro 108: #define WINDOW void *
1.4 noro 109: #define CURSOR int
110: #define DRAWABLE HDC
111:
112: /* XXX : use GC argument as the color */
113: #define DRAWPOINT(d,p,g,x,y) SetPixel(p,x,y,0)
114:
115: #define DRAWLINE(d,p,g,x,y,u,v) MoveToEx(p,x,y,&oldpos); LineTo(p,u,v)
1.5 noro 116: #define DRAWSTRING(d,p,g,x,y,s,l) TextOut(p,x,y,s,l)
117: /* #define TEXTWIDTH(f,s,l) */
1.1 noro 118: #else
1.4 noro 119: /* for UNIX */
1.1 noro 120: #define POINT XPoint
121: #define XC(a) ((a).x)
122: #define YC(a) ((a).y)
123: #define DRAWPOINT(d,p,g,x,y) (count_and_flush(),XDrawPoint(d,p,g,x,y))
124: #define DRAWLINE(d,p,g,x,y,u,v) XDrawLine(d,p,g,x,y,u,v)
125: #define DRAWSTRING(d,p,g,x,y,s,l) XDrawString(d,p,g,x,y,s,l)
126: #define TEXTWIDTH(f,s,l) XTextWidth(f,s,l)
127: #define DISPLAY Display
128: #define WINDOW Window
129: #define CURSOR Cursor
130: #define DRAWABLE Drawable
131: #endif
132:
133: struct pa {
134: int length;
135: POINT *pos;
136: };
137:
1.4 noro 138: typedef struct RealVect {
139: int len;
140: int body[1];
141: } RealVect;
142:
143: #define MKRVECT2(v,x,y)\
144: ((v)=(RealVect *)MALLOC_ATOMIC(sizeof(RealVect)+sizeof(int)),\
145: (v)->len=2,(v)->body[0]=(x),(v)->body[1]=(y))
1.5 noro 146: #define MKRVECT3(v,x,y,z)\
147: ((v)=(RealVect *)MALLOC_ATOMIC(sizeof(RealVect)+2*sizeof(int)),\
148: (v)->len=3,(v)->body[0]=(x),(v)->body[1]=(y),(v)->body[2]=(z))
149: #define MKRVECT4(v,x,y,z,u)\
1.4 noro 150: ((v)=(RealVect *)MALLOC_ATOMIC(sizeof(RealVect)+3*sizeof(int)),\
1.5 noro 151: (v)->len=4,(v)->body[0]=(x),(v)->body[1]=(y),(v)->body[2]=(z),(v)->body[3]=(u))
152:
153: #define RV_POINT 1
154: #define RV_LINE 2
155: #define RV_ARC 3
1.4 noro 156:
1.1 noro 157: struct canvas {
158: int index;
1.7 noro 159: #if defined(VISUAL)
1.4 noro 160: /* for Visual C++ */
161: void *window; /* pointer to CMainFrame */
162: HWND hwnd; /* handle to the canvas window */
163: HDC pix; /* shadow DC on memory */
164: char *prefix;
165: int percentage;
166: struct canvas *real_can;
1.1 noro 167: #else
168: Widget shell,xcoord,ycoord,xdone,ydone,level,wideb,preciseb,noaxisb;
169: Window window;
170: Pixmap pix;
171: #endif
172: char *wname;
173: char mode;
174: char wide;
175: char precise;
176: char noaxis;
177: V vx,vy;
178: P formula;
179: int width,height;
180: double xmin,xmax;
181: double ymin,ymax;
182: double zmin,zmax;
183: int nzstep;
184: Q qxmin,qxmax;
185: Q qymin,qymax;
186: struct pa *pa;
1.4 noro 187: /* to register the history in the interactive mode */
188: NODE history;
1.1 noro 189: };
190:
191: extern struct canvas *canvas[];
192: extern struct canvas *current_can;
193:
194: extern VL CO;
195: extern int stream;
196:
197: extern DISPLAY *display;
198: extern CURSOR normalcur,runningcur,errorcur;
199:
1.4 noro 200: #if defined(VISUAL)
201: extern POINT start_point,end_point;
202: extern SIZE cansize;
203: #else
1.1 noro 204: extern Window rootwin;
1.6 noro 205: extern GC drawGC,dashGC,hlGC,scaleGC,clearGC,xorGC,colorGC,cdrawGC;
1.1 noro 206: extern XFontStruct *sffs;
1.8 noro 207: #endif
1.9 ! takayama 208:
! 209: struct xcolorForPS {
! 210: unsigned long pixel;
! 211: double r,g,b;
! 212: int print;
! 213: };
1.8 noro 214:
215: /* prototypes */
216: void calc(double **tab,struct canvas *can,int nox);
217: double usubstrp(P p,double r);
218: void qcalc(char **tab,struct canvas *can);
219: void sturmseq(VL vl,P p,VECT *rp);
220: void seproot(VECT s,int min,int max,int *ar);
221: int numch(VECT s,Q n,Q a0);
222: void usubstqp(P p,Q r,Q *v);
223: void plotcalc(struct canvas *can);
224: int open_canvas(NODE arg);
225: int plot(NODE arg);
226: int memory_plot(NODE arg,LIST *bytes);
227: int plotover(NODE arg);
228: int drawcircle(NODE arg);
229: int draw_obj(NODE arg);
230: int clear_canvas(NODE arg);
231: int arrayplot(NODE arg);
232: void ifplot_resize(struct canvas *can,POINT spos,POINT epos);
233: void plot_resize(struct canvas *can,POINT spos,POINT epos);
234: void ifplotmain(struct canvas *can);
235: void qifplotmain(struct canvas *can);
236: void if_print(DISPLAY *display,double **tab,struct canvas *can);
237: void memory_if_print(double **tab,struct canvas *can,BYTEARRAY *bytes);
238: void con_print(DISPLAY *display,double **tab,struct canvas *can);
239: void memory_con_print(double **tab,struct canvas *can,BYTEARRAY *bytes);
240: void qif_print(DISPLAY *display,char **tab,struct canvas *can);
241: void plot_print(DISPLAY *display,struct canvas *can);
242: void draw_point(DISPLAY *display,struct canvas *can,int x,int y,int color);
243: void draw_line(DISPLAY *display,struct canvas *can,int x,int y,int u,int v,int color);
244: void pline(DISPLAY *display,struct canvas *can,DRAWABLE d);
245: double adjust_scale(double e,double w);
246: void initmarker(struct canvas *can,char *message);
247: void marker(struct canvas *can,int dir,int p);
248: void define_cursor(WINDOW w,CURSOR cur);
249: void count_and_flush();
250: void flush();
251:
252: #if defined(VISUAL)
253: int search_canvas();
254: int search_active_canvas();
255: void create_canvas(struct canvas *can);
256: void destroy_canvas(struct canvas *can);
257: void clear_pixmap(struct canvas *can);
258: void alloc_pixmap(struct canvas *can);
259: void copy_to_canvas(struct canvas *can);
260: void copy_subimage(struct canvas *subcan,struct canvas *can,POINT pos);
261: void draw_wideframe(struct canvas *can,DRAWABLE d);
262: void create_brushes();
263: void draw_frame0(DRAWABLE d,POINT spos,POINT epos);
264:
265: void reset_current_computation();
266: void set_selection();
267: void reset_selection();
268: void set_busy();
269: void reset_busy();
1.1 noro 270: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>