candle 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 (164) hide show
  1. data/LICENSE.txt +20 -0
  2. data/README.md +4 -0
  3. data/VERSION +1 -0
  4. data/bin/candle +21 -0
  5. data/lib/candle.rb +68 -0
  6. data/lib/candle/command.rb +27 -0
  7. data/lib/candle/generators/actions.rb +183 -0
  8. data/lib/candle/generators/blank.rb +127 -0
  9. data/lib/candle/generators/cli.rb +55 -0
  10. data/lib/candle/generators/help.rb +47 -0
  11. data/lib/candle/generators/jam.rb +80 -0
  12. data/lib/candle/generators/lua/scripts/AppDelegate.lua +36 -0
  13. data/lib/candle/generators/lua/scripts/tests/init.lua +6 -0
  14. data/lib/candle/generators/lua/scripts/tests/someTest.lua +12 -0
  15. data/lib/candle/generators/lua/wax/ProtocolLoader.h +12 -0
  16. data/lib/candle/generators/lua/wax/bin/hammer +157 -0
  17. data/lib/candle/generators/lua/wax/bin/update-xibs +131 -0
  18. data/lib/candle/generators/lua/wax/bin/waxsim +0 -0
  19. data/lib/candle/generators/lua/wax/lib/build-scripts/compile-stdlib.sh +14 -0
  20. data/lib/candle/generators/lua/wax/lib/build-scripts/copy-scripts.sh +58 -0
  21. data/lib/candle/generators/lua/wax/lib/build-scripts/luac.lua +80 -0
  22. data/lib/candle/generators/lua/wax/lib/extensions/CGAffine/wax_CGTransform.h +12 -0
  23. data/lib/candle/generators/lua/wax/lib/extensions/CGAffine/wax_CGTransform.m +85 -0
  24. data/lib/candle/generators/lua/wax/lib/extensions/CGContext/wax_CGContext.h +12 -0
  25. data/lib/candle/generators/lua/wax/lib/extensions/CGContext/wax_CGContext.m +251 -0
  26. data/lib/candle/generators/lua/wax/lib/extensions/HTTP/wax_http.h +14 -0
  27. data/lib/candle/generators/lua/wax/lib/extensions/HTTP/wax_http.m +240 -0
  28. data/lib/candle/generators/lua/wax/lib/extensions/HTTP/wax_http_connection.h +54 -0
  29. data/lib/candle/generators/lua/wax/lib/extensions/HTTP/wax_http_connection.m +304 -0
  30. data/lib/candle/generators/lua/wax/lib/extensions/filesystem/wax_filesystem.h +9 -0
  31. data/lib/candle/generators/lua/wax/lib/extensions/filesystem/wax_filesystem.m +273 -0
  32. data/lib/candle/generators/lua/wax/lib/extensions/json/Rakefile +10 -0
  33. data/lib/candle/generators/lua/wax/lib/extensions/json/wax_json.c +304 -0
  34. data/lib/candle/generators/lua/wax/lib/extensions/json/wax_json.h +11 -0
  35. data/lib/candle/generators/lua/wax/lib/extensions/json/yajl-1.0.9.tar.gz +0 -0
  36. data/lib/candle/generators/lua/wax/lib/extensions/json/yajl/api/yajl_common.h +85 -0
  37. data/lib/candle/generators/lua/wax/lib/extensions/json/yajl/api/yajl_gen.h +159 -0
  38. data/lib/candle/generators/lua/wax/lib/extensions/json/yajl/api/yajl_parse.h +193 -0
  39. data/lib/candle/generators/lua/wax/lib/extensions/json/yajl/yajl.c +159 -0
  40. data/lib/candle/generators/lua/wax/lib/extensions/json/yajl/yajl_alloc.c +65 -0
  41. data/lib/candle/generators/lua/wax/lib/extensions/json/yajl/yajl_alloc.h +50 -0
  42. data/lib/candle/generators/lua/wax/lib/extensions/json/yajl/yajl_buf.c +119 -0
  43. data/lib/candle/generators/lua/wax/lib/extensions/json/yajl/yajl_buf.h +73 -0
  44. data/lib/candle/generators/lua/wax/lib/extensions/json/yajl/yajl_bytestack.h +85 -0
  45. data/lib/candle/generators/lua/wax/lib/extensions/json/yajl/yajl_common.h +85 -0
  46. data/lib/candle/generators/lua/wax/lib/extensions/json/yajl/yajl_encode.c +188 -0
  47. data/lib/candle/generators/lua/wax/lib/extensions/json/yajl/yajl_encode.h +50 -0
  48. data/lib/candle/generators/lua/wax/lib/extensions/json/yajl/yajl_gen.c +322 -0
  49. data/lib/candle/generators/lua/wax/lib/extensions/json/yajl/yajl_gen.h +159 -0
  50. data/lib/candle/generators/lua/wax/lib/extensions/json/yajl/yajl_lex.c +737 -0
  51. data/lib/candle/generators/lua/wax/lib/extensions/json/yajl/yajl_lex.h +133 -0
  52. data/lib/candle/generators/lua/wax/lib/extensions/json/yajl/yajl_parse.h +193 -0
  53. data/lib/candle/generators/lua/wax/lib/extensions/json/yajl/yajl_parser.c +448 -0
  54. data/lib/candle/generators/lua/wax/lib/extensions/json/yajl/yajl_parser.h +82 -0
  55. data/lib/candle/generators/lua/wax/lib/lua/lapi.c +1087 -0
  56. data/lib/candle/generators/lua/wax/lib/lua/lapi.h +16 -0
  57. data/lib/candle/generators/lua/wax/lib/lua/lauxlib.c +652 -0
  58. data/lib/candle/generators/lua/wax/lib/lua/lauxlib.h +174 -0
  59. data/lib/candle/generators/lua/wax/lib/lua/lbaselib.c +653 -0
  60. data/lib/candle/generators/lua/wax/lib/lua/lcode.c +839 -0
  61. data/lib/candle/generators/lua/wax/lib/lua/lcode.h +76 -0
  62. data/lib/candle/generators/lua/wax/lib/lua/ldblib.c +397 -0
  63. data/lib/candle/generators/lua/wax/lib/lua/ldebug.c +638 -0
  64. data/lib/candle/generators/lua/wax/lib/lua/ldebug.h +33 -0
  65. data/lib/candle/generators/lua/wax/lib/lua/ldo.c +518 -0
  66. data/lib/candle/generators/lua/wax/lib/lua/ldo.h +57 -0
  67. data/lib/candle/generators/lua/wax/lib/lua/ldump.c +164 -0
  68. data/lib/candle/generators/lua/wax/lib/lua/lfunc.c +174 -0
  69. data/lib/candle/generators/lua/wax/lib/lua/lfunc.h +34 -0
  70. data/lib/candle/generators/lua/wax/lib/lua/lgc.c +711 -0
  71. data/lib/candle/generators/lua/wax/lib/lua/lgc.h +110 -0
  72. data/lib/candle/generators/lua/wax/lib/lua/linit.c +38 -0
  73. data/lib/candle/generators/lua/wax/lib/lua/liolib.c +553 -0
  74. data/lib/candle/generators/lua/wax/lib/lua/llex.c +461 -0
  75. data/lib/candle/generators/lua/wax/lib/lua/llex.h +81 -0
  76. data/lib/candle/generators/lua/wax/lib/lua/llimits.h +128 -0
  77. data/lib/candle/generators/lua/wax/lib/lua/lmathlib.c +263 -0
  78. data/lib/candle/generators/lua/wax/lib/lua/lmem.c +86 -0
  79. data/lib/candle/generators/lua/wax/lib/lua/lmem.h +49 -0
  80. data/lib/candle/generators/lua/wax/lib/lua/loadlib.c +666 -0
  81. data/lib/candle/generators/lua/wax/lib/lua/lobject.c +214 -0
  82. data/lib/candle/generators/lua/wax/lib/lua/lobject.h +381 -0
  83. data/lib/candle/generators/lua/wax/lib/lua/lopcodes.c +102 -0
  84. data/lib/candle/generators/lua/wax/lib/lua/lopcodes.h +268 -0
  85. data/lib/candle/generators/lua/wax/lib/lua/loslib.c +243 -0
  86. data/lib/candle/generators/lua/wax/lib/lua/lparser.c +1339 -0
  87. data/lib/candle/generators/lua/wax/lib/lua/lparser.h +82 -0
  88. data/lib/candle/generators/lua/wax/lib/lua/lstate.c +214 -0
  89. data/lib/candle/generators/lua/wax/lib/lua/lstate.h +169 -0
  90. data/lib/candle/generators/lua/wax/lib/lua/lstring.c +111 -0
  91. data/lib/candle/generators/lua/wax/lib/lua/lstring.h +31 -0
  92. data/lib/candle/generators/lua/wax/lib/lua/lstrlib.c +869 -0
  93. data/lib/candle/generators/lua/wax/lib/lua/ltable.c +588 -0
  94. data/lib/candle/generators/lua/wax/lib/lua/ltable.h +40 -0
  95. data/lib/candle/generators/lua/wax/lib/lua/ltablib.c +287 -0
  96. data/lib/candle/generators/lua/wax/lib/lua/ltm.c +75 -0
  97. data/lib/candle/generators/lua/wax/lib/lua/ltm.h +54 -0
  98. data/lib/candle/generators/lua/wax/lib/lua/lua.h +388 -0
  99. data/lib/candle/generators/lua/wax/lib/lua/luaconf.h +753 -0
  100. data/lib/candle/generators/lua/wax/lib/lua/lualib.h +53 -0
  101. data/lib/candle/generators/lua/wax/lib/lua/lundump.c +227 -0
  102. data/lib/candle/generators/lua/wax/lib/lua/lundump.h +36 -0
  103. data/lib/candle/generators/lua/wax/lib/lua/lvm.c +763 -0
  104. data/lib/candle/generators/lua/wax/lib/lua/lvm.h +36 -0
  105. data/lib/candle/generators/lua/wax/lib/lua/lzio.c +82 -0
  106. data/lib/candle/generators/lua/wax/lib/lua/lzio.h +67 -0
  107. data/lib/candle/generators/lua/wax/lib/lua/print.c +227 -0
  108. data/lib/candle/generators/lua/wax/lib/project.rake +159 -0
  109. data/lib/candle/generators/lua/wax/lib/stdlib/enums.lua +396 -0
  110. data/lib/candle/generators/lua/wax/lib/stdlib/ext/http.lua +43 -0
  111. data/lib/candle/generators/lua/wax/lib/stdlib/ext/init.lua +4 -0
  112. data/lib/candle/generators/lua/wax/lib/stdlib/ext/number.lua +21 -0
  113. data/lib/candle/generators/lua/wax/lib/stdlib/ext/string.lua +97 -0
  114. data/lib/candle/generators/lua/wax/lib/stdlib/ext/table.lua +165 -0
  115. data/lib/candle/generators/lua/wax/lib/stdlib/helpers/WaxServer.lua +49 -0
  116. data/lib/candle/generators/lua/wax/lib/stdlib/helpers/autoload.lua +10 -0
  117. data/lib/candle/generators/lua/wax/lib/stdlib/helpers/base64.lua +64 -0
  118. data/lib/candle/generators/lua/wax/lib/stdlib/helpers/bit.lua +274 -0
  119. data/lib/candle/generators/lua/wax/lib/stdlib/helpers/cache.lua +73 -0
  120. data/lib/candle/generators/lua/wax/lib/stdlib/helpers/callback.lua +22 -0
  121. data/lib/candle/generators/lua/wax/lib/stdlib/helpers/frame.lua +76 -0
  122. data/lib/candle/generators/lua/wax/lib/stdlib/helpers/init.lua +78 -0
  123. data/lib/candle/generators/lua/wax/lib/stdlib/helpers/pickView.lua +54 -0
  124. data/lib/candle/generators/lua/wax/lib/stdlib/helpers/time.lua +102 -0
  125. data/lib/candle/generators/lua/wax/lib/stdlib/init.lua +18 -0
  126. data/lib/candle/generators/lua/wax/lib/stdlib/luaspec/init.lua +2 -0
  127. data/lib/candle/generators/lua/wax/lib/stdlib/luaspec/luamock.lua +84 -0
  128. data/lib/candle/generators/lua/wax/lib/stdlib/luaspec/luaspec.lua +377 -0
  129. data/lib/candle/generators/lua/wax/lib/stdlib/repl.lua +9 -0
  130. data/lib/candle/generators/lua/wax/lib/stdlib/structs.lua +11 -0
  131. data/lib/candle/generators/lua/wax/lib/stdlib/waxClass.lua +42 -0
  132. data/lib/candle/generators/lua/wax/lib/wax.h +16 -0
  133. data/lib/candle/generators/lua/wax/lib/wax.m +260 -0
  134. data/lib/candle/generators/lua/wax/lib/wax_class.h +18 -0
  135. data/lib/candle/generators/lua/wax/lib/wax_class.m +190 -0
  136. data/lib/candle/generators/lua/wax/lib/wax_gc.h +20 -0
  137. data/lib/candle/generators/lua/wax/lib/wax_gc.m +56 -0
  138. data/lib/candle/generators/lua/wax/lib/wax_helpers.h +102 -0
  139. data/lib/candle/generators/lua/wax/lib/wax_helpers.m +870 -0
  140. data/lib/candle/generators/lua/wax/lib/wax_instance.h +34 -0
  141. data/lib/candle/generators/lua/wax/lib/wax_instance.m +810 -0
  142. data/lib/candle/generators/lua/wax/lib/wax_server.h +47 -0
  143. data/lib/candle/generators/lua/wax/lib/wax_server.m +252 -0
  144. data/lib/candle/generators/lua/wax/lib/wax_stdlib.h +3 -0
  145. data/lib/candle/generators/lua/wax/lib/wax_struct.h +26 -0
  146. data/lib/candle/generators/lua/wax/lib/wax_struct.m +335 -0
  147. data/lib/candle/generators/templates/blank/WaxApplication.xcodeproj/project.pbxproj +836 -0
  148. data/lib/candle/generators/templates/blank/WaxApplication.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  149. data/lib/candle/generators/templates/blank/WaxApplication.xcodeproj/project.xcworkspace/xcuserdata/eiffel.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  150. data/lib/candle/generators/templates/blank/WaxApplication.xcodeproj/xcuserdata/eiffel.xcuserdatad/xcschemes/WaxApplication.xcscheme +86 -0
  151. data/lib/candle/generators/templates/blank/WaxApplication.xcodeproj/xcuserdata/eiffel.xcuserdatad/xcschemes/xcschememanagement.plist +22 -0
  152. data/lib/candle/generators/templates/blank/WaxApplication/Default-568h@2x.png +0 -0
  153. data/lib/candle/generators/templates/blank/WaxApplication/Default.png +0 -0
  154. data/lib/candle/generators/templates/blank/WaxApplication/Default@2x.png +0 -0
  155. data/lib/candle/generators/templates/blank/WaxApplication/ProtocolLoader.h +12 -0
  156. data/lib/candle/generators/templates/blank/WaxApplication/WaxApplication-Info.plist.tt +38 -0
  157. data/lib/candle/generators/templates/blank/WaxApplication/WaxApplication-Prefix.pch.tt +14 -0
  158. data/lib/candle/generators/templates/blank/WaxApplication/en.lproj/InfoPlist.strings +2 -0
  159. data/lib/candle/generators/templates/blank/WaxApplication/main.m.tt +20 -0
  160. data/lib/candle/tasks.rb +22 -0
  161. data/lib/candle/utility.rb +30 -0
  162. data/lib/candle/version.rb +9 -0
  163. data/lib/candle/view.rb +48 -0
  164. metadata +582 -0
