[BACK]Return to ifplot.h CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / plot

Annotation of OpenXM_contrib2/asir2000/plot/ifplot.h, Revision 1.25

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>