rufus-lua-win 5.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +69 -0
- data/Rakefile +1 -0
- data/lib/rufus/lua/win.rb +18 -0
- data/lib/rufus/lua/win/version.rb +7 -0
- data/rufus-lua-win.gemspec +23 -0
- data/vendor/lua/bin/liblua.dll +0 -0
- data/vendor/lua/lib/lua/LuaXml.lua +119 -0
- data/vendor/lua/lib/lua/alien.lua +250 -0
- data/vendor/lua/lib/lua/alien/core.dll +0 -0
- data/vendor/lua/lib/lua/alien/struct.dll +0 -0
- data/vendor/lua/lib/lua/base.lua +536 -0
- data/vendor/lua/lib/lua/bin.lua +20 -0
- data/vendor/lua/lib/lua/bit.dll +0 -0
- data/vendor/lua/lib/lua/cdlua.dll +0 -0
- data/vendor/lua/lib/lua/cdluacontextplus.dll +0 -0
- data/vendor/lua/lib/lua/cdluagl.dll +0 -0
- data/vendor/lua/lib/lua/cdluaim.dll +0 -0
- data/vendor/lua/lib/lua/cdluapdf.dll +0 -0
- data/vendor/lua/lib/lua/copas.lua +543 -0
- data/vendor/lua/lib/lua/coxpcall.lua +57 -0
- data/vendor/lua/lib/lua/date.lua +745 -0
- data/vendor/lua/lib/lua/debug_ext.lua +84 -0
- data/vendor/lua/lib/lua/debug_init.lua +2 -0
- data/vendor/lua/lib/lua/des56.dll +0 -0
- data/vendor/lua/lib/lua/dist/config.lua +109 -0
- data/vendor/lua/lib/lua/dist/constraints.lua +271 -0
- data/vendor/lua/lib/lua/dist/depends.lua +601 -0
- data/vendor/lua/lib/lua/dist/git.lua +307 -0
- data/vendor/lua/lib/lua/dist/init.lua +278 -0
- data/vendor/lua/lib/lua/dist/manifest.lua +225 -0
- data/vendor/lua/lib/lua/dist/package.lua +583 -0
- data/vendor/lua/lib/lua/dist/sys.lua +367 -0
- data/vendor/lua/lib/lua/dist/utils.lua +130 -0
- data/vendor/lua/lib/lua/ex.dll +0 -0
- data/vendor/lua/lib/lua/fstable.lua +116 -0
- data/vendor/lua/lib/lua/getopt.lua +273 -0
- data/vendor/lua/lib/lua/git.lua +5 -0
- data/vendor/lua/lib/lua/git/core.dll +0 -0
- data/vendor/lua/lib/lua/git/objects.lua +121 -0
- data/vendor/lua/lib/lua/git/pack.lua +316 -0
- data/vendor/lua/lib/lua/git/protocol.lua +188 -0
- data/vendor/lua/lib/lua/git/repo.lua +283 -0
- data/vendor/lua/lib/lua/git/util.lua +233 -0
- data/vendor/lua/lib/lua/gzio.dll +0 -0
- data/vendor/lua/lib/lua/gzip.lua +81 -0
- data/vendor/lua/lib/lua/iconv.dll +0 -0
- data/vendor/lua/lib/lua/imlua.dll +0 -0
- data/vendor/lua/lib/lua/imlua_fftw.dll +0 -0
- data/vendor/lua/lib/lua/imlua_jp2.dll +0 -0
- data/vendor/lua/lib/lua/imlua_process.dll +0 -0
- data/vendor/lua/lib/lua/imlua_process_omp.dll +0 -0
- data/vendor/lua/lib/lua/io_ext.lua +115 -0
- data/vendor/lua/lib/lua/iuplua.dll +0 -0
- data/vendor/lua/lib/lua/iuplua_mglplot.dll +0 -0
- data/vendor/lua/lib/lua/iuplua_pplot.dll +0 -0
- data/vendor/lua/lib/lua/iupluacd.dll +0 -0
- data/vendor/lua/lib/lua/iupluacontrols.dll +0 -0
- data/vendor/lua/lib/lua/iupluagl.dll +0 -0
- data/vendor/lua/lib/lua/iupluaim.dll +0 -0
- data/vendor/lua/lib/lua/iupluaimglib.dll +0 -0
- data/vendor/lua/lib/lua/iupluatuio.dll +0 -0
- data/vendor/lua/lib/lua/lanes-keeper.lua +302 -0
- data/vendor/lua/lib/lua/lanes.lua +591 -0
- data/vendor/lua/lib/lua/lanes/core.dll +0 -0
- data/vendor/lua/lib/lua/lcs.lua +55 -0
- data/vendor/lua/lib/lua/lemock.lua +659 -0
- data/vendor/lua/lib/lua/lfs.dll +0 -0
- data/vendor/lua/lib/lua/list.lua +375 -0
- data/vendor/lua/lib/lua/logging.lua +189 -0
- data/vendor/lua/lib/lua/logging/console.lua +22 -0
- data/vendor/lua/lib/lua/logging/email.lua +44 -0
- data/vendor/lua/lib/lua/logging/file.lua +55 -0
- data/vendor/lua/lib/lua/logging/rolling_file.lua +81 -0
- data/vendor/lua/lib/lua/logging/socket.lua +35 -0
- data/vendor/lua/lib/lua/logging/sql.lua +64 -0
- data/vendor/lua/lib/lua/loop/base.lua +68 -0
- data/vendor/lua/lib/lua/loop/cached.lua +312 -0
- data/vendor/lua/lib/lua/loop/collection/MapWithArrayOfKeys.lua +64 -0
- data/vendor/lua/lib/lua/loop/collection/ObjectCache.lua +39 -0
- data/vendor/lua/lib/lua/loop/collection/OrderedSet.lua +164 -0
- data/vendor/lua/lib/lua/loop/collection/PriorityQueue.lua +86 -0
- data/vendor/lua/lib/lua/loop/collection/UnorderedArray.lua +32 -0
- data/vendor/lua/lib/lua/loop/collection/UnorderedArraySet.lua +56 -0
- data/vendor/lua/lib/lua/loop/compiler/Arguments.lua +108 -0
- data/vendor/lua/lib/lua/loop/compiler/Conditional.lua +50 -0
- data/vendor/lua/lib/lua/loop/compiler/Expression.lua +215 -0
- data/vendor/lua/lib/lua/loop/component/base.lua +221 -0
- data/vendor/lua/lib/lua/loop/component/contained.lua +71 -0
- data/vendor/lua/lib/lua/loop/component/dynamic.lua +223 -0
- data/vendor/lua/lib/lua/loop/component/intercepted.lua +354 -0
- data/vendor/lua/lib/lua/loop/component/wrapped.lua +195 -0
- data/vendor/lua/lib/lua/loop/debug/Inspector.lua +521 -0
- data/vendor/lua/lib/lua/loop/debug/Matcher.lua +192 -0
- data/vendor/lua/lib/lua/loop/debug/Verbose.lua +266 -0
- data/vendor/lua/lib/lua/loop/debug/Viewer.lua +200 -0
- data/vendor/lua/lib/lua/loop/multiple.lua +105 -0
- data/vendor/lua/lib/lua/loop/object/Exception.lua +57 -0
- data/vendor/lua/lib/lua/loop/object/Publisher.lua +43 -0
- data/vendor/lua/lib/lua/loop/object/Wrapper.lua +39 -0
- data/vendor/lua/lib/lua/loop/scoped.lua +585 -0
- data/vendor/lua/lib/lua/loop/serial/FileStream.lua +48 -0
- data/vendor/lua/lib/lua/loop/serial/Serializer.lua +291 -0
- data/vendor/lua/lib/lua/loop/serial/SocketStream.lua +51 -0
- data/vendor/lua/lib/lua/loop/serial/StringStream.lua +47 -0
- data/vendor/lua/lib/lua/loop/simple.lua +75 -0
- data/vendor/lua/lib/lua/loop/table.lua +71 -0
- data/vendor/lua/lib/lua/loop/thread/CoSocket.lua +416 -0
- data/vendor/lua/lib/lua/loop/thread/IOScheduler.lua +170 -0
- data/vendor/lua/lib/lua/loop/thread/Scheduler.lua +327 -0
- data/vendor/lua/lib/lua/loop/thread/SocketScheduler.lua +88 -0
- data/vendor/lua/lib/lua/loop/thread/Timer.lua +54 -0
- data/vendor/lua/lib/lua/lpeg.dll +0 -0
- data/vendor/lua/lib/lua/ltn12.lua +292 -0
- data/vendor/lua/lib/lua/luaXML_lib.dll +0 -0
- data/vendor/lua/lib/lua/luacurl.dll +0 -0
- data/vendor/lua/lib/lua/luadoc/config.lua +34 -0
- data/vendor/lua/lib/lua/luadoc/doclet/debug.lua +46 -0
- data/vendor/lua/lib/lua/luadoc/doclet/formatter.lua +84 -0
- data/vendor/lua/lib/lua/luadoc/doclet/html.lua +289 -0
- data/vendor/lua/lib/lua/luadoc/doclet/html/file.lp +113 -0
- data/vendor/lua/lib/lua/luadoc/doclet/html/function.lp +64 -0
- data/vendor/lua/lib/lua/luadoc/doclet/html/index.lp +70 -0
- data/vendor/lua/lib/lua/luadoc/doclet/html/luadoc.css +286 -0
- data/vendor/lua/lib/lua/luadoc/doclet/html/menu.lp +55 -0
- data/vendor/lua/lib/lua/luadoc/doclet/html/module.lp +109 -0
- data/vendor/lua/lib/lua/luadoc/doclet/html/table.lp +15 -0
- data/vendor/lua/lib/lua/luadoc/doclet/raw.lua +12 -0
- data/vendor/lua/lib/lua/luadoc/init.lua +58 -0
- data/vendor/lua/lib/lua/luadoc/lp.lua +130 -0
- data/vendor/lua/lib/lua/luadoc/taglet/standard.lua +495 -0
- data/vendor/lua/lib/lua/luadoc/taglet/standard/tags.lua +171 -0
- data/vendor/lua/lib/lua/luadoc/util.lua +233 -0
- data/vendor/lua/lib/lua/luagl.dll +0 -0
- data/vendor/lua/lib/lua/luaglu.dll +0 -0
- data/vendor/lua/lib/lua/luaidl.lua +113 -0
- data/vendor/lua/lib/lua/luaidl/lex.lua +793 -0
- data/vendor/lua/lib/lua/luaidl/pre.lua +149 -0
- data/vendor/lua/lib/lua/luaidl/sin.lua +3631 -0
- data/vendor/lua/lib/lua/luarocks/add.lua +108 -0
- data/vendor/lua/lib/lua/luarocks/admin_remove.lua +87 -0
- data/vendor/lua/lib/lua/luarocks/build.lua +330 -0
- data/vendor/lua/lib/lua/luarocks/build/builtin.lua +253 -0
- data/vendor/lua/lib/lua/luarocks/build/cmake.lua +54 -0
- data/vendor/lua/lib/lua/luarocks/build/command.lua +32 -0
- data/vendor/lua/lib/lua/luarocks/build/make.lua +92 -0
- data/vendor/lua/lib/lua/luarocks/cache.lua +85 -0
- data/vendor/lua/lib/lua/luarocks/cfg.lua +449 -0
- data/vendor/lua/lib/lua/luarocks/command_line.lua +163 -0
- data/vendor/lua/lib/lua/luarocks/deps.lua +654 -0
- data/vendor/lua/lib/lua/luarocks/dir.lua +69 -0
- data/vendor/lua/lib/lua/luarocks/download.lua +90 -0
- data/vendor/lua/lib/lua/luarocks/fetch.lua +321 -0
- data/vendor/lua/lib/lua/luarocks/fetch/cvs.lua +44 -0
- data/vendor/lua/lib/lua/luarocks/fetch/git.lua +81 -0
- data/vendor/lua/lib/lua/luarocks/fetch/git_file.lua +17 -0
- data/vendor/lua/lib/lua/luarocks/fetch/hg.lua +54 -0
- data/vendor/lua/lib/lua/luarocks/fetch/sscm.lua +42 -0
- data/vendor/lua/lib/lua/luarocks/fetch/svn.lua +53 -0
- data/vendor/lua/lib/lua/luarocks/fs.lua +40 -0
- data/vendor/lua/lib/lua/luarocks/fs/lua.lua +676 -0
- data/vendor/lua/lib/lua/luarocks/fs/unix.lua +88 -0
- data/vendor/lua/lib/lua/luarocks/fs/unix/tools.lua +325 -0
- data/vendor/lua/lib/lua/luarocks/fs/win32.lua +107 -0
- data/vendor/lua/lib/lua/luarocks/fs/win32/tools.lua +334 -0
- data/vendor/lua/lib/lua/luarocks/help.lua +101 -0
- data/vendor/lua/lib/lua/luarocks/index.lua +172 -0
- data/vendor/lua/lib/lua/luarocks/install.lua +151 -0
- data/vendor/lua/lib/lua/luarocks/list.lua +35 -0
- data/vendor/lua/lib/lua/luarocks/loader.lua +228 -0
- data/vendor/lua/lib/lua/luarocks/make.lua +71 -0
- data/vendor/lua/lib/lua/luarocks/make_manifest.lua +34 -0
- data/vendor/lua/lib/lua/luarocks/manif.lua +360 -0
- data/vendor/lua/lib/lua/luarocks/manif_core.lua +75 -0
- data/vendor/lua/lib/lua/luarocks/new_version.lua +141 -0
- data/vendor/lua/lib/lua/luarocks/pack.lua +205 -0
- data/vendor/lua/lib/lua/luarocks/path.lua +315 -0
- data/vendor/lua/lib/lua/luarocks/persist.lua +173 -0
- data/vendor/lua/lib/lua/luarocks/refresh_cache.lua +30 -0
- data/vendor/lua/lib/lua/luarocks/remove.lua +135 -0
- data/vendor/lua/lib/lua/luarocks/rep.lua +313 -0
- data/vendor/lua/lib/lua/luarocks/require.lua +6 -0
- data/vendor/lua/lib/lua/luarocks/search.lua +399 -0
- data/vendor/lua/lib/lua/luarocks/show.lua +138 -0
- data/vendor/lua/lib/lua/luarocks/site_config.lua +23 -0
- data/vendor/lua/lib/lua/luarocks/tools/patch.lua +712 -0
- data/vendor/lua/lib/lua/luarocks/tools/tar.lua +144 -0
- data/vendor/lua/lib/lua/luarocks/tools/zip.lua +245 -0
- data/vendor/lua/lib/lua/luarocks/type_check.lua +267 -0
- data/vendor/lua/lib/lua/luarocks/unpack.lua +151 -0
- data/vendor/lua/lib/lua/luarocks/util.lua +420 -0
- data/vendor/lua/lib/lua/luarocks/validate.lua +164 -0
- data/vendor/lua/lib/lua/luars232.dll +0 -0
- data/vendor/lua/lib/lua/luasql/mysql.dll +0 -0
- data/vendor/lua/lib/lua/luasql/postgres.dll +0 -0
- data/vendor/lua/lib/lua/luasql/sqlite3.dll +0 -0
- data/vendor/lua/lib/lua/luaunit.lua +601 -0
- data/vendor/lua/lib/lua/lxp.dll +0 -0
- data/vendor/lua/lib/lua/lxp/lom.lua +60 -0
- data/vendor/lua/lib/lua/math_ext.lua +27 -0
- data/vendor/lua/lib/lua/mbox.lua +53 -0
- data/vendor/lua/lib/lua/md5.lua +19 -0
- data/vendor/lua/lib/lua/md5/core.dll +0 -0
- data/vendor/lua/lib/lua/metalua.lua +0 -0
- data/vendor/lua/lib/lua/metalua/ast_to_string.mlua +553 -0
- data/vendor/lua/lib/lua/metalua/base.lua +104 -0
- data/vendor/lua/lib/lua/metalua/bytecode.lua +0 -0
- data/vendor/lua/lib/lua/metalua/clopts.mlua +204 -0
- data/vendor/lua/lib/lua/metalua/compiler.lua +3 -0
- data/vendor/lua/lib/lua/metalua/dollar.mlua +24 -0
- data/vendor/lua/lib/lua/metalua/extension/H-runtime.mlua +216 -0
- data/vendor/lua/lib/lua/metalua/extension/H.mlua +22 -0
- data/vendor/lua/lib/lua/metalua/extension/anaphoric.mlua +54 -0
- data/vendor/lua/lib/lua/metalua/extension/clist.mlua +149 -0
- data/vendor/lua/lib/lua/metalua/extension/continue.mlua +53 -0
- data/vendor/lua/lib/lua/metalua/extension/localin.mlua +2 -0
- data/vendor/lua/lib/lua/metalua/extension/log.mlua +39 -0
- data/vendor/lua/lib/lua/metalua/extension/match.mlua +374 -0
- data/vendor/lua/lib/lua/metalua/extension/ternary.mlua +10 -0
- data/vendor/lua/lib/lua/metalua/extension/trycatch.mlua +189 -0
- data/vendor/lua/lib/lua/metalua/extension/types-runtime.mlua +159 -0
- data/vendor/lua/lib/lua/metalua/extension/types.mlua +352 -0
- data/vendor/lua/lib/lua/metalua/extension/withdo.mlua +30 -0
- data/vendor/lua/lib/lua/metalua/extension/xglobal-runtime.lua +41 -0
- data/vendor/lua/lib/lua/metalua/extension/xglobal.mlua +20 -0
- data/vendor/lua/lib/lua/metalua/extension/xloop.mlua +100 -0
- data/vendor/lua/lib/lua/metalua/extension/xmatch.mlua +216 -0
- data/vendor/lua/lib/lua/metalua/metaloop.mlua +76 -0
- data/vendor/lua/lib/lua/metalua/mlc.lua +0 -0
- data/vendor/lua/lib/lua/metalua/mlc_xcall.lua +119 -0
- data/vendor/lua/lib/lua/metalua/mlp.lua +0 -0
- data/vendor/lua/lib/lua/metalua/package2.lua +101 -0
- data/vendor/lua/lib/lua/metalua/runtime.lua +3 -0
- data/vendor/lua/lib/lua/metalua/string2.lua +44 -0
- data/vendor/lua/lib/lua/metalua/table2.lua +372 -0
- data/vendor/lua/lib/lua/metalua/walk.mlua +304 -0
- data/vendor/lua/lib/lua/metalua/walk/bindings.mlua +41 -0
- data/vendor/lua/lib/lua/metalua/walk/id.mlua +186 -0
- data/vendor/lua/lib/lua/metalua/walk/scope.lua +54 -0
- data/vendor/lua/lib/lua/mime.lua +87 -0
- data/vendor/lua/lib/lua/mime/core.dll +0 -0
- data/vendor/lua/lib/lua/mobdebug.lua +1484 -0
- data/vendor/lua/lib/lua/modules.lua +16 -0
- data/vendor/lua/lib/lua/object.lua +56 -0
- data/vendor/lua/lib/lua/oil/Exception.lua +26 -0
- data/vendor/lua/lib/lua/oil/arch.lua +27 -0
- data/vendor/lua/lib/lua/oil/arch/basic/client.lua +29 -0
- data/vendor/lua/lib/lua/oil/arch/basic/common.lua +13 -0
- data/vendor/lua/lib/lua/oil/arch/basic/server.lua +27 -0
- data/vendor/lua/lib/lua/oil/arch/cooperative/common.lua +10 -0
- data/vendor/lua/lib/lua/oil/arch/cooperative/server.lua +16 -0
- data/vendor/lua/lib/lua/oil/arch/corba/client.lua +39 -0
- data/vendor/lua/lib/lua/oil/arch/corba/common.lua +58 -0
- data/vendor/lua/lib/lua/oil/arch/corba/intercepted/client.lua +9 -0
- data/vendor/lua/lib/lua/oil/arch/corba/intercepted/server.lua +9 -0
- data/vendor/lua/lib/lua/oil/arch/corba/server.lua +35 -0
- data/vendor/lua/lib/lua/oil/arch/ludo/byref.lua +18 -0
- data/vendor/lua/lib/lua/oil/arch/ludo/client.lua +19 -0
- data/vendor/lua/lib/lua/oil/arch/ludo/common.lua +18 -0
- data/vendor/lua/lib/lua/oil/arch/ludo/server.lua +19 -0
- data/vendor/lua/lib/lua/oil/arch/typed/client.lua +27 -0
- data/vendor/lua/lib/lua/oil/arch/typed/common.lua +9 -0
- data/vendor/lua/lib/lua/oil/arch/typed/server.lua +18 -0
- data/vendor/lua/lib/lua/oil/assert.lua +87 -0
- data/vendor/lua/lib/lua/oil/builder.lua +45 -0
- data/vendor/lua/lib/lua/oil/builder/basic/client.lua +31 -0
- data/vendor/lua/lib/lua/oil/builder/basic/common.lua +11 -0
- data/vendor/lua/lib/lua/oil/builder/basic/server.lua +13 -0
- data/vendor/lua/lib/lua/oil/builder/cooperative/common.lua +11 -0
- data/vendor/lua/lib/lua/oil/builder/cooperative/server.lua +11 -0
- data/vendor/lua/lib/lua/oil/builder/corba/client.lua +13 -0
- data/vendor/lua/lib/lua/oil/builder/corba/common.lua +24 -0
- data/vendor/lua/lib/lua/oil/builder/corba/gencode.lua +13 -0
- data/vendor/lua/lib/lua/oil/builder/corba/intercepted/client.lua +11 -0
- data/vendor/lua/lib/lua/oil/builder/corba/intercepted/server.lua +11 -0
- data/vendor/lua/lib/lua/oil/builder/corba/server.lua +13 -0
- data/vendor/lua/lib/lua/oil/builder/lua/client.lua +11 -0
- data/vendor/lua/lib/lua/oil/builder/lua/server.lua +12 -0
- data/vendor/lua/lib/lua/oil/builder/ludo/byref.lua +13 -0
- data/vendor/lua/lib/lua/oil/builder/ludo/client.lua +13 -0
- data/vendor/lua/lib/lua/oil/builder/ludo/common.lua +14 -0
- data/vendor/lua/lib/lua/oil/builder/ludo/server.lua +13 -0
- data/vendor/lua/lib/lua/oil/builder/typed/client.lua +16 -0
- data/vendor/lua/lib/lua/oil/builder/typed/server.lua +12 -0
- data/vendor/lua/lib/lua/oil/compat.lua +846 -0
- data/vendor/lua/lib/lua/oil/component.lua +1 -0
- data/vendor/lua/lib/lua/oil/corba/giop.lua +301 -0
- data/vendor/lua/lib/lua/oil/corba/giop/Codec.lua +1568 -0
- data/vendor/lua/lib/lua/oil/corba/giop/CodecGen.lua +589 -0
- data/vendor/lua/lib/lua/oil/corba/giop/Exception.lua +25 -0
- data/vendor/lua/lib/lua/oil/corba/giop/Indexer.lua +63 -0
- data/vendor/lua/lib/lua/oil/corba/giop/Listener.lua +343 -0
- data/vendor/lua/lib/lua/oil/corba/giop/Messenger.lua +228 -0
- data/vendor/lua/lib/lua/oil/corba/giop/Referrer.lua +180 -0
- data/vendor/lua/lib/lua/oil/corba/giop/Requester.lua +462 -0
- data/vendor/lua/lib/lua/oil/corba/idl.lua +597 -0
- data/vendor/lua/lib/lua/oil/corba/idl/Compiler.lua +133 -0
- data/vendor/lua/lib/lua/oil/corba/idl/Importer.lua +235 -0
- data/vendor/lua/lib/lua/oil/corba/idl/Indexer.lua +95 -0
- data/vendor/lua/lib/lua/oil/corba/idl/Registry.lua +1821 -0
- data/vendor/lua/lib/lua/oil/corba/idl/ir.lua +847 -0
- data/vendor/lua/lib/lua/oil/corba/idl/sysex.lua +21 -0
- data/vendor/lua/lib/lua/oil/corba/iiop/Profiler.lua +200 -0
- data/vendor/lua/lib/lua/oil/corba/intercepted/Listener.lua +158 -0
- data/vendor/lua/lib/lua/oil/corba/intercepted/Requester.lua +181 -0
- data/vendor/lua/lib/lua/oil/corba/services/event.lua +126 -0
- data/vendor/lua/lib/lua/oil/corba/services/event/ConsumerAdmin.lua +50 -0
- data/vendor/lua/lib/lua/oil/corba/services/event/EventFactory.lua +15 -0
- data/vendor/lua/lib/lua/oil/corba/services/event/EventQueue.lua +37 -0
- data/vendor/lua/lib/lua/oil/corba/services/event/ProxyPushConsumer.lua +75 -0
- data/vendor/lua/lib/lua/oil/corba/services/event/ProxyPushSupplier.lua +62 -0
- data/vendor/lua/lib/lua/oil/corba/services/event/SingleDeferredDispatcher.lua +60 -0
- data/vendor/lua/lib/lua/oil/corba/services/event/SingleSynchronousDispatcher.lua +39 -0
- data/vendor/lua/lib/lua/oil/corba/services/event/SupplierAdmin.lua +50 -0
- data/vendor/lua/lib/lua/oil/corba/services/naming.lua +436 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Acceptor.lua +268 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Channels.lua +121 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Connector.lua +147 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Dispatcher.lua +99 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Proxies.lua +86 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Proxies/asynchronous.lua +56 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Proxies/protected.lua +17 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Proxies/synchronous.lua +17 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Proxies/utils.lua +29 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Receiver.lua +110 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Servants.lua +207 -0
- data/vendor/lua/lib/lua/oil/kernel/base/Sockets.lua +44 -0
- data/vendor/lua/lib/lua/oil/kernel/cooperative/Receiver.lua +139 -0
- data/vendor/lua/lib/lua/oil/kernel/intercepted/Listener.lua +47 -0
- data/vendor/lua/lib/lua/oil/kernel/intercepted/Requester.lua +58 -0
- data/vendor/lua/lib/lua/oil/kernel/lua/Dispatcher.lua +76 -0
- data/vendor/lua/lib/lua/oil/kernel/lua/Proxies.lua +69 -0
- data/vendor/lua/lib/lua/oil/kernel/typed/Dispatcher.lua +91 -0
- data/vendor/lua/lib/lua/oil/kernel/typed/Proxies.lua +153 -0
- data/vendor/lua/lib/lua/oil/kernel/typed/Servants.lua +137 -0
- data/vendor/lua/lib/lua/oil/ludo/Codec.lua +66 -0
- data/vendor/lua/lib/lua/oil/ludo/CodecByRef.lua +103 -0
- data/vendor/lua/lib/lua/oil/ludo/Listener.lua +151 -0
- data/vendor/lua/lib/lua/oil/ludo/Referrer.lua +72 -0
- data/vendor/lua/lib/lua/oil/ludo/Requester.lua +107 -0
- data/vendor/lua/lib/lua/oil/oo.lua +1 -0
- data/vendor/lua/lib/lua/oil/port.lua +1 -0
- data/vendor/lua/lib/lua/oil/properties.lua +57 -0
- data/vendor/lua/lib/lua/oil/verbose.lua +133 -0
- data/vendor/lua/lib/lua/package_ext.lua +15 -0
- data/vendor/lua/lib/lua/parser.lua +268 -0
- data/vendor/lua/lib/lua/pl/Date.lua +555 -0
- data/vendor/lua/lib/lua/pl/List.lua +613 -0
- data/vendor/lua/lib/lua/pl/Map.lua +113 -0
- data/vendor/lua/lib/lua/pl/MultiMap.lua +62 -0
- data/vendor/lua/lib/lua/pl/OrderedMap.lua +151 -0
- data/vendor/lua/lib/lua/pl/Set.lua +153 -0
- data/vendor/lua/lib/lua/pl/app.lua +165 -0
- data/vendor/lua/lib/lua/pl/array2d.lua +501 -0
- data/vendor/lua/lib/lua/pl/class.lua +180 -0
- data/vendor/lua/lib/lua/pl/comprehension.lua +286 -0
- data/vendor/lua/lib/lua/pl/config.lua +176 -0
- data/vendor/lua/lib/lua/pl/data.lua +606 -0
- data/vendor/lua/lib/lua/pl/dir.lua +475 -0
- data/vendor/lua/lib/lua/pl/file.lua +70 -0
- data/vendor/lua/lib/lua/pl/func.lua +376 -0
- data/vendor/lua/lib/lua/pl/init.lua +68 -0
- data/vendor/lua/lib/lua/pl/input.lua +173 -0
- data/vendor/lua/lib/lua/pl/lapp.lua +407 -0
- data/vendor/lua/lib/lua/pl/lexer.lua +456 -0
- data/vendor/lua/lib/lua/pl/luabalanced.lua +264 -0
- data/vendor/lua/lib/lua/pl/operator.lua +201 -0
- data/vendor/lua/lib/lua/pl/path.lua +398 -0
- data/vendor/lua/lib/lua/pl/permute.lua +63 -0
- data/vendor/lua/lib/lua/pl/platf/luajava.lua +101 -0
- data/vendor/lua/lib/lua/pl/pretty.lua +285 -0
- data/vendor/lua/lib/lua/pl/seq.lua +551 -0
- data/vendor/lua/lib/lua/pl/sip.lua +344 -0
- data/vendor/lua/lib/lua/pl/strict.lua +70 -0
- data/vendor/lua/lib/lua/pl/stringio.lua +158 -0
- data/vendor/lua/lib/lua/pl/stringx.lua +440 -0
- data/vendor/lua/lib/lua/pl/tablex.lua +817 -0
- data/vendor/lua/lib/lua/pl/template.lua +103 -0
- data/vendor/lua/lib/lua/pl/test.lua +135 -0
- data/vendor/lua/lib/lua/pl/text.lua +243 -0
- data/vendor/lua/lib/lua/pl/utils.lua +550 -0
- data/vendor/lua/lib/lua/pl/xml.lua +689 -0
- data/vendor/lua/lib/lua/profiler.dll +0 -0
- data/vendor/lua/lib/lua/re.lua +248 -0
- data/vendor/lua/lib/lua/rex_onig.dll +0 -0
- data/vendor/lua/lib/lua/rex_pcre.dll +0 -0
- data/vendor/lua/lib/lua/rex_posix.dll +0 -0
- data/vendor/lua/lib/lua/rings.dll +0 -0
- data/vendor/lua/lib/lua/serialize.lua +193 -0
- data/vendor/lua/lib/lua/set.lua +149 -0
- data/vendor/lua/lib/lua/socket.lua +133 -0
- data/vendor/lua/lib/lua/socket/core.dll +0 -0
- data/vendor/lua/lib/lua/socket/ftp.lua +281 -0
- data/vendor/lua/lib/lua/socket/http.lua +350 -0
- data/vendor/lua/lib/lua/socket/smtp.lua +251 -0
- data/vendor/lua/lib/lua/socket/tp.lua +123 -0
- data/vendor/lua/lib/lua/socket/url.lua +297 -0
- data/vendor/lua/lib/lua/ssl.dll +0 -0
- data/vendor/lua/lib/lua/ssl.lua +93 -0
- data/vendor/lua/lib/lua/ssl/https.lua +138 -0
- data/vendor/lua/lib/lua/stable.lua +28 -0
- data/vendor/lua/lib/lua/std.lua +16 -0
- data/vendor/lua/lib/lua/strbuf.lua +32 -0
- data/vendor/lua/lib/lua/strict.lua +45 -0
- data/vendor/lua/lib/lua/string_ext.lua +274 -0
- data/vendor/lua/lib/lua/table_ext.lua +117 -0
- data/vendor/lua/lib/lua/tar.lua +262 -0
- data/vendor/lua/lib/lua/task.dll +0 -0
- data/vendor/lua/lib/lua/tree.lua +81 -0
- data/vendor/lua/lib/lua/unicode.dll +0 -0
- data/vendor/lua/lib/lua/verbose_require.lua +11 -0
- data/vendor/lua/lib/lua/vstruct.lua +86 -0
- data/vendor/lua/lib/lua/vstruct/ast.lua +192 -0
- data/vendor/lua/lib/lua/vstruct/ast/Bitpack.lua +33 -0
- data/vendor/lua/lib/lua/vstruct/ast/Generator.lua +174 -0
- data/vendor/lua/lib/lua/vstruct/ast/IO.lua +45 -0
- data/vendor/lua/lib/lua/vstruct/ast/List.lua +56 -0
- data/vendor/lua/lib/lua/vstruct/ast/Name.lua +20 -0
- data/vendor/lua/lib/lua/vstruct/ast/Repeat.lua +23 -0
- data/vendor/lua/lib/lua/vstruct/ast/Root.lua +19 -0
- data/vendor/lua/lib/lua/vstruct/ast/Table.lua +65 -0
- data/vendor/lua/lib/lua/vstruct/cursor.lua +81 -0
- data/vendor/lua/lib/lua/vstruct/io.lua +45 -0
- data/vendor/lua/lib/lua/vstruct/io/a.lua +24 -0
- data/vendor/lua/lib/lua/vstruct/io/b.lua +28 -0
- data/vendor/lua/lib/lua/vstruct/io/bigendian.lua +21 -0
- data/vendor/lua/lib/lua/vstruct/io/c.lua +25 -0
- data/vendor/lua/lib/lua/vstruct/io/defaults.lua +24 -0
- data/vendor/lua/lib/lua/vstruct/io/endianness.lua +41 -0
- data/vendor/lua/lib/lua/vstruct/io/f.lua +129 -0
- data/vendor/lua/lib/lua/vstruct/io/hostendian.lua +21 -0
- data/vendor/lua/lib/lua/vstruct/io/i.lua +42 -0
- data/vendor/lua/lib/lua/vstruct/io/littleendian.lua +21 -0
- data/vendor/lua/lib/lua/vstruct/io/m.lua +62 -0
- data/vendor/lua/lib/lua/vstruct/io/p.lua +23 -0
- data/vendor/lua/lib/lua/vstruct/io/s.lua +27 -0
- data/vendor/lua/lib/lua/vstruct/io/seekb.lua +18 -0
- data/vendor/lua/lib/lua/vstruct/io/seekf.lua +18 -0
- data/vendor/lua/lib/lua/vstruct/io/seekto.lua +18 -0
- data/vendor/lua/lib/lua/vstruct/io/u.lua +54 -0
- data/vendor/lua/lib/lua/vstruct/io/x.lua +34 -0
- data/vendor/lua/lib/lua/vstruct/io/z.lua +63 -0
- data/vendor/lua/lib/lua/vstruct/lexer.lua +100 -0
- data/vendor/lua/lib/lua/vstruct/pack.lua +142 -0
- data/vendor/lua/lib/lua/vstruct/test.lua +47 -0
- data/vendor/lua/lib/lua/vstruct/test/basic.lua +73 -0
- data/vendor/lua/lib/lua/vstruct/test/common.lua +100 -0
- data/vendor/lua/lib/lua/vstruct/test/fp-bigendian.lua +56 -0
- data/vendor/lua/lib/lua/vstruct/test/fp-littleendian.lua +56 -0
- data/vendor/lua/lib/lua/vstruct/test/struct-test-gen.lua +1230 -0
- data/vendor/lua/lib/lua/vstruct/unpack.lua +126 -0
- data/vendor/lua/lib/lua/wx.dll +0 -0
- data/vendor/lua/lib/lua/xml.lua +75 -0
- data/vendor/lua/lib/lua/zip.dll +0 -0
- data/vendor/lua/lib/lua/zlib.dll +0 -0
- metadata +529 -0
@@ -0,0 +1,149 @@
|
|
1
|
+
-- Set datatype.
|
2
|
+
module ("set", package.seeall)
|
3
|
+
|
4
|
+
require "list"
|
5
|
+
|
6
|
+
|
7
|
+
-- Primitive methods (know about representation)
|
8
|
+
-- The representation is a table whose tags are the elements, and
|
9
|
+
-- whose values are true.
|
10
|
+
|
11
|
+
--- Say whether an element is in a set
|
12
|
+
-- @param s set
|
13
|
+
-- @param e element
|
14
|
+
-- @return <code>true</code> if e is in set, <code>false</code>
|
15
|
+
-- otherwise
|
16
|
+
function member (s, e)
|
17
|
+
return rawget (s.contents, e) == true
|
18
|
+
end
|
19
|
+
|
20
|
+
--- Insert an element into a set
|
21
|
+
-- @param s set
|
22
|
+
-- @param e element
|
23
|
+
function insert (s, e)
|
24
|
+
rawset (s.contents, e, true)
|
25
|
+
end
|
26
|
+
|
27
|
+
--- Delete an element from a set
|
28
|
+
-- @param s set
|
29
|
+
-- @param e element
|
30
|
+
function delete (s, e)
|
31
|
+
rawset (s.contents, e, nil)
|
32
|
+
end
|
33
|
+
|
34
|
+
--- Make a list into a set
|
35
|
+
-- @param l list
|
36
|
+
-- @return set
|
37
|
+
local metatable = {}
|
38
|
+
function new (l)
|
39
|
+
local s = setmetatable ({contents={}}, metatable)
|
40
|
+
for e in list.elems (l) do
|
41
|
+
insert (s, e)
|
42
|
+
end
|
43
|
+
return s
|
44
|
+
end
|
45
|
+
|
46
|
+
--- Iterator for sets
|
47
|
+
-- TODO: Make the iterator return only the key
|
48
|
+
elems = pairs
|
49
|
+
|
50
|
+
|
51
|
+
-- High level methods (representation-independent)
|
52
|
+
|
53
|
+
--- Find the difference of two sets
|
54
|
+
-- @param s set
|
55
|
+
-- @param t set
|
56
|
+
-- @return s with elements of t removed
|
57
|
+
function difference (s, t)
|
58
|
+
local r = new {}
|
59
|
+
for e in elems (s) do
|
60
|
+
if not member (t, e) then
|
61
|
+
insert (r, e)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
return r
|
65
|
+
end
|
66
|
+
|
67
|
+
--- Find the symmetric difference of two sets
|
68
|
+
-- @param s set
|
69
|
+
-- @param t set
|
70
|
+
-- @return elements of s and t that are in s or t but not both
|
71
|
+
function symmetric_difference (s, t)
|
72
|
+
return difference (union (s, t), intersection (t, s))
|
73
|
+
end
|
74
|
+
|
75
|
+
--- Find the intersection of two sets
|
76
|
+
-- @param s set
|
77
|
+
-- @param t set
|
78
|
+
-- @return set intersection of s and t
|
79
|
+
function intersection (s, t)
|
80
|
+
local r = new {}
|
81
|
+
for e in elems (s) do
|
82
|
+
if member (t, e) then
|
83
|
+
insert (r, e)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
return r
|
87
|
+
end
|
88
|
+
|
89
|
+
--- Find the union of two sets
|
90
|
+
-- @param s set
|
91
|
+
-- @param t set
|
92
|
+
-- @return set union of s and t
|
93
|
+
function union (s, t)
|
94
|
+
local r = new {}
|
95
|
+
for e in elems (s) do
|
96
|
+
insert (r, e)
|
97
|
+
end
|
98
|
+
for e in elems (t) do
|
99
|
+
insert (r, e)
|
100
|
+
end
|
101
|
+
return r
|
102
|
+
end
|
103
|
+
|
104
|
+
--- Find whether one set is a subset of another
|
105
|
+
-- @param s set
|
106
|
+
-- @param t set
|
107
|
+
-- @return <code>true</code> if s is a subset of t, <code>false</code>
|
108
|
+
-- otherwise
|
109
|
+
function subset (s, t)
|
110
|
+
for e in elems (s) do
|
111
|
+
if not member (t, e) then
|
112
|
+
return false
|
113
|
+
end
|
114
|
+
end
|
115
|
+
return true
|
116
|
+
end
|
117
|
+
|
118
|
+
--- Find whether one set is a proper subset of another
|
119
|
+
-- @param s set
|
120
|
+
-- @param t set
|
121
|
+
-- @return <code>true</code> if s is a proper subset of t, false otherwise
|
122
|
+
function propersubset (s, t)
|
123
|
+
return subset (s, t) and not subset (t, s)
|
124
|
+
end
|
125
|
+
|
126
|
+
--- Find whether two sets are equal
|
127
|
+
-- @param s set
|
128
|
+
-- @param t set
|
129
|
+
-- @return <code>true</code> if sets are equal, <code>false</code>
|
130
|
+
-- otherwise
|
131
|
+
function equal (s, t)
|
132
|
+
return subset (s, t) and subset (t, s)
|
133
|
+
end
|
134
|
+
|
135
|
+
--- Metamethods for sets
|
136
|
+
-- set:method ()
|
137
|
+
metatable.__index = _M
|
138
|
+
-- set + table = union
|
139
|
+
metatable.__add = union
|
140
|
+
-- set - table = set difference
|
141
|
+
metatable.__sub = difference
|
142
|
+
-- set * table = intersection
|
143
|
+
metatable.__mul = intersection
|
144
|
+
-- set / table = symmetric difference
|
145
|
+
metatable.__div = symmetric_difference
|
146
|
+
-- set <= table = subset
|
147
|
+
metatable.__le = subset
|
148
|
+
-- set < table = proper subset
|
149
|
+
metatable.__lt = propersubset
|
@@ -0,0 +1,133 @@
|
|
1
|
+
-----------------------------------------------------------------------------
|
2
|
+
-- LuaSocket helper module
|
3
|
+
-- Author: Diego Nehab
|
4
|
+
-- RCS ID: $Id$
|
5
|
+
-----------------------------------------------------------------------------
|
6
|
+
|
7
|
+
-----------------------------------------------------------------------------
|
8
|
+
-- Declare module and import dependencies
|
9
|
+
-----------------------------------------------------------------------------
|
10
|
+
local base = _G
|
11
|
+
local string = require("string")
|
12
|
+
local math = require("math")
|
13
|
+
local socket = require("socket.core")
|
14
|
+
module("socket")
|
15
|
+
|
16
|
+
-----------------------------------------------------------------------------
|
17
|
+
-- Exported auxiliar functions
|
18
|
+
-----------------------------------------------------------------------------
|
19
|
+
function connect(address, port, laddress, lport)
|
20
|
+
local sock, err = socket.tcp()
|
21
|
+
if not sock then return nil, err end
|
22
|
+
if laddress then
|
23
|
+
local res, err = sock:bind(laddress, lport, -1)
|
24
|
+
if not res then return nil, err end
|
25
|
+
end
|
26
|
+
local res, err = sock:connect(address, port)
|
27
|
+
if not res then return nil, err end
|
28
|
+
return sock
|
29
|
+
end
|
30
|
+
|
31
|
+
function bind(host, port, backlog)
|
32
|
+
local sock, err = socket.tcp()
|
33
|
+
if not sock then return nil, err end
|
34
|
+
sock:setoption("reuseaddr", true)
|
35
|
+
local res, err = sock:bind(host, port)
|
36
|
+
if not res then return nil, err end
|
37
|
+
res, err = sock:listen(backlog)
|
38
|
+
if not res then return nil, err end
|
39
|
+
return sock
|
40
|
+
end
|
41
|
+
|
42
|
+
try = newtry()
|
43
|
+
|
44
|
+
function choose(table)
|
45
|
+
return function(name, opt1, opt2)
|
46
|
+
if base.type(name) ~= "string" then
|
47
|
+
name, opt1, opt2 = "default", name, opt1
|
48
|
+
end
|
49
|
+
local f = table[name or "nil"]
|
50
|
+
if not f then base.error("unknown key (".. base.tostring(name) ..")", 3)
|
51
|
+
else return f(opt1, opt2) end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
-----------------------------------------------------------------------------
|
56
|
+
-- Socket sources and sinks, conforming to LTN12
|
57
|
+
-----------------------------------------------------------------------------
|
58
|
+
-- create namespaces inside LuaSocket namespace
|
59
|
+
sourcet = {}
|
60
|
+
sinkt = {}
|
61
|
+
|
62
|
+
BLOCKSIZE = 2048
|
63
|
+
|
64
|
+
sinkt["close-when-done"] = function(sock)
|
65
|
+
return base.setmetatable({
|
66
|
+
getfd = function() return sock:getfd() end,
|
67
|
+
dirty = function() return sock:dirty() end
|
68
|
+
}, {
|
69
|
+
__call = function(self, chunk, err)
|
70
|
+
if not chunk then
|
71
|
+
sock:close()
|
72
|
+
return 1
|
73
|
+
else return sock:send(chunk) end
|
74
|
+
end
|
75
|
+
})
|
76
|
+
end
|
77
|
+
|
78
|
+
sinkt["keep-open"] = function(sock)
|
79
|
+
return base.setmetatable({
|
80
|
+
getfd = function() return sock:getfd() end,
|
81
|
+
dirty = function() return sock:dirty() end
|
82
|
+
}, {
|
83
|
+
__call = function(self, chunk, err)
|
84
|
+
if chunk then return sock:send(chunk)
|
85
|
+
else return 1 end
|
86
|
+
end
|
87
|
+
})
|
88
|
+
end
|
89
|
+
|
90
|
+
sinkt["default"] = sinkt["keep-open"]
|
91
|
+
|
92
|
+
sink = choose(sinkt)
|
93
|
+
|
94
|
+
sourcet["by-length"] = function(sock, length)
|
95
|
+
return base.setmetatable({
|
96
|
+
getfd = function() return sock:getfd() end,
|
97
|
+
dirty = function() return sock:dirty() end
|
98
|
+
}, {
|
99
|
+
__call = function()
|
100
|
+
if length <= 0 then return nil end
|
101
|
+
local size = math.min(socket.BLOCKSIZE, length)
|
102
|
+
local chunk, err = sock:receive(size)
|
103
|
+
if err then return nil, err end
|
104
|
+
length = length - string.len(chunk)
|
105
|
+
return chunk
|
106
|
+
end
|
107
|
+
})
|
108
|
+
end
|
109
|
+
|
110
|
+
sourcet["until-closed"] = function(sock)
|
111
|
+
local done
|
112
|
+
return base.setmetatable({
|
113
|
+
getfd = function() return sock:getfd() end,
|
114
|
+
dirty = function() return sock:dirty() end
|
115
|
+
}, {
|
116
|
+
__call = function()
|
117
|
+
if done then return nil end
|
118
|
+
local chunk, err, partial = sock:receive(socket.BLOCKSIZE)
|
119
|
+
if not err then return chunk
|
120
|
+
elseif err == "closed" then
|
121
|
+
sock:close()
|
122
|
+
done = 1
|
123
|
+
return partial
|
124
|
+
else return nil, err end
|
125
|
+
end
|
126
|
+
})
|
127
|
+
end
|
128
|
+
|
129
|
+
|
130
|
+
sourcet["default"] = sourcet["until-closed"]
|
131
|
+
|
132
|
+
source = choose(sourcet)
|
133
|
+
|
Binary file
|
@@ -0,0 +1,281 @@
|
|
1
|
+
-----------------------------------------------------------------------------
|
2
|
+
-- FTP support for the Lua language
|
3
|
+
-- LuaSocket toolkit.
|
4
|
+
-- Author: Diego Nehab
|
5
|
+
-- RCS ID: $Id$
|
6
|
+
-----------------------------------------------------------------------------
|
7
|
+
|
8
|
+
-----------------------------------------------------------------------------
|
9
|
+
-- Declare module and import dependencies
|
10
|
+
-----------------------------------------------------------------------------
|
11
|
+
local base = _G
|
12
|
+
local table = require("table")
|
13
|
+
local string = require("string")
|
14
|
+
local math = require("math")
|
15
|
+
local socket = require("socket")
|
16
|
+
local url = require("socket.url")
|
17
|
+
local tp = require("socket.tp")
|
18
|
+
local ltn12 = require("ltn12")
|
19
|
+
module("socket.ftp")
|
20
|
+
|
21
|
+
-----------------------------------------------------------------------------
|
22
|
+
-- Program constants
|
23
|
+
-----------------------------------------------------------------------------
|
24
|
+
-- timeout in seconds before the program gives up on a connection
|
25
|
+
TIMEOUT = 60
|
26
|
+
-- default port for ftp service
|
27
|
+
PORT = 21
|
28
|
+
-- this is the default anonymous password. used when no password is
|
29
|
+
-- provided in url. should be changed to your e-mail.
|
30
|
+
USER = "ftp"
|
31
|
+
PASSWORD = "anonymous@anonymous.org"
|
32
|
+
|
33
|
+
-----------------------------------------------------------------------------
|
34
|
+
-- Low level FTP API
|
35
|
+
-----------------------------------------------------------------------------
|
36
|
+
local metat = { __index = {} }
|
37
|
+
|
38
|
+
function open(server, port, create)
|
39
|
+
local tp = socket.try(tp.connect(server, port or PORT, TIMEOUT, create))
|
40
|
+
local f = base.setmetatable({ tp = tp }, metat)
|
41
|
+
-- make sure everything gets closed in an exception
|
42
|
+
f.try = socket.newtry(function() f:close() end)
|
43
|
+
return f
|
44
|
+
end
|
45
|
+
|
46
|
+
function metat.__index:portconnect()
|
47
|
+
self.try(self.server:settimeout(TIMEOUT))
|
48
|
+
self.data = self.try(self.server:accept())
|
49
|
+
self.try(self.data:settimeout(TIMEOUT))
|
50
|
+
end
|
51
|
+
|
52
|
+
function metat.__index:pasvconnect()
|
53
|
+
self.data = self.try(socket.tcp())
|
54
|
+
self.try(self.data:settimeout(TIMEOUT))
|
55
|
+
self.try(self.data:connect(self.pasvt.ip, self.pasvt.port))
|
56
|
+
end
|
57
|
+
|
58
|
+
function metat.__index:login(user, password)
|
59
|
+
self.try(self.tp:command("user", user or USER))
|
60
|
+
local code, reply = self.try(self.tp:check{"2..", 331})
|
61
|
+
if code == 331 then
|
62
|
+
self.try(self.tp:command("pass", password or PASSWORD))
|
63
|
+
self.try(self.tp:check("2.."))
|
64
|
+
end
|
65
|
+
return 1
|
66
|
+
end
|
67
|
+
|
68
|
+
function metat.__index:pasv()
|
69
|
+
self.try(self.tp:command("pasv"))
|
70
|
+
local code, reply = self.try(self.tp:check("2.."))
|
71
|
+
local pattern = "(%d+)%D(%d+)%D(%d+)%D(%d+)%D(%d+)%D(%d+)"
|
72
|
+
local a, b, c, d, p1, p2 = socket.skip(2, string.find(reply, pattern))
|
73
|
+
self.try(a and b and c and d and p1 and p2, reply)
|
74
|
+
self.pasvt = {
|
75
|
+
ip = string.format("%d.%d.%d.%d", a, b, c, d),
|
76
|
+
port = p1*256 + p2
|
77
|
+
}
|
78
|
+
if self.server then
|
79
|
+
self.server:close()
|
80
|
+
self.server = nil
|
81
|
+
end
|
82
|
+
return self.pasvt.ip, self.pasvt.port
|
83
|
+
end
|
84
|
+
|
85
|
+
function metat.__index:port(ip, port)
|
86
|
+
self.pasvt = nil
|
87
|
+
if not ip then
|
88
|
+
ip, port = self.try(self.tp:getcontrol():getsockname())
|
89
|
+
self.server = self.try(socket.bind(ip, 0))
|
90
|
+
ip, port = self.try(self.server:getsockname())
|
91
|
+
self.try(self.server:settimeout(TIMEOUT))
|
92
|
+
end
|
93
|
+
local pl = math.mod(port, 256)
|
94
|
+
local ph = (port - pl)/256
|
95
|
+
local arg = string.gsub(string.format("%s,%d,%d", ip, ph, pl), "%.", ",")
|
96
|
+
self.try(self.tp:command("port", arg))
|
97
|
+
self.try(self.tp:check("2.."))
|
98
|
+
return 1
|
99
|
+
end
|
100
|
+
|
101
|
+
function metat.__index:send(sendt)
|
102
|
+
self.try(self.pasvt or self.server, "need port or pasv first")
|
103
|
+
-- if there is a pasvt table, we already sent a PASV command
|
104
|
+
-- we just get the data connection into self.data
|
105
|
+
if self.pasvt then self:pasvconnect() end
|
106
|
+
-- get the transfer argument and command
|
107
|
+
local argument = sendt.argument or
|
108
|
+
url.unescape(string.gsub(sendt.path or "", "^[/\\]", ""))
|
109
|
+
if argument == "" then argument = nil end
|
110
|
+
local command = sendt.command or "stor"
|
111
|
+
-- send the transfer command and check the reply
|
112
|
+
self.try(self.tp:command(command, argument))
|
113
|
+
local code, reply = self.try(self.tp:check{"2..", "1.."})
|
114
|
+
-- if there is not a a pasvt table, then there is a server
|
115
|
+
-- and we already sent a PORT command
|
116
|
+
if not self.pasvt then self:portconnect() end
|
117
|
+
-- get the sink, source and step for the transfer
|
118
|
+
local step = sendt.step or ltn12.pump.step
|
119
|
+
local readt = {self.tp.c}
|
120
|
+
local checkstep = function(src, snk)
|
121
|
+
-- check status in control connection while downloading
|
122
|
+
local readyt = socket.select(readt, nil, 0)
|
123
|
+
if readyt[tp] then code = self.try(self.tp:check("2..")) end
|
124
|
+
return step(src, snk)
|
125
|
+
end
|
126
|
+
local sink = socket.sink("close-when-done", self.data)
|
127
|
+
-- transfer all data and check error
|
128
|
+
self.try(ltn12.pump.all(sendt.source, sink, checkstep))
|
129
|
+
if string.find(code, "1..") then self.try(self.tp:check("2..")) end
|
130
|
+
-- done with data connection
|
131
|
+
self.data:close()
|
132
|
+
-- find out how many bytes were sent
|
133
|
+
local sent = socket.skip(1, self.data:getstats())
|
134
|
+
self.data = nil
|
135
|
+
return sent
|
136
|
+
end
|
137
|
+
|
138
|
+
function metat.__index:receive(recvt)
|
139
|
+
self.try(self.pasvt or self.server, "need port or pasv first")
|
140
|
+
if self.pasvt then self:pasvconnect() end
|
141
|
+
local argument = recvt.argument or
|
142
|
+
url.unescape(string.gsub(recvt.path or "", "^[/\\]", ""))
|
143
|
+
if argument == "" then argument = nil end
|
144
|
+
local command = recvt.command or "retr"
|
145
|
+
self.try(self.tp:command(command, argument))
|
146
|
+
local code = self.try(self.tp:check{"1..", "2.."})
|
147
|
+
if not self.pasvt then self:portconnect() end
|
148
|
+
local source = socket.source("until-closed", self.data)
|
149
|
+
local step = recvt.step or ltn12.pump.step
|
150
|
+
self.try(ltn12.pump.all(source, recvt.sink, step))
|
151
|
+
if string.find(code, "1..") then self.try(self.tp:check("2..")) end
|
152
|
+
self.data:close()
|
153
|
+
self.data = nil
|
154
|
+
return 1
|
155
|
+
end
|
156
|
+
|
157
|
+
function metat.__index:cwd(dir)
|
158
|
+
self.try(self.tp:command("cwd", dir))
|
159
|
+
self.try(self.tp:check(250))
|
160
|
+
return 1
|
161
|
+
end
|
162
|
+
|
163
|
+
function metat.__index:type(type)
|
164
|
+
self.try(self.tp:command("type", type))
|
165
|
+
self.try(self.tp:check(200))
|
166
|
+
return 1
|
167
|
+
end
|
168
|
+
|
169
|
+
function metat.__index:greet()
|
170
|
+
local code = self.try(self.tp:check{"1..", "2.."})
|
171
|
+
if string.find(code, "1..") then self.try(self.tp:check("2..")) end
|
172
|
+
return 1
|
173
|
+
end
|
174
|
+
|
175
|
+
function metat.__index:quit()
|
176
|
+
self.try(self.tp:command("quit"))
|
177
|
+
self.try(self.tp:check("2.."))
|
178
|
+
return 1
|
179
|
+
end
|
180
|
+
|
181
|
+
function metat.__index:close()
|
182
|
+
if self.data then self.data:close() end
|
183
|
+
if self.server then self.server:close() end
|
184
|
+
return self.tp:close()
|
185
|
+
end
|
186
|
+
|
187
|
+
-----------------------------------------------------------------------------
|
188
|
+
-- High level FTP API
|
189
|
+
-----------------------------------------------------------------------------
|
190
|
+
local function override(t)
|
191
|
+
if t.url then
|
192
|
+
local u = url.parse(t.url)
|
193
|
+
for i,v in base.pairs(t) do
|
194
|
+
u[i] = v
|
195
|
+
end
|
196
|
+
return u
|
197
|
+
else return t end
|
198
|
+
end
|
199
|
+
|
200
|
+
local function tput(putt)
|
201
|
+
putt = override(putt)
|
202
|
+
socket.try(putt.host, "missing hostname")
|
203
|
+
local f = open(putt.host, putt.port, putt.create)
|
204
|
+
f:greet()
|
205
|
+
f:login(putt.user, putt.password)
|
206
|
+
if putt.type then f:type(putt.type) end
|
207
|
+
f:pasv()
|
208
|
+
local sent = f:send(putt)
|
209
|
+
f:quit()
|
210
|
+
f:close()
|
211
|
+
return sent
|
212
|
+
end
|
213
|
+
|
214
|
+
local default = {
|
215
|
+
path = "/",
|
216
|
+
scheme = "ftp"
|
217
|
+
}
|
218
|
+
|
219
|
+
local function parse(u)
|
220
|
+
local t = socket.try(url.parse(u, default))
|
221
|
+
socket.try(t.scheme == "ftp", "wrong scheme '" .. t.scheme .. "'")
|
222
|
+
socket.try(t.host, "missing hostname")
|
223
|
+
local pat = "^type=(.)$"
|
224
|
+
if t.params then
|
225
|
+
t.type = socket.skip(2, string.find(t.params, pat))
|
226
|
+
socket.try(t.type == "a" or t.type == "i",
|
227
|
+
"invalid type '" .. t.type .. "'")
|
228
|
+
end
|
229
|
+
return t
|
230
|
+
end
|
231
|
+
|
232
|
+
local function sput(u, body)
|
233
|
+
local putt = parse(u)
|
234
|
+
putt.source = ltn12.source.string(body)
|
235
|
+
return tput(putt)
|
236
|
+
end
|
237
|
+
|
238
|
+
put = socket.protect(function(putt, body)
|
239
|
+
if base.type(putt) == "string" then return sput(putt, body)
|
240
|
+
else return tput(putt) end
|
241
|
+
end)
|
242
|
+
|
243
|
+
local function tget(gett)
|
244
|
+
gett = override(gett)
|
245
|
+
socket.try(gett.host, "missing hostname")
|
246
|
+
local f = open(gett.host, gett.port, gett.create)
|
247
|
+
f:greet()
|
248
|
+
f:login(gett.user, gett.password)
|
249
|
+
if gett.type then f:type(gett.type) end
|
250
|
+
f:pasv()
|
251
|
+
f:receive(gett)
|
252
|
+
f:quit()
|
253
|
+
return f:close()
|
254
|
+
end
|
255
|
+
|
256
|
+
local function sget(u)
|
257
|
+
local gett = parse(u)
|
258
|
+
local t = {}
|
259
|
+
gett.sink = ltn12.sink.table(t)
|
260
|
+
tget(gett)
|
261
|
+
return table.concat(t)
|
262
|
+
end
|
263
|
+
|
264
|
+
command = socket.protect(function(cmdt)
|
265
|
+
cmdt = override(cmdt)
|
266
|
+
socket.try(cmdt.host, "missing hostname")
|
267
|
+
socket.try(cmdt.command, "missing command")
|
268
|
+
local f = open(cmdt.host, cmdt.port, cmdt.create)
|
269
|
+
f:greet()
|
270
|
+
f:login(cmdt.user, cmdt.password)
|
271
|
+
f.try(f.tp:command(cmdt.command, cmdt.argument))
|
272
|
+
if cmdt.check then f.try(f.tp:check(cmdt.check)) end
|
273
|
+
f:quit()
|
274
|
+
return f:close()
|
275
|
+
end)
|
276
|
+
|
277
|
+
get = socket.protect(function(gett)
|
278
|
+
if base.type(gett) == "string" then return sget(gett)
|
279
|
+
else return tget(gett) end
|
280
|
+
end)
|
281
|
+
|