TITLE LNKHSH - SYMBOL TABLE HASH SEARCH
SUBTTL D.M.NIXON/DMN/JLd/JNG/DZN/PAH/PY/HD 28-May-86
;COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1973,1986. ALL RIGHTS RESERVED.
;[2403]
;
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
;ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND 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. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY
;TRANSFERRED.
;
;
;THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE
;AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT
;CORPORATION.
;
;DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS
;SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.
SEARCH LNKPAR,LNKLOW,MACTEN,UUOSYM,SCNMAC
SALL
ENTRY TRYSYM
CUSTVR==0 ;CUSTOMER VERSION
DECVER==6 ;DEC VERSION
DECMVR==0 ;DEC MINOR VERSION
DECEVR==2403 ;DEC EDIT VERSION
SEGMENT

SUBTTL REVISION HISTORY
;START OF VERSION 2
;135 ADD OVERLAY FACILITY
;162 CHECK FOR CALLING TRYSYM WITH 0 NAME
;START OF VERSION 2B
;271 Suppress searching Bound Globals when rehashing
;272 Continue to issue "RGS" message only if user could
; have done something about it -- changed /HASHSIZE.
;404 Insert edit 340, which vanished.
;START OF VERSION 2C
;476 Insert missing FTOVERLAY conditionals.
;477 Count bound globals when computing HSPACE after rehashing.
;530 Get triplet flags definitions right
;557 Clean up the listing for release.
;START OF VERSION 3A
;560 Release on both TOPS-10 and TOPS-20 as LINK version 3A(560)
;START OF VERSION 4
;731 SEARCH MACTEN,UUOSYM
;765 Release on both TOPS-10 and TOPS-20 as LINK version 4(765)
;START OF VERSION 4A
;1174 Label and clean up all error messages.
;1217 Clean up the listings for release.
;1220 Release on both TOPS-10 and TOPS-20 as version 4A(1220).
;Start of Version 5.1
;2026 Update copyright notice.
;Start of Version 6
;2216 Handle long symbols in TRYSYM.
;2267 Fix problem with short symbol passed as long symbol.
;2275 Don't allow long symbol hash to produce zero value.
;2403 New corporate Copywrite statement.

SUBTTL SYMBOL TABLE HASH SEARCH
;ONE AUXILIARY TABLE IS USED (HASHTB)
; LH - 18 BIT HASH TOTAL FOR SYMBOL
; RH - LOCATION OF THE WORD IN NAMTAB, RELATIVE TO
; THE START OF NAMTAB
; NAMTAB - THE NAMES, IN SIXBIT (USUALLY GS.LB)
;AN ATTEMPT IS MADE TO FIND AN ENTRY MATCHING NAMWRD IN THE FOLLOWING MANNER:
; 1) HASH-TOTAL NAMWRD BY XORING ALL THE WORDS TOGETHER, THEN XORING THE
; HALVES OF THE RESULT.
; 2) DIVIDE THE HASH-TOTAL BY THE SIZE OF HASHTB (HT.PRM)
; THE QUOTIENT BECOMES Q, THE REMAINDER R(0).
; 3) IF LH HASHTB (R) IS UNEQUAL TO THE HASH-TOTAL, GO TO STEP 5.
; 4) IF THE NAMTAB ENTRY, WHOSE RELATIVE ADDRESS IS IN THE RH OF
; HASHTB (R), IS EQUAL TO NAMWRD, THE MATCH IS MADE
; AND THE ROUTINE EXITS; ELSE GO TO STEP 6.
; 5) IF HASHTB (R) IS ZERO, THERE IS NO MATCHING ENTRY.
; 6) COMPUTE A NEW R BY ADDING Q TO R. NOTE THAT
; R(I) = R(0) + Q*I
; 7) STEPS 3 THRU 6 ARE EXECUTED "HT.PRM" TIMES, THEN NO MORE
; ATTEMPTS ARE MADE.