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

Go to the source code of this file.

Functions/Subroutines

subroutine dccalparseunit1 (unit_str, unit_sym, err)
 単位の解釈

Function/Subroutine Documentation

◆ dccalparseunit1()

subroutine dccalparseunit1 ( character(*), intent(in) unit_str,
integer, intent(out) unit_sym,
logical, intent(out), optional err )

単位の解釈

Author
Yasuhiro MORIKAWA

このファイルに記載される手続き群は dc_calendar モジュールから提供されます.

文字列変数の日時単位を整数型シンボルに変換

文字列変数の日時単位 unit_str を整数型変数の日時単位 unit_sym に変換します. unit_str として有効な文字列は以下の通りです.

文字列定数 説明
dc_calendar_types#UNIT_SEC 秒の単位
dc_calendar_types#UNIT_MIN 分の単位
dc_calendar_types#UNIT_HOUR 時間の単位
dc_calendar_types#UNIT_DAY 日の単位
dc_calendar_types#UNIT_MONTH 月の単位
dc_calendar_types#UNIT_YEAR 年の単位

有効な文字列が与えられた場合, unit_sym に以下の変数に相当する 整数が返ります.

シンボル定数 説明
dc_calendar_types#UNIT_SYMBOL_SEC 秒の単位
dc_calendar_types#UNIT_SYMBOL_MIN 分の単位
dc_calendar_types#UNIT_SYMBOL_HOUR 時間の単位
dc_calendar_types#UNIT_SYMBOL_DAY 日の単位
dc_calendar_types#UNIT_SYMBOL_MONTH 月の単位
dc_calendar_types#UNIT_SYMBOL_YEAR 年の単位

無効な値が与えられた場合, エラーを生じます.

Parameters
[in]unit_str日時単位の文字列変数
[out]unit_sym日時単位の整数型変数 (シンボル)
[out]err例外処理用フラグ. デフォルトでは, この手続き内でエラーが生じた場合, プログラムは強制終了します. 引数 err が与えられる場合, プログラムは強制終了せず, 代わりに err に .true. が代入されます.

Definition at line 98 of file dccalparseunit.f90.

99
102 use dc_message, only: messagenotify
103 use dc_string, only: lchar
104 use dc_trace, only: beginsub, endsub
106 use dc_types, only: string
107 implicit none
108 character(*), intent(in):: unit_str
109 integer, intent(out):: unit_sym
110 logical, intent(out), optional:: err
111
112 ! 作業変数
113 ! Work variables
114 !
115 integer:: stat
116 character(STRING):: cause_c
117 character(*), parameter:: subname = 'DCCalParseUnit1'
118continue
119 call beginsub( subname )
120 stat = dc_noerr
121 cause_c = ''
122
123 ! 単位の文字列をシンボル (整数型変数) に変換
124 ! Convert strings of units into symbols (integer variables)
125 !
126 unit_sym = dccaldate_str2usym( unit_str )
127
128 ! エラー処理
129 ! Error Handling
130 !
131 if ( unit_sym == unit_symbol_err ) then
132 call messagenotify('W', subname, 'unit_str=<%c> is invalid. (ONLY day,hour,min,sec are valid)', &
133 & c1 = trim(unit_str) )
134 stat = dc_ebadunit
135 goto 999
136 end if
137
138 ! 終了処理, 例外処理
139 ! Termination and Exception handling
140 !
141999 continue
142 call storeerror( stat, subname, err, cause_c )
143 call endsub( subname )
dc_calendar用の内部モジュール
integer function, public dccaldate_str2usym(str)
暦と日時に関する構造データ型と定数
integer, parameter, public unit_symbol_err
エラー処理用モジュール
Definition dc_error.f90:454
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:891
integer, parameter, public dc_ebadunit
Definition dc_error.f90:536
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 string
文字列を保持する 文字型変数の種別型パラメタ
Definition dc_types.f90:137

References dc_trace::beginsub(), dc_error::dc_ebadunit, dc_error::dc_noerr, dc_calendar_internal::dccaldate_str2usym(), dc_trace::endsub(), dc_error::storeerror(), dc_types::string, and dc_calendar_types::unit_symbol_err.

Here is the call graph for this function: