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>2015-12-20 20:02:36 +0300
committerOliver Schneider <oliver@assarbad.net>2015-12-20 20:02:36 +0300
commit87a499eeb1447de796b090fefd6a1d1006f2f4d4 (patch)
tree1905b6696ebf912dc4ce23213a881a3e6a83187e
parent8d9602a7550bdc6e12bf2b246e185cc866ee18ec (diff)
LuaJIT (2.0.4) upstream update (this time with correct line endings, i.e. LF only)
-rw-r--r--3rdparty/lua/.gitignore11
-rw-r--r--3rdparty/lua/COPYRIGHT2
-rw-r--r--3rdparty/lua/Makefile10
-rw-r--r--3rdparty/lua/README4
-rw-r--r--3rdparty/lua/datadumper.lua474
-rw-r--r--3rdparty/lua/doc/bluequad-print.css2
-rw-r--r--3rdparty/lua/doc/bluequad.css2
-rw-r--r--3rdparty/lua/doc/changes.html92
-rw-r--r--3rdparty/lua/doc/contact.html6
-rw-r--r--3rdparty/lua/doc/ext_c_api.html4
-rw-r--r--3rdparty/lua/doc/ext_ffi.html4
-rw-r--r--3rdparty/lua/doc/ext_ffi_api.html4
-rw-r--r--3rdparty/lua/doc/ext_ffi_semantics.html8
-rw-r--r--3rdparty/lua/doc/ext_ffi_tutorial.html6
-rw-r--r--3rdparty/lua/doc/ext_jit.html6
-rw-r--r--3rdparty/lua/doc/extensions.html4
-rw-r--r--3rdparty/lua/doc/faq.html4
-rw-r--r--3rdparty/lua/doc/install.html67
-rw-r--r--3rdparty/lua/doc/luajit.html14
-rw-r--r--3rdparty/lua/doc/running.html6
-rw-r--r--3rdparty/lua/doc/status.html17
-rw-r--r--3rdparty/lua/dynasm/dasm_arm.h2
-rw-r--r--3rdparty/lua/dynasm/dasm_arm.lua9
-rw-r--r--3rdparty/lua/dynasm/dasm_mips.h2
-rw-r--r--3rdparty/lua/dynasm/dasm_mips.lua2
-rw-r--r--3rdparty/lua/dynasm/dasm_ppc.h2
-rw-r--r--3rdparty/lua/dynasm/dasm_ppc.lua2
-rw-r--r--3rdparty/lua/dynasm/dasm_proto.h2
-rw-r--r--3rdparty/lua/dynasm/dasm_x64.lua2
-rw-r--r--3rdparty/lua/dynasm/dasm_x86.h2
-rw-r--r--3rdparty/lua/dynasm/dasm_x86.lua22
-rw-r--r--3rdparty/lua/dynasm/dynasm.lua15
-rw-r--r--3rdparty/lua/etc/luajit.12
-rw-r--r--3rdparty/lua/etc/luajit.pc7
-rw-r--r--3rdparty/lua/in-lua-extensions/winreg.lua84
-rw-r--r--3rdparty/lua/premake4.lua438
-rw-r--r--3rdparty/lua/src/Makefile31
-rw-r--r--3rdparty/lua/src/Makefile.dep10
-rw-r--r--3rdparty/lua/src/host/buildvm.c2
-rw-r--r--3rdparty/lua/src/host/buildvm.h2
-rw-r--r--3rdparty/lua/src/host/buildvm_asm.c6
-rw-r--r--3rdparty/lua/src/host/buildvm_fold.c2
-rw-r--r--3rdparty/lua/src/host/buildvm_lib.c2
-rw-r--r--3rdparty/lua/src/host/buildvm_peobj.c2
-rw-r--r--3rdparty/lua/src/host/genminilua.lua3
-rw-r--r--3rdparty/lua/src/host/minilua.c1
-rw-r--r--3rdparty/lua/src/jit/bc.lua4
-rw-r--r--3rdparty/lua/src/jit/bcsave.lua6
-rw-r--r--3rdparty/lua/src/jit/dis_arm.lua2
-rw-r--r--3rdparty/lua/src/jit/dis_mips.lua2
-rw-r--r--3rdparty/lua/src/jit/dis_mipsel.lua2
-rw-r--r--3rdparty/lua/src/jit/dis_ppc.lua2
-rw-r--r--3rdparty/lua/src/jit/dis_x64.lua2
-rw-r--r--3rdparty/lua/src/jit/dis_x86.lua2
-rw-r--r--3rdparty/lua/src/jit/dump.lua7
-rw-r--r--3rdparty/lua/src/jit/v.lua4
-rw-r--r--3rdparty/lua/src/lauxlib.h2
-rw-r--r--3rdparty/lua/src/lib_aux.c4
-rw-r--r--3rdparty/lua/src/lib_base.c2
-rw-r--r--3rdparty/lua/src/lib_bit.c2
-rw-r--r--3rdparty/lua/src/lib_debug.c2
-rw-r--r--3rdparty/lua/src/lib_ffi.c5
-rw-r--r--3rdparty/lua/src/lib_init.c2
-rw-r--r--3rdparty/lua/src/lib_io.c4
-rw-r--r--3rdparty/lua/src/lib_jit.c4
-rw-r--r--3rdparty/lua/src/lib_math.c14
-rw-r--r--3rdparty/lua/src/lib_os.c13
-rw-r--r--3rdparty/lua/src/lib_package.c5
-rw-r--r--3rdparty/lua/src/lib_string.c2
-rw-r--r--3rdparty/lua/src/lib_table.c2
-rw-r--r--3rdparty/lua/src/lj_alloc.c22
-rw-r--r--3rdparty/lua/src/lj_api.c4
-rw-r--r--3rdparty/lua/src/lj_arch.h26
-rw-r--r--3rdparty/lua/src/lj_asm.c28
-rw-r--r--3rdparty/lua/src/lj_asm.h2
-rw-r--r--3rdparty/lua/src/lj_asm_arm.h23
-rw-r--r--3rdparty/lua/src/lj_asm_mips.h7
-rw-r--r--3rdparty/lua/src/lj_asm_ppc.h9
-rw-r--r--3rdparty/lua/src/lj_asm_x86.h27
-rw-r--r--3rdparty/lua/src/lj_bc.c2
-rw-r--r--3rdparty/lua/src/lj_bc.h2
-rw-r--r--3rdparty/lua/src/lj_bcdump.h2
-rw-r--r--3rdparty/lua/src/lj_bcread.c2
-rw-r--r--3rdparty/lua/src/lj_bcwrite.c2
-rw-r--r--3rdparty/lua/src/lj_carith.c10
-rw-r--r--3rdparty/lua/src/lj_carith.h2
-rw-r--r--3rdparty/lua/src/lj_ccall.c7
-rw-r--r--3rdparty/lua/src/lj_ccall.h2
-rw-r--r--3rdparty/lua/src/lj_ccallback.c7
-rw-r--r--3rdparty/lua/src/lj_ccallback.h2
-rw-r--r--3rdparty/lua/src/lj_cconv.c3
-rw-r--r--3rdparty/lua/src/lj_cconv.h2
-rw-r--r--3rdparty/lua/src/lj_cdata.c20
-rw-r--r--3rdparty/lua/src/lj_cdata.h2
-rw-r--r--3rdparty/lua/src/lj_clib.c7
-rw-r--r--3rdparty/lua/src/lj_clib.h2
-rw-r--r--3rdparty/lua/src/lj_cparse.c24
-rw-r--r--3rdparty/lua/src/lj_cparse.h2
-rw-r--r--3rdparty/lua/src/lj_crecord.c84
-rw-r--r--3rdparty/lua/src/lj_crecord.h2
-rw-r--r--3rdparty/lua/src/lj_ctype.c2
-rw-r--r--3rdparty/lua/src/lj_ctype.h2
-rw-r--r--3rdparty/lua/src/lj_debug.c25
-rw-r--r--3rdparty/lua/src/lj_debug.h2
-rw-r--r--3rdparty/lua/src/lj_def.h10
-rw-r--r--3rdparty/lua/src/lj_dispatch.c2
-rw-r--r--3rdparty/lua/src/lj_dispatch.h2
-rw-r--r--3rdparty/lua/src/lj_emit_arm.h2
-rw-r--r--3rdparty/lua/src/lj_emit_mips.h2
-rw-r--r--3rdparty/lua/src/lj_emit_ppc.h2
-rw-r--r--3rdparty/lua/src/lj_emit_x86.h2
-rw-r--r--3rdparty/lua/src/lj_err.c33
-rw-r--r--3rdparty/lua/src/lj_err.h2
-rw-r--r--3rdparty/lua/src/lj_errmsg.h3
-rw-r--r--3rdparty/lua/src/lj_ff.h2
-rw-r--r--3rdparty/lua/src/lj_ffrecord.c23
-rw-r--r--3rdparty/lua/src/lj_ffrecord.h2
-rw-r--r--3rdparty/lua/src/lj_frame.h2
-rw-r--r--3rdparty/lua/src/lj_func.c2
-rw-r--r--3rdparty/lua/src/lj_func.h2
-rw-r--r--3rdparty/lua/src/lj_gc.c22
-rw-r--r--3rdparty/lua/src/lj_gc.h2
-rw-r--r--3rdparty/lua/src/lj_gdbjit.c4
-rw-r--r--3rdparty/lua/src/lj_gdbjit.h2
-rw-r--r--3rdparty/lua/src/lj_ir.c2
-rw-r--r--3rdparty/lua/src/lj_ir.h2
-rw-r--r--3rdparty/lua/src/lj_ircall.h10
-rw-r--r--3rdparty/lua/src/lj_iropt.h2
-rw-r--r--3rdparty/lua/src/lj_jit.h3
-rw-r--r--3rdparty/lua/src/lj_lex.c3
-rw-r--r--3rdparty/lua/src/lj_lex.h2
-rw-r--r--3rdparty/lua/src/lj_lib.c2
-rw-r--r--3rdparty/lua/src/lj_lib.h2
-rw-r--r--3rdparty/lua/src/lj_load.c2
-rw-r--r--3rdparty/lua/src/lj_mcode.c54
-rw-r--r--3rdparty/lua/src/lj_mcode.h2
-rw-r--r--3rdparty/lua/src/lj_meta.c2
-rw-r--r--3rdparty/lua/src/lj_meta.h2
-rw-r--r--3rdparty/lua/src/lj_obj.c2
-rw-r--r--3rdparty/lua/src/lj_obj.h4
-rw-r--r--3rdparty/lua/src/lj_opt_dce.c3
-rw-r--r--3rdparty/lua/src/lj_opt_fold.c35
-rw-r--r--3rdparty/lua/src/lj_opt_loop.c33
-rw-r--r--3rdparty/lua/src/lj_opt_mem.c47
-rw-r--r--3rdparty/lua/src/lj_opt_narrow.c16
-rw-r--r--3rdparty/lua/src/lj_opt_sink.c2
-rw-r--r--3rdparty/lua/src/lj_opt_split.c2
-rw-r--r--3rdparty/lua/src/lj_parse.c12
-rw-r--r--3rdparty/lua/src/lj_parse.h2
-rw-r--r--3rdparty/lua/src/lj_record.c23
-rw-r--r--3rdparty/lua/src/lj_record.h2
-rw-r--r--3rdparty/lua/src/lj_snap.c18
-rw-r--r--3rdparty/lua/src/lj_snap.h2
-rw-r--r--3rdparty/lua/src/lj_state.c4
-rw-r--r--3rdparty/lua/src/lj_state.h2
-rw-r--r--3rdparty/lua/src/lj_str.c2
-rw-r--r--3rdparty/lua/src/lj_str.h2
-rw-r--r--3rdparty/lua/src/lj_strscan.c11
-rw-r--r--3rdparty/lua/src/lj_strscan.h2
-rw-r--r--3rdparty/lua/src/lj_tab.c9
-rw-r--r--3rdparty/lua/src/lj_tab.h5
-rw-r--r--3rdparty/lua/src/lj_target.h2
-rw-r--r--3rdparty/lua/src/lj_target_arm.h2
-rw-r--r--3rdparty/lua/src/lj_target_mips.h2
-rw-r--r--3rdparty/lua/src/lj_target_ppc.h2
-rw-r--r--3rdparty/lua/src/lj_target_x86.h2
-rw-r--r--3rdparty/lua/src/lj_trace.c3
-rw-r--r--3rdparty/lua/src/lj_trace.h2
-rw-r--r--3rdparty/lua/src/lj_traceerr.h4
-rw-r--r--3rdparty/lua/src/lj_udata.c2
-rw-r--r--3rdparty/lua/src/lj_udata.h2
-rw-r--r--3rdparty/lua/src/lj_vm.h2
-rw-r--r--3rdparty/lua/src/lj_vmevent.c2
-rw-r--r--3rdparty/lua/src/lj_vmevent.h2
-rw-r--r--3rdparty/lua/src/lj_vmmath.c2
-rw-r--r--3rdparty/lua/src/ljamalg.c6
-rw-r--r--3rdparty/lua/src/lua.h2
-rw-r--r--3rdparty/lua/src/luaconf.h51
-rw-r--r--3rdparty/lua/src/luajit.c20
-rw-r--r--3rdparty/lua/src/luajit.h10
-rw-r--r--3rdparty/lua/src/lualib.h2
-rw-r--r--3rdparty/lua/src/modules/dbgprint.c56
-rw-r--r--3rdparty/lua/src/modules/dbgprint.h34
-rw-r--r--3rdparty/lua/src/modules/isadmin.c106
-rw-r--r--3rdparty/lua/src/modules/isadmin.h34
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/README.md56
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/doc/COPYRIGHT10
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/lakefile154
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/build.mak142
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/l52util.c238
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/l52util.h92
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/lua_int64.c226
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/lua_int64.h104
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/lua_mtutil.c86
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/lua_mtutil.h32
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/lua_tstring.c748
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/lua_tstring.h196
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/luamacro.h248
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/luareg.h158
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/luawin_dllerror.c94
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/luawin_dllerror.h62
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/luawinmacro.h40
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/stdmacro.h154
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/win_privileges.c96
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/win_privileges.h26
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/win_registry.c38
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/win_registry.h26
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/win_trace.c88
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/win_trace.h104
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/src/winreg.c1380
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/test/test_1.lua20
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/test/test_5_1_10.lua16
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/test/test_5_1_13.lua14
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/test/test_5_1_5.lua16
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/test/test_5_1_6.lua40
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/test/test_5_1_8.lua18
-rw-r--r--3rdparty/lua/src/modules/lua-winreg/test/test_5_1_9.lua14
-rw-r--r--3rdparty/lua/src/modules/w32resembed.c414
-rw-r--r--3rdparty/lua/src/modules/w32resembed.h72
-rw-r--r--3rdparty/lua/src/modules/winreg.c98
-rw-r--r--3rdparty/lua/src/modules/winreg.h42
-rw-r--r--3rdparty/lua/src/modules/wow64.c94
-rw-r--r--3rdparty/lua/src/modules/wow64.h34
-rw-r--r--3rdparty/lua/src/msvcbuild.bat2
-rw-r--r--3rdparty/lua/src/vm_arm.dasc17
-rw-r--r--3rdparty/lua/src/vm_mips.dasc10
-rw-r--r--3rdparty/lua/src/vm_ppc.dasc43
-rw-r--r--3rdparty/lua/src/vm_ppcspe.dasc2
-rw-r--r--3rdparty/lua/src/vm_x86.dasc25
-rw-r--r--3rdparty/lua/src/xedkbuild.bat4
230 files changed, 4333 insertions, 3929 deletions
diff --git a/3rdparty/lua/.gitignore b/3rdparty/lua/.gitignore
new file mode 100644
index 0000000..1a07bf7
--- /dev/null
+++ b/3rdparty/lua/.gitignore
@@ -0,0 +1,11 @@
+*.[oa]
+*.so
+*.obj
+*.lib
+*.exp
+*.dll
+*.exe
+*.manifest
+*.dmp
+*.swp
+.tags
diff --git a/3rdparty/lua/COPYRIGHT b/3rdparty/lua/COPYRIGHT
index 83ce94d..1ef7df6 100644
--- a/3rdparty/lua/COPYRIGHT
+++ b/3rdparty/lua/COPYRIGHT
@@ -1,7 +1,7 @@
===============================================================================
LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/
-Copyright (C) 2005-2013 Mike Pall. All rights reserved.
+Copyright (C) 2005-2015 Mike Pall. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/3rdparty/lua/Makefile b/3rdparty/lua/Makefile
index 8883503..0cbe741 100644
--- a/3rdparty/lua/Makefile
+++ b/3rdparty/lua/Makefile
@@ -10,12 +10,12 @@
# For MSVC, please follow the instructions given in src/msvcbuild.bat.
# For MinGW and Cygwin, cd to src and run make with the Makefile there.
#
-# Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+# Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
##############################################################################
MAJVER= 2
MINVER= 0
-RELVER= 2
+RELVER= 4
VERSION= $(MAJVER).$(MINVER).$(RELVER)
ABIVER= 5.1
@@ -25,11 +25,12 @@ ABIVER= 5.1
# the paths in src/luaconf.h, too. Note: PREFIX must be an absolute path!
#
export PREFIX= /usr/local
+export MULTILIB= lib
##############################################################################
DPREFIX= $(DESTDIR)$(PREFIX)
INSTALL_BIN= $(DPREFIX)/bin
-INSTALL_LIB= $(DPREFIX)/lib
+INSTALL_LIB= $(DPREFIX)/$(MULTILIB)
INSTALL_SHARE= $(DPREFIX)/share
INSTALL_INC= $(DPREFIX)/include/luajit-$(MAJVER).$(MINVER)
@@ -73,7 +74,8 @@ INSTALL_X= install -m 0755
INSTALL_F= install -m 0644
UNINSTALL= $(RM)
LDCONFIG= ldconfig -n
-SED_PC= sed -e "s|^prefix=.*|prefix=$(PREFIX)|"
+SED_PC= sed -e "s|^prefix=.*|prefix=$(PREFIX)|" \
+ -e "s|^multilib=.*|multilib=$(MULTILIB)|"
FILE_T= luajit
FILE_A= libluajit.a
diff --git a/3rdparty/lua/README b/3rdparty/lua/README
index d837fd2..44366af 100644
--- a/3rdparty/lua/README
+++ b/3rdparty/lua/README
@@ -1,11 +1,11 @@
-README for LuaJIT 2.0.2
+README for LuaJIT 2.0.4
-----------------------
LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language.
Project Homepage: http://luajit.org/
-LuaJIT is Copyright (C) 2005-2013 Mike Pall.
+LuaJIT is Copyright (C) 2005-2015 Mike Pall.
LuaJIT is free software, released under the MIT license.
See full Copyright Notice in the COPYRIGHT file or in luajit.h.
diff --git a/3rdparty/lua/datadumper.lua b/3rdparty/lua/datadumper.lua
index 825daf6..3c78c10 100644
--- a/3rdparty/lua/datadumper.lua
+++ b/3rdparty/lua/datadumper.lua
@@ -1,237 +1,237 @@
---[[ DataDumper.lua
-Copyright (c) 2007 Olivetti-Engineering SA
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-]]
-
-local dumplua_closure = [[
-local closures = {}
-local function closure(t)
- closures[#closures+1] = t
- t[1] = assert(loadstring(t[1]))
- return t[1]
-end
-
-for _,t in pairs(closures) do
- for i = 2,#t do
- debug.setupvalue(t[1], i-1, t[i])
- end
-end
-]]
-
-local lua_reserved_keywords = {
- 'and', 'break', 'do', 'else', 'elseif', 'end', 'false', 'for',
- 'function', 'if', 'in', 'local', 'nil', 'not', 'or', 'repeat',
- 'return', 'then', 'true', 'until', 'while' }
-
-local function keys(t)
- local res = {}
- local oktypes = { stringstring = true, numbernumber = true }
- local function cmpfct(a,b)
- if oktypes[type(a)..type(b)] then
- return a < b
- else
- return type(a) < type(b)
- end
- end
- for k in pairs(t) do
- res[#res+1] = k
- end
- table.sort(res, cmpfct)
- return res
-end
-
-local c_functions = {}
-for _,lib in pairs{'_G', 'string', 'table', 'math',
- 'io', 'os', 'coroutine', 'package', 'debug'} do
- local t = _G[lib] or {}
- lib = lib .. "."
- if lib == "_G." then lib = "" end
- for k,v in pairs(t) do
- if type(v) == 'function' and not pcall(string.dump, v) then
- c_functions[v] = lib..k
- end
- end
-end
-
-function DataDumper(value, varname, fastmode, ident)
- local defined, dumplua = {}
- -- Local variables for speed optimization
- local string_format, type, string_dump, string_rep =
- string.format, type, string.dump, string.rep
- local tostring, pairs, table_concat =
- tostring, pairs, table.concat
- local keycache, strvalcache, out, closure_cnt = {}, {}, {}, 0
- setmetatable(strvalcache, {__index = function(t,value)
- local res = string_format('%q', value)
- t[value] = res
- return res
- end})
- local fcts = {
- string = function(value) return strvalcache[value] end,
- number = function(value) return value end,
- boolean = function(value) return tostring(value) end,
- ['nil'] = function(value) return 'nil' end,
- ['function'] = function(value)
- return string_format("loadstring(%q)", string_dump(value))
- end,
- userdata = function() error("Cannot dump userdata") end,
- thread = function() error("Cannot dump threads") end,
- }
- local function test_defined(value, path)
- if defined[value] then
- if path:match("^getmetatable.*%)$") then
- out[#out+1] = string_format("s%s, %s)\n", path:sub(2,-2), defined[value])
- else
- out[#out+1] = path .. " = " .. defined[value] .. "\n"
- end
- return true
- end
- defined[value] = path
- end
- local function make_key(t, key)
- local s
- if type(key) == 'string' and key:match('^[_%a][_%w]*$') then
- s = key .. "="
- else
- s = "[" .. dumplua(key, 0) .. "]="
- end
- t[key] = s
- return s
- end
- for _,k in ipairs(lua_reserved_keywords) do
- keycache[k] = '["'..k..'"] = '
- end
- if fastmode then
- fcts.table = function (value)
- -- Table value
- local numidx = 1
- out[#out+1] = "{"
- for key,val in pairs(value) do
- if key == numidx then
- numidx = numidx + 1
- else
- out[#out+1] = keycache[key]
- end
- local str = dumplua(val)
- out[#out+1] = str..","
- end
- if string.sub(out[#out], -1) == "," then
- out[#out] = string.sub(out[#out], 1, -2);
- end
- out[#out+1] = "}"
- return ""
- end
- else
- fcts.table = function (value, ident, path)
- if test_defined(value, path) then return "nil" end
- -- Table value
- local sep, str, numidx, totallen = " ", {}, 1, 0
- local meta, metastr = (debug or getfenv()).getmetatable(value)
- if meta then
- ident = ident + 1
- metastr = dumplua(meta, ident, "getmetatable("..path..")")
- totallen = totallen + #metastr + 16
- end
- for _,key in pairs(keys(value)) do
- local val = value[key]
- local s = ""
- local subpath = path
- if key == numidx then
- subpath = subpath .. "[" .. numidx .. "]"
- numidx = numidx + 1
- else
- s = keycache[key]
- if not s:match "^%[" then subpath = subpath .. "." end
- subpath = subpath .. s:gsub("%s*=%s*$","")
- end
- s = s .. dumplua(val, ident+1, subpath)
- str[#str+1] = s
- totallen = totallen + #s + 2
- end
- if totallen > 80 then
- sep = "\n" .. string_rep(" ", ident+1)
- end
- str = "{"..sep..table_concat(str, ","..sep).." "..sep:sub(1,-3).."}"
- if meta then
- sep = sep:sub(1,-3)
- return "setmetatable("..sep..str..","..sep..metastr..sep:sub(1,-3)..")"
- end
- return str
- end
- fcts['function'] = function (value, ident, path)
- if test_defined(value, path) then return "nil" end
- if c_functions[value] then
- return c_functions[value]
- elseif debug == nil or debug.getupvalue(value, 1) == nil then
- return string_format("loadstring(%q)", string_dump(value))
- end
- closure_cnt = closure_cnt + 1
- local res = {string.dump(value)}
- for i = 1,math.huge do
- local name, v = debug.getupvalue(value,i)
- if name == nil then break end
- res[i+1] = v
- end
- return "closure " .. dumplua(res, ident, "closures["..closure_cnt.."]")
- end
- end
- function dumplua(value, ident, path)
- local mapping = { project = "table", solution = "table" }
- if mapping[type(value)] and not fcts[type(value)] then
- fcts[type(value)] = fcts[mapping[type(value)]]
- end
- return fcts[type(value)](value, ident, path)
- end
- if varname == nil then
- varname = "return "
- elseif varname:match("^[%a_][%w_]*$") then
- varname = varname .. " = "
- end
- if fastmode then
- setmetatable(keycache, {__index = make_key })
- out[1] = varname
- table.insert(out,dumplua(value, 0))
- return table.concat(out)
- else
- setmetatable(keycache, {__index = make_key })
- local items = {}
- for i=1,10 do items[i] = '' end
- items[3] = dumplua(value, ident or 0, "t")
- if closure_cnt > 0 then
- items[1], items[6] = dumplua_closure:match("(.*\n)\n(.*)")
- out[#out+1] = ""
- end
- if #out > 0 then
- items[2], items[4] = "local t = ", "\n"
- items[5] = table.concat(out)
- items[7] = varname .. "t"
- else
- items[2] = varname
- end
- return table.concat(items)
- end
-end
-
-function dump(...)
- print(DataDumper(...), "\n---")
-end
+--[[ DataDumper.lua
+Copyright (c) 2007 Olivetti-Engineering SA
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+]]
+
+local dumplua_closure = [[
+local closures = {}
+local function closure(t)
+ closures[#closures+1] = t
+ t[1] = assert(loadstring(t[1]))
+ return t[1]
+end
+
+for _,t in pairs(closures) do
+ for i = 2,#t do
+ debug.setupvalue(t[1], i-1, t[i])
+ end
+end
+]]
+
+local lua_reserved_keywords = {
+ 'and', 'break', 'do', 'else', 'elseif', 'end', 'false', 'for',
+ 'function', 'if', 'in', 'local', 'nil', 'not', 'or', 'repeat',
+ 'return', 'then', 'true', 'until', 'while' }
+
+local function keys(t)
+ local res = {}
+ local oktypes = { stringstring = true, numbernumber = true }
+ local function cmpfct(a,b)
+ if oktypes[type(a)..type(b)] then
+ return a < b
+ else
+ return type(a) < type(b)
+ end
+ end
+ for k in pairs(t) do
+ res[#res+1] = k
+ end
+ table.sort(res, cmpfct)
+ return res
+end
+
+local c_functions = {}
+for _,lib in pairs{'_G', 'string', 'table', 'math',
+ 'io', 'os', 'coroutine', 'package', 'debug'} do
+ local t = _G[lib] or {}
+ lib = lib .. "."
+ if lib == "_G." then lib = "" end
+ for k,v in pairs(t) do
+ if type(v) == 'function' and not pcall(string.dump, v) then
+ c_functions[v] = lib..k
+ end
+ end
+end
+
+function DataDumper(value, varname, fastmode, ident)
+ local defined, dumplua = {}
+ -- Local variables for speed optimization
+ local string_format, type, string_dump, string_rep =
+ string.format, type, string.dump, string.rep
+ local tostring, pairs, table_concat =
+ tostring, pairs, table.concat
+ local keycache, strvalcache, out, closure_cnt = {}, {}, {}, 0
+ setmetatable(strvalcache, {__index = function(t,value)
+ local res = string_format('%q', value)
+ t[value] = res
+ return res
+ end})
+ local fcts = {
+ string = function(value) return strvalcache[value] end,
+ number = function(value) return value end,
+ boolean = function(value) return tostring(value) end,
+ ['nil'] = function(value) return 'nil' end,
+ ['function'] = function(value)
+ return string_format("loadstring(%q)", string_dump(value))
+ end,
+ userdata = function() error("Cannot dump userdata") end,
+ thread = function() error("Cannot dump threads") end,
+ }
+ local function test_defined(value, path)
+ if defined[value] then
+ if path:match("^getmetatable.*%)$") then
+ out[#out+1] = string_format("s%s, %s)\n", path:sub(2,-2), defined[value])
+ else
+ out[#out+1] = path .. " = " .. defined[value] .. "\n"
+ end
+ return true
+ end
+ defined[value] = path
+ end
+ local function make_key(t, key)
+ local s
+ if type(key) == 'string' and key:match('^[_%a][_%w]*$') then
+ s = key .. "="
+ else
+ s = "[" .. dumplua(key, 0) .. "]="
+ end
+ t[key] = s
+ return s
+ end
+ for _,k in ipairs(lua_reserved_keywords) do
+ keycache[k] = '["'..k..'"] = '
+ end
+ if fastmode then
+ fcts.table = function (value)
+ -- Table value
+ local numidx = 1
+ out[#out+1] = "{"
+ for key,val in pairs(value) do
+ if key == numidx then
+ numidx = numidx + 1
+ else
+ out[#out+1] = keycache[key]
+ end
+ local str = dumplua(val)
+ out[#out+1] = str..","
+ end
+ if string.sub(out[#out], -1) == "," then
+ out[#out] = string.sub(out[#out], 1, -2);
+ end
+ out[#out+1] = "}"
+ return ""
+ end
+ else
+ fcts.table = function (value, ident, path)
+ if test_defined(value, path) then return "nil" end
+ -- Table value
+ local sep, str, numidx, totallen = " ", {}, 1, 0
+ local meta, metastr = (debug or getfenv()).getmetatable(value)
+ if meta then
+ ident = ident + 1
+ metastr = dumplua(meta, ident, "getmetatable("..path..")")
+ totallen = totallen + #metastr + 16
+ end
+ for _,key in pairs(keys(value)) do
+ local val = value[key]
+ local s = ""
+ local subpath = path
+ if key == numidx then
+ subpath = subpath .. "[" .. numidx .. "]"
+ numidx = numidx + 1
+ else
+ s = keycache[key]
+ if not s:match "^%[" then subpath = subpath .. "." end
+ subpath = subpath .. s:gsub("%s*=%s*$","")
+ end
+ s = s .. dumplua(val, ident+1, subpath)
+ str[#str+1] = s
+ totallen = totallen + #s + 2
+ end
+ if totallen > 80 then
+ sep = "\n" .. string_rep(" ", ident+1)
+ end
+ str = "{"..sep..table_concat(str, ","..sep).." "..sep:sub(1,-3).."}"
+ if meta then
+ sep = sep:sub(1,-3)
+ return "setmetatable("..sep..str..","..sep..metastr..sep:sub(1,-3)..")"
+ end
+ return str
+ end
+ fcts['function'] = function (value, ident, path)
+ if test_defined(value, path) then return "nil" end
+ if c_functions[value] then
+ return c_functions[value]
+ elseif debug == nil or debug.getupvalue(value, 1) == nil then
+ return string_format("loadstring(%q)", string_dump(value))
+ end
+ closure_cnt = closure_cnt + 1
+ local res = {string.dump(value)}
+ for i = 1,math.huge do
+ local name, v = debug.getupvalue(value,i)
+ if name == nil then break end
+ res[i+1] = v
+ end
+ return "closure " .. dumplua(res, ident, "closures["..closure_cnt.."]")
+ end
+ end
+ function dumplua(value, ident, path)
+ local mapping = { project = "table", solution = "table" }
+ if mapping[type(value)] and not fcts[type(value)] then
+ fcts[type(value)] = fcts[mapping[type(value)]]
+ end
+ return fcts[type(value)](value, ident, path)
+ end
+ if varname == nil then
+ varname = "return "
+ elseif varname:match("^[%a_][%w_]*$") then
+ varname = varname .. " = "
+ end
+ if fastmode then
+ setmetatable(keycache, {__index = make_key })
+ out[1] = varname
+ table.insert(out,dumplua(value, 0))
+ return table.concat(out)
+ else
+ setmetatable(keycache, {__index = make_key })
+ local items = {}
+ for i=1,10 do items[i] = '' end
+ items[3] = dumplua(value, ident or 0, "t")
+ if closure_cnt > 0 then
+ items[1], items[6] = dumplua_closure:match("(.*\n)\n(.*)")
+ out[#out+1] = ""
+ end
+ if #out > 0 then
+ items[2], items[4] = "local t = ", "\n"
+ items[5] = table.concat(out)
+ items[7] = varname .. "t"
+ else
+ items[2] = varname
+ end
+ return table.concat(items)
+ end
+end
+
+function dump(...)
+ print(DataDumper(...), "\n---")
+end
diff --git a/3rdparty/lua/doc/bluequad-print.css b/3rdparty/lua/doc/bluequad-print.css
index 41ae757..07f5c84 100644
--- a/3rdparty/lua/doc/bluequad-print.css
+++ b/3rdparty/lua/doc/bluequad-print.css
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004-2013 Mike Pall.
+/* Copyright (C) 2004-2015 Mike Pall.
*
* You are welcome to use the general ideas of this design for your own sites.
* But please do not steal the stylesheet, the layout or the color scheme.
diff --git a/3rdparty/lua/doc/bluequad.css b/3rdparty/lua/doc/bluequad.css
index 5e8d5ce..ae53143 100644
--- a/3rdparty/lua/doc/bluequad.css
+++ b/3rdparty/lua/doc/bluequad.css
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004-2013 Mike Pall.
+/* Copyright (C) 2004-2015 Mike Pall.
*
* You are welcome to use the general ideas of this design for your own sites.
* But please do not steal the stylesheet, the layout or the color scheme.
diff --git a/3rdparty/lua/doc/changes.html b/3rdparty/lua/doc/changes.html
index b3deeaf..d7b83ce 100644
--- a/3rdparty/lua/doc/changes.html
+++ b/3rdparty/lua/doc/changes.html
@@ -4,7 +4,7 @@
<title>LuaJIT Change History</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2013, Mike Pall">
+<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@@ -63,7 +63,7 @@ div.major { max-width: 600px; padding: 1em; margin: 1em 0 1em 0; }
<div id="main">
<p>
This is a list of changes between the released versions of LuaJIT.<br>
-The current <span style="color: #0000c0;">stable version</span> is <strong>LuaJIT&nbsp;2.0.2</strong>.<br>
+The current <span style="color: #0000c0;">stable version</span> is <strong>LuaJIT&nbsp;2.0.4</strong>.<br>
</p>
<p>
Please check the
@@ -72,6 +72,92 @@ to see whether newer versions are available.
</p>
<div class="major" style="background: #d0d0ff;">
+<h2 id="LuaJIT-2.0.4">LuaJIT 2.0.4 &mdash; 2015-05-14</h2>
+<ul>
+<li>Fix stack check in narrowing optimization.</li>
+<li>Fix Lua/C API typecheck error for special indexes.</li>
+<li>Fix string to number conversion.</li>
+<li>Fix lexer error for chunks without tokens.</li>
+<li>Don't compile <tt>IR_RETF</tt> after <tt>CALLT</tt> to ff with-side effects.</li>
+<li>Fix <tt>BC_UCLO</tt>/<tt>BC_JMP</tt> join optimization in Lua parser.</li>
+<li>Fix corner case in string to number conversion.</li>
+<li>Gracefully handle <tt>lua_error()</tt> for a suspended coroutine.</li>
+<li>Avoid error messages when building with Clang.</li>
+<li>Fix snapshot #0 handling for traces with a stack check on entry.</li>
+<li>Fix fused constant loads under high register pressure.</li>
+<li>Invalidate backpropagation cache after DCE.</li>
+<li>Fix ABC elimination.</li>
+<li>Fix debug info for main chunk of stripped bytecode.</li>
+<li>Fix FOLD rule for <tt>string.sub(s, ...) == k</tt>.</li>
+<li>Fix FOLD rule for <tt>STRREF</tt> of <tt>SNEW</tt>.</li>
+<li>Fix frame traversal while searching for error function.</li>
+<li>Prevent GC estimate miscalculation due to buffer growth.</li>
+<li>Prevent adding side traces for stack checks.</li>
+<li>Fix top slot calculation for snapshots with continuations.</li>
+<li>Fix check for reuse of SCEV results in <tt>FORL</tt>.</li>
+<li>Add PS Vita port.</li>
+<li>Fix compatibility issues with Illumos.</li>
+<li>Fix DragonFly build (unsupported).</li>
+<li>OpenBSD/x86: Better executable memory allocation for W^X mode.</li>
+<li>x86: Fix argument checks for <tt>ipairs()</tt> iterator.</li>
+<li>x86: <tt>lj_math_random_step()</tt> clobbers XMM regs on OSX Clang.</li>
+<li>x86: Fix code generation for unused result of <tt>math.random()</tt>.</li>
+<li>x64: Allow building with <tt>LUAJIT_USE_SYSMALLOC</tt> and <tt>LUAJIT_USE_VALGRIND</tt>.</li>
+<li>x86/x64: Fix argument check for bit shifts.</li>
+<li>x86/x64: Fix code generation for fused test/arith ops.</li>
+<li>ARM: Fix write barrier check in <tt>BC_USETS</tt>.</li>
+<li>PPC: Fix red zone overflow in machine code generation.</li>
+<li>PPC: Don't use <tt>mcrxr</tt> on PPE.</li>
+<li>Various archs: Fix excess stack growth in interpreter.</li>
+<li>FFI: Fix FOLD rule for <tt>TOBIT</tt> + <tt>CONV num.u32</tt>.</li>
+<li>FFI: Prevent DSE across <tt>ffi.string()</tt>.</li>
+<li>FFI: No meta fallback when indexing pointer to incomplete struct.</li>
+<li>FFI: Fix initialization of unions of subtypes.</li>
+<li>FFI: Fix cdata vs. non-cdata arithmetic and comparisons.</li>
+<li>FFI: Fix <tt>__index</tt>/<tt>__newindex</tt> metamethod resolution for ctypes.</li>
+<li>FFI: Fix compilation of reference field access.</li>
+<li>FFI: Fix frame traversal for backtraces with FFI callbacks.</li>
+<li>FFI: Fix recording of indexing a struct pointer ctype object itself.</li>
+<li>FFI: Allow non-scalar cdata to be compared for equality by address.</li>
+<li>FFI: Fix pseudo type conversions for type punning.</li>
+</ul>
+
+<h2 id="LuaJIT-2.0.3">LuaJIT 2.0.3 &mdash; 2014-03-12</h2>
+<ul>
+<li>Add PS4 port.</li>
+<li>Add support for multilib distro builds.</li>
+<li>Fix OSX build.</li>
+<li>Fix MinGW build.</li>
+<li>Fix Xbox 360 build.</li>
+<li>Improve ULOAD forwarding for open upvalues.</li>
+<li>Fix GC steps threshold handling when called by JIT-compiled code.</li>
+<li>Fix argument checks for <tt>math.deg()</tt> and <tt>math.rad()</tt>.</li>
+<li>Fix <tt>jit.flush(func|true)</tt>.</li>
+<li>Respect <tt>jit.off(func)</tt> when returning to a function, too.</li>
+<li>Fix compilation of <tt>string.byte(s, nil, n)</tt>.</li>
+<li>Fix line number for relocated bytecode after closure fixup</li>
+<li>Fix frame traversal for backtraces.</li>
+<li>Fix ABC elimination.</li>
+<li>Fix handling of redundant PHIs.</li>
+<li>Fix snapshot restore for exit to function header.</li>
+<li>Fix type punning alias analysis for constified pointers</li>
+<li>Fix call unroll checks in the presence of metamethod frames.</li>
+<li>Fix initial maxslot for down-recursive traces.</li>
+<li>Prevent BASE register coalescing if parent uses <tt>IR_RETF</tt>.</li>
+<li>Don't purge modified function from stack slots in <tt>BC_RET</tt>.</li>
+<li>Fix recording of <tt>BC_VARG</tt>.</li>
+<li>Don't access dangling reference to reallocated IR.</li>
+<li>Fix frame depth display for bytecode dump in <tt>-jdump</tt>.</li>
+<li>ARM: Fix register allocation when rematerializing FPRs.</li>
+<li>x64: Fix store to upvalue for lightuserdata values.</li>
+<li>FFI: Add missing GC steps for callback argument conversions.</li>
+<li>FFI: Properly unload loaded DLLs.</li>
+<li>FFI: Fix argument checks for <tt>ffi.string()</tt>.</li>
+<li>FFI/x64: Fix passing of vector arguments to calls.</li>
+<li>FFI: Rehash finalizer table after GC cycle, if needed.</li>
+<li>FFI: Fix <tt>cts-&gt;L</tt> for cdata unsinking in snapshot restore.</li>
+</ul>
+
<h2 id="LuaJIT-2.0.2">LuaJIT 2.0.2 &mdash; 2013-06-03</h2>
<ul>
<li>Fix memory access check for fast string interning.</li>
@@ -882,7 +968,7 @@ This is the initial non-public release of LuaJIT.
</div>
<div id="foot">
<hr class="hide">
-Copyright &copy; 2005-2013 Mike Pall
+Copyright &copy; 2005-2015 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>
diff --git a/3rdparty/lua/doc/contact.html b/3rdparty/lua/doc/contact.html
index 4735faf..0ef01a7 100644
--- a/3rdparty/lua/doc/contact.html
+++ b/3rdparty/lua/doc/contact.html
@@ -4,7 +4,7 @@
<title>Contact</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2013, Mike Pall">
+<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@@ -84,7 +84,7 @@ xD("fyZKB8xv\"FJytmz8.KAB0u52D")
<h2>Copyright</h2>
<p>
All documentation is
-Copyright &copy; 2005-2013 Mike Pall.
+Copyright &copy; 2005-2015 Mike Pall.
</p>
@@ -92,7 +92,7 @@ Copyright &copy; 2005-2013 Mike Pall.
</div>
<div id="foot">
<hr class="hide">
-Copyright &copy; 2005-2013 Mike Pall
+Copyright &copy; 2005-2015 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>
diff --git a/3rdparty/lua/doc/ext_c_api.html b/3rdparty/lua/doc/ext_c_api.html
index c6feb8e..6598180 100644
--- a/3rdparty/lua/doc/ext_c_api.html
+++ b/3rdparty/lua/doc/ext_c_api.html
@@ -4,7 +4,7 @@
<title>Lua/C API Extensions</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2013, Mike Pall">
+<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@@ -177,7 +177,7 @@ Also note that this mechanism is not without overhead.
</div>
<div id="foot">
<hr class="hide">
-Copyright &copy; 2005-2013 Mike Pall
+Copyright &copy; 2005-2015 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>
diff --git a/3rdparty/lua/doc/ext_ffi.html b/3rdparty/lua/doc/ext_ffi.html
index a146b05..77b8e26 100644
--- a/3rdparty/lua/doc/ext_ffi.html
+++ b/3rdparty/lua/doc/ext_ffi.html
@@ -4,7 +4,7 @@
<title>FFI Library</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2013, Mike Pall">
+<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@@ -320,7 +320,7 @@ without undue conversion penalties.
</div>
<div id="foot">
<hr class="hide">
-Copyright &copy; 2005-2013 Mike Pall
+Copyright &copy; 2005-2015 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>
diff --git a/3rdparty/lua/doc/ext_ffi_api.html b/3rdparty/lua/doc/ext_ffi_api.html
index 8b2555b..8f577e9 100644
--- a/3rdparty/lua/doc/ext_ffi_api.html
+++ b/3rdparty/lua/doc/ext_ffi_api.html
@@ -4,7 +4,7 @@
<title>ffi.* API Functions</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2013, Mike Pall">
+<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@@ -556,7 +556,7 @@ named <tt>i</tt>.
</div>
<div id="foot">
<hr class="hide">
-Copyright &copy; 2005-2013 Mike Pall
+Copyright &copy; 2005-2015 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>
diff --git a/3rdparty/lua/doc/ext_ffi_semantics.html b/3rdparty/lua/doc/ext_ffi_semantics.html
index 0322901..c267b55 100644
--- a/3rdparty/lua/doc/ext_ffi_semantics.html
+++ b/3rdparty/lua/doc/ext_ffi_semantics.html
@@ -4,7 +4,7 @@
<title>FFI Semantics</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2013, Mike Pall">
+<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@@ -1188,7 +1188,9 @@ storing and initializing them are supported, yet.</li>
<li>The <tt>volatile</tt> type qualifier is currently ignored by
compiled code.</li>
<li><a href="ext_ffi_api.html#ffi_cdef"><tt>ffi.cdef</tt></a> silently
-ignores all re-declarations.</li>
+ignores most re-declarations. Note: avoid re-declarations which do not
+conform to C99. The implementation will eventually be changed to
+perform strict checks.</li>
</ul>
<p>
The JIT compiler already handles a large subset of all FFI operations.
@@ -1233,7 +1235,7 @@ compiled.</li>
</div>
<div id="foot">
<hr class="hide">
-Copyright &copy; 2005-2013 Mike Pall
+Copyright &copy; 2005-2015 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>
diff --git a/3rdparty/lua/doc/ext_ffi_tutorial.html b/3rdparty/lua/doc/ext_ffi_tutorial.html
index 30213b3..8f99bfb 100644
--- a/3rdparty/lua/doc/ext_ffi_tutorial.html
+++ b/3rdparty/lua/doc/ext_ffi_tutorial.html
@@ -4,7 +4,7 @@
<title>FFI Tutorial</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2013, Mike Pall">
+<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@@ -564,7 +564,7 @@ Thus it's not helpful and actually counter-productive to cache
individual C&nbsp;functions like this:
</p>
<pre class="code">
-local <b>funca</b>, <b>funcb</b> = ffi.C.funcb, ffi.C.funcb -- <span style="color:#c00000;">Not helpful!</span>
+local <b>funca</b>, <b>funcb</b> = ffi.C.funca, ffi.C.funcb -- <span style="color:#c00000;">Not helpful!</span>
local function foo(x, n)
for i=1,n do <b>funcb</b>(<b>funca</b>(x, i), 1) end
end
@@ -591,7 +591,7 @@ it to a local variable in the function scope is unnecessary.
</div>
<div id="foot">
<hr class="hide">
-Copyright &copy; 2005-2013 Mike Pall
+Copyright &copy; 2005-2015 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>
diff --git a/3rdparty/lua/doc/ext_jit.html b/3rdparty/lua/doc/ext_jit.html
index cc00e72..27351dd 100644
--- a/3rdparty/lua/doc/ext_jit.html
+++ b/3rdparty/lua/doc/ext_jit.html
@@ -4,7 +4,7 @@
<title>jit.* Library</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2013, Mike Pall">
+<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@@ -151,7 +151,7 @@ Contains the target OS name:
<h3 id="jit_arch"><tt>jit.arch</tt></h3>
<p>
Contains the target architecture name:
-"x86", "x64" or "ppcspe".
+"x86", "x64", "arm", "ppc", "ppcspe", or "mips".
</p>
<h2 id="jit_opt"><tt>jit.opt.*</tt> &mdash; JIT compiler optimization control</h2>
@@ -189,7 +189,7 @@ if you want to know more.
</div>
<div id="foot">
<hr class="hide">
-Copyright &copy; 2005-2013 Mike Pall
+Copyright &copy; 2005-2015 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>
diff --git a/3rdparty/lua/doc/extensions.html b/3rdparty/lua/doc/extensions.html
index 8684dc3..e9cd136 100644
--- a/3rdparty/lua/doc/extensions.html
+++ b/3rdparty/lua/doc/extensions.html
@@ -4,7 +4,7 @@
<title>Extensions</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2013, Mike Pall">
+<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@@ -398,7 +398,7 @@ lead to the termination of the process.</li>
</div>
<div id="foot">
<hr class="hide">
-Copyright &copy; 2005-2013 Mike Pall
+Copyright &copy; 2005-2015 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>
diff --git a/3rdparty/lua/doc/faq.html b/3rdparty/lua/doc/faq.html
index c61b8dc..9902f09 100644
--- a/3rdparty/lua/doc/faq.html
+++ b/3rdparty/lua/doc/faq.html
@@ -4,7 +4,7 @@
<title>Frequently Asked Questions (FAQ)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2013, Mike Pall">
+<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@@ -174,7 +174,7 @@ the development of certain features, if they are important to you.
</div>
<div id="foot">
<hr class="hide">
-Copyright &copy; 2005-2013 Mike Pall
+Copyright &copy; 2005-2015 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>
diff --git a/3rdparty/lua/doc/install.html b/3rdparty/lua/doc/install.html
index faf19c4..7a878b1 100644
--- a/3rdparty/lua/doc/install.html
+++ b/3rdparty/lua/doc/install.html
@@ -4,7 +4,7 @@
<title>Installation</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2013, Mike Pall">
+<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@@ -120,14 +120,14 @@ operating systems, CPUs and compilers:
<tr class="even">
<td class="compatcpu">x64 (64 bit)</td>
<td class="compatos">GCC 4.x</td>
-<td class="compatos compatno">&nbsp;</td>
+<td class="compatos">ORBIS (<a href="#ps4">PS4</a>)</td>
<td class="compatos">GCC 4.x</td>
<td class="compatos">MSVC + SDK v7.0<br>WinSDK v7.0</td>
</tr>
<tr class="odd">
<td class="compatcpu"><a href="#cross2">ARMv5+<br>ARM9E+</a></td>
<td class="compatos">GCC 4.2+</td>
-<td class="compatos">GCC 4.2+</td>
+<td class="compatos">GCC 4.2+<br>PSP2 (<a href="#psvita">PS VITA</a>)</td>
<td class="compatos">GCC 4.2+</td>
<td class="compatos compatno">&nbsp;</td>
</tr>
@@ -188,8 +188,8 @@ open a terminal window and change to this directory. Now unpack the archive
and change to the newly created directory:
</p>
<pre class="code">
-tar zxf LuaJIT-2.0.2.tar.gz
-cd LuaJIT-2.0.2</pre>
+tar zxf LuaJIT-2.0.4.tar.gz
+cd LuaJIT-2.0.4</pre>
<h3>Building LuaJIT</h3>
<p>
The supplied Makefiles try to auto-detect the settings needed for your
@@ -458,25 +458,56 @@ ISDKF="-arch armv7 -isysroot $ISDK/SDKs/$ISDKVER"
make HOST_CC="gcc -m32 -arch i386" CROSS=$ISDKP TARGET_FLAGS="$ISDKF" \
TARGET_SYS=iOS
</pre>
+
+<h3 id="consoles">Cross-compiling for consoles</h3>
+<p>
+Building LuaJIT for consoles requires both a supported host compiler
+(x86 or x64) and a cross-compiler (to PPC or ARM) from the official
+console SDK.
+</p>
+<p>
+Due to restrictions on consoles, the JIT compiler is disabled and only
+the fast interpreter is built. This is still faster than plain Lua,
+but much slower than the JIT compiler. The FFI is disabled, too, since
+it's not very useful in such an environment.
+</p>
+<p>
+The following commands build a static library <tt>libluajit.a</tt>,
+which can be linked against your game, just like the Lua library.
+</p>
<p>
-You can cross-compile for <b id="ps3">PS3</b> using the PS3&nbsp;SDK from
-a Linux host or a Windows host (requires 32 bit MinGW (GCC) on the host,
-too). Due to restrictions on consoles, the JIT compiler is disabled and
-only the fast interpreter is built:
+To cross-compile for <b id="ps3">PS3</b> from a Linux host (requires
+32&nbsp;bit GCC, i.e. multilib Linux/x64) or a Windows host (requires
+32&nbsp;bit MinGW), run this command:
</p>
<pre class="code">
make HOST_CC="gcc -m32" CROSS=ppu-lv2-
</pre>
<p>
-You can cross-compile for <b id="xbox360">Xbox 360</b> using the
-Xbox&nbsp;360 SDK (MSVC + XEDK). Due to restrictions on consoles, the
-JIT compiler is disabled and only the fast interpreter is built.
+To cross-compile for <b id="ps4">PS4</b> from a Windows host,
+open a "Visual Studio .NET Command Prompt" (64&nbsp;bit host compiler),
+<tt>cd</tt> to the directory where you've unpacked the sources and
+run the following commands:
</p>
+<pre class="code">
+cd src
+ps4build
+</pre>
<p>
-Open a "Visual Studio .NET Command Prompt" (32&nbsp;bit host compiler),
+To cross-compile for <b id="psvita">PS Vita</b> from a Windows host,
+open a "Visual Studio .NET Command Prompt" (32&nbsp;bit host compiler),
+<tt>cd</tt> to the directory where you've unpacked the sources and
+run the following commands:
+</p>
+<pre class="code">
+cd src
+psvitabuild
+</pre>
+<p>
+To cross-compile for <b id="xbox360">Xbox 360</b> from a Windows host,
+open a "Visual Studio .NET Command Prompt" (32&nbsp;bit host compiler),
<tt>cd</tt> to the directory where you've unpacked the sources and run
-the following commands. This builds a static library <tt>luajit20.lib</tt>,
-which can be linked against your game, just like the Lua library.
+the following commands:
</p>
<pre class="code">
cd src
@@ -565,9 +596,11 @@ for a regular distribution build:
<ul>
<li><tt>PREFIX</tt> overrides the installation path and should usually
be set to <tt>/usr</tt>. Setting this also changes the module paths and
-the <tt>-rpath</tt> of the shared library.</li>
+the paths needed to locate the shared library.</li>
<li><tt>DESTDIR</tt> is an absolute path which allows you to install
to a shadow tree instead of the root tree of the build system.</li>
+<li><tt>MULTILIB</tt> sets the architecture-specific library path component
+for multilib systems. The default is <tt>lib</tt>.</li>
<li>Have a look at the top-level <tt>Makefile</tt> and <tt>src/Makefile</tt>
for additional variables to tweak. The following variables <em>may</em> be
overridden, but it's <em>not</em> recommended, except for special needs
@@ -603,7 +636,7 @@ to me (the upstream) and not you (the package maintainer), anyway.
</div>
<div id="foot">
<hr class="hide">
-Copyright &copy; 2005-2013 Mike Pall
+Copyright &copy; 2005-2015 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>
diff --git a/3rdparty/lua/doc/luajit.html b/3rdparty/lua/doc/luajit.html
index e8581d3..45507c1 100644
--- a/3rdparty/lua/doc/luajit.html
+++ b/3rdparty/lua/doc/luajit.html
@@ -4,7 +4,7 @@
<title>LuaJIT</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2013, Mike Pall">
+<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@@ -38,6 +38,9 @@ table.os1 td {
table.os2 td {
color: #ffa040;
}
+table.os3 td {
+ color: #40ffff;
+}
table.compiler td {
color: #2080ff;
background: #62bf41;
@@ -147,7 +150,7 @@ Lua is a powerful, dynamic and light-weight programming language.
It may be embedded or used as a general-purpose, stand-alone language.
</p>
<p>
-LuaJIT is Copyright &copy; 2005-2013 Mike Pall, released under the
+LuaJIT is Copyright &copy; 2005-2015 Mike Pall, released under the
<a href="http://www.opensource.org/licenses/mit-license.php"><span class="ext">&raquo;</span>&nbsp;MIT open source license</a>.
</p>
<p>
@@ -158,7 +161,10 @@ LuaJIT is Copyright &copy; 2005-2013 Mike Pall, released under the
<tr><td>Windows</td><td>Linux</td><td>BSD</td><td>OSX</td><td>POSIX</td></tr>
</table>
<table class="feature os os2">
-<tr><td><span style="font-size:90%;">Embedded</span></td><td>Android</td><td>iOS</td><td>PS3</td><td>Xbox 360</td></tr>
+<tr><td><span style="font-size:90%;">Embedded</span></td><td>Android</td><td>iOS</td></tr>
+</table>
+<table class="feature os os3">
+<tr><td>PS3</td><td>PS4</td><td>PS Vita</td><td>Xbox 360</td></tr>
</table>
<table class="feature compiler">
<tr><td>GCC</td><td>CLANG<br>LLVM</td><td>MSVC</td></tr>
@@ -218,7 +224,7 @@ Please select a sub-topic in the navigation bar to learn more about LuaJIT.
</div>
<div id="foot">
<hr class="hide">
-Copyright &copy; 2005-2013 Mike Pall
+Copyright &copy; 2005-2015 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>
diff --git a/3rdparty/lua/doc/running.html b/3rdparty/lua/doc/running.html
index 3149b38..c6e1c29 100644
--- a/3rdparty/lua/doc/running.html
+++ b/3rdparty/lua/doc/running.html
@@ -4,7 +4,7 @@
<title>Running LuaJIT</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2013, Mike Pall">
+<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@@ -186,7 +186,7 @@ itself. For a description of their options and output format, please
read the comment block at the start of their source.
They can be found in the <tt>lib</tt> directory of the source
distribution or installed under the <tt>jit</tt> directory. By default
-this is <tt>/usr/local/share/luajit-2.0.2/jit</tt> on POSIX
+this is <tt>/usr/local/share/luajit-2.0.4/jit</tt> on POSIX
systems.
</p>
@@ -296,7 +296,7 @@ Here are the parameters and their default settings:
</div>
<div id="foot">
<hr class="hide">
-Copyright &copy; 2005-2013 Mike Pall
+Copyright &copy; 2005-2015 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>
diff --git a/3rdparty/lua/doc/status.html b/3rdparty/lua/doc/status.html
index 3d148b0..b4bbec7 100644
--- a/3rdparty/lua/doc/status.html
+++ b/3rdparty/lua/doc/status.html
@@ -1,10 +1,10 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
-<title>Status &amp; Roadmap</title>
+<title>Status</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Mike Pall">
-<meta name="Copyright" content="Copyright (C) 2005-2013, Mike Pall">
+<meta name="Copyright" content="Copyright (C) 2005-2015, Mike Pall">
<meta name="Language" content="en">
<link rel="stylesheet" type="text/css" href="bluequad.css" media="screen">
<link rel="stylesheet" type="text/css" href="bluequad-print.css" media="print">
@@ -17,7 +17,7 @@ ul li { padding-bottom: 0.3em; }
<a href="http://luajit.org"><span>Lua<span id="logo">JIT</span></span></a>
</div>
<div id="head">
-<h1>Status &amp; Roadmap</h1>
+<h1>Status</h1>
</div>
<div id="nav">
<ul><li>
@@ -102,20 +102,11 @@ handled correctly. The error may fall through an on-trace
garbage collector.
</li>
</ul>
-
-<h2>Roadmap</h2>
-<p>
-Please refer to the
-<a href="http://www.freelists.org/post/luajit/LuaJIT-Roadmap-20122013"><span class="ext">&raquo;</span>&nbsp;LuaJIT Roadmap 2012/2013</a> and an
-<a href="http://www.freelists.org/post/luajit/LuaJIT-Roadmap-20122013-UPDATE"><span class="ext">&raquo;</span>&nbsp;update on release planning</a> for details.
-</p>
-<p>
-</p>
<br class="flush">
</div>
<div id="foot">
<hr class="hide">
-Copyright &copy; 2005-2013 Mike Pall
+Copyright &copy; 2005-2015 Mike Pall
<span class="noprint">
&middot;
<a href="contact.html">Contact</a>
diff --git a/3rdparty/lua/dynasm/dasm_arm.h b/3rdparty/lua/dynasm/dasm_arm.h
index d83cbbb..57e0116 100644
--- a/3rdparty/lua/dynasm/dasm_arm.h
+++ b/3rdparty/lua/dynasm/dasm_arm.h
@@ -1,6 +1,6 @@
/*
** DynASM ARM encoding engine.
-** Copyright (C) 2005-2013 Mike Pall. All rights reserved.
+** Copyright (C) 2005-2015 Mike Pall. All rights reserved.
** Released under the MIT license. See dynasm.lua for full copyright notice.
*/
diff --git a/3rdparty/lua/dynasm/dasm_arm.lua b/3rdparty/lua/dynasm/dasm_arm.lua
index 9720e57..90a259c 100644
--- a/3rdparty/lua/dynasm/dasm_arm.lua
+++ b/3rdparty/lua/dynasm/dasm_arm.lua
@@ -1,7 +1,7 @@
------------------------------------------------------------------------------
-- DynASM ARM module.
--
--- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
+-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
-- See dynasm.lua for full copyright notice.
------------------------------------------------------------------------------
@@ -923,19 +923,22 @@ local function parse_template(params, template, nparams, pos)
end
map_op[".template__"] = function(params, template, nparams)
- if not params then return sub(template, 9) end
+ if not params then return template:gsub("%x%x%x%x%x%x%x%x", "") end
-- Limit number of section buffer positions used by a single dasm_put().
-- A single opcode needs a maximum of 3 positions.
if secpos+3 > maxsecpos then wflush() end
local pos = wpos()
- local apos, spos = #actargs, secpos
+ local lpos, apos, spos = #actlist, #actargs, secpos
local ok, err
for t in gmatch(template, "[^|]+") do
ok, err = pcall(parse_template, params, t, nparams, pos)
if ok then return end
secpos = spos
+ actlist[lpos+1] = nil
+ actlist[lpos+2] = nil
+ actlist[lpos+3] = nil
actargs[apos+1] = nil
actargs[apos+2] = nil
actargs[apos+3] = nil
diff --git a/3rdparty/lua/dynasm/dasm_mips.h b/3rdparty/lua/dynasm/dasm_mips.h
index 0866beb..2f4c2d2 100644
--- a/3rdparty/lua/dynasm/dasm_mips.h
+++ b/3rdparty/lua/dynasm/dasm_mips.h
@@ -1,6 +1,6 @@
/*
** DynASM MIPS encoding engine.
-** Copyright (C) 2005-2013 Mike Pall. All rights reserved.
+** Copyright (C) 2005-2015 Mike Pall. All rights reserved.
** Released under the MIT license. See dynasm.lua for full copyright notice.
*/
diff --git a/3rdparty/lua/dynasm/dasm_mips.lua b/3rdparty/lua/dynasm/dasm_mips.lua
index 02ab9d5..ae0dbd7 100644
--- a/3rdparty/lua/dynasm/dasm_mips.lua
+++ b/3rdparty/lua/dynasm/dasm_mips.lua
@@ -1,7 +1,7 @@
------------------------------------------------------------------------------
-- DynASM MIPS module.
--
--- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
+-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
-- See dynasm.lua for full copyright notice.
------------------------------------------------------------------------------
diff --git a/3rdparty/lua/dynasm/dasm_ppc.h b/3rdparty/lua/dynasm/dasm_ppc.h
index 13c4461..7df4936 100644
--- a/3rdparty/lua/dynasm/dasm_ppc.h
+++ b/3rdparty/lua/dynasm/dasm_ppc.h
@@ -1,6 +1,6 @@
/*
** DynASM PPC encoding engine.
-** Copyright (C) 2005-2013 Mike Pall. All rights reserved.
+** Copyright (C) 2005-2015 Mike Pall. All rights reserved.
** Released under the MIT license. See dynasm.lua for full copyright notice.
*/
diff --git a/3rdparty/lua/dynasm/dasm_ppc.lua b/3rdparty/lua/dynasm/dasm_ppc.lua
index 65da317..91f4ff9 100644
--- a/3rdparty/lua/dynasm/dasm_ppc.lua
+++ b/3rdparty/lua/dynasm/dasm_ppc.lua
@@ -1,7 +1,7 @@
------------------------------------------------------------------------------
-- DynASM PPC module.
--
--- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
+-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
-- See dynasm.lua for full copyright notice.
------------------------------------------------------------------------------
diff --git a/3rdparty/lua/dynasm/dasm_proto.h b/3rdparty/lua/dynasm/dasm_proto.h
index 960ddb7..a8bc6fd 100644
--- a/3rdparty/lua/dynasm/dasm_proto.h
+++ b/3rdparty/lua/dynasm/dasm_proto.h
@@ -1,6 +1,6 @@
/*
** DynASM encoding engine prototypes.
-** Copyright (C) 2005-2013 Mike Pall. All rights reserved.
+** Copyright (C) 2005-2015 Mike Pall. All rights reserved.
** Released under the MIT license. See dynasm.lua for full copyright notice.
*/
diff --git a/3rdparty/lua/dynasm/dasm_x64.lua b/3rdparty/lua/dynasm/dasm_x64.lua
index ca25823..b1b6202 100644
--- a/3rdparty/lua/dynasm/dasm_x64.lua
+++ b/3rdparty/lua/dynasm/dasm_x64.lua
@@ -1,7 +1,7 @@
------------------------------------------------------------------------------
-- DynASM x64 module.
--
--- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
+-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
-- See dynasm.lua for full copyright notice.
------------------------------------------------------------------------------
-- This module just sets 64 bit mode for the combined x86/x64 module.
diff --git a/3rdparty/lua/dynasm/dasm_x86.h b/3rdparty/lua/dynasm/dasm_x86.h
index c91bfdd..652e8c9 100644
--- a/3rdparty/lua/dynasm/dasm_x86.h
+++ b/3rdparty/lua/dynasm/dasm_x86.h
@@ -1,6 +1,6 @@
/*
** DynASM x86 encoding engine.
-** Copyright (C) 2005-2013 Mike Pall. All rights reserved.
+** Copyright (C) 2005-2015 Mike Pall. All rights reserved.
** Released under the MIT license. See dynasm.lua for full copyright notice.
*/
diff --git a/3rdparty/lua/dynasm/dasm_x86.lua b/3rdparty/lua/dynasm/dasm_x86.lua
index 1f0981f..7ca061d 100644
--- a/3rdparty/lua/dynasm/dasm_x86.lua
+++ b/3rdparty/lua/dynasm/dasm_x86.lua
@@ -1,7 +1,7 @@
------------------------------------------------------------------------------
-- DynASM x86/x64 module.
--
--- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
+-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
-- See dynasm.lua for full copyright notice.
------------------------------------------------------------------------------
@@ -1040,7 +1040,7 @@ local map_op = {
-- ED: *in Rdw,dx
-- EE: *out dx,Rb
-- EF: *out dx,Rdw
- -- F0: *lock
+ lock_0 = "F0",
int1_0 = "F1",
repne_0 = "F2",
repnz_0 = "F2",
@@ -1081,6 +1081,9 @@ local map_op = {
btr_2 = "mrqdw:0FB3Rm|miqdw:0FBA6mU",
bts_2 = "mrqdw:0FABRm|miqdw:0FBA5mU",
+ shld_3 = "mriqdw:0FA4RmU|mrCqdw:0FA5Rm",
+ shrd_3 = "mriqdw:0FACRmU|mrCqdw:0FADRm",
+
rdtsc_0 = "0F31", -- P1+
cpuid_0 = "0FA2", -- P1+
@@ -1114,6 +1117,9 @@ local map_op = {
fucompp_0 = "DAE9",
fcompp_0 = "DED9",
+ fldenv_1 = "x.:D94m",
+ fnstenv_1 = "x.:D96m",
+ fstenv_1 = "x.:9BD96m",
fldcw_1 = "xw:nD95m",
fstcw_1 = "xw:n9BD97m",
fnstcw_1 = "xw:nD97m",
@@ -1189,6 +1195,8 @@ local map_op = {
cvttps2dq_2 = "rmo:F30F5BrM",
cvttsd2si_2 = "rr/do:F20F2CrM|rr/qo:|rx/dq:|rxq:",
cvttss2si_2 = "rr/do:F30F2CrM|rr/qo:|rxd:|rx/qd:",
+ fxsave_1 = "x.:0FAE0m",
+ fxrstor_1 = "x.:0FAE1m",
ldmxcsr_1 = "xd:0FAE2m",
lfence_0 = "0FAEE8",
maskmovdqu_2 = "rro:660FF7rM",
@@ -1678,7 +1686,7 @@ if x64 then
function map_op.mov64_2(params)
if not params then return { "reg, imm", "reg, [disp]", "[disp], reg" } end
if secpos+2 > maxsecpos then wflush() end
- local opcode, op64, sz, rex
+ local opcode, op64, sz, rex, vreg
local op64 = match(params[1], "^%[%s*(.-)%s*%]$")
if op64 then
local a = parseoperand(params[2])
@@ -1699,11 +1707,17 @@ if x64 then
werror("bad operand mode")
end
op64 = params[2]
- opcode = 0xb8 + band(a.reg, 7) -- !x64: no VREG support.
+ if a.reg == -1 then
+ vreg = a.vreg
+ opcode = 0xb8
+ else
+ opcode = 0xb8 + band(a.reg, 7)
+ end
rex = a.reg > 7 and 9 or 8
end
end
wputop(sz, opcode, rex)
+ if vreg then waction("VREG", vreg); wputxb(0) end
waction("IMM_D", format("(unsigned int)(%s)", op64))
waction("IMM_D", format("(unsigned int)((%s)>>32)", op64))
end
diff --git a/3rdparty/lua/dynasm/dynasm.lua b/3rdparty/lua/dynasm/dynasm.lua
index d670f8f..fffda75 100644
--- a/3rdparty/lua/dynasm/dynasm.lua
+++ b/3rdparty/lua/dynasm/dynasm.lua
@@ -2,7 +2,7 @@
-- DynASM. A dynamic assembler for code generation engines.
-- Originally designed and implemented for LuaJIT.
--
--- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
+-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
-- See below for full copyright notice.
------------------------------------------------------------------------------
@@ -17,7 +17,7 @@ local _info = {
url = "http://luajit.org/dynasm.html",
license = "MIT",
copyright = [[
-Copyright (C) 2005-2013 Mike Pall. All rights reserved.
+Copyright (C) 2005-2015 Mike Pall. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@@ -85,7 +85,7 @@ end
-- Resync CPP line numbers.
local function wsync()
if g_synclineno ~= g_lineno and g_opt.cpp then
- wline("# "..g_lineno..' "'..g_fname..'"')
+ wline("#line "..g_lineno..' "'..g_fname..'"')
g_synclineno = g_lineno
end
end
@@ -695,6 +695,9 @@ map_op[".arch_1"] = function(params)
if not params then return "name" end
local err = loadarch(params[1])
if err then wfatal(err) end
+ wline(format("#if DASM_VERSION != %d", _info.vernum))
+ wline('#error "Version mismatch between DynASM and included encoding engine"')
+ wline("#endif")
end
-- Dummy .arch pseudo-opcode to improve the error report.
@@ -877,13 +880,9 @@ local function dasmhead(out)
** DO NOT EDIT! The original file is in "%s".
*/
-#if DASM_VERSION != %d
-#error "Version mismatch between DynASM and included encoding engine"
-#endif
-
]], _info.url,
_info.version, g_arch._info.arch, g_arch._info.version,
- g_fname, _info.vernum))
+ g_fname))
end
-- Read input file.
diff --git a/3rdparty/lua/etc/luajit.1 b/3rdparty/lua/etc/luajit.1
index 6489bd3..fd38b0a 100644
--- a/3rdparty/lua/etc/luajit.1
+++ b/3rdparty/lua/etc/luajit.1
@@ -74,7 +74,7 @@ luajit \-jv \-e "for i=1,10 do for j=1,10 do for k=1,100 do end end end"
Runs some nested loops and shows the resulting traces.
.SH COPYRIGHT
.PP
-\fBLuaJIT\fR is Copyright \(co 2005-2013 Mike Pall.
+\fBLuaJIT\fR is Copyright \(co 2005-2015 Mike Pall.
.br
\fBLuaJIT\fR is open source software, released under the MIT license.
.SH SEE ALSO
diff --git a/3rdparty/lua/etc/luajit.pc b/3rdparty/lua/etc/luajit.pc
index 5a982a6..a652b40 100644
--- a/3rdparty/lua/etc/luajit.pc
+++ b/3rdparty/lua/etc/luajit.pc
@@ -1,18 +1,19 @@
# Package information for LuaJIT to be used by pkg-config.
majver=2
minver=0
-relver=2
+relver=4
version=${majver}.${minver}.${relver}
abiver=5.1
prefix=/usr/local
+multilib=lib
exec_prefix=${prefix}
-libdir=${exec_prefix}/lib
+libdir=${exec_prefix}/${multilib}
libname=luajit-${abiver}
includedir=${prefix}/include/luajit-${majver}.${minver}
INSTALL_LMOD=${prefix}/share/lua/${abiver}
-INSTALL_CMOD=${prefix}/lib/lua/${abiver}
+INSTALL_CMOD=${prefix}/${multilib}/lua/${abiver}
Name: LuaJIT
Description: Just-in-time compiler for Lua
diff --git a/3rdparty/lua/in-lua-extensions/winreg.lua b/3rdparty/lua/in-lua-extensions/winreg.lua
index f62f55f..14964b8 100644
--- a/3rdparty/lua/in-lua-extensions/winreg.lua
+++ b/3rdparty/lua/in-lua-extensions/winreg.lua
@@ -1,42 +1,42 @@
-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
+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
diff --git a/3rdparty/lua/premake4.lua b/3rdparty/lua/premake4.lua
index 597c6cc..d5dde0b 100644
--- a/3rdparty/lua/premake4.lua
+++ b/3rdparty/lua/premake4.lua
@@ -1,219 +1,219 @@
--- The below is used to insert the .vs(2005|2008|2010|2012|2013) into the file names for projects and solutions
-local standalone = false
-local action = _ACTION or ""
-local pfx = ""
-if premake.CurrentContainer ~= nil then
- pfx = _OPTIONS["release"]
- if not pfx then
- pfx = ""
- end
-else
- -- Name the project files after their VS version
- local orig_getbasename = premake.project.getbasename
- premake.project.getbasename = function(prjname, pattern)
- if _ACTION then
- -- Using vc instead of vs here to avoid collisions
- name_map = {vs2005 = "8", vs2008 = "9", vs2010 = "10", vs2012 = "11", vs2013 = "12"}
- if name_map[_ACTION] then
- pattern = pattern:gsub("%%%%", "%%%%." .. name_map[_ACTION])
- else
- pattern = pattern:gsub("%%%%", "%%%%." .. _ACTION)
- end
- end
- return orig_getbasename(prjname, pattern)
- end
- -- Override the object directory paths ... don't make them "unique" inside premake4
- local orig_gettarget = premake.gettarget
- premake.gettarget = function(cfg, direction, pathstyle, namestyle, system)
- local r = orig_gettarget(cfg, direction, pathstyle, namestyle, system)
- if (cfg.objectsdir) and (cfg.objdir) then
- cfg.objectsdir = cfg.objdir
- end
- return r
- end
- -- Silently suppress generation of the .user files ...
- local orig_generate = premake.generate
- premake.generate = function(obj, filename, callback)
- if filename:find('.vcproj.user') or filename:find('.vcxproj.user') then
- return
- end
- orig_generate(obj, filename, callback)
- end
- -- Override the project creation to suppress unnecessary configurations
- -- these get invoked by sln2005.generate per project ...
- -- ... they depend on the values in the sln.vstudio_configs table
- local mprj = {[pfx.."minilua"] = {["Release|Win32"] = 0}, [pfx.."buildvm"] = {["Release|Win32"] = 0, ["Release|x64"] = 0}, [pfx.."luajit2"] = {["Release|Win32"] = 0, ["Release|x64"] = 0}, [pfx.."lua"] = {["Release|Win32"] = 0, ["Release|x64"] = 0}}
- local function prjgen_override_factory(orig_prjgen)
- return function(prj)
- local function prjmap()
- for k,v in pairs(mprj) do
- if prj.name:find(k) or prj.name:match(k) then
- return v
- end
- end
- return nil
- end
- if prjmap() and type(prj.solution.vstudio_configs) == "table" then
- local cfgs = prj.solution.vstudio_configs
- local faked_cfgs = {}
- local prjmap = prjmap()
- for k,v in pairs(cfgs) do
- if prjmap[v['name']] then
- faked_cfgs[#faked_cfgs+1] = v
- end
- end
- prj.solution.vstudio_configs = faked_cfgs
- retval = orig_prjgen(prj)
- prj.solution.vstudio_configs = cfgs
- return retval
- end
- return orig_prjgen(prj)
- end
- end
- premake.vs2010_vcxproj = prjgen_override_factory(premake.vs2010_vcxproj)
- premake.vstudio.vc200x.generate = prjgen_override_factory(premake.vstudio.vc200x.generate)
- -- Allow us to set the project configuration to Release|Win32 for minilua
- -- no matter what the global solution project is.
- local orig_project_platforms_sln2prj_mapping = premake.vstudio.sln2005.project_platforms_sln2prj_mapping
- premake.vstudio.sln2005.project_platforms_sln2prj_mapping = function(sln, prj, cfg, mapped)
- if prj.name:find(pfx..'minilua') then
- _p('\t\t{%s}.%s.ActiveCfg = Release|Win32', prj.uuid, cfg.name)
- _p('\t\t{%s}.%s.Build.0 = Release|Win32', prj.uuid, cfg.name)
- elseif prj.name:find(pfx..'buildvm') or prj.name:find(pfx..'luajit2') or prj.name:find(pfx..'lua') then
- _p('\t\t{%s}.%s.ActiveCfg = Release|%s', prj.uuid, cfg.name, mapped)
- _p('\t\t{%s}.%s.Build.0 = Release|%s', prj.uuid, cfg.name, mapped)
- else
- _p('\t\t{%s}.%s.ActiveCfg = %s|%s', prj.uuid, cfg.name, cfg.buildcfg, mapped)
- if mapped == cfg.platform or cfg.platform == "Mixed Platforms" then
- _p('\t\t{%s}.%s.Build.0 = %s|%s', prj.uuid, cfg.name, cfg.buildcfg, mapped)
- end
- end
- end
-end
-local function transformMN(input) -- transform the macro names for older Visual Studio versions
- local new_map = { vs2002 = 0, vs2003 = 0, vs2005 = 0, vs2008 = 0 }
- local replacements = { Platform = "PlatformName", Configuration = "ConfigurationName" }
- if new_map[action] ~= nil then
- for k,v in pairs(replacements) do
- if input:find(k) then
- input = input:gsub(k, v)
- end
- end
- end
- return input
-end
-local function fmt(msg, ...)
- return string.format(msg, unpack(arg))
-end
-
-function create_luajit_projects(basedir)
- local bd = ""
- local offs = "" -- relative path, calculated based on slashes and backslashes in bd (basedir after normalization)
- if basedir ~= nil then
- bd = basedir:gsub("[\\/]+$", "") .. "\\"
- offs = bd:gsub("[^\\/]+", ""):gsub(".", "..\\")
- end
- local oldcurr = premake.CurrentContainer
- local int_dir = fmt(pfx.."intermediate\\%s_$(%s)_$(%s)\\$(ProjectName)", action, transformMN("Platform"), transformMN("Configuration"))
- local inc_dir = fmt(pfx.."intermediate\\%s_$(%s)", action, transformMN("Platform"))
- -- Single minilua for all configurations and platforms
- project (pfx.."minilua") -- required to build LuaJIT
- uuid ("531911BC-0023-4EC6-A2CE-6C3F5C182647")
- language ("C")
- kind ("ConsoleApp")
- location (bd.."src")
- targetname ("minilua")
- targetdir (bd.."src")
- flags {"Optimize", "StaticRuntime", "NoManifest", "NoMinimalRebuild", "NoIncrementalLink", "NoEditAndContinue"}
- linkoptions {"/release"}
- objdir (int_dir)
- libdirs {"$(IntDir)"}
- defines {"NDEBUG", "_CRT_SECURE_NO_DEPRECATE"}
- vpaths {["Header Files/*"] = { bd.."src/host/*.h" }, ["Source Files/*"] = { bd.."src/host/*.c" },}
- files {bd.."src/host/minilua.c"}
- project (pfx.."buildvm") -- required to build LuaJIT
- uuid ("F949C208-7A2E-4B1C-B74D-956E88542A26")
- language ("C")
- kind ("ConsoleApp")
- location (bd.."src")
- targetname ("buildvm")
- targetdir (bd.."src")
- includedirs {"$(ProjectDir)", "$(ProjectDir)..\\dynasm", inc_dir}
- flags {"Optimize", "StaticRuntime", "NoManifest", "NoMinimalRebuild", "NoIncrementalLink", "NoEditAndContinue"}
- objdir (int_dir)
- libdirs {"$(IntDir)"}
- defines {"NDEBUG", "_CRT_SECURE_NO_DEPRECATE"}
- links (pfx.."minilua") -- make sure we have minilua.exe
- vpaths {["Header Files/*"] = { bd.."src/host/*.h" }, ["Source Files/*"] = { bd.."src/host/*.c" },}
- files {bd.."src/host/buildvm*.c", bd.."src/host/buildvm*.h",}
- -- Add the pre-build steps required to compile and link the static library
- local prebuild_table= {[32] = "", [64] = " -D P64"}
- for k,v in pairs(prebuild_table) do
- configuration {fmt("x%d", k)}
- targetsuffix (fmt("%d", k))
- prebuildcommands(fmt("if not exist \"%s..\\%s\" md \"%s..\\%s\"", offs, inc_dir, offs, inc_dir))
- prebuildcommands(fmt("minilua ..\\dynasm\\dynasm.lua -LN -D WIN -D JIT -D FFI%s -o \"%s..\\%s\\buildvm_arch.h\" vm_x86.dasc", prebuild_table[k], offs, inc_dir))
- end
- project (pfx.."luajit2") -- actual LuaJIT2 static lib
- uuid ("9F35C2BB-DF1E-400A-A829-AE34E1C91A70")
- language ("C")
- kind ("StaticLib")
- location (bd.."src")
- targetname (fmt("luajit2_$(%s)", transformMN("Platform")))
- targetdir (offs.."build")
- includedirs {"$(ProjectDir)", "$(ProjectDir)..\\dynasm", inc_dir}
- flags {"StaticRuntime", "Optimize", "No64BitChecks"}
- objdir (int_dir)
- libdirs {"$(IntDir)"}
- defines {"NDEBUG", "_CRT_SECURE_NO_DEPRECATE"}
- links {pfx.."minilua", pfx.."buildvm"} -- make sure we have minilua.exe
- linkoptions {"/nodefaultlib"}
- vpaths {["Header Files/*"] = { bd.."src/*.h" }, ["Source Files/*"] = { bd.."src/*.c" },}
- files {bd.."src/lib_*.c", bd.."src/lj_*.c", bd.."src/*.h",}
- -- Add the pre-build steps required to compile and link the static library
- local prebuild_table= {[32] = 0, [64] = 0}
- for k,v in pairs(prebuild_table) do
- local ALL_LIB = "lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c"
- configuration {fmt("x%d", k)}
- prebuildcommands(fmt("if not exist \"%s..\\%s\" md \"%s..\\%s\"", offs, inc_dir, offs, inc_dir))
- prebuildcommands(fmt("buildvm%d -m peobj -o \"$(IntDir)\\lj_vm%d.obj\"", k, k))
- linkoptions {fmt("\"$(IntDir)\\lj_vm%d.obj\"", k)}
- prebuildcommands(fmt("buildvm%d -m bcdef -o \"%s..\\%s\\lj_bcdef.h\" %s", k, offs, inc_dir, ALL_LIB))
- prebuildcommands(fmt("buildvm%d -m ffdef -o \"%s..\\%s\\lj_ffdef.h\" %s", k, offs, inc_dir, ALL_LIB))
- prebuildcommands(fmt("buildvm%d -m libdef -o \"%s..\\%s\\lj_libdef.h\" %s", k, offs, inc_dir, ALL_LIB))
- prebuildcommands(fmt("buildvm%d -m recdef -o \"%s..\\%s\\lj_recdef.h\" %s", k, offs, inc_dir, ALL_LIB))
- prebuildcommands(fmt("buildvm%d -m folddef -o \"%s..\\%s\\lj_folddef.h\" lj_opt_fold.c", k, offs, inc_dir))
- end
- if standalone then
- project (pfx.."lua") -- actual Lua executable that statically links LuaJIT2
- uuid ("3A806ACF-62B5-4597-B934-ED2F98A4F115")
- language ("C")
- kind ("ConsoleApp")
- location (bd.."src")
- targetname ("luajit")
- targetdir (offs.."build")
- includedirs {"$(ProjectDir)"}
- flags {"StaticRuntime", "Optimize", "NoMinimalRebuild", "NoIncrementalLink", "NoEditAndContinue", "No64BitChecks", "Symbols"}
- objdir (int_dir)
- libdirs {"$(IntDir)"}
- defines {"NDEBUG", "_CRT_SECURE_NO_DEPRECATE"}
- links {pfx.."luajit2"}
- linkoptions {"/pdbaltpath:%_PDB%"}
- vpaths {["Header Files/*"] = { bd.."src/*.h" }, ["Source Files/*"] = { bd.."src/*.c" },}
- files {bd.."src/luajit.c",}
- configuration {"Release", "x32"}
- targetsuffix ("32")
- configuration {"Release", "x64"}
- targetsuffix ("64")
- end
- premake.CurrentContainer = oldcurr -- restore container before this function was called
-end
-
-if premake.CurrentContainer == nil then
- standalone = true
- solution ("luajit")
- configurations {"Release"}
- platforms {"x32", "x64"}
- location ('.')
- create_luajit_projects(nil)
-end
+-- The below is used to insert the .vs(2005|2008|2010|2012|2013) into the file names for projects and solutions
+local standalone = false
+local action = _ACTION or ""
+local pfx = ""
+if premake.CurrentContainer ~= nil then
+ pfx = _OPTIONS["release"]
+ if not pfx then
+ pfx = ""
+ end
+else
+ -- Name the project files after their VS version
+ local orig_getbasename = premake.project.getbasename
+ premake.project.getbasename = function(prjname, pattern)
+ if _ACTION then
+ -- Using vc instead of vs here to avoid collisions
+ name_map = {vs2005 = "8", vs2008 = "9", vs2010 = "10", vs2012 = "11", vs2013 = "12"}
+ if name_map[_ACTION] then
+ pattern = pattern:gsub("%%%%", "%%%%." .. name_map[_ACTION])
+ else
+ pattern = pattern:gsub("%%%%", "%%%%." .. _ACTION)
+ end
+ end
+ return orig_getbasename(prjname, pattern)
+ end
+ -- Override the object directory paths ... don't make them "unique" inside premake4
+ local orig_gettarget = premake.gettarget
+ premake.gettarget = function(cfg, direction, pathstyle, namestyle, system)
+ local r = orig_gettarget(cfg, direction, pathstyle, namestyle, system)
+ if (cfg.objectsdir) and (cfg.objdir) then
+ cfg.objectsdir = cfg.objdir
+ end
+ return r
+ end
+ -- Silently suppress generation of the .user files ...
+ local orig_generate = premake.generate
+ premake.generate = function(obj, filename, callback)
+ if filename:find('.vcproj.user') or filename:find('.vcxproj.user') then
+ return
+ end
+ orig_generate(obj, filename, callback)
+ end
+ -- Override the project creation to suppress unnecessary configurations
+ -- these get invoked by sln2005.generate per project ...
+ -- ... they depend on the values in the sln.vstudio_configs table
+ local mprj = {[pfx.."minilua"] = {["Release|Win32"] = 0}, [pfx.."buildvm"] = {["Release|Win32"] = 0, ["Release|x64"] = 0}, [pfx.."luajit2"] = {["Release|Win32"] = 0, ["Release|x64"] = 0}, [pfx.."lua"] = {["Release|Win32"] = 0, ["Release|x64"] = 0}}
+ local function prjgen_override_factory(orig_prjgen)
+ return function(prj)
+ local function prjmap()
+ for k,v in pairs(mprj) do
+ if prj.name:find(k) or prj.name:match(k) then
+ return v
+ end
+ end
+ return nil
+ end
+ if prjmap() and type(prj.solution.vstudio_configs) == "table" then
+ local cfgs = prj.solution.vstudio_configs
+ local faked_cfgs = {}
+ local prjmap = prjmap()
+ for k,v in pairs(cfgs) do
+ if prjmap[v['name']] then
+ faked_cfgs[#faked_cfgs+1] = v
+ end
+ end
+ prj.solution.vstudio_configs = faked_cfgs
+ retval = orig_prjgen(prj)
+ prj.solution.vstudio_configs = cfgs
+ return retval
+ end
+ return orig_prjgen(prj)
+ end
+ end
+ premake.vs2010_vcxproj = prjgen_override_factory(premake.vs2010_vcxproj)
+ premake.vstudio.vc200x.generate = prjgen_override_factory(premake.vstudio.vc200x.generate)
+ -- Allow us to set the project configuration to Release|Win32 for minilua
+ -- no matter what the global solution project is.
+ local orig_project_platforms_sln2prj_mapping = premake.vstudio.sln2005.project_platforms_sln2prj_mapping
+ premake.vstudio.sln2005.project_platforms_sln2prj_mapping = function(sln, prj, cfg, mapped)
+ if prj.name:find(pfx..'minilua') then
+ _p('\t\t{%s}.%s.ActiveCfg = Release|Win32', prj.uuid, cfg.name)
+ _p('\t\t{%s}.%s.Build.0 = Release|Win32', prj.uuid, cfg.name)
+ elseif prj.name:find(pfx..'buildvm') or prj.name:find(pfx..'luajit2') or prj.name:find(pfx..'lua') then
+ _p('\t\t{%s}.%s.ActiveCfg = Release|%s', prj.uuid, cfg.name, mapped)
+ _p('\t\t{%s}.%s.Build.0 = Release|%s', prj.uuid, cfg.name, mapped)
+ else
+ _p('\t\t{%s}.%s.ActiveCfg = %s|%s', prj.uuid, cfg.name, cfg.buildcfg, mapped)
+ if mapped == cfg.platform or cfg.platform == "Mixed Platforms" then
+ _p('\t\t{%s}.%s.Build.0 = %s|%s', prj.uuid, cfg.name, cfg.buildcfg, mapped)
+ end
+ end
+ end
+end
+local function transformMN(input) -- transform the macro names for older Visual Studio versions
+ local new_map = { vs2002 = 0, vs2003 = 0, vs2005 = 0, vs2008 = 0 }
+ local replacements = { Platform = "PlatformName", Configuration = "ConfigurationName" }
+ if new_map[action] ~= nil then
+ for k,v in pairs(replacements) do
+ if input:find(k) then
+ input = input:gsub(k, v)
+ end
+ end
+ end
+ return input
+end
+local function fmt(msg, ...)
+ return string.format(msg, unpack(arg))
+end
+
+function create_luajit_projects(basedir)
+ local bd = ""
+ local offs = "" -- relative path, calculated based on slashes and backslashes in bd (basedir after normalization)
+ if basedir ~= nil then
+ bd = basedir:gsub("[\\/]+$", "") .. "\\"
+ offs = bd:gsub("[^\\/]+", ""):gsub(".", "..\\")
+ end
+ local oldcurr = premake.CurrentContainer
+ local int_dir = fmt(pfx.."intermediate\\%s_$(%s)_$(%s)\\$(ProjectName)", action, transformMN("Platform"), transformMN("Configuration"))
+ local inc_dir = fmt(pfx.."intermediate\\%s_$(%s)", action, transformMN("Platform"))
+ -- Single minilua for all configurations and platforms
+ project (pfx.."minilua") -- required to build LuaJIT
+ uuid ("531911BC-0023-4EC6-A2CE-6C3F5C182647")
+ language ("C")
+ kind ("ConsoleApp")
+ location (bd.."src")
+ targetname ("minilua")
+ targetdir (bd.."src")
+ flags {"Optimize", "StaticRuntime", "NoManifest", "NoMinimalRebuild", "NoIncrementalLink", "NoEditAndContinue"}
+ linkoptions {"/release"}
+ objdir (int_dir)
+ libdirs {"$(IntDir)"}
+ defines {"NDEBUG", "_CRT_SECURE_NO_DEPRECATE"}
+ vpaths {["Header Files/*"] = { bd.."src/host/*.h" }, ["Source Files/*"] = { bd.."src/host/*.c" },}
+ files {bd.."src/host/minilua.c"}
+ project (pfx.."buildvm") -- required to build LuaJIT
+ uuid ("F949C208-7A2E-4B1C-B74D-956E88542A26")
+ language ("C")
+ kind ("ConsoleApp")
+ location (bd.."src")
+ targetname ("buildvm")
+ targetdir (bd.."src")
+ includedirs {"$(ProjectDir)", "$(ProjectDir)..\\dynasm", inc_dir}
+ flags {"Optimize", "StaticRuntime", "NoManifest", "NoMinimalRebuild", "NoIncrementalLink", "NoEditAndContinue"}
+ objdir (int_dir)
+ libdirs {"$(IntDir)"}
+ defines {"NDEBUG", "_CRT_SECURE_NO_DEPRECATE"}
+ links (pfx.."minilua") -- make sure we have minilua.exe
+ vpaths {["Header Files/*"] = { bd.."src/host/*.h" }, ["Source Files/*"] = { bd.."src/host/*.c" },}
+ files {bd.."src/host/buildvm*.c", bd.."src/host/buildvm*.h",}
+ -- Add the pre-build steps required to compile and link the static library
+ local prebuild_table= {[32] = "", [64] = " -D P64"}
+ for k,v in pairs(prebuild_table) do
+ configuration {fmt("x%d", k)}
+ targetsuffix (fmt("%d", k))
+ prebuildcommands(fmt("if not exist \"%s..\\%s\" md \"%s..\\%s\"", offs, inc_dir, offs, inc_dir))
+ prebuildcommands(fmt("minilua ..\\dynasm\\dynasm.lua -LN -D WIN -D JIT -D FFI%s -o \"%s..\\%s\\buildvm_arch.h\" vm_x86.dasc", prebuild_table[k], offs, inc_dir))
+ end
+ project (pfx.."luajit2") -- actual LuaJIT2 static lib
+ uuid ("9F35C2BB-DF1E-400A-A829-AE34E1C91A70")
+ language ("C")
+ kind ("StaticLib")
+ location (bd.."src")
+ targetname (fmt("luajit2_$(%s)", transformMN("Platform")))
+ targetdir (offs.."build")
+ includedirs {"$(ProjectDir)", "$(ProjectDir)..\\dynasm", inc_dir}
+ flags {"StaticRuntime", "Optimize", "No64BitChecks"}
+ objdir (int_dir)
+ libdirs {"$(IntDir)"}
+ defines {"NDEBUG", "_CRT_SECURE_NO_DEPRECATE"}
+ links {pfx.."minilua", pfx.."buildvm"} -- make sure we have minilua.exe
+ linkoptions {"/nodefaultlib"}
+ vpaths {["Header Files/*"] = { bd.."src/*.h" }, ["Source Files/*"] = { bd.."src/*.c" },}
+ files {bd.."src/lib_*.c", bd.."src/lj_*.c", bd.."src/*.h",}
+ -- Add the pre-build steps required to compile and link the static library
+ local prebuild_table= {[32] = 0, [64] = 0}
+ for k,v in pairs(prebuild_table) do
+ local ALL_LIB = "lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c"
+ configuration {fmt("x%d", k)}
+ prebuildcommands(fmt("if not exist \"%s..\\%s\" md \"%s..\\%s\"", offs, inc_dir, offs, inc_dir))
+ prebuildcommands(fmt("buildvm%d -m peobj -o \"$(IntDir)\\lj_vm%d.obj\"", k, k))
+ linkoptions {fmt("\"$(IntDir)\\lj_vm%d.obj\"", k)}
+ prebuildcommands(fmt("buildvm%d -m bcdef -o \"%s..\\%s\\lj_bcdef.h\" %s", k, offs, inc_dir, ALL_LIB))
+ prebuildcommands(fmt("buildvm%d -m ffdef -o \"%s..\\%s\\lj_ffdef.h\" %s", k, offs, inc_dir, ALL_LIB))
+ prebuildcommands(fmt("buildvm%d -m libdef -o \"%s..\\%s\\lj_libdef.h\" %s", k, offs, inc_dir, ALL_LIB))
+ prebuildcommands(fmt("buildvm%d -m recdef -o \"%s..\\%s\\lj_recdef.h\" %s", k, offs, inc_dir, ALL_LIB))
+ prebuildcommands(fmt("buildvm%d -m folddef -o \"%s..\\%s\\lj_folddef.h\" lj_opt_fold.c", k, offs, inc_dir))
+ end
+ if standalone then
+ project (pfx.."lua") -- actual Lua executable that statically links LuaJIT2
+ uuid ("3A806ACF-62B5-4597-B934-ED2F98A4F115")
+ language ("C")
+ kind ("ConsoleApp")
+ location (bd.."src")
+ targetname ("luajit")
+ targetdir (offs.."build")
+ includedirs {"$(ProjectDir)"}
+ flags {"StaticRuntime", "Optimize", "NoMinimalRebuild", "NoIncrementalLink", "NoEditAndContinue", "No64BitChecks", "Symbols"}
+ objdir (int_dir)
+ libdirs {"$(IntDir)"}
+ defines {"NDEBUG", "_CRT_SECURE_NO_DEPRECATE"}
+ links {pfx.."luajit2"}
+ linkoptions {"/pdbaltpath:%_PDB%"}
+ vpaths {["Header Files/*"] = { bd.."src/*.h" }, ["Source Files/*"] = { bd.."src/*.c" },}
+ files {bd.."src/luajit.c",}
+ configuration {"Release", "x32"}
+ targetsuffix ("32")
+ configuration {"Release", "x64"}
+ targetsuffix ("64")
+ end
+ premake.CurrentContainer = oldcurr -- restore container before this function was called
+end
+
+if premake.CurrentContainer == nil then
+ standalone = true
+ solution ("luajit")
+ configurations {"Release"}
+ platforms {"x32", "x64"}
+ location ('.')
+ create_luajit_projects(nil)
+end
diff --git a/3rdparty/lua/src/Makefile b/3rdparty/lua/src/Makefile
index 999e280..1d38fa2 100644
--- a/3rdparty/lua/src/Makefile
+++ b/3rdparty/lua/src/Makefile
@@ -7,12 +7,12 @@
# Also works with MinGW and Cygwin on Windows.
# Please check msvcbuild.bat for building with MSVC on Windows.
#
-# Copyright (C) 2005-2012 Mike Pall. See Copyright Notice in luajit.h
+# Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
##############################################################################
MAJVER= 2
MINVER= 0
-RELVER= 2
+RELVER= 4
ABIVER= 5.1
NODOTABIVER= 51
@@ -122,8 +122,10 @@ XCFLAGS=
#
# Use the system provided memory allocator (realloc) instead of the
# bundled memory allocator. This is slower, but sometimes helpful for
-# debugging. It's helpful for Valgrind's memcheck tool, too. This option
-# cannot be enabled on x64, since the built-in allocator is mandatory.
+# debugging. This option cannot be enabled on x64, since realloc usually
+# doesn't return addresses in the right address range.
+# OTOH this option is mandatory for Valgrind's memcheck tool on x64 and
+# the only way to get useful results from it for all other architectures.
#XCFLAGS+= -DLUAJIT_USE_SYSMALLOC
#
# This define is required to run LuaJIT under Valgrind. The Valgrind
@@ -188,9 +190,10 @@ TARGET_LD= $(CROSS)$(CC)
TARGET_AR= $(CROSS)ar rcus
TARGET_STRIP= $(CROSS)strip
+TARGET_LIBPATH= $(or $(PREFIX),/usr/local)/$(or $(MULTILIB),lib)
TARGET_SONAME= libluajit-$(ABIVER).so.$(MAJVER)
TARGET_DYLIBNAME= libluajit-$(ABIVER).$(MAJVER).dylib
-TARGET_DYLIBPATH= $(or $(PREFIX),/usr/local)/lib/$(TARGET_DYLIBNAME)
+TARGET_DYLIBPATH= $(TARGET_LIBPATH)/$(TARGET_DYLIBNAME)
TARGET_DLLNAME= lua$(NODOTABIVER).dll
TARGET_XSHLDFLAGS= -shared -fPIC -Wl,-soname,$(TARGET_SONAME)
TARGET_DYNXLDOPTS=
@@ -249,12 +252,18 @@ TARGET_ARCH+= $(patsubst %,-DLUAJIT_TARGET=LUAJIT_ARCH_%,$(TARGET_LJARCH))
ifneq (,$(PREFIX))
ifneq (/usr/local,$(PREFIX))
- TARGET_XCFLAGS+= -DLUA_XROOT=\"$(PREFIX)/\"
+ TARGET_XCFLAGS+= -DLUA_ROOT=\"$(PREFIX)\"
ifneq (/usr,$(PREFIX))
- TARGET_DYNXLDOPTS= -Wl,-rpath,$(PREFIX)/lib
+ TARGET_DYNXLDOPTS= -Wl,-rpath,$(TARGET_LIBPATH)
endif
endif
endif
+ifneq (,$(MULTILIB))
+ TARGET_XCFLAGS+= -DLUA_MULTILIB=\"$(MULTILIB)\"
+endif
+ifneq (,$(LMULTILIB))
+ TARGET_XCFLAGS+= -DLUA_LMULTILIB=\"$(LMULTILIB)\"
+endif
##############################################################################
# System detection.
@@ -281,13 +290,15 @@ ifeq (Windows,$(TARGET_SYS))
TARGET_XSHLDFLAGS= -shared
TARGET_DYNXLDOPTS=
else
+ifeq (,$(shell $(TARGET_CC) -o /dev/null -c -x c /dev/null -fno-stack-protector 2>/dev/null || echo 1))
+ TARGET_XCFLAGS+= -fno-stack-protector
+endif
ifeq (Darwin,$(TARGET_SYS))
ifeq (,$(MACOSX_DEPLOYMENT_TARGET))
export MACOSX_DEPLOYMENT_TARGET=10.4
endif
TARGET_STRIP+= -x
TARGET_AR+= 2>/dev/null
- TARGET_XCFLAGS+= -fno-stack-protector
TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC
TARGET_DYNXLDOPTS=
TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER)
@@ -299,14 +310,10 @@ else
ifeq (iOS,$(TARGET_SYS))
TARGET_STRIP+= -x
TARGET_AR+= 2>/dev/null
- TARGET_XCFLAGS+= -fno-stack-protector
TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC
TARGET_DYNXLDOPTS=
TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER)
else
- ifneq (,$(findstring stack-protector,$(shell $(TARGET_CC) -dumpspecs)))
- TARGET_XCFLAGS+= -fno-stack-protector
- endif
ifneq (SunOS,$(TARGET_SYS))
ifneq (PS3,$(TARGET_SYS))
TARGET_XLDFLAGS+= -Wl,-E
diff --git a/3rdparty/lua/src/Makefile.dep b/3rdparty/lua/src/Makefile.dep
index 5d91723..9e14d61 100644
--- a/3rdparty/lua/src/Makefile.dep
+++ b/3rdparty/lua/src/Makefile.dep
@@ -17,8 +17,8 @@ lib_ffi.o: lib_ffi.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \
lj_ccallback.h lj_clib.h lj_ff.h lj_ffdef.h lj_lib.h lj_libdef.h
lib_init.o: lib_init.c lua.h luaconf.h lauxlib.h lualib.h lj_arch.h
lib_io.o: lib_io.c lua.h luaconf.h lauxlib.h lualib.h lj_obj.h lj_def.h \
- lj_arch.h lj_err.h lj_errmsg.h lj_str.h lj_state.h lj_ff.h lj_ffdef.h \
- lj_lib.h lj_libdef.h
+ lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_state.h lj_ff.h \
+ lj_ffdef.h lj_lib.h lj_libdef.h
lib_jit.o: lib_jit.c lua.h luaconf.h lauxlib.h lualib.h lj_arch.h \
lj_obj.h lj_def.h lj_err.h lj_errmsg.h lj_debug.h lj_str.h lj_tab.h \
lj_bc.h lj_ir.h lj_jit.h lj_ircall.h lj_iropt.h lj_target.h \
@@ -90,7 +90,7 @@ lj_ctype.o: lj_ctype.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_ctype.h lj_ccallback.h
lj_debug.o: lj_debug.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
lj_err.h lj_errmsg.h lj_debug.h lj_str.h lj_tab.h lj_state.h lj_frame.h \
- lj_bc.h lj_jit.h lj_ir.h
+ lj_bc.h lj_vm.h lj_jit.h lj_ir.h
lj_dispatch.o: lj_dispatch.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
lj_err.h lj_errmsg.h lj_func.h lj_str.h lj_tab.h lj_meta.h lj_debug.h \
lj_state.h lj_frame.h lj_bc.h lj_ff.h lj_ffdef.h lj_jit.h lj_ir.h \
@@ -129,8 +129,8 @@ lj_load.o: lj_load.c lua.h luaconf.h lauxlib.h lj_obj.h lj_def.h \
lj_arch.h lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_func.h lj_frame.h \
lj_bc.h lj_vm.h lj_lex.h lj_bcdump.h lj_parse.h
lj_mcode.o: lj_mcode.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
- lj_gc.h lj_jit.h lj_ir.h lj_mcode.h lj_trace.h lj_dispatch.h lj_bc.h \
- lj_traceerr.h lj_vm.h
+ lj_gc.h lj_err.h lj_errmsg.h lj_jit.h lj_ir.h lj_mcode.h lj_trace.h \
+ lj_dispatch.h lj_bc.h lj_traceerr.h lj_vm.h
lj_meta.o: lj_meta.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \
lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_meta.h lj_frame.h lj_bc.h \
lj_vm.h lj_strscan.h
diff --git a/3rdparty/lua/src/host/buildvm.c b/3rdparty/lua/src/host/buildvm.c
index 2ce3b63..07122a6 100644
--- a/3rdparty/lua/src/host/buildvm.c
+++ b/3rdparty/lua/src/host/buildvm.c
@@ -1,6 +1,6 @@
/*
** LuaJIT VM builder.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
**
** This is a tool to build the hand-tuned assembler code required for
** LuaJIT's bytecode interpreter. It supports a variety of output formats
diff --git a/3rdparty/lua/src/host/buildvm.h b/3rdparty/lua/src/host/buildvm.h
index 1a037e1..b262185 100644
--- a/3rdparty/lua/src/host/buildvm.h
+++ b/3rdparty/lua/src/host/buildvm.h
@@ -1,6 +1,6 @@
/*
** LuaJIT VM builder.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _BUILDVM_H
diff --git a/3rdparty/lua/src/host/buildvm_asm.c b/3rdparty/lua/src/host/buildvm_asm.c
index f18d149..2c9a2d4 100644
--- a/3rdparty/lua/src/host/buildvm_asm.c
+++ b/3rdparty/lua/src/host/buildvm_asm.c
@@ -1,6 +1,6 @@
/*
** LuaJIT VM builder: Assembler source code emitter.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#include "buildvm.h"
@@ -100,7 +100,7 @@ static void emit_asm_wordreloc(BuildCtx *ctx, uint8_t *p, int n,
fprintf(ctx->fp, "\tblx %s\n", sym);
} else if ((ins & 0x0e000000u) == 0x0a000000u) {
fprintf(ctx->fp, "\t%s%.2s %s\n", (ins & 0x01000000u) ? "bl" : "b",
- "eqnecsccmiplvsvchilsgeltgtle" + 2*(ins >> 28), sym);
+ &"eqnecsccmiplvsvchilsgeltgtle"[2*(ins >> 28)], sym);
} else {
fprintf(stderr,
"Error: unsupported opcode %08x for %s symbol relocation.\n",
@@ -286,7 +286,7 @@ void emit_asm(BuildCtx *ctx)
fprintf(ctx->fp, "\n");
switch (ctx->mode) {
case BUILD_elfasm:
-#if !LJ_TARGET_PS3
+#if !(LJ_TARGET_PS3 || LJ_TARGET_PSVITA)
fprintf(ctx->fp, "\t.section .note.GNU-stack,\"\"," ELFASM_PX "progbits\n");
#endif
#if LJ_TARGET_PPCSPE
diff --git a/3rdparty/lua/src/host/buildvm_fold.c b/3rdparty/lua/src/host/buildvm_fold.c
index 085a4c3..daed7ec 100644
--- a/3rdparty/lua/src/host/buildvm_fold.c
+++ b/3rdparty/lua/src/host/buildvm_fold.c
@@ -1,6 +1,6 @@
/*
** LuaJIT VM builder: IR folding hash table generator.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#include "buildvm.h"
diff --git a/3rdparty/lua/src/host/buildvm_lib.c b/3rdparty/lua/src/host/buildvm_lib.c
index 40141df..c37301d 100644
--- a/3rdparty/lua/src/host/buildvm_lib.c
+++ b/3rdparty/lua/src/host/buildvm_lib.c
@@ -1,6 +1,6 @@
/*
** LuaJIT VM builder: library definition compiler.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#include "buildvm.h"
diff --git a/3rdparty/lua/src/host/buildvm_peobj.c b/3rdparty/lua/src/host/buildvm_peobj.c
index 1249445..4279f50 100644
--- a/3rdparty/lua/src/host/buildvm_peobj.c
+++ b/3rdparty/lua/src/host/buildvm_peobj.c
@@ -1,6 +1,6 @@
/*
** LuaJIT VM builder: PE object emitter.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
**
** Only used for building on Windows, since we cannot assume the presence
** of a suitable assembler. The host and target byte order must match.
diff --git a/3rdparty/lua/src/host/genminilua.lua b/3rdparty/lua/src/host/genminilua.lua
index e666f08..cd0d946 100644
--- a/3rdparty/lua/src/host/genminilua.lua
+++ b/3rdparty/lua/src/host/genminilua.lua
@@ -2,7 +2,7 @@
-- Lua script to generate a customized, minified version of Lua.
-- The resulting 'minilua' is used for the build process of LuaJIT.
----------------------------------------------------------------------------
--- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
+-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
@@ -210,6 +210,7 @@ typedef unsigned __int64 U64;
#else
typedef unsigned long long U64;
#endif
+int _CRT_glob = 0;
]]}, {}
local function preprocess(src)
diff --git a/3rdparty/lua/src/host/minilua.c b/3rdparty/lua/src/host/minilua.c
index 93e9273..aee192a 100644
--- a/3rdparty/lua/src/host/minilua.c
+++ b/3rdparty/lua/src/host/minilua.c
@@ -27,6 +27,7 @@ typedef unsigned __int64 U64;
#else
typedef unsigned long long U64;
#endif
+int _CRT_glob = 0;
#include <stddef.h>
#include <stdarg.h>
#include <limits.h>
diff --git a/3rdparty/lua/src/jit/bc.lua b/3rdparty/lua/src/jit/bc.lua
index cef4752..46a4089 100644
--- a/3rdparty/lua/src/jit/bc.lua
+++ b/3rdparty/lua/src/jit/bc.lua
@@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- LuaJIT bytecode listing module.
--
--- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
+-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
--
@@ -41,7 +41,7 @@
-- Cache some library functions and objects.
local jit = require("jit")
-assert(jit.version_num == 20002, "LuaJIT core/library version mismatch")
+assert(jit.version_num == 20004, "LuaJIT core/library version mismatch")
local jutil = require("jit.util")
local vmdef = require("jit.vmdef")
local bit = require("bit")
diff --git a/3rdparty/lua/src/jit/bcsave.lua b/3rdparty/lua/src/jit/bcsave.lua
index e6d566e..0319b3d 100644
--- a/3rdparty/lua/src/jit/bcsave.lua
+++ b/3rdparty/lua/src/jit/bcsave.lua
@@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- LuaJIT module to save/list bytecode.
--
--- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
+-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
--
@@ -11,7 +11,7 @@
------------------------------------------------------------------------------
local jit = require("jit")
-assert(jit.version_num == 20002, "LuaJIT core/library version mismatch")
+assert(jit.version_num == 20004, "LuaJIT core/library version mismatch")
local bit = require("bit")
-- Symbol name prefix for LuaJIT bytecode.
@@ -69,7 +69,7 @@ local map_arch = {
local map_os = {
linux = true, windows = true, osx = true, freebsd = true, netbsd = true,
- openbsd = true, solaris = true,
+ openbsd = true, dragonfly = true, solaris = true,
}
local function checkarg(str, map, err)
diff --git a/3rdparty/lua/src/jit/dis_arm.lua b/3rdparty/lua/src/jit/dis_arm.lua
index dc7ca71..59be715 100644
--- a/3rdparty/lua/src/jit/dis_arm.lua
+++ b/3rdparty/lua/src/jit/dis_arm.lua
@@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- LuaJIT ARM disassembler module.
--
--- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
+-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
-- This is a helper module used by the LuaJIT machine code dumper module.
diff --git a/3rdparty/lua/src/jit/dis_mips.lua b/3rdparty/lua/src/jit/dis_mips.lua
index 830db40..acdd2be 100644
--- a/3rdparty/lua/src/jit/dis_mips.lua
+++ b/3rdparty/lua/src/jit/dis_mips.lua
@@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- LuaJIT MIPS disassembler module.
--
--- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
+-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
-- Released under the MIT/X license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
-- This is a helper module used by the LuaJIT machine code dumper module.
diff --git a/3rdparty/lua/src/jit/dis_mipsel.lua b/3rdparty/lua/src/jit/dis_mipsel.lua
index 8a10c46..dd9d26a 100644
--- a/3rdparty/lua/src/jit/dis_mipsel.lua
+++ b/3rdparty/lua/src/jit/dis_mipsel.lua
@@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- LuaJIT MIPSEL disassembler wrapper module.
--
--- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
+-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
-- This module just exports the little-endian functions from the
diff --git a/3rdparty/lua/src/jit/dis_ppc.lua b/3rdparty/lua/src/jit/dis_ppc.lua
index 169a534..d05c431 100644
--- a/3rdparty/lua/src/jit/dis_ppc.lua
+++ b/3rdparty/lua/src/jit/dis_ppc.lua
@@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- LuaJIT PPC disassembler module.
--
--- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
+-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
-- Released under the MIT/X license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
-- This is a helper module used by the LuaJIT machine code dumper module.
diff --git a/3rdparty/lua/src/jit/dis_x64.lua b/3rdparty/lua/src/jit/dis_x64.lua
index 4a1894a..a80981b 100644
--- a/3rdparty/lua/src/jit/dis_x64.lua
+++ b/3rdparty/lua/src/jit/dis_x64.lua
@@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- LuaJIT x64 disassembler wrapper module.
--
--- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
+-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
-- This module just exports the 64 bit functions from the combined
diff --git a/3rdparty/lua/src/jit/dis_x86.lua b/3rdparty/lua/src/jit/dis_x86.lua
index c442a17..078d609 100644
--- a/3rdparty/lua/src/jit/dis_x86.lua
+++ b/3rdparty/lua/src/jit/dis_x86.lua
@@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- LuaJIT x86/x64 disassembler module.
--
--- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
+-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
-- This is a helper module used by the LuaJIT machine code dumper module.
diff --git a/3rdparty/lua/src/jit/dump.lua b/3rdparty/lua/src/jit/dump.lua
index 7441b74..d15c528 100644
--- a/3rdparty/lua/src/jit/dump.lua
+++ b/3rdparty/lua/src/jit/dump.lua
@@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- LuaJIT compiler dump module.
--
--- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
+-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
--
@@ -36,6 +36,7 @@
-- * m Dump the generated machine code.
-- x Print each taken trace exit.
-- X Print each taken trace exit and the contents of all registers.
+-- a Print the IR of aborted traces, too.
--
-- The output format can be set with the following characters:
--
@@ -54,7 +55,7 @@
-- Cache some library functions and objects.
local jit = require("jit")
-assert(jit.version_num == 20002, "LuaJIT core/library version mismatch")
+assert(jit.version_num == 20004, "LuaJIT core/library version mismatch")
local jutil = require("jit.util")
local vmdef = require("jit.vmdef")
local funcinfo, funcbc = jutil.funcinfo, jutil.funcbc
@@ -546,10 +547,8 @@ local function dump_trace(what, tr, func, pc, otr, oex)
out:write("---- TRACE ", tr, " ", what)
if otr then out:write(" ", otr, "/", oex) end
out:write(" ", fmtfunc(func, pc), "\n")
- recprefix = ""
elseif what == "stop" or what == "abort" then
out:write("---- TRACE ", tr, " ", what)
- recprefix = nil
if what == "abort" then
out:write(" ", fmtfunc(func, pc), " -- ", fmterr(otr, oex), "\n")
else
diff --git a/3rdparty/lua/src/jit/v.lua b/3rdparty/lua/src/jit/v.lua
index d7df712..32666fd 100644
--- a/3rdparty/lua/src/jit/v.lua
+++ b/3rdparty/lua/src/jit/v.lua
@@ -1,7 +1,7 @@
----------------------------------------------------------------------------
-- Verbose mode of the LuaJIT compiler.
--
--- Copyright (C) 2005-2013 Mike Pall. All rights reserved.
+-- Copyright (C) 2005-2015 Mike Pall. All rights reserved.
-- Released under the MIT license. See Copyright Notice in luajit.h
----------------------------------------------------------------------------
--
@@ -59,7 +59,7 @@
-- Cache some library functions and objects.
local jit = require("jit")
-assert(jit.version_num == 20002, "LuaJIT core/library version mismatch")
+assert(jit.version_num == 20004, "LuaJIT core/library version mismatch")
local jutil = require("jit.util")
local vmdef = require("jit.vmdef")
local funcinfo, traceinfo = jutil.funcinfo, jutil.traceinfo
diff --git a/3rdparty/lua/src/lauxlib.h b/3rdparty/lua/src/lauxlib.h
index d201c51..fed1491 100644
--- a/3rdparty/lua/src/lauxlib.h
+++ b/3rdparty/lua/src/lauxlib.h
@@ -1,5 +1,5 @@
/*
-** $Id: lauxlib.h,v ec74646b41df 2013/11/19 00:23:10 oliver $
+** $Id: lauxlib.h,v 1.88.1.1 2007/12/27 13:02:25 roberto Exp $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
diff --git a/3rdparty/lua/src/lib_aux.c b/3rdparty/lua/src/lib_aux.c
index 05fa6b1..4a1b70d 100644
--- a/3rdparty/lua/src/lib_aux.c
+++ b/3rdparty/lua/src/lib_aux.c
@@ -1,6 +1,6 @@
/*
** Auxiliary library for the Lua/C API.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
**
** Major parts taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
@@ -302,7 +302,7 @@ static int panic(lua_State *L)
#ifdef LUAJIT_USE_SYSMALLOC
-#if LJ_64
+#if LJ_64 && !defined(LUAJIT_USE_VALGRIND)
#error "Must use builtin allocator for 64 bit target"
#endif
diff --git a/3rdparty/lua/src/lib_base.c b/3rdparty/lua/src/lib_base.c
index 070970e..17b9525 100644
--- a/3rdparty/lua/src/lib_base.c
+++ b/3rdparty/lua/src/lib_base.c
@@ -1,6 +1,6 @@
/*
** Base and coroutine library.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
**
** Major portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2011 Lua.org, PUC-Rio. See Copyright Notice in lua.h
diff --git a/3rdparty/lua/src/lib_bit.c b/3rdparty/lua/src/lib_bit.c
index 93fead9..583e04b 100644
--- a/3rdparty/lua/src/lib_bit.c
+++ b/3rdparty/lua/src/lib_bit.c
@@ -1,6 +1,6 @@
/*
** Bit manipulation library.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lib_bit_c
diff --git a/3rdparty/lua/src/lib_debug.c b/3rdparty/lua/src/lib_debug.c
index 38e6054..e87c35c 100644
--- a/3rdparty/lua/src/lib_debug.c
+++ b/3rdparty/lua/src/lib_debug.c
@@ -1,6 +1,6 @@
/*
** Debug library.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
**
** Major portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
diff --git a/3rdparty/lua/src/lib_ffi.c b/3rdparty/lua/src/lib_ffi.c
index f61fabc..f6df39d 100644
--- a/3rdparty/lua/src/lib_ffi.c
+++ b/3rdparty/lua/src/lib_ffi.c
@@ -1,6 +1,6 @@
/*
** FFI library.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lib_ffi_c
@@ -136,6 +136,7 @@ static int ffi_index_meta(lua_State *L, CTState *cts, CType *ct, MMS mm)
return 0;
}
}
+ copyTV(L, base, L->top);
tv = L->top-1;
}
return lj_meta_tailcall(L, tv);
@@ -657,7 +658,7 @@ LJLIB_CF(ffi_string) LJLIB_REC(.)
TValue *o = lj_lib_checkany(L, 1);
const char *p;
size_t len;
- if (o+1 < L->top) {
+ if (o+1 < L->top && !tvisnil(o+1)) {
len = (size_t)ffi_checkint(L, 2);
lj_cconv_ct_tv(cts, ctype_get(cts, CTID_P_CVOID), (uint8_t *)&p, o,
CCF_ARG(1));
diff --git a/3rdparty/lua/src/lib_init.c b/3rdparty/lua/src/lib_init.c
index 2d6bd59..85c194a 100644
--- a/3rdparty/lua/src/lib_init.c
+++ b/3rdparty/lua/src/lib_init.c
@@ -1,6 +1,6 @@
/*
** Library initialization.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
**
** Major parts taken verbatim from the Lua interpreter.
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
diff --git a/3rdparty/lua/src/lib_io.c b/3rdparty/lua/src/lib_io.c
index e0c6908..037aa28 100644
--- a/3rdparty/lua/src/lib_io.c
+++ b/3rdparty/lua/src/lib_io.c
@@ -1,6 +1,6 @@
/*
** I/O library.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
**
** Major portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2011 Lua.org, PUC-Rio. See Copyright Notice in lua.h
@@ -426,7 +426,7 @@ LJLIB_CF(io_popen)
LJLIB_CF(io_tmpfile)
{
IOFileUD *iof = io_file_new(L);
-#if LJ_TARGET_PS3
+#if LJ_TARGET_PS3 || LJ_TARGET_PS4 || LJ_TARGET_PSVITA
iof->fp = NULL; errno = ENOSYS;
#else
iof->fp = tmpfile();
diff --git a/3rdparty/lua/src/lib_jit.c b/3rdparty/lua/src/lib_jit.c
index 82e6825..96525fa 100644
--- a/3rdparty/lua/src/lib_jit.c
+++ b/3rdparty/lua/src/lib_jit.c
@@ -1,6 +1,6 @@
/*
** JIT library.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lib_jit_c
@@ -73,7 +73,7 @@ LJLIB_CF(jit_off)
LJLIB_CF(jit_flush)
{
#if LJ_HASJIT
- if (L->base < L->top && !tvisnil(L->base)) {
+ if (L->base < L->top && tvisnumber(L->base)) {
int traceno = lj_lib_checkint(L, 1);
luaJIT_setmode(L, traceno, LUAJIT_MODE_FLUSH|LUAJIT_MODE_TRACE);
return 0;
diff --git a/3rdparty/lua/src/lib_math.c b/3rdparty/lua/src/lib_math.c
index b23d9a2..40f2914 100644
--- a/3rdparty/lua/src/lib_math.c
+++ b/3rdparty/lua/src/lib_math.c
@@ -1,6 +1,6 @@
/*
** Math library.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#include <math.h>
@@ -47,6 +47,12 @@ LJLIB_ASM_(math_tanh) LJLIB_REC(math_htrig IRCALL_tanh)
LJLIB_ASM_(math_frexp)
LJLIB_ASM_(math_modf) LJLIB_REC(.)
+LJLIB_PUSH(57.29577951308232)
+LJLIB_ASM_(math_deg) LJLIB_REC(math_degrad)
+
+LJLIB_PUSH(0.017453292519943295)
+LJLIB_ASM_(math_rad) LJLIB_REC(math_degrad)
+
LJLIB_ASM(math_log) LJLIB_REC(math_log)
{
double x = lj_lib_checknum(L, 1);
@@ -63,12 +69,6 @@ LJLIB_ASM(math_log) LJLIB_REC(math_log)
return FFH_RETRY;
}
-LJLIB_PUSH(57.29577951308232)
-LJLIB_ASM_(math_deg) LJLIB_REC(math_degrad)
-
-LJLIB_PUSH(0.017453292519943295)
-LJLIB_ASM_(math_rad) LJLIB_REC(math_degrad)
-
LJLIB_ASM(math_atan2) LJLIB_REC(.)
{
lj_lib_checknum(L, 1);
diff --git a/3rdparty/lua/src/lib_os.c b/3rdparty/lua/src/lib_os.c
index 0a78412..bb5a141 100644
--- a/3rdparty/lua/src/lib_os.c
+++ b/3rdparty/lua/src/lib_os.c
@@ -1,13 +1,12 @@
/*
** OS library.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
**
** Major portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
*/
#include <errno.h>
-#include <locale.h>
#include <time.h>
#define lib_os_c
@@ -27,6 +26,10 @@
#include <stdio.h>
#endif
+#if !LJ_TARGET_PSVITA
+#include <locale.h>
+#endif
+
/* ------------------------------------------------------------------------ */
#define LJLIB_MODULE_os
@@ -70,7 +73,7 @@ LJLIB_CF(os_rename)
LJLIB_CF(os_tmpname)
{
-#if LJ_TARGET_PS3
+#if LJ_TARGET_PS3 || LJ_TARGET_PS4 || LJ_TARGET_PSVITA
lj_err_caller(L, LJ_ERR_OSUNIQF);
return 0;
#else
@@ -254,6 +257,9 @@ LJLIB_CF(os_difftime)
LJLIB_CF(os_setlocale)
{
+#if LJ_TARGET_PSVITA
+ lua_pushliteral(L, "C");
+#else
GCstr *s = lj_lib_optstr(L, 1);
const char *str = s ? strdata(s) : NULL;
int opt = lj_lib_checkopt(L, 2, 6,
@@ -265,6 +271,7 @@ LJLIB_CF(os_setlocale)
else if (opt == 4) opt = LC_MONETARY;
else if (opt == 6) opt = LC_ALL;
lua_pushstring(L, setlocale(opt, str));
+#endif
return 1;
}
diff --git a/3rdparty/lua/src/lib_package.c b/3rdparty/lua/src/lib_package.c
index f0e672d..ac38c81 100644
--- a/3rdparty/lua/src/lib_package.c
+++ b/3rdparty/lua/src/lib_package.c
@@ -1,6 +1,6 @@
/*
** Package library.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
**
** Major portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2012 Lua.org, PUC-Rio. See Copyright Notice in lua.h
@@ -68,9 +68,6 @@ static const char *ll_bcsym(void *lib, const char *sym)
#elif LJ_TARGET_WINDOWS
#define WIN32_LEAN_AND_MEAN
-#ifndef WINVER
-#define WINVER 0x0500
-#endif
#include <windows.h>
#ifndef GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
diff --git a/3rdparty/lua/src/lib_string.c b/3rdparty/lua/src/lib_string.c
index 0f245b0..c6168ed 100644
--- a/3rdparty/lua/src/lib_string.c
+++ b/3rdparty/lua/src/lib_string.c
@@ -1,6 +1,6 @@
/*
** String library.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
**
** Major portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
diff --git a/3rdparty/lua/src/lib_table.c b/3rdparty/lua/src/lib_table.c
index 542ed1f..fbfe863 100644
--- a/3rdparty/lua/src/lib_table.c
+++ b/3rdparty/lua/src/lib_table.c
@@ -1,6 +1,6 @@
/*
** Table library.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
**
** Major portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
diff --git a/3rdparty/lua/src/lj_alloc.c b/3rdparty/lua/src/lj_alloc.c
index 8f285d1..7c7ec67 100644
--- a/3rdparty/lua/src/lj_alloc.c
+++ b/3rdparty/lua/src/lj_alloc.c
@@ -177,32 +177,40 @@ static LJ_AINLINE int CALL_MUNMAP(void *ptr, size_t size)
#if LJ_64
/* 64 bit mode needs special support for allocating memory in the lower 2GB. */
-#if LJ_TARGET_LINUX
+#if defined(MAP_32BIT)
+#if defined(__sun__)
+#define MMAP_REGION_START ((uintptr_t)0x1000)
+#else
/* Actually this only gives us max. 1GB in current Linux kernels. */
+#define MMAP_REGION_START ((uintptr_t)0)
+#endif
+
static LJ_AINLINE void *CALL_MMAP(size_t size)
{
int olderr = errno;
- void *ptr = mmap(NULL, size, MMAP_PROT, MAP_32BIT|MMAP_FLAGS, -1, 0);
+ void *ptr = mmap((void *)MMAP_REGION_START, size, MMAP_PROT, MAP_32BIT|MMAP_FLAGS, -1, 0);
errno = olderr;
return ptr;
}
-#elif LJ_TARGET_OSX || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__sun__)
+#elif LJ_TARGET_OSX || LJ_TARGET_PS4 || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__sun__)
/* OSX and FreeBSD mmap() use a naive first-fit linear search.
** That's perfect for us. Except that -pagezero_size must be set for OSX,
** otherwise the lower 4GB are blocked. And the 32GB RLIMIT_DATA needs
** to be reduced to 250MB on FreeBSD.
*/
-#if LJ_TARGET_OSX
+#if LJ_TARGET_OSX || defined(__DragonFly__)
#define MMAP_REGION_START ((uintptr_t)0x10000)
+#elif LJ_TARGET_PS4
+#define MMAP_REGION_START ((uintptr_t)0x4000)
#else
#define MMAP_REGION_START ((uintptr_t)0x10000000)
#endif
#define MMAP_REGION_END ((uintptr_t)0x80000000)
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && !LJ_TARGET_PS4
#include <sys/resource.h>
#endif
@@ -212,7 +220,7 @@ static LJ_AINLINE void *CALL_MMAP(size_t size)
/* Hint for next allocation. Doesn't need to be thread-safe. */
static uintptr_t alloc_hint = MMAP_REGION_START;
int retry = 0;
-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && !LJ_TARGET_PS4
static int rlimit_modified = 0;
if (LJ_UNLIKELY(rlimit_modified == 0)) {
struct rlimit rlim;
@@ -230,7 +238,7 @@ static LJ_AINLINE void *CALL_MMAP(size_t size)
return p;
}
if (p != CMFAIL) munmap(p, size);
-#ifdef __sun__
+#if defined(__sun__) || defined(__DragonFly__)
alloc_hint += 0x1000000; /* Need near-exhaustive linear scan. */
if (alloc_hint + size < MMAP_REGION_END) continue;
#endif
diff --git a/3rdparty/lua/src/lj_api.c b/3rdparty/lua/src/lj_api.c
index edb2d62..3bedb39 100644
--- a/3rdparty/lua/src/lj_api.c
+++ b/3rdparty/lua/src/lj_api.c
@@ -1,6 +1,6 @@
/*
** Public Lua/C API.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
**
** Major portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
@@ -1164,7 +1164,7 @@ LUA_API int lua_gc(lua_State *L, int what, int data)
MSize a = (MSize)data << 10;
g->gc.threshold = (a <= g->gc.total) ? (g->gc.total - a) : 0;
while (g->gc.total >= g->gc.threshold)
- if (lj_gc_step(L)) {
+ if (lj_gc_step(L) > 0) {
res = 1;
break;
}
diff --git a/3rdparty/lua/src/lj_arch.h b/3rdparty/lua/src/lj_arch.h
index 9ea10d0..d3a9d57 100644
--- a/3rdparty/lua/src/lj_arch.h
+++ b/3rdparty/lua/src/lj_arch.h
@@ -1,6 +1,6 @@
/*
** Target architecture selection.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_ARCH_H
@@ -66,8 +66,9 @@
#define LUAJIT_OS LUAJIT_OS_LINUX
#elif defined(__MACH__) && defined(__APPLE__)
#define LUAJIT_OS LUAJIT_OS_OSX
-#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
- defined(__NetBSD__) || defined(__OpenBSD__)
+#elif (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
+ defined(__NetBSD__) || defined(__OpenBSD__) || \
+ defined(__DragonFly__)) && !defined(__ORBIS__)
#define LUAJIT_OS LUAJIT_OS_BSD
#elif (defined(__sun__) && defined(__svr4__)) || defined(__CYGWIN__)
#define LUAJIT_OS LUAJIT_OS_POSIX
@@ -104,6 +105,18 @@
#define LJ_TARGET_CONSOLE 1
#endif
+#ifdef __ORBIS__
+#define LJ_TARGET_PS4 1
+#define LJ_TARGET_CONSOLE 1
+#undef NULL
+#define NULL ((void*)0)
+#endif
+
+#ifdef __psp2__
+#define LJ_TARGET_PSVITA 1
+#define LJ_TARGET_CONSOLE 1
+#endif
+
#if _XBOX_VER >= 200
#define LJ_TARGET_XBOX360 1
#define LJ_TARGET_CONSOLE 1
@@ -168,7 +181,9 @@
#define LJ_TARGET_UNIFYROT 2 /* Want only IR_BROR. */
#define LJ_ARCH_NUMMODE LJ_NUMMODE_DUAL
-#if __ARM_ARCH_7__ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH_7S__
+#if __ARM_ARCH____ARM_ARCH_8__ || __ARM_ARCH_8A__
+#define LJ_ARCH_VERSION 80
+#elif __ARM_ARCH_7__ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH_7S__ || __ARM_ARCH_7VE__
#define LJ_ARCH_VERSION 70
#elif __ARM_ARCH_6T2__
#define LJ_ARCH_VERSION 61
@@ -327,6 +342,9 @@
#if defined(__mips_soft_float)
#error "No support for MIPS CPUs without FPU"
#endif
+#if defined(_LP64)
+#error "No support for MIPS64"
+#endif
#endif
#endif
diff --git a/3rdparty/lua/src/lj_asm.c b/3rdparty/lua/src/lj_asm.c
index 316e81d..804b4dc 100644
--- a/3rdparty/lua/src/lj_asm.c
+++ b/3rdparty/lua/src/lj_asm.c
@@ -1,6 +1,6 @@
/*
** IR assembler (SSA IR -> machine code).
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_asm_c
@@ -353,6 +353,7 @@ static Reg ra_rematk(ASMState *as, IRRef ref)
static int32_t ra_spill(ASMState *as, IRIns *ir)
{
int32_t slot = ir->s;
+ lua_assert(ir >= as->ir + REF_TRUE);
if (!ra_hasspill(slot)) {
if (irt_is64(ir->t)) {
slot = as->evenspill;
@@ -1246,16 +1247,18 @@ static void asm_phi_fixup(ASMState *as)
Reg r = rset_picktop(work);
IRRef lref = as->phireg[r];
IRIns *ir = IR(lref);
- /* Left PHI gained a spill slot before the loop? */
- if (irt_ismarked(ir->t) && ra_hasspill(ir->s)) {
- IRRef ren;
- lj_ir_set(as->J, IRT(IR_RENAME, IRT_NIL), lref, as->loopsnapno);
- ren = tref_ref(lj_ir_emit(as->J));
- as->ir = as->T->ir; /* The IR may have been reallocated. */
- IR(ren)->r = (uint8_t)r;
- IR(ren)->s = SPS_NONE;
+ if (irt_ismarked(ir->t)) {
+ irt_clearmark(ir->t);
+ /* Left PHI gained a spill slot before the loop? */
+ if (ra_hasspill(ir->s)) {
+ IRRef ren;
+ lj_ir_set(as->J, IRT(IR_RENAME, IRT_NIL), lref, as->loopsnapno);
+ ren = tref_ref(lj_ir_emit(as->J));
+ as->ir = as->T->ir; /* The IR may have been reallocated. */
+ IR(ren)->r = (uint8_t)r;
+ IR(ren)->s = SPS_NONE;
+ }
}
- irt_clearmark(ir->t); /* Always clear marker. */
rset_clear(work, r);
}
}
@@ -1370,6 +1373,11 @@ static void asm_head_side(ASMState *as)
int pass3 = 0;
IRRef i;
+ if (as->snapno && as->topslot > as->parent->topslot) {
+ /* Force snap #0 alloc to prevent register overwrite in stack check. */
+ as->snapno = 0;
+ asm_snap_alloc(as);
+ }
allow = asm_head_side_base(as, irp, allow);
/* Scan all parent SLOADs and collect register dependencies. */
diff --git a/3rdparty/lua/src/lj_asm.h b/3rdparty/lua/src/lj_asm.h
index a88e7da..85f2976 100644
--- a/3rdparty/lua/src/lj_asm.h
+++ b/3rdparty/lua/src/lj_asm.h
@@ -1,6 +1,6 @@
/*
** IR assembler (SSA IR -> machine code).
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_ASM_H
diff --git a/3rdparty/lua/src/lj_asm_arm.h b/3rdparty/lua/src/lj_asm_arm.h
index a66573c..9e4cf43 100644
--- a/3rdparty/lua/src/lj_asm_arm.h
+++ b/3rdparty/lua/src/lj_asm_arm.h
@@ -1,6 +1,6 @@
/*
** ARM IR assembler (SSA IR -> machine code).
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
/* -- Register allocator extensions --------------------------------------- */
@@ -493,6 +493,7 @@ static void asm_retf(ASMState *as, IRIns *ir)
int32_t delta = 1+bc_a(*((const BCIns *)pc - 1));
as->topslot -= (BCReg)delta;
if ((int32_t)as->topslot < 0) as->topslot = 0;
+ irt_setmark(IR(REF_BASE)->t); /* Children must not coalesce with BASE reg. */
/* Need to force a spill on REF_BASE now to update the stack slot. */
emit_lso(as, ARMI_STR, base, RID_SP, ra_spill(as, IR(REF_BASE)));
emit_setgl(as, base, jit_base);
@@ -521,10 +522,10 @@ static void asm_tointg(ASMState *as, IRIns *ir, Reg left)
static void asm_tobit(ASMState *as, IRIns *ir)
{
RegSet allow = RSET_FPR;
- Reg dest = ra_dest(as, ir, RSET_GPR);
Reg left = ra_alloc1(as, ir->op1, allow);
Reg right = ra_alloc1(as, ir->op2, rset_clear(allow, left));
Reg tmp = ra_scratch(as, rset_clear(allow, right));
+ Reg dest = ra_dest(as, ir, RSET_GPR);
emit_dn(as, ARMI_VMOV_R_S, dest, (tmp & 15));
emit_dnm(as, ARMI_VADD_D, (tmp & 15), (left & 15), (right & 15));
}
@@ -564,9 +565,9 @@ static void asm_conv(ASMState *as, IRIns *ir)
lua_assert(irt_isint(ir->t) && st == IRT_NUM);
asm_tointg(as, ir, ra_alloc1(as, lref, RSET_FPR));
} else {
- Reg dest = ra_dest(as, ir, RSET_GPR);
Reg left = ra_alloc1(as, lref, RSET_FPR);
Reg tmp = ra_scratch(as, rset_exclude(RSET_FPR, left));
+ Reg dest = ra_dest(as, ir, RSET_GPR);
ARMIns ai;
emit_dn(as, ARMI_VMOV_R_S, dest, (tmp & 15));
ai = irt_isint(ir->t) ?
@@ -1210,6 +1211,9 @@ static void asm_sload(ASMState *as, IRIns *ir)
} else
#endif
if (ra_used(ir)) {
+ Reg tmp = RID_NONE;
+ if ((ir->op2 & IRSLOAD_CONVERT))
+ tmp = ra_scratch(as, t == IRT_INT ? RSET_FPR : RSET_GPR);
lua_assert((LJ_SOFTFP ? 0 : irt_isnum(ir->t)) ||
irt_isint(ir->t) || irt_isaddr(ir->t));
dest = ra_dest(as, ir, (!LJ_SOFTFP && t == IRT_NUM) ? RSET_FPR : allow);
@@ -1217,18 +1221,15 @@ static void asm_sload(ASMState *as, IRIns *ir)
base = ra_alloc1(as, REF_BASE, allow);
if ((ir->op2 & IRSLOAD_CONVERT)) {
if (t == IRT_INT) {
- Reg tmp = ra_scratch(as, RSET_FPR);
emit_dn(as, ARMI_VMOV_R_S, dest, (tmp & 15));
emit_dm(as, ARMI_VCVT_S32_F64, (tmp & 15), (tmp & 15));
- dest = tmp;
t = IRT_NUM; /* Check for original type. */
} else {
- Reg tmp = ra_scratch(as, RSET_GPR);
emit_dm(as, ARMI_VCVT_F64_S32, (dest & 15), (dest & 15));
emit_dn(as, ARMI_VMOV_S_R, tmp, (dest & 15));
- dest = tmp;
t = IRT_INT; /* Check for original type. */
}
+ dest = tmp;
}
goto dotypecheck;
}
@@ -1503,7 +1504,7 @@ static void asm_intmul(ASMState *as, IRIns *ir)
if (dest == left && left != right) { left = right; right = dest; }
if (irt_isguard(ir->t)) { /* IR_MULOV */
if (!(as->flags & JIT_F_ARMV6) && dest == left)
- tmp = left = ra_scratch(as, rset_exclude(RSET_FPR, left));
+ tmp = left = ra_scratch(as, rset_exclude(RSET_GPR, left));
asm_guardcc(as, CC_NE);
emit_nm(as, ARMI_TEQ|ARMF_SH(ARMSH_ASR, 31), RID_TMP, dest);
emit_dnm(as, ARMI_SMULL|ARMF_S(right), dest, RID_TMP, left);
@@ -2102,7 +2103,8 @@ static void asm_head_root_base(ASMState *as)
IRIns *ir;
asm_head_lreg(as);
ir = IR(REF_BASE);
- if (ra_hasreg(ir->r) && rset_test(as->modset, ir->r)) ra_spill(as, ir);
+ if (ra_hasreg(ir->r) && (rset_test(as->modset, ir->r) || irt_ismarked(ir->t)))
+ ra_spill(as, ir);
ra_destreg(as, ir, RID_BASE);
}
@@ -2112,7 +2114,8 @@ static RegSet asm_head_side_base(ASMState *as, IRIns *irp, RegSet allow)
IRIns *ir;
asm_head_lreg(as);
ir = IR(REF_BASE);
- if (ra_hasreg(ir->r) && rset_test(as->modset, ir->r)) ra_spill(as, ir);
+ if (ra_hasreg(ir->r) && (rset_test(as->modset, ir->r) || irt_ismarked(ir->t)))
+ ra_spill(as, ir);
if (ra_hasspill(irp->s)) {
rset_clear(allow, ra_dest(as, ir, allow));
} else {
diff --git a/3rdparty/lua/src/lj_asm_mips.h b/3rdparty/lua/src/lj_asm_mips.h
index 9fe7c9c..78bd26d 100644
--- a/3rdparty/lua/src/lj_asm_mips.h
+++ b/3rdparty/lua/src/lj_asm_mips.h
@@ -1,6 +1,6 @@
/*
** MIPS IR assembler (SSA IR -> machine code).
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
/* -- Register allocator extensions --------------------------------------- */
@@ -394,6 +394,7 @@ static void asm_retf(ASMState *as, IRIns *ir)
int32_t delta = 1+bc_a(*((const BCIns *)pc - 1));
as->topslot -= (BCReg)delta;
if ((int32_t)as->topslot < 0) as->topslot = 0;
+ irt_setmark(IR(REF_BASE)->t); /* Children must not coalesce with BASE reg. */
emit_setgl(as, base, jit_base);
emit_addptr(as, base, -8*delta);
asm_guard(as, MIPSI_BNE, RID_TMP,
@@ -1723,7 +1724,7 @@ static void asm_head_root_base(ASMState *as)
if (as->loopinv) as->mctop--;
if (ra_hasreg(r)) {
ra_free(as, r);
- if (rset_test(as->modset, r))
+ if (rset_test(as->modset, r) || irt_ismarked(ir->t))
ir->r = RID_INIT; /* No inheritance for modified BASE register. */
if (r != RID_BASE)
emit_move(as, r, RID_BASE);
@@ -1738,7 +1739,7 @@ static RegSet asm_head_side_base(ASMState *as, IRIns *irp, RegSet allow)
if (as->loopinv) as->mctop--;
if (ra_hasreg(r)) {
ra_free(as, r);
- if (rset_test(as->modset, r))
+ if (rset_test(as->modset, r) || irt_ismarked(ir->t))
ir->r = RID_INIT; /* No inheritance for modified BASE register. */
if (irp->r == r) {
rset_clear(allow, r); /* Mark same BASE register as coalesced. */
diff --git a/3rdparty/lua/src/lj_asm_ppc.h b/3rdparty/lua/src/lj_asm_ppc.h
index 651fa31..2c5d74a 100644
--- a/3rdparty/lua/src/lj_asm_ppc.h
+++ b/3rdparty/lua/src/lj_asm_ppc.h
@@ -1,6 +1,6 @@
/*
** PPC IR assembler (SSA IR -> machine code).
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
/* -- Register allocator extensions --------------------------------------- */
@@ -49,6 +49,8 @@ static void asm_exitstub_setup(ASMState *as, ExitNo nexits)
{
ExitNo i;
MCode *mxp = as->mctop;
+ if (mxp - (nexits + 3 + MCLIM_REDZONE) < as->mclim)
+ asm_mclimit(as);
/* 1: mflr r0; bl ->vm_exit_handler; li r0, traceno; bl <1; bl <1; ... */
for (i = nexits-1; (int32_t)i >= 0; i--)
*--mxp = PPCI_BL|(((-3-i)&0x00ffffffu)<<2);
@@ -381,6 +383,7 @@ static void asm_retf(ASMState *as, IRIns *ir)
int32_t delta = 1+bc_a(*((const BCIns *)pc - 1));
as->topslot -= (BCReg)delta;
if ((int32_t)as->topslot < 0) as->topslot = 0;
+ irt_setmark(IR(REF_BASE)->t); /* Children must not coalesce with BASE reg. */
emit_setgl(as, base, jit_base);
emit_addptr(as, base, -8*delta);
asm_guardcc(as, CC_NE);
@@ -1901,7 +1904,7 @@ static void asm_head_root_base(ASMState *as)
Reg r = ir->r;
if (ra_hasreg(r)) {
ra_free(as, r);
- if (rset_test(as->modset, r))
+ if (rset_test(as->modset, r) || irt_ismarked(ir->t))
ir->r = RID_INIT; /* No inheritance for modified BASE register. */
if (r != RID_BASE)
emit_mr(as, r, RID_BASE);
@@ -1915,7 +1918,7 @@ static RegSet asm_head_side_base(ASMState *as, IRIns *irp, RegSet allow)
Reg r = ir->r;
if (ra_hasreg(r)) {
ra_free(as, r);
- if (rset_test(as->modset, r))
+ if (rset_test(as->modset, r) || irt_ismarked(ir->t))
ir->r = RID_INIT; /* No inheritance for modified BASE register. */
if (irp->r == r) {
rset_clear(allow, r); /* Mark same BASE register as coalesced. */
diff --git a/3rdparty/lua/src/lj_asm_x86.h b/3rdparty/lua/src/lj_asm_x86.h
index 64441cc..0b6b2d4 100644
--- a/3rdparty/lua/src/lj_asm_x86.h
+++ b/3rdparty/lua/src/lj_asm_x86.h
@@ -1,6 +1,6 @@
/*
** x86/x64 IR assembler (SSA IR -> machine code).
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
/* -- Guard handling ------------------------------------------------------ */
@@ -325,6 +325,14 @@ static Reg asm_fuseload(ASMState *as, IRRef ref, RegSet allow)
as->mrm.base = as->mrm.idx = RID_NONE;
return RID_MRM;
}
+ } else if (ir->o == IR_KINT64) {
+ RegSet avail = as->freeset & ~as->modset & RSET_GPR;
+ lua_assert(allow != RSET_EMPTY);
+ if (!(avail & (avail-1))) { /* Fuse if less than two regs available. */
+ as->mrm.ofs = ptr2addr(ir_kint64(ir));
+ as->mrm.base = as->mrm.idx = RID_NONE;
+ return RID_MRM;
+ }
} else if (mayfuse(as, ref)) {
RegSet xallow = (allow & RSET_GPR) ? allow : RSET_GPR;
if (ir->o == IR_SLOAD) {
@@ -361,7 +369,7 @@ static Reg asm_fuseload(ASMState *as, IRRef ref, RegSet allow)
return RID_MRM;
}
}
- if (!(as->freeset & allow) &&
+ if (!(as->freeset & allow) && !irref_isk(ref) &&
(allow == RSET_EMPTY || ra_hasspill(ir->s) || iscrossref(as, ref)))
goto fusespill;
return ra_allocref(as, ref, allow);
@@ -571,7 +579,7 @@ static void asm_setupresult(ASMState *as, IRIns *ir, const CCallInfo *ci)
lua_assert(!irt_ispri(ir->t));
ra_destreg(as, ir, RID_RET);
}
- } else if (LJ_32 && irt_isfp(ir->t)) {
+ } else if (LJ_32 && irt_isfp(ir->t) && !(ci->flags & CCI_CASTU64)) {
emit_x87op(as, XI_FPOP); /* Pop unused result from x87 st0. */
}
}
@@ -647,6 +655,7 @@ static void asm_retf(ASMState *as, IRIns *ir)
int32_t delta = 1+bc_a(*((const BCIns *)pc - 1));
as->topslot -= (BCReg)delta;
if ((int32_t)as->topslot < 0) as->topslot = 0;
+ irt_setmark(IR(REF_BASE)->t); /* Children must not coalesce with BASE reg. */
emit_setgl(as, base, jit_base);
emit_addptr(as, base, -8*delta);
asm_guardcc(as, CC_NE);
@@ -1827,8 +1836,12 @@ static void asm_intarith(ASMState *as, IRIns *ir, x86Arith xa)
Reg dest, right;
int32_t k = 0;
if (as->flagmcp == as->mcp) { /* Drop test r,r instruction. */
- as->flagmcp = NULL;
- as->mcp += (LJ_64 && *as->mcp < XI_TESTb) ? 3 : 2;
+ MCode *p = as->mcp + ((LJ_64 && *as->mcp < XI_TESTb) ? 3 : 2);
+ if ((p[1] & 15) < 14) {
+ if ((p[1] & 15) >= 12) p[1] -= 4; /* L <->S, NL <-> NS */
+ as->flagmcp = NULL;
+ as->mcp = p;
+ } /* else: cannot transform LE/NLE to cc without use of OF. */
}
right = IR(rref)->r;
if (ra_hasreg(right)) {
@@ -2481,7 +2494,7 @@ static void asm_head_root_base(ASMState *as)
Reg r = ir->r;
if (ra_hasreg(r)) {
ra_free(as, r);
- if (rset_test(as->modset, r))
+ if (rset_test(as->modset, r) || irt_ismarked(ir->t))
ir->r = RID_INIT; /* No inheritance for modified BASE register. */
if (r != RID_BASE)
emit_rr(as, XO_MOV, r, RID_BASE);
@@ -2495,7 +2508,7 @@ static RegSet asm_head_side_base(ASMState *as, IRIns *irp, RegSet allow)
Reg r = ir->r;
if (ra_hasreg(r)) {
ra_free(as, r);
- if (rset_test(as->modset, r))
+ if (rset_test(as->modset, r) || irt_ismarked(ir->t))
ir->r = RID_INIT; /* No inheritance for modified BASE register. */
if (irp->r == r) {
rset_clear(allow, r); /* Mark same BASE register as coalesced. */
diff --git a/3rdparty/lua/src/lj_bc.c b/3rdparty/lua/src/lj_bc.c
index 1e5869e..a8f444c 100644
--- a/3rdparty/lua/src/lj_bc.c
+++ b/3rdparty/lua/src/lj_bc.c
@@ -1,6 +1,6 @@
/*
** Bytecode instruction modes.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_bc_c
diff --git a/3rdparty/lua/src/lj_bc.h b/3rdparty/lua/src/lj_bc.h
index 56e71dd..7436fab 100644
--- a/3rdparty/lua/src/lj_bc.h
+++ b/3rdparty/lua/src/lj_bc.h
@@ -1,6 +1,6 @@
/*
** Bytecode instruction format.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_BC_H
diff --git a/3rdparty/lua/src/lj_bcdump.h b/3rdparty/lua/src/lj_bcdump.h
index e660156..812d0e1 100644
--- a/3rdparty/lua/src/lj_bcdump.h
+++ b/3rdparty/lua/src/lj_bcdump.h
@@ -1,6 +1,6 @@
/*
** Bytecode dump definitions.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_BCDUMP_H
diff --git a/3rdparty/lua/src/lj_bcread.c b/3rdparty/lua/src/lj_bcread.c
index 2b5ba85..25859d2 100644
--- a/3rdparty/lua/src/lj_bcread.c
+++ b/3rdparty/lua/src/lj_bcread.c
@@ -1,6 +1,6 @@
/*
** Bytecode reader.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_bcread_c
diff --git a/3rdparty/lua/src/lj_bcwrite.c b/3rdparty/lua/src/lj_bcwrite.c
index 4805d51..ff97450 100644
--- a/3rdparty/lua/src/lj_bcwrite.c
+++ b/3rdparty/lua/src/lj_bcwrite.c
@@ -1,6 +1,6 @@
/*
** Bytecode writer.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_bcwrite_c
diff --git a/3rdparty/lua/src/lj_carith.c b/3rdparty/lua/src/lj_carith.c
index afe7e68..2a358a9 100644
--- a/3rdparty/lua/src/lj_carith.c
+++ b/3rdparty/lua/src/lj_carith.c
@@ -1,6 +1,6 @@
/*
** C data arithmetic.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#include "lj_obj.h"
@@ -62,7 +62,7 @@ static int carith_checkarg(lua_State *L, CTState *cts, CDArith *ca)
TValue *o2 = i == 0 ? o+1 : o-1;
CType *ct = ctype_raw(cts, cdataV(o2)->ctypeid);
ca->ct[i] = NULL;
- ca->p[i] = NULL;
+ ca->p[i] = (uint8_t *)strVdata(o);
ok = 0;
if (ctype_isenum(ct->info)) {
CTSize ofs;
@@ -79,7 +79,7 @@ static int carith_checkarg(lua_State *L, CTState *cts, CDArith *ca)
}
} else {
ca->ct[i] = NULL;
- ca->p[i] = NULL;
+ ca->p[i] = (void *)(intptr_t)1; /* To make it unequal. */
ok = 0;
}
}
@@ -234,7 +234,9 @@ static int lj_carith_meta(lua_State *L, CTState *cts, CDArith *ca, MMS mm)
const char *repr[2];
int i, isenum = -1, isstr = -1;
if (mm == MM_eq) { /* Equality checks never raise an error. */
- setboolV(L->top-1, 0);
+ int eq = ca->p[0] == ca->p[1];
+ setboolV(L->top-1, eq);
+ setboolV(&G(L)->tmptv2, eq); /* Remember for trace recorder. */
return 1;
}
for (i = 0; i < 2; i++) {
diff --git a/3rdparty/lua/src/lj_carith.h b/3rdparty/lua/src/lj_carith.h
index ae17df0..8c4bdbb 100644
--- a/3rdparty/lua/src/lj_carith.h
+++ b/3rdparty/lua/src/lj_carith.h
@@ -1,6 +1,6 @@
/*
** C data arithmetic.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_CARITH_H
diff --git a/3rdparty/lua/src/lj_ccall.c b/3rdparty/lua/src/lj_ccall.c
index eb73604..998417c 100644
--- a/3rdparty/lua/src/lj_ccall.c
+++ b/3rdparty/lua/src/lj_ccall.c
@@ -1,6 +1,6 @@
/*
** FFI C call handling.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#include "lj_obj.h"
@@ -173,9 +173,10 @@
#define CCALL_HANDLE_REGARG \
if (isfp) { /* Try to pass argument in FPRs. */ \
- if (nfpr + n <= CCALL_NARG_FPR) { \
+ int n2 = ctype_isvector(d->info) ? 1 : n; \
+ if (nfpr + n2 <= CCALL_NARG_FPR) { \
dp = &cc->fpr[nfpr]; \
- nfpr += n; \
+ nfpr += n2; \
goto done; \
} \
} else { /* Try to pass argument in GPRs. */ \
diff --git a/3rdparty/lua/src/lj_ccall.h b/3rdparty/lua/src/lj_ccall.h
index 1afeed7..f553010 100644
--- a/3rdparty/lua/src/lj_ccall.h
+++ b/3rdparty/lua/src/lj_ccall.h
@@ -1,6 +1,6 @@
/*
** FFI C call handling.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_CCALL_H
diff --git a/3rdparty/lua/src/lj_ccallback.c b/3rdparty/lua/src/lj_ccallback.c
index 0010992..b210641 100644
--- a/3rdparty/lua/src/lj_ccallback.c
+++ b/3rdparty/lua/src/lj_ccallback.c
@@ -1,6 +1,6 @@
/*
** FFI C callback handling.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#include "lj_obj.h"
@@ -408,6 +408,7 @@ static void callback_conv_args(CTState *cts, lua_State *L)
intptr_t *stack = cts->cb.stack;
MSize slot = cts->cb.slot;
CTypeID id = 0, rid, fid;
+ int gcsteps = 0;
CType *ct;
GCfunc *fn;
MSize ngpr = 0, nsp = 0, maxgpr = CCALL_NARG_GPR;
@@ -475,7 +476,7 @@ static void callback_conv_args(CTState *cts, lua_State *L)
done:
if (LJ_BE && cta->size < CTSIZE_PTR)
sp = (void *)((uint8_t *)sp + CTSIZE_PTR-cta->size);
- lj_cconv_tv_ct(cts, cta, 0, o++, sp);
+ gcsteps += lj_cconv_tv_ct(cts, cta, 0, o++, sp);
}
fid = ctf->sib;
}
@@ -485,6 +486,8 @@ static void callback_conv_args(CTState *cts, lua_State *L)
if (ctype_cconv(ct->info) != CTCC_CDECL)
(L->base-2)->u32.hi |= (nsp << (16+2));
#endif
+ while (gcsteps-- > 0)
+ lj_gc_check(L);
}
/* Convert Lua object to callback result. */
diff --git a/3rdparty/lua/src/lj_ccallback.h b/3rdparty/lua/src/lj_ccallback.h
index ac11d7b..83dbe04 100644
--- a/3rdparty/lua/src/lj_ccallback.h
+++ b/3rdparty/lua/src/lj_ccallback.h
@@ -1,6 +1,6 @@
/*
** FFI C callback handling.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_CCALLBACK_H
diff --git a/3rdparty/lua/src/lj_cconv.c b/3rdparty/lua/src/lj_cconv.c
index 337382f..8a27076 100644
--- a/3rdparty/lua/src/lj_cconv.c
+++ b/3rdparty/lua/src/lj_cconv.c
@@ -1,6 +1,6 @@
/*
** C type conversions.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#include "lj_obj.h"
@@ -702,6 +702,7 @@ static void cconv_substruct_init(CTState *cts, CType *d, uint8_t *dp,
} else if (ctype_isxattrib(df->info, CTA_SUBTYPE)) {
cconv_substruct_init(cts, ctype_rawchild(cts, df),
dp+df->size, o, len, ip);
+ if ((d->info & CTF_UNION)) break;
} /* Ignore all other entries in the chain. */
}
}
diff --git a/3rdparty/lua/src/lj_cconv.h b/3rdparty/lua/src/lj_cconv.h
index 5c7a819..2bd50ff 100644
--- a/3rdparty/lua/src/lj_cconv.h
+++ b/3rdparty/lua/src/lj_cconv.h
@@ -1,6 +1,6 @@
/*
** C type conversions.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_CCONV_H
diff --git a/3rdparty/lua/src/lj_cdata.c b/3rdparty/lua/src/lj_cdata.c
index 10f4809..39fc13a 100644
--- a/3rdparty/lua/src/lj_cdata.c
+++ b/3rdparty/lua/src/lj_cdata.c
@@ -1,6 +1,6 @@
/*
** C data management.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#include "lj_obj.h"
@@ -127,16 +127,16 @@ collect_attrib:
integer_key:
if (ctype_ispointer(ct->info)) {
CTSize sz = lj_ctype_size(cts, ctype_cid(ct->info)); /* Element size. */
- if (sz != CTSIZE_INVALID) {
- if (ctype_isptr(ct->info)) {
- p = (uint8_t *)cdata_getptr(p, ct->size);
- } else if ((ct->info & (CTF_VECTOR|CTF_COMPLEX))) {
- if ((ct->info & CTF_COMPLEX)) idx &= 1;
- *qual |= CTF_CONST; /* Valarray elements are constant. */
- }
- *pp = p + idx*(int32_t)sz;
- return ct;
+ if (sz == CTSIZE_INVALID)
+ lj_err_caller(cts->L, LJ_ERR_FFI_INVSIZE);
+ if (ctype_isptr(ct->info)) {
+ p = (uint8_t *)cdata_getptr(p, ct->size);
+ } else if ((ct->info & (CTF_VECTOR|CTF_COMPLEX))) {
+ if ((ct->info & CTF_COMPLEX)) idx &= 1;
+ *qual |= CTF_CONST; /* Valarray elements are constant. */
}
+ *pp = p + idx*(int32_t)sz;
+ return ct;
}
} else if (tviscdata(key)) { /* Integer cdata key. */
GCcdata *cdk = cdataV(key);
diff --git a/3rdparty/lua/src/lj_cdata.h b/3rdparty/lua/src/lj_cdata.h
index 0c81b02..3a1275e 100644
--- a/3rdparty/lua/src/lj_cdata.h
+++ b/3rdparty/lua/src/lj_cdata.h
@@ -1,6 +1,6 @@
/*
** C data management.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_CDATA_H
diff --git a/3rdparty/lua/src/lj_clib.c b/3rdparty/lua/src/lj_clib.c
index 23d1f18..d352609 100644
--- a/3rdparty/lua/src/lj_clib.c
+++ b/3rdparty/lua/src/lj_clib.c
@@ -1,6 +1,6 @@
/*
** FFI C library loader.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#include "lj_obj.h"
@@ -144,9 +144,6 @@ static void *clib_getsym(CLibrary *cl, const char *name)
#elif LJ_TARGET_WINDOWS
#define WIN32_LEAN_AND_MEAN
-#ifndef WINVER
-#define WINVER 0x0500
-#endif
#include <windows.h>
#ifndef GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
@@ -220,7 +217,7 @@ static void clib_unloadlib(CLibrary *cl)
FreeLibrary((HINSTANCE)h);
}
}
- } else if (!cl->handle) {
+ } else if (cl->handle) {
FreeLibrary((HINSTANCE)cl->handle);
}
}
diff --git a/3rdparty/lua/src/lj_clib.h b/3rdparty/lua/src/lj_clib.h
index 421388a..e5dc98e 100644
--- a/3rdparty/lua/src/lj_clib.h
+++ b/3rdparty/lua/src/lj_clib.h
@@ -1,6 +1,6 @@
/*
** FFI C library loader.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_CLIB_H
diff --git a/3rdparty/lua/src/lj_cparse.c b/3rdparty/lua/src/lj_cparse.c
index 107c038..b9df88d 100644
--- a/3rdparty/lua/src/lj_cparse.c
+++ b/3rdparty/lua/src/lj_cparse.c
@@ -1,6 +1,6 @@
/*
** C declaration parser.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#include "lj_obj.h"
@@ -57,14 +57,22 @@ static LJ_AINLINE int cp_iseol(CPChar c)
return (c == '\n' || c == '\r');
}
-static LJ_AINLINE CPChar cp_get(CPState *cp);
-
/* Peek next raw character. */
static LJ_AINLINE CPChar cp_rawpeek(CPState *cp)
{
return (CPChar)(uint8_t)(*cp->p);
}
+static LJ_NOINLINE CPChar cp_get_bs(CPState *cp);
+
+/* Get next character. */
+static LJ_AINLINE CPChar cp_get(CPState *cp)
+{
+ cp->c = (CPChar)(uint8_t)(*cp->p++);
+ if (LJ_LIKELY(cp->c != '\\')) return cp->c;
+ return cp_get_bs(cp);
+}
+
/* Transparently skip backslash-escaped line breaks. */
static LJ_NOINLINE CPChar cp_get_bs(CPState *cp)
{
@@ -77,14 +85,6 @@ static LJ_NOINLINE CPChar cp_get_bs(CPState *cp)
return cp_get(cp);
}
-/* Get next character. */
-static LJ_AINLINE CPChar cp_get(CPState *cp)
-{
- cp->c = (CPChar)(uint8_t)(*cp->p++);
- if (LJ_LIKELY(cp->c != '\\')) return cp->c;
- return cp_get_bs(cp);
-}
-
/* Grow save buffer. */
static LJ_NOINLINE void cp_save_grow(CPState *cp, CPChar c)
{
@@ -1258,7 +1258,7 @@ static void cp_struct_layout(CPState *cp, CTypeID sid, CTInfo sattr)
sinfo |= (info & (CTF_QUAL|CTF_VLA)); /* Merge pseudo-qualifiers. */
/* Check for size overflow and determine alignment. */
- if (sz >= 0x20000000u || bofs + csz < bofs) {
+ if (sz >= 0x20000000u || bofs + csz < bofs || (info & CTF_VLA)) {
if (!(sz == CTSIZE_INVALID && ctype_isarray(info) &&
!(sinfo & CTF_UNION)))
cp_err(cp, LJ_ERR_FFI_INVSIZE);
diff --git a/3rdparty/lua/src/lj_cparse.h b/3rdparty/lua/src/lj_cparse.h
index c097b14..441580d 100644
--- a/3rdparty/lua/src/lj_cparse.h
+++ b/3rdparty/lua/src/lj_cparse.h
@@ -1,6 +1,6 @@
/*
** C declaration parser.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_CPARSE_H
diff --git a/3rdparty/lua/src/lj_crecord.c b/3rdparty/lua/src/lj_crecord.c
index df98e6e..a46665e 100644
--- a/3rdparty/lua/src/lj_crecord.c
+++ b/3rdparty/lua/src/lj_crecord.c
@@ -1,6 +1,6 @@
/*
** Trace recorder for C data operations.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_ffrecord_c
@@ -794,7 +794,7 @@ again:
}
} else if (tref_isstr(idx)) {
GCstr *name = strV(&rd->argv[1]);
- if (cd->ctypeid == CTID_CTYPEID)
+ if (cd && cd->ctypeid == CTID_CTYPEID)
ct = ctype_raw(cts, crec_constructor(J, cd, ptr));
if (ctype_isstruct(ct->info)) {
CTSize fofs;
@@ -835,6 +835,7 @@ again:
CType *cct = ctype_rawchild(cts, ct);
if (ctype_isstruct(cct->info)) {
ct = cct;
+ cd = NULL;
if (tref_isstr(idx)) goto again;
}
}
@@ -847,8 +848,11 @@ again:
/* Resolve reference for field. */
ct = ctype_get(cts, sid);
- if (ctype_isref(ct->info))
+ if (ctype_isref(ct->info)) {
ptr = emitir(IRT(IR_XLOAD, IRT_PTR), ptr, 0);
+ sid = ctype_cid(ct->info);
+ ct = ctype_get(cts, sid);
+ }
while (ctype_isattrib(ct->info))
ct = ctype_child(cts, ct); /* Skip attributes. */
@@ -1317,7 +1321,8 @@ static TRef crec_arith_ptr(jit_State *J, TRef *sp, CType **s, MMS mm)
}
/* Record ctype arithmetic metamethods. */
-static void crec_arith_meta(jit_State *J, CTState *cts, RecordFFData *rd)
+static TRef crec_arith_meta(jit_State *J, TRef *sp, CType **s, CTState *cts,
+ RecordFFData *rd)
{
cTValue *tv = NULL;
if (J->base[0]) {
@@ -1338,13 +1343,20 @@ static void crec_arith_meta(jit_State *J, CTState *cts, RecordFFData *rd)
if (tvisfunc(tv)) {
J->base[-1] = lj_ir_kfunc(J, funcV(tv)) | TREF_FRAME;
rd->nres = -1; /* Pending tailcall. */
- return;
+ return 0;
} /* NYI: non-function metamethods. */
- } else if ((MMS)rd->data == MM_eq) {
- J->base[0] = TREF_FALSE;
- return;
+ } else if ((MMS)rd->data == MM_eq) { /* Fallback cdata pointer comparison. */
+ if (sp[0] && sp[1] && ctype_isnum(s[0]->info) == ctype_isnum(s[1]->info)) {
+ /* Assume true comparison. Fixup and emit pending guard later. */
+ lj_ir_set(J, IRTG(IR_EQ, IRT_PTR), sp[0], sp[1]);
+ J->postproc = LJ_POST_FIXGUARD;
+ return TREF_TRUE;
+ } else {
+ return TREF_FALSE;
+ }
}
lj_trace_err(J, LJ_TRERR_BADTYPE);
+ return 0;
}
void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd)
@@ -1357,7 +1369,7 @@ void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd)
TRef tr = J->base[i];
CType *ct = ctype_get(cts, CTID_DOUBLE);
if (!tr) {
- goto trymeta;
+ lj_trace_err(J, LJ_TRERR_BADTYPE);
} else if (tref_iscdata(tr)) {
CTypeID id = argv2cdata(J, tr, &rd->argv[i])->ctypeid;
IRType t;
@@ -1387,11 +1399,12 @@ void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd)
}
if (ctype_isenum(ct->info)) ct = ctype_child(cts, ct);
if (ctype_isnum(ct->info)) {
- if (t == IRT_CDATA) goto trymeta;
- if (t == IRT_I64 || t == IRT_U64) lj_needsplit(J);
- tr = emitir(IRT(IR_XLOAD, t), tr, 0);
- } else if (!(ctype_isptr(ct->info) || ctype_isrefarray(ct->info))) {
- goto trymeta;
+ if (t == IRT_CDATA) {
+ tr = 0;
+ } else {
+ if (t == IRT_I64 || t == IRT_U64) lj_needsplit(J);
+ tr = emitir(IRT(IR_XLOAD, t), tr, 0);
+ }
}
} else if (tref_isnil(tr)) {
tr = lj_ir_kptr(J, NULL);
@@ -1411,10 +1424,17 @@ void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd)
emitir(IRTG(IR_EQ, IRT_STR), tr, lj_ir_kstr(J, str));
ct = ctype_child(cts, cct);
tr = lj_ir_kint(J, (int32_t)ofs);
- } /* else: interpreter will throw. */
- } /* else: interpreter will throw. */
+ } else { /* Interpreter will throw or return false. */
+ ct = ctype_get(cts, CTID_P_VOID);
+ }
+ } else if (ctype_isptr(ct->info)) {
+ tr = emitir(IRT(IR_ADD, IRT_PTR), tr, lj_ir_kintp(J, sizeof(GCstr)));
+ } else {
+ ct = ctype_get(cts, CTID_P_VOID);
+ }
} else if (!tref_isnum(tr)) {
- goto trymeta;
+ tr = 0;
+ ct = ctype_get(cts, CTID_P_VOID);
}
ok:
s[i] = ct;
@@ -1422,22 +1442,20 @@ void LJ_FASTCALL recff_cdata_arith(jit_State *J, RecordFFData *rd)
}
{
TRef tr;
- if ((tr = crec_arith_int64(J, sp, s, (MMS)rd->data)) ||
- (tr = crec_arith_ptr(J, sp, s, (MMS)rd->data))) {
- J->base[0] = tr;
- /* Fixup cdata comparisons, too. Avoids some cdata escapes. */
- if (J->postproc == LJ_POST_FIXGUARD && frame_iscont(J->L->base-1) &&
- !irt_isguard(J->guardemit)) {
- const BCIns *pc = frame_contpc(J->L->base-1) - 1;
- if (bc_op(*pc) <= BC_ISNEP) {
- setframe_pc(&J2G(J)->tmptv, pc);
- J2G(J)->tmptv.u32.lo = ((tref_istrue(tr) ^ bc_op(*pc)) & 1);
- J->postproc = LJ_POST_FIXCOMP;
- }
+ if (!(tr = crec_arith_int64(J, sp, s, (MMS)rd->data)) &&
+ !(tr = crec_arith_ptr(J, sp, s, (MMS)rd->data)) &&
+ !(tr = crec_arith_meta(J, sp, s, cts, rd)))
+ return;
+ J->base[0] = tr;
+ /* Fixup cdata comparisons, too. Avoids some cdata escapes. */
+ if (J->postproc == LJ_POST_FIXGUARD && frame_iscont(J->L->base-1) &&
+ !irt_isguard(J->guardemit)) {
+ const BCIns *pc = frame_contpc(J->L->base-1) - 1;
+ if (bc_op(*pc) <= BC_ISNEP) {
+ setframe_pc(&J2G(J)->tmptv, pc);
+ J2G(J)->tmptv.u32.lo = ((tref_istrue(tr) ^ bc_op(*pc)) & 1);
+ J->postproc = LJ_POST_FIXCOMP;
}
- } else {
- trymeta:
- crec_arith_meta(J, cts, rd);
}
}
}
@@ -1514,7 +1532,7 @@ void LJ_FASTCALL recff_ffi_string(jit_State *J, RecordFFData *rd)
TRef tr = J->base[0];
if (tr) {
TRef trlen = J->base[1];
- if (trlen) {
+ if (!tref_isnil(trlen)) {
trlen = crec_toint(J, cts, trlen, &rd->argv[1]);
tr = crec_ct_tv(J, ctype_get(cts, CTID_P_CVOID), 0, tr, &rd->argv[0]);
} else {
diff --git a/3rdparty/lua/src/lj_crecord.h b/3rdparty/lua/src/lj_crecord.h
index dea05f7..a4628ca 100644
--- a/3rdparty/lua/src/lj_crecord.h
+++ b/3rdparty/lua/src/lj_crecord.h
@@ -1,6 +1,6 @@
/*
** Trace recorder for C data operations.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_CRECORD_H
diff --git a/3rdparty/lua/src/lj_ctype.c b/3rdparty/lua/src/lj_ctype.c
index 57a0d7c..ac30174 100644
--- a/3rdparty/lua/src/lj_ctype.c
+++ b/3rdparty/lua/src/lj_ctype.c
@@ -1,6 +1,6 @@
/*
** C type management.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#include "lj_obj.h"
diff --git a/3rdparty/lua/src/lj_ctype.h b/3rdparty/lua/src/lj_ctype.h
index c43a2ba..3df26f0 100644
--- a/3rdparty/lua/src/lj_ctype.h
+++ b/3rdparty/lua/src/lj_ctype.h
@@ -1,6 +1,6 @@
/*
** C type management.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_CTYPE_H
diff --git a/3rdparty/lua/src/lj_debug.c b/3rdparty/lua/src/lj_debug.c
index be7fb2b..bd2fa1f 100644
--- a/3rdparty/lua/src/lj_debug.c
+++ b/3rdparty/lua/src/lj_debug.c
@@ -1,6 +1,6 @@
/*
** Debugging and introspection.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_debug_c
@@ -14,6 +14,7 @@
#include "lj_state.h"
#include "lj_frame.h"
#include "lj_bc.h"
+#include "lj_vm.h"
#if LJ_HASJIT
#include "lj_jit.h"
#endif
@@ -71,19 +72,27 @@ static BCPos debug_framepc(lua_State *L, GCfunc *fn, cTValue *nextframe)
/* Lua function below errfunc/gc/hook: find cframe to get the PC. */
void *cf = cframe_raw(L->cframe);
TValue *f = L->base-1;
- if (cf == NULL)
- return NO_BCPOS;
- while (f > nextframe) {
+ for (;;) {
+ if (cf == NULL)
+ return NO_BCPOS;
+ while (cframe_nres(cf) < 0) {
+ if (f >= restorestack(L, -cframe_nres(cf)))
+ break;
+ cf = cframe_raw(cframe_prev(cf));
+ if (cf == NULL)
+ return NO_BCPOS;
+ }
+ if (f < nextframe)
+ break;
if (frame_islua(f)) {
f = frame_prevl(f);
} else {
- if (frame_isc(f))
+ if (frame_isc(f) || (LJ_HASFFI && frame_iscont(f) &&
+ (f-1)->u32.lo == LJ_CONT_FFI_CALLBACK))
cf = cframe_raw(cframe_prev(cf));
f = frame_prevd(f);
}
}
- if (cframe_prev(cf))
- cf = cframe_raw(cframe_prev(cf));
ins = cframe_pc(cf);
}
}
@@ -456,7 +465,7 @@ int lj_debug_getinfo(lua_State *L, const char *what, lj_Debug *ar, int ext)
lj_debug_shortname(ar->short_src, name);
ar->linedefined = (int)firstline;
ar->lastlinedefined = (int)(firstline + pt->numline);
- ar->what = firstline ? "Lua" : "main";
+ ar->what = (firstline || !pt->numline) ? "Lua" : "main";
} else {
ar->source = "=[C]";
ar->short_src[0] = '[';
diff --git a/3rdparty/lua/src/lj_debug.h b/3rdparty/lua/src/lj_debug.h
index 7cf57de..fa8988c 100644
--- a/3rdparty/lua/src/lj_debug.h
+++ b/3rdparty/lua/src/lj_debug.h
@@ -1,6 +1,6 @@
/*
** Debugging and introspection.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_DEBUG_H
diff --git a/3rdparty/lua/src/lj_def.h b/3rdparty/lua/src/lj_def.h
index 250729f..e666c9e 100644
--- a/3rdparty/lua/src/lj_def.h
+++ b/3rdparty/lua/src/lj_def.h
@@ -1,6 +1,6 @@
/*
** LuaJIT common internal definitions.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_DEF_H
@@ -111,7 +111,7 @@ typedef uintptr_t BloomFilter;
#define bloomset(b, x) ((b) |= bloombit((x)))
#define bloomtest(b, x) ((b) & bloombit((x)))
-#if defined(__GNUC__)
+#if defined(__GNUC__) || defined(__psp2__)
#define LJ_NORET __attribute__((noreturn))
#define LJ_ALIGN(n) __attribute__((aligned(n)))
@@ -119,7 +119,7 @@ typedef uintptr_t BloomFilter;
#define LJ_AINLINE inline __attribute__((always_inline))
#define LJ_NOINLINE __attribute__((noinline))
-#if defined(__ELF__) || defined(__MACH__)
+#if defined(__ELF__) || defined(__MACH__) || defined(__psp2__)
#if !((defined(__sun__) && defined(__svr4__)) || defined(__CELLOS_LV2__))
#define LJ_NOAPI extern __attribute__((visibility("hidden")))
#endif
@@ -150,6 +150,9 @@ static LJ_AINLINE uint32_t lj_fls(uint32_t x)
#if defined(__arm__)
static LJ_AINLINE uint32_t lj_bswap(uint32_t x)
{
+#if defined(__psp2__)
+ return __builtin_rev(x);
+#else
uint32_t r;
#if __ARM_ARCH_6__ || __ARM_ARCH_6J__ || __ARM_ARCH_6T2__ || __ARM_ARCH_6Z__ ||\
__ARM_ARCH_6ZK__ || __ARM_ARCH_7__ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__
@@ -163,6 +166,7 @@ static LJ_AINLINE uint32_t lj_bswap(uint32_t x)
#endif
return ((r & 0xff00ffffu) >> 8) ^ lj_ror(x, 8);
#endif
+#endif
}
static LJ_AINLINE uint64_t lj_bswap64(uint64_t x)
diff --git a/3rdparty/lua/src/lj_dispatch.c b/3rdparty/lua/src/lj_dispatch.c
index d57f1a6..3725657 100644
--- a/3rdparty/lua/src/lj_dispatch.c
+++ b/3rdparty/lua/src/lj_dispatch.c
@@ -1,6 +1,6 @@
/*
** Instruction dispatch handling.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_dispatch_c
diff --git a/3rdparty/lua/src/lj_dispatch.h b/3rdparty/lua/src/lj_dispatch.h
index a56b626..778affc 100644
--- a/3rdparty/lua/src/lj_dispatch.h
+++ b/3rdparty/lua/src/lj_dispatch.h
@@ -1,6 +1,6 @@
/*
** Instruction dispatch handling.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_DISPATCH_H
diff --git a/3rdparty/lua/src/lj_emit_arm.h b/3rdparty/lua/src/lj_emit_arm.h
index b76a9a4..8c5e537 100644
--- a/3rdparty/lua/src/lj_emit_arm.h
+++ b/3rdparty/lua/src/lj_emit_arm.h
@@ -1,6 +1,6 @@
/*
** ARM instruction emitter.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
/* -- Constant encoding --------------------------------------------------- */
diff --git a/3rdparty/lua/src/lj_emit_mips.h b/3rdparty/lua/src/lj_emit_mips.h
index 74821b8..0fc07d9 100644
--- a/3rdparty/lua/src/lj_emit_mips.h
+++ b/3rdparty/lua/src/lj_emit_mips.h
@@ -1,6 +1,6 @@
/*
** MIPS instruction emitter.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
/* -- Emit basic instructions --------------------------------------------- */
diff --git a/3rdparty/lua/src/lj_emit_ppc.h b/3rdparty/lua/src/lj_emit_ppc.h
index a589f3a..14edf00 100644
--- a/3rdparty/lua/src/lj_emit_ppc.h
+++ b/3rdparty/lua/src/lj_emit_ppc.h
@@ -1,6 +1,6 @@
/*
** PPC instruction emitter.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
/* -- Emit basic instructions --------------------------------------------- */
diff --git a/3rdparty/lua/src/lj_emit_x86.h b/3rdparty/lua/src/lj_emit_x86.h
index bd184a3..3a2f651 100644
--- a/3rdparty/lua/src/lj_emit_x86.h
+++ b/3rdparty/lua/src/lj_emit_x86.h
@@ -1,6 +1,6 @@
/*
** x86/x64 instruction emitter.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
/* -- Emit basic instructions --------------------------------------------- */
diff --git a/3rdparty/lua/src/lj_err.c b/3rdparty/lua/src/lj_err.c
index 42cd12b..081bfde 100644
--- a/3rdparty/lua/src/lj_err.c
+++ b/3rdparty/lua/src/lj_err.c
@@ -1,6 +1,6 @@
/*
** Error handling.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_err_c
@@ -196,7 +196,7 @@ static void *err_unwind(lua_State *L, void *stopcf, int errcode)
typedef struct _Unwind_Exception
{
uint64_t exclass;
- void (*excleanup)(int, struct _Unwind_Exception);
+ void (*excleanup)(int, struct _Unwind_Exception *);
uintptr_t p1, p2;
} __attribute__((__aligned__)) _Unwind_Exception;
@@ -378,7 +378,7 @@ typedef struct UndocumentedDispatcherContext {
ULONG64 EstablisherFrame;
ULONG64 TargetIp;
PCONTEXT ContextRecord;
- PEXCEPTION_ROUTINE LanguageHandler;
+ void (*LanguageHandler)(void);
PVOID HandlerData;
PUNWIND_HISTORY_TABLE HistoryTable;
ULONG ScopeIndex;
@@ -499,8 +499,7 @@ static ptrdiff_t finderrfunc(lua_State *L)
{
cTValue *frame = L->base-1, *bot = tvref(L->stack);
void *cf = L->cframe;
- while (frame > bot) {
- lua_assert(cf != NULL);
+ while (frame > bot && cf) {
while (cframe_nres(cframe_raw(cf)) < 0) { /* cframe without frame? */
if (frame >= restorestack(L, -cframe_nres(cf)))
break;
@@ -518,12 +517,14 @@ static ptrdiff_t finderrfunc(lua_State *L)
case FRAME_C:
cf = cframe_prev(cf);
/* fallthrough */
+ case FRAME_VARG:
+ frame = frame_prevd(frame);
+ break;
case FRAME_CONT:
#if LJ_HASFFI
if ((frame-1)->u32.lo == LJ_CONT_FFI_CALLBACK)
cf = cframe_prev(cf);
#endif
- case FRAME_VARG:
frame = frame_prevd(frame);
break;
case FRAME_CP:
@@ -725,9 +726,23 @@ LJ_NOINLINE void lj_err_arg(lua_State *L, int narg, ErrMsg em)
/* Typecheck error for arguments. */
LJ_NOINLINE void lj_err_argtype(lua_State *L, int narg, const char *xname)
{
- TValue *o = narg < 0 ? L->top + narg : L->base + narg-1;
- const char *tname = o < L->top ? lj_typename(o) : lj_obj_typename[0];
- const char *msg = lj_str_pushf(L, err2msg(LJ_ERR_BADTYPE), xname, tname);
+ const char *tname, *msg;
+ if (narg <= LUA_REGISTRYINDEX) {
+ if (narg >= LUA_GLOBALSINDEX) {
+ tname = lj_obj_itypename[~LJ_TTAB];
+ } else {
+ GCfunc *fn = curr_func(L);
+ int idx = LUA_GLOBALSINDEX - narg;
+ if (idx <= fn->c.nupvalues)
+ tname = lj_typename(&fn->c.upvalue[idx-1]);
+ else
+ tname = lj_obj_typename[0];
+ }
+ } else {
+ TValue *o = narg < 0 ? L->top + narg : L->base + narg-1;
+ tname = o < L->top ? lj_typename(o) : lj_obj_typename[0];
+ }
+ msg = lj_str_pushf(L, err2msg(LJ_ERR_BADTYPE), xname, tname);
err_argmsg(L, narg, msg);
}
diff --git a/3rdparty/lua/src/lj_err.h b/3rdparty/lua/src/lj_err.h
index dbea409..03a56f0 100644
--- a/3rdparty/lua/src/lj_err.h
+++ b/3rdparty/lua/src/lj_err.h
@@ -1,6 +1,6 @@
/*
** Error handling.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_ERR_H
diff --git a/3rdparty/lua/src/lj_errmsg.h b/3rdparty/lua/src/lj_errmsg.h
index fd46acd..1c94876 100644
--- a/3rdparty/lua/src/lj_errmsg.h
+++ b/3rdparty/lua/src/lj_errmsg.h
@@ -1,6 +1,6 @@
/*
** VM error messages.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
/* This file may be included multiple times with different ERRDEF macros. */
@@ -102,6 +102,7 @@ ERRDEF(STRFMTW, "invalid format (width or precision too long)")
ERRDEF(STRGSRV, "invalid replacement value (a %s)")
ERRDEF(BADMODN, "name conflict for module " LUA_QS)
#if LJ_HASJIT
+ERRDEF(JITPROT, "runtime code generation failed, restricted kernel?")
#if LJ_TARGET_X86ORX64
ERRDEF(NOJIT, "JIT compiler disabled, CPU does not support SSE2")
#else
diff --git a/3rdparty/lua/src/lj_ff.h b/3rdparty/lua/src/lj_ff.h
index b4a4301..73dad96 100644
--- a/3rdparty/lua/src/lj_ff.h
+++ b/3rdparty/lua/src/lj_ff.h
@@ -1,6 +1,6 @@
/*
** Fast function IDs.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_FF_H
diff --git a/3rdparty/lua/src/lj_ffrecord.c b/3rdparty/lua/src/lj_ffrecord.c
index 35e2e88..69f71ab 100644
--- a/3rdparty/lua/src/lj_ffrecord.c
+++ b/3rdparty/lua/src/lj_ffrecord.c
@@ -1,6 +1,6 @@
/*
** Fast function call recorder.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_ffrecord_c
@@ -657,20 +657,19 @@ static void LJ_FASTCALL recff_string_range(jit_State *J, RecordFFData *rd)
end = argv2int(J, &rd->argv[2]);
}
} else { /* string.byte(str, [,start [,end]]) */
- if (!tref_isnil(J->base[1])) {
+ if (tref_isnil(J->base[1])) {
+ start = 1;
+ trstart = lj_ir_kint(J, 1);
+ } else {
start = argv2int(J, &rd->argv[1]);
trstart = lj_opt_narrow_toint(J, J->base[1]);
- trend = J->base[2];
- if (tref_isnil(trend)) {
- trend = trstart;
- end = start;
- } else {
- trend = lj_opt_narrow_toint(J, trend);
- end = argv2int(J, &rd->argv[2]);
- }
+ }
+ if (J->base[1] && !tref_isnil(J->base[2])) {
+ trend = lj_opt_narrow_toint(J, J->base[2]);
+ end = argv2int(J, &rd->argv[2]);
} else {
- trend = trstart = lj_ir_kint(J, 1);
- end = start = 1;
+ trend = trstart;
+ end = start;
}
}
if (end < 0) {
diff --git a/3rdparty/lua/src/lj_ffrecord.h b/3rdparty/lua/src/lj_ffrecord.h
index 9a30f35..f858ca2 100644
--- a/3rdparty/lua/src/lj_ffrecord.h
+++ b/3rdparty/lua/src/lj_ffrecord.h
@@ -1,6 +1,6 @@
/*
** Fast function call recorder.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_FFRECORD_H
diff --git a/3rdparty/lua/src/lj_frame.h b/3rdparty/lua/src/lj_frame.h
index 60ce1a9..cd57be2 100644
--- a/3rdparty/lua/src/lj_frame.h
+++ b/3rdparty/lua/src/lj_frame.h
@@ -1,6 +1,6 @@
/*
** Stack frames.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_FRAME_H
diff --git a/3rdparty/lua/src/lj_func.c b/3rdparty/lua/src/lj_func.c
index 83f2d0b..eb8a9db 100644
--- a/3rdparty/lua/src/lj_func.c
+++ b/3rdparty/lua/src/lj_func.c
@@ -1,6 +1,6 @@
/*
** Function handling (prototypes, functions and upvalues).
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
**
** Portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
diff --git a/3rdparty/lua/src/lj_func.h b/3rdparty/lua/src/lj_func.h
index 73280a8..a6e534e 100644
--- a/3rdparty/lua/src/lj_func.h
+++ b/3rdparty/lua/src/lj_func.h
@@ -1,6 +1,6 @@
/*
** Function handling (prototypes, functions and upvalues).
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_FUNC_H
diff --git a/3rdparty/lua/src/lj_gc.c b/3rdparty/lua/src/lj_gc.c
index 79f8b72..b498aba 100644
--- a/3rdparty/lua/src/lj_gc.c
+++ b/3rdparty/lua/src/lj_gc.c
@@ -1,6 +1,6 @@
/*
** Garbage collector.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
**
** Major portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
@@ -501,6 +501,7 @@ static void gc_finalize(lua_State *L)
setcdataV(L, &tmp, gco2cd(o));
tv = lj_tab_set(L, ctype_ctsG(g)->finalizer, &tmp);
if (!tvisnil(tv)) {
+ g->gc.nocdatafin = 0;
copyTV(L, &tmp, tv);
setnilV(tv); /* Clear entry in finalizer table. */
gc_call_finalizer(g, L, &tmp, o);
@@ -630,17 +631,20 @@ static size_t gc_onestep(lua_State *L)
case GCSsweep: {
MSize old = g->gc.total;
setmref(g->gc.sweep, gc_sweep(g, mref(g->gc.sweep, GCRef), GCSWEEPMAX));
+ lua_assert(old >= g->gc.total);
+ g->gc.estimate -= old - g->gc.total;
if (gcref(*mref(g->gc.sweep, GCRef)) == NULL) {
gc_shrink(g, L);
if (gcref(g->gc.mmudata)) { /* Need any finalizations? */
g->gc.state = GCSfinalize;
+#if LJ_HASFFI
+ g->gc.nocdatafin = 1;
+#endif
} else { /* Otherwise skip this phase to help the JIT. */
g->gc.state = GCSpause; /* End of GC cycle. */
g->gc.debt = 0;
}
}
- lua_assert(old >= g->gc.total);
- g->gc.estimate -= old - g->gc.total;
return GCSWEEPMAX*GCSWEEPCOST;
}
case GCSfinalize:
@@ -652,6 +656,9 @@ static size_t gc_onestep(lua_State *L)
g->gc.estimate -= GCFINALIZECOST;
return GCFINALIZECOST;
}
+#if LJ_HASFFI
+ if (!g->gc.nocdatafin) lj_tab_rehash(L, ctype_ctsG(g)->finalizer);
+#endif
g->gc.state = GCSpause; /* End of GC cycle. */
g->gc.debt = 0;
return 0;
@@ -671,7 +678,8 @@ int LJ_FASTCALL lj_gc_step(lua_State *L)
lim = (GCSTEPSIZE/100) * g->gc.stepmul;
if (lim == 0)
lim = LJ_MAX_MEM;
- g->gc.debt += g->gc.total - g->gc.threshold;
+ if (g->gc.total > g->gc.threshold)
+ g->gc.debt += g->gc.total - g->gc.threshold;
do {
lim -= (MSize)gc_onestep(L);
if (g->gc.state == GCSpause) {
@@ -682,12 +690,14 @@ int LJ_FASTCALL lj_gc_step(lua_State *L)
} while ((int32_t)lim > 0);
if (g->gc.debt < GCSTEPSIZE) {
g->gc.threshold = g->gc.total + GCSTEPSIZE;
+ g->vmstate = ostate;
+ return -1;
} else {
g->gc.debt -= GCSTEPSIZE;
g->gc.threshold = g->gc.total;
+ g->vmstate = ostate;
+ return 0;
}
- g->vmstate = ostate;
- return 0;
}
/* Ditto, but fix the stack top first. */
diff --git a/3rdparty/lua/src/lj_gc.h b/3rdparty/lua/src/lj_gc.h
index 22f7fea..ba061bc 100644
--- a/3rdparty/lua/src/lj_gc.h
+++ b/3rdparty/lua/src/lj_gc.h
@@ -1,6 +1,6 @@
/*
** Garbage collector.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_GC_H
diff --git a/3rdparty/lua/src/lj_gdbjit.c b/3rdparty/lua/src/lj_gdbjit.c
index 284195a..d3f3e61 100644
--- a/3rdparty/lua/src/lj_gdbjit.c
+++ b/3rdparty/lua/src/lj_gdbjit.c
@@ -1,6 +1,6 @@
/*
** Client for the GDB JIT API.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_gdbjit_c
@@ -356,6 +356,8 @@ static const ELFheader elfhdr_template = {
.eosabi = 2,
#elif defined(__OpenBSD__)
.eosabi = 12,
+#elif defined(__DragonFly__)
+ .eosabi = 0,
#elif (defined(__sun__) && defined(__svr4__))
.eosabi = 6,
#else
diff --git a/3rdparty/lua/src/lj_gdbjit.h b/3rdparty/lua/src/lj_gdbjit.h
index 481cb22..49c5863 100644
--- a/3rdparty/lua/src/lj_gdbjit.h
+++ b/3rdparty/lua/src/lj_gdbjit.h
@@ -1,6 +1,6 @@
/*
** Client for the GDB JIT API.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_GDBJIT_H
diff --git a/3rdparty/lua/src/lj_ir.c b/3rdparty/lua/src/lj_ir.c
index e1a5910..439f3fc 100644
--- a/3rdparty/lua/src/lj_ir.c
+++ b/3rdparty/lua/src/lj_ir.c
@@ -1,6 +1,6 @@
/*
** SSA IR (Intermediate Representation) emitter.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_ir_c
diff --git a/3rdparty/lua/src/lj_ir.h b/3rdparty/lua/src/lj_ir.h
index a982432..8126482 100644
--- a/3rdparty/lua/src/lj_ir.h
+++ b/3rdparty/lua/src/lj_ir.h
@@ -1,6 +1,6 @@
/*
** SSA IR (Intermediate Representation) format.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_IR_H
diff --git a/3rdparty/lua/src/lj_ircall.h b/3rdparty/lua/src/lj_ircall.h
index 7fcc532..893dac2 100644
--- a/3rdparty/lua/src/lj_ircall.h
+++ b/3rdparty/lua/src/lj_ircall.h
@@ -1,6 +1,6 @@
/*
** IR CALL* instruction definitions.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_IRCALL_H
@@ -86,6 +86,12 @@ typedef struct CCallInfo {
#define IRCALLCOND_FFI32(x) NULL
#endif
+#if LJ_TARGET_X86
+#define CCI_RANDFPR 0 /* Clang on OSX/x86 is overzealous. */
+#else
+#define CCI_RANDFPR CCI_NOFPRCLOBBER
+#endif
+
#if LJ_SOFTFP
#define ARG1_FP 2 /* Treat as 2 32 bit arguments. */
#else
@@ -112,7 +118,7 @@ typedef struct CCallInfo {
_(ANY, lj_gc_step_jit, 2, FS, NIL, CCI_L) \
_(ANY, lj_gc_barrieruv, 2, FS, NIL, 0) \
_(ANY, lj_mem_newgco, 2, FS, P32, CCI_L) \
- _(ANY, lj_math_random_step, 1, FS, NUM, CCI_CASTU64|CCI_NOFPRCLOBBER) \
+ _(ANY, lj_math_random_step, 1, FS, NUM, CCI_CASTU64|CCI_RANDFPR)\
_(ANY, lj_vm_modi, 2, FN, INT, 0) \
_(ANY, sinh, ARG1_FP, N, NUM, 0) \
_(ANY, cosh, ARG1_FP, N, NUM, 0) \
diff --git a/3rdparty/lua/src/lj_iropt.h b/3rdparty/lua/src/lj_iropt.h
index a74f018..4e424e7 100644
--- a/3rdparty/lua/src/lj_iropt.h
+++ b/3rdparty/lua/src/lj_iropt.h
@@ -1,6 +1,6 @@
/*
** Common header for IR emitter and optimizations.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_IROPT_H
diff --git a/3rdparty/lua/src/lj_jit.h b/3rdparty/lua/src/lj_jit.h
index c0b1c41..eb76547 100644
--- a/3rdparty/lua/src/lj_jit.h
+++ b/3rdparty/lua/src/lj_jit.h
@@ -1,6 +1,6 @@
/*
** Common definitions for the JIT compiler.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_JIT_H
@@ -279,6 +279,7 @@ typedef struct BPropEntry {
/* Scalar evolution analysis cache. */
typedef struct ScEvEntry {
+ MRef pc; /* Bytecode PC of FORI. */
IRRef1 idx; /* Index reference. */
IRRef1 start; /* Constant start reference. */
IRRef1 stop; /* Constant stop reference. */
diff --git a/3rdparty/lua/src/lj_lex.c b/3rdparty/lua/src/lj_lex.c
index 9f2b06f..e1dc3cd 100644
--- a/3rdparty/lua/src/lj_lex.c
+++ b/3rdparty/lua/src/lj_lex.c
@@ -1,6 +1,6 @@
/*
** Lexical analyzer.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
**
** Major portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
@@ -378,6 +378,7 @@ int lj_lex_setup(lua_State *L, LexState *ls)
ls->vtop = 0;
ls->bcstack = NULL;
ls->sizebcstack = 0;
+ ls->token = 0;
ls->lookahead = TK_eof; /* No look-ahead token. */
ls->linenumber = 1;
ls->lastline = 1;
diff --git a/3rdparty/lua/src/lj_lex.h b/3rdparty/lua/src/lj_lex.h
index 6e18e4b..fe01768 100644
--- a/3rdparty/lua/src/lj_lex.h
+++ b/3rdparty/lua/src/lj_lex.h
@@ -1,6 +1,6 @@
/*
** Lexical analyzer.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_LEX_H
diff --git a/3rdparty/lua/src/lj_lib.c b/3rdparty/lua/src/lj_lib.c
index 331eaa6..856685e 100644
--- a/3rdparty/lua/src/lj_lib.c
+++ b/3rdparty/lua/src/lj_lib.c
@@ -1,6 +1,6 @@
/*
** Library function support.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_lib_c
diff --git a/3rdparty/lua/src/lj_lib.h b/3rdparty/lua/src/lj_lib.h
index 2fe6d2a..9320f34 100644
--- a/3rdparty/lua/src/lj_lib.h
+++ b/3rdparty/lua/src/lj_lib.h
@@ -1,6 +1,6 @@
/*
** Library function support.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_LIB_H
diff --git a/3rdparty/lua/src/lj_load.c b/3rdparty/lua/src/lj_load.c
index 9d89267..ff7b851 100644
--- a/3rdparty/lua/src/lj_load.c
+++ b/3rdparty/lua/src/lj_load.c
@@ -1,6 +1,6 @@
/*
** Load and dump code.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#include <errno.h>
diff --git a/3rdparty/lua/src/lj_mcode.c b/3rdparty/lua/src/lj_mcode.c
index cb79e8c..d95ebeb 100644
--- a/3rdparty/lua/src/lj_mcode.c
+++ b/3rdparty/lua/src/lj_mcode.c
@@ -1,6 +1,6 @@
/*
** Machine code management.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_mcode_c
@@ -9,6 +9,7 @@
#include "lj_obj.h"
#if LJ_HASJIT
#include "lj_gc.h"
+#include "lj_err.h"
#include "lj_jit.h"
#include "lj_mcode.h"
#include "lj_trace.h"
@@ -78,10 +79,10 @@ static void mcode_free(jit_State *J, void *p, size_t sz)
VirtualFree(p, 0, MEM_RELEASE);
}
-static void mcode_setprot(void *p, size_t sz, DWORD prot)
+static int mcode_setprot(void *p, size_t sz, DWORD prot)
{
DWORD oprot;
- VirtualProtect(p, sz, prot, &oprot);
+ return !VirtualProtect(p, sz, prot, &oprot);
}
#elif LJ_TARGET_POSIX
@@ -112,9 +113,9 @@ static void mcode_free(jit_State *J, void *p, size_t sz)
munmap(p, sz);
}
-static void mcode_setprot(void *p, size_t sz, int prot)
+static int mcode_setprot(void *p, size_t sz, int prot)
{
- mprotect(p, sz, prot);
+ return mprotect(p, sz, prot);
}
#elif LJ_64
@@ -140,13 +141,11 @@ static void mcode_free(jit_State *J, void *p, size_t sz)
lj_mem_free(J2G(J), p, sz);
}
-#define mcode_setprot(p, sz, prot) UNUSED(p)
-
#endif
/* -- MCode area protection ----------------------------------------------- */
-/* Define this ONLY if the page protection twiddling becomes a bottleneck. */
+/* Define this ONLY if page protection twiddling becomes a bottleneck. */
#ifdef LUAJIT_UNPROTECT_MCODE
/* It's generally considered to be a potential security risk to have
@@ -180,11 +179,23 @@ static void mcode_protect(jit_State *J, int prot)
#define MCPROT_GEN MCPROT_RW
#define MCPROT_RUN MCPROT_RX
+/* Protection twiddling failed. Probably due to kernel security. */
+static LJ_NOINLINE void mcode_protfail(jit_State *J)
+{
+ lua_CFunction panic = J2G(J)->panic;
+ if (panic) {
+ lua_State *L = J->L;
+ setstrV(L, L->top++, lj_err_str(L, LJ_ERR_JITPROT));
+ panic(L);
+ }
+}
+
/* Change protection of MCode area. */
static void mcode_protect(jit_State *J, int prot)
{
if (J->mcprot != prot) {
- mcode_setprot(J->mcarea, J->szmcarea, prot);
+ if (LJ_UNLIKELY(mcode_setprot(J->mcarea, J->szmcarea, prot)))
+ mcode_protfail(J);
J->mcprot = prot;
}
}
@@ -241,7 +252,20 @@ static void *mcode_alloc(jit_State *J, size_t sz)
#else
/* All memory addresses are reachable by relative jumps. */
-#define mcode_alloc(J, sz) mcode_alloc_at((J), 0, (sz), MCPROT_GEN)
+static void *mcode_alloc(jit_State *J, size_t sz)
+{
+#ifdef __OpenBSD__
+ /* Allow better executable memory allocation for OpenBSD W^X mode. */
+ void *p = mcode_alloc_at(J, 0, sz, MCPROT_RUN);
+ if (p && mcode_setprot(p, sz, MCPROT_GEN)) {
+ mcode_free(J, p, sz);
+ return NULL;
+ }
+ return p;
+#else
+ return mcode_alloc_at(J, 0, sz, MCPROT_GEN);
+#endif
+}
#endif
@@ -305,7 +329,8 @@ void lj_mcode_commit(jit_State *J, MCode *top)
/* Abort the reservation. */
void lj_mcode_abort(jit_State *J)
{
- mcode_protect(J, MCPROT_RUN);
+ if (J->mcarea)
+ mcode_protect(J, MCPROT_RUN);
}
/* Set/reset protection to allow patching of MCode areas. */
@@ -318,8 +343,8 @@ MCode *lj_mcode_patch(jit_State *J, MCode *ptr, int finish)
if (finish) {
if (J->mcarea == ptr)
mcode_protect(J, MCPROT_RUN);
- else
- mcode_setprot(ptr, ((MCLink *)ptr)->size, MCPROT_RUN);
+ else if (LJ_UNLIKELY(mcode_setprot(ptr, ((MCLink *)ptr)->size, MCPROT_RUN)))
+ mcode_protfail(J);
return NULL;
} else {
MCode *mc = J->mcarea;
@@ -333,7 +358,8 @@ MCode *lj_mcode_patch(jit_State *J, MCode *ptr, int finish)
mc = ((MCLink *)mc)->next;
lua_assert(mc != NULL);
if (ptr >= mc && ptr < (MCode *)((char *)mc + ((MCLink *)mc)->size)) {
- mcode_setprot(mc, ((MCLink *)mc)->size, MCPROT_GEN);
+ if (LJ_UNLIKELY(mcode_setprot(mc, ((MCLink *)mc)->size, MCPROT_GEN)))
+ mcode_protfail(J);
return mc;
}
}
diff --git a/3rdparty/lua/src/lj_mcode.h b/3rdparty/lua/src/lj_mcode.h
index 2ba371b..ee60452 100644
--- a/3rdparty/lua/src/lj_mcode.h
+++ b/3rdparty/lua/src/lj_mcode.h
@@ -1,6 +1,6 @@
/*
** Machine code management.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_MCODE_H
diff --git a/3rdparty/lua/src/lj_meta.c b/3rdparty/lua/src/lj_meta.c
index 441d571..faaaf70 100644
--- a/3rdparty/lua/src/lj_meta.c
+++ b/3rdparty/lua/src/lj_meta.c
@@ -1,6 +1,6 @@
/*
** Metamethod handling.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
**
** Portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
diff --git a/3rdparty/lua/src/lj_meta.h b/3rdparty/lua/src/lj_meta.h
index 6af5e51..2c1ad0d 100644
--- a/3rdparty/lua/src/lj_meta.h
+++ b/3rdparty/lua/src/lj_meta.h
@@ -1,6 +1,6 @@
/*
** Metamethod handling.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_META_H
diff --git a/3rdparty/lua/src/lj_obj.c b/3rdparty/lua/src/lj_obj.c
index 322b7be..7fab714 100644
--- a/3rdparty/lua/src/lj_obj.c
+++ b/3rdparty/lua/src/lj_obj.c
@@ -1,6 +1,6 @@
/*
** Miscellaneous object handling.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_obj_c
diff --git a/3rdparty/lua/src/lj_obj.h b/3rdparty/lua/src/lj_obj.h
index b967819..6e8381c 100644
--- a/3rdparty/lua/src/lj_obj.h
+++ b/3rdparty/lua/src/lj_obj.h
@@ -1,6 +1,6 @@
/*
** LuaJIT VM tags, values and objects.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
**
** Portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
@@ -493,7 +493,7 @@ typedef struct GCState {
MSize threshold; /* Memory threshold. */
uint8_t currentwhite; /* Current white color. */
uint8_t state; /* GC state. */
- uint8_t unused1;
+ uint8_t nocdatafin; /* No cdata finalizer called. */
uint8_t unused2;
MSize sweepstr; /* Sweep position in string table. */
GCRef root; /* List of all collectable objects. */
diff --git a/3rdparty/lua/src/lj_opt_dce.c b/3rdparty/lua/src/lj_opt_dce.c
index d64cca7..7f1faaf 100644
--- a/3rdparty/lua/src/lj_opt_dce.c
+++ b/3rdparty/lua/src/lj_opt_dce.c
@@ -1,6 +1,6 @@
/*
** DCE: Dead Code Elimination. Pre-LOOP only -- ASM already performs DCE.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_opt_dce_c
@@ -69,6 +69,7 @@ void lj_opt_dce(jit_State *J)
if ((J->flags & JIT_F_OPT_DCE)) {
dce_marksnap(J);
dce_propagate(J);
+ memset(J->bpropcache, 0, sizeof(J->bpropcache)); /* Invalidate cache. */
}
}
diff --git a/3rdparty/lua/src/lj_opt_fold.c b/3rdparty/lua/src/lj_opt_fold.c
index fe37b98..d00fdd5 100644
--- a/3rdparty/lua/src/lj_opt_fold.c
+++ b/3rdparty/lua/src/lj_opt_fold.c
@@ -2,7 +2,7 @@
** FOLD: Constant Folding, Algebraic Simplifications and Reassociation.
** ABCelim: Array Bounds Check Elimination.
** CSE: Common-Subexpression Elimination.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_opt_fold_c
@@ -505,13 +505,14 @@ LJFOLDF(kfold_strref_snew)
} else {
/* Reassociate: strref(snew(strref(str, a), len), b) ==> strref(str, a+b) */
IRIns *ir = IR(fleft->op1);
- IRRef1 str = ir->op1; /* IRIns * is not valid across emitir. */
- lua_assert(ir->o == IR_STRREF);
- PHIBARRIER(ir);
- fins->op2 = emitir(IRTI(IR_ADD), ir->op2, fins->op2); /* Clobbers fins! */
- fins->op1 = str;
- fins->ot = IRT(IR_STRREF, IRT_P32);
- return RETRYFOLD;
+ if (ir->o == IR_STRREF) {
+ IRRef1 str = ir->op1; /* IRIns * is not valid across emitir. */
+ PHIBARRIER(ir);
+ fins->op2 = emitir(IRTI(IR_ADD), ir->op2, fins->op2); /* Clobbers fins! */
+ fins->op1 = str;
+ fins->ot = IRT(IR_STRREF, IRT_P32);
+ return RETRYFOLD;
+ }
}
return NEXTFOLD;
}
@@ -1005,11 +1006,16 @@ LJFOLDF(simplify_conv_flt_num)
LJFOLD(TOBIT CONV KNUM)
LJFOLDF(simplify_tobit_conv)
{
- if ((fleft->op2 & IRCONV_SRCMASK) == IRT_INT ||
- (fleft->op2 & IRCONV_SRCMASK) == IRT_U32) {
- /* Fold even across PHI to avoid expensive num->int conversions in loop. */
+ /* Fold even across PHI to avoid expensive num->int conversions in loop. */
+ if ((fleft->op2 & IRCONV_SRCMASK) == IRT_INT) {
lua_assert(irt_isnum(fleft->t));
return fleft->op1;
+ } else if ((fleft->op2 & IRCONV_SRCMASK) == IRT_U32) {
+ lua_assert(irt_isnum(fleft->t));
+ fins->o = IR_CONV;
+ fins->op1 = fleft->op1;
+ fins->op2 = (IRT_INT<<5)|IRT_U32;
+ return RETRYFOLD;
}
return NEXTFOLD;
}
@@ -1699,7 +1705,9 @@ LJFOLDF(abc_k)
LJFOLD(ABC any any)
LJFOLDF(abc_invar)
{
- if (!irt_isint(fins->t) && J->chain[IR_LOOP]) /* Currently marked as PTR. */
+ /* Invariant ABC marked as PTR. Drop if op1 is invariant, too. */
+ if (!irt_isint(fins->t) && fins->op1 < J->chain[IR_LOOP] &&
+ !irt_isphi(IR(fins->op1)->t))
return DROPFOLD;
return NEXTFOLD;
}
@@ -1823,7 +1831,8 @@ LJFOLDF(merge_eqne_snew_kgc)
if (len <= FOLD_SNEW_MAX_LEN) {
IROp op = (IROp)fins->o;
IRRef strref = fleft->op1;
- lua_assert(IR(strref)->o == IR_STRREF);
+ if (IR(strref)->o != IR_STRREF)
+ return NEXTFOLD;
if (op == IR_EQ) {
emitir(IRTGI(IR_EQ), fleft->op2, lj_ir_kint(J, len));
/* Caveat: fins/fleft/fright is no longer valid after emitir. */
diff --git a/3rdparty/lua/src/lj_opt_loop.c b/3rdparty/lua/src/lj_opt_loop.c
index 3a119f4..b7d1923 100644
--- a/3rdparty/lua/src/lj_opt_loop.c
+++ b/3rdparty/lua/src/lj_opt_loop.c
@@ -1,6 +1,6 @@
/*
** LOOP: Loop Optimizations.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_opt_loop_c
@@ -105,20 +105,24 @@ static void loop_emit_phi(jit_State *J, IRRef1 *subst, IRRef1 *phi, IRRef nphi,
SnapNo onsnap)
{
int passx = 0;
- IRRef i, nslots;
+ IRRef i, j, nslots;
IRRef invar = J->chain[IR_LOOP];
/* Pass #1: mark redundant and potentially redundant PHIs. */
- for (i = 0; i < nphi; i++) {
+ for (i = 0, j = 0; i < nphi; i++) {
IRRef lref = phi[i];
IRRef rref = subst[lref];
if (lref == rref || rref == REF_DROP) { /* Invariants are redundant. */
- irt_setmark(IR(lref)->t);
- } else if (!(IR(rref)->op1 == lref || IR(rref)->op2 == lref)) {
- /* Quick check for simple recurrences failed, need pass2. */
- irt_setmark(IR(lref)->t);
- passx = 1;
+ irt_clearphi(IR(lref)->t);
+ } else {
+ phi[j++] = (IRRef1)lref;
+ if (!(IR(rref)->op1 == lref || IR(rref)->op2 == lref)) {
+ /* Quick check for simple recurrences failed, need pass2. */
+ irt_setmark(IR(lref)->t);
+ passx = 1;
+ }
}
}
+ nphi = j;
/* Pass #2: traverse variant part and clear marks of non-redundant PHIs. */
if (passx) {
SnapNo s;
@@ -174,15 +178,10 @@ static void loop_emit_phi(jit_State *J, IRRef1 *subst, IRRef1 *phi, IRRef nphi,
IRRef lref = phi[i];
IRIns *ir = IR(lref);
if (!irt_ismarked(ir->t)) { /* Propagate only from unmarked PHIs. */
- IRRef rref = subst[lref];
- if (lref == rref) { /* Mark redundant PHI. */
- irt_setmark(ir->t);
- } else {
- IRIns *irr = IR(rref);
- if (irt_ismarked(irr->t)) { /* Right ref points to other PHI? */
- irt_clearmark(irr->t); /* Mark that PHI as non-redundant. */
- passx = 1; /* Retry. */
- }
+ IRIns *irr = IR(subst[lref]);
+ if (irt_ismarked(irr->t)) { /* Right ref points to other PHI? */
+ irt_clearmark(irr->t); /* Mark that PHI as non-redundant. */
+ passx = 1; /* Retry. */
}
}
}
diff --git a/3rdparty/lua/src/lj_opt_mem.c b/3rdparty/lua/src/lj_opt_mem.c
index 98974ce..a4d96fc 100644
--- a/3rdparty/lua/src/lj_opt_mem.c
+++ b/3rdparty/lua/src/lj_opt_mem.c
@@ -3,7 +3,7 @@
** AA: Alias Analysis using high-level semantic disambiguation.
** FWD: Load Forwarding (L2L) + Store Forwarding (S2L).
** DSE: Dead-Store Elimination.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_opt_mem_c
@@ -396,13 +396,13 @@ static AliasRet aa_uref(IRIns *refa, IRIns *refb)
TRef LJ_FASTCALL lj_opt_fwd_uload(jit_State *J)
{
IRRef uref = fins->op1;
- IRRef lim = uref; /* Search limit. */
+ IRRef lim = REF_BASE; /* Search limit. */
IRIns *xr = IR(uref);
IRRef ref;
/* Search for conflicting stores. */
ref = J->chain[IR_USTORE];
- while (ref > uref) {
+ while (ref > lim) {
IRIns *store = IR(ref);
switch (aa_uref(xr, IR(store->op1))) {
case ALIAS_NO: break; /* Continue searching. */
@@ -414,7 +414,16 @@ TRef LJ_FASTCALL lj_opt_fwd_uload(jit_State *J)
cselim:
/* Try to find a matching load. Below the conflicting store, if any. */
- return lj_opt_cselim(J, lim);
+
+ ref = J->chain[IR_ULOAD];
+ while (ref > lim) {
+ IRIns *ir = IR(ref);
+ if (ir->op1 == uref ||
+ (IR(ir->op1)->op12 == IR(uref)->op12 && IR(ir->op1)->o == IR(uref)->o))
+ return ref; /* Match for identical or equal UREFx (non-CSEable UREFO). */
+ ref = ir->prev;
+ }
+ return lj_ir_emit(J);
}
/* USTORE elimination. */
@@ -609,16 +618,17 @@ static AliasRet aa_xref(jit_State *J, IRIns *refa, IRIns *xa, IRIns *xb)
basea = IR(refa->op1);
ofsa = (LJ_64 && irk->o == IR_KINT64) ? (ptrdiff_t)ir_k64(irk)->u64 :
(ptrdiff_t)irk->i;
- if (basea == refb && ofsa != 0)
- return ALIAS_NO; /* base+-ofs vs. base. */
}
if (refb->o == IR_ADD && irref_isk(refb->op2)) {
IRIns *irk = IR(refb->op2);
baseb = IR(refb->op1);
ofsb = (LJ_64 && irk->o == IR_KINT64) ? (ptrdiff_t)ir_k64(irk)->u64 :
(ptrdiff_t)irk->i;
- if (refa == baseb && ofsb != 0)
- return ALIAS_NO; /* base vs. base+-ofs. */
+ }
+ /* Treat constified pointers like base vs. base+offset. */
+ if (basea->o == IR_KPTR && baseb->o == IR_KPTR) {
+ ofsb += (char *)ir_kptr(baseb) - (char *)ir_kptr(basea);
+ baseb = basea;
}
/* This implements (very) strict aliasing rules.
** Different types do NOT alias, except for differences in signedness.
@@ -730,21 +740,19 @@ retry:
case ALIAS_MUST:
/* Emit conversion if the loaded type doesn't match the forwarded type. */
if (!irt_sametype(fins->t, IR(store->op2)->t)) {
- IRType st = irt_type(fins->t);
- if (st == IRT_I8 || st == IRT_I16) { /* Trunc + sign-extend. */
- st |= IRCONV_SEXT;
- } else if (st == IRT_U8 || st == IRT_U16) { /* Trunc + zero-extend. */
- } else if (st == IRT_INT) {
- st = irt_type(IR(store->op2)->t); /* Needs dummy CONV.int.*. */
- } else { /* I64/U64 are boxed, U32 is hidden behind a CONV.num.u32. */
- goto store_fwd;
+ IRType dt = irt_type(fins->t), st = irt_type(IR(store->op2)->t);
+ if (dt == IRT_I8 || dt == IRT_I16) { /* Trunc + sign-extend. */
+ st = dt | IRCONV_SEXT;
+ dt = IRT_INT;
+ } else if (dt == IRT_U8 || dt == IRT_U16) { /* Trunc + zero-extend. */
+ st = dt;
+ dt = IRT_INT;
}
- fins->ot = IRTI(IR_CONV);
+ fins->ot = IRT(IR_CONV, dt);
fins->op1 = store->op2;
- fins->op2 = (IRT_INT<<5)|st;
+ fins->op2 = (dt<<5)|st;
return RETRYFOLD;
}
- store_fwd:
return store->op2; /* Store forwarding. */
}
ref = store->prev;
@@ -785,6 +793,7 @@ TRef LJ_FASTCALL lj_opt_dse_xstore(jit_State *J)
IRRef ref = *refp;
if (J->chain[IR_CALLXS] > lim) lim = J->chain[IR_CALLXS];
if (J->chain[IR_XBAR] > lim) lim = J->chain[IR_XBAR];
+ if (J->chain[IR_XSNEW] > lim) lim = J->chain[IR_XSNEW];
while (ref > lim) { /* Search for redundant or conflicting stores. */
IRIns *store = IR(ref);
switch (aa_xref(J, xr, fins, store)) {
diff --git a/3rdparty/lua/src/lj_opt_narrow.c b/3rdparty/lua/src/lj_opt_narrow.c
index caf2a8d..58b3763 100644
--- a/3rdparty/lua/src/lj_opt_narrow.c
+++ b/3rdparty/lua/src/lj_opt_narrow.c
@@ -1,7 +1,7 @@
/*
** NARROW: Narrowing of numbers to integers (double to int32_t).
** STRIPOV: Stripping of overflow checks.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_opt_narrow_c
@@ -247,10 +247,16 @@ static void narrow_stripov_backprop(NarrowConv *nc, IRRef ref, int depth)
if (bp) {
ref = bp->val;
} else if (++depth < NARROW_MAX_BACKPROP && nc->sp < nc->maxsp) {
+ NarrowIns *savesp = nc->sp;
narrow_stripov_backprop(nc, ir->op1, depth);
- narrow_stripov_backprop(nc, ir->op2, depth);
- *nc->sp++ = NARROWINS(IRT(ir->o - IR_ADDOV + IR_ADD, IRT_INT), ref);
- return;
+ if (nc->sp < nc->maxsp) {
+ narrow_stripov_backprop(nc, ir->op2, depth);
+ if (nc->sp < nc->maxsp) {
+ *nc->sp++ = NARROWINS(IRT(ir->o - IR_ADDOV + IR_ADD, IRT_INT), ref);
+ return;
+ }
+ }
+ nc->sp = savesp; /* Path too deep, need to backtrack. */
}
}
*nc->sp++ = NARROWINS(NARROW_REF, ref);
@@ -263,6 +269,8 @@ static int narrow_conv_backprop(NarrowConv *nc, IRRef ref, int depth)
IRIns *ir = IR(ref);
IRRef cref;
+ if (nc->sp >= nc->maxsp) return 10; /* Path too deep. */
+
/* Check the easy cases first. */
if (ir->o == IR_CONV && (ir->op2 & IRCONV_SRCMASK) == IRT_INT) {
if ((nc->mode & IRCONV_CONVMASK) <= IRCONV_ANY)
diff --git a/3rdparty/lua/src/lj_opt_sink.c b/3rdparty/lua/src/lj_opt_sink.c
index 56e4636..a98e9df 100644
--- a/3rdparty/lua/src/lj_opt_sink.c
+++ b/3rdparty/lua/src/lj_opt_sink.c
@@ -1,6 +1,6 @@
/*
** SINK: Allocation Sinking and Store Sinking.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_opt_sink_c
diff --git a/3rdparty/lua/src/lj_opt_split.c b/3rdparty/lua/src/lj_opt_split.c
index 5a8c33b..1cee509 100644
--- a/3rdparty/lua/src/lj_opt_split.c
+++ b/3rdparty/lua/src/lj_opt_split.c
@@ -1,6 +1,6 @@
/*
** SPLIT: Split 64 bit IR instructions into 32 bit IR instructions.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_opt_split_c
diff --git a/3rdparty/lua/src/lj_parse.c b/3rdparty/lua/src/lj_parse.c
index 7ff7d72..abfac3c 100644
--- a/3rdparty/lua/src/lj_parse.c
+++ b/3rdparty/lua/src/lj_parse.c
@@ -1,6 +1,6 @@
/*
** Lua parser (source code -> bytecode).
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
**
** Major portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
@@ -685,10 +685,12 @@ static BCPos bcemit_jmp(FuncState *fs)
BCPos j = fs->pc - 1;
BCIns *ip = &fs->bcbase[j].ins;
fs->jpc = NO_JMP;
- if ((int32_t)j >= (int32_t)fs->lasttarget && bc_op(*ip) == BC_UCLO)
+ if ((int32_t)j >= (int32_t)fs->lasttarget && bc_op(*ip) == BC_UCLO) {
setbc_j(ip, NO_JMP);
- else
+ fs->lasttarget = j+1;
+ } else {
j = bcemit_AJ(fs, BC_JMP, fs->freereg, NO_JMP);
+ }
jmp_append(fs, &j, jpc);
return j;
}
@@ -1555,7 +1557,9 @@ static void fs_fixup_ret(FuncState *fs)
switch (bc_op(ins)) {
case BC_CALLMT: case BC_CALLT:
case BC_RETM: case BC_RET: case BC_RET0: case BC_RET1:
- offset = bcemit_INS(fs, ins)-(pc+1)+BCBIAS_J; /* Copy return ins. */
+ offset = bcemit_INS(fs, ins); /* Copy original instruction. */
+ fs->bcbase[offset].line = fs->bcbase[pc].line;
+ offset = offset-(pc+1)+BCBIAS_J;
if (offset > BCMAX_D)
err_syntax(fs->ls, LJ_ERR_XFIXUP);
/* Replace with UCLO plus branch. */
diff --git a/3rdparty/lua/src/lj_parse.h b/3rdparty/lua/src/lj_parse.h
index 558b4e2..dc4fd40 100644
--- a/3rdparty/lua/src/lj_parse.h
+++ b/3rdparty/lua/src/lj_parse.h
@@ -1,6 +1,6 @@
/*
** Lua parser (source code -> bytecode).
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_PARSE_H
diff --git a/3rdparty/lua/src/lj_record.c b/3rdparty/lua/src/lj_record.c
index 7336e0a..843108c 100644
--- a/3rdparty/lua/src/lj_record.c
+++ b/3rdparty/lua/src/lj_record.c
@@ -1,6 +1,6 @@
/*
** Trace recorder (bytecode -> SSA IR).
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_record_c
@@ -421,6 +421,7 @@ static void rec_for_loop(jit_State *J, const BCIns *fori, ScEvEntry *scev,
J->base[ra+FORL_IDX] = idx = emitir(IRT(IR_ADD, t), idx, step);
J->base[ra+FORL_EXT] = idx;
scev->idx = tref_ref(idx);
+ setmref(scev->pc, fori);
J->maxslot = ra+FORL_EXT+1;
}
@@ -436,7 +437,7 @@ static LoopEvent rec_for(jit_State *J, const BCIns *fori, int isforl)
IRType t;
if (isforl) { /* Handle FORL/JFORL opcodes. */
TRef idx = tr[FORL_IDX];
- if (tref_ref(idx) == J->scev.idx) {
+ if (mref(J->scev.pc, const BCIns) == fori && tref_ref(idx) == J->scev.idx) {
t = J->scev.t.irt;
stop = J->scev.stop;
idx = emitir(IRT(IR_ADD, t), idx, J->scev.step);
@@ -701,7 +702,7 @@ void lj_record_ret(jit_State *J, BCReg rbase, ptrdiff_t gotresults)
(!frame_islua(frame) ||
(J->parent == 0 && !bc_isret(bc_op(J->cur.startins))))) {
/* NYI: specialize to frame type and return directly, not via RET*. */
- for (i = -1; i < (ptrdiff_t)rbase; i++)
+ for (i = 0; i < (ptrdiff_t)rbase; i++)
J->base[i] = 0; /* Purge dead slots. */
J->maxslot = rbase + (BCReg)gotresults;
rec_stop(J, LJ_TRLINK_RETURN, 0); /* Return to interpreter. */
@@ -722,6 +723,8 @@ void lj_record_ret(jit_State *J, BCReg rbase, ptrdiff_t gotresults)
ptrdiff_t nresults = bc_b(callins) ? (ptrdiff_t)bc_b(callins)-1 :gotresults;
BCReg cbase = bc_a(callins);
GCproto *pt = funcproto(frame_func(frame - (cbase+1)));
+ if ((pt->flags & PROTO_NOJIT))
+ lj_trace_err(J, LJ_TRERR_CJITOFF);
if (J->framedepth == 0 && J->pt && frame == J->L->base - 1) {
if (check_downrec_unroll(J, pt)) {
J->maxslot = (BCReg)(rbase + gotresults);
@@ -742,6 +745,8 @@ void lj_record_ret(jit_State *J, BCReg rbase, ptrdiff_t gotresults)
} else if (J->parent == 0 && !bc_isret(bc_op(J->cur.startins))) {
/* Return to lower frame would leave the loop in a root trace. */
lj_trace_err(J, LJ_TRERR_LLEAVE);
+ } else if (J->needsnap) { /* Tailcalled to ff with side-effects. */
+ lj_trace_err(J, LJ_TRERR_NYIRETL); /* No way to insert snapshot here. */
} else { /* Return to lower frame. Guard for the target we return to. */
TRef trpt = lj_ir_kgc(J, obj2gco(pt), IRT_PROTO);
TRef trpc = lj_ir_kptr(J, (void *)frame_pc(frame));
@@ -1057,7 +1062,7 @@ static void rec_idx_abc(jit_State *J, TRef asizeref, TRef ikey, uint32_t asize)
lua_assert(irt_isint(J->scev.t) && ir->o == IR_SLOAD);
stop = numberVint(&(J->L->base - J->baseslot)[ir->op1 + FORL_STOP]);
/* Runtime value for stop of loop is within bounds? */
- if ((int64_t)stop + ofs < (int64_t)asize) {
+ if ((uint64_t)stop + ofs < (uint64_t)asize) {
/* Emit invariant bounds check for stop. */
emitir(IRTG(IR_ABC, IRT_P32), asizeref, ofs == 0 ? J->scev.stop :
emitir(IRTI(IR_ADD), J->scev.stop, ofsref));
@@ -1387,6 +1392,7 @@ static void check_call_unroll(jit_State *J, TraceNo lnk)
int32_t count = 0;
if ((J->pt->flags & PROTO_VARARG)) depth--; /* Vararg frame still missing. */
for (; depth > 0; depth--) { /* Count frames with same prototype. */
+ if (frame_iscont(frame)) depth--;
frame = frame_prev(frame);
if (mref(frame_func(frame)->l.pc, void) == pc)
count++;
@@ -1505,10 +1511,8 @@ static void rec_varg(jit_State *J, BCReg dst, ptrdiff_t nresults)
} else if (dst + nresults > J->maxslot) {
J->maxslot = dst + (BCReg)nresults;
}
- for (i = 0; i < nresults; i++) {
- J->base[dst+i] = i < nvararg ? J->base[i - nvararg - 1] : TREF_NIL;
- lua_assert(J->base[dst+i] != 0);
- }
+ for (i = 0; i < nresults; i++)
+ J->base[dst+i] = i < nvararg ? getslot(J, i - nvararg - 1) : TREF_NIL;
} else { /* Unknown number of varargs passed to trace. */
TRef fr = emitir(IRTI(IR_SLOAD), 0, IRSLOAD_READONLY|IRSLOAD_FRAME);
int32_t frofs = 8*(1+numparams)+FRAME_VARG;
@@ -2128,7 +2132,7 @@ static const BCIns *rec_setup_root(jit_State *J)
case BC_RET0:
case BC_RET1:
/* No bytecode range check for down-recursive root traces. */
- J->maxslot = ra + bc_d(ins);
+ J->maxslot = ra + bc_d(ins) - 1;
break;
case BC_FUNCF:
/* No bytecode range check for root traces started by a hot call. */
@@ -2152,6 +2156,7 @@ void lj_record_setup(jit_State *J)
memset(J->chain, 0, sizeof(J->chain));
memset(J->bpropcache, 0, sizeof(J->bpropcache));
J->scev.idx = REF_NIL;
+ setmref(J->scev.pc, NULL);
J->baseslot = 1; /* Invoking function is at base[-1]. */
J->base = J->slot + J->baseslot;
diff --git a/3rdparty/lua/src/lj_record.h b/3rdparty/lua/src/lj_record.h
index 287b260..c9f4882 100644
--- a/3rdparty/lua/src/lj_record.h
+++ b/3rdparty/lua/src/lj_record.h
@@ -1,6 +1,6 @@
/*
** Trace recorder (bytecode -> SSA IR).
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_RECORD_H
diff --git a/3rdparty/lua/src/lj_snap.c b/3rdparty/lua/src/lj_snap.c
index 30ff915..5c870ba 100644
--- a/3rdparty/lua/src/lj_snap.c
+++ b/3rdparty/lua/src/lj_snap.c
@@ -1,6 +1,6 @@
/*
** Snapshot handling.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_snap_c
@@ -104,8 +104,6 @@ static BCReg snapshot_framelinks(jit_State *J, SnapEntry *map)
if (frame_islua(frame)) {
map[f++] = SNAP_MKPC(frame_pc(frame));
frame = frame_prevl(frame);
- if (frame + funcproto(frame_func(frame))->framesize > ftop)
- ftop = frame + funcproto(frame_func(frame))->framesize;
} else if (frame_iscont(frame)) {
map[f++] = SNAP_MKFTSZ(frame_ftsz(frame));
map[f++] = SNAP_MKPC(frame_contpc(frame));
@@ -114,7 +112,10 @@ static BCReg snapshot_framelinks(jit_State *J, SnapEntry *map)
lua_assert(!frame_isc(frame));
map[f++] = SNAP_MKFTSZ(frame_ftsz(frame));
frame = frame_prevd(frame);
+ continue;
}
+ if (frame + funcproto(frame_func(frame))->framesize > ftop)
+ ftop = frame + funcproto(frame_func(frame))->framesize;
}
lua_assert(f == (MSize)(1 + J->framedepth));
return (BCReg)(ftop - lim);
@@ -708,7 +709,7 @@ static void snap_unsink(jit_State *J, GCtrace *T, ExitState *ex,
ir->o == IR_CNEW || ir->o == IR_CNEWI);
#if LJ_HASFFI
if (ir->o == IR_CNEW || ir->o == IR_CNEWI) {
- CTState *cts = ctype_ctsG(J2G(J));
+ CTState *cts = ctype_cts(J->L);
CTypeID id = (CTypeID)T->ir[ir->op1].i;
CTSize sz = lj_ctype_size(cts, id);
GCcdata *cd = lj_cdata_new(cts, id, sz);
@@ -845,12 +846,15 @@ const BCIns *lj_snap_restore(jit_State *J, void *exptr)
/* Compute current stack top. */
switch (bc_op(*pc)) {
+ default:
+ if (bc_op(*pc) < BC_FUNCF) {
+ L->top = curr_topL(L);
+ break;
+ }
+ /* fallthrough */
case BC_CALLM: case BC_CALLMT: case BC_RETM: case BC_TSETM:
L->top = frame + snap->nslots;
break;
- default:
- L->top = curr_topL(L);
- break;
}
return pc;
}
diff --git a/3rdparty/lua/src/lj_snap.h b/3rdparty/lua/src/lj_snap.h
index aff97e5..9a125be 100644
--- a/3rdparty/lua/src/lj_snap.h
+++ b/3rdparty/lua/src/lj_snap.h
@@ -1,6 +1,6 @@
/*
** Snapshot handling.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_SNAP_H
diff --git a/3rdparty/lua/src/lj_state.c b/3rdparty/lua/src/lj_state.c
index 8c53d37..e654afa 100644
--- a/3rdparty/lua/src/lj_state.c
+++ b/3rdparty/lua/src/lj_state.c
@@ -1,6 +1,6 @@
/*
** State and stack handling.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
**
** Portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
@@ -175,7 +175,7 @@ static void close_state(lua_State *L)
g->allocf(g->allocd, G2GG(g), sizeof(GG_State), 0);
}
-#if LJ_64
+#if LJ_64 && !(defined(LUAJIT_USE_VALGRIND) && defined(LUAJIT_USE_SYSMALLOC))
lua_State *lj_state_newstate(lua_Alloc f, void *ud)
#else
LUA_API lua_State *lua_newstate(lua_Alloc f, void *ud)
diff --git a/3rdparty/lua/src/lj_state.h b/3rdparty/lua/src/lj_state.h
index 527f054..687889a 100644
--- a/3rdparty/lua/src/lj_state.h
+++ b/3rdparty/lua/src/lj_state.h
@@ -1,6 +1,6 @@
/*
** State and stack handling.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_STATE_H
diff --git a/3rdparty/lua/src/lj_str.c b/3rdparty/lua/src/lj_str.c
index 6548ee4..ca60bcc 100644
--- a/3rdparty/lua/src/lj_str.c
+++ b/3rdparty/lua/src/lj_str.c
@@ -1,6 +1,6 @@
/*
** String handling.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
**
** Portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
diff --git a/3rdparty/lua/src/lj_str.h b/3rdparty/lua/src/lj_str.h
index 3aa0366..9969705 100644
--- a/3rdparty/lua/src/lj_str.h
+++ b/3rdparty/lua/src/lj_str.h
@@ -1,6 +1,6 @@
/*
** String handling.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_STR_H
diff --git a/3rdparty/lua/src/lj_strscan.c b/3rdparty/lua/src/lj_strscan.c
index a71b86a..568f647 100644
--- a/3rdparty/lua/src/lj_strscan.c
+++ b/3rdparty/lua/src/lj_strscan.c
@@ -1,6 +1,6 @@
/*
** String scanning.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#include <math.h>
@@ -199,7 +199,7 @@ static StrScanFmt strscan_dec(const uint8_t *p, TValue *o,
*xip++ = d + ((*p != '.' ? *p : *++p) & 15); p++;
}
/* Scan and realign trailing digit. */
- if (i) *xip++ = 10 * ((*p != '.' ? *p : *++p) & 15), ex10--, p++;
+ if (i) *xip++ = 10 * ((*p != '.' ? *p : *++p) & 15), ex10--, dig++, p++;
/* Summarize rounding-effect of excess digits. */
if (dig > STRSCAN_MAXDIG) {
@@ -289,14 +289,15 @@ static StrScanFmt strscan_dec(const uint8_t *p, TValue *o,
/* Scale down until no more than 17 or 18 integer part digits remain. */
while (idig > 9) {
- uint32_t i, cy = 0;
+ uint32_t i = hi, cy = 0;
ex2 += 6;
- for (i = hi; i != lo; i = DNEXT(i)) {
+ do {
cy += xi[i];
xi[i] = (cy >> 6);
cy = 100 * (cy & 0x3f);
if (xi[i] == 0 && i == hi) hi = DNEXT(hi), idig--;
- }
+ i = DNEXT(i);
+ } while (i != lo);
while (cy) {
if (hi == lo) { xi[DPREV(lo)] |= 1; break; }
xi[lo] = (cy >> 6); lo = DNEXT(lo);
diff --git a/3rdparty/lua/src/lj_strscan.h b/3rdparty/lua/src/lj_strscan.h
index 9557d67..7760689 100644
--- a/3rdparty/lua/src/lj_strscan.h
+++ b/3rdparty/lua/src/lj_strscan.h
@@ -1,6 +1,6 @@
/*
** String scanning.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_STRSCAN_H
diff --git a/3rdparty/lua/src/lj_tab.c b/3rdparty/lua/src/lj_tab.c
index ccad1f6..a8062db 100644
--- a/3rdparty/lua/src/lj_tab.c
+++ b/3rdparty/lua/src/lj_tab.c
@@ -1,6 +1,6 @@
/*
** Table handling.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
**
** Major portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
@@ -351,6 +351,13 @@ static void rehashtab(lua_State *L, GCtab *t, cTValue *ek)
resizetab(L, t, asize, hsize2hbits(total));
}
+#if LJ_HASFFI
+void lj_tab_rehash(lua_State *L, GCtab *t)
+{
+ rehashtab(L, t, niltv(L));
+}
+#endif
+
void lj_tab_reasize(lua_State *L, GCtab *t, uint32_t nasize)
{
resizetab(L, t, nasize+1, t->hmask > 0 ? lj_fls(t->hmask)+1 : 0);
diff --git a/3rdparty/lua/src/lj_tab.h b/3rdparty/lua/src/lj_tab.h
index 2787caa..f0d228e 100644
--- a/3rdparty/lua/src/lj_tab.h
+++ b/3rdparty/lua/src/lj_tab.h
@@ -1,6 +1,6 @@
/*
** Table handling.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_TAB_H
@@ -39,6 +39,9 @@ LJ_FUNC GCtab * LJ_FASTCALL lj_tab_new1(lua_State *L, uint32_t ahsize);
#endif
LJ_FUNCA GCtab * LJ_FASTCALL lj_tab_dup(lua_State *L, const GCtab *kt);
LJ_FUNC void LJ_FASTCALL lj_tab_free(global_State *g, GCtab *t);
+#if LJ_HASFFI
+LJ_FUNC void lj_tab_rehash(lua_State *L, GCtab *t);
+#endif
LJ_FUNCA void lj_tab_reasize(lua_State *L, GCtab *t, uint32_t nasize);
/* Caveat: all getters except lj_tab_get() can return NULL! */
diff --git a/3rdparty/lua/src/lj_target.h b/3rdparty/lua/src/lj_target.h
index eed69d1..1a24232 100644
--- a/3rdparty/lua/src/lj_target.h
+++ b/3rdparty/lua/src/lj_target.h
@@ -1,6 +1,6 @@
/*
** Definitions for target CPU.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_TARGET_H
diff --git a/3rdparty/lua/src/lj_target_arm.h b/3rdparty/lua/src/lj_target_arm.h
index bec5577..6d4d0ae 100644
--- a/3rdparty/lua/src/lj_target_arm.h
+++ b/3rdparty/lua/src/lj_target_arm.h
@@ -1,6 +1,6 @@
/*
** Definitions for ARM CPUs.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_TARGET_ARM_H
diff --git a/3rdparty/lua/src/lj_target_mips.h b/3rdparty/lua/src/lj_target_mips.h
index 36f46c8..0ab140b 100644
--- a/3rdparty/lua/src/lj_target_mips.h
+++ b/3rdparty/lua/src/lj_target_mips.h
@@ -1,6 +1,6 @@
/*
** Definitions for MIPS CPUs.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_TARGET_MIPS_H
diff --git a/3rdparty/lua/src/lj_target_ppc.h b/3rdparty/lua/src/lj_target_ppc.h
index 4e95c3a..2caeeb0 100644
--- a/3rdparty/lua/src/lj_target_ppc.h
+++ b/3rdparty/lua/src/lj_target_ppc.h
@@ -1,6 +1,6 @@
/*
** Definitions for PPC CPUs.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_TARGET_PPC_H
diff --git a/3rdparty/lua/src/lj_target_x86.h b/3rdparty/lua/src/lj_target_x86.h
index 84b0871..d12a1b8 100644
--- a/3rdparty/lua/src/lj_target_x86.h
+++ b/3rdparty/lua/src/lj_target_x86.h
@@ -1,6 +1,6 @@
/*
** Definitions for x86 and x64 CPUs.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_TARGET_X86_H
diff --git a/3rdparty/lua/src/lj_trace.c b/3rdparty/lua/src/lj_trace.c
index c70fc24..e51ec54 100644
--- a/3rdparty/lua/src/lj_trace.c
+++ b/3rdparty/lua/src/lj_trace.c
@@ -1,6 +1,6 @@
/*
** Trace management.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_trace_c
@@ -607,6 +607,7 @@ static TValue *trace_state(lua_State *L, lua_CFunction dummy, void *ud)
}
lj_opt_split(J);
lj_opt_sink(J);
+ if (!J->loopref) J->cur.snap[J->cur.nsnap-1].count = SNAPCOUNT_DONE;
J->state = LJ_TRACE_ASM;
break;
diff --git a/3rdparty/lua/src/lj_trace.h b/3rdparty/lua/src/lj_trace.h
index e30d3d5..4fbe5cf 100644
--- a/3rdparty/lua/src/lj_trace.h
+++ b/3rdparty/lua/src/lj_trace.h
@@ -1,6 +1,6 @@
/*
** Trace management.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_TRACE_H
diff --git a/3rdparty/lua/src/lj_traceerr.h b/3rdparty/lua/src/lj_traceerr.h
index 2ef4ad6..9bef117 100644
--- a/3rdparty/lua/src/lj_traceerr.h
+++ b/3rdparty/lua/src/lj_traceerr.h
@@ -1,6 +1,6 @@
/*
** Trace compiler error messages.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
/* This file may be included multiple times with different TREDEF macros. */
@@ -20,7 +20,7 @@ TREDEF(LUNROLL, "loop unroll limit reached")
/* Recording calls/returns. */
TREDEF(BADTYPE, "bad argument type")
-TREDEF(CJITOFF, "call to JIT-disabled function")
+TREDEF(CJITOFF, "JIT compilation disabled for function")
TREDEF(CUNROLL, "call unroll limit reached")
TREDEF(DOWNREC, "down-recursion, restarting")
TREDEF(NYICF, "NYI: C function %p")
diff --git a/3rdparty/lua/src/lj_udata.c b/3rdparty/lua/src/lj_udata.c
index df5e7f3..d401a3d 100644
--- a/3rdparty/lua/src/lj_udata.c
+++ b/3rdparty/lua/src/lj_udata.c
@@ -1,6 +1,6 @@
/*
** Userdata handling.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_udata_c
diff --git a/3rdparty/lua/src/lj_udata.h b/3rdparty/lua/src/lj_udata.h
index f62c02b..676e970 100644
--- a/3rdparty/lua/src/lj_udata.h
+++ b/3rdparty/lua/src/lj_udata.h
@@ -1,6 +1,6 @@
/*
** Userdata handling.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_UDATA_H
diff --git a/3rdparty/lua/src/lj_vm.h b/3rdparty/lua/src/lj_vm.h
index c5d05de..036cabc 100644
--- a/3rdparty/lua/src/lj_vm.h
+++ b/3rdparty/lua/src/lj_vm.h
@@ -1,6 +1,6 @@
/*
** Assembler VM interface definitions.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_VM_H
diff --git a/3rdparty/lua/src/lj_vmevent.c b/3rdparty/lua/src/lj_vmevent.c
index 21ad08f..81fe47d 100644
--- a/3rdparty/lua/src/lj_vmevent.c
+++ b/3rdparty/lua/src/lj_vmevent.c
@@ -1,6 +1,6 @@
/*
** VM event handling.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#include <stdio.h>
diff --git a/3rdparty/lua/src/lj_vmevent.h b/3rdparty/lua/src/lj_vmevent.h
index 11dedb4..231e00e 100644
--- a/3rdparty/lua/src/lj_vmevent.h
+++ b/3rdparty/lua/src/lj_vmevent.h
@@ -1,6 +1,6 @@
/*
** VM event handling.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LJ_VMEVENT_H
diff --git a/3rdparty/lua/src/lj_vmmath.c b/3rdparty/lua/src/lj_vmmath.c
index aa69030..31c6029 100644
--- a/3rdparty/lua/src/lj_vmmath.c
+++ b/3rdparty/lua/src/lj_vmmath.c
@@ -1,6 +1,6 @@
/*
** Math helper functions for assembler VM.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#define lj_vmmath_c
diff --git a/3rdparty/lua/src/ljamalg.c b/3rdparty/lua/src/ljamalg.c
index 962b313..9b237b7 100644
--- a/3rdparty/lua/src/ljamalg.c
+++ b/3rdparty/lua/src/ljamalg.c
@@ -1,12 +1,12 @@
/*
** LuaJIT core and libraries amalgamation.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
/*
+--------------------------------------------------------------------------+
| WARNING: Compiling the amalgamation needs a lot of virtual memory |
-| (around 200 MB with GCC 4.x)! If you don't have enough physical memory |
+| (around 300 MB with GCC 4.x)! If you don't have enough physical memory |
| your machine will start swapping to disk and the compile will not finish |
| within a reasonable amount of time. |
| So either compile on a bigger machine or use the non-amalgamated build. |
@@ -22,7 +22,7 @@
#endif
#ifndef WINVER
-#define WINVER 0x0500
+#define WINVER 0x0501
#endif
#include "lua.h"
diff --git a/3rdparty/lua/src/lua.h b/3rdparty/lua/src/lua.h
index b07e134..c83fd3b 100644
--- a/3rdparty/lua/src/lua.h
+++ b/3rdparty/lua/src/lua.h
@@ -1,5 +1,5 @@
/*
-** $Id: lua.h,v ec74646b41df 2013/11/19 00:23:10 oliver $
+** $Id: lua.h,v 1.218.1.5 2008/08/06 13:30:12 roberto Exp $
** Lua - An Extensible Extension Language
** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
** See Copyright Notice at the end of this file
diff --git a/3rdparty/lua/src/luaconf.h b/3rdparty/lua/src/luaconf.h
index d55caab..84fa641 100644
--- a/3rdparty/lua/src/luaconf.h
+++ b/3rdparty/lua/src/luaconf.h
@@ -1,11 +1,14 @@
/*
** Configuration header.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef luaconf_h
#define luaconf_h
+#ifndef WINVER
+#define WINVER 0x0501
+#endif
#include <limits.h>
#include <stddef.h>
@@ -23,26 +26,40 @@
".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
#else
/*
-** Note to distribution maintainers: do NOT patch the following line!
+** Note to distribution maintainers: do NOT patch the following lines!
** Please read ../doc/install.html#distro and pass PREFIX=/usr instead.
*/
-#define LUA_ROOT "/usr/local/"
-#define LUA_LDIR LUA_ROOT "share/lua/5.1/"
-#define LUA_CDIR LUA_ROOT "lib/lua/5.1/"
-#ifdef LUA_XROOT
-#define LUA_JDIR LUA_XROOT "share/luajit-2.0.2/"
-#define LUA_XPATH \
- ";" LUA_XROOT "share/lua/5.1/?.lua;" LUA_XROOT "share/lua/5.1/?/init.lua"
-#define LUA_XCPATH LUA_XROOT "lib/lua/5.1/?.so;"
+#ifndef LUA_MULTILIB
+#define LUA_MULTILIB "lib"
+#endif
+#ifndef LUA_LMULTILIB
+#define LUA_LMULTILIB "lib"
+#endif
+#define LUA_LROOT "/usr/local"
+#define LUA_LUADIR "/lua/5.1/"
+#define LUA_LJDIR "/luajit-2.0.4/"
+
+#ifdef LUA_ROOT
+#define LUA_JROOT LUA_ROOT
+#define LUA_RLDIR LUA_ROOT "/share" LUA_LUADIR
+#define LUA_RCDIR LUA_ROOT "/" LUA_MULTILIB LUA_LUADIR
+#define LUA_RLPATH ";" LUA_RLDIR "?.lua;" LUA_RLDIR "?/init.lua"
+#define LUA_RCPATH ";" LUA_RCDIR "?.so"
#else
-#define LUA_JDIR LUA_ROOT "share/luajit-2.0.2/"
-#define LUA_XPATH
-#define LUA_XCPATH
+#define LUA_JROOT LUA_LROOT
+#define LUA_RLPATH
+#define LUA_RCPATH
#endif
-#define LUA_PATH_DEFAULT \
- "./?.lua;" LUA_JDIR"?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua" LUA_XPATH
-#define LUA_CPATH_DEFAULT \
- "./?.so;" LUA_CDIR"?.so;" LUA_XCPATH LUA_CDIR"loadall.so"
+
+#define LUA_JPATH ";" LUA_JROOT "/share" LUA_LJDIR "?.lua"
+#define LUA_LLDIR LUA_LROOT "/share" LUA_LUADIR
+#define LUA_LCDIR LUA_LROOT "/" LUA_LMULTILIB LUA_LUADIR
+#define LUA_LLPATH ";" LUA_LLDIR "?.lua;" LUA_LLDIR "?/init.lua"
+#define LUA_LCPATH1 ";" LUA_LCDIR "?.so"
+#define LUA_LCPATH2 ";" LUA_LCDIR "loadall.so"
+
+#define LUA_PATH_DEFAULT "./?.lua" LUA_JPATH LUA_LLPATH LUA_RLPATH
+#define LUA_CPATH_DEFAULT "./?.so" LUA_LCPATH1 LUA_RCPATH LUA_LCPATH2
#endif
/* Environment variable names for path overrides and initialization code. */
diff --git a/3rdparty/lua/src/luajit.c b/3rdparty/lua/src/luajit.c
index e0eacc4..85d713f 100644
--- a/3rdparty/lua/src/luajit.c
+++ b/3rdparty/lua/src/luajit.c
@@ -1,6 +1,6 @@
/*
** LuaJIT frontend. Runs commands, scripts, read-eval-print (REPL) etc.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
**
** Major portions taken verbatim or adapted from the Lua interpreter.
** Copyright (C) 1994-2008 Lua.org, PUC-Rio. See Copyright Notice in lua.h
@@ -301,17 +301,17 @@ static int loadjitmodule(lua_State *L)
lua_concat(L, 2);
if (lua_pcall(L, 1, 1, 0)) {
const char *msg = lua_tostring(L, -1);
- if (msg && !strncmp(msg, "module ", 7)) {
- err:
- l_message(progname,
- "unknown luaJIT command or jit.* modules not installed");
- return 1;
- } else {
- return report(L, 1);
- }
+ if (msg && !strncmp(msg, "module ", 7))
+ goto nomodule;
+ return report(L, 1);
}
lua_getfield(L, -1, "start");
- if (lua_isnil(L, -1)) goto err;
+ if (lua_isnil(L, -1)) {
+ nomodule:
+ l_message(progname,
+ "unknown luaJIT command or jit.* modules not installed");
+ return 1;
+ }
lua_remove(L, -2); /* Drop module table. */
return 0;
}
diff --git a/3rdparty/lua/src/luajit.h b/3rdparty/lua/src/luajit.h
index f33b64c..9ced18e 100644
--- a/3rdparty/lua/src/luajit.h
+++ b/3rdparty/lua/src/luajit.h
@@ -1,7 +1,7 @@
/*
** LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/
**
-** Copyright (C) 2005-2013 Mike Pall. All rights reserved.
+** Copyright (C) 2005-2015 Mike Pall. All rights reserved.
**
** Permission is hereby granted, free of charge, to any person obtaining
** a copy of this software and associated documentation files (the
@@ -30,10 +30,10 @@
#include "lua.h"
-#define LUAJIT_VERSION "LuaJIT 2.0.2"
-#define LUAJIT_VERSION_NUM 20002 /* Version 2.0.2 = 02.00.02. */
-#define LUAJIT_VERSION_SYM luaJIT_version_2_0_2
-#define LUAJIT_COPYRIGHT "Copyright (C) 2005-2013 Mike Pall"
+#define LUAJIT_VERSION "LuaJIT 2.0.4"
+#define LUAJIT_VERSION_NUM 20004 /* Version 2.0.4 = 02.00.04. */
+#define LUAJIT_VERSION_SYM luaJIT_version_2_0_4
+#define LUAJIT_COPYRIGHT "Copyright (C) 2005-2015 Mike Pall"
#define LUAJIT_URL "http://luajit.org/"
/* Modes for luaJIT_setmode. */
diff --git a/3rdparty/lua/src/lualib.h b/3rdparty/lua/src/lualib.h
index 18c6234..96530e7 100644
--- a/3rdparty/lua/src/lualib.h
+++ b/3rdparty/lua/src/lualib.h
@@ -1,6 +1,6 @@
/*
** Standard library header.
-** Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+** Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
*/
#ifndef _LUALIB_H
diff --git a/3rdparty/lua/src/modules/dbgprint.c b/3rdparty/lua/src/modules/dbgprint.c
index ae04e66..03a45ea 100644
--- a/3rdparty/lua/src/modules/dbgprint.c
+++ b/3rdparty/lua/src/modules/dbgprint.c
@@ -1,28 +1,28 @@
-///////////////////////////////////////////////////////////////////////////////
-///
-/// Written 2012, Oliver Schneider (assarbad.net) - PUBLIC DOMAIN/CC0
-///
-/// Original filename: dbgprint.c
-/// Project : WinDirStat
-/// Author(s) : Oliver Schneider
-///
-/// Purpose : Lua function, implemented in C, to call OutputDebugString
-///
-///////////////////////////////////////////////////////////////////////////////
-
-#include <Windows.h>
-#include <tchar.h>
-#include <lua.h>
-#include "lua-winreg/src/lua_tstring.h"
-
-static int luaC_dbgprint_(lua_State* L)
-{
- const TCHAR *str = lua_checkltstring(L,1,NULL);
- OutputDebugString(str);
- return 0;
-}
-
-LUA_API const luaL_Reg dbgprint_funcs[] = {
- {"dbgprint", luaC_dbgprint_},
- {NULL, NULL}
-};
+///////////////////////////////////////////////////////////////////////////////
+///
+/// Written 2012, Oliver Schneider (assarbad.net) - PUBLIC DOMAIN/CC0
+///
+/// Original filename: dbgprint.c
+/// Project : WinDirStat
+/// Author(s) : Oliver Schneider
+///
+/// Purpose : Lua function, implemented in C, to call OutputDebugString
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <Windows.h>
+#include <tchar.h>
+#include <lua.h>
+#include "lua-winreg/src/lua_tstring.h"
+
+static int luaC_dbgprint_(lua_State* L)
+{
+ const TCHAR *str = lua_checkltstring(L,1,NULL);
+ OutputDebugString(str);
+ return 0;
+}
+
+LUA_API const luaL_Reg dbgprint_funcs[] = {
+ {"dbgprint", luaC_dbgprint_},
+ {NULL, NULL}
+};
diff --git a/3rdparty/lua/src/modules/dbgprint.h b/3rdparty/lua/src/modules/dbgprint.h
index b65f0e0..f7007bf 100644
--- a/3rdparty/lua/src/modules/dbgprint.h
+++ b/3rdparty/lua/src/modules/dbgprint.h
@@ -1,17 +1,17 @@
-#ifndef __DBGPRINT_H_VER__
-#define __DBGPRINT_H_VER__ 2012102423
-// $Id: dbgprint.h,v e885f176d70a 2012/10/25 14:16:05 oliver $
-#if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__MCPP)
-#pragma once
-#endif // Check for "#pragma once" support
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif // __cplusplus
- LUA_API const luaL_Reg dbgprint_funcs[];
-#ifdef __cplusplus
-};
-#endif // __cplusplus
-
-#endif // __DBGPRINT_H_VER__
+#ifndef __DBGPRINT_H_VER__
+#define __DBGPRINT_H_VER__ 2012102423
+// $Id: dbgprint.h,v e885f176d70a 2012/10/25 14:16:05 oliver $
+#if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__MCPP)
+#pragma once
+#endif // Check for "#pragma once" support
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif // __cplusplus
+ LUA_API const luaL_Reg dbgprint_funcs[];
+#ifdef __cplusplus
+};
+#endif // __cplusplus
+
+#endif // __DBGPRINT_H_VER__
diff --git a/3rdparty/lua/src/modules/isadmin.c b/3rdparty/lua/src/modules/isadmin.c
index 4e982f3..55a2090 100644
--- a/3rdparty/lua/src/modules/isadmin.c
+++ b/3rdparty/lua/src/modules/isadmin.c
@@ -1,53 +1,53 @@
-///////////////////////////////////////////////////////////////////////////////
-///
-/// Written 2012, Oliver Schneider (assarbad.net) - PUBLIC DOMAIN/CC0
-///
-/// Original filename: isadmin.c
-/// Project : WinDirStat
-/// Author(s) : Oliver Schneider
-///
-/// Purpose : Lua function, implemented in C, to check whether the
-/// user is privileged or not.
-///
-///////////////////////////////////////////////////////////////////////////////
-
-#include <Windows.h>
-#include <tchar.h>
-#include <lua.h>
-
-BOOL static IsAdmin_()
-{
- SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
- PSID pSid;
- if (AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &pSid))
- {
- BOOL bResult = FALSE;
- if (!CheckTokenMembership( NULL, pSid, &bResult))
- {
- FreeSid(pSid);
- return FALSE;
- }
- FreeSid(pSid);
- return bResult;
- }
-
- return FALSE;
-}
-
-static int luaC_isadmin_(lua_State* L)
-{
- static int *pcachedResult = NULL;
- if(!pcachedResult)
- {
- static int cachedResult = 0;
- cachedResult = (IsAdmin_()) ? 1 : 0;
- pcachedResult = &cachedResult;
- }
- lua_pushboolean(L, *pcachedResult);
- return 1;
-}
-
-LUA_API const luaL_Reg isadmin_funcs[] = {
- {"isadmin", luaC_isadmin_},
- {NULL, NULL}
-};
+///////////////////////////////////////////////////////////////////////////////
+///
+/// Written 2012, Oliver Schneider (assarbad.net) - PUBLIC DOMAIN/CC0
+///
+/// Original filename: isadmin.c
+/// Project : WinDirStat
+/// Author(s) : Oliver Schneider
+///
+/// Purpose : Lua function, implemented in C, to check whether the
+/// user is privileged or not.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <Windows.h>
+#include <tchar.h>
+#include <lua.h>
+
+BOOL static IsAdmin_()
+{
+ SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
+ PSID pSid;
+ if (AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &pSid))
+ {
+ BOOL bResult = FALSE;
+ if (!CheckTokenMembership( NULL, pSid, &bResult))
+ {
+ FreeSid(pSid);
+ return FALSE;
+ }
+ FreeSid(pSid);
+ return bResult;
+ }
+
+ return FALSE;
+}
+
+static int luaC_isadmin_(lua_State* L)
+{
+ static int *pcachedResult = NULL;
+ if(!pcachedResult)
+ {
+ static int cachedResult = 0;
+ cachedResult = (IsAdmin_()) ? 1 : 0;
+ pcachedResult = &cachedResult;
+ }
+ lua_pushboolean(L, *pcachedResult);
+ return 1;
+}
+
+LUA_API const luaL_Reg isadmin_funcs[] = {
+ {"isadmin", luaC_isadmin_},
+ {NULL, NULL}
+};
diff --git a/3rdparty/lua/src/modules/isadmin.h b/3rdparty/lua/src/modules/isadmin.h
index 618ecc0..7d448a1 100644
--- a/3rdparty/lua/src/modules/isadmin.h
+++ b/3rdparty/lua/src/modules/isadmin.h
@@ -1,17 +1,17 @@
-#ifndef __ISADMIN_H_VER__
-#define __ISADMIN_H_VER__ 2012102414
-// $Id: isadmin.h,v 52e6657a08c7 2012/10/24 15:21:39 oliver $
-#if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__MCPP)
-#pragma once
-#endif // Check for "#pragma once" support
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif // __cplusplus
- LUA_API const luaL_Reg isadmin_funcs[];
-#ifdef __cplusplus
-};
-#endif // __cplusplus
-
-#endif // __ISADMIN_H_VER__
+#ifndef __ISADMIN_H_VER__
+#define __ISADMIN_H_VER__ 2012102414
+// $Id: isadmin.h,v 52e6657a08c7 2012/10/24 15:21:39 oliver $
+#if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__MCPP)
+#pragma once
+#endif // Check for "#pragma once" support
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif // __cplusplus
+ LUA_API const luaL_Reg isadmin_funcs[];
+#ifdef __cplusplus
+};
+#endif // __cplusplus
+
+#endif // __ISADMIN_H_VER__
diff --git a/3rdparty/lua/src/modules/lua-winreg/README.md b/3rdparty/lua/src/modules/lua-winreg/README.md
index aa9a887..e89641a 100644
--- a/3rdparty/lua/src/modules/lua-winreg/README.md
+++ b/3rdparty/lua/src/modules/lua-winreg/README.md
@@ -1,28 +1,28 @@
-#winreg
-
-##Jas Latrix
-Copyright © 2005, 2006 Jas Latrix <jastejada at yahoo dot com>
-
-All Rights Deserved. Use at your own risk!. Shake well before using.
-
---------------------------------------------------------------------------------
-
-
-#Introduction
-
-winreg is a Lua binary module to Access Microsoft(R) Windows(R) Registry. The registry is a system-defined database that applications and Microsoft(R) Windows(R) system components use to store and retrieve configuration data.
-Load the module via the require function (make sure Lua can find the module), for example:
-
-```lua
-local winreg = require"winreg"
-
--- prints all the special folders
-hkey = winreg.openkey[[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion]]
-
-skey = hkey:openkey([[Explorer\Shell Folders]])
-for name in skey:enumvalue() do
- print("\nname: " .. name
- .. "\npath: " .. skey:getvalue(name))
-end
-```
-
+#winreg
+
+##Jas Latrix
+Copyright © 2005, 2006 Jas Latrix <jastejada at yahoo dot com>
+
+All Rights Deserved. Use at your own risk!. Shake well before using.
+
+--------------------------------------------------------------------------------
+
+
+#Introduction
+
+winreg is a Lua binary module to Access Microsoft(R) Windows(R) Registry. The registry is a system-defined database that applications and Microsoft(R) Windows(R) system components use to store and retrieve configuration data.
+Load the module via the require function (make sure Lua can find the module), for example:
+
+```lua
+local winreg = require"winreg"
+
+-- prints all the special folders
+hkey = winreg.openkey[[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion]]
+
+skey = hkey:openkey([[Explorer\Shell Folders]])
+for name in skey:enumvalue() do
+ print("\nname: " .. name
+ .. "\npath: " .. skey:getvalue(name))
+end
+```
+
diff --git a/3rdparty/lua/src/modules/lua-winreg/doc/COPYRIGHT b/3rdparty/lua/src/modules/lua-winreg/doc/COPYRIGHT
index 8f22bc6..8103135 100644
--- a/3rdparty/lua/src/modules/lua-winreg/doc/COPYRIGHT
+++ b/3rdparty/lua/src/modules/lua-winreg/doc/COPYRIGHT
@@ -1,5 +1,5 @@
-Copyright (C) 2006-2007 Jas Latrix. All rights reserved.
-
-IN NO EVENT SHALL THE AUTHOR OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-THE AUTHOR AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHOR AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+Copyright (C) 2006-2007 Jas Latrix. All rights reserved.
+
+IN NO EVENT SHALL THE AUTHOR OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+THE AUTHOR AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHOR AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
diff --git a/3rdparty/lua/src/modules/lua-winreg/lakefile b/3rdparty/lua/src/modules/lua-winreg/lakefile
index c471e75..5a7b3cc 100644
--- a/3rdparty/lua/src/modules/lua-winreg/lakefile
+++ b/3rdparty/lua/src/modules/lua-winreg/lakefile
@@ -1,77 +1,77 @@
-if not WINDOWS then quit('This is only windwos module!') end
-
-if LUA_VER == '5.2' then
- LUA_NEED = 'lua52'
- LUA_DIR = ENV.LUA_DIR_5_2 or ENV.LUA_DIR
-else
- LUA_NEED = 'lua'
- LUA_DIR = ENV.LUA_DIR
-end
-
-lake.define_need('unicode',function()return{
- defines = {"UNICODE"; "_UNICODE"};
- flags = "/UMBS /U_MBS";
-} end)
-
-INSTALL_DIR = INSTALL_DIR or J(LUA_DIR,'libs','winreg')
-
-winreg = c.shared{'winreg',
- base = 'src';
- src = {"lua_int64","lua_mtutil","lua_tstring","luawin_dllerror",
- "win_privileges","win_registry","win_trace","winreg","l52util"
- };
- defines = L(
- {'WIN32','_WIN32','_WINDOWS'},
- {"WIN32_LEAN_AND_MEAN"; "WINDLL"; "USRDLL"},
- IF(DEBUG, {'_DEBUG', 'DEBUG'},'NDEBUG'),
- IF(MSVC, {'_CRT_SECURE_NO_WARNINGS'}),
- IF(MSVC, {'_WIN32_WINNT=0x0400','WINVER=0x0400', '_WIN32_IE=0x0300'}),
- IF(MSVC, {'CRTAPI1=_cdecl','CRTAPI2=_cdecl','_X86_=1'}),
- 'WINREG_EXPORTS', 'WINREG_API=__declspec(dllexport)'
- );
- flags = IF(MSVC,
- IF(DEBUG, {'-Z7' , '-Od', --[['-MLd']]}, {'-O2', --[['-ML']]}),
- '-Os -DNDEBUG -s'
- );
- libflags = IF(MSVC,IF(DEBUG, '-debug:full -debugtype:cv', '-DEBUG -OPT:REF -OPT:ICF'));
- needs = {LUA_NEED,IF(UNICODE, 'unicode')};
- libs = {"advapi32", "kernel32", "user32"};
- optimize = false;
-}
-
-target('build',{winreg})
-
-install = target('install', {
- file.group{odir=J(INSTALL_DIR, 'test');
- src = J('test','*.*');recurse=true;
- };
- file.group{odir=J(INSTALL_DIR, 'doc');
- src = J('doc','*.*');recurse=true;
- };
- file.group{odir=J(INSTALL_DIR, 'examples');
- src = J('examples','*.*');recurse=true;
- };
- target(J(INSTALL_DIR, 'bin', winreg.name .. DLL_EXT), winreg, CP );
-})
-
-target('test', install, function()
- if TESTING then
- lake.chdir('test')
- for file in path.mask('*.lua') do
- print("run " .. file)
- end
- lake.chdir('<')
- end
- if not TESTING then
- lake.chdir(J(INSTALL_DIR,'test'))
- for file in path.mask('*.lua') do
- print("run " .. file)
- if not utils.execute( LUA_EXE .. ' ' .. file ) then
- quit("FAIL!")
- end
- end
- lake.chdir('<')
- end
-end)
-
-default('build')
+if not WINDOWS then quit('This is only windwos module!') end
+
+if LUA_VER == '5.2' then
+ LUA_NEED = 'lua52'
+ LUA_DIR = ENV.LUA_DIR_5_2 or ENV.LUA_DIR
+else
+ LUA_NEED = 'lua'
+ LUA_DIR = ENV.LUA_DIR
+end
+
+lake.define_need('unicode',function()return{
+ defines = {"UNICODE"; "_UNICODE"};
+ flags = "/UMBS /U_MBS";
+} end)
+
+INSTALL_DIR = INSTALL_DIR or J(LUA_DIR,'libs','winreg')
+
+winreg = c.shared{'winreg',
+ base = 'src';
+ src = {"lua_int64","lua_mtutil","lua_tstring","luawin_dllerror",
+ "win_privileges","win_registry","win_trace","winreg","l52util"
+ };
+ defines = L(
+ {'WIN32','_WIN32','_WINDOWS'},
+ {"WIN32_LEAN_AND_MEAN"; "WINDLL"; "USRDLL"},
+ IF(DEBUG, {'_DEBUG', 'DEBUG'},'NDEBUG'),
+ IF(MSVC, {'_CRT_SECURE_NO_WARNINGS'}),
+ IF(MSVC, {'_WIN32_WINNT=0x0400','WINVER=0x0400', '_WIN32_IE=0x0300'}),
+ IF(MSVC, {'CRTAPI1=_cdecl','CRTAPI2=_cdecl','_X86_=1'}),
+ 'WINREG_EXPORTS', 'WINREG_API=__declspec(dllexport)'
+ );
+ flags = IF(MSVC,
+ IF(DEBUG, {'-Z7' , '-Od', --[['-MLd']]}, {'-O2', --[['-ML']]}),
+ '-Os -DNDEBUG -s'
+ );
+ libflags = IF(MSVC,IF(DEBUG, '-debug:full -debugtype:cv', '-DEBUG -OPT:REF -OPT:ICF'));
+ needs = {LUA_NEED,IF(UNICODE, 'unicode')};
+ libs = {"advapi32", "kernel32", "user32"};
+ optimize = false;
+}
+
+target('build',{winreg})
+
+install = target('install', {
+ file.group{odir=J(INSTALL_DIR, 'test');
+ src = J('test','*.*');recurse=true;
+ };
+ file.group{odir=J(INSTALL_DIR, 'doc');
+ src = J('doc','*.*');recurse=true;
+ };
+ file.group{odir=J(INSTALL_DIR, 'examples');
+ src = J('examples','*.*');recurse=true;
+ };
+ target(J(INSTALL_DIR, 'bin', winreg.name .. DLL_EXT), winreg, CP );
+})
+
+target('test', install, function()
+ if TESTING then
+ lake.chdir('test')
+ for file in path.mask('*.lua') do
+ print("run " .. file)
+ end
+ lake.chdir('<')
+ end
+ if not TESTING then
+ lake.chdir(J(INSTALL_DIR,'test'))
+ for file in path.mask('*.lua') do
+ print("run " .. file)
+ if not utils.execute( LUA_EXE .. ' ' .. file ) then
+ quit("FAIL!")
+ end
+ end
+ lake.chdir('<')
+ end
+end)
+
+default('build')
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/build.mak b/3rdparty/lua/src/modules/lua-winreg/src/build.mak
index fe2eef5..99d9f51 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/build.mak
+++ b/3rdparty/lua/src/modules/lua-winreg/src/build.mak
@@ -1,72 +1,72 @@
-src = \
- lua_int64.c \
- lua_mtutil.c \
- lua_tstring.c \
- luawin_dllerror.c \
- win_privileges.c \
- win_registry.c \
- win_trace.c \
- winreg.c \
-
-obj = \
- lua_int64.obj \
- lua_mtutil.obj \
- lua_tstring.obj \
- luawin_dllerror.obj \
- win_privileges.obj \
- win_registry.obj \
- win_trace.obj \
- winreg.obj \
-
-!IFNDEF outfile
-outfile=winreg.dll
-!ENDIF
-
-
-# Edit this!
-!IFDEF Lua5
-lualib = \usr\local\lib\lua\5.0\lua50.lib
-luainc = -I "\usr\local\include\lua\5.0"
-!ELSE
-lualib = \usr\local\lib\lua\5.1\lua51.lib
-luainc = -I "\usr\local\include\lua\5.1"
-!ENDIF
-
-!IFDEF unicode
-cuflags = -D UNICODE -D _UNICODE -UMBS -U_MBS
-!ENDIF
-
-!IFDEF nodebug
-cdebug = -O2 -DNDEBUG -ML
-ldebug = -DEBUG -OPT:REF -OPT:ICF
-!ELSE
-cdebug = -Z7 -Od -D_DEBUG -MLd
-ldebug = -debug:full -debugtype:cv
-!ENDIF
-
-cvars = -DWIN32 -D_WIN32 -D_WINDOWS -DWIN32_LEAN_AND_MEAN -D_WINDLL -D_USRDLL
-cflags = -EHsc -nologo -c -W4 -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -D_X86_=1 -D_WIN32_IE=0x0300 -DWINVER=0x0400 -I .
-lflags = -INCREMENTAL:NO -NOLOGO -subsystem:windows,4.0 -DLL
-libs = kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib
-
-echo:
- @echo src = $(src)
- @echo obj = $(obj)
- @echo outfile = $(outfile)
-
-build: compile link
-
-compile:
- cl $(cdebug) $(cflags) $(cvars) $(cuflags) $(ciflags) $(luainc) $(src)
-
-link:
- link $(ldebug) $(lflags) $(libs) $(obj) $(lualib) /OUT:"$(outfile)"
-
-pack:
- $(packcmd) $(outfile)
-
-clean:
- -del $(outfile)
- -del *.obj
- -del *.lib
+src = \
+ lua_int64.c \
+ lua_mtutil.c \
+ lua_tstring.c \
+ luawin_dllerror.c \
+ win_privileges.c \
+ win_registry.c \
+ win_trace.c \
+ winreg.c \
+
+obj = \
+ lua_int64.obj \
+ lua_mtutil.obj \
+ lua_tstring.obj \
+ luawin_dllerror.obj \
+ win_privileges.obj \
+ win_registry.obj \
+ win_trace.obj \
+ winreg.obj \
+
+!IFNDEF outfile
+outfile=winreg.dll
+!ENDIF
+
+
+# Edit this!
+!IFDEF Lua5
+lualib = \usr\local\lib\lua\5.0\lua50.lib
+luainc = -I "\usr\local\include\lua\5.0"
+!ELSE
+lualib = \usr\local\lib\lua\5.1\lua51.lib
+luainc = -I "\usr\local\include\lua\5.1"
+!ENDIF
+
+!IFDEF unicode
+cuflags = -D UNICODE -D _UNICODE -UMBS -U_MBS
+!ENDIF
+
+!IFDEF nodebug
+cdebug = -O2 -DNDEBUG -ML
+ldebug = -DEBUG -OPT:REF -OPT:ICF
+!ELSE
+cdebug = -Z7 -Od -D_DEBUG -MLd
+ldebug = -debug:full -debugtype:cv
+!ENDIF
+
+cvars = -DWIN32 -D_WIN32 -D_WINDOWS -DWIN32_LEAN_AND_MEAN -D_WINDLL -D_USRDLL
+cflags = -EHsc -nologo -c -W4 -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -D_X86_=1 -D_WIN32_IE=0x0300 -DWINVER=0x0400 -I .
+lflags = -INCREMENTAL:NO -NOLOGO -subsystem:windows,4.0 -DLL
+libs = kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib
+
+echo:
+ @echo src = $(src)
+ @echo obj = $(obj)
+ @echo outfile = $(outfile)
+
+build: compile link
+
+compile:
+ cl $(cdebug) $(cflags) $(cvars) $(cuflags) $(ciflags) $(luainc) $(src)
+
+link:
+ link $(ldebug) $(lflags) $(libs) $(obj) $(lualib) /OUT:"$(outfile)"
+
+pack:
+ $(packcmd) $(outfile)
+
+clean:
+ -del $(outfile)
+ -del *.obj
+ -del *.lib
-del *.exp \ No newline at end of file
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/l52util.c b/3rdparty/lua/src/modules/lua-winreg/src/l52util.c
index 5675114..ad44dbe 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/l52util.c
+++ b/3rdparty/lua/src/modules/lua-winreg/src/l52util.c
@@ -1,119 +1,119 @@
-#include "l52util.h"
-
-#include <memory.h>
-#include <assert.h>
-
-#if LUA_VERSION_NUM >= 502
-
-int luaL_typerror (lua_State *L, int narg, const char *tname) {
- const char *msg = lua_pushfstring(L, "%s expected, got %s", tname,
- luaL_typename(L, narg));
- return luaL_argerror(L, narg, msg);
-}
-
-void luaL_register (lua_State *L, const char *libname, const luaL_Reg *l){
- if(libname) lua_newtable(L);
- luaL_setfuncs(L, l, 0);
-}
-
-#else
-
-void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup){
- luaL_checkstack(L, nup, "too many upvalues");
- for (; l->name != NULL; l++) { /* fill the table with given functions */
- int i;
- for (i = 0; i < nup; i++) /* copy upvalues to the top */
- lua_pushvalue(L, -nup);
- lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */
- lua_setfield(L, -(nup + 2), l->name);
- }
- lua_pop(L, nup); /* remove upvalues */
-}
-
-void lua_rawgetp(lua_State *L, int index, const void *p){
- index = lua_absindex(L, index);
- lua_pushlightuserdata(L, (void *)p);
- lua_rawget(L, index);
-}
-
-void lua_rawsetp (lua_State *L, int index, const void *p){
- index = lua_absindex(L, index);
- lua_pushlightuserdata(L, (void *)p);
- lua_insert(L, -2);
- lua_rawset(L, index);
-}
-
-#endif
-
-int lutil_newmetatablep (lua_State *L, const void *p) {
- lua_rawgetp(L, LUA_REGISTRYINDEX, p);
- if (!lua_isnil(L, -1)) /* name already in use? */
- return 0; /* leave previous value on top, but return 0 */
- lua_pop(L, 1);
-
- lua_newtable(L); /* create metatable */
- lua_pushvalue(L, -1); /* duplicate metatable to set*/
- lua_rawsetp(L, LUA_REGISTRYINDEX, p);
-
- return 1;
-}
-
-void lutil_getmetatablep (lua_State *L, const void *p) {
- lua_rawgetp(L, LUA_REGISTRYINDEX, p);
-}
-
-void lutil_setmetatablep (lua_State *L, const void *p) {
- lutil_getmetatablep(L, p);
- assert(lua_istable(L,-1));
- lua_setmetatable (L, -2);
-}
-
-int lutil_isudatap (lua_State *L, int ud, const void *p) {
- if (lua_isuserdata(L, ud)){
- if (lua_getmetatable(L, ud)) { /* does it have a metatable? */
- int res;
- lutil_getmetatablep(L,p); /* get correct metatable */
- res = lua_rawequal(L, -1, -2); /* does it have the correct mt? */
- lua_pop(L, 2); /* remove both metatables */
- return res;
- }
- }
- return 0;
-}
-
-void *lutil_checkudatap (lua_State *L, int ud, const void *p) {
- void *up = lua_touserdata(L, ud);
- if (up != NULL) { /* value is a userdata? */
- if (lua_getmetatable(L, ud)) { /* does it have a metatable? */
- lutil_getmetatablep(L,p); /* get correct metatable */
- if (lua_rawequal(L, -1, -2)) { /* does it have the correct mt? */
- lua_pop(L, 2); /* remove both metatables */
- return up;
- }
- }
- }
- luaL_typerror(L, ud, p); /* else error */
- return NULL; /* to avoid warnings */
-}
-
-int lutil_createmetap (lua_State *L, const void *p, const luaL_Reg *methods) {
- if (!lutil_newmetatablep(L, p))
- return 0;
-
- /* define methods */
- luaL_setfuncs (L, methods, 0);
-
- /* define metamethods */
- lua_pushliteral (L, "__index");
- lua_pushvalue (L, -2);
- lua_settable (L, -3);
-
- return 1;
-}
-
-void *lutil_newudatap_impl(lua_State *L, size_t size, const void *p){
- void *obj = lua_newuserdata (L, size);
- memset(obj, 0, size);
- lutil_setmetatablep(L, p);
- return obj;
-}
+#include "l52util.h"
+
+#include <memory.h>
+#include <assert.h>
+
+#if LUA_VERSION_NUM >= 502
+
+int luaL_typerror (lua_State *L, int narg, const char *tname) {
+ const char *msg = lua_pushfstring(L, "%s expected, got %s", tname,
+ luaL_typename(L, narg));
+ return luaL_argerror(L, narg, msg);
+}
+
+void luaL_register (lua_State *L, const char *libname, const luaL_Reg *l){
+ if(libname) lua_newtable(L);
+ luaL_setfuncs(L, l, 0);
+}
+
+#else
+
+void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup){
+ luaL_checkstack(L, nup, "too many upvalues");
+ for (; l->name != NULL; l++) { /* fill the table with given functions */
+ int i;
+ for (i = 0; i < nup; i++) /* copy upvalues to the top */
+ lua_pushvalue(L, -nup);
+ lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */
+ lua_setfield(L, -(nup + 2), l->name);
+ }
+ lua_pop(L, nup); /* remove upvalues */
+}
+
+void lua_rawgetp(lua_State *L, int index, const void *p){
+ index = lua_absindex(L, index);
+ lua_pushlightuserdata(L, (void *)p);
+ lua_rawget(L, index);
+}
+
+void lua_rawsetp (lua_State *L, int index, const void *p){
+ index = lua_absindex(L, index);
+ lua_pushlightuserdata(L, (void *)p);
+ lua_insert(L, -2);
+ lua_rawset(L, index);
+}
+
+#endif
+
+int lutil_newmetatablep (lua_State *L, const void *p) {
+ lua_rawgetp(L, LUA_REGISTRYINDEX, p);
+ if (!lua_isnil(L, -1)) /* name already in use? */
+ return 0; /* leave previous value on top, but return 0 */
+ lua_pop(L, 1);
+
+ lua_newtable(L); /* create metatable */
+ lua_pushvalue(L, -1); /* duplicate metatable to set*/
+ lua_rawsetp(L, LUA_REGISTRYINDEX, p);
+
+ return 1;
+}
+
+void lutil_getmetatablep (lua_State *L, const void *p) {
+ lua_rawgetp(L, LUA_REGISTRYINDEX, p);
+}
+
+void lutil_setmetatablep (lua_State *L, const void *p) {
+ lutil_getmetatablep(L, p);
+ assert(lua_istable(L,-1));
+ lua_setmetatable (L, -2);
+}
+
+int lutil_isudatap (lua_State *L, int ud, const void *p) {
+ if (lua_isuserdata(L, ud)){
+ if (lua_getmetatable(L, ud)) { /* does it have a metatable? */
+ int res;
+ lutil_getmetatablep(L,p); /* get correct metatable */
+ res = lua_rawequal(L, -1, -2); /* does it have the correct mt? */
+ lua_pop(L, 2); /* remove both metatables */
+ return res;
+ }
+ }
+ return 0;
+}
+
+void *lutil_checkudatap (lua_State *L, int ud, const void *p) {
+ void *up = lua_touserdata(L, ud);
+ if (up != NULL) { /* value is a userdata? */
+ if (lua_getmetatable(L, ud)) { /* does it have a metatable? */
+ lutil_getmetatablep(L,p); /* get correct metatable */
+ if (lua_rawequal(L, -1, -2)) { /* does it have the correct mt? */
+ lua_pop(L, 2); /* remove both metatables */
+ return up;
+ }
+ }
+ }
+ luaL_typerror(L, ud, p); /* else error */
+ return NULL; /* to avoid warnings */
+}
+
+int lutil_createmetap (lua_State *L, const void *p, const luaL_Reg *methods) {
+ if (!lutil_newmetatablep(L, p))
+ return 0;
+
+ /* define methods */
+ luaL_setfuncs (L, methods, 0);
+
+ /* define metamethods */
+ lua_pushliteral (L, "__index");
+ lua_pushvalue (L, -2);
+ lua_settable (L, -3);
+
+ return 1;
+}
+
+void *lutil_newudatap_impl(lua_State *L, size_t size, const void *p){
+ void *obj = lua_newuserdata (L, size);
+ memset(obj, 0, size);
+ lutil_setmetatablep(L, p);
+ return obj;
+}
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/l52util.h b/3rdparty/lua/src/modules/lua-winreg/src/l52util.h
index 6391307..7403f06 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/l52util.h
+++ b/3rdparty/lua/src/modules/lua-winreg/src/l52util.h
@@ -1,46 +1,46 @@
-#ifndef _LZUTILS_H_
-#define _LZUTILS_H_
-
-#include "lua.h"
-#include "lauxlib.h"
-
-#if LUA_VERSION_NUM >= 502 // lua 5.2
-
-// lua_rawgetp
-// lua_rawsetp
-// luaL_setfuncs
-// lua_absindex
-
-
-#define lua_objlen lua_rawlen
-
-int luaL_typerror (lua_State *L, int narg, const char *tname);
-
-void luaL_register (lua_State *L, const char *libname, const luaL_Reg *l);
-
-#else // lua 5.1
-
-// functions form lua 5.2
-
-# define lua_absindex(L, i) (((i)>0)?(i):((i)<=LUA_REGISTRYINDEX?(i):(lua_gettop(L)+(i)+1)))
-# define lua_rawlen lua_objlen
-
-void lua_rawgetp (lua_State *L, int index, const void *p);
-void lua_rawsetp (lua_State *L, int index, const void *p);
-void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup);
-
-#endif
-
-int lutil_newmetatablep (lua_State *L, const void *p);
-void lutil_getmetatablep (lua_State *L, const void *p);
-void lutil_setmetatablep (lua_State *L, const void *p);
-
-#define lutil_newudatap(L, TTYPE, TNAME) (TTYPE *)lutil_newudatap_impl(L, sizeof(TTYPE), TNAME)
-int lutil_isudatap (lua_State *L, int ud, const void *p);
-void *lutil_checkudatap (lua_State *L, int ud, const void *p);
-int lutil_createmetap (lua_State *L, const void *p, const luaL_Reg *methods);
-
-void *lutil_newudatap_impl (lua_State *L, size_t size, const void *p);
-
-#endif
-
+#ifndef _LZUTILS_H_
+#define _LZUTILS_H_
+
+#include "lua.h"
+#include "lauxlib.h"
+
+#if LUA_VERSION_NUM >= 502 // lua 5.2
+
+// lua_rawgetp
+// lua_rawsetp
+// luaL_setfuncs
+// lua_absindex
+
+
+#define lua_objlen lua_rawlen
+
+int luaL_typerror (lua_State *L, int narg, const char *tname);
+
+void luaL_register (lua_State *L, const char *libname, const luaL_Reg *l);
+
+#else // lua 5.1
+
+// functions form lua 5.2
+
+# define lua_absindex(L, i) (((i)>0)?(i):((i)<=LUA_REGISTRYINDEX?(i):(lua_gettop(L)+(i)+1)))
+# define lua_rawlen lua_objlen
+
+void lua_rawgetp (lua_State *L, int index, const void *p);
+void lua_rawsetp (lua_State *L, int index, const void *p);
+void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup);
+
+#endif
+
+int lutil_newmetatablep (lua_State *L, const void *p);
+void lutil_getmetatablep (lua_State *L, const void *p);
+void lutil_setmetatablep (lua_State *L, const void *p);
+
+#define lutil_newudatap(L, TTYPE, TNAME) (TTYPE *)lutil_newudatap_impl(L, sizeof(TTYPE), TNAME)
+int lutil_isudatap (lua_State *L, int ud, const void *p);
+void *lutil_checkudatap (lua_State *L, int ud, const void *p);
+int lutil_createmetap (lua_State *L, const void *p, const luaL_Reg *methods);
+
+void *lutil_newudatap_impl (lua_State *L, size_t size, const void *p);
+
+#endif
+
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/lua_int64.c b/3rdparty/lua/src/modules/lua-winreg/src/lua_int64.c
index 3739b37..d33e5c2 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/lua_int64.c
+++ b/3rdparty/lua/src/modules/lua-winreg/src/lua_int64.c
@@ -1,114 +1,114 @@
-#include <windows.h>
-#include <lua.h>
-#include <lualib.h>
-#include <lauxlib.h>
-#include "luamacro.h"
-#include "stdmacro.h"
-
-// from NSIS source code
-
-int atoINT64(const char* s, INT64 *pv){
- *pv = 0;
- if (*s == '0' && (s[1] == 'x' || s[1] == 'X') && ISXDIGIT(s[2])){
- s++;
- for(;;){
- int c = *(++s);
- if (c >= '0' && c <= '9') c -= '0';
- else if (c >= 'a' && c <= 'f') c -= 'a' - 10;
- else if (c >= 'A' && c <= 'F') c -= 'A' - 10;
- else if (c == 0) break;
- else return 0;
- *pv <<= 4;
- *pv += c;
- }
- }else if (*s == '0' && ISODIGIT(s[1])){
- for(;;){
- int c = *(++s);
- if (c >= '0' && c <= '7')c -= '0';
- else if (c == 0) break;
- else return 0;
- *pv <<= 3;
- *pv += c;
- }
- }else if ((*s == '-' && ISDIGIT(s[1])) || ISDIGIT(s[0])){
- int sign = 0;
- if (*s == '-') sign++; else s--;
- for (;;){
- int c = *(++s);
- if (c >= '0' && c <= '9')c -= '0';
- else if (c == 0) break;
- else return 0;
- *pv *= 10;
- *pv += c;
- }
- if (sign) *pv = -*pv;
- }else{
- return 0;
- }
- return 1;
-}
-
-int atoUINT64(const char* s, UINT64 * pv){
- *pv = 0;
- if (*s == '0' && (s[1] == 'x' || s[1] == 'X') && ISXDIGIT(s[2])){
- s++;
- for(;;){
- int c = *(++s);
- if (c >= '0' && c <= '9') c -= '0';
- else if (c >= 'a' && c <= 'f') c -= 'a' - 10;
- else if (c >= 'A' && c <= 'F') c -= 'A' - 10;
- else if (c == 0) break;
- else return 0;
- *pv <<= 4;
- *pv += c;
- }
- }else if (*s == '0' && ISODIGIT(s[1])){
- for(;;){
- int c = *(++s);
- if (c >= '0' && c <= '7')c -= '0';
- else if (c == 0) break;
- else return 0;
- *pv <<= 3;
- *pv += c;
- }
- }else if ((*s == '-' && ISDIGIT(s[1])) || ISDIGIT(s[0])){
- if(*s == '-'){
- INT64 iv;
- if(atoINT64(s, &iv)){
- *pv = (UINT64)iv;
- }else{
- return 0;
- }
- }else{
- for (;;){
- int c = *(++s);
- if (c >= '0' && c <= '9')c -= '0';
- else if (c == 0) break;
- else return 0;
- *pv *= 10;
- *pv += c;
- }
- }
- }else{
- return 0;
- }
- return 1;
-}
-
-INT64 lua_checkINT64(lua_State *L, int i){
- INT64 v;
- if(lua_isrealstring(L, i) && atoINT64(lua_tostring(L, i), &v)){
- return v;
- }else{
- return (INT64)luaL_checknumber(L, i);
- }
-}
-
-UINT64 lua_checkUINT64(lua_State *L, int i){
- UINT64 v;
- if(lua_isrealstring(L, i) && atoUINT64(lua_tostring(L, i), &v)){
- return v;
- }else{
- return (UINT64)luaL_checknumber(L, i);
- }
+#include <windows.h>
+#include <lua.h>
+#include <lualib.h>
+#include <lauxlib.h>
+#include "luamacro.h"
+#include "stdmacro.h"
+
+// from NSIS source code
+
+int atoINT64(const char* s, INT64 *pv){
+ *pv = 0;
+ if (*s == '0' && (s[1] == 'x' || s[1] == 'X') && ISXDIGIT(s[2])){
+ s++;
+ for(;;){
+ int c = *(++s);
+ if (c >= '0' && c <= '9') c -= '0';
+ else if (c >= 'a' && c <= 'f') c -= 'a' - 10;
+ else if (c >= 'A' && c <= 'F') c -= 'A' - 10;
+ else if (c == 0) break;
+ else return 0;
+ *pv <<= 4;
+ *pv += c;
+ }
+ }else if (*s == '0' && ISODIGIT(s[1])){
+ for(;;){
+ int c = *(++s);
+ if (c >= '0' && c <= '7')c -= '0';
+ else if (c == 0) break;
+ else return 0;
+ *pv <<= 3;
+ *pv += c;
+ }
+ }else if ((*s == '-' && ISDIGIT(s[1])) || ISDIGIT(s[0])){
+ int sign = 0;
+ if (*s == '-') sign++; else s--;
+ for (;;){
+ int c = *(++s);
+ if (c >= '0' && c <= '9')c -= '0';
+ else if (c == 0) break;
+ else return 0;
+ *pv *= 10;
+ *pv += c;
+ }
+ if (sign) *pv = -*pv;
+ }else{
+ return 0;
+ }
+ return 1;
+}
+
+int atoUINT64(const char* s, UINT64 * pv){
+ *pv = 0;
+ if (*s == '0' && (s[1] == 'x' || s[1] == 'X') && ISXDIGIT(s[2])){
+ s++;
+ for(;;){
+ int c = *(++s);
+ if (c >= '0' && c <= '9') c -= '0';
+ else if (c >= 'a' && c <= 'f') c -= 'a' - 10;
+ else if (c >= 'A' && c <= 'F') c -= 'A' - 10;
+ else if (c == 0) break;
+ else return 0;
+ *pv <<= 4;
+ *pv += c;
+ }
+ }else if (*s == '0' && ISODIGIT(s[1])){
+ for(;;){
+ int c = *(++s);
+ if (c >= '0' && c <= '7')c -= '0';
+ else if (c == 0) break;
+ else return 0;
+ *pv <<= 3;
+ *pv += c;
+ }
+ }else if ((*s == '-' && ISDIGIT(s[1])) || ISDIGIT(s[0])){
+ if(*s == '-'){
+ INT64 iv;
+ if(atoINT64(s, &iv)){
+ *pv = (UINT64)iv;
+ }else{
+ return 0;
+ }
+ }else{
+ for (;;){
+ int c = *(++s);
+ if (c >= '0' && c <= '9')c -= '0';
+ else if (c == 0) break;
+ else return 0;
+ *pv *= 10;
+ *pv += c;
+ }
+ }
+ }else{
+ return 0;
+ }
+ return 1;
+}
+
+INT64 lua_checkINT64(lua_State *L, int i){
+ INT64 v;
+ if(lua_isrealstring(L, i) && atoINT64(lua_tostring(L, i), &v)){
+ return v;
+ }else{
+ return (INT64)luaL_checknumber(L, i);
+ }
+}
+
+UINT64 lua_checkUINT64(lua_State *L, int i){
+ UINT64 v;
+ if(lua_isrealstring(L, i) && atoUINT64(lua_tostring(L, i), &v)){
+ return v;
+ }else{
+ return (UINT64)luaL_checknumber(L, i);
+ }
} \ No newline at end of file
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/lua_int64.h b/3rdparty/lua/src/modules/lua-winreg/src/lua_int64.h
index 392d7d9..56a3396 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/lua_int64.h
+++ b/3rdparty/lua/src/modules/lua-winreg/src/lua_int64.h
@@ -1,52 +1,52 @@
-#ifndef __LUA_INT64_H___
-#define __LUA_INT64_H___
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <windows.h>
-#include <stdlib.h> //lua_push?INT64
-#include <lua.h>
-#include <lualib.h>
-#include <lauxlib.h>
-
-UINT64 lua_checkUINT64(lua_State *L, int i);
-INT64 lua_checkINT64(lua_State *L, int i);
-int atoUINT64(const char* s, UINT64 * pv);
-int atoINT64(const char* s, INT64 *pv);
-
-#ifdef __GNUC__
- #define CONST_9007199254740992 0x20000000000000LL
-#else
- #define CONST_9007199254740992 9007199254740992
-#endif
-
-#ifdef _DEBUG
-#define lua_dllerrorX(L,code,expr,fname,lineno) lua_dllerror(L,code,expr,fname,lineno)
-#else
-#define lua_dllerrorX(L,code,expr,fname,lineno) lua_dllerror(L,code)
-#endif // _DEBUG
-
-#define lua_pushUINT64(L,n,expr,fname,lineno) \
- if( n > CONST_9007199254740992 ){ \
- char buf[24]; \
- if(0 == _ui64toa_s(n, buf, _countof(buf) - 1, 10)) \
- lua_pushstring(L, buf); \
- else \
- lua_dllerrorX(L, ERROR_INVALID_DATA, expr, fname, lineno); \
- }else{ \
- lua_pushnumber(L, (lua_Number)(__int64)n); \
- }
-
-#define lua_pushINT64(L,n) \
- if(n > 9007199254740992 || n < -9007199254740992){ \
- char buf[24]; \
- lua_pushstring(L, _i64toa_s(n, buf, 10)); \
- }else{ \
- lua_pushnumber(L, (lua_Number)n); \
- }
-
-#ifdef __cplusplus
-}
-#endif
-#endif //__LUA_INT64_H___
+#ifndef __LUA_INT64_H___
+#define __LUA_INT64_H___
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <windows.h>
+#include <stdlib.h> //lua_push?INT64
+#include <lua.h>
+#include <lualib.h>
+#include <lauxlib.h>
+
+UINT64 lua_checkUINT64(lua_State *L, int i);
+INT64 lua_checkINT64(lua_State *L, int i);
+int atoUINT64(const char* s, UINT64 * pv);
+int atoINT64(const char* s, INT64 *pv);
+
+#ifdef __GNUC__
+ #define CONST_9007199254740992 0x20000000000000LL
+#else
+ #define CONST_9007199254740992 9007199254740992
+#endif
+
+#ifdef _DEBUG
+#define lua_dllerrorX(L,code,expr,fname,lineno) lua_dllerror(L,code,expr,fname,lineno)
+#else
+#define lua_dllerrorX(L,code,expr,fname,lineno) lua_dllerror(L,code)
+#endif // _DEBUG
+
+#define lua_pushUINT64(L,n,expr,fname,lineno) \
+ if( n > CONST_9007199254740992 ){ \
+ char buf[24]; \
+ if(0 == _ui64toa_s(n, buf, _countof(buf) - 1, 10)) \
+ lua_pushstring(L, buf); \
+ else \
+ lua_dllerrorX(L, ERROR_INVALID_DATA, expr, fname, lineno); \
+ }else{ \
+ lua_pushnumber(L, (lua_Number)(__int64)n); \
+ }
+
+#define lua_pushINT64(L,n) \
+ if(n > 9007199254740992 || n < -9007199254740992){ \
+ char buf[24]; \
+ lua_pushstring(L, _i64toa_s(n, buf, 10)); \
+ }else{ \
+ lua_pushnumber(L, (lua_Number)n); \
+ }
+
+#ifdef __cplusplus
+}
+#endif
+#endif //__LUA_INT64_H___
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/lua_mtutil.c b/3rdparty/lua/src/modules/lua-winreg/src/lua_mtutil.c
index 1e1d3a7..db2e3fb 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/lua_mtutil.c
+++ b/3rdparty/lua/src/modules/lua-winreg/src/lua_mtutil.c
@@ -1,44 +1,44 @@
-#include <lua.h>
-#include <lualib.h>
-#include <lauxlib.h>
-#include "l52util.h"
-
-/* push metatable to stack, create if not yet reg, the metatable of the table is its self */
-int lua_opentablemt(lua_State *L, const char * libname, const luaL_Reg * reg, int upval){
- /*STACK:...<upvals>#*/
- if(luaL_newmetatable(L, libname)){
- /*STACK:...<upvals><tablemt>#*/
- luaL_setfuncs(L, reg, upval);
- lua_pushliteral(L, "__index");
- /*STACK:...<tablemt><"__index">#*/
- lua_pushvalue(L, -2);
- /*STACK:...<tablemt><"__index"><tablemt>#*/
- lua_rawset(L, -3);
- /*STACK:...<tablemt>*/
- return 1;//created
- }
- return 0;//opened, all ready created
-}
-
-/* new user data with metamethods table */
-void * lua_newuserdatamt(lua_State *L, size_t cdata, const char * mtname, const luaL_Reg * mtreg){
- void* pdata = lua_newuserdata(L, cdata);/*STACK:...<udata># */
- lua_opentablemt(L, mtname, mtreg, 0); /*STACK:...<udata><tablemt># */
- lua_setmetatable(L, -2); /*STACK:...<udata># */
- return pdata;
-}
-
-/* new user data with metamethods table and upvalues */
-void * lua_newuserdatamtuv(lua_State *L, size_t cdata, const char * mtname, const luaL_Reg * mtreg, int upval){
- void* pdata;
- /*STACK:...<upvals>#*/
- lua_opentablemt(L, mtname, mtreg, upval);
- /*STACK:...<tablemt>#*/
- pdata = lua_newuserdata(L, cdata);
- /*STACK:...<tablemt><udata>#*/
- lua_insert(L,-2);
- /*STACK:...<udata><tablemt>#*/
- lua_setmetatable(L, -2);
- /*STACK:...<udata>#*/
- return pdata;
+#include <lua.h>
+#include <lualib.h>
+#include <lauxlib.h>
+#include "l52util.h"
+
+/* push metatable to stack, create if not yet reg, the metatable of the table is its self */
+int lua_opentablemt(lua_State *L, const char * libname, const luaL_Reg * reg, int upval){
+ /*STACK:...<upvals>#*/
+ if(luaL_newmetatable(L, libname)){
+ /*STACK:...<upvals><tablemt>#*/
+ luaL_setfuncs(L, reg, upval);
+ lua_pushliteral(L, "__index");
+ /*STACK:...<tablemt><"__index">#*/
+ lua_pushvalue(L, -2);
+ /*STACK:...<tablemt><"__index"><tablemt>#*/
+ lua_rawset(L, -3);
+ /*STACK:...<tablemt>*/
+ return 1;//created
+ }
+ return 0;//opened, all ready created
+}
+
+/* new user data with metamethods table */
+void * lua_newuserdatamt(lua_State *L, size_t cdata, const char * mtname, const luaL_Reg * mtreg){
+ void* pdata = lua_newuserdata(L, cdata);/*STACK:...<udata># */
+ lua_opentablemt(L, mtname, mtreg, 0); /*STACK:...<udata><tablemt># */
+ lua_setmetatable(L, -2); /*STACK:...<udata># */
+ return pdata;
+}
+
+/* new user data with metamethods table and upvalues */
+void * lua_newuserdatamtuv(lua_State *L, size_t cdata, const char * mtname, const luaL_Reg * mtreg, int upval){
+ void* pdata;
+ /*STACK:...<upvals>#*/
+ lua_opentablemt(L, mtname, mtreg, upval);
+ /*STACK:...<tablemt>#*/
+ pdata = lua_newuserdata(L, cdata);
+ /*STACK:...<tablemt><udata>#*/
+ lua_insert(L,-2);
+ /*STACK:...<udata><tablemt>#*/
+ lua_setmetatable(L, -2);
+ /*STACK:...<udata>#*/
+ return pdata;
} \ No newline at end of file
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/lua_mtutil.h b/3rdparty/lua/src/modules/lua-winreg/src/lua_mtutil.h
index e8a2681..97fae38 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/lua_mtutil.h
+++ b/3rdparty/lua/src/modules/lua-winreg/src/lua_mtutil.h
@@ -1,16 +1,16 @@
-#ifndef __LUA_MTUTIL_H___
-#define __LUA_MTUTIL_H___
-#ifdef __cplusplus
-extern "C" {
-#endif
-#include <lua.h>
-#include <lualib.h>
-#include <lauxlib.h>
-
-int lua_opentablemt(lua_State *L, const char * libname, const luaL_Reg * reg, int upval);
-void * lua_newuserdatamt(lua_State *L, size_t cdata, const char * mtname, const luaL_Reg * mtreg);
-void * lua_newuserdatamtuv(lua_State *L, size_t cdata, const char * mtname, const luaL_Reg * mtreg, int upval);
-#ifdef __cplusplus
-}
-#endif
-#endif //__LUA_MTUTIL_H___
+#ifndef __LUA_MTUTIL_H___
+#define __LUA_MTUTIL_H___
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include <lua.h>
+#include <lualib.h>
+#include <lauxlib.h>
+
+int lua_opentablemt(lua_State *L, const char * libname, const luaL_Reg * reg, int upval);
+void * lua_newuserdatamt(lua_State *L, size_t cdata, const char * mtname, const luaL_Reg * mtreg);
+void * lua_newuserdatamtuv(lua_State *L, size_t cdata, const char * mtname, const luaL_Reg * mtreg, int upval);
+#ifdef __cplusplus
+}
+#endif
+#endif //__LUA_MTUTIL_H___
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/lua_tstring.c b/3rdparty/lua/src/modules/lua-winreg/src/lua_tstring.c
index 8a24cfe..5a96413 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/lua_tstring.c
+++ b/3rdparty/lua/src/modules/lua-winreg/src/lua_tstring.c
@@ -1,375 +1,375 @@
-#include <limits.h>
-#include <string.h>
-#include <lua.h>
-#include <lualib.h>
-#include <lauxlib.h>
-
-#include "luamacro.h"
-
-size_t lua_utf8towcsZ(lua_State *L, const char *s, int len){
- wchar_t UNCH = 0;
- size_t cchWC = 0; // # of wchar_t code points generated
- const unsigned char * pUTF8 = (const unsigned char *)s;
- const unsigned char * pEnd = (const unsigned char *)(s + len);
- luaL_Buffer b;
- luaL_buffinit(L, &b);
- while (pUTF8 < pEnd){
- // See if there are any trail bytes.
- if (*pUTF8 < 0xC0) {// 192
- // Found ASCII.
- UNCH = pUTF8[0];
- }else if (pUTF8[0] < 0xE0){ //224
- if ((pUTF8[1] & 0xC0) == 0x80) {
- /* A two-byte-character lead-byte not followed by trail-byte represents itself.*/
- UNCH = (wchar_t) (((pUTF8[0] & 0x1F) << 6) | (pUTF8[1] & 0x3F));
- pUTF8 += 1;
- }else{
- /* A two-byte-character lead-byte not followed by trail-byte represents itself. */
- UNCH = pUTF8[0];
- }
- }else if (pUTF8[0] < 0xF0) {//240
- if (((pUTF8[1] & 0xC0) == 0x80) && ((pUTF8[2] & 0xC0) == 0x80)) {
- /* Three-byte-character lead byte followed by two trail bytes.*/
- UNCH = (wchar_t) (((pUTF8[0] & 0x0F) << 12) | ((pUTF8[1] & 0x3F) << 6) | (pUTF8[2] & 0x3F));
- pUTF8 += 2;
- }else{
- /* Three-byte-character lead byte followed by two trail bytes.*/
- UNCH = pUTF8[0];
- }
- }else{
- UNCH = pUTF8[0];
- }
- luaL_addlstring(&b, (const char*)&UNCH, sizeof(wchar_t));
- cchWC++;
- pUTF8++;
- }
- luaL_addchar(&b, '\0');// the other '\0' will be added by lua
- luaL_pushresult(&b);
- // Return the number of wchar_t characters written.
- return (cchWC);
-}
-
-size_t lua_utf8towcs(lua_State *L, const char *s, int len){
- wchar_t UNCH = 0;
- size_t cchWC = 0; // # of wchar_t code points generated
- const unsigned char * pUTF8 = (const unsigned char *)s;
- const unsigned char * pEnd = (const unsigned char *)(s + len);
- luaL_Buffer b;
- luaL_buffinit(L, &b);
- while (pUTF8 < pEnd){
- // See if there are any trail bytes.
- if (*pUTF8 < 0xC0) {// 192
- // Found ASCII.
- UNCH = pUTF8[0];
- }else if (pUTF8[0] < 0xE0){ //224
- if ((pUTF8[1] & 0xC0) == 0x80) {
- /* A two-byte-character lead-byte not followed by trail-byte represents itself.*/
- UNCH = (wchar_t) (((pUTF8[0] & 0x1F) << 6) | (pUTF8[1] & 0x3F));
- pUTF8 += 1;
- }else{
- /* A two-byte-character lead-byte not followed by trail-byte represents itself. */
- UNCH = pUTF8[0];
- }
- }else if (pUTF8[0] < 0xF0) {//240
- if (((pUTF8[1] & 0xC0) == 0x80) && ((pUTF8[2] & 0xC0) == 0x80)) {
- /* Three-byte-character lead byte followed by two trail bytes.*/
- UNCH = (wchar_t) (((pUTF8[0] & 0x0F) << 12) | ((pUTF8[1] & 0x3F) << 6) | (pUTF8[2] & 0x3F));
- pUTF8 += 2;
- }else{
- /* Three-byte-character lead byte followed by two trail bytes.*/
- UNCH = pUTF8[0];
- }
- }else{
- UNCH = pUTF8[0];
- }
- luaL_addlstring(&b, (const char*)&UNCH, sizeof(wchar_t));
- cchWC++;
- pUTF8++;
- }
- luaL_pushresult(&b);
- // Return the number of wchar_t characters written.
- return (cchWC);
-}
-
-// Constant Declarations.
-#define ASCII 0x007f
-#define UTF8_2_MAX 0x07ff // max UTF8 2-byte sequence (32 * 64 = 2048)
-#define UTF8_1ST_OF_2 0xc0 // 110x xxxx
-#define UTF8_1ST_OF_3 0xe0 // 1110 xxxx
-#define UTF8_TRAIL 0x80 // 10xx xxxx
-#define HIGER_6_BIT(u) ((u) >> 12)
-#define MIDDLE_6_BIT(u) (((u) & 0x0fc0) >> 6)
-#define LOWER_6_BIT(u) ((u) & 0x003f)
-
-#ifndef HIBYTE
-#define BYTE unsigned char
-#define HIBYTE(w) ((BYTE) (((wchar_t) (w) >> 8) & 0xFF))
-#define LOBYTE(w) ((BYTE) (w))
-#endif
-
-// Maps a wchar_t character string to its UTF-8 string counterpart.
-size_t lua_wcstoutf8(lua_State *L, const wchar_t *s, size_t cchSrc){
- const wchar_t * lpWC = s;
- size_t cchU8 = 0; // # of UTF8 chars generated
-
- luaL_Buffer b;
- luaL_buffinit(L, &b);
-
- while (cchSrc--) {
- if (*lpWC <= ASCII){
- // Found ASCII.
- luaL_addchar(&b, (char)*lpWC);
- cchU8++;
- }else if (*lpWC <= UTF8_2_MAX){
- // Found 2 byte sequence if < 0x07ff (11 bits).
- // Use upper 5 bits in first byte.
- // Use lower 6 bits in second byte.
- luaL_addchar(&b, (char)(UTF8_1ST_OF_2 | (*lpWC >> 6)));
- luaL_addchar(&b, (char)(UTF8_TRAIL | LOWER_6_BIT(*lpWC)));
- cchU8 += 2;
- }else{
- // Found 3 byte sequence.
- // Use upper 4 bits in first byte.
- // Use middle 6 bits in second byte.
- // Use lower 6 bits in third byte.
- luaL_addchar(&b, (char)(UTF8_1ST_OF_3 | (*lpWC >> 12)));
- luaL_addchar(&b, (char)(UTF8_TRAIL | MIDDLE_6_BIT(*lpWC)));
- luaL_addchar(&b, (char)(UTF8_TRAIL | LOWER_6_BIT(*lpWC)));
- cchU8 += 3;
- }
- lpWC++;
- }
- luaL_pushresult(&b);
- // Return the number of UTF-8 characters written.
- return (cchU8);
-}
-
-size_t lua_chartowcsZ(lua_State *L, const char *s, int len){
- luaL_Buffer b;
- size_t cchWC = 0;
- wchar_t UNCH = 0;
- const unsigned char * pCur = (const unsigned char *)s;
- const unsigned char * pEnd = (const unsigned char *)(s + len);
- luaL_buffinit(L, &b);
- while (pCur < pEnd){
- UNCH = pCur[0];
- luaL_addlstring(&b, (const char*)&UNCH, sizeof(wchar_t));
- cchWC++;
- pCur++;
- }
- luaL_addchar(&b, '\0');// the other '\0' will be added by lua
- luaL_pushresult(&b);
- // Return the number of wchar_t characters written.
- return (cchWC);
-}
-int wc2utf8(char *d, wchar_t ch){
- if (ch < 0x80) {
- *d++ = (char)ch;
- return 1;
- }
- if (ch < 0x800) {
- *d++ = (char)(( ch >> 6) | 0xc0);
- *d++ = (char)(( ch & 0x3f) | 0x80);
- return 2;
- }
- {
- *d++ = (char)(( ch >> 12) | 0xe0);
- *d++ = (char)(((ch >> 6) & 0x3f) | 0x80);
- *d++ = (char)(( ch & 0x3f) | 0x80);
- return 3;
- }
-}
-// push a wchar_t character value convert equiv utf8 chars
-void lua_pushutf8_from_wchar(lua_State *L, wchar_t ch){
- char buf[4] = {0,0,0,0};
- lua_pushlstring(L, buf, wc2utf8(buf, ch));
-}
-// add a wchar_t character to buffer converted to equiv utf8 chars
-void lua_addutf8_from_wchar(luaL_Buffer * pB, wchar_t ch){
- luaL_addsize(pB, wc2utf8(luaL_prepbuffer (pB), ch));
-}
-// gets an int character value, if string is >= 2 chars checks if utf
-wchar_t lua_checkwchar_from_utf8(lua_State *L, int i){
- const unsigned char* psz = (const unsigned char *)luaL_checkstring(L, i);
- if ((psz[0] && psz[1] == 0) || psz[0] == 0) {
- return psz[0];// single character
- }else if ((psz[0] >= 0xC0) && (psz[0] < 0xE0)
- && (psz[1] & 0xC0) == 0x80
- && (psz[2] == 0)// Two-byte-character lead-byte followed by a trail-byte.
- ){ return (wchar_t)(((psz[0] & 0x1F) << 6) | (psz[1] & 0x3F));
- }else if ((psz[0] >= 0xE0) && (psz[0] < 0xF0)
- && ((psz[1] & 0xC0) == 0x80)
- && ((psz[2] & 0xC0) == 0x80)
- && (psz[3] == 0)// Three-utf-character lead utf followed by two trail bytes.
- ){ return (wchar_t)(((psz[0] & 0x0F) << 12) | ((psz[1] & 0x3F) << 6) | (psz[2] & 0x3F));
- }else{
- luaL_argerror(L, i, "character expected");
- }
- return 0;
-}
-// lua utf8 string to wide string
-const wchar_t *lua_tolwcs_from_utf8(lua_State *L, int narg, size_t* l){
- size_t ulen = 0;
- const char * psz;
- narg = lua_absindex(L, narg);
-#if LUA_VERSION_NUM >= 501
- psz = lua_tolstring(L, narg, &ulen);
-#else
- psz = lua_tostring(L, narg);
- ulen = lua_strlen(L, narg);
-#endif
- if(psz){
- ulen = (size_t)lua_utf8towcsZ(L, psz, (int)ulen);
- if(l)*l = ulen;
- lua_replace (L, narg);
- return (const wchar_t *)lua_tostring(L, narg);
- }else{
- return NULL;
- }
-}
-// lua utf8 string to wide string, with len
-const wchar_t *lua_checklwcs_from_utf8(lua_State *L, int narg, size_t* l){
- size_t ulen = 0;
- const char * psz;
- narg = lua_absindex(L, narg);
- psz = luaL_checklstring(L, narg, &ulen);
- ulen = (size_t)lua_utf8towcsZ(L, psz, (int)ulen);
- if(l)*l = ulen;
- lua_replace (L, narg);
- return (const wchar_t *)lua_tostring(L, narg);
-}
-// lua utf8 string to wide string, with len, optional
-const wchar_t *lua_optlwcs_from_utf8(lua_State *L, int narg, const wchar_t *def, size_t *len){
- if (lua_isnoneornil(L, narg)) {
- if (len)
- *len = (def ? wcslen(def) : 0);
- return def;
- }
- else return lua_checklwcs_from_utf8(L, narg, len);
-}
-// lua push wide string, convert to utf8
-void lua_pushutf8_from_wcs (lua_State *L, const wchar_t *s) {
- if (s == NULL)
- lua_pushnil(L);
- else
- lua_wcstoutf8(L, s, wcslen(s));
-}
-
-
-size_t lua_cstowcsZ(lua_State *L, const char *s, int len){
- wchar_t UNCH = 0;
- size_t cchWC = 0; // # of wchar_t code points generated
- const unsigned char * pStr = (const unsigned char *)s;
- const unsigned char * pEnd = (const unsigned char *)(s + len);
- luaL_Buffer b;
- luaL_buffinit(L, &b);
-
- while (pStr < pEnd){
- UNCH = *pStr;
- luaL_addlstring(&b, (const char*)&UNCH, sizeof(wchar_t));
- cchWC++;
- pStr++;
- }
- luaL_addchar(&b, '\0');// the other '\0' will be added by lua
- luaL_pushresult(&b);
- // Return the number of wchar_t characters written.
- return (cchWC);
-}
-// Lua char string to wide string, with len
-const wchar_t *lua_checklwcs_from_char(lua_State *L, int narg, size_t* l){
- size_t ulen = 0;
- const char * psz;
- narg = lua_absindex(L, narg);
- psz = luaL_checklstring(L, narg, &ulen);
- ulen = (size_t)lua_cstowcsZ(L, psz, (int)ulen);
- if(l)*l = ulen;
- lua_replace (L, narg);
- return (const wchar_t *)lua_tostring(L, narg);
-}
-// Lua char string to wide string, with len, optional
-const wchar_t *lua_optlwcs_from_char (lua_State *L, int narg, const wchar_t *def, size_t *len){
- if (lua_isnoneornil(L, narg)) {
- if (len)
- *len = (def ? wcslen(def) : 0);
- return def;
- }
- else return lua_checklwcs_from_char(L, narg, len);
-}
-// Maps a wchar_t character string to its char string counterpart.
-size_t lua_wcstochar(lua_State *L, const wchar_t *s, size_t cchSrc){
- const wchar_t * lpWC = s;
- size_t cch = 0; // # of UTF8 chars generated
-
- luaL_Buffer b;
- luaL_buffinit(L, &b);
-
- while (cchSrc--) {
- if (*lpWC <= 0x00ff){
- luaL_addchar(&b, (char)*lpWC);
- }else{
- luaL_addchar(&b, '?');// no choice
- }
- cch++;
- lpWC++;
- }
- luaL_pushresult(&b);
- // Return the number of char characters written.
- return (cch);
-}
-
-
-
-
-
-
-
-/*
-size_t lua_utf8towcsZ2(lua_State *L, const char *s, int len){
- size_t cchWC = 0; // # of wchar_t code points generated
- const unsigned char * pUTF8 = (const unsigned char *)s;
- const unsigned char * pEnd = (const unsigned char *)(s + len);
- wchar_t * pBuf = NULL;
- const wchar_t * pBuf0 = NULL;
- const wchar_t * pBuf1 = NULL;
- luaL_Buffer b;
- luaL_buffinit(L, &b);
- while (pUTF8 < pEnd){
- pBuf = (wchar_t *)luaL_prepbuffer(&b);
- pBuf0 = pBuf;
- pBuf1 = pBuf + (LUAL_BUFFERSIZE-sizeof(wchar_t));
- while(pUTF8 < pEnd && pBuf <= pBuf1){
- // See if there are any trail bytes.
- if (*pUTF8 < 0xC0) {// 192
- // Found ASCII.
- *pBuf++ = pUTF8[0];
- }else if (pUTF8[0] < 0xE0){ //224
- if ((pUTF8[1] & 0xC0) == 0x80) {
- // A two-byte-character lead-byte not followed by trail-byte represents itself.
- *pBuf++ = (wchar_t) (((pUTF8[0] & 0x1F) << 6) | (pUTF8[1] & 0x3F));
- pUTF8 += 1;
- }else{
- // A two-byte-character lead-byte not followed by trail-byte represents itself.
- *pBuf++ = pUTF8[0];
- }
- }else if (pUTF8[0] < 0xF0) {//240
- if (((pUTF8[1] & 0xC0) == 0x80) && ((pUTF8[2] & 0xC0) == 0x80)) {
- // Three-byte-character lead byte followed by two trail bytes.
- *pBuf++ = (wchar_t) (((pUTF8[0] & 0x0F) << 12) | ((pUTF8[1] & 0x3F) << 6) | (pUTF8[2] & 0x3F));
- pUTF8 += 2;
- }else{
- // Three-byte-character lead byte followed by two trail bytes.
- *pBuf++ = pUTF8[0];
- }
- }else{
- *pBuf++ = pUTF8[0];
- }
- cchWC++;
- pUTF8++;
- }
- luaL_addsize(&b, (size_t)(pBuf0 - pBuf));
- }
- luaL_addchar(&b, '\0');// the other '\0' will be added by lua
- luaL_pushresult(&b);
- // Return the number of wchar_t characters written.
- return (cchWC);
+#include <limits.h>
+#include <string.h>
+#include <lua.h>
+#include <lualib.h>
+#include <lauxlib.h>
+
+#include "luamacro.h"
+
+size_t lua_utf8towcsZ(lua_State *L, const char *s, int len){
+ wchar_t UNCH = 0;
+ size_t cchWC = 0; // # of wchar_t code points generated
+ const unsigned char * pUTF8 = (const unsigned char *)s;
+ const unsigned char * pEnd = (const unsigned char *)(s + len);
+ luaL_Buffer b;
+ luaL_buffinit(L, &b);
+ while (pUTF8 < pEnd){
+ // See if there are any trail bytes.
+ if (*pUTF8 < 0xC0) {// 192
+ // Found ASCII.
+ UNCH = pUTF8[0];
+ }else if (pUTF8[0] < 0xE0){ //224
+ if ((pUTF8[1] & 0xC0) == 0x80) {
+ /* A two-byte-character lead-byte not followed by trail-byte represents itself.*/
+ UNCH = (wchar_t) (((pUTF8[0] & 0x1F) << 6) | (pUTF8[1] & 0x3F));
+ pUTF8 += 1;
+ }else{
+ /* A two-byte-character lead-byte not followed by trail-byte represents itself. */
+ UNCH = pUTF8[0];
+ }
+ }else if (pUTF8[0] < 0xF0) {//240
+ if (((pUTF8[1] & 0xC0) == 0x80) && ((pUTF8[2] & 0xC0) == 0x80)) {
+ /* Three-byte-character lead byte followed by two trail bytes.*/
+ UNCH = (wchar_t) (((pUTF8[0] & 0x0F) << 12) | ((pUTF8[1] & 0x3F) << 6) | (pUTF8[2] & 0x3F));
+ pUTF8 += 2;
+ }else{
+ /* Three-byte-character lead byte followed by two trail bytes.*/
+ UNCH = pUTF8[0];
+ }
+ }else{
+ UNCH = pUTF8[0];
+ }
+ luaL_addlstring(&b, (const char*)&UNCH, sizeof(wchar_t));
+ cchWC++;
+ pUTF8++;
+ }
+ luaL_addchar(&b, '\0');// the other '\0' will be added by lua
+ luaL_pushresult(&b);
+ // Return the number of wchar_t characters written.
+ return (cchWC);
+}
+
+size_t lua_utf8towcs(lua_State *L, const char *s, int len){
+ wchar_t UNCH = 0;
+ size_t cchWC = 0; // # of wchar_t code points generated
+ const unsigned char * pUTF8 = (const unsigned char *)s;
+ const unsigned char * pEnd = (const unsigned char *)(s + len);
+ luaL_Buffer b;
+ luaL_buffinit(L, &b);
+ while (pUTF8 < pEnd){
+ // See if there are any trail bytes.
+ if (*pUTF8 < 0xC0) {// 192
+ // Found ASCII.
+ UNCH = pUTF8[0];
+ }else if (pUTF8[0] < 0xE0){ //224
+ if ((pUTF8[1] & 0xC0) == 0x80) {
+ /* A two-byte-character lead-byte not followed by trail-byte represents itself.*/
+ UNCH = (wchar_t) (((pUTF8[0] & 0x1F) << 6) | (pUTF8[1] & 0x3F));
+ pUTF8 += 1;
+ }else{
+ /* A two-byte-character lead-byte not followed by trail-byte represents itself. */
+ UNCH = pUTF8[0];
+ }
+ }else if (pUTF8[0] < 0xF0) {//240
+ if (((pUTF8[1] & 0xC0) == 0x80) && ((pUTF8[2] & 0xC0) == 0x80)) {
+ /* Three-byte-character lead byte followed by two trail bytes.*/
+ UNCH = (wchar_t) (((pUTF8[0] & 0x0F) << 12) | ((pUTF8[1] & 0x3F) << 6) | (pUTF8[2] & 0x3F));
+ pUTF8 += 2;
+ }else{
+ /* Three-byte-character lead byte followed by two trail bytes.*/
+ UNCH = pUTF8[0];
+ }
+ }else{
+ UNCH = pUTF8[0];
+ }
+ luaL_addlstring(&b, (const char*)&UNCH, sizeof(wchar_t));
+ cchWC++;
+ pUTF8++;
+ }
+ luaL_pushresult(&b);
+ // Return the number of wchar_t characters written.
+ return (cchWC);
+}
+
+// Constant Declarations.
+#define ASCII 0x007f
+#define UTF8_2_MAX 0x07ff // max UTF8 2-byte sequence (32 * 64 = 2048)
+#define UTF8_1ST_OF_2 0xc0 // 110x xxxx
+#define UTF8_1ST_OF_3 0xe0 // 1110 xxxx
+#define UTF8_TRAIL 0x80 // 10xx xxxx
+#define HIGER_6_BIT(u) ((u) >> 12)
+#define MIDDLE_6_BIT(u) (((u) & 0x0fc0) >> 6)
+#define LOWER_6_BIT(u) ((u) & 0x003f)
+
+#ifndef HIBYTE
+#define BYTE unsigned char
+#define HIBYTE(w) ((BYTE) (((wchar_t) (w) >> 8) & 0xFF))
+#define LOBYTE(w) ((BYTE) (w))
+#endif
+
+// Maps a wchar_t character string to its UTF-8 string counterpart.
+size_t lua_wcstoutf8(lua_State *L, const wchar_t *s, size_t cchSrc){
+ const wchar_t * lpWC = s;
+ size_t cchU8 = 0; // # of UTF8 chars generated
+
+ luaL_Buffer b;
+ luaL_buffinit(L, &b);
+
+ while (cchSrc--) {
+ if (*lpWC <= ASCII){
+ // Found ASCII.
+ luaL_addchar(&b, (char)*lpWC);
+ cchU8++;
+ }else if (*lpWC <= UTF8_2_MAX){
+ // Found 2 byte sequence if < 0x07ff (11 bits).
+ // Use upper 5 bits in first byte.
+ // Use lower 6 bits in second byte.
+ luaL_addchar(&b, (char)(UTF8_1ST_OF_2 | (*lpWC >> 6)));
+ luaL_addchar(&b, (char)(UTF8_TRAIL | LOWER_6_BIT(*lpWC)));
+ cchU8 += 2;
+ }else{
+ // Found 3 byte sequence.
+ // Use upper 4 bits in first byte.
+ // Use middle 6 bits in second byte.
+ // Use lower 6 bits in third byte.
+ luaL_addchar(&b, (char)(UTF8_1ST_OF_3 | (*lpWC >> 12)));
+ luaL_addchar(&b, (char)(UTF8_TRAIL | MIDDLE_6_BIT(*lpWC)));
+ luaL_addchar(&b, (char)(UTF8_TRAIL | LOWER_6_BIT(*lpWC)));
+ cchU8 += 3;
+ }
+ lpWC++;
+ }
+ luaL_pushresult(&b);
+ // Return the number of UTF-8 characters written.
+ return (cchU8);
+}
+
+size_t lua_chartowcsZ(lua_State *L, const char *s, int len){
+ luaL_Buffer b;
+ size_t cchWC = 0;
+ wchar_t UNCH = 0;
+ const unsigned char * pCur = (const unsigned char *)s;
+ const unsigned char * pEnd = (const unsigned char *)(s + len);
+ luaL_buffinit(L, &b);
+ while (pCur < pEnd){
+ UNCH = pCur[0];
+ luaL_addlstring(&b, (const char*)&UNCH, sizeof(wchar_t));
+ cchWC++;
+ pCur++;
+ }
+ luaL_addchar(&b, '\0');// the other '\0' will be added by lua
+ luaL_pushresult(&b);
+ // Return the number of wchar_t characters written.
+ return (cchWC);
+}
+int wc2utf8(char *d, wchar_t ch){
+ if (ch < 0x80) {
+ *d++ = (char)ch;
+ return 1;
+ }
+ if (ch < 0x800) {
+ *d++ = (char)(( ch >> 6) | 0xc0);
+ *d++ = (char)(( ch & 0x3f) | 0x80);
+ return 2;
+ }
+ {
+ *d++ = (char)(( ch >> 12) | 0xe0);
+ *d++ = (char)(((ch >> 6) & 0x3f) | 0x80);
+ *d++ = (char)(( ch & 0x3f) | 0x80);
+ return 3;
+ }
+}
+// push a wchar_t character value convert equiv utf8 chars
+void lua_pushutf8_from_wchar(lua_State *L, wchar_t ch){
+ char buf[4] = {0,0,0,0};
+ lua_pushlstring(L, buf, wc2utf8(buf, ch));
+}
+// add a wchar_t character to buffer converted to equiv utf8 chars
+void lua_addutf8_from_wchar(luaL_Buffer * pB, wchar_t ch){
+ luaL_addsize(pB, wc2utf8(luaL_prepbuffer (pB), ch));
+}
+// gets an int character value, if string is >= 2 chars checks if utf
+wchar_t lua_checkwchar_from_utf8(lua_State *L, int i){
+ const unsigned char* psz = (const unsigned char *)luaL_checkstring(L, i);
+ if ((psz[0] && psz[1] == 0) || psz[0] == 0) {
+ return psz[0];// single character
+ }else if ((psz[0] >= 0xC0) && (psz[0] < 0xE0)
+ && (psz[1] & 0xC0) == 0x80
+ && (psz[2] == 0)// Two-byte-character lead-byte followed by a trail-byte.
+ ){ return (wchar_t)(((psz[0] & 0x1F) << 6) | (psz[1] & 0x3F));
+ }else if ((psz[0] >= 0xE0) && (psz[0] < 0xF0)
+ && ((psz[1] & 0xC0) == 0x80)
+ && ((psz[2] & 0xC0) == 0x80)
+ && (psz[3] == 0)// Three-utf-character lead utf followed by two trail bytes.
+ ){ return (wchar_t)(((psz[0] & 0x0F) << 12) | ((psz[1] & 0x3F) << 6) | (psz[2] & 0x3F));
+ }else{
+ luaL_argerror(L, i, "character expected");
+ }
+ return 0;
+}
+// lua utf8 string to wide string
+const wchar_t *lua_tolwcs_from_utf8(lua_State *L, int narg, size_t* l){
+ size_t ulen = 0;
+ const char * psz;
+ narg = lua_absindex(L, narg);
+#if LUA_VERSION_NUM >= 501
+ psz = lua_tolstring(L, narg, &ulen);
+#else
+ psz = lua_tostring(L, narg);
+ ulen = lua_strlen(L, narg);
+#endif
+ if(psz){
+ ulen = (size_t)lua_utf8towcsZ(L, psz, (int)ulen);
+ if(l)*l = ulen;
+ lua_replace (L, narg);
+ return (const wchar_t *)lua_tostring(L, narg);
+ }else{
+ return NULL;
+ }
+}
+// lua utf8 string to wide string, with len
+const wchar_t *lua_checklwcs_from_utf8(lua_State *L, int narg, size_t* l){
+ size_t ulen = 0;
+ const char * psz;
+ narg = lua_absindex(L, narg);
+ psz = luaL_checklstring(L, narg, &ulen);
+ ulen = (size_t)lua_utf8towcsZ(L, psz, (int)ulen);
+ if(l)*l = ulen;
+ lua_replace (L, narg);
+ return (const wchar_t *)lua_tostring(L, narg);
+}
+// lua utf8 string to wide string, with len, optional
+const wchar_t *lua_optlwcs_from_utf8(lua_State *L, int narg, const wchar_t *def, size_t *len){
+ if (lua_isnoneornil(L, narg)) {
+ if (len)
+ *len = (def ? wcslen(def) : 0);
+ return def;
+ }
+ else return lua_checklwcs_from_utf8(L, narg, len);
+}
+// lua push wide string, convert to utf8
+void lua_pushutf8_from_wcs (lua_State *L, const wchar_t *s) {
+ if (s == NULL)
+ lua_pushnil(L);
+ else
+ lua_wcstoutf8(L, s, wcslen(s));
+}
+
+
+size_t lua_cstowcsZ(lua_State *L, const char *s, int len){
+ wchar_t UNCH = 0;
+ size_t cchWC = 0; // # of wchar_t code points generated
+ const unsigned char * pStr = (const unsigned char *)s;
+ const unsigned char * pEnd = (const unsigned char *)(s + len);
+ luaL_Buffer b;
+ luaL_buffinit(L, &b);
+
+ while (pStr < pEnd){
+ UNCH = *pStr;
+ luaL_addlstring(&b, (const char*)&UNCH, sizeof(wchar_t));
+ cchWC++;
+ pStr++;
+ }
+ luaL_addchar(&b, '\0');// the other '\0' will be added by lua
+ luaL_pushresult(&b);
+ // Return the number of wchar_t characters written.
+ return (cchWC);
+}
+// Lua char string to wide string, with len
+const wchar_t *lua_checklwcs_from_char(lua_State *L, int narg, size_t* l){
+ size_t ulen = 0;
+ const char * psz;
+ narg = lua_absindex(L, narg);
+ psz = luaL_checklstring(L, narg, &ulen);
+ ulen = (size_t)lua_cstowcsZ(L, psz, (int)ulen);
+ if(l)*l = ulen;
+ lua_replace (L, narg);
+ return (const wchar_t *)lua_tostring(L, narg);
+}
+// Lua char string to wide string, with len, optional
+const wchar_t *lua_optlwcs_from_char (lua_State *L, int narg, const wchar_t *def, size_t *len){
+ if (lua_isnoneornil(L, narg)) {
+ if (len)
+ *len = (def ? wcslen(def) : 0);
+ return def;
+ }
+ else return lua_checklwcs_from_char(L, narg, len);
+}
+// Maps a wchar_t character string to its char string counterpart.
+size_t lua_wcstochar(lua_State *L, const wchar_t *s, size_t cchSrc){
+ const wchar_t * lpWC = s;
+ size_t cch = 0; // # of UTF8 chars generated
+
+ luaL_Buffer b;
+ luaL_buffinit(L, &b);
+
+ while (cchSrc--) {
+ if (*lpWC <= 0x00ff){
+ luaL_addchar(&b, (char)*lpWC);
+ }else{
+ luaL_addchar(&b, '?');// no choice
+ }
+ cch++;
+ lpWC++;
+ }
+ luaL_pushresult(&b);
+ // Return the number of char characters written.
+ return (cch);
+}
+
+
+
+
+
+
+
+/*
+size_t lua_utf8towcsZ2(lua_State *L, const char *s, int len){
+ size_t cchWC = 0; // # of wchar_t code points generated
+ const unsigned char * pUTF8 = (const unsigned char *)s;
+ const unsigned char * pEnd = (const unsigned char *)(s + len);
+ wchar_t * pBuf = NULL;
+ const wchar_t * pBuf0 = NULL;
+ const wchar_t * pBuf1 = NULL;
+ luaL_Buffer b;
+ luaL_buffinit(L, &b);
+ while (pUTF8 < pEnd){
+ pBuf = (wchar_t *)luaL_prepbuffer(&b);
+ pBuf0 = pBuf;
+ pBuf1 = pBuf + (LUAL_BUFFERSIZE-sizeof(wchar_t));
+ while(pUTF8 < pEnd && pBuf <= pBuf1){
+ // See if there are any trail bytes.
+ if (*pUTF8 < 0xC0) {// 192
+ // Found ASCII.
+ *pBuf++ = pUTF8[0];
+ }else if (pUTF8[0] < 0xE0){ //224
+ if ((pUTF8[1] & 0xC0) == 0x80) {
+ // A two-byte-character lead-byte not followed by trail-byte represents itself.
+ *pBuf++ = (wchar_t) (((pUTF8[0] & 0x1F) << 6) | (pUTF8[1] & 0x3F));
+ pUTF8 += 1;
+ }else{
+ // A two-byte-character lead-byte not followed by trail-byte represents itself.
+ *pBuf++ = pUTF8[0];
+ }
+ }else if (pUTF8[0] < 0xF0) {//240
+ if (((pUTF8[1] & 0xC0) == 0x80) && ((pUTF8[2] & 0xC0) == 0x80)) {
+ // Three-byte-character lead byte followed by two trail bytes.
+ *pBuf++ = (wchar_t) (((pUTF8[0] & 0x0F) << 12) | ((pUTF8[1] & 0x3F) << 6) | (pUTF8[2] & 0x3F));
+ pUTF8 += 2;
+ }else{
+ // Three-byte-character lead byte followed by two trail bytes.
+ *pBuf++ = pUTF8[0];
+ }
+ }else{
+ *pBuf++ = pUTF8[0];
+ }
+ cchWC++;
+ pUTF8++;
+ }
+ luaL_addsize(&b, (size_t)(pBuf0 - pBuf));
+ }
+ luaL_addchar(&b, '\0');// the other '\0' will be added by lua
+ luaL_pushresult(&b);
+ // Return the number of wchar_t characters written.
+ return (cchWC);
}//*/ \ No newline at end of file
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/lua_tstring.h b/3rdparty/lua/src/modules/lua-winreg/src/lua_tstring.h
index 094fc3d..b2e56bf 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/lua_tstring.h
+++ b/3rdparty/lua/src/modules/lua-winreg/src/lua_tstring.h
@@ -1,98 +1,98 @@
-#ifndef __LUA_TSTRING_H___
-#define __LUA_TSTRING_H___
-#ifdef __cplusplus
-extern "C" {
-#endif
-#include <lua.h>
-#include <lualib.h>
-#include <lauxlib.h>
-
-size_t lua_utf8towcsZ(lua_State *L, const char *s, int len);
-size_t lua_utf8towcs(lua_State *L, const char *s, int len);
-
-size_t lua_wcstoutf8(lua_State *L, const wchar_t *s, size_t cchSrc);
-size_t lua_wcstochar(lua_State *L, const wchar_t *s, size_t cchSrc);
-
-void lua_pushutf8_from_wchar(lua_State *L, wchar_t ch);
-void lua_addutf8_from_wchar(luaL_Buffer * pB, wchar_t ch);
-wchar_t lua_checkwchar_from_utf8(lua_State *L, int i);
-const wchar_t *lua_tolwcs_from_utf8(lua_State *L, int narg, size_t* l);
-const wchar_t *lua_checklwcs_from_utf8(lua_State *L, int narg, size_t* l);
-const wchar_t *lua_optlwcs_from_utf8(lua_State *L, int narg, const wchar_t *def, size_t *len);
-void lua_pushutf8_from_wcs(lua_State *L, const wchar_t *s);
-#define lua_checkwcs_from_utf8(L,n) (lua_checklwcs_from_utf8(L, (n), NULL))
-#define lua_optwcs_from_utf8(L,n,d) (lua_optlwcs_from_utf8(L, (n), (d), NULL))
-#define lua_towcs_from_utf8(L,i) (lua_tolwcs_from_utf8(L, (i), NULL))
-#define lua_pushlutf8_from_wcs lua_wcstoutf8
-
-const wchar_t *lua_checklwcs_from_char(lua_State *L, int narg, size_t* l);
-const wchar_t *lua_optlwcs_from_char(lua_State *L, int narg, const wchar_t *def, size_t *len);
-#define lua_checkwcs_from_char(L,n) (lua_checklwcs_from_char(L, (n), NULL))
-#define lua_optwcs_from_char(L,n,d) (lua_optlwcs_from_char(L, (n), (d), NULL))
-#define lua_pushchar_from_wchar(L,c){char _c;if(c>0x00FF){_c='?';}else{_c=(char)c;}lua_pushlstring(L,&_c,1);}
-#define lua_addchar_from_wchar(B,c) luaL_addchar(B,c>0x00ff?'?':c)
-#define lua_pushlwcs_from_char lua_wcstochar
-
-#ifdef UNICODE
-/* all lua*wstring function will use utf8 <--> wide convertion */
-#define luaL_checklwstring lua_checklwcs_from_utf8
-#define luaL_checkwstring lua_checkwcs_from_utf8
-#define luaL_optlwstring lua_optlwcs_from_utf8
-#define luaL_optwstring lua_optwcs_from_utf8
-
-#define lua_checklwstring lua_checklwcs_from_utf8
-#define lua_checkwstring lua_checkwcs_from_utf8
-#define lua_optlwstring lua_optlwcs_from_utf8
-#define lua_optwstring lua_optwcs_from_utf8
-
-#define lua_tolwstring lua_tolwcs_from_utf8
-#define lua_towstring lua_towcs_from_utf8
-#define lua_pushlwstring lua_pushlutf8_from_wcs
-#define lua_pushwstring lua_pushutf8_from_wcs
-#define lua_pushwchar lua_pushutf8_from_wchar
-#define lua_addwchar lua_addutf8_from_wchar
-#else
-/* all lua*wstring function will use char <--> wide convertion */
-#define lua_checkwstring lua_checkwcs_from_char
-#define lua_optlwstring lua_optlwcs_from_char
-#define lua_optwstring lua_optwcs_from_char
-#define lua_pushwchar lua_pushchar_from_wchar
-#define lua_addwchar lua_addchar_from_wchar
-#define lua_pushlwstring lua_pushlwcs_from_char
-#endif // !UNICODE
-
-#ifdef UNICODE
-# define lua_checkltstring luaL_checklwstring
-# define lua_checktstring(L,n) (luaL_checklwstring(L, (n), NULL))
-# define lua_optltstring luaL_optlwstring
-# define lua_opttstring(L,n,d) (luaL_optlwstring(L, (n), (d), NULL))
-# define lua_pushtstring lua_pushwstring
-# define lua_totstring lua_towstring
-# define lua_pushtchar lua_pushwchar
-# define lua_addtchar lua_addwchar
-# define LUA_TCHAR wchar_t
-# define lua_pushltstring lua_pushlwstring
-#else
-# define lua_checkltstring luaL_checklstring
-# define lua_checktstring luaL_checkstring
-# define lua_optltstring luaL_optlstring
-# define lua_opttstring luaL_optstring
-# define lua_pushtstring lua_pushstring
-# define lua_totstring lua_tostring
-# define LUA_TCHAR char
-# define lua_pushtchar lua_pushchar_from_wchar
-# define lua_addtchar luaL_addchar
-# define lua_pushltstring lua_pushlstring
-#endif // !UNICODE
-
-#define lua_alloc_tchar(L, charlen) ((LUA_TCHAR*)lua_newuserdata(L,(charlen)*sizeof(LUA_TCHAR)))
-#define lua_rawset_lt(L,t,k,v) (lua_rawset_index_assert(t), lua_pushliteral(L, k), lua_pushtstring(L, (v)), lua_rawset(L, (t)))
-#define lua_rawset_st(L,t,k,v) (lua_rawset_index_assert(t), lua_pushstring(L,(k)), lua_pushtstring(L, (v)), lua_rawset(L, (t)))
-#define lua_rawset_tt(L,t,k,v) (lua_rawset_index_assert(t), lua_pushtstring(L,(k)), lua_pushtstring(L, (v)), lua_rawset(L, (t)))
-#define lua_rawset_vt(L,t,k,v) (lua_rawset_index_assert(t), lua_pushvalue(L, (k)), lua_pushtstring(L, (v)), lua_rawset(L, (t)))
-#define lua_rawset_it(L,t,i,v) (assert((t) >= 0 || (t) == -2 || (t) <= LUA_REGISTRYINDEX), lua_pushtstring(L, (v)), lua_rawseti(L, (t), (i)))
-
-#ifdef __cplusplus
-}
-#endif
-#endif //__LUA_TSTRING_H___
+#ifndef __LUA_TSTRING_H___
+#define __LUA_TSTRING_H___
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include <lua.h>
+#include <lualib.h>
+#include <lauxlib.h>
+
+size_t lua_utf8towcsZ(lua_State *L, const char *s, int len);
+size_t lua_utf8towcs(lua_State *L, const char *s, int len);
+
+size_t lua_wcstoutf8(lua_State *L, const wchar_t *s, size_t cchSrc);
+size_t lua_wcstochar(lua_State *L, const wchar_t *s, size_t cchSrc);
+
+void lua_pushutf8_from_wchar(lua_State *L, wchar_t ch);
+void lua_addutf8_from_wchar(luaL_Buffer * pB, wchar_t ch);
+wchar_t lua_checkwchar_from_utf8(lua_State *L, int i);
+const wchar_t *lua_tolwcs_from_utf8(lua_State *L, int narg, size_t* l);
+const wchar_t *lua_checklwcs_from_utf8(lua_State *L, int narg, size_t* l);
+const wchar_t *lua_optlwcs_from_utf8(lua_State *L, int narg, const wchar_t *def, size_t *len);
+void lua_pushutf8_from_wcs(lua_State *L, const wchar_t *s);
+#define lua_checkwcs_from_utf8(L,n) (lua_checklwcs_from_utf8(L, (n), NULL))
+#define lua_optwcs_from_utf8(L,n,d) (lua_optlwcs_from_utf8(L, (n), (d), NULL))
+#define lua_towcs_from_utf8(L,i) (lua_tolwcs_from_utf8(L, (i), NULL))
+#define lua_pushlutf8_from_wcs lua_wcstoutf8
+
+const wchar_t *lua_checklwcs_from_char(lua_State *L, int narg, size_t* l);
+const wchar_t *lua_optlwcs_from_char(lua_State *L, int narg, const wchar_t *def, size_t *len);
+#define lua_checkwcs_from_char(L,n) (lua_checklwcs_from_char(L, (n), NULL))
+#define lua_optwcs_from_char(L,n,d) (lua_optlwcs_from_char(L, (n), (d), NULL))
+#define lua_pushchar_from_wchar(L,c){char _c;if(c>0x00FF){_c='?';}else{_c=(char)c;}lua_pushlstring(L,&_c,1);}
+#define lua_addchar_from_wchar(B,c) luaL_addchar(B,c>0x00ff?'?':c)
+#define lua_pushlwcs_from_char lua_wcstochar
+
+#ifdef UNICODE
+/* all lua*wstring function will use utf8 <--> wide convertion */
+#define luaL_checklwstring lua_checklwcs_from_utf8
+#define luaL_checkwstring lua_checkwcs_from_utf8
+#define luaL_optlwstring lua_optlwcs_from_utf8
+#define luaL_optwstring lua_optwcs_from_utf8
+
+#define lua_checklwstring lua_checklwcs_from_utf8
+#define lua_checkwstring lua_checkwcs_from_utf8
+#define lua_optlwstring lua_optlwcs_from_utf8
+#define lua_optwstring lua_optwcs_from_utf8
+
+#define lua_tolwstring lua_tolwcs_from_utf8
+#define lua_towstring lua_towcs_from_utf8
+#define lua_pushlwstring lua_pushlutf8_from_wcs
+#define lua_pushwstring lua_pushutf8_from_wcs
+#define lua_pushwchar lua_pushutf8_from_wchar
+#define lua_addwchar lua_addutf8_from_wchar
+#else
+/* all lua*wstring function will use char <--> wide convertion */
+#define lua_checkwstring lua_checkwcs_from_char
+#define lua_optlwstring lua_optlwcs_from_char
+#define lua_optwstring lua_optwcs_from_char
+#define lua_pushwchar lua_pushchar_from_wchar
+#define lua_addwchar lua_addchar_from_wchar
+#define lua_pushlwstring lua_pushlwcs_from_char
+#endif // !UNICODE
+
+#ifdef UNICODE
+# define lua_checkltstring luaL_checklwstring
+# define lua_checktstring(L,n) (luaL_checklwstring(L, (n), NULL))
+# define lua_optltstring luaL_optlwstring
+# define lua_opttstring(L,n,d) (luaL_optlwstring(L, (n), (d), NULL))
+# define lua_pushtstring lua_pushwstring
+# define lua_totstring lua_towstring
+# define lua_pushtchar lua_pushwchar
+# define lua_addtchar lua_addwchar
+# define LUA_TCHAR wchar_t
+# define lua_pushltstring lua_pushlwstring
+#else
+# define lua_checkltstring luaL_checklstring
+# define lua_checktstring luaL_checkstring
+# define lua_optltstring luaL_optlstring
+# define lua_opttstring luaL_optstring
+# define lua_pushtstring lua_pushstring
+# define lua_totstring lua_tostring
+# define LUA_TCHAR char
+# define lua_pushtchar lua_pushchar_from_wchar
+# define lua_addtchar luaL_addchar
+# define lua_pushltstring lua_pushlstring
+#endif // !UNICODE
+
+#define lua_alloc_tchar(L, charlen) ((LUA_TCHAR*)lua_newuserdata(L,(charlen)*sizeof(LUA_TCHAR)))
+#define lua_rawset_lt(L,t,k,v) (lua_rawset_index_assert(t), lua_pushliteral(L, k), lua_pushtstring(L, (v)), lua_rawset(L, (t)))
+#define lua_rawset_st(L,t,k,v) (lua_rawset_index_assert(t), lua_pushstring(L,(k)), lua_pushtstring(L, (v)), lua_rawset(L, (t)))
+#define lua_rawset_tt(L,t,k,v) (lua_rawset_index_assert(t), lua_pushtstring(L,(k)), lua_pushtstring(L, (v)), lua_rawset(L, (t)))
+#define lua_rawset_vt(L,t,k,v) (lua_rawset_index_assert(t), lua_pushvalue(L, (k)), lua_pushtstring(L, (v)), lua_rawset(L, (t)))
+#define lua_rawset_it(L,t,i,v) (assert((t) >= 0 || (t) == -2 || (t) <= LUA_REGISTRYINDEX), lua_pushtstring(L, (v)), lua_rawseti(L, (t), (i)))
+
+#ifdef __cplusplus
+}
+#endif
+#endif //__LUA_TSTRING_H___
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/luamacro.h b/3rdparty/lua/src/modules/lua-winreg/src/luamacro.h
index eb484aa..96ba318 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/luamacro.h
+++ b/3rdparty/lua/src/modules/lua-winreg/src/luamacro.h
@@ -1,124 +1,124 @@
-#ifndef __LUAMACRO_H__
-#define __LUAMACRO_H__
-/* Compatibility between Lua 5.1+ and Lua 5.0 */
-#ifndef LUA_VERSION_NUM
-# define LUA_VERSION_NUM 0
-#endif
-#if LUA_VERSION_NUM < 501
-# define luaL_register(a, b, c) luaL_openlib((a), (b), (c), 0)
-# define lua_Integer ptrdiff_t
-# define lua_pushinteger lua_pushnumber
-# define luaL_optinteger luaL_optnumber
-# define luaL_checkinteger luaL_checknumber
-# define luaL_addchar luaL_putchar
-# define lua_createtable(L,a,b) lua_newtable(L)
-# define lua_tointeger(L,i) ((lua_Integer)lua_tonumber((L),(i)))
-# define lua_recycle(L) lua_setgcthreshold(L,0)
-#else
-# define lua_recycle(L) lua_gc(L,LUA_GCCOLLECT,0)
-#endif
-#ifndef lua_boxpointer
-# define lua_boxpointer(L,u) (*(void **)(lua_newuserdata(L, sizeof(void *))) = (u))
-#endif
-#ifndef lua_unboxpointer
-# define lua_unboxpointer(L,i) (*(void **)(lua_touserdata(L, i)))
-#endif
-/* convert a stack index to positive */
-#define lua_absindex(L, i) (((i)>0)?(i):((i)<=LUA_REGISTRYINDEX?(i):(lua_gettop(L)+(i)+1)))
-
-
-
-
-#define lua_leavenil(L) (lua_settop(L,0),lua_pushnil(L))
-
-#define lua_checkint(L,i) ((int)luaL_checkinteger(L,(i)))
-#define lua_optint(L,i,d) ((int)luaL_optinteger(L,(i),(d)))
-#define lua_pushint(L, n) (lua_pushinteger(L, (lua_Integer)(n)))
-
-#define lua_checkstring luaL_checkstring
-#define lua_checklstring luaL_checklstring
-
-#define lua_isfulluserdata(L, n)(lua_type(L, (n)) == LUA_TUSERDATA)
-#define lua_isrealstring(L, n) (lua_type(L, (n)) == LUA_TSTRING)
-#define lua_isrealnumber(L, n) (lua_type(L, (n)) == LUA_TNUMBER)
-#define lua_isrealtrue(L, n) (lua_isboolean(L, (n)) && lua_toboolean(L, (n)))
-#define lua_isrealfalse(L, n) (lua_isboolean(L, (n)) && (lua_toboolean(L, (n)) == 0))
-
-#define lua_optbool(L,i,d) (lua_isnone(L,(i))?(d):lua_toboolean(L,(i)))
-#define lua_pushfasle(L) (lua_pushboolean(L, 0))
-#define lua_pushtrue(L) (lua_pushboolean(L, 1))
-/* rawset's shortcuts */
-#define lua_rawset_index_assert(t) assert((t) >= 0 || (t) == -3 || (t) <= LUA_REGISTRYINDEX)
-#define lua_rawset_lf(L,t,k,v) (lua_rawset_index_assert(t), lua_pushliteral(L, k), lua_pushcfunction(L, (v)), lua_rawset(L, (t)))
-#define lua_rawset_lb(L,t,k,v) (lua_rawset_index_assert(t), lua_pushliteral(L, k), lua_pushboolean(L, (v)), lua_rawset(L, (t)))
-#define lua_rawset_lv(L,t,k,v) (lua_rawset_index_assert(t), lua_pushliteral(L, k), lua_pushvalue(L, (v)), lua_rawset(L, (t)))
-#define lua_rawset_ll(L,t,k,v) (lua_rawset_index_assert(t), lua_pushliteral(L, k), lua_pushliteral(L, v), lua_rawset(L, (t)))
-#define lua_rawset_ln(L,t,k,v) (lua_rawset_index_assert(t), lua_pushliteral(L, k), lua_pushnumber(L, (v)), lua_rawset(L, (t)))
-#define lua_rawset_li(L,t,k,v) (lua_rawset_index_assert(t), lua_pushliteral(L, k), lua_pushinteger(L, (v)), lua_rawset(L, (t)))
-#define lua_rawset_sn(L,t,k,v) (lua_rawset_index_assert(t), lua_pushstring(L,(k)), lua_pushnumber(L, (v)), lua_rawset(L, (t)))
-#define lua_rawset_vv(L,t,k,v) (lua_rawset_index_assert(t), lua_pushvalue(L, (k)), lua_pushvalue(L, (v)), lua_rawset(L, (t)))
-#define lua_rawset_vi(L,t,k,v) (lua_rawset_index_assert(t), lua_pushvalue(L, (k)), lua_pushinteger(L, (v)), lua_rawset(L, (t)))
-/* rawseti's shortcuts */
-#define lua_rawset_ii(L,t,i,j) (assert((t) >= 0 || (t) == -2 || (t) <= LUA_REGISTRYINDEX), lua_pushinteger(L, (j)), lua_rawseti(L, (t), (i)))
-#define lua_rawset_is(L,t,i,v) (assert((t) >= 0 || (t) == -2 || (t) <= LUA_REGISTRYINDEX), lua_pushstring(L, (v)), lua_rawseti(L, (t), (i)))
-#define lua_rawset_in(L,t,i,j) (assert((t) >= 0 || (t) == -2 || (t) <= LUA_REGISTRYINDEX), lua_pushnumber(L, (j)), lua_rawseti(L, (t), (i)))
-
-/* traversing table */
-#define lua_tabletraverse(L, i) for(lua_pushnil(L); lua_next(L, (i)); lua_pop(L, 1))
-
-#define LUA_LEAVE_OBJECT(L) (lua_settop(L,1))
-#define LUA_CHECK_LEAVE_OBJECT(L,b) ((b)?LUA_LEAVE_OBJECT(L):(lua_settop(L,0),lua_pushnil(L)))
-#define LUA_CHECK_RETURN_OBJECT(L,b) return(LUA_CHECK_LEAVE_OBJECT(L,b),1)
-/* allocation charaters */
-#define lua_alloc_wchar(L, charlen) ((wchar_t*)lua_newuserdata(L,(charlen)*sizeof(wchar_t)))
-#define lua_alloc_char(L, charlen) ((char*)lua_newuserdata(L,(charlen)*sizeof(char)))
-#define lua_alloc_uchar(L, charlen) ((unsigned char*)lua_newuserdata(L,(charlen)*sizeof(unsigned char)))
-/* luacheia support */
-#define LUACHEIA(m) __declspec(dllexport) int luaLM_import(lua_State *L){luaopen_##m(L);return 0;} __declspec(dllexport) const char * luaLM_version(void) {return LUA_VERSION;}
-/* gettable shortcuts */
-#define lua_gettable_s(L,i,s) (lua_pushstring(L,s),lua_gettable(L,i))
-#define lua_gettable_l(L,i,l) (lua_pushliteral(L,l),lua_gettable(L,i))
-#define lua_gettable_i(L,i,j) (lua_pushinteger(L,j),lua_gettable(L,i))
-#define lua_chktable_s(L,i,s) (lua_gettable_s(L,i,s),!lua_isnoneornil(L,-1))
-#define lua_chktable_l(L,i,l) (lua_gettable_l(L,i,l),!lua_isnoneornil(L,-1))
-#define lua_chktable_i(L,i,j) (lua_gettable_i(L,i,j),!lua_isnoneornil(L,-1))
-
-/* Garbage !
-#define lua_push_lj(L,s) (lua_pushliteral(L, s), lua_absindex(L, -1))
-#define lua_push_fj(L,f) (lua_pushcfunction(L, f), lua_absindex(L, -1))
-
-#define lua_picktablep(L,i,p) (lua_pushlightuserdata(L,(p)),lua_rawget(L,(i)))
-#define lua_picktablev(L,i,j) (lua_pushvalue(L, (j)), lua_rawget(L,(i)))
-#define lua_picktablel(L,i,s) (lua_pushliteral(L, s), lua_rawget(L,(i)))
-#define lua_picktablei(L,i,n) (lua_rawgeti(L,i,n))
-
-#define lua_gettablel(L,i,s) (lua_pushliteral(L, s), lua_gettable(L,i))
-#define lua_gettablei(L,i,n) (lua_pushinteger(L,(n)),lua_gettable(L,i))
-#define lua_gettables(L,i,s) (lua_getfield(L,(i),(s)))
-
-
-#define lua_gettable_l(L,i,s) (lua_gettablel(L,i,s), !lua_isnoneornil(L,-1))
-#define lua_gettable_i(L,i,n) (lua_gettablei(L,i,n), !lua_isnoneornil(L,-1))
-#define lua_gettable_s(L,i,s) (lua_gettables(L,i,s), !lua_isnoneornil(L,-1))
-
-#define lua_checkktable_li(L,i,s) (lua_gettablel(L,i,s), luaL_checkinteger(L, -1))
-
-#define lua_gettable_lb(L,i,s) (lua_gettablel(L,i,s), lua_toboolean(L, -1))
-
-#define lua_picktable_l(L,i,s) (lua_picktablel(L,i,s), !lua_isnoneornil(L,-1))
-#define lua_picktable_v(L,i,j) (lua_picktablev(L,i,j), !lua_isnoneornil(L,-1))
-#define lua_picktable_i(L,i,n) (lua_picktablei(L,i,n), !lua_isnoneornil(L,-1))
-#define lua_picktable_p(L,i,p) (lua_picktablep(L,i,p), !lua_isnoneornil(L,-1))
-
-#define lua_picktable_lb(L,i,s) (lua_picktablel(L,i,s), lua_toboolean(L, -1))
-#define lua_picktable_vb(L,i,j) (lua_picktablev(L,i,j), lua_toboolean(L, -1))
-
-#define lua_picktabletype_l(L,i,s)(lua_picktablel(L,i,s), lua_type(L, -1))
-
-#define lua_querytable_vs(L,i,j) (lua_picktablev(L,i,j), luaL_checkstring(L, -1))
-
-#define lua_picktable_vj(L,i,j) (lua_picktablev(L,i,j), lua_absindex(L, -1))
-#define lua_picktable_lj(L,i,s) (lua_picktablel(L,i,s), lua_absindex(L, -1))
-*/
-
-#endif /*__LUAMACRO_H__*/
+#ifndef __LUAMACRO_H__
+#define __LUAMACRO_H__
+/* Compatibility between Lua 5.1+ and Lua 5.0 */
+#ifndef LUA_VERSION_NUM
+# define LUA_VERSION_NUM 0
+#endif
+#if LUA_VERSION_NUM < 501
+# define luaL_register(a, b, c) luaL_openlib((a), (b), (c), 0)
+# define lua_Integer ptrdiff_t
+# define lua_pushinteger lua_pushnumber
+# define luaL_optinteger luaL_optnumber
+# define luaL_checkinteger luaL_checknumber
+# define luaL_addchar luaL_putchar
+# define lua_createtable(L,a,b) lua_newtable(L)
+# define lua_tointeger(L,i) ((lua_Integer)lua_tonumber((L),(i)))
+# define lua_recycle(L) lua_setgcthreshold(L,0)
+#else
+# define lua_recycle(L) lua_gc(L,LUA_GCCOLLECT,0)
+#endif
+#ifndef lua_boxpointer
+# define lua_boxpointer(L,u) (*(void **)(lua_newuserdata(L, sizeof(void *))) = (u))
+#endif
+#ifndef lua_unboxpointer
+# define lua_unboxpointer(L,i) (*(void **)(lua_touserdata(L, i)))
+#endif
+/* convert a stack index to positive */
+#define lua_absindex(L, i) (((i)>0)?(i):((i)<=LUA_REGISTRYINDEX?(i):(lua_gettop(L)+(i)+1)))
+
+
+
+
+#define lua_leavenil(L) (lua_settop(L,0),lua_pushnil(L))
+
+#define lua_checkint(L,i) ((int)luaL_checkinteger(L,(i)))
+#define lua_optint(L,i,d) ((int)luaL_optinteger(L,(i),(d)))
+#define lua_pushint(L, n) (lua_pushinteger(L, (lua_Integer)(n)))
+
+#define lua_checkstring luaL_checkstring
+#define lua_checklstring luaL_checklstring
+
+#define lua_isfulluserdata(L, n)(lua_type(L, (n)) == LUA_TUSERDATA)
+#define lua_isrealstring(L, n) (lua_type(L, (n)) == LUA_TSTRING)
+#define lua_isrealnumber(L, n) (lua_type(L, (n)) == LUA_TNUMBER)
+#define lua_isrealtrue(L, n) (lua_isboolean(L, (n)) && lua_toboolean(L, (n)))
+#define lua_isrealfalse(L, n) (lua_isboolean(L, (n)) && (lua_toboolean(L, (n)) == 0))
+
+#define lua_optbool(L,i,d) (lua_isnone(L,(i))?(d):lua_toboolean(L,(i)))
+#define lua_pushfasle(L) (lua_pushboolean(L, 0))
+#define lua_pushtrue(L) (lua_pushboolean(L, 1))
+/* rawset's shortcuts */
+#define lua_rawset_index_assert(t) assert((t) >= 0 || (t) == -3 || (t) <= LUA_REGISTRYINDEX)
+#define lua_rawset_lf(L,t,k,v) (lua_rawset_index_assert(t), lua_pushliteral(L, k), lua_pushcfunction(L, (v)), lua_rawset(L, (t)))
+#define lua_rawset_lb(L,t,k,v) (lua_rawset_index_assert(t), lua_pushliteral(L, k), lua_pushboolean(L, (v)), lua_rawset(L, (t)))
+#define lua_rawset_lv(L,t,k,v) (lua_rawset_index_assert(t), lua_pushliteral(L, k), lua_pushvalue(L, (v)), lua_rawset(L, (t)))
+#define lua_rawset_ll(L,t,k,v) (lua_rawset_index_assert(t), lua_pushliteral(L, k), lua_pushliteral(L, v), lua_rawset(L, (t)))
+#define lua_rawset_ln(L,t,k,v) (lua_rawset_index_assert(t), lua_pushliteral(L, k), lua_pushnumber(L, (v)), lua_rawset(L, (t)))
+#define lua_rawset_li(L,t,k,v) (lua_rawset_index_assert(t), lua_pushliteral(L, k), lua_pushinteger(L, (v)), lua_rawset(L, (t)))
+#define lua_rawset_sn(L,t,k,v) (lua_rawset_index_assert(t), lua_pushstring(L,(k)), lua_pushnumber(L, (v)), lua_rawset(L, (t)))
+#define lua_rawset_vv(L,t,k,v) (lua_rawset_index_assert(t), lua_pushvalue(L, (k)), lua_pushvalue(L, (v)), lua_rawset(L, (t)))
+#define lua_rawset_vi(L,t,k,v) (lua_rawset_index_assert(t), lua_pushvalue(L, (k)), lua_pushinteger(L, (v)), lua_rawset(L, (t)))
+/* rawseti's shortcuts */
+#define lua_rawset_ii(L,t,i,j) (assert((t) >= 0 || (t) == -2 || (t) <= LUA_REGISTRYINDEX), lua_pushinteger(L, (j)), lua_rawseti(L, (t), (i)))
+#define lua_rawset_is(L,t,i,v) (assert((t) >= 0 || (t) == -2 || (t) <= LUA_REGISTRYINDEX), lua_pushstring(L, (v)), lua_rawseti(L, (t), (i)))
+#define lua_rawset_in(L,t,i,j) (assert((t) >= 0 || (t) == -2 || (t) <= LUA_REGISTRYINDEX), lua_pushnumber(L, (j)), lua_rawseti(L, (t), (i)))
+
+/* traversing table */
+#define lua_tabletraverse(L, i) for(lua_pushnil(L); lua_next(L, (i)); lua_pop(L, 1))
+
+#define LUA_LEAVE_OBJECT(L) (lua_settop(L,1))
+#define LUA_CHECK_LEAVE_OBJECT(L,b) ((b)?LUA_LEAVE_OBJECT(L):(lua_settop(L,0),lua_pushnil(L)))
+#define LUA_CHECK_RETURN_OBJECT(L,b) return(LUA_CHECK_LEAVE_OBJECT(L,b),1)
+/* allocation charaters */
+#define lua_alloc_wchar(L, charlen) ((wchar_t*)lua_newuserdata(L,(charlen)*sizeof(wchar_t)))
+#define lua_alloc_char(L, charlen) ((char*)lua_newuserdata(L,(charlen)*sizeof(char)))
+#define lua_alloc_uchar(L, charlen) ((unsigned char*)lua_newuserdata(L,(charlen)*sizeof(unsigned char)))
+/* luacheia support */
+#define LUACHEIA(m) __declspec(dllexport) int luaLM_import(lua_State *L){luaopen_##m(L);return 0;} __declspec(dllexport) const char * luaLM_version(void) {return LUA_VERSION;}
+/* gettable shortcuts */
+#define lua_gettable_s(L,i,s) (lua_pushstring(L,s),lua_gettable(L,i))
+#define lua_gettable_l(L,i,l) (lua_pushliteral(L,l),lua_gettable(L,i))
+#define lua_gettable_i(L,i,j) (lua_pushinteger(L,j),lua_gettable(L,i))
+#define lua_chktable_s(L,i,s) (lua_gettable_s(L,i,s),!lua_isnoneornil(L,-1))
+#define lua_chktable_l(L,i,l) (lua_gettable_l(L,i,l),!lua_isnoneornil(L,-1))
+#define lua_chktable_i(L,i,j) (lua_gettable_i(L,i,j),!lua_isnoneornil(L,-1))
+
+/* Garbage !
+#define lua_push_lj(L,s) (lua_pushliteral(L, s), lua_absindex(L, -1))
+#define lua_push_fj(L,f) (lua_pushcfunction(L, f), lua_absindex(L, -1))
+
+#define lua_picktablep(L,i,p) (lua_pushlightuserdata(L,(p)),lua_rawget(L,(i)))
+#define lua_picktablev(L,i,j) (lua_pushvalue(L, (j)), lua_rawget(L,(i)))
+#define lua_picktablel(L,i,s) (lua_pushliteral(L, s), lua_rawget(L,(i)))
+#define lua_picktablei(L,i,n) (lua_rawgeti(L,i,n))
+
+#define lua_gettablel(L,i,s) (lua_pushliteral(L, s), lua_gettable(L,i))
+#define lua_gettablei(L,i,n) (lua_pushinteger(L,(n)),lua_gettable(L,i))
+#define lua_gettables(L,i,s) (lua_getfield(L,(i),(s)))
+
+
+#define lua_gettable_l(L,i,s) (lua_gettablel(L,i,s), !lua_isnoneornil(L,-1))
+#define lua_gettable_i(L,i,n) (lua_gettablei(L,i,n), !lua_isnoneornil(L,-1))
+#define lua_gettable_s(L,i,s) (lua_gettables(L,i,s), !lua_isnoneornil(L,-1))
+
+#define lua_checkktable_li(L,i,s) (lua_gettablel(L,i,s), luaL_checkinteger(L, -1))
+
+#define lua_gettable_lb(L,i,s) (lua_gettablel(L,i,s), lua_toboolean(L, -1))
+
+#define lua_picktable_l(L,i,s) (lua_picktablel(L,i,s), !lua_isnoneornil(L,-1))
+#define lua_picktable_v(L,i,j) (lua_picktablev(L,i,j), !lua_isnoneornil(L,-1))
+#define lua_picktable_i(L,i,n) (lua_picktablei(L,i,n), !lua_isnoneornil(L,-1))
+#define lua_picktable_p(L,i,p) (lua_picktablep(L,i,p), !lua_isnoneornil(L,-1))
+
+#define lua_picktable_lb(L,i,s) (lua_picktablel(L,i,s), lua_toboolean(L, -1))
+#define lua_picktable_vb(L,i,j) (lua_picktablev(L,i,j), lua_toboolean(L, -1))
+
+#define lua_picktabletype_l(L,i,s)(lua_picktablel(L,i,s), lua_type(L, -1))
+
+#define lua_querytable_vs(L,i,j) (lua_picktablev(L,i,j), luaL_checkstring(L, -1))
+
+#define lua_picktable_vj(L,i,j) (lua_picktablev(L,i,j), lua_absindex(L, -1))
+#define lua_picktable_lj(L,i,s) (lua_picktablel(L,i,s), lua_absindex(L, -1))
+*/
+
+#endif /*__LUAMACRO_H__*/
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/luareg.h b/3rdparty/lua/src/modules/lua-winreg/src/luareg.h
index 5fb8628..d653f00 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/luareg.h
+++ b/3rdparty/lua/src/modules/lua-winreg/src/luareg.h
@@ -1,79 +1,79 @@
-#ifndef __LUA_REG__
-#define __LUA_REG__
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int reglib_createkey(lua_State *L);
-int reglib_openkey(lua_State *L);
-int reg_close(lua_State *L);
-int reg_createkey(lua_State *L);
-int reg_deletekey(lua_State *L);
-int reg_deletevalue(lua_State *L);
-int reg_enumkey(lua_State *L);
-int reg_enumvalue(lua_State *L);
-int reg_flushkey(lua_State *L);
-int reg_getinfo(lua_State *L);
-int reg_getvalue(lua_State *L);
-#ifndef LUA_REG_NO_HIVEOPS
-int reg_loadkey(lua_State *L);
-#endif // LUA_REG_NO_HIVEOPS
-int reg_openkey(lua_State *L);
-#ifndef LUA_REG_NO_HIVEOPS
-int reg_replacekey(lua_State *L);
-int reg_restorekey(lua_State *L);
-int reg_savekey(lua_State *L);
-#endif // LUA_REG_NO_HIVEOPS
-int reg_setvalue(lua_State *L);
-int reg_unloadkey(lua_State *L);
-int reg_handle(lua_State *L);
-int reg_detach(lua_State *L);
-int reg_getstrval(lua_State *L);
-int reg_getvaltype(lua_State *L);
-/* Total:22 */
-
-extern luaL_Reg lreg_regobj[];
-#ifdef LUA_REG_DEFINE_EXTERNS
-luaL_Reg lreg_regobj[] = {
-{"__gc",reg_close},
-{"close",reg_close},
-{"createkey",reg_createkey},
-{"deletekey",reg_deletekey},
-{"deletevalue",reg_deletevalue},
-{"enumkey",reg_enumkey},
-{"enumvalue",reg_enumvalue},
-{"flushkey",reg_flushkey},
-{"getinfo",reg_getinfo},
-{"getvalue",reg_getvalue},
-#ifndef LUA_REG_NO_HIVEOPS
-{"load",reg_loadkey},
-#endif // LUA_REG_NO_HIVEOPS
-{"openkey",reg_openkey},
-#ifndef LUA_REG_NO_HIVEOPS
-{"replace",reg_replacekey},
-{"restore",reg_restorekey},
-{"save",reg_savekey},
-#endif // LUA_REG_NO_HIVEOPS
-{"setvalue",reg_setvalue},
-#ifndef LUA_REG_NO_HIVEOPS
-{"unload",reg_unloadkey},
-#endif // LUA_REG_NO_HIVEOPS
-{"handle",reg_handle},
-{"detach",reg_detach},
-{"getstrval",reg_getstrval},
-{"getvaltype",reg_getvaltype},
-{0,0}};/* Total:21 */
-#endif
-
-extern luaL_Reg lreg_reglib[];
-#ifdef LUA_REG_DEFINE_EXTERNS
-luaL_Reg lreg_reglib[] = {
-{"createkey",reglib_createkey},
-{"openkey",reglib_openkey},
-{0,0}};/* Total:2 */
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-#endif //__LUA_REG__
+#ifndef __LUA_REG__
+#define __LUA_REG__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int reglib_createkey(lua_State *L);
+int reglib_openkey(lua_State *L);
+int reg_close(lua_State *L);
+int reg_createkey(lua_State *L);
+int reg_deletekey(lua_State *L);
+int reg_deletevalue(lua_State *L);
+int reg_enumkey(lua_State *L);
+int reg_enumvalue(lua_State *L);
+int reg_flushkey(lua_State *L);
+int reg_getinfo(lua_State *L);
+int reg_getvalue(lua_State *L);
+#ifndef LUA_REG_NO_HIVEOPS
+int reg_loadkey(lua_State *L);
+#endif // LUA_REG_NO_HIVEOPS
+int reg_openkey(lua_State *L);
+#ifndef LUA_REG_NO_HIVEOPS
+int reg_replacekey(lua_State *L);
+int reg_restorekey(lua_State *L);
+int reg_savekey(lua_State *L);
+#endif // LUA_REG_NO_HIVEOPS
+int reg_setvalue(lua_State *L);
+int reg_unloadkey(lua_State *L);
+int reg_handle(lua_State *L);
+int reg_detach(lua_State *L);
+int reg_getstrval(lua_State *L);
+int reg_getvaltype(lua_State *L);
+/* Total:22 */
+
+extern luaL_Reg lreg_regobj[];
+#ifdef LUA_REG_DEFINE_EXTERNS
+luaL_Reg lreg_regobj[] = {
+{"__gc",reg_close},
+{"close",reg_close},
+{"createkey",reg_createkey},
+{"deletekey",reg_deletekey},
+{"deletevalue",reg_deletevalue},
+{"enumkey",reg_enumkey},
+{"enumvalue",reg_enumvalue},
+{"flushkey",reg_flushkey},
+{"getinfo",reg_getinfo},
+{"getvalue",reg_getvalue},
+#ifndef LUA_REG_NO_HIVEOPS
+{"load",reg_loadkey},
+#endif // LUA_REG_NO_HIVEOPS
+{"openkey",reg_openkey},
+#ifndef LUA_REG_NO_HIVEOPS
+{"replace",reg_replacekey},
+{"restore",reg_restorekey},
+{"save",reg_savekey},
+#endif // LUA_REG_NO_HIVEOPS
+{"setvalue",reg_setvalue},
+#ifndef LUA_REG_NO_HIVEOPS
+{"unload",reg_unloadkey},
+#endif // LUA_REG_NO_HIVEOPS
+{"handle",reg_handle},
+{"detach",reg_detach},
+{"getstrval",reg_getstrval},
+{"getvaltype",reg_getvaltype},
+{0,0}};/* Total:21 */
+#endif
+
+extern luaL_Reg lreg_reglib[];
+#ifdef LUA_REG_DEFINE_EXTERNS
+luaL_Reg lreg_reglib[] = {
+{"createkey",reglib_createkey},
+{"openkey",reglib_openkey},
+{0,0}};/* Total:2 */
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif //__LUA_REG__
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/luawin_dllerror.c b/3rdparty/lua/src/modules/lua-winreg/src/luawin_dllerror.c
index d661083..8f06e35 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/luawin_dllerror.c
+++ b/3rdparty/lua/src/modules/lua-winreg/src/luawin_dllerror.c
@@ -1,47 +1,47 @@
-#include "luawin_dllerror.h"
-#include "stdmacro.h"
-#include "luamacro.h"
-#include "win_trace.h"
-#define lgk_dllerror "__dll_error"
-
-#ifndef NDEBUG
-void lua_dllerror(lua_State *L, DWORD dwErr, const char * exp, const char * file, int line){
-#else
-void lua_dllerror(lua_State *L, DWORD dwErr){
-#endif
-/*
-if lgk_dllerror is present in global env and equal to false dont raise error!
-*/
- lua_getglobal(L, lgk_dllerror);
-
- if(lua_isrealfalse(L, -1)){
- WIN_TRACEA("lua_dllerror:false");
- }else{
- CHAR chbuf[1024];
- int c;
- if(dwErr == 0)dwErr = GetLastError();
- c = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), chbuf, 1024, NULL);
- // remove trailing spaces
- if (c > 0 && c < 1024) {
- while(--c > 1 && ISSPACE(chbuf[c]))chbuf[c] = '\0';
- }
- lua_pushfstring(L, "%s\ncode: %d\n", chbuf, dwErr);
-#ifndef NDEBUG
- if(file){
- lua_pushfstring(L, "file: %s\nline: %d\n", file, line);
- lua_concat(L, 2);
- }
- if(exp){
- lua_pushfstring(L, "expr: %s\n", exp);
- lua_concat(L, 2);
- }
-#endif
- if(lua_isfunction(L, -2)){
- WIN_TRACEA("lua_dllerror:function");
- lua_call(L, 1, 0);
- }else{
- WIN_TRACEA("lua_dllerror:true");
- lua_error(L);
- }
- }
-}
+#include "luawin_dllerror.h"
+#include "stdmacro.h"
+#include "luamacro.h"
+#include "win_trace.h"
+#define lgk_dllerror "__dll_error"
+
+#ifndef NDEBUG
+void lua_dllerror(lua_State *L, DWORD dwErr, const char * exp, const char * file, int line){
+#else
+void lua_dllerror(lua_State *L, DWORD dwErr){
+#endif
+/*
+if lgk_dllerror is present in global env and equal to false dont raise error!
+*/
+ lua_getglobal(L, lgk_dllerror);
+
+ if(lua_isrealfalse(L, -1)){
+ WIN_TRACEA("lua_dllerror:false");
+ }else{
+ CHAR chbuf[1024];
+ int c;
+ if(dwErr == 0)dwErr = GetLastError();
+ c = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), chbuf, 1024, NULL);
+ // remove trailing spaces
+ if (c > 0 && c < 1024) {
+ while(--c > 1 && ISSPACE(chbuf[c]))chbuf[c] = '\0';
+ }
+ lua_pushfstring(L, "%s\ncode: %d\n", chbuf, dwErr);
+#ifndef NDEBUG
+ if(file){
+ lua_pushfstring(L, "file: %s\nline: %d\n", file, line);
+ lua_concat(L, 2);
+ }
+ if(exp){
+ lua_pushfstring(L, "expr: %s\n", exp);
+ lua_concat(L, 2);
+ }
+#endif
+ if(lua_isfunction(L, -2)){
+ WIN_TRACEA("lua_dllerror:function");
+ lua_call(L, 1, 0);
+ }else{
+ WIN_TRACEA("lua_dllerror:true");
+ lua_error(L);
+ }
+ }
+}
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/luawin_dllerror.h b/3rdparty/lua/src/modules/lua-winreg/src/luawin_dllerror.h
index 011c72a..5a8d3d1 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/luawin_dllerror.h
+++ b/3rdparty/lua/src/modules/lua-winreg/src/luawin_dllerror.h
@@ -1,31 +1,31 @@
-#ifndef __LUAWIN_DLLERROR_H__
-#define __LUAWIN_DLLERROR_H__
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <windows.h>
-#include <lua.h>
-
-
-#ifdef NDEBUG
-void lua_dllerror(lua_State *L, DWORD dwErr);
-# define LUA_LAST_DLL_ERROR_ASSERT(L,exp)((exp)||(lua_dllerror(L, 0),0))
-# define LUA_CHECK_DLL_ERROR(L, code) ((void)((code)&&(lua_dllerror(L, (code)),0)))
-# define LUA_CHECK_LAST_DLL_ERROR(L) lua_dllerror(L, 0)
-#else
-void lua_dllerror(lua_State *L, DWORD dwErr, const char * exp, const char * file, int line);
-# define LUA_LAST_DLL_ERROR_ASSERT(L,exp)((exp)||(lua_dllerror(L, 0, #exp, __FILE__, __LINE__),0))
-# define LUA_CHECK_DLL_ERROR(L, code) ((void)((code)&&(lua_dllerror(L, (code), NULL, __FILE__, __LINE__),0)))
-# define LUA_CHECK_LAST_DLL_ERROR(L) lua_dllerror(L, 0, NULL, __FILE__, __LINE__)
-#endif
-#define LUA_LAST_DLL_ERROR_ASSERT_RETURN_OBJECT(L,exp) LUA_CHECK_RETURN_OBJECT(L, LUA_LAST_DLL_ERROR_ASSERT(L,exp))
-#define LUA_LAST_DLL_ERROR_ASSERT_LEAVE_OBJECT(L,exp) LUA_CHECK_LEAVE_OBJECT(L, LUA_LAST_DLL_ERROR_ASSERT(L,exp))
-#define LUA_LAST_DLL_ERROR_ASSERT_PUSHBOOL(L,exp) lua_pushboolean(L, LUA_LAST_DLL_ERROR_ASSERT(L, exp)?1:0)
-#define LUA_LAST_DLL_ERROR_ASSERT_RETBOOL(L,exp) return(LUA_LAST_DLL_ERROR_ASSERT_PUSHBOOL(L,exp), 1)
-
-
-#ifdef __cplusplus
-}
-#endif
-#endif //__LUAWIN_DLLERROR_H__
+#ifndef __LUAWIN_DLLERROR_H__
+#define __LUAWIN_DLLERROR_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <windows.h>
+#include <lua.h>
+
+
+#ifdef NDEBUG
+void lua_dllerror(lua_State *L, DWORD dwErr);
+# define LUA_LAST_DLL_ERROR_ASSERT(L,exp)((exp)||(lua_dllerror(L, 0),0))
+# define LUA_CHECK_DLL_ERROR(L, code) ((void)((code)&&(lua_dllerror(L, (code)),0)))
+# define LUA_CHECK_LAST_DLL_ERROR(L) lua_dllerror(L, 0)
+#else
+void lua_dllerror(lua_State *L, DWORD dwErr, const char * exp, const char * file, int line);
+# define LUA_LAST_DLL_ERROR_ASSERT(L,exp)((exp)||(lua_dllerror(L, 0, #exp, __FILE__, __LINE__),0))
+# define LUA_CHECK_DLL_ERROR(L, code) ((void)((code)&&(lua_dllerror(L, (code), NULL, __FILE__, __LINE__),0)))
+# define LUA_CHECK_LAST_DLL_ERROR(L) lua_dllerror(L, 0, NULL, __FILE__, __LINE__)
+#endif
+#define LUA_LAST_DLL_ERROR_ASSERT_RETURN_OBJECT(L,exp) LUA_CHECK_RETURN_OBJECT(L, LUA_LAST_DLL_ERROR_ASSERT(L,exp))
+#define LUA_LAST_DLL_ERROR_ASSERT_LEAVE_OBJECT(L,exp) LUA_CHECK_LEAVE_OBJECT(L, LUA_LAST_DLL_ERROR_ASSERT(L,exp))
+#define LUA_LAST_DLL_ERROR_ASSERT_PUSHBOOL(L,exp) lua_pushboolean(L, LUA_LAST_DLL_ERROR_ASSERT(L, exp)?1:0)
+#define LUA_LAST_DLL_ERROR_ASSERT_RETBOOL(L,exp) return(LUA_LAST_DLL_ERROR_ASSERT_PUSHBOOL(L,exp), 1)
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif //__LUAWIN_DLLERROR_H__
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/luawinmacro.h b/3rdparty/lua/src/modules/lua-winreg/src/luawinmacro.h
index fc51615..19ff8a7 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/luawinmacro.h
+++ b/3rdparty/lua/src/modules/lua-winreg/src/luawinmacro.h
@@ -1,20 +1,20 @@
-#ifndef __LUAMACWIN_H__
-#define __LUAMACWIN_H__
-/* Lua useful macros for Windows */
-
-#define lua_toLONG(L,i) ((LONG)lua_tointeger(L,(i)))
-#define lua_toDWORD(L,i) ((DWORD)lua_tonumber(L,(i)))
-#define lua_toWORD(L,i) ((WORD)lua_tointeger(L,(i)))
-#define lua_checkLONG(L,i) ((LONG)luaL_checkinteger(L,(i)))
-#define lua_checkDWORD(L,i) ((DWORD)luaL_checknumber(L,(i)))
-#define lua_checkUINT(L,i) ((UINT)luaL_checknumber(L,(i)))
-#define lua_checkWORD(L,i) ((WORD)luaL_checkinteger(L,(i)))
-#define lua_checkSHORT(L,i) ((SHORT)luaL_checkinteger(L,(i)))
-#define lua_optUINT(L,i,d) ((UINT)luaL_optnumber(L,(i),(d)))
-#define lua_optDWORD(L,i,d) ((DWORD)luaL_optnumber(L,(i),(d)))
-#define lua_optSHORT(L,i,d) ((SHORT)luaL_optinteger(L,(i),(d)))
-#define lua_optWORD(L,i,d) ((WORD)luaL_optinteger(L,(i),(d)))
-
-#endif //__LUAMACWIN_H__
-
-
+#ifndef __LUAMACWIN_H__
+#define __LUAMACWIN_H__
+/* Lua useful macros for Windows */
+
+#define lua_toLONG(L,i) ((LONG)lua_tointeger(L,(i)))
+#define lua_toDWORD(L,i) ((DWORD)lua_tonumber(L,(i)))
+#define lua_toWORD(L,i) ((WORD)lua_tointeger(L,(i)))
+#define lua_checkLONG(L,i) ((LONG)luaL_checkinteger(L,(i)))
+#define lua_checkDWORD(L,i) ((DWORD)luaL_checknumber(L,(i)))
+#define lua_checkUINT(L,i) ((UINT)luaL_checknumber(L,(i)))
+#define lua_checkWORD(L,i) ((WORD)luaL_checkinteger(L,(i)))
+#define lua_checkSHORT(L,i) ((SHORT)luaL_checkinteger(L,(i)))
+#define lua_optUINT(L,i,d) ((UINT)luaL_optnumber(L,(i),(d)))
+#define lua_optDWORD(L,i,d) ((DWORD)luaL_optnumber(L,(i),(d)))
+#define lua_optSHORT(L,i,d) ((SHORT)luaL_optinteger(L,(i),(d)))
+#define lua_optWORD(L,i,d) ((WORD)luaL_optinteger(L,(i),(d)))
+
+#endif //__LUAMACWIN_H__
+
+
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/stdmacro.h b/3rdparty/lua/src/modules/lua-winreg/src/stdmacro.h
index db91726..c90972d 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/stdmacro.h
+++ b/3rdparty/lua/src/modules/lua-winreg/src/stdmacro.h
@@ -1,77 +1,77 @@
-#ifndef __STDMACRO_H__
-#define __STDMACRO_H__
-// determine number of elements in an array (not bytes)
-#ifndef _countof
-# define _countof(array) (sizeof(array)/sizeof(array[0]))
-#endif
-// 2^n
-#ifndef twoto
-# define twoto(x) (1<<(x))
-#endif
-// BIT OPERATION
-#define BITINC(f,v) ((f)&(v))
-#define BITINK(f,v) (((f)&(v))==(v))
-#define BITADD(f,v) (f)|=(v);
-#define BITREM(f,v) (f)&=~(v);
-#define BITMOD(f,a,r) (f)=((f)&(~(r)))|(a);
-#define BITSWT(f,v) if(BITINC(f,v)){BITREM(f,v)}else{BITADD(f,v)}
-#define BITIIF(f,v,b) if((b)){BITADD(f,v)}else{BITREM(f,v)}
-/*** STRING ***/
-#define ASCII2NUM(c) (ISDIGIT(c)?(c-'0'):(TOUPPER(c)-'A'+10))
-#define ISASCII(c) (AMID(c,0,127))
-#define ISSPACE(c) ((c)=='\r'||(c)=='\n'||(c)=='\v'||(c)=='\t'||(c)==' ')
-#define ISUPPER(c) (AMID(c,'A'/*65*/,'Z'/*90*/))
-#define ISLOWER(c) (AMID(c,'a'/*97*/,'z'/*122*/))
-#define ISDIGIT(c) (AMID(c,'0'/*48*/,'9'/*57*/))
-#define ISXDIGIT(c) (ISDIGIT(c)||AMID(c,'A'/*65*/,'F'/*70*/)||AMID(c,'a'/*97*/,'f'/*102*/))
-#define ISALPHA(c) (ISUPPER(c)||ISLOWER(c))
-#define ISALNUM(c) (ISALPHA(c)||ISDIGIT(c))
-#define ISBDIGIT(c) ('0'/*48*/==(c)||'1'/*49*/==(c))
-#define ISODIGIT(c) (AMID(c,'0'/*48*/,'7'/*55*/))
-#define ISCNTRL(c) (AMID(c,/*(NUL)*/0,/*(US)*/0x1F)||/*(DEL)*/0x7F==(c))
-
-#define ISBLANK(c) (/*32*/' '==(c))
-#define ISPUNCT(c) (ISPRINT(c) && !ISALNUM(c) && !ISSPACE(c))
-
-#define ISGRAPH(c) (ISPUNCT(c)||ISALNUM(c))
-#define ISPRINT(c) (ISBLANK(c)||ISGRAPH(c))
-
-#define ISNAMECHR1(c) (ISALPHA(c)||'_'/*95*/==(c))
-#define ISNAMECHR(c) (ISALNUM(c)||'_'/*95*/==(c))
-#define ISSLASH(c) ((c)=='/'||(c)=='\\')
-#define ISPAREN(c) ((c)=='('||(c)==')')
-//
-#define TOLOWER(c) (ISUPPER(c)?((c)+32):(c))
-#define TOUPPER(c) (ISLOWER(c)?((c)-32):(c))
-/*** MISC ***/
-//CASTING
-#ifndef cast
-# define cast(t, exp) ((t)(exp))
-#endif
-// is between
-#define AMID(c,x,y) (((x)<=(c))&&((c)<=(y)))
-// avoid comp err
-#ifndef UNUSED
-# define UNUSED(x) (void)(x)
-#endif // UNUSED
-// Ternary ops
-#define IIF(b,t,f) ((b)?(t):(f))
-// swap 2 numbers
-#define SWAP(a,b) ((a)^=(b)^=(a)^=(b))
-// for to loop
-#define FORTO(v,x,y) for((v)=(x);(v)<(y);(v)++)
-// string equal
-#define STREQ(s1,s2) (strcmp((const char *)(s1),(const char *)(s2))==0)
-#define STRIEQ(s1,s2) (strncmp((const char *)(s1),(const char *)(s2))==0)
-// string not equal
-#define STRNEQ(s1,s2) (strcmp((const char *)(s1),(const char *)(s2))!=0)
-
-#define DZTS_ITER_INIT(T,V,P) {T V = (P);while(V[0]){
-#define DZTS_ITER_CONT(V) while((V++)[0]!=0);}}
-
-// iter std::list l = std::list; a & b = std::list iters
-#define StdContainer_EraseAllItem(c) (c.erase(c.begin(),c.end()))
-#define StdContainer_ForEachItem(l,a,o) for(a=l.begin(),o=l.end();a!=o;a++)
-#define StdContainer_RemoveItem(l,a,n) (n=a;n++,l.erase(a),a=n)
-
-#endif //__STDMACRO_H__
+#ifndef __STDMACRO_H__
+#define __STDMACRO_H__
+// determine number of elements in an array (not bytes)
+#ifndef _countof
+# define _countof(array) (sizeof(array)/sizeof(array[0]))
+#endif
+// 2^n
+#ifndef twoto
+# define twoto(x) (1<<(x))
+#endif
+// BIT OPERATION
+#define BITINC(f,v) ((f)&(v))
+#define BITINK(f,v) (((f)&(v))==(v))
+#define BITADD(f,v) (f)|=(v);
+#define BITREM(f,v) (f)&=~(v);
+#define BITMOD(f,a,r) (f)=((f)&(~(r)))|(a);
+#define BITSWT(f,v) if(BITINC(f,v)){BITREM(f,v)}else{BITADD(f,v)}
+#define BITIIF(f,v,b) if((b)){BITADD(f,v)}else{BITREM(f,v)}
+/*** STRING ***/
+#define ASCII2NUM(c) (ISDIGIT(c)?(c-'0'):(TOUPPER(c)-'A'+10))
+#define ISASCII(c) (AMID(c,0,127))
+#define ISSPACE(c) ((c)=='\r'||(c)=='\n'||(c)=='\v'||(c)=='\t'||(c)==' ')
+#define ISUPPER(c) (AMID(c,'A'/*65*/,'Z'/*90*/))
+#define ISLOWER(c) (AMID(c,'a'/*97*/,'z'/*122*/))
+#define ISDIGIT(c) (AMID(c,'0'/*48*/,'9'/*57*/))
+#define ISXDIGIT(c) (ISDIGIT(c)||AMID(c,'A'/*65*/,'F'/*70*/)||AMID(c,'a'/*97*/,'f'/*102*/))
+#define ISALPHA(c) (ISUPPER(c)||ISLOWER(c))
+#define ISALNUM(c) (ISALPHA(c)||ISDIGIT(c))
+#define ISBDIGIT(c) ('0'/*48*/==(c)||'1'/*49*/==(c))
+#define ISODIGIT(c) (AMID(c,'0'/*48*/,'7'/*55*/))
+#define ISCNTRL(c) (AMID(c,/*(NUL)*/0,/*(US)*/0x1F)||/*(DEL)*/0x7F==(c))
+
+#define ISBLANK(c) (/*32*/' '==(c))
+#define ISPUNCT(c) (ISPRINT(c) && !ISALNUM(c) && !ISSPACE(c))
+
+#define ISGRAPH(c) (ISPUNCT(c)||ISALNUM(c))
+#define ISPRINT(c) (ISBLANK(c)||ISGRAPH(c))
+
+#define ISNAMECHR1(c) (ISALPHA(c)||'_'/*95*/==(c))
+#define ISNAMECHR(c) (ISALNUM(c)||'_'/*95*/==(c))
+#define ISSLASH(c) ((c)=='/'||(c)=='\\')
+#define ISPAREN(c) ((c)=='('||(c)==')')
+//
+#define TOLOWER(c) (ISUPPER(c)?((c)+32):(c))
+#define TOUPPER(c) (ISLOWER(c)?((c)-32):(c))
+/*** MISC ***/
+//CASTING
+#ifndef cast
+# define cast(t, exp) ((t)(exp))
+#endif
+// is between
+#define AMID(c,x,y) (((x)<=(c))&&((c)<=(y)))
+// avoid comp err
+#ifndef UNUSED
+# define UNUSED(x) (void)(x)
+#endif // UNUSED
+// Ternary ops
+#define IIF(b,t,f) ((b)?(t):(f))
+// swap 2 numbers
+#define SWAP(a,b) ((a)^=(b)^=(a)^=(b))
+// for to loop
+#define FORTO(v,x,y) for((v)=(x);(v)<(y);(v)++)
+// string equal
+#define STREQ(s1,s2) (strcmp((const char *)(s1),(const char *)(s2))==0)
+#define STRIEQ(s1,s2) (strncmp((const char *)(s1),(const char *)(s2))==0)
+// string not equal
+#define STRNEQ(s1,s2) (strcmp((const char *)(s1),(const char *)(s2))!=0)
+
+#define DZTS_ITER_INIT(T,V,P) {T V = (P);while(V[0]){
+#define DZTS_ITER_CONT(V) while((V++)[0]!=0);}}
+
+// iter std::list l = std::list; a & b = std::list iters
+#define StdContainer_EraseAllItem(c) (c.erase(c.begin(),c.end()))
+#define StdContainer_ForEachItem(l,a,o) for(a=l.begin(),o=l.end();a!=o;a++)
+#define StdContainer_RemoveItem(l,a,n) (n=a;n++,l.erase(a),a=n)
+
+#endif //__STDMACRO_H__
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/win_privileges.c b/3rdparty/lua/src/modules/lua-winreg/src/win_privileges.c
index b6abf88..a773959 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/win_privileges.c
+++ b/3rdparty/lua/src/modules/lua-winreg/src/win_privileges.c
@@ -1,48 +1,48 @@
-#include <windows.h>
-
-
-BOOL win_setprivilege(const TCHAR * privilege, BOOL bEnable, HANDLE hToken){
- TOKEN_PRIVILEGES tpPrevious;
- TOKEN_PRIVILEGES tp;
- DWORD cbPrevious = sizeof(TOKEN_PRIVILEGES);
- LUID luid;
- HANDLE hTokenUsed;
-
- // if no token specified open process token
- if(hToken == 0){
- if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hTokenUsed)){
- return FALSE;
- }
- }else hTokenUsed = hToken;
-
- if (!LookupPrivilegeValue(NULL, privilege, &luid )){
- if (hToken == 0)
- CloseHandle(hTokenUsed);
- return FALSE;
- }
-
- tp.PrivilegeCount = 1;
- tp.Privileges[0].Luid = luid;
- tp.Privileges[0].Attributes = 0;
-
- if (!AdjustTokenPrivileges(hTokenUsed, FALSE, &tp, sizeof(TOKEN_PRIVILEGES), &tpPrevious, &cbPrevious)){
- if (hToken == 0)
- CloseHandle(hTokenUsed);
- return FALSE;
- }
-
- tpPrevious.PrivilegeCount = 1;
- tpPrevious.Privileges[0].Luid = luid;
-
- if (bEnable)
- tpPrevious.Privileges[0].Attributes |= (SE_PRIVILEGE_ENABLED);
- else
- tpPrevious.Privileges[0].Attributes ^= (SE_PRIVILEGE_ENABLED & tpPrevious.Privileges[0].Attributes);
-
- if (!AdjustTokenPrivileges(hTokenUsed, FALSE, &tpPrevious, cbPrevious, NULL, NULL)){
- if (hToken == 0)
- CloseHandle(hTokenUsed);
- return FALSE;
- }
- return TRUE;
-}
+#include <windows.h>
+
+
+BOOL win_setprivilege(const TCHAR * privilege, BOOL bEnable, HANDLE hToken){
+ TOKEN_PRIVILEGES tpPrevious;
+ TOKEN_PRIVILEGES tp;
+ DWORD cbPrevious = sizeof(TOKEN_PRIVILEGES);
+ LUID luid;
+ HANDLE hTokenUsed;
+
+ // if no token specified open process token
+ if(hToken == 0){
+ if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hTokenUsed)){
+ return FALSE;
+ }
+ }else hTokenUsed = hToken;
+
+ if (!LookupPrivilegeValue(NULL, privilege, &luid )){
+ if (hToken == 0)
+ CloseHandle(hTokenUsed);
+ return FALSE;
+ }
+
+ tp.PrivilegeCount = 1;
+ tp.Privileges[0].Luid = luid;
+ tp.Privileges[0].Attributes = 0;
+
+ if (!AdjustTokenPrivileges(hTokenUsed, FALSE, &tp, sizeof(TOKEN_PRIVILEGES), &tpPrevious, &cbPrevious)){
+ if (hToken == 0)
+ CloseHandle(hTokenUsed);
+ return FALSE;
+ }
+
+ tpPrevious.PrivilegeCount = 1;
+ tpPrevious.Privileges[0].Luid = luid;
+
+ if (bEnable)
+ tpPrevious.Privileges[0].Attributes |= (SE_PRIVILEGE_ENABLED);
+ else
+ tpPrevious.Privileges[0].Attributes ^= (SE_PRIVILEGE_ENABLED & tpPrevious.Privileges[0].Attributes);
+
+ if (!AdjustTokenPrivileges(hTokenUsed, FALSE, &tpPrevious, cbPrevious, NULL, NULL)){
+ if (hToken == 0)
+ CloseHandle(hTokenUsed);
+ return FALSE;
+ }
+ return TRUE;
+}
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/win_privileges.h b/3rdparty/lua/src/modules/lua-winreg/src/win_privileges.h
index 8613a1c..08cc837 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/win_privileges.h
+++ b/3rdparty/lua/src/modules/lua-winreg/src/win_privileges.h
@@ -1,13 +1,13 @@
-#ifndef __WIN_PRIVILEGES_H__
-#define __WIN_PRIVILEGES_H__
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <windows.h>
-BOOL win_setprivilege(const TCHAR * privilege, BOOL bEnable, HANDLE hToken);
-
-#ifdef __cplusplus
-}
-#endif
-#endif //__WIN_PRIVILEGES_H__
+#ifndef __WIN_PRIVILEGES_H__
+#define __WIN_PRIVILEGES_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <windows.h>
+BOOL win_setprivilege(const TCHAR * privilege, BOOL bEnable, HANDLE hToken);
+
+#ifdef __cplusplus
+}
+#endif
+#endif //__WIN_PRIVILEGES_H__
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/win_registry.c b/3rdparty/lua/src/modules/lua-winreg/src/win_registry.c
index a6ff972..4603251 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/win_registry.c
+++ b/3rdparty/lua/src/modules/lua-winreg/src/win_registry.c
@@ -1,20 +1,20 @@
-#include <windows.h>
-
-// delete the whole sub key
-LONG win_reg_deltree(HKEY hParentKey, const TCHAR * strKeyName){
- TCHAR szSubKeyName[MAX_PATH];
- HKEY hCurrentKey;
- LONG dwResult;
- if ((dwResult = RegOpenKey(hParentKey, strKeyName, &hCurrentKey)) == ERROR_SUCCESS){
- // Remove all subkeys of the key to delete
- while ((dwResult = RegEnumKey(hCurrentKey, 0, szSubKeyName, 255)) == ERROR_SUCCESS){
- if((dwResult = win_reg_deltree(hCurrentKey, szSubKeyName)) != ERROR_SUCCESS)break;
- }
- // If all went well, we should now be able to delete the requested key
- if((dwResult == ERROR_NO_MORE_ITEMS) || (dwResult == ERROR_BADKEY)){
- dwResult = RegDeleteKey(hParentKey, strKeyName);
- }
- RegCloseKey(hCurrentKey);
- }
- return dwResult;
+#include <windows.h>
+
+// delete the whole sub key
+LONG win_reg_deltree(HKEY hParentKey, const TCHAR * strKeyName){
+ TCHAR szSubKeyName[MAX_PATH];
+ HKEY hCurrentKey;
+ LONG dwResult;
+ if ((dwResult = RegOpenKey(hParentKey, strKeyName, &hCurrentKey)) == ERROR_SUCCESS){
+ // Remove all subkeys of the key to delete
+ while ((dwResult = RegEnumKey(hCurrentKey, 0, szSubKeyName, 255)) == ERROR_SUCCESS){
+ if((dwResult = win_reg_deltree(hCurrentKey, szSubKeyName)) != ERROR_SUCCESS)break;
+ }
+ // If all went well, we should now be able to delete the requested key
+ if((dwResult == ERROR_NO_MORE_ITEMS) || (dwResult == ERROR_BADKEY)){
+ dwResult = RegDeleteKey(hParentKey, strKeyName);
+ }
+ RegCloseKey(hCurrentKey);
+ }
+ return dwResult;
} \ No newline at end of file
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/win_registry.h b/3rdparty/lua/src/modules/lua-winreg/src/win_registry.h
index edb722c..fb71e18 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/win_registry.h
+++ b/3rdparty/lua/src/modules/lua-winreg/src/win_registry.h
@@ -1,13 +1,13 @@
-#ifndef __WIN_REGISTRY_H__
-#define __WIN_REGISTRY_H__
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <windows.h>
-LONG win_reg_deltree(HKEY hParentKey, const TCHAR * strKeyName);
-
-#ifdef __cplusplus
-}
-#endif
-#endif //__WIN_REGISTRY_H__
+#ifndef __WIN_REGISTRY_H__
+#define __WIN_REGISTRY_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <windows.h>
+LONG win_reg_deltree(HKEY hParentKey, const TCHAR * strKeyName);
+
+#ifdef __cplusplus
+}
+#endif
+#endif //__WIN_REGISTRY_H__
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/win_trace.c b/3rdparty/lua/src/modules/lua-winreg/src/win_trace.c
index 3bab1b6..9a62a1e 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/win_trace.c
+++ b/3rdparty/lua/src/modules/lua-winreg/src/win_trace.c
@@ -1,44 +1,44 @@
-#include <windows.h>
-
-/*
-BOOL CALLBACK IsDebuggerPresentStub(VOID);
-BOOL (CALLBACK *IsDebuggerPresent)(VOID) = IsDebuggerPresentStub;
-
-BOOL CALLBACK IsDebuggerPresentStub(VOID){
- HINSTANCE hinst = GetModuleHandleA("KERNEL32.DLL");
- FARPROC fp = GetProcAddress(hinst, "IsDebuggerPresent");
- if (fp) {
- *(FARPROC *)&IsDebuggerPresent = fp;
- return IsDebuggerPresent();
- }
- return 0;
-}
-*/
-
-void win_traceA(const char *pszFmt, ...){
- CHAR tchbuf[1024] = {'$',0};
- va_list argList = NULL;
- va_start(argList, pszFmt);
- wvsprintfA(&tchbuf[1], pszFmt, argList);
- va_end(argList);
- lstrcatA(tchbuf, "\r\n");
- if(IsDebuggerPresent()){
- OutputDebugStringA(tchbuf);
- }else{
- DWORD dwWrt;
- WriteConsoleA(GetStdHandle(STD_ERROR_HANDLE), tchbuf, lstrlenA(tchbuf), &dwWrt, NULL);
- }
-}
-void win_traceW(const WCHAR *pszFmt, ...){
- WCHAR tchbuf[1024];
- va_list argList = NULL;
- va_start(argList, pszFmt);
- wvsprintfW(tchbuf, pszFmt, argList);
- va_end(argList);
- if(IsDebuggerPresent()){
- OutputDebugStringW(tchbuf);
- }else{
- DWORD dwWrt;
- WriteConsoleW(GetStdHandle(STD_ERROR_HANDLE), tchbuf, lstrlenW(tchbuf), &dwWrt, NULL);
- }
-}
+#include <windows.h>
+
+/*
+BOOL CALLBACK IsDebuggerPresentStub(VOID);
+BOOL (CALLBACK *IsDebuggerPresent)(VOID) = IsDebuggerPresentStub;
+
+BOOL CALLBACK IsDebuggerPresentStub(VOID){
+ HINSTANCE hinst = GetModuleHandleA("KERNEL32.DLL");
+ FARPROC fp = GetProcAddress(hinst, "IsDebuggerPresent");
+ if (fp) {
+ *(FARPROC *)&IsDebuggerPresent = fp;
+ return IsDebuggerPresent();
+ }
+ return 0;
+}
+*/
+
+void win_traceA(const char *pszFmt, ...){
+ CHAR tchbuf[1024] = {'$',0};
+ va_list argList = NULL;
+ va_start(argList, pszFmt);
+ wvsprintfA(&tchbuf[1], pszFmt, argList);
+ va_end(argList);
+ lstrcatA(tchbuf, "\r\n");
+ if(IsDebuggerPresent()){
+ OutputDebugStringA(tchbuf);
+ }else{
+ DWORD dwWrt;
+ WriteConsoleA(GetStdHandle(STD_ERROR_HANDLE), tchbuf, lstrlenA(tchbuf), &dwWrt, NULL);
+ }
+}
+void win_traceW(const WCHAR *pszFmt, ...){
+ WCHAR tchbuf[1024];
+ va_list argList = NULL;
+ va_start(argList, pszFmt);
+ wvsprintfW(tchbuf, pszFmt, argList);
+ va_end(argList);
+ if(IsDebuggerPresent()){
+ OutputDebugStringW(tchbuf);
+ }else{
+ DWORD dwWrt;
+ WriteConsoleW(GetStdHandle(STD_ERROR_HANDLE), tchbuf, lstrlenW(tchbuf), &dwWrt, NULL);
+ }
+}
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/win_trace.h b/3rdparty/lua/src/modules/lua-winreg/src/win_trace.h
index b973a6f..7ed98af 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/win_trace.h
+++ b/3rdparty/lua/src/modules/lua-winreg/src/win_trace.h
@@ -1,52 +1,52 @@
-#ifndef __WINTRACE_H__
-#define __WINTRACE_H__
-#pragma once
-
-#ifndef NOP_FUNCTION
- #if (_MSC_VER >= 1210)
- #define NOP_FUNCTION __noop
- #else
- #pragma warning(disable:4505) // unreferenced local function has been removed.
- static void nullfunc(const void * x, ...){FatalAppExit(0,(LPCTSTR)x);}
- #define NOP_FUNCTION 1?((void)0):nullfunc
- #endif
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <windows.h>
-#ifdef NDEBUG
- #define WIN_TRACET NOP_FUNCTION
- #define WIN_TRACEA NOP_FUNCTION
- #define WIN_TRACEW NOP_FUNCTION
- #define WIN_TRACEA_FT NOP_FUNCTION
- #define WIN_TRACEA_ST NOP_FUNCTION
-#else
- void win_traceA(const char *pszFmt, ...);
- void win_traceW(const WCHAR *pszFmt, ...);
-
- #define WIN_TRACEA win_traceA
- #define WIN_TRACEW win_traceW
- #ifdef UNICODE
- #define WIN_TRACET win_traceW
- #else
- #define WIN_TRACET win_traceA
- #endif
-
- // trace a FILE_TIME
- #define WIN_TRACEA_FT(msg,pft) if(pft){SYSTEMTIME st;FileTimeToSystemTime(pft, &st); \
- WIN_TRACEA(msg " %s %0.4d-%0.2d-%0.2d %0.2d:%0.2d:%0.2d.%0.3d", #pft, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);}
-
- // trace a SYSTEMTIME
- #define WIN_TRACEA_ST(msg,pst) if(pst){ \
- WIN_TRACEA(msg " %s %0.4d-%0.2d-%0.2d %0.2d:%0.2d:%0.2d.%0.3d", #pst, pst->wYear, pst->wMonth, pst->wDay, pst->wHour, pst->wMinute, pst->wSecond, pst->wMilliseconds);}
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__WINTRACE_H__
+#ifndef __WINTRACE_H__
+#define __WINTRACE_H__
+#pragma once
+
+#ifndef NOP_FUNCTION
+ #if (_MSC_VER >= 1210)
+ #define NOP_FUNCTION __noop
+ #else
+ #pragma warning(disable:4505) // unreferenced local function has been removed.
+ static void nullfunc(const void * x, ...){FatalAppExit(0,(LPCTSTR)x);}
+ #define NOP_FUNCTION 1?((void)0):nullfunc
+ #endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <windows.h>
+#ifdef NDEBUG
+ #define WIN_TRACET NOP_FUNCTION
+ #define WIN_TRACEA NOP_FUNCTION
+ #define WIN_TRACEW NOP_FUNCTION
+ #define WIN_TRACEA_FT NOP_FUNCTION
+ #define WIN_TRACEA_ST NOP_FUNCTION
+#else
+ void win_traceA(const char *pszFmt, ...);
+ void win_traceW(const WCHAR *pszFmt, ...);
+
+ #define WIN_TRACEA win_traceA
+ #define WIN_TRACEW win_traceW
+ #ifdef UNICODE
+ #define WIN_TRACET win_traceW
+ #else
+ #define WIN_TRACET win_traceA
+ #endif
+
+ // trace a FILE_TIME
+ #define WIN_TRACEA_FT(msg,pft) if(pft){SYSTEMTIME st;FileTimeToSystemTime(pft, &st); \
+ WIN_TRACEA(msg " %s %0.4d-%0.2d-%0.2d %0.2d:%0.2d:%0.2d.%0.3d", #pft, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);}
+
+ // trace a SYSTEMTIME
+ #define WIN_TRACEA_ST(msg,pst) if(pst){ \
+ WIN_TRACEA(msg " %s %0.4d-%0.2d-%0.2d %0.2d:%0.2d:%0.2d.%0.3d", #pst, pst->wYear, pst->wMonth, pst->wDay, pst->wHour, pst->wMinute, pst->wSecond, pst->wMilliseconds);}
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__WINTRACE_H__
diff --git a/3rdparty/lua/src/modules/lua-winreg/src/winreg.c b/3rdparty/lua/src/modules/lua-winreg/src/winreg.c
index ab441b6..4ea9795 100644
--- a/3rdparty/lua/src/modules/lua-winreg/src/winreg.c
+++ b/3rdparty/lua/src/modules/lua-winreg/src/winreg.c
@@ -1,691 +1,691 @@
-#ifdef _LUAMSVC
-# include <luamsvc.h>
-#endif
-
-#include <assert.h>
-#ifndef lua_assert
-# define lua_assert assert
-#endif // lua_assert
-
-#include <lua.h>
-#include <lualib.h>
-#include <lauxlib.h>
-#include "l52util.h"
-
-#include "stdmacro.h"
-#include "luamacro.h"
-#include "luawinmacro.h"
-
-#include "lua_tstring.h"
-#include "lua_int64.h"
-#include "lua_mtutil.h"
-#include "luawin_dllerror.h"
-
-#include "win_trace.h"
-#include "win_privileges.h"
-#include "win_registry.h"
-
-#define LUA_REG_DEFINE_EXTERNS
-#include "luareg.h"
-
-#define lua_error_invalid_option(L, i) luaL_argerror(L, (i), "invalid option")
-#define lrk_hkey "{afx/hkey}"
-
-#ifndef HKEY_PERFORMANCE_TEXT
-#define HKEY_PERFORMANCE_TEXT (( HKEY )((LONG)0x80000050) )
-#define HKEY_PERFORMANCE_NLSTEXT (( HKEY )((LONG)0x80000060) )
-#endif
-#ifndef REG_QWORD
-#define REG_QWORD ( 11 ) // 64-bit number
-#endif
-
-
-#ifdef LUA_REG_AS_DLL
-BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved){
- UNUSED(hModule);
- UNUSED(lpReserved);
- UNUSED(ul_reason_for_call);
- return TRUE;
-}
-
-__declspec(dllexport)
-#else
-LUA_API
-#endif // LUA_REG_AS_DLL
-int luaopen_winreg(lua_State *L){
- luaL_register(L, "winreg", lreg_reglib);
- return 1;
-}
-#define reg_aux_gethkey(L,index) (*((PHKEY)luaL_checkudata(L, index, lrk_hkey)))
-#define reg_aux_getphkey(L,index) ((PHKEY)luaL_checkudata(L, index, lrk_hkey))
-
-typedef struct HKEY_DATA{
- HKEY hkey;
- DWORD opt;
-} HKEY_DATA, *PHKEY_DATA;
-
-int reg_aux_newhkey(lua_State *L, PHKEY pHKey){
- PHKEY phKey = (PHKEY)lua_newuserdatamt(L, sizeof(HKEY), lrk_hkey, lreg_regobj);
- return phKey && pHKey && (NULL != (*phKey = *pHKey));
-}
-
-int reg_aux_newkey(lua_State *L, HKEY HKey, LPCTSTR szKey, LPCTSTR szClass, REGSAM samDesired, BOOL bCreate){
- DWORD dwDis = (bCreate==FALSE) ? REG_OPENED_EXISTING_KEY : 0;
- HKEY hKey = NULL;
- LONG ret = (bCreate
- ? RegCreateKeyEx(HKey, szKey, 0, (PTSTR)szClass, 0, samDesired, NULL, &hKey, &dwDis)
- : RegOpenKeyEx(HKey, szKey, 0, samDesired, &hKey)
- );
- //WIN_TRACET(_T("%hs: hkey<%x>, sub<%s>, cls<%s>, acc<%d>;"), bCreate?"createkey":"openkey", HKey, szKey, szClass, samDesired);
-
- if(ret == ERROR_SUCCESS){
- reg_aux_newhkey(L, &hKey);
- return dwDis;
- }else{
- // if we're opening a key, dont shout the error
- // just return nil
- // this will test if the key exist
- if(bCreate){
- LUA_CHECK_DLL_ERROR(L,ret);
- }
- lua_pushnil(L);
- return 0;
- }
-}
-
-REGSAM reg_aux_getaccess(lua_State *L, int i){
- REGSAM acc = 0;
- if(lua_isnumber(L, i) || lua_isnoneornil(L, i)){
- acc = lua_optint(L, i, KEY_ALL_ACCESS);
- }else{
- const char * psz = lua_checkstring(L, i);
- for(;*psz;psz++){
- switch(*psz){
- case 'w': acc |= KEY_WRITE; break;
- case 'r': acc |= KEY_READ ; break;
- case 'a': acc |= KEY_ALL_ACCESS ; break;
- case 'X': acc |= KEY_WOW64_64KEY ; break;
- case 'x': acc |= KEY_WOW64_32KEY ; break;
- default : lua_error_invalid_option(L, i);
- }
- }
- }
- return acc;
-}
-
-typedef struct KVDATA{
- const char * name;
- size_t data;
-} KVDATA, *PKVDATA;
-
-HKEY reg_aux_strtohkey(lua_State *L, const char * psz){
- static KVDATA ph[] = {
- {"HKEY_CLASSES_ROOT", (size_t)HKEY_CLASSES_ROOT},
- {"HKEY_CURRENT_USER", (size_t)HKEY_CURRENT_USER},
- {"HKEY_LOCAL_MACHINE", (size_t)HKEY_LOCAL_MACHINE},
- {"HKEY_USERS", (size_t)HKEY_USERS},
- {"HKEY_PERFORMANCE_DATA", (size_t)HKEY_PERFORMANCE_DATA},
- {"HKEY_PERFORMANCE_TEXT", (size_t)HKEY_PERFORMANCE_TEXT},
- {"HKEY_PERFORMANCE_NLSTEXT", (size_t)HKEY_PERFORMANCE_NLSTEXT},
- {"HKEY_CURRENT_CONFIG", (size_t)HKEY_CURRENT_CONFIG},
- {"HKEY_DYN_DATA", (size_t)HKEY_DYN_DATA},
- {"HKCR", (size_t)HKEY_CLASSES_ROOT},
- {"HKCU", (size_t)HKEY_CURRENT_USER},
- {"HKLM", (size_t)HKEY_LOCAL_MACHINE},
- {"HKU", (size_t)HKEY_USERS},
- {"HKPD", (size_t)HKEY_PERFORMANCE_DATA},
- {"HKPT", (size_t)HKEY_PERFORMANCE_TEXT},
- {"HKPN", (size_t)HKEY_PERFORMANCE_NLSTEXT},
- {"HKCC", (size_t)HKEY_CURRENT_CONFIG},
- {"HKDD", (size_t)HKEY_DYN_DATA},
- {0,0}
- };
- PKVDATA pph;
- INT64 x;
- if(atoINT64(psz, &x)){
- WIN_TRACEA("DIGIT ROOTKEY %s", psz);
- return (HKEY)(size_t)x;
- }else{
- for(pph = ph; pph->name && _stricmp(psz, pph->name); pph++);
- if(!pph->data)luaL_error(L, "invalid prefix key '%s'", psz);
- return (HKEY)pph->data;
- }
-}
-
-
-void reg_aux_splitkey(lua_State *L, const char * psz){
- const char * szpre;
- // skip space
- while(*psz && ISSPACE(*psz))psz++;
- // remember prefix
- szpre = psz;
- // skip prefix
- while(*psz && *psz != '\\')psz++;
- lua_pushlstring(L, szpre, (int)(psz - szpre)); //@ -2 (rootkey)
- while(*psz && *psz == '\\')psz++;
- lua_pushstring(L, psz); //@ -1 (subkey)
-}
-//docok
-int reglib_createkey(lua_State *L){//reglib.createkey
- //reglib.createkey("<ROOT>\\SUBKEY","access","class")
- HKEY hkey = NULL;
- const char * szPath = lua_checkstring(L, 1);
- REGSAM Access = reg_aux_getaccess(L, 2);
- const TCHAR * pszCls = lua_opttstring(L, 3, NULL);
- const TCHAR * pszSubKey;
- const char * pszRootKey;
- reg_aux_splitkey(L, szPath);
- pszSubKey = lua_totstring(L,-1);
- pszRootKey = lua_tostring(L,-2);
- // get hkey of root-key-string
- hkey = reg_aux_strtohkey(L, pszRootKey);
- reg_aux_newkey(L, hkey, pszSubKey, pszCls, Access, TRUE);
- return 1;
-}
-//docok
-int reglib_openkey(lua_State *L){//reglib.openkey
- HKEY hkey = NULL;
- LONG ret = 0;
- const char * szPath = lua_checkstring(L, 1);
- REGSAM Access = reg_aux_getaccess(L, 2);
-
- if(ISSLASH(szPath[0]) && ISSLASH(szPath[1])){
- HKEY HKey = NULL;
- const TCHAR * pszMachine;
- const char * pszRootKey;
- // \\computer_name\hkxx
- while(szPath[0] && ISSLASH(szPath[0]) )szPath++;// skip the beginning slashes
- reg_aux_splitkey(L, szPath);
- pszMachine = lua_totstring(L,-1);
- pszRootKey = lua_tostring(L,-2);
-
- hkey = reg_aux_strtohkey(L, pszRootKey);
- if((ret = RegConnectRegistry(pszMachine, hkey, &HKey)) == ERROR_SUCCESS){
- reg_aux_newhkey(L, &HKey);
- }else{
- lua_pushnil(L);
- LUA_CHECK_DLL_ERROR(L, ret);
- }
- }else{
- const TCHAR * pszSubKey;
- const char * pszRootKey;
- reg_aux_splitkey(L, szPath);
- pszSubKey = lua_totstring(L,-1);
- pszRootKey = lua_tostring(L,-2);
- hkey = reg_aux_strtohkey(L, pszRootKey);
- reg_aux_newkey(L, hkey, pszSubKey, NULL, Access, FALSE);
- }
- return 1;
-}
-static const KVDATA reg_type_table[] = {
- {"none", REG_NONE},
- {"sz", REG_SZ },
- {"expand_sz", REG_EXPAND_SZ},
- {"binary", REG_BINARY},
- {"dword", REG_DWORD},
- {"dword_big_endian", REG_DWORD_BIG_ENDIAN},
- {"link", REG_LINK},
- {"multi_sz", REG_MULTI_SZ},
- {"resource_list", REG_RESOURCE_LIST},
- {"full_resource_descriptor", REG_FULL_RESOURCE_DESCRIPTOR},
- {"resource_requirements_list", REG_RESOURCE_REQUIREMENTS_LIST},
- {"qword", REG_QWORD},
- {0,0}
-};
-void reg_aux_pushdatatype(lua_State *L, DWORD dwType){
-/* const KVDATA * pkvd;
- for(pkvd = &reg_type_table[0]; pkvd->name && pkvd->data != dwType; pkvd++);
- if(pkvd->name){
- lua_pushstring(L, pkvd->name);
- }else*/{
- lua_pushint(L, dwType);
- }
-}
-
-int reg_aux_getdatatype(lua_State *L, int i){
- if(lua_isrealstring(L, i)){
- const KVDATA * pkvd;
- const char * psz = lua_tostring(L, i);
- for(pkvd = &reg_type_table[0]; pkvd->name && strcmp(psz, pkvd->name); pkvd++);
- return (pkvd->name)?(int)pkvd->data:-1;
- }else{
- return lua_optint(L, i, -1);
- }
-}
-
-BOOL reg_aux_setvalue(lua_State *L, HKEY hKey, const TCHAR * pszVal, int type, int i){
- PBYTE pdata = NULL;
- size_t cdata = 0;
- LONG ret = ERROR_SUCCESS;
- DWORD32 dw32;
- DWORD64 dw64;
-
- if(type < 0){
- switch(lua_type(L, i)){
- break;case LUA_TTABLE :type = REG_MULTI_SZ;
- break;case LUA_TNUMBER:type = REG_DWORD;
- break;case LUA_TSTRING:type = REG_SZ;
- }
- }
- WIN_TRACEA("reg_aux_setvalue val<%s> type<%d>", pszVal, type);
- switch(type){
- case REG_DWORD: case REG_DWORD_BIG_ENDIAN:{
- dw32 = lua_checkDWORD(L, i);
- pdata = (PBYTE)&dw32;
- cdata = sizeof(DWORD32);
- }
- break; case REG_QWORD:{
- if(lua_isuserdata(L, i)){
- memcpy(&dw64, lua_touserdata(L, i), sizeof(DWORD64));
- }else{
- dw64 = lua_checkUINT64(L, i);
- }
- pdata = (PBYTE)&dw64;
- cdata = sizeof(DWORD64);
- }
- break; case REG_MULTI_SZ:{
- size_t len = 0;
- luaL_Buffer B;
- luaL_buffinit(L, &B);
- if(lua_istable(L, i)){
- int n;
- int last = (int)lua_objlen(L, i);
- for (n = 1; n <= last; n++) {
- lua_rawgeti(L, i, n);
- luaL_addstring(&B, lua_checkstring(L, -1));
- luaL_addchar(&B, 0);
- }
- }else{
- luaL_checktype(L, i, LUA_TSTRING);
- lua_pushvalue(L, i);
- luaL_addvalue(&B);
- luaL_addchar(&B, 0);
- }
- luaL_addchar(&B, 0);
- luaL_pushresult(&B);
- pdata = (PBYTE)lua_checkltstring(L, -1, &len);
- cdata = len*sizeof(TCHAR);
- }
- break; case REG_SZ: case REG_EXPAND_SZ:{
- pdata = (PBYTE)lua_checkltstring(L, i, &cdata);
- cdata = (cdata+1)*sizeof(TCHAR);
- }
- break; default:
-#if LUA_VERSION_NUM >= 501
- if(lua_isfulluserdata(L, i)){
- pdata = (PBYTE)lua_touserdata(L, i);
- cdata = lua_objlen(L, i);
- }else
-#endif
- {
- pdata = (PBYTE)luaL_checklstring(L, i, &cdata);
- }
- }
- ret = RegSetValueEx(hKey, pszVal, 0, type, pdata, (DWORD)cdata);
- LUA_CHECK_DLL_ERROR(L, ret);
- return ERROR_SUCCESS == ret;
-}
-void reg_aux_pusheregstrdata(lua_State *L, PVOID pdata, size_t cdata, DWORD dwType, int expand){
- if(pdata == NULL){lua_pushnil(L);return;}
- switch(dwType){
- case REG_DWORD: case REG_DWORD_BIG_ENDIAN: case REG_QWORD:
- {
- char buf[24];
- DWORD64 n;
- if(dwType == REG_QWORD){
- n = *((PDWORD64)pdata);
- }else{
- n = (DWORD64)(*((PDWORD32)pdata));
- }
- if(0 == _ui64toa_s(n, buf, _countof(buf) - 1, 10))
- lua_pushstring(L, buf);
- else
- LUA_CHECK_DLL_ERROR(L, ERROR_INVALID_DATA);
- }
- break; case REG_MULTI_SZ:
- {
- lua_pushltstring(L, (const TCHAR *)pdata, cdata);
- }
- break; case REG_EXPAND_SZ: case REG_SZ:
- {
- DWORD dwLen;
- PTSTR pbuf;
- if( dwType == REG_EXPAND_SZ && expand
- && (dwLen = ExpandEnvironmentStrings((const TCHAR *)pdata, NULL, 0)) > 0
- && NULL != (pbuf = lua_alloc_tchar(L, ++dwLen))
- && (dwLen = ExpandEnvironmentStrings((const TCHAR *)pdata, pbuf, dwLen)) > 0){
- lua_pushtstring(L, pbuf);
- }else{
- lua_pushtstring(L, (const TCHAR *)pdata);
- }
- }
- break;default:
- lua_pushlstring(L, (const char *)pdata, cdata);
- }
-}
-
-void reg_aux_pusheregluadata(lua_State *L, PVOID pdata, size_t cdata, DWORD dwType){
- if(pdata == NULL){lua_pushnil(L);return;}
- switch(dwType){
- case REG_DWORD: case REG_DWORD_BIG_ENDIAN:
- lua_pushnumber(L, *((PDWORD32)pdata));
- break; case REG_QWORD:
- lua_pushUINT64(L, *((PDWORD64)pdata), "reg_aux_pusheregluadata(REG_QWORD)", __FILE__, __LINE__);
- break; case REG_MULTI_SZ:
- {
- int c = 1;
- lua_newtable(L);
- DZTS_ITER_INIT(PTSTR, ptoken, (PTSTR)pdata)
- lua_pushinteger(L, c);
- lua_pushtstring(L, ptoken);//TCHAR!!
- lua_rawset(L, -3);
- c++;
- DZTS_ITER_CONT(ptoken)
- }
- break; case REG_SZ: case REG_EXPAND_SZ:
- lua_pushtstring(L, (const TCHAR *)pdata);
- break;default:
- lua_pushlstring(L, (const char *)pdata, cdata);
- }
-}
-typedef struct _REG_ENUM_TAG { // rc
- HKEY hKey;
- DWORD dwIndex;
- PTSTR buffer;
- DWORD bchlen;
-} REG_ENUM_TAG;
-#define REG_ENUM_MINBUFLEN ((LUAL_BUFFERSIZE-sizeof(REG_ENUM_TAG))/sizeof(TCHAR))
-#define REG_ENUM_DATALEN(n) (sizeof(REG_ENUM_TAG)+((n)*sizeof(TCHAR)))
-
-int reg_aux_enumkey_closure(lua_State *L){
- REG_ENUM_TAG* pret = (REG_ENUM_TAG*)lua_touserdata(L, lua_upvalueindex(1));
- if(pret){
- DWORD dwcbSubKey = pret->bchlen;
- PTSTR pszSubKey = pret->buffer;
- LONG ret = RegEnumKeyEx(pret->hKey, pret->dwIndex, pszSubKey, &dwcbSubKey, 0, NULL, NULL, NULL);
-
- if(ERROR_SUCCESS == ret ){
- lua_pushtstring(L, pszSubKey);
- pret->dwIndex++;
- return 1;
- }
- if(ret != ERROR_NO_MORE_ITEMS){
- WIN_TRACEA("pret->bchlen=%d,dwcbSubKey=%d,Subkey='%s'", pret->bchlen, dwcbSubKey, pszSubKey);
- LUA_CHECK_DLL_ERROR(L, ret);
- }
- }
- lua_pushnil(L);
- return 1;
-}
-int reg_aux_enumvalue_closure(lua_State *L){
- REG_ENUM_TAG* pret = (REG_ENUM_TAG*)lua_touserdata(L, lua_upvalueindex(1));
- if(pret){
- LONG ret = 0;
- DWORD dwType = 0;
- DWORD dwccValue = pret->bchlen;
- PTSTR pszValue = pret->buffer;
-
- ret = RegEnumValue(pret->hKey, pret->dwIndex, pszValue, &dwccValue, 0, &dwType, NULL, NULL);
-
- if(ERROR_SUCCESS == ret ){
- lua_pushtstring(L, pszValue);
- reg_aux_pushdatatype(L, dwType);
- pret->dwIndex++;
- return 2;
- }
- if(ret != ERROR_NO_MORE_ITEMS){
- LUA_CHECK_DLL_ERROR(L, ret);
- }
- }
- lua_pushnil(L);
- return 1;
-}
-//docok
-int reg_close(lua_State *L){//regobj.__gc, regobj.close
- PHKEY phKey = (PHKEY)lua_touserdata(L, 1);
- lua_assert(phKey);
- //WIN_TRACEA("reg_close<%x>;", *phKey);
- if(phKey && *phKey){
- LUA_CHECK_DLL_ERROR(L, RegCloseKey(*phKey));
- *phKey = NULL;
- }
- return 0;
-}
-//docok
-int reg_createkey(lua_State *L){//regobj.createkey
- reg_aux_newkey(L, reg_aux_gethkey(L, 1),
- lua_checktstring(L, 2), (PTSTR)lua_opttstring(L, 4, NULL), reg_aux_getaccess(L, 3), TRUE);
- return 1;
-}
-//docok
-int reg_deletekey(lua_State *L){//regobj.deletekey
- LONG ret;
- // the key name is optional
- if(reg_aux_gethkey(L,1) && lua_isnoneornil(L, 2))
- {
- lua_pushtstring(L, TEXT(""));
- }
- ret = win_reg_deltree(reg_aux_gethkey(L,1), lua_checktstring(L, 2));
- LUA_CHECK_DLL_ERROR(L, ret);
- LUA_CHECK_RETURN_OBJECT(L, ret == ERROR_SUCCESS);
-}
-//docok
-int reg_deletevalue(lua_State *L){//regobj.deletevalue
- LONG ret = RegDeleteValue(reg_aux_gethkey(L,1), lua_checktstring(L, 2));
- LUA_CHECK_DLL_ERROR(L, ret);
- LUA_CHECK_RETURN_OBJECT(L, ret == ERROR_SUCCESS);
-}
-//docok
-int reg_enumkey(lua_State *L){//regobj.enumkey
- HKEY hKey = reg_aux_gethkey(L, 1);
- DWORD dwNameLen = 0;
- REG_ENUM_TAG* pret;
- LONG ret = RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, &dwNameLen, NULL, NULL, NULL, NULL, NULL, NULL);
- dwNameLen = max(REG_ENUM_MINBUFLEN,dwNameLen+1);
- pret = (REG_ENUM_TAG*)lua_newuserdata(L,REG_ENUM_DATALEN(dwNameLen));
-
- pret->hKey = hKey;
- pret->dwIndex = 0;
- pret->bchlen = dwNameLen;
- pret->buffer = (PTSTR)(&pret[1]);
-
- WIN_TRACEA("reg_enumkey bchlen=%d datlen=%d", pret->bchlen, REG_ENUM_DATALEN(dwNameLen));
- LUA_CHECK_DLL_ERROR(L, ret);
- lua_pushcclosure(L, reg_aux_enumkey_closure, 1);
- return 1;
-}
-//docok
-int reg_enumvalue(lua_State *L){//regobj.enumvalue
- HKEY hKey = reg_aux_gethkey(L, 1);
- REG_ENUM_TAG* pret;
- DWORD dwNameLen = 0;
- LONG ret = RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &dwNameLen, NULL, NULL, NULL);
- dwNameLen = max(REG_ENUM_MINBUFLEN,dwNameLen+1);
- pret = (REG_ENUM_TAG*)lua_newuserdata(L,REG_ENUM_DATALEN(dwNameLen));
-
- pret->hKey = hKey;
- pret->dwIndex = 0;
- pret->bchlen = dwNameLen;
- pret->buffer = (PTSTR)(&pret[1]);
-
- WIN_TRACEA("reg_enumkey bchlen=%d datlen=%d", pret->bchlen, REG_ENUM_DATALEN(dwNameLen));
- LUA_CHECK_DLL_ERROR(L, ret);
-
- lua_pushcclosure(L, reg_aux_enumvalue_closure, 1);
- return 1;
-}
-//docok
-int reg_flushkey(lua_State *L){//"regobj.flushkey"
- LONG ret = RegFlushKey(reg_aux_gethkey(L, 1));
- LUA_CHECK_DLL_ERROR(L, ret);
- LUA_CHECK_RETURN_OBJECT(L, ret == ERROR_SUCCESS);
-}
-//docok
-int reg_getinfo(lua_State *L){//regobj.getinfo
- HKEY hKey = reg_aux_gethkey(L,1);
- FILETIME ftLastWriteTime = {0,};
- DWORD dwcbClass = 64, dwcSubKeys = 0, dwcbMaxSubKeyLen = 0, dwcbMaxClassLen = 0, dwcValues = 0, dwcbMaxValueNameLen = 0, dwcbMaxValueLen = 0, dwcbSecurityDescriptor = 0;
- LONG ret = RegQueryInfoKey (hKey, NULL, NULL, NULL, &dwcSubKeys, &dwcbMaxSubKeyLen, &dwcbMaxClassLen, &dwcValues, &dwcbMaxValueNameLen, &dwcbMaxValueLen, &dwcbSecurityDescriptor, &ftLastWriteTime);
- PTSTR psz = lua_alloc_tchar(L, ++dwcbClass);
-
- if(ERROR_MORE_DATA == RegQueryInfoKey(hKey, psz, &dwcbClass, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) ){
- psz = lua_alloc_tchar(L, ++dwcbClass);
- RegQueryInfoKey(hKey, psz, &dwcbClass, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
- }
-
- LUA_CHECK_DLL_ERROR(L, ret);
- if(ret == ERROR_SUCCESS){
- lua_newtable(L);
- lua_rawset_st(L, -3, "class",psz);
- lua_rawset_sn(L, -3, "subkeys",dwcSubKeys);
- lua_rawset_sn(L, -3, "values",dwcValues);
- lua_rawset_sn(L, -3, "maxsubkeylen",dwcbMaxSubKeyLen);
- lua_rawset_sn(L, -3, "maxclasslen",dwcbMaxClassLen);
- lua_rawset_sn(L, -3, "maxvaluelen",dwcbMaxValueLen);
- lua_rawset_sn(L, -3, "maxvaluenamelen",dwcbMaxValueNameLen);
- lua_rawset_sn(L, -3, "maxsecuritydescriptor",dwcbSecurityDescriptor);
- //lua_pushstring(L, "lastwritetime");
- //aux_pushftime(L, &ftLastWriteTime);
- //lua_rawset(L, -3);
- }else{
- lua_pushnil(L);
- }
- return 1;
-}
-//docok
-int reg_getvalue(lua_State *L){//regobj.getvalue
- HKEY hKey = reg_aux_gethkey(L, 1);
- const TCHAR * pszVal = lua_opttstring(L, 2, NULL);
- DWORD dwType = 0;
- DWORD dwLen = 0;
- PVOID pvd = 0;
- LONG ret = ERROR_SUCCESS;
- // open the key
- if( ERROR_SUCCESS == (ret = RegQueryValueEx(hKey, pszVal, NULL, &dwType, NULL, &dwLen))
- // alloc
- && (pvd = lua_newuserdata(L, dwLen)) != NULL
- // query a-again
- && ERROR_SUCCESS == (ret = RegQueryValueEx(hKey, pszVal, NULL, &dwType, pvd, &dwLen))
- ){
- reg_aux_pusheregluadata(L, pvd, dwLen, dwType);
- reg_aux_pushdatatype(L, dwType);
- }else{
- lua_pushnil(L);
- lua_pushnil(L);
- //LUA_CHECK_DLL_ERROR(L, ret);
- }
- return 2;
-}
-#ifndef LUA_REG_NO_HIVEOPS
-//docok
-int reg_loadkey(lua_State *L){//regobj.load
- LONG ret;
- win_setprivilege(SE_RESTORE_NAME, 1, NULL);
- ret = RegLoadKey(reg_aux_gethkey(L,1), lua_checktstring(L, 2), lua_checktstring(L, 3));
- LUA_CHECK_DLL_ERROR(L, ret);
- LUA_CHECK_RETURN_OBJECT(L, ret == ERROR_SUCCESS);
-}
-#endif // LUA_REG_NO_HIVEOPS
-//docok
-int reg_openkey(lua_State *L){//regobj.openkey
- reg_aux_newkey(L, reg_aux_gethkey(L, 1),
- lua_checktstring(L, 2), NULL, reg_aux_getaccess(L, 3), FALSE);
- return 1;
-}
-#ifndef LUA_REG_NO_HIVEOPS
-//docok
-int reg_replacekey(lua_State *L){//regobj.replace
- LONG ret;
- win_setprivilege(SE_RESTORE_NAME, 1, NULL);
- ret = RegReplaceKey(reg_aux_gethkey(L,1), lua_checktstring(L, 2), lua_checktstring(L, 3), lua_checktstring(L, 4));
- LUA_CHECK_DLL_ERROR(L, ret);
- LUA_CHECK_RETURN_OBJECT(L, ret == ERROR_SUCCESS);
-}
-//docok
-int reg_restorekey(lua_State *L){//regobj.restore
- LONG ret;
- DWORD dwFlags = 0;
- win_setprivilege(SE_RESTORE_NAME, 1, NULL);
- if(lua_isboolean(L,3)){
- dwFlags = lua_toboolean(L,3)?REG_WHOLE_HIVE_VOLATILE:0;
- }else{
- dwFlags = lua_optDWORD(L, 3, 0);
- }
- ret = RegRestoreKey(reg_aux_gethkey(L,1), lua_checktstring(L, 2), dwFlags);
- LUA_CHECK_DLL_ERROR(L, ret);
- LUA_CHECK_RETURN_OBJECT(L, ret == ERROR_SUCCESS);
-}
-//docok
-int reg_savekey(lua_State *L){//regobj.save
- LONG ret;
- win_setprivilege(SE_BACKUP_NAME, 1, NULL);
- ret = RegSaveKey(reg_aux_gethkey(L,1), lua_checktstring(L, 2), NULL);
- LUA_CHECK_DLL_ERROR(L, ret);
- LUA_CHECK_RETURN_OBJECT(L, ret == ERROR_SUCCESS);
-}
-#endif // LUA_REG_NO_HIVEOPS
-//docok
-int reg_setvalue(lua_State *L){//regobj.setvalue
- LUA_CHECK_RETURN_OBJECT(L,
- reg_aux_setvalue(L, reg_aux_gethkey(L, 1), lua_opttstring(L, 2, NULL), reg_aux_getdatatype(L, 4), 3)
- );
-}
-#ifndef LUA_REG_NO_HIVEOPS
-//docok
-int reg_unloadkey(lua_State *L){//regobj.unload
- LONG ret;
- win_setprivilege(SE_RESTORE_NAME, 1, NULL);
- ret = RegUnLoadKey(reg_aux_gethkey(L,1), lua_checktstring(L, 2));
- LUA_CHECK_DLL_ERROR(L, ret);
- LUA_CHECK_RETURN_OBJECT(L, ret == ERROR_SUCCESS);
-}
-#endif // LUA_REG_NO_HIVEOPS
-
-int reg_handle(lua_State *L){//regobj.handle
- HKEY hKey = reg_aux_gethkey(L, 1);
- lua_pushlightuserdata(L, hKey);
- return 1;
-}
-
-int reg_detach(lua_State *L){//regobj.detach
- PHKEY phKey = reg_aux_getphkey(L, 1);
- lua_pushlightuserdata(L, *phKey);
- *phKey = NULL;
- return 1;
-}
-
-int reg_getstrval(lua_State *L){//regobj.getstrval
- HKEY hKey = reg_aux_gethkey(L, 1);
- const TCHAR * pszVal = lua_opttstring(L, 2, NULL);
- int expand = lua_optbool(L,3,1);
- DWORD dwType = 0;
- DWORD dwLen = 0;
- PVOID pvd = 0;
- LONG ret = ERROR_SUCCESS;
- // open the key
- if( ERROR_SUCCESS == (ret = RegQueryValueEx(hKey, pszVal, NULL, &dwType, NULL, &dwLen))
- // alloc
- && (pvd = lua_newuserdata(L, dwLen)) != NULL
- // query a-again
- && ERROR_SUCCESS == (ret = RegQueryValueEx(hKey, pszVal, NULL, &dwType, pvd, &dwLen))
- ){
- reg_aux_pusheregstrdata(L, pvd, dwLen, dwType, expand);
- }else{
- lua_pushnil(L);
- }
- return 1;
-}
-
-int reg_getvaltype(lua_State *L){//regobj.getvaltype
- HKEY hKey = reg_aux_gethkey(L, 1);
- const TCHAR * pszVal = lua_opttstring(L, 2, NULL);
- DWORD dwType = 0;
- LONG ret = ERROR_SUCCESS;
- if(ERROR_SUCCESS == (ret = RegQueryValueEx(hKey, pszVal, NULL, &dwType, NULL, NULL)) ){
- reg_aux_pushdatatype(L, dwType);
- }else{
- // value does not exist!
- lua_pushnil(L);
- }
- return 1;
+#ifdef _LUAMSVC
+# include <luamsvc.h>
+#endif
+
+#include <assert.h>
+#ifndef lua_assert
+# define lua_assert assert
+#endif // lua_assert
+
+#include <lua.h>
+#include <lualib.h>
+#include <lauxlib.h>
+#include "l52util.h"
+
+#include "stdmacro.h"
+#include "luamacro.h"
+#include "luawinmacro.h"
+
+#include "lua_tstring.h"
+#include "lua_int64.h"
+#include "lua_mtutil.h"
+#include "luawin_dllerror.h"
+
+#include "win_trace.h"
+#include "win_privileges.h"
+#include "win_registry.h"
+
+#define LUA_REG_DEFINE_EXTERNS
+#include "luareg.h"
+
+#define lua_error_invalid_option(L, i) luaL_argerror(L, (i), "invalid option")
+#define lrk_hkey "{afx/hkey}"
+
+#ifndef HKEY_PERFORMANCE_TEXT
+#define HKEY_PERFORMANCE_TEXT (( HKEY )((LONG)0x80000050) )
+#define HKEY_PERFORMANCE_NLSTEXT (( HKEY )((LONG)0x80000060) )
+#endif
+#ifndef REG_QWORD
+#define REG_QWORD ( 11 ) // 64-bit number
+#endif
+
+
+#ifdef LUA_REG_AS_DLL
+BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved){
+ UNUSED(hModule);
+ UNUSED(lpReserved);
+ UNUSED(ul_reason_for_call);
+ return TRUE;
+}
+
+__declspec(dllexport)
+#else
+LUA_API
+#endif // LUA_REG_AS_DLL
+int luaopen_winreg(lua_State *L){
+ luaL_register(L, "winreg", lreg_reglib);
+ return 1;
+}
+#define reg_aux_gethkey(L,index) (*((PHKEY)luaL_checkudata(L, index, lrk_hkey)))
+#define reg_aux_getphkey(L,index) ((PHKEY)luaL_checkudata(L, index, lrk_hkey))
+
+typedef struct HKEY_DATA{
+ HKEY hkey;
+ DWORD opt;
+} HKEY_DATA, *PHKEY_DATA;
+
+int reg_aux_newhkey(lua_State *L, PHKEY pHKey){
+ PHKEY phKey = (PHKEY)lua_newuserdatamt(L, sizeof(HKEY), lrk_hkey, lreg_regobj);
+ return phKey && pHKey && (NULL != (*phKey = *pHKey));
+}
+
+int reg_aux_newkey(lua_State *L, HKEY HKey, LPCTSTR szKey, LPCTSTR szClass, REGSAM samDesired, BOOL bCreate){
+ DWORD dwDis = (bCreate==FALSE) ? REG_OPENED_EXISTING_KEY : 0;
+ HKEY hKey = NULL;
+ LONG ret = (bCreate
+ ? RegCreateKeyEx(HKey, szKey, 0, (PTSTR)szClass, 0, samDesired, NULL, &hKey, &dwDis)
+ : RegOpenKeyEx(HKey, szKey, 0, samDesired, &hKey)
+ );
+ //WIN_TRACET(_T("%hs: hkey<%x>, sub<%s>, cls<%s>, acc<%d>;"), bCreate?"createkey":"openkey", HKey, szKey, szClass, samDesired);
+
+ if(ret == ERROR_SUCCESS){
+ reg_aux_newhkey(L, &hKey);
+ return dwDis;
+ }else{
+ // if we're opening a key, dont shout the error
+ // just return nil
+ // this will test if the key exist
+ if(bCreate){
+ LUA_CHECK_DLL_ERROR(L,ret);
+ }
+ lua_pushnil(L);
+ return 0;
+ }
+}
+
+REGSAM reg_aux_getaccess(lua_State *L, int i){
+ REGSAM acc = 0;
+ if(lua_isnumber(L, i) || lua_isnoneornil(L, i)){
+ acc = lua_optint(L, i, KEY_ALL_ACCESS);
+ }else{
+ const char * psz = lua_checkstring(L, i);
+ for(;*psz;psz++){
+ switch(*psz){
+ case 'w': acc |= KEY_WRITE; break;
+ case 'r': acc |= KEY_READ ; break;
+ case 'a': acc |= KEY_ALL_ACCESS ; break;
+ case 'X': acc |= KEY_WOW64_64KEY ; break;
+ case 'x': acc |= KEY_WOW64_32KEY ; break;
+ default : lua_error_invalid_option(L, i);
+ }
+ }
+ }
+ return acc;
+}
+
+typedef struct KVDATA{
+ const char * name;
+ size_t data;
+} KVDATA, *PKVDATA;
+
+HKEY reg_aux_strtohkey(lua_State *L, const char * psz){
+ static KVDATA ph[] = {
+ {"HKEY_CLASSES_ROOT", (size_t)HKEY_CLASSES_ROOT},
+ {"HKEY_CURRENT_USER", (size_t)HKEY_CURRENT_USER},
+ {"HKEY_LOCAL_MACHINE", (size_t)HKEY_LOCAL_MACHINE},
+ {"HKEY_USERS", (size_t)HKEY_USERS},
+ {"HKEY_PERFORMANCE_DATA", (size_t)HKEY_PERFORMANCE_DATA},
+ {"HKEY_PERFORMANCE_TEXT", (size_t)HKEY_PERFORMANCE_TEXT},
+ {"HKEY_PERFORMANCE_NLSTEXT", (size_t)HKEY_PERFORMANCE_NLSTEXT},
+ {"HKEY_CURRENT_CONFIG", (size_t)HKEY_CURRENT_CONFIG},
+ {"HKEY_DYN_DATA", (size_t)HKEY_DYN_DATA},
+ {"HKCR", (size_t)HKEY_CLASSES_ROOT},
+ {"HKCU", (size_t)HKEY_CURRENT_USER},
+ {"HKLM", (size_t)HKEY_LOCAL_MACHINE},
+ {"HKU", (size_t)HKEY_USERS},
+ {"HKPD", (size_t)HKEY_PERFORMANCE_DATA},
+ {"HKPT", (size_t)HKEY_PERFORMANCE_TEXT},
+ {"HKPN", (size_t)HKEY_PERFORMANCE_NLSTEXT},
+ {"HKCC", (size_t)HKEY_CURRENT_CONFIG},
+ {"HKDD", (size_t)HKEY_DYN_DATA},
+ {0,0}
+ };
+ PKVDATA pph;
+ INT64 x;
+ if(atoINT64(psz, &x)){
+ WIN_TRACEA("DIGIT ROOTKEY %s", psz);
+ return (HKEY)(size_t)x;
+ }else{
+ for(pph = ph; pph->name && _stricmp(psz, pph->name); pph++);
+ if(!pph->data)luaL_error(L, "invalid prefix key '%s'", psz);
+ return (HKEY)pph->data;
+ }
+}
+
+
+void reg_aux_splitkey(lua_State *L, const char * psz){
+ const char * szpre;
+ // skip space
+ while(*psz && ISSPACE(*psz))psz++;
+ // remember prefix
+ szpre = psz;
+ // skip prefix
+ while(*psz && *psz != '\\')psz++;
+ lua_pushlstring(L, szpre, (int)(psz - szpre)); //@ -2 (rootkey)
+ while(*psz && *psz == '\\')psz++;
+ lua_pushstring(L, psz); //@ -1 (subkey)
+}
+//docok
+int reglib_createkey(lua_State *L){//reglib.createkey
+ //reglib.createkey("<ROOT>\\SUBKEY","access","class")
+ HKEY hkey = NULL;
+ const char * szPath = lua_checkstring(L, 1);
+ REGSAM Access = reg_aux_getaccess(L, 2);
+ const TCHAR * pszCls = lua_opttstring(L, 3, NULL);
+ const TCHAR * pszSubKey;
+ const char * pszRootKey;
+ reg_aux_splitkey(L, szPath);
+ pszSubKey = lua_totstring(L,-1);
+ pszRootKey = lua_tostring(L,-2);
+ // get hkey of root-key-string
+ hkey = reg_aux_strtohkey(L, pszRootKey);
+ reg_aux_newkey(L, hkey, pszSubKey, pszCls, Access, TRUE);
+ return 1;
+}
+//docok
+int reglib_openkey(lua_State *L){//reglib.openkey
+ HKEY hkey = NULL;
+ LONG ret = 0;
+ const char * szPath = lua_checkstring(L, 1);
+ REGSAM Access = reg_aux_getaccess(L, 2);
+
+ if(ISSLASH(szPath[0]) && ISSLASH(szPath[1])){
+ HKEY HKey = NULL;
+ const TCHAR * pszMachine;
+ const char * pszRootKey;
+ // \\computer_name\hkxx
+ while(szPath[0] && ISSLASH(szPath[0]) )szPath++;// skip the beginning slashes
+ reg_aux_splitkey(L, szPath);
+ pszMachine = lua_totstring(L,-1);
+ pszRootKey = lua_tostring(L,-2);
+
+ hkey = reg_aux_strtohkey(L, pszRootKey);
+ if((ret = RegConnectRegistry(pszMachine, hkey, &HKey)) == ERROR_SUCCESS){
+ reg_aux_newhkey(L, &HKey);
+ }else{
+ lua_pushnil(L);
+ LUA_CHECK_DLL_ERROR(L, ret);
+ }
+ }else{
+ const TCHAR * pszSubKey;
+ const char * pszRootKey;
+ reg_aux_splitkey(L, szPath);
+ pszSubKey = lua_totstring(L,-1);
+ pszRootKey = lua_tostring(L,-2);
+ hkey = reg_aux_strtohkey(L, pszRootKey);
+ reg_aux_newkey(L, hkey, pszSubKey, NULL, Access, FALSE);
+ }
+ return 1;
+}
+static const KVDATA reg_type_table[] = {
+ {"none", REG_NONE},
+ {"sz", REG_SZ },
+ {"expand_sz", REG_EXPAND_SZ},
+ {"binary", REG_BINARY},
+ {"dword", REG_DWORD},
+ {"dword_big_endian", REG_DWORD_BIG_ENDIAN},
+ {"link", REG_LINK},
+ {"multi_sz", REG_MULTI_SZ},
+ {"resource_list", REG_RESOURCE_LIST},
+ {"full_resource_descriptor", REG_FULL_RESOURCE_DESCRIPTOR},
+ {"resource_requirements_list", REG_RESOURCE_REQUIREMENTS_LIST},
+ {"qword", REG_QWORD},
+ {0,0}
+};
+void reg_aux_pushdatatype(lua_State *L, DWORD dwType){
+/* const KVDATA * pkvd;
+ for(pkvd = &reg_type_table[0]; pkvd->name && pkvd->data != dwType; pkvd++);
+ if(pkvd->name){
+ lua_pushstring(L, pkvd->name);
+ }else*/{
+ lua_pushint(L, dwType);
+ }
+}
+
+int reg_aux_getdatatype(lua_State *L, int i){
+ if(lua_isrealstring(L, i)){
+ const KVDATA * pkvd;
+ const char * psz = lua_tostring(L, i);
+ for(pkvd = &reg_type_table[0]; pkvd->name && strcmp(psz, pkvd->name); pkvd++);
+ return (pkvd->name)?(int)pkvd->data:-1;
+ }else{
+ return lua_optint(L, i, -1);
+ }
+}
+
+BOOL reg_aux_setvalue(lua_State *L, HKEY hKey, const TCHAR * pszVal, int type, int i){
+ PBYTE pdata = NULL;
+ size_t cdata = 0;
+ LONG ret = ERROR_SUCCESS;
+ DWORD32 dw32;
+ DWORD64 dw64;
+
+ if(type < 0){
+ switch(lua_type(L, i)){
+ break;case LUA_TTABLE :type = REG_MULTI_SZ;
+ break;case LUA_TNUMBER:type = REG_DWORD;
+ break;case LUA_TSTRING:type = REG_SZ;
+ }
+ }
+ WIN_TRACEA("reg_aux_setvalue val<%s> type<%d>", pszVal, type);
+ switch(type){
+ case REG_DWORD: case REG_DWORD_BIG_ENDIAN:{
+ dw32 = lua_checkDWORD(L, i);
+ pdata = (PBYTE)&dw32;
+ cdata = sizeof(DWORD32);
+ }
+ break; case REG_QWORD:{
+ if(lua_isuserdata(L, i)){
+ memcpy(&dw64, lua_touserdata(L, i), sizeof(DWORD64));
+ }else{
+ dw64 = lua_checkUINT64(L, i);
+ }
+ pdata = (PBYTE)&dw64;
+ cdata = sizeof(DWORD64);
+ }
+ break; case REG_MULTI_SZ:{
+ size_t len = 0;
+ luaL_Buffer B;
+ luaL_buffinit(L, &B);
+ if(lua_istable(L, i)){
+ int n;
+ int last = (int)lua_objlen(L, i);
+ for (n = 1; n <= last; n++) {
+ lua_rawgeti(L, i, n);
+ luaL_addstring(&B, lua_checkstring(L, -1));
+ luaL_addchar(&B, 0);
+ }
+ }else{
+ luaL_checktype(L, i, LUA_TSTRING);
+ lua_pushvalue(L, i);
+ luaL_addvalue(&B);
+ luaL_addchar(&B, 0);
+ }
+ luaL_addchar(&B, 0);
+ luaL_pushresult(&B);
+ pdata = (PBYTE)lua_checkltstring(L, -1, &len);
+ cdata = len*sizeof(TCHAR);
+ }
+ break; case REG_SZ: case REG_EXPAND_SZ:{
+ pdata = (PBYTE)lua_checkltstring(L, i, &cdata);
+ cdata = (cdata+1)*sizeof(TCHAR);
+ }
+ break; default:
+#if LUA_VERSION_NUM >= 501
+ if(lua_isfulluserdata(L, i)){
+ pdata = (PBYTE)lua_touserdata(L, i);
+ cdata = lua_objlen(L, i);
+ }else
+#endif
+ {
+ pdata = (PBYTE)luaL_checklstring(L, i, &cdata);
+ }
+ }
+ ret = RegSetValueEx(hKey, pszVal, 0, type, pdata, (DWORD)cdata);
+ LUA_CHECK_DLL_ERROR(L, ret);
+ return ERROR_SUCCESS == ret;
+}
+void reg_aux_pusheregstrdata(lua_State *L, PVOID pdata, size_t cdata, DWORD dwType, int expand){
+ if(pdata == NULL){lua_pushnil(L);return;}
+ switch(dwType){
+ case REG_DWORD: case REG_DWORD_BIG_ENDIAN: case REG_QWORD:
+ {
+ char buf[24];
+ DWORD64 n;
+ if(dwType == REG_QWORD){
+ n = *((PDWORD64)pdata);
+ }else{
+ n = (DWORD64)(*((PDWORD32)pdata));
+ }
+ if(0 == _ui64toa_s(n, buf, _countof(buf) - 1, 10))
+ lua_pushstring(L, buf);
+ else
+ LUA_CHECK_DLL_ERROR(L, ERROR_INVALID_DATA);
+ }
+ break; case REG_MULTI_SZ:
+ {
+ lua_pushltstring(L, (const TCHAR *)pdata, cdata);
+ }
+ break; case REG_EXPAND_SZ: case REG_SZ:
+ {
+ DWORD dwLen;
+ PTSTR pbuf;
+ if( dwType == REG_EXPAND_SZ && expand
+ && (dwLen = ExpandEnvironmentStrings((const TCHAR *)pdata, NULL, 0)) > 0
+ && NULL != (pbuf = lua_alloc_tchar(L, ++dwLen))
+ && (dwLen = ExpandEnvironmentStrings((const TCHAR *)pdata, pbuf, dwLen)) > 0){
+ lua_pushtstring(L, pbuf);
+ }else{
+ lua_pushtstring(L, (const TCHAR *)pdata);
+ }
+ }
+ break;default:
+ lua_pushlstring(L, (const char *)pdata, cdata);
+ }
+}
+
+void reg_aux_pusheregluadata(lua_State *L, PVOID pdata, size_t cdata, DWORD dwType){
+ if(pdata == NULL){lua_pushnil(L);return;}
+ switch(dwType){
+ case REG_DWORD: case REG_DWORD_BIG_ENDIAN:
+ lua_pushnumber(L, *((PDWORD32)pdata));
+ break; case REG_QWORD:
+ lua_pushUINT64(L, *((PDWORD64)pdata), "reg_aux_pusheregluadata(REG_QWORD)", __FILE__, __LINE__);
+ break; case REG_MULTI_SZ:
+ {
+ int c = 1;
+ lua_newtable(L);
+ DZTS_ITER_INIT(PTSTR, ptoken, (PTSTR)pdata)
+ lua_pushinteger(L, c);
+ lua_pushtstring(L, ptoken);//TCHAR!!
+ lua_rawset(L, -3);
+ c++;
+ DZTS_ITER_CONT(ptoken)
+ }
+ break; case REG_SZ: case REG_EXPAND_SZ:
+ lua_pushtstring(L, (const TCHAR *)pdata);
+ break;default:
+ lua_pushlstring(L, (const char *)pdata, cdata);
+ }
+}
+typedef struct _REG_ENUM_TAG { // rc
+ HKEY hKey;
+ DWORD dwIndex;
+ PTSTR buffer;
+ DWORD bchlen;
+} REG_ENUM_TAG;
+#define REG_ENUM_MINBUFLEN ((LUAL_BUFFERSIZE-sizeof(REG_ENUM_TAG))/sizeof(TCHAR))
+#define REG_ENUM_DATALEN(n) (sizeof(REG_ENUM_TAG)+((n)*sizeof(TCHAR)))
+
+int reg_aux_enumkey_closure(lua_State *L){
+ REG_ENUM_TAG* pret = (REG_ENUM_TAG*)lua_touserdata(L, lua_upvalueindex(1));
+ if(pret){
+ DWORD dwcbSubKey = pret->bchlen;
+ PTSTR pszSubKey = pret->buffer;
+ LONG ret = RegEnumKeyEx(pret->hKey, pret->dwIndex, pszSubKey, &dwcbSubKey, 0, NULL, NULL, NULL);
+
+ if(ERROR_SUCCESS == ret ){
+ lua_pushtstring(L, pszSubKey);
+ pret->dwIndex++;
+ return 1;
+ }
+ if(ret != ERROR_NO_MORE_ITEMS){
+ WIN_TRACEA("pret->bchlen=%d,dwcbSubKey=%d,Subkey='%s'", pret->bchlen, dwcbSubKey, pszSubKey);
+ LUA_CHECK_DLL_ERROR(L, ret);
+ }
+ }
+ lua_pushnil(L);
+ return 1;
+}
+int reg_aux_enumvalue_closure(lua_State *L){
+ REG_ENUM_TAG* pret = (REG_ENUM_TAG*)lua_touserdata(L, lua_upvalueindex(1));
+ if(pret){
+ LONG ret = 0;
+ DWORD dwType = 0;
+ DWORD dwccValue = pret->bchlen;
+ PTSTR pszValue = pret->buffer;
+
+ ret = RegEnumValue(pret->hKey, pret->dwIndex, pszValue, &dwccValue, 0, &dwType, NULL, NULL);
+
+ if(ERROR_SUCCESS == ret ){
+ lua_pushtstring(L, pszValue);
+ reg_aux_pushdatatype(L, dwType);
+ pret->dwIndex++;
+ return 2;
+ }
+ if(ret != ERROR_NO_MORE_ITEMS){
+ LUA_CHECK_DLL_ERROR(L, ret);
+ }
+ }
+ lua_pushnil(L);
+ return 1;
+}
+//docok
+int reg_close(lua_State *L){//regobj.__gc, regobj.close
+ PHKEY phKey = (PHKEY)lua_touserdata(L, 1);
+ lua_assert(phKey);
+ //WIN_TRACEA("reg_close<%x>;", *phKey);
+ if(phKey && *phKey){
+ LUA_CHECK_DLL_ERROR(L, RegCloseKey(*phKey));
+ *phKey = NULL;
+ }
+ return 0;
+}
+//docok
+int reg_createkey(lua_State *L){//regobj.createkey
+ reg_aux_newkey(L, reg_aux_gethkey(L, 1),
+ lua_checktstring(L, 2), (PTSTR)lua_opttstring(L, 4, NULL), reg_aux_getaccess(L, 3), TRUE);
+ return 1;
+}
+//docok
+int reg_deletekey(lua_State *L){//regobj.deletekey
+ LONG ret;
+ // the key name is optional
+ if(reg_aux_gethkey(L,1) && lua_isnoneornil(L, 2))
+ {
+ lua_pushtstring(L, TEXT(""));
+ }
+ ret = win_reg_deltree(reg_aux_gethkey(L,1), lua_checktstring(L, 2));
+ LUA_CHECK_DLL_ERROR(L, ret);
+ LUA_CHECK_RETURN_OBJECT(L, ret == ERROR_SUCCESS);
+}
+//docok
+int reg_deletevalue(lua_State *L){//regobj.deletevalue
+ LONG ret = RegDeleteValue(reg_aux_gethkey(L,1), lua_checktstring(L, 2));
+ LUA_CHECK_DLL_ERROR(L, ret);
+ LUA_CHECK_RETURN_OBJECT(L, ret == ERROR_SUCCESS);
+}
+//docok
+int reg_enumkey(lua_State *L){//regobj.enumkey
+ HKEY hKey = reg_aux_gethkey(L, 1);
+ DWORD dwNameLen = 0;
+ REG_ENUM_TAG* pret;
+ LONG ret = RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, &dwNameLen, NULL, NULL, NULL, NULL, NULL, NULL);
+ dwNameLen = max(REG_ENUM_MINBUFLEN,dwNameLen+1);
+ pret = (REG_ENUM_TAG*)lua_newuserdata(L,REG_ENUM_DATALEN(dwNameLen));
+
+ pret->hKey = hKey;
+ pret->dwIndex = 0;
+ pret->bchlen = dwNameLen;
+ pret->buffer = (PTSTR)(&pret[1]);
+
+ WIN_TRACEA("reg_enumkey bchlen=%d datlen=%d", pret->bchlen, REG_ENUM_DATALEN(dwNameLen));
+ LUA_CHECK_DLL_ERROR(L, ret);
+ lua_pushcclosure(L, reg_aux_enumkey_closure, 1);
+ return 1;
+}
+//docok
+int reg_enumvalue(lua_State *L){//regobj.enumvalue
+ HKEY hKey = reg_aux_gethkey(L, 1);
+ REG_ENUM_TAG* pret;
+ DWORD dwNameLen = 0;
+ LONG ret = RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &dwNameLen, NULL, NULL, NULL);
+ dwNameLen = max(REG_ENUM_MINBUFLEN,dwNameLen+1);
+ pret = (REG_ENUM_TAG*)lua_newuserdata(L,REG_ENUM_DATALEN(dwNameLen));
+
+ pret->hKey = hKey;
+ pret->dwIndex = 0;
+ pret->bchlen = dwNameLen;
+ pret->buffer = (PTSTR)(&pret[1]);
+
+ WIN_TRACEA("reg_enumkey bchlen=%d datlen=%d", pret->bchlen, REG_ENUM_DATALEN(dwNameLen));
+ LUA_CHECK_DLL_ERROR(L, ret);
+
+ lua_pushcclosure(L, reg_aux_enumvalue_closure, 1);
+ return 1;
+}
+//docok
+int reg_flushkey(lua_State *L){//"regobj.flushkey"
+ LONG ret = RegFlushKey(reg_aux_gethkey(L, 1));
+ LUA_CHECK_DLL_ERROR(L, ret);
+ LUA_CHECK_RETURN_OBJECT(L, ret == ERROR_SUCCESS);
+}
+//docok
+int reg_getinfo(lua_State *L){//regobj.getinfo
+ HKEY hKey = reg_aux_gethkey(L,1);
+ FILETIME ftLastWriteTime = {0,};
+ DWORD dwcbClass = 64, dwcSubKeys = 0, dwcbMaxSubKeyLen = 0, dwcbMaxClassLen = 0, dwcValues = 0, dwcbMaxValueNameLen = 0, dwcbMaxValueLen = 0, dwcbSecurityDescriptor = 0;
+ LONG ret = RegQueryInfoKey (hKey, NULL, NULL, NULL, &dwcSubKeys, &dwcbMaxSubKeyLen, &dwcbMaxClassLen, &dwcValues, &dwcbMaxValueNameLen, &dwcbMaxValueLen, &dwcbSecurityDescriptor, &ftLastWriteTime);
+ PTSTR psz = lua_alloc_tchar(L, ++dwcbClass);
+
+ if(ERROR_MORE_DATA == RegQueryInfoKey(hKey, psz, &dwcbClass, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) ){
+ psz = lua_alloc_tchar(L, ++dwcbClass);
+ RegQueryInfoKey(hKey, psz, &dwcbClass, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ }
+
+ LUA_CHECK_DLL_ERROR(L, ret);
+ if(ret == ERROR_SUCCESS){
+ lua_newtable(L);
+ lua_rawset_st(L, -3, "class",psz);
+ lua_rawset_sn(L, -3, "subkeys",dwcSubKeys);
+ lua_rawset_sn(L, -3, "values",dwcValues);
+ lua_rawset_sn(L, -3, "maxsubkeylen",dwcbMaxSubKeyLen);
+ lua_rawset_sn(L, -3, "maxclasslen",dwcbMaxClassLen);
+ lua_rawset_sn(L, -3, "maxvaluelen",dwcbMaxValueLen);
+ lua_rawset_sn(L, -3, "maxvaluenamelen",dwcbMaxValueNameLen);
+ lua_rawset_sn(L, -3, "maxsecuritydescriptor",dwcbSecurityDescriptor);
+ //lua_pushstring(L, "lastwritetime");
+ //aux_pushftime(L, &ftLastWriteTime);
+ //lua_rawset(L, -3);
+ }else{
+ lua_pushnil(L);
+ }
+ return 1;
+}
+//docok
+int reg_getvalue(lua_State *L){//regobj.getvalue
+ HKEY hKey = reg_aux_gethkey(L, 1);
+ const TCHAR * pszVal = lua_opttstring(L, 2, NULL);
+ DWORD dwType = 0;
+ DWORD dwLen = 0;
+ PVOID pvd = 0;
+ LONG ret = ERROR_SUCCESS;
+ // open the key
+ if( ERROR_SUCCESS == (ret = RegQueryValueEx(hKey, pszVal, NULL, &dwType, NULL, &dwLen))
+ // alloc
+ && (pvd = lua_newuserdata(L, dwLen)) != NULL
+ // query a-again
+ && ERROR_SUCCESS == (ret = RegQueryValueEx(hKey, pszVal, NULL, &dwType, pvd, &dwLen))
+ ){
+ reg_aux_pusheregluadata(L, pvd, dwLen, dwType);
+ reg_aux_pushdatatype(L, dwType);
+ }else{
+ lua_pushnil(L);
+ lua_pushnil(L);
+ //LUA_CHECK_DLL_ERROR(L, ret);
+ }
+ return 2;
+}
+#ifndef LUA_REG_NO_HIVEOPS
+//docok
+int reg_loadkey(lua_State *L){//regobj.load
+ LONG ret;
+ win_setprivilege(SE_RESTORE_NAME, 1, NULL);
+ ret = RegLoadKey(reg_aux_gethkey(L,1), lua_checktstring(L, 2), lua_checktstring(L, 3));
+ LUA_CHECK_DLL_ERROR(L, ret);
+ LUA_CHECK_RETURN_OBJECT(L, ret == ERROR_SUCCESS);
+}
+#endif // LUA_REG_NO_HIVEOPS
+//docok
+int reg_openkey(lua_State *L){//regobj.openkey
+ reg_aux_newkey(L, reg_aux_gethkey(L, 1),
+ lua_checktstring(L, 2), NULL, reg_aux_getaccess(L, 3), FALSE);
+ return 1;
+}
+#ifndef LUA_REG_NO_HIVEOPS
+//docok
+int reg_replacekey(lua_State *L){//regobj.replace
+ LONG ret;
+ win_setprivilege(SE_RESTORE_NAME, 1, NULL);
+ ret = RegReplaceKey(reg_aux_gethkey(L,1), lua_checktstring(L, 2), lua_checktstring(L, 3), lua_checktstring(L, 4));
+ LUA_CHECK_DLL_ERROR(L, ret);
+ LUA_CHECK_RETURN_OBJECT(L, ret == ERROR_SUCCESS);
+}
+//docok
+int reg_restorekey(lua_State *L){//regobj.restore
+ LONG ret;
+ DWORD dwFlags = 0;
+ win_setprivilege(SE_RESTORE_NAME, 1, NULL);
+ if(lua_isboolean(L,3)){
+ dwFlags = lua_toboolean(L,3)?REG_WHOLE_HIVE_VOLATILE:0;
+ }else{
+ dwFlags = lua_optDWORD(L, 3, 0);
+ }
+ ret = RegRestoreKey(reg_aux_gethkey(L,1), lua_checktstring(L, 2), dwFlags);
+ LUA_CHECK_DLL_ERROR(L, ret);
+ LUA_CHECK_RETURN_OBJECT(L, ret == ERROR_SUCCESS);
+}
+//docok
+int reg_savekey(lua_State *L){//regobj.save
+ LONG ret;
+ win_setprivilege(SE_BACKUP_NAME, 1, NULL);
+ ret = RegSaveKey(reg_aux_gethkey(L,1), lua_checktstring(L, 2), NULL);
+ LUA_CHECK_DLL_ERROR(L, ret);
+ LUA_CHECK_RETURN_OBJECT(L, ret == ERROR_SUCCESS);
+}
+#endif // LUA_REG_NO_HIVEOPS
+//docok
+int reg_setvalue(lua_State *L){//regobj.setvalue
+ LUA_CHECK_RETURN_OBJECT(L,
+ reg_aux_setvalue(L, reg_aux_gethkey(L, 1), lua_opttstring(L, 2, NULL), reg_aux_getdatatype(L, 4), 3)
+ );
+}
+#ifndef LUA_REG_NO_HIVEOPS
+//docok
+int reg_unloadkey(lua_State *L){//regobj.unload
+ LONG ret;
+ win_setprivilege(SE_RESTORE_NAME, 1, NULL);
+ ret = RegUnLoadKey(reg_aux_gethkey(L,1), lua_checktstring(L, 2));
+ LUA_CHECK_DLL_ERROR(L, ret);
+ LUA_CHECK_RETURN_OBJECT(L, ret == ERROR_SUCCESS);
+}
+#endif // LUA_REG_NO_HIVEOPS
+
+int reg_handle(lua_State *L){//regobj.handle
+ HKEY hKey = reg_aux_gethkey(L, 1);
+ lua_pushlightuserdata(L, hKey);
+ return 1;
+}
+
+int reg_detach(lua_State *L){//regobj.detach
+ PHKEY phKey = reg_aux_getphkey(L, 1);
+ lua_pushlightuserdata(L, *phKey);
+ *phKey = NULL;
+ return 1;
+}
+
+int reg_getstrval(lua_State *L){//regobj.getstrval
+ HKEY hKey = reg_aux_gethkey(L, 1);
+ const TCHAR * pszVal = lua_opttstring(L, 2, NULL);
+ int expand = lua_optbool(L,3,1);
+ DWORD dwType = 0;
+ DWORD dwLen = 0;
+ PVOID pvd = 0;
+ LONG ret = ERROR_SUCCESS;
+ // open the key
+ if( ERROR_SUCCESS == (ret = RegQueryValueEx(hKey, pszVal, NULL, &dwType, NULL, &dwLen))
+ // alloc
+ && (pvd = lua_newuserdata(L, dwLen)) != NULL
+ // query a-again
+ && ERROR_SUCCESS == (ret = RegQueryValueEx(hKey, pszVal, NULL, &dwType, pvd, &dwLen))
+ ){
+ reg_aux_pusheregstrdata(L, pvd, dwLen, dwType, expand);
+ }else{
+ lua_pushnil(L);
+ }
+ return 1;
+}
+
+int reg_getvaltype(lua_State *L){//regobj.getvaltype
+ HKEY hKey = reg_aux_gethkey(L, 1);
+ const TCHAR * pszVal = lua_opttstring(L, 2, NULL);
+ DWORD dwType = 0;
+ LONG ret = ERROR_SUCCESS;
+ if(ERROR_SUCCESS == (ret = RegQueryValueEx(hKey, pszVal, NULL, &dwType, NULL, NULL)) ){
+ reg_aux_pushdatatype(L, dwType);
+ }else{
+ // value does not exist!
+ lua_pushnil(L);
+ }
+ return 1;
} \ No newline at end of file
diff --git a/3rdparty/lua/src/modules/lua-winreg/test/test_1.lua b/3rdparty/lua/src/modules/lua-winreg/test/test_1.lua
index 1dc0170..cfcd7aa 100644
--- a/3rdparty/lua/src/modules/lua-winreg/test/test_1.lua
+++ b/3rdparty/lua/src/modules/lua-winreg/test/test_1.lua
@@ -1,10 +1,10 @@
-local winreg = require"winreg"
-
--- prints all the special folders
-hkey = winreg.openkey[[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion]]
-
-skey = hkey:openkey([[Explorer\Shell Folders]])
-for name in skey:enumvalue() do
- print("\nname: " .. name
- .. "\npath: " .. skey:getvalue(name))
-end
+local winreg = require"winreg"
+
+-- prints all the special folders
+hkey = winreg.openkey[[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion]]
+
+skey = hkey:openkey([[Explorer\Shell Folders]])
+for name in skey:enumvalue() do
+ print("\nname: " .. name
+ .. "\npath: " .. skey:getvalue(name))
+end
diff --git a/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_10.lua b/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_10.lua
index 7e9a2ce..4d3caca 100644
--- a/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_10.lua
+++ b/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_10.lua
@@ -1,8 +1,8 @@
-local winreg = require"winreg"
-rkey = "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"
-hkey = winreg.openkey(rkey)
-for name, kind in hkey:enumvalue() do
- print("\nname: " .. name
- .. "\ntype: " .. hkey:getvaltype(name))
- assert(kind == hkey:getvaltype(name))
-end
+local winreg = require"winreg"
+rkey = "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"
+hkey = winreg.openkey(rkey)
+for name, kind in hkey:enumvalue() do
+ print("\nname: " .. name
+ .. "\ntype: " .. hkey:getvaltype(name))
+ assert(kind == hkey:getvaltype(name))
+end
diff --git a/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_13.lua b/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_13.lua
index 308ec78..8245945 100644
--- a/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_13.lua
+++ b/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_13.lua
@@ -1,7 +1,7 @@
-local winreg = require"winreg"
--- Enumerate shell folders
-hkey = winreg.openkey([[HKCU\Software\Microsoft\Windows\CurrentVersion]])
-skey = hkey:openkey("Explorer\\Shell Folders")
-for name, kind in skey:enumvalue(true) do
- print("\nname: " .. name .. " (type " .. kind .. ")")
-end
+local winreg = require"winreg"
+-- Enumerate shell folders
+hkey = winreg.openkey([[HKCU\Software\Microsoft\Windows\CurrentVersion]])
+skey = hkey:openkey("Explorer\\Shell Folders")
+for name, kind in skey:enumvalue(true) do
+ print("\nname: " .. name .. " (type " .. kind .. ")")
+end
diff --git a/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_5.lua b/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_5.lua
index 4af3188..74e9311 100644
--- a/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_5.lua
+++ b/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_5.lua
@@ -1,8 +1,8 @@
-local winreg = require"winreg"
--- Enumerate Application paths
-rkey = [[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths]]
-hkey = winreg.openkey(rkey)
-for k in hkey:enumkey() do
- print(k,(hkey:openkey(k):getvalue()))
- collectgarbage()
-end
+local winreg = require"winreg"
+-- Enumerate Application paths
+rkey = [[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths]]
+hkey = winreg.openkey(rkey)
+for k in hkey:enumkey() do
+ print(k,(hkey:openkey(k):getvalue()))
+ collectgarbage()
+end
diff --git a/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_6.lua b/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_6.lua
index 615720f..c2e6263 100644
--- a/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_6.lua
+++ b/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_6.lua
@@ -1,20 +1,20 @@
-local winreg = require"winreg"
--- Enumerate start up programs
-
-rkey = "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"
-hkey = winreg.openkey(rkey)
-
-print('\n'..rkey..":")
-for name, kind in hkey:enumvalue() do
- print("\nname: " .. name
- .. "\ncommand: " .. hkey:getvalue(name))
-end
-
-rkey = "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce"
-hkey = winreg.openkey(rkey)
-
-print('\n'..rkey..":")
-for name, kind in hkey:enumvalue() do
- print("\nname: " .. name
- .. "\ncommand: " .. hkey:getvalue(name))
-end
+local winreg = require"winreg"
+-- Enumerate start up programs
+
+rkey = "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"
+hkey = winreg.openkey(rkey)
+
+print('\n'..rkey..":")
+for name, kind in hkey:enumvalue() do
+ print("\nname: " .. name
+ .. "\ncommand: " .. hkey:getvalue(name))
+end
+
+rkey = "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnce"
+hkey = winreg.openkey(rkey)
+
+print('\n'..rkey..":")
+for name, kind in hkey:enumvalue() do
+ print("\nname: " .. name
+ .. "\ncommand: " .. hkey:getvalue(name))
+end
diff --git a/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_8.lua b/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_8.lua
index 212d4c0..39f89ec 100644
--- a/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_8.lua
+++ b/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_8.lua
@@ -1,9 +1,9 @@
-local winreg = require"winreg"
-rkey = [[HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer]]
-info = winreg.openkey(rkey):getinfo()
-print("number of subkeys : '" .. info.subkeys .. "'")
-print("longest subkey name length : '" .. info.maxsubkeylen .. "'")
-print("longest class string length : '" .. info.maxclasslen .. "'")
-print("number of value entries : '" .. info.values .. "'")
-print("longest value name length : '" .. info.maxvaluelen .. "'")
-print("class string : '" .. info.class .. "'")
+local winreg = require"winreg"
+rkey = [[HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer]]
+info = winreg.openkey(rkey):getinfo()
+print("number of subkeys : '" .. info.subkeys .. "'")
+print("longest subkey name length : '" .. info.maxsubkeylen .. "'")
+print("longest class string length : '" .. info.maxclasslen .. "'")
+print("number of value entries : '" .. info.values .. "'")
+print("longest value name length : '" .. info.maxvaluelen .. "'")
+print("class string : '" .. info.class .. "'")
diff --git a/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_9.lua b/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_9.lua
index 18a59b2..076013a 100644
--- a/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_9.lua
+++ b/3rdparty/lua/src/modules/lua-winreg/test/test_5_1_9.lua
@@ -1,7 +1,7 @@
-local winreg = require"winreg"
-rkey = "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"
-hkey = winreg.openkey(rkey)
-for name, kind in hkey:enumvalue() do
- print("\nname: " .. name
- .. "\nvalue: " .. hkey:getstrval(name))
-end
+local winreg = require"winreg"
+rkey = "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"
+hkey = winreg.openkey(rkey)
+for name, kind in hkey:enumvalue() do
+ print("\nname: " .. name
+ .. "\nvalue: " .. hkey:getstrval(name))
+end
diff --git a/3rdparty/lua/src/modules/w32resembed.c b/3rdparty/lua/src/modules/w32resembed.c
index 7a41b0c..783e2c4 100644
--- a/3rdparty/lua/src/modules/w32resembed.c
+++ b/3rdparty/lua/src/modules/w32resembed.c
@@ -1,207 +1,207 @@
-///////////////////////////////////////////////////////////////////////////////
-///
-/// Written 2011-2012, Oliver Schneider (assarbad.net) - PUBLIC DOMAIN/CC0
-///
-/// Original filename: w32embed.h
-/// Project : WinDirStat
-/// Author(s) : Oliver Schneider
-///
-/// Purpose : Lua package to load Lua code from the resource section
-/// of a PE file. Skips the UTF-8 BOM (3 bytes), if found.
-///
-///////////////////////////////////////////////////////////////////////////////
-
-#include <Windows.h>
-#include <tchar.h>
-#include <lua.h>
-#include "w32resembed.h"
-
-static int luaC_registerPreloader_(lua_State* L, const int winresidx, LPCTSTR lpszName)
-{
- const int oldTop = lua_gettop(L);
- UNREFERENCED_PARAMETER(winresidx);
- // Expects the winres table at -1
- lua_getfield(L, LUA_GLOBALSINDEX, "package");
- if(!lua_istable(L, -1))
- {
- lua_settop(L, oldTop);
- lua_pushfstring(L, "Not a table at index %i. Expected '%s' table here.", -1, "package");
- return FALSE;
- }
- lua_getfield(L, -1, "preload");
- if(!lua_istable(L, -1))
- {
- lua_settop(L, oldTop);
- lua_pushfstring(L, "Not a table at index %i. Expected '%s.%s' table here.", -1, "package", "preload");
- return FALSE;
- }
- lua_pushtstring(L, lpszName);
- lua_getfield(L, -4, W32RES_LOADER); // get registered C function
- if(!lua_isfunction(L, -1))
- {
- lua_settop(L, oldTop);
- lua_pushfstring(L, "Not a C function when fetching field '%s.%s'.", W32RES_MODNAME, W32RES_LOADER);
- return 1;
- }
- lua_rawset(L, -3); // package.preload[lpszName] = winres.c_loader
- // We checked the parameters already
- lua_pushtstring_lowercase(L, lpszName); // lpszName = string:lower(lpszName)
- lua_getfield(L, -4, W32RES_LOADER);
- lua_rawset(L, -3); // package.preload[lpszName] = winres.c_loader
- lua_settop(L, oldTop);
- return 0;
-}
-
-static BOOL CALLBACK enumLuaScriptsLanguageCallback(HANDLE hModule, LPCTSTR lpszType, LPCTSTR lpszName, WORD wIDLanguage, lua_State* L)
-{
- UNREFERENCED_PARAMETER(hModule);
- UNREFERENCED_PARAMETER(lpszName);
- if((0 == lstrcmp(RT_LUASCRIPT,lpszType)) && (LANG_NEUTRAL == PRIMARYLANGID(wIDLanguage)))
- {
- const int winresidx = -1;
- // Expecting the winres table at the top of the stack here
- if(!lua_istable(L, winresidx))
- {
- lua_pushfstring(L, "Not a table at index %i. Expected '%s' table here.", winresidx, W32RES_MODNAME);
- return FALSE;
- }
- // Now register the preloader
- if(luaC_registerPreloader_(L, winresidx, lpszName))
- {
- // we expect a string on the stack here ... don't do anything additional
- return FALSE;
- }
- lua_getfield(L, -1, W32RES_SCRIPTS);
- if(!lua_istable(L, -1))
- {
- lua_pushfstring(L, "Not a table at index %i. Expected '%s.%s' table here.", winresidx, W32RES_MODNAME, W32RES_SCRIPTS);
- return FALSE;
- }
- // winres.scripts at top of stack
- lua_pushtstring(L, lpszName);
- lua_pushtstring(L, lpszType);
- lua_rawset(L, -3); // winres.scripts[lpszName] = lpszType
- // now pop one ... (winres.scripts)
- lua_pop(L, 1);
- }
- return TRUE;
-}
-
-static BOOL CALLBACK enumLuaScriptsNameCallback(HANDLE hModule, LPCTSTR lpszType, LPCTSTR lpszName, LONG_PTR lParam)
-{
- lua_State* L = (lua_State*)lParam;
- UNREFERENCED_PARAMETER(hModule);
- // First string table entry that we encounter will be grabbed
- if(0 == lstrcmp(RT_LUASCRIPT,lpszType))
- {
- // Now enumerate the languages of this entry ...
- EnumResourceLanguages((HMODULE)hModule, lpszType, lpszName, (ENUMRESLANGPROC)enumLuaScriptsLanguageCallback, (LONG_PTR)L);
- }
- return TRUE;
-}
-
-static BOOL getResourcePointer(HINSTANCE Instance, LPCTSTR ResName, LPCTSTR ResType, LPVOID* ppRes, DWORD* pdwResSize)
-{
- if(ppRes && pdwResSize)
- {
- HRSRC hRsrc;
- if(NULL != (hRsrc = FindResource((HMODULE)Instance, ResName, ResType)))
- {
- HGLOBAL hGlob;
- if(NULL != (hGlob = LoadResource(Instance, hRsrc)))
- {
- *ppRes = LockResource(hGlob);
- *pdwResSize = SizeofResource(Instance, hRsrc);
- return (*ppRes && *pdwResSize);
- }
- }
- }
- return FALSE;
-}
-
-static HMODULE getMyModuleHandle()
-{
- static int s_somevar = 0;
- MEMORY_BASIC_INFORMATION mbi;
- if(!VirtualQuery(&s_somevar, &mbi, sizeof(mbi)))
- {
- return NULL;
- }
- return (HMODULE)mbi.AllocationBase;
-}
-
-static int luaC_winres_loader_(lua_State* L)
-{
- const BYTE utf8bom[3] = { 0xEF, 0xBB, 0xBF };
- const char* scriptBuf = NULL;
- size_t scriptLen = 0;
- DWORD dwScriptLen = 0;
- int ret;
- LPCTSTR resName;
- LPCSTR chunkName;
-
- // Expecting char string here (used as chunk name)
- chunkName = lua_checkstring(L, 1);
- // Take a copy on the stack
- lua_pushstring(L, chunkName);
- // Converts the copy to a wchar_t string
- resName = lua_checktstring(L, 2);
-
- // Get pointer to script contents and size of script from current module
- if(
- !getResourcePointer(getMyModuleHandle(), resName, RT_LUASCRIPT, ((LPVOID*)&scriptBuf), &dwScriptLen)
- || !dwScriptLen
- )
- {
- luaL_error(L, "Could not load the Lua script from the resources: %s", chunkName);
- return 0;
- }
- scriptLen = (size_t)dwScriptLen;
- // Skip the UTF-8 BOM, if any
- if((scriptLen > sizeof(utf8bom)) && 0 == memcmp(utf8bom, scriptBuf, sizeof(utf8bom)))
- {
- scriptBuf += sizeof(utf8bom);
- scriptLen -= sizeof(utf8bom);
- dwScriptLen -= sizeof(utf8bom);
- }
- // Load the script into the Lua state
- if(0 != (ret = luaL_loadbuffer(L, scriptBuf, scriptLen, chunkName)))
- {
- luaL_error(L, "Could not load Lua chunk from resource (%d): %s", ret, lua_tostring(L, -1));
- return 0;
- }
- // the loaded script is at the top of the stack
- lua_remove(L, 2); // remove the chunk name now
- lua_pushtstring(L, resName);
- if(0 != (ret = lua_pcall(L, 1, LUA_MULTRET, 0)))
- {
- luaL_error(L, "Could not call the newly loaded chunk (%d): %s", ret, lua_tostring(L, -1));
- }
- return ret;
-}
-
-int w32res_enumerateEmbeddedLuaScripts(lua_State* L)
-{
- const luaL_Reg winres_funcs[] = {
- {W32RES_LOADER, luaC_winres_loader_},
- {NULL, NULL}
- };
- luaL_register(L, W32RES_MODNAME, winres_funcs);
- // winres table at top of stack
- // Name for the contained table
- lua_pushstring(L, W32RES_SCRIPTS);
- // winres.scripts (later)
- lua_newtable(L);
- // Assign the table as winres.scripts
- lua_rawset(L, -3);
- // Enumerate the resource names of type RT_LUASCRIPT in the current module
- // The callback functions add the names of resources to the table at the top of the stack
- (void)EnumResourceNames(getMyModuleHandle(), RT_LUASCRIPT, (ENUMRESNAMEPROC)enumLuaScriptsNameCallback, (LONG_PTR)L);
- if(lua_isstring(L, -1))
- {
- // Leave error message at top of stack
- return 1;
- }
- // leave the winres table on the stack
- return 0;
-}
+///////////////////////////////////////////////////////////////////////////////
+///
+/// Written 2011-2012, Oliver Schneider (assarbad.net) - PUBLIC DOMAIN/CC0
+///
+/// Original filename: w32embed.h
+/// Project : WinDirStat
+/// Author(s) : Oliver Schneider
+///
+/// Purpose : Lua package to load Lua code from the resource section
+/// of a PE file. Skips the UTF-8 BOM (3 bytes), if found.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <Windows.h>
+#include <tchar.h>
+#include <lua.h>
+#include "w32resembed.h"
+
+static int luaC_registerPreloader_(lua_State* L, const int winresidx, LPCTSTR lpszName)
+{
+ const int oldTop = lua_gettop(L);
+ UNREFERENCED_PARAMETER(winresidx);
+ // Expects the winres table at -1
+ lua_getfield(L, LUA_GLOBALSINDEX, "package");
+ if(!lua_istable(L, -1))
+ {
+ lua_settop(L, oldTop);
+ lua_pushfstring(L, "Not a table at index %i. Expected '%s' table here.", -1, "package");
+ return FALSE;
+ }
+ lua_getfield(L, -1, "preload");
+ if(!lua_istable(L, -1))
+ {
+ lua_settop(L, oldTop);
+ lua_pushfstring(L, "Not a table at index %i. Expected '%s.%s' table here.", -1, "package", "preload");
+ return FALSE;
+ }
+ lua_pushtstring(L, lpszName);
+ lua_getfield(L, -4, W32RES_LOADER); // get registered C function
+ if(!lua_isfunction(L, -1))
+ {
+ lua_settop(L, oldTop);
+ lua_pushfstring(L, "Not a C function when fetching field '%s.%s'.", W32RES_MODNAME, W32RES_LOADER);
+ return 1;
+ }
+ lua_rawset(L, -3); // package.preload[lpszName] = winres.c_loader
+ // We checked the parameters already
+ lua_pushtstring_lowercase(L, lpszName); // lpszName = string:lower(lpszName)
+ lua_getfield(L, -4, W32RES_LOADER);
+ lua_rawset(L, -3); // package.preload[lpszName] = winres.c_loader
+ lua_settop(L, oldTop);
+ return 0;
+}
+
+static BOOL CALLBACK enumLuaScriptsLanguageCallback(HANDLE hModule, LPCTSTR lpszType, LPCTSTR lpszName, WORD wIDLanguage, lua_State* L)
+{
+ UNREFERENCED_PARAMETER(hModule);
+ UNREFERENCED_PARAMETER(lpszName);
+ if((0 == lstrcmp(RT_LUASCRIPT,lpszType)) && (LANG_NEUTRAL == PRIMARYLANGID(wIDLanguage)))
+ {
+ const int winresidx = -1;
+ // Expecting the winres table at the top of the stack here
+ if(!lua_istable(L, winresidx))
+ {
+ lua_pushfstring(L, "Not a table at index %i. Expected '%s' table here.", winresidx, W32RES_MODNAME);
+ return FALSE;
+ }
+ // Now register the preloader
+ if(luaC_registerPreloader_(L, winresidx, lpszName))
+ {
+ // we expect a string on the stack here ... don't do anything additional
+ return FALSE;
+ }
+ lua_getfield(L, -1, W32RES_SCRIPTS);
+ if(!lua_istable(L, -1))
+ {
+ lua_pushfstring(L, "Not a table at index %i. Expected '%s.%s' table here.", winresidx, W32RES_MODNAME, W32RES_SCRIPTS);
+ return FALSE;
+ }
+ // winres.scripts at top of stack
+ lua_pushtstring(L, lpszName);
+ lua_pushtstring(L, lpszType);
+ lua_rawset(L, -3); // winres.scripts[lpszName] = lpszType
+ // now pop one ... (winres.scripts)
+ lua_pop(L, 1);
+ }
+ return TRUE;
+}
+
+static BOOL CALLBACK enumLuaScriptsNameCallback(HANDLE hModule, LPCTSTR lpszType, LPCTSTR lpszName, LONG_PTR lParam)
+{
+ lua_State* L = (lua_State*)lParam;
+ UNREFERENCED_PARAMETER(hModule);
+ // First string table entry that we encounter will be grabbed
+ if(0 == lstrcmp(RT_LUASCRIPT,lpszType))
+ {
+ // Now enumerate the languages of this entry ...
+ EnumResourceLanguages((HMODULE)hModule, lpszType, lpszName, (ENUMRESLANGPROC)enumLuaScriptsLanguageCallback, (LONG_PTR)L);
+ }
+ return TRUE;
+}
+
+static BOOL getResourcePointer(HINSTANCE Instance, LPCTSTR ResName, LPCTSTR ResType, LPVOID* ppRes, DWORD* pdwResSize)
+{
+ if(ppRes && pdwResSize)
+ {
+ HRSRC hRsrc;
+ if(NULL != (hRsrc = FindResource((HMODULE)Instance, ResName, ResType)))
+ {
+ HGLOBAL hGlob;
+ if(NULL != (hGlob = LoadResource(Instance, hRsrc)))
+ {
+ *ppRes = LockResource(hGlob);
+ *pdwResSize = SizeofResource(Instance, hRsrc);
+ return (*ppRes && *pdwResSize);
+ }
+ }
+ }
+ return FALSE;
+}
+
+static HMODULE getMyModuleHandle()
+{
+ static int s_somevar = 0;
+ MEMORY_BASIC_INFORMATION mbi;
+ if(!VirtualQuery(&s_somevar, &mbi, sizeof(mbi)))
+ {
+ return NULL;
+ }
+ return (HMODULE)mbi.AllocationBase;
+}
+
+static int luaC_winres_loader_(lua_State* L)
+{
+ const BYTE utf8bom[3] = { 0xEF, 0xBB, 0xBF };
+ const char* scriptBuf = NULL;
+ size_t scriptLen = 0;
+ DWORD dwScriptLen = 0;
+ int ret;
+ LPCTSTR resName;
+ LPCSTR chunkName;
+
+ // Expecting char string here (used as chunk name)
+ chunkName = lua_checkstring(L, 1);
+ // Take a copy on the stack
+ lua_pushstring(L, chunkName);
+ // Converts the copy to a wchar_t string
+ resName = lua_checktstring(L, 2);
+
+ // Get pointer to script contents and size of script from current module
+ if(
+ !getResourcePointer(getMyModuleHandle(), resName, RT_LUASCRIPT, ((LPVOID*)&scriptBuf), &dwScriptLen)
+ || !dwScriptLen
+ )
+ {
+ luaL_error(L, "Could not load the Lua script from the resources: %s", chunkName);
+ return 0;
+ }
+ scriptLen = (size_t)dwScriptLen;
+ // Skip the UTF-8 BOM, if any
+ if((scriptLen > sizeof(utf8bom)) && 0 == memcmp(utf8bom, scriptBuf, sizeof(utf8bom)))
+ {
+ scriptBuf += sizeof(utf8bom);
+ scriptLen -= sizeof(utf8bom);
+ dwScriptLen -= sizeof(utf8bom);
+ }
+ // Load the script into the Lua state
+ if(0 != (ret = luaL_loadbuffer(L, scriptBuf, scriptLen, chunkName)))
+ {
+ luaL_error(L, "Could not load Lua chunk from resource (%d): %s", ret, lua_tostring(L, -1));
+ return 0;
+ }
+ // the loaded script is at the top of the stack
+ lua_remove(L, 2); // remove the chunk name now
+ lua_pushtstring(L, resName);
+ if(0 != (ret = lua_pcall(L, 1, LUA_MULTRET, 0)))
+ {
+ luaL_error(L, "Could not call the newly loaded chunk (%d): %s", ret, lua_tostring(L, -1));
+ }
+ return ret;
+}
+
+int w32res_enumerateEmbeddedLuaScripts(lua_State* L)
+{
+ const luaL_Reg winres_funcs[] = {
+ {W32RES_LOADER, luaC_winres_loader_},
+ {NULL, NULL}
+ };
+ luaL_register(L, W32RES_MODNAME, winres_funcs);
+ // winres table at top of stack
+ // Name for the contained table
+ lua_pushstring(L, W32RES_SCRIPTS);
+ // winres.scripts (later)
+ lua_newtable(L);
+ // Assign the table as winres.scripts
+ lua_rawset(L, -3);
+ // Enumerate the resource names of type RT_LUASCRIPT in the current module
+ // The callback functions add the names of resources to the table at the top of the stack
+ (void)EnumResourceNames(getMyModuleHandle(), RT_LUASCRIPT, (ENUMRESNAMEPROC)enumLuaScriptsNameCallback, (LONG_PTR)L);
+ if(lua_isstring(L, -1))
+ {
+ // Leave error message at top of stack
+ return 1;
+ }
+ // leave the winres table on the stack
+ return 0;
+}
diff --git a/3rdparty/lua/src/modules/w32resembed.h b/3rdparty/lua/src/modules/w32resembed.h
index 75ca836..417d47c 100644
--- a/3rdparty/lua/src/modules/w32resembed.h
+++ b/3rdparty/lua/src/modules/w32resembed.h
@@ -1,36 +1,36 @@
-#ifndef __W32RESEMBED_H_VER__
-#define __W32RESEMBED_H_VER__ 2012121805
-// $Id: w32resembed.h,v c46495b518e1 2012/12/18 05:27:02 oliver $
-#if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__MCPP)
-#pragma once
-#endif // Check for "#pragma once" support
-
-#ifdef RC_INVOKED
-# include <WinNT.rh>
-# define RT_LUASCRIPT "LUA"
-#else
-# include <Windows.h>
-# define RT_LUASCRIPT TEXT("LUA")
-
-# define W32RES_MODNAME "winres"
-# define W32RES_LOADER "c_loader"
-# define W32RES_SCRIPTS "scripts"
-
- EXTERN_C int w32res_enumerateEmbeddedLuaScripts(lua_State* L);
-
-# ifndef lua_pushtstring
-# define lua_pushtstring lua_pushstring
-# endif
-# ifndef lua_pushtstring_lowercase
- // same as in Lua: s = s:lower() ... with s on the stack afterward
-# define lua_pushtstring_lowercase(L, s) \
- lua_getfield(L, LUA_GLOBALSINDEX, "string"); \
- lua_getfield(L, -1, "lower"); \
- lua_remove(L, -2); \
- lua_pushtstring(L, s); \
- lua_call(L, 1, 1)
-# endif // lua_pushtstring_lowercase
-
-#endif
-
-#endif // __W32RESEMBED_H_VER__
+#ifndef __W32RESEMBED_H_VER__
+#define __W32RESEMBED_H_VER__ 2012121805
+// $Id: w32resembed.h,v c46495b518e1 2012/12/18 05:27:02 oliver $
+#if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__MCPP)
+#pragma once
+#endif // Check for "#pragma once" support
+
+#ifdef RC_INVOKED
+# include <WinNT.rh>
+# define RT_LUASCRIPT "LUA"
+#else
+# include <Windows.h>
+# define RT_LUASCRIPT TEXT("LUA")
+
+# define W32RES_MODNAME "winres"
+# define W32RES_LOADER "c_loader"
+# define W32RES_SCRIPTS "scripts"
+
+ EXTERN_C int w32res_enumerateEmbeddedLuaScripts(lua_State* L);
+
+# ifndef lua_pushtstring
+# define lua_pushtstring lua_pushstring
+# endif
+# ifndef lua_pushtstring_lowercase
+ // same as in Lua: s = s:lower() ... with s on the stack afterward
+# define lua_pushtstring_lowercase(L, s) \
+ lua_getfield(L, LUA_GLOBALSINDEX, "string"); \
+ lua_getfield(L, -1, "lower"); \
+ lua_remove(L, -2); \
+ lua_pushtstring(L, s); \
+ lua_call(L, 1, 1)
+# endif // lua_pushtstring_lowercase
+
+#endif
+
+#endif // __W32RESEMBED_H_VER__
diff --git a/3rdparty/lua/src/modules/winreg.c b/3rdparty/lua/src/modules/winreg.c
index 0e1fdfd..ba9b13f 100644
--- a/3rdparty/lua/src/modules/winreg.c
+++ b/3rdparty/lua/src/modules/winreg.c
@@ -1,49 +1,49 @@
-#define __LUA_WINREG_C__
-#include "winreg.h"
-
-#ifdef LUA_REG_NO_HIVEOPS
-# define __WIN_PRIVILEGES_H__
-#endif // LUA_REG_NO_HIVEOPS
-
-#ifdef LUA_REG_NO_WINTRACE
-# define __WINTRACE_H__
-# ifndef NOP_FUNCTION
-# if (_MSC_VER >= 1210)
-# define NOP_FUNCTION __noop
-# else
-# pragma warning(disable:4505) // unreferenced local function has been removed.
- static void nullfunc(const void * x, ...){FatalAppExit(0,(LPCTSTR)x);}
-# define NOP_FUNCTION 1?((void)0):nullfunc
-# endif
-# endif
-# define WIN_TRACET NOP_FUNCTION
-# define WIN_TRACEA NOP_FUNCTION
-# define WIN_TRACEW NOP_FUNCTION
-# define WIN_TRACEA_FT NOP_FUNCTION
-# define WIN_TRACEA_ST NOP_FUNCTION
-#endif // LUA_REG_NO_WINTRACE
-
-#include "lua-winreg/src/l52util.h"
-#include "lua-winreg/src/stdmacro.h"
-#include "lua-winreg/src/luamacro.h"
-#include "lua-winreg/src/luawinmacro.h"
-#include "lua-winreg/src/lua_tstring.h"
-#include "lua-winreg/src/lua_int64.h"
-#include "lua-winreg/src/lua_mtutil.h"
-#include "lua-winreg/src/luawin_dllerror.h"
-#include "lua-winreg/src/win_trace.h"
-#include "lua-winreg/src/win_privileges.h"
-#include "lua-winreg/src/win_registry.h"
-
-#include "lua-winreg/src/l52util.c"
-#include "lua-winreg/src/luawin_dllerror.c"
-#include "lua-winreg/src/lua_int64.c"
-#include "lua-winreg/src/lua_mtutil.c"
-#include "lua-winreg/src/lua_tstring.c"
-#ifndef LUA_REG_NO_HIVEOPS
-# include "lua-winreg/src/win_privileges.c"
-#endif // LUA_REG_NO_HIVEOPS
-#include "lua-winreg/src/win_registry.c"
-#include "lua-winreg/src/win_trace.c"
-#include "lua-winreg/src/winreg.c"
-
+#define __LUA_WINREG_C__
+#include "winreg.h"
+
+#ifdef LUA_REG_NO_HIVEOPS
+# define __WIN_PRIVILEGES_H__
+#endif // LUA_REG_NO_HIVEOPS
+
+#ifdef LUA_REG_NO_WINTRACE
+# define __WINTRACE_H__
+# ifndef NOP_FUNCTION
+# if (_MSC_VER >= 1210)
+# define NOP_FUNCTION __noop
+# else
+# pragma warning(disable:4505) // unreferenced local function has been removed.
+ static void nullfunc(const void * x, ...){FatalAppExit(0,(LPCTSTR)x);}
+# define NOP_FUNCTION 1?((void)0):nullfunc
+# endif
+# endif
+# define WIN_TRACET NOP_FUNCTION
+# define WIN_TRACEA NOP_FUNCTION
+# define WIN_TRACEW NOP_FUNCTION
+# define WIN_TRACEA_FT NOP_FUNCTION
+# define WIN_TRACEA_ST NOP_FUNCTION
+#endif // LUA_REG_NO_WINTRACE
+
+#include "lua-winreg/src/l52util.h"
+#include "lua-winreg/src/stdmacro.h"
+#include "lua-winreg/src/luamacro.h"
+#include "lua-winreg/src/luawinmacro.h"
+#include "lua-winreg/src/lua_tstring.h"
+#include "lua-winreg/src/lua_int64.h"
+#include "lua-winreg/src/lua_mtutil.h"
+#include "lua-winreg/src/luawin_dllerror.h"
+#include "lua-winreg/src/win_trace.h"
+#include "lua-winreg/src/win_privileges.h"
+#include "lua-winreg/src/win_registry.h"
+
+#include "lua-winreg/src/l52util.c"
+#include "lua-winreg/src/luawin_dllerror.c"
+#include "lua-winreg/src/lua_int64.c"
+#include "lua-winreg/src/lua_mtutil.c"
+#include "lua-winreg/src/lua_tstring.c"
+#ifndef LUA_REG_NO_HIVEOPS
+# include "lua-winreg/src/win_privileges.c"
+#endif // LUA_REG_NO_HIVEOPS
+#include "lua-winreg/src/win_registry.c"
+#include "lua-winreg/src/win_trace.c"
+#include "lua-winreg/src/winreg.c"
+
diff --git a/3rdparty/lua/src/modules/winreg.h b/3rdparty/lua/src/modules/winreg.h
index b2acb80..3f026d9 100644
--- a/3rdparty/lua/src/modules/winreg.h
+++ b/3rdparty/lua/src/modules/winreg.h
@@ -1,21 +1,21 @@
-#ifndef __WINREG_H_VER__
-#define __WINREG_H_VER__ 2012102400
-#if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__MCPP)
-#pragma once
-#endif // Check for "#pragma once" support
-
-#ifdef __cplusplus
-extern "C" {
-#endif
- extern luaL_Reg lreg_regobj[];
- extern luaL_Reg lreg_reglib[];
- extern int luaopen_winreg(lua_State *L);
-#ifdef __cplusplus
-}
-#endif
-
-#define LUA_WINREGNAME "winreg"
-#define LUA_REG_NO_WINTRACE
-#define LUA_REG_NO_HIVEOPS
-
-#endif // __LWINREG_H_VER__
+#ifndef __WINREG_H_VER__
+#define __WINREG_H_VER__ 2012102400
+#if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__MCPP)
+#pragma once
+#endif // Check for "#pragma once" support
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ extern luaL_Reg lreg_regobj[];
+ extern luaL_Reg lreg_reglib[];
+ extern int luaopen_winreg(lua_State *L);
+#ifdef __cplusplus
+}
+#endif
+
+#define LUA_WINREGNAME "winreg"
+#define LUA_REG_NO_WINTRACE
+#define LUA_REG_NO_HIVEOPS
+
+#endif // __LWINREG_H_VER__
diff --git a/3rdparty/lua/src/modules/wow64.c b/3rdparty/lua/src/modules/wow64.c
index e0ac80b..b490750 100644
--- a/3rdparty/lua/src/modules/wow64.c
+++ b/3rdparty/lua/src/modules/wow64.c
@@ -1,47 +1,47 @@
-///////////////////////////////////////////////////////////////////////////////
-///
-/// Written 2012, Oliver Schneider (assarbad.net) - PUBLIC DOMAIN/CC0
-///
-/// Original filename: wow64.c
-/// Project : WinDirStat
-/// Author(s) : Oliver Schneider
-///
-/// Purpose : Lua function, implemented in C, to check whether the
-/// current process is running as WOW64 process.
-///
-///////////////////////////////////////////////////////////////////////////////
-
-#include <Windows.h>
-#include <tchar.h>
-#include <lua.h>
-
-static int luaC_iswow64_(lua_State* L)
-{
- static int *pcachedResult = NULL;
- if(!pcachedResult)
- {
- typedef BOOL (WINAPI *TFNIsWow64Process) (HANDLE, PBOOL);
- static int cachedResult = 0;
- TFNIsWow64Process pfnIsWow64Process = (TFNIsWow64Process)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "IsWow64Process");
- if(pfnIsWow64Process)
- {
- BOOL bIsWow64 = FALSE;
- // Ignore result, instead presume it's not WOW64
- (void)pfnIsWow64Process(GetCurrentProcess(), &bIsWow64);
- cachedResult = (bIsWow64) ? 1 : 0;
- }
- pcachedResult = &cachedResult;
- }
- if(!pcachedResult)
- {
- lua_pushnil(L);
- return 1;
- }
- lua_pushboolean(L, *pcachedResult);
- return 1;
-}
-
-LUA_API const luaL_Reg wow64_funcs[] = {
- {"iswow64", luaC_iswow64_},
- {NULL, NULL}
-};
+///////////////////////////////////////////////////////////////////////////////
+///
+/// Written 2012, Oliver Schneider (assarbad.net) - PUBLIC DOMAIN/CC0
+///
+/// Original filename: wow64.c
+/// Project : WinDirStat
+/// Author(s) : Oliver Schneider
+///
+/// Purpose : Lua function, implemented in C, to check whether the
+/// current process is running as WOW64 process.
+///
+///////////////////////////////////////////////////////////////////////////////
+
+#include <Windows.h>
+#include <tchar.h>
+#include <lua.h>
+
+static int luaC_iswow64_(lua_State* L)
+{
+ static int *pcachedResult = NULL;
+ if(!pcachedResult)
+ {
+ typedef BOOL (WINAPI *TFNIsWow64Process) (HANDLE, PBOOL);
+ static int cachedResult = 0;
+ TFNIsWow64Process pfnIsWow64Process = (TFNIsWow64Process)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "IsWow64Process");
+ if(pfnIsWow64Process)
+ {
+ BOOL bIsWow64 = FALSE;
+ // Ignore result, instead presume it's not WOW64
+ (void)pfnIsWow64Process(GetCurrentProcess(), &bIsWow64);
+ cachedResult = (bIsWow64) ? 1 : 0;
+ }
+ pcachedResult = &cachedResult;
+ }
+ if(!pcachedResult)
+ {
+ lua_pushnil(L);
+ return 1;
+ }
+ lua_pushboolean(L, *pcachedResult);
+ return 1;
+}
+
+LUA_API const luaL_Reg wow64_funcs[] = {
+ {"iswow64", luaC_iswow64_},
+ {NULL, NULL}
+};
diff --git a/3rdparty/lua/src/modules/wow64.h b/3rdparty/lua/src/modules/wow64.h
index 87ba565..462aa9f 100644
--- a/3rdparty/lua/src/modules/wow64.h
+++ b/3rdparty/lua/src/modules/wow64.h
@@ -1,17 +1,17 @@
-#ifndef __WOW64_H_VER__
-#define __WOW64_H_VER__ 2012102414
-// $Id: wow64.h,v 52e6657a08c7 2012/10/24 15:21:39 oliver $
-#if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__MCPP)
-#pragma once
-#endif // Check for "#pragma once" support
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif // __cplusplus
- LUA_API const luaL_Reg wow64_funcs[];
-#ifdef __cplusplus
-};
-#endif // __cplusplus
-
-#endif // __WOW64_H_VER__
+#ifndef __WOW64_H_VER__
+#define __WOW64_H_VER__ 2012102414
+// $Id: wow64.h,v 52e6657a08c7 2012/10/24 15:21:39 oliver $
+#if (defined(_MSC_VER) && (_MSC_VER >= 1020)) || defined(__MCPP)
+#pragma once
+#endif // Check for "#pragma once" support
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif // __cplusplus
+ LUA_API const luaL_Reg wow64_funcs[];
+#ifdef __cplusplus
+};
+#endif // __cplusplus
+
+#endif // __WOW64_H_VER__
diff --git a/3rdparty/lua/src/msvcbuild.bat b/3rdparty/lua/src/msvcbuild.bat
index 9160e0f..4b50185 100644
--- a/3rdparty/lua/src/msvcbuild.bat
+++ b/3rdparty/lua/src/msvcbuild.bat
@@ -1,5 +1,5 @@
@rem Script to build LuaJIT with MSVC.
-@rem Copyright (C) 2005-2014 Mike Pall. See Copyright Notice in luajit.h
+@rem Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
@rem
@rem Either open a "Visual Studio .NET Command Prompt"
@rem (Note that the Express Edition does not contain an x64 compiler)
diff --git a/3rdparty/lua/src/vm_arm.dasc b/3rdparty/lua/src/vm_arm.dasc
index 114416a..457efa6 100644
--- a/3rdparty/lua/src/vm_arm.dasc
+++ b/3rdparty/lua/src/vm_arm.dasc
@@ -1,6 +1,6 @@
|// Low-level VM code for ARM CPUs.
|// Bytecode interpreter, fast functions and helper functions.
-|// Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+|// Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
|.arch arm
|.section code_op, code_sub
@@ -335,7 +335,7 @@ static void build_subroutines(BuildCtx *ctx)
| // - The GC shrinks the stack in between.
| // - A return back from a lua_call() with (high) nresults adjustment.
| str BASE, L->top // Save current top held in BASE (yes).
- | mov CARG2, KBASE
+ | lsr CARG2, KBASE, #3
| mov CARG1, L
| bl extern lj_state_growstack // (lua_State *L, int n)
| ldr BASE, L->top // Need the (realloced) L->top in BASE.
@@ -389,7 +389,7 @@ static void build_subroutines(BuildCtx *ctx)
| str BASE, L->base
| add PC, PC, #4 // Must point after first instruction.
| str RC, L->top
- | lsr CARG3, RA, #3
+ | lsr CARG2, RA, #3
|2:
| // L->base = new base, L->top = top
| str PC, SAVE_PC
@@ -539,9 +539,8 @@ static void build_subroutines(BuildCtx *ctx)
|1:
| beq ->cont_ffi_callback // cont = 1: return from FFI callback.
| // cont = 0: tailcall from C function.
- | ldr CARG3, [BASE, FRAME_FUNC]
- | sub CARG4, CARG4, #16
- | sub RC, CARG4, BASE
+ | sub CARG4, CARG4, #16
+ | sub RC, CARG4, BASE
| b ->vm_call_tail
|.endif
|
@@ -3217,7 +3216,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
| ins_next
|
|2: // Check if new value is collectable.
- | cmn RB, #-(LJ_TISNUM - LJ_TISGCV)
+ | cmn RB, #-(LJ_TNUMX - LJ_TISGCV)
| ldrbhi RC, GCOBJ:CARG3->gch.marked
| bls <1 // tvisgcv(v)
| sub CARG1, DISPATCH, #-GG_DISP2G
@@ -3241,10 +3240,10 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
| mvn RC, RC
| ldr UPVAL:CARG2, [LFUNC:CARG2, RA]
| ldr STR:CARG3, [KBASE, RC, lsl #2]
- | mvn CARG4, #~LJ_TSTR
| ldrb RB, UPVAL:CARG2->marked
- | ldr CARG2, UPVAL:CARG2->v
| ldrb RC, UPVAL:CARG2->closed
+ | ldr CARG2, UPVAL:CARG2->v
+ | mvn CARG4, #~LJ_TSTR
| tst RB, #LJ_GC_BLACK // isblack(uv)
| ldrb RB, STR:CARG3->marked
| strd CARG34, [CARG2]
diff --git a/3rdparty/lua/src/vm_mips.dasc b/3rdparty/lua/src/vm_mips.dasc
index a81dbee..ac8346b 100644
--- a/3rdparty/lua/src/vm_mips.dasc
+++ b/3rdparty/lua/src/vm_mips.dasc
@@ -1,6 +1,6 @@
|// Low-level VM code for MIPS CPUs.
|// Bytecode interpreter, fast functions and helper functions.
-|// Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+|// Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
|.arch mips
|.section code_op, code_sub
@@ -398,7 +398,7 @@ static void build_subroutines(BuildCtx *ctx)
| // - A return back from a lua_call() with (high) nresults adjustment.
| load_got lj_state_growstack
| move MULTRES, RD
- | move CARG2, TMP2
+ | srl CARG2, TMP2, 3
| call_intern lj_state_growstack // (lua_State *L, int n)
|. move CARG1, L
| lw TMP2, SAVE_NRES
@@ -2155,7 +2155,7 @@ static void build_subroutines(BuildCtx *ctx)
|2:
| addiu RC, MULTRES, -8
| jr AT
- |. add RA, RA, BASE
+ |. addu RA, RA, BASE
|
|3: // Rethrow error from the right C frame.
| load_got lj_err_throw
@@ -2882,12 +2882,12 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
| li AT, LJ_GC_BLACK|1
| or TMP3, TMP3, TMP0
| beq TMP3, AT, >2 // Upvalue is closed and black?
- |. addiu TMP2, TMP2, -(LJ_TISNUM+1)
+ |. addiu TMP2, TMP2, -(LJ_TNUMX+1)
|1:
| ins_next
|
|2: // Check if new value is collectable.
- | sltiu AT, TMP2, LJ_TISGCV - (LJ_TISNUM+1)
+ | sltiu AT, TMP2, LJ_TISGCV - (LJ_TNUMX+1)
| beqz AT, <1 // tvisgcv(v)
|. lw TMP1, LO(RD)
| lbu TMP3, GCOBJ:TMP1->gch.marked
diff --git a/3rdparty/lua/src/vm_ppc.dasc b/3rdparty/lua/src/vm_ppc.dasc
index f253081..ad8a023 100644
--- a/3rdparty/lua/src/vm_ppc.dasc
+++ b/3rdparty/lua/src/vm_ppc.dasc
@@ -1,6 +1,6 @@
|// Low-level VM code for PowerPC CPUs.
|// Bytecode interpreter, fast functions and helper functions.
-|// Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+|// Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
|.arch ppc
|.section code_op, code_sub
@@ -75,6 +75,29 @@
|.endif
|.endmacro
|
+|.macro clrso, reg
+|.if PPE
+| li reg, 0
+| mtxer reg
+|.else
+| mcrxr cr0
+|.endif
+|.endmacro
+|
+|.macro checkov, reg, noov
+|.if PPE
+| mfxer reg
+| add reg, reg, reg
+| cmpwi reg, 0
+| li reg, 0
+| mtxer reg
+| bgey noov
+|.else
+| mcrxr cr0
+| bley noov
+|.endif
+|.endmacro
+|
|//-----------------------------------------------------------------------
|
|// Fixed register assignments for the interpreter.
@@ -563,7 +586,7 @@ static void build_subroutines(BuildCtx *ctx)
| // - A return back from a lua_call() with (high) nresults adjustment.
| stp BASE, L->top // Save current top held in BASE (yes).
| mr SAVE0, RD
- | mr CARG2, TMP2
+ | srwi CARG2, TMP2, 3
| mr CARG1, L
| bl extern lj_state_growstack // (lua_State *L, int n)
| lwz TMP2, SAVE_NRES
@@ -2587,7 +2610,7 @@ static void build_subroutines(BuildCtx *ctx)
| stw CARG2, DISPATCH_GL(vmstate)(DISPATCH)
| savex_ 0,1,2,3
| stw CARG1, 0(sp) // Store extended stack chain.
- | mcrxr cr0 // Clear SO flag.
+ | clrso TMP1
| savex_ 4,5,6,7
| addi CARG2, sp, 16+32*8+32*4 // Recompute original value of sp.
| savex_ 8,9,10,11
@@ -2706,7 +2729,7 @@ static void build_subroutines(BuildCtx *ctx)
| cmpwi CARG2, 0
| li CARG1, 0
| beqlr
- | mcrxr cr0 // Clear SO for -2147483648 % -1 and return 0.
+ | clrso TMP0 // Clear SO for -2147483648 % -1 and return 0.
| blr
|
|//-----------------------------------------------------------------------
@@ -3309,7 +3332,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
|4:
|.if not GPR64
| // Potential overflow.
- | mcrxr cr0; bley <1 // Ignore unrelated overflow.
+ | checkov TMP1, <1 // Ignore unrelated overflow.
|.endif
| lus TMP1, 0x41e0 // 2^31.
| li TMP0, 0
@@ -3494,7 +3517,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
|2:
| ins_next2
|4: // Overflow.
- | mcrxr cr0; bley <1 // Ignore unrelated overflow.
+ | checkov TMP0, <1 // Ignore unrelated overflow.
| ins_arithfallback b
|5: // FP variant.
||if (vk == 1) {
@@ -3715,13 +3738,13 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
| cmplwi cr1, TMP0, 0
| lwz TMP1, 4(RD)
| cror 4*cr0+eq, 4*cr0+eq, 4*cr1+eq
- | subi TMP2, TMP2, (LJ_TISNUM+1)
+ | subi TMP2, TMP2, (LJ_TNUMX+1)
| bne >2 // Upvalue is closed and black?
|1:
| ins_next
|
|2: // Check if new value is collectable.
- | cmplwi TMP2, LJ_TISGCV - (LJ_TISNUM+1)
+ | cmplwi TMP2, LJ_TISGCV - (LJ_TNUMX+1)
| bge <1 // tvisgcv(v)
| lbz TMP3, GCOBJ:TMP1->gch.marked
| andix. TMP3, TMP3, LJ_GC_WHITES // iswhite(v)
@@ -4692,7 +4715,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
| b <1
if (vk) {
|6: // Potential overflow.
- | mcrxr cr0; bley <4 // Ignore unrelated overflow.
+ | checkov TMP0, <4 // Ignore unrelated overflow.
| b <2
}
|.endif
@@ -4832,7 +4855,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
| // Traces on PPC don't store the trace number, so use 0.
| stw ZERO, DISPATCH_GL(vmstate)(DISPATCH)
| lwzx TRACE:TMP2, TMP1, RD
- | mcrxr cr0 // Clear SO flag.
+ | clrso TMP1
| lp TMP2, TRACE:TMP2->mcode
| stw BASE, DISPATCH_GL(jit_base)(DISPATCH)
| mtctr TMP2
diff --git a/3rdparty/lua/src/vm_ppcspe.dasc b/3rdparty/lua/src/vm_ppcspe.dasc
index 293e391..53ea2d9 100644
--- a/3rdparty/lua/src/vm_ppcspe.dasc
+++ b/3rdparty/lua/src/vm_ppcspe.dasc
@@ -1,6 +1,6 @@
|// Low-level VM code for PowerPC/e500 CPUs.
|// Bytecode interpreter, fast functions and helper functions.
-|// Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+|// Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
|.arch ppc
|.section code_op, code_sub
diff --git a/3rdparty/lua/src/vm_x86.dasc b/3rdparty/lua/src/vm_x86.dasc
index f25dfd3..6cdb8cb 100644
--- a/3rdparty/lua/src/vm_x86.dasc
+++ b/3rdparty/lua/src/vm_x86.dasc
@@ -1,6 +1,6 @@
|// Low-level VM code for x86 CPUs.
|// Bytecode interpreter, fast functions and helper functions.
-|// Copyright (C) 2005-2013 Mike Pall. See Copyright Notice in luajit.h
+|// Copyright (C) 2005-2015 Mike Pall. See Copyright Notice in luajit.h
|
|.if P64
|.arch x64
@@ -1617,7 +1617,7 @@ static void build_subroutines(BuildCtx *ctx)
| mov RD, 1+3
| jmp ->fff_res
|
- |.ffunc_1 ipairs_aux
+ |.ffunc_2 ipairs_aux
| cmp dword [BASE+4], LJ_TTAB; jne ->fff_fallback
| cmp dword [BASE+12], LJ_TISNUM
|.if DUALNUM
@@ -2198,7 +2198,7 @@ static void build_subroutines(BuildCtx *ctx)
|.endif
|
|.ffunc_nnr math_fmod
- |1: ; fprem; fnstsw ax; sahf; jp <1
+ |1: ; fprem; fnstsw ax; and ax, 0x400; jnz <1
| fpop1
| jmp ->fff_resn
|
@@ -2564,8 +2564,8 @@ static void build_subroutines(BuildCtx *ctx)
|
|.define TOBIT_BIAS, 0x59c00000 // 2^52 + 2^51 (float, not double!).
|
- |.macro .ffunc_bit, name, kind
- | .ffunc_1 name
+ |.macro .ffunc_bit, name, kind, fdef
+ | fdef name
|.if kind == 2
|.if SSE
| sseconst_tobit xmm1, RBa
@@ -2608,6 +2608,10 @@ static void build_subroutines(BuildCtx *ctx)
|2:
|.endmacro
|
+ |.macro .ffunc_bit, name, kind
+ | .ffunc_bit name, kind, .ffunc_1
+ |.endmacro
+ |
|.ffunc_bit bit_tobit, 0
|.if DUALNUM or SSE
|.if not SSE
@@ -2681,7 +2685,7 @@ static void build_subroutines(BuildCtx *ctx)
|
|.macro .ffunc_bit_sh, name, ins
|.if DUALNUM
- | .ffunc_bit name, 1
+ | .ffunc_bit name, 1, .ffunc_2
| // Note: no inline conversion from number for 2nd argument!
| cmp dword [BASE+12], LJ_TISNUM; jne ->fff_fallback
| mov RA, dword [BASE+8]
@@ -4652,7 +4656,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
|
|2: // Upvalue is black. Check if new value is collectable and white.
| sub RD, LJ_TISGCV
- | cmp RD, LJ_TISNUM - LJ_TISGCV // tvisgcv(v)
+ | cmp RD, LJ_TNUMX - LJ_TISGCV // tvisgcv(v)
| jbe <1
| test byte GCOBJ:RA->gch.marked, LJ_GC_WHITES // iswhite(v)
| jz <1
@@ -5320,8 +5324,7 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
| jnz <4
| movzx RA, PC_RA
| not RAa
- | lea RA, [BASE+RA*8]
- | mov LFUNC:KBASE, [RA-8] // Need to prepare KBASE.
+ | mov LFUNC:KBASE, [BASE+RA*8-8] // Need to prepare KBASE.
| mov KBASE, LFUNC:KBASE->pc
| mov KBASE, [KBASE+PC2PROTO(k)]
| jmp <4
@@ -6344,12 +6347,12 @@ static void emit_asm_debug(BuildCtx *ctx)
#if LJ_64
"\t.byte 0xe\n\t.byte 16\n" /* def_cfa_offset */
"\t.byte 0x86\n\t.byte 0x2\n" /* offset rbp */
- "\t.byte 0xd\n\t.uleb128 0x6\n" /* def_cfa_register rbp */
+ "\t.byte 0xd\n\t.byte 0x6\n" /* def_cfa_register rbp */
"\t.byte 0x83\n\t.byte 0x3\n" /* offset rbx */
#else
"\t.byte 0xe\n\t.byte 8\n" /* def_cfa_offset */
"\t.byte 0x84\n\t.byte 0x2\n" /* offset ebp (4 for MACH-O)*/
- "\t.byte 0xd\n\t.uleb128 0x4\n" /* def_cfa_register ebp */
+ "\t.byte 0xd\n\t.byte 0x4\n" /* def_cfa_register ebp */
"\t.byte 0x83\n\t.byte 0x3\n" /* offset ebx */
#endif
"\t.align " BSZPTR "\n"
diff --git a/3rdparty/lua/src/xedkbuild.bat b/3rdparty/lua/src/xedkbuild.bat
index 375f195..240ec87 100644
--- a/3rdparty/lua/src/xedkbuild.bat
+++ b/3rdparty/lua/src/xedkbuild.bat
@@ -56,11 +56,11 @@ buildvm -m folddef -o lj_folddef.h lj_opt_fold.c
@rem ---- Cross compiler ----
@set LJCOMPILE="%XEDK%\bin\win32\cl" /nologo /c /MT /O2 /W3 /GF /Gm- /GR- /GS- /Gy /openmp- /D_CRT_SECURE_NO_DEPRECATE /DNDEBUG /D_XBOX /D_LIB /DLUAJIT_USE_SYSMALLOC
@set LJLIB="%XEDK%\bin\win32\lib" /nologo
-@set INCLUDE="%XEDK%\include\xbox"
+@set "INCLUDE=%XEDK%\include\xbox"
@if "%1" neq "debug" goto :NODEBUG
@shift
-@set LJCOMPILE="%LJCOMPILE%" /Zi
+@set "LJCOMPILE=%LJCOMPILE% /Zi"
:NODEBUG
@if "%1"=="amalg" goto :AMALG
%LJCOMPILE% /DLUA_BUILD_AS_DLL lj_*.c lib_*.c