home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / icon / dos / src / icont / tsym.h < prev    next >
C/C++ Source or Header  |  1992-02-10  |  3KB  |  86 lines

  1. /*
  2.  * Structures for symbol table entries.
  3.  */
  4.  
  5. struct tlentry {            /* local table entry */
  6.    struct tlentry *l_blink;    /*   link for bucket chain */
  7.    char *l_name;        /*   name of variable */
  8.    int l_flag;            /*   variable flags */
  9.    };
  10.  
  11. struct tgentry {            /* global table entry */
  12.    struct tgentry *g_blink;    /*   link for bucket chain */
  13.    char *g_name;        /*   name of variable */
  14.    int g_flag;            /*   variable flags */
  15.    int g_nargs;            /*   number of args (procedure) or */
  16.    };                /*     number of fields (record) */
  17.  
  18. struct tcentry {            /* constant table entry */
  19.    struct tcentry *c_blink;    /*   link for bucket chain */
  20.    char *c_name;        /*   pointer to string */
  21.    int c_length;        /*   length of string */
  22.    int c_flag;            /*   type of literal flag */
  23.    };
  24.  
  25. struct tientry {            /* identifier table entry */
  26.    struct tientry *i_blink;    /*   link for bucket chain */
  27.    char *i_name;        /*   pointer to string */
  28.    int i_length;        /*   length of string */
  29.    };
  30.  
  31. /*
  32.  * Flag values.
  33.  */
  34.  
  35. #define F_Global        01    /* variable declared global externally */
  36. #define F_Proc            04    /* procedure */
  37. #define F_Record       010    /* record */
  38. #define F_Dynamic       020    /* variable declared local dynamic */
  39. #define F_Static       040    /* variable declared local static */
  40. #define F_Builtin      0100    /* identifier refers to built-in procedure */
  41. #define F_ImpError      0400    /* procedure has default error */
  42. #define F_Argument     01000    /* variable is a formal parameter */
  43. #define F_IntLit     02000    /* literal is an integer */
  44. #define F_RealLit     04000    /* literal is a real */
  45. #define F_StrLit    010000    /* literal is a string */
  46. #define F_CsetLit    020000    /* literal is a cset */
  47.  
  48. /*
  49.  * Symbol table region pointers.
  50.  */
  51.  
  52. extern struct tlentry **lhash;    /* hash area for local table */
  53. extern struct tgentry **ghash;    /* hash area for global table */
  54. extern struct tcentry **chash;    /* hash area for constant table */
  55. extern struct tientry **ihash;    /* hash area for identifier table */
  56.  
  57. extern struct tlentry *ltable;    /* local table */
  58. extern struct tgentry *gtable;    /* global table */
  59. extern struct tcentry *ctable;    /* constant table */
  60. extern struct tientry *itable;    /* identifier table */
  61.  
  62. extern struct tlentry *lfree;    /* free pointer for local table */
  63. extern struct tgentry *gfree;    /* free pointer for global table */
  64. extern struct tcentry *ctfree;    /* free pointer for constant table */
  65. extern struct tientry *ifree;    /* free pointer for identifier table */
  66.  
  67.  
  68. /*
  69.  * Structure for keyword table.
  70.  */
  71.  
  72. struct keyent {
  73.       char *keyname;
  74.       int keyid;
  75.       };
  76.  
  77. extern struct keyent keytab[];    /* keyword table */
  78.  
  79. /*
  80.  * Hash functions for symbol tables.
  81.  */
  82.  
  83. #define ghasher(x)    (((word)x)&gmask)     /* global symbol table */
  84. #define lhasher(x)    (((word)x)&lmask)     /* local symbol table */
  85. #define chasher(x)    (((word)x)&cmask)     /* constant symbol table */
  86.