
.;======================================================================
;
;	MSULIB.CMD - Build MSULIB utility libraries
;
.;	T V ATKINSON
.;	DEPARTMENT OF CHEMISTRY
.;	MICHIGAN STATE UNIVERSITY
.;	EAST LANSING, MI 48824
.;
.;	DATE:  03-NOV-82
.;
.;======================================================================
	.ENABLE SUBSTITUTION
	.SETS MODULE ""
	.SETT MACMOD
	.SETT CMPALL
	.SETT OLBBLD
	.SETF FORMOD
	.SETS SX "SR:"
	.SETS FX "FT:"
	.SETS OX "OB:"
	.SETS LX "NL:"
.;
.;	Begin set up
.;
	.ASK MSUBLD Do complete build of MSULIB.OLB
.;
.;	Set up devices
.;
	.ASK SETDEV Define logical devices
	.IFF SETDEV .GOTO 5
	.ASKS SX Device that contains sources [D SR:]
	.IF <STRLEN> = 0 .SETS SX "SR:"
.;
	.ASKS FX Device that will contain intermediate files [D FT:]
	.IF <STRLEN> = 0 .SETS FX "FT:"
.;
	.ASKS OX Device to receive objects, task, map, and library [D OB:]
	.IF <STRLEN> = 0 .SETS OX "OB:"
.;
	.ASKS LX Listing device [D NL:]
	.IF <STRLEN> = 0 .SETS LX "NL:"
.;
.;	Choose compilation options
.;
.5:	.IFT MSUBLD .GOTO 20
	.ASK CMPALL Compile MSUBLD modules
	.IFT CMPALL .GOTO 20
	.ASKS MODULE FORTRAN module to be compiled
	.SETT FORMOD
	.IF <STRLEN> = 0 .SETF FORMOD
	.GOTO 20
.19:
;
;	!!! Illegal compiler choice  !!!
;
.20:	.IFF CMPALL .IFF FORMOD .GOTO 16
	.ASKS $CNUM Compile using F4P, F77, or FOR
	.SETF COMF4P
	.SETF COMF77
	.SETF COMFOR
	.IF $CNUM EQ "F4P" .SETT COMF4P 
	.IF $CNUM EQ "F77" .SETT COMF77
	.IF $CNUM EQ "FOR" .SETT COMFOR
	.IFF COMFOR .IFF COMF4P .IFF COMF77 .GOTO 19
	.ASK $SEQN Compile with sequence numbers
	.SETS STRING ""
	.IFF $SEQN .AND .IFT COMFOR .SETS STRING "/NOSN"
	.IFF $SEQN .AND .IFT COMF4P .SETS STRING "/NOTR"
	.IFF $SEQN .AND .IFT COMF77 .SETS STRING "/NOTR"
	.SETS CONS "/CO:25."
	.IFT COMFOR .SETS CONS ""
	.ENABLE SUBSTITUTION
	.ASK MSUBLD Compile, or assemble MSUBLD modules
	.IFT MSUBLD PIP 'OX'*.OBJ;*/DE/NM
	.IFT MSUBLD .IF LX NE "NL:" PIP 'LX'*.LST;*/DE/NM
.;
.;	Compile high level modules
.;
	.IFT MSUBLD .GOTO 990
	.ASKS MODULE FORTRAN module to be compiled
	.SETT FORMOD
	.IF <STRLEN> = 0 .SETF FORMOD
	.IFF FORMOD .GOTO 24
	PIP 'OX''MODULE'.OBJ;*/DE/NM
	.IF LX NE "NL:" PIP 'LX''MODULE'.LST;*/DE/NM
	.IFT FORMOD .GOTO 35
.;
.;	Set up assembly
.;
.24:	.IFT MSUBLD .GOTO 990
	.ASKS MODULE MACRO module to be assembled
	.IF <STRLEN> = 0 .SETF MACMOD
	.IFF MACMOD .GOTO 37
	PIP 'OX''MODULE'.OBJ;*/DE/NM
	.IF LX NE "NL:" PIP 'LX''MODULE'.LST;*/DE/NM
