Loading...
Searching...
No Matches
inference_settings.c
Go to the documentation of this file.
20 * @details Module callbacks own module-specific keys; this layer never guesses a model's meaning. */
109 const int count = snprintf(joined, sizeof(joined), "%s%s", value[0] == '/' ? "" : absolute, value);
150/** @brief Delegate only unknown common keys; an invalid common key must not be accepted by a module. */
172 char *paths[] = {settings->model, settings->descriptor, settings->library_directory, settings->input};
213 /* Never search cwd: launching from another directory must not silently select another assignment. */
216 else if (directory == 1) count = snprintf(relative, sizeof(relative), "../modules/%s/%s_settings.ini", module, application);
217 else if (directory == 2) count = snprintf(relative, sizeof(relative), "../share/%s/%s_settings.ini", application, application);
218 else if (directory == 3) count = snprintf(relative, sizeof(relative), "modules/%s/%s_settings.ini", module, application);
219 else count = snprintf(relative, sizeof(relative), "share/%s/%s_settings.ini", application, application);
static bool ini_uint(const char *text, uint64_t *number)
Parse digits-only uint64; overflow and signs are rejected.
Definition bounded_ini.h:52
static bool ini_read_file(const char *filename, char *buffer, size_t capacity, size_t *length)
Read a nonempty regular file smaller than capacity and append NUL.
Definition bounded_ini.h:98
bool(* ini_field_handler)(void *context, const char *key, const char *value)
Definition bounded_ini.h:35
static bool ini_parse(char *buffer, size_t length, ini_field_handler handler, void *context)
Destructively parse flat fields with blank lines and #/; comment lines.
Definition bounded_ini.h:132
static bool start(uint32_t session)
Admit a nonzero session and discard correlation from the previous one.
Definition dipla_camera_backend.c:170
static bool settings_field(void *context, const char *key, const char *value)
Delegate only unknown common keys; an invalid common key must not be accepted by a module.
Definition inference_settings.c:151
bool inference_settings_find(const char *application, const char *module, char *filename, size_t capacity)
Discover application_settings.ini in adjacent, development-module, then installed-share order.
Definition inference_settings.c:202
bool inference_resolve_path(const char *base_file, const char *value, char *destination, size_t capacity)
Resolve an INI-relative path without requiring its destination to exist yet.
Definition inference_settings.c:93
int inference_settings_field(struct inference_settings *settings, const char *key, const char *value)
Parse one common key without consuming module-specific keys.
Definition inference_settings.c:53
static bool text_copy(char *destination, size_t capacity, const char *source)
Reject truncation and control characters before accepting configuration text.
Definition inference_settings.c:40
bool inference_settings_read(struct inference_settings *settings, const char *filename, ini_field_handler extra, void *context, char *error, size_t capacity)
Parse one flat INI, delegate application keys and resolve paths against the selected file.
Definition inference_settings.c:158
void inference_settings_init(struct inference_settings *settings, enum inference_backend backend)
Reset storage and select conservative thread/timeout defaults.
Definition inference_settings.c:28
Shared application_settings.ini discovery with module-owned extra keys.
inference_backend
Backend selection; AUTO resolves the model suffix, never an execution error.
Definition inference_settings.h:34
Per-application configuration; all resolved paths belong to this caller-owned value.
Definition inference_settings.h:39
char descriptor[INFERENCE_PATH_CAPACITY]
Definition inference_settings.h:43
char library_directory[INFERENCE_PATH_CAPACITY]
Definition inference_settings.h:44
Borrowed dispatch state scoped to one destructive INI parse.
Definition inference_settings.c:144