| 1 |
C Copyright(C) 1999-2020, 2022 National Technology & Engineering Solutions |
| 2 |
C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with |
| 3 |
C NTESS, the U.S. Government retains certain rights in this software. |
| 4 |
C |
| 5 |
C See packages/seacas/LICENSE for details |
| 6 |
SUBROUTINE FREFLD( KIN,KOUT,PROMPT,MFIELD,IOSTAT,NFIELD,KVALUE, |
| 7 |
* CVALUE,IVALUE,RVALUE ) |
| 8 |
CHARACTER*(*) PROMPT,CVALUE(MFIELD) |
| 9 |
CHARACTER*1024 LINE |
| 10 |
CHARACTER*132 PREFIX |
| 11 |
INTEGER KVALUE(MFIELD),IVALUE(MFIELD) |
| 12 |
REAL RVALUE(MFIELD) |
| 13 |
|
| 14 |
************************************************************************ |
| 15 |
|
| 16 |
C FREFLD INPUT SYSTEM - ANSI FORTRAN - USER INTERFACE ROUTINE |
| 17 |
|
| 18 |
C DESCRIPTION: |
| 19 |
C This routine is the main user interface to the SUPES Free Field |
| 20 |
C Input system. It obtains a record from the input stream, then |
| 21 |
C call FFISTR to parse the record into data fields. |
| 22 |
|
| 23 |
C FORMAL PARAMETERS: |
| 24 |
C KIN INTEGER Unit from which to read input. |
| 25 |
C KOUT INTEGER Unit to which to echo input. |
| 26 |
C PROMPT CHARACTER Prompt string. |
| 27 |
C MFIELD INTEGER Maximum number of data fields to be returned. |
| 28 |
C IOSTAT INTEGER ANSI FORTRAN I/O status. |
| 29 |
C NFIELD INTEGER Number of data fields found. |
| 30 |
C KVALUE INTEGER Translation states of the data fields: |
| 31 |
C -1 = This is a null field. |
| 32 |
C 0 = This is a non-numeric field. |
| 33 |
C 1 = This is a REAL numeric field. |
| 34 |
C 2 = This is an INTEGER numeric field. |
| 35 |
C CVALUE CHARACTER Character values of the data fields. |
| 36 |
C RVALUE REAL Floating-point values of the data fields. |
| 37 |
C IVALUE INTEGER Integer values of the data fields. |
| 38 |
|
| 39 |
C ROUTINES CALLED: |
| 40 |
C GETINP Get input line. |
| 41 |
C FFISTR Parse input line. |
| 42 |
|
| 43 |
************************************************************************ |
| 44 |
|
| 45 |
C PHASE 1: Initialize output arrays to their default values and zero |
| 46 |
C field counter. Set continuation flag to suppress further |
| 47 |
C initialization by FFISTR. |
| 48 |
|
| 49 |
DO 300 I = 1 , MFIELD |
| 50 |
KVALUE(I) = -1 |
| 51 |
CVALUE(I) = ' ' |
| 52 |
RVALUE(I) = 0. |
| 53 |
IVALUE(I) = 0 |
| 54 |
300 CONTINUE |
| 55 |
NFIELD = 0 |
| 56 |
IDCONT = 1 |
| 57 |
|
| 58 |
C Initialize prompt to the caller's - |
| 59 |
PREFIX = PROMPT |
| 60 |
LPRE = LEN( PROMPT ) |
| 61 |
|
| 62 |
************************************************************************ |
| 63 |
|
| 64 |
C PHASE 2: Get the next input record via GETINP. Return to caller if an |
| 65 |
C end-of-file or error was detected by GETINP. |
| 66 |
C Re-enter here to process a continuation line. |
| 67 |
|
| 68 |
500 CONTINUE |
| 69 |
|
| 70 |
C Get the next input line - |
| 71 |
CALL GETINP( KIN,KOUT,PREFIX(1:LPRE),LINE,IOSTAT ) |
| 72 |
|
| 73 |
C Return if I/O error or EOF detected - |
| 74 |
IF ( IOSTAT .NE. 0 ) RETURN |
| 75 |
|
| 76 |
C Call FFISTR to parse input record - |
| 77 |
CALL FFISTR( LINE,MFIELD,IDCONT,NFIELD,KVALUE,CVALUE,IVALUE, |
| 78 |
* RVALUE ) |
| 79 |
|
| 80 |
C If the continuation flag is set, define a continuation prompt and |
| 81 |
C re-enter at phase 2. Otherwise, return to the caller - |
| 82 |
IF ( IDCONT .NE. 0 ) THEN |
| 83 |
IF ( PROMPT .EQ. 'AUTO' ) THEN |
| 84 |
PREFIX = ' *: ' |
| 85 |
LPRE = 6 |
| 86 |
ELSE |
| 87 |
IF ( LPRE .GT. 3 ) PREFIX(1:LPRE-3) = ' ' |
| 88 |
IF ( LPRE .GE. 3 ) PREFIX(LPRE-2:LPRE-2) = '*' |
| 89 |
END IF |
| 90 |
GO TO 500 |
| 91 |
END IF |
| 92 |
|
| 93 |
END |