update generated headers
This commit is contained in:
parent
ad58f8898f
commit
e785bbf1bf
|
@ -11,211 +11,14 @@ int lua_open_lite_xl_xxxxx(lua_State* L, void* XL) {
|
||||||
}
|
}
|
||||||
In linux, to compile this file, you'd do: 'gcc -o xxxxx.so -shared xxxxx.c'. Simple!
|
In linux, to compile this file, you'd do: 'gcc -o xxxxx.so -shared xxxxx.c'. Simple!
|
||||||
Due to the way the API is structured, you *should not* link or include lua libraries.
|
Due to the way the API is structured, you *should not* link or include lua libraries.
|
||||||
This file was automatically generated by the below code. DO NOT MODIFY DIRECTLY.
|
This file was automatically generated. DO NOT MODIFY DIRECTLY.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
// #!/bin/bash
|
|
||||||
//
|
|
||||||
// ##### CONFIG
|
|
||||||
//
|
|
||||||
// # symbols to ignore
|
|
||||||
// IGNORE_SYM='luaL_pushmodule\|luaL_openlib'
|
|
||||||
//
|
|
||||||
// ##### CONFIG
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// # https://stackoverflow.com/a/13062682
|
|
||||||
// uncomment() {
|
|
||||||
// [ $# -eq 2 ] && arg="$1" || arg=""
|
|
||||||
// eval file="\$$#"
|
|
||||||
// sed 's/a/aA/g; s/__/aB/g; s/#/aC/g' "$file" | \
|
|
||||||
// gcc -P -E $arg - | \
|
|
||||||
// sed 's/aC/#/g; s/aB/__/g; s/aA/a/g'
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// # this is the magic that turns multiline statements into
|
|
||||||
// # single line statements
|
|
||||||
// # LITERALLY DOES NOT WORK WITH PREPROCESSOR
|
|
||||||
// onelineize() {
|
|
||||||
// grep -v '^#' | sed -e ':r;$!{N;br};s/\([^{;]\)\n\s*/\1 /g'
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// discard_preprocessors() {
|
|
||||||
// grep -v '#\(include\|if\|endif\)'
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// # sed regex for extracting data from function signature
|
|
||||||
// # if this isn't regex, idk what is
|
|
||||||
// # LUA_API (return type as \2) (function name as \3) (args as \4)
|
|
||||||
// sym_regex='^LUA\(LIB\)\?_API\s\+\([^(]\+\)\s*(\([^)]\+\))\s\+(\([^)]\+\));'
|
|
||||||
//
|
|
||||||
// # get funcptr declarations
|
|
||||||
// ptrize() {
|
|
||||||
// grep '^LUA' | grep -v "$IGNORE_SYM" | sed -e "s/$sym_regex/static \2(*\3) (\4);/"
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// import_sym() {
|
|
||||||
// grep '^LUA' | grep -v "$IGNORE_SYM" | sed -e "s/$sym_regex/\tIMPORT_SYMBOL(\3, \2, \4);/"
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// export_sym() {
|
|
||||||
// grep '^LUA' | grep -v "$IGNORE_SYM" | sed -e "s/$sym_regex/\t\tEXPORT_SYMBOL(\3),/"
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// decl() {
|
|
||||||
// header="$(uncomment $1 | discard_preprocessors)"
|
|
||||||
// header1="$(onelineize <<< "$header")"
|
|
||||||
//
|
|
||||||
// # typedef
|
|
||||||
// grep -v '^\(LUA\|#\|extern\)' <<< "$header1"
|
|
||||||
// # funcptrs
|
|
||||||
// ptrize <<< "$header1"
|
|
||||||
// # defines
|
|
||||||
// (grep '^#' | grep -v "$IGNORE_SYM") <<< "$header"
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// decl_import() {
|
|
||||||
// uncomment $1 | onelineize | import_sym
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// decl_export() {
|
|
||||||
// uncomment $1 | onelineize | export_sym
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// print_self() {
|
|
||||||
// cat "$0" | sed -e 's#^#// #'
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// generate_header() {
|
|
||||||
// local LUA_PATH="$1"
|
|
||||||
// echo "#ifndef LITE_XL_PLUGIN_API"
|
|
||||||
// echo "#define LITE_XL_PLUGIN_API"
|
|
||||||
// echo "/**"
|
|
||||||
// echo "The lite_xl plugin API is quite simple. Any shared library can be a plugin file, so long"
|
|
||||||
// echo "as it has an entrypoint that looks like the following, where xxxxx is the plugin name:"
|
|
||||||
// echo '#include "lite_xl_plugin_api.h"'
|
|
||||||
// echo "int lua_open_lite_xl_xxxxx(lua_State* L, void* XL) {"
|
|
||||||
// echo " lite_xl_plugin_init(XL);"
|
|
||||||
// echo " ..."
|
|
||||||
// echo " return 1;"
|
|
||||||
// echo "}"
|
|
||||||
// echo "In linux, to compile this file, you'd do: 'gcc -o xxxxx.so -shared xxxxx.c'. Simple!"
|
|
||||||
// echo "Due to the way the API is structured, you *should not* link or include lua libraries."
|
|
||||||
// echo "This file was automatically generated by the below code. DO NOT MODIFY DIRECTLY."
|
|
||||||
// echo "**/"
|
|
||||||
// echo
|
|
||||||
// print_self
|
|
||||||
// echo
|
|
||||||
// echo "#include <stdarg.h>"
|
|
||||||
// echo "#include <stdio.h> // for BUFSIZ? this is kinda weird"
|
|
||||||
//
|
|
||||||
// cat "$LUA_PATH/luaconf.h"
|
|
||||||
// decl "$LUA_PATH/lua.h"
|
|
||||||
// decl "$LUA_PATH/lauxlib.h"
|
|
||||||
//
|
|
||||||
// echo "#define IMPORT_SYMBOL(name, ret, ...) name = (ret (*) (__VA_ARGS__)) symbol(#name)"
|
|
||||||
// echo "static void lite_xl_plugin_init(void *XL) {"
|
|
||||||
// echo -e "\tvoid* (*symbol)(const char *) = (void* (*) (const char *)) XL;"
|
|
||||||
//
|
|
||||||
// decl_import "$LUA_PATH/lua.h"
|
|
||||||
// decl_import "$LUA_PATH/lauxlib.h"
|
|
||||||
//
|
|
||||||
// echo "}"
|
|
||||||
// echo "#endif"
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// generate_api_require() {
|
|
||||||
// local LUA_PATH="$1"
|
|
||||||
// echo "#ifndef API_REQUIRE_H"
|
|
||||||
// echo "#define API_REQUIRE_H"
|
|
||||||
// echo "/**"
|
|
||||||
// echo "This file contains the function api_require that"
|
|
||||||
// echo "returns a function pointer with it's corresponding name."
|
|
||||||
// echo
|
|
||||||
// echo "This file is automatically generated. DO NOT MODIFY."
|
|
||||||
// echo "**/"
|
|
||||||
// echo
|
|
||||||
// print_self
|
|
||||||
// echo
|
|
||||||
// echo "#include <string.h>"
|
|
||||||
// echo "#include <stddef.h>"
|
|
||||||
// echo '#include "lua.h"'
|
|
||||||
// echo '#include "lauxlib.h"'
|
|
||||||
// echo
|
|
||||||
// echo "typedef struct fnptr_s {"
|
|
||||||
// echo -e "\tconst char* name;"
|
|
||||||
// echo -e "\tvoid *addr;"
|
|
||||||
// echo "} fnptr_t;"
|
|
||||||
// echo
|
|
||||||
// echo "#define EXPORT_SYMBOL(SYM) { #SYM, (void*)(SYM) }"
|
|
||||||
// echo "static void *api_require(const char *symbol) {"
|
|
||||||
// echo -e "\tstatic fnptr_t nodes[] = {"
|
|
||||||
//
|
|
||||||
// decl_export "$LUA_PATH/lua.h"
|
|
||||||
// decl_export "$LUA_PATH/lauxlib.h"
|
|
||||||
//
|
|
||||||
// echo -e "\t};"
|
|
||||||
// echo -e "\tfor (int i = 0; i < sizeof(nodes) / sizeof(fnptr_t); i++)"
|
|
||||||
// echo -e "\t\tif (strcmp(nodes[i].name, symbol) == 0)"
|
|
||||||
// echo -e "\t\t\treturn nodes[i].addr;"
|
|
||||||
// echo -e "\treturn NULL;"
|
|
||||||
// echo "}"
|
|
||||||
// echo "#endif"
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// show_help() {
|
|
||||||
// echo -e "Usage: $0 <OPTIONS> prefix"
|
|
||||||
// echo
|
|
||||||
// echo -e "Available options:"
|
|
||||||
// echo
|
|
||||||
// echo -e "-a\t--api-header\tGenerate lite_xl_plugin_api.h"
|
|
||||||
// echo -e "-b\t--api-require\tGenerate api_require.h"
|
|
||||||
// echo -e "-p\t--prefix\tSet prefix (where to find lua.h and lauxlib.h)"
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// main() {
|
|
||||||
// local header=0
|
|
||||||
// local require=0
|
|
||||||
// local prefix=""
|
|
||||||
//
|
|
||||||
// for i in "$@"; do
|
|
||||||
// case $i in
|
|
||||||
// -h|--help)
|
|
||||||
// show_help
|
|
||||||
// exit 0
|
|
||||||
// ;;
|
|
||||||
// -a|--api-header)
|
|
||||||
// header=1
|
|
||||||
// shift
|
|
||||||
// ;;
|
|
||||||
// -b|--api-require)
|
|
||||||
// require=1
|
|
||||||
// shift
|
|
||||||
// ;;
|
|
||||||
// -p|--prefix)
|
|
||||||
// prefix="$2"
|
|
||||||
// shift
|
|
||||||
// shift
|
|
||||||
// ;;
|
|
||||||
// *)
|
|
||||||
// ;;
|
|
||||||
// esac
|
|
||||||
// done
|
|
||||||
//
|
|
||||||
// if [[ "$header" -eq 1 ]]; then
|
|
||||||
// generate_header "$prefix"
|
|
||||||
// elif [[ "$require" -eq 1 ]]; then
|
|
||||||
// generate_api_require "$prefix"
|
|
||||||
// else
|
|
||||||
// show_help
|
|
||||||
// exit 1
|
|
||||||
// fi
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// main "$@"
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h> // for BUFSIZ? this is kinda weird
|
#include <stdio.h> // for BUFSIZ? this is kinda weird
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** $Id: luaconf.h,v 1.176.1.2 2013/11/21 17:26:16 roberto Exp $
|
** $Id: luaconf.h,v 1.176.1.2 2013/11/21 17:26:16 roberto Exp $
|
||||||
** Configuration file for Lua
|
** Configuration file for Lua
|
||||||
|
@ -793,97 +596,97 @@ struct lua_Debug {
|
||||||
char short_src[LUA_IDSIZE];
|
char short_src[LUA_IDSIZE];
|
||||||
struct CallInfo *i_ci;
|
struct CallInfo *i_ci;
|
||||||
};
|
};
|
||||||
static lua_State *(*lua_newstate) (lua_Alloc f, void *ud);
|
static lua_State *(*lua_newstate) (lua_Alloc f, void *ud);
|
||||||
static void (*lua_close) (lua_State *L);
|
static void (*lua_close) (lua_State *L);
|
||||||
static lua_State *(*lua_newthread) (lua_State *L);
|
static lua_State *(*lua_newthread) (lua_State *L);
|
||||||
static lua_CFunction (*lua_atpanic) (lua_State *L, lua_CFunction panicf);
|
static lua_CFunction (*lua_atpanic) (lua_State *L, lua_CFunction panicf);
|
||||||
static const lua_Number *(*lua_version) (lua_State *L);
|
static const lua_Number *(*lua_version) (lua_State *L);
|
||||||
static int (*lua_absindex) (lua_State *L, int idx);
|
static int (*lua_absindex) (lua_State *L, int idx);
|
||||||
static int (*lua_gettop) (lua_State *L);
|
static int (*lua_gettop) (lua_State *L);
|
||||||
static void (*lua_settop) (lua_State *L, int idx);
|
static void (*lua_settop) (lua_State *L, int idx);
|
||||||
static void (*lua_pushvalue) (lua_State *L, int idx);
|
static void (*lua_pushvalue) (lua_State *L, int idx);
|
||||||
static void (*lua_remove) (lua_State *L, int idx);
|
static void (*lua_remove) (lua_State *L, int idx);
|
||||||
static void (*lua_insert) (lua_State *L, int idx);
|
static void (*lua_insert) (lua_State *L, int idx);
|
||||||
static void (*lua_replace) (lua_State *L, int idx);
|
static void (*lua_replace) (lua_State *L, int idx);
|
||||||
static void (*lua_copy) (lua_State *L, int fromidx, int toidx);
|
static void (*lua_copy) (lua_State *L, int fromidx, int toidx);
|
||||||
static int (*lua_checkstack) (lua_State *L, int sz);
|
static int (*lua_checkstack) (lua_State *L, int sz);
|
||||||
static void (*lua_xmove) (lua_State *from, lua_State *to, int n);
|
static void (*lua_xmove) (lua_State *from, lua_State *to, int n);
|
||||||
static int (*lua_isnumber) (lua_State *L, int idx);
|
static int (*lua_isnumber) (lua_State *L, int idx);
|
||||||
static int (*lua_isstring) (lua_State *L, int idx);
|
static int (*lua_isstring) (lua_State *L, int idx);
|
||||||
static int (*lua_iscfunction) (lua_State *L, int idx);
|
static int (*lua_iscfunction) (lua_State *L, int idx);
|
||||||
static int (*lua_isuserdata) (lua_State *L, int idx);
|
static int (*lua_isuserdata) (lua_State *L, int idx);
|
||||||
static int (*lua_type) (lua_State *L, int idx);
|
static int (*lua_type) (lua_State *L, int idx);
|
||||||
static const char *(*lua_typename) (lua_State *L, int tp);
|
static const char *(*lua_typename) (lua_State *L, int tp);
|
||||||
static lua_Number (*lua_tonumberx) (lua_State *L, int idx, int *isnum);
|
static lua_Number (*lua_tonumberx) (lua_State *L, int idx, int *isnum);
|
||||||
static lua_Integer (*lua_tointegerx) (lua_State *L, int idx, int *isnum);
|
static lua_Integer (*lua_tointegerx) (lua_State *L, int idx, int *isnum);
|
||||||
static lua_Unsigned (*lua_tounsignedx) (lua_State *L, int idx, int *isnum);
|
static lua_Unsigned (*lua_tounsignedx) (lua_State *L, int idx, int *isnum);
|
||||||
static int (*lua_toboolean) (lua_State *L, int idx);
|
static int (*lua_toboolean) (lua_State *L, int idx);
|
||||||
static const char *(*lua_tolstring) (lua_State *L, int idx, size_t *len);
|
static const char *(*lua_tolstring) (lua_State *L, int idx, size_t *len);
|
||||||
static size_t (*lua_rawlen) (lua_State *L, int idx);
|
static size_t (*lua_rawlen) (lua_State *L, int idx);
|
||||||
static lua_CFunction (*lua_tocfunction) (lua_State *L, int idx);
|
static lua_CFunction (*lua_tocfunction) (lua_State *L, int idx);
|
||||||
static void *(*lua_touserdata) (lua_State *L, int idx);
|
static void *(*lua_touserdata) (lua_State *L, int idx);
|
||||||
static lua_State *(*lua_tothread) (lua_State *L, int idx);
|
static lua_State *(*lua_tothread) (lua_State *L, int idx);
|
||||||
static const void *(*lua_topointer) (lua_State *L, int idx);
|
static const void *(*lua_topointer) (lua_State *L, int idx);
|
||||||
static void (*lua_arith) (lua_State *L, int op);
|
static void (*lua_arith) (lua_State *L, int op);
|
||||||
static int (*lua_rawequal) (lua_State *L, int idx1, int idx2);
|
static int (*lua_rawequal) (lua_State *L, int idx1, int idx2);
|
||||||
static int (*lua_compare) (lua_State *L, int idx1, int idx2, int op);
|
static int (*lua_compare) (lua_State *L, int idx1, int idx2, int op);
|
||||||
static void (*lua_pushnil) (lua_State *L);
|
static void (*lua_pushnil) (lua_State *L);
|
||||||
static void (*lua_pushnumber) (lua_State *L, lua_Number n);
|
static void (*lua_pushnumber) (lua_State *L, lua_Number n);
|
||||||
static void (*lua_pushinteger) (lua_State *L, lua_Integer n);
|
static void (*lua_pushinteger) (lua_State *L, lua_Integer n);
|
||||||
static void (*lua_pushunsigned) (lua_State *L, lua_Unsigned n);
|
static void (*lua_pushunsigned) (lua_State *L, lua_Unsigned n);
|
||||||
static const char *(*lua_pushlstring) (lua_State *L, const char *s, size_t l);
|
static const char *(*lua_pushlstring) (lua_State *L, const char *s, size_t l);
|
||||||
static const char *(*lua_pushstring) (lua_State *L, const char *s);
|
static const char *(*lua_pushstring) (lua_State *L, const char *s);
|
||||||
static const char *(*lua_pushvfstring) (lua_State *L, const char *fmt, va_list argp);
|
static const char *(*lua_pushvfstring) (lua_State *L, const char *fmt, va_list argp);
|
||||||
static const char *(*lua_pushfstring) (lua_State *L, const char *fmt, ...);
|
static const char *(*lua_pushfstring) (lua_State *L, const char *fmt, ...);
|
||||||
static void (*lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);
|
static void (*lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);
|
||||||
static void (*lua_pushboolean) (lua_State *L, int b);
|
static void (*lua_pushboolean) (lua_State *L, int b);
|
||||||
static void (*lua_pushlightuserdata) (lua_State *L, void *p);
|
static void (*lua_pushlightuserdata) (lua_State *L, void *p);
|
||||||
static int (*lua_pushthread) (lua_State *L);
|
static int (*lua_pushthread) (lua_State *L);
|
||||||
static void (*lua_getglobal) (lua_State *L, const char *var);
|
static void (*lua_getglobal) (lua_State *L, const char *var);
|
||||||
static void (*lua_gettable) (lua_State *L, int idx);
|
static void (*lua_gettable) (lua_State *L, int idx);
|
||||||
static void (*lua_getfield) (lua_State *L, int idx, const char *k);
|
static void (*lua_getfield) (lua_State *L, int idx, const char *k);
|
||||||
static void (*lua_rawget) (lua_State *L, int idx);
|
static void (*lua_rawget) (lua_State *L, int idx);
|
||||||
static void (*lua_rawgeti) (lua_State *L, int idx, int n);
|
static void (*lua_rawgeti) (lua_State *L, int idx, int n);
|
||||||
static void (*lua_rawgetp) (lua_State *L, int idx, const void *p);
|
static void (*lua_rawgetp) (lua_State *L, int idx, const void *p);
|
||||||
static void (*lua_createtable) (lua_State *L, int narr, int nrec);
|
static void (*lua_createtable) (lua_State *L, int narr, int nrec);
|
||||||
static void *(*lua_newuserdata) (lua_State *L, size_t sz);
|
static void *(*lua_newuserdata) (lua_State *L, size_t sz);
|
||||||
static int (*lua_getmetatable) (lua_State *L, int objindex);
|
static int (*lua_getmetatable) (lua_State *L, int objindex);
|
||||||
static void (*lua_getuservalue) (lua_State *L, int idx);
|
static void (*lua_getuservalue) (lua_State *L, int idx);
|
||||||
static void (*lua_setglobal) (lua_State *L, const char *var);
|
static void (*lua_setglobal) (lua_State *L, const char *var);
|
||||||
static void (*lua_settable) (lua_State *L, int idx);
|
static void (*lua_settable) (lua_State *L, int idx);
|
||||||
static void (*lua_setfield) (lua_State *L, int idx, const char *k);
|
static void (*lua_setfield) (lua_State *L, int idx, const char *k);
|
||||||
static void (*lua_rawset) (lua_State *L, int idx);
|
static void (*lua_rawset) (lua_State *L, int idx);
|
||||||
static void (*lua_rawseti) (lua_State *L, int idx, int n);
|
static void (*lua_rawseti) (lua_State *L, int idx, int n);
|
||||||
static void (*lua_rawsetp) (lua_State *L, int idx, const void *p);
|
static void (*lua_rawsetp) (lua_State *L, int idx, const void *p);
|
||||||
static int (*lua_setmetatable) (lua_State *L, int objindex);
|
static int (*lua_setmetatable) (lua_State *L, int objindex);
|
||||||
static void (*lua_setuservalue) (lua_State *L, int idx);
|
static void (*lua_setuservalue) (lua_State *L, int idx);
|
||||||
static void (*lua_callk) (lua_State *L, int nargs, int nresults, int ctx, lua_CFunction k);
|
static void (*lua_callk) (lua_State *L, int nargs, int nresults, int ctx, lua_CFunction k);
|
||||||
static int (*lua_getctx) (lua_State *L, int *ctx);
|
static int (*lua_getctx) (lua_State *L, int *ctx);
|
||||||
static int (*lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc, int ctx, lua_CFunction k);
|
static int (*lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc, int ctx, lua_CFunction k);
|
||||||
static int (*lua_load) (lua_State *L, lua_Reader reader, void *dt, const char *chunkname, const char *mode);
|
static int (*lua_load) (lua_State *L, lua_Reader reader, void *dt, const char *chunkname, const char *mode);
|
||||||
static int (*lua_dump) (lua_State *L, lua_Writer writer, void *data);
|
static int (*lua_dump) (lua_State *L, lua_Writer writer, void *data);
|
||||||
static int (*lua_yieldk) (lua_State *L, int nresults, int ctx, lua_CFunction k);
|
static int (*lua_yieldk) (lua_State *L, int nresults, int ctx, lua_CFunction k);
|
||||||
static int (*lua_resume) (lua_State *L, lua_State *from, int narg);
|
static int (*lua_resume) (lua_State *L, lua_State *from, int narg);
|
||||||
static int (*lua_status) (lua_State *L);
|
static int (*lua_status) (lua_State *L);
|
||||||
static int (*lua_gc) (lua_State *L, int what, int data);
|
static int (*lua_gc) (lua_State *L, int what, int data);
|
||||||
static int (*lua_error) (lua_State *L);
|
static int (*lua_error) (lua_State *L);
|
||||||
static int (*lua_next) (lua_State *L, int idx);
|
static int (*lua_next) (lua_State *L, int idx);
|
||||||
static void (*lua_concat) (lua_State *L, int n);
|
static void (*lua_concat) (lua_State *L, int n);
|
||||||
static void (*lua_len) (lua_State *L, int idx);
|
static void (*lua_len) (lua_State *L, int idx);
|
||||||
static lua_Alloc (*lua_getallocf) (lua_State *L, void **ud);
|
static lua_Alloc (*lua_getallocf) (lua_State *L, void **ud);
|
||||||
static void (*lua_setallocf) (lua_State *L, lua_Alloc f, void *ud);
|
static void (*lua_setallocf) (lua_State *L, lua_Alloc f, void *ud);
|
||||||
static int (*lua_getstack) (lua_State *L, int level, lua_Debug *ar);
|
static int (*lua_getstack) (lua_State *L, int level, lua_Debug *ar);
|
||||||
static int (*lua_getinfo) (lua_State *L, const char *what, lua_Debug *ar);
|
static int (*lua_getinfo) (lua_State *L, const char *what, lua_Debug *ar);
|
||||||
static const char *(*lua_getlocal) (lua_State *L, const lua_Debug *ar, int n);
|
static const char *(*lua_getlocal) (lua_State *L, const lua_Debug *ar, int n);
|
||||||
static const char *(*lua_setlocal) (lua_State *L, const lua_Debug *ar, int n);
|
static const char *(*lua_setlocal) (lua_State *L, const lua_Debug *ar, int n);
|
||||||
static const char *(*lua_getupvalue) (lua_State *L, int funcindex, int n);
|
static const char *(*lua_getupvalue) (lua_State *L, int funcindex, int n);
|
||||||
static const char *(*lua_setupvalue) (lua_State *L, int funcindex, int n);
|
static const char *(*lua_setupvalue) (lua_State *L, int funcindex, int n);
|
||||||
static void *(*lua_upvalueid) (lua_State *L, int fidx, int n);
|
static void *(*lua_upvalueid) (lua_State *L, int fidx, int n);
|
||||||
static void (*lua_upvaluejoin) (lua_State *L, int fidx1, int n1, int fidx2, int n2);
|
static void (*lua_upvaluejoin) (lua_State *L, int fidx1, int n1, int fidx2, int n2);
|
||||||
static int (*lua_sethook) (lua_State *L, lua_Hook func, int mask, int count);
|
static int (*lua_sethook) (lua_State *L, lua_Hook func, int mask, int count);
|
||||||
static lua_Hook (*lua_gethook) (lua_State *L);
|
static lua_Hook (*lua_gethook) (lua_State *L);
|
||||||
static int (*lua_gethookmask) (lua_State *L);
|
static int (*lua_gethookmask) (lua_State *L);
|
||||||
static int (*lua_gethookcount) (lua_State *L);
|
static int (*lua_gethookcount) (lua_State *L);
|
||||||
#define lua_h
|
#define lua_h
|
||||||
#define LUA_VERSION_MAJOR "5"
|
#define LUA_VERSION_MAJOR "5"
|
||||||
#define LUA_VERSION_MINOR "2"
|
#define LUA_VERSION_MINOR "2"
|
||||||
|
@ -986,51 +789,51 @@ typedef struct luaL_Stream {
|
||||||
FILE *f;
|
FILE *f;
|
||||||
lua_CFunction closef;
|
lua_CFunction closef;
|
||||||
} luaL_Stream;
|
} luaL_Stream;
|
||||||
static void (*luaL_checkversion_) (lua_State *L, lua_Number ver);
|
static void (*luaL_checkversion_) (lua_State *L, lua_Number ver);
|
||||||
static int (*luaL_getmetafield) (lua_State *L, int obj, const char *e);
|
static int (*luaL_getmetafield) (lua_State *L, int obj, const char *e);
|
||||||
static int (*luaL_callmeta) (lua_State *L, int obj, const char *e);
|
static int (*luaL_callmeta) (lua_State *L, int obj, const char *e);
|
||||||
static const char *(*luaL_tolstring) (lua_State *L, int idx, size_t *len);
|
static const char *(*luaL_tolstring) (lua_State *L, int idx, size_t *len);
|
||||||
static int (*luaL_argerror) (lua_State *L, int numarg, const char *extramsg);
|
static int (*luaL_argerror) (lua_State *L, int numarg, const char *extramsg);
|
||||||
static const char *(*luaL_checklstring) (lua_State *L, int numArg, size_t *l);
|
static const char *(*luaL_checklstring) (lua_State *L, int numArg, size_t *l);
|
||||||
static const char *(*luaL_optlstring) (lua_State *L, int numArg, const char *def, size_t *l);
|
static const char *(*luaL_optlstring) (lua_State *L, int numArg, const char *def, size_t *l);
|
||||||
static lua_Number (*luaL_checknumber) (lua_State *L, int numArg);
|
static lua_Number (*luaL_checknumber) (lua_State *L, int numArg);
|
||||||
static lua_Number (*luaL_optnumber) (lua_State *L, int nArg, lua_Number def);
|
static lua_Number (*luaL_optnumber) (lua_State *L, int nArg, lua_Number def);
|
||||||
static lua_Integer (*luaL_checkinteger) (lua_State *L, int numArg);
|
static lua_Integer (*luaL_checkinteger) (lua_State *L, int numArg);
|
||||||
static lua_Integer (*luaL_optinteger) (lua_State *L, int nArg, lua_Integer def);
|
static lua_Integer (*luaL_optinteger) (lua_State *L, int nArg, lua_Integer def);
|
||||||
static lua_Unsigned (*luaL_checkunsigned) (lua_State *L, int numArg);
|
static lua_Unsigned (*luaL_checkunsigned) (lua_State *L, int numArg);
|
||||||
static lua_Unsigned (*luaL_optunsigned) (lua_State *L, int numArg, lua_Unsigned def);
|
static lua_Unsigned (*luaL_optunsigned) (lua_State *L, int numArg, lua_Unsigned def);
|
||||||
static void (*luaL_checkstack) (lua_State *L, int sz, const char *msg);
|
static void (*luaL_checkstack) (lua_State *L, int sz, const char *msg);
|
||||||
static void (*luaL_checktype) (lua_State *L, int narg, int t);
|
static void (*luaL_checktype) (lua_State *L, int narg, int t);
|
||||||
static void (*luaL_checkany) (lua_State *L, int narg);
|
static void (*luaL_checkany) (lua_State *L, int narg);
|
||||||
static int (*luaL_newmetatable) (lua_State *L, const char *tname);
|
static int (*luaL_newmetatable) (lua_State *L, const char *tname);
|
||||||
static void (*luaL_setmetatable) (lua_State *L, const char *tname);
|
static void (*luaL_setmetatable) (lua_State *L, const char *tname);
|
||||||
static void *(*luaL_testudata) (lua_State *L, int ud, const char *tname);
|
static void *(*luaL_testudata) (lua_State *L, int ud, const char *tname);
|
||||||
static void *(*luaL_checkudata) (lua_State *L, int ud, const char *tname);
|
static void *(*luaL_checkudata) (lua_State *L, int ud, const char *tname);
|
||||||
static void (*luaL_where) (lua_State *L, int lvl);
|
static void (*luaL_where) (lua_State *L, int lvl);
|
||||||
static int (*luaL_error) (lua_State *L, const char *fmt, ...);
|
static int (*luaL_error) (lua_State *L, const char *fmt, ...);
|
||||||
static int (*luaL_checkoption) (lua_State *L, int narg, const char *def, const char *const lst[]);
|
static int (*luaL_checkoption) (lua_State *L, int narg, const char *def, const char *const lst[]);
|
||||||
static int (*luaL_fileresult) (lua_State *L, int stat, const char *fname);
|
static int (*luaL_fileresult) (lua_State *L, int stat, const char *fname);
|
||||||
static int (*luaL_execresult) (lua_State *L, int stat);
|
static int (*luaL_execresult) (lua_State *L, int stat);
|
||||||
static int (*luaL_ref) (lua_State *L, int t);
|
static int (*luaL_ref) (lua_State *L, int t);
|
||||||
static void (*luaL_unref) (lua_State *L, int t, int ref);
|
static void (*luaL_unref) (lua_State *L, int t, int ref);
|
||||||
static int (*luaL_loadfilex) (lua_State *L, const char *filename, const char *mode);
|
static int (*luaL_loadfilex) (lua_State *L, const char *filename, const char *mode);
|
||||||
static int (*luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz, const char *name, const char *mode);
|
static int (*luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz, const char *name, const char *mode);
|
||||||
static int (*luaL_loadstring) (lua_State *L, const char *s);
|
static int (*luaL_loadstring) (lua_State *L, const char *s);
|
||||||
static lua_State *(*luaL_newstate) (void);
|
static lua_State *(*luaL_newstate) (void);
|
||||||
static int (*luaL_len) (lua_State *L, int idx);
|
static int (*luaL_len) (lua_State *L, int idx);
|
||||||
static const char *(*luaL_gsub) (lua_State *L, const char *s, const char *p, const char *r);
|
static const char *(*luaL_gsub) (lua_State *L, const char *s, const char *p, const char *r);
|
||||||
static void (*luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup);
|
static void (*luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup);
|
||||||
static int (*luaL_getsubtable) (lua_State *L, int idx, const char *fname);
|
static int (*luaL_getsubtable) (lua_State *L, int idx, const char *fname);
|
||||||
static void (*luaL_traceback) (lua_State *L, lua_State *L1, const char *msg, int level);
|
static void (*luaL_traceback) (lua_State *L, lua_State *L1, const char *msg, int level);
|
||||||
static void (*luaL_requiref) (lua_State *L, const char *modname, lua_CFunction openf, int glb);
|
static void (*luaL_requiref) (lua_State *L, const char *modname, lua_CFunction openf, int glb);
|
||||||
static void (*luaL_buffinit) (lua_State *L, luaL_Buffer *B);
|
static void (*luaL_buffinit) (lua_State *L, luaL_Buffer *B);
|
||||||
static char *(*luaL_prepbuffsize) (luaL_Buffer *B, size_t sz);
|
static char *(*luaL_prepbuffsize) (luaL_Buffer *B, size_t sz);
|
||||||
static void (*luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);
|
static void (*luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);
|
||||||
static void (*luaL_addstring) (luaL_Buffer *B, const char *s);
|
static void (*luaL_addstring) (luaL_Buffer *B, const char *s);
|
||||||
static void (*luaL_addvalue) (luaL_Buffer *B);
|
static void (*luaL_addvalue) (luaL_Buffer *B);
|
||||||
static void (*luaL_pushresult) (luaL_Buffer *B);
|
static void (*luaL_pushresult) (luaL_Buffer *B);
|
||||||
static void (*luaL_pushresultsize) (luaL_Buffer *B, size_t sz);
|
static void (*luaL_pushresultsize) (luaL_Buffer *B, size_t sz);
|
||||||
static char *(*luaL_buffinitsize) (lua_State *L, luaL_Buffer *B, size_t sz);
|
static char *(*luaL_buffinitsize) (lua_State *L, luaL_Buffer *B, size_t sz);
|
||||||
#define lauxlib_h
|
#define lauxlib_h
|
||||||
#define LUA_ERRFILE (LUA_ERRERR+1)
|
#define LUA_ERRFILE (LUA_ERRERR+1)
|
||||||
#define luaL_checkversion(L) luaL_checkversion_(L, LUA_VERSION_NUM)
|
#define luaL_checkversion(L) luaL_checkversion_(L, LUA_VERSION_NUM)
|
||||||
|
|
|
@ -7,205 +7,6 @@ returns a function pointer with it's corresponding name.
|
||||||
This file is automatically generated. DO NOT MODIFY.
|
This file is automatically generated. DO NOT MODIFY.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
// #!/bin/bash
|
|
||||||
//
|
|
||||||
// ##### CONFIG
|
|
||||||
//
|
|
||||||
// # symbols to ignore
|
|
||||||
// IGNORE_SYM='luaL_pushmodule\|luaL_openlib'
|
|
||||||
//
|
|
||||||
// ##### CONFIG
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// # https://stackoverflow.com/a/13062682
|
|
||||||
// uncomment() {
|
|
||||||
// [ $# -eq 2 ] && arg="$1" || arg=""
|
|
||||||
// eval file="\$$#"
|
|
||||||
// sed 's/a/aA/g; s/__/aB/g; s/#/aC/g' "$file" | \
|
|
||||||
// gcc -P -E $arg - | \
|
|
||||||
// sed 's/aC/#/g; s/aB/__/g; s/aA/a/g'
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// # this is the magic that turns multiline statements into
|
|
||||||
// # single line statements
|
|
||||||
// # LITERALLY DOES NOT WORK WITH PREPROCESSOR
|
|
||||||
// onelineize() {
|
|
||||||
// grep -v '^#' | sed -e ':r;$!{N;br};s/\([^{;]\)\n\s*/\1 /g'
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// discard_preprocessors() {
|
|
||||||
// grep -v '#\(include\|if\|endif\)'
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// # sed regex for extracting data from function signature
|
|
||||||
// # if this isn't regex, idk what is
|
|
||||||
// # LUA_API (return type as \2) (function name as \3) (args as \4)
|
|
||||||
// sym_regex='^LUA\(LIB\)\?_API\s\+\([^(]\+\)\s*(\([^)]\+\))\s\+(\([^)]\+\));'
|
|
||||||
//
|
|
||||||
// # get funcptr declarations
|
|
||||||
// ptrize() {
|
|
||||||
// grep '^LUA' | grep -v "$IGNORE_SYM" | sed -e "s/$sym_regex/static \2(*\3) (\4);/"
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// import_sym() {
|
|
||||||
// grep '^LUA' | grep -v "$IGNORE_SYM" | sed -e "s/$sym_regex/\tIMPORT_SYMBOL(\3, \2, \4);/"
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// export_sym() {
|
|
||||||
// grep '^LUA' | grep -v "$IGNORE_SYM" | sed -e "s/$sym_regex/\t\tEXPORT_SYMBOL(\3),/"
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// decl() {
|
|
||||||
// header="$(uncomment $1 | discard_preprocessors)"
|
|
||||||
// header1="$(onelineize <<< "$header")"
|
|
||||||
//
|
|
||||||
// # typedef
|
|
||||||
// grep -v '^\(LUA\|#\|extern\)' <<< "$header1"
|
|
||||||
// # funcptrs
|
|
||||||
// ptrize <<< "$header1"
|
|
||||||
// # defines
|
|
||||||
// (grep '^#' | grep -v "$IGNORE_SYM") <<< "$header"
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// decl_import() {
|
|
||||||
// uncomment $1 | onelineize | import_sym
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// decl_export() {
|
|
||||||
// uncomment $1 | onelineize | export_sym
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// print_self() {
|
|
||||||
// cat "$0" | sed -e 's#^#// #'
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// generate_header() {
|
|
||||||
// local LUA_PATH="$1"
|
|
||||||
// echo "#ifndef LITE_XL_PLUGIN_API"
|
|
||||||
// echo "#define LITE_XL_PLUGIN_API"
|
|
||||||
// echo "/**"
|
|
||||||
// echo "The lite_xl plugin API is quite simple. Any shared library can be a plugin file, so long"
|
|
||||||
// echo "as it has an entrypoint that looks like the following, where xxxxx is the plugin name:"
|
|
||||||
// echo '#include "lite_xl_plugin_api.h"'
|
|
||||||
// echo "int lua_open_lite_xl_xxxxx(lua_State* L, void* XL) {"
|
|
||||||
// echo " lite_xl_plugin_init(XL);"
|
|
||||||
// echo " ..."
|
|
||||||
// echo " return 1;"
|
|
||||||
// echo "}"
|
|
||||||
// echo "In linux, to compile this file, you'd do: 'gcc -o xxxxx.so -shared xxxxx.c'. Simple!"
|
|
||||||
// echo "Due to the way the API is structured, you *should not* link or include lua libraries."
|
|
||||||
// echo "This file was automatically generated by the below code. DO NOT MODIFY DIRECTLY."
|
|
||||||
// echo "**/"
|
|
||||||
// echo
|
|
||||||
// print_self
|
|
||||||
// echo
|
|
||||||
// echo "#include <stdarg.h>"
|
|
||||||
// echo "#include <stdio.h> // for BUFSIZ? this is kinda weird"
|
|
||||||
//
|
|
||||||
// cat "$LUA_PATH/luaconf.h"
|
|
||||||
// decl "$LUA_PATH/lua.h"
|
|
||||||
// decl "$LUA_PATH/lauxlib.h"
|
|
||||||
//
|
|
||||||
// echo "#define IMPORT_SYMBOL(name, ret, ...) name = (ret (*) (__VA_ARGS__)) symbol(#name)"
|
|
||||||
// echo "static void lite_xl_plugin_init(void *XL) {"
|
|
||||||
// echo -e "\tvoid* (*symbol)(const char *) = (void* (*) (const char *)) XL;"
|
|
||||||
//
|
|
||||||
// decl_import "$LUA_PATH/lua.h"
|
|
||||||
// decl_import "$LUA_PATH/lauxlib.h"
|
|
||||||
//
|
|
||||||
// echo "}"
|
|
||||||
// echo "#endif"
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// generate_api_require() {
|
|
||||||
// local LUA_PATH="$1"
|
|
||||||
// echo "#ifndef API_REQUIRE_H"
|
|
||||||
// echo "#define API_REQUIRE_H"
|
|
||||||
// echo "/**"
|
|
||||||
// echo "This file contains the function api_require that"
|
|
||||||
// echo "returns a function pointer with it's corresponding name."
|
|
||||||
// echo
|
|
||||||
// echo "This file is automatically generated. DO NOT MODIFY."
|
|
||||||
// echo "**/"
|
|
||||||
// echo
|
|
||||||
// print_self
|
|
||||||
// echo
|
|
||||||
// echo "#include <string.h>"
|
|
||||||
// echo "#include <stddef.h>"
|
|
||||||
// echo '#include "lua.h"'
|
|
||||||
// echo '#include "lauxlib.h"'
|
|
||||||
// echo
|
|
||||||
// echo "typedef struct fnptr_s {"
|
|
||||||
// echo -e "\tconst char* name;"
|
|
||||||
// echo -e "\tvoid *addr;"
|
|
||||||
// echo "} fnptr_t;"
|
|
||||||
// echo
|
|
||||||
// echo "#define EXPORT_SYMBOL(SYM) { #SYM, (void*)(SYM) }"
|
|
||||||
// echo "static void *api_require(const char *symbol) {"
|
|
||||||
// echo -e "\tstatic fnptr_t nodes[] = {"
|
|
||||||
//
|
|
||||||
// decl_export "$LUA_PATH/lua.h"
|
|
||||||
// decl_export "$LUA_PATH/lauxlib.h"
|
|
||||||
//
|
|
||||||
// echo -e "\t};"
|
|
||||||
// echo -e "\tfor (int i = 0; i < sizeof(nodes) / sizeof(fnptr_t); i++)"
|
|
||||||
// echo -e "\t\tif (strcmp(nodes[i].name, symbol) == 0)"
|
|
||||||
// echo -e "\t\t\treturn nodes[i].addr;"
|
|
||||||
// echo -e "\treturn NULL;"
|
|
||||||
// echo "}"
|
|
||||||
// echo "#endif"
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// show_help() {
|
|
||||||
// echo -e "Usage: $0 <OPTIONS> prefix"
|
|
||||||
// echo
|
|
||||||
// echo -e "Available options:"
|
|
||||||
// echo
|
|
||||||
// echo -e "-a\t--api-header\tGenerate lite_xl_plugin_api.h"
|
|
||||||
// echo -e "-b\t--api-require\tGenerate api_require.h"
|
|
||||||
// echo -e "-p\t--prefix\tSet prefix (where to find lua.h and lauxlib.h)"
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// main() {
|
|
||||||
// local header=0
|
|
||||||
// local require=0
|
|
||||||
// local prefix=""
|
|
||||||
//
|
|
||||||
// for i in "$@"; do
|
|
||||||
// case $i in
|
|
||||||
// -h|--help)
|
|
||||||
// show_help
|
|
||||||
// exit 0
|
|
||||||
// ;;
|
|
||||||
// -a|--api-header)
|
|
||||||
// header=1
|
|
||||||
// shift
|
|
||||||
// ;;
|
|
||||||
// -b|--api-require)
|
|
||||||
// require=1
|
|
||||||
// shift
|
|
||||||
// ;;
|
|
||||||
// -p|--prefix)
|
|
||||||
// prefix="$2"
|
|
||||||
// shift
|
|
||||||
// shift
|
|
||||||
// ;;
|
|
||||||
// *)
|
|
||||||
// ;;
|
|
||||||
// esac
|
|
||||||
// done
|
|
||||||
//
|
|
||||||
// if [[ "$header" -eq 1 ]]; then
|
|
||||||
// generate_header "$prefix"
|
|
||||||
// elif [[ "$require" -eq 1 ]]; then
|
|
||||||
// generate_api_require "$prefix"
|
|
||||||
// else
|
|
||||||
// show_help
|
|
||||||
// exit 1
|
|
||||||
// fi
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// main "$@"
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
Loading…
Reference in New Issue