Initial implementation of tuple demonstration

This allows allocating a buffer of double pointers pointing to
the memory location in a bunch of variables. It is not particularly
ergonomic as is, and it seems unlikely the real world performance
benefit will exist.
This commit is contained in:
2024-02-27 21:59:10 -06:00
parent ef29b8abcb
commit 08e9bf08e7
4 changed files with 67 additions and 2 deletions

View File

@@ -61,7 +61,7 @@ typedef struct KiwiExpression {
#if defined(LJKIWI_LUAJIT_DEF)
KiwiTerm terms_[?];
#elif defined(LJKIWI_USE_FAM_1)
KiwiTerm terms_[1]; // LuaJIT: struct KiwiTerm terms_[?];
KiwiTerm terms_[1];
#else
KiwiTerm terms_[];
#endif
@@ -74,8 +74,22 @@ typedef struct KiwiErr {
bool must_free;
} KiwiErr;
typedef struct KiwiTuple {
int count;
#if defined(LJKIWI_LUAJIT_DEF)
const double* values[?];
#elif defined(LJKIWI_USE_FAM_1)
const double* values[1];
#else
const double* values[];
#endif
} KiwiTuple;
struct KiwiSolver;
LJKIWI_EXP void kiwi_tuple_init(KiwiTuple* tuple, int count, ...);
LJKIWI_EXP void kiwi_tuple_destroy(KiwiTuple* tuple);
LJKIWI_EXP KiwiVar* kiwi_var_construct(const char* name);
LJKIWI_EXP void kiwi_var_release(KiwiVar* var);
LJKIWI_EXP void kiwi_var_retain(KiwiVar* var);