Google
 

Trailing-Edge - PDP-10 Archives - bb-m836c-bm_tops20_v6_1_tools - tools/quetst/quetst.mac
There are 4 other files named quetst.mac in the archive. Click here to see a list.
TITLE QUETST - Program to test QUEUE% JSYS functions
SUBTTL

	SEARCH	GLXMAC,ORNMAC		;LOAD GALAXY SYSTEM SYMBOLS
	PROLOG(QUETST)			;DECLARE NAME, ETC...

	EXTERNAL PARSER
	EXTERNAL P$ACCT
	EXTERNAL P$CFM
	EXTERNAL P$IFIL
	EXTERNAL P$INTR
	EXTERNAL P$KEYW
	EXTERNAL P$NUM
	EXTERNAL P$SETU
	EXTERNAL P$SIXF
	EXTERNAL P$SWIT
	EXTERNAL P$TEXT
	EXTERNAL P$TIME
	EXTERNAL P$USER

	QUEVER==1			;VERSION
	QUEEDT==106			;EDIT LEVEL
	QUEWHO==0
	QUEMIN==0

	%%.TYP==<VRSN.(QUE)>		;MAKE INTO VERSION NUMBER
SUBTTL Interrupt vector definitions

	XP	TIMCHN,2		;CHANNEL FOR TIMER INTERRUPTS
	XP	IPCLEV,1		;IPCF INTERRUPT LEVEL (MUST BE 1)
	XP	DETLEV,1		;Detach/attach interrupt level
	XP	LEV1PC,1
	XP	LEV2PC,1
	XP	LEV3PC,1

LEVTAB:	EXP	LEV1PC
	EXP	LEV2PC
	EXP	LEV3PC

CHNTAB:	$BUILD	^D36
	  $SET(1,,<IPCLEV,,INT>)
	$EOB
SUBTTL Definitions and Storage

PT==13				;Define an AC to keep as pointer to QUEUE
				;  argument block
PS==14				;Define an AC to keep as pointer to space



	ND	STACKL,^D50		;SIZE OF STACK

DEB:	BLOCK	1			;Debugging
RES:	BLOCK	1			;Response wanted

QARG:	BLOCK	100			;For QUEUE JSYS args
SPACE:	BLOCK	400			;For arg. blocks
RSPLEN==400
RSPBLK:	BLOCK	RSPLEN			;Response block for QUEUE JSYS

PARBLK:	BLOCK	PAR.SZ

PRMT:	[ASCIZ /QUETST>/]

IB:	$BUILD(IB.SZ)
	  $SET(IB.OUT,,T%TTY)		;AND DEFAULT OUTPUT ROUTINE
	  $SET(IB.PIB,,PIB)		;ADDR OF PID BLOCK
	  $SET(IB.INT,,<LEVTAB,,CHNTAB>)
	$EOB

PIB:	$BUILD	(PB.MNS)		;A small PIB
	$SET	(PB.HDR,PB.LEN,PB.MNS)
	$EOB

ENTVEC:	JRST	QUETST			;ENTRY VECTOR
	JRST	QUETST
	EXP	%%.TYP			;VERSION

	LOC	137
	EXP	%%.TYP
	RELOC

STACK:	BLOCK	STACKL			;PUSHDOWN LIST
SUBTTL Command tables -- Command description

COMMENT %

QUETST>DISMOUNT
QUETST>EXIT
QUETST>MOUNT
QUETST>PRINT (file) filename.ext /ACCOUNT:account  (should be valid account)
				 /AFTER:time
    (Currently, only one	 /BEGIN:page to begin
    file may be included	 /COPIES:# of copies
    with each QUEUE		 /DELETE
    request.)			 /FILE:ASCII, COBOL, ELEVEN, or FORTRAN
				 /FORMS:formsname
				 /GENERIC
				 /JOBNAME:name of job
				 /LIMIT:total pages to print
				 /LOWER
				 /NOTE:to include in banner page
				 /NOTIFY:YES or NO
				 /PRESERVE
				 /PRIORITY:# where 0<#<63
				 /UNIT:printer number
				 /UPPER
				 /USER:username
QUETST>PUNCH
QUETST>SET (parameter) DEBUG
		       NO-DEBUG
		       NO-RESPONSE
		       RESPONSE
