Business BASIC III: RENUMBER 1.01

Business BASIC III: RENUMBER 1.01

Here is a corrected version of the Business BASIC Renumber program.  Just EXEC
this file and save it on the Business BASIC Master Diskette.
 
10   INVOKE"Renumber.INV"
20   HOME
30   PRINT USING"76c";"--  RENUMBER 1.01 --"
50   PRINT:PRINT TAB(8);"Your options are:":PRINT
60   PRINT TAB(26);"1   Line References"
70   PRINT TAB(26);"2   Append/Merge Programs"
80   PRINT TAB(26);"3   Renumber a Program"
90   PRINT TAB(26);"4   Quit"
100   PRINT
110   PRINT TAB(8);:INPUT"Which option? ";a$:x=ASC(a$)-48
120   ON x GOTO 150,250,360,140
130   PRINT TAB(8);"Please enter 1, 2, 3, or 4":
      VPOS= VPOS-2:GOTO 110
140   TEXT:HOME:END
150   REM --- XREF
160   TEXT:HOME:PRINT USING"76c";"-- XREF --":PRINT
170   INPUT"Name of Source File: ";i$:IF LEN(i$)=0 THEN 20
180   INPUT"Output file name?
      (Press RETURN for output to .CONSOLE) ";o$
190   IF LEN(o$)=0 THEN o$="temp.xref"
200   INPUT"Should unreferenced lines be displayed?";r$:
      IF ASC(r$)=ASC("y") OR ASC(r$)=ASC("Y") THEN 230
210   PERFORM xref(@i$,@o$)
211   IF o$<>"temp.xref" THEN 20
212   ON ERR GOTO 218
213   OPEN#1,"temp.xref"
214   INPUT#1;a$
215   GOSUB 620
216   IF l=20 THEN GOSUB 670
217   GOTO 214
218   OFF ERR:CLOSE#1:DELETE"temp.xref":GOSUB 670
220   GOTO 20
230   PERFORM xlist(@i$,@o$)
240   GOTO 211
250   REM --- MERGE
260   TEXT:HOME:PRINT USING"76c";"-- APPEND/MERGE --":PRINT
270   INPUT"Name of the first Program? ";i$:
      IF LEN(i$)=0 THEN 20
280   INPUT"Which Program should be merged with it? ";i2$:
      IF LEN(i2$)=0 THEN VPOS= VPOS-2:PRINT CHR$(29);:GOTO 270
290   INPUT"Output file name? ";o$:
      IF LEN(o$)=0 THEN VPOS= VPOS-3:PRINT CHR$(29);:GOTO 270
300   INPUT"Should I allow interleaving of program lines? ";a$
310   IF ASC(a$)=ASC("Y") OR ASC(a$)=ASC("y") THEN 340
320   PERFORM append(@i$,@i2$,@o$)
330   GOTO 20
340   PERFORM merge(@i$,@i2$,@o$)
350   GOTO 20
360   REM --- RENUMBER
370   TEXT:HOME:PRINT USING"76c";"-- RENUMBER --":PRINT
380   INPUT"Name of Program to be Renumbered? ";i$:
      IF LEN(i$)=0 THEN 20
390   INPUT"Save with what file name? ";o$:
      IF LEN(o$)=0 THEN VPOS= VPOS-2:PRINT CHR$(29);:GOTO 380
400   INPUT"What line number should I start renumbering at?
      (Default=0) ";low$:
      IF LEN(low$)=0 THEN low=0:GOTO 420
410   IF ASC(low$)<48 OR ASC(low$)>57 THEN VPOS= VPOS-1:
      GOTO 400:ELSE low=VAL(low$)
420   INPUT"What line number should I renumber up to?
      (Default=63999) ";high$:
      IF LEN(high$)=0 THEN high=63999:GOTO 440
430   IF ASC(high$)<48 OR ASC(high$)>57 THEN VPOS= VPOS-1:
      GOTO 420:ELSE high=VAL(high$)
440   INPUT"Starting value for the renumbered lines?
      (Default=10) ";start$:
      IF LEN(start$)=0 THEN start=10:GOTO 460
450   IF ASC(start$)<48 OR ASC(start$)>57 THEN VPOS= VPOS-1:
      GOTO 440:ELSE start=VAL(start$)
460   INPUT"What increment between each line? (Default=10) ";
      bump$:IF LEN(bump$)=0 THEN bump=10:GOTO 480
470   IF ASC(bump$)<48 OR ASC(bump$)>57 THEN VPOS= VPOS-1:
      GOTO 460:
      ELSE bump=VAL(bump$)
480   REM Map numbers larger than 32767 into standard
      two's complement form.
490   low=TEN(HEX$(low)):
      high=TEN(HEX$(high)):
      start=TEN(HEX$(start))
500   INPUT"Should I allow lines to be moved? ";a$:
      IF ASC(a$)=ASC("Y") OR ASC(a$)=ASC("y") THEN 530
510   PERFORM renum(@i$,@o$,%low,%high,%start,%bump)
520   GOTO 20
530   PERFORM reseqnce(@i$,@o$,%low,%high,%start,%bump)
540   GOTO 20
620   IF LEN(a$)<80 THEN PRINT a$:l=l+1:RETURN
630   PRINT MID$(a$,1,80):s=80:e=74:l=l+1:
      IF l=20 THEN GOSUB 670
640   IF LEN(a$)-80=>74 THEN HPOS=6:
      PRINT MID$(a$,s,e):s=s+74:l=l+1:
      IF l=20 THEN GOSUB 670:GOTO 640
650   IF LEN(a$)-s>0 THEN HPOS=6:PRINT MID$(a$,s)
660   RETURN
670   VPOS=23:
      PRINT USING"76c";"-- press RETURN to continue --";
680   GET a$
690   IF ASC(a$)<>13 THEN 690
700   HOME:PRINT USING"76c";"--  XREF --":PRINT:l=0:RETURN

Back