13
14
15
16
17
18
19
20
21
22
23
27 use dc_trace, only: beginsub, endsub, dbgmessage
28 use dc_string, only: putline, printf, split, strinclude, stoa, joinchar
29 use dc_present, only: present_and_not_empty, present_and_true
32 implicit none
33 type(GTHST_NMLINFO), intent(inout):: gthstnml
34 character(*), intent(in):: name
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49 logical, intent(out), optional:: err
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67 type(GTHST_NMLINFO_ENTRY), pointer:: hptr =>null()
68 type(GTHST_NMLINFO_ENTRY), pointer:: hptr_prev =>null()
69 type(GTHST_NMLINFO_ENTRY), pointer:: hptr_next =>null()
70 character(TOKEN), pointer:: varnames_array(:) =>null()
71 integer:: i, vnmax
72 integer:: stat
73 character(STRING):: cause_c
74 character(*), parameter:: subname = 'HstNmlInfoDelete'
75 continue
76 call beginsub( subname, &
77 & fmt = '@name=%c', &
78 & c1 = trim( name ) )
80 cause_c = ''
81
82
83
84
85
86 if ( .not. gthstnml % initialized ) then
88 cause_c = 'GTHST_NMLINFO'
89 goto 999
90 end if
91
92 if ( .not. gthstnml % define_mode ) then
94 cause_c = 'Delete'
95 goto 999
96 end if
97
98
99
100
101
102 if ( present_and_not_empty(name) ) then
104 call dbgmessage( 'multiple entries (%c) will be deleted', c1 = trim(name) )
106 & carray = varnames_array )
107 vnmax = size( varnames_array )
108
109 do i = 1, vnmax
111 & gthstnml = gthstnml, &
112 & name = varnames_array(i), &
113 & err = err )
114 if ( present_and_true( err ) ) then
115 deallocate( varnames_array )
117 goto 999
118 end if
119 end do
120 deallocate( varnames_array )
121 goto 999
122 end if
123 end if
124
125
126
127
128
129 hptr => gthstnml % gthstnml_list
131 & name = name, &
132 & previous = hptr_prev, &
133 & next = hptr_next )
134
135 if ( .not. associated( hptr ) ) goto 999
136 if ( ( trim(hptr % name) /= '' ) .and. associated( hptr_prev ) ) then
137 call dbgmessage( 'entry (%c) is deleted', c1 = trim( adjustl( name ) ) )
138 hptr_prev % next => hptr_next
139 deallocate( hptr )
140 end if
141
142
143
144
145
146999 continue
147 call storeerror( stat, subname, err, cause_c )
148 call endsub( subname )
recursive subroutine hstnmlinfodelete(gthstnml, name, err)
subroutine, public storeerror(number, where, err, cause_c, cause_i)
integer, parameter, public usr_errno
integer, parameter, public dc_enotinit
integer, parameter, public dc_earglack
integer, parameter, public dc_noerr
integer, parameter, public hst_enotindefine
Provides kind type parameter values.
integer, parameter, public token
Character length for word, token
integer, parameter, public string
Character length for string
integer, parameter, public stdout
Unit number for Standard OUTPUT
integer, parameter, public dp
Double Precision Real number
character(1), parameter, public name_delimiter