#define MAXSTACK 499
#define MAXDICT 500
#define MAXSTRING 65535

#define RB 3

#define LNTEN 2.30258509

#define ESCAPE 6
#define DISABLE 1

#define TRANSLATE 0
#define SCALE 1
#define ROTATE 2

#define EMPTY 0
#define NUMBER 1
#define ARRAY 2
#define DICTIONARY 3
#define STRING 4
#define NAME 5
#define BOOLEAN 6
#define PROCEDURE 7
#define MARK 8
#define FILETYPE 9
#define PMARK 10
#define OPERATOR 11
#define TPROC 12
#define SPECNAME 13
#define SPECDICT 14

#define DRAW 5
#define MOVE 4
#define CURVE 7
#define CLOSE 1

#define CLOSED 0
#define READ 1
#define FCLOSE 2
#define STDINP 3
#define STDOUT 4
#define WRITE 5

struct buftype {
        int load_address;
        int execution_address;
        int length;
        int attributes;
        int tp;
        char name[100];
        };

struct etr {
        int y2;
        double x1;
        double dx;
        int up;
        struct etr *next;
        };

struct strdef {
       int len;
       char *string;
       };

struct phile {
        FILE *f;
        int status;
        };

struct idlist {
        char *name;
        struct usere *invoc;
        struct idlist *next;
        };

struct opn {
        struct idlist *called;
        int k;
        };

union obj {
        double number;
        struct opn oper;
        struct idlist *name;
        struct userdict *dict;
        struct strdef *restr;
        struct arrele *array;
        struct phile *filo;
        int bool;
        char *spname;
        struct fontdict *spdict;
        };

struct usere {
        struct idlist *name;
        struct usere *next;
        struct usere *dnext;
        struct userdict *id;
        char sort;
        union obj u;
        };

struct userdict {
        struct usere *start;
        int size;
        int maxsize;
        };

struct gpath {
        char code;
        double xc,yc;
        struct gpath *next;
        };

struct gstate {
        struct gpath *path;
        struct gpath *epath;
        double cx,cy;
        double ctma,ctmb,ctmc,ctmd,ctmx,ctmy;
        double ax,ay;
        int nopath;
        int lcap,ljoin;
        double flat,red,green,blue,cline,mlim;
        struct arrele *curt;
        double sx,sy;
        struct fontdict *font;
        };

struct stelem {
        char sort;
        union obj u;
        };

struct arrele {
       int length;
       struct stelem *array;
       };

struct point {
       int x,y;
       };

struct elem {
       int type;
       int npoints;
       struct point *points;
       };

struct subpath {
       int length;
       struct elem *segments;
       };

struct charlist {
       char *name;
       int storage;
       int length;
       int width; /* sidebearing, xlowc, ylowc, xupperc, yupperc; */
       struct subpath *sub;
       struct charlist *next;
       };

struct fontdict {
       struct arrele *fontmatrix;
       int fonttype;
       struct arrele *fontbbox;
       struct arrele *encoding;
       struct idlist *fontname;
       int painttype;
       int uniqueid;
       struct charlist *charstrings;
       int fontheight;
       };

#define FONT_DICT_SIZE 9
