summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/honeysuckle.c19
-rw-r--r--src/honeysuckle.h45
-rw-r--r--src/hs_create_table.c10
3 files changed, 50 insertions, 24 deletions
diff --git a/src/honeysuckle.c b/src/honeysuckle.c
index 1d8da6b..2689544 100644
--- a/src/honeysuckle.c
+++ b/src/honeysuckle.c
@@ -1,24 +1,5 @@
#include "honeysuckle.h"
-void hs_parse_args_(lua_State *L, int n_args, struct hs_arg *arguments)
-{
- L = L;
-}
-
-int hs_parse_overloaded_(lua_State *L, ...)
-{
- L = L;
- return -1;
-}
-
-
-int hs_create_table(lua_State *L, ...)
-{
- lua_createtable(L, 0, 0);
- L = L;
- return 0;
-}
-
int hs_create_enum(lua_State *L, ...)
{
lua_createtable(L, 0, 0);
diff --git a/src/honeysuckle.h b/src/honeysuckle.h
index db26562..f54a261 100644
--- a/src/honeysuckle.h
+++ b/src/honeysuckle.h
@@ -60,8 +60,10 @@ struct hs_arg {
void hs_parse_args_(lua_State *L, int n_args, struct hs_arg *arguments);
-#define hs_parse_args(L, ...) \
- hs_parse_args_(L, VA_NARGS(__VA_ARGS__)/2, (struct hs_arg[]) { __VA_ARGS__ })
+#define hs_parse_args(L, ...) \
+ hs_parse_args_(L, \
+ VA_NARGS(__VA_ARGS__)/2, \
+ (struct hs_arg[]) { __VA_ARGS__ })
#define hs_overload(...) VA_NARGS(__VA_ARGS__)/2, (struct hs_arg[]) { __VA_ARGS__ }
@@ -99,7 +101,7 @@ struct hs_tbl_entry {
lua_CFunction function;
void *userdata;
} value;
-}
+};
#define hs_bool_bool(key, value) \
{ HS_BOOL, .key.boolean=key, HS_BOOL, .value.boolean=value }
@@ -253,8 +255,20 @@ struct hs_tbl_entry {
#define hs_light_light(key, value) \
{ HS_LIGHT, .key.userdata=key, HS_LIGHT, .value.userdata=value }
+int hs_create_table_(lua_State *L, int n_elements, struct hs_tbl_entry *elements);
+
+#define hs_create_table(L, ...) \
+ hs_create_table_(L, \
+ VA_NARGS(__VA_ARGS__)/4, \
+ (struct hs_tbl_entry[]) { __VA_ARGS__ })
-int hs_create_table(lua_State *L, ...);
+
+/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * hs_process_table
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
void hs_process_table(lua_State *L, int table_index, void *data, ...);
// default processors
@@ -263,16 +277,37 @@ void hs_pt_set_integer(lua_Integer value, void *data);
void hs_pt_set_number(lua_Number value, void *data);
void hs_pt_set_string(const char *value, void *data);
+
+/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * hs_pushstring
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
void hs_vpushstring(lua_State *L, const char *format_string, va_list args);
void hs_pushstring(lua_State *L, const char *format_string, ...);
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * error creation and handling
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
void hs_throw_error(lua_State *L, const char *format_string, ...);
int hs_traceback(lua_State *L);
int hs_call(lua_State *L, int nargs, int nret);
+
+/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * registry operations
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
#define hs_rstore(L) luaL_ref(L, LUA_REGISTRYINDEX);
#define hs_rload(L, ref) lua_rawgeti(L, LUA_REGISTRYINDEX, ref)
#define hs_rdel(L, ref) luaL_unref(L, LUA_REGISTRYINDEX, ref)
diff --git a/src/hs_create_table.c b/src/hs_create_table.c
new file mode 100644
index 0000000..a394f6e
--- /dev/null
+++ b/src/hs_create_table.c
@@ -0,0 +1,10 @@
+#include "honeysuckle.h"
+
+int hs_create_table_(lua_State *L,
+ int n_elements,
+ struct hs_tbl_entry *elements)
+{
+ L=L;
+ n_elements = n_elements;
+ elements = elements;
+}