!= Module DebugSet
!
! Authors::   ODAKA Masatsugu, SUGIYAMA Ko-ichiro
! Version::   $Id: debugset.f90,v 1.3 2007/06/09 13:12:30 sugiyama Exp $
! Tag Name::  $Name: arare4-20071012 $
! Copyright:: Copyright (C) GFD Dennou Club, 2006. All rights reserved.
! License::   See COPYRIGHT[link:../../COPYRIGHT]
!
!== Overview 
!
!デバグ設定モジュール
!
!== Error Handling
!
!== Known Bugs
!
!== Note
!
!== Future Plans
!

module debugset
  !
  !デバグ設定モジュール
  !

  !モジュール読み込み
  use dc_trace,   only: SetDebug

  !暗黙の型宣言禁止
  implicit none

  !save 属性
  save

  !公開変数
  logical :: DebugOn   ! デバッグ出力スイッチ

contains

  subroutine debugset_init(cfgfile)
    !
    !NAMELIST から情報を得て, デバッグ出力スイッチの切替えを行う.
    !

    !モジュール読み込み
    use dc_message,    only: MessageNotify

    !暗黙の型宣言禁止
    implicit none

    !入力変数
    character(*), intent(in) :: cfgfile

    !NAMELIST から情報取得
    NAMELIST /debugset/ DebugOn
    
    open (10, FILE=cfgfile)
    read(10, NML=debugset)
    close(10)

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

    write(*,*) "DebugSet, DebugOn ", DebugOn

  end subroutine debugset_init
  
end module debugset
