home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / lambda / soundpot / p / sc210.lbr / CC.DZF / CC.DEF
Encoding:
Text File  |  1993-10-25  |  7.4 KB  |  290 lines

  1.  
  2. /*
  3. ** Small-C Compiler Version 2.10
  4. **
  5. ** Copyright 1982 J. E. Hendrix
  6. **
  7. ** Modified version by F.A.Scacchitti 10/7/84
  8. **
  9. ** Upgrades are in chronological order. For more information regarding
  10. ** differences between this version and the one described in J.E.H.'s
  11. ** Small-C Manual, refer to CC.DOC.
  12. **
  13. **  2.06 
  14. **    -modified error pause to terminate on Control X
  15. **        CC22.C    error()
  16. **    -increased all values to conform to 2.1
  17. **        CC.DEF
  18. **    -added autext function per J.E.H.'s 2.1 (37) 
  19. **        CC32.C    primary()
  20. **        CC4.C    *ccptr, *symtab
  21. **        CC41.C    trailer()
  22. **  2.07
  23. **    -cleaned up and revised CC11.C to eliminate all that garbage
  24. **     mods include :
  25. **        -set M80 to always true (no -c option)
  26. **            CC11.C    ask()
  27. **        -added -i option to command line to initialize
  28. **         storage areas to zeroes only when desired
  29. **            CC1.C int iflag;
  30. **            CC11.C    ask() 
  31. **        -redid initialization to default to DS instead 
  32. **         DB or DW to speed up compile time
  33. **            CC11.C  dumpzero()
  34. **    -removed FULL_C, C80, SMALL_VM, PDS, #defines
  35. **        CC.DEF and everyplace else encountered
  36. **    -fixed minor bug in auto-external function causing erroneos
  37. **     defining of external nothings
  38. **
  39. **  2.08
  40. **    -more cleanup of old garbage got rid of all unnecessary #def's
  41. **     including CMD_LINE and NEW_CMD_LN
  42. **        CC.DEF, CC11.C and all other places encountered
  43. **    -added ## suffixes to all CALL calls to eliminate the CALL
  44. **     externals from STDIO.H
  45. **    -upgraded peephole() to accomodate new ptr values
  46. **        CC41.C, CC42.C
  47. **    -removed all unnecessary external defines from CC1.C, CC2.C
  48. **     CC3.C and CC4.C (left in as comments)
  49. **
  50. ** 2.09
  51. **    -defined HASH
  52. **    -defined DYNAMIC
  53. **    -changed CCALLOC to calloc and upgraded to conform to J.E.H's 2.1
  54. **        CC11.C  
  55. **    -changed CCAVAIL to avail and upgraded to conform to J.E.H's 2.1
  56. **        CC21.C
  57. **    -modified ifline() to properly nest #ifdef's per J.E.H's 2.1
  58. **        CC22.C
  59. **    -modified trailer to autodeclare externals for both DYNAMIC and
  60. **     !DYNAMIC defines
  61. **        CC41.C
  62. **    -modified trailer to link to ULINK (runtime module) if source 
  63. **     contain a main()
  64. **        CC41.C
  65. **    -modified runtime module - refer to those modules for specifics
  66. **        CLIB.DOC
  67. **        -seperated modules into standard C functions and
  68. **         genrerated clib.rel
  69. **    -modified compiler runtime module to minimize size, eliminate
  70. **     redirected input and unnecessary routines
  71. **        CCRTL.MAC
  72. **    -added permission for *(funct)() syntax as arguments
  73. **        CC12.C declglb(), doargs()   J.E.H.'s (3)
  74. **
  75. ** 2.10
  76. **    -added -n option to compiler runstring to allow return to CP/M's
  77. **     CCP rather than return via warm boot
  78. **        CC1.C nbflg
  79. **        CC11.C ask()
  80. **    -added code generation for -n option
  81. **        CC4.C nbflg
  82. **        CC41.C trailer()
  83. **    -added static's to preprocessor to allow non-global definitions
  84. **     of static variables
  85. **        CC11.C parse()
  86. **        CC41.C trailer()
  87. **    -added or verified the following fixes to upgrade to J.E.H.'s 2.1
  88. **        #1  - CC13.C, CC21.C
  89. **        #3  - CC12.C
  90. **        #7  - CC22.C
  91. **        #8  - CC12.C
  92. **        #9  - CC22.C
  93. **        #10 - 
  94. **        #11 -
  95. **        #16 - CC12.C
  96. **        #22 - C. A. L. L.
  97. **        #24 - CC33.C
  98. **        #25 - CC12.C
  99. ##        #28 - CC41.C
  100. **        #30 - CC42.C
  101. **        #31 - CC21.C
  102. **        #35 - CC41.C
  103. **        #37 - CC.DEF, CC32.C, CC41.C
  104. **        #40 - CC12.C
  105. **        #41 - CC1.C, CC2.C, CC3.C, CC4.C
  106. **     
  107. **    -added the conditional operator {e1 ? e2 : e3 }
  108. **        CC31.C heir1(), ducond()
  109. **    -changed stdiol.h to stdio.h -CC1.C, CC2.C, CC3.C, CC4.C
  110. **    -problems occur when using the (*funct)() syntax. Consider
  111. **       this feature not installed.
  112. **
  113. **    Stay tuned folk for the following:
  114. **
  115. **    >installed all fixes and pertinent upgrades per J.E.H.'s 2.1
  116. **     (13, 14, 15, 16, 26, 27, 34, 36, 38, )
  117. **    >added multi-dimensioned arrays
  118. **    >added arrays of pointers eg. *argv[], *num[i]
  119. **    >added multiple levels of indirection eg. **argv, ***ptr
  120. **    >added type longs
  121. **    >added floating point
  122. **    >added structures and unions
  123. **    >complete 'C' preprocessor external of compiler
  124. */    
  125.  
  126. /*
  127. ** Macro Definitions
  128. */
  129.  
  130. /*
  131. ** compile options
  132. */
  133. #define M80      /* generate m80 compatable library calls */
  134. #define PHASE2   /* 2nd and later compiles */
  135. #define SEPARATE /* compile separately */
  136. #define OPTIMIZE /* compile output optimizer */
  137. #define NOCCARGC /* no calls to CCARGC */
  138. #define HASH     /* use hash search for macros */
  139. #define DYNAMIC  /* allocate memory dynamically */
  140. /* #define POLL     /* poll for operator interruptions */
  141. #define COL      /* terminate labels with a colon */
  142. #define TAB  9   /* put out tabs of this value */
  143. #define UPPER    /* force symbols to upper case */
  144. #define LINK     /* will use with linking loader */
  145.  
  146. /*
  147. ** machine dependent parameters
  148. */
  149. #define BPW     2   /* bytes per word */
  150. #define LBPW    1   /* log2(BPW) */
  151. #define SBPC    1   /* stack bytes per character */
  152. #define ERRCODE 7   /* op sys return code */
  153.  
  154. /*
  155. ** symbol table format
  156. */
  157. #define IDENT    0
  158. #define TYPE     1
  159. #define CLASS    2
  160. #define OFFSET   3
  161. #define NAME     5
  162. #define OFFSIZE (NAME-OFFSET)
  163. #define SYMAVG  10
  164. #define SYMMAX  14
  165.  
  166. /*
  167. ** symbol table parameters
  168. */
  169. #define NUMLOCS   25
  170. #define STARTLOC  symtab
  171. #define ENDLOC   (symtab+(NUMLOCS*SYMAVG))
  172. #define NUMGLBS   200
  173. #define STARTGLB  ENDLOC
  174. #define ENDGLB   (ENDLOC+((NUMGLBS-1)*SYMMAX))
  175. #define SYMTBSZ   3050  /* NUMLOCS*SYMAVG + NUMGLBS*SYMMAX */
  176.  
  177. /*
  178. ** System wide name size (for symbols)
  179. */
  180. #define NAMESIZE 9
  181. #define NAMEMAX  8
  182.  
  183. /*
  184. ** possible entries for "IDENT"
  185. */
  186. #define LABEL    0
  187. #define VARIABLE 1
  188. #define ARRAY    2
  189. #define POINTER  3
  190. #define FUNCTION 4
  191.  
  192. /*
  193. ** possible entries for "TYPE"
  194. **    low order 2 bits make type unique within length
  195. **    high order bits give length of object
  196. */
  197. /*      LABEL   0 */
  198. #define CCHAR   (1<<2)
  199. #define CINT    (BPW<<2)
  200.  
  201. /*
  202. ** possible entries for "CLASS"
  203. */
  204. /*      LABEL     0 */
  205. #define STATIC    1
  206. #define AUTOMATIC 2
  207. #define EXTERNAL  3
  208. #define AUTOEXT   4
  209.  
  210. /*
  211. ** "switch" table
  212. */
  213. #ifdef PHASE2
  214. #define SWSIZ   (2*BPW)
  215. #define SWTABSZ (60*SWSIZ)
  216. #else /* PHASE2 */
  217. #define SWSIZ    4
  218. #define SWTABSZ 100
  219. #endif /* PHASE2 */
  220.  
  221. /*
  222. ** "while" statement queue
  223. */
  224. #define WQTABSZ  30
  225. #define WQSIZ     3
  226. #define WQMAX   (wq+WQTABSZ-WQSIZ)
  227.  
  228. /*
  229. ** entry offsets in while queue
  230. */
  231. #define WQSP    0
  232. #define WQLOOP  1
  233. #define WQEXIT  2
  234.  
  235. /*
  236. ** literal pool
  237. */
  238. #define LITABSZ 800
  239. #define LITMAX  (LITABSZ-1)
  240.  
  241. /*
  242. ** input line
  243. */
  244. #define LINEMAX  127
  245. #define LINESIZE 128
  246.  
  247. /*
  248. ** command line
  249. */
  250. #define MAXARGS  32     /* maximum number of option arguments */
  251.  
  252. /*
  253. ** output staging buffer size
  254. */
  255. #define STAGESIZE   800
  256. #define STAGELIMIT  (STAGESIZE-1)
  257.  
  258. /*
  259. ** macro (define) pool
  260. */
  261. #ifdef HASH
  262. #define MACNBR   100
  263. #define MACNSIZE 1100   /* 100*(NAMESIZE+2) */
  264. #define MACNEND  (macn+MACNSIZE)
  265. #define MACQSIZE 500   /* 100*5 */
  266.  
  267. #else /* HASH */
  268. #define MACQSIZE 1100
  269. #endif /* HASH */
  270.  
  271. #define MACMAX  (MACQSIZE-1)
  272.  
  273. /*
  274. ** statement types
  275. */
  276. #define STIF      1
  277. #define STWHILE   2
  278. #define STRETURN  3
  279. #define STBREAK   4
  280. #define STCONT    5
  281. #define STASM     6
  282. #define STEXPR    7
  283. #define STDO      8 /* compile "do" logic */
  284. #define STFOR     9 /* compile "for" logic */
  285. #define STSWITCH 10 /* compile "switch/case/default" logic */
  286. #define STCASE   11
  287. #define STDEF    12
  288. #define STGOTO   13 /* compile "goto" logic */
  289.  
  290.