@@ -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,753 @@
1
+ /*
2
+ ** $Id: luaconf.h,v 1.82.1.7 2008/02/11 16:25:08 roberto Exp $
3
+ ** Configuration file for Lua
4
+ ** See Copyright Notice in lua.h
5
+ */
6
+
7
+
8
+ #ifndef lconfig_h
9
+ #define lconfig_h
10
+
11
+ #include <limits.h>
12
+ #include <stddef.h>
13
+
14
+
15
+ /*
16
+ ** ==================================================================
17
+ ** Search for "@@" to find all configurable definitions.
18
+ ** ===================================================================
19
+ */
20
+
21
+
22
+ /*
23
+ @@ LUA_ANSI controls the use of non-ansi features.
24
+ ** CHANGE it (define it) if you want Lua to avoid the use of any
25
+ ** non-ansi feature or library.
26
+ */
27
+ #if defined(__STRICT_ANSI__)
28
+ #define LUA_ANSI
29
+ #endif
30
+
31
+
32
+ #if !defined(LUA_ANSI) && defined(_WIN32)
33
+ #define LUA_WIN
34
+ #endif
35
+
36
+ #if defined(LUA_USE_LINUX)
37
+ #define LUA_USE_POSIX
38
+ #define LUA_USE_DLOPEN /* needs an extra library: -ldl */
39
+ #define LUA_USE_READLINE /* needs some extra libraries */
40
+ #endif
41
+
42
+ #if defined(LUA_USE_MACOSX)
43
+ #define LUA_USE_POSIX
44
+ #define LUA_DL_DYLD /* does not need extra library */
45
+ #endif
46
+
47
+
48
+
49
+ /*
50
+ @@ LUA_USE_POSIX includes all functionallity listed as X/Open System
51
+ @* Interfaces Extension (XSI).
52
+ ** CHANGE it (define it) if your system is XSI compatible.
53
+ */
54
+ #if defined(LUA_USE_POSIX)
55
+ #define LUA_USE_MKSTEMP
56
+ #define LUA_USE_ISATTY
57
+ #define LUA_USE_POPEN
58
+ #define LUA_USE_ULONGJMP
59
+ #endif
60
+
61
+
62
+ /*
63
+ @@ LUA_PATH and LUA_CPATH are the names of the environment variables that
64
+ @* Lua check to set its paths.
65
+ @@ LUA_INIT is the name of the environment variable that Lua
66
+ @* checks for initialization code.
67
+ ** CHANGE them if you want different names.
68
+ */
69
+ #define LUA_PATH "LUA_PATH"
70
+ #define LUA_CPATH "LUA_CPATH"
71
+ #define LUA_INIT "LUA_INIT"
72
+
73
+
74
+ /*
75
+ @@ LUA_PATH_DEFAULT is the default path that Lua uses to look for
76
+ @* Lua libraries.
77
+ @@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for
78
+ @* C libraries.
79
+ ** CHANGE them if your machine has a non-conventional directory
80
+ ** hierarchy or if you want to install your libraries in
81
+ ** non-conventional directories.
82
+ */
83
+
84
+ // BEGIN WAX PATCH
85
+ #ifndef WAX_SCRIPTS_DIR
86
+ #define WAX_SCRIPTS_DIR "scripts"
87
+ #endif
88
+
89
+ #define LUA_PATH_DEFAULT WAX_SCRIPTS_DIR "/?.lua;" WAX_SCRIPTS_DIR "/?/init.lua;" WAX_SCRIPTS_DIR "/?.dat;"\
90
+ "?.lua;" "?/init.lua;" "?.dat;"
91
+ #define LUA_CPATH_DEFAULT ""
92
+
93
+ #ifndef WAX_LUA_INIT_SCRIPT
94
+ #define WAX_LUA_INIT_SCRIPT "AppDelegate"
95
+ #endif
96
+ // END WAX PATCH
97
+
98
+ /*
99
+ @@ LUA_DIRSEP is the directory separator (for submodules).
100
+ ** CHANGE it if your machine does not use "/" as the directory separator
101
+ ** and is not Windows. (On Windows Lua automatically uses "\".)
102
+ */
103
+ #if defined(_WIN32)
104
+ #define LUA_DIRSEP "\\"
105
+ #else
106
+ #define LUA_DIRSEP "/"
107
+ #endif
108
+
109
+
110
+ /*
111
+ @@ LUA_PATHSEP is the character that separates templates in a path.
112
+ @@ LUA_PATH_MARK is the string that marks the substitution points in a
113
+ @* template.
114
+ @@ LUA_EXECDIR in a Windows path is replaced by the executable's
115
+ @* directory.
116
+ @@ LUA_IGMARK is a mark to ignore all before it when bulding the
117
+ @* luaopen_ function name.
118
+ ** CHANGE them if for some reason your system cannot use those
119
+ ** characters. (E.g., if one of those characters is a common character
120
+ ** in file/directory names.) Probably you do not need to change them.
121
+ */
122
+ #define LUA_PATHSEP ";"
123
+ #define LUA_PATH_MARK "?"
124
+ #define LUA_EXECDIR "!"
125
+ #define LUA_IGMARK "-"
126
+
127
+
128
+ /*
129
+ @@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger.
130
+ ** CHANGE that if ptrdiff_t is not adequate on your machine. (On most
131
+ ** machines, ptrdiff_t gives a good choice between int or long.)
132
+ */
133
+ #define LUA_INTEGER ptrdiff_t
134
+
135
+
136
+ /*
137
+ @@ LUA_API is a mark for all core API functions.
138
+ @@ LUALIB_API is a mark for all standard library functions.
139
+ ** CHANGE them if you need to define those functions in some special way.
140
+ ** For instance, if you want to create one Windows DLL with the core and
141
+ ** the libraries, you may want to use the following definition (define
142
+ ** LUA_BUILD_AS_DLL to get it).
143
+ */
144
+ #if defined(LUA_BUILD_AS_DLL)
145
+
146
+ #if defined(LUA_CORE) || defined(LUA_LIB)
147
+ #define LUA_API __declspec(dllexport)
148
+ #else
149
+ #define LUA_API __declspec(dllimport)
150
+ #endif
151
+
152
+ #else
153
+
154
+ #define LUA_API extern
155
+
156
+ #endif
157
+
158
+ /* more often than not the libs go together with the core */
159
+ #define LUALIB_API LUA_API
160
+
161
+
162
+ /*
163
+ @@ LUAI_FUNC is a mark for all extern functions that are not to be
164
+ @* exported to outside modules.
165
+ @@ LUAI_DATA is a mark for all extern (const) variables that are not to
166
+ @* be exported to outside modules.
167
+ ** CHANGE them if you need to mark them in some special way. Elf/gcc
168
+ ** (versions 3.2 and later) mark them as "hidden" to optimize access
169
+ ** when Lua is compiled as a shared library.
170
+ */
171
+ #if defined(luaall_c)
172
+ #define LUAI_FUNC static
173
+ #define LUAI_DATA /* empty */
174
+
175
+ #elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
176
+ defined(__ELF__)
177
+ #define LUAI_FUNC __attribute__((visibility("hidden"))) extern
178
+ #define LUAI_DATA LUAI_FUNC
179
+
180
+ #else
181
+ #define LUAI_FUNC extern
182
+ #define LUAI_DATA extern
183
+ #endif
184
+
185
+
186
+
187
+ /*
188
+ @@ LUA_QL describes how error messages quote program elements.
189
+ ** CHANGE it if you want a different appearance.
190
+ */
191
+ #define LUA_QL(x) "'" x "'"
192
+ #define LUA_QS LUA_QL("%s")
193
+
194
+
195
+ /*
196
+ @@ LUA_IDSIZE gives the maximum size for the description of the source
197
+ @* of a function in debug information.
198
+ ** CHANGE it if you want a different size.
199
+ */
200
+ #define LUA_IDSIZE 60
201
+
202
+
203
+ /*
204
+ ** {==================================================================
205
+ ** Stand-alone configuration
206
+ ** ===================================================================
207
+ */
208
+
209
+ #if defined(lua_c) || defined(luaall_c)
210
+
211
+ /*
212
+ @@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that
213
+ @* is, whether we're running lua interactively).
214
+ ** CHANGE it if you have a better definition for non-POSIX/non-Windows
215
+ ** systems.
216
+ */
217
+ #if defined(LUA_USE_ISATTY)
218
+ #include <unistd.h>
219
+ #define lua_stdin_is_tty() isatty(0)
220
+ #elif defined(LUA_WIN)
221
+ #include <io.h>
222
+ #include <stdio.h>
223
+ #define lua_stdin_is_tty() _isatty(_fileno(stdin))
224
+ #else
225
+ #define lua_stdin_is_tty() 1 /* assume stdin is a tty */
226
+ #endif
227
+
228
+
229
+ /*
230
+ @@ LUA_PROMPT is the default prompt used by stand-alone Lua.
231
+ @@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua.
232
+ ** CHANGE them if you want different prompts. (You can also change the
233
+ ** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.)
234
+ */
235
+ #define LUA_PROMPT "> "
236
+ #define LUA_PROMPT2 ">> "
237
+
238
+
239
+ /*
240
+ @@ LUA_PROGNAME is the default name for the stand-alone Lua program.
241
+ ** CHANGE it if your stand-alone interpreter has a different name and
242
+ ** your system is not able to detect that name automatically.
243
+ */
244
+ #define LUA_PROGNAME "lua"
245
+
246
+
247
+ /*
248
+ @@ LUA_MAXINPUT is the maximum length for an input line in the
249
+ @* stand-alone interpreter.
250
+ ** CHANGE it if you need longer lines.
251
+ */
252
+ #define LUA_MAXINPUT 512
253
+
254
+
255
+ /*
256
+ @@ lua_readline defines how to show a prompt and then read a line from
257
+ @* the standard input.
258
+ @@ lua_saveline defines how to "save" a read line in a "history".
259
+ @@ lua_freeline defines how to free a line read by lua_readline.
260
+ ** CHANGE them if you want to improve this functionality (e.g., by using
261
+ ** GNU readline and history facilities).
262
+ */
263
+ #if defined(LUA_USE_READLINE)
264
+ #include <stdio.h>
265
+ #include <readline/readline.h>
266
+ #include <readline/history.h>
267
+ #define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL)
268
+ #define lua_saveline(L,idx) \
269
+ if (lua_strlen(L,idx) > 0) /* non-empty line? */ \
270
+ add_history(lua_tostring(L, idx)); /* add it to history */
271
+ #define lua_freeline(L,b) ((void)L, free(b))
272
+ #else
273
+ #define lua_readline(L,b,p) \
274
+ ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \
275
+ fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */
276
+ #define lua_saveline(L,idx) { (void)L; (void)idx; }
277
+ #define lua_freeline(L,b) { (void)L; (void)b; }
278
+ #endif
279
+
280
+ #endif
281
+
282
+ /* }================================================================== */
283
+
284
+
285
+ /*
286
+ @@ LUAI_GCPAUSE defines the default pause between garbage-collector cycles
287
+ @* as a percentage.
288
+ ** CHANGE it if you want the GC to run faster or slower (higher values
289
+ ** mean larger pauses which mean slower collection.) You can also change
290
+ ** this value dynamically.
291
+ */
292
+ #define LUAI_GCPAUSE 200 /* 200% (wait memory to double before next GC) */
293
+
294
+
295
+ /*
296
+ @@ LUAI_GCMUL defines the default speed of garbage collection relative to
297
+ @* memory allocation as a percentage.
298
+ ** CHANGE it if you want to change the granularity of the garbage
299
+ ** collection. (Higher values mean coarser collections. 0 represents
300
+ ** infinity, where each step performs a full collection.) You can also
301
+ ** change this value dynamically.
302
+ */
303
+ #define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */
304
+
305
+
306
+
307
+ /*
308
+ @@ LUA_COMPAT_GETN controls compatibility with old getn behavior.
309
+ ** CHANGE it (define it) if you want exact compatibility with the
310
+ ** behavior of setn/getn in Lua 5.0.
311
+ */
312
+ #undef LUA_COMPAT_GETN
313
+
314
+ /*
315
+ @@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib.
316
+ ** CHANGE it to undefined as soon as you do not need a global 'loadlib'
317
+ ** function (the function is still available as 'package.loadlib').
318
+ */
319
+ #undef LUA_COMPAT_LOADLIB
320
+
321
+ /*
322
+ @@ LUA_COMPAT_VARARG controls compatibility with old vararg feature.
323
+ ** CHANGE it to undefined as soon as your programs use only '...' to
324
+ ** access vararg parameters (instead of the old 'arg' table).
325
+ */
326
+ #define LUA_COMPAT_VARARG
327
+
328
+ /*
329
+ @@ LUA_COMPAT_MOD controls compatibility with old math.mod function.
330
+ ** CHANGE it to undefined as soon as your programs use 'math.fmod' or
331
+ ** the new '%' operator instead of 'math.mod'.
332
+ */
333
+ #define LUA_COMPAT_MOD
334
+
335
+ /*
336
+ @@ LUA_COMPAT_LSTR controls compatibility with old long string nesting
337
+ @* facility.
338
+ ** CHANGE it to 2 if you want the old behaviour, or undefine it to turn
339
+ ** off the advisory error when nesting [[...]].
340
+ */
341
+ #define LUA_COMPAT_LSTR 1
342
+
343
+ /*
344
+ @@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name.
345
+ ** CHANGE it to undefined as soon as you rename 'string.gfind' to
346
+ ** 'string.gmatch'.
347
+ */
348
+ #define LUA_COMPAT_GFIND
349
+
350
+ /*
351
+ @@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib'
352
+ @* behavior.
353
+ ** CHANGE it to undefined as soon as you replace to 'luaL_register'
354
+ ** your uses of 'luaL_openlib'
355
+ */
356
+ #define LUA_COMPAT_OPENLIB
357
+
358
+
359
+
360
+ /*
361
+ @@ luai_apicheck is the assert macro used by the Lua-C API.
362
+ ** CHANGE luai_apicheck if you want Lua to perform some checks in the
363
+ ** parameters it gets from API calls. This may slow down the interpreter
364
+ ** a bit, but may be quite useful when debugging C code that interfaces
365
+ ** with Lua. A useful redefinition is to use assert.h.
366
+ */
367
+ #if defined(LUA_USE_APICHECK)
368
+ #include <assert.h>
369
+ #define luai_apicheck(L,o) { (void)L; assert(o); }
370
+ #else
371
+ #define luai_apicheck(L,o) { (void)L; }
372
+ #endif
373
+
374
+
375
+ /*
376
+ @@ LUAI_BITSINT defines the number of bits in an int.
377
+ ** CHANGE here if Lua cannot automatically detect the number of bits of
378
+ ** your machine. Probably you do not need to change this.
379
+ */
380
+ /* avoid overflows in comparison */
381
+ #if INT_MAX-20 < 32760
382
+ #define LUAI_BITSINT 16
383
+ #elif INT_MAX > 2147483640L
384
+ /* int has at least 32 bits */
385
+ #define LUAI_BITSINT 32
386
+ #else
387
+ #error "you must define LUA_BITSINT with number of bits in an integer"
388
+ #endif
389
+
390
+
391
+ /*
392
+ @@ LUAI_UINT32 is an unsigned integer with at least 32 bits.
393
+ @@ LUAI_INT32 is an signed integer with at least 32 bits.
394
+ @@ LUAI_UMEM is an unsigned integer big enough to count the total
395
+ @* memory used by Lua.
396
+ @@ LUAI_MEM is a signed integer big enough to count the total memory
397
+ @* used by Lua.
398
+ ** CHANGE here if for some weird reason the default definitions are not
399
+ ** good enough for your machine. (The definitions in the 'else'
400
+ ** part always works, but may waste space on machines with 64-bit
401
+ ** longs.) Probably you do not need to change this.
402
+ */
403
+ #if LUAI_BITSINT >= 32
404
+ #define LUAI_UINT32 unsigned int
405
+ #define LUAI_INT32 int
406
+ #define LUAI_MAXINT32 INT_MAX
407
+ #define LUAI_UMEM size_t
408
+ #define LUAI_MEM ptrdiff_t
409
+ #else
410
+ /* 16-bit ints */
411
+ #define LUAI_UINT32 unsigned long
412
+ #define LUAI_INT32 long
413
+ #define LUAI_MAXINT32 LONG_MAX
414
+ #define LUAI_UMEM unsigned long
415
+ #define LUAI_MEM long
416
+ #endif
417
+
418
+
419
+ /*
420
+ @@ LUAI_MAXCALLS limits the number of nested calls.
421
+ ** CHANGE it if you need really deep recursive calls. This limit is
422
+ ** arbitrary; its only purpose is to stop infinite recursion before
423
+ ** exhausting memory.
424
+ */
425
+ #define LUAI_MAXCALLS 20000
426
+
427
+
428
+ /*
429
+ @@ LUAI_MAXCSTACK limits the number of Lua stack slots that a C function
430
+ @* can use.
431
+ ** CHANGE it if you need lots of (Lua) stack space for your C
432
+ ** functions. This limit is arbitrary; its only purpose is to stop C
433
+ ** functions to consume unlimited stack space. (must be smaller than
434
+ ** -LUA_REGISTRYINDEX)
435
+ */
436
+ #define LUAI_MAXCSTACK 8000
437
+
438
+
439
+
440
+ /*
441
+ ** {==================================================================
442
+ ** CHANGE (to smaller values) the following definitions if your system
443
+ ** has a small C stack. (Or you may want to change them to larger
444
+ ** values if your system has a large C stack and these limits are
445
+ ** too rigid for you.) Some of these constants control the size of
446
+ ** stack-allocated arrays used by the compiler or the interpreter, while
447
+ ** others limit the maximum number of recursive calls that the compiler
448
+ ** or the interpreter can perform. Values too large may cause a C stack
449
+ ** overflow for some forms of deep constructs.
450
+ ** ===================================================================
451
+ */
452
+
453
+
454
+ /*
455
+ @@ LUAI_MAXCCALLS is the maximum depth for nested C calls (short) and
456
+ @* syntactical nested non-terminals in a program.
457
+ */
458
+ #define LUAI_MAXCCALLS 200
459
+
460
+
461
+ /*
462
+ @@ LUAI_MAXVARS is the maximum number of local variables per function
463
+ @* (must be smaller than 250).
464
+ */
465
+ #define LUAI_MAXVARS 200
466
+
467
+
468
+ /*
469
+ @@ LUAI_MAXUPVALUES is the maximum number of upvalues per function
470
+ @* (must be smaller than 250).
471
+ */
472
+ #define LUAI_MAXUPVALUES 60
473
+
474
+
475
+ /*
476
+ @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
477
+ */
478
+ #define LUAL_BUFFERSIZE BUFSIZ
479
+
480
+ /* }================================================================== */
481
+
482
+
483
+
484
+
485
+ /*
486
+ ** {==================================================================
487
+ @@ LUA_NUMBER is the type of numbers in Lua.
488
+ ** CHANGE the following definitions only if you want to build Lua
489
+ ** with a number type different from double. You may also need to
490
+ ** change lua_number2int & lua_number2integer.
491
+ ** ===================================================================
492
+ */
493
+
494
+ #define LUA_NUMBER_DOUBLE
495
+ #define LUA_NUMBER double
496
+
497
+ /*
498
+ @@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
499
+ @* over a number.
500
+ */
501
+ #define LUAI_UACNUMBER double
502
+
503
+
504
+ /*
505
+ @@ LUA_NUMBER_SCAN is the format for reading numbers.
506
+ @@ LUA_NUMBER_FMT is the format for writing numbers.
507
+ @@ lua_number2str converts a number to a string.
508
+ @@ LUAI_MAXNUMBER2STR is maximum size of previous conversion.
509
+ @@ lua_str2number converts a string to a number.
510
+ */
511
+ #define LUA_NUMBER_SCAN "%lf"
512
+ #define LUA_NUMBER_FMT "%.14g"
513
+ #define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))
514
+ #define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */
515
+ #define lua_str2number(s,p) strtod((s), (p))
516
+
517
+
518
+ /*
519
+ @@ The luai_num* macros define the primitive operations over numbers.
520
+ */
521
+ #if defined(LUA_CORE)
522
+ #include <math.h>
523
+ #define luai_numadd(a,b) ((a)+(b))
524
+ #define luai_numsub(a,b) ((a)-(b))
525
+ #define luai_nummul(a,b) ((a)*(b))
526
+ #define luai_numdiv(a,b) ((a)/(b))
527
+ #define luai_nummod(a,b) ((a) - floor((a)/(b))*(b))
528
+ #define luai_numpow(a,b) (pow(a,b))
529
+ #define luai_numunm(a) (-(a))
530
+ #define luai_numeq(a,b) ((a)==(b))
531
+ #define luai_numlt(a,b) ((a)<(b))
532
+ #define luai_numle(a,b) ((a)<=(b))
533
+ #define luai_numisnan(a) (!luai_numeq((a), (a)))
534
+ #endif
535
+
536
+
537
+ /*
538
+ @@ lua_number2int is a macro to convert lua_Number to int.
539
+ @@ lua_number2integer is a macro to convert lua_Number to lua_Integer.
540
+ ** CHANGE them if you know a faster way to convert a lua_Number to
541
+ ** int (with any rounding method and without throwing errors) in your
542
+ ** system. In Pentium machines, a naive typecast from double to int
543
+ ** in C is extremely slow, so any alternative is worth trying.
544
+ */
545
+
546
+ /* On a Pentium, resort to a trick */
547
+ #if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \
548
+ (defined(__i386) || defined (_M_IX86) || defined(__i386__))
549
+
550
+ /* On a Microsoft compiler, use assembler */
551
+ #if defined(_MSC_VER)
552
+
553
+ #define lua_number2int(i,d) __asm fld d __asm fistp i
554
+ #define lua_number2integer(i,n) lua_number2int(i, n)
555
+
556
+ /* the next trick should work on any Pentium, but sometimes clashes
557
+ with a DirectX idiosyncrasy */
558
+ #else
559
+
560
+ union luai_Cast { double l_d; long l_l; };
561
+ #define lua_number2int(i,d) \
562
+ { volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; }
563
+ #define lua_number2integer(i,n) lua_number2int(i, n)
564
+
565
+ #endif
566
+
567
+
568
+ /* this option always works, but may be slow */
569
+ #else
570
+ #define lua_number2int(i,d) ((i)=(int)(d))
571
+ #define lua_number2integer(i,d) ((i)=(lua_Integer)(d))
572
+
573
+ #endif
574
+
575
+ /* }================================================================== */
576
+
577
+
578
+ /*
579
+ @@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment.
580
+ ** CHANGE it if your system requires alignments larger than double. (For
581
+ ** instance, if your system supports long doubles and they must be
582
+ ** aligned in 16-byte boundaries, then you should add long double in the
583
+ ** union.) Probably you do not need to change this.
584
+ */
585
+ #define LUAI_USER_ALIGNMENT_T union { double u; void *s; long l; }
586
+
587
+
588
+ /*
589
+ @@ LUAI_THROW/LUAI_TRY define how Lua does exception handling.
590
+ ** CHANGE them if you prefer to use longjmp/setjmp even with C++
591
+ ** or if want/don't to use _longjmp/_setjmp instead of regular
592
+ ** longjmp/setjmp. By default, Lua handles errors with exceptions when
593
+ ** compiling as C++ code, with _longjmp/_setjmp when asked to use them,
594
+ ** and with longjmp/setjmp otherwise.
595
+ */
596
+ #if defined(__cplusplus)
597
+ /* C++ exceptions */
598
+ #define LUAI_THROW(L,c) throw(c)
599
+ #define LUAI_TRY(L,c,a) try { a } catch(...) \
600
+ { if ((c)->status == 0) (c)->status = -1; }
601
+ #define luai_jmpbuf int /* dummy variable */
602
+
603
+ #elif defined(LUA_USE_ULONGJMP)
604
+ /* in Unix, try _longjmp/_setjmp (more efficient) */
605
+ #define LUAI_THROW(L,c) _longjmp((c)->b, 1)
606
+ #define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a }
607
+ #define luai_jmpbuf jmp_buf
608
+
609
+ #else
610
+ /* default handling with long jumps */
611
+ #define LUAI_THROW(L,c) longjmp((c)->b, 1)
612
+ #define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a }
613
+ #define luai_jmpbuf jmp_buf
614
+
615
+ #endif
616
+
617
+
618
+ /*
619
+ @@ LUA_MAXCAPTURES is the maximum number of captures that a pattern
620
+ @* can do during pattern-matching.
621
+ ** CHANGE it if you need more captures. This limit is arbitrary.
622
+ */
623
+ #define LUA_MAXCAPTURES 32
624
+
625
+
626
+ /*
627
+ @@ lua_tmpnam is the function that the OS library uses to create a
628
+ @* temporary name.
629
+ @@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam.
630
+ ** CHANGE them if you have an alternative to tmpnam (which is considered
631
+ ** insecure) or if you want the original tmpnam anyway. By default, Lua
632
+ ** uses tmpnam except when POSIX is available, where it uses mkstemp.
633
+ */
634
+ #if defined(loslib_c) || defined(luaall_c)
635
+
636
+ #if defined(LUA_USE_MKSTEMP)
637
+ #include <unistd.h>
638
+ #define LUA_TMPNAMBUFSIZE 32
639
+ #define lua_tmpnam(b,e) { \
640
+ strcpy(b, "/tmp/lua_XXXXXX"); \
641
+ e = mkstemp(b); \
642
+ if (e != -1) close(e); \
643
+ e = (e == -1); }
644
+
645
+ #else
646
+ #define LUA_TMPNAMBUFSIZE L_tmpnam
647
+ #define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); }
648
+ #endif
649
+
650
+ #endif
651
+
652
+
653
+ /*
654
+ @@ lua_popen spawns a new process connected to the current one through
655
+ @* the file streams.
656
+ ** CHANGE it if you have a way to implement it in your system.
657
+ */
658
+ #if defined(LUA_USE_POPEN)
659
+
660
+ #define lua_popen(L,c,m) ((void)L, fflush(NULL), popen(c,m))
661
+ #define lua_pclose(L,file) ((void)L, (pclose(file) != -1))
662
+
663
+ #elif defined(LUA_WIN)
664
+
665
+ #define lua_popen(L,c,m) ((void)L, _popen(c,m))
666
+ #define lua_pclose(L,file) ((void)L, (_pclose(file) != -1))
667
+
668
+ #else
669
+
670
+ #define lua_popen(L,c,m) ((void)((void)c, m), \
671
+ luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0)
672
+ #define lua_pclose(L,file) ((void)((void)L, file), 0)
673
+
674
+ #endif
675
+
676
+ /*
677
+ @@ LUA_DL_* define which dynamic-library system Lua should use.
678
+ ** CHANGE here if Lua has problems choosing the appropriate
679
+ ** dynamic-library system for your platform (either Windows' DLL, Mac's
680
+ ** dyld, or Unix's dlopen). If your system is some kind of Unix, there
681
+ ** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for
682
+ ** it. To use dlopen you also need to adapt the src/Makefile (probably
683
+ ** adding -ldl to the linker options), so Lua does not select it
684
+ ** automatically. (When you change the makefile to add -ldl, you must
685
+ ** also add -DLUA_USE_DLOPEN.)
686
+ ** If you do not want any kind of dynamic library, undefine all these
687
+ ** options.
688
+ ** By default, _WIN32 gets LUA_DL_DLL and MAC OS X gets LUA_DL_DYLD.
689
+ */
690
+ #if defined(LUA_USE_DLOPEN)
691
+ #define LUA_DL_DLOPEN
692
+ #endif
693
+
694
+ #if defined(LUA_WIN)
695
+ #define LUA_DL_DLL
696
+ #endif
697
+
698
+
699
+ /*
700
+ @@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State
701
+ @* (the data goes just *before* the lua_State pointer).
702
+ ** CHANGE (define) this if you really need that. This value must be
703
+ ** a multiple of the maximum alignment required for your machine.
704
+ */
705
+ #define LUAI_EXTRASPACE 0
706
+
707
+
708
+ /*
709
+ @@ luai_userstate* allow user-specific actions on threads.
710
+ ** CHANGE them if you defined LUAI_EXTRASPACE and need to do something
711
+ ** extra when a thread is created/deleted/resumed/yielded.
712
+ */
713
+ #define luai_userstateopen(L) ((void)L)
714
+ #define luai_userstateclose(L) ((void)L)
715
+ #define luai_userstatethread(L,L1) ((void)L)
716
+ #define luai_userstatefree(L) ((void)L)
717
+ #define luai_userstateresume(L,n) ((void)L)
718
+ #define luai_userstateyield(L,n) ((void)L)
719
+
720
+
721
+ /*
722
+ @@ LUA_INTFRMLEN is the length modifier for integer conversions
723
+ @* in 'string.format'.
724
+ @@ LUA_INTFRM_T is the integer type correspoding to the previous length
725
+ @* modifier.
726
+ ** CHANGE them if your system supports long long or does not support long.
727
+ */
728
+
729
+ #if defined(LUA_USELONGLONG)
730
+
731
+ #define LUA_INTFRMLEN "ll"
732
+ #define LUA_INTFRM_T long long
733
+
734
+ #else
735
+
736
+ #define LUA_INTFRMLEN "l"
737
+ #define LUA_INTFRM_T long
738
+
739
+ #endif
740
+
741
+
742
+
743
+ /* =================================================================== */
744
+
745
+ /*
746
+ ** Local configuration. You can use this space to add your redefinitions
747
+ ** without modifying the main part of the file.
748
+ */
749
+
750
+
751
+
752
+ #endif
753
+