.ENABLE SUBSTITUTION
.ENABLE ESCAPE
.ENABLE GLOBAL
.DISABLE LOWERCASE
	.SETF REMFLX
	.SETF REMPIP
	.SETF REMFOR
	.SETF REMLBR
	.SETF REMMAC
	.SETF REMTKB
	.SETS BEGINT "'<DATE>' '<TIME>'"
	.IFNINS PIP .SETT REMPIP
	.IFNINS LBR .SETT REMLBR
	.IFNINS MAC .SETT REMMAC
	.IFNINS TKB .SETT REMTKB
	.IFT REMPIP INS $PIP
	.IFT REMLBR INS $LBR
	.IFT REMMAC INS $MAC
	.IFT REMTKB INS $TKB
;
;	SOFTWARE TOOLS FOR RSX-11M[+] -- SPRING '82 DECUS DISTRIBUTION
;
;	TOOLGEN STARTED ON '<DATE>' AT '<TIME>'
;
;	YOU MAY REQUEST EXPANDED COMMENTS ON ANY QUESTION BY RESPONDING
;	WITH AN ESCAPE.
;
	.ASK XPD DO YOU WISH TO SEE ALL EXPANDED COMMENTS
	.IFF XPD .GOTO Q0
.H0:
;
;	The Mail system needs to know the time zone in which your
;	machine resides.  Just type in the appropriate three
;	character mnemonic
;
;	eg.	PST
;
.Q0:
	.ASKS TZONE 0. WHAT IS YOUR TIME ZONE [ XXX - DEFAULT: PST ]
	.IFT <ESCAPE> .GOTO H0
	.IF <STRLEN> = 0 .SETS TZONE "PST"
	.IFF XPD .GOTO Q05
.H05:
;
;	By default, the tools write over the contents of an existing file
;	when told to access a file at WRITE access.  Answering YES to this
;	question causes a new version of the file to be created.
;
.Q05:
	.ASK NEWVER 0.5 CREATE NEW VERSION WHEN ACCESSING FILE AT WRITE ACCESS
	.IFT <ESCAPE> .GOTO H05
	.IFF XPD .GOTO Q1
.H1:
;
;	THE TOOLS MAY PASS ARGUMENTS BETWEEN PARENT AND CHILD PROCESSES
;	VIA TWO DIFFERENT MECHANISMS
;
;	1.	USING INTERMEDIATE FILES IN THE SCRATCH DIRECTORY
;
;	2.	USING THE VARIABLE-LENGTH SEND/RECEIVE DRIVER
;		PROVIDED ON THE DISTRIBUTION
;
;	BESIDES PERMITTING THE PASSING OF ARGUMENTS BETWEEN TOOLS, THE
;	SEND/RECEIVE DRIVER PERMITS ANY TASK TO SEND ARBITRARY LENGTH
;	MESSAGES TO ANY OTHER TASK.  SEE THE FILE [307,34]SRDRV.DOC
;	FOR MORE DETAILS.
;
.Q1:
	.ASK USESR 1. DO YOU WISH TO USE THE SEND/RECEIVE DRIVER
	.IFT <ESCAPE> .GOTO H1
	.IFF USESR .GOTO CONT1
	.IFLOA SR: .GOTO CONT1
;
;	TOOLGEN IS VERY INCESTUOUS, IN THAT SOME TOOLS ARE USED TO BUILD
;	THE OTHERS.  IN PARTICULAR, THE SHELL MUST BE ABLE TO SPAWN
;	CHILD PROCESSES AND PASS ARGUMENTS TO THEM.  IF THE SEND/RECEIVE
;	DRIVER WAS CHOSEN, THEN IT MUST BE BUILT AND LOADED INTO MEMORY
;	BEFORE TOOLGEN CAN CONTINUE
;
;
;	SINCE SR: IS NOT LOADED, WE WILL TERMINATE
;	THIS SESSION.  CONSULT THE FILE [307,34]SRDRV.DOC FOR INFORMATION
;	ON THE DRIVER, AND IN PARTICULAR, ON HOW TO BUILD IT.
;
	.EXIT
.CONT1:
.;
.;	CLEAN UP AFTER ANY PREVIOUSLY ABORTED TOOLGEN'S
.;
	.IFINS SHX REM SHX
	.IFINS LSX REM LSX
	.IFINS CHX REM CHX
	.IFINS LDX REM LDX
	.IFINS FCX REM FCX
	.IFF XPD .GOTO Q2
