1  REM PROGRAM TO EXTRACT DOCUMENTATION FROM BASIC MACRO FILES
2  REM 15-OCT-76 - LARRY SIMPSON
3  REM READS FROM SOURCE FILES BASIC0-BASIC4(.MAC)
4  REM AND MAKES RUNOFF FILE BASIC.RNO
10 DIM L$[80]V,L1$[80]V,C2$[7]V,S$[40]V(7)
20 DIM N$[40]V(7),M$[40]V,A$[1]
30 C2$=".WC"
35 CF=0
40 M$="----------------------------------------"
50 INPUT "DIABLO OUTPUT (Y/N) ";A$
200					! SET UP SEPERATE CHAPTERS
201 DATA ^^INTRODUCTION\\
210 DATA ^^LOADING/RUNNING/SAVING PROGRAMS\\
220 DATA ^^PROGRAM STATEMENTS\\
230 DATA ^^ARITHMETIC FUNCTIONS\\
232 DATA ^^STRING FUNCTIONS\\
235 DATA ^^I/O _& FILE MANIPULATION\\
240 DATA ^^LOADABLE SUBROUTINES\\
300 FOR I=1 TO 7
310 N$(I)="BASIC"+STR$(I-1)+".RNO"
320 OPEN #3,N$(I)+"/WR"
330 READ S$(I) : S$(I)=LTR$(S$(I))
340 PRINT #3,".CHAPTER ";S$(I)
390 CLOSE 3
400 N$(I)=N$(I)+"/AP"
410 NEXT I
420 F=0
500					! EXTRACT TEXT FROM BASIC
501 FOR I2=1 TO 5
510 N$="BASIC"+STR$(I2-1)+".MAC/RO/EN:600/LN:132"
520 OPEN #4,N$
530 INPUT LINE #4,L$
540 IF SBS$(L$,1,2) <> ";+" THEN 530
550 GOSUB 3000
560 GOTO 530
600 CLOSE 4
605 PRINT "END FILE";I2-1
610 NEXT I2
620 OPEN #4,"SPAWN.MAC/RO/EN:670"
630 INPUT LINE #4,L$
640 IF SBS$(L$,1,2)<> ";+" THEN 630
650 GOSUB 3000
660 GOTO 630
670 CLOSE 4
1000 CLOSE 3
1001					! SET RNO INITIAL INFO
1010 OPEN #3,"BASIC.1ST/WR"
1020 PRINT #3,".PS 60,79" : PRINT #3,".LS 1"
1030 PRINT #3,".LM 10;.RM 75" : PRINT #3,".TS 15,25"
1045 PRINT #3,".FG 18"
1050 L$=DAT$(0)
1055 PRINT #3,".DT ";L$
1060 PRINT #3,C2$
1065 PRINT #3,"^^BASIC DOCUMENTATION\\"
1070 PRINT #3,C2$
1075 PRINT #3,L$
1080 PRINT #3,".TITLE ^^BASIC DOCUMENTATION\\"
1082 PRINT #3,".FG 1;.C"
1083 PRINT #3,"^MICHAEL ^REESE ^MEDICAL ^CENTER"
1084 PRINT #3,".FG 1;.C"
1085 PRINT #3,"^FRANK ^R. ^BORGER"
1098 PRINT #3,"@BASIC.TOC"
1099					! MERGE SEPERATE CHAPTERS
1100 FOR I=1 TO 7
1110 OPEN #4,SEG$(N$(I),1,LEN(N$(I))-3)+"/RO/EN:1150"
1120 INPUT LINE #4,L$
1130 PRINT #3,L$
1140 GOTO 1120
1150 CLOSE 4
1155 PRINT "FINISHED ";SEG$(N$(I),1,LEN(N$(I))-3)
1160 NEXT I
1164					! ADD APPENDICES
1165 PRINT #3, ".APPENDIX ^^BASIC ERROR VALUES\\"
1166 PRINT #3,".NOFILL" : PRINT #3, "^^"
1167 CF=1			: ! SHOW CHECK FOR #
1170 OPEN #4, "BSCERRNUM.DOC/RO" : GOSUB 2000
1175 PRINT #3, ".APPENDIX ^^SAMPLE LOADABLE MACRO SUBROUTINE\\"
1176 PRINT #3,".NOFILL" : PRINT #3, "^^"
1177 PRINT #3, ".TS 18,24,32,40,48,56,64"
1180 OPEN #4, "REVSTR.MAC/RO" : GOSUB 2000
1182 PRINT #3," " : PRINT #3," " : PRINT #3, "MACRO COMMAND FILE"
1183 PRINT #3," " : PRINT #3, "REVSTR,REVSTR/-SP=LB:[1,202]LOAMAC/ML,[1,202]REVSTR"
1184 PRINT #3," " : PRINT #3," " : PRINT #3,"TKB COMMAND FILE" : PRINT #3," "
1185 OPEN #4, "REVSTR.CMD/RO" : GOSUB 2000
1186 PRINT #3, ".APPENDIX ^^USEFUL INTERNAL BASIC SUBROUTINE CALLS\\"
1187 PRINT #3,".NOFILL" : PRINT #3, "^^"
1190 OPEN #4, "BASIC.SBS/RO" : GOSUB 2000
1220 PRINT #3,".APPENDIX ^^INDEX\\"
1280 PRINT #3,".PX"
1290 CLOSE 3
1300 EXIT
2000					! SUB TO INPUT OTHER FILES
2005 IF END #4 THEN 2025
2010 INPUT LINE #4,L$
2012 IF CF=1 THEN GOSUB 4000
2015 PRINT #3, L$
2020 GOTO 2010
2025 CLOSE 4
2030 RETURN
3000					! CHANGE CHAPTER IF NECESSARY
3005 F1=VAL(SBS$(L$,2))
3010 IF F1=F THEN 3050
3020 CLOSE 3
3030 F=F1
3040 OPEN #3,N$(F)
3050 INPUT LINE #4,L$
3060 IF SBS$(L$,1,1) <> ";" THEN 3050
3070 IF SBS$(L$,2,1) = "-" THEN RETURN
3071 IF A$="Y" THEN 3080
3072 PP=POS(L$,CHR$(123)) : IF PP<1 THEN 3076
3074 L$=SEG$(L$,1,PP-1)+SEG$(L$,PP+1)
3076 PP=POS(L$,CHR$(125)) : IF PP<1 THEN 3080
3078 L$=SEG$(L$,1,PP-1)+SEG$(L$,PP+1)
3080 PRINT #3,LTR$(SBS$(L$,2))
3090 GOTO 3050
4000					! HANDLE # IN MACRO SOURCE
4001 CP=1
4005 JJ=POS(L$,"#",CP) : IF JJ<1 THEN RETURN
4010 CP=JJ+2 : NC=NC+1
4015 L$=SEG$(L$,1,JJ-1)+"_"+SEG$(L$,JJ,LEN(L$)) : GOTO 4005
5000 END
