M_F2KCLI(3f) - [M_f2kcli]Fortran 200x Command Line Interface for Programming Environments without it
Synopsis
Description
Author
Conditions Of Use
Example
use M_f2kcli, only: command_argument_count use M_f2kcli, only: get_command use M_f2kcli, only: get_command_argument
The M_f2kcli(3f) module contains procedures useful for reading command line arguments from Fortran programs in Fortran 90 programming environments that do not support the new Fortran 2003 standardized procedures.
An extensive set of such routines is available on-line from Winteractor. The M_F2KCLI(3f) module found here is based on a single routine from this collection.
M_F2KCLI is an implementation of the Fortran command line interface as defined in the Fortran F2003 standard:
COMMAND_ARGUMENT_COUNT : Returns the number of command arguments. GET_COMMAND_ARGUMENT : Returns a command argument. GET_COMMAND : Returns the entire command by which the program was invoked.F2KCLI(2f) is intended to provide the definitive solution to the long standing lack of standardised command line access in Fortran, until F2003 compilers become generally available.
For the latest version of F2KCLI go to:
http://www.winteracter.com/f2kcli
Copyright Interactive Software Services Ltd. 2001
Platform : Unix/Linux Compiler : Any Fortran 9x compiler supporting IARGC/GETARG which counts the first true command line argument after the program name as argument number one. (Excludes compilers which require a special USE statement to make IARGC/GETARG available). Implementer : Lawson B. Wakefield, I.S.S. Ltd. Date : February 2001
F2KCLI has been developed by Interactive Software Services Ltd. based on the F2003 standard, on a voluntary basis. The F2KCLI source code, object code and documentation is copyright Interactive Software Services Ltd. 2001-2005 (with the obvious exception of the definitions of the F2003 command line interface routines themselves).This software is provided as-is, without any express or implied warranty. In no event will the copyright owner be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, subject to the following conditions:
If you amend F2KCLI or develop an implementation for a previously unsupported compiler/platform combination, you are invited to contribute your implementation to the F2KCLI file set. The origin of any such contributions will be fully acknowledged.
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. The supplied source code may be altered, but only to correct any failure to conform to the F2003 command line interface standard or to allow its use with a previously unsupported compiler/platform combination. 3. Altered source versions must be plainly marked as such and must not be misrepresented as being the original software. 4. You may not sell F2KCLI as a product in its own right. F2KCLI is free software (as in "free lunch" or "free beer").
Sample program
program demo_M_f2kcli use M_f2kcli, only : command_argument_count use M_f2kcli, only : get_command use M_f2kcli, only : get_command_argument implicit none character(len=256) :: line character(len=256) :: exe character(len=40) :: cmd integer :: narg,iarg narg = command_argument_count() write(unit=*,fmt=*) "Arg count=", narg call get_command(line) write(unit=*,fmt=*) "Line=",trim(line) call get_command_argument(0,exe) write(unit=*,fmt=*) "Program=",trim(exe) do iarg = 1,narg call get_command_argument(iarg,cmd) WRITE(unit=*,fmt=*) "Arg ",IARG,"=",CMD enddo stop end program demo_M_f2kcli
M_f2kcli (3) | March 11, 2021 |