hstnmlinfoclose.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine hstnmlinfoclose (gthstnml, err)
 

Function/Subroutine Documentation

◆ hstnmlinfoclose()

subroutine hstnmlinfoclose ( type(gthst_nmlinfo), intent(inout)  gthstnml,
logical, intent(out), optional  err 
)

Definition at line 11 of file hstnmlinfoclose.f90.

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_error::dc_enotinit, dc_error::dc_noerr, dc_types::dp, dc_trace::endsub(), dc_error::hst_enottermgthist, dc_string::joinchar(), dc_types::stdout, dc_error::storeerror(), dc_types::string, and dc_types::token.

11  !
12  ! GTHST_NMLINFO 型の変数の終了処理を行います.
13  !
14  ! このサブルーチンを使用する前に, *gthstnml* に格納されている
15  ! gtool_history_types#GT_HISTORY 型の全ての変数に対して,
16  ! gtool_history_generic#HistoryClose を用いて終了処理を行ってください.
17  ! 終了処理されていないものがある場合,
18  ! プログラムはエラーを発生させます.
19  !
20  ! なお, 与えられた *gthstnml* が HstNmlInfoCreate によって初期設定
21  ! されていない場合, プログラムはエラーを発生させます.
22  !
23  ! Deconstructor of "GTHST_NMLINFO".
24  !
25  ! Terminate all "gtool_history_types#GT_HISTORY" variables in *gthstnml*
26  ! by "gtool_history_generic#HistoryClose" before this subroutine is used.
27  ! If unterminated variables remain,
28  ! error is occurred.
29  !
30  ! Note that if *gthstnml* is not initialized by "HstNmlInfoCreate" yet,
31  ! error is occurred.
32  !
36  use dc_trace, only: beginsub, endsub, dbgmessage
38  use dc_types, only: dp, string, token, stdout
40  implicit none
41  type(gthst_nmlinfo), intent(inout):: gthstnml
42  logical, intent(out), optional:: err
43  ! 例外処理用フラグ.
44  ! デフォルトでは, この手続き内でエラーが
45  ! 生じた場合, プログラムは強制終了します.
46  ! 引数 *err* が与えられる場合,
47  ! プログラムは強制終了せず, 代わりに
48  ! *err* に .true. が代入されます.
49  !
50  ! Exception handling flag.
51  ! By default, when error occur in
52  ! this procedure, the program aborts.
53  ! If this *err* argument is given,
54  ! .true. is substituted to *err* and
55  ! the program does not abort.
56 
57  !-----------------------------------
58  ! 作業変数
59  ! Work variables
60  type(gthst_nmlinfo_entry), pointer:: hptr =>null()
61  type(gthst_nmlinfo_entry), pointer:: hptr_prev =>null()
62  integer:: stat
63  character(STRING):: cause_c
64  character(*), parameter:: subname = 'HstNmlInfoClose'
65  continue
66  call beginsub( subname )
67  stat = dc_noerr
68  cause_c = ''
69 
70  !-----------------------------------------------------------------
71  ! 初期設定のチェック
72  ! Check initialization
73  !-----------------------------------------------------------------
74  if ( .not. gthstnml % initialized ) then
75  stat = dc_enotinit
76  cause_c = 'GTHST_NMLINFO'
77  goto 999
78  end if
79 
80  !-----------------------------------------------------------------
81  ! "GTHST_NMLINFO" の設定の消去
82  ! Clear the settings for "GTHST_NMLINFO"
83  !-----------------------------------------------------------------
84  do
85  hptr => gthstnml % gthstnml_list
86  call listlast( gthstnml_list = hptr, & ! (inout)
87  & previous = hptr_prev ) ! (out)
88  call dbgmessage( 'remove entry (%c)', c1 = trim(hptr % name) )
89  if ( trim( hptr % name ) == '' ) exit
90  if ( .not. gthstnml % define_mode ) then
91  if ( historyinitialized( hptr % history ) ) then
92  stat = hst_enottermgthist
93  cause_c = hptr % name
94  goto 999
95  end if
96  end if
97  deallocate( hptr )
98  nullify( hptr_prev % next )
99  end do
100  deallocate( gthstnml % gthstnml_list )
101 
102  !-----------------------------------------------------------------
103  ! 終了処理, 例外処理
104  ! Termination and Exception handling
105  !-----------------------------------------------------------------
106  gthstnml % initialized = .false.
107  gthstnml % define_mode = .true.
108 999 continue
109  nullify( hptr )
110  call storeerror( stat, subname, err, cause_c )
111  call endsub( subname )
integer, parameter, public dc_enotinit
Definition: dc_error.f90:557
integer, parameter, public token
単語やキーワードを保持する文字型変数の種別型パラメタ
Definition: dc_types.f90:109
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
subroutine, public dbgmessage(fmt, i, r, d, L, n, c1, c2, c3, ca)
Definition: dc_trace.f90:509
subroutine, public beginsub(name, fmt, i, r, d, L, n, c1, c2, c3, ca, version)
Definition: dc_trace.f90:351
integer, parameter, public stdout
標準出力の装置番号
Definition: dc_types.f90:98
文字型変数の操作.
Definition: dc_string.f90:24
integer, parameter, public hst_enottermgthist
Definition: dc_error.f90:585
種別型パラメタを提供します。
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
Here is the call graph for this function: