rufus-lua-win 5.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (459) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +69 -0
  6. data/Rakefile +1 -0
  7. data/lib/rufus/lua/win.rb +18 -0
  8. data/lib/rufus/lua/win/version.rb +7 -0
  9. data/rufus-lua-win.gemspec +23 -0
  10. data/vendor/lua/bin/liblua.dll +0 -0
  11. data/vendor/lua/lib/lua/LuaXml.lua +119 -0
  12. data/vendor/lua/lib/lua/alien.lua +250 -0
  13. data/vendor/lua/lib/lua/alien/core.dll +0 -0
  14. data/vendor/lua/lib/lua/alien/struct.dll +0 -0
  15. data/vendor/lua/lib/lua/base.lua +536 -0
  16. data/vendor/lua/lib/lua/bin.lua +20 -0
  17. data/vendor/lua/lib/lua/bit.dll +0 -0
  18. data/vendor/lua/lib/lua/cdlua.dll +0 -0
  19. data/vendor/lua/lib/lua/cdluacontextplus.dll +0 -0
  20. data/vendor/lua/lib/lua/cdluagl.dll +0 -0
  21. data/vendor/lua/lib/lua/cdluaim.dll +0 -0
  22. data/vendor/lua/lib/lua/cdluapdf.dll +0 -0
  23. data/vendor/lua/lib/lua/copas.lua +543 -0
  24. data/vendor/lua/lib/lua/coxpcall.lua +57 -0
  25. data/vendor/lua/lib/lua/date.lua +745 -0
  26. data/vendor/lua/lib/lua/debug_ext.lua +84 -0
  27. data/vendor/lua/lib/lua/debug_init.lua +2 -0
  28. data/vendor/lua/lib/lua/des56.dll +0 -0
  29. data/vendor/lua/lib/lua/dist/config.lua +109 -0
  30. data/vendor/lua/lib/lua/dist/constraints.lua +271 -0
  31. data/vendor/lua/lib/lua/dist/depends.lua +601 -0
  32. data/vendor/lua/lib/lua/dist/git.lua +307 -0
  33. data/vendor/lua/lib/lua/dist/init.lua +278 -0
  34. data/vendor/lua/lib/lua/dist/manifest.lua +225 -0
  35. data/vendor/lua/lib/lua/dist/package.lua +583 -0
  36. data/vendor/lua/lib/lua/dist/sys.lua +367 -0
  37. data/vendor/lua/lib/lua/dist/utils.lua +130 -0
  38. data/vendor/lua/lib/lua/ex.dll +0 -0
  39. data/vendor/lua/lib/lua/fstable.lua +116 -0
  40. data/vendor/lua/lib/lua/getopt.lua +273 -0
  41. data/vendor/lua/lib/lua/git.lua +5 -0
  42. data/vendor/lua/lib/lua/git/core.dll +0 -0
  43. data/vendor/lua/lib/lua/git/objects.lua +121 -0
  44. data/vendor/lua/lib/lua/git/pack.lua +316 -0
  45. data/vendor/lua/lib/lua/git/protocol.lua +188 -0
  46. data/vendor/lua/lib/lua/git/repo.lua +283 -0
  47. data/vendor/lua/lib/lua/git/util.lua +233 -0
  48. data/vendor/lua/lib/lua/gzio.dll +0 -0
  49. data/vendor/lua/lib/lua/gzip.lua +81 -0
  50. data/vendor/lua/lib/lua/iconv.dll +0 -0
  51. data/vendor/lua/lib/lua/imlua.dll +0 -0
  52. data/vendor/lua/lib/lua/imlua_fftw.dll +0 -0
  53. data/vendor/lua/lib/lua/imlua_jp2.dll +0 -0
  54. data/vendor/lua/lib/lua/imlua_process.dll +0 -0
  55. data/vendor/lua/lib/lua/imlua_process_omp.dll +0 -0
  56. data/vendor/lua/lib/lua/io_ext.lua +115 -0
  57. data/vendor/lua/lib/lua/iuplua.dll +0 -0
  58. data/vendor/lua/lib/lua/iuplua_mglplot.dll +0 -0
  59. data/vendor/lua/lib/lua/iuplua_pplot.dll +0 -0
  60. data/vendor/lua/lib/lua/iupluacd.dll +0 -0
  61. data/vendor/lua/lib/lua/iupluacontrols.dll +0 -0
  62. data/vendor/lua/lib/lua/iupluagl.dll +0 -0
  63. data/vendor/lua/lib/lua/iupluaim.dll +0 -0
  64. data/vendor/lua/lib/lua/iupluaimglib.dll +0 -0
  65. data/vendor/lua/lib/lua/iupluatuio.dll +0 -0
  66. data/vendor/lua/lib/lua/lanes-keeper.lua +302 -0
  67. data/vendor/lua/lib/lua/lanes.lua +591 -0
  68. data/vendor/lua/lib/lua/lanes/core.dll +0 -0
  69. data/vendor/lua/lib/lua/lcs.lua +55 -0
  70. data/vendor/lua/lib/lua/lemock.lua +659 -0
  71. data/vendor/lua/lib/lua/lfs.dll +0 -0
  72. data/vendor/lua/lib/lua/list.lua +375 -0
  73. data/vendor/lua/lib/lua/logging.lua +189 -0
  74. data/vendor/lua/lib/lua/logging/console.lua +22 -0
  75. data/vendor/lua/lib/lua/logging/email.lua +44 -0
  76. data/vendor/lua/lib/lua/logging/file.lua +55 -0
  77. data/vendor/lua/lib/lua/logging/rolling_file.lua +81 -0
  78. data/vendor/lua/lib/lua/logging/socket.lua +35 -0
  79. data/vendor/lua/lib/lua/logging/sql.lua +64 -0
  80. data/vendor/lua/lib/lua/loop/base.lua +68 -0
  81. data/vendor/lua/lib/lua/loop/cached.lua +312 -0
  82. data/vendor/lua/lib/lua/loop/collection/MapWithArrayOfKeys.lua +64 -0
  83. data/vendor/lua/lib/lua/loop/collection/ObjectCache.lua +39 -0
  84. data/vendor/lua/lib/lua/loop/collection/OrderedSet.lua +164 -0
  85. data/vendor/lua/lib/lua/loop/collection/PriorityQueue.lua +86 -0
  86. data/vendor/lua/lib/lua/loop/collection/UnorderedArray.lua +32 -0
  87. data/vendor/lua/lib/lua/loop/collection/UnorderedArraySet.lua +56 -0
  88. data/vendor/lua/lib/lua/loop/compiler/Arguments.lua +108 -0
  89. data/vendor/lua/lib/lua/loop/compiler/Conditional.lua +50 -0
  90. data/vendor/lua/lib/lua/loop/compiler/Expression.lua +215 -0
  91. data/vendor/lua/lib/lua/loop/component/base.lua +221 -0
  92. data/vendor/lua/lib/lua/loop/component/contained.lua +71 -0
  93. data/vendor/lua/lib/lua/loop/component/dynamic.lua +223 -0
  94. data/vendor/lua/lib/lua/loop/component/intercepted.lua +354 -0
  95. data/vendor/lua/lib/lua/loop/component/wrapped.lua +195 -0
  96. data/vendor/lua/lib/lua/loop/debug/Inspector.lua +521 -0
  97. data/vendor/lua/lib/lua/loop/debug/Matcher.lua +192 -0
  98. data/vendor/lua/lib/lua/loop/debug/Verbose.lua +266 -0
  99. data/vendor/lua/lib/lua/loop/debug/Viewer.lua +200 -0
  100. data/vendor/lua/lib/lua/loop/multiple.lua +105 -0
  101. data/vendor/lua/lib/lua/loop/object/Exception.lua +57 -0
  102. data/vendor/lua/lib/lua/loop/object/Publisher.lua +43 -0
  103. data/vendor/lua/lib/lua/loop/object/Wrapper.lua +39 -0
  104. data/vendor/lua/lib/lua/loop/scoped.lua +585 -0
  105. data/vendor/lua/lib/lua/loop/serial/FileStream.lua +48 -0
  106. data/vendor/lua/lib/lua/loop/serial/Serializer.lua +291 -0
  107. data/vendor/lua/lib/lua/loop/serial/SocketStream.lua +51 -0
  108. data/vendor/lua/lib/lua/loop/serial/StringStream.lua +47 -0
  109. data/vendor/lua/lib/lua/loop/simple.lua +75 -0
  110. data/vendor/lua/lib/lua/loop/table.lua +71 -0
  111. data/vendor/lua/lib/lua/loop/thread/CoSocket.lua +416 -0
  112. data/vendor/lua/lib/lua/loop/thread/IOScheduler.lua +170 -0
  113. data/vendor/lua/lib/lua/loop/thread/Scheduler.lua +327 -0
  114. data/vendor/lua/lib/lua/loop/thread/SocketScheduler.lua +88 -0
  115. data/vendor/lua/lib/lua/loop/thread/Timer.lua +54 -0
  116. data/vendor/lua/lib/lua/lpeg.dll +0 -0
  117. data/vendor/lua/lib/lua/ltn12.lua +292 -0
  118. data/vendor/lua/lib/lua/luaXML_lib.dll +0 -0
  119. data/vendor/lua/lib/lua/luacurl.dll +0 -0
  120. data/vendor/lua/lib/lua/luadoc/config.lua +34 -0
  121. data/vendor/lua/lib/lua/luadoc/doclet/debug.lua +46 -0
  122. data/vendor/lua/lib/lua/luadoc/doclet/formatter.lua +84 -0
  123. data/vendor/lua/lib/lua/luadoc/doclet/html.lua +289 -0
  124. data/vendor/lua/lib/lua/luadoc/doclet/html/file.lp +113 -0
  125. data/vendor/lua/lib/lua/luadoc/doclet/html/function.lp +64 -0
  126. data/vendor/lua/lib/lua/luadoc/doclet/html/index.lp +70 -0
  127. data/vendor/lua/lib/lua/luadoc/doclet/html/luadoc.css +286 -0
  128. data/vendor/lua/lib/lua/luadoc/doclet/html/menu.lp +55 -0
  129. data/vendor/lua/lib/lua/luadoc/doclet/html/module.lp +109 -0
  130. data/vendor/lua/lib/lua/luadoc/doclet/html/table.lp +15 -0
  131. data/vendor/lua/lib/lua/luadoc/doclet/raw.lua +12 -0
  132. data/vendor/lua/lib/lua/luadoc/init.lua +58 -0
  133. data/vendor/lua/lib/lua/luadoc/lp.lua +130 -0
  134. data/vendor/lua/lib/lua/luadoc/taglet/standard.lua +495 -0
  135. data/vendor/lua/lib/lua/luadoc/taglet/standard/tags.lua +171 -0
  136. data/vendor/lua/lib/lua/luadoc/util.lua +233 -0
  137. data/vendor/lua/lib/lua/luagl.dll +0 -0
  138. data/vendor/lua/lib/lua/luaglu.dll +0 -0
  139. data/vendor/lua/lib/lua/luaidl.lua +113 -0
  140. data/vendor/lua/lib/lua/luaidl/lex.lua +793 -0
  141. data/vendor/lua/lib/lua/luaidl/pre.lua +149 -0
  142. data/vendor/lua/lib/lua/luaidl/sin.lua +3631 -0
  143. data/vendor/lua/lib/lua/luarocks/add.lua +108 -0
  144. data/vendor/lua/lib/lua/luarocks/admin_remove.lua +87 -0
  145. data/vendor/lua/lib/lua/luarocks/build.lua +330 -0
  146. data/vendor/lua/lib/lua/luarocks/build/builtin.lua +253 -0
  147. data/vendor/lua/lib/lua/luarocks/build/cmake.lua +54 -0
  148. data/vendor/lua/lib/lua/luarocks/build/command.lua +32 -0
  149. data/vendor/lua/lib/lua/luarocks/build/make.lua +92 -0
  150. data/vendor/lua/lib/lua/luarocks/cache.lua +85 -0
  151. data/vendor/lua/lib/lua/luarocks/cfg.lua +449 -0
  152. data/vendor/lua/lib/lua/luarocks/command_line.lua +163 -0
  153. data/vendor/lua/lib/lua/luarocks/deps.lua +654 -0
  154. data/vendor/lua/lib/lua/luarocks/dir.lua +69 -0
  155. data/vendor/lua/lib/lua/luarocks/download.lua +90 -0
  156. data/vendor/lua/lib/lua/luarocks/fetch.lua +321 -0
  157. data/vendor/lua/lib/lua/luarocks/fetch/cvs.lua +44 -0
  158. data/vendor/lua/lib/lua/luarocks/fetch/git.lua +81 -0
  159. data/vendor/lua/lib/lua/luarocks/fetch/git_file.lua +17 -0
  160. data/vendor/lua/lib/lua/luarocks/fetch/hg.lua +54 -0
  161. data/vendor/lua/lib/lua/luarocks/fetch/sscm.lua +42 -0
  162. data/vendor/lua/lib/lua/luarocks/fetch/svn.lua +53 -0
  163. data/vendor/lua/lib/lua/luarocks/fs.lua +40 -0
  164. data/vendor/lua/lib/lua/luarocks/fs/lua.lua +676 -0
  165. data/vendor/lua/lib/lua/luarocks/fs/unix.lua +88 -0
  166. data/vendor/lua/lib/lua/luarocks/fs/unix/tools.lua +325 -0
  167. data/vendor/lua/lib/lua/luarocks/fs/win32.lua +107 -0
  168. data/vendor/lua/lib/lua/luarocks/fs/win32/tools.lua +334 -0
  169. data/vendor/lua/lib/lua/luarocks/help.lua +101 -0
  170. data/vendor/lua/lib/lua/luarocks/index.lua +172 -0
  171. data/vendor/lua/lib/lua/luarocks/install.lua +151 -0
  172. data/vendor/lua/lib/lua/luarocks/list.lua +35 -0
  173. data/vendor/lua/lib/lua/luarocks/loader.lua +228 -0
  174. data/vendor/lua/lib/lua/luarocks/make.lua +71 -0
  175. data/vendor/lua/lib/lua/luarocks/make_manifest.lua +34 -0
  176. data/vendor/lua/lib/lua/luarocks/manif.lua +360 -0
  177. data/vendor/lua/lib/lua/luarocks/manif_core.lua +75 -0
  178. data/vendor/lua/lib/lua/luarocks/new_version.lua +141 -0
  179. data/vendor/lua/lib/lua/luarocks/pack.lua +205 -0
  180. data/vendor/lua/lib/lua/luarocks/path.lua +315 -0
  181. data/vendor/lua/lib/lua/luarocks/persist.lua +173 -0
  182. data/vendor/lua/lib/lua/luarocks/refresh_cache.lua +30 -0
  183. data/vendor/lua/lib/lua/luarocks/remove.lua +135 -0
  184. data/vendor/lua/lib/lua/luarocks/rep.lua +313 -0
  185. data/vendor/lua/lib/lua/luarocks/require.lua +6 -0
  186. data/vendor/lua/lib/lua/luarocks/search.lua +399 -0
  187. data/vendor/lua/lib/lua/luarocks/show.lua +138 -0
  188. data/vendor/lua/lib/lua/luarocks/site_config.lua +23 -0
  189. data/vendor/lua/lib/lua/luarocks/tools/patch.lua +712 -0
  190. data/vendor/lua/lib/lua/luarocks/tools/tar.lua +144 -0
  191. data/vendor/lua/lib/lua/luarocks/tools/zip.lua +245 -0
  192. data/vendor/lua/lib/lua/luarocks/type_check.lua +267 -0
  193. data/vendor/lua/lib/lua/luarocks/unpack.lua +151 -0
  194. data/vendor/lua/lib/lua/luarocks/util.lua +420 -0
  195. data/vendor/lua/lib/lua/luarocks/validate.lua +164 -0
  196. data/vendor/lua/lib/lua/luars232.dll +0 -0
  197. data/vendor/lua/lib/lua/luasql/mysql.dll +0 -0
  198. data/vendor/lua/lib/lua/luasql/postgres.dll +0 -0
  199. data/vendor/lua/lib/lua/luasql/sqlite3.dll +0 -0
  200. data/vendor/lua/lib/lua/luaunit.lua +601 -0
  201. data/vendor/lua/lib/lua/lxp.dll +0 -0
  202. data/vendor/lua/lib/lua/lxp/lom.lua +60 -0
  203. data/vendor/lua/lib/lua/math_ext.lua +27 -0
  204. data/vendor/lua/lib/lua/mbox.lua +53 -0
  205. data/vendor/lua/lib/lua/md5.lua +19 -0
  206. data/vendor/lua/lib/lua/md5/core.dll +0 -0
  207. data/vendor/lua/lib/lua/metalua.lua +0 -0
  208. data/vendor/lua/lib/lua/metalua/ast_to_string.mlua +553 -0
  209. data/vendor/lua/lib/lua/metalua/base.lua +104 -0
  210. data/vendor/lua/lib/lua/metalua/bytecode.lua +0 -0
  211. data/vendor/lua/lib/lua/metalua/clopts.mlua +204 -0
  212. data/vendor/lua/lib/lua/metalua/compiler.lua +3 -0
  213. data/vendor/lua/lib/lua/metalua/dollar.mlua +24 -0
  214. data/vendor/lua/lib/lua/metalua/extension/H-runtime.mlua +216 -0
  215. data/vendor/lua/lib/lua/metalua/extension/H.mlua +22 -0
  216. data/vendor/lua/lib/lua/metalua/extension/anaphoric.mlua +54 -0
  217. data/vendor/lua/lib/lua/metalua/extension/clist.mlua +149 -0
  218. data/vendor/lua/lib/lua/metalua/extension/continue.mlua +53 -0
  219. data/vendor/lua/lib/lua/metalua/extension/localin.mlua +2 -0
  220. data/vendor/lua/lib/lua/metalua/extension/log.mlua +39 -0
  221. data/vendor/lua/lib/lua/metalua/extension/match.mlua +374 -0
  222. data/vendor/lua/lib/lua/metalua/extension/ternary.mlua +10 -0
  223. data/vendor/lua/lib/lua/metalua/extension/trycatch.mlua +189 -0
  224. data/vendor/lua/lib/lua/metalua/extension/types-runtime.mlua +159 -0
  225. data/vendor/lua/lib/lua/metalua/extension/types.mlua +352 -0
  226. data/vendor/lua/lib/lua/metalua/extension/withdo.mlua +30 -0
  227. data/vendor/lua/lib/lua/metalua/extension/xglobal-runtime.lua +41 -0
  228. data/vendor/lua/lib/lua/metalua/extension/xglobal.mlua +20 -0
  229. data/vendor/lua/lib/lua/metalua/extension/xloop.mlua +100 -0
  230. data/vendor/lua/lib/lua/metalua/extension/xmatch.mlua +216 -0
  231. data/vendor/lua/lib/lua/metalua/metaloop.mlua +76 -0
  232. data/vendor/lua/lib/lua/metalua/mlc.lua +0 -0
  233. data/vendor/lua/lib/lua/metalua/mlc_xcall.lua +119 -0
  234. data/vendor/lua/lib/lua/metalua/mlp.lua +0 -0
  235. data/vendor/lua/lib/lua/metalua/package2.lua +101 -0
  236. data/vendor/lua/lib/lua/metalua/runtime.lua +3 -0
  237. data/vendor/lua/lib/lua/metalua/string2.lua +44 -0
  238. data/vendor/lua/lib/lua/metalua/table2.lua +372 -0
  239. data/vendor/lua/lib/lua/metalua/walk.mlua +304 -0
  240. data/vendor/lua/lib/lua/metalua/walk/bindings.mlua +41 -0
  241. data/vendor/lua/lib/lua/metalua/walk/id.mlua +186 -0
  242. data/vendor/lua/lib/lua/metalua/walk/scope.lua +54 -0
  243. data/vendor/lua/lib/lua/mime.lua +87 -0
  244. data/vendor/lua/lib/lua/mime/core.dll +0 -0
  245. data/vendor/lua/lib/lua/mobdebug.lua +1484 -0
  246. data/vendor/lua/lib/lua/modules.lua +16 -0
  247. data/vendor/lua/lib/lua/object.lua +56 -0
  248. data/vendor/lua/lib/lua/oil/Exception.lua +26 -0
  249. data/vendor/lua/lib/lua/oil/arch.lua +27 -0
  250. data/vendor/lua/lib/lua/oil/arch/basic/client.lua +29 -0
  251. data/vendor/lua/lib/lua/oil/arch/basic/common.lua +13 -0
  252. data/vendor/lua/lib/lua/oil/arch/basic/server.lua +27 -0
  253. data/vendor/lua/lib/lua/oil/arch/cooperative/common.lua +10 -0
  254. data/vendor/lua/lib/lua/oil/arch/cooperative/server.lua +16 -0
  255. data/vendor/lua/lib/lua/oil/arch/corba/client.lua +39 -0
  256. data/vendor/lua/lib/lua/oil/arch/corba/common.lua +58 -0
  257. data/vendor/lua/lib/lua/oil/arch/corba/intercepted/client.lua +9 -0
  258. data/vendor/lua/lib/lua/oil/arch/corba/intercepted/server.lua +9 -0
  259. data/vendor/lua/lib/lua/oil/arch/corba/server.lua +35 -0
  260. data/vendor/lua/lib/lua/oil/arch/ludo/byref.lua +18 -0
  261. data/vendor/lua/lib/lua/oil/arch/ludo/client.lua +19 -0
  262. data/vendor/lua/lib/lua/oil/arch/ludo/common.lua +18 -0
  263. data/vendor/lua/lib/lua/oil/arch/ludo/server.lua +19 -0
  264. data/vendor/lua/lib/lua/oil/arch/typed/client.lua +27 -0
  265. data/vendor/lua/lib/lua/oil/arch/typed/common.lua +9 -0
  266. data/vendor/lua/lib/lua/oil/arch/typed/server.lua +18 -0
  267. data/vendor/lua/lib/lua/oil/assert.lua +87 -0
  268. data/vendor/lua/lib/lua/oil/builder.lua +45 -0
  269. data/vendor/lua/lib/lua/oil/builder/basic/client.lua +31 -0
  270. data/vendor/lua/lib/lua/oil/builder/basic/common.lua +11 -0
  271. data/vendor/lua/lib/lua/oil/builder/basic/server.lua +13 -0
  272. data/vendor/lua/lib/lua/oil/builder/cooperative/common.lua +11 -0
  273. data/vendor/lua/lib/lua/oil/builder/cooperative/server.lua +11 -0
  274. data/vendor/lua/lib/lua/oil/builder/corba/client.lua +13 -0
  275. data/vendor/lua/lib/lua/oil/builder/corba/common.lua +24 -0
  276. data/vendor/lua/lib/lua/oil/builder/corba/gencode.lua +13 -0
  277. data/vendor/lua/lib/lua/oil/builder/corba/intercepted/client.lua +11 -0
  278. data/vendor/lua/lib/lua/oil/builder/corba/intercepted/server.lua +11 -0
  279. data/vendor/lua/lib/lua/oil/builder/corba/server.lua +13 -0
  280. data/vendor/lua/lib/lua/oil/builder/lua/client.lua +11 -0
  281. data/vendor/lua/lib/lua/oil/builder/lua/server.lua +12 -0
  282. data/vendor/lua/lib/lua/oil/builder/ludo/byref.lua +13 -0
  283. data/vendor/lua/lib/lua/oil/builder/ludo/client.lua +13 -0
  284. data/vendor/lua/lib/lua/oil/builder/ludo/common.lua +14 -0
  285. data/vendor/lua/lib/lua/oil/builder/ludo/server.lua +13 -0
  286. data/vendor/lua/lib/lua/oil/builder/typed/client.lua +16 -0
  287. data/vendor/lua/lib/lua/oil/builder/typed/server.lua +12 -0
  288. data/vendor/lua/lib/lua/oil/compat.lua +846 -0
  289. data/vendor/lua/lib/lua/oil/component.lua +1 -0
  290. data/vendor/lua/lib/lua/oil/corba/giop.lua +301 -0
  291. data/vendor/lua/lib/lua/oil/corba/giop/Codec.lua +1568 -0
  292. data/vendor/lua/lib/lua/oil/corba/giop/CodecGen.lua +589 -0
  293. data/vendor/lua/lib/lua/oil/corba/giop/Exception.lua +25 -0
  294. data/vendor/lua/lib/lua/oil/corba/giop/Indexer.lua +63 -0
  295. data/vendor/lua/lib/lua/oil/corba/giop/Listener.lua +343 -0
  296. data/vendor/lua/lib/lua/oil/corba/giop/Messenger.lua +228 -0
  297. data/vendor/lua/lib/lua/oil/corba/giop/Referrer.lua +180 -0
  298. data/vendor/lua/lib/lua/oil/corba/giop/Requester.lua +462 -0
  299. data/vendor/lua/lib/lua/oil/corba/idl.lua +597 -0
  300. data/vendor/lua/lib/lua/oil/corba/idl/Compiler.lua +133 -0
  301. data/vendor/lua/lib/lua/oil/corba/idl/Importer.lua +235 -0
  302. data/vendor/lua/lib/lua/oil/corba/idl/Indexer.lua +95 -0
  303. data/vendor/lua/lib/lua/oil/corba/idl/Registry.lua +1821 -0
  304. data/vendor/lua/lib/lua/oil/corba/idl/ir.lua +847 -0
  305. data/vendor/lua/lib/lua/oil/corba/idl/sysex.lua +21 -0
  306. data/vendor/lua/lib/lua/oil/corba/iiop/Profiler.lua +200 -0
  307. data/vendor/lua/lib/lua/oil/corba/intercepted/Listener.lua +158 -0
  308. data/vendor/lua/lib/lua/oil/corba/intercepted/Requester.lua +181 -0
  309. data/vendor/lua/lib/lua/oil/corba/services/event.lua +126 -0
  310. data/vendor/lua/lib/lua/oil/corba/services/event/ConsumerAdmin.lua +50 -0
  311. data/vendor/lua/lib/lua/oil/corba/services/event/EventFactory.lua +15 -0
  312. data/vendor/lua/lib/lua/oil/corba/services/event/EventQueue.lua +37 -0
  313. data/vendor/lua/lib/lua/oil/corba/services/event/ProxyPushConsumer.lua +75 -0
  314. data/vendor/lua/lib/lua/oil/corba/services/event/ProxyPushSupplier.lua +62 -0
  315. data/vendor/lua/lib/lua/oil/corba/services/event/SingleDeferredDispatcher.lua +60 -0
  316. data/vendor/lua/lib/lua/oil/corba/services/event/SingleSynchronousDispatcher.lua +39 -0
  317. data/vendor/lua/lib/lua/oil/corba/services/event/SupplierAdmin.lua +50 -0
  318. data/vendor/lua/lib/lua/oil/corba/services/naming.lua +436 -0
  319. data/vendor/lua/lib/lua/oil/kernel/base/Acceptor.lua +268 -0
  320. data/vendor/lua/lib/lua/oil/kernel/base/Channels.lua +121 -0
  321. data/vendor/lua/lib/lua/oil/kernel/base/Connector.lua +147 -0
  322. data/vendor/lua/lib/lua/oil/kernel/base/Dispatcher.lua +99 -0
  323. data/vendor/lua/lib/lua/oil/kernel/base/Proxies.lua +86 -0
  324. data/vendor/lua/lib/lua/oil/kernel/base/Proxies/asynchronous.lua +56 -0
  325. data/vendor/lua/lib/lua/oil/kernel/base/Proxies/protected.lua +17 -0
  326. data/vendor/lua/lib/lua/oil/kernel/base/Proxies/synchronous.lua +17 -0
  327. data/vendor/lua/lib/lua/oil/kernel/base/Proxies/utils.lua +29 -0
  328. data/vendor/lua/lib/lua/oil/kernel/base/Receiver.lua +110 -0
  329. data/vendor/lua/lib/lua/oil/kernel/base/Servants.lua +207 -0
  330. data/vendor/lua/lib/lua/oil/kernel/base/Sockets.lua +44 -0
  331. data/vendor/lua/lib/lua/oil/kernel/cooperative/Receiver.lua +139 -0
  332. data/vendor/lua/lib/lua/oil/kernel/intercepted/Listener.lua +47 -0
  333. data/vendor/lua/lib/lua/oil/kernel/intercepted/Requester.lua +58 -0
  334. data/vendor/lua/lib/lua/oil/kernel/lua/Dispatcher.lua +76 -0
  335. data/vendor/lua/lib/lua/oil/kernel/lua/Proxies.lua +69 -0
  336. data/vendor/lua/lib/lua/oil/kernel/typed/Dispatcher.lua +91 -0
  337. data/vendor/lua/lib/lua/oil/kernel/typed/Proxies.lua +153 -0
  338. data/vendor/lua/lib/lua/oil/kernel/typed/Servants.lua +137 -0
  339. data/vendor/lua/lib/lua/oil/ludo/Codec.lua +66 -0
  340. data/vendor/lua/lib/lua/oil/ludo/CodecByRef.lua +103 -0
  341. data/vendor/lua/lib/lua/oil/ludo/Listener.lua +151 -0
  342. data/vendor/lua/lib/lua/oil/ludo/Referrer.lua +72 -0
  343. data/vendor/lua/lib/lua/oil/ludo/Requester.lua +107 -0
  344. data/vendor/lua/lib/lua/oil/oo.lua +1 -0
  345. data/vendor/lua/lib/lua/oil/port.lua +1 -0
  346. data/vendor/lua/lib/lua/oil/properties.lua +57 -0
  347. data/vendor/lua/lib/lua/oil/verbose.lua +133 -0
  348. data/vendor/lua/lib/lua/package_ext.lua +15 -0
  349. data/vendor/lua/lib/lua/parser.lua +268 -0
  350. data/vendor/lua/lib/lua/pl/Date.lua +555 -0
  351. data/vendor/lua/lib/lua/pl/List.lua +613 -0
  352. data/vendor/lua/lib/lua/pl/Map.lua +113 -0
  353. data/vendor/lua/lib/lua/pl/MultiMap.lua +62 -0
  354. data/vendor/lua/lib/lua/pl/OrderedMap.lua +151 -0
  355. data/vendor/lua/lib/lua/pl/Set.lua +153 -0
  356. data/vendor/lua/lib/lua/pl/app.lua +165 -0
  357. data/vendor/lua/lib/lua/pl/array2d.lua +501 -0
  358. data/vendor/lua/lib/lua/pl/class.lua +180 -0
  359. data/vendor/lua/lib/lua/pl/comprehension.lua +286 -0
  360. data/vendor/lua/lib/lua/pl/config.lua +176 -0
  361. data/vendor/lua/lib/lua/pl/data.lua +606 -0
  362. data/vendor/lua/lib/lua/pl/dir.lua +475 -0
  363. data/vendor/lua/lib/lua/pl/file.lua +70 -0
  364. data/vendor/lua/lib/lua/pl/func.lua +376 -0
  365. data/vendor/lua/lib/lua/pl/init.lua +68 -0
  366. data/vendor/lua/lib/lua/pl/input.lua +173 -0
  367. data/vendor/lua/lib/lua/pl/lapp.lua +407 -0
  368. data/vendor/lua/lib/lua/pl/lexer.lua +456 -0
  369. data/vendor/lua/lib/lua/pl/luabalanced.lua +264 -0
  370. data/vendor/lua/lib/lua/pl/operator.lua +201 -0
  371. data/vendor/lua/lib/lua/pl/path.lua +398 -0
  372. data/vendor/lua/lib/lua/pl/permute.lua +63 -0
  373. data/vendor/lua/lib/lua/pl/platf/luajava.lua +101 -0
  374. data/vendor/lua/lib/lua/pl/pretty.lua +285 -0
  375. data/vendor/lua/lib/lua/pl/seq.lua +551 -0
  376. data/vendor/lua/lib/lua/pl/sip.lua +344 -0
  377. data/vendor/lua/lib/lua/pl/strict.lua +70 -0
  378. data/vendor/lua/lib/lua/pl/stringio.lua +158 -0
  379. data/vendor/lua/lib/lua/pl/stringx.lua +440 -0
  380. data/vendor/lua/lib/lua/pl/tablex.lua +817 -0
  381. data/vendor/lua/lib/lua/pl/template.lua +103 -0
  382. data/vendor/lua/lib/lua/pl/test.lua +135 -0
  383. data/vendor/lua/lib/lua/pl/text.lua +243 -0
  384. data/vendor/lua/lib/lua/pl/utils.lua +550 -0
  385. data/vendor/lua/lib/lua/pl/xml.lua +689 -0
  386. data/vendor/lua/lib/lua/profiler.dll +0 -0
  387. data/vendor/lua/lib/lua/re.lua +248 -0
  388. data/vendor/lua/lib/lua/rex_onig.dll +0 -0
  389. data/vendor/lua/lib/lua/rex_pcre.dll +0 -0
  390. data/vendor/lua/lib/lua/rex_posix.dll +0 -0
  391. data/vendor/lua/lib/lua/rings.dll +0 -0
  392. data/vendor/lua/lib/lua/serialize.lua +193 -0
  393. data/vendor/lua/lib/lua/set.lua +149 -0
  394. data/vendor/lua/lib/lua/socket.lua +133 -0
  395. data/vendor/lua/lib/lua/socket/core.dll +0 -0
  396. data/vendor/lua/lib/lua/socket/ftp.lua +281 -0
  397. data/vendor/lua/lib/lua/socket/http.lua +350 -0
  398. data/vendor/lua/lib/lua/socket/smtp.lua +251 -0
  399. data/vendor/lua/lib/lua/socket/tp.lua +123 -0
  400. data/vendor/lua/lib/lua/socket/url.lua +297 -0
  401. data/vendor/lua/lib/lua/ssl.dll +0 -0
  402. data/vendor/lua/lib/lua/ssl.lua +93 -0
  403. data/vendor/lua/lib/lua/ssl/https.lua +138 -0
  404. data/vendor/lua/lib/lua/stable.lua +28 -0
  405. data/vendor/lua/lib/lua/std.lua +16 -0
  406. data/vendor/lua/lib/lua/strbuf.lua +32 -0
  407. data/vendor/lua/lib/lua/strict.lua +45 -0
  408. data/vendor/lua/lib/lua/string_ext.lua +274 -0
  409. data/vendor/lua/lib/lua/table_ext.lua +117 -0
  410. data/vendor/lua/lib/lua/tar.lua +262 -0
  411. data/vendor/lua/lib/lua/task.dll +0 -0
  412. data/vendor/lua/lib/lua/tree.lua +81 -0
  413. data/vendor/lua/lib/lua/unicode.dll +0 -0
  414. data/vendor/lua/lib/lua/verbose_require.lua +11 -0
  415. data/vendor/lua/lib/lua/vstruct.lua +86 -0
  416. data/vendor/lua/lib/lua/vstruct/ast.lua +192 -0
  417. data/vendor/lua/lib/lua/vstruct/ast/Bitpack.lua +33 -0
  418. data/vendor/lua/lib/lua/vstruct/ast/Generator.lua +174 -0
  419. data/vendor/lua/lib/lua/vstruct/ast/IO.lua +45 -0
  420. data/vendor/lua/lib/lua/vstruct/ast/List.lua +56 -0
  421. data/vendor/lua/lib/lua/vstruct/ast/Name.lua +20 -0
  422. data/vendor/lua/lib/lua/vstruct/ast/Repeat.lua +23 -0
  423. data/vendor/lua/lib/lua/vstruct/ast/Root.lua +19 -0
  424. data/vendor/lua/lib/lua/vstruct/ast/Table.lua +65 -0
  425. data/vendor/lua/lib/lua/vstruct/cursor.lua +81 -0
  426. data/vendor/lua/lib/lua/vstruct/io.lua +45 -0
  427. data/vendor/lua/lib/lua/vstruct/io/a.lua +24 -0
  428. data/vendor/lua/lib/lua/vstruct/io/b.lua +28 -0
  429. data/vendor/lua/lib/lua/vstruct/io/bigendian.lua +21 -0
  430. data/vendor/lua/lib/lua/vstruct/io/c.lua +25 -0
  431. data/vendor/lua/lib/lua/vstruct/io/defaults.lua +24 -0
  432. data/vendor/lua/lib/lua/vstruct/io/endianness.lua +41 -0
  433. data/vendor/lua/lib/lua/vstruct/io/f.lua +129 -0
  434. data/vendor/lua/lib/lua/vstruct/io/hostendian.lua +21 -0
  435. data/vendor/lua/lib/lua/vstruct/io/i.lua +42 -0
  436. data/vendor/lua/lib/lua/vstruct/io/littleendian.lua +21 -0
  437. data/vendor/lua/lib/lua/vstruct/io/m.lua +62 -0
  438. data/vendor/lua/lib/lua/vstruct/io/p.lua +23 -0
  439. data/vendor/lua/lib/lua/vstruct/io/s.lua +27 -0
  440. data/vendor/lua/lib/lua/vstruct/io/seekb.lua +18 -0
  441. data/vendor/lua/lib/lua/vstruct/io/seekf.lua +18 -0
  442. data/vendor/lua/lib/lua/vstruct/io/seekto.lua +18 -0
  443. data/vendor/lua/lib/lua/vstruct/io/u.lua +54 -0
  444. data/vendor/lua/lib/lua/vstruct/io/x.lua +34 -0
  445. data/vendor/lua/lib/lua/vstruct/io/z.lua +63 -0
  446. data/vendor/lua/lib/lua/vstruct/lexer.lua +100 -0
  447. data/vendor/lua/lib/lua/vstruct/pack.lua +142 -0
  448. data/vendor/lua/lib/lua/vstruct/test.lua +47 -0
  449. data/vendor/lua/lib/lua/vstruct/test/basic.lua +73 -0
  450. data/vendor/lua/lib/lua/vstruct/test/common.lua +100 -0
  451. data/vendor/lua/lib/lua/vstruct/test/fp-bigendian.lua +56 -0
  452. data/vendor/lua/lib/lua/vstruct/test/fp-littleendian.lua +56 -0
  453. data/vendor/lua/lib/lua/vstruct/test/struct-test-gen.lua +1230 -0
  454. data/vendor/lua/lib/lua/vstruct/unpack.lua +126 -0
  455. data/vendor/lua/lib/lua/wx.dll +0 -0
  456. data/vendor/lua/lib/lua/xml.lua +75 -0
  457. data/vendor/lua/lib/lua/zip.dll +0 -0
  458. data/vendor/lua/lib/lua/zlib.dll +0 -0
  459. metadata +529 -0
@@ -0,0 +1,119 @@
1
+ --------------------------------------------------------------------------------
2
+ -- Execute an `mlc.ast_of_*()' in a separate lua process.
3
+ -- Communication between processes goes through temporary files,
4
+ -- for the sake of portability.
5
+ --------------------------------------------------------------------------------
6
+
7
+ mlc_xcall = { }
8
+
9
+ --------------------------------------------------------------------------------
10
+ -- Number of lines to remove at the end of a traceback, should it be
11
+ -- dumped due to a compilation error in metabugs mode.
12
+ --------------------------------------------------------------------------------
13
+ local STACK_LINES_TO_CUT = 7
14
+
15
+ --------------------------------------------------------------------------------
16
+ -- (Not intended to be called directly by users)
17
+ --
18
+ -- This is the back-end function, called in a separate lua process
19
+ -- by `mlc_xcall.client_*()' through `os.execute()'.
20
+ -- * inputs:
21
+ -- * the name of a lua source file to compile in a separate process
22
+ -- * the name of a writable file where the resulting ast is dumped
23
+ -- with `serialize()'.
24
+ -- * metabugs: if true and an error occurs during compilation,
25
+ -- the compiler's stacktrace is printed, allowing meta-programs
26
+ -- debugging.
27
+ -- * results:
28
+ -- * an exit status of 0 or -1, depending on whethet compilation
29
+ -- succeeded;
30
+ -- * the ast file filled will either the serialized ast, or the
31
+ -- error message.
32
+ --------------------------------------------------------------------------------
33
+ function mlc_xcall.server (luafilename, astfilename, metabugs)
34
+
35
+ -- We don't want these to be loaded when people only do client-side business
36
+ require 'metalua.compiler'
37
+ require 'serialize'
38
+
39
+ mlc.metabugs = metabugs
40
+
41
+ -- compile the content of luafile name in an AST, serialized in astfilename
42
+ --local status, ast = pcall (mlc.luafile_to_ast, luafilename)
43
+ local status, ast
44
+ local function compile() return mlc.luafile_to_ast (luafilename) end
45
+ if mlc.metabugs then
46
+ print 'mlc_xcall.server/metabugs'
47
+ --status, ast = xpcall (compile, debug.traceback)
48
+ --status, ast = xpcall (compile, debug.traceback)
49
+ local function tb(msg)
50
+ local r = debug.traceback(msg)
51
+
52
+ -- Cut superfluous end lines
53
+ local line_re = '\n[^\n]*'
54
+ local re = "^(.-)" .. (line_re) :rep (STACK_LINES_TO_CUT) .. "$"
55
+ return r :strmatch (re) or r
56
+ end
57
+ --status, ast = xpcall (compile, debug.traceback)
58
+ status, ast = xpcall (compile, tb)
59
+ else status, ast = pcall (compile) end
60
+ local out = io.open (astfilename, 'w')
61
+ if status then -- success
62
+ out:write (serialize (ast))
63
+ out:close ()
64
+ os.exit (0)
65
+ else -- failure, `ast' is actually the error message
66
+ out:write (ast)
67
+ out:close ()
68
+ os.exit (-1)
69
+ end
70
+ end
71
+
72
+ --------------------------------------------------------------------------------
73
+ -- Compile the file whose name is passed as argument, in a separate process,
74
+ -- communicating through a temporary file.
75
+ -- returns:
76
+ -- * true or false, indicating whether the compilation succeeded
77
+ -- * the ast, or the error message.
78
+ --------------------------------------------------------------------------------
79
+ function mlc_xcall.client_file (luafile)
80
+
81
+ -- printf("\n\nmlc_xcall.client_file(%q)\n\n", luafile)
82
+
83
+ local tmpfilename = os.tmpname()
84
+ local cmd = string.format (
85
+ [=[%s -l metalua.mlc_xcall -e "mlc_xcall.server([[%s]], [[%s]], %s)"]=],
86
+ (_PROGDIR and _PROGDIR.."/lua" or "lua"), luafile, tmpfilename, mlc.metabugs and "true" or "false")
87
+
88
+ -- printf("os.execute [[%s]]\n\n", cmd)
89
+
90
+ local status = (0 == os.execute (cmd))
91
+ local result -- ast or error msg
92
+ if status then
93
+ result = (lua_loadfile or loadfile) (tmpfilename) ()
94
+ else
95
+ local f = io.open (tmpfilename)
96
+ result = f :read '*a'
97
+ f :close()
98
+ end
99
+ os.remove(tmpfilename)
100
+ return status, result
101
+ end
102
+
103
+ --------------------------------------------------------------------------------
104
+ -- Compile a source string into an ast, by dumping it in a tmp
105
+ -- file then calling `mlc_xcall.client_file()'.
106
+ -- returns: the same as `mlc_xcall.client_file()'.
107
+ --------------------------------------------------------------------------------
108
+ function mlc_xcall.client_literal (luasrc)
109
+ local srcfilename = os.tmpname()
110
+ local srcfile, msg = io.open (srcfilename, 'w')
111
+ if not srcfile then print(msg) end
112
+ srcfile :write (luasrc)
113
+ srcfile :close ()
114
+ local status, ast = mlc_xcall.client_file (srcfilename)
115
+ os.remove(srcfilename)
116
+ return status, ast
117
+ end
118
+
119
+ return mlc_xcall
@@ -0,0 +1,101 @@
1
+ local package = package
2
+
3
+ require 'metalua.mlc'
4
+
5
+ package.metalua_extension_prefix = 'metalua.extension.'
6
+
7
+ package.mpath = os.getenv 'LUA_MPATH' or string.gsub( package.path or "./?.mlua", "%.lua", "%.mlua")
8
+
9
+ ----------------------------------------------------------------------
10
+ -- resc(k) returns "%"..k if it's a special regular expression char,
11
+ -- or just k if it's normal.
12
+ ----------------------------------------------------------------------
13
+ local regexp_magic = table.transpose{
14
+ "^", "$", "(", ")", "%", ".", "[", "]", "*", "+", "-", "?" }
15
+ local function resc(k)
16
+ return regexp_magic[k] and '%'..k or k
17
+ end
18
+
19
+ ----------------------------------------------------------------------
20
+ -- Take a Lua module name, return the open file and its name,
21
+ -- or <false> and an error message.
22
+ ----------------------------------------------------------------------
23
+ function package.findfile(name, path_string)
24
+ local config_regexp = ("([^\n])\n"):rep(5):sub(1, -2)
25
+ local dir_sep, path_sep, path_mark, execdir, igmark =
26
+ package.config:strmatch (config_regexp)
27
+ name = name:gsub ('%.', dir_sep)
28
+ local errors = { }
29
+ local path_pattern = string.format('[^%s]+', resc(path_sep))
30
+ for path in path_string:gmatch (path_pattern) do
31
+ --printf('path = %s, rpath_mark=%s, name=%s', path, resc(path_mark), name)
32
+ local filename = path:gsub (resc (path_mark), name)
33
+ --printf('filename = %s', filename)
34
+ local file = io.open (filename, 'r')
35
+ if file then return file, filename end
36
+ table.insert(errors, string.format("\tno lua file %q", filename))
37
+ end
38
+ return false, table.concat(errors, "\n")..'\n'
39
+ end
40
+
41
+ ----------------------------------------------------------------------
42
+ -- Execute a metalua module sources compilation in a separate process
43
+ -- Sending back the bytecode directly is difficult, as some shells
44
+ -- (at least MS-Windows') interpret some characters. So rather than
45
+ -- base64-encoding the bytecode, AST is returned from the child
46
+ -- process, and converted to bytecode then function in the calling
47
+ -- process.
48
+ ----------------------------------------------------------------------
49
+ local function spring_load(filename)
50
+ -- FIXME: handle compilation errors
51
+ local pattern =
52
+ [=[%s -l metalua.compiler -l serialize -e ]=]..
53
+ [=["print(serialize(mlc.ast_of_luafile [[%s]]))"]=]
54
+ local cmd = string.format (pattern, (_PROGDIR and _PROGDIR.."/lua" or "lua"), filename)
55
+ --print ("running command: ``" .. cmd .. "''")
56
+ local fd = io.popen (cmd)
57
+ local ast_src = fd:read '*a'
58
+ fd:close()
59
+ local ast = lua_loadstring (ast_src) () -- much faster than loadstring()
60
+ return mlc.function_of_ast (ast, filename)
61
+ end
62
+
63
+ ----------------------------------------------------------------------
64
+ -- Load a metalua source file.
65
+ ----------------------------------------------------------------------
66
+ function package.metalua_loader (name)
67
+ local file, filename_or_msg = package.findfile (name, package.mpath)
68
+ if not file then return filename_or_msg end
69
+ if package.metalua_nopopen then
70
+ local luastring = file:read '*a'
71
+ file:close()
72
+ return mlc.function_of_luastring (luastring, name)
73
+ else
74
+ file:close()
75
+ require 'metalua.mlc_xcall'
76
+ local status, ast = mlc_xcall.client_file (filename_or_msg)
77
+ return mlc.function_of_ast(ast)
78
+ end
79
+ end
80
+
81
+ ----------------------------------------------------------------------
82
+ -- Placed after lua/luac loader, so precompiled files have
83
+ -- higher precedence.
84
+ ----------------------------------------------------------------------
85
+ table.insert(package.loaders, package.metalua_loader)
86
+
87
+ ----------------------------------------------------------------------
88
+ -- Load an extension.
89
+ ----------------------------------------------------------------------
90
+ function extension (name, noruntime)
91
+ local complete_name = package.metalua_extension_prefix..name
92
+ local x = require (complete_name)
93
+ if x==true then return
94
+ elseif type(x) ~= 'table' then
95
+ error ("extension returned %s instead of an AST", type(x))
96
+ else
97
+ return x
98
+ end
99
+ end
100
+
101
+ return package
@@ -0,0 +1,3 @@
1
+ require 'metalua.base'
2
+ require 'metalua.table2'
3
+ require 'metalua.string2'
@@ -0,0 +1,44 @@
1
+
2
+ ----------------------------------------------------------------------
3
+ ----------------------------------------------------------------------
4
+ --
5
+ -- String module extension
6
+ --
7
+ ----------------------------------------------------------------------
8
+ ----------------------------------------------------------------------
9
+
10
+ -- Courtesy of lua-users.org
11
+ function string.split(str, pat)
12
+ local t = {}
13
+ local fpat = "(.-)" .. pat
14
+ local last_end = 1
15
+ local s, e, cap = string.find(str, fpat, 1)
16
+ while s do
17
+ if s ~= 1 or cap ~= "" then
18
+ table.insert(t,cap)
19
+ end
20
+ last_end = e+1
21
+ s, e, cap = string.find(str, fpat, last_end)
22
+ end
23
+ if last_end <= string.len(str) then
24
+ cap = string.sub(str, last_end)
25
+ table.insert(t, cap)
26
+ end
27
+ return t
28
+ end
29
+
30
+ -- "match" is regularly used as a keyword for pattern matching,
31
+ -- so here is an always available substitute.
32
+ string.strmatch = string["match"]
33
+
34
+ -- change a compiled string into a function
35
+ function string.undump(str)
36
+ if str:strmatch '^\027LuaQ' or str:strmatch '^#![^\n]+\n\027LuaQ' then
37
+ local f = (lua_loadstring or loadstring)(str)
38
+ return f
39
+ else
40
+ error "Not a chunk dump"
41
+ end
42
+ end
43
+
44
+ return string
@@ -0,0 +1,372 @@
1
+ ---------------------------------------------------------------------
2
+ ----------------------------------------------------------------------
3
+ --
4
+ -- Table module extension
5
+ --
6
+ ----------------------------------------------------------------------
7
+ ----------------------------------------------------------------------
8
+
9
+ -- todo: table.scan (scan1?) fold1? flip?
10
+
11
+ function table.transpose(t)
12
+ local tt = { }
13
+ for a, b in pairs(t) do tt[b] = a end
14
+ return tt
15
+ end
16
+
17
+ function table.iforeach(f, ...)
18
+ -- assert (type (f) == "function") [wouldn't allow metamethod __call]
19
+ local nargs = select("#", ...)
20
+ if nargs==1 then -- Quick iforeach (most common case), just one table arg
21
+ local t = ...
22
+ assert (type (t) == "table")
23
+ for i = 1, #t do
24
+ local result = f (t[i])
25
+ -- If the function returns non-false, stop iteration
26
+ if result then return result end
27
+ end
28
+ else -- advanced case: boundaries and/or multiple tables
29
+ -- 1 - find boundaries if any
30
+ local args, fargs, first, last, arg1 = {...}, { }
31
+ if type(args[1]) ~= "number" then first, arg1 = 1, 1
32
+ elseif type(args[2]) ~= "number" then first, last, arg1 = 1, args[1], 2
33
+ else first, last, i = args[1], args[2], 3 end
34
+ assert (nargs > arg1)
35
+ -- 2 - determine upper boundary if not given
36
+ if not last then for i = arg1, nargs do
37
+ assert (type (args[i]) == "table")
38
+ last = max (#args[i], last)
39
+ end end
40
+ -- 3 - perform the iteration
41
+ for i = first, last do
42
+ for j = arg1, nargs do fargs[j] = args[j][i] end -- build args list
43
+ local result = f (unpack (fargs)) -- here is the call
44
+ -- If the function returns non-false, stop iteration
45
+ if result then return result end
46
+ end
47
+ end
48
+ end
49
+
50
+ function table.imap (f, ...)
51
+ local result, idx = { }, 1
52
+ local function g(...) result[idx] = f(...); idx=idx+1 end
53
+ table.iforeach(g, ...)
54
+ return result
55
+ end
56
+
57
+ function table.ifold (f, acc, ...)
58
+ local function g(...) acc = f (acc,...) end
59
+ table.iforeach (g, ...)
60
+ return acc
61
+ end
62
+
63
+ -- function table.ifold1 (f, ...)
64
+ -- return table.ifold (f, acc, 2, false, ...)
65
+ -- end
66
+
67
+ function table.izip(...)
68
+ local function g(...) return {...} end
69
+ return table.imap(g, ...)
70
+ end
71
+
72
+ function table.ifilter(f, t)
73
+ local yes, no = { }, { }
74
+ for i=1,#t do table.insert (f(t[i]) and yes or no, t[i]) end
75
+ return yes, no
76
+ end
77
+
78
+ function table.icat(...)
79
+ local result = { }
80
+ for t in values {...} do
81
+ for x in values (t) do
82
+ table.insert (result, x)
83
+ end
84
+ end
85
+ return result
86
+ end
87
+
88
+ function table.iflatten (x) return table.icat (unpack (x)) end
89
+
90
+ function table.irev (t)
91
+ local result, nt = { }, #t
92
+ for i=0, nt-1 do result[nt-i] = t[i+1] end
93
+ return result
94
+ end
95
+
96
+ function table.isub (t, ...)
97
+ local ti, u = table.insert, { }
98
+ local args, nargs = {...}, select("#", ...)
99
+ for i=1, nargs/2 do
100
+ local a, b = args[2*i-1], args[2*i]
101
+ for i=a, b, a<=b and 1 or -1 do ti(u, t[i]) end
102
+ end
103
+ return u
104
+ end
105
+
106
+ function table.iall (f, ...)
107
+ local result = true
108
+ local function g(...) return not f(...) end
109
+ return not table.iforeach(g, ...)
110
+ --return result
111
+ end
112
+
113
+ function table.iany (f, ...)
114
+ local function g(...) return not f(...) end
115
+ return not table.iall(g, ...)
116
+ end
117
+
118
+ function table.shallow_copy(x)
119
+ local y={ }
120
+ for k, v in pairs(x) do y[k]=v end
121
+ return y
122
+ end
123
+
124
+ -- Warning, this is implementation dependent: it relies on
125
+ -- the fact the [next()] enumerates the array-part before the hash-part.
126
+ function table.cat(...)
127
+ local y={ }
128
+ for x in values{...} do
129
+ -- cat array-part
130
+ for _, v in ipairs(x) do table.insert(y,v) end
131
+ -- cat hash-part
132
+ local lx, k = #x
133
+ if lx>0 then k=next(x,lx) else k=next(x) end
134
+ while k do y[k]=x[k]; k=next(x,k) end
135
+ end
136
+ return y
137
+ end
138
+
139
+ function table.deep_copy(x)
140
+ local tracker = { }
141
+ local function aux (x)
142
+ if type(x) == "table" then
143
+ local y=tracker[x]
144
+ if y then return y end
145
+ y = { }; tracker[x] = y
146
+ setmetatable (y, getmetatable (x))
147
+ for k,v in pairs(x) do y[aux(k)] = aux(v) end
148
+ return y
149
+ else return x end
150
+ end
151
+ return aux(x)
152
+ end
153
+
154
+ function table.override(dst, src)
155
+ for k, v in pairs(src) do dst[k] = v end
156
+ for i = #src+1, #dst do dst[i] = nil end
157
+ return dst
158
+ end
159
+
160
+
161
+ function table.range(a,b,c)
162
+ if not b then assert(not(c)); b=a; a=1
163
+ elseif not c then c = (b>=a) and 1 or -1 end
164
+ local result = { }
165
+ for i=a, b, c do table.insert(result, i) end
166
+ return result
167
+ end
168
+
169
+ -- FIXME: new_indent seems to be always nil?!
170
+ -- FIXME: accumulator function should be configurable,
171
+ -- so that print() doesn't need to bufferize the whole string
172
+ -- before starting to print.
173
+ function table.tostring(t, ...)
174
+ local PRINT_HASH, HANDLE_TAG, FIX_INDENT, LINE_MAX, INITIAL_INDENT = true, true
175
+ for _, x in ipairs {...} do
176
+ if type(x) == "number" then
177
+ if not LINE_MAX then LINE_MAX = x
178
+ else INITIAL_INDENT = x end
179
+ elseif x=="nohash" then PRINT_HASH = false
180
+ elseif x=="notag" then HANDLE_TAG = false
181
+ else
182
+ local n = string['match'](x, "^indent%s*(%d*)$")
183
+ if n then FIX_INDENT = tonumber(n) or 3 end
184
+ end
185
+ end
186
+ LINE_MAX = LINE_MAX or math.huge
187
+ INITIAL_INDENT = INITIAL_INDENT or 1
188
+
189
+ local current_offset = 0 -- indentation level
190
+ local xlen_cache = { } -- cached results for xlen()
191
+ local acc_list = { } -- Generated bits of string
192
+ local function acc(...) -- Accumulate a bit of string
193
+ local x = table.concat{...}
194
+ current_offset = current_offset + #x
195
+ table.insert(acc_list, x)
196
+ end
197
+ local function valid_id(x)
198
+ -- FIXME: we should also reject keywords; but the list of
199
+ -- current keywords is not fixed in metalua...
200
+ return type(x) == "string"
201
+ and string['match'](x, "^[a-zA-Z_][a-zA-Z0-9_]*$")
202
+ end
203
+
204
+ -- Compute the number of chars it would require to display the table
205
+ -- on a single line. Helps to decide whether some carriage returns are
206
+ -- required. Since the size of each sub-table is required many times,
207
+ -- it's cached in [xlen_cache].
208
+ local xlen_type = { }
209
+ local function xlen(x, nested)
210
+ nested = nested or { }
211
+ if x==nil then return #"nil" end
212
+ --if nested[x] then return #tostring(x) end -- already done in table
213
+ local len = xlen_cache[x]
214
+ if len then return len end
215
+ local f = xlen_type[type(x)]
216
+ if not f then return #tostring(x) end
217
+ len = f (x, nested)
218
+ xlen_cache[x] = len
219
+ return len
220
+ end
221
+
222
+ -- optim: no need to compute lengths if I'm not going to use them
223
+ -- anyway.
224
+ if LINE_MAX == math.huge then xlen = function() return 0 end end
225
+
226
+ xlen_type["nil"] = function () return 3 end
227
+ function xlen_type.number (x) return #tostring(x) end
228
+ function xlen_type.boolean (x) return x and 4 or 5 end
229
+ function xlen_type.string (x) return #string.format("%q",x) end
230
+ function xlen_type.table (adt, nested)
231
+
232
+ -- Circular references detection
233
+ if nested [adt] then return #tostring(adt) end
234
+ nested [adt] = true
235
+
236
+ local has_tag = HANDLE_TAG and valid_id(adt.tag)
237
+ local alen = #adt
238
+ local has_arr = alen>0
239
+ local has_hash = false
240
+ local x = 0
241
+
242
+ if PRINT_HASH then
243
+ -- first pass: count hash-part
244
+ for k, v in pairs(adt) do
245
+ if k=="tag" and has_tag then
246
+ -- this is the tag -> do nothing!
247
+ elseif type(k)=="number" and k<=alen and math.fmod(k,1)==0 then
248
+ -- array-part pair -> do nothing!
249
+ else
250
+ has_hash = true
251
+ if valid_id(k) then x=x+#k
252
+ else x = x + xlen (k, nested) + 2 end -- count surrounding brackets
253
+ x = x + xlen (v, nested) + 5 -- count " = " and ", "
254
+ end
255
+ end
256
+ end
257
+
258
+ for i = 1, alen do x = x + xlen (adt[i], nested) + 2 end -- count ", "
259
+
260
+ nested[adt] = false -- No more nested calls
261
+
262
+ if not (has_tag or has_arr or has_hash) then return 3 end
263
+ if has_tag then x=x+#adt.tag+1 end
264
+ if not (has_arr or has_hash) then return x end
265
+ if not has_hash and alen==1 and type(adt[1])~="table" then
266
+ return x-2 -- substract extraneous ", "
267
+ end
268
+ return x+2 -- count "{ " and " }", substract extraneous ", "
269
+ end
270
+
271
+ -- Recursively print a (sub) table at given indentation level.
272
+ -- [newline] indicates whether newlines should be inserted.
273
+ local function rec (adt, nested, indent)
274
+ if not FIX_INDENT then indent = current_offset end
275
+ local function acc_newline()
276
+ acc ("\n"); acc (string.rep (" ", indent))
277
+ current_offset = indent
278
+ end
279
+ local x = { }
280
+ x["nil"] = function() acc "nil" end
281
+ function x.number() acc (tostring (adt)) end
282
+ --function x.string() acc (string.format ("%q", adt)) end
283
+ function x.string() acc ((string.format ("%q", adt):gsub("\\\n", "\\n"))) end
284
+ function x.boolean() acc (adt and "true" or "false") end
285
+ function x.table()
286
+ if nested[adt] then acc(tostring(adt)); return end
287
+ nested[adt] = true
288
+
289
+
290
+ local has_tag = HANDLE_TAG and valid_id(adt.tag)
291
+ local alen = #adt
292
+ local has_arr = alen>0
293
+ local has_hash = false
294
+
295
+ if has_tag then acc("`"); acc(adt.tag) end
296
+
297
+ -- First pass: handle hash-part
298
+ if PRINT_HASH then
299
+ for k, v in pairs(adt) do
300
+ -- pass if the key belongs to the array-part or is the "tag" field
301
+ if not (k=="tag" and HANDLE_TAG) and
302
+ not (type(k)=="number" and k<=alen and math.fmod(k,1)==0) then
303
+
304
+ -- Is it the first time we parse a hash pair?
305
+ if not has_hash then
306
+ acc "{ "
307
+ if not FIX_INDENT then indent = current_offset end
308
+ else acc ", " end
309
+
310
+ -- Determine whether a newline is required
311
+ local is_id, expected_len = valid_id(k)
312
+ if is_id then expected_len = #k + xlen (v, nested) + #" = , "
313
+ else expected_len = xlen (k, nested) +
314
+ xlen (v, nested) + #"[] = , " end
315
+ if has_hash and expected_len + current_offset > LINE_MAX
316
+ then acc_newline() end
317
+
318
+ -- Print the key
319
+ if is_id then acc(k); acc " = "
320
+ else acc "["; rec (k, nested, indent+(FIX_INDENT or 0)); acc "] = " end
321
+
322
+ -- Print the value
323
+ rec (v, nested, indent+(FIX_INDENT or 0))
324
+ has_hash = true
325
+ end
326
+ end
327
+ end
328
+
329
+ -- Now we know whether there's a hash-part, an array-part, and a tag.
330
+ -- Tag and hash-part are already printed if they're present.
331
+ if not has_tag and not has_hash and not has_arr then acc "{ }";
332
+ elseif has_tag and not has_hash and not has_arr then -- nothing, tag already in acc
333
+ else
334
+ assert (has_hash or has_arr)
335
+ local no_brace = false
336
+ if has_hash and has_arr then acc ", "
337
+ elseif has_tag and not has_hash and alen==1 and type(adt[1])~="table" then
338
+ -- No brace required; don't print "{", remember not to print "}"
339
+ acc (" "); rec (adt[1], nested, indent+(FIX_INDENT or 0))
340
+ no_brace = true
341
+ elseif not has_hash then
342
+ -- Braces required, but not opened by hash-part handler yet
343
+ acc "{ "
344
+ if not FIX_INDENT then indent = current_offset end
345
+ end
346
+
347
+ -- 2nd pass: array-part
348
+ if not no_brace and has_arr then
349
+ rec (adt[1], nested, indent+(FIX_INDENT or 0))
350
+ for i=2, alen do
351
+ acc ", ";
352
+ if current_offset + xlen (adt[i], { }) > LINE_MAX
353
+ then acc_newline() end
354
+ rec (adt[i], nested, indent+(FIX_INDENT or 0))
355
+ end
356
+ end
357
+ if not no_brace then acc " }" end
358
+ end
359
+ nested[adt] = false -- No more nested calls
360
+ end
361
+ local y = x[type(adt)]
362
+ if y then y() else acc(tostring(adt)) end
363
+ end
364
+ --printf("INITIAL_INDENT = %i", INITIAL_INDENT)
365
+ current_offset = INITIAL_INDENT or 0
366
+ rec(t, { }, 0)
367
+ return table.concat (acc_list)
368
+ end
369
+
370
+ function table.print(...) return print(table.tostring(...)) end
371
+
372
+ return table