Trailing-Edge
-
PDP-10 Archives
-
decuslib20-03
-
decus/20-0078/comp/sh.mac
There is 1 other file named sh.mac in the archive. Click here to see a list.
COMMENT;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
AUTHOR: CLAES WIHLBORG
VERSION: 8
PURPOSE: SYMBOL TABLE (ZSE) HANDLING
CONTENT: SH
SHNEW
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SEARCH SIMMC1,SIMMAC
SALL
CTITLE SH (SYMBOL HASH)
INTERN SH
EXTERN YMAXID,ZHT,ZSE1,ZSE2,ZSE3
EXTERN YELIN1,YELIN2,YESEM
EXTERN T1AB
MACINIT
TWOSEG
RELOC 400000
DEFINE ERROR(MESSAGE)<
; IFG QDEBUG,<
; OUTSTR [ASCIZ/
;ERROR: MESSAGE/]
; >
IFN QERIMP,<
LF ,YLSCLIN
ST YELIN1
ST YELIN2
LF ,YLSCSEM
ST YESEM
ERR QT,Q1SH.T
>
>
SUBTTL SH
COMMENT;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
FUNCTION:
SH (SYMBOL HASH) TAKES AN IDENTIFIER AND TRANSFORMS
IT TO AN INTERNAL IDENTIFIER NUMBER.
ARGUMENTS:
X1ID1-X1ID2 CONTAINS IDENTIFIER IN SIXBIT
RETURN:
IF MORE THAN 3072 IDENTIFIERS BRANCH TO T1AB
ELSE RETURN.
RETURN ARGUMENT:
X1NXT:= IF INSERTION NOT ALLOWED AND IDENTIFIER NOT FOUND
THEN ZERO ELSE IDENTIFIER NUMBER.
THE IDENTIFIER NUMBER HAS THE VALUE:
(1024-QNRESW) TO 1023 IF RESERWED WORD
1024 TO 4095 IF IDENTIFIER
ACCUMULATOR CONVENTIONS:
X0 AND X1 ARE DESTROYED.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SH: PROC
;HASH IDENTIFIER
L X0,X1ID1
MUL X0,[QHASHM]
ANDI X0,177
L X1,X0
;HASH-TABLE LOOKUP
SKIPN X1NXT,ZHT(X1)
GOTO [;FIRST IDENTIFIER HASHED TO THIS ENTRY
IFONA YZSE
RETURN ;ZERO
EXEC SHNEW
ST X1NXT,ZHT(X1)
RETURN]
;TRAVERSE BINARY TREE
SHLOOP:
LI X1,0(X1NXT)
CAME X1ID1,YZSE1(X1)
GOTO SHL
CAME X1ID2,YZSE2(X1)
GOTO SHH
RETURN ;IDENTIFIER FOUND
SHL:
CAML X1ID1,YZSE1(X1)
GOTO SHH1
SHL1:
HRR X1NXT,YZSE3(X1)
JUMPG X1NXT,SHLOOP
IFONA YZSE
RETURN ;ZERO
EXEC SHNEW
HRRM X1NXT,YZSE3(X1)
RETURN
SHH:
CAMG X1ID2,YZSE2(X1)
GOTO SHL1
SHH1:
HLR X1NXT,YZSE3(X1)
JUMPG X1NXT,SHLOOP
IFONA YZSE
RETURN ;ZERO
EXEC SHNEW
HRLM X1NXT,YZSE3(X1)
RETURN
EPROC
SUBTTL SHNEW
COMMENT;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
FUNCTION: THIS SUBROUTINE IS CALLED FROM SH WHEN A NEW IDENTIFIER
SHOULD BE INSERTED IN ZSE
ENTRY AND EXIT CONDITIONS:
SAME AS FOR SH
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SHNEW: PROC
L X1NXT,YMAXID
IF AOBJN X1NXT,FALSE
THEN
ERROR(MORE THAN 3072 IDENTIFIERS)
BRANCH T1AB
FI
ST X1NXT,YMAXID
TLZ X1NXT,-1 ;ZERO COUNTER
ST X1ID1,YZSE1(X1NXT)
ST X1ID2,YZSE2(X1NXT)
SETZM YZSE3(X1NXT)
RETURN
EPROC
LIT
END