Annotation of researchv9/cmd/pic/pic.h, revision 1.1

1.1     ! root        1: #ifndef PI
        !             2: #define PI 3.1415926535897932384626433832795028841971693993751
        !             3: #endif
        !             4: 
        !             5: #define        MAXWID  8.5     /* default limits max picture to 8.5 x 11; */
        !             6: #define        MAXHT   11      /* change to taste without peril */
        !             7: 
        !             8: #define        dprintf if(dbg)printf
        !             9: 
        !            10: #define        DEFAULT 0
        !            11: 
        !            12: #define        HEAD1   1
        !            13: #define        HEAD2   2
        !            14: #define        HEAD12  (HEAD1+HEAD2)
        !            15: #define        INVIS   4
        !            16: #define        CW_ARC  8       /* clockwise arc */
        !            17: #define        DOTBIT  16
        !            18: #define        DASHBIT 32
        !            19: 
        !            20: #define        CENTER  01      /* text attributes */
        !            21: #define        LJUST   02
        !            22: #define        RJUST   04
        !            23: #define        ABOVE   010
        !            24: #define        BELOW   020
        !            25: #define        SPREAD  040
        !            26: #define        FILL    0100
        !            27: 
        !            28: #define        SCALE   1.0     /* default scale: units/inch */
        !            29: #define        WID     0.75    /* default width for boxes and ellipses */
        !            30: #define        WID2    0.375
        !            31: #define        HT      0.5     /* default height and line length */
        !            32: #define        HT2     0.25    /* because no floating init exprs! */
        !            33: #define        HT5     0.1
        !            34: #define        HT10    0.05
        !            35: 
        !            36: /* these have to be like so, so that we can write */
        !            37: /* things like R & V, etc. */
        !            38: #define        H       0
        !            39: #define        V       1
        !            40: #define        R_DIR   0
        !            41: #define        U_DIR   1
        !            42: #define        L_DIR   2
        !            43: #define        D_DIR   3
        !            44: #define        ishor(n)        (((n) & V) == 0)
        !            45: #define        isvert(n)       (((n) & V) != 0)
        !            46: #define        isright(n)      ((n) == R_DIR)
        !            47: #define        isleft(n)       ((n) == L_DIR)
        !            48: #define        isdown(n)       ((n) == D_DIR)
        !            49: #define        isup(n)         ((n) == U_DIR)
        !            50: 
        !            51: typedef struct Point {
        !            52:        float   x;
        !            53:        float   y;
        !            54: };
        !            55: 
        !            56: typedef struct obj {   /* stores various things in variable length */
        !            57:        int     o_type;
        !            58:        int     o_count;        /* number of things */
        !            59:        int     o_nobj;         /* index in objlist */
        !            60:        int     o_mode;         /* hor or vert */
        !            61:        float   o_x;            /* coord of "center" */
        !            62:        float   o_y;
        !            63:        int     o_nt1;          /* 1st index in text[] for this object */
        !            64:        int     o_nt2;          /* 2nd; difference is #text strings */
        !            65:        int     o_attr;         /* HEAD, CW, INVIS go here */
        !            66:        int     o_size;         /* linesize */
        !            67:        int     o_nhead;        /* arrowhead style */
        !            68:        struct symtab *o_symtab; /* symtab for [...] */
        !            69:        float   o_ddval;        /* value of dot/dash expression */
        !            70:        float   o_val[1];       /* actually this will be > 1 in general */
        !            71:                                /* type is not always FLOAT!!!! */
        !            72: } obj;
        !            73: 
        !            74: typedef union {                /* the yacc stack type */
        !            75:        int     i;
        !            76:        char    *p;
        !            77:        obj     *o;
        !            78:        float   f;
        !            79: } YYSTYPE;
        !            80: 
        !            81: extern YYSTYPE yylval, yyval;
        !            82: 
        !            83: struct symtab {
        !            84:        char    *s_name;
        !            85:        int     s_type;
        !            86:        YYSTYPE s_val;
        !            87:        struct symtab *s_next;
        !            88: };
        !            89: 
        !            90: typedef struct {       /* attribute of an object */
        !            91:        int     a_type;
        !            92:        int     a_sub;
        !            93:        YYSTYPE a_val;
        !            94: } Attr;
        !            95: 
        !            96: typedef struct {
        !            97:        int     t_type;         /* CENTER, LJUST, etc. */
        !            98:        char    t_op;           /* optional sign for size changes */
        !            99:        char    t_size;         /* size, abs or rel */
        !           100:        char    *t_val;
        !           101: } Text;
        !           102: 
        !           103: #define        String  01
        !           104: #define        Macro   02
        !           105: #define        File    04
        !           106: #define        Char    010
        !           107: #define        Thru    020
        !           108: #define        Free    040
        !           109: 
        !           110: typedef struct {       /* input source */
        !           111:        int     type;   /* Macro, String, File */
        !           112:        char    *sp;    /* if String or Macro */
        !           113: } Src;
        !           114: 
        !           115: extern Src     src[], *srcp;   /* input source stack */
        !           116: 
        !           117: typedef struct {
        !           118:        FILE    *fin;
        !           119:        char    *fname;
        !           120:        int     lineno;
        !           121: } Infile;
        !           122: 
        !           123: extern Infile  infile[], *curfile;
        !           124: 
        !           125: #define        MAXARGS 20
        !           126: typedef struct {       /* argument stack */
        !           127:        char    *argstk[MAXARGS];       /* pointers to args */
        !           128:        char    *argval;        /* points to space containing args */
        !           129: } Arg;
        !           130: 
        !           131: extern int     dbg;
        !           132: extern obj     **objlist;
        !           133: extern int     nobj, nobjlist;
        !           134: extern Attr    *attr;
        !           135: extern int     nattr, nattrlist;
        !           136: extern Text    *text;
        !           137: extern int     ntextlist;
        !           138: extern int     ntext;
        !           139: extern int     ntext1;
        !           140: extern float   curx, cury;
        !           141: extern int     hvmode;
        !           142: extern int     codegen;
        !           143: extern int     PEseen;
        !           144: extern char    *malloc(), *realloc(), *tostring(), *grow();
        !           145: extern double  getfval(), getcomp(), getblkvar();
        !           146: extern YYSTYPE getvar();
        !           147: extern struct  symtab *lookup(), *makevar();
        !           148: extern char    *ifstat(), *delimstr(), *sprintgen();
        !           149: 
        !           150: extern float   deltx, delty;
        !           151: extern int     lineno;
        !           152: extern int     synerr;
        !           153: 
        !           154: extern float   xmin, ymin, xmax, ymax;
        !           155: extern obj     *leftthing(), *boxgen(), *circgen(), *arcgen();
        !           156: extern obj     *linegen(), *splinegen(), *movegen(), *textgen(), *plotgen();
        !           157: extern obj     *troffgen(), *rightthing(), *blockgen();
        !           158: extern obj     *makenode(), *makepos(), *fixpos(), *addpos(), *subpos(), *makebetween();
        !           159: extern obj     *getpos(), *gethere(), *getfirst(), *getlast(), *getblock();
        !           160: 
        !           161: struct pushstack {
        !           162:        float   p_x;
        !           163:        float   p_y;
        !           164:        int     p_hvmode;
        !           165:        float   p_xmin;
        !           166:        float   p_ymin;
        !           167:        float   p_xmax;
        !           168:        float   p_ymax;
        !           169:        struct symtab *p_symtab;
        !           170: };
        !           171: extern struct pushstack stack[];
        !           172: extern int     nstack;
        !           173: extern int     cw;
        !           174: 
        !           175: extern double  errcheck();
        !           176: #define        Log10(x) errcheck(log10(x), "log")
        !           177: #define        Exp(x)  errcheck(exp(x), "exp")
        !           178: #define        Sqrt(x) errcheck(sqrt(x), "sqrt")

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.