FLIBS - A collection of Fortran modules

The FLIBS project provides a collection of individual Fortran modules that perform particular tasks, such as:

The source code and documentation can be found here, a series of observations about Fortran can be found here.

Some experimental programs that may be of interest appear in the directory experiments.

Contents of the collection

Currently, FLIBS consists of the following modules:

DirectoryModulePurpose
SQLitesqlite Module to provide an easy-to-use interface to the SQLite library, a light-weight database management system.
Lemonflemon Lemon is a parser generator comparable to Yacc and Bison and flemon is an adaptation to generate Fortran code
Strings glob_matching Match strings to (simplified) glob patterns, such as "*.f90". The module does not support character classes yet.
csv_file Write comma-separated-values (CSV) files. The module takes care of quotation marks in strings and provides a simple interface to write individual data as well as one-dimensional arrays and matrices
filedir Manipulate directory and file names. It contains routines to split a full path into directories and file names, to smoothly join directory and file names and so on.
edit_text, singleline_text, multiline_text Modules that provide storage facilities for arbitrary-length strings. The emphasis is on storage, not on providing a full-featured varying-string-length module.
tokenize Module to split a string into pieces according to certain fairly basic, but common criteria.
simple manipulations Module with simple string manipulations like, reversing the characters, changing the case to upper or lower case, generating random words.
m_vstring Module for handling strings with a dynamic length. It contains a set of high-level facilities to manipulate such strings.
m_vstringlist Module for handling lists of strings with a dynamic length. Individual elements can easily be accessed or changed.
m_vstringformat Module for formatting strings with a dynamic length.
Data structures linked_lists Generic source code for implementing linked lists. The test program illustrates how the genericity is achieved.
binary_trees Generic source code for implementing binary trees. Balancing is not taken care of.
queues Generic source code for implementing queue of fixed size.
dictionaries Generic source code for implementing a mapping of strings to data. New: Implemented via a simple hash table (the original used a linked list).
vectors Generic source code for implementing an expandable array of data.
sets Generic source code for implementing unordered sets - collections of data objects that support operations like union and intersection.
sorting Generic source code that implements a combined QuickSort/InsertionSort algorithm for fast sorting arrays (contributed by Joe Krahn).
memory pool Generic source code that implements a straightforward memory pool. Use this to reduce the number of individual allocations and deallocations of data items of a fixed type.
indexset Implementation of a bit array using the bit manipulation functions of Fortran 90/95. Useful for handling sets that consist of integers or can be mapped to integers.
Computational facilities automatic_differentiation General technique for determining the first derivative of a function via mathematical, not numerical means.
select_precision Auxiliary module for selecting the precision of real variables.
timing Small module for timing parts of a program. This may be used to detect which part is taking most computing time or to compare different algorithms
decimal_arithmetic Module for implementing decimal arithmetic, as opposed to floating-point numbers.
interval_simple Module implementing interval arithmetic in a straightforward manner.
m_coordinates Basic coordinate transformations, such as spherical to cartesian.
pointsets Collection of routines to generate sets of points in one, two or three dimensions with certain properties.
combinations Routines for random permutations and other combinatorial functions. (Very limited at the moment)
backtracking Module to implement backtracking algorithms. It offers a single routine that controls the generation and checking of possible solutions. The user must supply a small number of routines and a single data type to implement the specific problem.
simulated_annealing Use the technique of simulated annealing to minimize a function of several variables.
genetic_algorithms Straightforward implementation of a genetic algorithm to minimize a function of several variables.
libdate Module for manipulating date and time information.
Streams binary streams Module to read and write files as a "stream" of bytes. Some caution: it relies on certain assumptions about the sizes of integers and reals and on the treatment of direct-access files.
text streams Module to read ordinary text files as a "stream" of words and numbers. It is not without limitations, but it may be a practical approximation to the real thing.
Unit testing ftnunit Module and auxiliary scripts that implement a unit testing framework akin to JUnit
gentabletest.tcl Tcl program to generate a test program based on a tabular description
testmake Program to create complete test programs based on specifications. See also: the article on this program
IPC ipc_file Module for exchanging information (inter-process communication) between two or more programs (processes) via files on disk. Preliminary version!
Checking checking Module and auxiliary program that instrument source code to trace what subroutines are called and what files are opened. It helps understand a program written by others.
chksys Collection of test programs to detect all manner of properties of the Fortran compiler - like what unit is used for the record length of direct access files and many other portability aspects.
Wrapper Wrapping C functions Auxiliary program to scan a C header file and produce code so that you can easily use the C functions in a Fortran program.
Files and directories fieldir Collection of portable routines to manipulate files and directories or retrieve detailed information
m_vfile Collection of portable routines to manipulate files and directories or retrieve detailed information in an object-oriented fashion
m_fileunit Routines to manage logical unit numbers
Platform platform Portable routines (as far as possible) to run external programs and to find out details of the operating system
platform Platform-dependent routines and features (uses variable-length strings)
Reporting reporting Set of routines with a common interface to write report files in HTML, Latex and RTF formats
m_logger Module for writing log files
m_exception Module for handling assertions and treating exceptions (to a certain extent) Note: preliminary version - some changes to the interface will be made
Control structures Finite state machines Facilities to help set up a finite state machine
messages Facilities for dealing with "messages", for instance in the context of discrete event simulations
Tools editcode Preprocessor for Fortran code meant for such things as replacing types by other types, assertions and other preprocessing tasks. Not a C-style preprocessor though!
CGI cgi_protocol Facilitate the interaction between Fortran programs and web servers using the CGI protocol

Note: Most modules come with test/example programs. The test/example programs should provide at least some indication on how to use the modules.

Though making the modules and test programs should be straightforward, there are no formal makefiles yet to actually make them - most development and testing so far has been done on Windows with Compaq Visual Fortran, which uses so-called project files.

Ideas still to be implemented


Experiments

The directory "experiments" contains several programs that simply try out a few ideas:
-- Arjen Markus, Michael Baudin, dd. october 2008