QUETST>SHOW PARAMETERS
QUETST>SUBMIT (batch job) filename.ext  /ACCOUNT: account
                                        /AFTER:time
                                        /BATCH-LOG:APPEND, SUPERSEDE, or SPOOL
                                        /BEGIN:page to begin
                                        /DELETE
                                        /GENERIC
                                        /JOBNAME:name of job
                                        /LOWER
                                        /NOTIFY:yes or no
                                        /OUTPUT:ALWAYS, ERRORS, or NOLOG
                                        /PRESERVE
                                        /PRIORITY:# where 0<#<63
                                        /RESTARTABLE:YES or NO
                                        /UNIQUE:YES or NO
                                        /UNIT:job stream number
                                        /UPPER
                                        /USER:user name
QUETST>WTO (message) ASCII message to be sent

QUETST>WTOR (message) ASCII message to be sent

%  ;End of comment and command description
SUBTTL Command tables -- Main tables

CMDTAB:	$INIT(CMDHEA)				;Initialize the command line

CMDHEA:	$KEYDSP (MAINTB,<$ALTERNATE(CONFRM)>)

MAINTB:	$STAB
	  DSPTAB (CONFRM,.DISM,<DISMOUNT>)
	  DSPTAB (CONFRM,.EXIT,<EXIT>)
	  DSPTAB (CONFRM,.MOU,<MOUNT>)
	  DSPTAB (PRICMD,.PRI,<PRINT>)
	  DSPTAB (CONFRM,.PUN,<PUNCH>)
	  DSPTAB (SETCMD,.SET,<SET>)
	  DSPTAB (SHOWCM,.SHOW,<SHOW>)
	  DSPTAB (SUBCMD,.SUB,<SUBMIT>)
	  DSPTAB (WTOCMD,.WTO,<WTO>)
	  DSPTAB (WTOCMD,.WTOR,<WTOR>)
	$ETAB

SETCMD:	$NOISE	(SET010,<parameter>)

SET010:	$KEYDSP (SET020)

SET020:	$STAB
	  DSPTAB (CONFRM,.DEBUG,<DEBUG>)
	  DSPTAB (CONFRM,.NODEB,<NO-DEBUG>)
	  DSPTAB (CONFRM,.NORES,<NO-RESPONSE>)
	  DSPTAB (CONFRM,.RESP,<RESPONSE>)
	$ETAB

SHOWCM:	$KEY (CONFRM,SHO010)

SHO010:	$STAB
	  KEYTAB (.PARA,<PARAMETERS>)
	$ETAB

.PARA==1

WTOCMD:	$NOISE (WTO010,<message>)

WTO010:	$CTEXT (CONFRM)

CONFRM:	$CRLF
SUBTTL Command tables -- PRINT command

PRICMD:	$NOISE	(PRI010,<file>)

PRI010:	$IFILE	(PRI020)

PRI020:	$SWITCH	(,PRI030,<$ACTION(SHRSWT),$ALTERNATE(CONFRM)>)

PRI030:	$STAB
	  DSPTAB (PRI040,.ACCOU,<ACCOUNT:>)
	  DSPTAB (PRI050,.AFTER,<AFTER:>)
	  DSPTAB (PRI060,.BEGIN,<BEGIN:>)
	  DSPTAB (PRI060,.COPIE,<COPIES:>)
	  DSPTAB (NEXT(PRI020),.DELET,<DELETE>)
	  DSPTAB (PRI090,.FILE,<FILE:>)
	  DSPTAB (PRI100,.FORMS,<FORMS:>)
	  DSPTAB (NEXT(PRI020),.GENER,<GENERIC>)
	  DSPTAB (PRI100,.JOBN,<JOBNAME:>)
	  DSPTAB (PRI060,.LIMIT,<LIMIT:>)
	  DSPTAB (NEXT(PRI020),.LOWER,<LOWER>)
	  DSPTAB (PRI160,.NOTE,<NOTE:>)
	  DSPTAB (PRI170,.NOTIF,<NOTIFY:>)
	  DSPTAB (NEXT(PRI020),.PRESE,<PRESERVE>)
	  DSPTAB (PRI060,.PRIOR,<PRIORITY:>)
	  DSPTAB (PRI060,.UNIT,<UNIT:>)
	  DSPTAB (NEXT(PRI020),.UPPER,<UPPER>)
	  DSPTAB (PRI220,.USER,<USER:>)
	$ETAB

;  Parse an account

PRI040:	$ACCOUNT(NEXT(PRI020),<Account to be charged for request>)

;  Parse time and date

PRI050:	$TAD	(NEXT(PRI020))

;  Parse a number

PRI060:	$NUMBER	(NEXT(PRI020),^D10)

;  Get file type

PRI090:	$KEY	(NEXT(PRI020),PRI095)

PRI095:	$STAB
	  KEYTAB (.QBFAS,<ASCII>)
	  KEYTAB (.QBFCB,<COBOL>)
	  KEYTAB (.QNF11,<ELEVEN>)
	  KEYTAB (.QBFFR,<FORTRAN>)
	$ETAB

;  Parse a field

PRI100:	$FIELD	(NEXT(PRI020),<Name of request, six characters or fewer>)

;  Parse a text string

PRI160:	$CTEXT	(NEXT(PRI020))

;  Notification choice

PRI170:	$KEY	(NEXT(PRI020),PRI175)

PRI175:	$STAB
	  KEYTAB (0,<NO>)
	  KEYTAB (.QBNTY,<YES>)
	$ETAB

;  Parse user name

PRI220:	$USER	(NEXT(PRI020))
SUBTTL        Command Tables -- SUBMIT command

SUBCMD:	$NOISE(SUB010,<batch job>)

SUB010: $IFILE(SUB020)

SUB020: $SWITCH(,SUB030,<$ACTION(SHRSWT),$ALTERNATE(CONFRM)>)

SUB030: $STAB
          DSPTAB(SUB040,.ACCOU,<ACCOUNT:>)
          DSPTAB(SUB050,.AFTER,<AFTER:>)
          DSPTAB(SUB060,.BATCH,<BATCH-LOG:>)
          DSPTAB(SUB070,.BEGIN,<BEGIN:>)
          DSPTAB(NEXT(SUB020),.DELET,<DELETE>)
          DSPTAB(NEXT(SUB020),.GENER,<GENERIC>)
          DSPTAB(SUB090,.JOBN,<JOBNAME:>)
          DSPTAB(NEXT(SUB020),.LOWER,<LOWER>)
          DSPTAB(SUB100,.NOTIF,<NOTIFY:>)
          DSPTAB(SUB115,.OUTPU,<OUTPUT:>)
          DSPTAB(NEXT(SUB020),.PRESE,<PRESERVE>)
          DSPTAB(SUB070,.PRIOR,<PRIORITY:>)
          DSPTAB(SUB125,.RESTA,<RESTARTABLE:>)
          DSPTAB(SUB140,.UNIQU,<UNIQUE:>)
          DSPTAB(SUB070,.UNIT,<UNIT:>)
          DSPTAB(NEXT(SUB020),.UPPER,<UPPER>)
          DSPTAB(SUB160,.USER,<USER:>)
        $ETAB

;  Parse an account

SUB040: $ACCOUNT(NEXT(SUB020),<Account to be charged for request>)

;  Parse time and date

SUB050: $TAD(NEXT(SUB020))

;  Get batch-log disposition

SUB060: $KEY(NEXT(SUB020),SUB065)

SUB065: $STAB
          KEYTAB(.QBBND,<APPEND>)
          KEYTAB(.QBBSP,<SPOOL>)
          KEYTAB(.QBBDE,<SUPERSEDE>)
        $ETAB

;  Parse a number

SUB070: $NUMBER(NEXT(SUB020),^D10)

;  Parse directory name

SUB080: $DIR(NEXT(SUB020))

; Parse a field

SUB090: $FIELD(NEXT(PRI020),<Name of request, six characters or fewer>)

;  Notification choice

SUB100: $KEY(NEXT(SUB020),SUB110)

SUB110: $STAB
          KEYTAB(0,<NO>)
          KEYTAB(.QBNTY,<YES>)
        $ETAB

;  Log file printout choices

SUB115: $KEY(NEXT(SUB020),SUB120)

SUB120: $STAB
          KEYTAB(.QBLLG,<ALWAYS>)
          KEYTAB(.QBLLE,<ERRORS>)
          KEYTAB(.QBLNL,<NOLOG>)
        $ETAB

;  Restart choice

SUB125: $KEY(NEXT(SUB020),SUB130)

SUB130: $STAB
          KEYTAB(.QBRNO,<NO>)
          KEYTAB(.QBRYE,<YES>)
        $ETAB

;  Simultaneous running of batch jobs choice

SUB140: $KEY(NEXT(SUB020),SUB150)

SUB150: $STAB
          KEYTAB(.QBUNQ,<NO>)
          KEYTAB(.QBUYE,<YES>)
        $ETAB

;  Parse user name

SUB160: $USER(NEXT(SUB020))
SUBTTL	Program initialization

QUETST:	RESET
	MOVE	P,[IOWD STACKL,STACK]	;SET UP STACK POINTER
	DMOVE	S1,[EXP IB.SZ,IB]	;POINT TO THE INIT BLOCK
	PUSHJ	P,I%INIT##		;INITIALIZE EVERTHING