.H2:
;
;	ALL OF THE IMAGE AND READ-ONLY TEXT FILES ARE KEPT IN DIRECTORIES
;	ON THE LOGICAL DEVICE ST0:.  THE DIRECTORIES ARE GIVEN THE
;	PROTECTION [RWE,RWE,RE,RE]
;
.Q2:
	.ASKS DEV 2. DEVICE AND UNIT FOR ST0 [ DDN - DEFAULT: LB0 ]
	.IFT <ESCAPE> .GOTO H2
	.IF <STRLEN> = 0 .SETS DEV "LB0"
	.SETS RDEV DEV+":"
	.SETS TMPS DEV
	.IFF XPD .GOTO Q3
.H3:
;
;	THE SCRATCH DIRECTORY AND THAT FOR FORMATTED LPR FILES RESIDE
;	ON THE LOGICAL DEVICE ST1:.  THESE DIRECTORIES ARE GIVEN THE
;	PROTECTION [RWE,RWE,RWE,RWE]
;
.Q3:
	.ASKS DEV 3. DEVICE AND UNIT FOR ST1 [ DDN - DEFAULT: 'TMPS' ]
	.IFT <ESCAPE> .GOTO H3
	.IF <STRLEN> = 0 .SETS DEV TMPS
	.SETS WDEV DEV+":"
	ASN 'RDEV'=ST0:
	ASN 'WDEV'=ST1:
	.IFF XPD .GOTO Q4
.H4:
;
;	THE TOOLS OCCUPY 6 UIC'S, ALL IN THE SAME GROUP.  THE DEFAULT
;	GROUP IS 105, BUT YOU MAY CHANGE THIS AT THIS TIME.
;
.Q4:
	.ASKN [0:377:105] GRP 4. GROUP FOR TOOLS SYSTEM
	.IFT <ESCAPE> .GOTO H4
	.IFF XPD .GOTO Q5
.H5:
;
;	THE TOOLS OCCUPY 6 CONSECUTIVE MEMBER NUMBERS IN GROUP 'GRP'.
;	THE DEFAULT BASE FOR THIS SEQUENCE IS 1, BUT YOU MAY CHANGE THIS
;	AT THIS TIME
;
.Q5:
	.ASKN [1:370:1] MEM 5. MEMBER NO FOR BIN DIRECTORY
	.IFT <ESCAPE> .GOTO H5
	.SETS BIN "'GRP'"+","+"'MEM'"
	.INC MEM
	.SETS USR "'GRP'"+","+"'MEM'"
	.INC MEM
	.SETS TMP "'GRP'"+","+"'MEM'"
	.INC MEM
	.SETS LPR "'GRP'"+","+"'MEM'"
	.INC MEM
	.SETS MSG "'GRP'"+","+"'MEM'"
	.INC MEM
	.SETS MAN "'GRP'"+","+"'MEM'"
;
;	NOW CREATE THE NECESSARY UIC'S ON THE TARGET DISKS WITH
;	THE APPROPRIATE PROTECTION
;
	UFD 'RDEV'['BIN']/PRO=[RWE,RWE,RE,RE]
	UFD 'RDEV'['USR']/PRO=[RWE,RWE,RE,RE]
	UFD 'WDEV'['TMP']/PRO=[RWE,RWE,RWE,RWE]
	UFD 'WDEV'['LPR']/PRO=[RWE,RWE,RWE,RWE]
	UFD 'WDEV'['MSG']/PRO=[RWE,RWE,RE,RE]
	UFD 'RDEV'['MAN']/PRO=[RWE,RWE,RE,RE]
	.IFF XPD .GOTO Q5A
.H5A:
;
;	IF YOU ARE DOING YOUR SECOND OR WORSE TOOLGEN ON THE SAME DIRECTORIES,
;	IT IS NECESSARY TO CLEAN UP ALL DIRECTORIES BUT ['USR']
;	IF YOU ANSWER NO, WE EXIT TO PERMIT YOU TO SAVE APPROPRIATE FILES
;
.Q5A:
	.ASK CLEAND 5A. DELETE ALL OLD FILES ON THE TOOLS DIRECTORIES
	.IFT <ESCAPE> .GOTO H5A
	.IFF CLEAND .EXIT
	.IFF XPD .GOTO Q6
.H6:
;
;	IF YOU OBTAINED YOUR DISTRIBUTION FROM THE DECUS SIG SYMPOSIUM
;	TAPE, THEN YOU HAVE ALREADY BRU'ED THE NECESSARY FILES ONTO A
;	DISK.  SOME OF YOU MAY HAVE RECEIVED YOUR DISTRIBUTION IN DOS
;	FORMAT VIA DIFFERENT DISTRIBUTION.  TOOLGEN WILL PERMIT
;	THE PEOPLE IN THE LATTER CATEGORY TO BUILD THE SYSTEM DIRECTLY
;	FROM THE TAPE, ALTHOUGH THAT IS MUCH SLOWER.   A COPY OF FFL
;	IS PROVIDED IN [307,30] IF YOU WISH TO STOP NOW AND ZAP THE
;	FILES TO DISK
;
.Q6:
	.ASK IFTAPE 6. BUILDING DIRECTLY FROM DOS DISTN TAPE
	.IFT <ESCAPE> .GOTO H6
	.IFF IFTAPE .GOTO CONT2
	.IFF XPD .GOTO Q6A
.H6A:
;
;	INPUT THE NAME OF THE MAG TAPE DEVICE UPON WHICH THE DOS TAPE
;	IS MOUNTED.  TOOLGEN WILL CHECK TO SEE IF FLX IS INSTALLED, AND
;	WILL INSTALL IT IF NOT.
;
.Q6A:
	.ASKS IDEV 6A. TAPE DEVICE AND UNIT NUMBER [ DDN - DEFAULT: MM0 ]
	.IFT <ESCAPE> .GOTO H6A
	.IF <STRLEN> = 0 .SETS IDEV "MM0"
	.IFINS FLX .GOTO CONT3
	.SETT REMFLX
	INS $FLX
	.GOTO CONT3
.CONT2:
	.IFF XPD .GOTO Q6B
.H6B:
;
;	INPUT THE NAME OF THE DISK UPON WHICH THE UIC [307,31]
;	HAS BEEN COPIED FROM THE DISTN TAPE.  TOOLGEN WILL CHECK
;	TO SEE IF PIP IS INSTALLED, AND WILL INSTALL IT IF NOT.
;
.Q6B:
	.ASKS IDEV 6B. DISK DEVICE AND UNIT [ DDN - DEFAULT: LB0 ]
	.IFT <ESCAPE> .GOTO H6B
	.IF <STRLEN> = 0 .SETS IDEV "LB0"
.CONT3:
	.SETS TAPE IDEV+":"
	.IFF XPD .GOTO Q7
.H7:
;
;	THE TOOLS WORK WITH BOTH THE FORTRAN IV AND 4+ COMPILERS.
;	THIS QUESTION INDICATES TO TOOLGEN WHICH COMPILER YOU WISH TO
;	USE.
;
.Q7:
	.ASK COMPLR 7. DO YOU WISH TO USE THE F4P COMPILER
	.IFT <ESCAPE> .GOTO H7
	.SETS FORTRN "F4P"
	.SETS FORTSW "/NOTR/NOCK/CO:19./RO"
	.IFT COMPLR .GOTO CONT4
	.SETS FORTRN "FOR"
	.SETS FORTSW "/NOSN/NOVA/NOLO/RO"
.CONT4:
	.SETS CMPNAM FORTRN
	.IFINS 'FORTRN' .GOTO CONT5
;
;	YOU DO NOT HAVE 'FORTRN' INSTALLED UNDER THAT NAME.  TOOLGEN
;	MUST INSTALL IT UNDER THAT NAME, BUT WILL REMOVE IT AT THE END.
;
;	IN ADDITION, YOU MUST ANSWER THE NEXT QUESTION TO PERMIT FC TO
;	BE BUILT PROPERLY FOR THE WAY YOU NORMALLY INSTALL 'FORTRN'
;
	.SETT REMFOR
	.IFF XPD .GOTO Q7A
.H7A:
;
;	ENTER THE NAME UNDER WHICH THE COMPILER IS NORMALLY INSTALLED.  IF
;	YOU USE A CATCH ALL TASK, GIVE THE NAME OF THE TASK IMAGE AS IT
;	RESIDES IN THE KNOWN DIRECTORY - I.E IF IT IS [1,54]F30.TSK (TO
;	PERMIT BOTH F4P 2.51 AND 3.0 TO RESIDE IN THE SAME SYSTEM) THEN
;	RESPOND 	F30
;
.Q7A:
	.ASKS CMPNAM 7A. WHAT IS THE NORMAL NAME OF THE COMPILER
	.IFT <ESCAPE> .GOTO H7A
	.IF <STRLEN> > 0 .GOTO CONT5
;
;	YOU MUST GIVE AN ANSWER TO QUESTION 7A, SINCE I MUST INSTALL THE DAMN
;	COMPILER.
;
	.GOTO Q7A
.CONT5:
	.IFNINS 'FORTRN' INS $'CMPNAM'/TASK=...'FORTRN'
	.IFF XPD .GOTO Q8
.H8:
;
;	MANY SITES DO NOT PLACE THE FORTRAN OBJECT TIME SYSTEM (OTS)
;	LIBRARY INTO LB:[1,1]SYSLIB.  THIS QUESTION QUERIES THAT SITUATION.
;
.Q8:
	.ASK SYSOTS 8. IS THE FORTRAN OTS IN LB:[1,1]SYSLIB.OLB
	.IFT <ESCAPE> .GOTO H8
	.SETS OTSFIL "LB0:[1,1]SYSLIB"
	.IFT SYSOTS .GOTO CONT6
	.IFF XPD .GOTO Q8A
.H8A:
;
;	INPUT THE FILE SPEC OF THE FORTRAN OTS LIBRARY.  IT MUST BE THE
;	FULL FILE SPECIFICATON - I.E DDN:[G,M]NAME
;
;	FOR EXAMPLE	LB:[1,1]'CMPNAM'OTS
;
.Q8A:
	.ASKS OTSFIL 8A. FILE SPEC FOR OTS LIB [DEFAULT: LB:[1,1]'CMPNAM'OTS]
	.IFT <ESCAPE> .GOTO H8A
	.IF <STRLEN> = 0 .SETS OTSFIL "LB:[1,1]'CMPNAM'OTS"
.CONT6:
	.SETT FPP
	.SETS LDFIL "LDFP"
	.IFT COMPLR .GOTO CONT7
	.IFF XPD .GOTO Q9
.H9:
;
;	YOUR SITE MAY BE RUNNING FORTRAN IV FOR COMPATIBILITY WITH OTHER
;	PDP11'S WITHOUT FPP, BUT YOU MAY BE USING THE FPPOTS FOR FORTRAN
;	IV ON YOUR MACHINE WITH A FLOATING POINT PROCESSOR.  THE FOLLOWING
;	QUESTION PERMITS LD TO BUILD THE TASKS /FP IF THIS IS THE CASE.
;
.Q9:
	.ASK FPP 9. DO YOU WISH THE TASKS BUILT /FP
	.IFT <ESCAPE> .GOTO H9
	.IFF FPP .SETS LDFIL "LDNOFP"
.CONT7:
	.SETS FPSW "/FP"
	.IFF FPP .SETS FPSW "/-FP"
	.IFF XPD .GOTO Q10
.H10:
;
;	IF YOU HAVE AN FCS RESIDENT LIBRARY INSTALLED, THE TOOLS MAY BE
;	TASKBUILT OVER IT.  THIS RESULTS IN CONSIDERABLE SAVINGS IN
;	THE DISK SPACE REQUIRED FOR THE TASK IMAGES, SINCE EACH TOOL
;	WILL DRAG IN APPROX. 6500 BYTES OF FCS.  IN ADDITION, FCSRES
;	GREATLY REDUCES THE CHECKPOINT ACTIVITY OF YOUR SYSTEM.  SEE
;	[307,30]RELEASE.DOC FOR MORE DETAILS ON FCSRES
;
.Q10:
	.ASK FCSRES 10. DO YOU WISH TO LINK TO AN FCS RESIDENT LIBRARY
	.IFT <ESCAPE> .GOTO H10
	.SETS RESLIB ";"
	.IFF FCSRES .GOTO CONT8
	.IFF XPD .GOTO Q10A
.H10A:
;
;	INPUT THE TKB OPTION LINE FOR LINKING TO THE RESIDENT LIBRARY
;	THE DEFAULT IS "LIBR=FCSRES:RO"
;
;	ON M+ SYSTEMS WITH A SUPERVISOR MODE FCS LIBRARY, INPUT
;
;			SUPLIB=FCSFSL:SV
;
.Q10A:
;	INPUT THE TKB OPTION LINE FOR LINKING TO THE RESIDENT LIBRARY
	.ASKS RESLIB TKB OPTION LINE [DEFAULT - LIBR=FCSRES:RO ]
	.IFT <ESCAPE> .GOTO H10A
	.IF <STRLEN> = 0 .SETS RESLIB "LIBR=FCSRES:RO"
.CONT8:
	.IFF XPD .GOTO Q11
.H11:
;
;	THE FOLLLOWING TWO QUESTIONS PERMIT THE USER TO CONTROL THE AMOUNT
;	OF SPACE THAT THE COMPLETED SYSTEM WILL TAKE UP ON THE TARGET DISK.
;
;	IF NONE OF THE FILES ARE DELETED DURING THE PROCESSING, THE ENTIRE
;	SYSTEM OCCUPIES APPROX 16600 BLOCKS
;
;	IF THE FORTRAN AND MACRO SOURCE FILES ARE DELETED ALONG THE WAY,
;	A SAVINGS OF 2575 BLOCKS ENSUES.
;
;	IF THE OBJECT FILES ARE DELETED AFTER USE, WE SAVE ANOTHER 3325 BLOCKS
;
;	DELETED		SPACE OCCUPIED
;	-------		--------------
;	 NONE		   16600
;	  .F		   14050
;	 .OBJ		   13300
;	 BOTH		   10725
;
;	OF COURSE, IF YOU LINK WITH FCSRES, YOUR TOTAL SPACE WILL BE
;	SMALLER BY ANOTHER 2800 BLOCKS
;
.Q11:
	.ASK $SRCDE 11A. DELETE THE FORTRAN AND MACRO SOURCES AS WE PROGRESS
	.IFT <ESCAPE> .GOTO H11
	.ASK $OBJDE 11B. DELETE THE OBJECT FILES AS WE GO ALONG
	.IFT <ESCAPE> .GOTO H11
;
;	NOW WE START TO PROCESS
;
;	FIRST COPY THE FILES TO THE APPROPRIATE DIRECTORIES
;
	ASN 'RDEV'=SY:
.CONT9:
	.IFF CLEAND .GOTO CONT10
	PIP ['BIN']*.*;*/DE/NM
	PIP ST1:['TMP']*.*;*/DE/NM
	PIP ST1:['LPR']*.*;*/DE/NM
	PIP ST1:['MSG']*.*;*/DE/NM
	PIP ['MAN']*.*;*/DE/NM
.CONT10:
	.IFT IFTAPE FLX ['BIN']/RS='TAPE'[307,31]*.*/DO
	.IFF IFTAPE PIP ['BIN']*.*;*='TAPE'[307,31]*.*;*
;
;	EXTRACT NEEDED TASK IMAGES FROM UNIVERSAL LIBRARY
;
	LBR ['BIN']CH.TSK=['BIN']SUPPORT.ULB/EX:CH
	LBR ['BIN']LS.TSK=['BIN']SUPPORT.ULB/EX:LS
	PIP ['BIN']SUPPORT.ULB;*/DE
;
;	MAKE SURE .F FILES ARE VERSION 1
;
	PIP ['BIN']*.F;1=['BIN']*.F;*/RE
	PIP ['BIN']*.;1=['BIN']*.;*/RE
;
;	NOW MODIFY THE SOURCE FILES WHICH REFERENCE ['BIN'] -> ['MAN']
;
	INS ['BIN']CH/TASK=...CHX
	PIP ['BIN']GETDIR.SRC=['BIN']GETDIR.MAC
	CHX <['BIN']GETDIR.SRC >['BIN']T.1 105,1 'BIN'
	CHX <['BIN']T.1 >['BIN']T.2 105,2 'USR'
	CHX <['BIN']T.2 >['BIN']T.1 105,3 'TMP'
	CHX <['BIN']T.1 >['BIN']T.2 105,4 'LPR'
	CHX <['BIN']T.2 >['BIN']T.1 105,5 'MSG'
	CHX <['BIN']T.1 >['BIN']GETDIR.MAC 105,6 'MAN'
	CHX <['BIN']BSPAWN.SRC >['BIN']T.1 105,1 'BIN'
	CHX <['BIN']T.1 >['BIN']BSPAWN.SRC 105,3 'TMP'
	PIP ['BIN']T.*;*/DE
;
;	NOW BUILD SITE-DEPENDENT FILES FROM ANSWERS TO ABOVE QUESTIONS
;
	PIP ['BIN']LD.FF=['BIN']'LDFIL'.FF
	.TEST CMPNAM
	.IFT COMPLR CHX <['BIN']FCF4P.FF >['BIN']FC.FF 3HF4P '<STRLEN>'H'CMPNAM'
	.IFF COMPLR CHX <['BIN']FCFOR.FF >['BIN']FC.FF 3HFOR '<STRLEN>'H'CMPNAM'
	.SETS ALFBET "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	.SETS X TZONE[1:1]
	.SETN I 1
.101:
	.IF I > 26. .GOTO 102
	.SETS Y ALFBET['I':'I']
	.IF X = Y .GOTO 102
	.INC I
	.GOTO 101
.102:
	.SETN I I+64.
	CHX <['BIN']PRIMPST.FF >['BIN']PRIM.FF "TZONE(1)/80" "TZONE(1)/'I'"
	.OPEN ['BIN']ASM.PRE
	.DATA 	.NLIST
	.IFT USESR .DATA SRDRV=0
	.IFT NEWVER .DATA NEWVER=0
	.DATA 	.LIST
	.CLOSE
	.OPENA ['BIN']SYMBOLS.
	.DATA DEFINE(TIME_ZONE,"'TZONE'")
	.DATA DEFINE(FORT_COMP,'FORTRN')
	.DATA DEFINE(COMP_NAME,"'CMPNAM'")
	.IFT FPP .DATA DEFINE(FLOAT_PT,YES)
	.IFF FPP .DATA DEFINE(FLOAT_PT,NO)
	.CLOSE
	.OPEN ['BIN']TOOLS.TKB
	.DATA 'OTSFIL'/LB:$SHORT
	.IFF SYSOTS .DATA 'OTSFIL'/LB
	.DATA /
	.DATA UNITS=8
	.DATA ACTFIL=7
	.IFT FCSRES .DATA 'RESLIB'
	.DATA //
	.CLOSE
;
;	HERE IS THE TEMPLATE TKB COMMAND FILE USED TO TASK BUILD THE TOOLS
;
PIP TI:=['BIN']TOOLS.TKB
;
;	NOW WE BUILD THE TOOLS LIBRARY, RLIB.OLB
;
;	ASSEMBLE ALL OF THE .MAC FILES
;
	INS ['BIN']LS/TASK=...LSX
	LSX /'BIN'/.MAC >/'BIN'/T.1
	CHX </'BIN'/T.1 >/'BIN'/T.2 ".?*$"
	CHX </'BIN'/T.2 >/'BIN'/ASSEMBLE.CMD "%?*$" "['BIN']&=['BIN']ASM.PRE,&"
	PIP TI:=['BIN']ASSEMBLE.CMD
	MAC @['BIN']ASSEMBLE
	PIP ['BIN']ASSEMBLE.OBS=['BIN']*.OBJ
.CONT11:
	LBR ['BIN']RLIB.OLB/CR:400.:1024.:1024.=['BIN']ASSEMBLE.OBS
	PIP ['BIN']*.OBS;*/DE,T.*;*,ASSEMBLE.CMD;*,GETDIR.SRC;*,PRIMPST.FF;*
	.IFT $SRCDE PIP ['BIN']*.MAC;*/DE
	.IFT $OBJDE PIP ['BIN']*.OBJ;*/DE
;
;	NOW COMPILE THE PRIMITIVE FUNCTIONS IN RATFOR AND PLACE THEM IN
;	THE LIBRARY
;
	'FORTRN' ['BIN']PRIM=['BIN']PRIM.FF'FORTSW'
	'FORTRN' ['BIN']LIB=['BIN']LIB.FF'FORTSW'
	LBR ['BIN']RLIB/RP=['BIN']PRIM,LIB
	.IFT $SRCDE PIP ['BIN']PRIM.FF;*/DE,LIB.FF;*
	.IFT $OBJDE PIP ['BIN']PRIM.OBJ;*/DE,LIB.OBJ;*
