Google
 

Trailing-Edge - PDP-10 Archives - bb-jr93k-bb - 10,7/galaxy/glxlib/galgen.mac
There are 23 other files named galgen.mac in the archive. Click here to see a list.
TITLE	GALGEN	GALAXY system generation program
SUBTTL	Larry Samberg/PJT	1-Jan-82


;
;
;                COPYRIGHT (c) 1978,1979,1980,1981,1982,
;			     1983,1984,1985,1986,1987,1988
;                    DIGITAL EQUIPMENT CORPORATION
;			  ALL RIGHTS RESERVED.
;
;     THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY  BE  USED
;     AND COPIED ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE
;     AND WITH THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.   THIS
;     SOFTWARE  OR ANY OTHER COPIES THEREOF MAY NOT BE PROVIDED OR
;     OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON.  NO  TITLE  TO
;     AND OWNERSHIP OF THE SOFTWARE IS HEREBY TRANSFERRED.
;
;     THE INFORMATION  IN  THIS  SOFTWARE  IS  SUBJECT  TO  CHANGE
;     WITHOUT  NOTICE  AND SHOULD NOT BE CONSTRUED AS A COMMITMENT
;     BY DIGITAL EQUIPMENT CORPORATION.
;
;     DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY
;     OF  ITS  SOFTWARE  ON  EQUIPMENT  WHICH  IS  NOT SUPPLIED BY
;     DIGITAL.


	SEARCH	GLXMAC			;GET GLXLIB
	SEARCH	QSRMAC			; QUASAR
	PROLOGUE(GALGEN)		;GENERATE ALL NECESSARY DEFINITIONS


;VERSION INFORMATION
	GLNVER==5			;VERSION NUMBER
	GLNEDT==2126			;EDIT NUMBER

	%GLN==<BYTE (3)0 (9)GLNVER (6)0 (18)GLNEDT>
	LOC	137
	EXP	%GLN			;STORE VERSION NUMBER
	RELOC				;AND BACK TO NORMAL PROCESSING

COPYRIGHT (C) DIGITAL EQUIPMENT CORPORATION 1971,1984,1987,1988.\
SUBTTL	Table of Contents
SUBTTL	Revision History

;2000	Create new GALGEN program for GALAXY release 4.
;2001	Define ORION Applications tables via GALGEN
;2002	Remove system configuration dialog and clean
;	up miscelaneous dialog
;2003	Remote applications section and always define NCP as the
;	only application for TOPS20
;2004	Fix a bug - invalid $TEXT argument for orion log question
;	Fix a bug in memory enforcement question so that it waits for
;	a users response.
;	Fix a bug - add an entry for applications so that G%%ATB is
;	generated as a null macro.
;2005	Make some editorial changes
;2006	Add MDA section on TOPS10, delete references to TCS and don't
;	default NCP on applications section (TOPS20).  Default
;	queue structure to SYS on TOPS10.  Fix $YESNO to turn listing
;	when it is finished.
;2007	Change system queue structure default from SYS to SSL.
;2010	Change operator log filename defaults for the -10 and -20
;2011	Unconditionally ask MDA questions so the values will be
;	included in GALCNF
;2012	TOPS-10 customers get confused when the long blurb about limit
;	computations gets typed out. They like to to refer to disk blocks,
;	not disk pages.
;2013	DELETE DEFDEN AND MAKE IT A DEFAULT FOR 7 AND 9 TRACK TAPE DENSITIES
;
;2014	DEFINE FTFTS feature test for FTS support (always off)
;
;2015	Increase PDL by 10 words
;
;2016	Remove setting checkpoint time as an option since components should
;	and are going to generate their own checkpoints.
;
;2017	Also remove variable for setting checkpoint time period
;
;2020	Change dialog in limit computation to say "blocks" instead of
;	"pages" on the -10.
;
;2021	Change a few defaults:
;	1) Spooled plotter time limit from 200 to 30 minutes.
;	2) Turn on core limit enforcement.
;	3) Change default 7 track density from 556 to 800 BPI.
;	4) PLT and PTP limits.
;
;2022	Re-word questions for batch PTP ans PLT limits. Allow all batch limits
;	to be as low as 0 cards, feet, minutes and pages.
;
;2023	ND FTFACT feature test symbol at the end of the GALGEN dialogue.
;
;2024	Change the default answer to the deadlock avoidance question from
;	YES to NO.
;
;2025	Fix some constants that are to be used in LPT and PTP limits
;	calculations. Took out question about deadlock avoidance.
;
;2026	Allow applications to be defined on the -10.
;
;2027	Change responses to LIMIT-EXCEEDED-ACTION to be ABORT, ASK or PROCEED
;	for consistancy with the OPR SET command. Use new symbols .CHLAB and
;	.CHRAB (defined in GLXMAC) instead of .LA and .RA symbols.
;
;2030	Correct wording in question about ABORT, ASK or PROCEED....
;
;2031	More of  edit 2030
;
;2100	Make GALGEN V5(2100) for GALAXY-10 V5.1
;
;2101	Add a question for Deadlock Avoidance, since we now know it works
;	alot better than before.
;
;2102	Add a question for [SYSTEM]INFO and GLXIPC to set the maximum possible
;	length of the name string for a named PID.
;
;2103	Add a question about whether to include fallback code for 702.
;
;2104	Add new question for internal application tables.
;	Teach YESNO to not use KEYTAB for its tables since we
;	we may be in the middle of building another table there.
;
;2105	Add new question for default network type of FAL-STREAMs.
;
;2106	Add questions regarding special device drivers for LPTSPL.
;	GCO 10139 28-Jan-85 /NT
;
;2107	Add FTDQS definition in feature test section.
;	GCO 10225 6-Jun-85 /JAD
;
;2110	Chance the default network type for FAL to ANF-10 since
;	most customers still do not have or care to use DECnet.
;	GCO 10247  9-Jul-85 /DPM
;
;2111	Change range of batch core limit argument to be 24-16384 pages.
;	Make the default be 512 pages.
;	GCO 10259 22-Jul-85 /DPM
;
;2112	Change the FTDQS definition from an "ND" to an "XP".  Since
;	GALGEN SEARCHes GLXMAC who has gotten FTDQS from GALCNF a
;	tortuous circle can develops.
;	GCO 10293 24-Sep-85 /JAD
;
;2113	Allow the input of site specific parameters. Get rid of
;	any references to FTDQS since it is unsupported, and the
;	customer can specify it manually now.
;	GCO 10305 18-Oct-85 /NT
;
;2114	Change $STOP to STOPCD.
;	GCO 10462 14-Nov-86 /BAH
;
;2115	Remove fallback code question. Permanently turn off conditional.
;	Add question to ask for number of minutes "demand spoolers"
;	will tolerate idleness before logging out.
;	GCO 10516 28-Jun-87 /LWS
;
;2116	Remove all traces of FTFLBK.
;	GCO 10557 21-Aug-87 /LWS
;
;2117	Change applications section as follows:  If a NO answer is given to the
;	"Do you want applications?" question, automatically generate
;	entries for QUOTA, CONFIG, and CATALOG, since they are now required for
;	Galaxy to run on the 10.  If YES is given, check and see if
;	either application was selected, to avoid duplicating the table
;	entries.  
;	GCO 10562 31-Aug-87 /JJF
;
;2120	Rework 2117 to do it right.  Don't blindly put the mandatory entries
;	at the end of the list; since the list is used to generate the
;	command keyword tables, we MUST put it in order.  To do so, add
;	routines to insert the entries into the same table used by the
;	interactive questions.
;	GCO 10572 14-Sep-87 /JJF
;
;2121	Change the $NUMBRS routine to do the right things when presented
;	with numbers that may be followed by spaces, tabs, and comments.
;	Allow all characters after a semicolon is seen, and allow spaces
;	and/or tabs to follow a number.
;	GCO 10573 14-Sep-87 /JJF
;
;2122	Rework the applications section to ask about supporting LCP and
;	NCP as yes/no questions instead of the three-question set.
;	Also, ask if the user has any installation-dependent applications
;	and if s/he says yes, then enter the 3-question loop.
;	GCO 10581 13-Oct-87 /JJF
;
;2123	Fix bug in the ACQUIR routine to input user-specified parameters
;	so that a line containing a comment (optionally preceeded by
;	spaces or tabs) is considered a 'blank' line, and terminate
;	input appropriately.
;	GCO 10596 SPR: 36081 28-Jan-1988 /JJF
;
;2124	Fix bug in LCP and NCP help code which kept the help messages
;	from being displayed correctly.  Also change the text of the
;	messages themselves to be more descriptive and match optional
;	system requirements.
;	GCO 10653 SPR: None  17-Aug-1988 /JJF
;
;2125	Remove references to FTDQS.  The DQS code is now supported.
;	Turning off the conditional hasn't worked for some time.
;	GCO 10673 SPR: None  25-Jul-89 /DPM
;
;2126	Allow customers to specify non-standard hard copy terminals
;	as printers.
;	GCO 10676 SPR: None  24-Aug-89 /DPM
SUBTTL	OUTPUT MACROS

;UNCONDITIONAL TEXT OUTPUT

;Each of the following accept standard GALAXY $TEXT strings as
;arguments.  In Addition, the "@" is replaced by <CRLF> and is
;not written on terminal or file.


; $TTYSTR <@Hello@> would Type <CRLF>Hello<CRLF> on terminal.

	DEFINE	$TTYSTR (TEXT) <	;;WRITE STRING TO TERMINAL

	$TEXT	(TTYCHR,<TEXT>)		;;ACCEPT ANY $TEXT ARGUMENT

> ; END TTYSTR


; $CNFSTR <@Hello@> would Write <CRLF>Hello<CRLF> in Config File

	DEFINE	$CNFSTR (TEXT) <	;;WRITE STRING TO CONFIG FILE

	$TEXT	(CNFCHR,<TEXT>)		;;ACCEPT ANY $TEXT ARGUMENT

> ; END CNFSTR

	DEFINE	$BTHSTR (TEXT) <	;;WRITE TO FILE AND TERMINAL

	$TEXT	(BTHCHR,<TEXT>)		;;ACCEPT ANY $TEXT ARGUMENT

> ; END BTHSTR

; $HEADER Macro Accepts a one line String argument and generates the
; the following output for $HEADER (Header Text):

; Configuration File Output:
; Form Feed to start new page followed by "SUBTTL	Header Text"
; followed by header text centerd and underscored as follows
;
;			Header Text
;			------ ----

; Terminal output:
; Two blank lines followed by Centered and underscored "Header Text"

	DEFINE $HEADER (STRING) <

	$CALL	HEADER
	XLIST
	JUMP	[ASCIZ\STRING\]
	LIST

> ;END OF HEADER
; CONDITIONAL OUTPUT TO TERMINAL AND FILE

; $COMMENT Accepts a paragraph as an argument and conditionally displays
; and writes paragraph into configuration file as a multiline comment.
; Only does Output if Dialog Length is "LONG".


	DEFINE $COMMENT (STRING) <

	$CALL	COMMENT
	XLIST
	JUMP	[ASCIZ\STRING\]
	LIST

> ;END OF COMMENT


;$HELP Accepts a Paragraph as an argument and moves argument to
; HLPTXT to be used as help if user types ? in response to any
; Question.  The Help paragraph is also written in the Configuration
; file as a comment and displayed on the terminal if the dialog
; length is "LONG"

