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,151 @@
1
+
2
+ --- Module implementing the LuaRocks "unpack" command.
3
+ -- Unpack the contents of a rock.
4
+ module("luarocks.unpack", package.seeall)
5
+
6
+ local fetch = require("luarocks.fetch")
7
+ local fs = require("luarocks.fs")
8
+ local util = require("luarocks.util")
9
+ local build = require("luarocks.build")
10
+ local dir = require("luarocks.dir")
11
+
12
+ help_summary = "Unpack the contents of a rock."
13
+ help_arguments = "{<rock>|<name> [<version>]}"
14
+ help = [[
15
+ Unpacks the contents of a rock in a newly created directory.
16
+ Argument may be a rock file, or the name of a rock in a rocks server.
17
+ In the latter case, the app version may be given as a second argument.
18
+ ]]
19
+
20
+ --- Load a rockspec file to the given directory, fetches the source
21
+ -- files specified in the rockspec, and unpack them inside the directory.
22
+ -- @param rockspec_file string: The URL for a rockspec file.
23
+ -- @param dir_name string: The directory where to store and unpack files.
24
+ -- @return table or (nil, string): the loaded rockspec table or
25
+ -- nil and an error message.
26
+ local function unpack_rockspec(rockspec_file, dir_name)
27
+ assert(type(rockspec_file) == "string")
28
+ assert(type(dir_name) == "string")
29
+
30
+ local rockspec, err = fetch.load_rockspec(rockspec_file)
31
+ if not rockspec then
32
+ return nil, "Failed loading rockspec "..rockspec_file..": "..err
33
+ end
34
+ fs.change_dir(dir_name)
35
+ local ok, sources_dir = fetch.fetch_sources(rockspec, true, ".")
36
+ if not ok then
37
+ return nil, sources_dir
38
+ end
39
+ fs.change_dir(dir_name)
40
+ build.apply_patches(rockspec)
41
+ fs.pop_dir()
42
+ return rockspec
43
+ end
44
+
45
+ --- Load a .rock file to the given directory and unpack it inside it.
46
+ -- @param rock_file string: The URL for a .rock file.
47
+ -- @param dir_name string: The directory where to unpack.
48
+ -- @param kind string: the kind of rock file, as in the second-level
49
+ -- extension in the rock filename (eg. "src", "all", "linux-x86")
50
+ -- @return table or (nil, string): the loaded rockspec table or
51
+ -- nil and an error message.
52
+ local function unpack_rock(rock_file, dir_name, kind)
53
+ assert(type(rock_file) == "string")
54
+ assert(type(dir_name) == "string")
55
+
56
+ local ok, err, errcode = fetch.fetch_and_unpack_rock(rock_file, dir_name)
57
+ if not ok then
58
+ return nil, "Failed unzipping rock "..rock_file, errcode
59
+ end
60
+ fs.change_dir(dir_name)
61
+ local rockspec_file = dir_name..".rockspec"
62
+ local rockspec, err = fetch.load_rockspec(rockspec_file)
63
+ if not rockspec then
64
+ return nil, "Failed loading rockspec "..rockspec_file..": "..err
65
+ end
66
+ if kind == "src" then
67
+ if rockspec.source.file then
68
+ local ok, err = fs.unpack_archive(rockspec.source.file)
69
+ if not ok then
70
+ return nil, err
71
+ end
72
+ fs.change_dir(rockspec.source.dir)
73
+ build.apply_patches(rockspec)
74
+ fs.pop_dir()
75
+ end
76
+ end
77
+ return rockspec
78
+ end
79
+
80
+ --- Create a directory and perform the necessary actions so that
81
+ -- the sources for the rock and its rockspec are unpacked inside it,
82
+ -- laid out properly so that the 'make' command is able to build the module.
83
+ -- @param file string: A rockspec or .rock URL.
84
+ -- @return boolean or (nil, string): true if successful or nil followed
85
+ -- by an error message.
86
+ local function run_unpacker(file)
87
+ assert(type(file) == "string")
88
+
89
+ local base_name = dir.base_name(file)
90
+ local dir_name, kind, extension = base_name:match("(.*)%.([^.]+)%.(rock)$")
91
+ if not extension then
92
+ dir_name, extension = base_name:match("(.*)%.(rockspec)$")
93
+ kind = "rockspec"
94
+ end
95
+ if not extension then
96
+ return nil, file.." does not seem to be a valid filename."
97
+ end
98
+
99
+ if (fs.exists(dir_name)) then
100
+ return nil, "Directory "..dir_name.." already exists."
101
+ end
102
+ fs.make_dir(dir_name)
103
+ local rollback = util.schedule_function(fs.delete, fs.absolute_name(dir_name))
104
+
105
+ local rockspec, err
106
+ if extension == "rock" then
107
+ rockspec, err = unpack_rock(file, dir_name, kind)
108
+ elseif extension == "rockspec" then
109
+ rockspec, err = unpack_rockspec(file, dir_name)
110
+ end
111
+ if not rockspec then
112
+ return nil, err
113
+ end
114
+ if kind == "src" or kind == "rockspec" then
115
+ if rockspec.source.dir ~= "." then
116
+ local ok = fs.copy(rockspec.local_filename, rockspec.source.dir)
117
+ if not ok then
118
+ return nil, "Failed copying unpacked rockspec into unpacked source directory."
119
+ end
120
+ end
121
+ util.printout()
122
+ util.printout("Done. You may now enter directory ")
123
+ util.printout(dir.path(dir_name, rockspec.source.dir))
124
+ util.printout("and type 'luarocks make' to build.")
125
+ end
126
+ util.remove_scheduled_function(rollback)
127
+ return true
128
+ end
129
+
130
+ --- Driver function for the "unpack" command.
131
+ -- @param name string: may be a rock filename, for unpacking a
132
+ -- rock file or the name of a rock to be fetched and unpacked.
133
+ -- @param version string or nil: if the name of a package is given, a
134
+ -- version may also be passed.
135
+ -- @return boolean or (nil, string): true if successful or nil followed
136
+ -- by an error message.
137
+ function run(...)
138
+ local flags, name, version = util.parse_flags(...)
139
+
140
+ assert(type(version) == "string" or not version)
141
+ if type(name) ~= "string" then
142
+ return nil, "Argument missing, see help."
143
+ end
144
+
145
+ if name:match(".*%.rock") or name:match(".*%.rockspec") then
146
+ return run_unpacker(name)
147
+ else
148
+ local search = require("luarocks.search")
149
+ return search.act_on_src_or_rockspec(run_unpacker, name, version)
150
+ end
151
+ end
@@ -0,0 +1,420 @@
1
+
2
+ --- Assorted utilities for managing tables, plus a scheduler for rollback functions.
3
+ -- Does not requires modules directly (only as locals
4
+ -- inside specific functions) to avoid interdependencies,
5
+ -- as this is used in the bootstrapping stage of luarocks.cfg.
6
+
7
+ local global_env = _G
8
+
9
+ module("luarocks.util", package.seeall)
10
+
11
+ local scheduled_functions = {}
12
+
13
+ --- Schedule a function to be executed upon program termination.
14
+ -- This is useful for actions such as deleting temporary directories
15
+ -- or failure rollbacks.
16
+ -- @param f function: Function to be executed.
17
+ -- @param ... arguments to be passed to function.
18
+ -- @return table: A token representing the scheduled execution,
19
+ -- which can be used to remove the item later from the list.
20
+ function schedule_function(f, ...)
21
+ assert(type(f) == "function")
22
+
23
+ local item = { fn = f, args = {...} }
24
+ table.insert(scheduled_functions, item)
25
+ return item
26
+ end
27
+
28
+ --- Unschedule a function.
29
+ -- This is useful for cancelling a rollback of a completed operation.
30
+ -- @param item table: The token representing the scheduled function that was
31
+ -- returned from the schedule_function call.
32
+ function remove_scheduled_function(item)
33
+ for k, v in pairs(scheduled_functions) do
34
+ if v == item then
35
+ table.remove(scheduled_functions, k)
36
+ return
37
+ end
38
+ end
39
+ end
40
+
41
+ --- Execute scheduled functions.
42
+ -- Some calls create temporary files and/or directories and register
43
+ -- corresponding cleanup functions. Calling this function will run
44
+ -- these function, erasing temporaries.
45
+ -- Functions are executed in the inverse order they were scheduled.
46
+ function run_scheduled_functions()
47
+ local fs = require("luarocks.fs")
48
+ fs.change_dir_to_root()
49
+ for i = #scheduled_functions, 1, -1 do
50
+ local item = scheduled_functions[i]
51
+ item.fn(unpack(item.args))
52
+ end
53
+ end
54
+
55
+ --- Extract flags from an arguments list.
56
+ -- Given string arguments, extract flag arguments into a flags set.
57
+ -- For example, given "foo", "--tux=beep", "--bla", "bar", "--baz",
58
+ -- it would return the following:
59
+ -- {["bla"] = true, ["tux"] = "beep", ["baz"] = true}, "foo", "bar".
60
+ function parse_flags(...)
61
+ local args = {...}
62
+ local flags = {}
63
+ for i = #args, 1, -1 do
64
+ local flag = args[i]:match("^%-%-(.*)")
65
+ if flag then
66
+ local var,val = flag:match("([a-z_%-]*)=(.*)")
67
+ if val then
68
+ flags[var] = val
69
+ else
70
+ flags[flag] = true
71
+ end
72
+ table.remove(args, i)
73
+ end
74
+ end
75
+ return flags, unpack(args)
76
+ end
77
+
78
+ --- Merges contents of src on top of dst's contents.
79
+ -- @param dst Destination table, which will receive src's contents.
80
+ -- @param src Table which provides new contents to dst.
81
+ -- @see platform_overrides
82
+ function deep_merge(dst, src)
83
+ for k, v in pairs(src) do
84
+ if type(v) == "table" then
85
+ if not dst[k] then
86
+ dst[k] = {}
87
+ end
88
+ if type(dst[k]) == "table" then
89
+ deep_merge(dst[k], v)
90
+ else
91
+ dst[k] = v
92
+ end
93
+ else
94
+ dst[k] = v
95
+ end
96
+ end
97
+ end
98
+
99
+ --- Perform platform-specific overrides on a table.
100
+ -- Overrides values of table with the contents of the appropriate
101
+ -- subset of its "platforms" field. The "platforms" field should
102
+ -- be a table containing subtables keyed with strings representing
103
+ -- platform names. Names that match the contents of the global
104
+ -- cfg.platforms setting are used. For example, if
105
+ -- cfg.platforms= {"foo"}, then the fields of
106
+ -- tbl.platforms.foo will overwrite those of tbl with the same
107
+ -- names. For table values, the operation is performed recursively
108
+ -- (tbl.platforms.foo.x.y.z overrides tbl.x.y.z; other contents of
109
+ -- tbl.x are preserved).
110
+ -- @param tbl table or nil: Table which may contain a "platforms" field;
111
+ -- if it doesn't (or if nil is passed), this function does nothing.
112
+ function platform_overrides(tbl)
113
+ assert(type(tbl) == "table" or not tbl)
114
+
115
+ local cfg = require("luarocks.cfg")
116
+
117
+ if not tbl then return end
118
+
119
+ if tbl.platforms then
120
+ for _, platform in ipairs(cfg.platforms) do
121
+ local platform_tbl = tbl.platforms[platform]
122
+ if platform_tbl then
123
+ deep_merge(tbl, platform_tbl)
124
+ end
125
+ end
126
+ end
127
+ tbl.platforms = nil
128
+ end
129
+
130
+ local var_format_pattern = "%$%((%a[%a%d_]+)%)"
131
+
132
+ --- Create a new shallow copy of a table: a new table with
133
+ -- the same keys and values. Keys point to the same objects as
134
+ -- the original table (ie, does not copy recursively).
135
+ -- @param tbl table: the input table
136
+ -- @return table: a new table with the same contents.
137
+ local function make_shallow_copy(tbl)
138
+ local copy = {}
139
+ for k,v in pairs(tbl) do
140
+ copy[k] = v
141
+ end
142
+ return copy
143
+ end
144
+
145
+ -- Check if a set of needed variables are referenced
146
+ -- somewhere in a list of definitions, warning the user
147
+ -- about any unused ones. Each key in needed_set should
148
+ -- appear as a $(XYZ) variable at least once as a
149
+ -- substring of some value of var_defs.
150
+ -- @param var_defs: a table with string keys and string
151
+ -- values, containing variable definitions.
152
+ -- @param needed_set: a set where keys are the names of
153
+ -- needed variables.
154
+ -- @param msg string: the warning message to display.
155
+ function warn_if_not_used(var_defs, needed_set, msg)
156
+ needed_set = make_shallow_copy(needed_set)
157
+ for var,val in pairs(var_defs) do
158
+ for used in val:gmatch(var_format_pattern) do
159
+ needed_set[used] = nil
160
+ end
161
+ end
162
+ for var,_ in pairs(needed_set) do
163
+ warning(msg:format(var))
164
+ end
165
+ end
166
+
167
+ -- Output any entries that might remain in $(XYZ) format,
168
+ -- warning the user that substitutions have failed.
169
+ -- @param line string: the input string
170
+ local function warn_failed_matches(line)
171
+ local any_failed = false
172
+ if line:match(var_format_pattern) then
173
+ for unmatched in line:gmatch(var_format_pattern) do
174
+ warning("unmatched variable " .. unmatched)
175
+ any_failed = true
176
+ end
177
+ end
178
+ return any_failed
179
+ end
180
+
181
+ --- Perform make-style variable substitutions on string values of a table.
182
+ -- For every string value tbl.x which contains a substring of the format
183
+ -- "$(XYZ)" will have this substring replaced by vars["XYZ"], if that field
184
+ -- exists in vars. Only string values are processed; this function
185
+ -- does not scan subtables recursively.
186
+ -- @param tbl table: Table to have its string values modified.
187
+ -- @param vars table: Table containing string-string key-value pairs
188
+ -- representing variables to replace in the strings values of tbl.
189
+ function variable_substitutions(tbl, vars)
190
+ assert(type(tbl) == "table")
191
+ assert(type(vars) == "table")
192
+
193
+ local updated = {}
194
+ for k, v in pairs(tbl) do
195
+ if type(v) == "string" then
196
+ updated[k] = v:gsub(var_format_pattern, vars)
197
+ if warn_failed_matches(updated[k]) then
198
+ updated[k] = updated[k]:gsub(var_format_pattern, "")
199
+ end
200
+ end
201
+ end
202
+ for k, v in pairs(updated) do
203
+ tbl[k] = v
204
+ end
205
+ end
206
+
207
+ --- Return an array of keys of a table.
208
+ -- @param tbl table: The input table.
209
+ -- @return table: The array of keys.
210
+ function keys(tbl)
211
+ local ks = {}
212
+ for k,_ in pairs(tbl) do
213
+ table.insert(ks, k)
214
+ end
215
+ return ks
216
+ end
217
+
218
+ local function default_sort(a, b)
219
+ local ta = type(a)
220
+ local tb = type(b)
221
+ if ta == "number" and tb == "number" then
222
+ return a < b
223
+ elseif ta == "number" then
224
+ return true
225
+ elseif tb == "number" then
226
+ return false
227
+ else
228
+ return tostring(a) < tostring(b)
229
+ end
230
+ end
231
+
232
+ -- The iterator function used internally by util.sortedpairs.
233
+ -- @param tbl table: The table to be iterated.
234
+ -- @param sort_function function or nil: An optional comparison function
235
+ -- to be used by table.sort when sorting keys.
236
+ -- @see sortedpairs
237
+ local function sortedpairs_iterator(tbl, sort_function)
238
+ local ks = keys(tbl)
239
+ if not sort_function or type(sort_function) == "function" then
240
+ table.sort(ks, sort_function or default_sort)
241
+ for _, k in ipairs(ks) do
242
+ coroutine.yield(k, tbl[k])
243
+ end
244
+ else
245
+ local order = sort_function
246
+ local done = {}
247
+ for _, k in ipairs(order) do
248
+ local sub_order
249
+ if type(k) == "table" then
250
+ sub_order = k[2]
251
+ k = k[1]
252
+ end
253
+ if tbl[k] then
254
+ done[k] = true
255
+ coroutine.yield(k, tbl[k], sub_order)
256
+ end
257
+ end
258
+ table.sort(ks, default_sort)
259
+ for _, k in ipairs(ks) do
260
+ if not done[k] then
261
+ coroutine.yield(k, tbl[k])
262
+ end
263
+ end
264
+ end
265
+ end
266
+
267
+ --- A table iterator generator that returns elements sorted by key,
268
+ -- to be used in "for" loops.
269
+ -- @param tbl table: The table to be iterated.
270
+ -- @param sort_function function or table or nil: An optional comparison function
271
+ -- to be used by table.sort when sorting keys, or an array listing an explicit order
272
+ -- for keys. If a value itself is an array, it is taken so that the first element
273
+ -- is a string representing the field name, and the second element is a priority table
274
+ -- for that key.
275
+ -- @return function: the iterator function.
276
+ function sortedpairs(tbl, sort_function)
277
+ return coroutine.wrap(function() sortedpairs_iterator(tbl, sort_function) end)
278
+ end
279
+
280
+ function starts_with(s, prefix)
281
+ return s:sub(1,#prefix) == prefix
282
+ end
283
+
284
+ --- Print a line to standard output
285
+ function printout(...)
286
+ io.stdout:write(table.concat({...},"\t"))
287
+ io.stdout:write("\n")
288
+ end
289
+
290
+ --- Print a line to standard error
291
+ function printerr(...)
292
+ io.stderr:write(table.concat({...},"\t"))
293
+ io.stderr:write("\n")
294
+ end
295
+
296
+ --- Display a warning message.
297
+ -- @param msg string: the warning message
298
+ function warning(msg)
299
+ printerr("Warning: "..msg)
300
+ end
301
+
302
+ -- from http://lua-users.org/wiki/SplitJoin
303
+ -- by PhilippeLhoste
304
+ function split_string(str, delim, maxNb)
305
+ -- Eliminate bad cases...
306
+ if string.find(str, delim) == nil then
307
+ return { str }
308
+ end
309
+ if maxNb == nil or maxNb < 1 then
310
+ maxNb = 0 -- No limit
311
+ end
312
+ local result = {}
313
+ local pat = "(.-)" .. delim .. "()"
314
+ local nb = 0
315
+ local lastPos
316
+ for part, pos in string.gmatch(str, pat) do
317
+ nb = nb + 1
318
+ result[nb] = part
319
+ lastPos = pos
320
+ if nb == maxNb then break end
321
+ end
322
+ -- Handle the last field
323
+ if nb ~= maxNb then
324
+ result[nb + 1] = string.sub(str, lastPos)
325
+ end
326
+ return result
327
+ end
328
+
329
+ --[[
330
+ Author: Julio Manuel Fernandez-Diaz
331
+ Date: January 12, 2007
332
+ (For Lua 5.1)
333
+
334
+ Formats tables with cycles recursively to any depth.
335
+ The output is returned as a string.
336
+ References to other tables are shown as values.
337
+ Self references are indicated.
338
+
339
+ The string returned is "Lua code", which can be procesed
340
+ (in the case in which indent is composed by spaces or "--").
341
+ Userdata and function keys and values are shown as strings,
342
+ which logically are exactly not equivalent to the original code.
343
+
344
+ This routine can serve for pretty formating tables with
345
+ proper indentations, apart from printing them:
346
+
347
+ io.write(table.show(t, "t")) -- a typical use
348
+
349
+ Heavily based on "Saving tables with cycles", PIL2, p. 113.
350
+
351
+ Arguments:
352
+ t is the table.
353
+ name is the name of the table (optional)
354
+ indent is a first indentation (optional).
355
+ --]]
356
+ function show_table(t, name, indent)
357
+ local cart -- a container
358
+ local autoref -- for self references
359
+
360
+ local function isemptytable(t) return next(t) == nil end
361
+
362
+ local function basicSerialize (o)
363
+ local so = tostring(o)
364
+ if type(o) == "function" then
365
+ local info = debug.getinfo(o, "S")
366
+ -- info.name is nil because o is not a calling level
367
+ if info.what == "C" then
368
+ return ("%q"):format(so .. ", C function")
369
+ else
370
+ -- the information is defined through lines
371
+ return ("%q"):format(so .. ", defined in (" .. info.linedefined .. "-" .. info.lastlinedefined .. ")" .. info.source)
372
+ end
373
+ elseif type(o) == "number" then
374
+ return so
375
+ else
376
+ return ("%q"):format(so)
377
+ end
378
+ end
379
+
380
+ local function addtocart (value, name, indent, saved, field)
381
+ indent = indent or ""
382
+ saved = saved or {}
383
+ field = field or name
384
+
385
+ cart = cart .. indent .. field
386
+
387
+ if type(value) ~= "table" then
388
+ cart = cart .. " = " .. basicSerialize(value) .. ";\n"
389
+ else
390
+ if saved[value] then
391
+ cart = cart .. " = {}; -- " .. saved[value] .. " (self reference)\n"
392
+ autoref = autoref .. name .. " = " .. saved[value] .. ";\n"
393
+ else
394
+ saved[value] = name
395
+ --if tablecount(value) == 0 then
396
+ if isemptytable(value) then
397
+ cart = cart .. " = {};\n"
398
+ else
399
+ cart = cart .. " = {\n"
400
+ for k, v in pairs(value) do
401
+ k = basicSerialize(k)
402
+ local fname = ("%s[%s]"):format(name, k)
403
+ field = ("[%s]"):format(k)
404
+ -- three spaces between levels
405
+ addtocart(v, fname, indent .. " ", saved, field)
406
+ end
407
+ cart = cart .. indent .. "};\n"
408
+ end
409
+ end
410
+ end
411
+ end
412
+
413
+ name = name or "__unnamed__"
414
+ if type(t) ~= "table" then
415
+ return name .. " = " .. basicSerialize(t)
416
+ end
417
+ cart, autoref = "", ""
418
+ addtocart(t, name, indent)
419
+ return cart .. autoref
420
+ end