locident.h 4.1 KB

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