PREBAÓ                                  =====½                        Á pre-processoò foò BASIC®                        -------------------------­ Copyrighô (c© 198µ bù Greywolf® Lasô revisioî tï thió documentº Jaî 2° 1985® PREBAÓ  takeó á flaô ASCIÉ file¬  addó linå numberó tï  it¬  and¬ optionally¬  resolveó  referenceó tï targeô labels®  Iô caî  alsï resolvå  thå  labeló  withouô linå numbers¬  oò  strið  olä  linå numberó  ouô  oæ á file®  PREBAÓ ió intendeä aó aî aiä  tï  BASIà programmers®  Witè  iô theù caî enteò á prograí iî theiò favoritå texô  editoò  oò worä processor¬  whilå noô worryinç  abouô  linå numbers¬  oò thå targetó foò theiò GOTÏ anä GOSU statements®  Iô haó á numbeò oæ options¬ including:      addinç linå numberó      resolvinç labeló strippinç  olä  linå  numberó  selectioî  oæ  thå  starô  numbeò selectioî oæ thå steð sizå selectioî oæ thå labeì markeò additioî oæ commentó tï thå enä oæ á line¬  showinç targeô labeló  commanä linå executioî (noô yeô availablå iî MS/DOÓ version) PREBAÓ  waó writteî iî Microsofô BASIà (MBASIC© anä waó  compileä witè BASCOM® Therå arå threå files:      PREBAS.DOà -­ Thió document®      PREBAS.COÍ -­ Thå compileä executablå prograí (linkeä tï                    OBSLIB.REL)®      PREBAS.BAÓ -­ Thå BASIà sourcå code® Noteº  É  includå  thå BASIà sourcå sï thaô thå defaultó  caî  bå changeä  (seå Appendiø Á -- Customization© oò sï thaô PREBAÓ  caî bå recompileä tï ruî undeò thå BRUÎ run-timå library® PREBAÓ doeó ruî  undeò thå interpreter¬  buô runó verù slowlù (especiallù  iæ yoõ   arå  resolvinç  labels)®   PREBAÓ  translateó  line-by-linå (writinç eacè linå ouô tï thå ne÷ file)¬  ratheò thaî iî  RAM®  É felô  thaô  speeä  waó lesó importanô thaî á limitatioî  oæ  sizå imposeä bù thå sizå oæ RAM®  However¬  PREBAÓ ió stilì limiteä bù disë capacity¬  needinç rooí foò á filå aô leasô thå samå sizå aó thå inpuô file. Š                             RUNNINÇ PREBAÓ                              =============½ Thå simplesô waù tï executå PREBAÓ ió froí thå commanä linå usinç thå standarä defaultsº A>PREBAÓ B:TEXT Thió  woulä takå aî ASCIÉ (non-document© filå  calleä  TEST¬  anä creatå á ne÷ filå oî thå Bº  drivå calleä TEST.BAS® Thió ne÷ filå woulä havå linå numberó aô thå starô oæ eacè line¬  startinç witè 1° anä incrementinç bù 1° eacè time® Aî "'¢ wilì bå inserteä intï anù linå startinç witè á labeì (identifieä bù aî "@¢ aó itó firsô character.©  Anù referenceó tï thaô labeì wilì bå translateä intï referenceó tï thå actuaì linå number®  Appendeä tï thå enä oæ anù linå  containinç referenceó tï targeô labeló wilì bå  ¢  '^ITO:"¬ theî thå lisô oæ originaì referencå labeló separateä bù commas. Foò example¬ Saù wå haä á filå calleä TESÔ thaô lookeä likå thisº '-----------------------------------------------------------­ §               @TESÔ -­ Á tesô foò PREBAÓ § '-----------------------------------------------------------­ @STARÔ -­ Thió ió thå starô oæ thå program® FOÒ Ê ½ ± TÏ 2°         GOSU @ROUTINÅ NEXÔ Ê § INPUÔ "DÏ YOÕ WANÔ TÏ EXIT"» A¤ IÆ A¤ ½ "Y¢ THEÎ GOTÏ @ENÄ ELSÅ GOTÏ @STARÔ § @ENÄ § ENÄ § § @ROUTINÅ PRINÔ "INSIDÅ ROUTINE¢ RETURÎ Thå commandº A>PREBAÓ B:TESÔ woulä producå á filå calleä TEST.BAÓ thaô lookeä likå thisº 1° '-----------------------------------------------------------­ 2° §            @TESÔ -­ Á tesô foò PREBAÓ 3° § 4° '-----------------------------------------------------------­ 5° '@STARÔ -­ Thió ió thå starô oæ thå program® 6° FOÒ Ê ½ ± TÏ 2° 7°      GOSU 18° §     TOº @ROUTINÅ 8° NEXÔ Ê 9° § 10° INPUÔ "DÏ YOÕ WANÔ TÏ EXIT"» A¤ 11° IÆ A¤ ½ "Y¢ THEÎ GOTÏ 13° ELSÅ GOTÏ 5° §    TOº @END¬ @STARÔŠ12° § 13° '@ENÄ 14° § 15° ENÄ 16° § 17° § 18° '@ROUTINÅ 19° PRINÔ "INSIDÅ ROUTINE¢ 20° RETURÎ Á  morå  compleø examplå caî bå founä iî Appendiø  B®  Also¬  thå sourcå filå (PREBAS.BAS)¬ froí @PARSECÌ oî down¬ waó processeä bù PREBAS. LABELSº =====½ PREBAÓ recognizeó labeló if¬  (A)º  theiò firsô characteò ió  thå markeò character¬  anä (B)º theù arå wholå words® Foò instancå -- supposå  yoõ arå á Cromemcï Sbasiã faî (aó É am)¬  anä yoõ  choså "*¢  aó youò markeò character®  PREBAÓ wilì bå ablå tï telì  thaô "*Getchar¢  ió á label¬  anä wilì noô bå confuseä bù "32± ª  42"¬ "4*8"¬  oò "18ª 47/6"® Iô WILÌ geô confuseä bù somethinç likeº "² *853"¬  thinkinç  thaô *85³ ió á label®  However¬  alì thaô  wilì happeî  ió yoõ wilì geô thå messageº  *84³ AÔ LINÅ 20°  -- TARGEÔ NOÔ FOUNÄ durinç pasó two¬  anä thå "*843¢ wilì remaiî untouched® Unless¬ oæ course¬ yoõ werå foolisè enougè tï labeì á targeô linå witè thå labelº "*843" PREBAÓ  recognizå aó á targeô linå anù linå wherå thå firsô word¬ (whetheò precedeä bù whitå space¬  oò not)¬  ió á labeì (haó  thå markeò  characteò  aó itó firsô char.)®  Iæ therå  arå  duplicatå labels¬ thå firsô onå wilì bå useä aó thå target.                       RUNNINÇ PREBAÓ WITÈ PROMPTÓ                       ==========================½ Iæ yoõ arå unfamiliaò witè thå commanä linå syntaø oæ PREBAS¬ yoõ caî havå iô prompô yoõ foò thå informatioî yoõ need®  Yoõ dï thió bù   jusô   enterinç  itó  namå  oî  thå   commanä   line®   e.g® A>PREBASMBASIà PREBAS)®  PREBAÓ wilì theî asë á serieó oæ questions® Aô anù time¬ yoõ caî aborô thå process¬ bù typinç "X¢ iî responså tï á question¬  anä PREBAÓ wilì aborô thå presenô translation¬  theî asë yoõ iæ yoõ wanô tï dï anotheò file® Iæ yoõ answeò "N¢ tï thió question¬  yoõ wilì exiô froí PREBAS¬ otherwiså yoõ caî starô alì over. Afteò   givinç  PREBAÓ  thå  inpuô  filå  anä  thå  outpuô  file¬ Šrespondinç  witè  aî  escapå  WHAÔ IÓ THÅ NAMÅ OÆ THÅ OUTFILÅ ()¬  PREBAÓ wilì  begiî thå translation¬  keepinç yoõ informeä oæ whaô iô  ió doing. Š Iæ yoõ arå onlù addinç linå numbers¬  yoõ wilì seå thå  followinç display: WRITINÇ TESÔ TÏ TEST.BAÓ WITÈ LINÅ NUMBERÓ  1° ¬ 1° Thå  twï  numberó oî thå enä arå thå starô number¬  anä thå  steð size. Iæ yoõ arå resolvinç labeló iî thå file¬ yoõ wilì seeº PASÓ ONEº RESOLVINÇ LABELÓ IÎ B:TESÔ MARKEÄ BÙ À Thenº PASÓ TWOº WRITINÇ B:TESÔ TÏ B:TEST.BAÓ WITÈ LINÅ NUMBERÓ 1° ¬ 1° WITÈ LABEÌ RESOLUTION® -­ MARKEÒ ½ À PLEASÅ WAIÔ Iæ  youò filå ió á biç one¬  thió mighô takå á weå while¬  sï  bå patienô  (especiallù  iæ you'rå runninç undeò  thå  interpreter)® Noteº  Iæ  youò operatinç systeí haó disë caching¬  likå CPM«  oò largå memorù MS/DOS¬  yoõ mighô noô seå mucè disë activitù foò  á while® Don'ô worry¬ PREBAÓ ió stilì running. Eacè  timå  PREBAÓ  findó á referencå labeì  withouô  á  matchinç targeô label¬ yoõ wilì bå tolä abouô it¬ e.g.: @LABEÌ -­ oî linå 45° -­ noô found® Iæ  PREBAÓ findó anù linå numberó alreadù iî thå infile¬  iô wilì halô processing¬ rinç thå bell¬ anä ask: WARNINÇ -­ numbereä lineó alreadù iî thå file¬ B:TESÔ startinç aô linå numbeò 35° Dï yoõ wisè tï proceeä (strip/overwritå olä numbers© ¿ (Inpuô 'Y§ tï proceeä -­ anythinç elså wilì abort)º Iæ yoõ typå "Y¢ here¬ thå olä linå numberó wilì bå overwritteî bù thå ne÷ oneó -- buô remember¬ thå samå cautioî thaô waó giveî foò strippinç olä linå numberó applieó here. Iæ  yoõ  typå anythinç elså thaî  "Y"¬  yoõ  wilì  seeº  "PROCESÓ ABORTED"¬ anä yoõ wilì bå askeä iæ yoõ wanô tï dï anotheò file. Afteò PREBAÓ haó finisheä processinç youò file¬ yoõ wilì seeº PROCESSEÄ 3¸ LINES¬ NUMBEREÄ FROÍ 1° TÏ 38° DÏ YOÕ WANÔ TÏ NUMBEÒ ANOTHEÒ FILÅ (Y/N)¿ Answeò  "Y¢ tï thió anä PREBAÓ wilì starô askinç questionó  abouô thå  nexô  copù  (witè  thå optionó yoõ choså iî  thå  lasô  pasó througè aó thå ne÷ defaulô options)®  Answeò anythinç  else¬  anä Šyoõ wilì bå returneä tï youò operatinç system.                  EXECUTINÇ PREBAÓ FROÍ THÅ COMMANÄ LINÅ                  =====================================½ PREBAÓ  caî bå executeä froí thå commanä line¬  witè fulì controì oæ  alì  thå options®  Thió allowó foò easù inclusioî  oæ  PREBAÓ commandó  iî submiô (batch© files®  However¬  thå PREBAÓ  commanä linå optioî presumeó yoõ kno÷ whaô yoõ arå doing®  Therå ió  lesó erroò checkinç thaî therå ió iî thå prompô mode¬  anä iô wilì noô asë  yoõ  iæ thió ió REALLÙ whaô yoõ intendeä tï dï  wheî  you'rå overwritinç  á filå oò linå numberó alreadù exist®  Afteò  PREBAÓ executeó  froí  thå commanä line¬  iô returnó yoõ tï thå  commanä leveì (yoõ dï noô geô askeä iæ yoõ wanô tï dï anotheò file). Noteº Aô  presenô  therå  ió nï commanä linå optioî  foò  PREBAÓ  undeò MS/DOS®  Thió  ió becauså wheî yoõ loaä á compileä BASIà prograí undeò MS/DOS¬  bù thå timå thå prograí getó control¬  thå segmenô registeró havå changed®  É don'ô kno÷ ho÷ á runninç BASIà prograí woulä  inquirå aó tï wherå thå MS/DOÓ (anä commanä line©  segmenô resides®  Iæ anyonå haó anù ideaó abouô ho÷ thió ió done¬  É surå woulä appreciatå hií droppinç må á linå anä lettinç må iî oî  thå secret. Thå syntaø foò thå PREBAÓ commanä linå modå isº PREBAÓ INFILE[.EXTÝ [OUTFILE[.EXT]Ý [$[{+,-}LÝ [{+,-}NÝ [{+,-}CÝ                                     [McÝ [SxxxÝ [Pxxx]Ý Whereº [...Ý     indicateó thå parameteò ió optional® {...ý     indicateó yoõ musô choså onå oæ thå optionó enclosed® xxø       ió á number® ã         ió á character® INFILÅ    Ió thå sourcefilå yoõ wanô tï process® Thió caî bå precedeä bù á drivå designatoò (e.g® B:TEST)¬ otherwiså thå loggeä iî (default© drivå ió assumed® OUTFILÅ   Ió thå namå oæ thå destinatioî file® Iæ noô specified¬ iô defaultó tï thå namå oæ thå infile¬ thå drivå oæ thå infile¬ anä aî extensioî oæ ".BAS¢ (e.g® B:TEST.BAS)® EXÔ       Optionaì filenamå extension® Iæ noô specified¬ iô defaultó tï ".BAS¢ foò thå OUTFILE¬ anä nothinç ("®   "© foò thå infile® Š¤  (Optional.©  Telló  PREBAÓ  thaô anù numbeò  oæ commanä   linå optionó follow® Eacè optioî musô bå separateä bù á space. OPTIONSº +Ì        (Default.© Resolvå Labeló iî INFILE¬ anä translatå intï           absolutå (linå number© targetó iî OUTFILE® -Ì        Dï noô resolvå Labeló iî INFILE® +Π       (Default.© Adä linå Numberó tï OUTFILÅ -Π       Dï noô adä linå Numberó tï OUTFILÅ +à       (Default.© Adä Commentó tï thå enä oæ lineó showinç targeô labeló ¨ §     TOº @SUB1¬ @SUB2¬ @ERROR...)® -à       Dï noô adä Commentó tï thå enä oæ lines® Sxxø      Seô Starô number® Examplå -­ S10° -­ wilì starô linå numberinç witè 100® Iæ noô specified¬ thå defaulô oæ 1° ió assumed® Pxxø      Seô steÐ size® Examplå -­ P1µ -­ wilì numbeò lineó iî           incrementó oæ 15¬ (10,25,40,55...)® Iæ noô specified¬           thå defaulô oæ 1° ió assumed® Mã        Seô markeò character® Examplå -­ Mª -­ wilì searcè foò labeló witè "*¢ foò theiò firsô character® Iæ noô specified¬ thå defaulô oæ "@¢ ió assumed® EXAMPLESº A>PREBAÓ B:TESÔ Writeó B:TESÔ tï B:TEST.BAÓ witè alì thå standarä defaults. A>PREBAÓ B:TESÔ $-Î Writeó  B:TESÔ tï B:TEST.BAÓ resolvinç labels¬  buô doeó noô  adä linå numberó (otheò thaî thoså oî lineó witè targeô labels) A>PREBAÓ B:TESÔ ¤ -Î MÞ -à S± P± Samå aó above¬  buô doeó noô adä comments¬  anä lookó foò  labeló markeä bù "^¢ aó theiò leadinç character® Becauså oæ thå "S± P1"¬ lineó  startinç  witè  targeô labeló wilì bå  numbereä  witè  thå actuaì  numbeò  oæ lineó froí thå toð oæ thå filå  (noô  countinç solï linefeeds). A>PREBAÓ TEST.BAÓ B:STRIP.OUT$-Ì -Î Stripó  linå  numberó  froí TEST.BAÓ oî thå  defaulô  drive¬  anä writeó thå strippeä filå tï STRIP.OUÔ oî thå Bº drive. Thió softwarå fitó intï thå categorù oæ what'ó termeä "freeware"® (Althougè  á  betteò descriptioî woulä bå  "almosô  freeware¢  oò "somewhaô freeware")®  Whaô thaô meanó is¬  iæ yoõ likå it¬  theî Špaù foò it® Iæ  yoõ  havå  founä  thió softwarå useful¬  anä iæ  yoõ  havå  á consciencå anä arå noô pooò -- theî thå authoò woulä likå yoõ  tï sho÷  youò appreciatioî bù sendinç hií somå buckó foò it®  Eveî á smalì amount¬  eveî á dollar¬  woulä bå warmlù received® Thinë oæ whaô iô woulä havå cosô yoõ iî timå tï writå iô foò yourself®  Iæ yoõ  senä $1° dollaró oò over¬  yoõ wilì bå placeä oî mù  mailinç lisô tï geô thå latesô updatå oæ thå prograí (aô nï charge)¬  anä perhapó  somå  otheò goodieó É mighô havå lyinç  arounä  aô  thaô time.                     G® Wolfå                     8¸ 51sô Avenue¬ Nortè                     Boió då Filionó                     Quebec¬ Canada¬  J6Ú 2N¹ Thió  ió  á  prograí thaô runó MUCÈ betteò  wheî  compileä  (eveî disregardinç  mù  freå uså oæ comments¬  whitå space¬  anä  largå variablå  names.©  Thå  versioî oî thå PÄ librarù  ió  linkeä  tï OBSLIB.REÌ  sï  iô caî bå useä bù anyone®  Iæ yoõ keeð á  seô  oæ utilitieó oî á disë witè BRUN.REL¬ yoõ caî recompilå tï linë witè thaô librarù (nï /Ï option)¬  anä you'lì savå yourselæ abouô  20Ë oæ disë space®  Thå twï versionó ruî thå same¬ witè thå exceptioî thaô thå BRUÎ versioî takeó abouô ² secondó morå tï load. OPTIOÎ DEFAULTÓ ==============½ Alì  thå optioî defaultó arå gathereä neaò thå fronô end¬  sï arå easù tï change® Herå ió á list: 17° MSDOÓ ½ FALSÅ §    Seô truå iæ yoõ intenä tï porô tï á MS/DOÓ                        machine¬ buô reaä belo÷ abouô portinç tï                        MS/DOÓ 18° OSEXEà ½ TRUÅ §    Truå iæ we'rå oî aî Osbornå Exec®                        (Oò aî Osbornå 1)¬ oò otheò CPÍ machinå 20° IÆ OSEXEà ½ TRUÅ THEÎ CLS¤ ½ CHR$(26©§Thå cleaò screeî string¬                                           foò youò machinå (CPM© 21° MARKER¤ ½ "@¢ §                    defaulô labeì identifieò 23° DIÍ LABTAB$(2,1000©§Thå seconä number¬ iî parenthesis¬ ió thå                        numbeò oæ labeló wå caî handlå aô once® Bå                        carefuì oæ RAÍ iæ yoõ bumð thió up® 25° STARTNUÍ ½ 10º STEPSIZÅ ½ 1°' Defaulô values® 26° ADDVECTÓ ½ TRUÅ §    Sho÷ thå replaceä labeló aó commentó aô                          thå enä oæ thå line® Default® 28° COMBUÆ ½ &H8° §      CPÍ commanä linå buffeò 30° INFEXT¤ ½ ""º OUTFEXT¤ ½ ".BAS¢§Defaulô filå extensionó foò                                     INFILÅ anä OUTFILÅ (remembeò                                     thå leadinç period)® 34° DOLABELÓ ½ TRUEº DOLINUMÓ ½ TRUŧDefaultó oæ whetheò wå resolvå labeló anä whetheò wå adä linå numbers® ŠPortinç tï MS/DOSº Seô MSDOÓ tï TRUÅ iî linå 170¬  anä OSEXEà tï FALSÅ iî linå  180® Yoõ wilì havå tï changå thå @CLEARSCREEÎ routinå tï "CLSº RETURN¢ oò  seô  thå CLS¤ iî linå 20° tï whateveò youò cleaò  screeî  anä homå  strinç  is®  Also¬  É aí verù liberaì iî extendinç  logicaì lineó  intï  á numbeò oæ physicaì lines¬  bù thå  uså  oæ  singlå linefeedó (nï CR)®  Then¬ whilå É aí debugginç anä saving¬ MBASIà takeó  thoså  anä  saveó theí ouô aó linefeeä  - carriagå  returî pairó (ratheò thaî thå CR-LÆ pairó aô thå enä oæ regulaò  lines)® Iî  MS/DOS¬  neitheò  thå interpreteò oò thå compileò  recognizeó theså  aó  logicaì  linå  extenderó  (thå  intrigueó  oæ   MS/DOÓ software¬ I'lì neveò understand.© Yoõ wilì havå tï finä theså anä takå  theí  ouô witè youò editor¬  makinç somå verù  lonç  lines® (Theù  wilì sho÷ uð iî WordStaò aó á "J¢ theî á "-¢ oî thå  righô margin® Searcè anä replacå foò ^P^J^P® Buô perhapó betteò tï searcè foò thå ^P^Ió first¬  replacinç witè ^P® Dï thió untiì you'vå goô alì thå tabó ouô first¬  theî geô riä oæ thå LF-CRs® Elså you'lì havå á helì oæ á joâ gettinç theí out®                       APPENDIØ Â -­ Aî examplå ruî                       ===========================½ Herå ió aî examplå sourcå programº § THIÓ IÓ Á TESÔ FOÒ PREBAÓ § @STARÔ ¿ "WÅ ARÅ UNDEÒ @START¢ OÎ ERROÒ GOTÏ @ERROÒ GOTÏ @NEXÔ STOÐ @Nexô -­ Á loweò (mixed© caså target® ¿ "WE'RÅ AÔ @NEXT¢ FOÒ É ½ ± TÏ 30°         ¿ "THESÅ TWÏ LINEÓ HAVÅ LINEFEEDS"º                   GOSU @FINDXº                   GOSU @FINDØ         IÆ A¤ <¾ "¢ THEÎ GOTÏ @LASTFOÒ         @LastFOÒ -­ Á tabbeä labeì witè mixeä case® NEXÔ É IÆ A¤ <¾ "X¢ ANÄ A¤ <¾ "x¢ THEÎ GOTÏ @STARÔ ELSÅ GOTÏ @ENÄ § @ERROÒ ¿ "WÅ HAÄ AÎ ERROR¢ RESUMÅ @NEXÔ §  Iô workó foò RESUMÅ (oæ course© § @FINDØ ¿ "WÅ ARÅ IÎ @FINDX¢ A¤ ½ INKEY¤ RETURÎ § §       Noteº therå ió nï conflicô betweeî @ENÄ anä ENÄ @ENÄ ENÄ Š Thå outpuô (PREBASed© prograí ió showî oî thå nexô page. 1° § THIÓ IÓ Á TESÔ FOÒ PREBAÓ 2° § 3° '@STARÔ 4° ¿ "WÅ ARÅ UNDEÒ @START¢ 5° OÎ ERROÒ GOTÏ 17° §  TOº @ERROÒ 6° GOTÏ 8° §    TOº @NEXÔ 7° STOÐ 8° '@Nexô -­ Á loweò (mixed© caså target® 9° ¿ "WE'RÅ AÔ @NEXT¢ 10° FOÒ É ½ ± TÏ 30° 11°     ¿ "THESÅ TWÏ LINEÓ HAVÅ LINEFEEDS"º              GOSU 210º              GOSU 21° §        TOº @FINDX¬ @FINDØ 12°     IÆ A¤ <¾ "¢ THEÎ GOTÏ 13° §     TOº @LASTFOÒ 13° §   @LastFOÒ -­ Á tabbeä labeì witè mixeä case® 14° NEXÔ É 15°  IÆ A¤ <¾ "X¢ ANÄ A¤ <¾ "x¢ THEÎ GOTÏ 3° ELSÅ GOTÏ 27° §  TOº @START¬ @ENÄ 16° § 17° '@ERROÒ 18° ¿ "WÅ HAÄ AÎ ERROR¢ 19° RESUMÅ 8°  §  Iô  workó foò RESUMÅ (oæ course© § TOº  @NEXÔ  20°  §  21° '@FINDØ 22° ¿ "WÅ ARÅ IÎ @FINDX¢ 23° A¤ ½ INKEY¤ 24° RETURÎ 25° § 26°  § Noteº  therå ió nï conflicô betweeî @ENÄ anä ENÄ 27° '@ENÄ 28° END Notå  ho÷  wå  handlå  mixeä  caså  labels¬  tabbeä  labels¬  anä linefeedó (oî linå 110).                                      @ENÄ