home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / dosdisas.zip / parsehdr.zip / LOCIDENT.H next >
Text File  |  1994-03-16  |  4KB  |  118 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.     STK_FRAME,            /* For stack vars            */
  57.     REG_FRAME,            /* For register variables     */
  58.     GLB_FRAME,            /* For globals                */
  59. } frameType;
  60.  
  61.  
  62. /* Enumeration to determine whether pIcode points to the high or low part
  63.  * of a long number */
  64. typedef enum {
  65.     HIGH_FIRST,            /* High value is first        */
  66.     LOW_FIRST,            /* Low value is first        */
  67. } hlFirst;
  68.  
  69.  
  70. /* LOCAL_ID */
  71. typedef struct {
  72.     hlType            type;    /* Probable type                             */
  73.     boolT            illegal;/* Boolean: not a valid field any more         */
  74.     IDX_ARRAY        idx;    /* Index into icode array (REG_FRAME only)     */
  75.     frameType        loc;    /* Frame location                             */
  76.     boolT            hasMacro;/* Identifier requires a macro                 */
  77.     char            macro[10];/* Macro for this identifier                 */
  78.     char            name[20];/* Identifier's name                         */
  79.     union {                    /* Different types of identifiers              */
  80.         byte        regi;    /* For TYPE_BYTE(WORD)_(UN)SIGN registers    */ 
  81.         struct {            /* For TYPE_BYTE(WORD)_(UN)SIGN on the stack */
  82.             byte    regOff; /*    register offset (if any)                 */
  83.             Int        off;    /*    offset from BP                         */
  84.         }            bwId;
  85.         struct _bwGlb {        /* For TYPE_BYTE(WORD)_(UN)SIGN globals         */
  86.             int16    seg;    /*   segment value                             */
  87.             int16    off;    /*   offset                                     */
  88.             byte     regi;    /*   optional indexed register                 */
  89.         }            bwGlb;
  90.         struct _longId{        /* For TYPE_LONG_(UN)SIGN registers             */
  91.             byte    h;        /*   high register                             */
  92.             byte    l;        /*   low register                             */
  93.         }            longId;
  94.         struct _longStkId { /* For TYPE_LONG_(UN)SIGN on the stack         */
  95.             Int        offH;    /*   high offset from BP                     */
  96.             Int        offL;    /*   low offset from BP                         */
  97.         }            longStkId;
  98.         struct {            /* For TYPE_LONG_(UN)SIGN globals             */
  99.             int16    seg;    /*   segment value                             */
  100.             int16    offH;    /*   offset high                             */
  101.             int16    offL;    /*   offset low                                 */
  102.             byte    regi;    /*   optional indexed register                 */
  103.         }            longGlb;
  104.         struct {            /* For TYPE_LONG_(UN)SIGN constants             */
  105.             dword    h;        /*     high word                                 */
  106.             dword     l;        /*     low word                                 */
  107.         }            longKte;
  108.     }                id;
  109. } ID;
  110.  
  111. typedef struct {
  112.     Int            csym;        /* No. of symbols in the table    */
  113.     Int            alloc;        /* No. of symbols allocated        */
  114.     ID            *id;        /* Identifier                    */
  115. } LOCAL_ID;
  116.  
  117.  
  118.