!
!= å±žæ€§ã®ã‚³ãƒ”ãƒ¼
!
! Authors::   Eizi TOYODA, Yasuhiro MORIKAWA
! Version::   $Id: gtvarcopyattrall.f90,v 1.1 2009-03-20 09:09:52 morikawa Exp $
! Tag Name::  $Name:  $
! Copyright:: Copyright (C) GFD Dennou Club, 2000-2005. All rights reserved.
! License::   See COPYRIGHT[link:../../COPYRIGHT]
!
! ä»¥ä¸‹ã®ã‚µãƒ–ãƒ«ãƒ¼ãƒãƒ³ã€é–¢æ•°ã¯ gtdata_generic ã‹ã‚‰ gtdata_generic#Copy_Attr
! ã¨ã—ã¦æä¾›ã•ã‚Œã¾ã™ã€‚

subroutine GTVarCopyAttrAll(to, from, err, global)
  !
  !== å±žæ€§ã®ã‚³ãƒ”ãƒ¼
  !
  ! å¤‰æ•° *from* ã®å…¨ã¦ã®å±žæ€§ã‚’å¤‰æ•° *to* ã¸ã‚³ãƒ”ãƒ¼ã—ã¾ã™ã€‚
  !
  ! ãƒ‡ãƒ•ã‚©ãƒ«ãƒˆã§ã¯å¤§åŸŸå±žæ€§ã‚‚ã‚³ãƒ”ãƒ¼ã—ã¾ã™ãŒã€
  ! *global* ã« .false. ã‚’ä¸Žãˆã‚‹å ´åˆã€å¤§åŸŸå±žæ€§ã‚’ã‚³ãƒ”ãƒ¼ã—ã¾ã›ã‚“ã€‚
  !
  ! *Copy_Attr* ã¯ 2 ã¤ã®ã‚µãƒ–ãƒ«ãƒ¼ãƒãƒ³ã®ç·ç§°åã§ã‚ã‚Šã€
  ! ä»–ã«ã‚‚å±žæ€§ã‚’æŒ‡å®šã—ã¦ã‚³ãƒ”ãƒ¼ã™ã‚‹æ–¹æ³•ã‚‚ã‚ã‚Šã¾ã™ã€‚
  ! ä¸Šè¨˜ã®ã‚µãƒ–ãƒ«ãƒ¼ãƒãƒ³ã‚’å‚ç…§ãã ã•ã„ã€‚
  !
  use gtdata_types, only: gt_variable
  use gtdata_generic, only: attr_rewind, attr_next, gtvarcopyattr
  use dc_present,only:present_and_true, present_and_false
  use dc_url,   only: GT_PLUS
  use dc_error, only: dumperror
  use dc_trace, only: beginsub, endsub, DbgMessage
  use dc_types, only: string
  type(gt_variable), intent(inout):: to
  type(gt_variable), intent(inout):: from
  logical, intent(out), optional:: err
  logical, intent(in), optional:: global
  character(len = *), parameter:: subnam = "GTVarCopyAttrAll"
  character(len = STRING):: aname
  logical:: end
continue
  if (present(err)) err = .false.
  call beginsub(subnam)
  call attr_rewind(from)
  do
    call attr_next(from, aname, end)
    if (end) exit
    if ( (present_and_false(global)) .and. (aname(1:1) == GT_PLUS) ) then
      call DbgMessage("Ignored attr=%c", c1=aname)
      cycle
    end if
    call DbgMessage("Copied attr=%c", c1=aname)
    call GTVarCopyAttr(to=to, attrname=aname, from=from, err=err)
    if (present_and_true(err)) err = .false.
  enddo
  call endsub(subnam)
end subroutine GTVarCopyAttrAll