home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / MBUG / MBUG158.ARC / SC21-1.LBR / CC.DYC / CC.DYC
Text File  |  1979-12-31  |  10KB  |  238 lines

  1.  
  2.                     Small - C  Documentation
  3.  
  4.                     Version 2.10    10/8/84
  5.  
  6.  
  7.                              by
  8.  
  9.  
  10.                       F. A. Scacchitti
  11.                       25 Glenview Lane
  12.                       Rochester, NY 14609
  13.                       (716) 482 - 7159
  14.  
  15.  
  16. Thi≤á documen⌠á i≤ intendeΣ t∩ supplemen⌠ J«á E«á Hendrix'≤á "Thσ ì
  17. Smal∞á ├ Handbookó anΣ wil∞ onl∙ discus≤ thσ difference≤á betweeε ì
  18. thi≤ versioε oµ Smal∞ ├ anΣ tha⌠ describeΣ iε thσ Manual«á I⌠á i≤ ì
  19. recommendeΣá thσá use≥á purchasσ hi≤ manua∞ fo≥ ßá morσá completσ ì
  20. treatmen⌠ oµ Smal∞ C.
  21.  
  22.  
  23. Fo≥ informatioε regardinτ thσ content≤ anΣ structurσ oµ thσ Smal∞ ì
  24. ├ librar∙, refe≥ t∩ thσ filσ CLIB.DOC and Hendrix's Manual.
  25.  
  26.  
  27. Thi≤á compile≥á wa≤ originall∙ obtaineΣ froφ Micr∩ Cornucopißá iε ì
  28. Decembe≥ 198│ a≤ versioε 2.03A«á Thσ package¼á a≤ received¼á  wa≤ ì
  29. pu⌠ togethe≥ b∙ Bil∞ Randlσ anΣ se⌠ u≡ fo≥ usσ witΦá ASM.COM«á I⌠ ì
  30. wa≤á upgradeΣ t∩ usσ Microsoft'≤ M80/L8░ t∩ takσ advantagσ oµ thσ ì
  31. feature≤á oµá thi≤ packagσ anΣ subsequentl∙ i⌠á wa≤á cleaneΣá up¼ ì
  32. upgradeΣá t∩ usσ thσ hasΦ searchinτ functioε anΣ ß dynamiπ memor∙ ì
  33. scheme«á Refe≥á t∩ thσ filσ CC.DE╞ fo≥ ßá completσá chronologica∞ ì
  34. histor∙á oµá change≤ anΣ detail≤ regardinτ module≤á o≥á function≤ ì
  35. changed«á I⌠á i≤á assumeΣ thσ use≥ i≤ somewha⌠ familia≥ witΦá thσ ì
  36. M80/L8░ software.
  37.  
  38.  
  39. Thi≤á compile≥ contain≤ mos⌠ oµ thσ function≤ anΣ improvement≤ oµ ì
  40. J« E« Hendrix'≤ Versioε 2.▒ compiler« Iε additioε t∩ hi≤ upgrade≤ ì
  41. thσ followinτ havσ beeε installed:
  42.  
  43.      * - Abort via Control-X when the -p option is used
  44.  
  45.      * - Global initialization option -i
  46.  
  47.      * - No boot option -n
  48.  
  49.      * - static Type Specifiers for global declarations
  50.  
  51.      * - Conditional operator {expr1 ? expr2 : expr3}
  52.  
  53.      * - 4k file buffers for input, output and include files
  54.  
  55.      * - Special runtime package for compiler supportèFEATURES and ENHANCEMENTS
  56.  
  57.  
  58. * - Abort via Control-X when the -p option is used
  59.  
  60. Thi≤ featurσ allow≤ thσ use≥ t∩ abor⌠ thσ compile≥ anΣ returεá t∩ ì
  61. CP/═ wheε pauseΣ duσ t∩ error«á Thσ compile≥ ma∙ bσ compileΣ witΦ ì
  62. POL╠á defineΣ t∩ allo≈ operato≥ interruptioε anΣ abortinτá durinτ ì
  63. compilation«á However¼á ╔á personall∙á fel⌠ thi≤ woulΣ slo≈á dowε ì
  64. compilσ timσ anΣ preferreΣ ß simple≥ abor⌠ feature¼ wherσ ╔ coulΣ ì
  65. abor⌠á iµá thσá erro≥ encountereΣ woulΣ affec⌠ thσá res⌠á oµá thσ ì
  66. compilation.
  67.  
  68.  
  69. * - Global initialization option -i
  70.  
  71. Thi≤á featurσ decrease≤ compilatioε time¼á especiall∙ wheεá largσ ì
  72. array≤ arσ declareΣ globally«á Mos⌠ version≤ oµ thσ compile≥á (a⌠ ì
  73. leas⌠á thσá one≤ I'vσ seen)¼á b∙ default¼á initializσ al∞á globa∞ ì
  74. variable≤ t∩ zer∩ b∙ generatinτ eithe≥ D┬ ░ o≥ D╫ 0«á Array≤á arσ ì
  75. initializeΣ viß D┬ 0¼ 0¼ 0¼ 0¼ 0¼ 0¼ « « « « « « « « « .
  76. Thi≤á add≤ significantl∙ t∩ compilσ timσ iµ thσ use≥ ha≤ declareΣ ì
  77. largσá globa∞á arrays«á Thσá compile≥á no≈ issue≤á ßá D╙á εá thu≤ ì
  78. allocatinτ ε byte≤ oµ uninitializeΣ memory«á Iµ thσ -Θ switcΦá i≤ ì
  79. used¼á memor∙á wil∞á bσá initializeΣ t∩ zeroe≤ a≤á before«á A≤á ß ì
  80. furthu≥á examplσ, thσ Eratosthene≤ Primσ Numbe≥á Sievσá take≤á 8░ ì
  81. second≤ t∩ compilσ wheε thσ -Θ switcΦ i≤ useΣ bu⌠ onl∙ 1╖ second≤ ì
  82. iµá i⌠ isn't«á Aε additiona∞ 5╡ second≤ i≤ requireΣ witΦ eacΦ fo≥ ì
  83. assembl∙ anΣ linking.
  84.  
  85.  
  86. * - No boot option -n
  87.  
  88. Thi≤á featurσ allow≤ rapiΣ returε t∩ thσ CP/═ promp⌠á oεá prograφ ì
  89. completioεá a⌠ ß cos⌠ oµ 800Φ byte≤ oµ codσ space«á I⌠ i≤ useΣ iε ì
  90. conjunctioε witΦ thσ runtimσ packagσ iε thσ ├ librar∙ (CLIB.REL)« ì
  91. Iµá thσ thσ -ε switcΦ i≤ useΣ anΣ thσ prograφ contain≤á ßá main(⌐ ì
  92. function¼á D┬ ZZZCC╨ ▒ wil∞ bσ generateΣ b∙ thσ compile≥ prio≥ t∩ ì
  93. thσá EN─ statement«á Iµ i⌠ isn'⌠ specifieΣ thσ compile≥ generate≤ ì
  94. D┬á ZZZCC╨á 0«á Thσ globa∞ variablσ ZZZCC╨ determine≤á wherσá thσ ì
  95. stacδ shoulΣ bσ placeΣ anΣ thσ returε patΦ t∩ CP/M«á Iε short¼ iµ ì
  96. thσ -ε optioε i≤ useΣ thσ stacδ i≤ placeΣ a⌠ thσ basσ oµ thσá CC╨ ì
  97. anΣ thσ prograφ return≤ t∩ CP/═ viß ß returε instruction«á Iµ thσ ì
  98. -εá optioε isn'⌠ specifieΣ thσ stacδ i≤ placeΣ a⌠ thσ basσ oµ thσ ì
  99. BDO╙ anΣ returε i≤ performeΣ viß ß warφ boot«á Refe≥ t∩á CLIB.DO├ ì
  100. anΣ ULINK.MA├ fo≥ detail≤ regardinτ operatioε oµ thi≤ feature.
  101.  
  102.  
  103. * - static Type Specifiers for global declarations
  104.  
  105. Globa∞á variable≤á arσ morσ rapidl∙ accesseΣ (botΦá fetchinτá anΣ ì
  106. storing⌐á anΣ requirσ les≤ codσ t∩ acces≤ thaεá loca∞á variables« ì
  107. Refe≥áá t∩á Chapte≥á 1╣á oµá Hendrix'≤á manua∞á fo≥á ßáá completσ ì
  108. explanation«á Mos⌠ Smal∞ ├ compiler≤ makσ al∞ globa∞ declaration≤ ì
  109. public«á Thi≤á obviousl∙á present≤ ß probleφ (especiall∙ fo≥á thσ ìèvariable≤ π anΣ i⌐ iε takinτ ful∞ advantagσ oµ thi≤ feature«á Thσ ì
  110. statiπ typσ specifie≥ implie≤ tha⌠ thσ variablσ shoulΣ bσá memor∙ ì
  111. resident¼ ye⌠ knowε onl∙ t∩ thσ modulσ i⌠ i≤ compileΣ in« Thi≤ i≤ ì
  112. accomplisheΣá simpl∙á b∙á generatinτá ß singlσá coloεá fo≥á type≤ ì
  113. specifieΣ a≤ statiπ anΣ thσ origina∞ doublσ coloε fo≥ thosσá tha⌠ ì
  114. arσ not.
  115.  
  116.  
  117. * - Conditional operator {expr1 ? expr2 : expr3}
  118.  
  119. Thi≤á i≤ jus⌠ anothe≥ enhancemen⌠ t∩ brinτ Smal∞ ├ close≥ t∩á Biτ ì
  120. C«á Thi≤á operato≥á i≤ describeΣ quitσ thoroughl∙ iεá Kernigaεá ª ì
  121. Ritchie'≤á "Thσá ├ Programminτ Languageó anΣ work≤ a≤á specified« ì
  122. Thσá use≥á shoulΣá tr∙ thσ example≤ iεá thie≥á manual«á Thσá codσ ì
  123. generateΣá b∙ thi≤ operato≥ i≤ almos⌠ exactl∙ thσ samσ a≤ aεá if-ì
  124. elsσ statement¼ howeve≥ iµ doe≤ leaΣ t∩ morσ succinc⌠ anΣ elegan⌠ ì
  125. codσ a⌠ thσ sourcσ level.
  126.  
  127.  
  128. * - 4k file buffers for input, output and include files
  129.  
  130. Anothe≥á enhancemen⌠á whicΦ reduce≤ compilσ time«á Mos⌠á Smal∞á ├ ì
  131. compiler≤ usσ 12╕ bytσ filσ buffer≤ fo≥ filσ I/O« Thi≤ i≤ readil∙ ì
  132. noticeΣá wheεá onσá start≤ t∩ compilσ anΣ listen≤á t∩á thσá disk≤ ì
  133. churn¼á churn¼ churn¼ churε anΣ then¼ churε somσ more« Obviously¼ ì
  134. wheεá churning¼á yo⌡ ain'⌠ compiling«á Onσ wa∙ t∩ eliminatσá thi≤ ì
  135. timσ wastinτ activit∙ i≤ t∩ increasσ thσ sizσ oµ thσ filσ buffer≤ ì
  136. sucΦá tha⌠á large≥á portion≤ oµ sourcσ anΣá outpu⌠á codσá ma∙á bσ ì
  137. handled« Aε added¼ bu⌠ unproven¼ featurσ i≤ les≤ wea≥ anΣ tea≥ oε ì
  138. thσ disδ drives.
  139.  
  140. * - Special runtime package for compiler support
  141.  
  142. Thσ Runtimσ Modulσ useΣ witΦ thi≤ compile≥ wa≤ originall∙ writteε ì
  143. iε ├ anΣ containeΣ assembl∙ languagσ enhancements.(╔ thinδ !⌐ Thσ ì
  144. presen⌠á modulσ CCRTL.MA├ contain≤ mos⌠ oµ thσ routine≤á requireΣ ì
  145. b∙á thσá compile≥ anΣ i≤ structureΣ arounΣ thσ 4δá filσá buffers« ì
  146. LimiteΣá I/╧á redirection¼á argv/argπ handlinτ anΣ specia∞á abor⌠ ì
  147. feature≤ arσ included«á Thσ resultan⌠ sizσ oµ thσ compile≥á afte≥ ì
  148. linkinτá CCRTL.REL¼áá CC1.REL¼á CC2.REL¼á CC3.REL¼á CC4.REL¼á anΣ ì
  149. searchinτá CLIB.RE╠ t∩ picδ u≡ ß fe≈ necessar∙ functioε i≤ ╝ 29K« ì
  150. Smaller than most.
  151.  
  152.  
  153. Threσ submi⌠ file≤ arσ includeΣ witΦ thσ source¼ CCM.SUB¼ CCR.SU┬ ì
  154. anΣ CCC.SUB« Thesσ file≤ wil∞ producσ m8░ sourcσ files(.mac)¼ l8░ ì
  155. sourcσá files(.rel⌐ anΣ ß fina∞ objec⌠ file(.com)¼á respectively« ì
  156. Thσá use≥ i≤ encourageΣ t∩ examinσ and/o≥ modif∙ thesσá file≤á t∩ ì
  157. mee⌠ hi≤ o≥ he≥ owε particula≥ needs.
  158.  
  159. Onσá fina∞á note¼á iε casσ yo⌡ haven'⌠ haΣá acces≤á t∩á Hendrix'≤ ì
  160. manual«á I⌠ i≤ no⌠ necessar∙ t∩ specif∙ externa∞ function≤ iε thσ ì
  161. source«á Thσá compile≥á generate≤á thσ necessar∙á codσá t∩á causσ ì
  162. module≤á iεá CLIB.RE╠á t∩á automaticall∙ bσá linkeΣá wheεá i⌠á i≤ ì
  163. searched by L80.èUSING THE COMPILER
  164.  
  165. Thσ majo≥ differencσ betweeε usinτ thi≤ compile≥ anΣ Hendrix'≤ i≤ ì
  166. thi≤ compile≥ doe≤ no⌠ creatσ ß defaul⌠ outpu⌠ file« Iµ n∩ outpu⌠ ì
  167. filσ i≤ specified¼ thσ outpu⌠ wil∞ g∩ t∩ thσ consolσ wherσ i⌠ ma∙ ì
  168. bσ stoppeΣ anΣ starteΣ viß Contro∞ ╙ anΣ Contro∞ Q« Iµ thσ outpu⌠ ì
  169. i≤á suspendeΣ b∙ Contro∞ S¼á Contro∞ ├ ma∙ bσ useΣ t∩á abor⌠á thσ ì
  170. compile«á Thσá compile≥ i≤ invokeΣ b∙ runninτ thσ prograφá cc.coφ ì
  171. followeΣ b∙ thσ desireΣ option≤ (iε thσ runstring)« Somσ example≤ ì
  172. follow:
  173.  
  174. cc
  175.      compile console input to console output
  176.  
  177. cc test.c
  178.      compile test.c direct output to console
  179.  
  180. cc test.c -p -a -l2
  181.      compile test.c direct output and source to console
  182.                        pause on errors and sound bell
  183.  
  184. cc test.c >test.mac
  185.      compile test.c direct output and source to console
  186.                        pause on errors and sound bell
  187.  
  188. cc test.c >test.mac -p -a 
  189.      compile test.c direct output to the file test.mac
  190.                        pause on errors and sound bell
  191.  
  192. cc test.c new.c >test.mac -l2 -i
  193.      compile test.c and new.c direct output to test.mac
  194.                       display source on screen
  195.                       initialize global variables to zero
  196.  
  197. cc test.c >test.mac -o -n -l1
  198.      compile test.c direct output to test.mac
  199.                       optimize for size over speed
  200.                       generate no boot flag
  201.                       insert source in output file as comments
  202.  
  203.  
  204.  
  205. COMPILER OPTIONS (SWITCHES)
  206.  
  207.  
  208.      -a   sound alarm on errors
  209.      -i   initialize global variables to zero
  210.      -l1  insert as comments in output file *
  211.      -l2  display source on screen as compile progresses *
  212.      -n   set noboot flag
  213.      -o   optimize for size over speed
  214.      -p   pause on errors
  215.  
  216.  
  217. * only one of these may be specifiedèCOMPILING THE COMPILER
  218.  
  219. Compilinτ thσ compile≥ i≤ n∩ differen⌠ theε compilinτ an∙ othe≥ π ì
  220. program«á Wha⌠ i≤ differen⌠ thaε norma∞ i≤ thσ linkinτ procedure« ì
  221. Thσ filσ CCRTL.RE╠ (├ Compile≥ Ruε Timσ Library⌐ shoulΣ bσ linkeΣ ì
  222. firs⌠á t∩ ensurσ tha⌠ modulσ satisfie≤ it≤ entr∙ point≤ prio≥á t∩ ì
  223. searchinτ CLIB.REL.
  224.  
  225. Thσ submi⌠ filσ CCCC.SU┬ provide≤ aε examplσ oµ prope≥ compiling¼ ì
  226. assembling and linking of of this compiler.
  227.  
  228.  
  229. FUTURE OF THE COMPILER
  230.  
  231. Needles≤á t∩ sa∙ Smal∞ ├ ha≤ comσ ß lonτ wa∙ sincσ Roε Caiε firs⌠ ì
  232. presenteΣá i⌠ iε Ma∙ oµ 1980«á I⌠ i≤ m∙ firφ belieµ tha⌠ i⌠á wil∞ ì
  233. continuσá t∩ gro≈ unti∞ i⌠ reache≤ ß higΦ leve∞ oµá compatabilit∙ ì
  234. witΦ ├ a≤ describeΣ b∙ ╦ ª R«á Iε it'≤ presen⌠ form¼á i⌠ i≤ quitσ ì
  235. competetivσá witΦ man∙ oµ thσ CP/═ 8░ compiler≤ presentl∙ oεá thσ ì
  236. market. 
  237.  
  238.