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

Go to the source code of this file.

Functions/Subroutines

subroutine hstnmlinfosetvalidname (gthstnml, name, err)
 

Function/Subroutine Documentation

◆ hstnmlinfosetvalidname()

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

Definition at line 10 of file hstnmlinfosetvalidname.f90.

13 !
14 ! 変数名の有効性を設定.
15 !
16 ! 無効な変数名を検知するため, このサブルーチンで
17 ! 有効な変数に対しては明示的に設定を行います.
18 !
19 ! なお, 与えられた *gthstnml* が HstNmlInfoCreate によって初期設定
20 ! されていない場合, プログラムはエラーを発生させます.
21 !
22 ! Set validation to variable names.
23 !
24 ! For detection of invalid variable names,
25 ! Set validation to variable names explicitly by this
26 ! subroutine.
27 !
28 ! If *gthstnml* is not initialized by "HstNmlInfoCreate" yet,
29 ! error is occurred.
30 !
34 use gtool_history, only: historyinitialized
35 use dc_trace, only: beginsub, endsub
36 use dc_string, only: putline, printf, split, strinclude, stoa, joinchar
37 use dc_present, only: present_and_not_empty, present_and_true
38 use dc_types, only: dp, string, token, stdout
40 implicit none
41 type(GTHST_NMLINFO), intent(in):: gthstnml
42 character(*), intent(in):: name
43 ! 有効であることを設定する変数名.
44 !
45 ! "Data1,Data2" のようにカンマで区切って複数
46 ! の変数を指定することも可能です.
47 !
48 ! A variable name that is set validation.
49 !
50 ! Multiple variables can be specified
51 ! as "Data1,Data2" too. Delimiter is comma.
52 logical, intent(out), optional:: err
53 ! 例外処理用フラグ.
54 ! デフォルトでは, この手続き内でエラーが
55 ! 生じた場合, プログラムは強制終了します.
56 ! 引数 *err* が与えられる場合,
57 ! プログラムは強制終了せず, 代わりに
58 ! *err* に .true. が代入されます.
59 !
60 ! Exception handling flag.
61 ! By default, when error occur in
62 ! this procedure, the program aborts.
63 ! If this *err* argument is given,
64 ! .true. is substituted to *err* and
65 ! the program does not abort.
66
67 !-----------------------------------
68 ! 作業変数
69 ! Work variables
70 type(GTHST_NMLINFO_ENTRY), pointer:: hptr =>null()
71 character(TOKEN), pointer:: varnames_array(:) =>null()
72 integer:: i, vnmax
73 integer:: stat
74 character(STRING):: cause_c
75 character(*), parameter:: subname = 'HstNmlInfoSetValidName'
76 continue
77 call beginsub( subname, fmt = '@name=%c', c1 = trim(name) )
78 stat = dc_noerr
79 cause_c = ''
80
81 !-----------------------------------------------------------------
82 ! 初期設定のチェック
83 ! Check initialization
84 !-----------------------------------------------------------------
85 if ( .not. gthstnml % initialized ) then
86 stat = dc_enotinit
87 cause_c = 'GTHST_NMLINFO'
88 goto 999
89 end if
90
91 !-----------------------------------------------------------------
92 ! 複数の変数名の取り扱い
93 ! Handle multiple variables
94 !-----------------------------------------------------------------
95 call split( str = name, sep = name_delimiter, & ! (in)
96 & carray = varnames_array ) ! (out)
97 vnmax = size( varnames_array )
98
99 !-----------------------------------------------------------------
100 ! *gthstnml* 内から, *name* に関する情報を探査.
101 ! Search information correspond to *name* in *gthstnml*
102 !-----------------------------------------------------------------
103 do i = 1, vnmax
104 hptr => gthstnml % gthstnml_list
105 call listsearch( gthstnml_list = hptr, & ! (inout)
106 & name = varnames_array(i) ) ! (in)
107 if ( associated( hptr ) ) then
108 hptr % name_invalid = .false.
109 end if
110 end do
111
112 !-----------------------------------------------------------------
113 ! 終了処理, 例外処理
114 ! Termination and Exception handling
115 !-----------------------------------------------------------------
116999 continue
117 call storeerror( stat, subname, err, cause_c )
118 call endsub( subname )
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:830
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 dc_enoentry
Definition dc_error.f90:571
種別型パラメタを提供します。
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_enoentry, dc_error::dc_enotinit, dc_error::dc_noerr, dc_types::dp, gtool_history_nmlinfo_internal::name_delimiter, dc_types::stdout, dc_error::storeerror(), dc_types::string, and dc_types::token.

Here is the call graph for this function: