Class option_parser
In: setup/option_parser.f90

�³ã���³ã�����¤ã�³å��°è§£������

Command line option parser

Note that Japanese and English are described in parallel.

�³ã���³ã�����¤ã�³å��°ã��§£��������è¡����¾ã��.

Command line options are parsed

Procedures List

OptParseInit :�³ã���³ã�����¤ã�³å��°ã��§£������
———— :————
OptParseInit :Parse of command line options

Methods

Included Modules

dc_types dc_string dc_args dc_present

Public Instance methods

Subroutine :
namelist_filename :character(*), intent(out)
: NAMELIST ���¡ã�¤ã������ç§�. NAMELIST file name
exec_name :character(*), intent(in ), optional
: å®�è¡����¡ã�¤ã����. Executable file name
brief :character(*), intent(in ), optional
: å®�è¡����¡ã�¤ã����°¡æ½������ Brief account of executable file

option_parser �¢ã�¸ã�¥ã�¼ã��������設å���è¡����¾ã��.

Initialize "option_parser" module.

[Source]

  subroutine OptParseInit( namelist_filename, exec_name, brief )
    !
    ! option_parser �¢ã�¸ã�¥ã�¼ã��������設å���è¡����¾ã��. 
    !
    ! Initialize "option_parser" module. 
    !

    ! �¢ã�¸ã�¥ã�¼ã����� ; USE statements
    !

    ! ��������
    ! Character handling
    !
    use dc_string, only: StoA

    ! �³ã���³ã�����¤ã�³å��°å����ä¸�è«���
    ! Command line option parser subcontractor
    !
    use dc_args, only: ARGS, DCArgsOpen,  DCArgsHelpMsg, DCArgsOption, DCArgsDebug, DCArgsHelp,    DCArgsStrict, DCArgsClose

    ! çµ��¿è¾¼�¿é�¢æ�� PRESENT ���¡å¼µ���¢æ��
    ! Extended functions of intrinsic function "PRESENT"
    !
    use dc_present, only: present_and_not_empty

    ! 宣�� ; Declaration statements
    !
    implicit none
    character(*), intent(out)          :: namelist_filename
                              ! NAMELIST ���¡ã�¤ã������ç§�. 
                              ! NAMELIST file name
    character(*), intent(in ), optional:: exec_name
                              ! å®�è¡����¡ã�¤ã����. 
                              ! Executable file name
    character(*), intent(in ), optional:: brief
                              ! å®�è¡����¡ã�¤ã����°¡æ½������
                              ! Brief account of executable file

    character(STRING):: ename
                              ! å®�è¡����¡ã�¤ã����. 
                              ! Executable file name
    character(STRING):: brief_msg
                              ! å®�è¡����¡ã�¤ã����°¡æ½������
                              ! Brief account of executable file

    type(ARGS):: arg          ! �³ã���³ã�����¤ã�³å���. 
                              ! Command line options

    ! ���� ; Executable statement
    !

    if ( option_parser_inited ) return
    call InitCheck

    ! �����·ã�§ã������°ã������. 
    ! Handling of optional arguments 
    !
    if ( present_and_not_empty(exec_name) ) then
      ename = exec_name
    else
      ename = 'dcpam'
    end if

    if ( present_and_not_empty(brief) ) then
      brief_msg = brief
    else
      brief_msg = 'dcpam main program'
    end if

    ! �³ã���³ã�����¤ã�³å��°ã��§£������
    ! Parse command line arguments
    !
    call DCArgsOpen( arg )               ! (out)

    call DCArgsHelpMsg( arg, category = 'Title', msg = trim(ename) // ': ' // trim(brief_msg) )  ! (in)
    call DCArgsHelpMsg( arg, category = 'Usage', msg = './' // trim(ename) // ' [Options]' ) ! (in)

    call DCArgsOption( arg, options = StoA('-N', '--namelist'), flag = namelist_flag, value = namelist_filename, help = "Namelist filename")           ! (in)

    call DCArgsDebug( arg )  ! (inout)
    call DCArgsHelp( arg )   ! (inout)
    call DCArgsStrict( arg ) ! (inout)

    call DCArgsClose( arg )  ! (inout)

    option_parser_inited = .true.
  end subroutine OptParseInit
option_parser_inited
Variable :
option_parser_inited = .false. :logical, save, public
: ����設������. Initialization flag

Private Instance methods

Subroutine :

ä¾�å­��¢ã�¸ã�¥ã�¼ã�������������§ã����

Check initialization of dependency modules

[Source]

  subroutine InitCheck
    !
    ! ä¾�å­��¢ã�¸ã�¥ã�¼ã�������������§ã����
    !
    ! Check initialization of dependency modules

    ! ���� ; Executable statement
    !


  end subroutine InitCheck
module_name
Constant :
module_name = ‘option_parser :character(*), parameter
: �¢ã�¸ã�¥ã�¼ã������ç§�. Module name
namelist_flag
Variable :
namelist_flag = .false. :logical, save
: NAMELIST ���¡ã�¤ã����å®������¡ã��示ã��������. Flag of NAMELIST file specification
version
Constant :
version = ’$Name: $’ // ’$Id: option_parser.f90,v 1.3 2010/08/30 01:54:45 yot Exp $’ :character(*), parameter
: �¢ã�¸ã�¥ã�¼ã�������¼ã�¸ã�§ã�� Module version