home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_09_07 / 9n07066a < prev    next >
Text File  |  1991-05-07  |  4KB  |  166 lines

  1.  
  2. /*
  3. ** Small-C Compiler Version 2.0
  4. **
  5. ** Portions Copyright 1982 J. E. Hendrix
  6. **
  7. ** Converted to 8088/PCDOS by D. R. Hicks, et al
  8. ** Symbol tables modified for up to 2-D  - D. Lang
  9. **
  10. ** Macro Definitions
  11. */
  12.  
  13. /*
  14. ** compile options
  15. */
  16. #define SEPARATE    /* compile separately                 */
  17. /* #define NOCCARGC /* no calls to CCARGC                 */
  18. /* #define HASH     /* use hash search for macros         */
  19. #define CMD_LINE    /* comand line run option             */
  20. /* #define DYNAMIC  /* allocate memory dynamically        */
  21. #define TAB  9      /* put out tabs of this value         */
  22. #define UPPER       /* force symbols to upper case        */
  23.  
  24. /*
  25. ** machine dependent parameters
  26. */
  27. #define BPW      2  /* bytes per word                     */
  28. #define LBPW     1  /* log2(BPW)                          */
  29. #define SBPC     1  /* stack bytes per character          */
  30. #define STKFRSZ  4  /* stack frame header size in bytes   */
  31. #define ERRCODE  errno /* I/O system error code           */
  32.  
  33. /*
  34. **    symbol table format
  35. */
  36. #define IDENT       0
  37. #define TYPE        1
  38. #define CLASS       2
  39. #define STATUS      3
  40. #define OFFSET      4
  41. #define NDIM        6    /* Number of dimensions if array */
  42. #define CDIM        7    /* Size of the column dimension  */
  43. #define NAME        9
  44. #define OFFSIZE     (NDIM-OFFSET)
  45. #define SYMAVG      14
  46. #define SYMMAX      18
  47.  
  48. /*
  49. **    symbol table parameters
  50. */
  51. #define NUMLOCS     50 /* room for 50 locals (up from 25) */
  52. #define STARTLOC    symtab
  53. #define ENDLOC      (symtab+(NUMLOCS*SYMAVG))
  54. #define NUMGLBS     210         /* was 200 */
  55. #define STARTGLB    ENDLOC
  56. #define ENDGLB      (ENDLOC+((NUMGLBS-1)*SYMMAX))
  57. #define SYMTBSZ     NUMLOCS*SYMAVG + NUMGLBS*SYMMAX
  58.  
  59. /*
  60. ** System wide name size   (for symbols )
  61. */
  62. #define NAMESIZE    9
  63. #define NAMEMAX     8
  64.  
  65. /*
  66. ** possible entries for "IDENT"
  67. */
  68. #define LABEL       0
  69. #define VARIABLE    1
  70. #define ARRAY       2
  71. #define POINTER     3
  72. #define FUNCTION    4
  73.  
  74. /*
  75. ** possible entries for "TYPE"
  76. **    low order 2 bits make type unique within length
  77. **    high order 2 bits give length of object
  78. */
  79. /*      LABEL       0              */
  80. #define CCHAR       (1<<2)
  81. #define CINT        (BPW<<2)
  82.  
  83. /*
  84. ** possible entries for "CLASS"
  85. */
  86. /*      LABEL       0              */
  87. #define STATIC      1
  88. #define PUBLIC      2
  89. #define EXTERNAL    3
  90. #define AUTOMATIC   4
  91.  
  92. /*
  93. ** possible entries for "STATUS" (bit significant)
  94. */
  95. #define DECLARED    128  /* symbol is explicitly declared */
  96. #define USED        64   /* symbol is referenced */
  97.  
  98. /*
  99. **  "switch" table
  100. */
  101. #define SWSIZ       (2*BPW)
  102. #define SWTABSZ     (25*SWSIZ)
  103.  
  104. /*
  105. ** "while" statement queue
  106. */
  107. #define WQTABSZ     30
  108. #define WQSIZ        3
  109. #define WQMAX       (wq+WQTABSZ-WQSIZ)
  110.  
  111. /*
  112. ** entry offsets in while queue
  113. */
  114. #define WQSP        0
  115. #define WQLOOP      1
  116. #define WQEXIT      2
  117.  
  118. /*
  119. **  literal pool
  120. */
  121. #define LITABSZ     700
  122. #define LITMAX      (LITABSZ-1)
  123.  
  124. /*
  125. **  input line
  126. */
  127. #define LINEMAX     160
  128. #define LINESIZE    161
  129.  
  130. /*
  131. ** output staging buffer size
  132. */
  133. #define STAGESIZE   1500
  134. #define STAGELIMIT  (STAGESIZE-1)
  135.  
  136. /*
  137. **  macro (define) pool
  138. */
  139. #ifdef HASH
  140. #define MACNBR      90
  141. #define MACNSIZE    990      /* 90*(NAMESIZE+2)  */
  142. #define MACNEND     (macn+MACNSIZE)
  143. #define MACQSIZE    450      /* 90*5             */
  144. #else
  145. #define MACQSIZE    1250
  146. #endif
  147. #define MACMAX      (MACQSIZE-1)
  148.  
  149. /*
  150. **  statement types
  151. */
  152. #define STIF        1
  153. #define STWHILE     2
  154. #define STRETURN    3
  155. #define STBREAK     4
  156. #define STCONT      5
  157. #define STASM       6
  158. #define STEXPR      7
  159. #define STDO        8    /* compile "do" logic      */
  160. #define STFOR       9    /* compile "for" logic     */
  161. #define STSWITCH    10   /* compile "switch/case/default" */
  162. #define STCASE      11
  163. #define STDEF       12
  164. #define STGOTO      13   /* compile "goto" logic    */
  165.  
  166.