;  Setup for parser use...

	MOVE	S1,[IPCLEV,,TIMCHN]	;GET LEVEL NUMBER AND TIMER CHANNEL
	MOVE	S2,IB+IB.INT		;GET INTERRUPT DATA BASE INFO
	$CALL	P$INIT##		;INIT THE PARSER
	$CALL	I%ION			;Turn on interrupts
	SETZM	DEB			;No debug
	SETOM	RES			;But response

;  Initial message

	$CALL	SPARAM			;Show the initial parameters
;	JRST	LOOP			;Continue on the next page into
					;  main program loop
SUBTTL Main Program Loop

;  Setup the parser argument block

LOOP:	SETZ	PS,			;Nowhere in the argument space
	HRRO	S1,PRMT			;Get the prompt
	HRRZM	S1,PARBLK+PAR.PM	;Put it in the arg. block
	MOVEI	S1,CMDTAB		;Get the command tables
	MOVEM	S1,PARBLK+PAR.TB	;Save it
        SETZM   PARBLK+PAR.CM           ;Zero to allocate a page
        SETZM   PARBLK+PAR.SR           ;Zero to parse commands from tty

;  Do the parsing

	MOVEI	S1,PAR.SZ		;Get the argument block size
	MOVEI	S2,PARBLK		;  and address
	$CALL	PARSER
	MOVE	P1,S2			;Save returned stuff
	SKIPT
	JRST	[HRROI	S1,[ASCIZ/?Command error -- /]
		PSOUT
		HRRO	S1,PRT.EM(P1)	;Get the error message
		PSOUT
		HRROI	S1,[ASCIZ/
/]
		PSOUT			;Finish with a CRLF
		JRST	LOOP]		;Go back and try again

	MOVE	S1,PRT.CM(P1)		;Get address of parsed data
	ADD	S1,COM.PB(S1)		;Get displacement into data block
	$CALL	P$SETU			;Setup to parse things
	$CALL	P$KEYW			;Parse a keyword
	JUMPF	[$CALL	P$CFM		;Check for confirm
		JUMPT	LOOP		;O.K. just continue on
		HALTF]			;Command skew can't happen

	$CALL	(S1)			;Do the rest of the processing
	JRST	LOOP			;Go for some more
.DISM:	$CALL	NOTYET
	$RET

.EXIT:	HRROI	S1,[ASCIZ/Exiting/]
	PSOUT
	HALTF
	$RET

.MOU:	$CALL	NOTYET
	$RET
SUBTTL	PRINT command processing

;  Creates a message of the following form...

;  +-------------------------------------+  -
;  |flags| resp.length|      .QUPRT      |  |
;  |-------------------------------------| header
;  |        Response block address       |  |
;  |-------------------------------------|  -
;  | Length of text   |      .QBFIL      |
;  |-------------------------------------|
;  |   Pointer (address) to ASCII text   |  (filename as ASCII string)
;  |-------------------------------------|
;  |   Optional switch argument blocks   |
;  |                  .                  |

.PRI:	MOVEI	S1,.QUPRT		;Set print command
	$CALL	SETUP			;Setup the QUEUE% header
	$CALL	SETFIL			;Setup the file
	$CALL	PRCSWI			;Go process switches
	$CALL	QUECAL			;Do the thing
	$RET
.PUN:	$CALL	NOTYET
	$RET
SUBTTL	SET command

.SET:	$CALL	P$KEYW			;Get another keyword
	SKIPT
	HALTF				;Don't like bad stuff
	$CALL	(S1)			;Go do it
	$RET

.NODEB:	TDZA	S1,S1			;Set to zero and skip
.DEBUG:	SETO	S1,			;Set to ones
	MOVEM	S1,DEB			;To debug or not to debug
	$RET

.NORES:	TDZA	S1,S1			;Set to zero and skip
.RESP:	SETO	S1,			;Set to ones
	MOVEM	S1,RES			;Set need/noneed for response
	$RET
SUBTTL	SHOW command

.SHOW:	$CALL	P$KEYW			;Get the next keyword
	SKIPT
	HALTF

	CAIE	S1,.PARA		;Parameter?
	HALTF				;No, Must be!

;  Alternate entry point to allow printing initial state

SPARAM:	HRROI	S1,[ASCIZ/
	Parameter settings
/]
	PSOUT

;  Debugging line

	HRROI	S1,[ASCIZ/		Debugging  --	/]
	PSOUT
	HRROI	S1,[ASCIZ/yes
/]					;Assume debugging
	SKIPN	DEB			;Debugging?
	HRROI	S1,[ASCIZ/no
/]					;No.
	PSOUT

;  Response line

	HRROI	S1,[ASCIZ/		Response  --	/]
	PSOUT
	HRROI	S1,[ASCIZ/wanted
/]					;Assume response
	SKIPN	RES			;Response wanted?
	HRROI	S1,[ASCIZ/not wanted
/]					;No.
	PSOUT
	$RET
SUBTTL	Submit command processing

;  Creates a message of the following form...

;  +-------------------------------------+  -
;  |flags| resp.length|      .QUBAT      |  |
;  |-------------------------------------- header
;  |        Response block address       |  |
;  |--------------------------------------  -
;  | Length of text   |      .QBFIL      | 
;  ---------------------------------------
;  |   Pointer (address) to ASCII text   |  (filename as ASCII string)
;  ---------------------------------------
;  |   Optional switch argument blocks   |
;  |                                     |

.SUB:	MOVEI	S1,.QUBAT		;Set batch command
	$CALL	SETUP			;Setup the QUEUE% header
	$CALL	SETFIL			;Setup the file
	$CALL	PRCSWI			;Go process switches
	$CALL	QUECAL			;Do the thing
	$RET
SUBTTL	Write To Operator commands

;  Creates a message of the following form...

;  +-------------------------------------+  -
;  |flags| resp.length|    .QUWTO/WTR    |  |
;  |-------------------------------------| header
;  |        Response block address       |  |
;  |-------------------------------------|  -
;  | Length of text   |      .QBMSG      |
;  |-------------------------------------|
;  |   Pointer (address) to ASCII text   |
;  +-------------------------------------+


.WTO:	MOVEI	S1,.QUWTO		;Set WTO
	SKIPA
.WTOR:	MOVEI	S1,.QUWTR		;Set WTOR
	$CALL	SETUP			;Setup the QUEUE% header
	$CALL	P$TEXT			;Get the text
	SKIPT
	HALTF
	MOVEI	T1,.QBMSG		;Get the arg type
	LOAD	S2,ARG.HD(S1),AR.LEN	;Get the arg length (not block)
	SUBI	S2,1			;Adjust away the header word
	HRL	T1,S2			;And set
	MOVEM	T1,.QATYP(PT)		;Save as first word of argument
	MOVEI	T1,ARG.DA(S1)		;Get address of data
	MOVEM	T1,.QADAT(PT)		;Save the address as the data
	ADDI	PT,2			;Add the size of the argument
	$CALL	QUECAL			;Do the thing
	$RET				;And return
SUBTTL	QUECAL  Do the actual QUEUE% JSYS

QUECAL:	MOVE	S1,PT			;Get the location
	SUBI	S1,QARG			;Make it the size
	MOVEI	S2,QARG			;Get the arg block
	QUEUE%
	 ERJMP	QUERR			;Badness
	HRROI	S1,[ASCIZ/QUEUE% function completed
/]
	PSOUT

;  Output response if needed

QUERES:	SKIPN	RES			;Response wanted?
	$RET				;No. just return
	
	HRROI	S1,RSPBLK		;Get the response
	SKIPN	RSPBLK			;Any response returned?
	HRROI	S1,[ASCIZ/Null response returned/]
	PSOUT
	HRROI	S1,[ASCIZ/
/]
	PSOUT				;Output a CR
	$RET

QUERR:	HRROI	S1,[ASCIZ/?QUEUE% JSYS failure -- /]
	PSOUT
					;Any error deserves to fail
	MOVEI	S1,.PRIOU		;Output to the terminal
	MOVE	S2,[.FHSLF,,-1]		;This process -- last error
	SETZ	T1,			;As many characters as it takes
	ERSTR				;Output last error
	 JFCL				;Who cares
	 JFCL				;Who cares
	HRROI	S1,[ASCIZ/
/]
	PSOUT
	JRST	QUERES			;Continue on to include response
					;  if any
SUBTTL	SETUP to setup first two words of QUEUE arg. block

;  The purpose of this routine is to setup the first two words of the
;  QUEUE% argument block given the function code in S1.  Returns with
;  the first two words done and the address of the first argument in
;  PT.

;  +-------------------------------------+  -
;  |flags| resp.length|     function     |  |
;  |-------------------------------------| header
;  |        Response block address       |  |
;  |-------------------------------------|  -

SETUP:	HRLI	S1,RSPLEN		;Set length
	SKIPN	RES			;Want a response?
	TXO	S1,QU%NRS		;No, set the bit
	SKIPE	DEB			;Talk to a debugging GALAXY?
	TXO	S1,QU%DBG		;Yes, set the bit
	MOVEM	S1,QARG+.QUFNC		;Save the function word
	SETZM	RSPBLK			;Clear first word of response block
	MOVEI	S1,RSPBLK		;Get address of response block
	MOVEM	S1,QARG+.QURSP		;Save it
	MOVEI	PT,QARG+.QUARG		;Get address of first argument block
	$RET
SUBTTL	SETFIL	Setup the file part of an actual queue command

;  This routine sets up the file argument block part of the QUEUE% arguments.

;  |                                     |
;  |-------------------------------------|
;  | Length of text   |      .QBFIL      |
;  |-------------------------------------|
;  |   Pointer (address) to ASCII text   |  (filename as ASCII string)
;  |-------------------------------------|
;  |                                     |


SETFIL:	$CALL	P$IFIL			;Get the file block
	SKIPT
	HALTF
	MOVEI	T1,.QBFIL		;Get the arg. type
	HLR	T2,.FDLEN(S1)		;Get length+1 of filename
	SUBI	T2,1			;Subtract out the header length
	HRL	T1,T2			;Form image of first argument word
	MOVEM	T1,.QATYP(PT)		;Save as the first word of argument
	MOVEI	T1,.FDSTG(S1)		;Get the address of the filename
	MOVEM	T1,.QADAT(PT)		;Save the address
	ADDI	PT,ARG.SZ		;Move the pointer to next arg.
	$RET
SUBTTL	PRCSWI process switches

;  The purpose of this routine is to process switches.  This includes reading
;  the switch and adding the argument block to the main QUEUE% arguments.
;  (although in all cases the block is built and added in a subsidiary routine)
;  P2 is used accross these routines to indicate function code.

PRCSWI:	$CALL	P$SWIT			;Try to read a switch
	$RETIF 				;No more switches
	$CALL	(S1)			;Process the switch
	$RETIF				;Quit if a bad switch
	JRST PRCSWI			;Go for another
SUBTTL	PRCSWI process switches -- ACCOUNT

;  Generates an argument block of the form:

;  |                                     |
;  |-------------------------------------|
;  | Length of text   |      .QBACT      |
;  |-------------------------------------|
;  |   Pointer (address) to ASCIZ text   |  (account as ASCII string)
;  |-------------------------------------|
;  |                                     |

.ACCOU:	$CALL	P$ACCT			;Process an account switch
	$RETIF
	MOVEI	P2,.QBACT		;Get the argument type
	SUBI	S2,1			;Adjust length to ignore P$ACCT arg.
					;  header
	ADDI	S1,1			;Again, skip over P$ACCT arg. header
	$CALL	NORARG			;Setup argument
	$RETT

SUBTTL	PRCSWI process switches -- AFTER

;  Generates an argument block of the form:

;  |                                     |
;  |-------------------------------------|
;  |I|       1        |      .QBAFT      |
;  |-------------------------------------|
;  |      Date/time in UDT format        |
;  |-------------------------------------|
;  |                                     |

.AFTER:	$CALL	P$TIME			;Get time block
	$RETIF
	MOVEI	P2,.QBAFT		;Get the argument type
	$CALL	IMMARG			;Setup immediate argument block
	$RETT

SUBTTL  PRCSWI process switches  -- BATCH-LOG

;  Generates an argument block of the form:

;  |                                     |
;  |-------------------------------------|
;  |I|       1        |      .QBFMT      |
;  |-------------------------------------|
;  |      .QBBND, .QBBDE or .QBBSP       |  File type
;  |-------------------------------------|
;  |                                     |
.BATCH:	MOVEI	P2,.QBBLT		;Get function code
	$CALL	P$KEYW			;Get keyword for disposition type
	$RETIF
	$CALL	IMMARG			;Setup the argument, S1 has type
	$RETT
SUBTTL	PRCSWI process switches -- BEGIN

;  Generates an argument block of the form:

;  |                                     |
;  |-------------------------------------|
;  |I|       1        |      .QBBGN      |
;  |-------------------------------------|
;  |  Number indicating where to begin   |
;  |-------------------------------------|
;  |                                     |

.BEGIN:	MOVEI	P2,.QBBGN		;Get the argument type
PRCNUM:	$CALL	P$NUM			;Get the number
	$RETIF
	$CALL	IMMARG			;Setup immediate argument block
	$RETT

SUBTTL	PRCSWI process switches -- COPIES

;  Generates an argument block of the form:

;  |                                     |
;  |-------------------------------------|
;  |I|       1        |      .QBCOP      |
;  |-------------------------------------|
;  |         Number of copies            |
;  |-------------------------------------|
;  |                                     |

.COPIE:	MOVEI	P2,.QBCOP		;Get the argument type
	$CALL	PRCNUM			;Process number argument
	$RET				;Return preserving whatever

SUBTTL	PRCSWI process switches -- file disposition DELETE and PRESERVE

;  Generates an argument block of the form:

;  |                                     |
;  |-------------------------------------|
;  |I|       1        |      .QBODP      |
;  |-------------------------------------|
;  |     0 to preserve, 1 to delete      |
;  |-------------------------------------|
;  |                                     |

.PRESE:	TDZA	S1,S1			;Clear S1 to indicate preserve and skip
.DELET:	MOVEI	S1,1			;Want to delete
	MOVEI	P2,.QBODP		;Get function code
	$CALL	IMMARG			;Process immediate
	$RETT
SUBTTL	PRCSWI process switches -- FILE

;  Generates an argument block of the form:

;  |                                     |
;  |-------------------------------------|
;  |I|       1        |      .QBFMT      |
;  |-------------------------------------|
;  |  .QBFAS, .QBFCB, .QNF11, or .QBFFR  |  file type
;  |-------------------------------------|
;  |                                     |

.FILE:	MOVEI	P2,.QBFMT		;Get function code
	$CALL	P$KEYW			;Get the keyword for file type
	$RETIF
	$CALL	IMMARG			;Setup the argument, S1 has type
	$RETT

SUBTTL	PRCSWI process switches -- FORMS

;  Generates an argument block of the form:

;  |                                     |
;  |-------------------------------------|
;  |I|       1        |      .QBFRM      |
;  |-------------------------------------|
;  |         Forms name in SIXBIT        |
;  |-------------------------------------|
;  |                                     |

.FORMS:	MOVEI	P2,.QBFRM		;Get function code
PRCSIX:	$CALL	P$SIXF			;Get the field as SIXBIT
	$RETIF
	$CALL	IMMARG			;Setup immediate argument
	$RETT
SUBTTL	PRCSWI process switches -- Unit number and type switches
;		GENERIC, LOWER, UPPER, and UNIT

;  Generates an argument block of the form:

;  |                                     |
;  |-------------------------------------|
;  |I|       1        |      .QBUNT      |
;  |-------------------------------------|
;  | Unit # if .QBUPH | .QBUGN, .QBULC,  |
;  |                  | .QBUUC or .QBUPH |
;  |-------------------------------------|
;  |                                     |

.GENER:	MOVEI	S1,.QBUGN		;Set generic
	JRST	DEVSWI			;Join common

.LOWER:	MOVEI	S1,.QBULC		;Set lower case
	JRST	DEVSWI			;Join common

.UPPER:	MOVEI	S1,.QBUUC		;Set upper case
	JRST	DEVSWI			;Join common

.UNIT:	$CALL	P$NUM			;Get the unit number
	$RETIF
	HRLZS	S1			;Move it left
	HRRI	S1,.QBUPH		;Set device number
;	JRST	DEVSWI			;Join common

DEVSWI:	MOVEI	P2,.QBUNT		;Say this is unit desc. block
	$CALL	IMMARG			;Setup immediate argument
	$RETT

SUBTTL	PRCSWI process switches -- JOBNAME

;  Generates an argument block of the form:

;  |                                     |
;  |-------------------------------------|
;  |I|       1        |      .QBJBN      |
;  |-------------------------------------|
;  |         Job name in SIXBIT          |
;  |-------------------------------------|
;  |                                     |

.JOBN:	MOVEI	P2,.QBJBN		;Jobname argument
	$CALL	PRCSIX			;Go do it
	$RET				;Return preserving any error
SUBTTL	PRCSWI process switches -- LIMIT

;  Generates an argument block of the form:

;  |                                     |
;  |-------------------------------------|
;  |I|       1        |      .QBLIM      |
;  |-------------------------------------|
;  |        Limit of job as number       |
;  |-------------------------------------|
;  |                                     |

.LIMIT:	MOVEI	P2,.QBLIM		;Say its the limit argument
	$CALL	PRCNUM			;Go process number
	$RET

SUBTTL	PRCSWI process switches -- NOTE

;  Generates an argument block of the form:

;  |                                     |
;  |-------------------------------------|
;  |  length (2 max)  |      .QBNTE      |
;  |-------------------------------------|
;  |address of sixbit words holding note |
;  |-------------------------------------|
;  |                                     |

