WSRCS	MACRO M1110  22-AUG-78 02:03  PAGE 2





      1						.TITLE	WSRCS

      2						.IDENT	/00/

      3					;

      4					; COPYRIGHT (C) 1976

      5					; DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.

      6					;

      7					; THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ONLY ON A

      8					; SINGLE COMPUTER SYSTEM AND MAY  BE  COPIED   ONLY  WITH  THE

      9					; INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE,  OR

     10					; ANY OTHER COPIES THEREOF, MAY NOT BE PROVIDED  OR  OTHERWISE

     11					; MADE AVAILABLE TO ANY OTHER PERSON   EXCEPT FOR  USE ON SUCH

     12					; SYSTEM AND TO ONE WHO AGREES TO THESE LICENSE  TERMS.  TITLE

     13					; TO AND OWNERSHIP OF THE SOFTWARE SHALL AT ALL  TIMES  REMAIN

     14					; IN DEC.

     15					;

     16					; THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT

     17					; NOTICE AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL

     18					; EQUIPMENT CORPORATION.

     19					;

     20					; DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF

     21					; ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.

     22					;

     23

     24					; VERSION 01

     25					;

     26					; C. MONIA 23-SEP-75

     27					;

     28					; SYMBOL TABLE WHOLE SEARCH ROUTINE

     29					;

     30					; LOCAL DATA

     31					;

     32					; CURRENT PATH LIST ADDRESS

     33					;

     34

     35	000000				PATH:	.BLKW	1		;

     36

     37					;

     38					; SYMBOL DESCRIPTOR

     39					;

     40

     41	000002				SYM:	.BLKW	2		;

     42	000006	000000 				.WORD	0		;

     43

     44					;

     45					; SEARCH EXTENT FLAG

     46					;

     47

     48	000010	000000 			$WSEXT::.WORD	0		;

     49

     50					;+

     51					; **-$WSRCS-PERFORM WHOLE SEARCH OF SYMBOL TABLES

     52					;

     53					; THIS SUBROUTINE IS CALLED TO SEARCH FOR A GLOBAL SYMBOL

     54					; IN A SEGMENT THAT IS ON A COMMON PATH WITH THE CURRENT

     55					; SEGMENT BEING PROCESSED. PRIOR TO CALLING THIS ROUTINE

     56					; SUBROUTINE $WSINI MUST BE INVOKED TO BUILD THE

     57					; PATH LIST CONTAINING THE VIRTUAL ADDRESS OF ALL SEGMENTS

WSRCS	MACRO M1110  22-AUG-78 02:03  PAGE 2-1





     58					; THAT ARE VISIBLE FROM THE CURRENT SEGMENT.

     59					;

     60					; THE CURRENT SEGMENT IS SEARCHED ON THE INITIAL CALL. IF THE

     61					; SYMBOL IS FOUND, A CO-ROUTINE CALL IS MADE TO THE CALLER WITH

     62					; THE C-BIT CLEAR. SUBSEQUENT CO-ROUTINE CALLS ARE MADE TO SEEK

     63					; ADDITIONAL SYMBOL TABLE ENTRIES IN THE STRUCTURE. THE SEARCH

     64					; FOR THESE ENTRIES IS PERFORMED BY REFERENCING THE MASTER SYMBOL

     65					; TABLE AND THE PATH LIST. ALL SYMBOLS OF THE SPECIFIED NAME WITHIN

     66					; THE TABLE ARE SCANNED EXTRACTING THE VIRTUAL ADDRESS OF THE

     67					; SEGMENT DESCRIPTOR AND CORRESPONDING ENTRY. THE PATH LIST

     68					; IS THEN SEARCHED FOR A MATCH ON SEGMENT DESCRIPTOR ADDRESS

     69					; FOR EACH TABLE ENTRY FOUND. A CO-ROUTINE CALL IS MADE TO THE

     70					; CALLER FOR EACH MATCH.

     71					;

     72					; WHEN NO MORE ENTRIES REMAIN, THE ROUTINE EXITS VIA A RETURN

     73					; WITH THE C-BIT SET. CALLER MAY TERMINATE THE SEARCH BY REMOVING

     74					; THE CO-ROUTINE ADDRESS FROM THE STACK.

     75					;

     76					; INPUTS:

     77					;

     78					;	R1=ADDRESS OF SYMBOL DESCRIPTOR

     79					;	$CRSEG=REAL ADDRESS OF CURRENT SEGMENT

     80					;	$CRVSG=VIRTUAL ADDRESS OF CURRENT SEGMENT

     81					;

     82					; IF TASK HAS MORE THAN ONE SEGMENT, THE FOLLOWING ADDITIONAL

     83					; INPUTS ARE REQUIRED:

     84					;

     85					;	$PATH=ADDRESS OF PATH LIST BUILT BY $WSINI

     86					;	$SGLST=BUFFER TO CONTAIN SEGMENTS AND SYMBOL ADDRESSES

     87					;	$SYMHD=LISTHEAD FOR MASTER SYMBOL TABLE

     88					;	$WSEXT=SEARCH EXTENT FLAG. IF CLEAR, THE SEARCH IS CONFINED

     89					;	       TO THE CURRENT CO-TREE AND MAIN ROOT. ELSE THE SEARCH

     90					;	       EXTENT COVERS ALL CO-TREES.

     91					;

     92					; OUTPUTS:

     93					;

     94					;	C/CLEAR -- FOUND SYMBOL, EXIT IS VIA CO-ROUTINE CALL.

     95					;

     96					;		R0=REAL ADDRESS OF DESCRIPTOR

     97					;		R1=PATH FLAG. ONE OF THE FOLLOWING

     98					;		   VALUES IS RETURNED:

     99					;

    100					;			R1=0; FOUND IN CURRENT SEGMENT

    101					;			R1<0; FOUND TOWARDS THE ROOT

    102					;			R1=1; FOUND UP-TREE

    103					;			R1=2; FOUND IN CO-TREE

    104					;

    105					;	CONDITION CODES REFLECT THE CONTENTS OF R1.

    106					;

    107					;		$CRVSM=VIRTUAL ADDRESS OF FOUND SYMBOL

    108					;		$CRVSR=VIRTUAL ADDRESS OF FOUND SEGMENT

    109					;

    110					;	C/SET -- NO FURTHER ENTRIES CAN BE FOUND. EXIT IS

    111					;	         VIA A RETURN WITH R1 CLEARED.

    112					;

    113					;	CONDITION CODES REFLECT THE CONTENTS OF R1

    114					;

