[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.1.1.1

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

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