[comp.os.vms] print symbiont routine replacement

sloane@UKANVAX.BITNET (Bob Sloane) (05/23/88)

Igal Iancu writes:
>...
>I have searched the Print Symbiont routines.  All I have found are examples
>which will replace the Flag page.  The PSM$ routines enable you to replace the
>DEC supplied routines but not to MODIFY them.  Since I have no intention to
>rewrite the FLAG page routines (I do not know how to generate big letters,
>etc.) I am stuck.
>

While it is true that you can only replace the flag page routine, you CAN
call the print symbiont flag page routine to do the generation of the flag
page.  The following short program generates a single line message before
the first line of the standard flag page. While this may not solve your
particular problem, it might at least start you in the right direction.

The example is in MACRO.  I have tried writing PSM replacement routines
in other languages, but have never gotten them to work.  Perhaps some of
the gurus on the net can explain why. Anyway, good luck with your problem.

                      Bob Sloane
                      University of Kansas
                      Computer Center
                      (913) 864-0444
                      SLOANE@UKANVAX.BITNET

================================== CUT HERE ==================================
        .TITLE  RPLQUEUE - USER MODIFIED SYMBIONT
        .SBTTL  STORAGE DEFINITIONS
        .IDENT  'V01-000'
;
; PRINT SYMBOINT MODIFICATION ROUTINE TO ADD A LINE TO THE BANNER
;
;    TO USE:
;      $ MACRO PSMRPL
;      $ LINK PSMRPL
;      $ COPY PSMRPL.EXE SYS$SYSTEM:
;      $ INIT/QUEUE/PROC=PSMRPL/ON=txa4:/SEPARATE=(FLAG,TRAILER) TEST$PRINT
;      $ START/QUE TEST$PRINT
;
;    WILL PRINT "THIS IS A TEST" BEFORE THE JOB FLAG PAGE FOR EACH JOB.
;
        .LIBRARY /SYS$LIBRARY:LIB.MLB/
;
;******************************************************************************
;       SYSTEM DEFINITIONS
;******************************************************************************
;
        $PSMDEF                         ; PRINT SYMBIONT REPLACEMENT DEFINITIONS
        $SMBDEF                         ; PRINT SYMBIONT DEFINITIONS
        $DSCDEF                         ; DESCRIPTOR DEFINITIONS
        $SSDEF                          ; STATUS CODE DEFINITIONS
;
;******************************************************************************
;       DEFINE ARGUMENT OFFSETS
;******************************************************************************
;
        CONTEXT         = 04            ; PRINT SYMBIONT CONTEXT VARIABLE
        WORK_AREA       = 08            ; WORK AREA POINTER
        FUNC            = 12            ; FUNCTION CODE POINTER
        FUNC_DESC       = 16            ; POINTER TO DESCR USED BY FUNCTION
        FUNC_ARG        = 20            ; LONGWORD POINTER USED BY FUNCTION
;
;******************************************************************************
;       STORAGE FOR MESSAGE
;******************************************************************************
;
MSGFLG: .LONG   1                       ; INDICATES THAT WE HAVE INSERTED MSG
MSGBUF: .ASCII  /THIS IS A TEST/        ; THE MESSAGE TO INSERT
MSGSIZ  =       14                      ; LENGTH OF MESSAGE
;
;******************************************************************************
;       OWN STORAGE FOR VALUES PASSED BY REFERENCE
;******************************************************************************
;
CODE:   .LONG   0                       ; CODE OF ITEM TO RETURN
STREAMS:.LONG   1                       ; NUMBER OF STREAMS
BUFSIZ: .LONG   2048                    ; BUFFER SIZE
        .PAGE
        .SBTTL  REPLACE ROUTINES AND CALL PRINT SYMBIONT
;
;******************************************************************************
;       MAIN ROUTINE - INVOKED AT IMAGE STARTUP
;******************************************************************************
;
        .ENTRY  START,^M<>              ; NO NEED TO SAVE REGS
