1 ! COMPILE.BAS [1,200] - UTILITY PROGRAM TO RECOMPILE ALL ALREADY COMPILED VERSIONS OF BASIC PROGRAMS IN THE ACCOUNT:
	! :
	! 	BONNIE KAPLAN			JULY 26, 1978:
	! :
	! ASSUMES THAT EVERY BAC FILE HAS A CORRESPONDING BAS FILE:
	! :
	!	ASSUMES NEW VERSION OF BASIC, OR VERSION OF BASIC PROGRAMS SHOULD BE:
	 ! RECOMPILED UNDER, IS BAR:
100	 ! INITIALIZATIONS
110 DIM R$[132]V				: ! RECORD
120 DIM BS$[4], BP$[4]				: ! FILE EXTENSIONS
122 BS$=".BAS"
124 BP$=".BAP"
130 DIM F$[12]V					: ! FILE NAME
140 DIM Q$[1]					: ! QUOTES
200	 ! CREATE SORTED DIRECTORY FILE SO CAN FIND *.BAC
210 S=0:
    CALL "SPAWNB" ("PIP *.BAC/PU", S):
    IF S<0 THEN  PRINT "PIP PURGE ERROR" : STOP 	: ! ELIMINATE ALL BUT ONE VERSION OF BAC FILES
220 S=0:
    CALL "SPAWNB" ("SRD SRD.DAT=", S):
    IF S<0 THEN  PRINT "SRD ERROR" : STOP 
230 PRINT : PRINT "PROGRAMS BEING RECOMPILED:" : PRINT 
300	 ! FIND *.BAC SECTION
310 OPEN #3, "SRD.DAT/EN:900"
320 INPUT LINE #3, R$
330 P=POS(R$,".BAC")
340 IF P=0 THEN 320				: ! GO THRU FILE UNTIL FIND *.BAC
400	 ! RECOMPILE EACH BAC FILE
410 F$=LEFT(R$,P-1)				: ! GET FILE NAME (P SET IN SECTION 300)
420 PRINT F$
430 S=0:
    CALL "SPAWNB" ("PIP " + F$+BP$ + "=" + F$ + BS$, S):
    IF S<0 THEN  PRINT "PIP ERROR" : STOP 	: ! COPY THE BAS VERSION
440 OPEN #4, F$+BP$+"/AP/LN:132"
450 Q$=CHR$(34)			: ! ** CHR$(34) IS A CALL FOR A " (QUOTE)
460 PRINT #4, "SAVE " + Q$ + "/CO" + Q$ + ": EXIT" : ! ADD SAVE "/CO" : EXIT TO COPIED BAS VERSION
470 CLOSE 4
480 S=0:
    CALL "SPAWNB" ("BAR " + F$+BP$ + "/RT", S):
    IF S<0 THEN  PRINT "BAR ERROR " : STOP 	: ! THE PROGRAM WILL RECOMPILE AND SAVE ITSELF
500	 ! CONTINUE UNTIL REACH END OF BAC SECTION
510 INPUT #3, R$
520 P=POS(R$,".BAC")
530 IF P=0 THEN 900
540 GOTO 400
900	 ! HAVE NOW DONE ALL RECOMPILATIONS.  CLEAN UP
910 S=0:
    CALL "SPAWNB" ("PIP *"+BP$+";*/DE", S):
    IF S<0 THEN  PRINT "PIP PURGE ERROR" : STOP 
920 S=0:
    CALL "SPAWNB" ("PIP *.BAC/PU", S):
    IF S<0 THEN  PRINT "PIP BAC PURGE ERROR" : STOP 
930 S=0:
    CALL "SPAWNB" ("PIP SRD.DAT;*/DE", S):
    IF S<0 THEN  PRINT "PIP DELETE ERROR" : STOP 
1000	 ! CLOSE FILES - END PROGRAM
1010 CLOSE 
1020 STOP 
