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
       LOGICAL PROMPT
       COMMON /MYRCOM/ PROMPT
       COMMON /BLKCOM/ BLKLIN
C      REAL*8 TXT,WDS,KK
       CHARACTER*8 TXT, WDS, KK
       CHARACTER TERM
      LOGICAL ACTIVE
      INTEGER*4 MESSGS
      CHARACTER TEXT
      COMMON/LNKCOM/ACTIVE(32),USER(15,32),MESSGS(32),MONITO(32),
     1 TEXT(70,32)
      COMMON/WRUCOM/ME
       COMMON /UTXCOM/ TXT(35,2),WDX
       CHARACTER CHRS
       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()
 2      FORMAT('>',$) ! so I gather, $ means no newline...
 3      FORMAT('INPUT:')

        IF(PROMPT) THEN
           WRITE(*,2)
        ELSE
           WRITE(*,3)
        END IF

C30      READ (1,50)CHRS
        CALL FLUSH() ! to fix tcl script
30      READ (*,50)CHRS
50      FORMAT(70A1)
      IF(MONITO(ME).EQ.0)GOTO 40
C      CALL SEM$WT(MONITO(ME),CODE)
C I HAVE NO IDEA WHAT THE ABOVE LINE DOES, SINCE THE MONITORING STUFF ISN'T
C IMPORTANT (TO ME) I'M REMOVING IT IN HOPE THAT IT'S OK -- MYRKRAVERK
      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)
C       IF((TERM.EQ.'; '.OR.TERM.EQ.0).AND.WDX.EQ.0)GOTO 20
       IF((TERM.EQ.';'.OR.TERM.EQ.CHAR(0)).AND.WDX.EQ.0)GOTO 20 !WARNING!!!
       KK=WDS(1)
       IF(KK.NE.'THE     '.AND.KK.NE.'AN      '.AND.KK.NE.'A       ')
     1  GOTO 110
C       IF(TERM.EQ.'  ')GOTO 100
       IF(TERM.EQ.' ')GOTO 100 !!WARNING!!!!
       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)
C120     IF(TERM.EQ.'  ')GOTO 100
120     IF(TERM.EQ.' ')GOTO 100 !WARNING!!!!!
C       IF(TERM.EQ.0.OR.TERM.EQ.'; ')RETURN
       IF(TERM.EQ.CHAR(0).OR.TERM.EQ.';')RETURN
C       IF(TERM.NE.', '.AND.TERM.NE.'. ')CALL BUG(31)
       IF(TERM.NE.','.AND.TERM.NE.'.')CALL BUG(31)
       WDX=WDX+1
       TXT(WDX,1)='AND     '
       TXT(WDX,2)='        ' !????
C       TXT(WDX,2)=0
       GOTO 100

       END