;
;******************************************************************************
;       SUPPLY PRIVATE JOB_FLAG ROUTINE
;******************************************************************************
;
        MOVZBL  #PSM$K_JOB_FLAG,CODE    ; CODE FOR FUNCTION TO REPLACE
        PUSHAL  J_FLAG                  ; ADDRESS OF REPLACEMENT ROUTINE
        PUSHAL  CODE                    ; ADDRESS OF CODE
        CALLS   #2,G^PSM$REPLACE        ; REPLACE THE MODULE
        BLBC    R0,ERRXIT               ; QUIT NOW IF ERROR
;
;******************************************************************************
;       TRANSFER CONTROL TO THE STANDARD SYMBIONT
;******************************************************************************
;
        PUSHAL  BUFSIZ                  ; ADDRESS OF BUFFER SIZE
        PUSHAL  STREAMS                 ; NUMBER OF STREAMS
        CALLS   #2,G^PSM$PRINT          ; INVOKE THE STANDARD SYMBIONT
ERRXIT: RET                             ; ALL DONE
        .PAGE
        .SBTTL  REPLACEMENT JOB FLAG PAGE MODULE
;
;******************************************************************************
;       FLAG PAGE ROUTINE
;******************************************************************************
;
        .ENTRY  J_FLAG,^M<>             ; WE ONLY USE REG R0
;
;******************************************************************************
;       REPLACE THE REAL FLAG PAGE ROUTINE
;******************************************************************************
;
        CMPL    #PSM$K_OPEN,@FUNC(AP)   ; IS THIS THE OPEN FUNCTION?
        BNEQ    DOREAD                  ; NO - CHECK FOR READ
        MOVZBL  #0,MSGFLG               ; YES - INIT FLAG FOR THIS JOB
        BRB     DOFLAG                  ; GO CALL REAL FLAG PAGE ROUTINE
;
;******************************************************************************
;       CHECK FOR READ FUNCTION CODE
;******************************************************************************
;
DOREAD: CMPL    #PSM$K_READ,@FUNC(AP)   ; IS THIS A READ FUNCTION?
        BNEQ    DOFLAG                  ; NO - LET REAL ROUTINE HANDLE
        CMPL    #0,MSGFLG               ; IS THIS THE FIRST TIME HERE?
        BNEQ    DOFLAG                  ; NO - ON TO REAL ROUTINE
;
;******************************************************************************
;       RETURN THE MESSAGE TO THE BUFFER
;******************************************************************************
;
        MOVL    FUNC_DESC(AP),R0        ; GET POINTER TO DESCRIPTOR
        MOVL    #MSGSIZ,(R0)            ; SET COUNT
        MOVAB   MSGBUF,4(R0)            ; PUT IN POINTER TO MESSAGE
        MOVZBL  #1,MSGFLG               ; SHOW WE HAVE BEEN HERE
        MOVL    #SS$_NORMAL,R0          ; WE DIDN'T HAVE ANY ERRORS
        RET
;
;******************************************************************************
;       NOW INVOKE THE STANDARD FLAG PAGE ROUTINE
;******************************************************************************
;
DOFLAG: PUSHL   FUNC_ARG(AP)            ; COPY ARGS FOR REAL FLAG PAGE ROUTINE
        PUSHL   FUNC_DESC(AP)
        PUSHL   FUNC(AP)
        PUSHL   WORK_AREA(AP)
        PUSHL   CONTEXT(AP)
        CALLS   #5,G^PSM$JOB_FLAG       ; CALL THE REAL SYMBIONT ROUTINE
        RET                             ; BACK TO SYMBIONT

        .END    START
=============================== CUT HERE ======================================

                      Bob Sloane
                      University of Kansas
                      Computer Center
                      (913) 864-0444
                      SLOANE@UKANVAX.BITNET