C*---------------------------------------------------------------------* C| G T A R G B : GET CHARACTER ARGUMENT FROM BUFFER (BYTE) | C*---------------------------------------------------------------------* SUBROUTINE GTARGB(INBUF,BUFLOC,MAXBUF,ARGBUF,ARGLEN,MAXARG,ENDCH) C C INBUF - BUFFER TO BE SCANNED C BUFLOC - CURRENT SCAN LOCATION IN BUFFER, UPDATED TO NEXT CHAR C MAXBUF - MAXIMUM LENGTH OF BUFFER C ARGBUF - BUFFER TO CONTAIN ARGUMENT, WILL BE BLANK FILLED C ARGLEN - LENGTH OF ARGUMENT FOUND (0 = NO ARG) C MAXARG - MAX LENGTH OF ARGBUF, SCAN STOPS IF ARGBUF IS FILLED C ENDCH - CHARACTER THAT DELIMITS END OF ARGUMENT IN "INBUF" C C----------------------------------------------- SUBPROGRAM PARAMETERS INTEGER BUFLOC,MAXBUF,ARGLEN,MAXARG BYTE INBUF(1),ARGBUF(MAXARG),ENDCH C----------------------------------------------- LOCAL DATA STRUCTURES INTEGER J C*---------------------------------------------------------------------* C C----------------------------------------------- SET LENGTH TO 0 ARGLEN=0 C----------------------------------------------- BLANK OUT ARGUMENT DO 5 J=1,MAXARG 5 ARGBUF(J) = ' ' C----------------------------------------------- CHECK CURRENT LOCATION IF (BUFLOC .GE. MAXBUF) RETURN C----------------------------------------------- INCREMENT BUFFER LOC BUFLOC = BUFLOC + 1 C----------------------------------------------- SKIP BLANKS DO 10 BUFLOC=BUFLOC,MAXBUF IF (INBUF(BUFLOC) .NE. ' ') GO TO 15 10 CONTINUE RETURN C----------------------------------------------- GET ARGUMENT 15 DO 20 J=BUFLOC,MAXBUF IF (INBUF(J) .EQ. ENDCH) GO TO 99 IF (ARGLEN .GE. MAXARG) GO TO 99 ARGLEN = ARGLEN + 1 20 ARGBUF(ARGLEN) = INBUF(J) C----------------------------------------------- SET TO LAST COLUMN J=MAXBUF+1 C----------------------------------------------- SET BUFFER LOCATION 99 BUFLOC = J - 1 C----------------------------------------------- RETURN RETURN END