.MCALL .MODULE .MODULE RCHAIN,VERSION=04,COMMENT=,IDENT=NO,LIB=YES; ; Copyright (c) 1998 by Mentec, Inc., Nashua, NH. ; All rights reserved ; ; This software is furnished under a license for use only on a ; single computer system and may be copied only 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 except for use on such ; system and to one who agrees to these license terms. Title ; to and ownership of the software shall at all times remain ; in Mentec, Inc. ; ; The information in this document is subject to change without ; notice and should not be construed as a commitment by Digital ; Equipment Corporation, or Mentec, Inc. ; ; Digital and Mentec assume no responsibility for the use or ; reliability of its software on equipment which is not supplied ; by Digital or Mentec, and listed in the Software Product ; Description. .SBTTL Module Declarations .NLIST .ENABL LC .DSABL GBL .NLIST CND .LIST ; ++ ; FACILITY: ; ; RT-11 System Subroutine Library ; ; ENVIRONMENT: ; ; This routine can be used by any job running in a single-job ; or multi-job environment. It uses "TRAP" to provide error ; processing. ; ; INCLUDE FILES: ; ; SYSMAC.SML ; RT-11 system macro library. ; ; EQUATED SYMBOLS: ; CH.PGM = 500 ; Start of chain parameter area. CH.ARG = 510 ; Length of passed command string in chain area CH.STR = 512 ; Start of passed command string in chain area $JSW = 44 ; Offset to Job Status Word. CHAIN$ = 400 ; JSW's "chain" bit-mask. ; ; EXTERNAL REFERENCES: ; .GLOBL $NXADR ; Entry point to next address routine. .GLOBL $NXVAL ; Entry point to next value routine. .GLOBL $SYSLB ; Include system library work area. .WEAK $MSARG ; Trap code for missing argument .SBTTL RCHAIN - Fortran-callable Routine ; ++ ; FUNCTIONAL DESCRIPTION: ; ; The RCHAIN subroutine allows a program to determine whether it has been ; chained to and to access variables passed across a chain. ; ; CALLING SEQUENCE: ; ; CALL RCHAIN( flag, var, wcnt ) ; ; INPUT PARAMETERS: ; ; R5 - address of RCHAIN's argument block ; ; 0(R5) - argument count of RCHAIN call ; 2(R5) - address of integer*2 variable RCHAIN returns chain status in ; 4(R5) - address of parameter storage area ; 6(R5) - address of word count specifying number of words to move ; ; IMPLICIT INPUTS: ; ; JSW - Job Status Word (contains "chain" bit) ; ; Chain parameter area if parameters are passed. ; ; OUTPUT PARAMETERS: ; ; flag = 0 - if program has not been chained to ; flag = -1 - if program has been chained to ;-- ; .PSECT SYS$I RCHAIN::MOV (R5)+,R4 ; R4 <- argument count. CALL $NXADR ; Get -> 'flag' argument BCS ERR ; If CS, error - 'flag' wasn't supplied CLR @R0 ; Indicate that no chaining (default) occurred ; by setting 'flag' variable to 0 BIT #CHAIN$,@#$JSW ; Were we chained to? BEQ 20$ ; If EQ, weren't chained to; no parameters to ; move from chain area - just return to caller. COM @R0 ; Otherwise, indicate that we were chained ; to by setting 'flag' variable to -1 CALL $NXADR ; Get -> 'var' argument BCS ERR ; If CS, error - 'var' wasn't supplied MOV R0,R3 ; R3 <- address of parameter storage area CALL $NXVAL ; Get 'wcnt' argument BCS ERR ; If CS, error - 'wcnt' wasn't supplied BEQ 20$ ; If EQ, no parameters to move; just return. MOV #CH.ARG,R2 ; R2 <- start of chain (command) parameter area. 10$: MOV (R2)+,(R3)+ ; Move parameter(s) passed across chain to ;>>> sob? DEC R0 ; caller's storage area one word at a time. BNE 10$ ; Repeat until all words have been moved. 20$: RETURN ERR: TRAP $MSARG ; Handle any missing arguments in call RETURN .END