.MCALL .MODULE .MODULE CONCAT,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. ;++ ; ; ; Edit Who Date Description of modification ; ---- --- ---- --------------------------- ; 001 WLD 13-SEP-90 Use SOB instruction and ; $NX%%% subroutines. Trap on ; required arguments missing. ;-- ;+ ;COND ; EIS$I (0) use SOB macro ; 1 use SOB instruction ; ; SLIB$M (0) Generate standard SYSLIB routine ; SLIB$M 1 Generate U mode part of Supervisor library ; SLIB$M 2 Generate S mode part of Supervisor library ; ; SLIB$M values are referenced using symbols of the form *PART ; in conditional startements. ; ; If SLIB$M <> 0, EIS$I is forced to 1 ;- .IIF NDF EIS$I EIS$I=0 .IIF NDF SLIB$M SLIB$M=0 .IIF NE SLIB$M EIS$I=1 OPART = SLIB$M ;0 = generate if building old library UPART = SLIB$M-1 ;0 = generate if building User part SPART = SLIB$M-2 ;0 = generate if building Supy part OSPART = OPART*SPART ;0 = generate ... old or Supy OUPART = OPART*UPART ;0 = generate ... old or User ;+ ; RT-11 SYSTEM LIBRARY (SYSLIB) SUBROUTINE ; ; CALLABLE ENTRIES: CONCAT ; ; FUNCTIONAL DESCRIPTION: ; This routine replaces the string in array OUT with the string in ; array A followed on the right by the string in array B followed by ; the terminating NULL character. Any combination of string arguments ; is allowed provided that B and OUT are not the same array. The ; effect of the optional arguments LEN and ERR is the same as for ; subroutine SCOPY. If either A or B is A NULL string, the other ; string is copied to OUT. If A and B Are both NULL, then OUT is made ; NULL. The old contents of OUT are lost when this routine is called. ; ; CALLING SEQUENCE: ; ; CALL CONCAT(A,B,OUT[,LEN[,ERR]]) ; ; PASSED ARGUMENTS: ; ; A - BYTE array or CHARACTER string terminated with NULL ; B - BYTE array or CHARACTER string terminated with NULL ; OUT - BYTE array or CHARACTER string ; LEN - INTEGER size of OUT in characters minus 1 for NULL to be set ; ERR - BYTE ; ; RETURNED ARGUMENT VALUES: ; ; OUT - A B and terminated by NULL ; ERR - set TRUE if concatenation is truncated; otherwise unmodified ; ; FUNCTION RETURN VALUE: ; ; ; ; ; EXTERNAL REFERENCES: ; ; $NXADR ; $NXVAL ; ; ; MACRO REFERENCES: ; ; SOB .SBTTL CONCAT - FORTRAN-callable system subroutine .GLOBL $SYSLB, $NXADR, $NXVAL .WEAK $MSARG .IIF EQ EIS$I .MCALL SOB .PSECT SYS$I,I CONCAT::MOV (R5)+,R4 ;Get # arguments. CALL $NXADR ;Get addr(string A). BCS 4$ ;BR if A missing. MOV R0,R1 CALL $NXADR ;Get addr(string B). BCS 4$ ;BR if B missing. MOV R0,R2 CALL $NXADR ;Get addr(string OUT). BCS 4$ ;BR if OUT missing. MOV R0,R3 CALL $NXVAL ;Get addr(LEN). BCS 7$ ;BR if LEN missing. 1$: MOVB (R1)+,(R3)+ ;Copy A to OUT. BEQ 5$ ;BR when done. SOB R0,1$ ;BR if OUT still has room. 2$: CLRB (R3)+ ;Set NULL to terminate OUT. CALL $NXADR ;Get addr(ERR). BCS 9$ ;BR if missing. TSTB @R1 ;Has all of A been moved into OUT? BNE 3$ ;BR if not: ERROR. TSTB @R2 ;Has all of B been moved? BEQ 9$ ;BR if yes: concatenation OK. 3$: MOVB #-1,@R0 ;Set ERR to TRUE. BR 9$ ;BR to RETURN. 4$: TRAP $MSARG ;Trap since required argument missing. BR 9$ ;BR to RETURN. 5$: CMPB -(R1),-(R3) ;Back up pointers to A and OUT. 6$: MOVB (R2)+,(R3)+ ;Copy B to OUT. BEQ 9$ ;BR when done. SOB R0,6$ ;BR if OUT still has room. BR 2$ ;BR to terminate OUT with NULL. 7$: MOVB (R1)+,(R3)+ ;Copy A to OUT. BNE 7$ ;BR if still more of A. DEC R3 ;Back up over NULL from A. 8$: MOVB (R2)+,(R3)+ ;Copy B to OUT. BNE 8$ ;BR if still more of B. 9$: RETURN .END