Tamar 0.7.5 → 0.7.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. data/.gitmodules +3 -0
  2. data/HISTORY +22 -5
  3. data/Tamar.gemspec +114 -1
  4. data/VERSION +1 -1
  5. data/src/lua/CMakeLists.txt +176 -0
  6. data/src/lua/COPYRIGHT +34 -0
  7. data/src/lua/FindReadline.cmake +25 -0
  8. data/src/lua/HISTORY +183 -0
  9. data/src/lua/INSTALL +99 -0
  10. data/src/lua/Makefile +128 -0
  11. data/src/lua/README +46 -0
  12. data/src/lua/dist.cmake +450 -0
  13. data/src/lua/dist.info +10 -0
  14. data/src/lua/doc/amazon.gif +0 -0
  15. data/src/lua/doc/contents.html +499 -0
  16. data/src/lua/doc/cover.png +0 -0
  17. data/src/lua/doc/logo.gif +0 -0
  18. data/src/lua/doc/lua.1 +163 -0
  19. data/src/lua/doc/lua.css +41 -0
  20. data/src/lua/doc/lua.html +172 -0
  21. data/src/lua/doc/luac.1 +136 -0
  22. data/src/lua/doc/luac.html +145 -0
  23. data/src/lua/doc/manual.css +13 -0
  24. data/src/lua/doc/manual.html +8801 -0
  25. data/src/lua/doc/readme.html +40 -0
  26. data/src/lua/etc/Makefile +44 -0
  27. data/src/lua/etc/README +37 -0
  28. data/src/lua/etc/all.c +38 -0
  29. data/src/lua/etc/lua.hpp +9 -0
  30. data/src/lua/etc/lua.ico +0 -0
  31. data/src/lua/etc/lua.pc +31 -0
  32. data/src/lua/etc/luavs.bat +28 -0
  33. data/src/lua/etc/min.c +39 -0
  34. data/src/lua/etc/noparser.c +50 -0
  35. data/src/lua/etc/strict.lua +41 -0
  36. data/src/lua/src/Makefile +182 -0
  37. data/src/lua/src/lapi.c +1087 -0
  38. data/src/lua/src/lapi.h +16 -0
  39. data/src/lua/src/lauxlib.c +652 -0
  40. data/src/lua/src/lauxlib.h +174 -0
  41. data/src/lua/src/lbaselib.c +653 -0
  42. data/src/lua/src/lcode.c +831 -0
  43. data/src/lua/src/lcode.h +76 -0
  44. data/src/lua/src/ldblib.c +398 -0
  45. data/src/lua/src/ldebug.c +638 -0
  46. data/src/lua/src/ldebug.h +33 -0
  47. data/src/lua/src/ldo.c +518 -0
  48. data/src/lua/src/ldo.h +57 -0
  49. data/src/lua/src/ldump.c +164 -0
  50. data/src/lua/src/lfunc.c +174 -0
  51. data/src/lua/src/lfunc.h +34 -0
  52. data/src/lua/src/lgc.c +711 -0
  53. data/src/lua/src/lgc.h +110 -0
  54. data/src/lua/src/linit.c +38 -0
  55. data/src/lua/src/liolib.c +556 -0
  56. data/src/lua/src/llex.c +463 -0
  57. data/src/lua/src/llex.h +81 -0
  58. data/src/lua/src/llimits.h +128 -0
  59. data/src/lua/src/lmathlib.c +263 -0
  60. data/src/lua/src/lmem.c +86 -0
  61. data/src/lua/src/lmem.h +49 -0
  62. data/src/lua/src/loadlib.c +666 -0
  63. data/src/lua/src/loadlib_rel.c +719 -0
  64. data/src/lua/src/lobject.c +214 -0
  65. data/src/lua/src/lobject.h +381 -0
  66. data/src/lua/src/lopcodes.c +102 -0
  67. data/src/lua/src/lopcodes.h +268 -0
  68. data/src/lua/src/loslib.c +243 -0
  69. data/src/lua/src/lparser.c +1339 -0
  70. data/src/lua/src/lparser.h +82 -0
  71. data/src/lua/src/lstate.c +214 -0
  72. data/src/lua/src/lstate.h +169 -0
  73. data/src/lua/src/lstring.c +111 -0
  74. data/src/lua/src/lstring.h +31 -0
  75. data/src/lua/src/lstrlib.c +871 -0
  76. data/src/lua/src/ltable.c +588 -0
  77. data/src/lua/src/ltable.h +40 -0
  78. data/src/lua/src/ltablib.c +287 -0
  79. data/src/lua/src/ltm.c +75 -0
  80. data/src/lua/src/ltm.h +54 -0
  81. data/src/lua/src/lua.c +392 -0
  82. data/src/lua/src/lua.def +131 -0
  83. data/src/lua/src/lua.h +388 -0
  84. data/src/lua/src/lua.rc +28 -0
  85. data/src/lua/src/lua_dll.rc +26 -0
  86. data/src/lua/src/luac.c +200 -0
  87. data/src/lua/src/luac.rc +1 -0
  88. data/src/lua/src/luaconf.h.in +724 -0
  89. data/src/lua/src/luaconf.h.orig +763 -0
  90. data/src/lua/src/lualib.h +53 -0
  91. data/src/lua/src/lundump.c +227 -0
  92. data/src/lua/src/lundump.h +36 -0
  93. data/src/lua/src/lvm.c +766 -0
  94. data/src/lua/src/lvm.h +36 -0
  95. data/src/lua/src/lzio.c +82 -0
  96. data/src/lua/src/lzio.h +67 -0
  97. data/src/lua/src/print.c +227 -0
  98. data/src/lua/test/README +26 -0
  99. data/src/lua/test/bisect.lua +27 -0
  100. data/src/lua/test/cf.lua +16 -0
  101. data/src/lua/test/echo.lua +5 -0
  102. data/src/lua/test/env.lua +7 -0
  103. data/src/lua/test/factorial.lua +32 -0
  104. data/src/lua/test/fib.lua +40 -0
  105. data/src/lua/test/fibfor.lua +13 -0
  106. data/src/lua/test/globals.lua +13 -0
  107. data/src/lua/test/hello.lua +3 -0
  108. data/src/lua/test/life.lua +111 -0
  109. data/src/lua/test/luac.lua +7 -0
  110. data/src/lua/test/printf.lua +7 -0
  111. data/src/lua/test/readonly.lua +12 -0
  112. data/src/lua/test/sieve.lua +29 -0
  113. data/src/lua/test/sort.lua +66 -0
  114. data/src/lua/test/table.lua +12 -0
  115. data/src/lua/test/trace-calls.lua +32 -0
  116. data/src/lua/test/trace-globals.lua +38 -0
  117. data/src/lua/test/xd.lua +14 -0
  118. metadata +115 -2
data/src/lua/src/lua.h ADDED
@@ -0,0 +1,388 @@
1
+ /*
2
+ ** $Id: lua.h,v 1.218.1.5 2008/08/06 13:30:12 roberto Exp $
3
+ ** Lua - An Extensible Extension Language
4
+ ** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
5
+ ** See Copyright Notice at the end of this file
6
+ */
7
+
8
+
9
+ #ifndef lua_h
10
+ #define lua_h
11
+
12
+ #include <stdarg.h>
13
+ #include <stddef.h>
14
+
15
+
16
+ #include "luaconf.h"
17
+
18
+
19
+ #define LUA_VERSION "Lua 5.1"
20
+ #define LUA_RELEASE "Lua 5.1.4"
21
+ #define LUA_VERSION_NUM 501
22
+ #define LUA_COPYRIGHT "Copyright (C) 1994-2008 Lua.org, PUC-Rio"
23
+ #define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
24
+
25
+
26
+ /* mark for precompiled code (`<esc>Lua') */
27
+ #define LUA_SIGNATURE "\033Lua"
28
+
29
+ /* option for multiple returns in `lua_pcall' and `lua_call' */
30
+ #define LUA_MULTRET (-1)
31
+
32
+
33
+ /*
34
+ ** pseudo-indices
35
+ */
36
+ #define LUA_REGISTRYINDEX (-10000)
37
+ #define LUA_ENVIRONINDEX (-10001)
38
+ #define LUA_GLOBALSINDEX (-10002)
39
+ #define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i))
40
+
41
+
42
+ /* thread status; 0 is OK */
43
+ #define LUA_YIELD 1
44
+ #define LUA_ERRRUN 2
45
+ #define LUA_ERRSYNTAX 3
46
+ #define LUA_ERRMEM 4
47
+ #define LUA_ERRERR 5
48
+
49
+
50
+ typedef struct lua_State lua_State;
51
+
52
+ typedef int (*lua_CFunction) (lua_State *L);
53
+
54
+
55
+ /*
56
+ ** functions that read/write blocks when loading/dumping Lua chunks
57
+ */
58
+ typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz);
59
+
60
+ typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud);
61
+
62
+
63
+ /*
64
+ ** prototype for memory-allocation functions
65
+ */
66
+ typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);
67
+
68
+
69
+ /*
70
+ ** basic types
71
+ */
72
+ #define LUA_TNONE (-1)
73
+
74
+ #define LUA_TNIL 0
75
+ #define LUA_TBOOLEAN 1
76
+ #define LUA_TLIGHTUSERDATA 2
77
+ #define LUA_TNUMBER 3
78
+ #define LUA_TSTRING 4
79
+ #define LUA_TTABLE 5
80
+ #define LUA_TFUNCTION 6
81
+ #define LUA_TUSERDATA 7
82
+ #define LUA_TTHREAD 8
83
+
84
+
85
+
86
+ /* minimum Lua stack available to a C function */
87
+ #define LUA_MINSTACK 20
88
+
89
+
90
+ /*
91
+ ** generic extra include file
92
+ */
93
+ #if defined(LUA_USER_H)
94
+ #include LUA_USER_H
95
+ #endif
96
+
97
+
98
+ /* type of numbers in Lua */
99
+ typedef LUA_NUMBER lua_Number;
100
+
101
+
102
+ /* type for integer functions */
103
+ typedef LUA_INTEGER lua_Integer;
104
+
105
+
106
+
107
+ /*
108
+ ** state manipulation
109
+ */
110
+ LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud);
111
+ LUA_API void (lua_close) (lua_State *L);
112
+ LUA_API lua_State *(lua_newthread) (lua_State *L);
113
+
114
+ LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf);
115
+
116
+
117
+ /*
118
+ ** basic stack manipulation
119
+ */
120
+ LUA_API int (lua_gettop) (lua_State *L);
121
+ LUA_API void (lua_settop) (lua_State *L, int idx);
122
+ LUA_API void (lua_pushvalue) (lua_State *L, int idx);
123
+ LUA_API void (lua_remove) (lua_State *L, int idx);
124
+ LUA_API void (lua_insert) (lua_State *L, int idx);
125
+ LUA_API void (lua_replace) (lua_State *L, int idx);
126
+ LUA_API int (lua_checkstack) (lua_State *L, int sz);
127
+
128
+ LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n);
129
+
130
+
131
+ /*
132
+ ** access functions (stack -> C)
133
+ */
134
+
135
+ LUA_API int (lua_isnumber) (lua_State *L, int idx);
136
+ LUA_API int (lua_isstring) (lua_State *L, int idx);
137
+ LUA_API int (lua_iscfunction) (lua_State *L, int idx);
138
+ LUA_API int (lua_isuserdata) (lua_State *L, int idx);
139
+ LUA_API int (lua_type) (lua_State *L, int idx);
140
+ LUA_API const char *(lua_typename) (lua_State *L, int tp);
141
+
142
+ LUA_API int (lua_equal) (lua_State *L, int idx1, int idx2);
143
+ LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2);
144
+ LUA_API int (lua_lessthan) (lua_State *L, int idx1, int idx2);
145
+
146
+ LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx);
147
+ LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx);
148
+ LUA_API int (lua_toboolean) (lua_State *L, int idx);
149
+ LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len);
150
+ LUA_API size_t (lua_objlen) (lua_State *L, int idx);
151
+ LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx);
152
+ LUA_API void *(lua_touserdata) (lua_State *L, int idx);
153
+ LUA_API lua_State *(lua_tothread) (lua_State *L, int idx);
154
+ LUA_API const void *(lua_topointer) (lua_State *L, int idx);
155
+
156
+
157
+ /*
158
+ ** push functions (C -> stack)
159
+ */
160
+ LUA_API void (lua_pushnil) (lua_State *L);
161
+ LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n);
162
+ LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n);
163
+ LUA_API void (lua_pushlstring) (lua_State *L, const char *s, size_t l);
164
+ LUA_API void (lua_pushstring) (lua_State *L, const char *s);
165
+ LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt,
166
+ va_list argp);
167
+ LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...);
168
+ LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);
169
+ LUA_API void (lua_pushboolean) (lua_State *L, int b);
170
+ LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p);
171
+ LUA_API int (lua_pushthread) (lua_State *L);
172
+
173
+
174
+ /*
175
+ ** get functions (Lua -> stack)
176
+ */
177
+ LUA_API void (lua_gettable) (lua_State *L, int idx);
178
+ LUA_API void (lua_getfield) (lua_State *L, int idx, const char *k);
179
+ LUA_API void (lua_rawget) (lua_State *L, int idx);
180
+ LUA_API void (lua_rawgeti) (lua_State *L, int idx, int n);
181
+ LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec);
182
+ LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz);
183
+ LUA_API int (lua_getmetatable) (lua_State *L, int objindex);
184
+ LUA_API void (lua_getfenv) (lua_State *L, int idx);
185
+
186
+
187
+ /*
188
+ ** set functions (stack -> Lua)
189
+ */
190
+ LUA_API void (lua_settable) (lua_State *L, int idx);
191
+ LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k);
192
+ LUA_API void (lua_rawset) (lua_State *L, int idx);
193
+ LUA_API void (lua_rawseti) (lua_State *L, int idx, int n);
194
+ LUA_API int (lua_setmetatable) (lua_State *L, int objindex);
195
+ LUA_API int (lua_setfenv) (lua_State *L, int idx);
196
+
197
+
198
+ /*
199
+ ** `load' and `call' functions (load and run Lua code)
200
+ */
201
+ LUA_API void (lua_call) (lua_State *L, int nargs, int nresults);
202
+ LUA_API int (lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc);
203
+ LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud);
204
+ LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt,
205
+ const char *chunkname);
206
+
207
+ LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data);
208
+
209
+
210
+ /*
211
+ ** coroutine functions
212
+ */
213
+ LUA_API int (lua_yield) (lua_State *L, int nresults);
214
+ LUA_API int (lua_resume) (lua_State *L, int narg);
215
+ LUA_API int (lua_status) (lua_State *L);
216
+
217
+ /*
218
+ ** garbage-collection function and options
219
+ */
220
+
221
+ #define LUA_GCSTOP 0
222
+ #define LUA_GCRESTART 1
223
+ #define LUA_GCCOLLECT 2
224
+ #define LUA_GCCOUNT 3
225
+ #define LUA_GCCOUNTB 4
226
+ #define LUA_GCSTEP 5
227
+ #define LUA_GCSETPAUSE 6
228
+ #define LUA_GCSETSTEPMUL 7
229
+
230
+ LUA_API int (lua_gc) (lua_State *L, int what, int data);
231
+
232
+
233
+ /*
234
+ ** miscellaneous functions
235
+ */
236
+
237
+ LUA_API int (lua_error) (lua_State *L);
238
+
239
+ LUA_API int (lua_next) (lua_State *L, int idx);
240
+
241
+ LUA_API void (lua_concat) (lua_State *L, int n);
242
+
243
+ LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud);
244
+ LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);
245
+
246
+
247
+
248
+ /*
249
+ ** ===============================================================
250
+ ** some useful macros
251
+ ** ===============================================================
252
+ */
253
+
254
+ #define lua_pop(L,n) lua_settop(L, -(n)-1)
255
+
256
+ #define lua_newtable(L) lua_createtable(L, 0, 0)
257
+
258
+ #define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n)))
259
+
260
+ #define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0)
261
+
262
+ #define lua_strlen(L,i) lua_objlen(L, (i))
263
+
264
+ #define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION)
265
+ #define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE)
266
+ #define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA)
267
+ #define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL)
268
+ #define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN)
269
+ #define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD)
270
+ #define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE)
271
+ #define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0)
272
+
273
+ #define lua_pushliteral(L, s) \
274
+ lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1)
275
+
276
+ #define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, (s))
277
+ #define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, (s))
278
+
279
+ #define lua_tostring(L,i) lua_tolstring(L, (i), NULL)
280
+
281
+
282
+
283
+ /*
284
+ ** compatibility macros and functions
285
+ */
286
+
287
+ #define lua_open() luaL_newstate()
288
+
289
+ #define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX)
290
+
291
+ #define lua_getgccount(L) lua_gc(L, LUA_GCCOUNT, 0)
292
+
293
+ #define lua_Chunkreader lua_Reader
294
+ #define lua_Chunkwriter lua_Writer
295
+
296
+
297
+ /* hack */
298
+ LUA_API void lua_setlevel (lua_State *from, lua_State *to);
299
+
300
+
301
+ /*
302
+ ** {======================================================================
303
+ ** Debug API
304
+ ** =======================================================================
305
+ */
306
+
307
+
308
+ /*
309
+ ** Event codes
310
+ */
311
+ #define LUA_HOOKCALL 0
312
+ #define LUA_HOOKRET 1
313
+ #define LUA_HOOKLINE 2
314
+ #define LUA_HOOKCOUNT 3
315
+ #define LUA_HOOKTAILRET 4
316
+
317
+
318
+ /*
319
+ ** Event masks
320
+ */
321
+ #define LUA_MASKCALL (1 << LUA_HOOKCALL)
322
+ #define LUA_MASKRET (1 << LUA_HOOKRET)
323
+ #define LUA_MASKLINE (1 << LUA_HOOKLINE)
324
+ #define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT)
325
+
326
+ typedef struct lua_Debug lua_Debug; /* activation record */
327
+
328
+
329
+ /* Functions to be called by the debuger in specific events */
330
+ typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
331
+
332
+
333
+ LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar);
334
+ LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);
335
+ LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);
336
+ LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);
337
+ LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n);
338
+ LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n);
339
+
340
+ LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count);
341
+ LUA_API lua_Hook lua_gethook (lua_State *L);
342
+ LUA_API int lua_gethookmask (lua_State *L);
343
+ LUA_API int lua_gethookcount (lua_State *L);
344
+
345
+
346
+ struct lua_Debug {
347
+ int event;
348
+ const char *name; /* (n) */
349
+ const char *namewhat; /* (n) `global', `local', `field', `method' */
350
+ const char *what; /* (S) `Lua', `C', `main', `tail' */
351
+ const char *source; /* (S) */
352
+ int currentline; /* (l) */
353
+ int nups; /* (u) number of upvalues */
354
+ int linedefined; /* (S) */
355
+ int lastlinedefined; /* (S) */
356
+ char short_src[LUA_IDSIZE]; /* (S) */
357
+ /* private part */
358
+ int i_ci; /* active function */
359
+ };
360
+
361
+ /* }====================================================================== */
362
+
363
+
364
+ /******************************************************************************
365
+ * Copyright (C) 1994-2008 Lua.org, PUC-Rio. All rights reserved.
366
+ *
367
+ * Permission is hereby granted, free of charge, to any person obtaining
368
+ * a copy of this software and associated documentation files (the
369
+ * "Software"), to deal in the Software without restriction, including
370
+ * without limitation the rights to use, copy, modify, merge, publish,
371
+ * distribute, sublicense, and/or sell copies of the Software, and to
372
+ * permit persons to whom the Software is furnished to do so, subject to
373
+ * the following conditions:
374
+ *
375
+ * The above copyright notice and this permission notice shall be
376
+ * included in all copies or substantial portions of the Software.
377
+ *
378
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
379
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
380
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
381
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
382
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
383
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
384
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
385
+ ******************************************************************************/
386
+
387
+
388
+ #endif
@@ -0,0 +1,28 @@
1
+ 0 ICON "..\\etc\\lua.ico"
2
+
3
+ 1 VERSIONINFO
4
+ FILEVERSION 5,1,4,0
5
+ PRODUCTVERSION 5,1,4,0
6
+ BEGIN
7
+ BLOCK "StringFileInfo"
8
+ BEGIN
9
+ BLOCK "040904b0"
10
+ BEGIN
11
+ VALUE "Comments", "www.lua.org\0"
12
+ VALUE "CompanyName", "Lua.org\0"
13
+ VALUE "FileDescription", "Lua Console Standalone Interpreter\0"
14
+ VALUE "FileVersion", "5.1.4\0"
15
+ VALUE "LegalCopyright", "Copyright � 1994-2008 Lua.org, PUC-Rio.\0"
16
+ VALUE "OriginalFilename", "lua5.1.exe\0"
17
+ VALUE "ProductName", "Lua - The Programming Language\0"
18
+ VALUE "ProductVersion", "5.1.4\0"
19
+ VALUE "PrivateBuild", "Built for LuaDist\0"
20
+ END
21
+ END
22
+ END
23
+
24
+ #ifdef MSVC8
25
+ 1 24 "lua_dll8.manifest"
26
+ #elif MSVC9
27
+ 1 24 "lua_dll9.manifest"
28
+ #endif
@@ -0,0 +1,26 @@
1
+ 1 VERSIONINFO
2
+ FILEVERSION 5,1,4,0
3
+ PRODUCTVERSION 5,1,4,0
4
+ BEGIN
5
+ BLOCK "StringFileInfo"
6
+ BEGIN
7
+ BLOCK "040904b0"
8
+ BEGIN
9
+ VALUE "Comments", "www.lua.org\0"
10
+ VALUE "CompanyName", "Lua.org\0"
11
+ VALUE "FileDescription", "Lua Language Run Time\0"
12
+ VALUE "FileVersion", "5.1.4\0"
13
+ VALUE "LegalCopyright", "Copyright � 1994-2009 Lua.org, PUC-Rio.\0"
14
+ VALUE "OriginalFilename", "lua5.1.dll\0"
15
+ VALUE "ProductName", "Lua - The Programming Language\0"
16
+ VALUE "ProductVersion", "5.1.4\0"
17
+ VALUE "PrivateBuild", "Built for LuaDist\0"
18
+ END
19
+ END
20
+ END
21
+
22
+ #ifdef MSVC8
23
+ 2 24 "lua_dll8.manifest"
24
+ #elif MSVC9
25
+ 2 24 "lua_dll9.manifest"
26
+ #endif
@@ -0,0 +1,200 @@
1
+ /*
2
+ ** $Id: luac.c,v 1.54 2006/06/02 17:37:11 lhf Exp $
3
+ ** Lua compiler (saves bytecodes to files; also list bytecodes)
4
+ ** See Copyright Notice in lua.h
5
+ */
6
+
7
+ #include <errno.h>
8
+ #include <stdio.h>
9
+ #include <stdlib.h>
10
+ #include <string.h>
11
+
12
+ #define luac_c
13
+ #define LUA_CORE
14
+
15
+ #include "lua.h"
16
+ #include "lauxlib.h"
17
+
18
+ #include "ldo.h"
19
+ #include "lfunc.h"
20
+ #include "lmem.h"
21
+ #include "lobject.h"
22
+ #include "lopcodes.h"
23
+ #include "lstring.h"
24
+ #include "lundump.h"
25
+
26
+ #define PROGNAME "luac" /* default program name */
27
+ #define OUTPUT PROGNAME ".out" /* default output file */
28
+
29
+ static int listing=0; /* list bytecodes? */
30
+ static int dumping=1; /* dump bytecodes? */
31
+ static int stripping=0; /* strip debug information? */
32
+ static char Output[]={ OUTPUT }; /* default output file name */
33
+ static const char* output=Output; /* actual output file name */
34
+ static const char* progname=PROGNAME; /* actual program name */
35
+
36
+ static void fatal(const char* message)
37
+ {
38
+ fprintf(stderr,"%s: %s\n",progname,message);
39
+ exit(EXIT_FAILURE);
40
+ }
41
+
42
+ static void cannot(const char* what)
43
+ {
44
+ fprintf(stderr,"%s: cannot %s %s: %s\n",progname,what,output,strerror(errno));
45
+ exit(EXIT_FAILURE);
46
+ }
47
+
48
+ static void usage(const char* message)
49
+ {
50
+ if (*message=='-')
51
+ fprintf(stderr,"%s: unrecognized option " LUA_QS "\n",progname,message);
52
+ else
53
+ fprintf(stderr,"%s: %s\n",progname,message);
54
+ fprintf(stderr,
55
+ "usage: %s [options] [filenames].\n"
56
+ "Available options are:\n"
57
+ " - process stdin\n"
58
+ " -l list\n"
59
+ " -o name output to file " LUA_QL("name") " (default is \"%s\")\n"
60
+ " -p parse only\n"
61
+ " -s strip debug information\n"
62
+ " -v show version information\n"
63
+ " -- stop handling options\n",
64
+ progname,Output);
65
+ exit(EXIT_FAILURE);
66
+ }
67
+
68
+ #define IS(s) (strcmp(argv[i],s)==0)
69
+
70
+ static int doargs(int argc, char* argv[])
71
+ {
72
+ int i;
73
+ int version=0;
74
+ if (argv[0]!=NULL && *argv[0]!=0) progname=argv[0];
75
+ for (i=1; i<argc; i++)
76
+ {
77
+ if (*argv[i]!='-') /* end of options; keep it */
78
+ break;
79
+ else if (IS("--")) /* end of options; skip it */
80
+ {
81
+ ++i;
82
+ if (version) ++version;
83
+ break;
84
+ }
85
+ else if (IS("-")) /* end of options; use stdin */
86
+ break;
87
+ else if (IS("-l")) /* list */
88
+ ++listing;
89
+ else if (IS("-o")) /* output file */
90
+ {
91
+ output=argv[++i];
92
+ if (output==NULL || *output==0) usage(LUA_QL("-o") " needs argument");
93
+ if (IS("-")) output=NULL;
94
+ }
95
+ else if (IS("-p")) /* parse only */
96
+ dumping=0;
97
+ else if (IS("-s")) /* strip debug information */
98
+ stripping=1;
99
+ else if (IS("-v")) /* show version */
100
+ ++version;
101
+ else /* unknown option */
102
+ usage(argv[i]);
103
+ }
104
+ if (i==argc && (listing || !dumping))
105
+ {
106
+ dumping=0;
107
+ argv[--i]=Output;
108
+ }
109
+ if (version)
110
+ {
111
+ printf("%s %s\n",LUA_RELEASE,LUA_COPYRIGHT);
112
+ if (version==argc-1) exit(EXIT_SUCCESS);
113
+ }
114
+ return i;
115
+ }
116
+
117
+ #define toproto(L,i) (clvalue(L->top+(i))->l.p)
118
+
119
+ static const Proto* combine(lua_State* L, int n)
120
+ {
121
+ if (n==1)
122
+ return toproto(L,-1);
123
+ else
124
+ {
125
+ int i,pc;
126
+ Proto* f=luaF_newproto(L);
127
+ setptvalue2s(L,L->top,f); incr_top(L);
128
+ f->source=luaS_newliteral(L,"=(" PROGNAME ")");
129
+ f->maxstacksize=1;
130
+ pc=2*n+1;
131
+ f->code=luaM_newvector(L,pc,Instruction);
132
+ f->sizecode=pc;
133
+ f->p=luaM_newvector(L,n,Proto*);
134
+ f->sizep=n;
135
+ pc=0;
136
+ for (i=0; i<n; i++)
137
+ {
138
+ f->p[i]=toproto(L,i-n-1);
139
+ f->code[pc++]=CREATE_ABx(OP_CLOSURE,0,i);
140
+ f->code[pc++]=CREATE_ABC(OP_CALL,0,1,1);
141
+ }
142
+ f->code[pc++]=CREATE_ABC(OP_RETURN,0,1,0);
143
+ return f;
144
+ }
145
+ }
146
+
147
+ static int writer(lua_State* L, const void* p, size_t size, void* u)
148
+ {
149
+ UNUSED(L);
150
+ return (fwrite(p,size,1,(FILE*)u)!=1) && (size!=0);
151
+ }
152
+
153
+ struct Smain {
154
+ int argc;
155
+ char** argv;
156
+ };
157
+
158
+ static int pmain(lua_State* L)
159
+ {
160
+ struct Smain* s = (struct Smain*)lua_touserdata(L, 1);
161
+ int argc=s->argc;
162
+ char** argv=s->argv;
163
+ const Proto* f;
164
+ int i;
165
+ if (!lua_checkstack(L,argc)) fatal("too many input files");
166
+ for (i=0; i<argc; i++)
167
+ {
168
+ const char* filename=IS("-") ? NULL : argv[i];
169
+ if (luaL_loadfile(L,filename)!=0) fatal(lua_tostring(L,-1));
170
+ }
171
+ f=combine(L,argc);
172
+ if (listing) luaU_print(f,listing>1);
173
+ if (dumping)
174
+ {
175
+ FILE* D= (output==NULL) ? stdout : fopen(output,"wb");
176
+ if (D==NULL) cannot("open");
177
+ lua_lock(L);
178
+ luaU_dump(L,f,writer,D,stripping);
179
+ lua_unlock(L);
180
+ if (ferror(D)) cannot("write");
181
+ if (fclose(D)) cannot("close");
182
+ }
183
+ return 0;
184
+ }
185
+
186
+ int main(int argc, char* argv[])
187
+ {
188
+ lua_State* L;
189
+ struct Smain s;
190
+ int i=doargs(argc,argv);
191
+ argc-=i; argv+=i;
192
+ if (argc<=0) usage("no input files given");
193
+ L=lua_open();
194
+ if (L==NULL) fatal("not enough memory for state");
195
+ s.argc=argc;
196
+ s.argv=argv;
197
+ if (lua_cpcall(L,pmain,&s)!=0) fatal(lua_tostring(L,-1));
198
+ lua_close(L);
199
+ return EXIT_SUCCESS;
200
+ }
@@ -0,0 +1 @@
1
+ 0 ICON "..\\etc\\lua.ico"