.NOTE:	MOVEI	P2,.QBNTE		;Save the argument type
	$CALL	P$TEXT			;Get the field as ASCII text
	$RETIF
	ADDI	S1,1			;Skip over returned arg. header
	$CALL	S%SIXB			;Convert the first word
	MOVE	T1,S2			;Save first word
	$CALL	S%SIXB			;Convert the second word
	MOVE	T2,S2			;Save second word
	MOVEI	S1,T1			;Save the address of 2 word
					;  sixbit string
	MOVEI	S2,2			;Length
	$CALL	NORARG			;Go process
	$RETT
SUBTTL	PRCSWI process switches -- NOTIFY

;  Generates an argument block of the form:

;  |                                     |
;  |-------------------------------------|
;  |I|       1        |      .QBNOT      |
;  |-------------------------------------|
;  |  0 if no notify, .QBNTY to notify   |
;  |-------------------------------------|
;  |                                     |

.NOTIF:	MOVEI	P2,.QBNOT		;Set argument block type
	$CALL	P$KEYW			;Get keyword
	$RETIF
	$CALL	IMMARG			;Setup the argument
	$RET

SUBTTL  PRCSWI process switches -- OUTPUT

;  Generates an argument block of the form:

;  |                                     |
;  |-------------------------------------|
;  |I|       1        |      .QBLOG      |
;  |-------------------------------------|
;  |      .QBLNL, .QBLLG, or .QBLLE      |
;  |-------------------------------------|
;  |                                     |

.OUTPU:	MOVEI 	P2,.QBLOG		;Set argument block type
	$CALL	P$KEYW			;Get keywork
	$RETIF
	$CALL	IMMARG			;Setup the argument
	$RET

SUBTTL	PRCSWI process switches -- PRIORITY

;  Generates an argument block of the form:

;  |                                     |
;  |-------------------------------------|
;  |I|       1        |      .QBPRI      |
;  |-------------------------------------|
;  |  Number 0<#<63 indicating 

.PRIOR:	MOVEI	P2,.QBPRI		;Set priority argument
	$CALL	PRCNUM
	$RET
SUBTTL  PRCSWI process switches -- RESTARTABLE

;  Generates an argument block of the form:

;  |                                     |
;  |-------------------------------------|
;  |I|       1        |      .QBRES      |
;  |-------------------------------------|
;  |     .QBRNO (no) or .QBRYE (yes)     |
;  |-------------------------------------|
;  |                                     |

.RESTA:	MOVEI	P2,.QBRES		;Get function code
	$CALL	P$KEYW			;Get the keyword for file type
	$RETIF
	$CALL	IMMARG			;Setup the argument, S1 has type
	$RETT

SUBTTL  PRCSWI process switches -- UNIQUE

;  Generates an argument block of the form:

;  |                                     |
;  |-------------------------------------|
;  |I|       1        |      .QBUNQ      |
;  |-------------------------------------|
;  |     .QBUNQ (no) or .QBUYE (yes)     |
;  |-------------------------------------|
;  |                                     |

.UNIQU:	MOVEI	P2,.QBUNQ		;Get function code
	$CALL	P$KEYW			;Get the keyword for file type
	$RETIF
	$CALL	IMMARG			;Setup the argument, S1 has type
	$RETT

SUBTTL	PRCSWI process switches -- USER

;  Generates an argument block of the form:

;  |                                     |
;  |-------------------------------------|
;  |I|       1        |      .QBOID      |
;  |-------------------------------------|
;  |             User number             |
;  |-------------------------------------|
;  |                                     |

.USER:	MOVEI	P2,.QBOID		;Say user argument
	$CALL	P$USER			;Parse user field
	$RETIF
	$CALL	IMMARG			;Go do it
	$RETT
SUBTTL	PRCSWI process switches -- work routines to set up args

;  IMMARG and NORARG take information and build the arg. blocks.

;	S1 / Data or address to data
;	S2 / Length of data (only for NORARG)
;	P2 / function code

IMMARG:	HRLI	P2,1			;Get length
	TXO	P2,QA%IMM		;Make it immediate
	JRST	FINARG			;Go to common clean up

NORARG:	HRL	P2,S2			;Get length

FINARG:	MOVEM	P2,.QATYP(PT)		;Save length,,type
	MOVEM	S1,.QADAT(PT)		;Save number of where to begin or data
	ADDI	PT,ARG.SZ		;Setup for next argument
	$RET
;  General support routines

NOTYET:	HRROI	S1,[ASCIZ/Command not yet implemented
/]
	PSOUT
	$RET

SNTYET:	HRROI	S1,[ASCIZ/Switch not yet implemented
/]
	PSOUT
	$RET

INT:	$BGINT	IPCLEV
	$CALL	P$INTR
	$CALL	C%INTR
	$DEBRK


	END	<3,,ENTVEC>