SUBROUTINE CMLKUP(TOKEN,NCHARS,TABLE,START,STOP, INDEX) NOLINEUP C C LOOK UP TOKEN IN THE SECTION OF TABLE BOUNDED BY START,STOP C C NOTE THAT AN INPUT TOKEN WILL MATCH THE FIRST TABLE ENTRY C FOR WHICH IT IS AN INITIAL SUBSTRING. THUS, THERE SHOULD C NOT BE TWO OR MORE COMMANDS IN THE SAME TABLE FOR WHICH C ONE IS AN INITIAL SUBSTRING OF ANOTHER. ALSO NOTE THAT C THIS IMPLIES THAT COMMANDS, KEYWORDS, AND NAMES MAY BE C ABBREVIATED TO ANY UNIQUE INITIAL SUBSTRING. C MODIFIED 81-06-23 (JWB) TO: C C . - TREAT UPPER AND LOWER CASE AS EQUAL C . - GIVE A WARNING FOR NON-UNIQUE ABBREVIATION C C INPUTS-- C . TOKEN() - CHARACTERS TO BE LOOKED UP - CHAR*1(NCHARS) C . NCHARS - NUMBER OF CHARACTERS IN TOKEN C . TABLE(,)- TABLE OF CHARACTER STRINGS C . START - FIRST TABLE ENTRY TO CHECK C . STOP - LAST TABLE ENTRY TO CHECK C C OUTPUT-- C . INDEX - INDEX TO TABLE ENTRY WHICH MATCHES TOKEN IF FOUND C . (ZERO IF NOT FOUND) C INCLUDE (SCANLIB.PARAMS) CHARACTER*1 TOKEN(1),TABLE(NAMLEN,1) CHARACTER*1 UPCASE INTEGER NCHARS,START,STOP, INDEX LOGICAL MATCH C INDEX = 0 IF (NCHARS.GT.0) THEN NMAX = MIN0(NCHARS,NAMLEN) I = START DO WHILE (I.LE.STOP) MATCH = .TRUE. DO FOR J = 1,NMAX CALL CMCASE(TOKEN(J), UPCASE) IF (TOKEN(J).NE.TABLE(J,I).AND.UPCASE.NE.TABLE(J,I)) MATCH=.FALSE. END FOR IF (MATCH) THEN IF (INDEX.EQ.0) THEN INDEX = I ELSE C *** ERROR 11 - NON-UNIQUE ABBREVIATION CALL CMERMS(11,TOKEN,NMAX) C *** ERROR 12 - PRINT ASSUMED WORD CALL CMERMS(12,TABLE(1,INDEX),NAMLEN) I = STOP ENDIF ENDIF I = I + 1 END WHILE ENDIF RETURN END