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