Debian Codegraph @

packages/seacas/applications/blot/rixwrd.f

raw
1 C Copyright(C) 1999-2020 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
7 C=======================================================================
8 SUBROUTINE RIXWRD (INLINE, IFLD, INTYP, CFIELD,
9 & SELMSG, LLIST, LIST, NUMSEL, IXSEL, *)
10 C=======================================================================
11
12 C --*** RIXWRD *** (BLOT) Parse selection command
13 C -- Written by Amy Gilkey - revised 05/17/88
14 C --
15 C --RIXWRD selects the items listed in the command. If there are no
16 C --fields, all items are selected. If the first field is ADD, the
17 C --items are added to the items already selected, otherwise
18 C --only the listed items are selected.
19 C --
20 C --Parameters:
21 C -- INLINE - IN/OUT - the parsed input line for the log file
22 C -- IFLD - IN/OUT - the number of the next entry to scan, incremented
23 C -- INTYP - IN - the free-format field types
24 C -- -1 = none, 0 = name, 1 = real, 2 = integer, 3 = character
25 C -- CFIELD - IN - the scanned character line entries
26 C -- SELMSG - IN - the type of item for error messages
27 C -- LLIST - IN - the number of words in LIST
28 C -- LIST - IN - the list of words which may be in the range
29 C -- NUMSEL - OUT - the number of selected words
30 C -- IXSEL - OUT - the indices of the selected words
31 C -- * - return statement if error before any items selected
32
33 include 'params.blk'
34 CHARACTER*(*) INLINE
35 INTEGER INTYP(*)
36 CHARACTER*(*) CFIELD(*)
37 CHARACTER*(*) SELMSG
38 CHARACTER*(*) LIST(*)
39 INTEGER IXSEL(*)
40
41 LOGICAL FFEXST, FFMATC
42 CHARACTER*80 ERRMSG
43 CHARACTER*(MXNAME) WORD
44
45 IF (.NOT. FFEXST (IFLD, INTYP)) THEN
46
47 C --Select all items if no fields
48
49 NUMSEL = LLIST
50 DO 100 I = 1, LLIST
51 IXSEL(I) = I
52 100 CONTINUE
53
54 ELSE IF (FFMATC (IFLD, INTYP, CFIELD, 'OFF', 3)) THEN
55
56 C --Select no items if OFF
57
58 CALL FFADDC ('OFF', INLINE)
59 NUMSEL = 0
60
61 ELSE
62
63 C --Reset to none selected unless ADD
64
65 IF (FFMATC (IFLD, INTYP, CFIELD, 'ADD', 3)) THEN
66 CALL FFADDC ('ADD', INLINE)
67 ELSE
68 NUMSEL = 0
69 END IF
70
71 110 CONTINUE
72 IF (FFEXST (IFLD, INTYP)) THEN
73
74 C --Read word of range
75
76 CALL FFCHAR (IFLD, INTYP, CFIELD, ' ', WORD)
77
78 C --Find word in list and set range
79
80 IX = LOCSTR (WORD, LLIST, LIST)
81 IF (IX .LE. 0) THEN
82 ERRMSG = '"' // WORD(:LENSTR(WORD)) //
83 & '" is an invalid ' // SELMSG // ', ignored'
84 CALL PRTERR ('CMDERR', ERRMSG(:LENSTR(ERRMSG)))
85 ELSE IF (LOCINT (IX, NUMSEL, IXSEL) .LE. 0) THEN
86 CALL FFADDC (WORD, INLINE)
87 NUMSEL = NUMSEL + 1
88 IXSEL(NUMSEL) = IX
89 END IF
90
91 GOTO 110
92 END IF
93
94 IF (NUMSEL .EQ. 0) THEN
95 ERRMSG = 'No ' // SELMSG // 's are selected'
96 CALL PRTERR ('CMDWARN', ERRMSG(:LENSTR(ERRMSG)))
97 END IF
98 END IF
99
100 RETURN
101 END