;
;	NOW BUILD LD AND FC, WHICH AUTOMATE THE REST OF THE TOOLGEN
;
	'FORTRN' ['BIN']LD=['BIN']LD.FF'FORTSW'
	'FORTRN' ['BIN']FC=['BIN']FC.FF'FORTSW'
	.IFT $SRCDE PIP ['BIN']LD.FF;*/DE,FC.FF;*,FCFOR.FF;*,FCF4P.*;*
	.IFT $SRCDE PIP ['BIN']LDFP.FF;*/DE,LDNOFP.FF;*
	.OPEN ['BIN']LD.TKB
	.DATA ['BIN']LD/CP'FPSW'=
	.DATA ['BIN']LD
	.DATA ['BIN']RLIB/LB:.MAIN.
	.DATA ['BIN']RLIB/LB
	.CLOSE
	PIP ['BIN']LD.TKB/AP=['BIN']TOOLS.TKB
	TKB @['BIN']LD.TKB
	INS ['BIN']LD/TASK=...LDX
	LDX -V ['BIN']FC
	REM LDX
	.IFT $OBJDE PIP ['BIN']LD.OBJ;*/DE,FC.OBJ;*
	INS ['BIN']FC/TASK=...FCX
	.OPEN ['BIN']FEL.TKB
	.DATA ['BIN']FELLTREE/CP/-FP=['BIN']RLIB/LB:FEL
	.DATA /
	.DATA UNITS=1
	.DATA TASK=...FEL
	.DATA STACK=64
	.DATA //
	.CLOSE
	TKB @['BIN']FEL.TKB
;
;
;	NOW BUILD A COMMAND FILE TO COMPILE AND LINK ALL OF THE TOOLS
;
	LSX /'BIN'/.F$ >/'BIN'/T.1
	CHX </'BIN'/T.1 >/'BIN'/FLIST ".?*$"
;
;	TAKE A LONG BREAK - IT TAKES BETWEEN ONE AND TWO HOURS TO BUILD
;	THESE TASKS
;
	.OPENR ['BIN']FLIST.
.10:
	.READ FILE
	.IF <FILERR> <> 1 .GOTO 20
	FCX ['BIN']'FILE'.F
	.IFT $SRCDE PIP ['BIN']'FILE'.F;*/DE
	.IFT $OBJDE PIP ['BIN']'FILE'.OBJ;*/DE
	.GOTO 10
.20:
	.CLOSE
	PIP ['BIN']T.*;*/DE,FLIST.*;*
;
;	NOW WE JUST HAVE A LITTLE BIT OF CLEANUP LEFT
;
;	FIXUP SCRIPT FILES REFERENCING ['BIN'] -> ['MAN']
;
	INS ST0:['BIN']SH/TASK=...SHX
	SHX -X ['BIN']FIXUP 'BIN' 'TMP'
	PIP ST1:['MSG']*.*=['BIN']MSGHLP.
	PIP ['BIN']MSGHLP.;*/DE
;
;	FIXUP FILES NEEDING TO KNOW THE VALUES OF ST0: AND ST1:
;
	SHX -X ['BIN']DFIXUP 'RDEV' 'WDEV'
;
;	BUILD DICTIONARY INDEX FOR SPELL TOOL
;
	SHX -C "ISAM <['BIN']DICT >['BIN']DICTDX -D20"
;
;	TRIM THE FILES IN ['BIN']
;
	PIP ['BIN']FIXUP.;*/DE,DFIXUP.;*
	PIP ['BIN']*.*;*/PR/WO:RE
	PIP ['BIN']*.*;*/TR
;
;	BUILD DOCUMENTATION DIRECTORY ['MAN']
;
	PIP ['MAN']S1.;1=['BIN']SECT1.;1/RE
	PIP ['MAN']S2.;1=['BIN']SECT2.;1/RE
	PIP ['MAN']S3.;1=['BIN']SECT3.;1/RE
	PIP ['MAN']S4.;1=['BIN']SECT4.;1/RE
	SHX -C "ASAM <['MAN']S1 | SORT >['MAN']I1"
	SHX -C "ASAM <['MAN']S2 | SORT >['MAN']I2"
	SHX -C "ASAM <['MAN']S3 | SORT >['MAN']I3"
	SHX -C "ASAM <['MAN']S4 | SORT >['MAN']I4"
	PIP ['MAN']*.*;*/PR/WO:RE
	PIP ['MAN']*.*;*/TR
