Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/windirstat.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Schneider <oliver@assarbad.net>2018-04-04 22:32:36 +0300
committerOliver Schneider <oliver@assarbad.net>2018-04-04 22:32:36 +0300
commit861ef113a9a1654747949f77a040357cac8a7b41 (patch)
tree783a6675094fbeea9ffafccd738bc2ac74ff22b1
parent4d85f899cc1f5a346275cd1f3cf934239c33d414 (diff)
Removing the Lua implementations of some functions I planned to make available by default.
-rw-r--r--3rdparty/lua/in-lua-extensions/globals.lua45
-rw-r--r--3rdparty/lua/in-lua-extensions/os.lua264
-rw-r--r--3rdparty/lua/in-lua-extensions/path.lua105
-rw-r--r--3rdparty/lua/in-lua-extensions/string.lua50
-rw-r--r--3rdparty/lua/in-lua-extensions/winreg.lua42
5 files changed, 0 insertions, 506 deletions
diff --git a/3rdparty/lua/in-lua-extensions/globals.lua b/3rdparty/lua/in-lua-extensions/globals.lua
deleted file mode 100644
index 49fdfb2..0000000
--- a/3rdparty/lua/in-lua-extensions/globals.lua
+++ /dev/null
@@ -1,45 +0,0 @@
---
--- globals.lua
--- Global tables and variables, replacements and extensions to Lua's global functions.
--- Copyright (c) 2002-2009 Jason Perkins and the Premake project
---
-
---
--- "Immediate If" - returns one of the two values depending on the value of expr.
---
-
- function iif(expr, trueval, falseval)
- if (expr) then
- return trueval
- else
- return falseval
- end
- end
-
-
-
---
--- A shortcut for printing formatted output.
---
-
- function printf(msg, ...)
- print(string.format(msg, unpack(arg)))
- end
-
-
-
---
--- An extension to type() to identify project object types by reading the
--- "__type" field from the metatable.
---
-
- local builtin_type = type
- function type(t)
- local mt = getmetatable(t)
- if (mt) then
- if (mt.__type) then
- return mt.__type
- end
- end
- return builtin_type(t)
- end
diff --git a/3rdparty/lua/in-lua-extensions/os.lua b/3rdparty/lua/in-lua-extensions/os.lua
deleted file mode 100644
index 1d95179..0000000
--- a/3rdparty/lua/in-lua-extensions/os.lua
+++ /dev/null
@@ -1,264 +0,0 @@
---
--- os.lua
--- Additions to the OS namespace.
--- Copyright (c) 2002-2011 Jason Perkins and the Premake project
---
-
-
---
--- Same as os.execute(), but accepts string formatting arguments.
---
-
- function os.executef(cmd, ...)
- cmd = string.format(cmd, unpack(arg))
- return os.execute(cmd)
- end
-
-
---
--- Scan the well-known system locations for a particular library.
---
-
- function os.findlib(libname)
- local path, formats
-
- -- assemble a search path, depending on the platform
- if os.is("windows") then
- formats = { "%s.dll", "%s" }
- path = os.getenv("PATH")
- elseif os.is("haiku") then
- formats = { "lib%s.so", "%s.so" }
- path = os.getenv("LIBRARY_PATH")
- else
- if os.is("macosx") then
- formats = { "lib%s.dylib", "%s.dylib" }
- path = os.getenv("DYLD_LIBRARY_PATH")
- else
- formats = { "lib%s.so", "%s.so" }
- path = os.getenv("LD_LIBRARY_PATH") or ""
-
- io.input("/etc/ld.so.conf")
- if io.input() then
- for line in io.lines() do
- path = path .. ":" .. line
- end
- io.input():close()
- end
- end
-
- table.insert(formats, "%s")
- path = path or ""
- if os.is64bit() then
- path = path .. ":/lib64:/usr/lib64/:usr/local/lib64"
- end
- path = path .. ":/lib:/usr/lib:/usr/local/lib"
- end
-
- for _, fmt in ipairs(formats) do
- local name = string.format(fmt, libname)
- local result = os.pathsearch(name, path)
- if result then return result end
- end
- end
-
-
-
---
--- Retrieve the current operating system ID string.
---
-
- function os.get()
- return _OPTIONS.os or _OS
- end
-
-
-
---
--- Check the current operating system; may be set with the /os command line flag.
---
-
- function os.is(id)
- return (os.get():lower() == id:lower())
- end
-
-
-
---
--- Determine if the current system is running a 64-bit architecture
---
-
- local _64BitHostTypes = {
- "x86_64",
- "ia64",
- "amd64",
- "ppc64",
- "powerpc64",
- "sparc64"
- }
-
- function os.is64bit()
- -- Call the native code implementation. If this returns true then
- -- we're 64-bit, otherwise do more checking locally
- if (os._is64bit()) then
- return true
- end
-
- -- Identify the system
- local arch
- if _OS == "windows" then
- arch = os.getenv("PROCESSOR_ARCHITECTURE")
- elseif _OS == "macosx" then
- arch = os.outputof("echo $HOSTTYPE")
- else
- arch = os.outputof("uname -m")
- end
-
- -- Check our known 64-bit identifiers
- arch = arch:lower()
- for _, hosttype in ipairs(_64BitHostTypes) do
- if arch:find(hosttype) then
- return true
- end
- end
- return false
- end
-
-
-
---
--- The os.matchdirs() and os.matchfiles() functions
---
-
- local function domatch(result, mask, wantfiles)
- -- need to remove extraneous path info from the mask to ensure a match
- -- against the paths returned by the OS. Haven't come up with a good
- -- way to do it yet, so will handle cases as they come up
- if mask:startswith("./") then
- mask = mask:sub(3)
- end
-
- -- strip off any leading directory information to find out
- -- where the search should take place
- local basedir = mask
- local starpos = mask:find("%*")
- if starpos then
- basedir = basedir:sub(1, starpos - 1)
- end
- basedir = path.getdirectory(basedir)
- if (basedir == ".") then basedir = "" end
-
- -- recurse into subdirectories?
- local recurse = mask:find("**", nil, true)
-
- -- convert mask to a Lua pattern
- mask = path.wildcards(mask)
-
- local function matchwalker(basedir)
- local wildcard = path.join(basedir, "*")
-
- -- retrieve files from OS and test against mask
- local m = os.matchstart(wildcard)
- while (os.matchnext(m)) do
- local isfile = os.matchisfile(m)
- if ((wantfiles and isfile) or (not wantfiles and not isfile)) then
- local fname = path.join(basedir, os.matchname(m))
- if fname:match(mask) == fname then
- table.insert(result, fname)
- end
- end
- end
- os.matchdone(m)
-
- -- check subdirectories
- if recurse then
- m = os.matchstart(wildcard)
- while (os.matchnext(m)) do
- if not os.matchisfile(m) then
- local dirname = os.matchname(m)
- matchwalker(path.join(basedir, dirname))
- end
- end
- os.matchdone(m)
- end
- end
-
- matchwalker(basedir)
- end
-
- function os.matchdirs(...)
- local result = { }
- for _, mask in ipairs(arg) do
- domatch(result, mask, false)
- end
- return result
- end
-
- function os.matchfiles(...)
- local result = { }
- for _, mask in ipairs(arg) do
- domatch(result, mask, true)
- end
- return result
- end
-
-
-
---
--- An overload of the os.mkdir() function, which will create any missing
--- subdirectories along the path.
---
-
- local builtin_mkdir = os.mkdir
- function os.mkdir(p)
- local dir = iif(p:startswith("/"), "/", "")
- for part in p:gmatch("[^/]+") do
- dir = dir .. part
-
- if (part ~= "" and not path.isabsolute(part) and not os.isdir(dir)) then
- local ok, err = builtin_mkdir(dir)
- if (not ok) then
- return nil, err
- end
- end
-
- dir = dir .. "/"
- end
-
- return true
- end
-
-
---
--- Run a shell command and return the output.
---
-
- function os.outputof(cmd)
- local pipe = io.popen(cmd)
- local result = pipe:read('*a')
- pipe:close()
- return result
- end
-
-
---
--- Remove a directory, along with any contained files or subdirectories.
---
-
- local builtin_rmdir = os.rmdir
- function os.rmdir(p)
- -- recursively remove subdirectories
- local dirs = os.matchdirs(p .. "/*")
- for _, dname in ipairs(dirs) do
- os.rmdir(dname)
- end
-
- -- remove any files
- local files = os.matchfiles(p .. "/*")
- for _, fname in ipairs(files) do
- os.remove(fname)
- end
-
- -- remove this directory
- builtin_rmdir(p)
- end
-
diff --git a/3rdparty/lua/in-lua-extensions/path.lua b/3rdparty/lua/in-lua-extensions/path.lua
deleted file mode 100644
index 0692cf2..0000000
--- a/3rdparty/lua/in-lua-extensions/path.lua
+++ /dev/null
@@ -1,105 +0,0 @@
---
--- path.lua
--- Path manipulation functions.
--- Copyright (c) 2002-2010 Jason Perkins and the Premake project
---
-
-
---
--- Retrieve the filename portion of a path, without any extension.
---
-
- function path.getbasename(p)
- local name = path.getname(p)
- local i = name:findlast(".", true)
- if (i) then
- return name:sub(1, i - 1)
- else
- return name
- end
- end
-
---
--- Retrieve the directory portion of a path, or an empty string if
--- the path does not include a directory.
---
-
- function path.getdirectory(p)
- local i = p:findlast("/", true)
- if (i) then
- if i > 1 then i = i - 1 end
- return p:sub(1, i)
- else
- return "."
- end
- end
-
-
---
--- Retrieve the drive letter, if a Windows path.
---
-
- function path.getdrive(p)
- local ch1 = p:sub(1,1)
- local ch2 = p:sub(2,2)
- if ch2 == ":" then
- return ch1
- end
- end
-
-
-
---
--- Retrieve the file extension.
---
-
- function path.getextension(p)
- local i = p:findlast(".", true)
- if (i) then
- return p:sub(i)
- else
- return ""
- end
- end
-
-
-
---
--- Retrieve the filename portion of a path.
---
-
- function path.getname(p)
- local i = p:findlast("[/\\]")
- if (i) then
- return p:sub(i + 1)
- else
- return p
- end
- end
-
-
---
--- Converts from a simple wildcard syntax, where * is "match any"
--- and ** is "match recursive", to the corresponding Lua pattern.
---
--- @param pattern
--- The wildcard pattern to convert.
--- @returns
--- The corresponding Lua pattern.
---
-
- function path.wildcards(pattern)
- -- Escape characters that have special meanings in Lua patterns
- pattern = pattern:gsub("([%+%.%-%^%$%(%)%%])", "%%%1")
-
- -- Replace wildcard patterns with special placeholders so I don't
- -- have competing star replacements to worry about
- pattern = pattern:gsub("%*%*", "\001")
- pattern = pattern:gsub("%*", "\002")
-
- -- Replace the placeholders with their Lua patterns
- pattern = pattern:gsub("\001", ".*")
- pattern = pattern:gsub("\002", "[^/]*")
-
- return pattern
- end
diff --git a/3rdparty/lua/in-lua-extensions/string.lua b/3rdparty/lua/in-lua-extensions/string.lua
deleted file mode 100644
index 764f964..0000000
--- a/3rdparty/lua/in-lua-extensions/string.lua
+++ /dev/null
@@ -1,50 +0,0 @@
---
--- string.lua
--- Additions to Lua's built-in string functions.
--- Copyright (c) 2002-2008 Jason Perkins and the Premake project
---
-
-
---
--- Returns an array of strings, each of which is a substring of s
--- formed by splitting on boundaries formed by `pattern`.
---
-
- function string.explode(s, pattern, plain)
- if (pattern == '') then return false end
- local pos = 0
- local arr = { }
- for st,sp in function() return s:find(pattern, pos, plain) end do
- table.insert(arr, s:sub(pos, st-1))
- pos = sp + 1
- end
- table.insert(arr, s:sub(pos))
- return arr
- end
-
-
-
---
--- Find the last instance of a pattern in a string.
---
-
- function string.findlast(s, pattern, plain)
- local curr = 0
- repeat
- local next = s:find(pattern, curr + 1, plain)
- if (next) then curr = next end
- until (not next)
- if (curr > 0) then
- return curr
- end
- end
-
-
-
---
--- Returns true if `haystack` starts with the sequence `needle`.
---
-
- function string.startswith(haystack, needle)
- return (haystack:find(needle, 1, true) == 1)
- end
diff --git a/3rdparty/lua/in-lua-extensions/winreg.lua b/3rdparty/lua/in-lua-extensions/winreg.lua
deleted file mode 100644
index 14964b8..0000000
--- a/3rdparty/lua/in-lua-extensions/winreg.lua
+++ /dev/null
@@ -1,42 +0,0 @@
-local winreg = require "winreg"
-
-function winreg.copykey(src, dst, remove_dst_on_fail)
- hksrc = winreg.openkey(src, "r")
- if not hksrc then
- return nil, string.format("Source key (%s) could not be opened", src)
- end
- hkdst = winreg.openkey(dst) or winreg.createkey(dst)
- if not hkdst then
- if remove_dst_on_fail then hkdst:deletekey() end
- return nil, string.format("Destination key (%s) could not be opened/created", dst)
- end
- for vname, vtype in hksrc:enumvalue() do
- if not hkdst:setvalue(vname, hksrc:getvalue(vname), vtype) then
- if remove_dst_on_fail then hkdst:deletekey() end
- return nil, string.format("Destination key (%s) could not be opened", dst)
- end
- end
- for kname in hksrc:enumkey() do
- ret, err = winreg.copykey(src .. [[\]] .. kname, dst .. [[\]] .. kname)
- if not ret then
- return ret, err
- end
- end
- return true
-end
-
-function winreg.movekey(src, dst, remove_dst_on_fail)
- ret, err = winreg.copykey(src, dst, remove_dst_on_fail)
- if not ret then
- return ret, err
- end
- hksrc = winreg.openkey(src)
- if not hksrc then
- return nil, string.format("Could not open %s for removal", src)
- else
- if not hksrc:deletekey() then
- return nil, string.format("Could not remove %s", src)
- end
- end
- return true
-end