home *** CD-ROM | disk | FTP | other *** search
-
- Small - C Documentation
-
- Version 2.10 10/8/84
-
-
- by
-
-
- F. A. Scacchitti
- 25 Glenview Lane
- Rochester, NY 14609
- (716) 482 - 7159
-
-
- Thi≤á documen⌠á i≤ intendeΣ t∩ supplemen⌠ J«á E«á Hendrix'≤á "Thσ ì
- Smal∞á ├ Handbookó anΣ wil∞ onl∙ discus≤ thσ difference≤á betweeε ì
- thi≤ versioε oµ Smal∞ ├ anΣ tha⌠ describeΣ iε thσ Manual«á I⌠á i≤ ì
- recommendeΣá thσá use≥á purchasσ hi≤ manua∞ fo≥ ßá morσá completσ ì
- treatmen⌠ oµ Smal∞ C.
-
-
- Fo≥ informatioε regardinτ thσ content≤ anΣ structurσ oµ thσ Smal∞ ì
- ├ librar∙, refe≥ t∩ thσ filσ CLIB.DOC and Hendrix's Manual.
-
-
- Thi≤á compile≥á wa≤ originall∙ obtaineΣ froφ Micr∩ Cornucopißá iε ì
- Decembe≥ 198│ a≤ versioε 2.03A«á Thσ package¼á a≤ received¼á wa≤ ì
- pu⌠ togethe≥ b∙ Bil∞ Randlσ anΣ se⌠ u≡ fo≥ usσ witΦá ASM.COM«á I⌠ ì
- wa≤á upgradeΣ t∩ usσ Microsoft'≤ M80/L8░ t∩ takσ advantagσ oµ thσ ì
- feature≤á oµá thi≤ packagσ anΣ subsequentl∙ i⌠á wa≤á cleaneΣá up¼ ì
- upgradeΣá t∩ usσ thσ hasΦ searchinτ functioε anΣ ß dynamiπ memor∙ ì
- scheme«á Refe≥á t∩ thσ filσ CC.DE╞ fo≥ ßá completσá chronologica∞ ì
- histor∙á oµá change≤ anΣ detail≤ regardinτ module≤á o≥á function≤ ì
- changed«á I⌠á i≤á assumeΣ thσ use≥ i≤ somewha⌠ familia≥ witΦá thσ ì
- M80/L8░ software.
-
-
- Thi≤á compile≥ contain≤ mos⌠ oµ thσ function≤ anΣ improvement≤ oµ ì
- J« E« Hendrix'≤ Versioε 2.▒ compiler« Iε additioε t∩ hi≤ upgrade≤ ì
- thσ followinτ havσ beeε installed:
-
- * - Abort via Control-X when the -p option is used
-
- * - Global initialization option -i
-
- * - No boot option -n
-
- * - static Type Specifiers for global declarations
-
- * - Conditional operator {expr1 ? expr2 : expr3}
-
- * - 4k file buffers for input, output and include files
-
- * - Special runtime package for compiler support
- èFEATURES and ENHANCEMENTS
-
-
- * - Abort via Control-X when the -p option is used
-
- Thi≤ featurσ allow≤ thσ use≥ t∩ abor⌠ thσ compile≥ anΣ returεá t∩ ì
- CP/═ wheε pauseΣ duσ t∩ error«á Thσ compile≥ ma∙ bσ compileΣ witΦ ì
- POL╠á defineΣ t∩ allo≈ operato≥ interruptioε anΣ abortinτá durinτ ì
- compilation«á However¼á ╔á personall∙á fel⌠ thi≤ woulΣ slo≈á dowε ì
- compilσ timσ anΣ preferreΣ ß simple≥ abor⌠ feature¼ wherσ ╔ coulΣ ì
- abor⌠á iµá thσá erro≥ encountereΣ woulΣ affec⌠ thσá res⌠á oµá thσ ì
- compilation.
-
-
- * - Global initialization option -i
-
- Thi≤á featurσ decrease≤ compilatioε time¼á especiall∙ wheεá largσ ì
- array≤ arσ declareΣ globally«á Mos⌠ version≤ oµ thσ compile≥á (a⌠ ì
- leas⌠á thσá one≤ I'vσ seen)¼á b∙ default¼á initializσ al∞á globa∞ ì
- variable≤ t∩ zer∩ b∙ generatinτ eithe≥ D┬ ░ o≥ D╫ 0«á Array≤á arσ ì
- initializeΣ viß D┬ 0¼ 0¼ 0¼ 0¼ 0¼ 0¼ « « « « « « « « « .
- Thi≤á add≤ significantl∙ t∩ compilσ timσ iµ thσ use≥ ha≤ declareΣ ì
- largσá globa∞á arrays«á Thσá compile≥á no≈ issue≤á ßá D╙á εá thu≤ ì
- allocatinτ ε byte≤ oµ uninitializeΣ memory«á Iµ thσ -Θ switcΦá i≤ ì
- used¼á memor∙á wil∞á bσá initializeΣ t∩ zeroe≤ a≤á before«á A≤á ß ì
- furthu≥á examplσ, thσ Eratosthene≤ Primσ Numbe≥á Sievσá take≤á 8░ ì
- second≤ t∩ compilσ wheε thσ -Θ switcΦ i≤ useΣ bu⌠ onl∙ 1╖ second≤ ì
- iµá i⌠ isn't«á Aε additiona∞ 5╡ second≤ i≤ requireΣ witΦ eacΦ fo≥ ì
- assembl∙ anΣ linking.
-
-
- * - No boot option -n
-
- Thi≤á featurσ allow≤ rapiΣ returε t∩ thσ CP/═ promp⌠á oεá prograφ ì
- completioεá a⌠ ß cos⌠ oµ 800Φ byte≤ oµ codσ space«á I⌠ i≤ useΣ iε ì
- conjunctioε witΦ thσ runtimσ packagσ iε thσ ├ librar∙ (CLIB.REL)« ì
- Iµá thσ thσ -ε switcΦ i≤ useΣ anΣ thσ prograφ contain≤á ßá main(⌐ ì
- function¼á D┬ ZZZCC╨ ▒ wil∞ bσ generateΣ b∙ thσ compile≥ prio≥ t∩ ì
- thσá EN─ statement«á Iµ i⌠ isn'⌠ specifieΣ thσ compile≥ generate≤ ì
- D┬á ZZZCC╨á 0«á Thσ globa∞ variablσ ZZZCC╨ determine≤á wherσá thσ ì
- stacδ shoulΣ bσ placeΣ anΣ thσ returε patΦ t∩ CP/M«á Iε short¼ iµ ì
- thσ -ε optioε i≤ useΣ thσ stacδ i≤ placeΣ a⌠ thσ basσ oµ thσá CC╨ ì
- anΣ thσ prograφ return≤ t∩ CP/═ viß ß returε instruction«á Iµ thσ ì
- -εá optioε isn'⌠ specifieΣ thσ stacδ i≤ placeΣ a⌠ thσ basσ oµ thσ ì
- BDO╙ anΣ returε i≤ performeΣ viß ß warφ boot«á Refe≥ t∩á CLIB.DO├ ì
- anΣ ULINK.MA├ fo≥ detail≤ regardinτ operatioε oµ thi≤ feature.
-
-
- * - static Type Specifiers for global declarations
-
- Globa∞á variable≤á arσ morσ rapidl∙ accesseΣ (botΦá fetchinτá anΣ ì
- storing⌐á anΣ requirσ les≤ codσ t∩ acces≤ thaεá loca∞á variables« ì
- Refe≥áá t∩á Chapte≥á 1╣á oµá Hendrix'≤á manua∞á fo≥á ßáá completσ ì
- explanation«á Mos⌠ Smal∞ ├ compiler≤ makσ al∞ globa∞ declaration≤ ì
- public«á Thi≤á obviousl∙á present≤ ß probleφ (especiall∙ fo≥á thσ ìèvariable≤ π anΣ i⌐ iε takinτ ful∞ advantagσ oµ thi≤ feature«á Thσ ì
- statiπ typσ specifie≥ implie≤ tha⌠ thσ variablσ shoulΣ bσá memor∙ ì
- resident¼ ye⌠ knowε onl∙ t∩ thσ modulσ i⌠ i≤ compileΣ in« Thi≤ i≤ ì
- accomplisheΣá simpl∙á b∙á generatinτá ß singlσá coloεá fo≥á type≤ ì
- specifieΣ a≤ statiπ anΣ thσ origina∞ doublσ coloε fo≥ thosσá tha⌠ ì
- arσ not.
-
-
- * - Conditional operator {expr1 ? expr2 : expr3}
-
- Thi≤á i≤ jus⌠ anothe≥ enhancemen⌠ t∩ brinτ Smal∞ ├ close≥ t∩á Biτ ì
- C«á Thi≤á operato≥á i≤ describeΣ quitσ thoroughl∙ iεá Kernigaεá ª ì
- Ritchie'≤á "Thσá ├ Programminτ Languageó anΣ work≤ a≤á specified« ì
- Thσá use≥á shoulΣá tr∙ thσ example≤ iεá thie≥á manual«á Thσá codσ ì
- generateΣá b∙ thi≤ operato≥ i≤ almos⌠ exactl∙ thσ samσ a≤ aεá if-ì
- elsσ statement¼ howeve≥ iµ doe≤ leaΣ t∩ morσ succinc⌠ anΣ elegan⌠ ì
- codσ a⌠ thσ sourcσ level.
-
-
- * - 4k file buffers for input, output and include files
-
- Anothe≥á enhancemen⌠á whicΦ reduce≤ compilσ time«á Mos⌠á Smal∞á ├ ì
- compiler≤ usσ 12╕ bytσ filσ buffer≤ fo≥ filσ I/O« Thi≤ i≤ readil∙ ì
- noticeΣá wheεá onσá start≤ t∩ compilσ anΣ listen≤á t∩á thσá disk≤ ì
- churn¼á churn¼ churn¼ churε anΣ then¼ churε somσ more« Obviously¼ ì
- wheεá churning¼á yo⌡ ain'⌠ compiling«á Onσ wa∙ t∩ eliminatσá thi≤ ì
- timσ wastinτ activit∙ i≤ t∩ increasσ thσ sizσ oµ thσ filσ buffer≤ ì
- sucΦá tha⌠á large≥á portion≤ oµ sourcσ anΣá outpu⌠á codσá ma∙á bσ ì
- handled« Aε added¼ bu⌠ unproven¼ featurσ i≤ les≤ wea≥ anΣ tea≥ oε ì
- thσ disδ drives.
-
- * - Special runtime package for compiler support
-
- Thσ Runtimσ Modulσ useΣ witΦ thi≤ compile≥ wa≤ originall∙ writteε ì
- iε ├ anΣ containeΣ assembl∙ languagσ enhancements.(╔ thinδ !⌐ Thσ ì
- presen⌠á modulσ CCRTL.MA├ contain≤ mos⌠ oµ thσ routine≤á requireΣ ì
- b∙á thσá compile≥ anΣ i≤ structureΣ arounΣ thσ 4δá filσá buffers« ì
- LimiteΣá I/╧á redirection¼á argv/argπ handlinτ anΣ specia∞á abor⌠ ì
- feature≤ arσ included«á Thσ resultan⌠ sizσ oµ thσ compile≥á afte≥ ì
- linkinτá CCRTL.REL¼áá CC1.REL¼á CC2.REL¼á CC3.REL¼á CC4.REL¼á anΣ ì
- searchinτá CLIB.RE╠ t∩ picδ u≡ ß fe≈ necessar∙ functioε i≤ ╝ 29K« ì
- Smaller than most.
-
-
- Threσ submi⌠ file≤ arσ includeΣ witΦ thσ source¼ CCM.SUB¼ CCR.SU┬ ì
- anΣ CCC.SUB« Thesσ file≤ wil∞ producσ m8░ sourcσ files(.mac)¼ l8░ ì
- sourcσá files(.rel⌐ anΣ ß fina∞ objec⌠ file(.com)¼á respectively« ì
- Thσá use≥ i≤ encourageΣ t∩ examinσ and/o≥ modif∙ thesσá file≤á t∩ ì
- mee⌠ hi≤ o≥ he≥ owε particula≥ needs.
-
- Onσá fina∞á note¼á iε casσ yo⌡ haven'⌠ haΣá acces≤á t∩á Hendrix'≤ ì
- manual«á I⌠ i≤ no⌠ necessar∙ t∩ specif∙ externa∞ function≤ iε thσ ì
- source«á Thσá compile≥á generate≤á thσ necessar∙á codσá t∩á causσ ì
- module≤á iεá CLIB.RE╠á t∩á automaticall∙ bσá linkeΣá wheεá i⌠á i≤ ì
- searched by L80.
- èUSING THE COMPILER
-
- Thσ majo≥ differencσ betweeε usinτ thi≤ compile≥ anΣ Hendrix'≤ i≤ ì
- thi≤ compile≥ doe≤ no⌠ creatσ ß defaul⌠ outpu⌠ file« Iµ n∩ outpu⌠ ì
- filσ i≤ specified¼ thσ outpu⌠ wil∞ g∩ t∩ thσ consolσ wherσ i⌠ ma∙ ì
- bσ stoppeΣ anΣ starteΣ viß Contro∞ ╙ anΣ Contro∞ Q« Iµ thσ outpu⌠ ì
- i≤á suspendeΣ b∙ Contro∞ S¼á Contro∞ ├ ma∙ bσ useΣ t∩á abor⌠á thσ ì
- compile«á Thσá compile≥ i≤ invokeΣ b∙ runninτ thσ prograφá cc.coφ ì
- followeΣ b∙ thσ desireΣ option≤ (iε thσ runstring)« Somσ example≤ ì
- follow:
-
- cc
- compile console input to console output
-
- cc test.c
- compile test.c direct output to console
-
- cc test.c -p -a -l2
- compile test.c direct output and source to console
- pause on errors and sound bell
-
- cc test.c >test.mac
- compile test.c direct output and source to console
- pause on errors and sound bell
-
- cc test.c >test.mac -p -a
- compile test.c direct output to the file test.mac
- pause on errors and sound bell
-
- cc test.c new.c >test.mac -l2 -i
- compile test.c and new.c direct output to test.mac
- display source on screen
- initialize global variables to zero
-
- cc test.c >test.mac -o -n -l1
- compile test.c direct output to test.mac
- optimize for size over speed
- generate no boot flag
- insert source in output file as comments
-
-
-
- COMPILER OPTIONS (SWITCHES)
-
-
- -a sound alarm on errors
- -i initialize global variables to zero
- -l1 insert as comments in output file *
- -l2 display source on screen as compile progresses *
- -n set noboot flag
- -o optimize for size over speed
- -p pause on errors
-
-
- * only one of these may be specified
- èCOMPILING THE COMPILER
-
- Compilinτ thσ compile≥ i≤ n∩ differen⌠ theε compilinτ an∙ othe≥ π ì
- program«á Wha⌠ i≤ differen⌠ thaε norma∞ i≤ thσ linkinτ procedure« ì
- Thσ filσ CCRTL.RE╠ (├ Compile≥ Ruε Timσ Library⌐ shoulΣ bσ linkeΣ ì
- firs⌠á t∩ ensurσ tha⌠ modulσ satisfie≤ it≤ entr∙ point≤ prio≥á t∩ ì
- searchinτ CLIB.REL.
-
- Thσ submi⌠ filσ CCCC.SU┬ provide≤ aε examplσ oµ prope≥ compiling¼ ì
- assembling and linking of of this compiler.
-
-
- FUTURE OF THE COMPILER
-
- Needles≤á t∩ sa∙ Smal∞ ├ ha≤ comσ ß lonτ wa∙ sincσ Roε Caiε firs⌠ ì
- presenteΣá i⌠ iε Ma∙ oµ 1980«á I⌠ i≤ m∙ firφ belieµ tha⌠ i⌠á wil∞ ì
- continuσá t∩ gro≈ unti∞ i⌠ reache≤ ß higΦ leve∞ oµá compatabilit∙ ì
- witΦ ├ a≤ describeΣ b∙ ╦ ª R«á Iε it'≤ presen⌠ form¼á i⌠ i≤ quitσ ì
- competetivσá witΦ man∙ oµ thσ CP/═ 8░ compiler≤ presentl∙ oεá thσ ì
- market.
-