.MCALL .MODULE .MODULE VERIFY,VERSION=03,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 31-AUG-90 Treat non-positive characters ; as string terminators consistently ; in both arguments. Use $NXADR ; and trap on missing arguments. ;-- ;+ ;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: VERIFY ; ; FUNCTIONAL DESCRIPTION: ; ; This subroutine examines every character of string A to ; determine if it occurs anywhere within string B. If a ; character is found scanning a from left to right which does ; not exist in B, the character position of that character is ; returned in I. If all characters of A exist in B, a value of ; ZERO is returned in I. If A is a null string, a value of ; ZERO will be returned. If B is a null string and A is not ; NULL, a value of ONE is returned. ; ; ; CALLING SEQUIENCE: ; ; CALL VERIFY(A,B,I) ; ; I = IVERIF(A,B) ; ; ; PASSED ARGUMENTS: ; ; A - BYTE array or CHARACTER string ; B - BYTE array or CHARACTER string ; ; ; RETURNED ARGUMENT VALUES: ; ; I - INTEGER position of first character in A not in B or ZERO ; ; ; FUNCTION RETURN VALUE: ; ; INTEGER position of first character in A not in B or ZERO ; ; ; EXTERNAL REFERENCES: ; ; $NXADR - standard routine to return address of next argument ; $MSARG - trap routine invoked for a missing argument ; ; ; MACRO REFERENCES: ; ; SOB .SBTTL VERIFY - FORTRAN-callable system subroutine .GLOBL $SYSLB, $NXADR .WEAK $MSARG .IIF EQ EIS$I .MCALL SOB .PSECT SYS$I,I VERIFY:: IVERIF::MOV (R5)+,R4 ;# OF ARGS IN LOW BYTE MOV R4,-(SP) CALL $NXADR ;GET ADDR(STRING A). BCS 3$ ;BR IF MISSING. MOV R0,R1 CALL $NXADR ;GET ADDR(STRING B). BCS 3$ ;BR IF MISSING. MOV R0,R2 MOV #8.,R0 ;# OF WORDS IN BIT TABLE 1$: CLR -(SP) ;CLEAR BIT TABLE ON STACK SOB R0,1$ 2$: MOVB (R2)+,R3 ;GET CHAR FROM B BLE 4$ ;BR IF END OF STRING B. CALL ADRBIT ;SELECT BIT IN TABLE BASED ON CHAR IN R3 BISB @R3,@R4 ;SET THE SELECTED BIT. BR 2$ ;CONTINUE UNTIL END OF STRING B. 3$: TST (SP)+ ;HANDLE MISSING ARGUMENT. TRAP $MSARG BR 7$ 4$: INC R0 ;UPDATE CHARACTER POSITION IN STRING A. MOVB (R1)+,R3 ;GET CHARACTER FROM STRING A. BLE 5$ ;BR IF END OF STRING A. CALL ADRBIT ;USE CHAR TO SELECT A BIT IN TABLE BITB @R3,@R4 ;TEST THE SELECTED BIT BNE 4$ ;BR IF CHAR IS IN STRING B. BR 6$ ;BR IF CHAR IS NOT IN STRING B. 5$: CLR R0 ;ALL CHAR'S IN A FOUND IN B. 6$: ADD #16.,SP ;POP TABLE OFF STACK CMPB #3,(SP)+ ;RETURN VALUE ARGUMENT GIVEN? BHI 7$ ;NO, ONLY RESULT IS IN R0 MOV R0,@(R5)+ ;RETURN RESULT TO I 7$: RETURN ADRBIT: MOV R3,R4 ;COPY CHAR BIC #177770,R3 ;BIT INDEX IS IN R3 ADD PC,R3 ;USE IT TO ADDRESS ADD #BITS-.,R3 ; THE BIT LIST ASR R4 ASR R4 ASR R4 ;BYTE INDEX IS IN R4 ADD SP,R4 ;USE TO ADDRESS BIT TABLE CMPB (R4)+,(R4)+ ;POINT INTO BIT TABLE RETURN .PSECT SYS$S,D BITS: .BYTE 200,100,40,20,10,4,2,1 .END