-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgen-lua-swig.tpl
81 lines (72 loc) · 1.61 KB
/
gen-lua-swig.tpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//
// lua.swig
//
#pragma SWIG nowarn=451
//
// lua structs
//
struct lua_Debug;
struct luaL_Buffer;
struct luaL_Stream;
%nodefaultdtor lua_Debug;
%nodefaultdtor luaL_Buffer;
%nodefaultdtor luaL_Stream;
//
// impls manully
//
%ignore lua_ident;
%ignore lua_pushvfstring;
%ignore lua_pushfstring;
%ignore lua_isnumber;
%ignore lua_isstring;
%ignore lua_iscfunction;
%ignore lua_isinteger;
%ignore lua_isuserdata;
%ignore lua_toboolean;
%ignore lua_pushboolean;
%ignore luaL_Reg;
%ignore luaL_checkoption;
%ignore luaL_setfuncs;
%ignore luaL_loadbufferx;
%rename(fun) func;
//
// types
//
%typemap(gotype) (lua_State*) "Lua_State"
%typemap(gotype) (lua_Number) "Lua_Number"
%typemap(gotype) (lua_Integer) "Lua_Integer"
%typemap(gotype) (lua_Unsigned) "Lua_Unsigned"
%typemap(gotype) (lua_KContext) "Lua_KContext"
%typemap(gotype) (int) "Lua_CInt"
%typemap(gotype) (unsigned int) "Lua_CUint"
%typemap(gotype) (FILE*) "Lua_CFile"
%typemap(gotype) (size_t) "uint"
%typemap(gotype) (void*) "uintptr"
%typemap(gotype) (CallInfo*) "uintptr"
//
// interfaces
//
%import "lua.swig.i"
%include "${LUA_SRC}/luaconf.h"
%include "${LUA_SRC}/lua.h"
%include "${LUA_SRC}/lualib.h"
%include "${LUA_SRC}/lauxlib.h"
%include "lua_macros.inc"
//
// c wrapper code
//
%insert(header) %{
#include "lua_header.h"
#include "lua_macros.inc"
%}
//
// go wrapper code
//
#if SWIG_VERSION >= 0x030006
%insert(go_begin) %{
/*
#include "lua_header.h"
*/
import "C"
%}
#endif