gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
Functions/Subroutines
hstnmlinfoclose.f90 File Reference

Destructor of gtool_history_nmlinfo_types::GTHST_NMLINFO . More...

Go to the source code of this file.

Functions/Subroutines

subroutine hstnmlinfoclose (gthstnml, err)
 

Detailed Description

Destructor of gtool_history_nmlinfo_types::GTHST_NMLINFO

.

Author
Yasuhiro MORIKAWA

Definition in file hstnmlinfoclose.f90.

Function/Subroutine Documentation

◆ hstnmlinfoclose()

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

Destructor of gtool_history_nmlinfo_types::GTHST_NMLINFO

Terminate all gtool_history_types::GT_HISTORY variables in gthstnml by gtool_history_generic::HistoryClose before this subroutine is used. If unterminated variables remain, error is occurred.

Note that if gthstnml is not initialized by HstNmlInfoCreate yet, error is occurred.

Parameters
[in,out]gthstnmlgtool_history_nmlinfo_types::GTHST_NMLINFO 型変数
[out]err例外処理用フラグ. Exception handling flag.

Definition at line 42 of file hstnmlinfoclose.f90.

45 use gtool_history, only: historyinitialized
47 use dc_types, only: string
49 implicit none
50 type(GTHST_NMLINFO), intent(inout):: gthstnml
51 logical, intent(out), optional:: err
52 ! 例外処理用フラグ.
53 ! デフォルトでは, この手続き内でエラーが
54 ! 生じた場合, プログラムは強制終了します.
55 ! 引数 *err* が与えられる場合,
56 ! プログラムは強制終了せず, 代わりに
57 ! *err* に .true. が代入されます.
58 !
59 ! Exception handling flag.
60 ! By default, when error occur in
61 ! this procedure, the program aborts.
62 ! If this *err* argument is given,
63 ! .true. is substituted to *err* and
64 ! the program does not abort.
65
66 !-----------------------------------
67 ! 作業変数
68 ! Work variables
69 type(GTHST_NMLINFO_ENTRY), pointer:: hptr =>null()
70 type(GTHST_NMLINFO_ENTRY), pointer:: hptr_prev =>null()
71 integer:: stat
72 character(STRING):: cause_c
73 character(*), parameter:: subname = 'HstNmlInfoClose'
74 continue
75 call beginsub( subname )
76 stat = dc_noerr
77 cause_c = ''
78
79 !-----------------------------------------------------------------
80 ! 初期設定のチェック
81 ! Check initialization
82 !-----------------------------------------------------------------
83 if ( .not. gthstnml % initialized ) then
84 stat = dc_enotinit
85 cause_c = 'GTHST_NMLINFO'
86 goto 999
87 end if
88
89 !-----------------------------------------------------------------
90 ! "GTHST_NMLINFO" の設定の消去
91 ! Clear the settings for "GTHST_NMLINFO"
92 !-----------------------------------------------------------------
93 do
94 hptr => gthstnml % gthstnml_list
95 call listlast( gthstnml_list = hptr, & ! (inout)
96 & previous = hptr_prev ) ! (out)
97 call dbgmessage( 'remove entry (%c)', c1 = trim(hptr % name) )
98 if ( trim( hptr % name ) == '' ) exit
99 if ( .not. gthstnml % define_mode ) then
100 if ( historyinitialized( hptr % history ) ) then
101 stat = hst_enottermgthist
102 cause_c = hptr % name
103 goto 999
104 end if
105 end if
106 deallocate( hptr )
107 nullify( hptr_prev % next )
108 end do
109 deallocate( gthstnml % gthstnml_list )
110
111 !-----------------------------------------------------------------
112 ! 終了処理, 例外処理
113 ! Termination and Exception handling
114 !-----------------------------------------------------------------
115 gthstnml % initialized = .false.
116 gthstnml % define_mode = .true.
117999 continue
118 nullify( hptr )
119 call storeerror( stat, subname, err, cause_c )
120 call endsub( subname )
Error handling module.
Definition dc_error.f90:454
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:891
integer, parameter, public hst_enottermgthist
Definition dc_error.f90:561
integer, parameter, public dc_noerr
Error storage variables
Definition dc_error.f90:468
integer, parameter, public dc_enotinit
-400 or less: DC utilities errors
Definition dc_error.f90:534
Debug tracing module.
Definition dc_trace.f90:150
subroutine, public dbgmessage(fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:680
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
Provides kind type parameter values.
Definition dc_types.f90:55
integer, parameter, public string
Character length for string
Definition dc_types.f90:137

References dc_trace::beginsub(), dc_trace::dbgmessage(), dc_error::dc_enotinit, dc_error::dc_noerr, dc_trace::endsub(), dc_error::hst_enottermgthist, dc_error::storeerror(), and dc_types::string.

Here is the call graph for this function: