!== Formatted output conversion
!
! Authors::   Yasuhiro MORIKAWA, Eizi TOYODA
! Version::   $Id: dcstringcprintf.f90,v 1.2 2009-03-20 09:50:19 morikawa Exp $
! Tag Name::  $Name:  $
! Copyright:: Copyright (C) GFD Dennou Club, 2000-2005. All rights reserved.
! License::   See COPYRIGHT[link:../../COPYRIGHT]
!
!== Overview
!
! C ã® sprintf(3) ã®ã‚ˆã†ã«æ–‡å—åˆ—ã‚’ãƒ•ã‚©ãƒ¼ãƒžãƒƒãƒˆã—ã¦è¿”ã—ã¾ã™ã€‚
! ãŸã ã—ã€å®Ÿè£…ã¯ C ã® sprintf(3) ã¨ã¯å¤§åˆ†é•ã†ã®ã§ã”æ³¨æ„ãã ã•ã„ã€‚
!

function DCStringCPrintf(fmt, i, r, d, L, n, c1, c2, c3, ca) result(result)
  !
  ! ãƒ•ã‚©ãƒ¼ãƒžãƒƒãƒˆæ–‡å—åˆ— fmt ã«å¾“ã£ã¦å¤‰æ›ã•ã‚ŒãŸæ–‡å—åˆ—ã‚’è¿”ã—ã¾ã™ã€‚
  ! ç¬¬1å¼•æ•° fmt ã«ã¯æŒ‡ç¤ºåã‚’å«ã‚€æ–‡å—åˆ—ã‚’ä¸Žãˆã¾ã™ã€‚
  ! æŒ‡ç¤ºåã«ã¯ã€Œ<tt>%</tt>ã€ã‚’ç”¨ã„ã¾ã™ã€‚
  ! <tt>%</tt> ã‚’ç”¨ã„ãŸã„å ´åˆã¯ ã€Œ<tt>%%</tt>ã€ã¨è¨˜è¿°ã—ã¾ã™ã€‚
  ! æŒ‡ç¤ºåã«é–¢ã—ã¦ã®è©³ç´°ã‚„ç”¨ä¾‹ã«é–¢ã—ã¦ã¯ dc_utils/dcstringsprintf.f90 ã‚’å‚ç…§ãã ã•ã„ã€‚
  !
  use dc_types, only: STRING, DP
  use dc_string, only: Printf
  implicit none
  character(len = STRING):: result
  character(*), intent(in):: fmt
  integer, intent(in), optional:: i(:), n(:)
  real, intent(in), optional:: r(:)
  real(DP), intent(in), optional:: d(:)
  logical, intent(in), optional:: L(:)
  character(*), intent(in), optional:: c1, c2, c3
  character(*), intent(in), optional:: ca(:)
continue
  call printf(result, fmt, i=i, r=r, d=d, L=L, n=n, &
    &         c1=c1, c2=c2, c3=c3, ca=ca)
end function DCStringCPrintf