Annotation of researchv10no/cmd/picasso/picasso.h, revision 1.1

1.1     ! root        1: /*     Copyright (c) 1984 AT&T */
        !             2: /*       All Rights Reserved   */
        !             3: 
        !             4: /*     THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T     */
        !             5: /*     The copyright notice above does not evidence any        */
        !             6: /*     actual or intended publication of such source code.     */
        !             7: 
        !             8: /*     @(#)picasso:picasso.h   1.0     */
        !             9: 
        !            10: #include <stdio.h>
        !            11: #include <math.h>
        !            12: /* Research hack */
        !            13: #define M_PI PI
        !            14: #define M_PI_2 PI/2.0
        !            15: #define M_1_PI 1.0/PI
        !            16: #define M_SQRT2 1.41421
        !            17: #define M_SQRT1_2 .7071085
        !            18: /* End of Research hack */
        !            19: 
        !            20: #define        DEFAULT 0
        !            21: #define        MINRAD  3/pgscale       /* slop for box corners, ellipse major/minor */
        !            22:                                /* (should probably be a predefined variable)*/
        !            23: #define        HEAD1     1
        !            24: #define        HEAD2     2
        !            25: #define        HEAD12  (HEAD1+HEAD2)
        !            26: #define        HEADFILL  4
        !            27: #define        CW_ARC    8                     /* clockwise arc */
        !            28: #define        DOTBIT   16
        !            29: #define        DASHBIT  32
        !            30: #define        DOTDASH (DOTBIT+DASHBIT)        /* i.e., PostScript dash pattern */
        !            31:                                        /* (implementation not yet done) */ 
        !            32: #define        EDGED    64
        !            33: #define        FILLED  128
        !            34: #define        LINECAP 256
        !            35: #define        JOIN    1024
        !            36: #define        MITER   4096
        !            37: 
        !            38: #define        CENTER   1                      /* text types */
        !            39: #define        LJUST    2
        !            40: #define        RJUST    4
        !            41: #define        ABOVE    8
        !            42: #define        BELOW   16
        !            43: #define        EQNTXT  32
        !            44: 
        !            45: #define        GSCALE  1.0     /* default global scale: units/inch */
        !            46: #define        WID     0.75    /* default width for boxes and ellipses */
        !            47: #define        WID2    0.375
        !            48: #define        HT      0.5     /* default height and line length */
        !            49: #define        HT2     0.25    /* because no floating init exprs! */
        !            50: #define        HT5     0.1
        !            51: #define        HT10    0.05
        !            52: 
        !            53: /* these have to be like so, so that we can write */
        !            54: /* things like R & V, etc. */
        !            55: #define        H       0
        !            56: #define        V       1
        !            57: #define        R_DIR   0
        !            58: #define        U_DIR   1
        !            59: #define        L_DIR   2
        !            60: #define        D_DIR   3
        !            61: #define        ishor(n)        (((n) & V) == 0)
        !            62: #define        isvert(n)       (((n) & V) != 0)
        !            63: #define        isright(n)      ((n) == R_DIR)
        !            64: #define        isleft(n)       ((n) == L_DIR)
        !            65: #define        isdown(n)       ((n) == D_DIR)
        !            66: #define        isup(n)         ((n) == U_DIR)
        !            67: 
        !            68: typedef union {
        !            69:        long            i;
        !            70:        float           f;
        !            71:        float           *a;     /* array of values; dimension kept in symtab */
        !            72:        char            *p;
        !            73:        struct  obj     *o;
        !            74:        struct  symtab  *s;
        !            75: } valtype;
        !            76: 
        !            77: typedef struct obj {   /* stores various things in variable length */
        !            78:        struct   obj    *o_next;        /* forward link in object list      */
        !            79:        struct   obj    *o_prev;        /* back link                        */
        !            80:        struct   obj    *o_parent;      /* parent block or place reference  */
        !            81:        short           o_layer;        /* "draft" layers are < 0           */ 
        !            82:        unsigned short  o_size;
        !            83:        unsigned short  o_type;
        !            84:        unsigned short  o_nt1;          /* 1st index in text[] for object   */
        !            85:        unsigned short  o_nt2;          /* 2nd; difference is #text strings */
        !            86:        float           o_x;            /* coordinates of object's "center" */
        !            87:        float           o_y;
        !            88:        float           o_text;         /* color attribute for any labels   */
        !            89:        valtype         o_val[1];       /* actually, > 1 in general         */
        !            90: } obj;
        !            91: 
        !            92: #define    N_VAL       14              /* base o_val size [xform, attrs]   */
        !            93: #define           o_xform      o_val
        !            94: #define    o_mxx       o_val[ 0].f
        !            95: #define    o_myx       o_val[ 1].f
        !            96: #define    o_mxy       o_val[ 2].f
        !            97: #define    o_myy       o_val[ 3].f
        !            98: #define    o_mxt       o_val[ 4].f
        !            99: #define    o_myt       o_val[ 5].f
        !           100: #define    o_wid       o_val[ 7].f
        !           101: #define    o_ht                o_val[ 8].f
        !           102: #define    o_attr      o_val[ 9].i     /* attribute flags and counts here. */
        !           103: #define    o_ddpat     o_val[10]
        !           104: #define    o_weight    o_val[11].f
        !           105: #define    o_color     o_val[12].f
        !           106: #define    o_fill      o_val[13].f
        !           107: 
        !           108: struct objattr {                       /* common attributes of objects */
        !           109:                short   a_flags;
        !           110:                short   a_layer;
        !           111:                float   a_ht;
        !           112:                double  a_wid;
        !           113:                double  a_rad;
        !           114:                double  a_weight;
        !           115:                double  a_lcolor;
        !           116:                double  a_pcolor;
        !           117:                double  a_tcolor;
        !           118:                valtype a_dashpat;
        !           119: };
        !           120: 
        !           121: typedef        valtype YYSTYPE;                        /* the yacc stack type  */
        !           122: 
        !           123: extern YYSTYPE yylval, yyval;
        !           124: 
        !           125: struct symtab {
        !           126:        char            *s_name;
        !           127:        unsigned short  s_type;
        !           128:        unsigned short  s_dim;          /* actually, dim-1; i.e. max index */
        !           129:        valtype         s_val;
        !           130:        struct  symtab  *s_next;
        !           131: };
        !           132: 
        !           133: typedef struct {       /* attribute of an object */
        !           134:        int     a_type;
        !           135:        int     a_sub;
        !           136:        valtype a_val;
        !           137: } Attr;
        !           138: 
        !           139: typedef struct {
        !           140:        short   t_type;         /* CENTER, LJUST, etc. */
        !           141:        short   t_font;
        !           142:        short   t_size;
        !           143:        short   t_space;
        !           144:        short   t_line;
        !           145:        float   t_width;
        !           146:        char    *t_val;
        !           147: } Text;
        !           148: 
        !           149: typedef        struct {
        !           150:        float   r;
        !           151:        float   g;
        !           152:        float   b;
        !           153: } rgb;
        !           154: 
        !           155: #define        pString 01
        !           156: #define        Macro   02
        !           157: #define        File    04
        !           158: #define        Char    010
        !           159: #define        Thru    020
        !           160: #define        Free    040
        !           161: 
        !           162: typedef struct {       /* input source */
        !           163:        int     type;   /* Macro, pString, File */
        !           164:        char    *sp;    /* if pString or Macro */
        !           165: } Src;
        !           166: 
        !           167: extern Src     src[], *srcp;   /* input source stack */
        !           168: 
        !           169: typedef struct {
        !           170:        FILE    *fin;
        !           171:        char    *fname;
        !           172:        int     lineno;
        !           173: } Infile;
        !           174: 
        !           175: extern Infile  infile[], *curfile;
        !           176: 
        !           177: #define        MAXARGS 20
        !           178: typedef struct {       /* argument stack */
        !           179:        char    *argstk[MAXARGS];       /* pointers to args */
        !           180:        char    *argval;        /* points to space containing args */
        !           181: } pArg;
        !           182: 
        !           183: extern obj     *objhead, *objtail, *cur_block;;
        !           184: extern Attr    *attr;
        !           185: extern int     nattr, nattrlist;
        !           186: extern Text    *text;
        !           187: extern int     ntextlist;
        !           188: extern int     ntext, ntext1, ntextlines;
        !           189: extern float   *exprlist;
        !           190: extern int     nexpr;
        !           191: extern int     nexprlist;
        !           192: extern rgb     *rgbtable;
        !           193: extern int     nrgbtable;
        !           194: extern int     nrgb;
        !           195: extern float   curx, cury;
        !           196: extern valtype cur_xform[6];
        !           197: extern int     xdelta[8], ydelta[8];
        !           198: extern int     hvmode;
        !           199: extern int     codegen;
        !           200: extern int     PEseen;
        !           201: extern int     pass_thru;
        !           202: extern int     verbose;
        !           203: extern int     batch;
        !           204: extern char    *cmdname;
        !           205: extern char    *troffname[];
        !           206: extern float   Gbox[4];
        !           207: extern double  pgscale;
        !           208: 
        !           209: extern char    *malloc(), *calloc(), *realloc(), *tostring(), *grow();
        !           210: extern double  getsub(), getfval(), getcomp(), getblkvar();
        !           211: extern struct  symtab *lookup(), *findvar(), *makevar(), *newvar();
        !           212: extern char    *ifstat(), *delimstr(), *sprintgen();
        !           213: extern YYSTYPE getvar();
        !           214: 
        !           215: extern double  Xformx(), Xformy();
        !           216: extern double  Linx(),   Liny();
        !           217: 
        !           218: extern int     nosqueeze;
        !           219: extern int     objbuf, objcount;
        !           220: extern int     lineno;
        !           221: extern int     synerr;
        !           222: extern int     redo_gbox;
        !           223: 
        !           224: extern obj     *leftthing(), *boxgen(), *circgen(), *arcgen();
        !           225: extern obj     *linegen(), *splinegen(), *movegen(), *textgen(), *plotgen(), *picgen();
        !           226: extern obj     *troffgen(), *rightthing(), *blockgen();
        !           227: extern obj     *makenode(), *makepos(), *fixpos(), *addpos(), *subpos();
        !           228: extern obj     *makebetween();
        !           229: extern obj     *getpos(), *gethere(), *getnth();
        !           230: extern obj     *getfirst(), *getlast(), *getblock();
        !           231: extern obj     *copypos(), *copyobj();
        !           232: 
        !           233: struct pushstack {
        !           234:        float   p_x;
        !           235:        float   p_y;
        !           236:        int     p_hvmode;
        !           237:        float   p_xmin;
        !           238:        float   p_ymin;
        !           239:        float   p_xmax;
        !           240:        float   p_ymax;
        !           241:        struct  symtab  *p_symtab;
        !           242: };
        !           243: extern struct  pushstack stack[];
        !           244: extern int     nstack;
        !           245: extern int     cw;
        !           246: extern int     draftlayer;
        !           247: extern int     top_layer;
        !           248: 
        !           249: extern double  errcheck();
        !           250: 
        !           251: extern double  Log();
        !           252: extern double  Log10();
        !           253: extern double  Exp();
        !           254: extern double  Pow();
        !           255: extern double  Sqrt();
        !           256: extern double  Cos();
        !           257: extern double  Sin();
        !           258: extern double  Atan2();
        !           259: extern double  Maxvar ();
        !           260: extern double  Maxlist();
        !           261: extern double  Minvar ();
        !           262: extern double  Minlist();
        !           263: 
        !           264: extern double  setvar();
        !           265: extern double  setsize();
        !           266: extern double  setattr();
        !           267: extern double  setfont();
        !           268: extern double  setarray();
        !           269: extern double  setrgbindex();
        !           270: extern double  checkcolor();
        !           271: extern double  checkfont();
        !           272: extern double  getstringwidth();
        !           273: extern double  find_axes();
        !           274: extern double  *text_bounds();
        !           275: extern char    *parse_text();
        !           276: extern obj     *print_obj();
        !           277: extern obj     *print_xform();

unix.superglobalmegacorp.com

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