| Path: | sysdeparg-common.f90 | 
| Last Update: | Sun Feb 05 17:20:07 +0900 2006 | 
| Authors: | Eizi TOYODA, Yasuhiro MORIKAWA | 
| Version: | $Id: sysdeparg-common.f90,v 1.1 2006-02-05 08:20:07 morikawa Exp $ | 
| Tag Name: | $Name: gt4f90io-20080812 $ | 
| Copyright: | Copyright (C) GFD Dennou Club, 2000-2005. All rights reserved. | 
| License: | See COPYRIGHT | 
通常の処理系では iargc, getarg というサービスサブルーチンが つけられている (残念ながら、これらは Fortran90/95 の規格には 含まれていない)。これを使えない処理系では適宜対処が必要である。 日立コンパイラでは上記サービスサブルーチンの挙動が違うので注意。
| Function : | |
| result : | integer | 
この手続きは、コマンドライン引数の数を返します。 ほとんどの処理系では Fortran90/95 規格外の IARGC() 関数により実装されます。
gets the number of commandline arguments. Most typically, it is implemented by nonstandard built-in function IARGC().
integer function SysdepArgCount() result(result) ! ! この手続きは、コマンドライン引数の数を返します。 ! ほとんどの処理系では Fortran90/95 規格外の <b>IARGC()</b> ! 関数により実装されます。 ! ! gets the number of commandline arguments. ! Most typically, it is implemented by nonstandard built-in ! function <b>IARGC()</b>. ! implicit none ! ! Selected by Makefile using Ruby ! result = iargc() end function SysdepArgCount
| Function : | |
| result : | integer | 
この手続きは、コマンドライン引数の数を返します。 ほとんどの処理系では Fortran90/95 規格外の IARGC() 関数により実装されます。
gets the number of commandline arguments. Most typically, it is implemented by nonstandard built-in function IARGC().
Original external subprogram is sysdeparg-common.f90#SysdepArgCount
| Subroutine : | |
| idx_given : | integer, intent(in) | 
| result : | character(len = *), intent(out) | 
この手続きはコマンドライン引数のうち、index (idx_given) 番目の値を value (result) に返します。
index が引数の数よりも大きい場合、value には空文字 が返ります。index が負の場合には、後方からの順番になります。 すなわち、-1 ならば最後の引数が返ります。
ほとんどの処理系では Fortran90/95 規格外の GETARGC() 関数により実装されます。
gets the *index*th (*idx_given*th) commandline argument to value (result).
If index is more than the number of arguments, value will be filled with blank. If index is negative, *index*th argument in reverse is return to value. In other words, if index = -1, the last argument is returned.
Most typically, it is implemented by nonstandard built-in subroutine GETARG().
subroutine SysdepArgGet(idx_given, result)
  !
  ! この手続きはコマンドライン引数のうち、*index* (*idx_given*)
  ! 番目の値を *value* (*result*) に返します。
  !
  ! *index* が引数の数よりも大きい場合、*value* には空文字
  ! が返ります。*index* が負の場合には、後方からの順番になります。
  ! すなわち、-1 ならば最後の引数が返ります。
  !
  ! ほとんどの処理系では Fortran90/95 規格外の <b>GETARGC()</b>
  ! 関数により実装されます。
  !
  ! gets the *index*th (*idx_given*th) commandline argument
  ! to *value* (*result*).
  !
  ! If *index* is more than the number of arguments,
  ! *value* will be filled with blank.
  ! If *index* is negative, *index*th argument in reverse
  ! is return to *value*. In other words, if *index* = -1,
  ! the last argument is returned.
  !
  ! Most typically, it is implemented by nonstandard built-in
  ! subroutine <b>GETARG()</b>.
  !
  implicit none
  integer, intent(in):: idx_given
  character(len = *), intent(out):: result
  integer:: idx
  integer:: argc
continue
  argc = SysdepArgCount()
  if (idx_given < 0) then
    idx = argc + 1 + idx_given
  else
    idx = idx_given
  endif
  if (idx > argc) then
    result = ""
  else
  !
  ! Selected by Makefile using Ruby
  !
  call getarg(idx, result)
  endif
end subroutine SysdepArgGet