From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 17-MAY-1991 09:22:30.42
To:	ARISIA::EVERHART
CC:	
Subj:	LATSET.1_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 AA16394; Fri, 17 May 91 08:57:46 EDT
Message-Id:  <9105171257.AA16394@crdgw1.ge.com>
Received: From SUN2.NSFNET-RELAY.AC.UK by CRVAX.SRI.COM with TCP; Fri, 17 MAY 91 05:46:17 PDT
Received: from ncdlab.ulcc.ac.uk by sun2.nsfnet-relay.ac.uk via JANET 
          with NIFTP id <12389-0@sun2.nsfnet-relay.ac.uk>;
          Fri, 17 May 1991 13:44:05 +0100
Date: Fri, 17 May 91 13:44 BST
From: Nick de Smith <NICK@ncdlab.ulcc.ac.uk>
To: INFO-VAX <@nsfnet-relay.ac.uk:INFO-VAX@CRVAX.SRI.com>
Subject: LATSET.1_OF_3 - LATSYM modifications

$! ------------------ CUT HERE -----------------------
$ v='f$verify(f$trnlnm("SHARE_VERIFY"))'
$!
$! This archive created by VMS_SHARE Version 7.2-007  22-FEB-1990
$!   On 14-MAY-1991 14:18:33.93   By user NICK 
$!
$! This VMS_SHARE Written by:
$!    Andy Harper, Kings College London UK
$!
$! Acknowledgements to:
$!    James Gray       - Original VMS_SHARE
$!    Michael Bednarek - Original Concept and implementation
$!
$!+ THIS PACKAGE DISTRIBUTED IN 3 PARTS, TO KEEP EACH PART
$!  BELOW 30 BLOCKS
$!
$! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER
$! AND EXECUTE AS A COMMAND PROCEDURE  (  @name  )
$!
$! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING:
$!       1. AAAREADME.TXT;1
$!       2. BUILD_LATSYM$SETUP.COM;1
$!       3. LATSYM$SETUP.C;1
$!       4. LATSYM$SETUP_MSG.MSG;1
$!       5. PSMDEF.H;1
$!       6. SMBDEF.H;1
$!       7. START_LAT_PRINT.COM;1
$!
$set="set"
$set symbol/scope=(nolocal,noglobal)
$f=f$parse("SHARE_TEMP","SYS$SCRATCH:.TMP_"+f$getjpi("","PID"))
$e="write sys$error  ""%UNPACK"", "
$w="write sys$output ""%UNPACK"", "
$ if f$trnlnm("SHARE_LOG") then $ w = "!"
$ ve=f$getsyi("version")
$ if ve-f$extract(0,1,ve) .ges. "4.4" then $ goto START
$ e "-E-OLDVER, Must run at least VMS 4.4"
$ v=f$verify(v)
$ exit 44
$UNPACK: SUBROUTINE ! P1=filename, P2=checksum
$ if f$search(P1) .eqs. "" then $ goto file_absent
$ e "-W-EXISTS, File ''P1' exists. Skipped."
$ delete 'f'*
$ exit
$file_absent:
$ if f$parse(P1) .nes. "" then $ goto dirok
$ dn=f$parse(P1,,,"DIRECTORY")
$ w "-I-CREDIR, Creating directory ''dn'."
$ create/dir 'dn'
$ if $status then $ goto dirok
$ e "-E-CREDIRFAIL, Unable to create ''dn'. File skipped."
$ delete 'f'*
$ exit
$dirok:
$ w "-I-PROCESS, Processing file ''P1'."
$ if .not. f$verify() then $ define/user sys$output nl:
$ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT 'f'/OUT='P1'
PROCEDURE Unpacker ON_ERROR ENDON_ERROR;SET(FACILITY_NAME,"UNPACK");SET(
SUCCESS,OFF);SET(INFORMATIONAL,OFF);f:=GET_INFO(COMMAND_LINE,"file_name");b:=
CREATE_BUFFER(f,f);p:=SPAN(" ")@r&LINE_END;POSITION(BEGINNING_OF(b));
LOOP EXITIF SEARCH(p,FORWARD)=0;POSITION(r);ERASE(r);ENDLOOP;POSITION(
BEGINNING_OF(b));g:=0;LOOP EXITIF MARK(NONE)=END_OF(b);x:=ERASE_CHARACTER(1);
IF g=0 THEN IF x="X" THEN MOVE_VERTICAL(1);ENDIF;IF x="V" THEN APPEND_LINE;
MOVE_HORIZONTAL(-CURRENT_OFFSET);MOVE_VERTICAL(1);ENDIF;IF x="+" THEN g:=1;
ERASE_LINE;ENDIF;ELSE IF x="-" THEN IF INDEX(CURRENT_LINE,"+-+-+-+-+-+-+-+")=
1 THEN g:=0;ENDIF;ENDIF;ERASE_LINE;ENDIF;ENDLOOP;t:="0123456789ABCDEF";
POSITION(BEGINNING_OF(b));LOOP r:=SEARCH("`",FORWARD);EXITIF r=0;POSITION(r);
ERASE(r);x1:=INDEX(t,ERASE_CHARACTER(1))-1;x2:=INDEX(t,ERASE_CHARACTER(1))-1;
COPY_TEXT(ASCII(16*x1+x2));ENDLOOP;WRITE_FILE(b,GET_INFO(COMMAND_LINE,
"output_file"));ENDPROCEDURE;Unpacker;QUIT;
$ delete/nolog 'f'*
$ CHECKSUM 'P1'
$ IF CHECKSUM$CHECKSUM .eqs. P2 THEN $ EXIT
$ e "-E-CHKSMFAIL, Checksum of ''P1' failed."
$ ENDSUBROUTINE
$START:
$ create 'f'
X`09`09`09L A T S Y M $ S E T U P
X`09`09`09-----------------------
X
XAuthor:`09Nick de Smith`09May 1991
X`09Applied Telematics Group, 7 Vale Avenue, Tunbridge Wells, Kent TN1 1DJ, E
Vngland.
X`09+44 892 511000, PSI%234213300154::NICK, NICK@NCDLAB.ULCC.AC.UK
X
XThis code uses an undocumented feature of LATSYM to disable the printing of
Xleading and trailing <FF> characters by the print symbiont.
X
XThis is important if you are using a non-DEC printer, such as an HPLaserJet,
Xand/or a package that drives the printer directly, such as WordPerfect or PC
VSA.
X
XThe problem is that packages that drive printers directly normally expect to
V do
Xtheir own form control. eg. WordPerfect via PCSA submits print jobs with the
X/PASSALL qualifier, expecting that the VMS print queue will let it do all th
Ve
Xprinter control. But... although the VMS print symbiont (LATSYM) will not do
Xformatting on the data as it is printed, it does output a leading and traili
Vng
X<FF> character in order to try to make sure that the printer is at top of fo
Vrm.
XAs WordPerfect does its own form control (eg. outputting an <ESC>E at the en
Vd of
Xprint jobs when talking to HP LaserJets), the result is a *LOT* of wasted bl
Vank
Xsheets of paper, and a lot of delay. Blank sheets come through the printers
V at
Xthe same rate as printed sheets. With small print jobs you can loose 50% or
V more
Xof your printer's throughput unless you can suppress blank pages.
X
XTo enable supression of the blank pages, place the image LATSYM$SETUP.EXE in
XSYS$SHARE:, and then start your LATSYM queues. Note that this module is only
Xcalled when LATSYM.EXE starts up, so ALL LAT queues must be stopped, and the
Vn
Xrestarted to use this module.
X
XNote also, that once this module is loaded into LATSYM, all LAT print queues
Xusing that incarnation of LATSYM will have blank page suppression.
X
XIn order to have some queues with blank page suppression, and some acting as
Xnormal, I suggest that you copy SYS$SYSTEM:LATSYM.EXE to
XSYS$SYSTEM:LATSYM_SETUP.EXE. When you want to start up a queue with blank pa
Vge
Xsuppression, do the following:
X
X$ Define/System/Exec LATSYM$SETUP SYS$SHARE:LATSYM$SETUP.EXE
X$ @START_LAT_PRINT <queue> <device> <server> <port> <descr> LATSYM_SETUP
X
XWhen you want to start a normal LATSYM queue, do this:
X
X$ Define/System/Exec LATSYM$SETUP NL:`09! Stop LATSYM$SETUP being found
X$ @START_LAT_PRINT <queue> <device> <server> <port> <descr> LATSYM
X
XYou could also define the logical name LAT$SYMPARAMETER to only allow 1 queu
Ve
Xper incarnation of the symbiont, eg.
X
X$ Define/System/Exec LAT$SYMPARAMETER`09"1"
X
XYou can also define a forms library for use with a page suppressed print que
Vue
Xto properly drive ANY printer you desire.
X
XNick de Smith, 14-May-91
$ CALL UNPACK AAAREADME.TXT;1 87518316
$ create 'f'
X$ CC/Debug`09LATSYM$SETUP.C
X$ Message`09LATSYM$SETUP_MSG.MSG
X$ Link /Share=LATSYM$SETUP.EXE SYS$INPUT/Option
XLATSYM$SETUP.OBJ
XLATSYM$SETUP_MSG.OBJ
XUniversal=LATSYM$SETUP
X$!
X$ Type/NoPage SYS$INPUT
X
X`09LATSYM$SETUP.EXE is now built.
X
X`09You must copy LATSYM$SETUP.EXE to SYS$COMMON:`5BSYSLIB`5D and
X`09restart any LAT printers that you wish to use this software.
X
X`09A message regarding the successful completion of the initialisation
X`09of this module is displayed on PRINTER class operator terminals
X`09when a queue is started.
X
X$!
$ CALL UNPACK BUILD_LATSYM$SETUP.COM;1 1459707711
$ create 'f'
X
X/***************************************************************************
V**************************************
X
X File:`09`09LATSYM$SETUP.C`09`09VMS print symbiont for HP LaserJet +
X Module:`09LATSYM$SETUP.C`09(the root)
X Author:`09Nick de Smith`09May 1991
X`09`09Applied Telematics Group, 7 Vale Avenue, Tunbridge Wells, Kent TN1 1DJ
V, England.
X`09`09+44 892 511000, PSI%234213300154::NICK, NICK@NCDLAB.ULCC.AC.UK
X
X Copyright `A9 1991 by Applied Telematics Group Limited and Nick de Smith.
X This software is supplied for information only. No guarantee is supplied fo
Vr this software, and no liability
X will be accepted for any action resulting from the use of this software or
V the information contained herein.
X Under no circumstances may this software be used for commercial gain, inclu
Vding its sale, lease or loan.
X This software may be copied only with the inclusion of this copyright notic
Ve.
X The author is prepared to enter into correspondance with interested parties
V, but will not necessarily
X maintain this software. Having said all that, enjoy it!
X
X Description:
X The symbiont replaces 1 or 2 of the standard VMS LATSYM print symbiont modu
Vles in order to prevent leading and
X trailing blank pages being printed. This is necessary when attempting to co
Vntrol the printer entirely from the
X printing application. An example of this would be printing from WordPerfect
V via PCSA to an HP LaserJet on a
X DECserver terminal port.
X
X Implementation:
X This code relies on an undocumented "feature" of LATSYM. If a file called S
VYS$SHARE:LATSYM$SETUP.EXE exists,
X and if it has a universal entry point defined, called LATSYM$SETUP, then th
Vis routine will be called after
X LATSYM has done its own initialisation, and most especially, after LATSYM h
Vas called PSM$REPLACE to load its
X own modified print symbiont routines.
X We replace the PSM default FILE_SETUP_2 routine as LATSYM does not use one,
V but we need to duplicate LATSYM's own
X JOB_COMPLETION routine before carrying out our own modification to that mod
Vule.
X A status message is displayed on PRINTER class operator consoles when this
V module starts up.
X
X Usage:
X LATSYM$SETUP_BUILD.COM is used to build this module.
X Note that ALL instances of LATSYM will automatically use this module once i
Vnstalled. You must assign the logical
X name LATSYM$SETUP to an invalid filename and select a different processor n
Vame in order to start a LAT printer that
X does not use this module.
X
X Edit`09Edit date`09By`09Reason
X  02`0914-May-91`09NMdS`09Use general method to replace JOB_COMPLETION_2 rou
Vtine.
X  01`0930-Apr-91`09NMdS`09First attempt, VMS V5.4-2
X
X****************************************************************************
V*************************************/
X
X#define`09VERSION`09`09"V01.02"
X#module`09LATSYM$SETUP`09VERSION
X
X#define`09LSM$K_MAXSTREAMS`0932`09`09`09`09`09/* Maximum number of streams s
Vupported`09*/
X`09`09`09`09`09`09`09`09`09/* (taken from V5.4 fiche)`09`09*/
X#define`09TRUE`09(1==1)`09`09`09`09`09`09`09/* Logical .TRUE.`09`09`09*/
X#define`09FALSE`09(1==0)`09`09`09`09`09`09`09/* Logical .FALSE.`09`09`09*/
X/*
X This magic string is used internally by LATSYM to detect when the end of a
V job has been reached in
X order to drop the LAT connection so that another host can use the printer.
V The LAT port remains
X allocated to the symbiont, but the link to the DECserver is broken.
X It is never printed, but the version used by LATSYM has a <CR><FF> sequence
V preceding it. We remove
X the leading sequence using the same rules that LATSYM uses. This is extract
Ved from the VMS V5.4 fiche.
X Interestingly, this text is unprintable by LATSYM (when the <ESC>s are in b
Vinary). It was chosen as a
X piece of text that was very unlikely to appear in any file. Yetch.
X*/
X#define`09DROP_LAT_CONNECTION`09"\033`5DLAT Select ASCII LP\033\\"
X
X#include`09descrip`09`09`09`09`09`09`09/* Define DSC$xxx - VMS descriptors`0
V9*/
X#include`09opcdef`09`09`09`09`09`09`09/* Define OPC$xxxx - OPER logging`09*/
X#include`09ssdef`09`09`09`09`09`09`09/* Define SS$xxxx - System status codes
V`09*/
X#include`09stsdef`09`09`09`09`09`09`09/* Define STS$xxxx - VMS status masks`
V09*/
X
X#include`09"psmdef.h"`09`09`09`09`09`09/* Define PSM$xxxx - PSM definitions`
V09*/
X#include`09"smbdef.h"`09`09`09`09`09`09/* Define SMBxxxx - Symbiont definiti
Vons */
X
Xglobalvalue`09PSM$_FUNNOTSUP;`09`09`09`09`09`09/* Function not supported`09`
V09*/
Xglobalvalue`09PSM$_EOF;`09`09`09`09`09`09/* End of file`09`09`09`09*/
Xglobalvalue`09LSMSET$_STARTUP;
X
X/* Macro to replace a PSM routine`09`09`09*/
X
X#define`09PSM_REPLACE( psm_routine, our_routine ) `7B`09\
X`09long`09psm_status;`09`09`09`09\
X`09long`09our_routine();`09`09`09`09\
X`09psm_status = PSM$REPLACE(`09`09`09\
X`09`09&psm_routine`09,`09`09`09\
X`09`09our_routine`09);`09`09`09\
X`09if ( (psm_status & STS$M_SUCCESS) == 0 ) `7B`09\
X`09`09LIB$SIGNAL( psm_status );`09`09\
X`09`7D`09`09`09`09`09`09\
X`7D
X
X/* Macro to check returned system status`09`09*/
X
X#define`09ss_check( command ) `7B`09`09`09`09\
X`09long ss_status = (command);`09`09`09\
X`09if ( (ss_status & STS$M_SUCCESS) == 0 ) `7B`09\
X`09`09return ss_status;`09`09`09\
X`09`7D`09`09`09`09`09`09\
X`7D
X`0C
X
X/***************************************************************************
V**************************************
X
X`09`09`09`09`09L A T S Y M $ S E T U P
X
X LATSYM setup routine.
X This routine is declared as a universal symbol and is called by LATSYM. It
V replaces the FILE_SETUP_2 and the
X JOB_COMPLETION routines.
X This routine is called from LAT$$OUTPUT in LATSYM as part of the PSM$K_OPEN
V processing. This happens each time
X a queue is started or re-started using this symbiont.
X
X****************************************************************************
V*************************************/
Xvoid
XLATSYM$SETUP(
X`09void`09* ar_latcb`09`09`09,`09`09`09/* => LAT Control Block`09`09`09*/
X`09struct dsc$descriptor *`09ax_device`09)`09`09`09/* LAT device name to use
V`09`09*/
X`7B
X`09static`09long`09replace_called = FALSE;`09`09`09`09/* This is a one-shot
V piece of code`09*/
X`09long`09Handler();
X
X`09LIB$ESTABLISH( Handler );`09`09`09`09`09/* Set up our exception handler`0
V9`09*/
X
X`09LIB$SIGNAL( LSMSET$_STARTUP, 2, sizeof( VERSION ), VERSION, ax_device );
V /* Say that we have started */
X
X`09if ( !replace_called ) `7B`09`09`09`09`09/* If this is not the first time
V...`09*/
X`09`09PSM_REPLACE( PSM$K_FILE_SETUP_2, PSM_File_Setup_2 );`09/* Replace the
V file setup routine`09*/
X`09`09PSM_REPLACE( PSM$K_JOB_COMPLETION, PSM_Job_Completion ); /* Replace th
Ve job completion routine`09*/
X`09`09replace_called = TRUE;`09`09`09`09`09/* Say we have done the PSM$REPLA
VCE calls */
X`09`7D
X`09return;
X`7D
X`0C
X
X/***************************************************************************
V**************************************
X
X`09`09`09`09`09P S M _ F i l e _ S e t u p _ 2
X
X Replaces the PSM$K_FILE_SETUP_2 routine.
X
X The normal action of the FILE_SETUP_2 module is to insert an <FF> in the ou
Vtput stream by returning an <FF> in
X psm$ax_funcdesc. The output formatter normally removes this <FF> because it
V realises that the printer has just
X received an <FF> character from one or more of the previously executed modu
Vles. When SETUP modules are used,
X the output formatter assumes that the printer is no longer at TOF for safet
Vy, and will send the FILE_SETUP_2
X supplied <FF> character just in case. We therefore replace the FILE_SETUP_2
V module with this routine which
X never returns anything, thus preventing a leading <FF>. Note that this will
V only work with forms that never
X output printable characters.
X
X LATSYM does not provide a FILE_SETUP_2 routine, so we just return PSM$_EOF
V for PSM$K_READ functions.
X
X****************************************************************************
V*************************************/
Xstatic long
XPSM_File_Setup_2(
X`09unsigned long`09*`09psm$al_request_id`09,`09`09/* Request ident`09`09`09*
V/
+-+-+-+-+-+-+-+-  END  OF PART 1 +-+-+-+-+-+-+-+-

