[BACK]Return to rect.h CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / pari-2.2 / src / graph

Annotation of OpenXM_contrib/pari-2.2/src/graph/rect.h, Revision 1.2

1.2     ! noro        1: /* $Id: rect.h,v 1.10 2002/06/09 18:49:11 karim Exp $
1.1       noro        2:
                      3: Copyright (C) 2000  The PARI group.
                      4:
                      5: This file is part of the PARI/GP package.
                      6:
                      7: PARI/GP is free software; you can redistribute it and/or modify it under the
                      8: terms of the GNU General Public License as published by the Free Software
                      9: Foundation. It is distributed in the hope that it will be useful, but WITHOUT
                     10: ANY WARRANTY WHATSOEVER.
                     11:
                     12: Check the License for details. You should have received a copy of it, along
                     13: with the package; see the file 'COPYING'. If not, write to the Free Software
                     14: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
                     15:
                     16: #define PLOT_NAME_LEN 20
                     17: #define NUMRECT 18
                     18:
                     19: #define DTOL(t) ((long)(t + 0.5))
                     20:
                     21: typedef struct PARI_plot {
                     22:   long width;
                     23:   long height;
                     24:   long hunit;
                     25:   long vunit;
                     26:   long fwidth;
                     27:   long fheight;
                     28:   long init;
                     29:   char name[PLOT_NAME_LEN+1];
                     30: } PARI_plot;
                     31:
                     32: extern PARI_plot pari_plot, pari_psplot;
1.2     ! noro       33: #ifdef BOTH_GNUPLOT_AND_X11
        !            34: extern PARI_plot pari_X11plot;
        !            35: #endif
        !            36: extern PARI_plot *pari_plot_engine;
        !            37:
        !            38: #define w_height (pari_plot_engine->height)
        !            39: #define w_width (pari_plot_engine->width)
        !            40: #define f_height (pari_plot_engine->fheight)
        !            41: #define f_width (pari_plot_engine->fwidth)
        !            42: #define h_unit (pari_plot_engine->hunit)
        !            43: #define v_unit (pari_plot_engine->vunit)
1.1       noro       44: #define lmargin (f_width*10)
                     45: #define rmargin (h_unit - 1)
                     46: #define tmargin (v_unit - 1)
                     47: #define bmargin (v_unit + f_height - 1)
                     48:
                     49: typedef struct dblPointList{
                     50:   double *d;                   /* data */
                     51:   long nb;                     /* number of elements */
                     52:   double xsml,xbig,ysml,ybig;  /* extrema */
                     53: } dblPointList;
                     54:
                     55: typedef struct RectObj {
                     56:   struct RectObj *next;
                     57:   long code,color;
                     58: } RectObj;
                     59:
                     60: typedef struct PariRect {
                     61:   RectObj *head,*tail;
                     62:   long sizex,sizey;
                     63:   double cursorx,cursory;
                     64:   double xscale,yscale;
                     65:   double xshift,yshift;
                     66:   long has_graph;         /* xy-ranges of this rectangle should be used
                     67:                              for interactive operations.  */
                     68: } PariRect;
                     69:
                     70: /* The structures below are "subclasses" of RectObj. */
                     71:
                     72: typedef struct RectObj1P {
                     73:   struct RectObj *next;
                     74:   long code,color;
                     75:   double x,y;
                     76: } RectObj1P;
                     77:
                     78: typedef struct RectObj2P {
                     79:   struct RectObj *next;
                     80:   long code,color;
                     81:   double x1,y1;
                     82:   double x2,y2;
                     83: } RectObj2P;
                     84:
                     85: typedef struct RectObjMP {
                     86:   struct RectObj *next;
                     87:   long code,color;
                     88:   long count;
                     89:   double *xs,*ys;
                     90: } RectObjMP;
                     91:
                     92: typedef struct RectObjST {
                     93:   struct RectObj *next;
                     94:   long code,color;
                     95:   long length;
                     96:   char *s;
                     97:   double x,y;
                     98:   long dir;
                     99: } RectObjST;
                    100:
                    101: typedef struct RectObjPN {
                    102:   struct RectObj *next;
                    103:   long code,color;
                    104:   long pen;
                    105: } RectObjPN;
                    106:
                    107: typedef struct RectObjPS {
                    108:   struct RectObj *next;
                    109:   long code,color;
                    110:   double size;
                    111: } RectObjPS;
                    112:
                    113: #define BLACK      1 /* Default */
                    114: #define BLUE       2 /* Axes */
                    115: #define SIENNA     3 /* Odd numbered curves in ploth */
                    116: #define RED        4 /* Curves, or Even numbered curves in ploth */
                    117: #define CORNSILK   5
                    118: #define GREY       6
                    119: #define GAINSBORO  7
                    120:
                    121: #define MAX_COLORS 8
                    122: #define DEFAULT_COLOR BLACK
                    123:
                    124: #define ROt_MV 0                       /* Move */
                    125: #define ROt_PT 1                       /* Point */
                    126: #define ROt_LN 2                       /* Line */
                    127: #define ROt_BX 3                       /* Box */
                    128: #define ROt_MP 4                       /* Multiple point */
                    129: #define ROt_ML 5                       /* Multiple lines */
                    130: #define ROt_ST 6                       /* String */
                    131: #define ROt_PTT 7                      /* Point type change */
                    132: #define ROt_LNT 8                      /* Line type change */
                    133: #define ROt_PTS 9                      /* Point size change */
                    134: #define ROt_NULL 10            /* To be the start of the chain */
                    135:
                    136: #define ROt_MAX 10             /* Maximal type */
                    137:
                    138: /* Pointer conversion. */
                    139:
                    140: #define RoMV(rop) ((RectObj1P*)rop)
                    141: #define RoPT(rop) ((RectObj1P*)rop)
                    142: #define RoLN(rop) ((RectObj2P*)rop)
                    143: #define RoBX(rop) ((RectObj2P*)rop)
                    144: #define RoMP(rop) ((RectObjMP*)rop)
                    145: #define RoML(rop) ((RectObjMP*)rop)
                    146: #define RoST(rop) ((RectObjST*)rop)
                    147: #define RoPTT(rop) ((RectObjPN*)rop)
                    148: #define RoPTS(rop) ((RectObjPS*)rop)
                    149: #define RoLNT(rop) ((RectObjPN*)rop)
                    150: #define RoNULL(rop) ((RectObj*)rop)
                    151:
                    152: /* All the access to the rectangle data _should_ go via these macros! */
                    153:
                    154: #define RHead(rp) ((rp)->head)
                    155: #define RTail(rp) ((rp)->tail)
                    156: #define RXsize(rp) ((rp)->sizex)
                    157: #define RYsize(rp) ((rp)->sizey)
                    158: #define RXcursor(rp) ((rp)->cursorx)
                    159: #define RYcursor(rp) ((rp)->cursory)
                    160: #define RXshift(rp) ((rp)->xshift)
                    161: #define RYshift(rp) ((rp)->yshift)
                    162: #define RXscale(rp) ((rp)->xscale)
                    163: #define RYscale(rp) ((rp)->yscale)
                    164: #define RHasGraph(rp) ((rp)->has_graph)
                    165:
                    166: #define RoNext(rop) ((rop)->next)
                    167: #define RoType(rop) ((rop)->code)
                    168: #define RoCol(rop) ((rop)->color)
                    169: #define RoMVx(rop) (RoMV(rop)->x)
                    170: #define RoMVy(rop) (RoMV(rop)->y)
                    171: #define RoPTx(rop) (RoPT(rop)->x)
                    172: #define RoPTy(rop) (RoPT(rop)->y)
                    173: #define RoLNx1(rop) (RoLN(rop)->x1)
                    174: #define RoLNy1(rop) (RoLN(rop)->y1)
                    175: #define RoLNx2(rop) (RoLN(rop)->x2)
                    176: #define RoLNy2(rop) (RoLN(rop)->y2)
                    177: #define RoBXx1(rop) (RoBX(rop)->x1)
                    178: #define RoBXy1(rop) (RoBX(rop)->y1)
                    179: #define RoBXx2(rop) (RoBX(rop)->x2)
                    180: #define RoBXy2(rop) (RoBX(rop)->y2)
                    181:
                    182: #define RoMPcnt(rop) (RoMP(rop)->count)
                    183: #define RoMPxs(rop) (RoMP(rop)->xs)
                    184: #define RoMPys(rop) (RoMP(rop)->ys)
                    185:
                    186: #define RoMLcnt(rop) (RoML(rop)->count)
                    187: #define RoMLxs(rop) (RoML(rop)->xs)
                    188: #define RoMLys(rop) (RoML(rop)->ys)
                    189:
                    190: #define RoSTs(rop) (RoST(rop)->s)
                    191: #define RoSTl(rop) (RoST(rop)->length)
                    192: #define RoSTx(rop) (RoST(rop)->x)
                    193: #define RoSTy(rop) (RoST(rop)->y)
                    194: #define RoSTdir(rop) (RoST(rop)->dir)
                    195:
                    196: #define RoSTdirLEFT      0x00
                    197: #define RoSTdirCENTER    0x01
                    198: #define RoSTdirRIGHT     0x02
                    199: #define RoSTdirHPOS_mask  0x03
                    200:
                    201: #define RoSTdirBOTTOM    0x00
                    202: #define RoSTdirVCENTER   0x04
                    203: #define RoSTdirTOP       0x08
                    204: #define RoSTdirVPOS_mask  0x0c
                    205:
                    206: #define RoSTdirHGAP      0x10
                    207: #define RoSTdirVGAP      0x20
                    208:
                    209:
                    210: #define RoPTTpen(rop) (RoPTT(rop)->pen)
                    211: #define RoLNTpen(rop) (RoLNT(rop)->pen)
                    212: #define RoPTSsize(rop) (RoPTS(rop)->size)
                    213:
                    214: #define PL_POINTS 1
                    215: #define GOODRECT(r) (0 <= r && r < NUMRECT)
                    216: #define GOODCOLOR(c) (1 <= c && c < MAX_COLORS)
                    217:
                    218: #define PLOT_PARAMETRIC   0x00001
                    219: #define PLOT_RECURSIVE    0x00002
                    220: #define PLOT_NO_RESCALE   0x00004
                    221: #define PLOT_NO_AXE_X     0x00008
                    222: #define PLOT_NO_AXE_Y     0x00010
                    223: #define PLOT_NO_FRAME     0x00020
                    224: #define PLOT_POINTS       0x00040
                    225: #define PLOT_POINTS_LINES 0x00080
                    226: #define PLOT_SPLINES      0x00100
                    227: #define PLOT_NO_TICK_X    0x00200
                    228: #define PLOT_NO_TICK_Y    0x00400
                    229: #define PLOT_NODOUBLETICK 0x00800
                    230:
                    231: #define PLOT_POSTSCRIPT   0x80000
                    232:
                    233: #define RECT_CP_RELATIVE  0x1
                    234: #define RECT_CP_NW        0x0
                    235: #define RECT_CP_SW        0x2
                    236: #define RECT_CP_SE        0x4
                    237: #define RECT_CP_NE        0x6
                    238:
                    239: #define TICKS_CLOCKW   1               /* Draw in clockwise direction */
                    240: #define TICKS_ACLOCKW  2               /* Draw in anticlockwise direction */
                    241: #define TICKS_ENDSTOO  4               /* Draw at endspoints if needed */
                    242: #define TICKS_NODOUBLE 8               /* Do not draw double-length ticks */
                    243:
                    244: /* Not implemented yet */
                    245: #define TICKS_COORD    16              /* Output [x,y,l,isdbl] for each tick */
                    246: #define TICKS_RELATIVE 32              /* x,y-coordinates are relative */
                    247:
                    248: extern PariRect  **rectgraph;
                    249: extern long  rectpoint_itype;
                    250: extern long  rectline_itype;
                    251:
                    252: /* plotport.c */
                    253:
                    254: extern  void    initrect(long ne, long x, long y);
                    255: extern  void    initrect_gen(long ne, GEN x, GEN y, long flag);
                    256: extern  void    killrect(long ne);
                    257: extern  void    plot(entree *ep, GEN a, GEN b, char *ch, GEN ysmlu, GEN ybigu, long prec);
                    258: extern  GEN     ploth(entree *ep, GEN a, GEN b, char *ch, long prec, long flag, long numpoints);
                    259: extern  GEN     ploth2(entree *ep, GEN a, GEN b, char *ch, long prec);
                    260: extern  GEN     plothmult(entree *ep, GEN a, GEN b, char *ch, long prec);
                    261: extern  GEN     plothraw(GEN listx, GEN listy, long flag);
