sweet-moon 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,243 @@
1
+ module Logic
2
+ module V401
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_check_lstr (lua_State *L, int numArg, size_t *len);',
7
+ ffi: [:luaL_check_lstr, %i[pointer int pointer], :pointer] },
8
+ { source: 'LUALIB_API const char *luaL_opt_lstr (lua_State *L, int numArg, const char *def, size_t *len);',
9
+ ffi: [:luaL_opt_lstr, %i[pointer int pointer pointer], :pointer] },
10
+ { source: 'LUALIB_API double luaL_check_number (lua_State *L, int numArg);',
11
+ ffi: [:luaL_check_number, %i[pointer int], :double] },
12
+ { source: 'LUALIB_API double luaL_opt_number (lua_State *L, int numArg, double def);',
13
+ ffi: [:luaL_opt_number, %i[pointer int double], :double] },
14
+ { source: 'LUALIB_API int luaL_findstring (const char *name, const char *const _list[]);',
15
+ ffi: [:luaL_findstring, %i[pointer pointer], :int] },
16
+ { source: 'LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l);',
17
+ ffi: [:luaL_addlstring, %i[pointer pointer ulong], :void] },
18
+ { source: 'LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s);',
19
+ ffi: [:luaL_addstring, %i[pointer pointer], :void] },
20
+ { source: 'LUALIB_API void luaL_addvalue (luaL_Buffer *B);',
21
+ ffi: [:luaL_addvalue, [:pointer], :void] },
22
+ { source: 'LUALIB_API void luaL_argerror (lua_State *L, int numarg, const char *extramsg);',
23
+ ffi: [:luaL_argerror, %i[pointer int pointer], :void] },
24
+ { source: 'LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B);',
25
+ ffi: [:luaL_buffinit, %i[pointer pointer], :void] },
26
+ { source: 'LUALIB_API void luaL_checkany (lua_State *L, int narg);',
27
+ ffi: [:luaL_checkany, %i[pointer int], :void] },
28
+ { source: 'LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *msg);',
29
+ ffi: [:luaL_checkstack, %i[pointer int pointer], :void] },
30
+ { source: 'LUALIB_API void luaL_checktype (lua_State *L, int narg, int t);',
31
+ ffi: [:luaL_checktype, %i[pointer int int], :void] },
32
+ { source: 'LUALIB_API void luaL_openlib (lua_State *L, const struct luaL_reg *l, int n);',
33
+ ffi: [:luaL_openlib, %i[pointer pointer int], :void] },
34
+ { source: 'LUALIB_API void luaL_pushresult (luaL_Buffer *B);',
35
+ ffi: [:luaL_pushresult, [:pointer], :void] },
36
+ { source: 'LUALIB_API void luaL_verror (lua_State *L, const char *fmt, ...);',
37
+ ffi: [:luaL_verror, %i[pointer pointer varargs], :void] },
38
+ { source: 'LUALIB_API void lua_baselibopen (lua_State *L);',
39
+ ffi: [:lua_baselibopen, [:pointer], :void] },
40
+ { source: 'LUALIB_API void lua_dblibopen (lua_State *L);',
41
+ ffi: [:lua_dblibopen, [:pointer], :void] },
42
+ { source: 'LUALIB_API void lua_iolibopen (lua_State *L);',
43
+ ffi: [:lua_iolibopen, [:pointer], :void] },
44
+ { source: 'LUALIB_API void lua_mathlibopen (lua_State *L);',
45
+ ffi: [:lua_mathlibopen, [:pointer], :void] },
46
+ { source: 'LUALIB_API void lua_strlibopen (lua_State *L);',
47
+ ffi: [:lua_strlibopen, [:pointer], :void] },
48
+ { source: 'LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);',
49
+ ffi: [:lua_getlocal, %i[pointer pointer int], :pointer] },
50
+ { source: 'LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);',
51
+ ffi: [:lua_setlocal, %i[pointer pointer int], :pointer] },
52
+ { source: 'LUA_API const char *lua_tostring (lua_State *L, int index);',
53
+ ffi: [:lua_tostring, %i[pointer int], :pointer] },
54
+ { source: 'LUA_API const char *lua_typename (lua_State *L, int t);',
55
+ ffi: [:lua_typename, %i[pointer int], :pointer] },
56
+ { source: 'LUA_API const void *lua_topointer (lua_State *L, int index);',
57
+ ffi: [:lua_topointer, %i[pointer int], :pointer] },
58
+ { source: 'LUA_API double lua_tonumber (lua_State *L, int index);',
59
+ ffi: [:lua_tonumber, %i[pointer int], :double] },
60
+ { source: 'LUA_API int lua_call (lua_State *L, int nargs, int nresults);',
61
+ ffi: [:lua_call, %i[pointer int int], :int] },
62
+ { source: 'LUA_API int lua_copytagmethods (lua_State *L, int tagto, int tagfrom);',
63
+ ffi: [:lua_copytagmethods, %i[pointer int int], :int] },
64
+ { source: 'LUA_API int lua_dobuffer (lua_State *L, const char *buff, size_t size, const char *name);',
65
+ ffi: [:lua_dobuffer, %i[pointer pointer ulong pointer], :int] },
66
+ { source: 'LUA_API int lua_dofile (lua_State *L, const char *filename);',
67
+ ffi: [:lua_dofile, %i[pointer pointer], :int] },
68
+ { source: 'LUA_API int lua_dostring (lua_State *L, const char *str);',
69
+ ffi: [:lua_dostring, %i[pointer pointer], :int] },
70
+ { source: 'LUA_API int lua_equal (lua_State *L, int index1, int index2);',
71
+ ffi: [:lua_equal, %i[pointer int int], :int] },
72
+ { source: 'LUA_API int lua_getgccount (lua_State *L);',
73
+ ffi: [:lua_getgccount, [:pointer], :int] },
74
+ { source: 'LUA_API int lua_getgcthreshold (lua_State *L);',
75
+ ffi: [:lua_getgcthreshold, [:pointer], :int] },
76
+ { source: 'LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);',
77
+ ffi: [:lua_getinfo, %i[pointer pointer pointer], :int] },
78
+ { source: 'LUA_API int lua_getn (lua_State *L, int index);',
79
+ ffi: [:lua_getn, %i[pointer int], :int] },
80
+ { source: 'LUA_API int lua_getref (lua_State *L, int ref);',
81
+ ffi: [:lua_getref, %i[pointer int], :int] },
82
+ { source: 'LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar);',
83
+ ffi: [:lua_getstack, %i[pointer int pointer], :int] },
84
+ { source: 'LUA_API int lua_gettop (lua_State *L);',
85
+ ffi: [:lua_gettop, [:pointer], :int] },
86
+ { source: 'LUA_API int lua_iscfunction (lua_State *L, int index);',
87
+ ffi: [:lua_iscfunction, %i[pointer int], :int] },
88
+ { source: 'LUA_API int lua_isnumber (lua_State *L, int index);',
89
+ ffi: [:lua_isnumber, %i[pointer int], :int] },
90
+ { source: 'LUA_API int lua_isstring (lua_State *L, int index);',
91
+ ffi: [:lua_isstring, %i[pointer int], :int] },
92
+ { source: 'LUA_API int lua_lessthan (lua_State *L, int index1, int index2);',
93
+ ffi: [:lua_lessthan, %i[pointer int int], :int] },
94
+ { source: 'LUA_API int lua_newtag (lua_State *L);',
95
+ ffi: [:lua_newtag, [:pointer], :int] },
96
+ { source: 'LUA_API int lua_next (lua_State *L, int index);',
97
+ ffi: [:lua_next, %i[pointer int], :int] },
98
+ { source: 'LUA_API int lua_ref (lua_State *L, int lock);',
99
+ ffi: [:lua_ref, %i[pointer int], :int] },
100
+ { source: 'LUA_API int lua_stackspace (lua_State *L);',
101
+ ffi: [:lua_stackspace, [:pointer], :int] },
102
+ { source: 'LUA_API int lua_tag (lua_State *L, int index);',
103
+ ffi: [:lua_tag, %i[pointer int], :int] },
104
+ { source: 'LUA_API int lua_type (lua_State *L, int index);',
105
+ ffi: [:lua_type, %i[pointer int], :int] },
106
+ { source: 'LUA_API lua_CFunction lua_tocfunction (lua_State *L, int index);',
107
+ ffi: [:lua_tocfunction, %i[pointer int], :int] },
108
+ { source: 'LUA_API lua_Hook lua_setcallhook (lua_State *L, lua_Hook func);',
109
+ ffi: [:lua_setcallhook, [:pointer], :void] },
110
+ { source: 'LUA_API lua_Hook lua_setlinehook (lua_State *L, lua_Hook func);',
111
+ ffi: [:lua_setlinehook, [:pointer], :void] },
112
+ { source: 'LUA_API lua_State *lua_open (int stacksize);',
113
+ ffi: [:lua_open, [:int], :pointer] },
114
+ { source: 'LUA_API size_t lua_strlen (lua_State *L, int index);',
115
+ ffi: [:lua_strlen, %i[pointer int], :ulong] },
116
+ { source: 'LUA_API void *lua_newuserdata (lua_State *L, size_t size);',
117
+ ffi: [:lua_newuserdata, %i[pointer ulong], :pointer] },
118
+ { source: 'LUA_API void *lua_touserdata (lua_State *L, int index);',
119
+ ffi: [:lua_touserdata, %i[pointer int], :pointer] },
120
+ { source: 'LUA_API void lua_close (lua_State *L);',
121
+ ffi: [:lua_close, [:pointer], :void] },
122
+ { source: 'LUA_API void lua_concat (lua_State *L, int n);',
123
+ ffi: [:lua_concat, %i[pointer int], :void] },
124
+ { source: 'LUA_API void lua_error (lua_State *L, const char *s);',
125
+ ffi: [:lua_error, %i[pointer pointer], :void] },
126
+ { source: 'LUA_API void lua_getglobal (lua_State *L, const char *name);',
127
+ ffi: [:lua_getglobal, %i[pointer pointer], :void] },
128
+ { source: 'LUA_API void lua_getglobals (lua_State *L);',
129
+ ffi: [:lua_getglobals, [:pointer], :void] },
130
+ { source: 'LUA_API void lua_gettable (lua_State *L, int index);',
131
+ ffi: [:lua_gettable, %i[pointer int], :void] },
132
+ { source: 'LUA_API void lua_gettagmethod (lua_State *L, int tag, const char *event);',
133
+ ffi: [:lua_gettagmethod, %i[pointer int pointer], :void] },
134
+ { source: 'LUA_API void lua_insert (lua_State *L, int index);',
135
+ ffi: [:lua_insert, %i[pointer int], :void] },
136
+ { source: 'LUA_API void lua_newtable (lua_State *L);',
137
+ ffi: [:lua_newtable, [:pointer], :void] },
138
+ { source: 'LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n);',
139
+ ffi: [:lua_pushcclosure, %i[pointer int int], :void] },
140
+ { source: 'LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len);',
141
+ ffi: [:lua_pushlstring, %i[pointer pointer ulong], :void] },
142
+ { source: 'LUA_API void lua_pushnil (lua_State *L);',
143
+ ffi: [:lua_pushnil, [:pointer], :void] },
144
+ { source: 'LUA_API void lua_pushnumber (lua_State *L, double n);',
145
+ ffi: [:lua_pushnumber, %i[pointer double], :void] },
146
+ { source: 'LUA_API void lua_pushstring (lua_State *L, const char *s);',
147
+ ffi: [:lua_pushstring, %i[pointer pointer], :void] },
148
+ { source: 'LUA_API void lua_pushusertag (lua_State *L, void *u, int tag);',
149
+ ffi: [:lua_pushusertag, %i[pointer pointer int], :void] },
150
+ { source: 'LUA_API void lua_pushvalue (lua_State *L, int index);',
151
+ ffi: [:lua_pushvalue, %i[pointer int], :void] },
152
+ { source: 'LUA_API void lua_rawcall (lua_State *L, int nargs, int nresults);',
153
+ ffi: [:lua_rawcall, %i[pointer int int], :void] },
154
+ { source: 'LUA_API void lua_rawget (lua_State *L, int index);',
155
+ ffi: [:lua_rawget, %i[pointer int], :void] },
156
+ { source: 'LUA_API void lua_rawgeti (lua_State *L, int index, int n);',
157
+ ffi: [:lua_rawgeti, %i[pointer int int], :void] },
158
+ { source: 'LUA_API void lua_rawset (lua_State *L, int index);',
159
+ ffi: [:lua_rawset, %i[pointer int], :void] },
160
+ { source: 'LUA_API void lua_rawseti (lua_State *L, int index, int n);',
161
+ ffi: [:lua_rawseti, %i[pointer int int], :void] },
162
+ { source: 'LUA_API void lua_remove (lua_State *L, int index);',
163
+ ffi: [:lua_remove, %i[pointer int], :void] },
164
+ { source: 'LUA_API void lua_setgcthreshold (lua_State *L, int newthreshold);',
165
+ ffi: [:lua_setgcthreshold, %i[pointer int], :void] },
166
+ { source: 'LUA_API void lua_setglobal (lua_State *L, const char *name);',
167
+ ffi: [:lua_setglobal, %i[pointer pointer], :void] },
168
+ { source: 'LUA_API void lua_setglobals (lua_State *L);',
169
+ ffi: [:lua_setglobals, [:pointer], :void] },
170
+ { source: 'LUA_API void lua_settable (lua_State *L, int index);',
171
+ ffi: [:lua_settable, %i[pointer int], :void] },
172
+ { source: 'LUA_API void lua_settag (lua_State *L, int tag);',
173
+ ffi: [:lua_settag, %i[pointer int], :void] },
174
+ { source: 'LUA_API void lua_settagmethod (lua_State *L, int tag, const char *event);',
175
+ ffi: [:lua_settagmethod, %i[pointer int pointer], :void] },
176
+ { source: 'LUA_API void lua_settop (lua_State *L, int index);',
177
+ ffi: [:lua_settop, %i[pointer int], :void] },
178
+ { source: 'LUA_API void lua_unref (lua_State *L, int ref);',
179
+ ffi: [:lua_unref, %i[pointer int], :void] },
180
+ { source: 'const char *luaI_classend (lua_State *L, const char *p);',
181
+ ffi: [:luaI_classend, %i[pointer pointer], :pointer] },
182
+ { source: 'int luaI_singlematch (int c, const char *p, const char *ep);',
183
+ ffi: [:luaI_singlematch, %i[int pointer pointer], :int] }],
184
+ macros: [{ source: '#define luaL_addsize(B,n) ((B)->p += (n))',
185
+ name: 'luaL_addsize',
186
+ input: %w[B n] },
187
+ { source: '#define luaL_check_int(L,n) ((int)luaL_check_number(L, n))',
188
+ name: 'luaL_check_int',
189
+ input: %w[L n] },
190
+ { source: '#define luaL_check_long(L,n) ((long)luaL_check_number(L, n))',
191
+ name: 'luaL_check_long',
192
+ input: %w[L n] },
193
+ { source: '#define luaL_check_string(L,n) (luaL_check_lstr(L, (n), NULL))',
194
+ name: 'luaL_check_string',
195
+ input: %w[L n] },
196
+ { source: '#define luaL_openl(L,a) luaL_openlib(L, a, (sizeof(a)/sizeof(a[0])))',
197
+ name: 'luaL_openl',
198
+ input: %w[L a] },
199
+ { source: '#define luaL_opt_int(L,n,d) ((int)luaL_opt_number(L, n,d))',
200
+ name: 'luaL_opt_int',
201
+ input: %w[L n d] },
202
+ { source: '#define luaL_opt_long(L,n,d) ((long)luaL_opt_number(L, n,d))',
203
+ name: 'luaL_opt_long',
204
+ input: %w[L n d] },
205
+ { source: '#define luaL_opt_string(L,n,d) (luaL_opt_lstr(L, (n), (d), NULL))',
206
+ name: 'luaL_opt_string',
207
+ input: %w[L n d] },
208
+ { source: '#define lua_clonetag(L,t) lua_copytagmethods(L, lua_newtag(L), (t))',
209
+ name: 'lua_clonetag',
210
+ input: %w[L t] },
211
+ { source: '#define lua_getregistry(L) lua_getref(L, LUA_REFREGISTRY)',
212
+ name: 'lua_getregistry',
213
+ input: ['L'] },
214
+ { source: '#define lua_isfunction(L,n) (lua_type(L,n) == LUA_TFUNCTION)',
215
+ name: 'lua_isfunction',
216
+ input: %w[L n] },
217
+ { source: '#define lua_isnil(L,n) (lua_type(L,n) == LUA_TNIL)',
218
+ name: 'lua_isnil',
219
+ input: %w[L n] },
220
+ { source: '#define lua_isnull(L,n) (lua_type(L,n) == LUA_TNONE)',
221
+ name: 'lua_isnull',
222
+ input: %w[L n] },
223
+ { source: '#define lua_istable(L,n) (lua_type(L,n) == LUA_TTABLE)',
224
+ name: 'lua_istable',
225
+ input: %w[L n] },
226
+ { source: '#define lua_isuserdata(L,n) (lua_type(L,n) == LUA_TUSERDATA)',
227
+ name: 'lua_isuserdata',
228
+ input: %w[L n] },
229
+ { source: '#define lua_pop(L,n) lua_settop(L, -(n)-1)',
230
+ name: 'lua_pop',
231
+ input: %w[L n] },
232
+ { source: '#define lua_pushcfunction(L,f) lua_pushcclosure(L, f, 0)',
233
+ name: 'lua_pushcfunction',
234
+ input: %w[L f] },
235
+ { source: '#define lua_pushuserdata(L,u) lua_pushusertag(L, u, 0)',
236
+ name: 'lua_pushuserdata',
237
+ input: %w[L u] },
238
+ { source: '#define lua_register(L,n,f) (lua_pushcfunction(L, f), lua_setglobal(L, n))',
239
+ name: 'lua_register',
240
+ input: %w[L n f] }]
241
+ }
242
+ end
243
+ end