gtool5 Fortran 90/95 ライブラリ 1.0.0-rc5
English
Loading...
Searching...
No Matches
hstnmlinfodelete.f90
Go to the documentation of this file.
1
14
39 recursive subroutine hstnmlinfodelete( gthstnml, &
40 & name, &
41 & err )
45 use dc_string, only: split
47 use dc_types, only: string, token
49 implicit none
50 type(gthst_nmlinfo), intent(inout):: gthstnml
51 character(*), intent(in):: name
52 ! 変数名.
53 !
54 ! 先頭の空白は無視されます.
55 !
56 ! "Data1,Data2" のようにカンマで区切って複数
57 ! の変数を指定することが可能です.
58 !
59 ! Variable identifier.
60 !
61 ! Blanks at the head of the name are ignored.
62 !
63 ! Multiple variables can be specified
64 ! as "Data1,Data2". Delimiter is comma.
65 !
66 logical, intent(out), optional:: err
67 ! 例外処理用フラグ.
68 ! デフォルトでは, この手続き内でエラーが
69 ! 生じた場合, プログラムは強制終了します.
70 ! 引数 *err* が与えられる場合,
71 ! プログラムは強制終了せず, 代わりに
72 ! *err* に .true. が代入されます.
73 !
74 ! Exception handling flag.
75 ! By default, when error occur in
76 ! this procedure, the program aborts.
77 ! If this *err* argument is given,
78 ! .true. is substituted to *err* and
79 ! the program does not abort.
80
81 !-----------------------------------
82 ! 作業変数
83 ! Work variables
84 type(gthst_nmlinfo_entry), pointer:: hptr =>null()
85 type(gthst_nmlinfo_entry), pointer:: hptr_prev =>null()
86 type(gthst_nmlinfo_entry), pointer:: hptr_next =>null()
87 character(TOKEN), pointer:: varnames_array(:) =>null()
88 integer:: i, vnmax
89 integer:: stat
90 character(STRING):: cause_c
91 character(*), parameter:: subname = 'HstNmlInfoDelete'
92 continue
93 call beginsub( subname, &
94 & fmt = '@name=%c', &
95 & c1 = trim( name ) )
96 stat = dc_noerr
97 cause_c = ''
98
99 !-----------------------------------------------------------------
100 ! 初期設定のチェック
101 ! Check initialization
102 !-----------------------------------------------------------------
103 if ( .not. gthstnml % initialized ) then
104 stat = dc_enotinit
105 cause_c = 'GTHST_NMLINFO'
106 goto 999
107 end if
108
109 if ( .not. gthstnml % define_mode ) then
110 stat = hst_enotindefine
111 cause_c = 'Delete'
112 goto 999
113 end if
114
115 !-----------------------------------------------------------------
116 ! 複数の変数を削除する場合
117 ! Delete multiple variables
118 !-----------------------------------------------------------------
119 if ( present_and_not_empty(name) ) then
120 if ( index(name, name_delimiter) > 0 ) then
121 call dbgmessage( 'multiple entries (%c) will be deleted', c1 = trim(name) )
122 call split( str = name, sep = name_delimiter, & ! (in)
123 & carray = varnames_array ) ! (out)
124 vnmax = size( varnames_array )
125
126 do i = 1, vnmax
127 call hstnmlinfodelete( &
128 & gthstnml = gthstnml, & ! (inout)
129 & name = varnames_array(i), & ! (in)
130 & err = err ) ! (out)
131 if ( present_and_true( err ) ) then
132 deallocate( varnames_array )
133 stat = usr_errno
134 goto 999
135 end if
136 end do
137 deallocate( varnames_array )
138 goto 999
139 end if
140 end if
141
142 !-----------------------------------------------------------------
143 ! *gthstnml* の情報を削除.
144 ! Delete information in *gthstnml*
145 !-----------------------------------------------------------------
146 hptr => gthstnml % gthstnml_list
147 call listsearch( gthstnml_list = hptr, & ! (inout)
148 & name = name, & ! (in)
149 & previous = hptr_prev, & ! (out)
150 & next = hptr_next ) ! (out)
151
152 if ( .not. associated( hptr ) ) goto 999
153 if ( ( trim(hptr % name) /= '' ) .and. associated( hptr_prev ) ) then
154 call dbgmessage( 'entry (%c) is deleted', c1 = trim( adjustl( name ) ) )
155 hptr_prev % next => hptr_next
156 deallocate( hptr )
157 end if
158
159 !-----------------------------------------------------------------
160 ! 終了処理, 例外処理
161 ! Termination and Exception handling
162 !-----------------------------------------------------------------
163999 continue
164 call storeerror( stat, subname, err, cause_c )
165 call endsub( subname )
166 end subroutine hstnmlinfodelete
recursive subroutine hstnmlinfodelete(gthstnml, name, err)
エラー処理用モジュール
Definition dc_error.f90:454
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:891
integer, parameter, public usr_errno
-1000 以下: ユーザー定義
Definition dc_error.f90:579
integer, parameter, public dc_noerr
エラー等を保持
Definition dc_error.f90:468
integer, parameter, public dc_enotinit
-400 以下: dc ユーティリティのエラー
Definition dc_error.f90:534
integer, parameter, public hst_enotindefine
-500 以下: データ入出力層のエラー
Definition dc_error.f90:557
省略可能な制御パラメータの判定
logical function, public present_and_not_empty(arg)
logical function, public present_and_true(arg)
文字型変数の操作
Definition dc_string.f90:83
デバッグ時の追跡用モジュール
Definition dc_trace.f90:150
subroutine, public dbgmessage(fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:661
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
Definition dc_trace.f90:457
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:580
種別型パラメタを提供します。
Definition dc_types.f90:55
integer, parameter, public token
単語やキーワードを保持する文字型変数の種別型パラメタ
Definition dc_types.f90:128
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition dc_types.f90:137
character(1), parameter, public name_delimiter