10 REM TOF (INSTRUCTIONS)
100 ?TAB(-1,0);: REM CLR'SCRN
110 ?"ALPHA-BASIC SOURCE FILE RENUMBERING UTILITY"
120 ?"       (COURTESY TETON DATA SYSTEMS)"
130 ?"             (JACKSON, WYOMING)"
135 ?"MODIFIED 1/3/80 TO ACCOMODATE 150 CHARACTER LINES"
140 ?
150 INPUT "WANT INSTRUCTIONS  (0=NO  1=YES)?  "; A
160 IF A=0 GOTO PRGRM
170 ?
180 ?"    This program will renumber your ALPHA-BASIC source files, giving"
190 ?"you the options of where to start renumbering, where to stop, and"
200 ?"the increment to be used between lines in the new source file.  You"
210 ?"may also specify a new starting point for the renumbered lines, which"
220 ?"is handy for rearranging your program modules, (providing your CALL's"
230 ?"GOTO's and GOSUB's are to LABELED lines)!!  The program does NOT"
240 ?"renumber imbedded line numbers, as in 'GOTO 2000'.  It will check for"
250 ?"renumbering beyond module boundaries, and warn you if you goofed."
260 ?
270 ?"    After running the program, a new source file is created with the"
280 ?"name 'filename.REN'.  You can reload and run it as such, or rename it"
1000 REM TOF (MAP & PROGRAM)
1010 STRSIZ 150
1020 MAP1 WORK'AREA
1030	MAP2 NMBR,S,5
1040	MAP2 CHAR,S,150
1050	MAP2 SRCE'LIN,S,150
1060	MAP2 NAME$,S,6
1070 GOTO PRGRM
1999   
2000 PRGRM:	?:INPUT "PROCESS WHICH FILENAME.BAS? "; NAME$
2110		LOOKUP NAME$+".BAS",CHK
2120		IF CHK=0 THEN PRINT NAME$;".BAS  NOT FOUND!": GOTO PRGRM
2130		?:?"IF YOU DO NOT HAVE";CHK;" FREE RECORDS AVAILABLE, ABORT!":?
2140		INPUT "START FROM WHICH LINE NO.? "; START'FROM
2150		INPUT "   COPY TO WHICH LINE NO.? "; COPY'TO
2160		INPUT "  END WITH WHICH LINE NO.? "; FIN
2170		INPUT "           WHAT INCREMENT? "; INCR
2180		?:?"SOURCE";TAB(9)"DESTINATION"
2500 OPEN #1, NAME$+".BAS",INPUT
2510 OPEN #2, NAME$+".REN", OUTPUT
3000 LOOP:	INPUT LINE #1, SRCE'LIN
3010		IF EOF(1)=1 GOTO FINISH
3020		CALL SPC
3030		NMBR=SRCE'LIN[1,(SPC-1)]
3040		?TAB(-1,2);TAB(-1,10);NMBR;: REM OPT DSPLY ACT-IV
3050		IF VAL(NMBR)<START'FROM ?#2,SRCE'LIN: GOTO LOOP
3060		IF VAL(NMBR)>FIN AND VAL(NMBR)<=COPY'TO CALL OOPS
3070		IF VAL(NMBR)>FIN ?#2,SRCE'LIN: GOTO LOOP
3080		CHAR=SRCE'LIN[SPC,-1]
3090		NMBR=COPY'TO
3100		?TAB(10) NMBR;:		REM OPT DSPLY ACT-IV
3110		SRCE'LIN=NMBR+CHAR
3120		?#2, SRCE'LIN
3130		COPY'TO=COPY'TO + INCR
3140		GOTO LOOP
3199 
3200 SPC:	A=INSTR(1,SRCE'LIN," ")
3210		B=INSTR(1,SRCE'LIN,CHR(9))
3215		C=INSTR(1,SRCE'LIN,"!")
3230		IF A=0 SPC=B: CONT
3240		IF B=0 SPC=A: CONT
3250		IF B>A SPC=A: CONT
3260		IF A>B SPC=B: CONT
3270		CONT: IF C < SPC AND C > SPC = C :
3299 		RETURN
3300 OOPS:	?:?CHR(7):?"YOU RENUMBERED OVER THE FOLLOWING BLOCK!!"
3310		?"TRY AGAIN WITH SMALLER INCREMENTS BETWEEN LINES..."
3320		CLOSE #1: CLOSE #2: GOTO PRGRM
64999 
65000 FINISH:	?" LAST LINE COPIED.":?: CLOSE #1: CLOSE #2
65010 ?"YOUR RENUMBERED FILE EXISTS ON DISK AS ## ";NAME$;".REN ##"
65020		?"REMEMBER TO RELOAD IT AS SUCH, OR RENAME IT."
65030		?:?:INPUT "ANOTHER ONE  (0=NO  1=YES)? ";A
65040		IF A=1 ?TAB(-1,0);: GOTO PRGRM
65050		END