summaryrefslogtreecommitdiff
path: root/libs/honeysuckle/examples
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-03-02 00:20:38 -0600
committersanine <sanine.not@pm.me>2023-03-02 00:20:38 -0600
commit5bb783912ac384156b8abbe6e83a5a61da73881d (patch)
treec160295a01871d8e27beadac5fd1d3b9b0308e07 /libs/honeysuckle/examples
parentfb0b24647350df9514c5db6f2330921f97804731 (diff)
fully remove honeysuckle and stop building cglm
Diffstat (limited to 'libs/honeysuckle/examples')
-rw-r--r--libs/honeysuckle/examples/argument_parsing/argument_parsing.c23
-rw-r--r--libs/honeysuckle/examples/table_creation/table_creation.c28
-rw-r--r--libs/honeysuckle/examples/table_processing/table_processing.c60
3 files changed, 0 insertions, 111 deletions
diff --git a/libs/honeysuckle/examples/argument_parsing/argument_parsing.c b/libs/honeysuckle/examples/argument_parsing/argument_parsing.c
deleted file mode 100644
index 11a48f4..0000000
--- a/libs/honeysuckle/examples/argument_parsing/argument_parsing.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <honeysuckle.h>
-
-int demo(lua_State *L)
-{
- lua_Integer i;
- lua_Number n;
- char *string;
- hs_parse_args(L, hs_int(i), hs_num(n), hs_str(string));
- printf("received %ld, %f, and %s\n", i, n, string);
- return 0;
-}
-
-int main()
-{
- lua_State *L = luaL_newstate();
- luaL_openlibs(L);
-
- lua_pushcfunction(L, demo);
- lua_setglobal(L, "demo");
-
- luaL_dostring(L, "demo(12, 34.4, 'hi there!')");
- return 0;
-}
diff --git a/libs/honeysuckle/examples/table_creation/table_creation.c b/libs/honeysuckle/examples/table_creation/table_creation.c
deleted file mode 100644
index 42088c6..0000000
--- a/libs/honeysuckle/examples/table_creation/table_creation.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <honeysuckle.h>
-
-int main()
-{
- lua_State *L = luaL_newstate();
- luaL_openlibs(L);
-
- /* create the table
- * { "one"=1, "two"=2, "half"=0.5, "runme"=[some function] }
- */
- luaL_dostring(L,
- "return function(self) \n" \
- "print(self.one)\n" \
- "print(self.two)\n" \
- "print(self.half)\n" \
- "end");
- int func_index = lua_gettop(L);
-
- hs_create_table(L,
- hs_str_int("one", 1),
- hs_str_int("two", 2),
- hs_str_num("half", 0.5f),
- hs_str_func("runme", func_index));
- lua_setglobal(L, "runnable");
-
- luaL_dostring(L, "runnable:runme()");
- return 0;
-}
diff --git a/libs/honeysuckle/examples/table_processing/table_processing.c b/libs/honeysuckle/examples/table_processing/table_processing.c
deleted file mode 100644
index 64c1f01..0000000
--- a/libs/honeysuckle/examples/table_processing/table_processing.c
+++ /dev/null
@@ -1,60 +0,0 @@
-#include <string.h>
-#include <stdlib.h>
-#include <honeysuckle.h>
-
-struct settings
-{
- bool debug;
- int debug_level;
- char *logfile;
-} global_settings;
-
-void set_logfile(const char* filename, void *s)
-{
- struct settings *settings = (struct settings *) s;
- settings->logfile = malloc(sizeof(char) * strlen(filename));
- strcpy(settings->logfile, filename);
-}
-
-int process(lua_State *L)
-{
- int table_index;
- hs_parse_args(L, hs_tbl(table_index));
- hs_process_table(L, table_index,
- hs_process_bool("debug",
- hs_pt_set_boolean,
- &(global_settings.debug)),
- hs_process_int("level",
- hs_pt_set_integer,
- &(global_settings.debug_level)),
- hs_process_str("logfile",
- set_logfile,
- &global_settings));
- return 0;
-}
-
-int main()
-{
- lua_State *L = luaL_newstate();
- luaL_openlibs(L);
-
- lua_pushcfunction(L, process);
- lua_setglobal(L, "configure");
-
- global_settings.debug = false;
- global_settings.debug_level = 0;
- global_settings.logfile = "nil";
-
- printf("settings: [ %d, %d, '%s' ]\n",
- global_settings.debug,
- global_settings.debug_level,
- global_settings.logfile);
-
- luaL_dostring(L, "configure{debug=true, level=6, logfile='output.log'}");
-
- printf("settings: [ %d, %d, '%s' ]\n",
- global_settings.debug,
- global_settings.debug_level,
- global_settings.logfile);
- return 0;
-}