sweet-moon 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/.rspec +1 -0
  4. data/.rubocop.yml +40 -0
  5. data/Gemfile +12 -0
  6. data/Gemfile.lock +61 -0
  7. data/README.md +1149 -0
  8. data/components/api.rb +83 -0
  9. data/components/injections/injections_503.rb +21 -0
  10. data/components/injections/injections_514.rb +29 -0
  11. data/components/injections/injections_542.rb +49 -0
  12. data/components/injections.rb +11 -0
  13. data/components/interpreters/50/function.rb +52 -0
  14. data/components/interpreters/50/interpreter.rb +105 -0
  15. data/components/interpreters/50/reader.rb +65 -0
  16. data/components/interpreters/50/table.rb +99 -0
  17. data/components/interpreters/50/writer.rb +45 -0
  18. data/components/interpreters/51/function.rb +52 -0
  19. data/components/interpreters/51/interpreter.rb +104 -0
  20. data/components/interpreters/51/reader.rb +65 -0
  21. data/components/interpreters/51/table.rb +60 -0
  22. data/components/interpreters/51/writer.rb +45 -0
  23. data/components/interpreters/54/function.rb +52 -0
  24. data/components/interpreters/54/interpreter.rb +100 -0
  25. data/components/interpreters/54/reader.rb +65 -0
  26. data/components/interpreters/54/table.rb +60 -0
  27. data/components/interpreters/54/writer.rb +45 -0
  28. data/components/interpreters.rb +11 -0
  29. data/components/io.rb +11 -0
  30. data/config/tests.sample.yml +15 -0
  31. data/controllers/api.rb +143 -0
  32. data/controllers/cli/cli.rb +32 -0
  33. data/controllers/cli/help.rb +24 -0
  34. data/controllers/cli/signatures.rb +179 -0
  35. data/controllers/cli/version.rb +14 -0
  36. data/controllers/interpreter.rb +68 -0
  37. data/controllers/state.rb +74 -0
  38. data/dsl/api.rb +31 -0
  39. data/dsl/cache.rb +118 -0
  40. data/dsl/concerns/fennel.rb +13 -0
  41. data/dsl/concerns/packages.rb +37 -0
  42. data/dsl/errors.rb +28 -0
  43. data/dsl/fennel.rb +47 -0
  44. data/dsl/global.rb +42 -0
  45. data/dsl/state.rb +104 -0
  46. data/dsl/sweet_moon.rb +53 -0
  47. data/logic/api.rb +17 -0
  48. data/logic/interpreter.rb +84 -0
  49. data/logic/interpreters/interpreter_50.rb +34 -0
  50. data/logic/interpreters/interpreter_51.rb +37 -0
  51. data/logic/interpreters/interpreter_54.rb +41 -0
  52. data/logic/io.rb +6 -0
  53. data/logic/options.rb +14 -0
  54. data/logic/shared_object.rb +52 -0
  55. data/logic/signature.rb +258 -0
  56. data/logic/signatures/ffi_types.rb +27 -0
  57. data/logic/signatures/signatures_322.rb +418 -0
  58. data/logic/signatures/signatures_401.rb +243 -0
  59. data/logic/signatures/signatures_503.rb +575 -0
  60. data/logic/signatures/signatures_514.rb +460 -0
  61. data/logic/signatures/signatures_542.rb +591 -0
  62. data/logic/spec.rb +13 -0
  63. data/logic/tables.rb +32 -0
  64. data/ports/in/dsl/sweet-moon/errors.rb +3 -0
  65. data/ports/in/dsl/sweet-moon.rb +1 -0
  66. data/ports/in/shell/sweet-moon +5 -0
  67. data/ports/in/shell.rb +21 -0
  68. data/ports/out/shell.rb +9 -0
  69. data/sweet-moon.gemspec +35 -0
  70. metadata +137 -0
@@ -0,0 +1,460 @@
1
+ module Logic
2
+ module V514
3
+ Signatures = {
4
+ functions: [{ source: 'LUALIB_API char *(luaL_prepbuffer) (luaL_Buffer *B);',
5
+ ffi: [:luaL_prepbuffer, [:pointer], :pointer] },
6
+ { source: 'LUALIB_API const char *(luaL_checklstring) (lua_State *L, int numArg, size_t *l);',
7
+ ffi: [:luaL_checklstring, %i[pointer int pointer], :pointer] },
8
+ { source: 'LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx, const char *fname, int szhint);',
9
+ ffi: [:luaL_findtable, %i[pointer int pointer int], :pointer] },
10
+ { source: 'LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p, const char *r);',
11
+ ffi: [:luaL_gsub, %i[pointer pointer pointer pointer], :pointer] },
12
+ { source: 'LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg, const char *def, size_t *l);',
13
+ ffi: [:luaL_optlstring, %i[pointer int pointer pointer], :pointer] },
14
+ { source: 'LUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg);',
15
+ ffi: [:luaL_argerror, %i[pointer int pointer], :int] },
16
+ { source: 'LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e);',
17
+ ffi: [:luaL_callmeta, %i[pointer int pointer], :int] },
18
+ { source: 'LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def, const char *const lst[]);',
19
+ ffi: [:luaL_checkoption, %i[pointer int pointer pointer], :int] },
20
+ { source: 'LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...);',
21
+ ffi: [:luaL_error, %i[pointer pointer varargs], :int] },
22
+ { source: 'LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e);',
23
+ ffi: [:luaL_getmetafield, %i[pointer int pointer], :int] },
24
+ { source: 'LUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz, const char *name);',
25
+ ffi: [:luaL_loadbuffer, %i[pointer pointer ulong pointer], :int] },
26
+ { source: 'LUALIB_API int (luaL_loadfile) (lua_State *L, const char *filename);',
27
+ ffi: [:luaL_loadfile, %i[pointer pointer], :int] },
28
+ { source: 'LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s);',
29
+ ffi: [:luaL_loadstring, %i[pointer pointer], :int] },
30
+ { source: 'LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname);',
31
+ ffi: [:luaL_newmetatable, %i[pointer pointer], :int] },
32
+ { source: 'LUALIB_API int (luaL_ref) (lua_State *L, int t);',
33
+ ffi: [:luaL_ref, %i[pointer int], :int] },
34
+ { source: 'LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname);',
35
+ ffi: [:luaL_typerror, %i[pointer int pointer], :int] },
36
+ { source: 'LUALIB_API int (luaopen_base) (lua_State *L);',
37
+ ffi: [:luaopen_base, [:pointer], :int] },
38
+ { source: 'LUALIB_API int (luaopen_debug) (lua_State *L);',
39
+ ffi: [:luaopen_debug, [:pointer], :int] },
40
+ { source: 'LUALIB_API int (luaopen_io) (lua_State *L);',
41
+ ffi: [:luaopen_io, [:pointer], :int] },
42
+ { source: 'LUALIB_API int (luaopen_math) (lua_State *L);',
43
+ ffi: [:luaopen_math, [:pointer], :int] },
44
+ { source: 'LUALIB_API int (luaopen_os) (lua_State *L);',
45
+ ffi: [:luaopen_os, [:pointer], :int] },
46
+ { source: 'LUALIB_API int (luaopen_package) (lua_State *L);',
47
+ ffi: [:luaopen_package, [:pointer], :int] },
48
+ { source: 'LUALIB_API int (luaopen_string) (lua_State *L);',
49
+ ffi: [:luaopen_string, [:pointer], :int] },
50
+ { source: 'LUALIB_API int (luaopen_table) (lua_State *L);',
51
+ ffi: [:luaopen_table, [:pointer], :int] },
52
+ { source: 'LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg);',
53
+ ffi: [:luaL_checkinteger, %i[pointer int], :int] },
54
+ { source: 'LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg, lua_Integer def);',
55
+ ffi: [:luaL_optinteger, %i[pointer int int], :int] },
56
+ { source: 'LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg);',
57
+ ffi: [:luaL_checknumber, %i[pointer int], :double] },
58
+ { source: 'LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def);',
59
+ ffi: [:luaL_optnumber, %i[pointer int double], :double] },
60
+ { source: 'LUALIB_API lua_State *(luaL_newstate) (void);',
61
+ ffi: [:luaL_newstate, [], :pointer] },
62
+ { source: 'LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);',
63
+ ffi: [:luaL_addlstring, %i[pointer pointer ulong], :void] },
64
+ { source: 'LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s);',
65
+ ffi: [:luaL_addstring, %i[pointer pointer], :void] },
66
+ { source: 'LUALIB_API void (luaL_addvalue) (luaL_Buffer *B);',
67
+ ffi: [:luaL_addvalue, [:pointer], :void] },
68
+ { source: 'LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B);',
69
+ ffi: [:luaL_buffinit, %i[pointer pointer], :void] },
70
+ { source: 'LUALIB_API void (luaL_checkany) (lua_State *L, int narg);',
71
+ ffi: [:luaL_checkany, %i[pointer int], :void] },
72
+ { source: 'LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg);',
73
+ ffi: [:luaL_checkstack, %i[pointer int pointer], :void] },
74
+ { source: 'LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t);',
75
+ ffi: [:luaL_checktype, %i[pointer int int], :void] },
76
+ { source: 'LUALIB_API void (luaL_openlibs) (lua_State *L);',
77
+ ffi: [:luaL_openlibs, [:pointer], :void] },
78
+ { source: 'LUALIB_API void (luaL_pushresult) (luaL_Buffer *B);',
79
+ ffi: [:luaL_pushresult, [:pointer], :void] },
80
+ { source: 'LUALIB_API void (luaL_register) (lua_State *L, const char *libname, const luaL_Reg *l);',
81
+ ffi: [:luaL_register, %i[pointer pointer pointer], :void] },
82
+ { source: 'LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);',
83
+ ffi: [:luaL_unref, %i[pointer int int], :void] },
84
+ { source: 'LUALIB_API void (luaL_where) (lua_State *L, int lvl);',
85
+ ffi: [:luaL_where, %i[pointer int], :void] },
86
+ { source: 'LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname);',
87
+ ffi: [:luaL_checkudata, %i[pointer int pointer], :pointer] },
88
+ { source: 'LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...);',
89
+ ffi: [:lua_pushfstring, %i[pointer pointer varargs], :pointer] },
90
+ { source: 'LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt, va_list argp);',
91
+ ffi: [:lua_pushvfstring, %i[pointer pointer varargs], :pointer] },
92
+ { source: 'LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len);',
93
+ ffi: [:lua_tolstring, %i[pointer int pointer], :pointer] },
94
+ { source: 'LUA_API const char *(lua_typename) (lua_State *L, int tp);',
95
+ ffi: [:lua_typename, %i[pointer int], :pointer] },
96
+ { source: 'LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);',
97
+ ffi: [:lua_getlocal, %i[pointer pointer int], :pointer] },
98
+ { source: 'LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n);',
99
+ ffi: [:lua_getupvalue, %i[pointer int int], :pointer] },
100
+ { source: 'LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);',
101
+ ffi: [:lua_setlocal, %i[pointer pointer int], :pointer] },
102
+ { source: 'LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n);',
103
+ ffi: [:lua_setupvalue, %i[pointer int int], :pointer] },
104
+ { source: 'LUA_API const void *(lua_topointer) (lua_State *L, int idx);',
105
+ ffi: [:lua_topointer, %i[pointer int], :pointer] },
106
+ { source: 'LUA_API int (lua_checkstack) (lua_State *L, int sz);',
107
+ ffi: [:lua_checkstack, %i[pointer int], :int] },
108
+ { source: 'LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud);',
109
+ ffi: [:lua_cpcall, %i[pointer int pointer], :int] },
110
+ { source: 'LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data);',
111
+ ffi: [:lua_dump, %i[pointer int pointer], :int] },
112
+ { source: 'LUA_API int (lua_equal) (lua_State *L, int idx1, int idx2);',
113
+ ffi: [:lua_equal, %i[pointer int int], :int] },
114
+ { source: 'LUA_API int (lua_error) (lua_State *L);',
115
+ ffi: [:lua_error, [:pointer], :int] },
116
+ { source: 'LUA_API int (lua_gc) (lua_State *L, int what, int data);',
117
+ ffi: [:lua_gc, %i[pointer int int], :int] },
118
+ { source: 'LUA_API int (lua_getmetatable) (lua_State *L, int objindex);',
119
+ ffi: [:lua_getmetatable, %i[pointer int], :int] },
120
+ { source: 'LUA_API int (lua_gettop) (lua_State *L);',
121
+ ffi: [:lua_gettop, [:pointer], :int] },
122
+ { source: 'LUA_API int (lua_iscfunction) (lua_State *L, int idx);',
123
+ ffi: [:lua_iscfunction, %i[pointer int], :int] },
124
+ { source: 'LUA_API int (lua_isnumber) (lua_State *L, int idx);',
125
+ ffi: [:lua_isnumber, %i[pointer int], :int] },
126
+ { source: 'LUA_API int (lua_isstring) (lua_State *L, int idx);',
127
+ ffi: [:lua_isstring, %i[pointer int], :int] },
128
+ { source: 'LUA_API int (lua_isuserdata) (lua_State *L, int idx);',
129
+ ffi: [:lua_isuserdata, %i[pointer int], :int] },
130
+ { source: 'LUA_API int (lua_lessthan) (lua_State *L, int idx1, int idx2);',
131
+ ffi: [:lua_lessthan, %i[pointer int int], :int] },
132
+ { source: 'LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, const char *chunkname);',
133
+ ffi: [:lua_load, %i[pointer char pointer pointer], :int] },
134
+ { source: 'LUA_API int (lua_next) (lua_State *L, int idx);',
135
+ ffi: [:lua_next, %i[pointer int], :int] },
136
+ { source: 'LUA_API int (lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc);',
137
+ ffi: [:lua_pcall, %i[pointer int int int], :int] },
138
+ { source: 'LUA_API int (lua_pushthread) (lua_State *L);',
139
+ ffi: [:lua_pushthread, [:pointer], :int] },
140
+ { source: 'LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2);',
141
+ ffi: [:lua_rawequal, %i[pointer int int], :int] },
142
+ { source: 'LUA_API int (lua_resume) (lua_State *L, int narg);',
143
+ ffi: [:lua_resume, %i[pointer int], :int] },
144
+ { source: 'LUA_API int (lua_setfenv) (lua_State *L, int idx);',
145
+ ffi: [:lua_setfenv, %i[pointer int], :int] },
146
+ { source: 'LUA_API int (lua_setmetatable) (lua_State *L, int objindex);',
147
+ ffi: [:lua_setmetatable, %i[pointer int], :int] },
148
+ { source: 'LUA_API int (lua_status) (lua_State *L);',
149
+ ffi: [:lua_status, [:pointer], :int] },
150
+ { source: 'LUA_API int (lua_toboolean) (lua_State *L, int idx);',
151
+ ffi: [:lua_toboolean, %i[pointer int], :int] },
152
+ { source: 'LUA_API int (lua_type) (lua_State *L, int idx);',
153
+ ffi: [:lua_type, %i[pointer int], :int] },
154
+ { source: 'LUA_API int (lua_yield) (lua_State *L, int nresults);',
155
+ ffi: [:lua_yield, %i[pointer int], :int] },
156
+ { source: 'LUA_API int lua_gethookcount (lua_State *L);',
157
+ ffi: [:lua_gethookcount, [:pointer], :int] },
158
+ { source: 'LUA_API int lua_gethookmask (lua_State *L);',
159
+ ffi: [:lua_gethookmask, [:pointer], :int] },
160
+ { source: 'LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);',
161
+ ffi: [:lua_getinfo, %i[pointer pointer pointer], :int] },
162
+ { source: 'LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar);',
163
+ ffi: [:lua_getstack, %i[pointer int pointer], :int] },
164
+ { source: 'LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count);',
165
+ ffi: [:lua_sethook, %i[pointer void int int], :int] },
166
+ { source: 'LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud);',
167
+ ffi: [:lua_getallocf, %i[pointer pointer], :void] },
168
+ { source: 'LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf);',
169
+ ffi: [:lua_atpanic, %i[pointer int], :int] },
170
+ { source: 'LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx);',
171
+ ffi: [:lua_tocfunction, %i[pointer int], :int] },
172
+ { source: 'LUA_API lua_Hook lua_gethook (lua_State *L);',
173
+ ffi: [:lua_gethook, [:pointer], :void] },
174
+ { source: 'LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx);',
175
+ ffi: [:lua_tointeger, %i[pointer int], :int] },
176
+ { source: 'LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx);',
177
+ ffi: [:lua_tonumber, %i[pointer int], :double] },
178
+ { source: 'LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud);',
179
+ ffi: [:lua_newstate, %i[void pointer], :pointer] },
180
+ { source: 'LUA_API lua_State *(lua_newthread) (lua_State *L);',
181
+ ffi: [:lua_newthread, [:pointer], :pointer] },
182
+ { source: 'LUA_API lua_State *(lua_tothread) (lua_State *L, int idx);',
183
+ ffi: [:lua_tothread, %i[pointer int], :pointer] },
184
+ { source: 'LUA_API size_t (lua_objlen) (lua_State *L, int idx);',
185
+ ffi: [:lua_objlen, %i[pointer int], :ulong] },
186
+ { source: 'LUA_API void (lua_call) (lua_State *L, int nargs, int nresults);',
187
+ ffi: [:lua_call, %i[pointer int int], :void] },
188
+ { source: 'LUA_API void (lua_close) (lua_State *L);',
189
+ ffi: [:lua_close, [:pointer], :void] },
190
+ { source: 'LUA_API void (lua_concat) (lua_State *L, int n);',
191
+ ffi: [:lua_concat, %i[pointer int], :void] },
192
+ { source: 'LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec);',
193
+ ffi: [:lua_createtable, %i[pointer int int], :void] },
194
+ { source: 'LUA_API void (lua_getfenv) (lua_State *L, int idx);',
195
+ ffi: [:lua_getfenv, %i[pointer int], :void] },
196
+ { source: 'LUA_API void (lua_getfield) (lua_State *L, int idx, const char *k);',
197
+ ffi: [:lua_getfield, %i[pointer int pointer], :void] },
198
+ { source: 'LUA_API void (lua_gettable) (lua_State *L, int idx);',
199
+ ffi: [:lua_gettable, %i[pointer int], :void] },
200
+ { source: 'LUA_API void (lua_insert) (lua_State *L, int idx);',
201
+ ffi: [:lua_insert, %i[pointer int], :void] },
202
+ { source: 'LUA_API void (lua_pushboolean) (lua_State *L, int b);',
203
+ ffi: [:lua_pushboolean, %i[pointer int], :void] },
204
+ { source: 'LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);',
205
+ ffi: [:lua_pushcclosure, %i[pointer int int], :void] },
206
+ { source: 'LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n);',
207
+ ffi: [:lua_pushinteger, %i[pointer int], :void] },
208
+ { source: 'LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p);',
209
+ ffi: [:lua_pushlightuserdata, %i[pointer pointer], :void] },
210
+ { source: 'LUA_API void (lua_pushlstring) (lua_State *L, const char *s, size_t l);',
211
+ ffi: [:lua_pushlstring, %i[pointer pointer ulong], :void] },
212
+ { source: 'LUA_API void (lua_pushnil) (lua_State *L);',
213
+ ffi: [:lua_pushnil, [:pointer], :void] },
214
+ { source: 'LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n);',
215
+ ffi: [:lua_pushnumber, %i[pointer double], :void] },
216
+ { source: 'LUA_API void (lua_pushstring) (lua_State *L, const char *s);',
217
+ ffi: [:lua_pushstring, %i[pointer pointer], :void] },
218
+ { source: 'LUA_API void (lua_pushvalue) (lua_State *L, int idx);',
219
+ ffi: [:lua_pushvalue, %i[pointer int], :void] },
220
+ { source: 'LUA_API void (lua_rawget) (lua_State *L, int idx);',
221
+ ffi: [:lua_rawget, %i[pointer int], :void] },
222
+ { source: 'LUA_API void (lua_rawgeti) (lua_State *L, int idx, int n);',
223
+ ffi: [:lua_rawgeti, %i[pointer int int], :void] },
224
+ { source: 'LUA_API void (lua_rawset) (lua_State *L, int idx);',
225
+ ffi: [:lua_rawset, %i[pointer int], :void] },
226
+ { source: 'LUA_API void (lua_rawseti) (lua_State *L, int idx, int n);',
227
+ ffi: [:lua_rawseti, %i[pointer int int], :void] },
228
+ { source: 'LUA_API void (lua_remove) (lua_State *L, int idx);',
229
+ ffi: [:lua_remove, %i[pointer int], :void] },
230
+ { source: 'LUA_API void (lua_replace) (lua_State *L, int idx);',
231
+ ffi: [:lua_replace, %i[pointer int], :void] },
232
+ { source: 'LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k);',
233
+ ffi: [:lua_setfield, %i[pointer int pointer], :void] },
234
+ { source: 'LUA_API void (lua_settable) (lua_State *L, int idx);',
235
+ ffi: [:lua_settable, %i[pointer int], :void] },
236
+ { source: 'LUA_API void (lua_settop) (lua_State *L, int idx);',
237
+ ffi: [:lua_settop, %i[pointer int], :void] },
238
+ { source: 'LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n);',
239
+ ffi: [:lua_xmove, %i[pointer pointer int], :void] },
240
+ { source: 'LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz);',
241
+ ffi: [:lua_newuserdata, %i[pointer ulong], :pointer] },
242
+ { source: 'LUA_API void *(lua_touserdata) (lua_State *L, int idx);',
243
+ ffi: [:lua_touserdata, %i[pointer int], :pointer] },
244
+ { source: 'LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);',
245
+ ffi: [:lua_setallocf, %i[pointer void pointer], :void] },
246
+ { source: 'LUA_API void lua_setlevel (lua_State *from, lua_State *to);',
247
+ ffi: [:lua_setlevel, %i[pointer pointer], :void] }],
248
+ macros: [{ source: '#define LUAI_THROW(L,c) throw(c)',
249
+ name: 'LUAI_THROW',
250
+ input: %w[L c] },
251
+ { source: '#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS)',
252
+ name: 'luaC_white',
253
+ input: ['g'] },
254
+ { source: '#define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx)',
255
+ name: 'luaK_codeAsBx',
256
+ input: %w[fs o A sBx] },
257
+ { source: '#define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET)',
258
+ name: 'luaK_setmultret',
259
+ input: %w[fs e] },
260
+ { source: '#define luaL_addsize(B,n) ((B)->p += (n))',
261
+ name: 'luaL_addsize',
262
+ input: %w[B n] },
263
+ { source: '#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n)))',
264
+ name: 'luaL_checkint',
265
+ input: %w[L n] },
266
+ { source: '#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n)))',
267
+ name: 'luaL_checklong',
268
+ input: %w[L n] },
269
+ { source: '#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL))',
270
+ name: 'luaL_checkstring',
271
+ input: %w[L n] },
272
+ { source: '#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n)))',
273
+ name: 'luaL_getmetatable',
274
+ input: %w[L n] },
275
+ { source: '#define luaL_getn(L,i) ((int)lua_objlen(L, i))',
276
+ name: 'luaL_getn',
277
+ input: %w[L i] },
278
+ { source: '#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))',
279
+ name: 'luaL_opt',
280
+ input: %w[L f n d] },
281
+ { source: '#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d)))',
282
+ name: 'luaL_optint',
283
+ input: %w[L n d] },
284
+ { source: '#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d)))',
285
+ name: 'luaL_optlong',
286
+ input: %w[L n d] },
287
+ { source: '#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL))',
288
+ name: 'luaL_optstring',
289
+ input: %w[L n d] },
290
+ { source: '#define luaL_putchar(B,c) luaL_addchar(B,c)',
291
+ name: 'luaL_putchar',
292
+ input: %w[B c] },
293
+ { source: '#define luaL_setn(L,i,j) ((void)0)',
294
+ name: 'luaL_setn',
295
+ input: %w[L i j] },
296
+ { source: '#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i)))',
297
+ name: 'luaL_typename',
298
+ input: %w[L i] },
299
+ { source: '#define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0)',
300
+ name: 'luaM_free',
301
+ input: %w[L b] },
302
+ { source: '#define luaM_freearray(L, b, n, t) luaM_reallocv(L, (b), n, 0, sizeof(t))',
303
+ name: 'luaM_freearray',
304
+ input: %w[L b n t] },
305
+ { source: '#define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0)',
306
+ name: 'luaM_freemem',
307
+ input: %w[L b s] },
308
+ { source: '#define luaM_malloc(L,t) luaM_realloc_(L, NULL, 0, (t))',
309
+ name: 'luaM_malloc',
310
+ input: %w[L t] },
311
+ { source: '#define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t)))',
312
+ name: 'luaM_new',
313
+ input: %w[L t] },
314
+ { source: '#define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT)',
315
+ name: 'luaS_fix',
316
+ input: ['s'] },
317
+ { source: '#define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s)))',
318
+ name: 'luaS_new',
319
+ input: %w[L s] },
320
+ { source: '#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \\ (sizeof(s)/sizeof(char))-1))',
321
+ name: 'luaS_newliteral',
322
+ input: %w[L s] },
323
+ { source: '#define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0)',
324
+ name: 'luaZ_freebuffer',
325
+ input: %w[L buff] },
326
+ { source: '#define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0)',
327
+ name: 'luaZ_initbuffer',
328
+ input: %w[L buff] },
329
+ { source: '#define lua_freeline(L,b) ((void)L, free(b))',
330
+ name: 'lua_freeline',
331
+ input: %w[L b] },
332
+ { source: '#define lua_getgccount(L) lua_gc(L, LUA_GCCOUNT, 0)',
333
+ name: 'lua_getgccount',
334
+ input: ['L'] },
335
+ { source: '#define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, (s))',
336
+ name: 'lua_getglobal',
337
+ input: %w[L s] },
338
+ { source: '#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref))',
339
+ name: 'lua_getref',
340
+ input: %w[L ref] },
341
+ { source: '#define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX)',
342
+ name: 'lua_getregistry',
343
+ input: ['L'] },
344
+ { source: '#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN)',
345
+ name: 'lua_isboolean',
346
+ input: %w[L n] },
347
+ { source: '#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION)',
348
+ name: 'lua_isfunction',
349
+ input: %w[L n] },
350
+ { source: '#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA)',
351
+ name: 'lua_islightuserdata',
352
+ input: %w[L n] },
353
+ { source: '#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL)',
354
+ name: 'lua_isnil',
355
+ input: %w[L n] },
356
+ { source: '#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE)',
357
+ name: 'lua_isnone',
358
+ input: %w[L n] },
359
+ { source: '#define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0)',
360
+ name: 'lua_isnoneornil',
361
+ input: %w[L n] },
362
+ { source: '#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE)',
363
+ name: 'lua_istable',
364
+ input: %w[L n] },
365
+ { source: '#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD)',
366
+ name: 'lua_isthread',
367
+ input: %w[L n] },
368
+ { source: '#define lua_newtable(L) lua_createtable(L, 0, 0)',
369
+ name: 'lua_newtable',
370
+ input: ['L'] },
371
+ { source: '#define lua_number2int(i,d) ((i)=(int)(d))',
372
+ name: 'lua_number2int',
373
+ input: %w[i d] },
374
+ { source: '#define lua_number2integer(i,n) lua_number2int(i, n)',
375
+ name: 'lua_number2integer',
376
+ input: %w[i n] },
377
+ { source: '#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))',
378
+ name: 'lua_number2str',
379
+ input: %w[s n] },
380
+ { source: '#define lua_open() luaL_newstate()',
381
+ name: 'lua_open',
382
+ input: [] },
383
+ { source: '#define lua_pclose(L,file) ((void)L, (pclose(file) != -1))',
384
+ name: 'lua_pclose',
385
+ input: %w[L file] },
386
+ { source: '#define lua_pop(L,n) lua_settop(L, -(n)-1)',
387
+ name: 'lua_pop',
388
+ input: %w[L n] },
389
+ { source: '#define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m))',
390
+ name: 'lua_popen',
391
+ input: %w[L c m] },
392
+ { source: '#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0)',
393
+ name: 'lua_pushcfunction',
394
+ input: %w[L f] },
395
+ { source: '#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL)',
396
+ name: 'lua_readline',
397
+ input: %w[L b p] },
398
+ { source: '#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \\ (lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0))',
399
+ name: 'lua_ref',
400
+ input: %w[L lock] },
401
+ { source: '#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n)))',
402
+ name: 'lua_register',
403
+ input: %w[L n f] },
404
+ { source: '#define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, (s))',
405
+ name: 'lua_setglobal',
406
+ input: %w[L s] },
407
+ { source: '#define lua_stdin_is_tty() isatty(0)',
408
+ name: 'lua_stdin_is_tty',
409
+ input: [] },
410
+ { source: '#define lua_str2number(s,p) strtod((s), (p))',
411
+ name: 'lua_str2number',
412
+ input: %w[s p] },
413
+ { source: '#define lua_strlen(L,i) lua_objlen(L, (i))',
414
+ name: 'lua_strlen',
415
+ input: %w[L i] },
416
+ { source: '#define lua_tostring(L,i) lua_tolstring(L, (i), NULL)',
417
+ name: 'lua_tostring',
418
+ input: %w[L i] },
419
+ { source: '#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref))',
420
+ name: 'lua_unref',
421
+ input: %w[L ref] },
422
+ { source: '#define luai_numadd(a,b) ((a)+(b))',
423
+ name: 'luai_numadd',
424
+ input: %w[a b] },
425
+ { source: '#define luai_numdiv(a,b) ((a)/(b))',
426
+ name: 'luai_numdiv',
427
+ input: %w[a b] },
428
+ { source: '#define luai_numeq(a,b) ((a)==(b))',
429
+ name: 'luai_numeq',
430
+ input: %w[a b] },
431
+ { source: '#define luai_numle(a,b) ((a)<=(b))',
432
+ name: 'luai_numle',
433
+ input: %w[a b] },
434
+ { source: '#define luai_numlt(a,b) ((a)<(b))',
435
+ name: 'luai_numlt',
436
+ input: %w[a b] },
437
+ { source: '#define luai_nummod(a,b) ((a) - floor((a)/(b))*(b))',
438
+ name: 'luai_nummod',
439
+ input: %w[a b] },
440
+ { source: '#define luai_nummul(a,b) ((a)*(b))',
441
+ name: 'luai_nummul',
442
+ input: %w[a b] },
443
+ { source: '#define luai_numpow(a,b) (pow(a,b))',
444
+ name: 'luai_numpow',
445
+ input: %w[a b] },
446
+ { source: '#define luai_numsub(a,b) ((a)-(b))',
447
+ name: 'luai_numsub',
448
+ input: %w[a b] },
449
+ { source: '#define luai_userstateresume(L,n) ((void)L)',
450
+ name: 'luai_userstateresume',
451
+ input: %w[L n] },
452
+ { source: '#define luai_userstatethread(L,L1) ((void)L)',
453
+ name: 'luai_userstatethread',
454
+ input: %w[L L1] },
455
+ { source: '#define luai_userstateyield(L,n) ((void)L)',
456
+ name: 'luai_userstateyield',
457
+ input: %w[L n] }]
458
+ }
459
+ end
460
+ end