1.2     ! noro      262: extern  GEN     plothsizes(void);
1.1       noro      263: extern  GEN     plothsizes_flag(long flag);
                    264: extern  void    postdraw(GEN list);
                    265: extern  void    postdraw_flag(GEN list, long flag);
                    266: extern  GEN     postploth(entree *ep,GEN a,GEN b,char *ch,long prec,long flag,long numpoints);
                    267: extern  GEN     postploth2(entree *ep,GEN a,GEN b,char *ch,long prec,long numpoints);
                    268: extern  GEN     postplothraw(GEN listx, GEN listy, long flag);
                    269: extern  void    rectbox(long ne, GEN gx2, GEN gy2);
                    270: extern  void    rectcolor(long ne, long color);
                    271: extern  void    rectcopy(long source, long dest, long xoff, long yoff);
                    272: extern  void    rectcopy_gen(long source, long dest, GEN xoff, GEN yoff, long flag);
                    273: extern  GEN     rectcursor(long ne);
                    274: extern  void    rectdraw(GEN list);
                    275: extern  void    rectdraw_flag(GEN list, long flag);
                    276: extern  void    rectline(long ne, GEN gx2, GEN gy2);
                    277: extern  void    rectlines(long ne, GEN listx, GEN listy, long flag);
                    278: extern  void    rectlinetype(long ne, long t);
                    279: extern  void    rectmove(long ne, GEN x, GEN y);
                    280: extern  GEN     rectploth(long drawrect,entree *ep, GEN a, GEN b, char *ch, long prec, ulong flags, long testpoints);
                    281: extern  GEN     rectplothraw(long drawrect, GEN data, long flags);
                    282: extern  void    rectpoint(long ne, GEN x, GEN y);
                    283: extern  void    rectpoints(long ne, GEN listx, GEN listy);
                    284: extern  void    rectpointtype(long ne, long t);
                    285: extern  void   rectpointsize(long ne, GEN size);
                    286: extern  void    rectrbox(long ne, GEN gx2, GEN gy2);
                    287: extern  void    rectrline(long ne, GEN gx2, GEN gy2);
                    288: extern  void    rectrmove(long ne, GEN x, GEN y);
                    289: extern  void    rectrpoint(long ne, GEN x, GEN y);
                    290: extern  void    rectscale(long ne, GEN x1, GEN x2, GEN y1, GEN y2);
                    291: extern  void    rectstring(long ne, char *x);
                    292: extern  void    rectstring3(long ne, char *x, long dir);
                    293: extern  void    rectclip(long rect);
                    294:
                    295: /* architecture-dependent plot file (plotX.c, plotsun.c, plognuplot.c...) */
                    296:
                    297: extern  void    PARI_get_plot(long fatal);
                    298: extern  long    term_set(char *s);
                    299: extern  long    plot_outfile_set(char *s);
                    300: extern  void   set_pointsize(double d);

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