      SUBROUTINE ENTER
C+
C  FORTRAN SUBROUTINE TO UPDATE THE SYMBOL TABLE
C  FOR XREF. THIS ROUTINE IS CALLED BY THE MAIN
C  LOOP UPON ENCOUNTERING A SYMBOL OR STATEMENT
C  NUMBER. THE FOLLOWING VALUES ARE SET (IN COMMON)
C
C     JSYM (INTEGER*4) = SYMBOL PACKED IN RADIX 50
C     FROM TOP DOWN AND REFERENCE ELEMENTS ARE ADDED FROM
C     NSTMT=CURRENT STATEMENT NUMBER
C     ICLASS=TYPE OF REFERENCE
C
C     SYMBOL TABLE IS MADE UP OF N 4 WORD (16 BIT)
C     "ELEMENTS". AN ELEMENT IS USED TO HOLD A
C     SYMBOL DEFINITION OR UP TO 3 REFERENCE TO
C     THAT SYMBOL. THEY ARE REFERED TO AS "DEFINITION" OR
C     "REFERENCE" ELEMENTS. "DEFINITION" ELEMENTS ARE ALLOCATED
C     BOTTOM UP. ALL RELATED ELEMENTS ARE LINKED VIA
C     THEIR FIRST WORD WITH THE ORIGIN OF THE LIST IN
C     THE "DEFINITION" ELEMENT.
C     "DEFINITION" ELEMENTS ARE ENTERED IN ALPHABETICAL
C     (NUMERIC) ORDER.
C
C     REFERENCES TO A SYMBOL ARE STORED IN A 16 BIT
C     FIELD:
C         CLASS=[15:11]    TYPES 1-31
C         NSTMT=[10:0]     RECORD 1-2047
C
C     MAX PROGRAM SIZE 12 2K STATEMENTS
C     (NOT COUNTING COMMENT CARDS)
C
C-
C
      IMPLICIT LOGICAL*1 (B)
      DOUBLE PRECISION SYMBOL
      COMMON/PARAMS/LUNIN,LUNOUT,LUNCMD,BTAB,BSPC,NLINE,NSTMT,
     1ICLASS,BCHR,BLST,JSYM(2),NSYMTP,IPARNS,NPAGE
      COMMON /INBUFR/INSIZ,INCNT,IOUTX,MCRSIZ,INFIL,IOUTFL,
     1BDPB(2),BUFR(80),BNAM(24),BTIME(8),BDATE(9),BX(1)
      COMMON NSYM,NELM,KLIM,SYMBOL(1000)
C
C
C
C***FIRST CK FOR NULL ENTRY
C
	IF(JSYM(1).NE.0) GOTO 10
	IF(JSYM(2).EQ.0) GOTO 99	!EXIT IF NO SYMBOL
10	CONTINUE
C***NOW---GENERATE SYMBOL TABLE ENTRY
C
	IF(NELM.EQ.0) GOTO 99	!FORGET IT IF SYMTAB FULL
      ICODE=IOR(IISHFT(ICLASS,11),NSTMT)
C
C
C  NOW-SEE IF SYMBOL DEFINED
C
      CALL SRCTBL(SYMBOL,JSYM,NSYM,IADR,IFLG)
      IF (IFLG.NE. 0) GOTO 30      !IF DEFINED ADD REFERENCE
C
C  NEW SYMBOL-MAKE ENTRY
C
      IF(NSYM.LT.NELM) GOTO 20
      NELM=0			!FLAG TABLE OVERFLOW
      GOTO 99			!AND FORGET IT
20    CALL MAKENT(SYMBOL,JSYM,NSYM,IADR,ICODE)
      NSYM=NSYM+1        !COUNT UP NUMBER
      GO TO 50
C
C  OLD SYMBOL---ADD REFERENCE
C
 30   CALL ADDREF(SYMBOL,ICODE,NELM,IADR)
C
C  NOW---CHECK IF TABLE FILLED!
C
50	CONTINUE
99	RETURN
C
C
      END
