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 |
For full documentation (guide, API reference, examples, etc...) see the FiNeR website.
- Stefano Zaghi — @szaghi
Contributions are welcome — see the Contributing page.
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.
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.
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 libraryAs a project dependency — declare FiNeR in your fobos and run fetch:
[dependencies]
deps_dir = src/third_party
FiNeR = https://github.com/szaghi/FiNeRFoBiS.py fetch # fetch and build
FoBiS.py fetch --update # re-fetch and rebuildgit clone https://github.com/szaghi/FiNeR --recursive && cd FiNeR
cmake -B build && cmake --build build && ctest --test-dir buildAs a CMake subdirectory:
add_subdirectory(FiNeR)
target_link_libraries(your_target FiNeR::FiNeR)