From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 17-MAY-1991 09:42:58.47
To:	ARISIA::EVERHART
CC:	
Subj:	LATSET.2_OF_3 - LATSYM modifications

From:	RELAY-INFO-VAX@CRVAX.SRI.COM@SMTP@CRDGW2
To:	Everhart@Arisia@MRGATE

Received:  by crdgw1.ge.com (5.57/GE 1.97)
	 id AA16758; Fri, 17 May 91 09:16:08 EDT
Message-Id:  <9105171316.AA16758@crdgw1.ge.com>
Received: From SUN2.NSFNET-RELAY.AC.UK by CRVAX.SRI.COM with TCP; Fri, 17 MAY 91 05:48:19 PDT
Received: from ncdlab.ulcc.ac.uk by sun2.nsfnet-relay.ac.uk via JANET 
          with NIFTP id <12432-0@sun2.nsfnet-relay.ac.uk>;
          Fri, 17 May 1991 13:45:10 +0100
Date: Fri, 17 May 91 13:45 BST
From: Nick de Smith <NICK@ncdlab.ulcc.ac.uk>
To: INFO-VAX <@nsfnet-relay.ac.uk:INFO-VAX@CRVAX.SRI.com>
Subject: LATSET.2_OF_3 - LATSYM modifications

-+-+-+-+-+-+-+-+ START OF PART 2 -+-+-+-+-+-+-+-+
X`09unsigned char`09*`09psm$ab_work_area`09,`09`09/* => work area to use`09`0
V9`09*/
X`09unsigned long`09*`09psm$al_func`09`09,`09`09/* Required function (PSM$K_x
Vxxx)`09*/
X`09struct dsc$descriptor *`09psm$ax_funcdesc`09`09,`09`09/* Function descrip
Vtor`09`09`09*/
X`09unsigned long`09*`09psm$al_funcarg`09`09)`09`09/* Function argument`09`09
V`09*/
X`7B
X`09switch ( *psm$al_func ) `7B`09`09`09`09`09/* Determine function required`
V09`09*/
X
X`09`09case PSM$K_OPEN:`09`09`09`09`09/* Allocate resources`09`09`09*/
X`09`09`09break;
X
X`09`09case PSM$K_CLOSE:`09`09`09`09`09/* Release resources`09`09`09*/
X`09`09`09break;
X
X`09`09case PSM$K_READ:`09`09`09`09`09/* Return an input record or PSM$K_EOF`
V09*/
X`09`09`09return PSM$_EOF;`09`09`09`09/* Do not return a form feed`09`09*/
X
X`09`09default:`09`09`09`09`09`09/* Unrecognised function`09`09*/
X`09`09`09return PSM$_FUNNOTSUP;`09`09`09`09/* ...say function not supported`
V09*/
X`09`7D
X
X`09return SS$_NORMAL;`09`09`09`09`09`09/* Return success to caller`09`09*/
X`7D
X`0C
X
X/***************************************************************************
V**************************************
X
X`09`09`09`09`09P S M _ J o b _ C o m p l e t i o n
X
X Replaces the PSM$K_JOB_COMPLETION routine.
X
X The normal action of the JOB_COMPLETION module is to insert a <FF> in the o
Vutput stream by returning an <FF> in
X psm$ax_funcdesc.
X We therefore replace the LATSYM JOB_COMPLETION module (LAT$$JOB_COMPLETION)
V with this routine which prevents a
X trailing <FF> being output.
X
X As LATSYM has its own JOB_COMPLETION routine that performs a certain amount
V of housekeeping, we duplicate the
X LATSYM job completion routine, and then, if the function code was PSM$K_REA
VD, we always return PSM$_EOF or the
X magic disconnection string to prevent any <FF> being printed. This stops fo
Vrm feeds being generated by LATSYM
X and output to the printer.
X
X****************************************************************************
V*************************************/
Xstatic long
XPSM_Job_Completion(
X`09unsigned long`09*`09psm$al_request_id`09,`09`09/* Request ident`09`09`09*
V/
X`09unsigned char`09*`09psm$ab_work_area`09,`09`09/* => work area to use`09`0
V9`09*/
X`09unsigned long`09*`09psm$al_func`09`09,`09`09/* Required function (PSM$K_x
Vxxx)`09*/
X`09struct dsc$descriptor *`09psm$ax_funcdesc`09`09,`09`09/* Function descrip
Vtor`09`09`09*/
X`09unsigned long`09*`09psm$al_funcarg`09`09)`09`09/* Function argument`09`09
V`09*/
X`7B
X`09long`09status;
X`09long`09lsm$l_stream_index = *(long *)psm$ab_work_area;`09`09/* LATSYM str
Veam index`09`09`09*/
X`09unsigned long l_job_status;
X`09struct dsc$descriptor_s x_buffer = `7B
X`09`09sizeof( long ), DSC$K_DTYPE_T, DSC$K_CLASS_S, &l_job_status `7D;
X`09static $DESCRIPTOR( x_drop_lat_connection, DROP_LAT_CONNECTION );
X`09static`09char lcb$eoj_read`5B LSM$K_MAXSTREAMS `5D;`09`09`09/* .TRUE. whe
Vn eoj has been returned`09*/
X
X`09if ( (lsm$l_stream_index <= 0) `7C`7C (lsm$l_stream_index > LSM$K_MAXSTRE
VAMS) ) `7B /* Check stream index...`09*/
X`09`09return SS$_BADPARAM;
X`09`7D else `7B
X`09`09lsm$l_stream_index--;`09`09`09`09`09/* Make stream index 0 biased`09`0
V9*/
X`09`7D
X`09switch ( *psm$al_func ) `7B`09`09`09`09`09/* Determine function required`
V09`09*/
X
X`09`09case PSM$K_OPEN:`09`09`09`09`09/* Start of new stream`09`09`09*/
X`09`09`09lcb$eoj_read`5B lsm$l_stream_index `5D = FALSE;`09/* Say no EOJ see
Vn yet`09`09`09*/
X`09`09`09*psm$al_funcarg = PSM$K_CC_INTERNAL;`09`09/* Do reads with internal
V carriage control */
X`09`09`09status = SS$_NORMAL;
X`09`09`09break;
X
X`09`09case PSM$K_READ:`09`09`09`09`09/* Return an input record or PSM$K_EOF`
V09*/
X`09`09`09if ( lcb$eoj_read`5B lsm$l_stream_index `5D ) `7B`09/* If we have a
Vlready seen an EOJ...`09*/
X`09`09`09`09status = PSM$_EOF;`09`09`09/* ...return an end-of-file marker`09
V*/
X`09`09`09`09break;
X`09`09`09`7D
X`09`09`09lcb$eoj_read`5B lsm$l_stream_index `5D = TRUE;`09/* Say EOJ seen`09
V`09`09`09*/
X
X`09`09`09ss_check( PSM$READ_ITEM_DX(`09`09`09/* ...read the job params from
V the symbiont */
X`09`09`09`09psm$al_request_id`09,`09`09/* Request ident`09`09`09*/
X`09`09`09`09&SMBMSG$K_SEPARATION_CONTROL,
X`09`09`09`09&x_buffer`09`09) )
X`09`09`09/* If this is the last file of a job, drop the LAT connection */
X`09`09`09if ( l_job_status & SMBMSG$M_LAST_FILE_OF_JOB ) `7B
X`09`09`09`09ss_check( STR$COPY_DX(
X`09`09`09`09`09psm$ax_funcdesc`09`09,`09/* Function descriptor`09`09`09*/
X`09`09`09`09`09&x_drop_lat_connection`09) )`09/* "magic" drop connection str
Ving`09*/
X`09`09`09`09status = SS$_NORMAL;
X`09`09`09`7D else `7B
X`09`09`09`09status = PSM$_EOF;`09`09`09/* Do not return anything`09`09*/
X`09`09`09`7D
X`09`09`09break;
X
X`09`09default:`09`09`09`09`09`09/* Unrecognised function`09`09*/
X`09`09`09status = PSM$_FUNNOTSUP;
X`09`09`09break;
X`09`7D
X
X`09return status;`09`09`09`09`09`09`09/* Return success to caller`09`09*/
X`7D
X`0C
X
X/***************************************************************************
V**************************************
X
X`09`09`09`09`09`09H a n d l e r
X
X Exception handler. This routine just builds up the message text and outputs
V it to an operator console. It can
X handle all the formatting requirements of multiple signals with FAO argumen
Vts.
X
X****************************************************************************
V*************************************/
Xstatic
XHandler(
X`09unsigned long`09signal`5B`5D`09,`09`09`09`09/* Signal array`09`09`09`09*/
X`09unsigned long`09mech`5B`5D`09`09)`09`09`09`09/* Mechanism array`09`09`09*
V/
X`7B
X`09int`09Handler_Action();`09`09`09`09`09/* Handler message action routine`0
V9*/
X`09static`09struct dsc$descriptor_d hnd$x_message = `7B`09`09/* Message text
V to signal`09`09*/
X`09`090, DSC$K_DTYPE_T, DSC$K_CLASS_D, 0 `7D;
X
X`09switch ( $VMS_STATUS_SEVERITY( signal`5B 1 `5D ) ) `7B`09`09/* Dispatch o
Vn severity of signal`09*/
X`09`09case STS$K_SUCCESS:`09`09`09`09`09/* Success (-S-) messages`09`09*/
X`09`09case STS$K_INFO:`09`09`09`09`09/* Information (-I-) messages`09`09*/
X`09`09case STS$K_WARNING:`09`09`09`09`09/* Warning (-W-) messages`09`09*/
X`09`09case STS$K_ERROR:`09`09`09`09`09/* Error (-E-) messages`09`09`09*/
X`09`09case STS$K_SEVERE:`09`09`09`09`09/* Severe (-F-) messages`09`09*/
X`09`09`09STR$FREE1_DX( &hnd$x_message );`09`09`09/* Free up the message text
V`09`09*/
X`09`09`09signal`5B 0 `5D -= 2;`09`09`09`09/* Trim the PC and PSL`09`09`09*/
X`09`09`09SYS$PUTMSG( signal, Handler_Action, 0, &hnd$x_message ); /* Format
V the message`09`09*/
X`09`09`09signal`5B 0 `5D += 2;`09`09`09`09/* Add back the PC and PSL`09`09*/
X`09`09`09Send_To_Operator( &hnd$x_message );`09`09/* Send the formatted mess
Vage to an oper */
X`09`09`09if ( $VMS_STATUS_SEVERITY( signal`5B 1 `5D ) == STS$K_SEVERE ) `7B
V /* If message was FATAL...`09*/
X`09`09`09`09return SS$_RESIGNAL;`09`09`09/* Resignal -F- errors (same as DIE
V!)`09*/
X`09`09`09`7D
X`09`09`09return SS$_CONTINUE;`09`09`09`09/* Stop the signal progressing`09`0
V9*/
X`09`09default:`09`09`09`09`09`09/* Catchall - should never get here`09*/
X`09`09`09return SS$_RESIGNAL;`09`09`09`09/* ...pass this one on`09`09`09*/
X`09`7D
X`7D
X
X/***************************************************************************
V**************************************
X
X`09`09`09`09`09H a n d l e r _ A c t i o n
X
X Action routine for SYS$PUTMSG that builds the final message to output to th
Ve user.
X This routine always returns 0 so that $PUTMSG will never try to output the
V message to SYS$OUTPUT and/or SYS$ERROR.
X As we may be running detached, the main handler will always log the message
V to an operator console.
X
X****************************************************************************
V*************************************/
Xstatic
XHandler_Action(
X`09struct`09dsc$descriptor`09*hnd$ax_message`09,`09`09`09/* Message text to
V add`09`09`09*/
X`09struct`09dsc$descriptor`09*hnd$ax_final_message`09)`09`09/* Final message
V text to add message to`09*/
X`7B
X`09static`09$DESCRIPTOR( hnd$x_crlf, "\015\012" );`09`09`09/* Explicit CR LF
V`09`09`09*/
X
X`09if ( hnd$ax_final_message->dsc$w_length ) `7B`09`09`09/* If not first mes
Vsage...`09`09*/
X`09`09STR$APPEND( hnd$ax_final_message, &hnd$x_crlf );`09/* ..add a CRLF for
V neatness`09`09*/
X`09`7D
X`09STR$APPEND( hnd$ax_final_message, hnd$ax_message );`09`09/* Add in this m
Vessage`09`09`09*/
X
X`09return 0;`09`09`09`09`09`09`09/* Do not try to output message`09`09*/
X`7D
X`0C
X
X/***************************************************************************
V**************************************
X
X`09`09`09`09`09S e n d _ T o _ O p e r a t o r
X
X Send a message to a VMS operator. If the message is longer than OPC_TEXT_MA
VX, then truncate it. This "magic"
X value is specified in the VMS System Services $SNDOPR documentation.
X
X****************************************************************************
V*************************************/
Xstatic
XSend_To_Operator(
X`09struct dsc$descriptor `09*opr$ax_text`09)`09`09`09/* Message to send to o
Vperator`09`09*/
X`7B
X#define`09OPC_TEXT_MAX`09255`09`09`09`09`09`09/* Maximum length of an operat
Vor message */
X`09struct `7B
X`09`09char`09`09opc$b_ms_type;`09`09`09/* Message type`09`09`09`09*/
X`09`09unsigned`09opc$b_ms_target : 24;`09`09/* Message target (yes, its 24 b
Vits and a $b_) */
X`09`09long`09`09opc$l_ms_rqstid;`09`09/* Request number (not used)`09`09*/
X`09`09char`09`09opc$l_ms_text`5B OPC_TEXT_MAX `5D;`09/* Message text to send
V`09`09`09*/
X`09`7D opc;`09`09`09`09`09`09`09`09/* Operator message structure`09`09*/
X`09short`09opr$w_length = `09`09`09`09`09`09 /* Length of message to send`09
V`09*/
X`09`09`09opr$ax_text->dsc$w_length > OPC_TEXT_MAX ? OPC_TEXT_MAX : opr$ax_te
Vxt->dsc$w_length;
X`09struct dsc$descriptor_s opr$x_message = `7B`09`09`09/* Descriptor for ope
Vrator message`09*/
X`09`09opr$w_length+8, DSC$K_DTYPE_T, DSC$K_CLASS_S, &opc `7D;
X`09int`09status;`09`09`09`09`09`09`09/* Status from $SNDOPR`09`09`09*/
X
X`09opc.opc$b_ms_type`09= OPC$_RQ_RQST;`09`09`09`09/* Say that it is a REQUES
VT (no reply)`09*/
X`09opc.opc$b_ms_target`09= OPC$M_NM_PRINT;`09`09`09/* Default to log to PRIN
VTER consoles`09*/
X`09opc.opc$l_ms_rqstid`09= 0;`09`09`09`09`09/* No request ident needed`09`09
V*/
X
X`09LIB$MOVC3( &opr$w_length, opr$ax_text->dsc$a_pointer, opc.opc$l_ms_text )
V;
X
X`09status = SYS$SNDOPR( &opr$x_message, 0 );`09`09`09/* Send the message to
V the operator`09*/
X`09if ( (status & STS$M_SUCCESS) == 0 `7C`7C status == OPC$_NOPERATOR ) `7B
V /* Check for OPCOM being busy or not there */
X`09`7D
X`7D
X`0C
$ CALL UNPACK LATSYM$SETUP.C;1 2724670448
$ create 'f'
X!+
X! LATSYM$SETUP_MSG.MSG`09`09VMS message facility tables for LATSYM$SETUP
X!
X! Note: Always add new messages at the end of the relevant section. This
X!`09preserves the numbers of all existing messages.
X!
X! Author:`09Nick de Smith
X! Date:`09`0929-Apr-91
X! Edit`09Edit date`09By`09Why
X!  01`0929-Apr-91`09NMdS`09New
X!-
X`09.facility`09LSMSET 1 /prefix=LSMSET$_
X`09.ident`09`09"V01.00"
X
X`09.severity`09success
X`09NORMAL`09`09<normal successful completion>
X
X`09.severity`09informational
X`09.base`09100
X`09STARTUP`09`09<LATSYM$SETUP !AD has been called for device !AS>
X
X`09.severity`09warning
X`09.base`09200
X
X`09.severity`09error
X`09.base`09300
X
X`09.severity`09severe
X`09.base`09400
X`09SEVERE`09`09<severe server error: R0 = !XL, R1 = !XL, PC = !XL, PSL = !XL
V>/fao=4
X
X`09.severity`09fatal
X`09.base`09500
X
X`09.end
X`0C
$ CALL UNPACK LATSYM$SETUP_MSG.MSG;1 1633488124
$ create 'f'
X/***************************************************************************
V**************************************
X
X`09PSMDEF.H
X
X VAX C language definitions from the LIB library.
X Extracted by NICK using VAXCDEF at 14-MAY-1991 11:49:05.31 on a MicroVAX 31
V00 system under VMS V5.4-2
X
X****************************************************************************
V*************************************/
X
X#define`09PSM$K_CANCEL`090x1
X#define`09PSM$K_CLOSE`090x2
X#define`09PSM$K_FORMAT`090x3
X#define`09PSM$K_OPEN`090x4
X#define`09PSM$K_READ`090x5
X#define`09PSM$K_GET_KEY`090x6
X#define`09PSM$K_POSITION_TO_KEY`090x7
X#define`09PSM$K_REWIND`090x8
X#define`09PSM$K_WRITE`090x9
X#define`09PSM$K_WRITE_NOFORMAT`090xA
X#define`09PSM$K_WRITE_SUPPRESSED`090xB
X#define`09PSM$K_PAUSE_TASK`090xC
X#define`09PSM$K_RESET_STREAM`090xD
X#define`09PSM$K_RESUME_TASK`090xE
X#define`09PSM$K_START_STREAM`090xF
X#define`09PSM$K_START_TASK`090x10
X#define`09PSM$K_STOP_TASK`090x11
X#define`09PSM$K_STOP_STREAM`090x12
X#define`09PSM$K_PAGE_SETUP`090x1
X#define`09PSM$K_PAGE_HEADER`090x2
X#define`09PSM$K_LIBRARY_INPUT`090x3
X#define`09PSM$K_INPUT_FILTER`090x4
X#define`09PSM$K_MAIN_FORMAT`090x5
X#define`09PSM$K_OUTPUT_FILTER`090x6
X#define`09PSM$K_OUTPUT`090x7
X#define`09PSM$K_JOB_SETUP`090x8
X#define`09PSM$K_FORM_SETUP`090x9
X#define`09PSM$K_JOB_FLAG`090xA
X#define`09PSM$K_JOB_BURST`090xB
X#define`09PSM$K_FILE_SETUP`090xC
X#define`09PSM$K_FILE_FLAG`090xD
X#define`09PSM$K_FILE_BURST`090xE
X#define`09PSM$K_FILE_SETUP_2`090xF
X#define`09PSM$K_MAIN_INPUT`090x10
X#define`09PSM$K_FILE_INFORMATION`090x11
X#define`09PSM$K_FILE_ERRORS`090x12
X#define`09PSM$K_FILE_TRAILER`090x13
X#define`09PSM$K_JOB_RESET`090x14
X#define`09PSM$K_JOB_TRAILER`090x15
X#define`09PSM$K_JOB_COMPLETION`090x16
X#define`09PSM$K_PAGE_FOOTER`090x17
X#define`09PSM$K_MAX`090x18
X#define`09PSM$K_CC_INTERNAL`090x1
X#define`09PSM$K_CC_IMPLIED`090x2
X#define`09PSM$K_CC_FORTRAN`090x3
X#define`09PSM$K_CC_PRINT`090x4
X#define`09PSM$K_CC_MAX`090x5
X
X/* End of PSMDEF.H */
$ CALL UNPACK PSMDEF.H;1 1833795477
$ create 'f'
X/***************************************************************************
V**************************************
X
X`09SMBDEF.H
X
X VAX C language definitions from the LIB library.
X Extracted by NICK using VAXCDEF at 14-MAY-1991 11:52:51.63 on a MicroVAX 31
V00 system under VMS V5.4-2
X
X****************************************************************************
V*************************************/
X
X#define`09SMBMSG$K_STRUCTURE_LEVEL`090x1
X#define`09SMBMSG$K_STRUCTURE_LEVEL_1`090x1
X#define`09SMBMSG$K_PAUSE_TASK`090x1
X#define`09SMBMSG$K_RESET_STREAM`090x2
X#define`09SMBMSG$K_RESUME_TASK`090x3
X#define`09SMBMSG$K_START_STREAM`090x4
+-+-+-+-+-+-+-+-  END  OF PART 2 +-+-+-+-+-+-+-+-