; Only Asciz strings are supported, however "@" will be replaced
; with <CRLF>.

	DEFINE $HELP (STRING) <

	$CALL	HELP
	XLIST
	JUMP	[ASCIZ\@STRING@\]
	LIST

> ;END OF HELP
SUBTTL	Parsing Settup Macros

; $PROMPT Accepts an $TEXT String as an argument and Causes this
; string to be moved to PRMTXT where it will be appended with any
; Range or Choice and any Default String.  $PROMPT does not cause
; the display of any text.  (The Text will be displayed when the
; appropriate action routine is called
; $PROMPT also initializes Range, Choice, and Default Specifications

	DEFINE $PROMPT (TEXT) <

	$CALL	PROMPT
	XLIST
	JUMP	[ITEXT <TEXT>]
	LIST

> ;END OF PROMPT

; $RANGE accepts Decimal integers for Minimum and maximum values
; for the $NUMBER and $FIELD Action Macros. It also accepts an
; Asciz Suffix.
; $RANGE appends the vaules to PRMTXT so they may be displayed
; with the prompt by the action routine.

	DEFINE $RANGE (MINIMUM,MAXIMUM,SUFFIX) <

	$CALL	RANGE
	XLIST
	JUMP	[^D<MINIMUM>
		 ^D<MAXIMUM>
	IFB <SUFFIX>,<Z ]>
	IFNB<SUFFIX>,<ASCIZ\ SUFFIX\]>
	LIST

> ;END OF RANGE
; Parsing Settup macros (continued)

; $CHOICES Accepts a list of Asciz Keywords to allow for the $KEYWORD
; Action Macro.  It generates a Sorted Keyword table beginning at
; location KEYTAB that is used for parsing keywords
; $CHOICES appends the list of possible choices to PRMTXT so it may
; be displayed with the prompt by the Keyword action routine.

	DEFINE $CHOICES (ARGLST) <

	$CALL	CHOICES
	XLIST
	$TABLE <ARGLST>				;BUILD TABLE AND POINTER
	LIST

> ;END OF CHOICES

; $REJECT Accepts a list of Keywords to reject for the $NEWKEY macro.


	DEFINE $REJECT (ARGLST) <

	$CALL	REJECT
	XLIST
	$TABLE <ARGLST>
	LIST

> ;END OF REJECT

; $ADDKEY Accepts a list of Keywords to add to the table without
; prompting the user for them.

	DEFINE	$ADDKEY (ARGLST) <

	$CALL	ADDKEY
	XLIST
	$TABLE	<ARGLST>
	LIST

> ;END OF ADDKEY

; $DEFAULT accepts any standard $TEXT string as an argument and 
; moves the resultant string to DEFTXT where it is used if the
; user types only a carriage return.
; $DEFAULT also appends the string to PRMTXT so it may be displayed
; with the prompt by the Action routine

	DEFINE $DEFAULT (ITXT) <

	$CALL	DEFAULT
	XLIST
	JUMP	[ITEXT <ITXT>]
	LIST

> ;END OF DEFAULT

; $TABLE is used by $CHOICES, $ADDKEY, and $REJECT to build a table and a one
; word pointer to the table in the form of a JUMP instruction

	DEFINE $TABLE (ARGLST) <

	.ZZ.==0					;COUNT ARGS
	IRP <ARGLST>,<.ZZ.==.ZZ.+1>
	JUMP	[XWD .ZZ.,[ASCIZ\ARGLST\]	;COUNT,,STRING ADR
		.ZZ.==0				;NUMBER ENTRIES
		  IRP ARGLST,<
		  XWD [ASCIZ\ARGLST\],.ZZ.
		  .ZZ.==.ZZ.+1
		  > ];END IRP ARGLST		;END OF TABLE

> ;END OF TABLE
SUBTTL	Parsing Action Macros

; The following macros cause the PROMPT (RANGE or CHOICES) [DEFAULT]
; to be displayed and the answer to be accepted.  The all call a
; single field parsing routine with the particular function they desire
; to have parsed


; $NUMBER Causes a Decimal integer to be accepted within the range
; specified since the last $PROMPT

; True Return always with Integer in S1

	DEFINE $NUMBER <

	$CALL	NUMBER

> ;END OF NUMBER

; $ONUMBR Causes an octal number to be read.
; Call and return is the same as for $NUMBER.

	DEFINE	$ONUMBR <

	$CALL	ONUMBR

> ;END OF ONUMBR

; $NUMBRS Causes a numeric string to be accepted

; The string must be numeric and may contain a decimal point

; Returns S1/ Integer value of the string (ignoring decimal point)
;	S2/ 1 * the number of digits to the right of the decimal

	DEFINE	$NUMBRS <

	$CALL	NUMBRS

> ;END OF NUMBRS

; $KEYWORD Causes a word specified in a $CHOICE since the last $PROMPT
; to be accepted (or the default if specified and only carriage return
; is typed)

; True Return always with

; S1/ Number of the word in the $CHOICE argument list (counting from 0)
; S2/ address of the Keyword asciz string

	DEFINE $KEYWORD <

	$CALL	KEYWORD

> ;END OF KEYWORD

; $NEWKEY Causes a unique word not currently in the KEYTABLE to be
; accepted and placed into the KEYTABLE.   $REJECT may be used to
; prefill the table with invalid entries

	DEFINE $NEWKEY <

		$CALL	NEWKEY

> ;END NEWKEY DEFINITION

; $FIELD Causes an alphanumeric field to be accepted.  It checks
; the field to see that it's length is within the $RANGE specified
; since the last $PROMPT

; True return if field is within specified range

; S1/ Length of field
; ATOM/ Start of asciz string

; False return if field is not within specifed range

; S1/ Length of field

	DEFINE $FIELD <

	$CALL	FIELD

> ;END OF FIELD


; $YESNO Causes a yes or no answer to be accepted. It takes
; three arguments, all of which ar optional
; Arg 1 -- Must be YES, NO, or blank (determines default answer)
; Arg 2 -- Must be Address to branch to on YES answer or blank
; Arg 3 -- Must be Address to branch to on NO answer or blank

; True return if YES was specified and dispatch address was blank

; False return if NO was specified and dispatch address was blank

	DEFINE $YESNO (DEFAULT,YESDSP<0>,NODSP<0>) <

	$CALL	YESNO
	XLIST
	JUMP	[YESDSP
		 NODSP
	IFB <DEFAULT>,<Z ]>	;NO DEFAULT
	IFNB<DEFAULT>,<ASCIZ\DEFAULT\]>
	LIST
> ;END OF $YESNO
SUBTTL	Zero and Non-zero Data Area

	PDLSIZ==60

PDL:	BLOCK	PDLSIZ

;SYSTEM DEPENDENT VARIABLES

OPSYS:	BLOCK	1		;0=TOPS10     -1=TOPS20
G.NPGS:	BLOCK	1		;NUMBER OF AVAILABLE USER PAGES
G.NCMX:	BLOCK	1		;MAXIMUM PAGES AVAILABLE PER JOB

;PROGRAM VARIABLES

CNFIFN:	BLOCK	1		;IFN OF GALCNF FILE
FULLFD:	BLOCK	1		;ADDRESS OF FULL OPENED FD FOR GALCNF
DIALEN:	BLOCK	1		;0=SHORT DIALOG     -1=LONG DIALOG
NOMSG:	BLOCK	1		;0=WRITE QUESTION/ANSWER -1=DONT WRITE
TXTPTR:	BLOCK	1		;POINTER USED BY DEPTXT ROUTINE
TXTCNT:	BLOCK	1		;INCREMENTED BY DEPTXT ROUTINE

IB:	$BUILD	IB.SZ
	  $SET	(IB.PRG,,%%.MOD)	;PROGRAM NAME IS GALGEN
	  $SET(IB.OUT,,TTYCHR)	;DEFAULT $TEXT OUTPUT ROUTINE
	  $SET(IB.FLG,IT.OCT,1)	;OPEN CONTROLLING TERMINAL
	$EOB

IFN FTUUOS,<
GFD:	$BUILD	FDMSIZ
	  $SET(.FDLEN,FD.LEN,FDMSIZ)
	  $SET(.FDNAM,,<SIXBIT/GALCNF/>)
	  $SET(.FDEXT,,<SIXBIT/MAC/>)
	$EOB
>  ;END IFN FTUUOS

IFN FTJSYS,<
GFD:	XWD GFDSIZ,0
	ASCIZ /DSK:GALCNF.MAC/
	GFDSIZ==.-GFD
>  ;END IFN FTJSYS

FOB:	$BUILD	FOB.SZ
	  $SET(FOB.FD,,GFD)		;FD ADDRESS
	  $SET(FOB.CW,FB.BSZ,7)		;FILE BYTE SIZE
	$EOB


TXTIBK:	$BUILD	.RDRTY+1
	  $SET(.RDCWB,,.RDRTY)		;WORD COUNT
	  $SET(.RDFLG,,RD%BEL!RD%JFN)	;BREAK ONLY ON CARRIAGE RETURN
	  $SET(.RDIOJ,,<.PRIIN,,.PRIOU>) ;ACCEPT INPUT FROM TERMINAL
	  $SET(.RDDBP,,<POINT 7,ATOM>)	;ATOM BUFFER FOR INPUT BUFFER
	  $SET(.RDDBC,,<<BUFLEN*5>-1>)	;NUMBER OF CHARACTERS
	  $SET(.RDBFP,,<POINT 7,ATOM>)	;BEGINNING OF BUFFER
	  $SET(.RDRTY,,<POINT 7,ATOM>)	;RETYPE BUFFER
	$EOB
;COMMAND STATE BLOCK

CMDBLK::
CMDFLG:	BLOCK 1			;COMMAND FLAGS,,REPARSE ADDRESS
CMDJFN:	BLOCK 1			;INPJFN,,OUTJFN
CMDPRM:	BLOCK 1			;PROMPT POINTER
BUFPTR:	BLOCK 1			;POINNTER TO BEGINNING OF COMMAND BUFFER
NXTPTR:	BLOCK 1			;POINTER TO NEXT CHARACTER TO BE PARSED
BUFSIZ:	BLOCK 1			;FREE CHARACTER COUNT IN COMMAND BUFFER
CMDINC:	BLOCK 1			;NUMBER OF CHARACTERS LEFT TO PARSE
ATMPTR:	BLOCK 1			;POINTER TO BEGGINING OF ATOM BUFFER
ATMSIZ:	BLOCK 1			;FREE CHARACTER COUNT  IN ATOM BUFFER
CMDJFB:	BLOCK 1			;ADDRESS OF GTJFN BLOCK FOR COMND BLOCK

;COMMAND FUNCTION BLOCK

FNCBLK::
CMDFNC:	BLOCK 1			;FUNCTION!FLAGS,,NEXT FNCBLK
CMDDAT:	BLOCK	1		;DATA SPECIFICE TO FUNCION
CMDHLP:	BLOCK 1			;POINTER TO HELP STRING (LONG)
CMDDEF:	BLOCK	1		;DEFAULT STRING POINTER
CMDFN2:	BLOCK	1		;FUNCTION BLOCK 2

;RANGE CHECK WORDS

MIN:	BLOCK 1
MAX:	BLOCK 1

	NCHRW==5		;CHARACTERS PER WORD
	BUFLEN==^D50		;SIZE OF BUFFER IN WORDS
	HLPSIZ==^D256		;MAX WORDS OF HELP
	KEY$LN==^D18		;LARGEST NUMBER OF CHOICES
	STR$LN==^D30/NCHRW	;SIZE OF STORAGE FOR LARGEST STRING
	KTE$LN==STR$LN+5	;NUMBER OF WORDS/TABLE ENTRY

HLPTXT:	BLOCK HLPSIZ		;BUFFER TO STORE HELP STING
PRMTXT:	BLOCK ^D50		;STORAGE  FOR $TEXT PRMTXT
DEFTXT:	BLOCK ^D10		;STORAGE FOR DEFAULT STRING
BUFFER:	BLOCK BUFLEN		;COMMAND BUFFER
ATOM:	BLOCK BUFLEN		;ATOM BUFFER
KEYTAB:	BLOCK KEY$LN+1		;FOR KEYWORD ARGUMENTS
STRADR:	BLOCK KEY$LN+1		;ADDR OF TABLE STRING,,ADDR OF ORN MODULE NAME
STRBUF:	BLOCK <KEY$LN*STR$LN>+<KEY$LN*3> ;ROOM FOR STRING STORAGE
ST2BUF:	BLOCK <KEY$LN*STR$LN>+<KEY$LN*3> ;AND FOR A SECOND STRING
TXTIAR:	BLOCK	.RDRTY+1	;ARGUEMENT BLOCK FOR K%TXTI


	MAPCNT==^D3		;Count of mandatory applications~
	APPCNT==^D5		;Count of total applications

;In the tables below, the first n entries (up to MAPCNT) are for the
;mandatory applications.  The remaining entries are for the optional ones.

MAPAPP:	[ASCIZ	/CATALOG/]	;APPLICATION NAMES
	[ASCIZ	/CONFIG/]
	[ASCIZ	/QUOTA/]
	[ASCIZ	/LCP/]
	[ASCIZ	/NCP/]
	
MAPPRS:	[ASCIZ	/CATTAB/]	;APPLICATION PARSE TABLES
	[ASCIZ	/CNFTAB/]
	[ASCIZ	/QUOTAB/]
	[ASCIZ	/LCPTAB/]
	[ASCIZ	/NCPTAB/]

MAPORN:	BLOCK	1		;ORION ACTION ROUTINES
	[ASCIZ	/CNFORN/]
	BLOCK	1
	[ASCIZ	/LCPORN/]
	BLOCK	1

MAPADD:	PUSHJ	P,[$ADDKEY (CATALOG)
		  POPJ P,]
	PUSHJ	P,[$ADDKEY (CONFIG)
		  POPJ P,]
	PUSHJ	P,[$ADDKEY (QUOTA)
		  POPJ P,]
	PUSHJ	P,[$ADDKEY (LCP)
		  POPJ P,]
	PUSHJ	P,[$ADDKEY (NCP)
		  POPJ P,]

MAPPMT:	BLOCK	3
[ASCIZ	/Include the LAT Control Protocol (LCP) commands? /]
[ASCIZ	/Include the DECnet Network Control Protocol (NCP) commands? /]

MAPHLP:	BLOCK	3
	LCPHLP
	NCPHLP

LCPHLP:	$HELP <The LAT Control Protocol (LCP) commands allow the operator or system
administrator to control various aspects of Local Area Transport (LAT)
service, and to display status and parameter settings information.

The LCP command subset is required if your monitor is built with
Ethernet LAT terminal access enabled.>
	$RET

NCPHLP:	$HELP <The Network Control Protocol (NCP) commands allow the system administrator
to perform various DECnet network management functions.

The NCP command subset is required if you are running DECnet-10.>
	$RET
SUBTTL	Program Startup

GALGEN:	RESET				;RESET THE WORLD
	MOVE	P,[IOWD PDLSIZ,PDL]	;SETUP THE PUSHDOWN POINTER
	MOVEI	S1,IB.SZ		;GET IB LENGTH
	MOVEI	S2,IB			;AND IB ADDRESS
	$CALL	I%INIT		;AND GET THE LIBRARY

	$TTYSTR <@GALGEN Version ^V/[%GLN]/@>

	SETZM	CMDFLG			;CLEAR FLAGS AND REPARSE
	MOVE	S1,[.PRIIN,,.PRIOU]	;SET JFNS TO TTY
	MOVEM	S1,CMDJFN
	HRROI	S1,PRMTXT		;POINT TO PRMTXT BUFFER
	MOVEM	S1,CMDPRM
	HRROI	S1,BUFFER		;POINT TO BUFFER
	MOVEM	S1,BUFPTR		;BEGINNING
	MOVEM	S1,NXTPTR		;NEXT CHARACTER TO PARSE
	SETZM	CMDINC			;CLEAR CONT OF CHAR TO PARSE
	MOVEI	S1,BUFLEN*NCHRW		;COMPUTE SIZE OF BUFFER
	MOVEM	S1,BUFSIZ		;AND SAVE
	MOVEM	S1,ATMSIZ		;SAME SIZE AS ATOM (CURRENTLY)
	HRROI	S1,ATOM			;POINT TO ATOM BUFFER
	MOVEM	S1,ATMPTR		;AND SAVE
	SETZM	CMDJFB			;NO GET JFN BLOCK CURRENTLY

	MOVEI	S1,KEY$LN		;INIT KEYTABLE
	MOVEM	S1,KEYTAB

	MOVX	S1,<112,,11>		;GETTAB TO MONITOR TYPE
	GETTAB	S1,			;DO IT
	STOPCD	(CDM,HALT,,<Cannot Determine Monitor Type>)
	LDB	S1,[POINT 6,S1,23]	;GET MONITOR TYPE
	SETZM	OPSYS			;ASSUME ITS TOPS10
	CAIE	S1,1			;IF TOPS10
	CAIN	S1,4			; OR TOPS20
	SKIPA				;ALL IS WELL
	STOPCD	(UMT,HALT,,<Unrecognized Monitor Type>)
	CAIN	S1,4			;IS IT TOPS20?
	SETOM	OPSYS			;YES, REMEMBER
	MOVEI	S1,[ASCIZ /TOPS-10/]	;LOAD MONITOR TYPE
	SKIPE	OPSYS			;SKIP IF NOT
	MOVEI	S1,[ASCIZ /TOPS-20/]	;ONE OR THE OTHER
	$TTYSTR <@
[Starting GALAXY Generation Procedure for ^T/0(S1)/ System]>
SUBTTL	Initialize the Configuration File

INITFL:	MOVEI	S1,FOB.SZ		;GET FOB SIZE
	MOVEI	S2,FOB			;GET FOB
	$CALL	F%OOPN			;OPEN THE FILE
	JUMPT	INIT.1			;JUMP IF WE WON
	$TTYSTR <@?  Cannot write configuration file ^F/GFD/ -- ^E/[-1]/>
	PJRST	I%EXIT			;AND STOP NOW

INIT.1:	MOVEM	S1,CNFIFN		;STORE THE IFN
	SETO	S2,			;GET FULL FD OF THE FILE
	$CALL	F%FD			;ASK GLXLIB FOR IT
	MOVEM	S1,FULLFD		;STORE IT
	$TTYSTR <[Writing  GALAXY Configuration File ^F/@FULLFD/]>


	$CNFSTR <

SUBTTL	GALCNF	Created by GALGEN Version ^V/[%GLN]/ at ^H/[-1]/

	UNIVERSAL GALCNF
	.DIRECT	.NOBIN


	DEFINE XP (SYM,VAL) ^7/[.CHLAB]/
	SYM==:VAL^7/[.CHRAB]/

	G.%GLN==^O/[%GLN]/		;STANDARD VERSION FOR GALGEN
	G.GVER==^O/[GLNVER]/		;GALAXY VERSION NUMBER

	RADIX 5+5>

	MOVNI	S1,1			;LOAD A TOPS10 VALUE
	MOVEI	S2,0			;AND A TOPS20 VALUE
	SKIPE	OPSYS			;SKIP IF IT IS TOPS10
	EXCH	S1,S2			;EXCHANGE THEM IF TOPS20

	$CNFSTR <

	FTUUOS==^D/S1/			;-1 IF TOPS 10 ELSE 0
	FTJSYS==^D/S2/			;-1 IF TOPS 20 ELSE 0
>
SUBTTL	Begin The Dialog

DIALOG:	SETOM	DIALEN			;ASSUME LONG DIALOG

	$COMMENT <
In the following dialog, all questions are of the form:

  text of question (list or range of answers) [default answer]>
	$COMMENT <
The line starts with the actual text of the question.  Following
the question is a description  of the possible answers  enclosed
in parentheses.  This description might be a range of numbers, a
list of  keywords, or  a  textual description.   Following  this
description is the default answer, enclosed in square  brackets.
The default will be assumed if you only press the RETURN key.>
	$COMMENT<
You have the  choice of carrying  on a LONG  dialog in which  an
explanation of  each question  is provided  automatically, or  a
SHORT dialog in which it is  assumed that you are familiar  with
the GALAXY generation procedure.  In either case, you can always
obtain the help text by typing  a question mark (?) in  response
to any question.>
	$HELP <
Answer the  following  question with  either  LONG (for  a  long
dialog) or SHORT (for a short one).  Simply pressing the  RETURN
key will imply SHORT.>

DIAL.1:	$PROMPT <Dialog Length>
	$CHOICES <SHORT,LONG>
	$DEFAULT (SHORT)
	$KEYWORD			;GET THE KEYWORD

DIAL.2:	CAIE	S1,1			;WAS LONG SPECIFIED?
	SETZM	DIALEN			;NO -- MAKE IT SHORT

SUBTTL	Administrative Controls

ADMIN:	$HEADER (Administrative Controls and Parameters)
	$COMMENT <
The  questions  in  this   section  determine  absolute   GALAXY
parameters, which  cannot  be  overridden by  user  or  operator
commands.>
	$CNFSTR <@	XP	G.OLOG,^D/[-1]/>
	$HELP < 
The system logs all operator interactions in a disk file in  the
spooling area.  Your answer to the following question  specifies
the name to be used for this file.>

	$PROMPT	<Operator log filename>

TOPS10 <$RANGE (3,6,Characters)
	$DEFAULT (OPERAT)>

TOPS20 <$RANGE (3,20,Characters)
	$DEFAULT (OPERATOR-SYSTEM)>

	$FIELD

	$CNFSTR <
DEFINE G$$LGN ^7/[.CHLAB]/	X	^T/ATOM/^7/[.CHRAB]/>

ADM.1:

TOPS10 <
	$HELP <
You have the option  of maintaining a  backup master queue  file
which may be used in the unlikely event that the primary  master
queue file is destroyed.>

	$PROMPT	<Do you want redundant master queue file>
	$YESNO	(NO)
	
	$CNFSTR	<@	XP	FTRQUE,^D/TF/>

	$HELP <
Any  permanantly  mounted  structure  may be used for the master
queues.  The structure that is first in the system  search  list
is preferred.>
	$PROMPT <File structure to use for master queue>
	$RANGE (3,6,Characters)
	$DEFAULT <SSL>
	$FIELD

	$CNFSTR <@	XP	G.QSTR,'^T6/ATOM/'>
