locident.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*$Log: locident.h,v $
  2. * Revision 1.6 94/02/22 15:20:23 cifuente
  3. * Code generation is done.
  4. *
  5. * Revision 1.5 93/12/10 09:38:20 cifuente
  6. * New high-level types
  7. *
  8. * Revision 1.4 93/11/10 17:30:51 cifuente
  9. * Procedure header, locals
  10. *
  11. * Revision 1.3 93/11/08 12:06:35 cifuente
  12. * du1 analysis finished. Instantiates procedure arguments for user
  13. * declared procedures.
  14. *
  15. * Revision 1.2 93/10/25 11:01:00 cifuente
  16. * New SYNTHETIC instructions for d/u analysis
  17. *
  18. * Revision 1.1 93/10/11 11:47:39 cifuente
  19. * Initial revision
  20. *
  21. * File: locIdent.h
  22. * Purpose: High-level local identifier definitions
  23. * Date: October 1993
  24. */
  25. /* Type definition */
  26. typedef struct {
  27. Int csym; /* # symbols used */
  28. Int alloc; /* # symbols allocated */
  29. Int *idx; /* Array of integer indexes */
  30. } IDX_ARRAY;
  31. /* Type definitions used in the decompiled program */
  32. typedef enum {
  33. TYPE_UNKNOWN = 0, /* unknown so far */
  34. TYPE_BYTE_SIGN, /* signed byte (8 bits) */
  35. TYPE_BYTE_UNSIGN, /* unsigned byte */
  36. TYPE_WORD_SIGN, /* signed word (16 bits) */
  37. TYPE_WORD_UNSIGN, /* unsigned word (16 bits) */
  38. TYPE_LONG_SIGN, /* signed long (32 bits) */
  39. TYPE_LONG_UNSIGN, /* unsigned long (32 bits) */
  40. TYPE_RECORD, /* record structure */
  41. TYPE_PTR, /* pointer (32 bit ptr) */
  42. TYPE_STR, /* string */
  43. TYPE_CONST, /* constant (any type) */
  44. TYPE_FLOAT, /* floating point */
  45. TYPE_DOUBLE, /* double precision float */
  46. } hlType;
  47. static char *hlTypes[13] = {"", "char", "unsigned char", "int", "unsigned int",
  48. "long", "unsigned long", "record", "int *", "char *",
  49. "", "float", "double"};
  50. typedef enum {
  51. STK_FRAME, /* For stack vars */
  52. REG_FRAME, /* For register variables */
  53. GLB_FRAME, /* For globals */
  54. } frameType;
  55. /* Enumeration to determine whether pIcode points to the high or low part
  56. * of a long number */
  57. typedef enum {
  58. HIGH_FIRST, /* High value is first */
  59. LOW_FIRST, /* Low value is first */
  60. } hlFirst;
  61. /* LOCAL_ID */
  62. typedef struct {
  63. hlType type; /* Probable type */
  64. boolT illegal;/* Boolean: not a valid field any more */
  65. IDX_ARRAY idx; /* Index into icode array (REG_FRAME only) */
  66. frameType loc; /* Frame location */
  67. boolT hasMacro;/* Identifier requires a macro */
  68. char macro[10];/* Macro for this identifier */
  69. char name[20];/* Identifier's name */
  70. union { /* Different types of identifiers */
  71. byte regi; /* For TYPE_BYTE(WORD)_(UN)SIGN registers */
  72. struct { /* For TYPE_BYTE(WORD)_(UN)SIGN on the stack */
  73. byte regOff; /* register offset (if any) */
  74. Int off; /* offset from BP */
  75. } bwId;
  76. struct _bwGlb { /* For TYPE_BYTE(WORD)_(UN)SIGN globals */
  77. int16 seg; /* segment value */
  78. int16 off; /* offset */
  79. byte regi; /* optional indexed register */
  80. } bwGlb;
  81. struct _longId{ /* For TYPE_LONG_(UN)SIGN registers */
  82. byte h; /* high register */
  83. byte l; /* low register */
  84. } longId;
  85. struct _longStkId { /* For TYPE_LONG_(UN)SIGN on the stack */
  86. Int offH; /* high offset from BP */
  87. Int offL; /* low offset from BP */
  88. } longStkId;
  89. struct { /* For TYPE_LONG_(UN)SIGN globals */
  90. int16 seg; /* segment value */
  91. int16 offH; /* offset high */
  92. int16 offL; /* offset low */
  93. byte regi; /* optional indexed register */
  94. } longGlb;
  95. struct { /* For TYPE_LONG_(UN)SIGN constants */
  96. dword h; /* high word */
  97. dword l; /* low word */
  98. } longKte;
  99. } id;
  100. } ID;
  101. typedef struct {
  102. Int csym; /* No. of symbols in the table */
  103. Int alloc; /* No. of symbols allocated */
  104. ID *id; /* Identifier */
  105. } LOCAL_ID;