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