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

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