.ENABLE SUBSTITUTION
.ENABLE GLOBAL
.;
	.SETS mac "MAC"
	.SETS macro "MAC"
	.SETS f4p "F4P"
	.SETS for "FTN"
	.SETS swt "/NOTR"
	.SETS lbr "LBR"
	.SETS lbrnam "HAYS1.OLB"
	.SETS lbrswt "/RP"
	.TESTFILE 'lbrnam'
	.IF <filerr> <> 1 .SETS lbrswt "/CR"
.;
	.SETS fil1 "TBUILT.MAC"
	.SETS fil2 "GETLOG.FTN"
	.SETS fil3 "MCRSPW.FTN"
	.SETS fil4 "GETDEF.FTN"
	.SETS fil5 "FUNCTNS.FTN"
	.SETS fil6 ""			! Mark end of file list.
.;
	.SETT first
	.SETN i 1
	.SETD i
.Loop:
	.IFNDF fil'i' .GOTO Inccnt
	.IF fil'i' = "" .GOTO Xit	! End of file list.
	    .PARSE fil'i' "." name ext	! Parse name and extension.
	    .IF ext = mac .GOTO M11	! Use Macro-11.
	    .IF ext = for .GOTO Fortr	! Use Fortran.
		.DISABLE QUIET
		;%MAKLIB-F-EXT, Illegal file extension 'ext'.
		.ENABLE QUIET
		.GOTO Xit
.M11:	    'macro' 'name'='name'	! Assemble module.
	    .GOTO Libins		! Put it in library.
.Fortr:	    'f4p' 'name'='name''swt'	! Compile.
	    .GOTO Libins		! Put it in library.
.;
.Libins:    .IF <exstat> = 1 .GOTO Good	! Check for compile error.
		.DISABLE QUIET
		;%MAKLIB-F-COM, Compiler error.
		.ENABLE QUIET
		.GOTO Xit		! Exit.
.Good:	    'lbr' 'lbrnam''lbrswt'='name'	! Do it.
	    .IF <exstat> = 1 .GOTO Good2	! Success.
		.DISABLE QUIET
		;%MAKLIB-F-LBR, LBR error.
		.ENABLE QUIET
		.GOTO Xit
.Good2:	    .IFT first .SETS lbrswt "/RP"
	    .IFT first .SETF first
	    PIP 'name'.OBJ;*/DE/NM	! Clear object module.
.Inccnt:    .INC i
	    .GOTO Loop
.Xit:	.EXIT
.;
.; This command file generates Bob Hays's general subroutine and function
.; library.
.;
