immunio 1.2.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +13 -5
- data/ext/immunio/Rakefile +14 -6
- data/lib/immunio/context.rb +2 -0
- data/lib/immunio/plugins/action_view.rb +7 -668
- data/lib/immunio/plugins/action_view/action_view.rb +22 -0
- data/lib/immunio/plugins/action_view/active_support_hash.rb +29 -0
- data/lib/immunio/plugins/action_view/cache_store.rb +24 -0
- data/lib/immunio/plugins/action_view/erubi.rb +38 -0
- data/lib/immunio/plugins/action_view/erubis.rb +39 -0
- data/lib/immunio/plugins/action_view/fragment_caching.rb +29 -0
- data/lib/immunio/plugins/action_view/haml.rb +46 -0
- data/lib/immunio/plugins/action_view/slim.rb +42 -0
- data/lib/immunio/plugins/action_view/template.rb +431 -0
- data/lib/immunio/plugins/action_view/template_rendering.rb +45 -0
- data/lib/immunio/plugins/http_tracker.rb +2 -0
- data/lib/immunio/plugins/io.rb +34 -0
- data/lib/immunio/version.rb +1 -1
- data/lua-hooks/Makefile +36 -9
- data/lua-hooks/ext/luajit/COPYRIGHT +1 -1
- data/lua-hooks/ext/luajit/Makefile +22 -15
- data/lua-hooks/ext/luajit/README +2 -2
- data/lua-hooks/ext/luajit/doc/bluequad-print.css +1 -1
- data/lua-hooks/ext/luajit/doc/bluequad.css +1 -1
- data/lua-hooks/ext/luajit/doc/changes.html +69 -3
- data/lua-hooks/ext/luajit/doc/contact.html +10 -3
- data/lua-hooks/ext/luajit/doc/ext_c_api.html +2 -2
- data/lua-hooks/ext/luajit/doc/ext_ffi.html +2 -2
- data/lua-hooks/ext/luajit/doc/ext_ffi_api.html +2 -2
- data/lua-hooks/ext/luajit/doc/ext_ffi_semantics.html +3 -4
- data/lua-hooks/ext/luajit/doc/ext_ffi_tutorial.html +2 -2
- data/lua-hooks/ext/luajit/doc/ext_jit.html +3 -3
- data/lua-hooks/ext/luajit/doc/ext_profiler.html +2 -2
- data/lua-hooks/ext/luajit/doc/extensions.html +47 -20
- data/lua-hooks/ext/luajit/doc/faq.html +2 -2
- data/lua-hooks/ext/luajit/doc/install.html +74 -45
- data/lua-hooks/ext/luajit/doc/luajit.html +5 -5
- data/lua-hooks/ext/luajit/doc/running.html +3 -3
- data/lua-hooks/ext/luajit/doc/status.html +13 -8
- data/lua-hooks/ext/luajit/dynasm/dasm_arm.h +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_arm.lua +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_arm64.h +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_arm64.lua +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_mips.h +8 -5
- data/lua-hooks/ext/luajit/dynasm/dasm_mips.lua +66 -11
- data/lua-hooks/ext/luajit/dynasm/dasm_mips64.lua +12 -0
- data/lua-hooks/ext/luajit/dynasm/dasm_ppc.h +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_ppc.lua +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_proto.h +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_x64.lua +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_x86.h +1 -1
- data/lua-hooks/ext/luajit/dynasm/dasm_x86.lua +5 -1
- data/lua-hooks/ext/luajit/dynasm/dynasm.lua +2 -2
- data/lua-hooks/ext/luajit/etc/luajit.1 +1 -1
- data/lua-hooks/ext/luajit/etc/luajit.pc +1 -1
- data/lua-hooks/ext/luajit/src/Makefile +15 -11
- data/lua-hooks/ext/luajit/src/Makefile.dep +16 -16
- data/lua-hooks/ext/luajit/src/host/buildvm.c +2 -2
- data/lua-hooks/ext/luajit/src/host/buildvm.h +1 -1
- data/lua-hooks/ext/luajit/src/host/buildvm_asm.c +9 -4
- data/lua-hooks/ext/luajit/src/host/buildvm_fold.c +2 -2
- data/lua-hooks/ext/luajit/src/host/buildvm_lib.c +1 -1
- data/lua-hooks/ext/luajit/src/host/buildvm_libbc.h +14 -3
- data/lua-hooks/ext/luajit/src/host/buildvm_peobj.c +27 -3
- data/lua-hooks/ext/luajit/src/host/genlibbc.lua +1 -1
- data/lua-hooks/ext/luajit/src/host/genminilua.lua +6 -5
- data/lua-hooks/ext/luajit/src/host/minilua.c +1 -1
- data/lua-hooks/ext/luajit/src/jit/bc.lua +1 -1
- data/lua-hooks/ext/luajit/src/jit/bcsave.lua +8 -8
- data/lua-hooks/ext/luajit/src/jit/dis_arm.lua +2 -2
- data/lua-hooks/ext/luajit/src/jit/dis_arm64.lua +1216 -0
- data/lua-hooks/ext/luajit/src/jit/dis_arm64be.lua +12 -0
- data/lua-hooks/ext/luajit/src/jit/dis_mips.lua +35 -20
- data/lua-hooks/ext/luajit/src/jit/dis_mips64.lua +17 -0
- data/lua-hooks/ext/luajit/src/jit/dis_mips64el.lua +17 -0
- data/lua-hooks/ext/luajit/src/jit/dis_mipsel.lua +1 -1
- data/lua-hooks/ext/luajit/src/jit/dis_ppc.lua +2 -2
- data/lua-hooks/ext/luajit/src/jit/dis_x64.lua +1 -1
- data/lua-hooks/ext/luajit/src/jit/dis_x86.lua +7 -4
- data/lua-hooks/ext/luajit/src/jit/dump.lua +17 -12
- data/lua-hooks/ext/luajit/src/jit/p.lua +3 -2
- data/lua-hooks/ext/luajit/src/jit/v.lua +2 -2
- data/lua-hooks/ext/luajit/src/jit/zone.lua +1 -1
- data/lua-hooks/ext/luajit/src/lauxlib.h +14 -20
- data/lua-hooks/ext/luajit/src/lib_aux.c +38 -27
- data/lua-hooks/ext/luajit/src/lib_base.c +12 -5
- data/lua-hooks/ext/luajit/src/lib_bit.c +1 -1
- data/lua-hooks/ext/luajit/src/lib_debug.c +5 -5
- data/lua-hooks/ext/luajit/src/lib_ffi.c +2 -2
- data/lua-hooks/ext/luajit/src/lib_init.c +16 -16
- data/lua-hooks/ext/luajit/src/lib_io.c +6 -7
- data/lua-hooks/ext/luajit/src/lib_jit.c +14 -4
- data/lua-hooks/ext/luajit/src/lib_math.c +1 -5
- data/lua-hooks/ext/luajit/src/lib_os.c +1 -1
- data/lua-hooks/ext/luajit/src/lib_package.c +14 -23
- data/lua-hooks/ext/luajit/src/lib_string.c +1 -5
- data/lua-hooks/ext/luajit/src/lib_table.c +21 -1
- data/lua-hooks/ext/luajit/src/lj.supp +3 -3
- data/lua-hooks/ext/luajit/src/lj_alloc.c +174 -83
- data/lua-hooks/ext/luajit/src/lj_api.c +97 -18
- data/lua-hooks/ext/luajit/src/lj_arch.h +54 -22
- data/lua-hooks/ext/luajit/src/lj_asm.c +172 -53
- data/lua-hooks/ext/luajit/src/lj_asm.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_asm_arm.h +19 -16
- data/lua-hooks/ext/luajit/src/lj_asm_arm64.h +2022 -0
- data/lua-hooks/ext/luajit/src/lj_asm_mips.h +564 -158
- data/lua-hooks/ext/luajit/src/lj_asm_ppc.h +19 -18
- data/lua-hooks/ext/luajit/src/lj_asm_x86.h +578 -92
- data/lua-hooks/ext/luajit/src/lj_bc.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_bc.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_bcdump.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_bcread.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_bcwrite.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_buf.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_buf.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_carith.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_carith.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_ccall.c +172 -7
- data/lua-hooks/ext/luajit/src/lj_ccall.h +21 -5
- data/lua-hooks/ext/luajit/src/lj_ccallback.c +71 -17
- data/lua-hooks/ext/luajit/src/lj_ccallback.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_cconv.c +4 -2
- data/lua-hooks/ext/luajit/src/lj_cconv.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_cdata.c +7 -5
- data/lua-hooks/ext/luajit/src/lj_cdata.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_clib.c +5 -5
- data/lua-hooks/ext/luajit/src/lj_clib.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_cparse.c +11 -6
- data/lua-hooks/ext/luajit/src/lj_cparse.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_crecord.c +70 -14
- data/lua-hooks/ext/luajit/src/lj_crecord.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_ctype.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_ctype.h +8 -8
- data/lua-hooks/ext/luajit/src/lj_debug.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_debug.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_def.h +6 -9
- data/lua-hooks/ext/luajit/src/lj_dispatch.c +3 -3
- data/lua-hooks/ext/luajit/src/lj_dispatch.h +2 -1
- data/lua-hooks/ext/luajit/src/lj_emit_arm.h +5 -4
- data/lua-hooks/ext/luajit/src/lj_emit_arm64.h +419 -0
- data/lua-hooks/ext/luajit/src/lj_emit_mips.h +100 -20
- data/lua-hooks/ext/luajit/src/lj_emit_ppc.h +4 -4
- data/lua-hooks/ext/luajit/src/lj_emit_x86.h +116 -25
- data/lua-hooks/ext/luajit/src/lj_err.c +34 -13
- data/lua-hooks/ext/luajit/src/lj_err.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_errmsg.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_ff.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_ffrecord.c +58 -49
- data/lua-hooks/ext/luajit/src/lj_ffrecord.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_frame.h +33 -6
- data/lua-hooks/ext/luajit/src/lj_func.c +4 -2
- data/lua-hooks/ext/luajit/src/lj_func.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_gc.c +16 -7
- data/lua-hooks/ext/luajit/src/lj_gc.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_gdbjit.c +31 -1
- data/lua-hooks/ext/luajit/src/lj_gdbjit.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_ir.c +69 -96
- data/lua-hooks/ext/luajit/src/lj_ir.h +29 -18
- data/lua-hooks/ext/luajit/src/lj_ircall.h +24 -30
- data/lua-hooks/ext/luajit/src/lj_iropt.h +9 -9
- data/lua-hooks/ext/luajit/src/lj_jit.h +67 -9
- data/lua-hooks/ext/luajit/src/lj_lex.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_lex.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_lib.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_lib.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_load.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_mcode.c +11 -10
- data/lua-hooks/ext/luajit/src/lj_mcode.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_meta.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_meta.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_obj.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_obj.h +7 -3
- data/lua-hooks/ext/luajit/src/lj_opt_dce.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_opt_fold.c +84 -17
- data/lua-hooks/ext/luajit/src/lj_opt_loop.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_opt_mem.c +3 -3
- data/lua-hooks/ext/luajit/src/lj_opt_narrow.c +24 -22
- data/lua-hooks/ext/luajit/src/lj_opt_sink.c +11 -6
- data/lua-hooks/ext/luajit/src/lj_opt_split.c +11 -2
- data/lua-hooks/ext/luajit/src/lj_parse.c +9 -7
- data/lua-hooks/ext/luajit/src/lj_parse.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_profile.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_profile.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_record.c +201 -117
- data/lua-hooks/ext/luajit/src/lj_record.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_snap.c +72 -26
- data/lua-hooks/ext/luajit/src/lj_snap.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_state.c +6 -6
- data/lua-hooks/ext/luajit/src/lj_state.h +2 -2
- data/lua-hooks/ext/luajit/src/lj_str.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_str.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_strfmt.c +7 -3
- data/lua-hooks/ext/luajit/src/lj_strfmt.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_strfmt_num.c +4 -3
- data/lua-hooks/ext/luajit/src/lj_strscan.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_strscan.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_tab.c +1 -2
- data/lua-hooks/ext/luajit/src/lj_tab.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_target.h +3 -3
- data/lua-hooks/ext/luajit/src/lj_target_arm.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_target_arm64.h +239 -7
- data/lua-hooks/ext/luajit/src/lj_target_mips.h +111 -22
- data/lua-hooks/ext/luajit/src/lj_target_ppc.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_target_x86.h +21 -4
- data/lua-hooks/ext/luajit/src/lj_trace.c +63 -18
- data/lua-hooks/ext/luajit/src/lj_trace.h +2 -1
- data/lua-hooks/ext/luajit/src/lj_traceerr.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_udata.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_udata.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_vm.h +5 -1
- data/lua-hooks/ext/luajit/src/lj_vmevent.c +1 -1
- data/lua-hooks/ext/luajit/src/lj_vmevent.h +1 -1
- data/lua-hooks/ext/luajit/src/lj_vmmath.c +1 -1
- data/lua-hooks/ext/luajit/src/ljamalg.c +1 -1
- data/lua-hooks/ext/luajit/src/lua.h +9 -1
- data/lua-hooks/ext/luajit/src/luaconf.h +3 -7
- data/lua-hooks/ext/luajit/src/luajit.c +69 -54
- data/lua-hooks/ext/luajit/src/luajit.h +4 -4
- data/lua-hooks/ext/luajit/src/lualib.h +1 -1
- data/lua-hooks/ext/luajit/src/msvcbuild.bat +12 -4
- data/lua-hooks/ext/luajit/src/vm_arm.dasc +1 -1
- data/lua-hooks/ext/luajit/src/vm_arm64.dasc +255 -32
- data/lua-hooks/ext/luajit/src/vm_mips.dasc +26 -23
- data/lua-hooks/ext/luajit/src/vm_mips64.dasc +5062 -0
- data/lua-hooks/ext/luajit/src/vm_ppc.dasc +1 -1
- data/lua-hooks/ext/luajit/src/vm_x64.dasc +24 -25
- data/lua-hooks/ext/luajit/src/vm_x86.dasc +77 -4
- data/lua-hooks/libluahooks.darwin.a +0 -0
- data/lua-hooks/libluahooks.linux.a +0 -0
- data/lua-hooks/options.mk +1 -1
- metadata +37 -77
- data/lua-hooks/ext/all.c +0 -69
- data/lua-hooks/ext/libinjection/COPYING +0 -37
- data/lua-hooks/ext/libinjection/libinjection.h +0 -65
- data/lua-hooks/ext/libinjection/libinjection_html5.c +0 -847
- data/lua-hooks/ext/libinjection/libinjection_html5.h +0 -54
- data/lua-hooks/ext/libinjection/libinjection_sqli.c +0 -2301
- data/lua-hooks/ext/libinjection/libinjection_sqli.h +0 -295
- data/lua-hooks/ext/libinjection/libinjection_sqli_data.h +0 -9349
- data/lua-hooks/ext/libinjection/libinjection_xss.c +0 -531
- data/lua-hooks/ext/libinjection/libinjection_xss.h +0 -21
- data/lua-hooks/ext/libinjection/lualib.c +0 -145
- data/lua-hooks/ext/libinjection/module.mk +0 -5
- data/lua-hooks/ext/lpeg/HISTORY +0 -96
- data/lua-hooks/ext/lpeg/lpcap.c +0 -537
- data/lua-hooks/ext/lpeg/lpcap.h +0 -56
- data/lua-hooks/ext/lpeg/lpcode.c +0 -1014
- data/lua-hooks/ext/lpeg/lpcode.h +0 -40
- data/lua-hooks/ext/lpeg/lpeg-128.gif +0 -0
- data/lua-hooks/ext/lpeg/lpeg.html +0 -1445
- data/lua-hooks/ext/lpeg/lpprint.c +0 -244
- data/lua-hooks/ext/lpeg/lpprint.h +0 -36
- data/lua-hooks/ext/lpeg/lptree.c +0 -1303
- data/lua-hooks/ext/lpeg/lptree.h +0 -82
- data/lua-hooks/ext/lpeg/lptypes.h +0 -149
- data/lua-hooks/ext/lpeg/lpvm.c +0 -364
- data/lua-hooks/ext/lpeg/lpvm.h +0 -58
- data/lua-hooks/ext/lpeg/makefile +0 -55
- data/lua-hooks/ext/lpeg/module.mk +0 -6
- data/lua-hooks/ext/lpeg/re.html +0 -498
- data/lua-hooks/ext/lua-cmsgpack/.gitignore +0 -13
- data/lua-hooks/ext/lua-cmsgpack/CMakeLists.txt +0 -45
- data/lua-hooks/ext/lua-cmsgpack/README.md +0 -115
- data/lua-hooks/ext/lua-cmsgpack/lua_cmsgpack.c +0 -970
- data/lua-hooks/ext/lua-cmsgpack/module.mk +0 -2
- data/lua-hooks/ext/lua-cmsgpack/test.lua +0 -570
- data/lua-hooks/ext/lua-snapshot/LICENSE +0 -7
- data/lua-hooks/ext/lua-snapshot/Makefile +0 -12
- data/lua-hooks/ext/lua-snapshot/README.md +0 -18
- data/lua-hooks/ext/lua-snapshot/dump.lua +0 -15
- data/lua-hooks/ext/lua-snapshot/module.mk +0 -2
- data/lua-hooks/ext/lua-snapshot/snapshot.c +0 -462
- data/lua-hooks/ext/luautf8/README.md +0 -152
- data/lua-hooks/ext/luautf8/lutf8lib.c +0 -1274
- data/lua-hooks/ext/luautf8/module.mk +0 -2
- data/lua-hooks/ext/luautf8/unidata.h +0 -3064
- data/lua-hooks/ext/module.mk +0 -15
- data/lua-hooks/ext/modules.h +0 -17
- data/lua-hooks/ext/perf/luacpu.c +0 -114
- data/lua-hooks/ext/perf/lualoadavg.c +0 -40
- data/lua-hooks/ext/perf/luameminfo.c +0 -38
- data/lua-hooks/ext/perf/luaoslib.c +0 -203
- data/lua-hooks/ext/perf/module.mk +0 -5
- data/lua-hooks/ext/sha1/luasha1.c +0 -74
- data/lua-hooks/ext/sha1/module.mk +0 -5
- data/lua-hooks/ext/sha1/sha1.c +0 -145
- data/lua-hooks/ext/sha2/luasha256.c +0 -77
- data/lua-hooks/ext/sha2/module.mk +0 -5
- data/lua-hooks/ext/sha2/sha256.c +0 -196
- data/lua-hooks/ext/sysutils/lua_utils.c +0 -56
- data/lua-hooks/ext/sysutils/module.mk +0 -2
@@ -0,0 +1,12 @@
|
|
1
|
+
----------------------------------------------------------------------------
|
2
|
+
-- LuaJIT ARM64BE disassembler wrapper module.
|
3
|
+
--
|
4
|
+
-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.
|
5
|
+
-- Released under the MIT license. See Copyright Notice in luajit.h
|
6
|
+
----------------------------------------------------------------------------
|
7
|
+
-- ARM64 instructions are always little-endian. So just forward to the
|
8
|
+
-- common ARM64 disassembler module. All the interesting stuff is there.
|
9
|
+
------------------------------------------------------------------------------
|
10
|
+
|
11
|
+
return require((string.match(..., ".*%.") or "").."dis_arm64")
|
12
|
+
|
@@ -1,7 +1,7 @@
|
|
1
1
|
----------------------------------------------------------------------------
|
2
2
|
-- LuaJIT MIPS disassembler module.
|
3
3
|
--
|
4
|
-
-- Copyright (C) 2005-
|
4
|
+
-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.
|
5
5
|
-- Released under the MIT/X license. See Copyright Notice in luajit.h
|
6
6
|
----------------------------------------------------------------------------
|
7
7
|
-- This is a helper module used by the LuaJIT machine code dumper module.
|
@@ -11,8 +11,8 @@
|
|
11
11
|
------------------------------------------------------------------------------
|
12
12
|
|
13
13
|
local type = type
|
14
|
-
local
|
15
|
-
local match, gmatch
|
14
|
+
local byte, format = string.byte, string.format
|
15
|
+
local match, gmatch = string.match, string.gmatch
|
16
16
|
local concat = table.concat
|
17
17
|
local bit = require("bit")
|
18
18
|
local band, bor, tohex = bit.band, bit.bor, bit.tohex
|
@@ -34,15 +34,17 @@ local map_special = {
|
|
34
34
|
"jrS", "jalrD1S", "movzDST", "movnDST",
|
35
35
|
"syscallY", "breakY", false, "sync",
|
36
36
|
"mfhiD", "mthiS", "mfloD", "mtloS",
|
37
|
-
|
37
|
+
"dsllvDST", false, "dsrlvDST", "dsravDST",
|
38
38
|
"multST", "multuST", "divST", "divuST",
|
39
|
-
|
39
|
+
"dmultST", "dmultuST", "ddivST", "ddivuST",
|
40
40
|
"addDST", "addu|moveDST0", "subDST", "subu|neguDS0T",
|
41
|
-
"andDST", "
|
41
|
+
"andDST", "or|moveDST0", "xorDST", "nor|notDST0",
|
42
42
|
false, false, "sltDST", "sltuDST",
|
43
|
-
|
43
|
+
"daddDST", "dadduDST", "dsubDST", "dsubuDST",
|
44
44
|
"tgeSTZ", "tgeuSTZ", "tltSTZ", "tltuSTZ",
|
45
|
-
"teqSTZ", false, "tneSTZ",
|
45
|
+
"teqSTZ", false, "tneSTZ", false,
|
46
|
+
"dsllDTA", false, "dsrlDTA", "dsraDTA",
|
47
|
+
"dsll32DTA", false, "dsrl32DTA", "dsra32DTA",
|
46
48
|
}
|
47
49
|
|
48
50
|
local map_special2 = {
|
@@ -60,11 +62,17 @@ local map_bshfl = {
|
|
60
62
|
[24] = "sehDT",
|
61
63
|
}
|
62
64
|
|
65
|
+
local map_dbshfl = {
|
66
|
+
shift = 6, mask = 31,
|
67
|
+
[2] = "dsbhDT",
|
68
|
+
[5] = "dshdDT",
|
69
|
+
}
|
70
|
+
|
63
71
|
local map_special3 = {
|
64
72
|
shift = 0, mask = 63,
|
65
|
-
[0]
|
66
|
-
[
|
67
|
-
[59] = "rdhwrTD",
|
73
|
+
[0] = "extTSAK", [1] = "dextmTSAP", [3] = "dextTSAK",
|
74
|
+
[4] = "insTSAL", [6] = "dinsuTSEQ", [7] = "dinsTSAL",
|
75
|
+
[32] = map_bshfl, [36] = map_dbshfl, [59] = "rdhwrTD",
|
68
76
|
}
|
69
77
|
|
70
78
|
local map_regimm = {
|
@@ -178,8 +186,8 @@ local map_cop1bc = {
|
|
178
186
|
|
179
187
|
local map_cop1 = {
|
180
188
|
shift = 21, mask = 31,
|
181
|
-
[0] = "mfc1TG",
|
182
|
-
"mtc1TG",
|
189
|
+
[0] = "mfc1TG", "dmfc1TG", "cfc1TG", "mfhc1TG",
|
190
|
+
"mtc1TG", "dmtc1TG", "ctc1TG", "mthc1TG",
|
183
191
|
map_cop1bc, false, false, false,
|
184
192
|
false, false, false, false,
|
185
193
|
map_cop1s, map_cop1d, false, false,
|
@@ -213,16 +221,16 @@ local map_pri = {
|
|
213
221
|
"andiTSU", "ori|liTS0U", "xoriTSU", "luiTU",
|
214
222
|
map_cop0, map_cop1, false, map_cop1x,
|
215
223
|
"beql|beqzlST0B", "bnel|bnezlST0B", "blezlSB", "bgtzlSB",
|
216
|
-
|
217
|
-
map_special2,
|
224
|
+
"daddiTSI", "daddiuTSI", false, false,
|
225
|
+
map_special2, "jalxJ", false, map_special3,
|
218
226
|
"lbTSO", "lhTSO", "lwlTSO", "lwTSO",
|
219
227
|
"lbuTSO", "lhuTSO", "lwrTSO", false,
|
220
228
|
"sbTSO", "shTSO", "swlTSO", "swTSO",
|
221
229
|
false, false, "swrTSO", "cacheNSO",
|
222
230
|
"llTSO", "lwc1HSO", "lwc2TSO", "prefNSO",
|
223
|
-
false, "ldc1HSO", "ldc2TSO",
|
231
|
+
false, "ldc1HSO", "ldc2TSO", "ldTSO",
|
224
232
|
"scTSO", "swc1HSO", "swc2TSO", false,
|
225
|
-
false, "sdc1HSO", "sdc2TSO",
|
233
|
+
false, "sdc1HSO", "sdc2TSO", "sdTSO",
|
226
234
|
}
|
227
235
|
|
228
236
|
------------------------------------------------------------------------------
|
@@ -306,6 +314,8 @@ local function disass_ins(ctx)
|
|
306
314
|
x = "f"..band(rshift(op, 21), 31)
|
307
315
|
elseif p == "A" then
|
308
316
|
x = band(rshift(op, 6), 31)
|
317
|
+
elseif p == "E" then
|
318
|
+
x = band(rshift(op, 6), 31) + 32
|
309
319
|
elseif p == "M" then
|
310
320
|
x = band(rshift(op, 11), 31)
|
311
321
|
elseif p == "N" then
|
@@ -315,8 +325,12 @@ local function disass_ins(ctx)
|
|
315
325
|
if x == 0 then x = nil end
|
316
326
|
elseif p == "K" then
|
317
327
|
x = band(rshift(op, 11), 31) + 1
|
328
|
+
elseif p == "P" then
|
329
|
+
x = band(rshift(op, 11), 31) + 33
|
318
330
|
elseif p == "L" then
|
319
331
|
x = band(rshift(op, 11), 31) - last + 1
|
332
|
+
elseif p == "Q" then
|
333
|
+
x = band(rshift(op, 11), 31) - last + 33
|
320
334
|
elseif p == "I" then
|
321
335
|
x = arshift(lshift(op, 16), 16)
|
322
336
|
elseif p == "U" then
|
@@ -330,11 +344,12 @@ local function disass_ins(ctx)
|
|
330
344
|
elseif p == "B" then
|
331
345
|
x = ctx.addr + ctx.pos + arshift(lshift(op, 16), 16)*4 + 4
|
332
346
|
ctx.rel = x
|
333
|
-
x = "0x"
|
347
|
+
x = format("0x%08x", x)
|
334
348
|
elseif p == "J" then
|
335
|
-
|
349
|
+
local a = ctx.addr + ctx.pos
|
350
|
+
x = a - band(a, 0x0fffffff) + band(op, 0x03ffffff)*4
|
336
351
|
ctx.rel = x
|
337
|
-
x = "0x"
|
352
|
+
x = format("0x%08x", x)
|
338
353
|
elseif p == "V" then
|
339
354
|
x = band(rshift(op, 8), 7)
|
340
355
|
if x == 0 then x = nil end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
----------------------------------------------------------------------------
|
2
|
+
-- LuaJIT MIPS64 disassembler wrapper module.
|
3
|
+
--
|
4
|
+
-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.
|
5
|
+
-- Released under the MIT license. See Copyright Notice in luajit.h
|
6
|
+
----------------------------------------------------------------------------
|
7
|
+
-- This module just exports the big-endian functions from the
|
8
|
+
-- MIPS disassembler module. All the interesting stuff is there.
|
9
|
+
------------------------------------------------------------------------------
|
10
|
+
|
11
|
+
local dis_mips = require((string.match(..., ".*%.") or "").."dis_mips")
|
12
|
+
return {
|
13
|
+
create = dis_mips.create,
|
14
|
+
disass = dis_mips.disass,
|
15
|
+
regname = dis_mips.regname
|
16
|
+
}
|
17
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
----------------------------------------------------------------------------
|
2
|
+
-- LuaJIT MIPS64EL disassembler wrapper module.
|
3
|
+
--
|
4
|
+
-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.
|
5
|
+
-- Released under the MIT license. See Copyright Notice in luajit.h
|
6
|
+
----------------------------------------------------------------------------
|
7
|
+
-- This module just exports the little-endian functions from the
|
8
|
+
-- MIPS disassembler module. All the interesting stuff is there.
|
9
|
+
------------------------------------------------------------------------------
|
10
|
+
|
11
|
+
local dis_mips = require((string.match(..., ".*%.") or "").."dis_mips")
|
12
|
+
return {
|
13
|
+
create = dis_mips.create_el,
|
14
|
+
disass = dis_mips.disass_el,
|
15
|
+
regname = dis_mips.regname
|
16
|
+
}
|
17
|
+
|
@@ -1,7 +1,7 @@
|
|
1
1
|
----------------------------------------------------------------------------
|
2
2
|
-- LuaJIT MIPSEL disassembler wrapper module.
|
3
3
|
--
|
4
|
-
-- Copyright (C) 2005-
|
4
|
+
-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.
|
5
5
|
-- Released under the MIT license. See Copyright Notice in luajit.h
|
6
6
|
----------------------------------------------------------------------------
|
7
7
|
-- This module just exports the little-endian functions from the
|
@@ -1,7 +1,7 @@
|
|
1
1
|
----------------------------------------------------------------------------
|
2
2
|
-- LuaJIT PPC disassembler module.
|
3
3
|
--
|
4
|
-
-- Copyright (C) 2005-
|
4
|
+
-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.
|
5
5
|
-- Released under the MIT/X license. See Copyright Notice in luajit.h
|
6
6
|
----------------------------------------------------------------------------
|
7
7
|
-- This is a helper module used by the LuaJIT machine code dumper module.
|
@@ -13,7 +13,7 @@
|
|
13
13
|
------------------------------------------------------------------------------
|
14
14
|
|
15
15
|
local type = type
|
16
|
-
local
|
16
|
+
local byte, format = string.byte, string.format
|
17
17
|
local match, gmatch, gsub = string.match, string.gmatch, string.gsub
|
18
18
|
local concat = table.concat
|
19
19
|
local bit = require("bit")
|
@@ -1,7 +1,7 @@
|
|
1
1
|
----------------------------------------------------------------------------
|
2
2
|
-- LuaJIT x64 disassembler wrapper module.
|
3
3
|
--
|
4
|
-
-- Copyright (C) 2005-
|
4
|
+
-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.
|
5
5
|
-- Released under the MIT license. See Copyright Notice in luajit.h
|
6
6
|
----------------------------------------------------------------------------
|
7
7
|
-- This module just exports the 64 bit functions from the combined
|
@@ -1,7 +1,7 @@
|
|
1
1
|
----------------------------------------------------------------------------
|
2
2
|
-- LuaJIT x86/x64 disassembler module.
|
3
3
|
--
|
4
|
-
-- Copyright (C) 2005-
|
4
|
+
-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.
|
5
5
|
-- Released under the MIT license. See Copyright Notice in luajit.h
|
6
6
|
----------------------------------------------------------------------------
|
7
7
|
-- This is a helper module used by the LuaJIT machine code dumper module.
|
@@ -244,6 +244,7 @@ nil,"||psrlvVSXrvm","||psravdXrvm","||psllvVSXrvm",
|
|
244
244
|
[0xde] = "||aesdecXrvm", [0xdf] = "||aesdeclastXrvm",
|
245
245
|
--Fx
|
246
246
|
[0xf0] = "|||crc32TrBmt",[0xf1] = "|||crc32TrVmt",
|
247
|
+
[0xf7] = "| sarxVrmv| shlxVrmv| shrxVrmv",
|
247
248
|
},
|
248
249
|
|
249
250
|
["3a"] = { -- [66] 0f 3a xx
|
@@ -273,6 +274,8 @@ nil,nil,nil,nil,
|
|
273
274
|
[0x60] = "||pcmpestrmXrmu",[0x61] = "||pcmpestriXrmu",
|
274
275
|
[0x62] = "||pcmpistrmXrmu",[0x63] = "||pcmpistriXrmu",
|
275
276
|
[0xdf] = "||aeskeygenassistXrmu",
|
277
|
+
--Fx
|
278
|
+
[0xf0] = "||| rorxVrmu",
|
276
279
|
},
|
277
280
|
}
|
278
281
|
|
@@ -414,8 +417,8 @@ local function putop(ctx, text, operands)
|
|
414
417
|
(ctx.rexx and "x" or "")..(ctx.rexb and "b" or "")..
|
415
418
|
(ctx.vexl and "l" or "")
|
416
419
|
if ctx.vexv and ctx.vexv ~= 0 then t = t.."v"..ctx.vexv end
|
417
|
-
if t ~= "" then text = ctx.rex.."."..t.." "..text
|
418
|
-
elseif ctx.rex == "vex" then text = "v"..text end
|
420
|
+
if t ~= "" then text = ctx.rex.."."..t.." "..gsub(text, "^ ", "")
|
421
|
+
elseif ctx.rex == "vex" then text = gsub("v"..text, "^v ", "") end
|
419
422
|
ctx.rexw = false; ctx.rexr = false; ctx.rexx = false; ctx.rexb = false
|
420
423
|
ctx.rex = false; ctx.vexl = false; ctx.vexv = false
|
421
424
|
end
|
@@ -815,7 +818,7 @@ map_act = {
|
|
815
818
|
m = b%32; b = (b-m)/32
|
816
819
|
local nb = b%2; b = (b-nb)/2
|
817
820
|
if nb == 0 then ctx.rexb = true end
|
818
|
-
local nx = b%2
|
821
|
+
local nx = b%2
|
819
822
|
if nx == 0 then ctx.rexx = true end
|
820
823
|
b = byte(ctx.code, pos, pos)
|
821
824
|
if not b then return incomplete(ctx) end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
----------------------------------------------------------------------------
|
2
2
|
-- LuaJIT compiler dump module.
|
3
3
|
--
|
4
|
-
-- Copyright (C) 2005-
|
4
|
+
-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.
|
5
5
|
-- Released under the MIT license. See Copyright Notice in luajit.h
|
6
6
|
----------------------------------------------------------------------------
|
7
7
|
--
|
@@ -63,9 +63,9 @@ local traceinfo, traceir, tracek = jutil.traceinfo, jutil.traceir, jutil.tracek
|
|
63
63
|
local tracemc, tracesnap = jutil.tracemc, jutil.tracesnap
|
64
64
|
local traceexitstub, ircalladdr = jutil.traceexitstub, jutil.ircalladdr
|
65
65
|
local bit = require("bit")
|
66
|
-
local band,
|
66
|
+
local band, shr, tohex = bit.band, bit.rshift, bit.tohex
|
67
67
|
local sub, gsub, format = string.sub, string.gsub, string.format
|
68
|
-
local byte,
|
68
|
+
local byte, rep = string.byte, string.rep
|
69
69
|
local type, tostring = type, tostring
|
70
70
|
local stdout, stderr = io.stdout, io.stderr
|
71
71
|
|
@@ -85,7 +85,7 @@ local nexitsym = 0
|
|
85
85
|
local function fillsymtab_tr(tr, nexit)
|
86
86
|
local t = {}
|
87
87
|
symtabmt.__index = t
|
88
|
-
if jit.arch == "mips"
|
88
|
+
if jit.arch:sub(1, 4) == "mips" then
|
89
89
|
t[traceexitstub(tr, 0)] = "exit"
|
90
90
|
return
|
91
91
|
end
|
@@ -213,7 +213,7 @@ local colortype_ansi = {
|
|
213
213
|
"\027[35m%s\027[m",
|
214
214
|
}
|
215
215
|
|
216
|
-
local function colorize_text(s
|
216
|
+
local function colorize_text(s)
|
217
217
|
return s
|
218
218
|
end
|
219
219
|
|
@@ -310,15 +310,17 @@ local function fmtfunc(func, pc)
|
|
310
310
|
end
|
311
311
|
end
|
312
312
|
|
313
|
-
local function formatk(tr, idx)
|
313
|
+
local function formatk(tr, idx, sn)
|
314
314
|
local k, t, slot = tracek(tr, idx)
|
315
315
|
local tn = type(k)
|
316
316
|
local s
|
317
317
|
if tn == "number" then
|
318
|
-
if
|
318
|
+
if band(sn or 0, 0x30000) ~= 0 then
|
319
|
+
s = band(sn, 0x20000) ~= 0 and "contpc" or "ftsz"
|
320
|
+
elseif k == 2^52+2^51 then
|
319
321
|
s = "bias"
|
320
322
|
else
|
321
|
-
s = format("%+.14g", k)
|
323
|
+
s = format(0 < k and k < 0x1p-1026 and "%+a" or "%+.14g", k)
|
322
324
|
end
|
323
325
|
elseif tn == "string" then
|
324
326
|
s = format(#k > 20 and '"%.20s"~' or '"%s"', gsub(k, "%c", ctlsub))
|
@@ -331,11 +333,13 @@ local function formatk(tr, idx)
|
|
331
333
|
s = format("userdata:%p", k)
|
332
334
|
else
|
333
335
|
s = format("[%p]", k)
|
334
|
-
if s == "[
|
336
|
+
if s == "[NULL]" then s = "NULL" end
|
335
337
|
end
|
336
338
|
elseif t == 21 then -- int64_t
|
337
339
|
s = sub(tostring(k), 1, -3)
|
338
340
|
if sub(s, 1, 1) ~= "-" then s = "+"..s end
|
341
|
+
elseif sn == 0x1057fff then -- SNAP(1, SNAP_FRAME | SNAP_NORESTORE, REF_NIL)
|
342
|
+
return "----" -- Special case for LJ_FR2 slot 1.
|
339
343
|
else
|
340
344
|
s = tostring(k) -- For primitives.
|
341
345
|
end
|
@@ -354,7 +358,7 @@ local function printsnap(tr, snap)
|
|
354
358
|
n = n + 1
|
355
359
|
local ref = band(sn, 0xffff) - 0x8000 -- REF_BIAS
|
356
360
|
if ref < 0 then
|
357
|
-
out:write(formatk(tr, ref))
|
361
|
+
out:write(formatk(tr, ref, sn))
|
358
362
|
elseif band(sn, 0x80000) ~= 0 then -- SNAP_SOFTFPNUM
|
359
363
|
out:write(colorize(format("%04d/%04d", ref, ref+1), 14))
|
360
364
|
else
|
@@ -552,7 +556,7 @@ local function dump_trace(what, tr, func, pc, otr, oex)
|
|
552
556
|
if what == "start" then
|
553
557
|
if dumpmode.H then out:write('<pre class="ljdump">\n') end
|
554
558
|
out:write("---- TRACE ", tr, " ", what)
|
555
|
-
if otr then out:write(" ", otr, "/", oex) end
|
559
|
+
if otr then out:write(" ", otr, "/", oex == -1 and "stitch" or oex) end
|
556
560
|
out:write(" ", fmtfunc(func, pc), "\n")
|
557
561
|
elseif what == "stop" or what == "abort" then
|
558
562
|
out:write("---- TRACE ", tr, " ", what)
|
@@ -651,7 +655,8 @@ end
|
|
651
655
|
local function dumpon(opt, outfile)
|
652
656
|
if active then dumpoff() end
|
653
657
|
|
654
|
-
local
|
658
|
+
local term = os.getenv("TERM")
|
659
|
+
local colormode = (term and term:match("color") or os.getenv("COLORTERM")) and "A" or "T"
|
655
660
|
if opt then
|
656
661
|
opt = gsub(opt, "[TAH]", function(mode) colormode = mode; return ""; end)
|
657
662
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
----------------------------------------------------------------------------
|
2
2
|
-- LuaJIT profiler.
|
3
3
|
--
|
4
|
-
-- Copyright (C) 2005-
|
4
|
+
-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.
|
5
5
|
-- Released under the MIT license. See Copyright Notice in luajit.h
|
6
6
|
----------------------------------------------------------------------------
|
7
7
|
--
|
@@ -120,7 +120,7 @@ end
|
|
120
120
|
-- Show top N list.
|
121
121
|
local function prof_top(count1, count2, samples, indent)
|
122
122
|
local t, n = {}, 0
|
123
|
-
for k
|
123
|
+
for k in pairs(count1) do
|
124
124
|
n = n + 1
|
125
125
|
t[n] = k
|
126
126
|
end
|
@@ -156,6 +156,7 @@ local function prof_annotate(count1, samples)
|
|
156
156
|
ms = math.max(ms, v)
|
157
157
|
if pct >= prof_min then
|
158
158
|
local file, line = k:match("^(.*):(%d+)$")
|
159
|
+
if not file then file = k; line = 0 end
|
159
160
|
local fl = files[file]
|
160
161
|
if not fl then fl = {}; files[file] = fl; files[#files+1] = file end
|
161
162
|
line = tonumber(line)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
----------------------------------------------------------------------------
|
2
2
|
-- Verbose mode of the LuaJIT compiler.
|
3
3
|
--
|
4
|
-
-- Copyright (C) 2005-
|
4
|
+
-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.
|
5
5
|
-- Released under the MIT license. See Copyright Notice in luajit.h
|
6
6
|
----------------------------------------------------------------------------
|
7
7
|
--
|
@@ -99,7 +99,7 @@ end
|
|
99
99
|
local function dump_trace(what, tr, func, pc, otr, oex)
|
100
100
|
if what == "start" then
|
101
101
|
startloc = fmtfunc(func, pc)
|
102
|
-
startex = otr and "("..otr.."/"..oex..") " or ""
|
102
|
+
startex = otr and "("..otr.."/"..(oex == -1 and "stitch" or oex)..") " or ""
|
103
103
|
else
|
104
104
|
if what == "abort" then
|
105
105
|
local loc = fmtfunc(func, pc)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
----------------------------------------------------------------------------
|
2
2
|
-- LuaJIT profiler zones.
|
3
3
|
--
|
4
|
-
-- Copyright (C) 2005-
|
4
|
+
-- Copyright (C) 2005-2017 Mike Pall. All rights reserved.
|
5
5
|
-- Released under the MIT license. See Copyright Notice in luajit.h
|
6
6
|
----------------------------------------------------------------------------
|
7
7
|
--
|
@@ -15,9 +15,6 @@
|
|
15
15
|
#include "lua.h"
|
16
16
|
|
17
17
|
|
18
|
-
#define luaL_getn(L,i) ((int)lua_objlen(L, i))
|
19
|
-
#define luaL_setn(L,i,j) ((void)0) /* no op! */
|
20
|
-
|
21
18
|
/* extra error code for `luaL_load' */
|
22
19
|
#define LUA_ERRFILE (LUA_ERRERR+1)
|
23
20
|
|
@@ -58,6 +55,10 @@ LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...);
|
|
58
55
|
LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def,
|
59
56
|
const char *const lst[]);
|
60
57
|
|
58
|
+
/* pre-defined references */
|
59
|
+
#define LUA_NOREF (-2)
|
60
|
+
#define LUA_REFNIL (-1)
|
61
|
+
|
61
62
|
LUALIB_API int (luaL_ref) (lua_State *L, int t);
|
62
63
|
LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);
|
63
64
|
|
@@ -84,6 +85,11 @@ LUALIB_API int (luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz,
|
|
84
85
|
const char *name, const char *mode);
|
85
86
|
LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1, const char *msg,
|
86
87
|
int level);
|
88
|
+
LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup);
|
89
|
+
LUALIB_API void (luaL_pushmodule) (lua_State *L, const char *modname,
|
90
|
+
int sizehint);
|
91
|
+
LUALIB_API void *(luaL_testudata) (lua_State *L, int ud, const char *tname);
|
92
|
+
LUALIB_API void (luaL_setmetatable) (lua_State *L, const char *tname);
|
87
93
|
|
88
94
|
|
89
95
|
/*
|
@@ -113,6 +119,11 @@ LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1, const char *msg,
|
|
113
119
|
|
114
120
|
#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))
|
115
121
|
|
122
|
+
/* From Lua 5.2. */
|
123
|
+
#define luaL_newlibtable(L, l) \
|
124
|
+
lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1)
|
125
|
+
#define luaL_newlib(L, l) (luaL_newlibtable(L, l), luaL_setfuncs(L, l, 0))
|
126
|
+
|
116
127
|
/*
|
117
128
|
** {======================================================
|
118
129
|
** Generic Buffer manipulation
|
@@ -147,21 +158,4 @@ LUALIB_API void (luaL_pushresult) (luaL_Buffer *B);
|
|
147
158
|
|
148
159
|
/* }====================================================== */
|
149
160
|
|
150
|
-
|
151
|
-
/* compatibility with ref system */
|
152
|
-
|
153
|
-
/* pre-defined references */
|
154
|
-
#define LUA_NOREF (-2)
|
155
|
-
#define LUA_REFNIL (-1)
|
156
|
-
|
157
|
-
#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \
|
158
|
-
(lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0))
|
159
|
-
|
160
|
-
#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref))
|
161
|
-
|
162
|
-
#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref))
|
163
|
-
|
164
|
-
|
165
|
-
#define luaL_reg luaL_Reg
|
166
|
-
|
167
161
|
#endif
|