gtool5 Fortran 90/95 ライブラリ 1.0.0-rc5
English
Loading...
Searching...
No Matches
hstnmlinfosetvalidname.f90 File Reference

変数名の有効性を設定 More...

Go to the source code of this file.

Functions/Subroutines

subroutine hstnmlinfosetvalidname (gthstnml, name, err)

Detailed Description

変数名の有効性を設定

Author
Yasuhiro MORIKAWA

Definition in file hstnmlinfosetvalidname.f90.

Function/Subroutine Documentation

◆ hstnmlinfosetvalidname()

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

変数名の有効性を設定

無効な変数名を検知するため, このサブルーチンで 有効な変数に対しては明示的に設定を行います.

なお, 与えられた gthstnml が HstNmlInfoCreate によって初期設定 されていない場合, プログラムはエラーを発生させます.

Parameters
[in]gthstnmlgtool_history_nmlinfo_types::GTHST_NMLINFO 型変数
[in]name有効であることを設定する変数名. "Data1,Data2" のようにカンマで区切って複数指定可能. A variable name that is set validation. Multiple variables can be specified as "Data1,Data2".
[out]err例外処理用フラグ. Exception handling flag.

Definition at line 42 of file hstnmlinfosetvalidname.f90.

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 )
エラー処理用モジュール
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 以下: dc ユーティリティのエラー
Definition dc_error.f90:534
integer, parameter, public dc_noerr
エラー等を保持
Definition dc_error.f90:468
文字型変数の操作
Definition dc_string.f90:83
デバッグ時の追跡用モジュール
Definition dc_trace.f90:150
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
Definition dc_trace.f90:476
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:599
種別型パラメタを提供します。
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

References dc_trace::beginsub(), dc_error::dc_enotinit, dc_error::dc_noerr, dc_trace::endsub(), gtool_history_nmlinfo_internal::name_delimiter, dc_error::storeerror(), dc_types::string, and dc_types::token.

Here is the call graph for this function: