home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / program / compiler / nasm20b / nasm_src / structs.h < prev    next >
C/C++ Source or Header  |  1993-01-19  |  5KB  |  192 lines

  1. /* ---------------------------------------------------------------------- */
  2. /*                   Copyright (C) 1991 by Natürlich!                     */
  3. /*                      This file is copyrighted!                         */
  4. /*                Refer to the documentation for details.                 */
  5. /* ---------------------------------------------------------------------- */
  6. #ifndef _STRUCTS_
  7. #define _STRUCTS_
  8.  
  9. typedef struct buffer_
  10. {
  11.    struct buffer_ huge *next,
  12.                   huge *before;     /* links for input buffer chain */
  13.    byte           huge  *buflist,
  14.                   huge  *p;         /* pointers to actual buffer        */
  15.    char                 *name;      /* buffer "name"                    */
  16.    union
  17.    {
  18.       struct lexpr_ huge *list;     /* for macros                       */
  19.       char              *unused;    /* for other uses                   */
  20.    } parms;
  21.    lword                remain, 
  22.                         oremain;    /* bytes left in file , total len   */
  23.    word                 line;       /* line counter                     */
  24.    int                  _aux1;      /* used for FDs and macro counts    */
  25.    unsigned short       _aux2,      /* used for lookahead chars         */
  26.                         type;
  27. #ifdef __NSTDC__
  28.    union
  29.    {
  30.       void              (*fill)( struct buffer_ *); /* see non __STDC__  */
  31.       struct macro_ huge *dad;                     /* for comments      */
  32.    } multi;
  33.    void                 (*done)( struct buffer_ *);
  34.    int                  (*get )( void);
  35. #else
  36.    union
  37.    {
  38.       void              (*fill)();  /* refill buffer routine            */
  39.       struct macro_ huge *dad;      /* address of macro definition      */
  40.    } multi;
  41.    void                 (*done)();  /* Called before buffer is killed   */
  42.    int                  (*get)();   /* Input routine to get token       */
  43. #endif
  44. } buffer;
  45.  
  46.  
  47. typedef struct ref_
  48. {
  49.    struct ref_ huge     *next;
  50.    struct expr_ huge    *ref;    /* Pointer to value that needs fixing */
  51. #if ! LINKER
  52.    unsigned             no;
  53.    unsigned             line;
  54. #else
  55.    unsigned             hacked;
  56. #endif
  57. } ref;
  58.  
  59.  
  60. #if LINKER || LIBRARIAN
  61. # define EXPRSIZE 20
  62. typedef struct expr_
  63. {
  64.    word                 val,
  65.                         aux, label;    /*  6 bytes */
  66.    byte                 op, fix;       /*  8 bytes */
  67.    struct expr_ huge    *l,            /* 12 bytes */
  68.                 huge    *r;            /* 16 bytes */
  69.    union
  70.    {
  71.       struct fix_ huge  *fixp;
  72.       struct expr_ huge *t;            /* 20 bytes */
  73.    } zonk;
  74. #if ! VERSION
  75.    word                 hacked;        /* (22) bytes */
  76. #undef EXPRSIZE
  77. #define EXPRSIZE  22
  78. #endif   
  79. } expr;
  80.  
  81. #else
  82.  
  83. typedef struct expr_
  84. {
  85.    struct label_ huge   *label;        /*  4 bytes */
  86.    word                 no, val, aux;  /* 10 bytes */
  87.    byte                 op, fix;       /* 12 bytes */
  88.    struct expr_ huge    *l,            /* 16 bytes */
  89.                 huge    *r;            /* 20 bytes */
  90.    union
  91.    {
  92.       struct fix_ huge  *fixp;
  93.       struct expr_ huge *t;            /* 24 bytes */
  94.    } zonk;
  95. } expr;
  96. # define EXPRSIZE 24
  97. #endif
  98.  
  99. typedef struct label_
  100. {
  101.    struct label_ huge   *next,
  102.                  huge   *before;
  103.    lword                hash;
  104.    word                 val,          /* must be in second position       */
  105.                         type;         /* see "expr.c":  recalc()          */
  106.    char                 *name;        /* ^^^ I sure hope this is obsolete */
  107.    struct ref_ huge     *refs;
  108. #if ! LINKER
  109.    word                 no;
  110. #endif
  111. } label;
  112.  
  113.  
  114. typedef struct lexpr_
  115. {
  116.    struct lexpr_ huge   *next;
  117.    char                 *string;
  118.    struct expr_ huge    *expr;
  119. } lexpr;
  120.  
  121.  
  122. typedef struct memo_
  123. {
  124.    struct expr_ huge    *p;
  125.    struct memo_ huge    *next;
  126. } memo;
  127.  
  128.  
  129. typedef struct macro_
  130. {
  131.    lword                hash;
  132.    word                 inuse;
  133.    char                 *name;
  134.    struct buffer_ huge  *buf;             /* Pretty circular */
  135.    struct macro_ huge   *next,
  136.                         *before;
  137. } macro;
  138.  
  139.  
  140. typedef struct exp_m_
  141. {
  142.    int                  free;
  143.    expr huge            *tab;
  144.    struct exp_m_ huge   *before;
  145. } exp_m;
  146.  
  147.  
  148. typedef struct seg_
  149. {
  150.    struct seg_ huge     *next;         /* pointer to next seg  */
  151.    int                  type;          /* type of the seg      */
  152.    word                 index,         /* __program[ index]    */
  153.                         size;          /* --> .DS  and .ALIGN  */
  154. #if ! LINKER
  155.    word                 no;
  156. #else
  157.    word                 offset;        /* real offset PC wise  */
  158. #endif
  159. } seg;
  160.  
  161.  
  162. typedef struct imm_
  163. {
  164.    struct imm_ huge     *next;
  165.    struct seg_ huge     *block;
  166.    word                 type,
  167.                         offset,
  168.                         val;
  169. #if ! LINKER
  170.    word                 no;
  171. #endif
  172. } imm;
  173.  
  174.  
  175. typedef struct fix_
  176. {
  177.    union
  178.    {
  179.       struct seg_ huge     *block;
  180.       struct label_ huge   *label;
  181.    } poof;
  182.    struct imm_ huge        *imm;
  183.    word                    index;
  184. #if ! LINKER
  185.    word                    no;
  186. #else
  187.    word                    hacked;
  188. #endif
  189. } fix;
  190.  
  191. #endif
  192.