;
;	NOW BUILD THE MAIL SYSTEM
;
;	FIRST WE MUST SAVE OUR UIC AND SET UIC TO [1,1]
;	THIS IS NECESSARY FOR ADDR TO BE ABLE TO READ [0,0]RSX11.SYS FOR
;	THE ACCOUNT INFORMATION
;
	.SETS SUIC "'<UIC>'"
	SET /UIC=[1,1]
;
;	READ [0,0]RSX11.SYS AND SORT THE OUTPUT FILE ONTO ST1:['MSG']ADDRESS
;
;	THE FORMAT OF AN ENTRY IN ST1:['MSG']ADDRESS IS:
;
;	USERNAME	HOME DIRECTORY		UIC		INFO
;
	SHX -C "ADDR | SORT >ST1:['MSG']ADDRESS"
	PIP ST1:['MSG']*.*;*/PR/WO:RE
	PIP ST1:['MSG']*.*;*/TR
;
;	NOW GENERATE A COMMAND FILE TO PLACE A DUMMY COPY OF "MYMAIL" IN
;	EACH USER'S HOME DIRECTORY.  THE PROTECTION ON "MYMAIL" IS
;	SET TO [RWE,RWE,RWE,RWE]
;
	SHX -V ['BIN']MYMAIL.BLD
;
;	NOW INVOKE THE GENERATED COMMAND FILE
;
	@['BIN']MYMAIL
;
;	NOW REMOVE ALL INSTALLED TASKS
;
	.IFINS SHX REM SHX
	.IFINS LSX REM LSX
	.IFINS CHX REM CHX
	.IFINS LDX REM LDX
	.IFINS FCX REM FCX
	.IFT REMFLX REM FLX
	.IFT REMPIP REM PIP
	.IFT REMFOR REM 'FORTRN'
	.IFT REMLBR REM LBR
	.IFT REMMAC REM MAC
	.IFT REMTKB REM TKB
	ASN =ST0:
	ASN =ST1:
	ASN =SY:
;
;	HERE IS A LISTING OF THE SUGGESTED TOOLS SPECIFIC STARTUP FILE
;
;	THIS FILE SHOULD BE COPIED TO LB:[1,2] AND INVOKED FROM
;	LB:[1,2]STARTUP.CMD TO CAUSE THE TOOLS SYSTEM TO BE KNOWN
;	WHEN THE SYSTEM BOOTS
;
	PIP TI:='RDEV'['BIN']TOOLS.CMD
;
;	THE SUGGESTED PROCEDURE FROM HERE IS AS FOLLOWS
;
;	>@'RDEV'['BIN']TOOLS		! GET TOOLS RUNNING NOW
;	>SET /UIC=[1,2]
;	>PIP *.*/NV='RDEV'['BIN']TOOLS.CMD	! COPY STARTUP TO [1,2]
;	>EDIT STARTUP.CMD TO INVOKE TOOLS.CMD
;
;	IF YOU WISH TO SUPPORT BACKGROUND PROCESSING FROM THE SHELL,
;	IT WILL BE NECESSARY FOR YOU TO RUN A SEPARATE COMMAND FILE.
;	SIMPLY TYPE:
;
;	>@'RDEV'['BIN']BSPBLD
;
;	WHEN THIS COMMAND FILE COMPLETES
;
;
;	IF YOU WISH TO BUILD A MULTI-USER VERSION OF THE SHELL,
;	IT WILL BE NECESSARY FOR YOU TO EXECUTE THE FOLLOWING
;	COMMANDS AT THE COMPLETION OF TOOLGEN:
;
;	1. COPY SH.W FROM THE DISTRIBUTION DEVICE TO A WORKING UIC
;	2. @ST0:['BIN']MUSHBLD
;
;	THE MULTI-USER VERSION OF THE SHELL WILL BE BUILT ON THE
;	DEFAULT UIC WHEN THE COMMAND FILE IS INVOKED
;
;
;
;	TOOLGEN COMPLETED ON '<DATE>' AT '<TIME>'
;
;	START 'BEGINT'
;	END   '<DATE>' '<TIME>'
;
	SET /UIC='SUIC'
