hstnmlinfosetvalidname.f90
Go to the documentation of this file.
1 != 変数名の有効性を設定
2 != Set validation to variable names
3 !
4 ! Authors:: Yasuhiro MORIKAWA
5 ! Version:: $Id: hstnmlinfosetvalidname.f90,v 1.1 2009-05-11 15:15:14 morikawa Exp $
6 ! Tag Name:: $Name: $
7 ! Copyright:: Copyright (C) GFD Dennou Club, 2007-2009. All rights reserved.
8 ! License:: See COPYRIGHT[link:../../../COPYRIGHT]
9 !
10  subroutine hstnmlinfosetvalidname( gthstnml, &
11  & name, &
12  & err )
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
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  !-----------------------------------------------------------------
116 999 continue
117  call storeerror( stat, subname, err, cause_c )
118  call endsub( subname )
119  end subroutine hstnmlinfosetvalidname
integer, parameter, public dc_earglack
Definition: dc_error.f90:569
integer, parameter, public dc_enotinit
Definition: dc_error.f90:557
integer, parameter, public token
単語やキーワードを保持する文字型変数の種別型パラメタ
Definition: dc_types.f90:109
logical function, public present_and_true(arg)
Definition: dc_present.f90:80
character(1), parameter, public name_delimiter
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition: dc_error.f90:830
integer, parameter, public dc_noerr
Definition: dc_error.f90:509
character(string) function, public joinchar(carray, expr)
Definition: dc_string.f90:861
integer, parameter, public dp
倍精度実数型変数
Definition: dc_types.f90:83
logical function, public present_and_not_empty(arg)
Definition: dc_present.f90:276
subroutine, public beginsub(name, fmt, i, r, d, L, n, c1, c2, c3, ca, version)
Definition: dc_trace.f90:351
integer, parameter, public dc_enoentry
Definition: dc_error.f90:571
integer, parameter, public stdout
標準出力の装置番号
Definition: dc_types.f90:98
文字型変数の操作.
Definition: dc_string.f90:24
種別型パラメタを提供します。
Definition: dc_types.f90:49
subroutine hstnmlinfosetvalidname(gthstnml, name, err)
subroutine, public endsub(name, fmt, i, r, d, L, n, c1, c2, c3, ca)
Definition: dc_trace.f90:446
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition: dc_types.f90:118