[BACK]Return to plot.h CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gnuplot

Annotation of OpenXM_contrib/gnuplot/plot.h, Revision 1.1.1.3

1.1       maekawa     1: /*
1.1.1.3 ! ohara       2:  * $Id: plot.h,v 1.19.2.5 2002/03/11 16:09:00 lhecking Exp $
1.1       maekawa     3:  *
                      4:  */
                      5:
                      6: /* GNUPLOT - plot.h */
                      7:
                      8: /*[
                      9:  * Copyright 1986 - 1993, 1998   Thomas Williams, Colin Kelley
                     10:  *
                     11:  * Permission to use, copy, and distribute this software and its
                     12:  * documentation for any purpose with or without fee is hereby granted,
                     13:  * provided that the above copyright notice appear in all copies and
                     14:  * that both that copyright notice and this permission notice appear
                     15:  * in supporting documentation.
                     16:  *
                     17:  * Permission to modify the software is granted, but not the right to
                     18:  * distribute the complete modified source code.  Modifications are to
                     19:  * be distributed as patches to the released version.  Permission to
                     20:  * distribute binaries produced by compiling modified sources is granted,
                     21:  * provided you
                     22:  *   1. distribute the corresponding source modifications from the
                     23:  *    released version in the form of a patch file along with the binaries,
                     24:  *   2. add special version identification to distinguish your version
                     25:  *    in addition to the base release version number,
                     26:  *   3. provide your name and address as the primary contact for the
                     27:  *    support of your modified version, and
                     28:  *   4. retain our contact information in regard to use of the base
                     29:  *    software.
                     30:  * Permission to distribute the released version of the source code along
                     31:  * with corresponding source modifications in the form of a patch file is
                     32:  * granted with same provisions 2 through 4 for binary distributions.
                     33:  *
                     34:  * This software is provided "as is" without express or implied warranty
                     35:  * to the extent permitted by applicable law.
                     36: ]*/
                     37:
                     38: /* avoid multiple includes */
                     39: #ifndef PLOT_H
                     40: #define PLOT_H
                     41:
                     42: #ifdef HAVE_CONFIG_H
                     43: # include "config.h"
                     44: #endif
                     45:
                     46: #include "ansichek.h"
                     47: /* syscfg.h is included by stdfn.h */
                     48: #include "stdfn.h"
                     49:
                     50: #define PROGRAM "G N U P L O T"
                     51: #define PROMPT "gnuplot> "
                     52:
                     53: /* The part for OS dependent defines
                     54:  * has been moved to a new file.
                     55:  */
                     56:
                     57: #define SAMPLES 100            /* default number of samples for a plot */
                     58: #define ISO_SAMPLES 10         /* default number of isolines per splot */
                     59: #define ZERO   1e-8            /* default for 'zero' set option */
                     60:
                     61: #ifndef TERM
                     62: /* default terminal is "unknown"; but see init_terminal */
                     63: # define TERM "unknown"
                     64: #endif
                     65:
                     66: /* avoid precompiled header conflict with redefinition */
                     67: #ifdef NEXT
                     68: # include <mach/boolean.h>
                     69: #else
                     70: /* Sheer, raging paranoia */
                     71: # ifdef TRUE
                     72: #  undef TRUE
                     73: # endif
                     74: # ifdef FALSE
                     75: #  undef FALSE
                     76: # endif
                     77: # define TRUE 1
                     78: # define FALSE 0
                     79: #endif
                     80: /* TRUE or FALSE */
                     81: typedef int TBOOLEAN;
                     82:
                     83: /* double true, used in autoscale: 1=autoscale ?min, 2=autoscale ?max */
                     84: #define DTRUE 3
                     85:
1.1.1.3 ! ohara      86: #define DEG2RAD (M_PI / 180.0)
1.1       maekawa    87:
                     88:
                     89: /* minimum size of points[] in curve_points */
                     90: #define MIN_CRV_POINTS 100
                     91: /* minimum size of points[] in surface_points */
                     92: #define MIN_SRF_POINTS 1000
                     93:
                     94:
                     95: /* Minimum number of chars to represent an integer */
                     96: #define INT_STR_LEN (3*sizeof(int))
                     97:
                     98: /* note that MAX_LINE_LEN, MAX_TOKENS and MAX_AT_LEN do no longer limit the
                     99:    size of the input. The values describe the steps in which the sizes are
                    100:    extended. */
                    101:
                    102: #define MAX_LINE_LEN 1024      /* maximum number of chars allowed on line */
                    103: #define MAX_TOKENS 400
                    104: #define MAX_ID_LEN 50          /* max length of an identifier */
                    105:
                    106:
                    107: #define MAX_AT_LEN 150         /* max number of entries in action table */
                    108: #define STACK_DEPTH 100
                    109: #define NO_CARET (-1)
                    110:
                    111: #ifdef DOS16
                    112: # define MAX_NUM_VAR   3       /* Plotting projection of func. of max. five vars. */
                    113: #else /* not DOS16 */
                    114: # define MAX_NUM_VAR   5       /* Plotting projection of func. of max. five vars. */
                    115: #endif /* not DOS16 */
                    116:
                    117: #define MAP3D_CARTESIAN                0       /* 3D Data mapping. */
                    118: #define MAP3D_SPHERICAL                1
                    119: #define MAP3D_CYLINDRICAL      2
                    120:
                    121: #define CONTOUR_NONE   0       /* Where to place contour maps if at all. */
                    122: #define CONTOUR_BASE   1
                    123: #define CONTOUR_SRF    2
                    124: #define CONTOUR_BOTH   3
                    125:
                    126: #define CONTOUR_KIND_LINEAR    0
                    127: #define CONTOUR_KIND_CUBIC_SPL 1
                    128: #define CONTOUR_KIND_BSPLINE   2
                    129:
                    130: #define LEVELS_AUTO            0               /* How contour levels are set */
                    131: #define LEVELS_INCREMENTAL     1               /* user specified start & incremnet */
                    132: #define LEVELS_DISCRETE                2               /* user specified discrete levels */
                    133:
                    134: #define ANGLES_RADIANS 0
                    135: #define ANGLES_DEGREES 1
                    136:
                    137: #define NO_TICS        0
                    138: #define TICS_ON_BORDER 1
                    139: #define TICS_ON_AXIS   2
                    140: #define TICS_MASK      3
                    141: #define TICS_MIRROR    4
                    142:
                    143: /* give some names to some array elements used in command.c and grap*.c
                    144:  * maybe one day the relevant items in setshow will also be stored
                    145:  * in arrays
                    146:  */
                    147:
                    148: /* SECOND_X_AXIS = FIRST_X_AXIS + SECOND_AXES
                    149:  * FIRST_X_AXIS & SECOND_AXES == 0
                    150:  */
                    151: #define FIRST_AXES 0
                    152: #define SECOND_AXES 4
                    153:
                    154: #define FIRST_Z_AXIS 0
                    155: #define FIRST_Y_AXIS 1
                    156: #define FIRST_X_AXIS 2
                    157: #define SECOND_Z_AXIS 4 /* for future expansion ;-) */
                    158: #define SECOND_Y_AXIS 5
                    159: #define SECOND_X_AXIS 6
                    160: /* extend list for datatype[] for t,u,v,r though IMHO
                    161:  * they are not relevant to time data [being parametric dummies]
                    162:  */
                    163: #define T_AXIS 3  /* fill gap */
                    164: #define R_AXIS 7  /* never used ? */
                    165: #define U_AXIS 8
                    166: #define V_AXIS 9
                    167:
                    168: #define AXIS_ARRAY_SIZE 10
                    169: #define DATATYPE_ARRAY_SIZE 10
                    170:
                    171: /* values for range_flags[] */
                    172: #define RANGE_WRITEBACK 1    /* write auto-ed ranges back to variables for autoscale */
                    173: #define RANGE_REVERSE   2    /* allow auto and reversed ranges */
                    174:
                    175: /* we want two auto modes for minitics - default where minitics
                    176:  * are auto for log/time and off for linear, and auto where
                    177:  * auto for all graphs
                    178:  * I've done them in this order so that logscale-mode can simply
                    179:  * test bit 0 to see if it must do the minitics automatically.
                    180:  * similarly, conventional plot can test bit 1 to see if minitics are
                    181:  * required
                    182:  */
                    183: #define MINI_OFF      0
                    184: #define MINI_DEFAULT  1
                    185: #define MINI_AUTO     3
                    186: #define MINI_USER     2
                    187:
                    188:
                    189: /* Need to allow user to choose grid at first and/or second axes tics.
                    190:  * Also want to let user choose circles at x or y tics for polar grid.
                    191:  * Also want to allow user rectangular grid for polar plot or polar
                    192:  * grid for parametric plot. So just go for full configurability.
                    193:  * These are bitmasks
                    194:  */
                    195: #define GRID_OFF    0
                    196: #define GRID_X      1
                    197: #define GRID_Y      2
                    198: #define GRID_Z      4
                    199: #define GRID_X2     8
                    200: #define GRID_Y2     16
                    201: #define GRID_MX     32
                    202: #define GRID_MY     64
                    203: #define GRID_MZ     128
                    204: #define GRID_MX2    256
                    205: #define GRID_MY2    512
                    206:
                    207: /* To access curves larger than 64k, MSDOS needs to use huge pointers */
                    208: #if (defined(__TURBOC__) && defined(MSDOS)) || defined(WIN16)
                    209: # define GPHUGE huge
                    210: # define GPFAR far
                    211: #else /* not TurboC || WIN16 */
                    212: # define GPHUGE /* nothing */
                    213: # define GPFAR /* nothing */
                    214: #endif /* not TurboC || WIN16 */
                    215:
                    216: #if defined(DOS16) || defined(WIN16)
                    217: typedef float coordval;                /* memory is tight on PCs! */
                    218: # define COORDVAL_FLOAT 1
                    219: #else
                    220: typedef double coordval;
                    221: #endif
                    222:
                    223: /*
                    224:  * Note about VERYLARGE:  This is the upper bound double (or float, if PC)
                    225:  * numbers. This flag indicates very large numbers. It doesn't have to
                    226:  * be the absolutely biggest number on the machine.
                    227:  * If your machine doesn't have HUGE, or float.h,
                    228:  * define VERYLARGE here.
                    229:  *
                    230:  * example:
                    231: #define VERYLARGE 1e37
                    232:  *
                    233:  * To get an appropriate value for VERYLARGE, we can use DBL_MAX (or
                    234:  * FLT_MAX on PCs), HUGE or HUGE_VAL. DBL_MAX is usually defined in
                    235:  * float.h and is the largest possible double value. HUGE and HUGE_VAL
                    236:  * are either DBL_MAX or +Inf (IEEE special number), depending on the
                    237:  * compiler. +Inf may cause problems with some buggy fp
                    238:  * implementations, so we better avoid that. The following should work
                    239:  * better than the previous setup (which used HUGE in preference to
                    240:  * DBL_MAX).
                    241:  */
                    242:
                    243: /* both min/max and MIN/MAX are defined by some compilers.
                    244:  * we are now on GPMIN / GPMAX
                    245:  */
                    246:
                    247: #define GPMAX(a,b) ( (a) > (b) ? (a) : (b) )
                    248: #define GPMIN(a,b) ( (a) < (b) ? (a) : (b) )
                    249:
                    250: /* Moved from binary.h, command.c, graph3d.c, graphics.c, interpol.c,
                    251:  * plot2d.c, plot3d.c, util3d.c ...
                    252:  */
                    253: #ifndef inrange
                    254: # define inrange(z,min,max) \
                    255:    (((min)<(max)) ? (((z)>=(min)) && ((z)<=(max))) : \
                    256:                     (((z)>=(max)) && ((z)<=(min))))
                    257: #endif
                    258:
                    259: /* There is a bug in the NEXT OS. This is a workaround. Lookout for
                    260:  * an OS correction to cancel the following dinosaur
                    261:  *
                    262:  * Hm, at least with my setup (compiler version 3.1, system 3.3p1),
                    263:  * DBL_MAX is defined correctly and HUGE and HUGE_VAL are both defined
                    264:  * as 1e999. I have no idea to which OS version the bugfix below
                    265:  * applies, at least wrt. HUGE, it is inconsistent with the current
                    266:  * version. Since we are using DBL_MAX anyway, most of this isn't
                    267:  * really needed anymore.
                    268:  */
                    269:
                    270: #if defined ( NEXT ) && NX_CURRENT_COMPILER_RELEASE<310
                    271: # if defined ( DBL_MAX)
                    272: #  undef DBL_MAX
                    273: # endif
                    274: # define DBL_MAX 1.7976931348623157e+308
                    275: # undef HUGE
                    276: # define HUGE    DBL_MAX
                    277: # undef HUGE_VAL
                    278: # define HUGE_VAL DBL_MAX
                    279: #endif /* NEXT && NX_CURRENT_COMPILER_RELEASE<310 */
                    280:
                    281: /* Now define VERYLARGE. This is usually DBL_MAX/2 - 1. On MS-DOS however
                    282:  * we use floats for memory considerations and thus use FLT_MAX.
                    283:  */
                    284:
                    285: #ifndef COORDVAL_FLOAT
                    286: # ifdef DBL_MAX
                    287: #  define VERYLARGE (DBL_MAX/2-1)
                    288: # endif
                    289: #else /* COORDVAL_FLOAT */
                    290: # ifdef FLT_MAX
                    291: #  define VERYLARGE (FLT_MAX/2-1)
                    292: # endif
                    293: #endif /* COORDVAL_FLOAT */
                    294:
                    295: #ifndef VERYLARGE
                    296: # ifdef HUGE
                    297: #  define VERYLARGE (HUGE/2-1)
                    298: # elif defined(HUGE_VAL)
                    299: #  define VERYLARGE (HUGE_VAL/2-1)
                    300: # else
                    301: /* as a last resort */
                    302: #  define VERYLARGE (1e37)
                    303: #  warning "using last resort 1e37 as VERYLARGE define, please check your headers"
                    304: # endif /* HUGE */
                    305: #endif /* VERYLARGE */
                    306:
                    307: /* Some older platforms, namely SunOS 4.x, don't define this. */
                    308: #ifndef DBL_EPSILON
                    309: # define DBL_EPSILON     2.2204460492503131E-16
                    310: #endif
                    311:
                    312: /* The XOPEN ln(10) macro */
                    313: #ifndef M_LN10
                    314: #  define M_LN10    2.3025850929940456840e0
                    315: #endif
                    316:
                    317: /* argument: char *fn */
                    318: #define VALID_FILENAME(fn) ((fn) != NULL && (*fn) != '\0')
                    319:
                    320: #define END_OF_COMMAND (c_token >= num_tokens || equals(c_token,";"))
                    321: #define is_EOF(c) ((c) == 'e' || (c) == 'E')
                    322:
                    323: #ifdef VMS
                    324: # define is_comment(c) ((c) == '#' || (c) == '!')
                    325: # define is_system(c) ((c) == '$')
                    326: /* maybe configure could check this? */
                    327: # define BACKUP_FILESYSTEM 1
                    328: #else /* not VMS */
                    329: # define is_comment(c) ((c) == '#')
                    330: # define is_system(c) ((c) == '!')
                    331: #endif /* not VMS */
                    332:
                    333: #define top_of_stack stack[s_p]
                    334:
                    335: #ifndef RETSIGTYPE
                    336: /* assume ANSI definition by default */
                    337: # define RETSIGTYPE void
                    338: #endif
                    339:
                    340: #ifndef SIGFUNC_NO_INT_ARG
                    341: typedef RETSIGTYPE (*sigfunc)__PROTO((int));
                    342: #else
                    343: typedef RETSIGTYPE (*sigfunc)__PROTO((void));
                    344: #endif
                    345:
1.1.1.3 ! ohara     346: /* HBB 20010720: removed 'sortfunc' --- it's no longer used */
1.1       maekawa   347: #ifndef SORTFUNC_ARGS
1.1.1.3 ! ohara     348: # define SORTFUNC_ARGS const generic *
1.1       maekawa   349: #endif
                    350:
                    351: enum operators {
                    352:        /* keep this in line with table in plot.c */
                    353:        PUSH, PUSHC, PUSHD1, PUSHD2, PUSHD, CALL, CALLN, LNOT, BNOT, UMINUS,
                    354:        LOR, LAND, BOR, XOR, BAND, EQ, NE, GT, LT, GE, LE, PLUS, MINUS, MULT,
                    355:        DIV, MOD, POWER, FACTORIAL, BOOLE,
                    356:        DOLLARS, /* for using extension - div */
                    357:        /* only jump operators go between jump and sf_start */
                    358:    JUMP, JUMPZ, JUMPNZ, JTERN, SF_START
                    359: };
                    360:
                    361:
                    362: #define is_jump(operator) ((operator) >=(int)JUMP && (operator) <(int)SF_START)
                    363:
                    364:
                    365: enum DATA_TYPES {
                    366:        INTGR, CMPLX
                    367: };
                    368:
                    369: #define TIME 3
                    370:
                    371: enum PLOT_TYPE {
                    372:        FUNC, DATA, FUNC3D, DATA3D
                    373: };
                    374:
                    375: /* we explicitly assign values to the types, such that we can
                    376:  * perform bit tests to see if the style involves points and/or lines
                    377:  * bit 0 (val 1) = line, bit 1 (val 2) = point, bit 2 (val 4)= error
                    378:  * This allows rapid decisions about the sample drawn into the key,
                    379:  * for example.
                    380:  */
                    381: enum PLOT_STYLE {
                    382:        LINES      = 0*8 + 1,
                    383:        POINTSTYLE = 1*8 + 2,
                    384:        IMPULSES   = 2*8 + 1,
                    385:        LINESPOINTS= 3*8 + 3,
                    386:        DOTS       = 4*8 + 0,
                    387:        XERRORBARS = 5*8 + 6,
                    388:        YERRORBARS = 6*8 + 6,
                    389:        XYERRORBARS= 7*8 + 6,
                    390:        BOXXYERROR = 8*8 + 1,
                    391:        BOXES      = 9*8 + 1,
                    392:        BOXERROR   =10*8 + 1,
                    393:        STEPS      =11*8 + 1,
                    394:        FSTEPS     =12*8 + 1,
                    395:        HISTEPS    =13*8 + 1,
                    396:        VECTOR     =14*8 + 1,
                    397:        CANDLESTICKS=15*8 + 4,
                    398:        FINANCEBARS=16*8 + 1
                    399: };
                    400:
                    401: enum PLOT_SMOOTH {
                    402:        NONE, UNIQUE, CSPLINES, ACSPLINES, BEZIER, SBEZIER
                    403:
                    404: };
                    405:
                    406: /* this order means we can use  x-(just*strlen(text)*t->h_char)/2 if
                    407:  * term cannot justify
                    408:  */
                    409: enum JUSTIFY {
                    410:        LEFT, CENTRE, RIGHT
                    411: };
                    412:
                    413: /* we use a similar trick for vertical justification of multi-line labels */
                    414: #define JUST_TOP    0
                    415: #define JUST_CENTRE 1
                    416: #define JUST_BOT    2
                    417:
                    418: #if !(defined(ATARI)&&defined(__GNUC__)&&defined(_MATH_H)) &&  !(defined(MTOS)&&defined(__GNUC__)&&defined(_MATH_H)) /* FF's math.h has the type already */
                    419: struct cmplx {
                    420:        double real, imag;
                    421: };
                    422: #endif
                    423:
                    424:
                    425: struct value {
                    426:        enum DATA_TYPES type;
                    427:        union {
                    428:                int int_val;
                    429:                struct cmplx cmplx_val;
                    430:        } v;
                    431: };
                    432:
                    433:
                    434: struct lexical_unit {  /* produced by scanner */
                    435:        TBOOLEAN is_token;      /* true if token, false if a value */
                    436:        struct value l_val;
                    437:        int start_index;        /* index of first char in token */
                    438:        int length;                     /* length of token in chars */
                    439: };
                    440:
                    441:
                    442: struct udft_entry {                            /* user-defined function table entry */
                    443:        struct udft_entry *next_udf;            /* pointer to next udf in linked list */
                    444:        char udf_name[MAX_ID_LEN+1];            /* name of this function entry */
                    445:        struct at_type *at;                     /* pointer to action table to execute */
                    446:        char *definition;                       /* definition of function as typed */
                    447:        struct value dummy_values[MAX_NUM_VAR]; /* current value of dummy variables */
                    448: };
                    449:
                    450:
                    451: struct udvt_entry {                    /* user-defined value table entry */
                    452:        struct udvt_entry *next_udv; /* pointer to next value in linked list */
                    453:        char udv_name[MAX_ID_LEN+1]; /* name of this value entry */
                    454:        TBOOLEAN udv_undef;             /* true if not defined yet */
                    455:        struct value udv_value; /* value it has */
                    456: };
                    457:
                    458:
                    459: union argument {                       /* p-code argument */
                    460:        int j_arg;                              /* offset for jump */
                    461:        struct value v_arg;             /* constant value */
                    462:        struct udvt_entry *udv_arg;     /* pointer to dummy variable */
                    463:        struct udft_entry *udf_arg; /* pointer to udf to execute */
                    464: };
                    465:
                    466:
                    467: struct at_entry {                      /* action table entry */
                    468:        enum operators index;   /* index of p-code function */
                    469:        union argument arg;
                    470: };
                    471:
                    472:
                    473: struct at_type {
                    474:        int a_count;                            /* count of entries in .actions[] */
                    475:        struct at_entry actions[MAX_AT_LEN];
                    476:                /* will usually be less than MAX_AT_LEN is malloc()'d copy */
                    477: };
                    478:
                    479:
                    480: /* This type definition has to come after union argument has been declared. */
                    481: #ifdef __ZTC__
                    482: typedef int (*FUNC_PTR)(...);
                    483: #else
                    484: typedef int (*FUNC_PTR) __PROTO((union argument *arg));
                    485: #endif
                    486:
                    487: struct ft_entry {              /* standard/internal function table entry */
                    488:        char *f_name;           /* pointer to name of this function */
                    489:        FUNC_PTR func;          /* address of function to call */
                    490: };
                    491:
                    492:
                    493: /* Defines the type of a coordinate */
                    494: /* INRANGE and OUTRANGE points have an x,y point associated with them */
                    495: enum coord_type {
                    496:     INRANGE,                           /* inside plot boundary */
                    497:     OUTRANGE,                          /* outside plot boundary, but defined */
                    498:     UNDEFINED                          /* not defined at all */
                    499: };
                    500:
                    501:
                    502: struct coordinate {
                    503:        enum coord_type type;   /* see above */
                    504:        coordval x, y, z;
                    505:        coordval ylow, yhigh;   /* ignored in 3d */
                    506:         coordval xlow, xhigh;   /* also ignored in 3d */
                    507: #if defined(WIN16) || (defined(MSDOS) && defined(__TURBOC__))
                    508:        char pad[2];            /* pad to 32 byte boundary */
                    509: #endif
                    510: };
                    511:
                    512: struct lp_style_type {          /* contains all Line and Point properties */
                    513:         int     pointflag;      /* 0 if points not used, otherwise 1 */
                    514:         int     l_type,
                    515:                 p_type;
                    516:         double  l_width,
                    517:                 p_size;
                    518:                                 /* more to come ? */
                    519: };
                    520:
                    521: /* Now unused; replaced with set.c(reset_lp_properties) */
                    522: /* default values for the structure 'lp_style_type' */
                    523: /* #define LP_DEFAULT {0,0,0,1.0,1.0} */
                    524:
                    525:
                    526: struct curve_points {
                    527:        struct curve_points *next_cp;   /* pointer to next plot in linked list */
                    528:        int token;    /* last token in re/plot line, for second pass */
                    529:        enum PLOT_TYPE plot_type;
                    530:        enum PLOT_STYLE plot_style;
                    531:        enum PLOT_SMOOTH plot_smooth;
                    532:        char *title;
                    533:         struct lp_style_type lp_properties;
                    534:        int p_max;                                      /* how many points are allocated */
                    535:        int p_count;                                    /* count of points in points */
                    536:        int x_axis;                                     /* FIRST_X_AXIS or SECOND_X_AXIS */
                    537:        int y_axis;                                     /* FIRST_Y_AXIS or SECOND_Y_AXIS */
                    538:        struct coordinate GPHUGE *points;
                    539: };
                    540:
                    541: struct gnuplot_contours {
                    542:        struct gnuplot_contours *next;
                    543:        struct coordinate GPHUGE *coords;
                    544:        char isNewLevel;
                    545:        char label[32];
                    546:        int num_pts;
                    547: };
                    548:
                    549: struct iso_curve {
                    550:        struct iso_curve *next;
                    551:        int p_max;                                      /* how many points are allocated */
                    552:        int p_count;                                    /* count of points in points */
                    553:        struct coordinate GPHUGE *points;
                    554: };
                    555:
                    556: struct surface_points {
                    557:        struct surface_points *next_sp; /* pointer to next plot in linked list */
                    558:        int token;  /* last token in re/plot line, for second pass */
                    559:        enum PLOT_TYPE plot_type;
                    560:        enum PLOT_STYLE plot_style;
                    561:        char *title;
                    562:         struct lp_style_type lp_properties;
                    563:        int has_grid_topology;
                    564:        int num_iso_read;  /* Data files only - num of isolines read from file. */
                    565:        /* for functions, num_iso_read is the number of 'primary' isolines (in x dirn) */
                    566:        struct gnuplot_contours *contours;      /* Not NULL If have contours. */
                    567:        struct iso_curve *iso_crvs;
                    568: };
                    569:
                    570: /* It should go without saying that additional entries may be made
                    571:  * only at the end of this structure. Any fields added must be
                    572:  * optional - a value of 0 (or NULL pointer) means an older driver
                    573:  * does not support that feature - gnuplot must still be able to
                    574:  * function without that terminal feature
                    575:  */
                    576:
                    577: /* values for the optional flags field - choose sensible defaults
                    578:  * these aren't really very sensible names - multiplot attributes
                    579:  * depend on whether stdout is redirected or not. Remember that
                    580:  * the default is 0. Thus most drivers can do multiplot only if
                    581:  * the output is redirected
                    582:  */
                    583:
                    584: #define TERM_CAN_MULTIPLOT    1  /* tested if stdout not redirected */
                    585: #define TERM_CANNOT_MULTIPLOT 2  /* tested if stdout is redirected  */
                    586: #define TERM_BINARY           4  /* open output file with "b"       */
                    587:
                    588: struct TERMENTRY {
                    589:        char *name;
                    590: #ifdef WIN16
                    591:        char GPFAR description[80];     /* to make text go in FAR segment */
                    592: #else
                    593:        char *description;
                    594: #endif
                    595:        unsigned int xmax,ymax,v_char,h_char,v_tic,h_tic;
                    596:
                    597:        void (*options) __PROTO((void));
                    598:        void (*init) __PROTO((void));
                    599:        void (*reset) __PROTO((void));
                    600:        void (*text) __PROTO((void));
                    601:        int (*scale) __PROTO((double, double));
                    602:        void (*graphics) __PROTO((void));
                    603:        void (*move) __PROTO((unsigned int, unsigned int));
                    604:        void (*vector) __PROTO((unsigned int, unsigned int));
                    605:        void (*linetype) __PROTO((int));
                    606:        void (*put_text) __PROTO((unsigned int, unsigned int,char*));
                    607: /* the following are optional. set term ensures they are not NULL */
                    608:        int (*text_angle) __PROTO((int));
                    609:        int (*justify_text) __PROTO((enum JUSTIFY));
                    610:        void (*point) __PROTO((unsigned int, unsigned int,int));
                    611:        void (*arrow) __PROTO((unsigned int, unsigned int, unsigned int, unsigned int, int));
                    612:        int (*set_font) __PROTO((char *font));
                    613:        void (*pointsize) __PROTO((double)); /* change pointsize */
                    614:        int flags;
                    615:        void (*suspend) __PROTO((void)); /* called after one plot of multiplot */
                    616:        void (*resume)  __PROTO((void)); /* called before plots of multiplot */
                    617:        void (*fillbox) __PROTO((int, unsigned int, unsigned int, unsigned int, unsigned int)); /* clear in multiplot mode */
                    618:    void (*linewidth) __PROTO((double linewidth));
                    619: };
                    620:
                    621: #ifdef WIN16
                    622: # define termentry TERMENTRY far
                    623: #else
                    624: # define termentry TERMENTRY
                    625: #endif
                    626:
                    627:
                    628: /* we might specify a co-ordinate in first/second/graph/screen coords */
                    629: /* allow x,y and z to be in separate co-ordinates ! */
                    630: enum position_type { first_axes, second_axes, graph, screen };
                    631:
                    632: struct position {
                    633:        enum position_type scalex,scaley,scalez;
                    634:        double x,y,z;
                    635: };
                    636:
                    637: struct text_label {
                    638:        struct text_label *next;        /* pointer to next label in linked list */
                    639:        int tag;                        /* identifies the label */
                    640:        struct position place;
                    641:        enum JUSTIFY pos;
                    642:         int rotate;
                    643:        char text[MAX_LINE_LEN+1];
                    644:         char font[MAX_LINE_LEN+1];
                    645: }; /* Entry font added by DJL */
                    646:
                    647: struct arrow_def {
                    648:        struct arrow_def *next; /* pointer to next arrow in linked list */
                    649:        int tag;                        /* identifies the arrow */
                    650:        struct position start;
                    651:        struct position end;
                    652:        TBOOLEAN head;                  /* arrow has a head or not */
                    653:         struct lp_style_type lp_properties;
                    654: };
                    655:
                    656: struct linestyle_def {
                    657:        struct linestyle_def *next;     /* pointer to next linestyle in linked list */
                    658:        int tag;                        /* identifies the linestyle */
                    659:         struct lp_style_type lp_properties;
                    660: };
                    661:
                    662: /* Tic-mark labelling definition; see set xtics */
                    663: struct ticdef {
                    664:     int type;                          /* one of three values below */
                    665: #define TIC_COMPUTED 1         /* default; gnuplot figures them */
                    666: #define TIC_SERIES 2           /* user-defined series */
                    667: #define TIC_USER 3                     /* user-defined points */
                    668: #define TIC_MONTH 4            /* print out month names ((mo-1[B)%12)+1 */
                    669: #define TIC_DAY 5              /* print out day of week */
                    670:     union {
                    671:           struct {                     /* for TIC_SERIES */
                    672:                  double start, incr;
                    673:                  double end;           /* ymax, if VERYLARGE */
                    674:           } series;
                    675:           struct ticmark *user;        /* for TIC_USER */
                    676:     } def;
                    677: };
                    678:
                    679: /* Defines one ticmark for TIC_USER style.
                    680:  * If label==NULL, the value is printed with the usual format string.
                    681:  * else, it is used as the format string (note that it may be a constant
                    682:  * string, like "high" or "low").
                    683:  */
                    684: struct ticmark {
                    685:     double position;           /* where on axis is this */
                    686:     char *label;                       /* optional (format) string label */
                    687:     struct ticmark *next;      /* linked list */
                    688: };
                    689:
                    690: /*
                    691:  * SS$_NORMAL is "normal completion", STS$M_INHIB_MSG supresses
                    692:
                    693:  * printing a status message.
                    694:  * SS$_ABORT is the general abort status code.
                    695:  from: Martin Minow
                    696:        decvax!minow
                    697:  */
                    698: #ifdef VMS
                    699: # include              <ssdef.h>
                    700: # include              <stsdef.h>
                    701: # define       IO_SUCCESS      (SS$_NORMAL | STS$M_INHIB_MSG)
                    702: # define       IO_ERROR        SS$_ABORT
                    703: #endif /* VMS */
                    704:
                    705:
                    706: #ifndef        IO_SUCCESS      /* DECUS or VMS C will have defined these already */
                    707: # define       IO_SUCCESS      0
                    708: #endif
                    709:
                    710: #ifndef        IO_ERROR
                    711: # define       IO_ERROR        1
                    712: #endif
                    713:
                    714: /* Some key global variables */
                    715: extern TBOOLEAN screen_ok;             /* from util.c */
                    716: extern struct termentry *term;/* from term.c */
                    717: extern TBOOLEAN undefined;             /* from internal.c */
                    718: extern char *input_line;               /* from command.c */
                    719: extern int input_line_len;
                    720: extern char *replot_line;
                    721: extern struct lexical_unit *token;
                    722: extern int token_table_size;
                    723: extern int num_tokens, c_token;
                    724: extern int inline_num;
                    725: extern char c_dummy_var[MAX_NUM_VAR][MAX_ID_LEN+1];
                    726: extern struct ft_entry GPFAR ft[];     /* from plot.c */
                    727: extern struct udft_entry *first_udf;
                    728: extern struct udvt_entry *first_udv;
                    729: extern TBOOLEAN interactive;
                    730: extern char *infile_name;
                    731: extern struct udft_entry *dummy_func;
                    732: extern char dummy_var[MAX_NUM_VAR][MAX_ID_LEN+1];      /* from setshow.c */
1.1.1.3 ! ohara     733:
        !           734: /* From version.c */
        !           735: extern char gnuplot_version[];
        !           736: extern char gnuplot_patchlevel[];
        !           737: extern char gnuplot_date[];
        !           738: extern char gnuplot_copyright[];
        !           739: extern char faq_location[];
        !           740: extern char bug_email[];
        !           741: extern char help_email[];
        !           742: extern char os_name[];
        !           743: extern char os_rel[];
1.1       maekawa   744:
                    745: /* Windows needs to redefine stdin/stdout functions */
1.1.1.2   maekawa   746: #if defined(_Windows) && !defined(WINDOWS_NO_GUI)
1.1       maekawa   747: # include "win/wtext.h"
                    748: #endif
                    749:
                    750: #define TTOP 0
                    751: #define TBOTTOM 1
                    752: #define TUNDER 2
                    753: #define TLEFT 0
                    754: #define TRIGHT 1
                    755: #define TOUT 2
                    756: #define JLEFT 0
                    757: #define JRIGHT 1
                    758:
                    759: /* defines used for timeseries, seconds */
                    760: #define ZERO_YEAR      2000
                    761: #define JAN_FIRST_WDAY 6  /* 1st jan, 2000 is a Saturday (cal 1 2000 on unix) */
                    762: #define SEC_OFFS_SYS   946684800.0             /*  zero gnuplot (2000) - zero system (1970) */
                    763: #define YEAR_SEC       31557600.0      /* avg, incl. leap year */
                    764: #define MON_SEC                2629800.0       /* YEAR_SEC / 12 */
                    765: #define WEEK_SEC       604800.0
                    766: #define DAY_SEC                86400.0
                    767:
                    768: /* returns from DF_READLINE in datafile.c */
                    769: /* +ve is number of columns read */
                    770: #define DF_EOF          (-1)
                    771: #define DF_UNDEFINED    (-2)
                    772: #define DF_FIRST_BLANK  (-3)
                    773: #define DF_SECOND_BLANK (-4)
                    774:
                    775: /* HBB: changed to __inline__, which seems more usually
                    776:  * understood by tools like, e.g., lclint */
                    777: /* if GP_INLINE has not yet been defined, set to __inline__ for gcc,
                    778:  * nothing. I'd prefer that any other compilers have the defn in
                    779:  * the makefile, rather than having a huge list of compilers here.
                    780:  * But gcc is sufficiently ubiquitous that I'll allow it here !!!
                    781:  */
                    782: #ifndef GP_INLINE
                    783: # ifdef __GNUC__
                    784: #  define GP_INLINE __inline__
                    785: # else
                    786: #  define GP_INLINE /*nothing*/
                    787: # endif
                    788: #endif
                    789:
                    790: #include "protos.h"
                    791:
                    792:
                    793: /* line/point parsing...
                    794:  *
                    795:  * allow_ls controls whether we are allowed to accept linestyle in
                    796:  * the current context [ie not when doing a  set linestyle command]
                    797:  * allow_point is whether we accept a point command
                    798:  * We assume compiler will optimise away if(0) or if(1)
                    799:  */
                    800: #if defined(__FILE__) && defined(__LINE__) && defined(DEBUG_LP)
                    801: # define LP_DUMP(lp) \
                    802:  fprintf(stderr, \
                    803:   "lp_properties at %s:%d : lt: %d, lw: %.3f, pt: %d, ps: %.3f\n", \
                    804:   __FILE__, __LINE__, lp.l_type, lp.l_width, lp.p_type, lp.p_size)
                    805: #else
                    806: # define LP_DUMP(lp)
                    807: #endif
                    808:
                    809: #define LP_PARSE(lp, allow_ls, allow_point, def_line, def_point) \
                    810: if (allow_ls && (almost_equals(c_token, "lines$tyle") || equals(c_token, "ls" ))) { \
                    811:  struct value t; ++c_token; \
                    812:  lp_use_properties(&(lp), (int) real(const_express(&t)), allow_point); \
                    813: } else { \
                    814:        if (almost_equals(c_token, "linet$ype") || equals(c_token, "lt" )) { \
                    815:                struct value t; ++c_token; \
                    816:       lp.l_type = (int) real(const_express(&t))-1; \
                    817:    } else lp.l_type = def_line; \
                    818:        if (almost_equals(c_token, "linew$idth") || equals(c_token, "lw" )) { \
                    819:                struct value t; ++c_token; \
                    820:       lp.l_width = real(const_express(&t)); \
                    821:    } else lp.l_width = 1.0; \
                    822:    if ( (lp.pointflag = allow_point) != 0) { \
                    823:           if (almost_equals(c_token, "pointt$ype") || equals(c_token, "pt" )) { \
                    824:                   struct value t; ++c_token; \
                    825:          lp.p_type = (int) real(const_express(&t))-1; \
                    826:       } else lp.p_type = def_point; \
                    827:           if (almost_equals(c_token, "points$ize") || equals(c_token, "ps" )) { \
                    828:                   struct value t; ++c_token; \
                    829:          lp.p_size = real(const_express(&t)); \
                    830:       } else lp.p_size = pointsize; /* as in "set pointsize" */ \
                    831:    } else lp.p_size = pointsize; /* give it a value */ \
                    832:    LP_DUMP(lp); \
                    833: }
                    834:
                    835:
                    836:
                    837: #endif /* not PLOT_H */

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