Skip to content

szaghi/FiNeR

Repository files navigation

FiNeR

Fortran INI ParseR and generator

a pure Fortran 2003+ OOP library for reading and writing INI configuration files.

GitHub tag GitHub issues CI Coverage License

📂 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
🔍 Introspection
has_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.


Authors

Contributions are welcome — see the Contributing page.

Copyrights

This project is distributed under a multi-licensing system:

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)

About

Fortran INI ParseR and generator

Topics

Resources

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors