gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
hstnmlinfosetvalidname.f90
Go to the documentation of this file.
1!> @file hstnmlinfosetvalidname.f90
2!>
3!> @author Yasuhiro MORIKAWA
4!> @copyright Copyright (C) GFD Dennou Club, 2007-2026. All rights reserved. <br/>
5!> License is BSD-2-Clause. See [COPYRIGHT](@ref COPYRIGHT) in detail
6!>
7!> @en
8!> @brief Set validation to variable names
9!> @enden
10!>
11!> @ja
12!> @brief 変数名の有効性を設定
13!> @endja
14
15 !> @en
16 !> @brief Set validation to variable names
17 !>
18 !> For detection of invalid variable names,
19 !> set validation to variable names explicitly by this
20 !> subroutine.
21 !>
22 !> If @p gthstnml is not initialized by HstNmlInfoCreate yet,
23 !> error is occurred.
24 !> @enden
25 !>
26 !> @ja
27 !> @brief 変数名の有効性を設定
28 !>
29 !> 無効な変数名を検知するため, このサブルーチンで
30 !> 有効な変数に対しては明示的に設定を行います.
31 !>
32 !> なお, 与えられた @p gthstnml が HstNmlInfoCreate によって初期設定
33 !> されていない場合, プログラムはエラーを発生させます.
34 !> @endja
35 !>
36 !> @param[in] gthstnml gtool_history_nmlinfo_types::GTHST_NMLINFO 型変数
37 !> @param[in] name 有効であることを設定する変数名.
38 !> "Data1,Data2" のようにカンマで区切って複数指定可能.
39 !> A variable name that is set validation.
40 !> Multiple variables can be specified as "Data1,Data2".
41 !> @param[out] err 例外処理用フラグ. Exception handling flag.
42 subroutine hstnmlinfosetvalidname( gthstnml, &
43 & name, &
44 & err )
48 use dc_trace, only: beginsub, endsub
49 use dc_string, only: split
50 use dc_types, only: string, token
52 implicit none
53 type(gthst_nmlinfo), intent(in):: gthstnml
54 character(*), intent(in):: name
55 ! 有効であることを設定する変数名.
56 !
57 ! "Data1,Data2" のようにカンマで区切って複数
58 ! の変数を指定することも可能です.
59 !
60 ! A variable name that is set validation.
61 !
62 ! Multiple variables can be specified
63 ! as "Data1,Data2" too. Delimiter is comma.
64 logical, intent(out), optional:: err
65 ! 例外処理用フラグ.
66 ! デフォルトでは, この手続き内でエラーが
67 ! 生じた場合, プログラムは強制終了します.
68 ! 引数 *err* が与えられる場合,
69 ! プログラムは強制終了せず, 代わりに
70 ! *err* に .true. が代入されます.
71 !
72 ! Exception handling flag.
73 ! By default, when error occur in
74 ! this procedure, the program aborts.
75 ! If this *err* argument is given,
76 ! .true. is substituted to *err* and
77 ! the program does not abort.
78
79 !-----------------------------------
80 ! 作業変数
81 ! Work variables
82 type(gthst_nmlinfo_entry), pointer:: hptr =>null()
83 character(TOKEN), pointer:: varnames_array(:) =>null()
84 integer:: i, vnmax
85 integer:: stat
86 character(STRING):: cause_c
87 character(*), parameter:: subname = 'HstNmlInfoSetValidName'
88 continue
89 call beginsub( subname, fmt = '@name=%c', c1 = trim(name) )
90 stat = dc_noerr
91 cause_c = ''
92
93 !-----------------------------------------------------------------
94 ! 初期設定のチェック
95 ! Check initialization
96 !-----------------------------------------------------------------
97 if ( .not. gthstnml % initialized ) then
98 stat = dc_enotinit
99 cause_c = 'GTHST_NMLINFO'
100 goto 999
101 end if
102
103 !-----------------------------------------------------------------
104 ! 複数の変数名の取り扱い
105 ! Handle multiple variables
106 !-----------------------------------------------------------------
107 call split( str = name, sep = name_delimiter, & ! (in)
108 & carray = varnames_array ) ! (out)
109 vnmax = size( varnames_array )
110
111 !-----------------------------------------------------------------
112 ! *gthstnml* 内から, *name* に関する情報を探査.
113 ! Search information correspond to *name* in *gthstnml*
114 !-----------------------------------------------------------------
115 do i = 1, vnmax
116 hptr => gthstnml % gthstnml_list
117 call listsearch( gthstnml_list = hptr, & ! (inout)
118 & name = varnames_array(i) ) ! (in)
119 if ( associated( hptr ) ) then
120 hptr % name_invalid = .false.
121 end if
122 end do
123
124 !-----------------------------------------------------------------
125 ! 終了処理, 例外処理
126 ! Termination and Exception handling
127 !-----------------------------------------------------------------
128999 continue
129 call storeerror( stat, subname, err, cause_c )
130 call endsub( subname )
131 end subroutine hstnmlinfosetvalidname
subroutine hstnmlinfosetvalidname(gthstnml, name, err)
Error handling module.
Definition dc_error.f90:454
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:891
integer, parameter, public dc_enotinit
-400 or less: DC utilities errors
Definition dc_error.f90:534
integer, parameter, public dc_noerr
Error storage variables
Definition dc_error.f90:468
Handling character types.
Definition dc_string.f90:83
Debug tracing module.
Definition dc_trace.f90:150
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
Provides kind type parameter values.
Definition dc_types.f90:55
integer, parameter, public token
Character length for word, token
Definition dc_types.f90:128
integer, parameter, public string
Character length for string
Definition dc_types.f90:137
character(1), parameter, public name_delimiter