![]() |
Fun API Documentation 0.42.1
The programming language that makes you have fun!
|
iniparser helpers for Fun VM INI-related opcodes (conditional build). More...
#include <iniparser/dictionary.h>#include <iniparser/iniparser.h>#include <ctype.h>#include <stdio.h>#include <string.h>#include <stddef.h>Go to the source code of this file.
Data Structures | |
| struct | IniSlot |
| One slot in the global INI handle registry. More... | |
Functions | |
| int | ini_alloc_handle (dictionary *d) |
| Allocate a registry handle for a newly created dictionary. | |
| dictionary * | ini_get (int h) |
| Look up a dictionary pointer by registry handle. | |
| int | ini_free_handle (int h) |
| Free a previously allocated handle and close its dictionary. | |
| void | ini_make_full_key (char *buf, size_t cap, const char *sec, const char *key) |
| Build a fully qualified key of the form "section:key". | |
Variables | |
| IniSlot | g_ini [64] |
| Fixed-size registry of iniparser dictionaries. | |
iniparser helpers for Fun VM INI-related opcodes (conditional build).
This module centralizes small utilities and a tiny handle registry used by VM opcodes that interact with INI configuration files through the iniparser library. Placing the concrete logic in src/extensions/ keeps the opcode implementations minimal — they focus on VM stack marshalling and delegate the concrete work here, mirroring other extensions (PCRE2, SQLite, XML2).
Build-time feature flag:
Registry and ownership model:
Thread-safety:
Key formatting helper:
Definition in file ini.c.
| int ini_alloc_handle | ( | dictionary * | d | ) |
Allocate a registry handle for a newly created dictionary.
Transfers ownership of the dictionary pointer to the registry on success.
| d | Pointer to an initialized iniparser dictionary (e.g., from iniparser_load()). Must not be NULL. |
| int ini_free_handle | ( | int | h | ) |
Free a previously allocated handle and close its dictionary.
If the slot holds a dictionary, iniparser_freedict() is called. The slot is then marked available for reuse.
| h | Handle id to free. |
| dictionary * ini_get | ( | int | h | ) |
Look up a dictionary pointer by registry handle.
The returned pointer is owned by the registry; callers must not free it directly. Use ini_free_handle() to release the association.
| h | Handle id previously returned by ini_alloc_handle(). |
| void ini_make_full_key | ( | char * | buf, |
| size_t | cap, | ||
| const char * | sec, | ||
| const char * | key ) |
Build a fully qualified key of the form "section:key".
Writes into a caller-provided buffer a key qualified by section, as expected by iniparser lookups. If sec is NULL, an empty section is used. If key is NULL, an empty key is used. The function is a no-op if buf is NULL or cap is
| buf | Destination buffer. |
| cap | Capacity of buf in bytes (including terminator). |
| sec | Section name (may be NULL for default/empty section). |
| key | Key name (may be NULL to produce an empty key). |