The IO-Fortran-Library
is a Fortran module io_fortran_lib
which provides high level routines
for doing internal and external I/O. In particular, the module provides
a handful of generic interfaces and a simple derived type for doing
string-based and array-based I/O that are useful for recording program
data, reading data into programs, writing formatted logs and output,
and for doing advanced string manipulations. For instance, one may read
and write data from/to .csv
and .dat
files, represent numbers as
strings inside of a string expression, efficiently stream text data to
a .log
file, and dynamically manipulate strings with a String
type
(including casting between numeric and string data).
To use io_fortran_lib
with your fpm
project, add the following lines to your fpm.toml
file and use
the
module in your program units to access the routines:
[dependencies]
IO-Fortran-Library = { git="https://github.com/acbbullock/IO-Fortran-Library", branch="main" }
The module is fully self-contained, with no external dependencies, and
is written to be portable and compliant to the Fortran 2018 standard
such that no special extensions or compiler options should be required.
The public interfaces accept all intrinsic numeric types (integer
,
real
, and complex
) and all standard kinds provided by the intrinsic
iso_fortran_env
module (int8
, int16
, int32
, int64
, real32
,
real64
, and real128
). All array-based routines additionally support
up to rank 15.
The API documentation for this project was generated by
FORD (the Fortran
documentation generator) and is available at
IO-Fortran-Library.
To view the documentation locally, clone this repository and view
/doc/index.html
in your browser.
For a list of available interfaces and how to call them, see the reference guide. For further information, see the important user information and the tutorials for complete example programs.
- Fixed a "z" format string conversion bug.
- Updated documentation.
- Modified benchmark programs.
- Added implementations for cast.
- Improved performance for count, read_file, and write_file, as well as split for very large strings. The read/write performance is 2-4x faster than previous (compiler-dependent).
- The
String
type has been greatly expanded and can now serve as an interface for advanced string manipulations and text file I/O. See the references for type-bound procedures and the tutorials for more information. - New constants have been added for public use to facilitate file I/O consistently on a variety of platforms.
- New interface String
for an elemental version of
str
with a return type ofString
. - New interface cast
for casting
character
andString
data into numeric variables. - New interfaces join and split for joining and splitting strings.
- New operator interfaces
for string manipulations involving both
character
andString
types.
- Slightly modified interfaces for echo and from_file to accept an additional optional argument each.
- Test programs have been added in
/test
, which are all passing in the following configurations with lowest and highest optimizations enabled:- GNU Fortran Compiler v11.3.0 on Linux
- Intel Fortran Compiler v2023.0.0 on Linux
- Intel Fortran Compiler Classic v2021.8.0 on Linux
- GNU Fortran Compiler v11.2.0 on Windows 11
- Intel Fortran Compiler v2023.0.0 on Windows 11
- Intel Fortran Compiler Classic v2021.8.0 on Windows 11
- Removed vertical bars in aprint which were displayed incorrectly in terminals with display encoding different from UTF-8.
- Text file I/O has been optimized for performance and memory usage, and expanded to support processing of large files.
All source code referenced is distributed under the MIT license.
For bug fixes or feature requests, feel free to open an issue at the project repository or contact acb.bullock@gmail.com.