FiNeR
March 2, 2026 ยท View on GitHub
Fortran INI ParseR and generator
a pure Fortran 2003+ OOP library for reading and writing INI configuration files.
| ๐ File & string parsing Load from disk or an in-memory string โ no schema required | ๐ฌ Multi-line & comments Continuation lines and ; inline comments handled automatically | ๐ค Polymorphic values integer, real, logical, character, and arrays of any PENF kind | โ๏ธ Generate INI Build and save INI files programmatically with add/del/save |
|---|---|---|---|
๐ Introspectionhas_section, has_option, index, count_values, items, loop | โ๏ธ Configurable Custom option separator, comment chars, and inline delimiters | ๐๏ธ OOP designed Single file_ini type, all functionality as type-bound procedures | ๐ฆ Multiple build systems FoBiS, CMake |
Documentation
For full documentation (guide, API reference, examples, etc...) see the FiNeR website.
Authors
- Stefano Zaghi โ @szaghi
Contributions are welcome โ see the Contributing page.
Copyrights
This project is distributed under a multi-licensing system:
- FOSS projects: GPL v3
- Closed source / commercial: BSD 2-Clause, BSD 3-Clause, or MIT
Anyone interested in using, developing, or contributing to this project is welcome โ pick the license that best fits your needs.
Quick start
use finer
use penf, only: R4P
implicit none
type(file_ini) :: fini
character(len=:), allocatable :: source
real(R4P), allocatable :: array(:)
integer :: error
source = '[section-1]'//new_line('A')// &
'option-1 = one'//new_line('A')// &
'option-2 = 2.'//new_line('A')// &
' 3.'//new_line('A')// &
'[section-2]'//new_line('A')// &
'option-1 = foo'
call fini%load(source=source)
allocate(array(1:fini%count_values(section_name='section-1', option_name='option-2')))
call fini%get(section_name='section-1', option_name='option-2', val=array, error=error)
if (error == 0) print *, array ! 2.0 3.0
call fini%add(section='sec-foo', option='bar', val=-32.1_R4P)
call fini%save(filename='foo.ini')
See src/tests/ for more examples including multi-value arrays, logical options, and file round-trips.
Install
FoBiS
Standalone โ clone, fetch dependencies, and build:
git clone https://github.com/szaghi/FiNeR && cd FiNeR
FoBiS.py fetch # fetch BeFoR64, FACE, FLAP, PENF, StringiFor
FoBiS.py build -mode finer-static-gnu # build static library
As a project dependency โ declare FiNeR in your fobos and run fetch:
[dependencies]
deps_dir = src/third_party
FiNeR = https://github.com/szaghi/FiNeR
FoBiS.py fetch # fetch and build
FoBiS.py fetch --update # re-fetch and rebuild
CMake
git clone https://github.com/szaghi/FiNeR --recursive && cd FiNeR
cmake -B build && cmake --build build && ctest --test-dir build
As a CMake subdirectory:
add_subdirectory(FiNeR)
target_link_libraries(your_target FiNeR::FiNeR)