Debian Codegraph @

packages/seacas/applications/explore/exp_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 C=======================================================================
7 SUBROUTINE RIXWRD (INLINE, IFLD, INTYP, CFIELD,
8 & SELMSG, LLIST, LIST, NUMSEL, IXSEL, *)
9 C=======================================================================
10
11 C --*** RIXWRD *** (BLOT) Parse selection command
12 C --
13 C --RIXWRD selects the items listed in the command. If there are no
14 C --fields, all items are selected. If the first field is ADD, the
15 C --items are added to the items already selected, otherwise
16 C --only the listed items are selected.
17 C --
18 C --Parameters:
19 C -- INLINE - IN/OUT - the parsed input line for the log file
20 C -- IFLD - IN/OUT - the number of the next entry to scan, incremented
21 C -- INTYP - IN - the free-format field types
22 C -- -1 = none, 0 = name, 1 = real, 2 = integer, 3 = character
23 C -- CFIELD - IN - the scanned character line entries
24 C -- SELMSG - IN - the type of item for error messages
25 C -- LLIST - IN - the number of words in LIST
26 C -- LIST - IN - the list of words which may be in the range
27 C -- NUMSEL - OUT - the number of selected words
28 C -- IXSEL - OUT - the indices of the selected words
29 C -- * - return statement if error before any items selected
30
31 include 'exodusII.inc'
32 CHARACTER*(*) INLINE
33 INTEGER INTYP(*)
34 CHARACTER*(*) CFIELD(*)
35 CHARACTER*(*) SELMSG
36 CHARACTER*(*) LIST(*)
37 INTEGER IXSEL(*)
38
39 LOGICAL FFEXST, FFMATC
40 CHARACTER*80 ERRMSG
41 CHARACTER*(MXNAME) WORD
42 LOGICAL REMOVE
43
44 REMOVE = .FALSE.
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 IF (FFMATC (IFLD, INTYP, CFIELD, 'REMOVE', 3)) THEN
68 CALL FFADDC ('REMOVE', INLINE)
69 REMOVE = .TRUE.
70 NUMSEL = LLIST
71 DO 110 I = 1, LLIST
72 IXSEL(I) = I
73 110 CONTINUE
74 ELSE
75 NUMSEL = 0
76 END IF
77
78 200 CONTINUE
79 IF (FFEXST (IFLD, INTYP)) THEN
80
81 C --Read word of range
82
83 CALL FFCHAR (IFLD, INTYP, CFIELD, ' ', WORD)
84
85 C --Find word in list and set range
86
87 IX = LOCSTR (WORD, LLIST, LIST)
88 IF (IX .LE. 0) THEN
89 ERRMSG = '"' // WORD(:LENSTR(WORD)) //
90 & '" is an invalid ' // SELMSG // ', ignored'
91 CALL PRTERR ('CMDERR', ERRMSG(:LENSTR(ERRMSG)))
92 GOTO 200
93 END IF
94 iloc = LOCINT (IX, NUMSEL, IXSEL)
95 IF (iloc .LE. 0) THEN
96 CALL FFADDC (WORD, INLINE)
97 NUMSEL = NUMSEL + 1
98 IXSEL(NUMSEL) = IX
99 ELSE IF (REMOVE) THEN
100 CALL FFADDC (WORD, INLINE)
101 DO 120 i = iloc, numsel-1
102 ixsel(i) = ixsel(i+1)
103 120 continue
104 NUMSEL = NUMSEL - 1
105 END IF
106
107 GOTO 200
108 END IF
109
110 IF (NUMSEL .EQ. 0) THEN
111 ERRMSG = 'No ' // SELMSG // 's are selected'
112 CALL PRTERR ('CMDWARN', ERRMSG(:LENSTR(ERRMSG)))
113 END IF
114 END IF
115
116 RETURN
117 END