! Copyright (C) GFD Dennou Club, 2000. All rights reserved ! gtopt module for giving commandline option module module gt_argtable ! 機能 ! ! ユーザは通常 gt_args モジュールに引用仕様を宣言した ! GtArgGet や GtArgCount を呼び出すべきである。これらは内部的に ! gt_argtable を参照し BuildArgTable を呼び出す。 ! ! sysdep の類似関数との相違は、 ! DCL のコマンドラインオプションがある場合、あたかもそれらが ! 存在しないかのように挙動する点である。 ! sysdep の引数番号との対応表 argind_table は ! BuildArgTable によって作成される。 ! ! MS-Windows 環境においてはコマンドラインの長さに制限があるため、 ! この層でレスポンスファイル入力ルーチンを実装するべきであろう。 implicit none ! 添字は gt_args ユーザ向け、配列値は sysdepgetarg の引数 integer, allocatable, save:: argind_table(:) integer, save:: argind_count = -1 contains subroutine BuildArgTable use sysdep use dc_types, only: STRING implicit none integer:: i, narg, nargmax character(len = STRING):: value integer, allocatable:: localtab(:) continue if (argind_count >= 0) return nargmax = SysdepArgCount() allocate(localtab(nargmax)) narg = 0 do, i = 1, nargmax call SysdepArgGet(i, value) if (i == 1 .and. value(1:5) == '-Wl,-') cycle if (value(1:1) == '-' .and. index(value, ':') > 1) cycle narg = narg + 1 localtab(narg) = i enddo argind_count = narg allocate(argind_table(narg)) argind_table(1: narg) = localtab(1: narg) deallocate(localtab) end subroutine end module