!---------------------------------------------------------------------
!     Copyright (C) GFD Dennou Club, 2004. All rights reserved.
!---------------------------------------------------------------------
                                                                 !=begin
!= Module DebugSet
!
!   * Developer: ODAKA Masatsugu (odakker@gfd-dennou.org)
!   * Version: $Id: debugset.f90,v 1.2 2005/04/22 15:01:52 sugiyama Exp $
!   * Tag Name: $Name:  $
!   * Change History: 
!
!== Overview 
!
!デバグ設定モジュール
!
!== Error Handling
!
!== Known Bugs
!
!== Note
!
!== Future Plans
!
                                                                 !=end

module debugset
                                                                 !=begin
  !== Dependency
  use dc_trace, only: SetDebug
                                                                 !=end
  !--- 暗黙の型宣言禁止
  implicit none

  !--- save 属性
  save
                                                                 !=begin
  !== Public Interface
  logical :: DebugOn   ! デバッグ出力スイッチ
                                                                 !=end  
contains
                                                                 !=begin
  !== Procedure Interface 
  !
  !=== Initialize module and acquire NAMELIST
  !
  !NAMELIST から情報を得て, デバッグ出力スイッチの切替えを行う.
  !
  subroutine debugset_init(cfgfile)
    !=== Input
    character(*), intent(in) :: cfgfile

    !=== NAMELIST 
    NAMELIST /debugset/ DebugOn
    
    open (10, FILE=cfgfile)
    read(10, NML=debugset)
    close(10)
                                                                 !=end

    !=== デバッグモードなら dc_trace を ON にする
    if ( DebugOn ) call SetDebug

    !=== 確認
!    write(*,*) "DebugOn", DebugOn

  end subroutine debugset_init
  
end module debugset