> ;END OF TOPS10 CONDITIONAL

TOPS20 <
	$CNFSTR <@	XP	G.QSTR,0	;NOT REQUIRED FOR TOPS20>
	$CNFSTR <@	XP	FTRQUE,0	;NOT REQUIRED FOR TOPS20>
> ;END OF TOPS20 CONDITIONAL
ADM.3:
	$HELP <
Users can  specify  a  priority for  their  batch  and  spooling
requests with the  /PRIORITY switch.  The  allowable values  for
this parameter range  between 1  (representing lowest  priority)
and 63 (representing the highest).  The following two  questions
relate to this switch.  The first question requests the  maximum
priority which may be specified by a non-privileged user. >

	$PROMPT <Maximum priority non-privileged users may specify>
	$RANGE (1,63)
	$DEFAULT (20)
	$NUMBER

	$CNFSTR <@	XP	G.SPRI,^D/S1/>

	$HELP<
You may specify the value to be used if the user does not specify
a /PRIORITY switch.  This value must be between 1 and the maximum
that you specified in the previous question.>

	$PROMPT <Default for /PRIORITY on batch and spooling requests>
	$RANGE (1,63)
	$DEFAULT (10)
	$NUMBER				;GET THE NUMBER

	$CNFSTR <@	XP	G.DPRI,^D/S1/>
	SUBTTL	[SYSTEM]INFO Parameters

INFO:	$HEADER <[SYSTEM]INFO Parameters>

TOPS10<
	$COMMENT <
This section allows you to set any currently defined [SYSTEM]INFO
control parameters.>

	$CNFSTR	<@	XP	FTINFO,-1	;Enable [SYSTEM]INFO support>

	$HELP <
The [SYSTEM]INFO facility, which allows users to manipulate PIDs
for IPCF communication by symbolic names, is now part of QUASAR.
While  [SYSTEM]INFO  normally  limits  the  maximum length  of a
symbolic  PID  name  via the  GETTAB item %IPMPL (maximum packet
length),  you have the option  of  specifying the maximum length
of a PID name allowable at all.>

	$PROMPT <Maximum length of a PID name>
	$RANGE (29,79,Characters)
	$DEFAULT 39
	$NUMBER
	$CNFSTR	<@	XP	SZ.INF,^D/S1/>
>;End of TOPS10 conditional

TOPS20<
	$CNFSTR	<@	XP	FTINFO,0	;Disable [SYSTEM]INFO support>
>
SUBTTL	Applications Parameters

APPLIC:	$HEADER <Applications>

	$COMMENT <
The following section determines which optional applications
you wish to run on your system.  These applications will be 
accesible through OPR, the operator interface program.  
>

APL.1:	$HELP	<
GALAXY supports by default the CATALOG, CONFIG, and QUOTA applications.
If you wish to run additional applications (such as NCP), answer YES.>

	$PROMPT	<Do you wish to run optional applications?>
	$YESNO	(YES)		;SURE WE DO
	JUMPF	APL.5		;NO? THEN JUST DO MANDATORY ONES


APL.2:	SETZ	T3,			;CLEAR A COUNTER
	HRRZS	KEYTAB			;CLEAR COUNT OF TABLE ENTRIES
APL.2A:	CAIGE	T3,MAPCNT		;HAVE WE PROCESSED THE MANDATORY ONES
	 JRST	APL.20			;NO, THEN DON'T ASK IF WE SHOULD
	PUSHJ	P,@MAPHLP(T3)		;YES, DO THE CORRECT $HELP MACRO
	$PROMPT	<^T/@MAPPMT(T3)/>	;GET THE STRING
	$YESNO	(YES)			;ASK THE USER
	JUMPF	APL.2B			;DON'T DO REST IF USER SAID NO
APL.20:	XCT	MAPADD(T3)		;DO THE $ADDKEY OF THE KEYWORD
	JUMPF	APL.2B			;DON'T INSERT IT IF USER DID ALREADY
	DMOVE	T1,@MAPAPP(T3)		;DUMMY UP A NAME
	DMOVEM	T1,ATOM			;STORE IT
	MOVEI	S1,KEYTAB		;GET ENTRIES ADDRESS
	MOVE	S2,[POINT 7,ATOM]
	$CALL	S%TBLK
	MOVE	P1,(S1)			;SAVE CONTENTS IN P1
	HLRZ	P2,P1			;GET THE ADDRESS OF THE FLAG WORD
	SETZM	ATOM+1			;ZERO 2ND WORD IN ATOM BUFFER
	HLRZ	T1,KEYTAB		;GET THE COUNT
	MOVE	T2,T1			;COPY IT INTO T2 FOR LATER
	IMULI	T1,KTE$LN		;MULTIPLY BY SIZE
	ADDI	T1,STRBUF		;POINT TO STORAGE
	HRLI	T1,(POINT 7,)		;MAKE POINTER TO STORAGE
	MOVEM	T1,TXTPTR		;STORE FOR DEPTXT
	HRLM	T1,STRADR(T2)		;PUT ADDR IN LH OF ADDRESS TABLE
	MOVEI	T1,STRADR(T2)		;GET ADDR OF TABLE SLOT
	HRRM	T1,(S1)			;PUT IN RH OF FLAG WORD
	MOVEI	T2,@MAPPRS(T3)		;GET THE PARSE TABLE ENTRY
	$TEXT	(DEPTXT,<^T/(T2)/^0>)
	MOVEI	T2,@MAPORN(T3)		;GET THE ORION MODULE NAME
	JUMPE	T2,APL.2B		;JUMP IF NO SUCH NAME
	HLRZ	T1,KEYTAB		;GET COUNT AGAIN
	MOVE	T4,T1			;COPY THE ADDRESS
	IMULI	T1,KTE$LN		;MULTIPLY BY SIZE
	ADDI	T1,ST2BUF		;POINT TO STORAGE
	HRLI	T1,(POINT 7,)		;MAKE POINTER TO STORAGE
	MOVEM	T1,TXTPTR		;STORE FOR DEPTXT
	HRRM	T1,STRADR(T4)		;PUT ADDR IN RH OF ADDR TABLE
	$TEXT	(DEPTXT,<^T/(T2)/^0>)
APL.2B:	AOS	T3			;BUMP COUNTER
	CAIGE	T3,APPCNT		;TIME TO FINISH?
	 JRST	APL.2A			;NO  - STUFF ANOTHER
					;YES - FALL THROUGH

;THIS SECTION ASKS ABOUT INSTALLATION-DEVELOPED COMMAND SUBSETS AND
;ASKS THE QUESTIONS NEEDED TO INCLUDE THEM.

	$HELP <
You can include installation-developed applications with your answers
to the following questions.>
	$PROMPT <Do you wish to run any installation-developed applications?>
	$YESNO	(NO)
	JUMPF	APL.3A			;NO MORE? THEN GO PLAY OUT THE TABLES
	SETOM	NOMSG			;SUPPRESS WRITING DIALOG TO FILE

APL.3:
	$HELP <
Specify the name of the application.  This name is used
to access the application through OPR.
>
	$PROMPT <Application name or carriage return to exit>
	$RANGE (1,20,characters)
	$NEWKEY
	JUMPF	APL.3A			;END OF TABLES
	MOVEI	S1,KEYTAB		;GET ENTRIES ADDRESS
	MOVE	S2,[POINT 7,ATOM]
	$CALL	S%TBLK
	MOVE	P1,(S1)			;SAVE CONTENTS IN P1
	HLRZ	P2,P1			;Get the address of the flag word
	SOS	P2
	$HELP <
Each application must  be associated with  an application  table
name.  This table file contains the command syntax parsing tree
for the application.  Specify only the file name.
>
	$PROMPT <Table name for ^T/ATOM/>
	$RANGE (1,6,Characters)
	$FIELD
	HLRZ	S1,KEYTAB		;GET THE COUNT
	MOVE	T1,S1			;COPY IT
	IMULI	S1,KTE$LN		;MULTIPLY BY THE SIZE OF AN ENTRY
	ADDI	S1,STRBUF		;CALCULATE WHERE TO STORE THE STRING
	HRLI	S1,(POINT 7,)		;MAKE POINTER TO STORAGE
	MOVEM	S1,TXTPTR		;STORE FOR DEPTXT
	HRLM	S1,STRADR(T1)		;SAVE ADDRESS
	MOVEI	T2,STRADR(T1)		;GET ADDR OF HOLDER
	HRRM	T2,(P2)			;SAVE ADDRESS IN RH OF FLAG WORD
	$TEXT	(DEPTXT,<^T6/ATOM/^0>)	;SAVE THE STRING
	$HELP	<
The code to implement an application can exist either as a separate
program (which communicates with users via ORION), or as an internal
module within ORION itself.>
	$PROMPT	<Internal ORION application?>
	$YESNO	(NO)
	JUMPF	APL.3			;NO IS RIGHT; GO FOR ANOTHER
	$HELP	<
Please specify the name of the module containing the application-specific
code.  This module will be assembled and incorporated into ORION.
You need only provide the file name.  The extension of .MAC is
assumed.>
	$PROMPT <Application module name>
	$RANGE (1,6,Characters)
	$FIELD
	HLRZ	S1,KEYTAB		;GET THE COUNT
	MOVE	T1,S1			;COPY IT
	IMULI	S1,KTE$LN		;MULTIPLY BY THE SIZE OF AN ENTRY
	ADDI	S1,ST2BUF		;CALCULATE WHERE TO STORE THE STRING
	HRLI	S1,(POINT 7,)		;MAKE POINTER TO STORAGE
	MOVEM	S1,TXTPTR		;STORE FOR DEPTXT
	HRRM	S1,STRADR(T1)		;STORE ADDRESS FOR PLAY-OUT
	$TEXT	(DEPTXT,<^T6/ATOM/^0>)
	JRST	APL.3			;BACK FOR MORE

;HERE WE 'PLAY OUT' THE KEYTABLE TO BUILD THE G$$ATB DEFINITIONS

APL.3A:	$CNFSTR	<@DEFINE G$$ATB ^7/[.CHLAB]/>	;START TABLE DEFINITION
	SETZ	T2,			;CLEAR SEQUENCE
	SETZ	TF,			;AND AC 0
	HLLZ	T1,KEYTAB		;GET NUMBER OF ENTRIES
	JUMPE	T1,APL.4		;EMPTY? GO WRAP UP
	MOVNS	T1			;NO -- NEGATE COUNT
	HRRI	T1,KEYTAB+1		;POINT TO FIRST ENTRY
APL.3B:	HLRZ	S1,(T1)			;POINT TO FIRST STRING
APL.3C:	HRRZ	S2,(T1)			;GET 2ND & 3RD STRING ADDRESSES
	HLRZ	T3,(S2)			;GET 2ND STRING ADDRESS
	HRRZ	T4,(S2)			;GET 3RD STRING ADDRESS
	$CNFSTR	<@X	^7/[.CHLAB]/^T/0(S1)/^7/[.CHRAB]/,^O/T2/,^T/0(T3)/,^T/0(T4)/>
	AOJ	T2,			;BUMP SEQUENCE
APL.3D:	AOBJN	T1,APL.3B		;DO ALL ENTRIES


;COMMON WRAP-UP CODE
APL.4:	$CNFSTR	<@^7/[.CHRAB]/ ; END OF G$$ATB>
	SETZM	NOMSG			;RESTORE WRITING TO FILE
	JRST	BJOB			;GO DO BATCH JOB DEFAULTS

;HERE WHEN NO OPTIONAL APPLICATIONS ARE BEING ADDED
APL.5:	SKIPE	OPSYS			;TOPS10?
	 JRST	APL.6			;NO - JUST WRAP UP AND GO ON
	SETZ	T2,			;INITIALIZE COUNTER
	$CNFSTR	<@DEFINE G$$ATB ^7/[.CHLAB]/>	;START TABLE DEFINITION
	;PUT IN THE MANDATORY APPLICATIONS
	$CNFSTR <@X	^7/[.CHLAB]/CATALOG^7/[.CHRAB]/,^O/T2/,CATTAB,>
	AOJ	T2,			;BUMP SEQUENCE
	$CNFSTR <@X	^7/[.CHLAB]/CONFIG^7/[.CHRAB]/,^O/T2/,CNFTAB,CNFORN>
	AOJ	T2,			;BUMP SEQUENCE
	$CNFSTR <@X	^7/[.CHLAB]/QUOTA^7/[.CHRAB]/,^O/T2/,QUOTAB,>
	$CNFSTR	<@^7/[.CHRAB]/ ; END OF G$$ATB>
	JRST	BJOB			;SKIP NULL DEF AND MOVE ON

APL.6:	$CNFSTR	<@DEFINE G$$ATB ^7/[.CHLAB]/^7/[.CHRAB]/>
SUBTTL	Batch Job Defaults

BJOB:	$HEADER <Batch Job Defaults>

	$COMMENT <
The questions in this section are used to define default  values
for  the various options that a user can specify when submitting
a batch job.>
	$HELP <
The  batch  user can specify a maximum runtime for his batch job
using the /TIME switch.  If he does not specify this switch  the
following default will be used:>

BJOB.1:	$PROMPT <Default batch job runtime limit>
	$RANGE (5,9999,seconds)
	$DEFAULT (300)
	$NUMBER				;GET A NUMBER

	$CNFSTR <@	XP	G.ITIM,^D/S1/>
	$HELP < 
Every batch  job has  maximum limits  for each  type of  spooled
output.  These  limits  can  be  set  by  the  batch  user  with
appropriate switches to the SUBMIT command.  If the user doesn't
specify these switches, the following defaults will be used:>

BJOB.2:	$PROMPT <Line printer output limit>
	$RANGE (0,9999,pages)
	$DEFAULT (200)
	$NUMBER				;GET A NUMBER

	$CNFSTR <@	XP	G.ILPT,^D/S1/>

BJOB.3:	$PROMPT <Card punch output limit>
	$RANGE (0,9999,cards)
	$DEFAULT (1000)
	$NUMBER				;GET A NUMBER

	$CNFSTR <@	XP	G.ICDP,^D/S1/>

	$PROMPT	<Paper tape punch output limit>
	$RANGE (0,5000,feet)
	$DEFAULT (200)
	$NUMBER

	$CNFSTR <@	XP	G.IPTP,^D/S1/>

	$PROMPT	<Plotter output limit>
	$RANGE (0,5000,minutes)
	$DEFAULT <30>
	$NUMBER

	$CNFSTR <@	XP	G.IPLT,^D/S1/>
	JRST	BJOB.4

LOGTBL:	2			;VALUE FOR LOG
	1			;VALUE FOR NOLOG
	3			;VALUE FOR ERROR

BJOB.4:
	$HELP < 
The user can specify whether or not the batch log file should be
printed after the job terminates by using the /OUTPUT switch  to
the SUBMIT command.  The action  is specified by: LOG to  always
print the log file, NOLOG to never print the log file, and ERROR
to print the log  file only if the  job ended with an  unhandled
error.  If the user doesn't  specify this switch, the  following
value will be used.>

	$PROMPT <Default for SUBMIT/OUTPUT>
	$CHOICES <LOG,NOLOG,ERROR>
	$DEFAULT (LOG)
	$KEYWORD			;GET THE KEYWORD

	$CNFSTR <@	XP	G.ILOG,^D/LOGTBL(S1)/>

	MOVEI	S1,0			;LOAD A ZERO
	SKIPE	OPSYS			;SKIP IF TOPS10
	JRST	BJOB.7			;AND JUST WRITE THE VALUE

	$HELP <
The  system  provides  for the enforcement of a maximum physical
memory limit on batch jobs.  The  user  can  specify  a  maximum
memory  parameter  and  if  any  program attempts to exceed this
limit, the batch job goes virtual.>

BJOB.5:	$PROMPT <Should memory limits be enforced>
	$YESNO	YES
	SETZM	S1
	JUMPF	BJOB.7			;IF NO, WRITE A 0

	$HELP <
The  user  can specify a maximum memory limit by using the /CORE
switch.  If this switch  is  not  specified  by  the  user,  the
following default will be used.>

BJOB.6:	$PROMPT <Memory limit>
	$RANGE (24,16384,pages)
	$DEFAULT (512)
	$NUMBER				;GET A NUMBER

BJOB.7:	$CNFSTR <@	XP	G.ICOR,^D/S1/	;CORE LIMITS>
SUBTTL	Line printer defaults and parameters

LPTP:	$HEADER <Line Printer Defaults and Parameters>

	$COMMENT <
The questions in this section are used to set default values for
the line printer spooler.>
	$HELP <
Job banner pages are printed at  the  beginning  of  each  print
request.   The  user's  name  and  any /NOTE value is printed on
them.>

	$PROMPT	<Number of job banner pages>
	$RANGE (0,5)
	$DEFAULT (2)
	$NUMBER				;GET THE NUMBER

	$CNFSTR <@	XP	G.LBAN,^D/S1/>

	$HELP <
Job  trailer pages are printed at the end of each print request.
The user's  name  and  any  spooler  checkpoint  information  is
printed on them.>

	$PROMPT	<Number of job trailer pages>
	$RANGE (0,5)
	$DEFAULT (2)
	$NUMBER				;GET THE NUMBER

	$CNFSTR <@	XP	G.LTRL,^D/S1/>

	$HELP	<
File header pages are printed before  each file or copy in  each
print request.  The file name is printed in BOLD letters on each
header page.>

	$PROMPT <Number of file header pages>
	$RANGE (0,5)
	$DEFAULT (2)
	$NUMBER				;GET THE NUMBER

	$CNFSTR <@	XP	G.LHDR,^D/S1/>

	$HELP <
The user can specify a special form for a print request with the
/FORMS switch.  If this switch is not  specified  the  following
default will be used.>

	$PROMPT	<Name for standard output forms>
	$RANGE (4,6,Characters)
	$DEFAULT (NORMAL)
	$FIELD

	$CNFSTR <@	XP	G.DNOR,'^T6/ATOM/'>

	$HELP <
The number  of  characters  that uniquely  identify  a  form  is
compared with  the current  form name  to determine  if a  forms
change is required for a specific user request.>

	$PROMPT	<Number of characters which uniquely identifies form>
	$RANGE (2,6)
	$DEFAULT (4)
	$NUMBER				;GET THE NUMBER

	$CNFSTR <@	XP	G.DNUC,^D/S1/>

	$HELP <

There may  be site specific devices which require special device
drivers loaded  with  LPTSPL  as needed.  For example,  the LN01
laser printer requires  the module  LPTL01  in  order for LPTSPL
to load fonts as requested. >

	$PROMPT <Do you want to load any special printer drivers?>
	$YESNO	(NO)
	JUMPF	LPTD.1

	$HELP <

Each device driver must have  its own module  to be  loaded with
the LPTSPL main module. This module's .REL file must be found on
the build area when LPTSPL is loaded. >

	SETOM	NOMSG			;Suppress dialog to file

	$CNFSTR	<@DEFINE G$$LPT ^7/[.CHLAB]/>	;START TABLE DEFINITION

LPTD.0:	$PROMPT <Name of device driver module>
	$RANGE (1,6,Characters)
	$FIELD
	$CNFSTR <@	LL	^T6/ATOM/>
	$PROMPT <Any more special drivers to load>
	$YESNO	(NO)
	JUMPT	LPTD.0

LPTD.2:	$CNFSTR	<@^7/[.CHRAB]/ ; End of G$$LPT>
	JRST	LPTD.X

LPTD.1:	$CNFSTR	<@DEFINE G$$LPT ^7/[.CHLAB]/^7/[.CHRAB]/>

LPTD.X:
	$HELP <

There may be site specific hard  copy  terminal  printers  which
function  as  LA120  or LA180 equivalents, but have non-standard
names.  LPTSPL must be told to recognize these names.

                          *** NOTE ***

The use of non-standard hard copy terminals is supported only if
the terminal  is functionally  equivalent  to  an  LA120  or  an
LA180.>

	$PROMPT <Do you want to use non-standard terminal printers>
	$YESNO	(NO)
	JUMPF	LPTT.2			;SKIP THIS STUFF IF 'NO'
	SETOM	NOMSG			;SUPPRESS DIALOG TO FILE
	$CNFSTR	<@DEFINE	G$$TTY,^7/[.CHLAB]/@>

LPTT.1:	$PROMPT	<Name of terminal>
	$RANGE	(1,6,Characters)
	$FIELD
	$CNFSTR	<	SIXBIT	/^T6/ATOM//>
	$PROMPT	<Any more terminals>
	$YESNO	(NO)
	JUMPT	LPTT.1
	$CNFSTR	<@^7/[.CHRAB]/ ; END OF G$$TTY>
	JRST	LPTT.X

LPTT.2:	$CNFSTR	<@DEFINE	G$$TTY ^7/[.CHLAB]/^7/[.CHRAB]/>

LPTT.X:
SUBTTL	MDA Parameters
	
MDA:	SETZM	NOMSG			;Turn on dialog to file

	TOPS10<

	$HEADER (Parameters for MDA)

	$COMMENT <
The questions  in  this section  are  used to  set  the  default
parameters for the Mountable Device Allocator (MDA).>

	$HELP <
The   following  question  allows  you to  enable  the  deadlock
avoidance code in  MDA. This  code  prevents jobs  from  waiting
for  tape or  disk resources that another  job  may already own,
or that  do not  exist. Enabling  the  deadlock  avoidance  code
causes MDA  to  use  sligthly  more  CPU  time  to  insure  that
deadlocks  will  not occur.>

	$PROMPT	<Enable deadlock avoidance?>
	$YESNO(YES)
	$CNFSTR	<@	XP	G.DEAD,^D/TF/	;DEADLOCK AVOIDANCE>

	$CNFSTR	<

	      %TRK7==1			      ; 7 TRACK
	      %TRK9==2			      ; 9 TRACK
	>

	$HELP <
You have  the  option of  specifying  which label  type  is  the
default.
                             NOTE:
Label type USER-EOT will allow a user program to see the end  of
tape condition on an UNLABELED tape only.  All other label types
will  cause  the  user  to  block  at  end  of  tape  while  MDA
automatically  expands  the  volume  set.  In this case the user
program will NOT see end of tape.  >

MDA.1:	$PROMPT <Default tape label type>
	$CHOICES <ANSI,BYPASS,IBM,USER-EOT,UNLABELED>
	$DEFAULT (<USER-EOT>)
	$KEYWORD

	MOVE	P1,[EXP %TFANS,%TFLBP,%TFEBC,%TFUNV,%TFUNL](S1)

	$CNFSTR	<@	XP	DEFLBT,^D/P1/>

	$HELP	<
You have the option of  specifying the default density at  which
tapes are read and written.>

MDA.2:	$PROMPT	<Default 9-track tape density>
	$CHOICES <200,556,800,1600,6250>
	$DEFAULT (1600)
	$KEYWORD

	MOVE	P1,[EXP .TFD20,.TFD55,.TFD80,.TFD16,.TFD62](S1)

	$CNFSTR	<@	XP	DEF9TK,^O/P1/>

	$PROMPT	<Default 7-track tape density>
	$CHOICES <200,556,800>
	$DEFAULT (800)
	$KEYWORD

	MOVE	P1,[EXP .TFD20,.TFD55,.TFD80](S1)

	$CNFSTR	<@	XP	DEF7TK,^O/P1/>

	$HELP	<
You have  the option  of specifying  the default  track type  on
which to mount tapes.>

	$PROMPT	<Default track type>
	$CHOICES <7,9>
	$DEFAULT (9)
	$KEYWORD

	$CNFSTR	<@	XP	DEFTRK,%TRK^T/0(S2)/>

>
TOPS20<	$HEADER	<Tape Label Action>>

	$HELP	<
The system  administrator  can  allow  non-privileged  users  to
bypass label processing.>

	$PROMPT	<Allow bypassing for non-privileged users?> 
	$YESNO	(NO)

	$CNFSTR	<@	XP	NPRTLB,^D/TF/>

SUBTTL	Miscellaneous Parameters

MISC:	$HEADER <Miscellaneous Defaults and Parameters>

	$COMMENT <
The  questions  in   this  section  refer   to  general   GALAXY
parameters.>
	$HELP <
The following section establishes default bias and disk page  to
spooler unit conversion factors.>

	$PROMPT	<Do you want the standard limit computation>
	$YESNO	(YES)

	JUMPF	MISC.1

TOPS10 <
	$CNFSTR	<@	XP	G.LPTM,6>
	$CNFSTR <@	XP	G.LPTD,8>
	$CNFSTR <@	XP	G.CDPM,33>
	$CNFSTR	<@	XP	G.CDPD,4>
	$CNFSTR	<@	XP	G.PLTM,7>
	$CNFSTR	<@	XP	G.PLTD,100>
	$CNFSTR	<@	XP	G.PTPM,7>
	$CNFSTR	<@	XP	G.PTPD,4>
> ;End of TOPS10

TOPS20 <
	$CNFSTR	<@	XP	G.LPTM,15>
	$CNFSTR <@	XP	G.LPTD,5>
	$CNFSTR <@	XP	G.CDPM,33>
	$CNFSTR	<@	XP	G.CDPD,1>
	$CNFSTR	<@	XP	G.PLTM,7>
	$CNFSTR	<@	XP	G.PLTD,25>
	$CNFSTR	<@	XP	G.PTPM,28>
	$CNFSTR	<@	XP	G.PTPD,1>
> ;End of TOPS20
	JRST	MISC.2

MISC.1:
TOPS10	<
	$HELP <
The default output limit of a spooled file is calculated as:

    limit = disk blocks * units per disk block * copies

The output limit is  expressed in pages  for the printer,  cards
for the card punch,  minutes for the plotter,  and feet for  the
paper tape punch.  The following questions establish the  number
of units of output per disk page.> >

TOPS20	<
	$HELP <
The default output limit of a spooled file is calculated as:

    limit = disk pages * units per disk page * copies

The output limit is  expressed in pages  for the printer,  cards
for the card punch,  minutes for the plotter,  and feet for  the
paper tape punch.  The following questions establish the  number
of units of output per disk page:> >

TOPS10<	$PROMPT <Number of printed pages per disk block >
	$DEFAULT (.7) >
TOPS20<	$PROMPT	<Number of printed pages per disk page >
	$DEFAULT (5)  >
	$NUMBRS
	$CNFSTR	<@	XP	G.LPTM,^D/S1/>
	$CNFSTR	<@	XP	G.LPTD,^D/S2/>

TOPS10<	$PROMPT	<Number of punched cards per disk block >
	$DEFAULT (8) >
TOPS20<	$PROMPT <Number of punched cards per disk page >
	$DEFAULT (33) >
	$NUMBRS
	$CNFSTR	<@	XP	G.CDPM,^D/S1/>
	$CNFSTR	<@	XP	G.CDPD,^D/S2/>

TOPS10<	$PROMPT	<Minutes of plotter output per disk block >
	$DEFAULT (0.07) >
TOPS20<	$PROMPT	<Minutes of plotter output per disk page >
	$DEFAULT (0.28) >
	$NUMBRS
	$CNFSTR	<@	XP	G.PLTM,^D/S1/>
	$CNFSTR	<@	XP	G.PLTD,^D/S2/>

TOPS10<	$PROMPT	<Feet of paper tape per disk block >
	$DEFAULT (7) >
TOPS20<	$PROMPT	<Feet of paper tape per disk page >
	$DEFAULT (28) >
	$NUMBRS
	$CNFSTR	<@	XP	G.PTPM,^D/S1/>
	$CNFSTR	<@	XP	G.PTPD,^D/S2/>

MISC.2:
	$HELP <
The default action to be taken when output exceeds the specified
limit for an output spooler may  be to ABORT the job and  ignore
all remaining output, ASK the operator what to do, or PROCEED to
finish processing the job.>

	$PROMPT	<Default output-limit-exceeded action>
	$CHOICES <ABORT,ASK,PROCEED>
	$DEFAULT <ASK>
	$KEYWORD
	AOS	S1			;GET PROPER VALUE

	$CNFSTR	<@	XP	G.FLEA,^D/S1/>

TOPS10 <
         $HELP <
If file access between network nodes is to be done, each FAL -
file access listener - stream needs a network type  associated
with it. The 2  network types supported are ANF-10 and DECnet.>

	$PROMPT <Default network-type for FAL streams>
	$CHOICES <ANF-10,DECnet>
	$DEFAULT <ANF-10>
	$KEYWORD
	AOS	S1			;GET PROPER VALUE

	$CNFSTR <@	XP	G.FNTY,^D/S1/>

	$HELP <
Galaxy-10 spoolers (object processors) are now grouped into three
categories  and  are  started (logged-in and  run) by  QUASAR  at
different times depending  on which  category they fall into. The
three categories and their corresponding characteristics are:>
$HELP <%ONCE  - "fired up" by  QUASAR  after QUASAR starts ORION, PULSAR
         and CATLOG).  The spooler will never logout on its own.>
$HELP <%STCMD - "fired up" by QUASAR when an OPR START command is issued
         for a stream controlled by the spooler. The spooler will
         logout when all streams under its control are shut down.>
$HELP <%DEMND - "fired up" by QUASAR  when a job is in a queue that  can
         be serviced by one  of the spooler's job streams.  These
         "demand"  spoolers  will  logout  after  "n"  minutes of
         idleness.  You will be prompted below to  define a value
         for "n".>
$HELP <The PRCDAT macro in QSRMAC.MAC defines the category to which each
supported object processor/spooler belongs.>

	$PROMPT	<Number of minutes "demand" spoolers tolerate idleness>
	$RANGE (5,60)
	$DEFAULT (10)
	$NUMBER				;GET THE NUMBER

	$CNFSTR <@	XP	G.IMIN,^D/S1/>
>
	SUBTTL	Hardwired parameters

HRDWRD:	$CNFSTR	<@	XP	FTDN60,-1	;Always include DN60 support>
	$CNFSTR	<@	XP	FTFTS,0		;No FTS support>
TOPS10 <
	$CNFSTR	<@	XP	FTRJE,0		;No DN200 support>
	$CNFSTR	<@	XP	FTFACT,0	;FACT file support off>
> ;End TOPS10

TOPS20 <
	$CNFSTR	<@	XP	FTRJE,-1	;Always include DN200>
	$CNFSTR	<@	XP	FTFACT,0	;FACT file support off>
> ;End TOPS20
	SUBTTL	Site specific values acquisition

	$HELP <

Your site may wish to include additional symbols and values which
are different from  Digital's standard ones.  By specifying these
values here,  you may  further tailor  GALAXY  to your particular
installation.>

	$PROMPT <Do you wish to enter any site specific paramters?>
	$YESNO	(NO)
	JUMPF	GALEND
	SETOM	NOMSG			;Suppress dialog to file

	$HELP  <
The parameters are entered as lines of text  in a form acceptable
for assembly by MACRO-10.  Valid examples are:

	XP	SYMBOL,EXPRESSION	;comment
	ND	SYMBOL,EXPRESSION	;comment
	SYMBOL==EXPRESSION		;comment

Where SYMBOL is a  legal symbol name for MACRO-10, and EXPRESSION
is any valid  MACRO-10  expression consisting  of  symbols and/or
constants.  The comment is any  arbitrary string beginning with a
semi-colon.>

	$TTYSTR	<Enter site specific parameter text: (Empty line to end.) >
ACQUIR:	MOVEI	S1,BUFLEN		;Get the buffer lenght
	MOVEI	S2,ATOM			;Get the address
	$CALL	.ZCHNK			;Clear it
	MOVE	S1,[TXTIBK,,TXTIAR]	;Transfer the TEXTI block
	BLT	S1,TXTIAR+.RDRTY	;Do it
	MOVEI	S1,TXTIAR		;Get the address of the arguements
	$CALL	K%TXTI			;Get a line of text
	MOVE	S1,TXTIAR+.RDDBC	;Null string?
	CAIN	S1,<BUFLEN*5>-3		;Did he only type a carriage return?
	 JRST	GALEND			;Yes, all done
	PUSHJ	P,ACQCHC		;NO - go see if line only has a comment
	JUMPE	T1,GALEND		;If T1 is clear, we have a comment only
	$CNFSTR	<@^T/ATOM/>		;If not, it's fair game for the file
	JUMPT	ACQUIR			;Back for more abuse

;ACQCHC - Routine to examine atom buffer for a comment-only line.
;A comment line contains text beginning with a semicolon, with potential
;leading nulls, spaces, or tabs.

ACQCHC:	MOVEI	S1,BUFLEN*5		;GET BUFFER LENGTH
	MOVE	S2,[POINT 7,ATOM]	;SET UP BYTE POINTER
	SETZM	T1			;CLEAR RETURN AC
ACQCHL:	ILDB	T2,S2			;GET A BYTE
	SOJE	S1,ACQCHD		;DECREMENT COUNT, JUMP IF DONE
	CAIE	T2,0			;Null?
	 CAIN	T2," "			;Or is it a space?
	  JRST	ACQCHL			;Yes - get another character
	CAIN	T2,"	"		;How about a tab?
	 JRST	ACQCHL			;Yes - Try another
	CAIE	T2,";"			;Semicolon?
	 SETOM	T1			;No - indicate line is not 'blank'
ACQCHD:	POPJ	P,			;Whatever - All done, return

GALEND:	$CNFSTR <@@	END>
	$TTYSTR <@@[End of GALGEN Dialog]>

	MOVE	S1,CNFIFN
	$CALL	F%REL
	JRST	I%EXIT
