From d377b707b67b477ee5b22b08c714be34f3e82aa3 Mon Sep 17 00:00:00 2001 From: sanine-a Date: Fri, 7 Apr 2023 13:59:47 -0500 Subject: switch to cargs and remove honeysuckle --- src/honeysuckle/hs_process_table.c | 86 -------------------------------------- 1 file changed, 86 deletions(-) delete mode 100644 src/honeysuckle/hs_process_table.c (limited to 'src/honeysuckle/hs_process_table.c') diff --git a/src/honeysuckle/hs_process_table.c b/src/honeysuckle/hs_process_table.c deleted file mode 100644 index d07d815..0000000 --- a/src/honeysuckle/hs_process_table.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "honeysuckle.h" - -void hs_pt_set_boolean(bool value, void *data) -{ - *(bool *) data = value; -} - -void hs_pt_set_integer(lua_Integer value, void *data) -{ - *(lua_Integer *) data = value; -} - -void hs_pt_set_number(lua_Number value, void *data) -{ - *(lua_Number *) data = value; -} - -void hs_pt_set_string(const char *value, void *data) -{ - *(const char **) data = value; -} - - -static bool process_key(lua_State *L, struct hs_table_processor *p) -{ - switch (p->type) { - case HS_BOOL: - if (!lua_isboolean(L, -1)) - hs_throw_error(L, - "expected key '%s' to be of type boolean, "\ - "but got type %s instead", - p->key, - lua_typename(L, lua_type(L, -1))); - p->func.boolean(lua_toboolean(L, -1), p->data); - break; - - case HS_INT: - if (!lua_isnumber(L, -1)) - hs_throw_error(L, - "expected key '%s' to be of type integer, "\ - "but got type %s instead", - p->key, - lua_typename(L, lua_type(L, -1))); - p->func.integer(lua_tointeger(L, -1), p->data); - break; - - case HS_NUM: - if (!lua_isnumber(L, -1)) - hs_throw_error(L, - "expected key '%s' to be of type number, "\ - "but got type %s instead", - p->key, - lua_typename(L, lua_type(L, -1))); - p->func.number(lua_tonumber(L, -1), p->data); - break; - - case HS_STR: - if (!lua_isstring(L, -1)) - hs_throw_error(L, - "expected key '%s' to be of type string, "\ - "but got type %s instead", - p->key, - lua_typename(L, lua_type(L, -1))); - p->func.string(lua_tostring(L, -1), p->data); - break; - - default: - // bad type value, throw error - hs_throw_error(L, "bad expected type '%d' for key '%s'", - p->type, p->key); - break; - } -} - -void hs_process_table_(lua_State *L, - int table_index, - int n_processors, - struct hs_table_processor *processors) -{ - for (int i=0; i