LIB$INDEX       ; Return position of substring                   21-AUG-1978 18:58:17   VAX-11 MACRO X0.3-11               Page   0

TABLE OF CONTENTS   



   (2)      89  HISTORY		; Detailed Current Edit History

   (3)      97  DECLARATIONS

   (4)     124  LIB$INDEX - return relative pos. of substring

LIB$INDEX       ; Return position of substring                   21-AUG-1978 18:58:17   VAX-11 MACRO X0.3-11               Page   1

0-5                                                                                                                              (1)



                                     0000     1 	.TITLE	LIB$INDEX		; Return position of substring 

                                     0000     2 	.IDENT	/0-5/			; File: LIBINDEX.MAR

                                     0000     3 

                                     0000     4 ;

                                     0000     5 ; Copyright (C) 1977

                                     0000     6 ; Digital Equipment Corporation, Maynard, Massachusetts 01754

                                     0000     7 ;

                                     0000     8 ; This software is furnished under a license for use only on a single

                                     0000     9 ; computer  system  and  may be copied only with the inclusion of the

                                     0000    10 ; above copyright notice. This software, or any other copies thereof,

                                     0000    11 ; may not be provided or otherwise made available to any other person

                                     0000    12 ; except for use on such system and to one who agree to these license 

                                     0000    13 ; terms.  Title to  and  ownership of the software shall at all times 

                                     0000    14 ; remain in DEC.

                                     0000    15 ;

                                     0000    16 ; The information in the software is subject to change without notice

                                     0000    17 ; and should  not  be construed  as a commitment by Digital Equipment 

                                     0000    18 ; Corporation.

                                     0000    19 ;

                                     0000    20 ; DEC assumes  no  responsibility  for the use or  reliability of its

                                     0000    21 ; software on equipment which is not supplied by DEC.

                                     0000    22 ;

                                     0000    23 ;

                                     0000    24 ; FACILITY: General Utility Library

                                     0000    25 ;++

                                     0000    26 ; ABSTRACT:

                                     0000    27 ;

                                     0000    28 ;	Return relative position of substring in string or 0

                                     0000    29 ;--

                                     0000    30 ;

                                     0000    31 ; VERSION: 0

                                     0000    32 ;

                                     0000    33 ; HISTORY:

                                     0000    34 ;

                                     0000    35 ; AUTHOR:

                                     0000    36 ;	Thomas N. Hastings, 6-Aug-77: Version 0

                                     0000    37 ;

                                     0000    38 ; MODIFIED BY:

                                     0000    39 ;

                                     0000    40 ;	04 - DGP, 03-Jan-78

                                     0000    41 ;

LIB$INDEX       ; Return position of substring                   21-AUG-1978 18:58:17   VAX-11 MACRO X0.3-11               Page   2

0-5             HISTORY  ; Detailed Current Edit History                                                                         (2)



                                     0000    43 	.SBTTL	HISTORY		; Detailed Current Edit History

                                     0000    44 

                                     0000    45 

                                     0000    46 ; Edit History for Version 0

                                     0000    47 ;

                                     0000    48 ;	04 -	Remove R4 and R5 from entry mask

                                     0000    49 

LIB$INDEX       ; Return position of substring                   21-AUG-1978 18:58:17   VAX-11 MACRO X0.3-11               Page   3

0-5             DECLARATIONS                                                                                                     (3)



                                     0000    51 	.SBTTL	DECLARATIONS

                                     0000    52 

                                     0000    53 ;

                                     0000    54 ; INCLUDE FILES:

                                     0000    55 ;

                                     0000    56 

                                     0000    57 ;

                                     0000    58 ; EXTERNAL SYMBOLS:

                                     0000    59 ;

                                     0000    60 

                                     0000    61 ;

                                     0000    62 ; MACROS:

                                     0000    63 ;

                                     0000    64 

                                     0000    65 ;

                                     0000    66 ; PSECT DECLARATIONS:

                                     0000    67 ;

                                 00000000    68 	.PSECT	LIB$CODE PIC,SHR,LONG,EXE,NOWRT

                                     0000    69 ;

                                     0000    70 ; EQUATED SYMBOLS:

                                     0000    71 ;

                                     0000    72 

                                     0000    73 ;

                                     0000    74 ; OWN STORAGE:

                                     0000    75 ;

                                     0000    76 

LIB$INDEX       ; Return position of substring                   21-AUG-1978 18:58:17   VAX-11 MACRO X0.3-11               Page   4

0-5             LIB$INDEX - return relative pos. of substring                                                                    (4)



                                     0000    78 	.SBTTL	LIB$INDEX - return relative pos. of substring

                                     0000    79 

                                     0000    80 ;++

                                     0000    81 ; FUNCTIONAL DESCRIPTION:

                                     0000    82 ;

                                     0000    83 ;	Return the relative position of the first character of sub_string in src_string or

                                     0000    84 ;	The value is an unisgned integer longword.

                                     0000    85 ;	The relative character positions are numbered 1, 2, ...,

                                     0000    86 ;	thus 0 is a unique number meaning sub_string was not found.

                                     0000    87 ;	The value returned is the relative position of the first

                                     0000    88 ;	character of sub_string in src_string (not the last+1).

                                     0000    89 ;	If both strings have zero length or sub_string has zero length

                                     0000    90 ;	a 1 is returned indicating a found string.  If src_string

                                     0000    91 ;	has zero length and sub_string has non-zero length, a 0 is

                                     0000    92 ;	returned indicating that sub_string was not found.

                                     0000    93 ;

                                     0000    94 ; CALLING SEQUENCE:

                                     0000    95 ;

                                     0000    96 ;	rel_position.wlu.v = LIB$INDEX (src_string.rt.dx, sub_string.rt.dx)

                                     0000    97 

                           00000004  0000    98 	src_string = 4		; Adr. of source string descriptor to be searched.

                           00000008  0000    99 	sub_string = 8		; Adr. of sub string descriptor to be searched for.

                                     0000   100 

                                     0000   101 ;

                                     0000   102 ; INPUT PARAMETERS:

                                     0000   103 ;	NONE

                                     0000   104 ;

                                     0000   105 ; IMPLICIT INPUTS:

                                     0000   106 ;	NONE

                                     0000   107 ;

                                     0000   108 ; OUTPUT PARAMETERS:

                                     0000   109 ;	NONE

                                     0000   110 ;

                                     0000   111 ; IMPLICIT OUTPUTS:

                                     0000   112 ;	NONE

                                     0000   113 ;

                                     0000   114 ; COMPLETION CODES:

                                     0000   115 ;	NONE

                                     0000   116 ;

                                     0000   117 ; SIDE EFFECTS:

                                     0000   118 ;	NONE

                                     0000   119 ;--

                                     0000   120 

LIB$INDEX       ; Return position of substring                   21-AUG-1978 18:58:17   VAX-11 MACRO X0.3-11               Page   5

0-5             LIB$INDEX - return relative pos. of substring                                                                    (5)



                               000C' 0000   122 	.ENTRY	LIB$INDEX, ^M<R2,R3> ; entry point and entry mask

                                     0002   123 					; integer enable is off for SUBW3 (unsigned)

                                     0002   124 

            50         08 BC     7D  0002   125 	MOVQ	@sub_string(AP), R0	; R0/R1 = sub string len/adr.

            52         04 BC     7D  0006   126 	MOVQ	@src_string(AP), R2	; R2/R3 = source string len/adr.

            61            50     39  000A   127 	MATCHC	R0, (R1), R2, (R3)	; look for sub string in source

            63            52         000D       

                          0F     12  000F   128 	BNEQ	10$			; branch if no match found

                                     0011   129 					; Note: could use following code except

                                     0011   130 					; for src len = 0 and sub len > 0.

         04 BC         08 BC     A3  0011   131 	SUBW3	@sub_string(AP), -	; R0 = unsigned difference in lengths of

                          50         0016       

                                     0017   132 		@src_string(AP), R0	; src minus sub.

            50            50     3C  0017   133 	MOVZWL	R0, R0			; R0 = len src - len sub

            50            52     C2  001A   134 	SUBL	R2, R0			; R0 = len src - len sub - # char left

                                     001D   135 					; to scan = rel. pos. of 1st char of sub.

                          50     D6  001D   136 	INCL	R0			; wants 1-origin, not 0-origin position.

                                 04  001F   137 	RET				; R0 = relative position

                                     0020   138 

                                     0020   139 

                                     0020   140 ;+

                                     0020   141 ; Here when sub_string not found

                                     0020   142 ;-

                                     0020   143 

                          50     D4  0020   144 10$:	CLRL	R0			; R0 = 0 to indicate not found

                                 04  0022   145 	RET				; return

                                     0023   146 

                                     0023   147 	.END				; End of module LIB$INDEX

LIB$INDEX       ; Return position of substring                   21-AUG-1978 18:58:17   VAX-11 MACRO X0.3-11               Page   6

SYMBOL TABLE                                                                                                                     (5)



FOR$K_ERR_PREFX= 00000018            

LIB$INDEX        00000000 RG    02   

MTH$K_ERR_PREFX= 00000016            

MTH__FLOOVEMAT = 00000058            

MTH__FLOUNDMAT = 00000059            

MTH__INVARG    = 00000051            

MTH__LOGZERNEG = 00000053            

MTH__SINSIGLOS = 00000057            

MTH__SQUROONEG = 00000054            

MTH__UNDEXP    = 00000052            

MTH__WRONUMARG = 00000050            

SRC_STRING     = 00000004            

SUB_STRING     = 00000008            





PROGRAM SECTION SYNOPSIS



.  ABS  .        00000000      00     NOPIC   USR   CON   ABS   LCL NOSHR NOEXE NORD  NOWRT BYTE  

. BLANK .        00000000      01     NOPIC   USR   CON   REL   LCL NOSHR   EXE   RD    WRT BYTE  

LIB$CODE         00000023      02       PIC   USR   CON   REL   LCL   SHR   EXE   RD  NOWRT LONG  





THERE WERE NO ERRORS OR WARNINGS.

28008. BYTES LEFT IN FREE MEMORY POOL.

OBJ$:LIBINDEX,LIS$:LIBINDEX/-SP=LIB$:S/ML,SRC$:P,LIBINDEX

0 MLB DIR RDS - 0 GETS TO DEFINE 0 MACROS. 2 INTER. FILE WRITES. 

