home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / dosdisas.zip / dccsrcoo.zip / locident.h < prev    next >
Text File  |  1997-04-09  |  4KB  |  129 lines

  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.  
  26.  
  27. /* Type definition */
  28. typedef struct {
  29.     Int        csym;        /* # symbols used             */
  30.     Int        alloc;        /* # symbols allocated         */
  31.     Int        *idx;        /* Array of integer indexes */
  32. } IDX_ARRAY;
  33.  
  34. /* Type definitions used in the decompiled program  */
  35. typedef enum {
  36.     TYPE_UNKNOWN = 0,   /* unknown so far              */
  37.     TYPE_BYTE_SIGN,        /* signed byte (8 bits)     */
  38.     TYPE_BYTE_UNSIGN,    /* unsigned byte             */
  39.     TYPE_WORD_SIGN,     /* signed word (16 bits)     */
  40.     TYPE_WORD_UNSIGN,    /* unsigned word (16 bits)    */
  41.     TYPE_LONG_SIGN,        /* signed long (32 bits)    */
  42.     TYPE_LONG_UNSIGN,    /* unsigned long (32 bits)    */
  43.     TYPE_RECORD,        /* record structure            */
  44.     TYPE_PTR,            /* pointer (32 bit ptr)     */
  45.     TYPE_STR,            /* string                   */
  46.      TYPE_CONST,            /* constant (any type)        */
  47.     TYPE_FLOAT,            /* floating point            */
  48.     TYPE_DOUBLE,        /* double precision float    */
  49. } hlType;
  50.  
  51. static char *hlTypes[13] = {"", "char", "unsigned char", "int", "unsigned int", 
  52.                       "long", "unsigned long", "record", "int *", "char *",
  53.                       "", "float", "double"};
  54.  
  55. typedef enum
  56. {
  57.     STK_FRAME,            /* For stack vars            */
  58.     REG_FRAME,            /* For register variables     */
  59.     GLB_FRAME,            /* For globals                */
  60. } frameType;
  61.  
  62.  
  63. /* Enumeration to determine whether pIcode points to the high or low part
  64.  * of a long number */
  65. typedef enum {
  66.     HIGH_FIRST,            /* High value is first        */
  67.     LOW_FIRST,            /* Low value is first        */
  68. } hlFirst;
  69.  
  70.  
  71. typedef struct
  72. {
  73.     int16    seg;            /*   segment value                             */
  74.     int16    off;            /*   offset                                     */
  75.     byte     regi;            /*   optional indexed register                 */
  76. } BWGLB_TYPE;
  77.  
  78.  
  79. typedef struct
  80. { /* For TYPE_LONG_(UN)SIGN on the stack         */
  81.     Int        offH;    /*   high offset from BP                     */
  82.     Int        offL;    /*   low offset from BP                         */
  83. }    LONG_STKID_TYPE;
  84. typedef struct
  85. {        /* For TYPE_LONG_(UN)SIGN registers             */
  86.     byte    h;        /*   high register                             */
  87.     byte    l;        /*   low register                             */
  88. } LONGID_TYPE;
  89.  
  90.  
  91. /* ID, LOCAL_ID */
  92. typedef struct {
  93.     hlType            type;    /* Probable type                             */
  94.     boolT            illegal;/* Boolean: not a valid field any more         */
  95.     IDX_ARRAY        idx;    /* Index into icode array (REG_FRAME only)     */
  96.     frameType        loc;    /* Frame location                             */
  97.     boolT            hasMacro;/* Identifier requires a macro                 */
  98.     char            macro[10];/* Macro for this identifier                 */
  99.     char            name[20];/* Identifier's name                         */
  100.     union {                    /* Different types of identifiers              */
  101.         byte        regi;    /* For TYPE_BYTE(WORD)_(UN)SIGN registers    */ 
  102.         struct {            /* For TYPE_BYTE(WORD)_(UN)SIGN on the stack */
  103.             byte    regOff; /*    register offset (if any)                 */
  104.             Int        off;    /*    offset from BP                         */
  105.         }            bwId;
  106.         BWGLB_TYPE    bwGlb;    /* For TYPE_BYTE(WORD)_(UN)SIGN globals         */
  107.         LONGID_TYPE longId; /* For TYPE_LONG_(UN)SIGN registers             */
  108.         LONG_STKID_TYPE    longStkId;/* For TYPE_LONG_(UN)SIGN on the stack */
  109.         struct {            /* For TYPE_LONG_(UN)SIGN globals             */
  110.             int16    seg;    /*   segment value                             */
  111.             int16    offH;    /*   offset high                             */
  112.             int16    offL;    /*   offset low                                 */
  113.             byte    regi;    /*   optional indexed register                 */
  114.         }            longGlb;
  115.         struct {            /* For TYPE_LONG_(UN)SIGN constants             */
  116.             dword    h;        /*     high word                                 */
  117.             dword     l;        /*     low word                                 */
  118.         }            longKte;
  119.     }                id;
  120. } ID;
  121.  
  122. typedef struct {
  123.     Int            csym;        /* No. of symbols in the table    */
  124.     Int            alloc;        /* No. of symbols allocated        */
  125.     ID            *id;        /* Identifier                    */
  126. } LOCAL_ID;
  127.  
  128.  
  129.