Loading...
Searching...
No Matches
Functions/Subroutines
hstnmlinfodelete.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

recursive subroutine hstnmlinfodelete (gthstnml, name, err)
 

Function/Subroutine Documentation

◆ hstnmlinfodelete()

recursive subroutine hstnmlinfodelete ( type(gthst_nmlinfo), intent(inout)  gthstnml,
character(*), intent(in)  name,
logical, intent(out), optional  err 
)

Definition at line 10 of file hstnmlinfodelete.f90.

13 !
14 ! 変数の出力情報を削除します.
15 !
16 ! なお, 与えられた *gthstnml* が HstNmlInfoCreate によって初期設定
17 ! されていない場合, プログラムはエラーを発生させます.
18 !
19 ! Delete output information of a variable.
20 !
21 ! If *gthstnml* is not initialized by "HstNmlInfoCreate" yet,
22 ! error is occurred.
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
30 use dc_types, only: dp, string, token, stdout
32 implicit none
33 type(GTHST_NMLINFO), intent(inout):: gthstnml
34 character(*), intent(in):: name
35 ! 変数名.
36 !
37 ! 先頭の空白は無視されます.
38 !
39 ! "Data1,Data2" のようにカンマで区切って複数
40 ! の変数を指定することが可能です.
41 !
42 ! Variable identifier.
43 !
44 ! Blanks at the head of the name are ignored.
45 !
46 ! Multiple variables can be specified
47 ! as "Data1,Data2". Delimiter is comma.
48 !
49 logical, intent(out), optional:: err
50 ! 例外処理用フラグ.
51 ! デフォルトでは, この手続き内でエラーが
52 ! 生じた場合, プログラムは強制終了します.
53 ! 引数 *err* が与えられる場合,
54 ! プログラムは強制終了せず, 代わりに
55 ! *err* に .true. が代入されます.
56 !
57 ! Exception handling flag.
58 ! By default, when error occur in
59 ! this procedure, the program aborts.
60 ! If this *err* argument is given,
61 ! .true. is substituted to *err* and
62 ! the program does not abort.
63
64 !-----------------------------------
65 ! 作業変数
66 ! Work variables
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 ) )
79 stat = dc_noerr
80 cause_c = ''
81
82 !-----------------------------------------------------------------
83 ! 初期設定のチェック
84 ! Check initialization
85 !-----------------------------------------------------------------
86 if ( .not. gthstnml % initialized ) then
87 stat = dc_enotinit
88 cause_c = 'GTHST_NMLINFO'
89 goto 999
90 end if
91
92 if ( .not. gthstnml % define_mode ) then
93 stat = hst_enotindefine
94 cause_c = 'Delete'
95 goto 999
96 end if
97
98 !-----------------------------------------------------------------
99 ! 複数の変数を削除する場合
100 ! Delete multiple variables
101 !-----------------------------------------------------------------
102 if ( present_and_not_empty(name) ) then
103 if ( index(name, name_delimiter) > 0 ) then
104 call dbgmessage( 'multiple entries (%c) will be deleted', c1 = trim(name) )
105 call split( str = name, sep = name_delimiter, & ! (in)
106 & carray = varnames_array ) ! (out)
107 vnmax = size( varnames_array )
108
109 do i = 1, vnmax
110 call hstnmlinfodelete( &
111 & gthstnml = gthstnml, & ! (inout)
112 & name = varnames_array(i), & ! (in)
113 & err = err ) ! (out)
114 if ( present_and_true( err ) ) then
115 deallocate( varnames_array )
116 stat = usr_errno
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 ! *gthstnml* の情報を削除.
127 ! Delete information in *gthstnml*
128 !-----------------------------------------------------------------
129 hptr => gthstnml % gthstnml_list
130 call listsearch( gthstnml_list = hptr, & ! (inout)
131 & name = name, & ! (in)
132 & previous = hptr_prev, & ! (out)
133 & next = hptr_next ) ! (out)
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 ! Termination and Exception handling
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)
Definition dc_error.f90:830
integer, parameter, public usr_errno
Definition dc_error.f90:604
integer, parameter, public dc_enotinit
Definition dc_error.f90:557
integer, parameter, public dc_earglack
Definition dc_error.f90:569
integer, parameter, public dc_noerr
Definition dc_error.f90:509
integer, parameter, public hst_enotindefine
Definition dc_error.f90:581
種別型パラメタを提供します。
Definition dc_types.f90:49
integer, parameter, public stdout
標準出力の装置番号
Definition dc_types.f90:98
integer, parameter, public token
単語やキーワードを保持する文字型変数の種別型パラメタ
Definition dc_types.f90:109
integer, parameter, public dp
倍精度実数型変数
Definition dc_types.f90:83
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition dc_types.f90:118
character(1), parameter, public name_delimiter

References dc_error::dc_earglack, dc_error::dc_enotinit, dc_error::dc_noerr, dc_types::dp, dc_error::hst_enotindefine, hstnmlinfodelete(), gtool_history_nmlinfo_internal::name_delimiter, dc_types::stdout, dc_error::storeerror(), dc_types::string, dc_types::token, and dc_error::usr_errno.

Here is the call graph for this function: