dcdatetimeputline.f90
Go to the documentation of this file.
1 !== dc_date_types#DC_DATETIME, dc_date_types#DC_DIFFTIME の印字
2 !
3 ! Authors:: Yasuhiro MORIKAWA
4 ! Version:: $Id: dcdatetimeputline.f90,v 1.2 2009-05-25 10:01:34 morikawa Exp $
5 ! Tag Name:: $Name: $
6 ! Copyright:: Copyright (C) GFD Dennou Club, 2000-2005. All rights reserved.
7 ! License:: See COPYRIGHT[link:../../COPYRIGHT]
8 !
9 ! このファイルで提供される手続き群は dc_date モジュールにて提供されます。
10 !
11 
12 subroutine dcdatetimeputline( time, unit, indent )
13  !
14  ! 引数 *time* に設定されている情報を印字します.
15  ! デフォルトではメッセージは標準出力に出力されます.
16  ! *unit* に装置番号を指定することで, 出力先を変更することが可能です.
17  !
18  ! Print information of *time*.
19  ! By default messages are output to standard output.
20  ! Unit number for output can be changed by *unit* argument.
21  !
22  use dc_date_types, only: dc_datetime
23  use dc_date_generic, only: tochar
24  use dc_string, only: printf
25  use dc_trace, only: beginsub, endsub
26  use dc_types, only: stdout, string
28  implicit none
29  type(dc_datetime), intent(in) :: time
30  integer, intent(in), optional :: unit
31  ! 出力先の装置番号.
32  ! デフォルトの出力先は標準出力.
33  !
34  ! Unit number for output.
35  ! Default value is standard output.
36  character(*), intent(in), optional:: indent
37  ! 表示されるメッセージの字下げ.
38  !
39  ! Indent of displayed messages.
40 
41  integer :: out_unit
42  integer:: indent_len
43  character(STRING):: indent_str
44  character(*), parameter :: subname = 'DCDateTimePutLine'
45 continue
46  call beginsub(subname)
47  if (present(unit)) then
48  out_unit = unit
49  else
50  out_unit = stdout
51  end if
52 
53  indent_len = 0
54  indent_str = ''
55  if ( present(indent) ) then
56  if ( len(indent) /= 0 ) then
57  indent_len = len(indent)
58  indent_str(1:indent_len) = indent
59  end if
60  end if
61 
62  call printf(out_unit, &
63  & indent_str(1:indent_len) // &
64  & '#<DC_DATETIME:: @date=%c @caltype=%d @zone=%c', &
65  & i=(/time % caltype/), c1=trim(tochar(time)), c2=trim(time % zone) )
66 
67  call printf(out_unit, &
68  & indent_str(1:indent_len) // &
69  & ' @day=' )
70  call dcscaledsecputline( time % day, unit = unit, &
71  & indent = indent_str(1:indent_len) // &
72  & ' ' )
73 
74  call printf(out_unit, &
75  & indent_str(1:indent_len) // &
76  & ' @sec=' )
77  call dcscaledsecputline( time % sec, unit = unit, &
78  & indent = indent_str(1:indent_len) // &
79  & ' ' )
80 
81  call printf(out_unit, &
82  & indent_str(1:indent_len) // '>' )
83 
84 999 continue
85  call endsub(subname)
86 end subroutine dcdatetimeputline
87 
88 subroutine dcdifftimeputline( diff, unit, indent )
89  !
90  ! 引数 *diff* に設定されている情報を印字します.
91  ! デフォルトではメッセージは標準出力に出力されます.
92  ! *unit* に装置番号を指定することで, 出力先を変更することが可能です.
93  !
94  ! Print information of *diff*.
95  ! By default messages are output to standard output.
96  ! Unit number for output can be changed by *unit* argument.
97  !
98  use dc_date_types, only: dc_difftime
99  use dc_date_generic, only: tochar
100  use dc_string, only: printf
101  use dc_trace, only: beginsub, endsub
102  use dc_types, only: stdout, string
104  implicit none
105  type(dc_difftime), intent(in) :: diff
106  integer, intent(in), optional :: unit
107  ! 出力先の装置番号.
108  ! デフォルトの出力先は標準出力.
109  !
110  ! Unit number for output.
111  ! Default value is standard output.
112  character(*), intent(in), optional:: indent
113  ! 表示されるメッセージの字下げ.
114  !
115  ! Indent of displayed messages.
116 
117  integer :: out_unit
118  integer:: indent_len
119  character(STRING):: indent_str
120  character(*), parameter :: subname = 'DCDiffTimePutLine'
121 continue
122  call beginsub(subname)
123  if (present(unit)) then
124  out_unit = unit
125  else
126  out_unit = stdout
127  end if
128 
129  indent_len = 0
130  indent_str = ''
131  if ( present(indent) ) then
132  if ( len(indent) /= 0 ) then
133  indent_len = len(indent)
134  indent_str(1:indent_len) = indent
135  end if
136  end if
137 
138  call printf(out_unit, &
139  & indent_str(1:indent_len) // &
140  & '#<DC_DIFFTIME:: @diff=%c @nondim=%b', &
141  & c1 = trim(tochar(diff)), l = (/ diff % nondim_flag /) )
142 
143  call printf(out_unit, &
144  & indent_str(1:indent_len) // &
145  & ' @mon=' )
146  call dcscaledsecputline( diff % mon, unit = unit, &
147  & indent = indent_str(1:indent_len) // &
148  & ' ' )
149 
150  call printf(out_unit, &
151  & indent_str(1:indent_len) // &
152  & ' @day=' )
153  call dcscaledsecputline( diff % day, unit = unit, &
154  & indent = indent_str(1:indent_len) // &
155  & ' ' )
156 
157  call printf(out_unit, &
158  & indent_str(1:indent_len) // &
159  & ' @sec=' )
160  call dcscaledsecputline( diff % sec, unit = unit, &
161  & indent = indent_str(1:indent_len) // &
162  & ' ' )
163 
164  call printf(out_unit, &
165  & indent_str(1:indent_len) // '>' )
166 
167 999 continue
168  call endsub(subname)
169 end subroutine dcdifftimeputline
170 
171 
172 !-----------------------------------------------
173 ! 後方互換用
174 ! For backward compatibility
175 subroutine dcdatetimeputline_bc(time, unit)
178  type(dc_datetime), intent(in) :: time
179  integer, intent(in), optional :: unit
180 continue
181  call dcdatetimeputline( time, unit )
182 end subroutine dcdatetimeputline_bc
183 
184 subroutine dcdifftimeputline_bc(diff, unit)
187  type(dc_difftime), intent(in) :: diff
188  integer, intent(in), optional :: unit
189 continue
190  call dcdifftimeputline( diff, unit )
191 end subroutine dcdifftimeputline_bc
subroutine dcdatetimeputline(time, unit, indent)
subroutine dcdifftimeputline(diff, unit, indent)
subroutine dcdifftimeputline_bc(diff, unit)
subroutine, public beginsub(name, fmt, i, r, d, L, n, c1, c2, c3, ca, version)
Definition: dc_trace.f90:351
subroutine dcdatetimeputline_bc(time, unit)
integer, parameter, public stdout
標準出力の装置番号
Definition: dc_types.f90:98
文字型変数の操作.
Definition: dc_string.f90:24
種別型パラメタを提供します。
Definition: dc_types.f90:49
subroutine, public dcscaledsecputline(sclsec, unit, indent)
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