Skip to content

flap_config_m ​

Configuration file reader: a small INI subset, the value source below the environment (F08 of #125).

Format: key = value lines; [section] starts a section (a group, i.e. a command; the keys before any section belong to the top level, section ''); blank lines and lines starting with '#' or ';' are comments; an inline comment starts at a '#' or ';' preceded by a blank; one pair of quotes (' or ") around a value is stripped, and a quoted value keeps its '#' and ';'. Lines have any length. Any other line is malformed: its number is recorded.

Source: src/lib/flap_config_m.f90

Dependencies

Contents ​

Derived Types ​

config_file ​

Entries of a configuration file.

Components ​

NameTypeAttributesDescription
sectiontype(flap_string)allocatableSection of each entry ('' for the top level).
keytype(flap_string)allocatableKey of each entry.
valuetype(flap_string)allocatableValue of each entry.
lineinteger(kind=I4P)allocatableLine number of each entry.
ninteger(kind=I4P)Number of entries.
bad_lineinteger(kind=I4P)Line number of the first malformed line, 0 if none.

Type-Bound Procedures ​

NameAttributesDescription
loadpass(self)Load a file.
lookuppass(self)Look up the value of a key.

Subroutines ​

load ​

Load a configuration file; found is false (and nothing is loaded) when the file does not exist.

fortran
subroutine load(self, file, found, iostat, iomsg)

Arguments

NameTypeIntentAttributesDescription
selfclass(config_file)inoutConfiguration.
filecharacter(len=*)inFile name.
foundlogicaloutThe file exists.
iostatinteger(kind=I4P)outI/O status (0 when read, or not found).
iomsgcharacter(len=:)outallocatableI/O message.

Call graph

lookup ​

Look up the value of a key in a section: the last entry wins.

Attributes: pure

fortran
subroutine lookup(self, section, key, value, found)

Arguments

NameTypeIntentAttributesDescription
selfclass(config_file)inConfiguration.
sectioncharacter(len=*)inSection ('' for the top level).
keycharacter(len=*)inKey.
valuecharacter(len=:)outallocatableValue ('' if not found).
foundlogicaloutThe key is in the section.

Call graph

Functions ​

tabs_to_blanks ​

Return a string with its tabs replaced by blanks.

Attributes: pure

Returns: character(len=len(string))

fortran
function tabs_to_blanks(string) result(blanked)

Arguments

NameTypeIntentAttributesDescription
stringcharacter(len=*)inString.