SUBTTL	Terminal Input Processors

GETANS:	CAIN	S1,.CMFLD		;ARE WE PARSING A FIELD?
	SKIPE	CMDDEF			; WITH NO DEFAULT?
	JRST	GETAN			;NO..PROCEED NORMALLY
	MOVX	S1,FLD(.CMFLD,CM%FNC)+CM%SDH
	MOVEM	S1,CMDFN2			;STORE AS ALTERNATE
	MOVE	S1,[CM%SDH+CMDFN2]
	IORM	S1,CMDFNC		;SET THE ALTERNATE
	MOVEI	S1,.CMCFM		;MAKE CONFIRM PRIMARY
GETAN:	STORE	S1,CMDFNC,CM%FNC	;STORE FUNCTION CODE
	STORE	S2,CMDDAT		;AND SPECIFIC DATA
	MOVEI	S1,GET.1
	HRRM	S1,CMDFLG		;STORE REPARSE ADDRESS
	DMOVE	S1,[EXP CMDBLK,[<.CMINI>B8]]
	$CALL	S%CMND		;INIT COMMAND AND DISPLAY PROMPT
	SKIPT
	STOPCD	(CIF,HALT,,<Command Initialization Failed>)
GET.1:	DMOVE	S1,[EXP CMDBLK,FNCBLK]	;GET RESPONSE
	SETZM	ATOM
	$CALL	S%CMND		;FROM COMND
	JUMPF	.RETF			;DIE IF COMND DID
	LDB	S1,[POINT 7,ATOM,6]		;CHECK FIRST BYTE
	JUMPE	S1,.RETF			;DIE IF NULL
	DMOVE	S1,CR.FLG(S2)		;GET COMMAND FLAGS RETURNED
	TXNE	S1,CM%NOP		;CHECK NO PARSE
	  $RETF				;BAD RETURN
	TXNE	S1,CM%EOC		;CHECK END OF LINE
	$RETT				;GOOD..RETURN NOW
	$SAVE	<S1,S2>			;SAVE FOR RETURN
	DMOVE	S1,[EXP CMDBLK,[<.CMCFM>B8]]	;CONFIRM COMMMAND
	$CALL	S%CMND
	JUMPF	.RETF			;DIE IF FALSE
	MOVE	S1,0(S2)		;GET FLAGS
	TXNE	S1,CM%EOC
	$RETT
	$TTYSTR <@? Answer Not Confirmed with Carriage Return>
	$RETF

;WRTANS is called to write the prompt and answer to the configuration
;file as a comment.  It should be called after a field is parsed
;succesfully

WRTANS:	SKIPN	NOMSG				;WRITING MESSAGES?
	$CNFSTR	<@;^T/PRMTXT/^T/BUFFER/>	;YES..DO IT
	$RETT
SUBTTL	KEYWORD  --  Parse a keyword response

;KEYWORD is called to match a user response to a keyword table.
KEYWORD:MOVEI	S1,.CMKEY		;SET KEYWORD FUNCTION
	MOVEI	S2,KEYTAB		;FROM KEYTAB (SORTED via CHOICE)
	$CALL	GETANS
	JUMPF	KEYW.1			;HELP AND RETRY
	HRRZ	S1,(S2)			;CALLING INDEX TO S1
	HLRZ	S2,(S2)			;ADDRESS OF STRING TO S2
	PJRST	WRTANS			;WRITE TO FILE AND RETURN

KEYW.1:	$TTYSTR <? Invalid Keyword, Please try again.@>
	JRST	KEYWORD

;FIELD is called to parse a one-word user response

FIELD:	MOVEI	S1,.CMFLD		;SET FIELD FUNCTION
	SETZ	S2,			;NO ARGS
	$CALL	GETANS
	MOVE	S2,[POINT 7,ATOM]	;COUNT CHARACTERS
	MOVEM	S2,TXTPTR		;SAVE POINTER
	SETZ	S1,			;CLEAR TALLY
	JUMPF	FLD.4			;Complain and retry

FLD.1:	ILDB	S2,TXTPTR		;GET BYTE
	JUMPE	S2,FLD.2		;EXIT ON NULL
	AOJA	S1,FLD.1		;TALLY COUNT

FLD.2:	CAML	S1,MIN			;FAIL IF TOO SMALL
	CAMLE	S1,MAX			;OR IF TOO BIG
	JRST	FLD.3			;OUT OF RANGE

	PJRST	WRTANS			;WRITE TO FILE AND RETURN

FLD.3:	$TTYSTR <? Field Length Incorrect, Please try again.@>
	JRST	FIELD

FLD.4:	$TTYSTR <? Field incorrect, Please try again.@>
	JRST	FIELD

YESNO:	$TEXT(DEPTXT,<(YES,NO) ^A>)	;LIST CHOICES
	HRRZ	S2,@0(P)		;GET THE DEFAULT KEYWORD
	SKIPE	S1,2(S2)		;GET DEFAULT WORD
	$DEFAULT (^T/2(S2)/)		;SET DEFAULT IF PRESENT
YESNO2:	MOVEI	S1,.CMKEY		;SET KEYWORD FUNCTION
	MOVEI	S2,YONTAB		;AND THE LIST OF KEYWORDS
	$CALL	GETANS			;GET THE ANSWER
	JUMPF	YESNO1			;HELP AND RETRY
	HRRZ	S1,(S2)			;CALLING INDEX TO S1
	HLRZ	S2,(S2)			;ADDRESS OF STRING TO S2
	PUSHJ	P,WRTANS		;LOG THE ANSWER
	HRRZ	S2,@0(P)		;GET ADDR OF ARGS
	HRL	S2,S1			;S2/ ARGADR(S1)
	SKIPN	S2,@S2			;LOAD AND TEST ARG
	 PJRST @[.RETT
		 .RETF](S1)		;RETURN IF NULL
	POP	P,S1			;ELSE CLEAN UP STACK
	PJRST	@S2			;AND DISPATCH

YESNO1:	$TTYSTR <? Please answer YES or NO@>
	JRST	YESNO2

YONTAB:	2,,2
	[ASCIZ |NO|],,1
	[ASCIZ |YES|],,0
SUBTTL	NEWKEY	Support routine for $NEWKEY macro

NEWKEY:	MOVEI	S1,.CMFLD		;FUNCTION FIELD
	SETZ	S2,			;NO ARGS
	$CALL	GETANS			;GET THE ANSWER
	JUMPF	.RETF			;END OF THE LINE
	HLRZ	S2,KEYTAB		;GET THE COUNT
	IMULI	S2,KTE$LN		;COMPUTE OFFSET TO STRBUF
	ADD	S2,[POINT 7,STRBUF+1]	;POINT TO IT
	MOVEM	S2,TXTPTR		;STORE THE POINTER
	SETZM	TXTCNT			;CLEAR THE COUNT
	$TEXT	(DEPTXT,<^T/ATOM/^0>)	;MOVE THE STRING
	MOVE	S1,TXTCNT		;GET THE COUNT
	CAML	S1,MIN			;CHECK LENGTH
	CAMLE	S1,MAX			; OF STRING
	 JRST	[$TTYSTR <@? Keyword size out of range>
		 JRST	NEWKEY]		;TRY AGAIN
	MOVEI	S1,KEYTAB		;POINT TO TABLE
	HRL	S2,S2			;GET ADDR,,ADDR
	ADDI	S2,STR$LN		;COMPUTE OFFSET TO SECOND ENTRY
	$CALL	S%TBAD			;ADD THE ENTRY TO TABLE
	JUMPT	WRTANS			;LOG IN FILE AND RETURN
	CAIN	S1,EREIT$		;ENTRY ALREADY EXIST?
	$TTYSTR	<@? ^T/ATOM/ already specified>
	CAIE	S1,ERTBF$		;IS TABLE FULL?
	JRST	NEWKEY			;NO -- TRY AGAIN
	$TTYSTR	<@? Keyword table is full>
	$RETF
SUBTTL	NUMBER/ONUMBR -- SUPPORT ROUTINES FOR $NUMBER/$ONUMBR

;NUMBER is called to parse type-in of a decimal number.
;
;T Return:	S1/ Number

ONUMBR:	MOVEI	S1,.CMNUM		;REQUEST NUMBER
	MOVEI	S2,^O10			;OCTAL RADIX
	JRST	NUMB.1			;Go get it

NUMBER:	MOVEI	S1,.CMNUM		;REQUEST NUMBER
	MOVEI	S2,^D10			;IN DECIMAL RADIX
NUMB.1:	$CALL	GETANS			;GET THE TYPE-IN
	JUMPF	NUM.1			;HELP AND RETRY
	MOVE	S1,S2			;NUMBER IN S1
	CAML	S1,MIN			;CHECK RANGE
	CAMLE	S1,MAX
	JRST	NUM.2			;OUT OF RANGE
	PJRST	WRTANS			;WRITE TO FILE AND RETURN

NUM.1:	$TTYSTR <? You Must Specify a number@>
	JRST	NUMBER

NUM.2:	$TTYSTR <? Number not within specified Range@>
	JRST	NUMBER
SUBTTL	NUMBRS	Support routine for $NUMBRS MACRO

NUMBRS:	MOVEI	S1,.CMTXT	;TEXT FUNCTION
	MOVEI	S2,NUMBRK	;BREAK SET
	$CALL	GETANS		;PARSE THE STRING
	$CALL	NUMBDV		;GET THE VALUE
	JUMPT	WRTANS			;WRITE IN FILE AND RETURN
	$TTYSTR	<@? Invalid numeric string@>
	JRST	NUMBRS			;GET THE STRING

NUMBDV:	MOVEI	S1,0			;INITIALIZE RESULT
	MOVEI	S2,1			;INITIALIZE SCALE
	SETZ	T3,			;CLEAR FLAG FOR PERIOD SEEN
	SETZ	T4,			;CLEAR FLAG FOR SEMI SEEN
	MOVE	T1,[POINT 7,ATOM]	;POINT TO BUFFER
NUMV.1:	ILDB	T2,T1			;GET A BYTE
	JUMPE	T2,.RETT		;TERMINATE ON NULL
	JUMPL	T4,NUMV.1		;LOOP FOR MORE IF SEMI ALREADY SEEN
	CAIN	T2,";"			;SEMICOLON?
	 JRST	[SETOM T4		;YES - LIGHT FLAG WORD
		 JRST NUMV.1]		;AND GET ANOTHER CHARACTER
	CAIE	T2," "			;SPACE?
	 CAIN	T2,"	"		;OR TAB?
	  JRST	[MOVEI T4,1		;LIGHT THE 'SAW A SPACE' FLAG
		 JRST NUMV.1]		;AND GET ANOTHER CHARACTER
	CAIL	T2,"0"
	CAILE	T2,"9"			;NUMERIC
	 JRST	[CAIN T2,"."		;NO -- THEN MUST BE PERIOD
		 SKIPE T3		; AND THE ONLY ONE
		  $RETF			;OOPS -- BAD SYNTAX
		 SETO T3,		;SET FLAG -- PERIOD SEEN
		 JRST NUMV.1]		;GET NEXT CHARACTER
	JUMPG	T4,[$RETF]		;IF A SPACE WAS SEEN, FAIL
	IMULI	S1,^D10			;ADJUST INTEGER RESULT
	ADDI	S1,-"0"(T2)		;ADD THIS DIGIT
	JUMPE	T3,NUMV.1		;WAS PERIOD SEEN?
	IMULI	S2,^D10			;YES -- ADJUST PER DECIMAL POINT
	JRST	NUMV.1			;GET NEXT DIGIT

NUMBRK:	777777,,777760		;BREAK ON ALL CONTROL
	777764,,001760		;ALLOW 0-9 AND ,
	777777,,777760		;BREAK ON ALL ALPHA
	777777,,777760		;BREAK ON ALL ALPHA
SUBTTL	CHOICE	Support Routine for $CHOICE MACRO


REJECT:	HRRZ	S1,@0(P)		;POINT TO ARGUMENTS
	MOVE	S2,(S1)			;S2/ ARG CNT,,STRING ADR
	PJRST	CHO.1			;FALL INTO COMMON CHOICE ROUTINE

CHOICE:	HRRZ	S1,@0(P)		;POINT TO ARGUMENTS
	MOVE	S2,(S1)			;S2/ ARG CNT,,STRING ADR
	$TEXT	(DEPTXT,<(^T/(S2)/) ^A>) ;MOVE STRING TO PRMTXT BUFFER
CHO.1:	HLLZ	S2,S2			;GET A NULL IN S2
	MOVE	T1,TXTPTR		;STORE NULL, BUT DON'T
	IDPB	S2,T1			;CHANGE POINTER

;add each entry to table

;	S1/	Dummy table address
;	S2/	Arg count,,0

	MOVN	T1,S2			;NEGITIVE COUNT,,0
	HRRI	T1,1(S1)		;ADDRESS OF FIRST ENTRY
	HRRZS	KEYTAB			;CLEAR TABLE COUNTS

TBA.1:	MOVEI	S1,KEYTAB		;POINT TO TABLE
	MOVE	S2,(T1)			;GET ENTRY
	$CALL	S%TBAD		;ADD IT TO TABLE
	AOBJN	T1,TBA.1		;DO ALL ENTRIES
	$RETT
SUBTTL	ADDKEY	Support Routine for $ADDKEY MACRO


ADDKEY:	HRRZ	S1,@0(P)		;POINT TO ARGUMENTS
	MOVE	S2,(S1)			;S2/ ARG CNT,,STRING ADR
	PJRST	ADD.1			;FALL INTO COMMON CHOICE ROUTINE

ADD.1:	HLLZ	S2,S2			;GET A NULL IN S2
	MOVE	T1,TXTPTR		;STORE NULL, BUT DON'T
	IDPB	S2,T1			;CHANGE POINTER

;add each entry to table

;	S1/	Dummy table address
;	S2/	Arg count,,0

	MOVN	T1,S2			;NEGITIVE COUNT,,0
	HRRI	T1,1(S1)		;ADDRESS OF FIRST ENTRY

TBAA.1:	MOVEI	S1,KEYTAB		;POINT TO TABLE
	MOVE	S2,(T1)			;GET ENTRY
	$CALL	S%TBAD			;ADD IT TO TABLE
	AOBJN	T1,TBAA.1		;DO ALL ENTRIES
	POPJ	P,			;RETURN, PROPAGATING STATUS
SUBTTL	HELP AND COMMENT SUPPORT ROUTINES

HELP:	MOVE	S1,[POINT 7,HLPTXT]
	MOVEM	S1,TXTPTR		;POINT DEPTXT TO HELP BUFFER
	HRRZ	T1,@0(P)		;GET ADDRESS OF STRING
	$TEXT	(DEPTXT,^T/@T1/^0)	;STORE HELP MESSAGE
	SKIPE	DIALEN			;WRITE IN FILE IF LONG DIALOG
	$CALL	COM.1			;WRITE AS A COMMENT IN FILE
	MOVX	S1,CM%HPP!CM%SDH	;HELP PRESENT AND NO DEFAULT HELP
	IORM	S1,CMDFNC		;IN FUNCTION BLOCK
	MOVE	S1,[POINT 7,HLPTXT]	;STORE POINTER TO HELP
	MOVEM	S1,CMDHLP		;FOR COMND
	$RETT

;COMMENT Routine to Output Comment to File

COMMENT:SKIPN	DIALEN			;RETURN IF SHORT DIALOG
	$RETT
	HRRZ	T1,@0(P)		;GET ADDRESS OF STRING

;CALLED HERE FROM HELP AND PROMPT WITH ADDR IN T1

COM.1:	SKIPE	DIALEN			;DISPLAY IF LONG MODE
	$TEXT	(TTYCHR,^T/@T1/@)
	HRLI	T1,440700		;CREATE POINTER
	$CALL	CNFCRL		;PREFIX WITH <CRLF>
COM.2:	MOVEI	S1,";"			;PREFIX WITH "; "
	$CALL	CNFCHR
	MOVEI	S1," "
	$CALL	CNFCHR
COM.3:	ILDB	S1,T1			;GET BYTE
	  JUMPE	S1,COM.4		;EXIT ON NULL BYTE
	$CALL	CNFCHR
	CAIE	S2,12			;LAST CHARACTER <LF>?
	JRST	COM.3			;NO -- GET NEXT BYTE
	JRST	COM.2			;ELSE FORCE NEW PREFIX
COM.4:	PJRST	CNFCRL			;SUFFIX WITH <CRLF> AND RETURN

HEADER:	HRRZ	S1,@0(P)		;GET ADDRESS OF STRING
	$TEXT	(CNFCHR,<^LSUBTTL	^T/@S1/@>) ;NEW PAGE AND SUBTTL
	MOVE	S2,[POINT 7,BUFFER]
	MOVEM	S2,TXTPTR
	$TTYSTR <@@>			;SPACE TWO LINES ON TERMINAL
	$TEXT	(DEPTXT,<^T52C/@S1/>)	;JUSTIFY HEADER
HEAD.1:	ILDB	S1,S2			;UNDERSCORE ALL EXCEPT "SPACE<CRLF>
	CAILE	S1," "			;SPACE OR CONTROL?
	MOVEI	S1,"-"
	IDPB	S1,TXTPTR		;ELSE WRITE CHARACTER
	CAIE	S1,12			;TERMINATE ON <LF>
	JRST	HEAD.1
HEAD.2:	SETZ	S1,
	IDPB	S1,TXTPTR
	MOVEI	T1,BUFFER		;POINT TO BUFFER
	SOS	DIALEN			;FORCE OUTPUT TO TERMINAL
	$CALL	COM.1			;AND WRITE AS COMMENT
	AOS	DIALEN			;RESTORE DIALOG LENGTH
	$RETT
SUBTTL	$TEXT OUTPUT ROUTINES

IFN FTUUOS,<DEFINE PBOUT <OUTCHR S1>>

BTHCHR:	$SAVE	<P1>			;PRESERVE P1
	MOVE	P1,S1			;SAVE ARG
	$CALL	CNFCHR		;WRITE IN FILE
	MOVE	S1,P1			;RESTORE ARG
	PJRST	TTYCHR			;WRITE ON TERMINAL AND RETURN

CNFCRL:	MOVEI	S1,15			;WRITE <CRLF> IN FILE
	$CALL	CNFCHR
	MOVEI	S1,12
	PJRST	CNFCHR			;AND RETURN

CNFCHR:	CAIN	S1,"@"			;REQUEST FOR <CRLF> ?
	PJRST	CNFCRL			;YES -- DO IT
	MOVE	S2,S1			;PUT CHARACTER IN S2
	MOVE	S1,CNFIFN		;PUT IFN IN S1
	$CALL	F%OBYT		;WRITE THE CHARACTER
	JUMPT	.RETT			;AND RETURN IF SUCCESS
	$TTYSTR <? Error Writing File -- ^E/[-1]/>
	PJRST	I%EXIT			;AND DIE

TTYCRL:	MOVEI	S1,15			;WRITE <CRLF> ON TERMINAL
	PBOUT
	MOVEI	S1,12
	PBOUT
	$RETT

TTYCHR:	CAIN	S1,"@"			;REQUEST FOR <CRLF> ?
	PJRST	TTYCRL			;YES -- DO IT
	PBOUT
	$RETT

SUBTTL	PROMPT Support Routine for $PROMPT Macro

PROMPT:	HRRZ	S1,@0(P)		;GET ADDRESS OF STRING
	MOVE	S2,[POINT 7,PRMTXT]
	MOVEM	S2,TXTPTR		;POINT DEPTXT AT PRMTXT BUFFER
	$TEXT	(DEPTXT,^I/@S1/ ^A)	;STORE PROMPT STRING IN PRMTXT
	SETZ	S1,
	MOVE	S2,TXTPTR		;STORE TRAILING NULL
	IDPB	S1,S2			;BUT DON'T CHANGE POINTER
	MOVX	S1,CM%DPP+CM%LST	;CLEAR DEFAULT AND LST
	ANDCAM	S1,CMDFNC		;CLEAR DEFALUT PRESENT FLAG
	SETZM	CMDDEF			;CLEAR DEFAULT POINTER WORD
	SETZM	MIN			;CLEAR RANGE CHECK WORDS
	SETZM	MAX
	$RETT

DEFAULT:HRRZ	S1,@0(P)		;GET ADDR OF DEFAULT ITEXT
	$TEXT	(<-1,,DEFTXT>,^I/@S1/^0);STORE AS DEFAULT STRING
	$TEXT	(DEPTXT,<[^I/@S1/] ^0>)	;MOVE TO PRMTXT BUFFER
	MOVE	S1,[POINT 7,DEFTXT]	;GET POINTER TO DEFAULT STRING
	MOVEM	S1,CMDDEF		;STORE AS DEFAULT POINTER
	MOVX	S1,CM%DPP
	IORM	S1,CMDFNC		;SET DEFAULT PRESENT FLAG
	$RETT

RANGE:	HRRZ	S1,@0(P)		;GET ADDR OF ARGS
	MOVE	S2,0(S1)		;GET MINIMUM
	MOVEM	S2,MIN
	MOVE	S2,1(S1)		;GET MAXIMUM
	MOVEM	S2,MAX
	CAME	S2,MIN			;(MIN-MAX Suffix) ?
	$TEXT	(DEPTXT,<(^D/MIN/-^D/MAX/^T/2(S1)/) ^A>) ;MOVE TO PRMTXT
	CAMN	S2,MIN			;(Count Suffix) ?
	$TEXT	(DEPTXT,<(^D/MIN/^T/2(S1)/) ^A>)
	SETZ	S1,			;STORE NULL BUT DON'T CHANGE
	MOVE	S2,TXTPTR		;POINTER
	IDPB	S1,S2
	$RETT

DEPTXT:	CAIN	S1,"@"			;REQUEST FOR CRLF?
	JRST	DEPCRL			;YES -- STORE IT
	IDPB	S1,TXTPTR		;ELSE JUST STORE CHARACTER
	SKIPE	S1			;NULL?
	AOS	TXTCNT			;NO -- ACCOUNT FOR CHARACTER
	$RETT

DEPCRL:	MOVEI	S1,15
	IDPB	S1,TXTPTR
	AOS	TXTCNT
	MOVEI	S1,12
	IDPB	S1,TXTPTR
	AOS	TXTCNT
	$RETT
	END	GALGEN