Annotation of researchv10dc/cmd/icon/src/link/ilink.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * External declarations for the linker.
        !             3:  */
        !             4: 
        !             5: #include "../h/rt.h"
        !             6: 
        !             7: #ifdef ATT3B
        !             8: #include <sys/types.h>
        !             9: #include <sys/stat.h>
        !            10: #endif ATT3B
        !            11: 
        !            12: /*
        !            13:  * Miscellaneous external declarations.
        !            14:  */
        !            15: 
        !            16: extern FILE *infile;           /* current input file */
        !            17: extern FILE *outfile;          /* interpreter output file */
        !            18: extern FILE *dbgfile;          /* debug file */
        !            19: extern char inname[];          /* input file name */
        !            20: extern char outname[];         /* output file name */
        !            21: extern char *pname;            /* this program name (from command line) */
        !            22: extern int line;               /* source program line number (from ucode) */
        !            23: extern char *file;             /* source program file name (from ucode) */
        !            24: extern int statics;            /* total number of statics */
        !            25: extern int dynoff;             /* stack offset counter for locals */
        !            26: extern int argoff;             /* stack offset counter for arguments */
        !            27: extern int static1;            /* first static in procedure */
        !            28: extern int nlocal;             /* number of locals in local table */
        !            29: extern int nconst;             /* number of constants in constant table */
        !            30: extern int nrecords;           /* number of records in program */
        !            31: extern int trace;              /* initial setting of &trace */
        !            32: extern int Dflag;              /* debug flag */
        !            33: extern char ixhdr[];           /* header line for direct execution */
        !            34: extern char *iconx;            /* location of iconx to put in #! line */
        !            35: extern int hdrloc;             /* location to place hdr block at */
        !            36: extern struct lfile *lfiles;   /* list of files to link */
        !            37: extern struct lfile *getlfile();
        !            38: 
        !            39: /*
        !            40:  * Structures for symbol table entries.
        !            41:  */
        !            42: 
        !            43: struct lentry {                        /* local table entry */
        !            44:    char *l_name;               /*   name of variable */
        !            45:    int l_flag;                 /*   variable flags */
        !            46:    union {                     /*   value field */
        !            47:       int staticid;            /*     unique id for static variables */
        !            48:       word offset;             /*     stack offset for args and locals */
        !            49:       struct gentry *global;   /*     global table entry */
        !            50:       } l_val;
        !            51:    };
        !            52: 
        !            53: struct gentry {                        /* global table entry */
        !            54:    struct gentry *g_blink;     /*   link for bucket chain */
        !            55:    char *g_name;               /*   name of variable */
        !            56:    int g_flag;                 /*   variable flags */
        !            57:    int g_nargs;                /*   number of args or fields */
        !            58:    int g_procid;               /*   procedure or record id */
        !            59:    word g_pc;                  /*   position in icode of object */
        !            60:    };
        !            61: 
        !            62: struct centry {                        /* constant table entry */
        !            63:    int c_flag;                 /*   type of literal flag */
        !            64:    union {                     /*   value field */
        !            65:       long ival;               /*     integer */
        !            66:       double rval;             /*     real */
        !            67:       char *sval;              /*     string */
        !            68:       } c_val;
        !            69:    int c_length;               /*   length of literal string */
        !            70:    word c_pc;                  /*   position in icode of object */
        !            71:    };
        !            72: 
        !            73: struct ientry {                        /* identifier table entry */
        !            74:    struct ientry *i_blink;     /*   link for bucket chain */
        !            75:    char *i_name;               /*   pointer to string */
        !            76:    int i_length;               /*   length of string */
        !            77:    };
        !            78: 
        !            79: struct fentry {                        /* field table header entry */
        !            80:    struct fentry *f_blink;     /*   link for bucket chain */
        !            81:    char *f_name;               /*   name of field */
        !            82:    int f_fid;                  /*   field id */
        !            83:    struct rentry *f_rlist;     /*   head of list of records */
        !            84:    };
        !            85: 
        !            86: struct rentry {                        /* field table record list entry */
        !            87:    struct rentry *r_link;      /*   link for list of records */
        !            88:    int r_recid;                        /*   record id */
        !            89:    int r_fnum;                 /*   offset of field within record */
        !            90:    };
        !            91: 
        !            92: /*
        !            93:  * Structure for linked list of file names to link.
        !            94:  */
        !            95: struct lfile {
        !            96:    struct lfile *lf_link;      /* next file in list */
        !            97:    char *lf_name;              /* name of file */
        !            98:    };
        !            99: 
        !           100: /*
        !           101:  * Flag values in symbol tables.
        !           102:  */
        !           103: 
        !           104: #define F_Global           01  /* variable declared global externally */
        !           105: #define F_Proc             05  /* procedure (includes GLOBAL) */
        !           106: #define F_Record          011  /* record (includes GLOBAL) */
        !           107: #define F_Dynamic         020  /* variable declared local dynamic */
        !           108: #define F_Static          040  /* variable declared local static */
        !           109: #define F_Builtin        0101  /* identifier refers to built-in procedure */
        !           110: #define F_ImpError       0400  /* procedure has default error */
        !           111: #define F_Argument      01000  /* variable is a formal parameter */
        !           112: #define F_IntLit        02000  /* literal is an integer */
        !           113: #define F_RealLit       04000  /* literal is a real */
        !           114: #define F_StrLit       010000  /* literal is a string */
        !           115: #define F_CsetLit      020000  /* literal is a cset */
        !           116: #define F_LongLit      040000  /* literal is a long integer */
        !           117: 
        !           118: /*
        !           119:  * Symbol table region pointers.
        !           120:  */
        !           121: 
        !           122: extern struct gentry **ghash;  /* hash area for global table */
        !           123: extern struct ientry **ihash;  /* hash area for identifier table */
        !           124: extern struct fentry **fhash;  /* hash area for field table */
        !           125: 
        !           126: extern struct lentry *ltable;  /* local table */
        !           127: extern struct gentry *gtable;  /* global table */
        !           128: extern struct centry *ctable;  /* constant table */
        !           129: extern struct ientry *itable;  /* identifier table */
        !           130: extern struct fentry *ftable;  /* field table headers */
        !           131: extern struct rentry *rtable;  /* field table record lists */
        !           132: extern char *strings;          /* string space */
        !           133: extern word *labels;           /* label table */
        !           134: extern char *code;             /* generated code space */
        !           135: 
        !           136: extern struct gentry *gfree;   /* free pointer for global table */
        !           137: extern struct ientry *ifree;   /* free pointer for identifier table */
        !           138: extern struct fentry *ffree;   /* free pointer for field table headers */
        !           139: extern struct rentry *rfree;   /* free pointer for field table record lists */
        !           140: extern char *strfree;          /* free pointer for string space */
        !           141: extern char *codep;            /* free pointer for code space */
        !           142: 
        !           143: extern word lsize;             /* size of local table */
        !           144: extern word gsize;             /* size of global table */
        !           145: extern word csize;             /* size of constant table */
        !           146: extern word isize;             /* size of identifier table */
        !           147: extern word fsize;             /* size of field table headers */
        !           148: extern word rsize;             /* size of field table record lists */
        !           149: extern word ssize;             /* size of string space */
        !           150: extern word ihsize;            /* size of identifier table hash area */
        !           151: extern word ghsize;            /* size of global table hash area */
        !           152: extern word fhsize;            /* size of field table hash area */
        !           153: extern word maxlabels;         /* maximum number of labels per procedure */
        !           154: extern word maxcode;           /* maximum amount of code per procedure */
        !           155: 
        !           156: extern int gmask;              /* mask for global table hash */
        !           157: extern int imask;              /* mask for identifier table hash */
        !           158: extern int fmask;              /* mask for field table hash */
        !           159: 
        !           160: /*
        !           161:  * Symbol table parameters.
        !           162:  */
        !           163: 
        !           164: #define Lsize           100    /* default size of local table */
        !           165: #define GSize           200    /* default size of global table */
        !           166: #define CSize           100    /* default size of constant table */
        !           167: #define ISize           500    /* default size of identifier table */
        !           168: #define FSize           100    /* default size of field table headers */
        !           169: #define RSize           100    /* default size of field table record lists */
        !           170: #define StrSize                5000    /* default size of string space */
        !           171: #define GhSize           64    /* default size of global table hash area */
        !           172: #define IhSize          128    /* default size of identifier table hash area */
        !           173: #define FhSize           32    /* default size of field table hash area */
        !           174: #define MaxLabels       500    /* default maximum number of labels/proc */
        !           175: 
        !           176: /*
        !           177:  * Hash computation macros.
        !           178:  */
        !           179: 
        !           180: #define ghasher(x)     (((word)x)&gmask)       /* for global table */
        !           181: #define fhasher(x)     (((word)x)&fmask)       /* for field table */
        !           182: 
        !           183: /*
        !           184:  * Machine-dependent constants.
        !           185:  */
        !           186: 
        !           187: 
        !           188: #define RkBlkSize 9*WordSize   /* size of record constructor block */

unix.superglobalmegacorp.com

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