C***   GETLIN

       SUBROUTINE GETLIN

C  SUCKS UP A LINE FROM THE TTY, THEN CALLS A1TOA5 TO SEPARATE
C  OUT EACH WORD (AND MAKE SURE IT'S ALL UPPER CASE).  THE TEXT OF
C  EACH WORD IS MOVED INTO AN ARRAY (TXT(I,J), FOR HIGHER
C  LEVEL ANALYSIS.  A LINE IS TERMINATED
C  WHEN A WORD=ZERO IS RETURNED.  INTRA-LINE CLAUSE TERMINATORS, LIKE
C  COMMA, PERIOD AND 'AND', ARE MOVED INTO THE TXT VECTOR AS 'AND'.
C  AN UNEXPECTED TERMINATOR IS CAUSE FOR ALARM.
C  THE ONLY OTHER PRE-PROCESSING THAT IS DONE IS TO FLUSH ALL
C  OCCURRENCES OF "THE", "AN" AND "A".  IF THE LINE ENDS WITH ANY
C  OF THESE, AN ERROR MESSAGE IS PRINTED AND THE WHOLE LINE IS FLUSHED.

       IMPLICIT INTEGER(A-Z)
       LOGICAL BLKLIN
       COMMON /BLKCOM/ BLKLIN
      REAL*8 TXT,WDS,KK
      LOGICAL ACTIVE
      INTEGER*4 MESSGS
      COMMON/LNKCOM/ACTIVE(32),USER(15,32),MESSGS(32),MONITO(32),
     1 TEXT(70,32)
      COMMON/WRUCOM/ME
       COMMON /UTXCOM/ TXT(35,2),WDX
       DIMENSION CHRS(70),WDS(2)

10      DO 15 I=1,35
       DO 15 J=1,2
15      TXT(I,J)='        '

20      IF(BLKLIN)PRINT 1
1       FORMAT()


30      READ (1,50)CHRS
50      FORMAT(70A1)
      IF(MONITO(ME).EQ.0)GOTO 40
      CALL SEM$WT(MONITO(ME),CODE)
      DO 31 I=1,70
31    TEXT(I,ME)=CHRS(I)
      MESSGS(ME)=-1
40     CINDEX=1
       WDX=0
100     CALL A1TOA5(CHRS,CINDEX,WDS,TERM)
       IF((TERM.EQ.'; '.OR.TERM.EQ.0).AND.WDX.EQ.0)GOTO 20
       KK=WDS(1)
       IF(KK.NE.'THE     '.AND.KK.NE.'AN      '.AND.KK.NE.'A       ')
     1  GOTO 110
       IF(TERM.EQ.'  ')GOTO 100
       LL=CONFUZ(0)
       CALL RSPEAK(LL)
       GOTO 10

110     IF(WDS(1).EQ.'        ')GOTO 120
       WDX=WDX+1
       TXT(WDX,1)=WDS(1)
       TXT(WDX,2)=WDS(2)
120     IF(TERM.EQ.'  ')GOTO 100
       IF(TERM.EQ.0.OR.TERM.EQ.'; ')RETURN
       IF(TERM.NE.', '.AND.TERM.NE.'. ')CALL BUG(31)
       WDX=WDX+1
       TXT(WDX,1)='AND     '
       TXT(WDX,2)=0
       GOTO 100

       END
