symtab.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Symbol table prototypes
  3. * (C) Mike van Emmerik
  4. */
  5. #pragma once
  6. #include <string>
  7. #include <stdint.h>
  8. #include "Enums.h"
  9. #include "types.h"
  10. struct COND_EXPR;
  11. struct TypeContainer;
  12. /* * * * * * * * * * * * * * * * * */
  13. /* Symbol table structs and protos */
  14. /* * * * * * * * * * * * * * * * * */
  15. struct Function;
  16. struct SYMTABLE
  17. {
  18. std::string pSymName; /* Ptr to symbolic name or comment */
  19. uint32_t symOff; /* Symbol image offset */
  20. Function *symProc; /* Procedure pointer */
  21. SYMTABLE() : symOff(0),symProc(0) {}
  22. SYMTABLE(uint32_t _sym,Function *_proc) : symOff(_sym),symProc(_proc)
  23. {}
  24. bool operator == (const SYMTABLE &other) const
  25. {
  26. // does not yse pSymName, to ease finding by symOff/symProc combo
  27. // in map<SYMTABLE,X>
  28. return (symOff==other.symOff) && symProc==(other.symProc);
  29. }
  30. };
  31. enum tableType /* The table types */
  32. {
  33. Label=0, /* The label table */
  34. Comment, /* The comment table */
  35. NUM_TABLE_TYPES /* Number of entries: must be last */
  36. };
  37. void createSymTables(void);
  38. void destroySymTables(void);
  39. boolT readVal (std::ostringstream &symName, uint32_t symOff, Function *symProc);
  40. void selectTable(tableType); /* Select a particular table */