hstnmlinfoallvarinicheck.f90
Go to the documentation of this file.
1 != 初期設定されていない変数名のチェック
2 != Check uninitialized variable names
3 !
4 ! Authors:: Yasuhiro MORIKAWA
5 ! Version:: $Id: hstnmlinfoallvarinicheck.f90,v 1.1 2009-05-11 15:15:15 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 hstnmlinfoallvarinicheck( gthstnml, &
11  & invalid, &
12  & names, &
13  & err )
14  !
15  ! 初期設定されていない変数名のチェック
16  !
17  ! 初期設定されていない変数名がある場合,
18  ! *invalid* に .true. を返し, *names* には初期設定されていない
19  ! 変数名をカンマで区切った文字列を返します.
20  !
21  ! なお, 与えられた *gthstnml* が HstNmlInfoCreate によって初期設定
22  ! されていない場合, プログラムはエラーを発生させます.
23  !
24  ! Check uninitialized variable names
25  !
26  ! If uninitialized variable names are exist,
27  ! .true. is set to *invalid*, and uninitialized variable names
28  ! are joined with comma, and set to *names*.
29  !
30  ! If *gthstnml* is not initialized by "HstNmlInfoCreate" yet,
31  ! error is occurred.
32  !
36  use gtool_history, only: historyinitialized
37  use dc_trace, only: beginsub, endsub
40  use dc_types, only: dp, string, token, stdout
42  implicit none
43  type(gthst_nmlinfo), intent(in):: gthstnml
44  logical, intent(out):: invalid
45  ! 初期設定されていない変数名が存在する
46  ! 場合には .true. を返す.
47  !
48  ! If uninitialized variable names are exist,
49  ! .true. is returned.
50  !
51  character(*), intent(out):: names
52  ! 初期設定されていない変数名のリスト.
53  !
54  ! List of uninitialized variable names.
55  logical, intent(out), optional:: err
56  ! 例外処理用フラグ.
57  ! デフォルトでは, この手続き内でエラーが
58  ! 生じた場合, プログラムは強制終了します.
59  ! 引数 *err* が与えられる場合,
60  ! プログラムは強制終了せず, 代わりに
61  ! *err* に .true. が代入されます.
62  !
63  ! Exception handling flag.
64  ! By default, when error occur in
65  ! this procedure, the program aborts.
66  ! If this *err* argument is given,
67  ! .true. is substituted to *err* and
68  ! the program does not abort.
69 
70  !-----------------------------------
71  ! 作業変数
72  ! Work variables
73  type(gthst_nmlinfo_entry), pointer:: hptr =>null()
74  integer:: stat
75  character(STRING):: cause_c
76  character(*), parameter:: subname = 'HstNmlInfoAllVarIniCheck'
77  continue
78  call beginsub( subname )
79  stat = dc_noerr
80  cause_c = ''
81 
82  names = ''
83  invalid = .false.
84 
85  !-----------------------------------------------------------------
86  ! 初期設定のチェック
87  ! Check initialization
88  !-----------------------------------------------------------------
89  if ( .not. gthstnml % initialized ) then
90  stat = dc_enotinit
91  cause_c = 'GTHST_NMLINFO'
92  goto 999
93  end if
94 
95  !-----------------------------------------------------------------
96  ! *gthstnml* 内から, *name* に関する情報を探査.
97  ! Search information correspond to *name* in *gthstnml*
98  !-----------------------------------------------------------------
99  hptr => gthstnml % gthstnml_list
100  do while ( associated( hptr % next ) )
101  call listnext( gthstnml_list = hptr ) ! (inout)
102 
103  if ( .not. historyinitialized( hptr % history ) ) then
104  invalid = .true.
105  if ( trim(names) /= '' ) names = trim(names) // name_delimiter
106  names = trim(names) // adjustl( hptr % name )
107  end if
108  end do
109 
110  !-----------------------------------------------------------------
111  ! 終了処理, 例外処理
112  ! Termination and Exception handling
113  !-----------------------------------------------------------------
114 999 continue
115  call storeerror( stat, subname, err, cause_c )
116  call endsub( subname, fmt = '@invalid=%y @names=%c', &
117  & l = (/ invalid /), c1 = trim(names) )
118  end subroutine hstnmlinfoallvarinicheck
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
subroutine hstnmlinfoallvarinicheck(gthstnml, invalid, names, err)
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, 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