symbol.hh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* $Header$
  2. Symbol table data structure.
  3. Each identifier structure refers to a list of possible meanings of this
  4. identifier. Each of these meanings is represented by a "symbol" structure.
  5. */
  6. typedef union constant { /* depends on type */
  7. long co_ival;
  8. double co_rval;
  9. char *co_sval;
  10. char *co_setval;
  11. } t_const, *p_const;
  12. typedef struct name {
  13. long nm_value; /* address or offset */
  14. struct scope *nm_scope; /* for names that define a scope */
  15. } t_name, *p_name;
  16. typedef struct symbol {
  17. struct symbol *sy_next; /* link to next meaning */
  18. struct symbol *sy_prev_sc; /* link to previous decl in scope */
  19. struct type *sy_type; /* type of symbol */
  20. int sy_class;
  21. #define CONST 0x0001
  22. #define TYPE 0x0002
  23. #define TAG 0x0004
  24. #define MODULE 0x0008
  25. #define PROC 0x0010
  26. #define FUNCTION 0x0020
  27. #define VAR 0x0040
  28. #define REGVAR 0x0080
  29. #define LOCVAR 0x0100
  30. #define VARPAR 0x0200
  31. /* #define SYMENTRY 0x0400 /* a non-dbx entry */
  32. #define FILESYM 0x0800 /* a filename */
  33. #define FILELINK 0x1000 /* a filename without its suffix */
  34. struct idf *sy_idf; /* reference back to its idf structure */
  35. struct scope *sy_scope; /* scope in which this symbol resides */
  36. union {
  37. t_const syv_const; /* CONST */
  38. t_name syv_name;
  39. /* struct outname syv_onam; /* for non-dbx entries */
  40. struct file *syv_file; /* for FILESYM */
  41. struct symbol *syv_fllink; /* for FILELINK */
  42. } sy_v;
  43. #define sy_const sy_v.syv_const
  44. #define sy_name sy_v.syv_name
  45. #define sy_onam sy_v.syv_onam
  46. #define sy_file sy_v.syv_file
  47. #define sy_filelink sy_v.syv_fllink
  48. } t_symbol, *p_symbol;
  49. /* ALLOCDEF "symbol" 50 */
  50. extern p_symbol NewSymbol(), Lookup(), Lookfor(), Lookfromscope(), add_file();
  51. extern p_symbol identify();
  52. extern p_symbol currfile;