.990:	.ASK MCRLST List MCR lines
;
;	End of setup
;
	.SETS BEGTIM <DATE>+"  "+<TIME>
;	MSULIB.OLB building began:        'BEGTIM'
	.IFF MCRLST .ENABLE QUIET
	.IFF CMPALL .IFF FORMOD .GOTO 1405
.;
.; 	Set up the file
.;
	.OPEN 'SX'MSULIBCMP.CMD
	.IF MODULE NE "VECTOR" .IFF MSUBLD .GOTO 1000
	.DATA 'OX'VECTOR'STRING','LX'VECTOR/-SP='SX'VECTOR'CONS'
.1000:	.IF MODULE NE "SYMPLT" .IFF MSUBLD .GOTO 1010
	.DATA 'OX'SYMPLT'STRING','LX'SYMPLT/-SP='SX'SYMPLT'CONS' 
.1010:	.IF MODULE NE "SYMPAR" .IFF MSUBLD .GOTO 1020
	.DATA 'OX'SYMPAR'STRING','LX'SYMPAR/-SP='SX'SYMPAR'CONS' 
.1020:	.IF MODULE NE "ROTXY0" .IFF MSUBLD .GOTO 1030
	.DATA 'OX'ROTXY0'STRING','LX'ROTXY0/-SP='SX'ROTXY0'CONS' 
.1030:	.IF MODULE NE "ROTXY1" .IFF MSUBLD .GOTO 1040
	.DATA 'OX'ROTXY1'STRING','LX'ROTXY1/-SP='SX'ROTXY1'CONS' 
.1040:	.IF MODULE NE "MULHOM" .IFF MSUBLD .GOTO 1050
	.DATA 'OX'MULHOM'STRING','LX'MULHOM/-SP='SX'MULHOM'CONS' 
.1050:	.IF MODULE NE "AXIS" .IFF MSUBLD .GOTO 1060
	.DATA 'OX'AXIS'STRING','LX'AXIS/-SP='SX'AXIS'CONS' 
.1060:	.IF MODULE NE "GETCMD" .IFF MSUBLD .GOTO 1070
	.DATA 'OX'GETCMD'STRING','LX'GETCMD/-SP='SX'GETCMD'CONS' 
.1070:	.IF MODULE NE "RELATV" .IFF MSUBLD .GOTO 1080
	.DATA 'OX'RELATV'STRING','LX'RELATV/-SP='SX'RELATV'CONS' 
.1080:	.IF MODULE NE "ROTXY2" .IFF MSUBLD .GOTO 1090
	.DATA 'OX'ROTXY2'STRING','LX'ROTXY2/-SP='SX'ROTXY2'CONS' 
.1090:	.CLOSE
.;
.; Do the compilation
.;
	.IFT COMFOR FOR @'SX'MSULIBCMP
	.IFT COMF77 F77 @'SX'MSULIBCMP
	.IFT COMF4P F4P @'SX'MSULIBCMP
.;
.;	Build command file for MACRO
.;
.25:	.OPEN 'FX'MSULIBASM.CMD
	.IF MODULE NE "SYMGET" .IFF MSUBLD .GOTO 1200
	.DATA 'OX'SYMGET,'LX'SYMGET/-SP='SX'SYMGET
.1200:	.IF MODULE NE "PLOTSM" .IFF MSUBLD .GOTO 1210
	.DATA 'OX'PLOTSM,'LX'PLOTSM/-SP='SX'PLOTSM
.1210:	.IF MODULE NE "ROMSIM" .IFF MSUBLD .GOTO 1220
	.DATA 'OX'ROMSIM,'LX'ROMSIM/-SP='SX'ROMSIM
.1220:	.IF MODULE NE "GRKSIM" .IFF MSUBLD .GOTO 1230
	.DATA 'OX'GRKSIM,'LX'GRKSIM/-SP='SX'GRKSIM
.1230:	.IF MODULE NE "ARROWH" .IFF MSUBLD .GOTO 1250
	.DATA 'OX'ARROWH,'LX'ARROWH/-SP='SX'ARROWH
.1250:	.IF MODULE NE "UNFORM" .IFF MSUBLD .GOTO 1270
	.DATA 'OX'UNFORM,'LX'UNFORM/-SP='SX'UNFORM
.1270:	.IF MODULE NE "KBCHEK" .IFF MSUBLD .GOTO 1280
	.DATA 'OX'KBCHEK,'LX'KBCHEK/-SP='SX'KBCHEK
.1280:	.IF MODULE NE "ERRPRT" .IFF MSUBLD .GOTO 1290
	.DATA 'OX'ERRPRT,'LX'ERRPRT/-SP='SX'ERRPRT
.1290:	.IF MODULE NE "FORMCR" .IFF MSUBLD .GOTO 1300
	.DATA 'OX'FORMCR,'LX'FORMCR/-SP='SX'FORMCR
.1300:	.IF MODULE NE "F2FORM" .IFF MSUBLD .GOTO 1330
	.DATA 'OX'F2FORM,'LX'F2FORM/-SP='SX'F2FORM
.1330:	.IF MODULE NE "CMDLIN" .IFF MSUBLD .GOTO 1340
	.DATA 'OX'CMDLIN,'LX'CMDLIN/-SP='SX'CMDLIN
.1340:	.IF MODULE NE "GT" .IFF MSUBLD .GOTO 1350
	.DATA 'OX'GT,'LX'GT/-SP='SX'GT
.1350:	.IF MODULE NE "GTTEK" .IFF MSUBLD .GOTO 1360
	.DATA 'OX'GTTEK,'LX'GTTEK/-SP='SX'GTTEK
.1360:	.IF MODULE NE "GTGRIN" .IFF MSUBLD .GOTO 1370
	.DATA 'OX'GTGRIN,'LX'GTGRIN/-SP='SX'GTGRIN
.1370:	.CLOSE
	MAC @'FX'MSULIBASM
.;
.;	Build command file for LBR
.;
	.IFF MSUBLD .GOTO 35
	.OPEN 'FX'MSULIBOLB.CMD
	.DATA DF:OBJ
	.DATA 'OX'MSULIB/CR
	.DATA 'OX'MSULIB/IN='OX'VECTOR,SYMPLT,SYMPAR,ROTXY0,ROTXY1
	.DATA 'OX'MSULIB/IN='OX'MULHOM,AXIS,GETCMD,RELATV,ROTXY2
	.DATA 'OX'MSULIB/IN='OX'SYMGET,PLOTSM,ROMSIM,GRKSIM,ARROWH
	.DATA 'OX'MSULIB/IN='OX'UNFORM,KBCHEK,ERRPRT,F2FORM,CMDLIN
	.DATA 'OX'MSULIB/IN='OX'GT,GTTEK,GTGRIN,FORMCR
	.DATA 'OX'MSULIB,'LX'MSULIB/FU
	.CLOSE
	LBR @'FX'MSULIBOLB
	.GOTO 2000
.;
.;	Replace single module
.;
.35:	LBR 'OX'MSULIB.OLB/RP='OX''MODULE'
	LBR 'OX'MSULIB.OLB/CO='OX'MSULIB.OLB
	PIP 'OX'MSULIB.OLB/TR
.;
.;	Final cleanup
.;
.2000:	.SETS ENDTIM <DATE>+"  "+<TIME>
	.DISABLE QUIET
;	MSULIB building began:        'BEGTIM'
;	MSULIB building finished:     'ENDTIM'
	.ASK DELCMD Delete temporary command files
	.IFF DELCMD .GOTO 9999
	PIP 'FX'MSULIBCMP.CMD;*/DE/NM
	PIP 'FX'MSULIBASM.CMD;*/DE/NM
	PIP 'FX'MSULIBOLB.CMD;*/DE/NM
.9999:
