\hypertarget{dcstringsprintf_8f90}{}\section{dc\+\_\+utils/dcstringsprintf.f90 File Reference}
\label{dcstringsprintf_8f90}\index{dc\+\_\+utils/dcstringsprintf.\+f90@{dc\+\_\+utils/dcstringsprintf.\+f90}}
\subsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
subroutine \hyperlink{dcstringsprintf_8f90_a523241850c616e5bd7bbd40ebec1d531}{dcstringsprintf} (unit, fmt, i, r, d, L, n, c1, c2, c3, ca)
\item 
subroutine \hyperlink{dcstringsprintf_8f90_a2cd5d7358ae4c2f53624aced7d4e3ffc}{append} (unitx, ucur, val, stat)
\end{DoxyCompactItemize}


\subsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{dcstringsprintf_8f90_a2cd5d7358ae4c2f53624aced7d4e3ffc}\label{dcstringsprintf_8f90_a2cd5d7358ae4c2f53624aced7d4e3ffc}} 
\index{dcstringsprintf.\+f90@{dcstringsprintf.\+f90}!append@{append}}
\index{append@{append}!dcstringsprintf.\+f90@{dcstringsprintf.\+f90}}
\subsubsection{\texorpdfstring{append()}{append()}}
{\footnotesize\ttfamily subroutine dcstringsprintf\+::append (\begin{DoxyParamCaption}\item[{character($\ast$), intent(inout)}]{unitx,  }\item[{integer, intent(inout)}]{ucur,  }\item[{character($\ast$), intent(in)}]{val,  }\item[{integer, intent(out)}]{stat }\end{DoxyParamCaption})}



Definition at line 368 of file dcstringsprintf.\+f90.



Referenced by dcstringsprintf().


\begin{DoxyCode}
368     \textcolor{comment}{!}
369     \textcolor{comment}{! unitx に val を付加。その際、unitx がその最大文字列長を越えた場合}
370     \textcolor{comment}{! には stat = 2 を返す。}
371     \textcolor{comment}{!}
372     \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{intent(inout)}:: unitx \textcolor{comment}{! 最終的に返される文字列}
373     \textcolor{keywordtype}{integer},      \textcolor{keywordtype}{intent(inout)}:: ucur \textcolor{comment}{! unitx の文字数}
374     \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{intent(in)}   :: val  \textcolor{comment}{! unitx に付加される文字列}
375     \textcolor{keywordtype}{integer},      \textcolor{keywordtype}{intent(out)}  :: stat \textcolor{comment}{! ステータス}
376     \textcolor{keywordtype}{integer}                    :: wrsz \textcolor{comment}{! val の文字列}
377     \textcolor{keywordflow}{continue}
378     \textcolor{comment}{! unitx の最大長を越えた場合には stat = 2 を返す。}
379     \textcolor{keywordflow}{if} (ucur >= len(unitx)) \textcolor{keywordflow}{then}
380       stat = 2
381       \textcolor{comment}{! 正常時の処理}
382     \textcolor{keywordflow}{else}
383       \textcolor{comment}{! unitx の長さを越えた場合も考慮して unitx に val を付加する。}
384       wrsz = \hyperlink{interfacedc__date__generic_1_1min}{min}(len(val), len(unitx) - ucur)
385       unitx(1+ucur: wrsz+ucur) = val(1: wrsz)
386       ucur = ucur + wrsz
387       stat = 0
388       \textcolor{keywordflow}{if} (wrsz < len(val)) stat = 1
389 \textcolor{keywordflow}{    endif}
\end{DoxyCode}
Here is the caller graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=242pt]{dcstringsprintf_8f90_a2cd5d7358ae4c2f53624aced7d4e3ffc_icgraph}
\end{center}
\end{figure}
\mbox{\Hypertarget{dcstringsprintf_8f90_a523241850c616e5bd7bbd40ebec1d531}\label{dcstringsprintf_8f90_a523241850c616e5bd7bbd40ebec1d531}} 
\index{dcstringsprintf.\+f90@{dcstringsprintf.\+f90}!dcstringsprintf@{dcstringsprintf}}
\index{dcstringsprintf@{dcstringsprintf}!dcstringsprintf.\+f90@{dcstringsprintf.\+f90}}
\subsubsection{\texorpdfstring{dcstringsprintf()}{dcstringsprintf()}}
{\footnotesize\ttfamily subroutine dcstringsprintf (\begin{DoxyParamCaption}\item[{character($\ast$), intent(out)}]{unit,  }\item[{character($\ast$), intent(in)}]{fmt,  }\item[{integer, dimension(\+:), intent(in), optional}]{i,  }\item[{real, dimension(\+:), intent(in), optional}]{r,  }\item[{real(dp), dimension(\+:), intent(in), optional}]{d,  }\item[{logical, dimension(\+:), intent(in), optional}]{L,  }\item[{integer, dimension(\+:), intent(in), optional}]{n,  }\item[{character($\ast$), intent(in), optional}]{c1,  }\item[{character($\ast$), intent(in), optional}]{c2,  }\item[{character($\ast$), intent(in), optional}]{c3,  }\item[{character($\ast$), dimension(\+:), intent(in), optional}]{ca }\end{DoxyParamCaption})}



Definition at line 144 of file dcstringsprintf.\+f90.



References append(), and dc\+\_\+types\+::dp.


\begin{DoxyCode}
144   \textcolor{comment}{!}
145   \textcolor{comment}{! フォーマット文字列 fmt に従って変換された文字列を unit に返します。}
146   \textcolor{comment}{! 第2引数 fmt には指示子を含む文字列を与えます。}
147   \textcolor{comment}{! 指示子には「<tt>%</tt>」を用います。}
148   \textcolor{comment}{! <tt>%</tt> を用いたい場合は 「<tt>%%</tt>」と記述します。}
149   \textcolor{comment}{! 指示子および用例に関しての詳細は dc\_utils/dcstringsprintf.f90 を参照ください。}
150   \textcolor{comment}{!}
151   \textcolor{keywordtype}{use }\hyperlink{namespacedc__types}{dc\_types}\textcolor{keywordtype}{,      only}: \hyperlink{namespacedc__types_ac74a34430fcd3d0eb2344f19d536c086}{dp}
152   \textcolor{keywordtype}{implicit none}
153   \textcolor{keywordtype}{character(*)},     \textcolor{keywordtype}{intent(out)}         :: unit
154   \textcolor{keywordtype}{character(*)},     \textcolor{keywordtype}{intent(in)}          :: fmt
155   \textcolor{keywordtype}{integer},          \textcolor{keywordtype}{intent(in)}, \textcolor{keywordtype}{optional}:: i(:), n(:)
156   \textcolor{keywordtype}{real},             \textcolor{keywordtype}{intent(in)}, \textcolor{keywordtype}{optional}:: r(:)
157   \textcolor{keywordtype}{real(DP)},         \textcolor{keywordtype}{intent(in)}, \textcolor{keywordtype}{optional}:: d(:)
158   \textcolor{keywordtype}{logical},          \textcolor{keywordtype}{intent(in)}, \textcolor{keywordtype}{optional}:: l(:)
159   \textcolor{keywordtype}{character(*)},     \textcolor{keywordtype}{intent(in)}, \textcolor{keywordtype}{optional}:: c1, c2, c3
160   \textcolor{keywordtype}{character(*)},     \textcolor{keywordtype}{intent(in)}, \textcolor{keywordtype}{optional}:: ca(:)
161 
162   \textcolor{comment}{! 上記配列引数のカウンタ}
163   \textcolor{keywordtype}{integer}:: ni, nr, nd, nl, nc, na, nn
164   \textcolor{keywordtype}{integer}:: ucur       \textcolor{comment}{! unit に書かれた文字数}
165   \textcolor{keywordtype}{integer}:: endp       \textcolor{comment}{! 既に処理された fmt の文字数}
166   \textcolor{keywordtype}{integer}:: cur        \textcolor{comment}{! 現在着目中の文字は fmt(cur:cur) である}
167   \textcolor{keywordtype}{integer}:: ptr        \textcolor{comment}{! fmt から検索をするときに使用}
168   \textcolor{keywordtype}{integer}:: exp\_ptr    \textcolor{comment}{! fmt から数値の指数部を検索をするときに使用}
169   \textcolor{keywordtype}{integer}:: minus\_ptr  \textcolor{comment}{! '-' を検索する時に使用}
170   \textcolor{keywordtype}{integer}:: repeat     \textcolor{comment}{! %数字 または %* から決定された繰返し数}
171   \textcolor{keywordtype}{integer}:: m          \textcolor{comment}{! 1:repeat の範囲で動くループ変数}
172   \textcolor{keywordtype}{integer}:: stat       \textcolor{comment}{! エラー処理}
173   \textcolor{keywordtype}{character(80)}:: cbuf \textcolor{comment}{! read/write 文のバッファ}
174   \textcolor{keywordtype}{character(80)}:: exp\_buf \textcolor{comment}{! real/write 文の指数部のバッファ (実数型用)}
175   \textcolor{keywordtype}{character(80)}:: ibuf \textcolor{comment}{! real/write 文のバッファ (整数型用)}
176   \textcolor{keywordtype}{integer}:: len\_ibuf   \textcolor{comment}{! ibuf の長さ}
177   \textcolor{keywordtype}{integer}:: figs\_ibuf  \textcolor{comment}{! ibuf の有効な桁数}
178   \textcolor{keywordtype}{logical}:: int\_zero\_fill \textcolor{comment}{! 先頭を 0 で埋めるかどうかを判定するフラグ (整数型用)}
179   \textcolor{keywordtype}{integer}:: int\_figs   \textcolor{comment}{! 整数型を出力する際の桁数 (整数型用)}
180 \textcolor{keywordflow}{continue}
181   ni = 0;  nr = 0;  nd = 0;  nl = 0;  nc = 0;  na = 0;  nn = 0
182   unit = \textcolor{stringliteral}{""}
183   ucur = 0
184 \textcolor{keyword}{  end}p = 0
185   int\_figs = 0
186   int\_zero\_fill = .false.
187   mainloop: \textcolor{keywordflow}{do}
188     cur = endp + 1
189     \textcolor{keywordflow}{if} (cur > len(fmt)) \textcolor{keywordflow}{exit} mainloop
190     \textcolor{comment}{!}
191     \textcolor{comment}{! リテラルに転写できる文字列 fmt(cur:endp-1) を発見処理}
192     \textcolor{comment}{!}
193 \textcolor{keyword}{    end}p = cur - 1 + scan(fmt(cur: ), \textcolor{stringliteral}{'%'})
194     \textcolor{keywordflow}{if} (endp > cur) \textcolor{keywordflow}{then}
195       \textcolor{keyword}{call }\hyperlink{dcstringsprintf_8f90_a2cd5d7358ae4c2f53624aced7d4e3ffc}{append}(unit, ucur, fmt(cur:endp-1), stat)
196       \textcolor{keywordflow}{if} (stat /= 0) \textcolor{keywordflow}{exit} mainloop
197     \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (endp == cur - 1) \textcolor{keywordflow}{then}
198       \textcolor{keyword}{call }\hyperlink{dcstringsprintf_8f90_a2cd5d7358ae4c2f53624aced7d4e3ffc}{append}(unit, ucur, fmt(cur: ), stat)
199       \textcolor{keywordflow}{exit} mainloop
200 \textcolor{keywordflow}{    endif}
201     \textcolor{comment}{!}
202     \textcolor{comment}{! % から書式指定文字までを fmt(cur:endp) とする}
203     \textcolor{comment}{!}
204     cur = endp + 1
205 \textcolor{keyword}{    end}p = cur - 1 + scan(fmt(cur: ), \textcolor{stringliteral}{'DdOoXxFfRrBbYySsCcAa%'})
206     \textcolor{keywordflow}{if} (endp < cur) \textcolor{keywordflow}{then}
207       \textcolor{keyword}{call }\hyperlink{dcstringsprintf_8f90_a2cd5d7358ae4c2f53624aced7d4e3ffc}{append}(unit, ucur, fmt(cur-1: ), stat)
208       \textcolor{keywordflow}{exit} mainloop
209 \textcolor{keywordflow}{    endif}
210     cbuf = fmt(cur:endp-1)
211     \textcolor{comment}{!}
212     \textcolor{comment}{! %* がある場合、n(:) に渡された数から繰り返し回数を取得}
213     \textcolor{comment}{!}
214     \textcolor{keywordflow}{if} (cbuf(1:1) == \textcolor{stringliteral}{'*'}) \textcolor{keywordflow}{then}
215       nn = nn + 1
216       \textcolor{keywordflow}{if} (nn > \textcolor{keyword}{size}(n)) \textcolor{keywordflow}{then}
217         repeat = 1
218       \textcolor{keywordflow}{else}
219         repeat = n(nn)
220 \textcolor{keywordflow}{      endif}
221       ibuf = cbuf(2:)
222     \textcolor{keywordflow}{else}
223       repeat = 1
224       ibuf = cbuf
225 \textcolor{comment}{!    else if (cbuf == '') then}
226 \textcolor{comment}{!      repeat = 1}
227 \textcolor{comment}{!    else}
228 \textcolor{comment}{!      ptr = verify(cbuf, " 0123456789")}
229 \textcolor{comment}{!      if (ptr > 0) cbuf(ptr: ) = " "}
230 \textcolor{comment}{!      read(cbuf, "(I80)", iostat=ptr) repeat}
231 \textcolor{keywordflow}{    endif}
232     \textcolor{comment}{!}
233     \textcolor{comment}{! %2d や %04d のように '%' の後ろに数字が指定され、}
234     \textcolor{comment}{! かつ d (整数型変数の表示) の場合には先頭に空白}
235     \textcolor{comment}{! または 0 を埋める.}
236     \textcolor{comment}{!}
237     \textcolor{keywordflow}{if} (scan(ibuf(1:1),\textcolor{stringliteral}{'1234567890'}) > 0) \textcolor{keywordflow}{then}
238       \textcolor{keywordflow}{if} (ibuf(1:1) == \textcolor{stringliteral}{'0'}) \textcolor{keywordflow}{then}
239         int\_zero\_fill = .true.
240       \textcolor{keywordflow}{else}
241         int\_zero\_fill = .false.
242 \textcolor{keywordflow}{      end if}
243       \textcolor{keyword}{read}(unit=ibuf, fmt=\textcolor{stringliteral}{"(i80)"}) int\_figs
244     \textcolor{keywordflow}{else}
245       int\_figs = 0
246       int\_zero\_fill = .false.
247 \textcolor{keywordflow}{    endif}
248     percentrepeat: \textcolor{keywordflow}{do}, m = 1, repeat
249       \textcolor{keywordflow}{if} (m > 1) \textcolor{keywordflow}{then}
250         \textcolor{keyword}{call }\hyperlink{dcstringsprintf_8f90_a2cd5d7358ae4c2f53624aced7d4e3ffc}{append}(unit, ucur, \textcolor{stringliteral}{", "}, stat)
251         \textcolor{keywordflow}{if} (stat /= 0) \textcolor{keywordflow}{exit} mainloop
252 \textcolor{keywordflow}{      endif}
253       \textcolor{keywordflow}{select case}(fmt(endp:endp))
254       \textcolor{keywordflow}{case}(\textcolor{stringliteral}{'d'}, \textcolor{stringliteral}{'D'})
255         \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{present}(i)) cycle mainloop
256         ni = ni + 1;  \textcolor{keywordflow}{if} (ni > \textcolor{keyword}{size}(i)) cycle mainloop
257         \textcolor{keyword}{write}(ibuf, \textcolor{stringliteral}{"(i20)"}) i(ni)
258         len\_ibuf = len(trim(adjustl(ibuf)))
259         figs\_ibuf = verify(ibuf, \textcolor{stringliteral}{' '})
260         cbuf = \textcolor{stringliteral}{' '}
261         \textcolor{keywordflow}{if} (int\_figs > len\_ibuf) \textcolor{keywordflow}{then}
262           minus\_ptr = scan(ibuf, \textcolor{stringliteral}{'-'})
263           \textcolor{keywordflow}{if} (int\_zero\_fill) \textcolor{keywordflow}{then}
264             \textcolor{keywordflow}{if} (minus\_ptr /= 0) \textcolor{keywordflow}{then}
265               len\_ibuf = len\_ibuf - 1
266               figs\_ibuf = figs\_ibuf + 1
267               cbuf(1:int\_figs-len\_ibuf) = \textcolor{stringliteral}{'-0000000000000000000'}
268             \textcolor{keywordflow}{else}
269               cbuf(1:int\_figs-len\_ibuf) = \textcolor{stringliteral}{'00000000000000000000'}
270 \textcolor{keywordflow}{            end if}
271 \textcolor{keywordflow}{          end if}
272           cbuf(int\_figs-len\_ibuf+1:) = ibuf(figs\_ibuf:20)
273         \textcolor{keywordflow}{else}
274           cbuf = ibuf(figs\_ibuf:20)
275 \textcolor{keywordflow}{        end if}
276         \textcolor{keyword}{call }\hyperlink{dcstringsprintf_8f90_a2cd5d7358ae4c2f53624aced7d4e3ffc}{append}(unit, ucur, trim(cbuf), stat)
277         \textcolor{keywordflow}{if} (stat /= 0) \textcolor{keywordflow}{exit} mainloop
278       \textcolor{keywordflow}{case}(\textcolor{stringliteral}{'o'}, \textcolor{stringliteral}{'O'})
279         \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{present}(i)) cycle mainloop
280         ni = ni + 1;  \textcolor{keywordflow}{if} (ni > \textcolor{keyword}{size}(i)) cycle mainloop
281         \textcolor{keyword}{write}(cbuf, \textcolor{stringliteral}{"(o20)"}) i(ni)
282         \textcolor{keyword}{call }\hyperlink{dcstringsprintf_8f90_a2cd5d7358ae4c2f53624aced7d4e3ffc}{append}(unit, ucur, trim(adjustl(cbuf)), stat)
283         \textcolor{keywordflow}{if} (stat /= 0) \textcolor{keywordflow}{exit} mainloop
284       \textcolor{keywordflow}{case}(\textcolor{stringliteral}{'x'}, \textcolor{stringliteral}{'X'})
285         \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{present}(i)) cycle mainloop
286         ni = ni + 1;  \textcolor{keywordflow}{if} (ni > \textcolor{keyword}{size}(i)) cycle mainloop
287         \textcolor{keyword}{write}(cbuf, \textcolor{stringliteral}{"(z20)"}) i(ni)
288         \textcolor{keyword}{call }\hyperlink{dcstringsprintf_8f90_a2cd5d7358ae4c2f53624aced7d4e3ffc}{append}(unit, ucur, trim(adjustl(cbuf)), stat)
289         \textcolor{keywordflow}{if} (stat /= 0) \textcolor{keywordflow}{exit} mainloop
290       \textcolor{keywordflow}{case}(\textcolor{stringliteral}{'f'}, \textcolor{stringliteral}{'F'})
291         \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{present}(d)) cycle mainloop
292         nd = nd + 1;  \textcolor{keywordflow}{if} (nd > \textcolor{keyword}{size}(d)) cycle mainloop
293         \textcolor{keyword}{write}(cbuf, \textcolor{stringliteral}{"(g80.40)"}) d(nd)
294         cbuf = adjustl(cbuf)
295         exp\_ptr = verify(cbuf, \textcolor{stringliteral}{' 1234567890-+.'}, back=.true.)
296         exp\_buf = \textcolor{stringliteral}{' '}
297         \textcolor{keywordflow}{if} (exp\_ptr > 0) \textcolor{keywordflow}{then}
298           exp\_buf = cbuf(exp\_ptr: )
299           cbuf(exp\_ptr: ) = \textcolor{stringliteral}{" "}
300 \textcolor{keywordflow}{        end if}
301         ptr = verify(cbuf, \textcolor{stringliteral}{" 0"}, back=.true.)
302         \textcolor{keywordflow}{if} (ptr > 0) cbuf(ptr+1: ) = \textcolor{stringliteral}{" "}
303         cbuf = trim(cbuf) // trim(exp\_buf)
304         \textcolor{keyword}{call }\hyperlink{dcstringsprintf_8f90_a2cd5d7358ae4c2f53624aced7d4e3ffc}{append}(unit, ucur, trim(adjustl(cbuf)), stat)
305         \textcolor{keywordflow}{if} (stat /= 0) \textcolor{keywordflow}{exit} mainloop
306       \textcolor{keywordflow}{case}(\textcolor{stringliteral}{'r'}, \textcolor{stringliteral}{'R'})
307         \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{present}(r)) cycle mainloop
308         nr = nr + 1;  \textcolor{keywordflow}{if} (nr > \textcolor{keyword}{size}(r)) cycle mainloop
309         \textcolor{keyword}{write}(cbuf, \textcolor{stringliteral}{"(g80.40)"}) r(nr)
310         cbuf = adjustl(cbuf)
311         exp\_ptr = verify(cbuf, \textcolor{stringliteral}{' 1234567890-+.'}, back=.true.)
312         exp\_buf = \textcolor{stringliteral}{' '}
313         \textcolor{keywordflow}{if} (exp\_ptr > 0) \textcolor{keywordflow}{then}
314           exp\_buf = cbuf(exp\_ptr: )
315           cbuf(exp\_ptr: ) = \textcolor{stringliteral}{" "}
316 \textcolor{keywordflow}{        end if}
317         ptr = verify(cbuf, \textcolor{stringliteral}{" 0"}, back=.true.)
318         \textcolor{keywordflow}{if} (ptr > 0) cbuf(ptr+1: ) = \textcolor{stringliteral}{" "}
319         cbuf = trim(cbuf) // trim(exp\_buf)
320         \textcolor{keyword}{call }\hyperlink{dcstringsprintf_8f90_a2cd5d7358ae4c2f53624aced7d4e3ffc}{append}(unit, ucur, trim(adjustl(cbuf)), stat)
321         \textcolor{keywordflow}{if} (stat /= 0) \textcolor{keywordflow}{exit} mainloop
322       \textcolor{keywordflow}{case}(\textcolor{stringliteral}{'b'}, \textcolor{stringliteral}{'B'})
323         \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{present}(l)) cycle mainloop
324         nl = nl + 1;  \textcolor{keywordflow}{if} (nl > \textcolor{keyword}{size}(l)) cycle mainloop
325         \textcolor{keyword}{write}(cbuf, \textcolor{stringliteral}{"(L1)"}) l(nl)
326         \textcolor{keyword}{call }\hyperlink{dcstringsprintf_8f90_a2cd5d7358ae4c2f53624aced7d4e3ffc}{append}(unit, ucur, trim(adjustl(cbuf)), stat)
327         \textcolor{keywordflow}{if} (stat /= 0) \textcolor{keywordflow}{exit} mainloop
328       \textcolor{keywordflow}{case}(\textcolor{stringliteral}{'y'}, \textcolor{stringliteral}{'Y'})
329         \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{present}(l)) cycle mainloop
330         nl = nl + 1;  \textcolor{keywordflow}{if} (nl > \textcolor{keyword}{size}(l)) cycle mainloop
331         \textcolor{keywordflow}{if} (l(nl)) \textcolor{keywordflow}{then}
332           \textcolor{keyword}{call }\hyperlink{dcstringsprintf_8f90_a2cd5d7358ae4c2f53624aced7d4e3ffc}{append}(unit, ucur, \textcolor{stringliteral}{"yes"}, stat)
333           \textcolor{keywordflow}{if} (stat /= 0) \textcolor{keywordflow}{exit} mainloop
334         \textcolor{keywordflow}{else}
335           \textcolor{keyword}{call }\hyperlink{dcstringsprintf_8f90_a2cd5d7358ae4c2f53624aced7d4e3ffc}{append}(unit, ucur, \textcolor{stringliteral}{"no"}, stat)
336           \textcolor{keywordflow}{if} (stat /= 0) \textcolor{keywordflow}{exit} mainloop
337 \textcolor{keywordflow}{        endif}
338       \textcolor{keywordflow}{case}(\textcolor{stringliteral}{'c'}, \textcolor{stringliteral}{'C'})
339         nc = nc + 1
340         \textcolor{keywordflow}{if} (nc == 1) \textcolor{keywordflow}{then}
341           \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{present}(c1)) cycle percentrepeat
342           \textcolor{keyword}{call }\hyperlink{dcstringsprintf_8f90_a2cd5d7358ae4c2f53624aced7d4e3ffc}{append}(unit, ucur, c1, stat)
343           \textcolor{keywordflow}{if} (stat /= 0) \textcolor{keywordflow}{exit} mainloop
344         \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (nc == 2) \textcolor{keywordflow}{then}
345           \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{present}(c2)) cycle percentrepeat
346           \textcolor{keyword}{call }\hyperlink{dcstringsprintf_8f90_a2cd5d7358ae4c2f53624aced7d4e3ffc}{append}(unit, ucur, c2, stat)
347           \textcolor{keywordflow}{if} (stat /= 0) \textcolor{keywordflow}{exit} mainloop
348         \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (nc == 3) \textcolor{keywordflow}{then}
349           \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{present}(c3)) cycle percentrepeat
350           \textcolor{keyword}{call }\hyperlink{dcstringsprintf_8f90_a2cd5d7358ae4c2f53624aced7d4e3ffc}{append}(unit, ucur, c3, stat)
351           \textcolor{keywordflow}{if} (stat /= 0) \textcolor{keywordflow}{exit} mainloop
352 \textcolor{keywordflow}{        endif}
353       \textcolor{keywordflow}{case}(\textcolor{stringliteral}{'a'}, \textcolor{stringliteral}{'A'})
354         \textcolor{keywordflow}{if} (.not. \textcolor{keyword}{present}(ca)) cycle mainloop
355         na = na + 1;  \textcolor{keywordflow}{if} (na > \textcolor{keyword}{size}(ca)) cycle mainloop
356         \textcolor{keyword}{call }\hyperlink{dcstringsprintf_8f90_a2cd5d7358ae4c2f53624aced7d4e3ffc}{append}(unit, ucur, trim(adjustl(ca(na))), stat)
357         \textcolor{keywordflow}{if} (stat /= 0) \textcolor{keywordflow}{exit} mainloop
358       \textcolor{keywordflow}{case}(\textcolor{stringliteral}{'%'})
359         \textcolor{keyword}{call }\hyperlink{dcstringsprintf_8f90_a2cd5d7358ae4c2f53624aced7d4e3ffc}{append}(unit, ucur, \textcolor{stringliteral}{'%'}, stat)
360         \textcolor{keywordflow}{if} (stat /= 0) \textcolor{keywordflow}{exit} mainloop
361 \textcolor{keywordflow}{      end select}
362 \textcolor{keywordflow}{    enddo} percentrepeat
363 \textcolor{keywordflow}{  enddo} mainloop
364   \textcolor{keywordflow}{return}
365 \textcolor{keyword}{contains}
366 
367 \textcolor{keyword}{  subroutine }\hyperlink{dcstringsprintf_8f90_a2cd5d7358ae4c2f53624aced7d4e3ffc}{append}(unitx, ucur, val, stat)
368     \textcolor{comment}{!}
369     \textcolor{comment}{! unitx に val を付加。その際、unitx がその最大文字列長を越えた場合}
370     \textcolor{comment}{! には stat = 2 を返す。}
371     \textcolor{comment}{!}
372     \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{intent(inout)}:: unitx \textcolor{comment}{! 最終的に返される文字列}
373     \textcolor{keywordtype}{integer},      \textcolor{keywordtype}{intent(inout)}:: ucur \textcolor{comment}{! unitx の文字数}
374     \textcolor{keywordtype}{character(*)}, \textcolor{keywordtype}{intent(in)}   :: val  \textcolor{comment}{! unitx に付加される文字列}
375     \textcolor{keywordtype}{integer},      \textcolor{keywordtype}{intent(out)}  :: stat \textcolor{comment}{! ステータス}
376     \textcolor{keywordtype}{integer}                    :: wrsz \textcolor{comment}{! val の文字列}
377     \textcolor{keywordflow}{continue}
378     \textcolor{comment}{! unitx の最大長を越えた場合には stat = 2 を返す。}
379     \textcolor{keywordflow}{if} (ucur >= len(unitx)) \textcolor{keywordflow}{then}
380       stat = 2
381       \textcolor{comment}{! 正常時の処理}
382     \textcolor{keywordflow}{else}
383       \textcolor{comment}{! unitx の長さを越えた場合も考慮して unitx に val を付加する。}
384       wrsz = \hyperlink{interfacedc__date__generic_1_1min}{min}(len(val), len(unitx) - ucur)
385       unitx(1+ucur: wrsz+ucur) = val(1: wrsz)
386       ucur = ucur + wrsz
387       stat = 0
388       \textcolor{keywordflow}{if} (wrsz < len(val)) stat = 1
389 \textcolor{keywordflow}{    endif}
390 \textcolor{keyword}{  end subroutine }\hyperlink{dcstringsprintf_8f90_a2cd5d7358ae4c2f53624aced7d4e3ffc}{append}
391 
\end{DoxyCode}
Here is the call graph for this function\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=242pt]{dcstringsprintf_8f90_a523241850c616e5bd7bbd40ebec1d531_cgraph}
\end{center}
\end{figure}
