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_parse_args.c | 149 ---------------------------------------- 1 file changed, 149 deletions(-) delete mode 100644 src/honeysuckle/hs_parse_args.c (limited to 'src/honeysuckle/hs_parse_args.c') diff --git a/src/honeysuckle/hs_parse_args.c b/src/honeysuckle/hs_parse_args.c deleted file mode 100644 index d6d3b3c..0000000 --- a/src/honeysuckle/hs_parse_args.c +++ /dev/null @@ -1,149 +0,0 @@ -#include - -#include "honeysuckle.h" - -static bool check_parse(lua_State *L, int index, struct hs_arg *expected) -{ - switch(expected->type) { - case HS_BOOL: - if (!lua_isboolean(L, index)) - return false; - *(expected->ptr.boolean) = lua_toboolean(L, index); - return true; - - case HS_INT: - if (!lua_isnumber(L, index)) - return false; - *(expected->ptr.integer) = lua_tointeger(L, index); - return true; - - case HS_NUM: - if (!lua_isnumber(L, index)) - return false; - *(expected->ptr.number) = lua_tonumber(L, index); - return true; - - case HS_STR: - if (!lua_isstring(L, index) || lua_isnumber(L, index)) - return false; - *(expected->ptr.string) = (char *) lua_tostring(L, index); - return true; - - case HS_TBL: - if (!lua_istable(L, index)) - return false; - *(expected->ptr.stack_index) = index; - return true; - - case HS_FUNC: - if (!lua_isfunction(L, index)) - return false; - *(expected->ptr.stack_index) = index; - return true; - - case HS_CFUNC: - if (!lua_iscfunction(L, index)) - return false; - *(expected->ptr.function) = lua_tocfunction(L, index); - return true; - - case HS_USER: - if (!lua_isuserdata(L, index)) - return false; - *(expected->ptr.userdata) = lua_touserdata(L, index); - return true; - - case HS_LIGHT: - if (!lua_islightuserdata(L, index)) - return false; - *(expected->ptr.userdata) = lua_touserdata(L, index); - return true; - - case HS_NIL: - if (!lua_isnil(L, index)) - return false; - *(expected->ptr.stack_index) = index; - - case HS_ANY: - *(expected->ptr.stack_index) = index; - return true; - - default: - return false; - } -} - - -static bool try_parse_args(lua_State *L, int n_args, struct hs_arg *arguments) -{ - int args_provided = lua_gettop(L); - if (args_provided != n_args) - return false; - - for (int i=0; i