ヘルプオプションの自動設定を行います.
ヘルプメッセージに表示される情報は, DCArgsOption, DCArgsHelpMsg サブルーチンによって付加することが可能です.
743 implicit none
744 type(ARGS), intent(inout) :: arg
745 logical, intent(in), optional :: force
746 logical :: OPT_help, found, end
747 character(STRING) :: VAL_help, options_msg, help_msg, category
748 character(STRING), pointer :: localopts(:) => null()
749 integer :: unit, i
750 character(len = *), parameter :: subname = 'DCArgsHelp'
751 continue
752 if (.not. arg % initialized) then
753 call messagenotify(
'W', subname,
'Call Open before Help in dc_args.')
754 call dcargsopen(arg)
755 end if
756 call dcargsoption(arg,
stoa(
'-h',
'-H',
'--help'), opt_help, val_help, &
757 & help="display this help and exit. " // &
758 & "VAL is unit number (default is standard output)")
760 return
761 end if
762 if (trim(val_help) == '') then
764 else
765 unit =
stoi(val_help)
766 end if
767
769
770 call dchashget(arg % helpmsg,
'TITLE', help_msg, found)
771 if (found) then
772 call printf(unit,
'%c', c1=trim(help_msg))
775 end if
776
777 call dchashget(arg % helpmsg,
'OVERVIEW', help_msg, found)
778 if (found) then
779 call printf(unit,
'Overview::')
780 call printautolinefeed(unit, help_msg, indent=' ')
783 end if
784
785 call dchashget(arg % helpmsg,
'USAGE', help_msg, found)
786 if (found) then
787 call printf(unit,
'Usage::')
788 call printautolinefeed(unit, help_msg, indent=' ')
791 end if
792
793 call printf(unit,
'Options::')
794 if ( associated(arg % opt_table) ) then
795 do i = 1, size(arg % opt_table)
796 options_msg = ' '
797 if (arg % opt_table(i) % optvalue_flag) then
798 call concat(arg % opt_table(i) % options,
'=VAL', localopts)
799 else
800 allocate(localopts(size(arg % opt_table(i) % options)))
801 localopts = arg % opt_table(i) % options
802 end if
803 options_msg = trim(options_msg) // trim(
joinchar(localopts))
804 deallocate(localopts)
805 call printf(unit,
' %c', c1=trim(options_msg))
806 call printautolinefeed(unit, &
807 & arg % opt_table(i) % help_message, indent=' ')
809 end do
810 end if
811
813 do
814 call dchashnext(arg % helpmsg, category, help_msg,
end)
815 if (end) exit
816
817 call printf(unit,
'%c%c::', &
818 & c1=trim(
uchar(category(1:1))), c2=trim(
lchar(category(2:))))
819 call printautolinefeed(unit, help_msg, indent=' ')
821
822 enddo
823
824 call dcargsclose(arg)
825
826 stop
logical function, public present_and_true(arg)
character(string) function, public joinchar(carray, expr)
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
integer, parameter, public stdout
標準出力の装置番号