sysdeparg.f90
Go to the documentation of this file.
1 !--
2 ! *** Caution!! ***
3 !
4 ! This file is generated from "sysdeparg.rb2f90" by Ruby 2.3.3.
5 ! Please do not edit this file directly.
6 !
7 ! [JAPANESE]
8 !
9 ! ※※※ 注意!!! ※※※
10 !
11 ! このファイルは "sysdeparg.rb2f90" から Ruby 2.3.3
12 ! によって自動生成されたファイルです.
13 ! このファイルを直接編集しませんようお願い致します.
14 !
15 !
16 !++
17 !
18 !== SysdepArg - 環境依存性ルーチン (コマンドライン取得)
19 !
20 ! Authors:: Eizi TOYODA, Yasuhiro MORIKAWA
21 ! Version:: $Id: sysdeparg.rb2f90,v 1.2 2009-03-22 02:17:32 morikawa Exp $
22 ! Tag Name:: $Name: $
23 ! Copyright:: Copyright (C) GFD Dennou Club, 2000-2005. All rights reserved.
24 ! License:: See COPYRIGHT[link:../../COPYRIGHT]
25 !
26 ! Fortran 95 以前の大抵の処理系では IARGC, GETARG というサービスサブルーチンが
27 ! 用意されている (これらは Fortran90/95 の規格には含まれていない).
28 ! Fortran 2003 規格には COMMAND_ARGUMENT_COUNT, GET_COMMAND_ARGUMENT
29 ! というサブルーチンが規定されている.
30 ! これを使えない処理系では適宜対処が必要である。
31 ! 日立コンパイラでは上記サービスサブルーチンの挙動が違うので注意。
32 !
33 
34 integer function sysdepargcount() result(result)
35  !
36  ! この手続きは, コマンドライン引数の数を返します.
37  ! F95 以前の処理系では Fortran90/95 規格外の <b>IARGC()</b>
38  ! 関数により実装され, F2003 に対応する処理系では
39  ! COMMAND_ARGUMENT_COUNT 関数によって実装されます.
40  !
41  ! Get the number of commandline arguments.
42  ! In F95, it is implemented by nonstandard built-in
43  ! function <b>IARGC()</b>.
44  ! In F2003, it is implemented by standard built-in
45  ! function <b>COMMAND_ARGUMENT_COUNT()</b>.
46  !
47  implicit none
48  !
49  ! Selected by Makefile using Ruby
50  !
51  result = command_argument_count()
52 end function sysdepargcount
53 
54 subroutine sysdepargget(idx_given, result)
55  !
56  ! この手続きはコマンドライン引数のうち、*index* (*idx_given*)
57  ! 番目の値を *value* (*result*) に返します。
58  !
59  ! *index* が引数の数よりも大きい場合、*value* には空文字
60  ! が返ります。*index* が負の場合には、後方からの順番になります。
61  ! すなわち、-1 ならば最後の引数が返ります。
62  !
63  ! ほとんどの処理系では Fortran90/95 規格外の <b>GETARGC()</b>
64  ! 関数により実装されます。
65  !
66  ! gets the *index*th (*idx_given*th) commandline argument
67  ! to *value* (*result*).
68  !
69  ! If *index* is more than the number of arguments,
70  ! *value* will be filled with blank.
71  ! If *index* is negative, *index*th argument in reverse
72  ! is return to *value*. In other words, if *index* = -1,
73  ! the last argument is returned.
74  !
75  ! Most typically, it is implemented by nonstandard built-in
76  ! subroutine <b>GETARG()</b>.
77  !
78  implicit none
79  integer, intent(in):: idx_given
80  character(len = *), intent(out):: result
81  integer:: idx
82  integer:: argc
83  interface
84  integer function sysdepargcount()
85  end function sysdepargcount
86  end interface
87 continue
88  argc = sysdepargcount()
89  if (idx_given < 0) then
90  idx = argc + 1 + idx_given
91  else
92  idx = idx_given
93  endif
94  if (idx > argc) then
95  result = ""
96  else
97  !
98  ! Selected by Makefile using Ruby
99  !
100  call get_command_argument(idx, result)
101  endif
102 end subroutine sysdepargget
103 
104 !--
105 ! vi:set readonly sw=4 ts=8:
106 !
107 !Local Variables:
108 !mode: f90
109 !buffer-read-only: t
110 !End:
111 !
112 !++
subroutine sysdepargget(idx_given, result)
Definition: sysdeparg.f90:55
integer function sysdepargcount()
Definition: sysdeparg.f90:35