Add dump
Some checks failed
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=OFF (push) Failing after 13s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=OFF (push) Successful in 16s
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=ON (push) Failing after 14s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=ON (push) Successful in 17s
CMake / ubuntu-latest - shared=OFF, pthread=ON, posix=ON (push) Failing after 18s
CMake / ubuntu-latest - shared=ON, pthread=ON, posix=ON (push) Successful in 15s

Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
2025-07-26 23:41:34 +03:00
parent 0b5c556f84
commit e49654efb1
6 changed files with 411 additions and 24 deletions

View File

@@ -4,6 +4,7 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#ifdef __cplusplus
extern "C" {
@@ -17,6 +18,7 @@ typedef struct dcfg_StringView {
char const *data;
size_t size;
} dcfg_StringView;
#define dcfg_SV(cstr) ((dcfg_StringView) { .data = cstr, .size = strlen(cstr) })
typedef void *(*dcfg_AllocFn)(size_t); // This should automatically zero memory.
typedef void (*dcfg_FreeFn)(void *);
@@ -75,6 +77,8 @@ bool dcfg_Value_get_object_field_ex(dcfg_Value *value,
dcfg_StringView const key, dcfg_Value **out_value, bool const evaluate);
bool dcfg_Value_get_array_item_ex(dcfg_Value *value, size_t const index,
dcfg_Value **out_value, bool const evaluate);
bool dcfg_Value_get_function_body_ex(
dcfg_Value *value, dcfg_Value **out_value, bool evaluate);
bool dcfg_Value_get_boolean(dcfg_Value *value, bool *out_value);
bool dcfg_Value_get_integer(dcfg_Value *value, int64_t *out_value);
@@ -95,6 +99,10 @@ static inline bool dcfg_Value_get_array_item(
{
return dcfg_Value_get_array_item_ex(value, index, out_value, true);
}
bool dcfg_Value_get_function_body(dcfg_Value *value, dcfg_Value **out_value)
{
return dcfg_Value_get_function_body_ex(value, out_value, true);
}
bool dcfg_call_function(dcfg_Value *function, dcfg_Value **args,
size_t arg_count, dcfg_Value **out_value);