.;	CCLGEN.CMD  CCL LANGUAGE INTERPRETOR GENERATOR
.;	**********************************************
.;	Ing.Brunecky    Ver.001   March 1981
.;
.;	Command file produces ...CCL user-consize-command-language
.;	interpretor, whih may be used as catch-all monitor or be
.;	called by such monitor.
.;
.;	Following global parameters allow non-querry run:
.;	$NQR = .TRUE. - use non query run if possible
.;	$FCSR= .TRUE. - use FCS resident library FCSRES
.;	$ALDV= "dduu" - assembly listing device
.;	$MPDV= "dduu" - taskbuild map listing device
.;	$TKDV= "dduu" - task image output device
.;
.;	NOTE: Used UFDs [12,10],[12,24],[12,34],[1,24],[1,34],[1,54]
.;	      CCL sources assumed to reside under SY:[12,10]
.;
	@LB:[1,7]PRVTST  check, if TI: privileged
	.ENABLE GLOBAL
	.IFNDF $EDI .SETS $EDI "EDI" .;default editor to be used
	.ENABLE SUBSTITUTION
	.SETS UIC  <UIC>
	.SETF CRL
	.SETF EXE
	.SETS SUIC "[12,10]"
	.SETS OUIC "[12,24]" 
	.SETS DUIC "[12,34]"
	.SETS LUIC "[1,24]"
	.SETS L "CCL"
	.SETS S "CCL"
	.GOSUB EDI
	.SETS S "SPWNMCR"
	.GOSUB EDI
	.SETS S "FIXUP"
	.GOSUB EDI
	.SETS S "LOOKUP"
	.GOSUB EDI
.;
.;	Assembly finished succesfully, prepare task-build
	.IFNDF $TKDV .ASKS $TKDV Task image output device [ddu]
	.PARSE $TKDV ":" $TKDV X
	.IF $TKDV = "" .SETS $TKDV "SY0"
	.IFNDF $MPDV .ASKS $MPDV Task map listing  device [ddu]
	.PARSE $MPDV ":" $MPDV X
	.IF $MPDV = "" .SETS $MPDV "SY0"
	.IFNDF $FCSR .ASK $FCSR FCSRES res. library available
	SET /UIC='LUIC'
	.OPEN CCLBLD.CMD
	.DATA ; BUILD-COMMAND FILE   >CCL<   FOR  RSX11M
	.DATA ;	****************************************
	.DATA ;
	.DATA TK:[1,54]CCL/CP/-FP,MP:[1,34]CCL=
	.DATA CCL/LB:CCL:SPNMCR:FIXUP:LOOKUP
	.DATA /
	.IFT $FCSR .DATA RESLIB=FCSRES/RO:7
	.DATA TASK=...CCL
	.DATA PRI=130
	.DATA UNITS=2
	.DATA ASG=TI:2,LB:1
	.DATA STACK=64
	.DATA PAR=GEN
	.DATA //
	.CLOSE
	ASN '$MPDV':=MP:
	ASN '$TKDV':=TK:
	PIP MP:[1,34]CCL.MAP;*/DE/NM
	PIP TK:[1,54]CCL.TSK/PU/NM
	TKB @CCLBLD
	.IF <EXSTAT> NE 1 ; CCL taskbuild error, continue manuelly !
	.IF <EXSTAT> NE 1 .GOTO EX
	ASN =TK:
	ASN =MP:
	PIP CCLBLD.CMD;*/DE/NM
.EX:	SET /UIC='UIC'
	.EXIT
.;
.;	Subroutine for editing and assembly
.EDI:	.IFDF $NQR .GOTO E12
.E10:	.ASK ED Edit source file 'S'.MAC	
	.IFF ED .GOTO ASM
.E12:	SET /UIC='SUIC'
	'$EDI' 'S'.MAC
	.SETT AS
.ASM:	.IFNDF AS .SETF AS
	.IFNDF L .GOTO A10
	.TESTFILE 'LUIC''L'.OLB
	.IF <FILERR> NE 1 .SETT CRL
	.IF <FILERR> = 1 .GOTO A20
.A10:	.TESTFILE'OUIC''S'.OBJ
	.IF <FILERR> NE 1 .SETT AS
.A20:	.IFT CRL .SETT AS
	.IFF AS .RETURN
	.IFNDF $ALDV .ASKS $ALDV Assembly listing device [dduu]
	.PARSE $ALDV ":" $ALDV X
	.IF $ALDV = "" .SETS $ALDV "SY0"
	SET /UIC='OUIC'
	PIP 'S'.OBJ;*/DE/NM,'$ALDV':'DUIC''S'.LST;*/DE/NM
	.IFT EXE MAC 'S','$ALDV':'DUIC''S'/-SP=[11,10]RSXMC/PA:1,[1,1]EXEMC/ML,'SUIC''S'
	.IFF EXE MAC 'S','$ALDV':'DUIC''S'/-SP='SUIC''S'
	.SETF AS
	.IF <EXSTAT> NE 1 .GOTO E10
	.IFNDF L PIP 'S'.OBJ/PU/NM
	.IFNDF L .RETURN
	SET /UIC='LUIC'
	.IFT CRL .TESTFILE 'L'.OLB
	.IFT CRL .IF <FILERR> NE 1 LBR 'L'/CR:20
	LBR 'L'/RP='OUIC''S'
	SET /UIC='OUIC'
	PIP 'S'.OBJ;*/DE/NM
	.RETURN
