home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
-
-
-
- IF-ELSE-ENDIF Documentation
-
-
- For Version 1.0
-
-
- Written by: Marc C. Brooks
- 1124 Redman Rd.
- St. Louis, MO 63043
- (314)741-4465 (voice)
-
-
-
-
- INTRODUCTION
-
- I╞á anΣ it≤ companioε program≤ (ELSE¼á ENDI╞ anΣá GOTO⌐á arσ ì
- direc⌠á out-growth≤á oµá DaviΣ Kirkland'≤ versioε oµá thσá SKIPI╞ ì
- prograφ a≤ printeΣ iε Dr«á Dobb'≤ Journal«á The∙ sharσ mucΦ codσ ì
- witΦá thσ SKIPI╞ anΣ ╔ aφ eternall∙ gratefu∞ fo≥á Mr«á Kirkland'≤ ì
- inspiration.
-
- I╞á i≤ designeΣ t∩ allo≈ conditiona∞ executioε oµ statement≤ ì
- withiεá ß CP/═ submi⌠ file«á Becausσ oµ thσ methoΣ useΣ t∩á ski≡ ì
- statement≤ iε thσ submi⌠ file¼á I╞ canno⌠ bσ useΣ iε CP/M+«á Fo≥ ì
- al∞ othe≥ version≤ oµ CP/M-80¼á though¼á I╞ lend≤ thσ versitilit∙ ì
- oµá thσ standarΣ structureΣ programminτ construc⌠á IF-ELSE-ENDIF« ì
- GOT╧ i≤ ß companioε prograφ whosσ neeΣ wa≤ discovereΣ whilσ usinτ ì
- IF«á I⌠á allow≤á forwarΣ (backwarΣ i≤ impossible⌐ jump≤á iεá thσ ì
- submi⌠ t∩ labeleΣ points.
-
- IF¼ ELSE¼ anΣ GOTO¼ wheε executσ froφ thσ CC╨ bu⌠ no⌠ withiε ì
- ßá submi⌠á file¼áá wil∞á explaiεá thei≥á usσá anΣá syntax«á Thi≤ ì
- document'≤á maiε purposσ i≤ t∩ givσ example≤ iε thσ usσ oµá thesσ ì
- four programs.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 1 of 4 IF Documentation Version 1.0
-
-
-
-
-
-
-
-
-
-
- I. IF Summary
-
- I╞ i≤ thσ maiε prograφ fo≥ thi≤ package« I⌠ make≤ decision≤ ì
- oεá whicΦ logica∞ brancΦ oµ thσ submi⌠ shoulΣ bσ taken«á Iµá thσ ì
- conditioε specifieΣ b∙ thσ I╞ commanΣ i≤ true¼ al∞ command≤ u≡ t∩ ì
- thσá matchinτá ELS┼ o≥ ENDI╞ wil∞ bσ executed«á Iµá aεá ELS┼á i≤ ì
- encountereΣá whilσ executinτ command¼á t∩ followinτ command≤ wil∞ ì
- bσá skippeΣá unti∞ thσ matchinτ ENDI╞á i≤á encountered«á Iµá thσ ì
- conditioεá i≤á false¼á command≤ u≡ t∩ anΣ includinτ thσá matchinτ ì
- ELS┼ (iµ i⌠ exists⌐ o≥ ENDI╞ arσ skipped«á I╞ ha≤ fivσá command≤ ì
- whicΦ decidσ thσ fatσ oµ thσ submit« The∙ are:
-
- A[mbig] fn Iµá thσ fε whicΦ appear≤ oε thσ commanΣá linσ ì
- áááááááááááááááááááái≤á aεá ambiguou≤ filσ referencσá (i.e«á onσ ì
- ááááááááááááááááááááwitΦ aε ¬ o≥ ┐ iε it⌐ thσ conditioε i≤ true.
-
- áááááE[xists] fn Iµ thσ filσ referenceΣ b∙ thσ fε giveε oε thσ ì
- áááááááááááááááááááácommand line exists, the condition is true.
-
- M[issing] fn Iµ thσ filσ referenceΣ b∙ thσ fε giveε oε thσ ì
- áááááááááááááááááááácommanΣ linσ caε no⌠ bσ found¼á thσ conditioε ì
- áááááááááááááááááááái≤ true.
-
- N[ull] (fn) Iµá thσ fε itselµ i≤ missinτ froφ thσ commanΣ ì
- ááááááááááááááááááááline¼á thσ conditioε i≤ true«á Notσ tha⌠ thσ ì
- ááááááááááááááááááááparathesi≤ '()º d∩ NO╘ appea≥ iε actua∞ use.
-
- áááááZ[ero] fn Iµ thσ filσ referenceΣ b∙ thσ fε giveε oε thσ ì
- áááááááááááááááááááácommanΣá linσ caε no⌠ bσ founΣ o≥ i≤ oµá zer∩ ì
- áááááááááááááááááááálength¼ thσ conditioε i≤ true.
-
- Notσ tha⌠ onl∙ thσ firs⌠ characte≥ oµ thσ keyworΣ (┴ fo≥ Ambiτ o≥ ì
- whateve≥á i≤á significant«á Al∞á othe≥ character≤ oµá thσá firs⌠ ì
- paramete≥ arσ ignored«á Thσ seconΣ paramete≥ MUS╘ exis⌠ fo≥á al∞ ì
- commanΣá excep⌠ witΦ thσ Nul∞ command«á Iµ aε invaliΣ keyworΣ i≤ ì
- giveεá o≥ thσ fε i≤ missinτ wheε needed¼á I╞ wil∞ givσá aεá erro≥ ì
- messagσá anΣ ski≡ t∩ thσ matchinτ ENDI╞ statement«á Iµ an∙ othe≥ ì
- error occurs, IF will abort the submit.
-
-
- II. ELSE Summary
-
- ELS┼á i≤ ß prograφ tha⌠ automaticall∙ skip≤ al∞ command≤á u≡ ì
- t∩á anΣá includigεá thσ matchinτ IF«á I⌠á i≤á skippeΣá wheεá thσ ì
- preceedinτá I╞á i≤ false¼á s∩ i⌠ wil∞ onl∙ bσ executeΣá wheεá thσ ì
- preceedinτ I╞ i≤ true«á Iε tha⌠ case¼á ELS┼ shoulΣ ski≡ thσ ELS┼ ì
- clausσá u≡á t∩ thσ ENDI╞ marker«á Fo≥ tha⌠ reason¼á ELS┼á alway≤ ì
- skip≤ t∩ thσ matchinτ ENDIF«á IF-ELSE-ENDI╞ group≤ ma∙ bσ nesteΣ ì
- t∩á an∙á deptΦá anΣ ELS┼ wil∞ ski≡ t∩á it≤á ENDIF«á Iµá ELS┼á i≤ ì
- executeΣ b∙ thσ CC╨ outsidσ ß submit¼ i⌠ wil∞ explaiε it≤ usσ anΣ ì
- exit« Iµ i⌠ run≤ int∩ an∙ errors¼ i⌠ wil∞ terminatσ thσ submit.
-
-
-
-
- Page 2 of 4 IF Documentation Version 1.0
-
-
-
-
-
-
-
-
-
-
- III. ENDIF Summary
-
- ENDI╞ i≤ jus⌠ ß place-marke≥ fo≥ I╞ anΣ ELSE¼ bu⌠ i⌠ mus⌠ bσ ì
- aεá executablσá prograφ becausσ i⌠ wil∞ bσ loadeΣ ever∙ timσá thσ ì
- ELS┼ clausσ oµ aε I╞ i≤ executed«á Iε it≤ curren⌠ form¼á i⌠ jus⌠ ì
- returns to the CCP.
-
-
- IV. GOTO Summary
-
- GOT╧ i≤ useΣ t∩ providσ unconditiona∞ skippinτ oµ step≤ iε ß ì
- submi⌠ procedure« T∩ usσ it¼ jus⌠ pu⌠ GOT╧ 'labelº iε thσ submi⌠ ì
- prograφ wherσ desired«á Somewherσ late≥ iε thσ submit¼á placσá ß ì
- labe∞á a≤ ß commen⌠ line«á Label≤ takσ thσ forφ oµ an∙ strinτ oµ ì
- non-whitespacσ character≤ terminateΣ b∙ thσ enΣ oµ thσ linσ o≥á ß ì
- whitespacσá character«á Whitespacσ character≤ arσ an∙ character≤ ì
- lowe≥ iε thσ ASCI╔ collatinτ sequencσ thaε '!º (i.e«á space¼ tab¼ ì
- etc.) Some examples of GOTO are:
-
- GOTO END-OF-COMPILE
- GOTO SKIP terminate the rest of the submit
- GOTO 1200
-
- Iε thσ seconΣ example¼ thσ tex⌠ followinτ thσ worΣ 'SKIPº i≤ ì
- al∞á ignored«á Thσá correspondinτ t∩ thσ abovσá GOT╧á statement≤ ì
- might look like this:
-
- ;END-OF-COMPIL┼ Al∞ thσ passe≤ oµ thσ compilσ arσ done
- ;SKIP
- ;1200
-
- Oncσá again¼á iε thσ firs⌠ example¼á thσ tex⌠ followinτá thσ ì
- labe∞ i≤ completel∙ ignored« Also¼ duσ t∩ limitation≤ withiε thσ ì
- CCP, the case of the label characters is not significant.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 3 of 4 IF Documentation Version 1.0
-
-
-
-
-
-
-
-
-
-
- V. EXAMPLES
-
- Example 1. pp -o edit.tm1 edit.c
- p1 -o edit.tm2 edit.tm1
- era edit.tm1
- IF ZERO EDIT.TM2 did the p1 passed find errors ?
- era edit.tm2
- GOTO LIST-FILE
- ELSE
- p280 -o edit.s edit.tm2
- era edit.tm2
- as80 edit.s
- era edit.s
- link -o edit.com edit.o
- ENDIF
- IF ZERO EDIT.COM did the link fail ?
- ;LIST-FILE ; list the source file
- list edit.c
- ENDIF
-
- Example 2: IF Null $1
- ;ERROR -- You must supply a file to be compiled
- ELSE
- IF Ambig $1
- ;ERRO╥á-- Yo⌡áma∙áno⌠ usσáambiguou≤áfilσ names
- ELSE
- IF Missing $1.bas
- ;ERROR -- I can't find $1
- ELSE
- ; all okay so lets compile the program
- CB80 $1.bas $3
- LK80 $1 my.lib
- IF Null $2
- ELSE
- list $1.bas
- ENDIF
- ENDIF
- ENDI╞ ╗ thesσ tw∩ ENDIF'≤ aren'⌠ necessary,
- ENDIF ; just good programming.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 4 of 4 IF Documentation Version 1.0
-
-
-
-
-