.;  M. R. BROWN	15-MAY-79	VERSION 1.4
.;  R. E. HUGHES 8-JUNE-79	VERSION 1.5
.; THIS INDIRECT FILE WILL COMPILE AND BUILD A PROGRAM. IT DOES THIS BY
.; MAKING TWO INDIRECT FILES 	USER.CMD     WHICH COMPILES ETC
.;				USERBLD.CMD  WHICH TASKBUILDS.
.; IT WILL RERUN THE LAST COMPILE IF YOU DO NOT GIVE IT A FILE NAME
.; BUT IF YOU ANSWER THE FIRST QUESTION WITH A FILE NAME THEN IT
.; WILL ASK ABOUT OPTIONS
.;	1) RUN FLECS PREPROCESSOR?
.;	2) FOR OR FORPLUS?
.;	3) VT11 GRAPHICS?
.;	4) OTHER .OBJ FILES TO INCLUDE IN TASKBUILD
.;	5) OTHER LIBRARIES
.; IT THEN MAKES APROPRIATE .CMD FILES AND CLEANS UP.
.; THE .CMD FILES WILL ALSO CLEAN UP I.E. .OBJ FILES ARE
.; DELETED AFTER TASKBUILD, THE .TSK IS PURGED /PU:1
.; AND IF YOU USE FLECS THE .FTN WILL ALWAYS BE "USER.FTN;1"
.;
.; WHEN IT DIES SEE RUSS OR BOB
	.ENABLE GLOBAL
	.ENABLE SUBSTITUTION
	.ENABLE ESCAPE
.;PRE SET THE STRINGS TO DEFAULTS UNTIL A CHOICE IS MADE
.;THEN THEY CHANGE TO THE CHOICE
.;READ IN THE STORED DEFAULTS
	.TESTFILE USER.DAT;1
	.IF <FILERR> EQ 1 @USER.DAT;1
	.SETF NOFLE		!FLEX OUTPUT
	.IFNDF $NOFLE .GOTO 1
	.IFT $NOFLE .SETT NOFLE
.1:	.SETF FOR		!F4P DEFAULT
	.IFNDF $FOR .GOTO 2
	.IFT $FOR .SETT FOR
.2:	.SETF GRA		!NO GRAPHICS
	.IFNDF $GRA .GOTO 3
	.IFT $GRA .SETT GRA
.3:	.SETS NL ""		!A NULL STRING FOR TESTING
	.SETS FIL NL		!NO FILE NAME
	.IFDF $FIL .SETS FIL $FIL
	.SETS FLEX NL		!NO FLEX STRING
	.SETS GRAPH NL		!NO GRAPHICS
	.SETS SYSLIB NL		!F4P LIBRARY DEFAULT
	.SETS LIB NL		!NO EXTRA LIBRARIES
	.IFDF $LIB .SETS LIB $LIB
	.SETS MLST ",LP;1/-SP/-WI"
	.SETS OFIL NL		!OBJECT FILES FOR TKB
	.IFDF $OFIL .SETS OFIL $OFIL
	.SETS FORT "F4P"	!F4P DEFAULT
	.SETS FORSW NL		!NOTR SW
	.IFDF $FORSW .SETS FORSW $FORSW
	.SETS TKBSH NL		!TKB SHORT
	.IFDF $TKBSH .SETS TKBSH $TKBSH
	.SETS ACTF "2"		!DEFAULT # OF ACTIVE FILES
	.IFDF $ACTF .SETS ACTF $ACTF
	.SETS UNIT "5"		!DEFAULT # OF UNITS
	.IFDF $UNIT .SETS UNIT $UNIT
	.SETN NUM 0		!RUNNING TOTAL
.BEG:
;    Type ESCAPE to take default
	.ASKS [0:9.] ZZ ENTER FILENAME <'FIL'>
	.IFT <ESCAPE> .CHAIN USER
	.IF ZZ NE NL .SETS FIL ZZ
	.TEST FIL
	.SETN NUM NUM + <STRLEN>
	.ASK Z Make task as small as possible
	.IFT <ESCAPE> .GOTO 7
	.IFT Z .SETS FORSW "/NOTR"
	.IFT Z .SETS TKBSH "[1,1]SYSLIB/LB:$SHORT"
	.IFF Z .SETS FORSW NL
	.IFF Z .SETS TKBSH NL
	.IFF Z .GOTO 7
	.ASKS ZZ NUMBER OF ACTIVE FILES <DEFAULT 'ACTF'>
	.IFT <ESCAPE> .GOTO 7
	.IF ZZ NE NL .SETS ACTF ZZ
	.ASKS ZZ NUMBER OF UNITS <DEFAULT 'UNIT'>
	.IFF <ESCAPE> .AND .IF ZZ NE NL .SETS UNIT ZZ
