V10/cmd/spitbol/4.3/makemsg.spt

-IN80
-TITLE MAKEMSG - PRODUCE SPITMSG.MSG FOR VAX/VMS SPITBOL SYSTEM
-STITL PREAMBLE
*	This is a Macro Spitbol program which generates the
*	error message module (SPITMSG.MSG) for the VAX/VMS Spitbol
*	interpreter.
*
*	Inputs to this program are:
*
*	1. filename.ERR - The list of error numbers and associated
*		text from the Minimal translation.  Each record
*		in this file consists of a three digit error message
*		number and the remainder of the record contains the
*		text of the message.  This file need not be sorted.
*		It is produced automatically by the XFER program.
*	2. Standard INPUT channel - The 'template' for SPITMSG.MSG
*		is read using INPUT, and so must immediately follow
*		the END statement of the program.  This template is
*		copied to SPITMSG.MSG intact, except that lines beginning
*		with "[[[" followed by a command are used to signal
*		this program to invoke some special action to substitute
*		something at that point. (E.g. Error messages).  The
*		appendages in this program which perform these special
*		actions all begin with "REP_" followed by the command
*		used in the template to invoke them.
*
*	This program creates filename.MSG automatically.
*
*	Steve Duff for VAX/VMS Spitbol Project April 1980.
*
-STITL INITIALIZATION
*
*	Set Keywords
*
	&STLIMIT = 1000000; &TRIM = 1; &ANCHOR = 1
	UC = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
	LC = 'abcdefghijklmnopqrstuvwxyz'
*
*	Create File Bindings
*
	TERMINAL = 'Enter name of .ERR file (no extension).'
	TERMINAL = '	Output will be file.MSG.'
	FILENAME = TERMINAL
	INPUT(.INMESS,1,FILENAME '.ERR')		:F(NOFILE)
	OUTPUT(.MESG,2,FILENAME '.MSG')
*
*	Create the Error Message Array
*
	MESSARY	= ARRAY(499)
*
*	Special names in upper case
*
	NMS	= '-NOFAIL ABORT CONTINUE ANY BREAK BREAKX LEN NOTANY '
+	'POS RTAB RPOS SPAN TAB APPLY ARBNO ARRAY CLEAR COLLECT '
+	'CTI ITC BUFFER APPEND INSERT PROFILE SET '
+	'CONVERT DATA DEFINE DETACH DUMP DUPL EJECT ENDFILE EQ '
+	'EVAL EXIT FENCE GE GT HOST '
+ 	'INPUT LE LEQ LGE LGT LLE LNE LLT LOAD LPAD LT NE NOTANY OPSYN '
+	'OUTPUT PROTOTYPE REMDR REPLACE REVERSE RPAD '
+	'RTAB TAB RPOS SETEXIT SORT/RSORT '
+	'SPAN SIZE STOPTR SUBSTR TABLE TRACE '
+	'TRIM UNLOAD MAXLNGTH ERRTEXT END STLIMIT NRETURN '
	NMT	= TABLE(101)
NMS	NMS BREAK(' ') $ T *?(NMT<T> = '!') ' ' =	:S(NMS)
*
-STITL	CVRT(MSG) - Convert message to mixed case
*
	P	= BREAK(' ') $ WD ' ' | REM $ WD
*
	DEFINE('CVRT(MSG)CMS')			:(CVRTE)
*
*   This converts MSG to lower case except for the first word, if any,
*   found in NMT which is left in Upper case.
*   First char and first char after a fullstop are left in UC.
*   Occurrences of 'ARRAY, DUMP, TABLE' after error message no. 200
*   are not capitalised.
*
CVRT	MSG P =					:F(ER)
	CMS	= (DIFFER(CMS) CMS ' ',)
+		(DIFFER(RP = NMT<WD>) WD,REPLACE(WD,UC,LC))
	CMS	= DIFFER(RP) CMS ' ' REPLACE(MSG,UC,LC)	:S(CMS)
	IDENT(MSG)				:F(CVRT)
CMS	CMS LEN(1) $ T = REPLACE(T,LC,UC)
	CMS (BREAK('.') '. ') $ L LEN(1) $ T = L REPLACE(T,LC,UC)
	NMT<'ARRAY'> = NMT<'DUMP'> = NMT<'TABLE'> = EQ(I,200)
	CVRT	= CMS				:(RETURN)
CVRTE
*
-STITL PROCESS THE ERROR MESSAGE FILE
*
*	This initial piece of code reads the input error message file
*	into the array MESSARY, indexing each message by its number.
*
READ_MSGS
	MESS	= INMESS			:F(MAKE_MSG)
	MESS	LEN(3) . MESSID  REM . MESSTEXT	:F(FORMATBAD)
	MAX_MESSID = GT(MESSID,MAX_MESSID) MESSID
	MESSARY[MESSID] = CVRT(MESSTEXT)	:(READ_MSGS)
*
*	Now we generate SPITMSG.MSG using the template.
*
MAKE_MSG
	EMLINE	= INPUT				:F(EXIT)
	EMLINE	'[[['  REM . CMD		:S($('REP_' CMD))
	MESG	= EMLINE			:(MAKE_MSG)
*
*	Here when finished
*
EXIT	:(END)
-STITL	SUBSTITUTION APPENDAGES
*
*	Substitute error messages
*
REP_DOERRS
	MESSID	= 0
RDE.LOOP
	MESSID	= LT(MESSID,MAX_MESSID) MESSID + 1	:F(MAKE_MSG)
	MESG	= ' ERR' LPAD(MESSID,3,0) ' <' MESSARY[MESSID] '>/WARNING'
	:(RDE.LOOP)
*
*	Emit definition for maximum error message number
*
REP_MAXMSG
	MESG	= '	.LITERAL SPITBOL_MAXMSG = ' MAX_MESSID	:(MAKE_MSG)
END
 .TITLE	SPITMSG - MACRO SPITBOL Error Message Definitions
 .FACILITY	SPITBOL,1000
 .SEVERITY	SEVERE
 EXIT		<EXIT Module Saved - !AD>/INFORMATIONAL/FAO=2
 EXSUP		<>/INFORMATIONAL
 INSVIRMEM	<Insufficient Virtual Memory>
 LINETRUNC	<>/WARNING
 LOADCRC	<Load Incompatible, Please Retranslate Source>
 LOADMEM	<Insufficient Virtual Memory For LOAD>
 LOADOPEN	<Can't Open LOAD File - !AD>/FAO=2
 LOADMAP	<Error Mapping LOAD File - !AD>/FAO=2
 LOADUNEXCOND	<Loaded Function Failed To Handle Condition At PC=!XL>/FAO=1/ERROR
 LOADUNEXTRY	<Will Attempt to Recover By Forcing Failure>/WARN
 LOADVERS	<Load Versions Incompatible, Please Retranslate Source>
 NOSYSOUT	<>
 NOTEXITMOD	<File is Not a Saved EXIT File - !AD>/FAO=2
 OPENOUT	<>
 OPENIN		<>
 PAUSE		<Paused at Statement !ZL>/FAO=1/INFORMATIONAL
 STACKOVFL	<Virtual Stack Space Exhausted>
 SYNTAX		<Syntax Error In Command Line>
!
! New in V3.5(BCAB-1131)
!
 BADLINK	<>
 LOADBADINT	<Loaded function returned invalid INTEGER result pointer>/WARN
 LOADBADREAL	<Loaded function returned invalid REAL number result ptr>/WARN
 LOADBADSTRING	<Loaded function returned invalid STRING descriptor>/WARN
 LOADBADUNCONV	<Loaded function returned bad block for unconverted result>/WARN
!
! New in V4.3
!
 ENCROACH	<Cannot RELOAD - virtual space encroachment>
 HOST_NOTSUP	<HOST called with unknown operands>
 ILLIORESPEC	<Illegal I/O respecification>
 ILLIOSPEC	<Illegal combination of I/O specifications>
 LOADBADBUF	<Loaded function returned bad BUFFER string descriptor>/WARN
 LOAD_ERR	<Error while attempting to LOAD function>
 NOSTACK	<No room for SPITBOL stack - external functions extend too far>
 OPEN		<Error opening file !AD>/FAO=2
 SET2DT		<SET second arg not convertible to proper datatype>
 SET3NZ		<SET third arg must be zero for this file>
 SET3DT		<SET third arg not convertible to proper datatype>
 SETNOTSUP	<SET function not yet supported for indexed files>
 SYSERR		<Internal system error - submit SPR>
	.PAGE
 ERR000 <Internal Spitbol System Error - Please Submit SPR>/SEVERE
[[[DOERRS
[[[MAXMSG
	.END