From 98d81e701a3e6c75b932ac75c872ae0e3f4d84f4 Mon Sep 17 00:00:00 2001 From: amelia squires Date: Mon, 14 Apr 2025 14:03:08 -0500 Subject: config change, local support, overall fixes --- src/config.h | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'src/config.h') diff --git a/src/config.h b/src/config.h index 74efc15..f09af91 100644 --- a/src/config.h +++ b/src/config.h @@ -1,34 +1,34 @@ #include "lua.h" +#ifndef _config_h +#define _config_h -extern int _print_type; -extern int _max_depth; -extern int _start_nl_at; -extern int _collapse_all; -extern int _collapse_to_memory; -extern int _print_meta; - -extern int _file_malloc_chunk; - -struct str_to_int { - const char* key; - int* value; +enum config_type { + c_none, + c_string, + c_int, + c_number, + //c_function, + //c_table }; -static struct str_to_int config_map[] = { - {"file_chunksize", &_file_malloc_chunk}, - {"print_type", &_print_type}, - {"max_depth", &_max_depth}, - {"collapse_all", &_collapse_all}, - {"start_nl_at", &_start_nl_at}, - {"collapse_to_memory", &_collapse_to_memory}, - {"print_meta", &_print_meta}, - {NULL,NULL} +struct config { + const char* name; + enum config_type type; + + //a single value will be valid, all other are undefined (except len which will be valid for c_string and c_function) + struct value { + char** c_string; + int* c_int; + float* c_number; + char** c_function; + //location of table in lua registery + int* c_table_idx; + //length used for c_string or c_function + size_t* len; + } value; }; -int l_set(lua_State*); +int i_config_metatable(lua_State*, struct config[]); -static const luaL_Reg config_function_list [] = { - {"set",l_set}, - {NULL,NULL} -}; +#endif -- cgit v1.2.3