.7:	.IFF <ESCAPE> .ASK NOFLE DO YOU WANT TO OMIT THE FLEX PREPROCESSOR
	.IFF NOFLE .SETS FLEX "FLE USER;1,LP;1="+FIL+"
	.IFF NOFLE ; THE FLECS OUTPUT WILL ALWAYS BE  USER.FTN;1
	.IFF <ESCAPE> .ASK FOR DO YOU WANT FOR INSTEAD OF F4P
	.IFT FOR ; FORTRAN VERSION 2 WILL BE USED WITH LISTING IN LP.LST;1
	.IFF FOR ; FORTRAN-4-PLUS WILL BE USED WITH LISTING IN LP.LST;1
	.IFT FOR .SETS FORT "FOR"
	.IFT FOR .SETS SYSLIB "SY:[1,1]SYSLIBOLD/LB"
	.SETS FORT FORT+" USER;1,LP;1/-SP="
	.IFF NOFLE .SETS FORT FORT+"USER;1"
	.IFT NOFLE .SETS FORT FORT+FIL
	.IFF NOFLE .AND .IFT FOR .SETS FORT FORT+"/-EX"
	.IFF FOR .SETS FORT FORT+"/-WR"+FORSW
	.IFT FOR .SETS FORT FORT+"/LI:1"
	.TEST SYSLIB
	.SETN NUM NUM+<STRLEN>
	.IFF <ESCAPE> .ASK GRA DO YOU WANT THE VT11 GRAPICS LIBRARY
	.IFT GRA .AND .IFT FOR .SETS GRAPH "SY:[1,1]GLIB/LB"
	.IFT GRA .AND .IFF FOR .SETS GRAPH "SY:[1,1]F4PGLIB/LB"
	.IFT GRA .SETN NUM 90.
	.IFT <ESCAPE> .GOTO 9
	.SETF Z
	.IF OFIL NE NL .ASK Z DO YOU WANT TO RETAIN <'OFIL'>
	.IFT <ESCAPE> .OR .IFT Z .GOTO 9
	.SETS OFIL NL
	; TYPE OTHER .OBJ FILES TO INCLUDE AT TASKBUILD
	.ASKS ZZ (SEPARATE WITH COMMAS)
	.IFT <ESCAPE> .GOTO 9
	.IF ZZ NE NL .SETS OFIL ","+ZZ
.9:	.TEST OFIL
	.SETN NUM NUM+<STRLEN>
	; THE CORRECT FORTRAN AND GRAPHICS LIBRARIES HAVE BEEN SELECTED
	.IFF <ESCAPE>;, HOWEVER, ADDITIONAL LIBRARIES MAY BE ADDED
.10:	.IFT <ESCAPE> .GOTO SKPLIB
	.SETF Z
	.IF LIB NE NL .ASK Z DO YOU WANT <'LIB'>
	.IFT <ESCAPE> .OR .IFT Z .GOTO SKPLIB
	.SETS LIB NL
	.ASKS  ZZ SPECIAL LIBRARY  TO INCLUDE
	.IF ZZ EQ NL .OR .IFT <ESCAPE> .GOTO SKPLIB
	.ASKS WHR1 WHAT DISK AND UIC IS IT IN (SY:[1,1] DEFAULT)
	.IFT <ESCAPE> .SETS WHR1 NL
	.IF WHR1 = NL .SETS WHR1 "SY:[1,1]"
	.IF LIB NE NL .SETS LIB LIB+","
	.SETS LIB LIB+WHR1+ZZ+"/LB"
	.GOTO 10
.SKPLIB:
	.TEST LIB
	.SETN NUM NUM+<STRLEN>
	PIP USER.CMD;*/DE,USERBLD.CMD;*
.OPEN USER.DAT;1
.ENABLE DATA
.ENABLE SUBSTITUTION
.ENABLE GLOBAL
.SETS $FIL "'FIL'"
.SETS $LIB "'LIB'"
.SETS $OFIL "'OFIL'"
.SETS $FORSW "'FORSW'"
.SETS $TKBSH "'TKBSH'"
.SETS $ACTF "'ACTF'"
.SETS $UNIT "'UNIT'"
.DISABLE DATA
	.IFT NOFLE .DATA .SETT $NOFLE
	.IFF NOFLE .DATA .SETF $NOFLE
	.IFT FOR .DATA .SETT $FOR
	.IFF FOR .DATA .SETF $FOR
	.IFT GRA .DATA .SETT $GRA
	.IFF GRA .DATA .SETF $GRA
.CLOSE
	.IF TKBSH NE NL .GOTO LONG
	.IF NUM GT 65 .GOTO LONG
	.SETS MLST ",LP;1/-SP"
	.IF LIB NE NL .SETS LIB ","+LIB
	.IF SYSLIB NE NL .SETS SYSLIB ","+SYSLIB
.OPEN USER.CMD
.ENABLE DATA
'FLEX'
'FORT'
FTB 'FIL';1'MLST'=USER;1'OFIL''LIB''SYSLIB'
.DISABLE DATA
.CLOSE
	.GOTO END2
.LONG:
.OPEN USER.CMD
.ENABLE DATA
TIM
'FLEX'
'FORT'
TKB @USERBLD
TIM
;
/
.DISABLE DATA
	.CLOSE
	.IFT GRA .SETS MLST "/-CP"+MLST
.OPEN USERBLD.CMD
.ENABLE DATA
'FIL';1'MLST'=USER;1'OFIL'
'LIB'
'TKBSH'
'SYSLIB'
'GRAPH'
/
ACTFIL='ACTF'
UNITS='UNIT'
.DISABLE DATA
	.IFF GRA .GOTO END
.ENABLE DATA
ASG=GR0:1
MAXBUF=512
COMMON=DFILE:RW
PRI=45
TASK=VT11
.DISABLE DATA
.END:
.DATA /
	.CLOSE
.END2:
	.CHAIN USER
/