WSRCS	MACRO M1110  22-AUG-78 02:03  PAGE 2-2





    115					;-

    116

    117	000012				$WSRCS::			;

    118	000012	016700 	000000G			MOV	$CRSEG,R0	; GET REAL ADDRESS OF CURRENT SEGMENT

    119	000016	062700 	000000G			ADD	#S$GSTB,R0	; OFFSET TO SYMBOL TABLE LISTHEAD

    120	000022	016767 	000000G	000000G		MOV	$CRVSG,$CRVSR	; SET VIRTUAL ADDRESS OF SEARCH SEGMENT

    121	000030	012702 	000002'			MOV	#SYM,R2		; GET ADDRESS OF DESCRIPTOR

    122	000034	016122 	000000G			MOV	S$YM(R1),(R2)+	; COPY SYMBOL NAME

    123	000040	016112 	000002G			MOV	S$YM+2(R1),(R2) ; ...

    124	000044					CALL	$SRCH		; SEARCH FOR SYMBOL

    125	000050	103404 				BCS	10$		; IF C/S NOT IN CURRENT SEGMENT

    126	000052	010167 	000000G			MOV	R1,$CRVSM	; RECORD VIRTUAL ADDRESS OF SYMBOL

    127	000056	005001 				CLR	R1		; SET PATH FLAG=CURRENT

    128	000060					CALL	@(SP)+		; CALL THE CALLER

    129	000062				10$:				;

    130	000062	016701 	000000G			MOV	$SGLST,R1	; GET ADDRESS OF SEGMENT LIST

    131	000066	001505 				BEQ	80$		; IF EQ NONE

    132	000070	010346 				MOV	R3,-(SP)	; SAVE R3

    133	000072	010103 				MOV	R1,R3		; COPY ADDRESS OF SEGMENT LIST

    134	000074	012700 	000000G			MOV	#$SYMHD,R0	; GET ADDRESS OF MASTER TABLE

    135	000100	012701 	177774'			MOV	#SYM-6,R1	; GET ADDRESS OF DESCRIPTOR LESS OFFSET

    136	000104	012746 	000000G			MOV	#$ISEDP,-(SP)	; SET TO SCAN MASTER TABLE

    137	000110				20$:				;

    138	000110	005013 				CLR	(R3)		; ASSUME END OF LIST

    139	000112					CALL	@(SP)+		; FETCH AN ENTRY FROM MASTER LIST

    140	000114	103414 				BCS	30$		; IF C/S END OF LIST

    141	000116	062700 	000006 			ADD	#6,R0		; OFFSET TO SYMBOL NAME

    142	000122	026720 	177654 			CMP	SYM,(R0)+	; NAME MATCH?

    143	000126	001006 				BNE	25$		; IF NE NO

    144	000130	026720 	177650 			CMP	SYM+2,(R0)+	; CHECK SECOND HALF OF NAME

    145	000134	001003 				BNE	25$		; IF NE NO MORE MATCHES POSSIBLE

    146	000136	012023 				MOV	(R0)+,(R3)+	; COPY SEGMENT DESCRIPTOR ADDRESS

    147	000140	012023 				MOV	(R0)+,(R3)+	; COPY ADDRESS OF SYMBOL

    148	000142	000762 				BR	20$		; CONTINUE SCAN

    149	000144				25$:				;

    150	000144	005226 				INC	(SP)+		; TERMINATE SCAN

    151	000146				30$:				;

    152	000146	012603 				MOV	(SP)+,R3	; RESTORE R3

    153	000150	016700 	000000G			MOV	$PATH,R0	; GET PATH LIST ADDRESS

    154	000154				40$:				;

    155	000154	022020 				CMP	(R0)+,(R0)+	; STEP TO NEXT PATH LIST ENTRY

    156	000156				50$:				;

    157	000156	005710 				TST	(R0)		; REACHED END OF PATH LIST?

    158	000160	001447 				BEQ	70$		; IF EQ YES

    159	000162	005767 	177622 			TST	$WSEXT		; SEARCH EXTENDED TO ALL TREES?

    160	000166	001013 				BNE	55$		; IF NE YES

    161	000170	026767 	000000G	000000G		CMP	$CRVSG,$RTSEG	; SEARCHING FROM MAIN ROOT?

    162	000176	001407 				BEQ	55$		; IF EQ YES

    163	000200	021067 	000000G			CMP	(R0),$RTSEG	; FOUND MAIN ROOT?

    164	000204	001404 				BEQ	55$		; IF EQ YES

    165	000206	026027 	000002 	000002 		CMP	2(R0),#2	; IN CO TREE?

    166	000214	001757 				BEQ	40$		; IF EQ YES, STEP TO NEXT ENTRY

    167	000216				55$:				;

    168	000216	016701 	000000G			MOV	$SGLST,R1	; GET SEGMENT LIST ADDRESS

    169	000222	024141 				CMP	-(R1),-(R1)	; ADJUST LIST POINTER

    170	000224				60$:				;

    171	000224	022121 				CMP	(R1)+,(R1)+	; POINT TO NEXT SEGMENT LIST ENTRY

WSRCS	MACRO M1110  22-AUG-78 02:03  PAGE 2-3





    172	000226	005711 				TST	(R1)		; REACHED END OF SEGMENT LIST?

    173	000230	001751 				BEQ	40$		; IF EQ YES, GET NEXT SEGMENT ON PATH

    174	000232	021110 				CMP	(R1),(R0)	; SEGMENT ON PATH HAVE SYMBOL?

    175	000234	001373 				BNE	60$		; IF NE NO

    176	000236	010067 	177536 			MOV	R0,PATH		; MARK CURRENT POSITION IN PATH LIST

    177	000242	016046 	000002 			MOV	2(R0),-(SP)	; COPY PATH FLAG

    178	000246	012167 	000000G			MOV	(R1)+,$CRVSR	; COPY VIRTUAL ADDRESS OF SEGMENT

    179	000252	011167 	000000G			MOV	(R1),$CRVSM	; COPY VIRTUAL ADDRESS OF SYMBOL

    180	000256	011101 				MOV	(R1),R1		; GET VIRTUAL ADDRESS OF SYMBOL

    181	000260					CALL	$CVRL		; CONVERT TO REAL ADDRESS

    182	000264	000241 				CLC			; SET SUCCESS

    183	000266	012601 				MOV	(SP)+,R1	; RETRIEVE PATH FLAG

    184	000270					CALL	@(SP)+		; CALL THE CALLER

    185	000272	016700 	177502 			MOV	PATH,R0		; RETRIEVE PATH ADDRESS

    186	000276	000726 				BR	40$		; CONTINUE SCAN

    187	000300				70$:				;

    188	000300	005001 				CLR	R1		; CLEAR R1

    189	000302				80$:				;

    190	000302	000261 				SEC			; FLAG END OF SEARCH

    191	000304					RETURN			;

    192

    193		000001 				.END

WSRCS	MACRO M1110  22-AUG-78 02:03  PAGE 2-4

SYMBOL TABLE



CR    = 000015   	R$$11M= 000000   	VT    = 000013   	$CVRL = ****** GX	$SRCH = ****** GX

FF    = 000014   	SPA   = 000040   	$CRSEG= ****** GX	$ISEDP= ****** GX	$SYMHD= ****** GX

HT    = 000011   	SYM     000002R  	$CRVSG= ****** GX	$PATH = ****** GX	$WSEXT  000010RG

LF    = 000012   	S$GSTB= ****** GX	$CRVSM= ****** GX	$RTSEG= ****** GX	$WSRCS  000012RG

PATH    000000R  	S$YM  = ****** GX	$CRVSR= ****** GX	$SGLST= ****** GX	$$    = 000001



. ABS.	000000	   000

      	000306	   001

ERRORS DETECTED:  0



VIRTUAL MEMORY USED:  685 WORDS  ( 3 PAGES)

DYNAMIC MEMORY:  2772 WORDS  ( 10 PAGES)

ELAPSED TIME:  00:00:06

OBJ$:WSRCS,LIS$:WSRCS/-SP=SRC$:MACFLM,WSRCS

