├── .editorconfig ├── .gitignore ├── InvokeCompilerPass ├── .clang-format ├── .editorconfig ├── .gitignore ├── .vsconfig ├── Directory.Build.props ├── ICPTest.cpp ├── ICPTest.vs17.vcxproj ├── ICPTest.vs17.vcxproj.filters ├── InvokeCompilerPass.cpp ├── InvokeCompilerPass.h ├── InvokeCompilerPass.vs17.sln ├── InvokeCompilerPass.vs17.vcxproj ├── InvokeCompilerPass.vs17.vcxproj.filters ├── LuaBridge.h ├── README.md ├── check-ntnative.sh ├── clang-reformat.sh ├── dllversion.h ├── dllversion.rc ├── fmt │ ├── .clang-format │ ├── LICENSE.rst │ ├── include │ │ └── fmt │ │ │ ├── args.h │ │ │ ├── chrono.h │ │ │ ├── color.h │ │ │ ├── compile.h │ │ │ ├── core.h │ │ │ ├── format-inl.h │ │ │ ├── format.h │ │ │ ├── os.h │ │ │ ├── ostream.h │ │ │ ├── printf.h │ │ │ ├── ranges.h │ │ │ ├── std.h │ │ │ └── xchar.h │ └── src │ │ ├── fmt.cc │ │ ├── format.cc │ │ └── os.cc ├── lua │ ├── .clang-format │ ├── .gitignore │ ├── README.md │ ├── all │ ├── lapi.c │ ├── lapi.h │ ├── lauxlib.c │ ├── lauxlib.h │ ├── lbaselib.c │ ├── lcode.c │ ├── lcode.h │ ├── lcorolib.c │ ├── lctype.c │ ├── lctype.h │ ├── ldblib.c │ ├── ldebug.c │ ├── ldebug.h │ ├── ldo.c │ ├── ldo.h │ ├── ldump.c │ ├── lfunc.c │ ├── lfunc.h │ ├── lgc.c │ ├── lgc.h │ ├── linit.c │ ├── liolib.c │ ├── ljumptab.h │ ├── llex.c │ ├── llex.h │ ├── llimits.h │ ├── lmathlib.c │ ├── lmem.c │ ├── lmem.h │ ├── loadlib.c │ ├── lobject.c │ ├── lobject.h │ ├── lopcodes.c │ ├── lopcodes.h │ ├── lopnames.h │ ├── loslib.c │ ├── lparser.c │ ├── lparser.h │ ├── lprefix.h │ ├── lstate.c │ ├── lstate.h │ ├── lstring.c │ ├── lstring.h │ ├── lstrlib.c │ ├── ltable.c │ ├── ltable.h │ ├── ltablib.c │ ├── ltests.c │ ├── ltests.h │ ├── ltm.c │ ├── ltm.h │ ├── lua.c │ ├── lua.h │ ├── luaconf.h │ ├── lualib.h │ ├── lundump.c │ ├── lundump.h │ ├── lutf8lib.c │ ├── lvm.c │ ├── lvm.h │ ├── lzio.c │ ├── lzio.h │ ├── makefile │ ├── manual │ │ ├── 2html │ │ └── manual.of │ ├── onelua.c │ └── testes │ │ ├── all.lua │ │ ├── api.lua │ │ ├── attrib.lua │ │ ├── big.lua │ │ ├── bitwise.lua │ │ ├── bwcoercion.lua │ │ ├── calls.lua │ │ ├── closure.lua │ │ ├── code.lua │ │ ├── constructs.lua │ │ ├── coroutine.lua │ │ ├── cstack.lua │ │ ├── db.lua │ │ ├── errors.lua │ │ ├── events.lua │ │ ├── files.lua │ │ ├── gc.lua │ │ ├── gengc.lua │ │ ├── goto.lua │ │ ├── heavy.lua │ │ ├── libs │ │ ├── P1 │ │ │ └── dummy │ │ ├── lib1.c │ │ ├── lib11.c │ │ ├── lib2.c │ │ ├── lib21.c │ │ ├── lib22.c │ │ └── makefile │ │ ├── literals.lua │ │ ├── locals.lua │ │ ├── main.lua │ │ ├── math.lua │ │ ├── nextvar.lua │ │ ├── packtests │ │ ├── pm.lua │ │ ├── sort.lua │ │ ├── strings.lua │ │ ├── tpack.lua │ │ ├── tracegc.lua │ │ ├── utf8.lua │ │ ├── vararg.lua │ │ └── verybig.lua ├── luaall.c ├── ntnative.h ├── ntpebldr.h ├── premake4.lua ├── project.early.props ├── project.late.props └── utfcpp │ ├── .clang-format │ └── source │ ├── utf8.h │ └── utf8 │ ├── checked.h │ ├── core.h │ ├── cpp11.h │ ├── cpp17.h │ └── unchecked.h ├── LINK.exe.md ├── NOTES.md ├── README.md ├── UNLICENSE ├── help-output ├── 14.29.30133-16.11.30 │ └── Hostx64 │ │ ├── arm │ │ ├── armasm.exe-14.29.30152.0.txt │ │ ├── cl.exe-19.29.30152.0.txt │ │ ├── lib.exe-14.29.30152.0.txt │ │ ├── link.exe-14.29.30152.0.txt │ │ └── nmake.exe-14.29.30152.0.txt │ │ ├── arm64 │ │ ├── armasm64.exe-14.29.30152.0.txt │ │ ├── cl.exe-19.29.30152.0.txt │ │ ├── lib.exe-14.29.30152.0.txt │ │ ├── link.exe-14.29.30152.0.txt │ │ ├── ml64.exe-14.29.30152.0.txt │ │ └── nmake.exe-14.29.30152.0.txt │ │ ├── x64 │ │ ├── cl.exe-19.29.30152.0.txt │ │ ├── lib.exe-14.29.30152.0.txt │ │ ├── link.exe-14.29.30152.0.txt │ │ ├── ml64.exe-14.29.30152.0.txt │ │ └── nmake.exe-14.29.30152.0.txt │ │ └── x86 │ │ ├── cl.exe-19.29.30152.0.txt │ │ ├── lib.exe-14.29.30152.0.txt │ │ ├── link.exe-14.29.30152.0.txt │ │ ├── ml.exe-14.29.30152.0.txt │ │ └── nmake.exe-14.29.30152.0.txt ├── 14.29.30133 │ └── Hostx64 │ │ ├── arm │ │ ├── armasm.exe-14.29.30151.0.txt │ │ ├── cl.exe-19.29.30151.0.txt │ │ ├── lib.exe-14.29.30151.0.txt │ │ ├── link.exe-14.29.30151.0.txt │ │ └── nmake.exe-14.29.30151.0.txt │ │ ├── arm64 │ │ ├── armasm64.exe-14.29.30151.0.txt │ │ ├── cl.exe-19.29.30151.0.txt │ │ ├── lib.exe-14.29.30151.0.txt │ │ ├── link.exe-14.29.30151.0.txt │ │ ├── ml64.exe-14.29.30151.0.txt │ │ └── nmake.exe-14.29.30151.0.txt │ │ ├── x64 │ │ ├── cl.exe-19.29.30151.0.txt │ │ ├── lib.exe-14.29.30151.0.txt │ │ ├── link.exe-14.29.30151.0.txt │ │ ├── ml64.exe-14.29.30151.0.txt │ │ └── nmake.exe-14.29.30151.0.txt │ │ └── x86 │ │ ├── cl.exe-19.29.30151.0.txt │ │ ├── lib.exe-14.29.30151.0.txt │ │ ├── link.exe-14.29.30151.0.txt │ │ ├── ml.exe-14.29.30151.0.txt │ │ └── nmake.exe-14.29.30151.0.txt ├── 14.34.31933 │ └── Hostx64 │ │ ├── x64 │ │ ├── cl.exe-19.34.31937.0.txt │ │ ├── link.exe-14.34.31937.0.txt │ │ ├── ml64.exe-14.34.31937.0.txt │ │ └── nmake.exe-14.34.31937.0.txt │ │ └── x86 │ │ ├── cl.exe-19.34.31937.0.txt │ │ ├── link.exe-14.34.31937.0.txt │ │ ├── ml.exe-14.34.31937.0.txt │ │ └── nmake.exe-14.34.31937.0.txt ├── 14.36.32532 │ └── Hostx64 │ │ ├── arm │ │ ├── armasm.exe-14.36.32534.0.txt │ │ ├── cl.exe-19.36.32534.0.txt │ │ ├── lib.exe-14.36.32534.0.txt │ │ ├── link.exe-14.36.32534.0.txt │ │ └── nmake.exe-14.36.32534.0.txt │ │ ├── arm64 │ │ ├── armasm64.exe-14.36.32534.0.txt │ │ ├── cl.exe-19.36.32534.0.txt │ │ ├── lib.exe-14.36.32534.0.txt │ │ ├── link.exe-14.36.32534.0.txt │ │ ├── ml64.exe-14.36.32534.0.txt │ │ └── nmake.exe-14.36.32534.0.txt │ │ ├── x64 │ │ ├── cl.exe-19.36.32534.0.txt │ │ ├── lib.exe-14.36.32534.0.txt │ │ ├── link.exe-14.36.32534.0.txt │ │ ├── ml64.exe-14.36.32534.0.txt │ │ └── nmake.exe-14.36.32534.0.txt │ │ └── x86 │ │ ├── cl.exe-19.36.32534.0.txt │ │ ├── lib.exe-14.36.32534.0.txt │ │ ├── link.exe-14.36.32534.0.txt │ │ ├── ml.exe-14.36.32534.0.txt │ │ └── nmake.exe-14.36.32534.0.txt ├── 14.37.32822-17.7.4 │ └── Hostx64 │ │ ├── arm │ │ ├── armasm.exe-14.37.32824.0.txt │ │ ├── cl.exe-19.37.32824.0.txt │ │ ├── lib.exe-14.37.32824.0.txt │ │ ├── link.exe-14.37.32824.0.txt │ │ └── nmake.exe-14.37.32824.0.txt │ │ ├── arm64 │ │ ├── armasm64.exe-14.37.32824.0.txt │ │ ├── cl.exe-19.37.32824.0.txt │ │ ├── lib.exe-14.37.32824.0.txt │ │ ├── link.exe-14.37.32824.0.txt │ │ ├── ml64.exe-14.37.32824.0.txt │ │ └── nmake.exe-14.37.32824.0.txt │ │ ├── x64 │ │ ├── cl.exe-19.37.32824.0.txt │ │ ├── lib.exe-14.37.32824.0.txt │ │ ├── link.exe-14.37.32824.0.txt │ │ ├── ml64.exe-14.37.32824.0.txt │ │ └── nmake.exe-14.37.32824.0.txt │ │ └── x86 │ │ ├── cl.exe-19.37.32824.0.txt │ │ ├── lib.exe-14.37.32824.0.txt │ │ ├── link.exe-14.37.32824.0.txt │ │ ├── ml.exe-14.37.32824.0.txt │ │ └── nmake.exe-14.37.32824.0.txt ├── 14.37.32822-17.7.5 │ └── Hostx64 │ │ ├── arm │ │ ├── armasm.exe-14.37.32825.0.txt │ │ ├── cl.exe-19.37.32825.0.txt │ │ ├── lib.exe-14.37.32825.0.txt │ │ ├── link.exe-14.37.32825.0.txt │ │ └── nmake.exe-14.37.32825.0.txt │ │ ├── arm64 │ │ ├── armasm64.exe-14.37.32825.0.txt │ │ ├── cl.exe-19.37.32825.0.txt │ │ ├── lib.exe-14.37.32825.0.txt │ │ ├── link.exe-14.37.32825.0.txt │ │ ├── ml64.exe-14.37.32825.0.txt │ │ └── nmake.exe-14.37.32825.0.txt │ │ ├── x64 │ │ ├── cl.exe-19.37.32825.0.txt │ │ ├── lib.exe-14.37.32825.0.txt │ │ ├── link.exe-14.37.32825.0.txt │ │ ├── ml64.exe-14.37.32825.0.txt │ │ └── nmake.exe-14.37.32825.0.txt │ │ └── x86 │ │ ├── cl.exe-19.37.32825.0.txt │ │ ├── lib.exe-14.37.32825.0.txt │ │ ├── link.exe-14.37.32825.0.txt │ │ ├── ml.exe-14.37.32825.0.txt │ │ └── nmake.exe-14.37.32825.0.txt ├── 8.0.50727.762 │ └── Hostx64 │ │ ├── cl.exe-14.00.50727.762.txt │ │ ├── lib.exe-8.00.50727.762.txt │ │ ├── link.exe-8.00.50727.762.txt │ │ ├── ml64.exe-8.00.50727.762.txt │ │ └── nmake.exe-8.00.50727.762.txt └── README.md ├── msvc.yaml └── tools ├── .flake8 ├── .python-version ├── GNUmakefile ├── IDAPython ├── black.cmd └── toolchain_prepare.py ├── LINK.exe.md.j2 ├── Pipfile ├── Pipfile.lock ├── activate ├── c1.dll.yml ├── c1xx.dll.yml ├── c2.dll.yml ├── clexe_documented.txt ├── extract-strings.cmd ├── extract-strings.py ├── helpers ├── .gitignore ├── GNUmakefile ├── README.md ├── get-help-output.ps1 ├── normalize-buildlogs.py ├── pyproject.toml ├── symdl.cmd └── symdl_global.cmd ├── install-python-prerequisites.cmd ├── install-python-prerequisites.sh ├── linkexe_documented.txt ├── msvc-undoc.ini ├── pyproject.toml ├── requirements.txt ├── rsrc_strings.json ├── update-docs ├── update-docs.py ├── update-yaml └── update-yaml.py /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | # Unix-style newlines with a newline ending every file 4 | [*] 5 | charset = utf-8 6 | end_of_line = lf 7 | insert_final_newline = true 8 | 9 | [*.py] 10 | indent_style = space 11 | indent_size = 4 12 | trim_trailing_whitespace = true 13 | 14 | [*.cmd] 15 | end_of_line = crlf 16 | indent_style = space 17 | indent_size = 4 18 | trim_trailing_whitespace = true 19 | 20 | [*.{rst,md}] 21 | indent_style = space 22 | indent_size = 4 23 | trim_trailing_whitespace = false 24 | 25 | [GNUmakefile] 26 | indent_style = tab 27 | 28 | [{UN,}LICENSE] 29 | insert_final_newline = false 30 | 31 | [.{clang-format,editorconfig,hgignore,gitignore}] 32 | charset = utf-8 33 | end_of_line = lf 34 | trim_trailing_whitespace = true 35 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .venv/ 2 | tools/mirrors/ 3 | *.txt 4 | *.backup.* 5 | *.dryrun.* 6 | -------------------------------------------------------------------------------- /InvokeCompilerPass/.clang-format: -------------------------------------------------------------------------------- 1 | IndentWidth: 4 2 | TabWidth: 4 3 | UseTab: Never 4 | Language: Cpp 5 | BasedOnStyle: Microsoft 6 | Standard: c++17 7 | AlignAfterOpenBracket: Align 8 | AlignConsecutiveMacros: AcrossEmptyLinesAndComments 9 | AlignEscapedNewlinesLeft: true 10 | AllowShortFunctionsOnASingleLine: false 11 | BinPackArguments: false 12 | BinPackParameters: false 13 | ColumnLimit: 160 14 | IndentCaseLabels: false 15 | IndentCaseBlocks: true 16 | PointerAlignment: Left 17 | SortIncludes: false 18 | SpaceAfterCStyleCast: false 19 | SpaceBeforeAssignmentOperators: true 20 | SpaceBeforeParens: ControlStatements 21 | SpaceInEmptyParentheses: false 22 | SpacesInCStyleCastParentheses: false 23 | SpacesInParentheses: false 24 | FixNamespaceComments: true 25 | NamespaceIndentation: All 26 | BreakBeforeBraces: Allman 27 | IndentPPDirectives: AfterHash 28 | # AlignArrayOfStructures: Right // clang-format-13 29 | BreakConstructorInitializers: BeforeComma 30 | ConstructorInitializerAllOnOneLineOrOnePerLine: false 31 | IncludeBlocks: Preserve 32 | IndentExternBlock: Indent 33 | AttributeMacros: ['_Success_', '_Field_range_', '_Field_z_', '_In_', '_In_z_', '_In_reads_bytes_', '_In_opt_', '_Inout_', '_Inout_', '_Inout_opt_', '_Out_', '_Out_writes_bytes_', '_Out_opt_', '_Out_writes_bytes_opt_', '_Reserved_', '_Must_inspect_result_', '_Ret_maybenull_', '_Ret_writes_bytes_maybenull_', '_Post_writable_byte_size_', '_Post_invalid_', '_When_', '_Out_range_', '_Frees_ptr_opt_', '_Frees_ptr_', '_Inout_updates_opt_', '_Inout_updates_'] 34 | BreakAfterAttributes: Leave 35 | -------------------------------------------------------------------------------- /InvokeCompilerPass/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | # Unix-style newlines with a newline ending every file 4 | [*] 5 | end_of_line = lf 6 | insert_final_newline = true 7 | 8 | [*.{c,cpp,h,hpp,rc}] 9 | charset = utf-8 10 | end_of_line = lf 11 | indent_style = space 12 | indent_size = 4 13 | trim_trailing_whitespace = true 14 | 15 | [*.cmd] 16 | end_of_line = crlf 17 | indent_style = space 18 | indent_size = 4 19 | trim_trailing_whitespace = true 20 | 21 | [*.lua] 22 | end_of_line = lf 23 | indent_style = space 24 | indent_size = 4 25 | trim_trailing_whitespace = true 26 | 27 | [*.{rst,md}] 28 | charset = utf-8 29 | end_of_line = lf 30 | indent_style = space 31 | indent_size = 4 32 | trim_trailing_whitespace = false 33 | 34 | [*.xml] 35 | end_of_line = lf 36 | indent_style = space 37 | 38 | [*.{props,vcxproj,vcxproj.filters}] 39 | charset = utf-8 40 | end_of_line = crlf 41 | indent_style = space 42 | indent_size = 4 43 | 44 | [.{clang-format,editorconfig,hgignore,gitignore}] 45 | charset = utf-8 46 | end_of_line = lf 47 | trim_trailing_whitespace = true 48 | -------------------------------------------------------------------------------- /InvokeCompilerPass/.gitignore: -------------------------------------------------------------------------------- 1 | .vs/ 2 | bin/ 3 | obj/ 4 | **.user 5 | **.bak 6 | BuildCommandLines*.log 7 | sccache/ 8 | utfcpp/ 9 | -------------------------------------------------------------------------------- /InvokeCompilerPass/.vsconfig: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0", 3 | "components": [ 4 | "Microsoft.Component.MSBuild", 5 | "Microsoft.VisualStudio.Component.CoreEditor", 6 | "Microsoft.VisualStudio.Component.Graphics.Tools", 7 | "Microsoft.VisualStudio.Component.TextTemplating", 8 | "Microsoft.VisualStudio.Component.VC.CoreIde", 9 | "Microsoft.VisualStudio.Component.VC.DiagnosticTools", 10 | "Microsoft.VisualStudio.Component.VC.Redist.14.Latest", 11 | "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", 12 | "Microsoft.VisualStudio.Component.Windows10SDK.*", 13 | "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core", 14 | "Microsoft.VisualStudio.Workload.CoreEditor", 15 | "Microsoft.VisualStudio.Workload.NativeDesktop" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /InvokeCompilerPass/ICPTest.cpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// 2023 Oliver Schneider (assarbad.net) under the terms of the UNLICENSE 4 | /// 5 | /// SPDX-License-Identifier: Unlicense 6 | /// 7 | /////////////////////////////////////////////////////////////////////////////// 8 | 9 | #include 10 | #include 11 | #include 12 | #include "InvokeCompilerPass.h" 13 | 14 | int wmain(int argc, wchar_t** argv) 15 | { 16 | wprintf(L"DLL: %s\n", GetThisDllName()); 17 | wprintf(L"Process: %s\n", GetThisProcessImageName()); 18 | HMODULE hMod = nullptr; 19 | if (InvokeCompilerPassW(argc, argv, -1, &hMod)) 20 | { 21 | return EXIT_SUCCESS; 22 | } 23 | return EXIT_FAILURE; 24 | } 25 | -------------------------------------------------------------------------------- /InvokeCompilerPass/ICPTest.vs17.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {0DC60841-C4FC-3634-8613-BB371B955781} 6 | 7 | 8 | {52A7F7FD-A929-AA94-6033-155CF828137D} 9 | 10 | 11 | 12 | 13 | Header Files 14 | 15 | 16 | 17 | 18 | Source Files 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /InvokeCompilerPass/InvokeCompilerPass.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// 2023 Oliver Schneider (assarbad.net) under the terms of the UNLICENSE 4 | /// 5 | /// Based on http://blog.airesoft.co.uk/2013/01/plug-in-to-cls-kitchen/ and 6 | /// subsequent own research. 7 | /// 8 | /// SPDX-License-Identifier: Unlicense 9 | /// 10 | /////////////////////////////////////////////////////////////////////////////// 11 | 12 | #include 13 | 14 | #ifdef _USRDLL 15 | # define DLLEXPORT __declspec(dllexport) 16 | #else 17 | # define DLLEXPORT __declspec(dllimport) 18 | #endif 19 | 20 | EXTERN_C_START 21 | 22 | DLLEXPORT BOOL WINAPI InvokeCompilerPassW(int, wchar_t**, int, HMODULE*); 23 | DLLEXPORT void WINAPI AbortCompilerPass(int); 24 | 25 | DLLEXPORT LPCWSTR WINAPI GetThisDllName(); 26 | DLLEXPORT LPCWSTR WINAPI GetThisProcessImageName(); 27 | 28 | EXTERN_C_END 29 | -------------------------------------------------------------------------------- /InvokeCompilerPass/InvokeCompilerPass.vs17.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.0.0 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InvokeCompilerPass", "InvokeCompilerPass.vs17.vcxproj", "{738FB476-8ACF-4293-A438-6FFA7A7D24AA}" 6 | EndProject 7 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ICPTest", "ICPTest.vs17.vcxproj", "{96228B54-5C76-46BD-B899-B56F15A2C9F9}" 8 | ProjectSection(ProjectDependencies) = postProject 9 | {738FB476-8ACF-4293-A438-6FFA7A7D24AA} = {738FB476-8ACF-4293-A438-6FFA7A7D24AA} 10 | EndProjectSection 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Win32 = Debug|Win32 15 | Debug|x64 = Debug|x64 16 | Release|Win32 = Release|Win32 17 | Release|x64 = Release|x64 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {738FB476-8ACF-4293-A438-6FFA7A7D24AA}.Debug|Win32.ActiveCfg = Debug|Win32 21 | {738FB476-8ACF-4293-A438-6FFA7A7D24AA}.Debug|Win32.Build.0 = Debug|Win32 22 | {738FB476-8ACF-4293-A438-6FFA7A7D24AA}.Debug|x64.ActiveCfg = Debug|x64 23 | {738FB476-8ACF-4293-A438-6FFA7A7D24AA}.Debug|x64.Build.0 = Debug|x64 24 | {738FB476-8ACF-4293-A438-6FFA7A7D24AA}.Release|Win32.ActiveCfg = Release|Win32 25 | {738FB476-8ACF-4293-A438-6FFA7A7D24AA}.Release|Win32.Build.0 = Release|Win32 26 | {738FB476-8ACF-4293-A438-6FFA7A7D24AA}.Release|x64.ActiveCfg = Release|x64 27 | {738FB476-8ACF-4293-A438-6FFA7A7D24AA}.Release|x64.Build.0 = Release|x64 28 | {96228B54-5C76-46BD-B899-B56F15A2C9F9}.Debug|Win32.ActiveCfg = Debug|Win32 29 | {96228B54-5C76-46BD-B899-B56F15A2C9F9}.Debug|Win32.Build.0 = Debug|Win32 30 | {96228B54-5C76-46BD-B899-B56F15A2C9F9}.Debug|x64.ActiveCfg = Debug|x64 31 | {96228B54-5C76-46BD-B899-B56F15A2C9F9}.Debug|x64.Build.0 = Debug|x64 32 | {96228B54-5C76-46BD-B899-B56F15A2C9F9}.Release|Win32.ActiveCfg = Release|Win32 33 | {96228B54-5C76-46BD-B899-B56F15A2C9F9}.Release|Win32.Build.0 = Release|Win32 34 | {96228B54-5C76-46BD-B899-B56F15A2C9F9}.Release|x64.ActiveCfg = Release|x64 35 | {96228B54-5C76-46BD-B899-B56F15A2C9F9}.Release|x64.Build.0 = Release|x64 36 | EndGlobalSection 37 | GlobalSection(SolutionProperties) = preSolution 38 | HideSolutionNode = FALSE 39 | EndGlobalSection 40 | EndGlobal 41 | -------------------------------------------------------------------------------- /InvokeCompilerPass/LuaBridge.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/assarbad/msvc-undoc/138af4734840d078c585cffeec4d8daa63e337f7/InvokeCompilerPass/LuaBridge.h -------------------------------------------------------------------------------- /InvokeCompilerPass/README.md: -------------------------------------------------------------------------------- 1 | # InvokeCompilerPass 2 | 3 | As per [this website](http://blog.airesoft.co.uk/2013/01/plug-in-to-cls-kitchen/), other resources on the web and my own research one can plug into the MSVC toolchain via command line switches and a supplied DLL. 4 | 5 | ## License 6 | 7 | Any third-party code (e.g. Lua and LuaVBidge3, fmtlib) obviously comes under its own respective licenses, the same goes for `ntnative.h` and `ntpebldr.h`; the remainder is under UNLICENSE or the very very liberal Boost Software license, just like the rest of the project (docs etc. as well as the items outside of this subdirectory). 8 | -------------------------------------------------------------------------------- /InvokeCompilerPass/check-ntnative.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | FNAME="ntnative.h" 3 | declare -a FCTNAMES=() 4 | while read -r fctname; do 5 | # echo "$fctname" 6 | NO_T=${fctname%_t} 7 | FCTNAMES+=("$NO_T") 8 | COUNTX=$(grep -v "^#" "$FNAME"|grep -cP "$NO_T\\W") 9 | COUNTY=$(grep -v "^#" "$FNAME"|grep -cP "$fctname\\W") 10 | if ((COUNTX == 1)) && ((COUNTY == 1)); then 11 | : # "balanced" 12 | elif ((COUNTX == 0)) && ((COUNTY == 1)); then 13 | if ! grep -P "$fctname\\W" "$FNAME"|grep -q '// winternl\.h'; then 14 | printf "Type found, but not marked as winternl.h: %s exists %d/%d times\n" "$NO_T" "$COUNTX" "$COUNTY" 15 | else 16 | : # winternl.h-declared function for which we only declare the type! 17 | fi 18 | else 19 | printf "UNICORN: %s exists %d/%d times\n" "$NO_T" "$COUNTX" "$COUNTY" 20 | fi 21 | done < <(set -x; grep -P 'typedef\s+?\w+?\s*?\(NTAPI\s*?\*\s*?(?:Rtl|Nt|Ldr)\w+?_t(?!>\))' "$FNAME"|grep -Po '(?:Rtl|Nt|Ldr)\w+?_t(?!>\))'|sort -u) 22 | 23 | for fct in "${FCTNAMES[@]}"; do 24 | case "$fct" in 25 | Nt*) 26 | printf "#define %s %s\n" "Zw${fct#Nt}" "$fct" 27 | ;; 28 | esac 29 | done 30 | 31 | test -d "ntdll-stubs" || mkdir "ntdll-stubs" 32 | ( 33 | echo -e "LIBRARY ntdll.dll\n" 34 | echo "EXPORTS" 35 | for fct in "${FCTNAMES[@]}"; do 36 | echo " $fct" 37 | done 38 | ) > "ntdll-stubs/ntdll.def" 39 | -------------------------------------------------------------------------------- /InvokeCompilerPass/clang-reformat.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # SPDX-License-Identifier: Unlicense 3 | [[ -t 1 ]] && { cG="\e[1;32m"; cR="\e[1;31m"; cB="\e[1;34m"; cW="\e[1;37m"; cY="\e[1;33m"; cG_="\e[0;32m"; cR_="\e[0;31m"; cB_="\e[0;34m"; cW_="\e[0;37m"; cY_="\e[0;33m"; cZ="\e[0m"; export cR cG cB cY cW cR_ cG_ cB_ cY_ cW_ cZ; } 4 | for tool in dirname env find readlink; do type $tool > /dev/null 2>&1 || { echo -e "${cR}ERROR:${cZ} couldn't find '$tool' which is required by this script."; exit 1; }; done 5 | pushd $(dirname $0) > /dev/null; CURRABSPATH=$(readlink -nf "$(pwd)"); popd > /dev/null; # Get the directory in which the script resides 6 | # Allow our callers to override the name (think clang-format-13 or similar stuff) 7 | CLANGFMT=${CLANGFMT:-"clang-format"} 8 | 9 | if [[ "$CLANGFMT" == "clang-format" ]] && [[ -n "$COMSPEC" ]]; then # assume Windows 10 | for tool in cygpath; do type $tool > /dev/null 2>&1 || { echo -e "${cR}ERROR:${cZ} couldn't find '$tool' which is required by this script."; exit 1; }; done 11 | PF86="$(cygpath -amF 42)" 12 | VSWHERE="$PF86/Microsoft Visual Studio/Installer/vswhere.exe" 13 | echo -e "${cG}VSWHERE${cZ}=$VSWHERE" 14 | if [[ -f "$VSWHERE" && -x "$VSWHERE" ]]; then 15 | WIN_VSINSTPATH="$(set -x; "$VSWHERE" -products \* -format value -property installationPath -latest)" 16 | VSINSTPATH="$(cygpath -u "$WIN_VSINSTPATH")" 17 | if [[ -n "$VSINSTPATH" ]]; then 18 | echo -e "${cG}VSINSTPATH${cZ}=$VSINSTPATH" 19 | LLVMPATH="$VSINSTPATH/VC/Tools/Llvm/bin" 20 | if [[ ! -d "$LLVMPATH" ]]; then 21 | echo -e "${cR}ERROR:${cZ} couldn't find '$LLVMPATH' inside of which we hoped to find '$CLANGFMT'."; exit 1 22 | fi 23 | if (export PATH="$LLVMPATH:$PATH"; "$CLANGFMT" --version 2> /dev/null); then 24 | export PATH="$LLVMPATH:$PATH" 25 | else 26 | echo -e "${cR}ERROR:${cZ} couldn't find '$CLANGFMT' inside '$LLVMPATH'."; exit 1 27 | fi 28 | fi 29 | else 30 | echo -e "${cR}ERROR:${cZ} couldn't find '$VSWHERE' which is required by this script, unless you have set ${cW}CLANGFMT${cZ} to point to ${cW}clang-format${cZ}."; exit 1 31 | fi 32 | else 33 | echo "$CLANGFMT" 34 | fi 35 | 36 | command find -type f \( -name '*.cpp' -o -name '*.h' -o -name '*.hpp' -o -name '*.c' \) |while read fname; do 37 | case "${fname#./}" in 38 | # Ignore a bunch of folders 39 | bin/* | obj/* | .vs/* | cmocka/* | thirdparty/* | Tests/googlemock/* | Tests/googletest/* | utfcpp/* | fmt/* | lua/* ) ;; 40 | # Only process what remains 41 | *) 42 | echo -e "Formatting: ${cW}${fname#./}${cZ}" 43 | ( set -x; "$CLANGFMT" -i "${fname#./}" ) 44 | ;; 45 | esac 46 | done 47 | -------------------------------------------------------------------------------- /InvokeCompilerPass/dllversion.h: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// 2023 Oliver Schneider (assarbad.net) under the terms of the UNLICENSE 4 | /// 5 | /// SPDX-License-Identifier: Unlicense 6 | /// 7 | /////////////////////////////////////////////////////////////////////////////// 8 | #ifndef __DLLVERSION_H_VER__ 9 | #define __DLLVERSION_H_VER__ 2023072321 10 | 11 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) 12 | # pragma once 13 | #endif 14 | 15 | // --------------------------------------------------------------------------- 16 | // Several defines have to be given before including this file. These are: 17 | // --------------------------------------------------------------------------- 18 | #define TEXT_AUTHOR Oliver Schneider // author (optional value) 19 | #define PRD_MAJVER 0 // major product version 20 | #define PRD_MINVER 1 // minor product version 21 | #define PRD_PATCH 0 // patch number 22 | #define PRD_BUILD 0 // build number for product 23 | #define FILE_MAJVER PRD_MAJVER // major file version 24 | #define FILE_MINVER PRD_MINVER // minor file version 25 | #define FILE_PATCH PRD_PATCH // patch number 26 | #define FILE_BUILD PRD_BUILD // build number 27 | 28 | // clang-format off 29 | #define DLL_YEAR 2023 // current year or timespan (e.g. 2003-2007) 30 | #define TEXT_WEBSITE https:/##/assarbad.net // website 31 | 32 | #define TEXT_PRODUCTNAME InvokeCompilerPass // product's name 33 | #define TEXT_FILEDESC DLL to research InvokeCompilerPassW of MSVC // component description 34 | #define TEXT_COMPANY Oliver Schneider (assarbad.net) // company 35 | #define TEXT_MODULE InvokeCompilerPass // module name 36 | #define TEXT_COPYRIGHT DLL_YEAR TEXT_AUTHOR // copyright information 37 | #define TEXT_INTERNALNAME InvokeCompilerPass.dll 38 | // clang-format on 39 | 40 | #define _ANSISTRING(text) #text 41 | #define ANSISTRING(text) _ANSISTRING(text) 42 | 43 | #define _WIDESTRING(text) L##text 44 | #define WIDESTRING(text) _WIDESTRING(text) 45 | 46 | #define PRESET_UNICODE_STRING(symbol, buffer) \ 47 | UNICODE_STRING symbol = {sizeof(WIDESTRING(buffer)) - sizeof(WCHAR), sizeof(WIDESTRING(buffer)), WIDESTRING(buffer)}; 48 | 49 | #define CREATE_XVER(maj, min, patch, build) maj##, ##min##, ##patch##, ##build 50 | #define CREATE_FVER(maj, min, patch, build) maj##.##min##.##patch##.##build 51 | #define CREATE_PVER(maj, min, patch, build) maj##.##min##.##patch 52 | 53 | #endif // __DLLVERSION_H_VER__ 54 | -------------------------------------------------------------------------------- /InvokeCompilerPass/dllversion.rc: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | /// 3 | /// 2023 Oliver Schneider (assarbad.net) under the terms of the UNLICENSE 4 | /// 5 | /// SPDX-License-Identifier: Unlicense 6 | /// 7 | /////////////////////////////////////////////////////////////////////////////// 8 | #include 9 | #include 10 | #pragma code_page(65001) 11 | 12 | #ifdef RC_INVOKED 13 | LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL 14 | #include "dllversion.h" 15 | 16 | #ifdef DBG 17 | #define ACTUAL_FILEFLAGS VS_FF_DEBUG 18 | #else 19 | #define ACTUAL_FILEFLAGS 0 20 | #endif 21 | 22 | VS_VERSION_INFO VERSIONINFO 23 | FILEVERSION CREATE_XVER(FILE_MAJVER, FILE_MINVER, FILE_PATCH, FILE_BUILD) 24 | PRODUCTVERSION CREATE_XVER(PRD_MAJVER, PRD_MINVER, PRD_PATCH, PRD_BUILD) 25 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 26 | FILEFLAGS ACTUAL_FILEFLAGS 27 | FILEOS VOS_NT 28 | FILETYPE VFT_DLL 29 | FILESUBTYPE VFT2_UNKNOWN 30 | BEGIN 31 | BLOCK "StringFileInfo" 32 | BEGIN 33 | BLOCK "000004b0" 34 | BEGIN 35 | #ifdef TEXT_AUTHOR 36 | VALUE "Author", ANSISTRING(TEXT_AUTHOR) 37 | #endif 38 | #ifdef TEXT_COMMENTS 39 | VALUE "Comments", ANSISTRING(TEXT_COMMENTS) 40 | #endif 41 | VALUE "CompanyName", ANSISTRING(TEXT_COMPANY) 42 | VALUE "FileDescription", ANSISTRING(TEXT_FILEDESC) 43 | VALUE "FileVersion", ANSISTRING(CREATE_FVER(FILE_MAJVER, FILE_MINVER, FILE_PATCH, FILE_BUILD)) 44 | VALUE "InternalName", ANSISTRING(TEXT_INTERNALNAME) 45 | VALUE "LegalCopyright", ANSISTRING(TEXT_COPYRIGHT) 46 | VALUE "OriginalFilename", ANSISTRING(TEXT_MODULE) 47 | VALUE "ProductName", ANSISTRING(TEXT_PRODUCTNAME) 48 | VALUE "ProductVersion", ANSISTRING(CREATE_PVER(PRD_MAJVER, PRD_MINVER, PRD_PATCH, PRD_BUILD)) 49 | #ifdef TEXT_PORTIONSCOPYRIGHT 50 | VALUE "Portions Copyright", TEXT_PORTIONSCOPYRIGHT 51 | #endif 52 | #ifdef TEXT_SPECIALBUILD 53 | VALUE "SpecialBuild", ANSISTRING(TEXT_SPECIALBUILD) 54 | #endif 55 | #ifdef TEXT_WEBSITE 56 | VALUE "Website", ANSISTRING(TEXT_WEBSITE) 57 | #endif 58 | #if defined(HG_REV_ID) && defined(HG_REV_NO) 59 | VALUE "Mercurial revision", HG_REV_ID " (" ANSISTRING(HG_REV_NO) ")" 60 | #endif 61 | #if defined(GIT_COMMIT) 62 | VALUE "Git revision", ANSISTRING(GIT_COMMIT) 63 | #endif 64 | #if defined(HG_FULLID) && defined(HG_REPOSITORY) 65 | VALUE "Mercurial revision URL", HG_REPOSITORY "/src/" HG_FULLID 66 | #endif 67 | #ifdef HG_REPOSITORY 68 | VALUE "Mercurial repository", HG_REPOSITORY 69 | #endif 70 | END 71 | END 72 | BLOCK "VarFileInfo" 73 | BEGIN 74 | VALUE "Translation", 0x0, 1200 75 | END 76 | END 77 | 78 | #endif // RC_INVOKED 79 | -------------------------------------------------------------------------------- /InvokeCompilerPass/fmt/.clang-format: -------------------------------------------------------------------------------- 1 | # Run manually to reformat a file: 2 | # clang-format -i --style=file 3 | Language: Cpp 4 | BasedOnStyle: Google 5 | IndentPPDirectives: AfterHash 6 | IndentCaseLabels: false 7 | AlwaysBreakTemplateDeclarations: false 8 | DerivePointerAlignment: false 9 | -------------------------------------------------------------------------------- /InvokeCompilerPass/fmt/LICENSE.rst: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 - present, Victor Zverovich and {fmt} contributors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | --- Optional exception to the license --- 23 | 24 | As an exception, if, as a result of your compiling your source code, portions 25 | of this Software are embedded into a machine-executable object form of such 26 | source code, you may redistribute such embedded portions in such object form 27 | without including the above copyright and permission notices. 28 | -------------------------------------------------------------------------------- /InvokeCompilerPass/fmt/src/fmt.cc: -------------------------------------------------------------------------------- 1 | module; 2 | 3 | // Put all implementation-provided headers into the global module fragment 4 | // to prevent attachment to this module. 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #if __has_include() 39 | # include 40 | #endif 41 | #if defined(_MSC_VER) || defined(__MINGW32__) 42 | # include 43 | #endif 44 | #if defined __APPLE__ || defined(__FreeBSD__) 45 | # include 46 | #endif 47 | #if __has_include() 48 | # include 49 | #endif 50 | #if (__has_include() || defined(__APPLE__) || \ 51 | defined(__linux__)) && \ 52 | (!defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)) 53 | # include 54 | # include 55 | # include 56 | # ifndef _WIN32 57 | # include 58 | # else 59 | # include 60 | # endif 61 | #endif 62 | #ifdef _WIN32 63 | # if defined(__GLIBCXX__) 64 | # include 65 | # include 66 | # elif defined(_LIBCPP_VERSION) 67 | # include <__std_stream> 68 | # endif 69 | # define WIN32_LEAN_AND_MEAN 70 | # include 71 | #endif 72 | 73 | export module fmt; 74 | 75 | #define FMT_MODULE_EXPORT export 76 | #define FMT_BEGIN_EXPORT export { 77 | #define FMT_END_EXPORT } 78 | #define FMT_BEGIN_DETAIL_NAMESPACE \ 79 | } \ 80 | namespace detail { 81 | #define FMT_END_DETAIL_NAMESPACE \ 82 | } \ 83 | export { 84 | // If you define FMT_ATTACH_TO_GLOBAL_MODULE 85 | // - all declarations are detached from module 'fmt' 86 | // - the module behaves like a traditional static library, too 87 | // - all library symbols are mangled traditionally 88 | // - you can mix TUs with either importing or #including the {fmt} API 89 | #ifdef FMT_ATTACH_TO_GLOBAL_MODULE 90 | extern "C++" { 91 | #endif 92 | 93 | // All library-provided declarations and definitions must be in the module 94 | // purview to be exported. 95 | #include "fmt/args.h" 96 | #include "fmt/chrono.h" 97 | #include "fmt/color.h" 98 | #include "fmt/compile.h" 99 | #include "fmt/format.h" 100 | #include "fmt/os.h" 101 | #include "fmt/printf.h" 102 | #include "fmt/std.h" 103 | #include "fmt/xchar.h" 104 | 105 | 106 | #ifdef FMT_ATTACH_TO_GLOBAL_MODULE 107 | } 108 | #endif 109 | 110 | // gcc doesn't yet implement private module fragments 111 | #if !FMT_GCC_VERSION 112 | module :private; 113 | #endif 114 | 115 | #include "format.cc" 116 | #include "os.cc" 117 | -------------------------------------------------------------------------------- /InvokeCompilerPass/fmt/src/format.cc: -------------------------------------------------------------------------------- 1 | // Formatting library for C++ 2 | // 3 | // Copyright (c) 2012 - 2016, Victor Zverovich 4 | // All rights reserved. 5 | // 6 | // For the license information refer to format.h. 7 | 8 | #include "fmt/format-inl.h" 9 | 10 | FMT_BEGIN_NAMESPACE 11 | namespace detail { 12 | 13 | template FMT_API auto dragonbox::to_decimal(float x) noexcept 14 | -> dragonbox::decimal_fp; 15 | template FMT_API auto dragonbox::to_decimal(double x) noexcept 16 | -> dragonbox::decimal_fp; 17 | 18 | #ifndef FMT_STATIC_THOUSANDS_SEPARATOR 19 | template FMT_API locale_ref::locale_ref(const std::locale& loc); 20 | template FMT_API auto locale_ref::get() const -> std::locale; 21 | #endif 22 | 23 | // Explicit instantiations for char. 24 | 25 | template FMT_API auto thousands_sep_impl(locale_ref) 26 | -> thousands_sep_result; 27 | template FMT_API auto decimal_point_impl(locale_ref) -> char; 28 | 29 | template FMT_API void buffer::append(const char*, const char*); 30 | 31 | template FMT_API void vformat_to(buffer&, string_view, 32 | typename vformat_args<>::type, locale_ref); 33 | 34 | // Explicit instantiations for wchar_t. 35 | 36 | template FMT_API auto thousands_sep_impl(locale_ref) 37 | -> thousands_sep_result; 38 | template FMT_API auto decimal_point_impl(locale_ref) -> wchar_t; 39 | 40 | template FMT_API void buffer::append(const wchar_t*, const wchar_t*); 41 | 42 | } // namespace detail 43 | FMT_END_NAMESPACE 44 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/.clang-format: -------------------------------------------------------------------------------- 1 | DisableFormat: true 2 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/.gitignore: -------------------------------------------------------------------------------- 1 | .gitattributes 2 | 3 | *.so 4 | *.o 5 | *.a 6 | 7 | manual/manual.html 8 | 9 | testes/time.txt 10 | testes/time-debug.txt 11 | 12 | testes/libs/all 13 | 14 | temp 15 | lua 16 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/README.md: -------------------------------------------------------------------------------- 1 | # Lua 2 | 3 | This is the repository of Lua development code, as seen by the Lua team. It contains the full history of all commits but is mirrored irregularly. For complete information about Lua, visit [Lua.org](https://www.lua.org/). 4 | 5 | Please **do not** send pull requests. To report issues, post a message to the [Lua mailing list](https://www.lua.org/lua-l.html). 6 | 7 | Download official Lua releases from [Lua.org](https://www.lua.org/download.html). 8 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/all: -------------------------------------------------------------------------------- 1 | make -s -j 2 | cd testes/libs; make -s 3 | cd .. # back to directory 'testes' 4 | ulimit -S -s 1100 5 | if { ../lua -W all.lua; } then 6 | echo -e "\n\n final OK!!!!\n\n" 7 | else 8 | echo -e "\n\n >>>> BUG!!!!\n\n" 9 | fi 10 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/lapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lapi.h $ 3 | ** Auxiliary functions from Lua API 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lapi_h 8 | #define lapi_h 9 | 10 | 11 | #include "llimits.h" 12 | #include "lstate.h" 13 | 14 | 15 | /* Increments 'L->top.p', checking for stack overflows */ 16 | #define api_incr_top(L) {L->top.p++; \ 17 | api_check(L, L->top.p <= L->ci->top.p, \ 18 | "stack overflow");} 19 | 20 | 21 | /* 22 | ** If a call returns too many multiple returns, the callee may not have 23 | ** stack space to accommodate all results. In this case, this macro 24 | ** increases its stack space ('L->ci->top.p'). 25 | */ 26 | #define adjustresults(L,nres) \ 27 | { if ((nres) <= LUA_MULTRET && L->ci->top.p < L->top.p) \ 28 | L->ci->top.p = L->top.p; } 29 | 30 | 31 | /* Ensure the stack has at least 'n' elements */ 32 | #define api_checknelems(L,n) \ 33 | api_check(L, (n) < (L->top.p - L->ci->func.p), \ 34 | "not enough elements in the stack") 35 | 36 | 37 | /* 38 | ** To reduce the overhead of returning from C functions, the presence of 39 | ** to-be-closed variables in these functions is coded in the CallInfo's 40 | ** field 'nresults', in a way that functions with no to-be-closed variables 41 | ** with zero, one, or "all" wanted results have no overhead. Functions 42 | ** with other number of wanted results, as well as functions with 43 | ** variables to be closed, have an extra check. 44 | */ 45 | 46 | #define hastocloseCfunc(n) ((n) < LUA_MULTRET) 47 | 48 | /* Map [-1, inf) (range of 'nresults') into (-inf, -2] */ 49 | #define codeNresults(n) (-(n) - 3) 50 | #define decodeNresults(n) (-(n) - 3) 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/lctype.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lctype.c $ 3 | ** 'ctype' functions for Lua 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #define lctype_c 8 | #define LUA_CORE 9 | 10 | #include "lprefix.h" 11 | 12 | 13 | #include "lctype.h" 14 | 15 | #if !LUA_USE_CTYPE /* { */ 16 | 17 | #include 18 | 19 | 20 | #if defined (LUA_UCID) /* accept UniCode IDentifiers? */ 21 | /* consider all non-ascii codepoints to be alphabetic */ 22 | #define NONA 0x01 23 | #else 24 | #define NONA 0x00 /* default */ 25 | #endif 26 | 27 | 28 | LUAI_DDEF const lu_byte luai_ctype_[UCHAR_MAX + 2] = { 29 | 0x00, /* EOZ */ 30 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0. */ 31 | 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 32 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 1. */ 33 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 34 | 0x0c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, /* 2. */ 35 | 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 36 | 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, /* 3. */ 37 | 0x16, 0x16, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 38 | 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* 4. */ 39 | 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 40 | 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 5. */ 41 | 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x05, 42 | 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* 6. */ 43 | 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 44 | 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 7. */ 45 | 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x00, 46 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* 8. */ 47 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, 48 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* 9. */ 49 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, 50 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* a. */ 51 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, 52 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* b. */ 53 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, 54 | 0x00, 0x00, NONA, NONA, NONA, NONA, NONA, NONA, /* c. */ 55 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, 56 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* d. */ 57 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, 58 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* e. */ 59 | NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, 60 | NONA, NONA, NONA, NONA, NONA, 0x00, 0x00, 0x00, /* f. */ 61 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 62 | }; 63 | 64 | #endif /* } */ 65 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/lctype.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lctype.h $ 3 | ** 'ctype' functions for Lua 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lctype_h 8 | #define lctype_h 9 | 10 | #include "lua.h" 11 | 12 | 13 | /* 14 | ** WARNING: the functions defined here do not necessarily correspond 15 | ** to the similar functions in the standard C ctype.h. They are 16 | ** optimized for the specific needs of Lua. 17 | */ 18 | 19 | #if !defined(LUA_USE_CTYPE) 20 | 21 | #if 'A' == 65 && '0' == 48 22 | /* ASCII case: can use its own tables; faster and fixed */ 23 | #define LUA_USE_CTYPE 0 24 | #else 25 | /* must use standard C ctype */ 26 | #define LUA_USE_CTYPE 1 27 | #endif 28 | 29 | #endif 30 | 31 | 32 | #if !LUA_USE_CTYPE /* { */ 33 | 34 | #include 35 | 36 | #include "llimits.h" 37 | 38 | 39 | #define ALPHABIT 0 40 | #define DIGITBIT 1 41 | #define PRINTBIT 2 42 | #define SPACEBIT 3 43 | #define XDIGITBIT 4 44 | 45 | 46 | #define MASK(B) (1 << (B)) 47 | 48 | 49 | /* 50 | ** add 1 to char to allow index -1 (EOZ) 51 | */ 52 | #define testprop(c,p) (luai_ctype_[(c)+1] & (p)) 53 | 54 | /* 55 | ** 'lalpha' (Lua alphabetic) and 'lalnum' (Lua alphanumeric) both include '_' 56 | */ 57 | #define lislalpha(c) testprop(c, MASK(ALPHABIT)) 58 | #define lislalnum(c) testprop(c, (MASK(ALPHABIT) | MASK(DIGITBIT))) 59 | #define lisdigit(c) testprop(c, MASK(DIGITBIT)) 60 | #define lisspace(c) testprop(c, MASK(SPACEBIT)) 61 | #define lisprint(c) testprop(c, MASK(PRINTBIT)) 62 | #define lisxdigit(c) testprop(c, MASK(XDIGITBIT)) 63 | 64 | 65 | /* 66 | ** In ASCII, this 'ltolower' is correct for alphabetic characters and 67 | ** for '.'. That is enough for Lua needs. ('check_exp' ensures that 68 | ** the character either is an upper-case letter or is unchanged by 69 | ** the transformation, which holds for lower-case letters and '.'.) 70 | */ 71 | #define ltolower(c) \ 72 | check_exp(('A' <= (c) && (c) <= 'Z') || (c) == ((c) | ('A' ^ 'a')), \ 73 | (c) | ('A' ^ 'a')) 74 | 75 | 76 | /* one entry for each character and for -1 (EOZ) */ 77 | LUAI_DDEC(const lu_byte luai_ctype_[UCHAR_MAX + 2];) 78 | 79 | 80 | #else /* }{ */ 81 | 82 | /* 83 | ** use standard C ctypes 84 | */ 85 | 86 | #include 87 | 88 | 89 | #define lislalpha(c) (isalpha(c) || (c) == '_') 90 | #define lislalnum(c) (isalnum(c) || (c) == '_') 91 | #define lisdigit(c) (isdigit(c)) 92 | #define lisspace(c) (isspace(c)) 93 | #define lisprint(c) (isprint(c)) 94 | #define lisxdigit(c) (isxdigit(c)) 95 | 96 | #define ltolower(c) (tolower(c)) 97 | 98 | #endif /* } */ 99 | 100 | #endif 101 | 102 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/ldebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ldebug.h $ 3 | ** Auxiliary functions from Debug Interface module 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ldebug_h 8 | #define ldebug_h 9 | 10 | 11 | #include "lstate.h" 12 | 13 | 14 | #define pcRel(pc, p) (cast_int((pc) - (p)->code) - 1) 15 | 16 | 17 | /* Active Lua function (given call info) */ 18 | #define ci_func(ci) (clLvalue(s2v((ci)->func.p))) 19 | 20 | 21 | #define resethookcount(L) (L->hookcount = L->basehookcount) 22 | 23 | /* 24 | ** mark for entries in 'lineinfo' array that has absolute information in 25 | ** 'abslineinfo' array 26 | */ 27 | #define ABSLINEINFO (-0x80) 28 | 29 | 30 | /* 31 | ** MAXimum number of successive Instructions WiTHout ABSolute line 32 | ** information. (A power of two allows fast divisions.) 33 | */ 34 | #if !defined(MAXIWTHABS) 35 | #define MAXIWTHABS 128 36 | #endif 37 | 38 | 39 | LUAI_FUNC int luaG_getfuncline (const Proto *f, int pc); 40 | LUAI_FUNC const char *luaG_findlocal (lua_State *L, CallInfo *ci, int n, 41 | StkId *pos); 42 | LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o, 43 | const char *opname); 44 | LUAI_FUNC l_noret luaG_callerror (lua_State *L, const TValue *o); 45 | LUAI_FUNC l_noret luaG_forerror (lua_State *L, const TValue *o, 46 | const char *what); 47 | LUAI_FUNC l_noret luaG_concaterror (lua_State *L, const TValue *p1, 48 | const TValue *p2); 49 | LUAI_FUNC l_noret luaG_opinterror (lua_State *L, const TValue *p1, 50 | const TValue *p2, 51 | const char *msg); 52 | LUAI_FUNC l_noret luaG_tointerror (lua_State *L, const TValue *p1, 53 | const TValue *p2); 54 | LUAI_FUNC l_noret luaG_ordererror (lua_State *L, const TValue *p1, 55 | const TValue *p2); 56 | LUAI_FUNC l_noret luaG_runerror (lua_State *L, const char *fmt, ...); 57 | LUAI_FUNC const char *luaG_addinfo (lua_State *L, const char *msg, 58 | TString *src, int line); 59 | LUAI_FUNC l_noret luaG_errormsg (lua_State *L); 60 | LUAI_FUNC int luaG_traceexec (lua_State *L, const Instruction *pc); 61 | 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/ldo.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ldo.h $ 3 | ** Stack and Call structure of Lua 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ldo_h 8 | #define ldo_h 9 | 10 | 11 | #include "llimits.h" 12 | #include "lobject.h" 13 | #include "lstate.h" 14 | #include "lzio.h" 15 | 16 | 17 | /* 18 | ** Macro to check stack size and grow stack if needed. Parameters 19 | ** 'pre'/'pos' allow the macro to preserve a pointer into the 20 | ** stack across reallocations, doing the work only when needed. 21 | ** It also allows the running of one GC step when the stack is 22 | ** reallocated. 23 | ** 'condmovestack' is used in heavy tests to force a stack reallocation 24 | ** at every check. 25 | */ 26 | #define luaD_checkstackaux(L,n,pre,pos) \ 27 | if (l_unlikely(L->stack_last.p - L->top.p <= (n))) \ 28 | { pre; luaD_growstack(L, n, 1); pos; } \ 29 | else { condmovestack(L,pre,pos); } 30 | 31 | /* In general, 'pre'/'pos' are empty (nothing to save) */ 32 | #define luaD_checkstack(L,n) luaD_checkstackaux(L,n,(void)0,(void)0) 33 | 34 | 35 | 36 | #define savestack(L,pt) (cast_charp(pt) - cast_charp(L->stack.p)) 37 | #define restorestack(L,n) cast(StkId, cast_charp(L->stack.p) + (n)) 38 | 39 | 40 | /* macro to check stack size, preserving 'p' */ 41 | #define checkstackp(L,n,p) \ 42 | luaD_checkstackaux(L, n, \ 43 | ptrdiff_t t__ = savestack(L, p), /* save 'p' */ \ 44 | p = restorestack(L, t__)) /* 'pos' part: restore 'p' */ 45 | 46 | 47 | /* macro to check stack size and GC, preserving 'p' */ 48 | #define checkstackGCp(L,n,p) \ 49 | luaD_checkstackaux(L, n, \ 50 | ptrdiff_t t__ = savestack(L, p); /* save 'p' */ \ 51 | luaC_checkGC(L), /* stack grow uses memory */ \ 52 | p = restorestack(L, t__)) /* 'pos' part: restore 'p' */ 53 | 54 | 55 | /* macro to check stack size and GC */ 56 | #define checkstackGC(L,fsize) \ 57 | luaD_checkstackaux(L, (fsize), luaC_checkGC(L), (void)0) 58 | 59 | 60 | /* type of protected functions, to be ran by 'runprotected' */ 61 | typedef void (*Pfunc) (lua_State *L, void *ud); 62 | 63 | LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop); 64 | LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, 65 | const char *mode); 66 | LUAI_FUNC void luaD_hook (lua_State *L, int event, int line, 67 | int fTransfer, int nTransfer); 68 | LUAI_FUNC void luaD_hookcall (lua_State *L, CallInfo *ci); 69 | LUAI_FUNC int luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func, 70 | int narg1, int delta); 71 | LUAI_FUNC CallInfo *luaD_precall (lua_State *L, StkId func, int nResults); 72 | LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); 73 | LUAI_FUNC void luaD_callnoyield (lua_State *L, StkId func, int nResults); 74 | LUAI_FUNC StkId luaD_tryfuncTM (lua_State *L, StkId func); 75 | LUAI_FUNC int luaD_closeprotected (lua_State *L, ptrdiff_t level, int status); 76 | LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, 77 | ptrdiff_t oldtop, ptrdiff_t ef); 78 | LUAI_FUNC void luaD_poscall (lua_State *L, CallInfo *ci, int nres); 79 | LUAI_FUNC int luaD_reallocstack (lua_State *L, int newsize, int raiseerror); 80 | LUAI_FUNC int luaD_growstack (lua_State *L, int n, int raiseerror); 81 | LUAI_FUNC void luaD_shrinkstack (lua_State *L); 82 | LUAI_FUNC void luaD_inctop (lua_State *L); 83 | 84 | LUAI_FUNC l_noret luaD_throw (lua_State *L, int errcode); 85 | LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); 86 | 87 | #endif 88 | 89 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/lfunc.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lfunc.h $ 3 | ** Auxiliary functions to manipulate prototypes and closures 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lfunc_h 8 | #define lfunc_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | #define sizeCclosure(n) (cast_int(offsetof(CClosure, upvalue)) + \ 15 | cast_int(sizeof(TValue)) * (n)) 16 | 17 | #define sizeLclosure(n) (cast_int(offsetof(LClosure, upvals)) + \ 18 | cast_int(sizeof(TValue *)) * (n)) 19 | 20 | 21 | /* test whether thread is in 'twups' list */ 22 | #define isintwups(L) (L->twups != L) 23 | 24 | 25 | /* 26 | ** maximum number of upvalues in a closure (both C and Lua). (Value 27 | ** must fit in a VM register.) 28 | */ 29 | #define MAXUPVAL 255 30 | 31 | 32 | #define upisopen(up) ((up)->v.p != &(up)->u.value) 33 | 34 | 35 | #define uplevel(up) check_exp(upisopen(up), cast(StkId, (up)->v.p)) 36 | 37 | 38 | /* 39 | ** maximum number of misses before giving up the cache of closures 40 | ** in prototypes 41 | */ 42 | #define MAXMISS 10 43 | 44 | 45 | 46 | /* special status to close upvalues preserving the top of the stack */ 47 | #define CLOSEKTOP (-1) 48 | 49 | 50 | LUAI_FUNC Proto *luaF_newproto (lua_State *L); 51 | LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nupvals); 52 | LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nupvals); 53 | LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl); 54 | LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); 55 | LUAI_FUNC void luaF_newtbcupval (lua_State *L, StkId level); 56 | LUAI_FUNC void luaF_closeupval (lua_State *L, StkId level); 57 | LUAI_FUNC StkId luaF_close (lua_State *L, StkId level, int status, int yy); 58 | LUAI_FUNC void luaF_unlinkupval (UpVal *uv); 59 | LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); 60 | LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, 61 | int pc); 62 | 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/linit.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: linit.c $ 3 | ** Initialization of libraries for lua.c and other clients 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #define linit_c 9 | #define LUA_LIB 10 | 11 | /* 12 | ** If you embed Lua in your program and need to open the standard 13 | ** libraries, call luaL_openlibs in your program. If you need a 14 | ** different set of libraries, copy this file to your project and edit 15 | ** it to suit your needs. 16 | ** 17 | ** You can also *preload* libraries, so that a later 'require' can 18 | ** open the library, which is already linked to the application. 19 | ** For that, do the following code: 20 | ** 21 | ** luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE); 22 | ** lua_pushcfunction(L, luaopen_modname); 23 | ** lua_setfield(L, -2, modname); 24 | ** lua_pop(L, 1); // remove PRELOAD table 25 | */ 26 | 27 | #include "lprefix.h" 28 | 29 | 30 | #include 31 | 32 | #include "lua.h" 33 | 34 | #include "lualib.h" 35 | #include "lauxlib.h" 36 | 37 | 38 | /* 39 | ** these libs are loaded by lua.c and are readily available to any Lua 40 | ** program 41 | */ 42 | static const luaL_Reg loadedlibs[] = { 43 | {LUA_GNAME, luaopen_base}, 44 | {LUA_LOADLIBNAME, luaopen_package}, 45 | {LUA_COLIBNAME, luaopen_coroutine}, 46 | {LUA_TABLIBNAME, luaopen_table}, 47 | {LUA_IOLIBNAME, luaopen_io}, 48 | {LUA_OSLIBNAME, luaopen_os}, 49 | {LUA_STRLIBNAME, luaopen_string}, 50 | {LUA_MATHLIBNAME, luaopen_math}, 51 | {LUA_UTF8LIBNAME, luaopen_utf8}, 52 | {LUA_DBLIBNAME, luaopen_debug}, 53 | {NULL, NULL} 54 | }; 55 | 56 | 57 | LUALIB_API void luaL_openlibs (lua_State *L) { 58 | const luaL_Reg *lib; 59 | /* "require" functions from 'loadedlibs' and set results to global table */ 60 | for (lib = loadedlibs; lib->func; lib++) { 61 | luaL_requiref(L, lib->name, lib->func, 1); 62 | lua_pop(L, 1); /* remove lib */ 63 | } 64 | } 65 | 66 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/ljumptab.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ljumptab.h $ 3 | ** Jump Table for the Lua interpreter 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #undef vmdispatch 9 | #undef vmcase 10 | #undef vmbreak 11 | 12 | #define vmdispatch(x) goto *disptab[x]; 13 | 14 | #define vmcase(l) L_##l: 15 | 16 | #define vmbreak vmfetch(); vmdispatch(GET_OPCODE(i)); 17 | 18 | 19 | static const void *const disptab[NUM_OPCODES] = { 20 | 21 | #if 0 22 | ** you can update the following list with this command: 23 | ** 24 | ** sed -n '/^OP_/\!d; s/OP_/\&\&L_OP_/ ; s/,.*/,/ ; s/\/.*// ; p' lopcodes.h 25 | ** 26 | #endif 27 | 28 | &&L_OP_MOVE, 29 | &&L_OP_LOADI, 30 | &&L_OP_LOADF, 31 | &&L_OP_LOADK, 32 | &&L_OP_LOADKX, 33 | &&L_OP_LOADFALSE, 34 | &&L_OP_LFALSESKIP, 35 | &&L_OP_LOADTRUE, 36 | &&L_OP_LOADNIL, 37 | &&L_OP_GETUPVAL, 38 | &&L_OP_SETUPVAL, 39 | &&L_OP_GETTABUP, 40 | &&L_OP_GETTABLE, 41 | &&L_OP_GETI, 42 | &&L_OP_GETFIELD, 43 | &&L_OP_SETTABUP, 44 | &&L_OP_SETTABLE, 45 | &&L_OP_SETI, 46 | &&L_OP_SETFIELD, 47 | &&L_OP_NEWTABLE, 48 | &&L_OP_SELF, 49 | &&L_OP_ADDI, 50 | &&L_OP_ADDK, 51 | &&L_OP_SUBK, 52 | &&L_OP_MULK, 53 | &&L_OP_MODK, 54 | &&L_OP_POWK, 55 | &&L_OP_DIVK, 56 | &&L_OP_IDIVK, 57 | &&L_OP_BANDK, 58 | &&L_OP_BORK, 59 | &&L_OP_BXORK, 60 | &&L_OP_SHRI, 61 | &&L_OP_SHLI, 62 | &&L_OP_ADD, 63 | &&L_OP_SUB, 64 | &&L_OP_MUL, 65 | &&L_OP_MOD, 66 | &&L_OP_POW, 67 | &&L_OP_DIV, 68 | &&L_OP_IDIV, 69 | &&L_OP_BAND, 70 | &&L_OP_BOR, 71 | &&L_OP_BXOR, 72 | &&L_OP_SHL, 73 | &&L_OP_SHR, 74 | &&L_OP_MMBIN, 75 | &&L_OP_MMBINI, 76 | &&L_OP_MMBINK, 77 | &&L_OP_UNM, 78 | &&L_OP_BNOT, 79 | &&L_OP_NOT, 80 | &&L_OP_LEN, 81 | &&L_OP_CONCAT, 82 | &&L_OP_CLOSE, 83 | &&L_OP_TBC, 84 | &&L_OP_JMP, 85 | &&L_OP_EQ, 86 | &&L_OP_LT, 87 | &&L_OP_LE, 88 | &&L_OP_EQK, 89 | &&L_OP_EQI, 90 | &&L_OP_LTI, 91 | &&L_OP_LEI, 92 | &&L_OP_GTI, 93 | &&L_OP_GEI, 94 | &&L_OP_TEST, 95 | &&L_OP_TESTSET, 96 | &&L_OP_CALL, 97 | &&L_OP_TAILCALL, 98 | &&L_OP_RETURN, 99 | &&L_OP_RETURN0, 100 | &&L_OP_RETURN1, 101 | &&L_OP_FORLOOP, 102 | &&L_OP_FORPREP, 103 | &&L_OP_TFORPREP, 104 | &&L_OP_TFORCALL, 105 | &&L_OP_TFORLOOP, 106 | &&L_OP_SETLIST, 107 | &&L_OP_CLOSURE, 108 | &&L_OP_VARARG, 109 | &&L_OP_VARARGPREP, 110 | &&L_OP_EXTRAARG 111 | 112 | }; 113 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/llex.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: llex.h $ 3 | ** Lexical Analyzer 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef llex_h 8 | #define llex_h 9 | 10 | #include 11 | 12 | #include "lobject.h" 13 | #include "lzio.h" 14 | 15 | 16 | /* 17 | ** Single-char tokens (terminal symbols) are represented by their own 18 | ** numeric code. Other tokens start at the following value. 19 | */ 20 | #define FIRST_RESERVED (UCHAR_MAX + 1) 21 | 22 | 23 | #if !defined(LUA_ENV) 24 | #define LUA_ENV "_ENV" 25 | #endif 26 | 27 | 28 | /* 29 | * WARNING: if you change the order of this enumeration, 30 | * grep "ORDER RESERVED" 31 | */ 32 | enum RESERVED { 33 | /* terminal symbols denoted by reserved words */ 34 | TK_AND = FIRST_RESERVED, TK_BREAK, 35 | TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION, 36 | TK_GOTO, TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, 37 | TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, 38 | /* other terminal symbols */ 39 | TK_IDIV, TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, 40 | TK_SHL, TK_SHR, 41 | TK_DBCOLON, TK_EOS, 42 | TK_FLT, TK_INT, TK_NAME, TK_STRING 43 | }; 44 | 45 | /* number of reserved words */ 46 | #define NUM_RESERVED (cast_int(TK_WHILE-FIRST_RESERVED + 1)) 47 | 48 | 49 | typedef union { 50 | lua_Number r; 51 | lua_Integer i; 52 | TString *ts; 53 | } SemInfo; /* semantics information */ 54 | 55 | 56 | typedef struct Token { 57 | int token; 58 | SemInfo seminfo; 59 | } Token; 60 | 61 | 62 | /* state of the lexer plus state of the parser when shared by all 63 | functions */ 64 | typedef struct LexState { 65 | int current; /* current character (charint) */ 66 | int linenumber; /* input line counter */ 67 | int lastline; /* line of last token 'consumed' */ 68 | Token t; /* current token */ 69 | Token lookahead; /* look ahead token */ 70 | struct FuncState *fs; /* current function (parser) */ 71 | struct lua_State *L; 72 | ZIO *z; /* input stream */ 73 | Mbuffer *buff; /* buffer for tokens */ 74 | Table *h; /* to avoid collection/reuse strings */ 75 | struct Dyndata *dyd; /* dynamic structures used by the parser */ 76 | TString *source; /* current source name */ 77 | TString *envn; /* environment variable name */ 78 | } LexState; 79 | 80 | 81 | LUAI_FUNC void luaX_init (lua_State *L); 82 | LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, 83 | TString *source, int firstchar); 84 | LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l); 85 | LUAI_FUNC void luaX_next (LexState *ls); 86 | LUAI_FUNC int luaX_lookahead (LexState *ls); 87 | LUAI_FUNC l_noret luaX_syntaxerror (LexState *ls, const char *s); 88 | LUAI_FUNC const char *luaX_token2str (LexState *ls, int token); 89 | 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/lmem.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lmem.h $ 3 | ** Interface to Memory Manager 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lmem_h 8 | #define lmem_h 9 | 10 | 11 | #include 12 | 13 | #include "llimits.h" 14 | #include "lua.h" 15 | 16 | 17 | #define luaM_error(L) luaD_throw(L, LUA_ERRMEM) 18 | 19 | 20 | /* 21 | ** This macro tests whether it is safe to multiply 'n' by the size of 22 | ** type 't' without overflows. Because 'e' is always constant, it avoids 23 | ** the runtime division MAX_SIZET/(e). 24 | ** (The macro is somewhat complex to avoid warnings: The 'sizeof' 25 | ** comparison avoids a runtime comparison when overflow cannot occur. 26 | ** The compiler should be able to optimize the real test by itself, but 27 | ** when it does it, it may give a warning about "comparison is always 28 | ** false due to limited range of data type"; the +1 tricks the compiler, 29 | ** avoiding this warning but also this optimization.) 30 | */ 31 | #define luaM_testsize(n,e) \ 32 | (sizeof(n) >= sizeof(size_t) && cast_sizet((n)) + 1 > MAX_SIZET/(e)) 33 | 34 | #define luaM_checksize(L,n,e) \ 35 | (luaM_testsize(n,e) ? luaM_toobig(L) : cast_void(0)) 36 | 37 | 38 | /* 39 | ** Computes the minimum between 'n' and 'MAX_SIZET/sizeof(t)', so that 40 | ** the result is not larger than 'n' and cannot overflow a 'size_t' 41 | ** when multiplied by the size of type 't'. (Assumes that 'n' is an 42 | ** 'int' or 'unsigned int' and that 'int' is not larger than 'size_t'.) 43 | */ 44 | #define luaM_limitN(n,t) \ 45 | ((cast_sizet(n) <= MAX_SIZET/sizeof(t)) ? (n) : \ 46 | cast_uint((MAX_SIZET/sizeof(t)))) 47 | 48 | 49 | /* 50 | ** Arrays of chars do not need any test 51 | */ 52 | #define luaM_reallocvchar(L,b,on,n) \ 53 | cast_charp(luaM_saferealloc_(L, (b), (on)*sizeof(char), (n)*sizeof(char))) 54 | 55 | #define luaM_freemem(L, b, s) luaM_free_(L, (b), (s)) 56 | #define luaM_free(L, b) luaM_free_(L, (b), sizeof(*(b))) 57 | #define luaM_freearray(L, b, n) luaM_free_(L, (b), (n)*sizeof(*(b))) 58 | 59 | #define luaM_new(L,t) cast(t*, luaM_malloc_(L, sizeof(t), 0)) 60 | #define luaM_newvector(L,n,t) cast(t*, luaM_malloc_(L, (n)*sizeof(t), 0)) 61 | #define luaM_newvectorchecked(L,n,t) \ 62 | (luaM_checksize(L,n,sizeof(t)), luaM_newvector(L,n,t)) 63 | 64 | #define luaM_newobject(L,tag,s) luaM_malloc_(L, (s), tag) 65 | 66 | #define luaM_growvector(L,v,nelems,size,t,limit,e) \ 67 | ((v)=cast(t *, luaM_growaux_(L,v,nelems,&(size),sizeof(t), \ 68 | luaM_limitN(limit,t),e))) 69 | 70 | #define luaM_reallocvector(L, v,oldn,n,t) \ 71 | (cast(t *, luaM_realloc_(L, v, cast_sizet(oldn) * sizeof(t), \ 72 | cast_sizet(n) * sizeof(t)))) 73 | 74 | #define luaM_shrinkvector(L,v,size,fs,t) \ 75 | ((v)=cast(t *, luaM_shrinkvector_(L, v, &(size), fs, sizeof(t)))) 76 | 77 | LUAI_FUNC l_noret luaM_toobig (lua_State *L); 78 | 79 | /* not to be called directly */ 80 | LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, 81 | size_t size); 82 | LUAI_FUNC void *luaM_saferealloc_ (lua_State *L, void *block, size_t oldsize, 83 | size_t size); 84 | LUAI_FUNC void luaM_free_ (lua_State *L, void *block, size_t osize); 85 | LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int nelems, 86 | int *size, int size_elem, int limit, 87 | const char *what); 88 | LUAI_FUNC void *luaM_shrinkvector_ (lua_State *L, void *block, int *nelem, 89 | int final_n, int size_elem); 90 | LUAI_FUNC void *luaM_malloc_ (lua_State *L, size_t size, int tag); 91 | 92 | #endif 93 | 94 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/lopnames.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lopnames.h $ 3 | ** Opcode names 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #if !defined(lopnames_h) 8 | #define lopnames_h 9 | 10 | #include 11 | 12 | 13 | /* ORDER OP */ 14 | 15 | static const char *const opnames[] = { 16 | "MOVE", 17 | "LOADI", 18 | "LOADF", 19 | "LOADK", 20 | "LOADKX", 21 | "LOADFALSE", 22 | "LFALSESKIP", 23 | "LOADTRUE", 24 | "LOADNIL", 25 | "GETUPVAL", 26 | "SETUPVAL", 27 | "GETTABUP", 28 | "GETTABLE", 29 | "GETI", 30 | "GETFIELD", 31 | "SETTABUP", 32 | "SETTABLE", 33 | "SETI", 34 | "SETFIELD", 35 | "NEWTABLE", 36 | "SELF", 37 | "ADDI", 38 | "ADDK", 39 | "SUBK", 40 | "MULK", 41 | "MODK", 42 | "POWK", 43 | "DIVK", 44 | "IDIVK", 45 | "BANDK", 46 | "BORK", 47 | "BXORK", 48 | "SHRI", 49 | "SHLI", 50 | "ADD", 51 | "SUB", 52 | "MUL", 53 | "MOD", 54 | "POW", 55 | "DIV", 56 | "IDIV", 57 | "BAND", 58 | "BOR", 59 | "BXOR", 60 | "SHL", 61 | "SHR", 62 | "MMBIN", 63 | "MMBINI", 64 | "MMBINK", 65 | "UNM", 66 | "BNOT", 67 | "NOT", 68 | "LEN", 69 | "CONCAT", 70 | "CLOSE", 71 | "TBC", 72 | "JMP", 73 | "EQ", 74 | "LT", 75 | "LE", 76 | "EQK", 77 | "EQI", 78 | "LTI", 79 | "LEI", 80 | "GTI", 81 | "GEI", 82 | "TEST", 83 | "TESTSET", 84 | "CALL", 85 | "TAILCALL", 86 | "RETURN", 87 | "RETURN0", 88 | "RETURN1", 89 | "FORLOOP", 90 | "FORPREP", 91 | "TFORPREP", 92 | "TFORCALL", 93 | "TFORLOOP", 94 | "SETLIST", 95 | "CLOSURE", 96 | "VARARG", 97 | "VARARGPREP", 98 | "EXTRAARG", 99 | NULL 100 | }; 101 | 102 | #endif 103 | 104 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/lprefix.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lprefix.h $ 3 | ** Definitions for Lua code that must come before any other header file 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lprefix_h 8 | #define lprefix_h 9 | 10 | 11 | /* 12 | ** Allows POSIX/XSI stuff 13 | */ 14 | #if !defined(LUA_USE_C89) /* { */ 15 | 16 | #if !defined(_XOPEN_SOURCE) 17 | #define _XOPEN_SOURCE 600 18 | #elif _XOPEN_SOURCE == 0 19 | #undef _XOPEN_SOURCE /* use -D_XOPEN_SOURCE=0 to undefine it */ 20 | #endif 21 | 22 | /* 23 | ** Allows manipulation of large files in gcc and some other compilers 24 | */ 25 | #if !defined(LUA_32BITS) && !defined(_FILE_OFFSET_BITS) 26 | #define _LARGEFILE_SOURCE 1 27 | #define _FILE_OFFSET_BITS 64 28 | #endif 29 | 30 | #endif /* } */ 31 | 32 | 33 | /* 34 | ** Windows stuff 35 | */ 36 | #if defined(_WIN32) /* { */ 37 | 38 | #if !defined(_CRT_SECURE_NO_WARNINGS) 39 | #define _CRT_SECURE_NO_WARNINGS /* avoid warnings about ISO C functions */ 40 | #endif 41 | 42 | #endif /* } */ 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/lstring.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lstring.h $ 3 | ** String table (keep all strings handled by Lua) 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lstring_h 8 | #define lstring_h 9 | 10 | #include "lgc.h" 11 | #include "lobject.h" 12 | #include "lstate.h" 13 | 14 | 15 | /* 16 | ** Memory-allocation error message must be preallocated (it cannot 17 | ** be created after memory is exhausted) 18 | */ 19 | #define MEMERRMSG "not enough memory" 20 | 21 | 22 | /* 23 | ** Size of a TString: Size of the header plus space for the string 24 | ** itself (including final '\0'). 25 | */ 26 | #define sizelstring(l) (offsetof(TString, contents) + ((l) + 1) * sizeof(char)) 27 | 28 | #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ 29 | (sizeof(s)/sizeof(char))-1)) 30 | 31 | 32 | /* 33 | ** test whether a string is a reserved word 34 | */ 35 | #define isreserved(s) ((s)->tt == LUA_VSHRSTR && (s)->extra > 0) 36 | 37 | 38 | /* 39 | ** equality for short strings, which are always internalized 40 | */ 41 | #define eqshrstr(a,b) check_exp((a)->tt == LUA_VSHRSTR, (a) == (b)) 42 | 43 | 44 | LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed); 45 | LUAI_FUNC unsigned int luaS_hashlongstr (TString *ts); 46 | LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b); 47 | LUAI_FUNC void luaS_resize (lua_State *L, int newsize); 48 | LUAI_FUNC void luaS_clearcache (global_State *g); 49 | LUAI_FUNC void luaS_init (lua_State *L); 50 | LUAI_FUNC void luaS_remove (lua_State *L, TString *ts); 51 | LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, int nuvalue); 52 | LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); 53 | LUAI_FUNC TString *luaS_new (lua_State *L, const char *str); 54 | LUAI_FUNC TString *luaS_createlngstrobj (lua_State *L, size_t l); 55 | 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/ltable.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ltable.h $ 3 | ** Lua tables (hash) 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ltable_h 8 | #define ltable_h 9 | 10 | #include "lobject.h" 11 | 12 | 13 | #define gnode(t,i) (&(t)->node[i]) 14 | #define gval(n) (&(n)->i_val) 15 | #define gnext(n) ((n)->u.next) 16 | 17 | 18 | /* 19 | ** Clear all bits of fast-access metamethods, which means that the table 20 | ** may have any of these metamethods. (First access that fails after the 21 | ** clearing will set the bit again.) 22 | */ 23 | #define invalidateTMcache(t) ((t)->flags &= ~maskflags) 24 | 25 | 26 | /* true when 't' is using 'dummynode' as its hash part */ 27 | #define isdummy(t) ((t)->lastfree == NULL) 28 | 29 | 30 | /* allocated size for hash nodes */ 31 | #define allocsizenode(t) (isdummy(t) ? 0 : sizenode(t)) 32 | 33 | 34 | /* returns the Node, given the value of a table entry */ 35 | #define nodefromval(v) cast(Node *, (v)) 36 | 37 | 38 | LUAI_FUNC const TValue *luaH_getint (Table *t, lua_Integer key); 39 | LUAI_FUNC void luaH_setint (lua_State *L, Table *t, lua_Integer key, 40 | TValue *value); 41 | LUAI_FUNC const TValue *luaH_getshortstr (Table *t, TString *key); 42 | LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); 43 | LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); 44 | LUAI_FUNC void luaH_newkey (lua_State *L, Table *t, const TValue *key, 45 | TValue *value); 46 | LUAI_FUNC void luaH_set (lua_State *L, Table *t, const TValue *key, 47 | TValue *value); 48 | LUAI_FUNC void luaH_finishset (lua_State *L, Table *t, const TValue *key, 49 | const TValue *slot, TValue *value); 50 | LUAI_FUNC Table *luaH_new (lua_State *L); 51 | LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned int nasize, 52 | unsigned int nhsize); 53 | LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize); 54 | LUAI_FUNC void luaH_free (lua_State *L, Table *t); 55 | LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); 56 | LUAI_FUNC lua_Unsigned luaH_getn (Table *t); 57 | LUAI_FUNC unsigned int luaH_realasize (const Table *t); 58 | 59 | 60 | #if defined(LUA_DEBUG) 61 | LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); 62 | #endif 63 | 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/ltm.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ltm.h $ 3 | ** Tag methods 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ltm_h 8 | #define ltm_h 9 | 10 | 11 | #include "lobject.h" 12 | #include "lstate.h" 13 | 14 | 15 | /* 16 | * WARNING: if you change the order of this enumeration, 17 | * grep "ORDER TM" and "ORDER OP" 18 | */ 19 | typedef enum { 20 | TM_INDEX, 21 | TM_NEWINDEX, 22 | TM_GC, 23 | TM_MODE, 24 | TM_LEN, 25 | TM_EQ, /* last tag method with fast access */ 26 | TM_ADD, 27 | TM_SUB, 28 | TM_MUL, 29 | TM_MOD, 30 | TM_POW, 31 | TM_DIV, 32 | TM_IDIV, 33 | TM_BAND, 34 | TM_BOR, 35 | TM_BXOR, 36 | TM_SHL, 37 | TM_SHR, 38 | TM_UNM, 39 | TM_BNOT, 40 | TM_LT, 41 | TM_LE, 42 | TM_CONCAT, 43 | TM_CALL, 44 | TM_CLOSE, 45 | TM_N /* number of elements in the enum */ 46 | } TMS; 47 | 48 | 49 | /* 50 | ** Mask with 1 in all fast-access methods. A 1 in any of these bits 51 | ** in the flag of a (meta)table means the metatable does not have the 52 | ** corresponding metamethod field. (Bit 7 of the flag is used for 53 | ** 'isrealasize'.) 54 | */ 55 | #define maskflags (~(~0u << (TM_EQ + 1))) 56 | 57 | 58 | /* 59 | ** Test whether there is no tagmethod. 60 | ** (Because tagmethods use raw accesses, the result may be an "empty" nil.) 61 | */ 62 | #define notm(tm) ttisnil(tm) 63 | 64 | 65 | #define gfasttm(g,et,e) ((et) == NULL ? NULL : \ 66 | ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) 67 | 68 | #define fasttm(l,et,e) gfasttm(G(l), et, e) 69 | 70 | #define ttypename(x) luaT_typenames_[(x) + 1] 71 | 72 | LUAI_DDEC(const char *const luaT_typenames_[LUA_TOTALTYPES];) 73 | 74 | 75 | LUAI_FUNC const char *luaT_objtypename (lua_State *L, const TValue *o); 76 | 77 | LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); 78 | LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, 79 | TMS event); 80 | LUAI_FUNC void luaT_init (lua_State *L); 81 | 82 | LUAI_FUNC void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1, 83 | const TValue *p2, const TValue *p3); 84 | LUAI_FUNC void luaT_callTMres (lua_State *L, const TValue *f, 85 | const TValue *p1, const TValue *p2, StkId p3); 86 | LUAI_FUNC void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, 87 | StkId res, TMS event); 88 | LUAI_FUNC void luaT_tryconcatTM (lua_State *L); 89 | LUAI_FUNC void luaT_trybinassocTM (lua_State *L, const TValue *p1, 90 | const TValue *p2, int inv, StkId res, TMS event); 91 | LUAI_FUNC void luaT_trybiniTM (lua_State *L, const TValue *p1, lua_Integer i2, 92 | int inv, StkId res, TMS event); 93 | LUAI_FUNC int luaT_callorderTM (lua_State *L, const TValue *p1, 94 | const TValue *p2, TMS event); 95 | LUAI_FUNC int luaT_callorderiTM (lua_State *L, const TValue *p1, int v2, 96 | int inv, int isfloat, TMS event); 97 | 98 | LUAI_FUNC void luaT_adjustvarargs (lua_State *L, int nfixparams, 99 | CallInfo *ci, const Proto *p); 100 | LUAI_FUNC void luaT_getvarargs (lua_State *L, CallInfo *ci, 101 | StkId where, int wanted); 102 | 103 | 104 | #endif 105 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/lualib.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lualib.h $ 3 | ** Lua standard libraries 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #ifndef lualib_h 9 | #define lualib_h 10 | 11 | #include "lua.h" 12 | 13 | 14 | /* version suffix for environment variable names */ 15 | #define LUA_VERSUFFIX "_" LUA_VERSION_MAJOR "_" LUA_VERSION_MINOR 16 | 17 | 18 | LUAMOD_API int (luaopen_base) (lua_State *L); 19 | 20 | #define LUA_COLIBNAME "coroutine" 21 | LUAMOD_API int (luaopen_coroutine) (lua_State *L); 22 | 23 | #define LUA_TABLIBNAME "table" 24 | LUAMOD_API int (luaopen_table) (lua_State *L); 25 | 26 | #define LUA_IOLIBNAME "io" 27 | LUAMOD_API int (luaopen_io) (lua_State *L); 28 | 29 | #define LUA_OSLIBNAME "os" 30 | LUAMOD_API int (luaopen_os) (lua_State *L); 31 | 32 | #define LUA_STRLIBNAME "string" 33 | LUAMOD_API int (luaopen_string) (lua_State *L); 34 | 35 | #define LUA_UTF8LIBNAME "utf8" 36 | LUAMOD_API int (luaopen_utf8) (lua_State *L); 37 | 38 | #define LUA_MATHLIBNAME "math" 39 | LUAMOD_API int (luaopen_math) (lua_State *L); 40 | 41 | #define LUA_DBLIBNAME "debug" 42 | LUAMOD_API int (luaopen_debug) (lua_State *L); 43 | 44 | #define LUA_LOADLIBNAME "package" 45 | LUAMOD_API int (luaopen_package) (lua_State *L); 46 | 47 | 48 | /* open all previous libraries */ 49 | LUALIB_API void (luaL_openlibs) (lua_State *L); 50 | 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/lundump.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lundump.h $ 3 | ** load precompiled Lua chunks 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lundump_h 8 | #define lundump_h 9 | 10 | #include "llimits.h" 11 | #include "lobject.h" 12 | #include "lzio.h" 13 | 14 | 15 | /* data to catch conversion errors */ 16 | #define LUAC_DATA "\x19\x93\r\n\x1a\n" 17 | 18 | #define LUAC_INT 0x5678 19 | #define LUAC_NUM cast_num(370.5) 20 | 21 | /* 22 | ** Encode major-minor version in one byte, one nibble for each 23 | */ 24 | #define MYINT(s) (s[0]-'0') /* assume one-digit numerals */ 25 | #define LUAC_VERSION (MYINT(LUA_VERSION_MAJOR)*16+MYINT(LUA_VERSION_MINOR)) 26 | 27 | #define LUAC_FORMAT 0 /* this is the official format */ 28 | 29 | /* load one chunk; from lundump.c */ 30 | LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name); 31 | 32 | /* dump one chunk; from ldump.c */ 33 | LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, 34 | void* data, int strip); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/lzio.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lzio.c $ 3 | ** Buffered streams 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #define lzio_c 8 | #define LUA_CORE 9 | 10 | #include "lprefix.h" 11 | 12 | 13 | #include 14 | 15 | #include "lua.h" 16 | 17 | #include "llimits.h" 18 | #include "lmem.h" 19 | #include "lstate.h" 20 | #include "lzio.h" 21 | 22 | 23 | int luaZ_fill (ZIO *z) { 24 | size_t size; 25 | lua_State *L = z->L; 26 | const char *buff; 27 | lua_unlock(L); 28 | buff = z->reader(L, z->data, &size); 29 | lua_lock(L); 30 | if (buff == NULL || size == 0) 31 | return EOZ; 32 | z->n = size - 1; /* discount char being returned */ 33 | z->p = buff; 34 | return cast_uchar(*(z->p++)); 35 | } 36 | 37 | 38 | void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) { 39 | z->L = L; 40 | z->reader = reader; 41 | z->data = data; 42 | z->n = 0; 43 | z->p = NULL; 44 | } 45 | 46 | 47 | /* --------------------------------------------------------------- read --- */ 48 | size_t luaZ_read (ZIO *z, void *b, size_t n) { 49 | while (n) { 50 | size_t m; 51 | if (z->n == 0) { /* no bytes in buffer? */ 52 | if (luaZ_fill(z) == EOZ) /* try to read more */ 53 | return n; /* no more input; return number of missing bytes */ 54 | else { 55 | z->n++; /* luaZ_fill consumed first byte; put it back */ 56 | z->p--; 57 | } 58 | } 59 | m = (n <= z->n) ? n : z->n; /* min. between n and z->n */ 60 | memcpy(b, z->p, m); 61 | z->n -= m; 62 | z->p += m; 63 | b = (char *)b + m; 64 | n -= m; 65 | } 66 | return 0; 67 | } 68 | 69 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/lzio.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lzio.h $ 3 | ** Buffered streams 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #ifndef lzio_h 9 | #define lzio_h 10 | 11 | #include "lua.h" 12 | 13 | #include "lmem.h" 14 | 15 | 16 | #define EOZ (-1) /* end of stream */ 17 | 18 | typedef struct Zio ZIO; 19 | 20 | #define zgetc(z) (((z)->n--)>0 ? cast_uchar(*(z)->p++) : luaZ_fill(z)) 21 | 22 | 23 | typedef struct Mbuffer { 24 | char *buffer; 25 | size_t n; 26 | size_t buffsize; 27 | } Mbuffer; 28 | 29 | #define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) 30 | 31 | #define luaZ_buffer(buff) ((buff)->buffer) 32 | #define luaZ_sizebuffer(buff) ((buff)->buffsize) 33 | #define luaZ_bufflen(buff) ((buff)->n) 34 | 35 | #define luaZ_buffremove(buff,i) ((buff)->n -= (i)) 36 | #define luaZ_resetbuffer(buff) ((buff)->n = 0) 37 | 38 | 39 | #define luaZ_resizebuffer(L, buff, size) \ 40 | ((buff)->buffer = luaM_reallocvchar(L, (buff)->buffer, \ 41 | (buff)->buffsize, size), \ 42 | (buff)->buffsize = size) 43 | 44 | #define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) 45 | 46 | 47 | LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, 48 | void *data); 49 | LUAI_FUNC size_t luaZ_read (ZIO* z, void *b, size_t n); /* read next n bytes */ 50 | 51 | 52 | 53 | /* --------- Private Part ------------------ */ 54 | 55 | struct Zio { 56 | size_t n; /* bytes still unread */ 57 | const char *p; /* current position in buffer */ 58 | lua_Reader reader; /* reader function */ 59 | void *data; /* additional data */ 60 | lua_State *L; /* Lua state (for reader) */ 61 | }; 62 | 63 | 64 | LUAI_FUNC int luaZ_fill (ZIO *z); 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/onelua.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** Lua core, libraries, and interpreter in a single file. 3 | ** Compiling just this file generates a complete Lua stand-alone 4 | ** program: 5 | ** 6 | ** $ gcc -O2 -std=c99 -o lua onelua.c -lm 7 | ** 8 | ** or 9 | ** 10 | ** $ gcc -O2 -std=c89 -DLUA_USE_C89 -o lua onelua.c -lm 11 | ** 12 | */ 13 | 14 | /* default is to build the full interpreter */ 15 | #ifndef MAKE_LIB 16 | #ifndef MAKE_LUAC 17 | #ifndef MAKE_LUA 18 | #define MAKE_LUA 19 | #endif 20 | #endif 21 | #endif 22 | 23 | 24 | /* 25 | ** Choose suitable platform-specific features. Default is no 26 | ** platform-specific features. Some of these options may need extra 27 | ** libraries such as -ldl -lreadline -lncurses 28 | */ 29 | #if 0 30 | #define LUA_USE_LINUX 31 | #define LUA_USE_MACOSX 32 | #define LUA_USE_POSIX 33 | #define LUA_ANSI 34 | #endif 35 | 36 | 37 | /* no need to change anything below this line ----------------------------- */ 38 | 39 | #include "lprefix.h" 40 | 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | 57 | 58 | /* setup for luaconf.h */ 59 | #define LUA_CORE 60 | #define LUA_LIB 61 | #define ltable_c 62 | #define lvm_c 63 | #include "luaconf.h" 64 | 65 | /* do not export internal symbols */ 66 | #undef LUAI_FUNC 67 | #undef LUAI_DDEC 68 | #undef LUAI_DDEF 69 | #define LUAI_FUNC static 70 | #define LUAI_DDEC(def) /* empty */ 71 | #define LUAI_DDEF static 72 | 73 | /* core -- used by all */ 74 | #include "lzio.c" 75 | #include "lctype.c" 76 | #include "lopcodes.c" 77 | #include "lmem.c" 78 | #include "lundump.c" 79 | #include "ldump.c" 80 | #include "lstate.c" 81 | #include "lgc.c" 82 | #include "llex.c" 83 | #include "lcode.c" 84 | #include "lparser.c" 85 | #include "ldebug.c" 86 | #include "lfunc.c" 87 | #include "lobject.c" 88 | #include "ltm.c" 89 | #include "lstring.c" 90 | #include "ltable.c" 91 | #include "ldo.c" 92 | #include "lvm.c" 93 | #include "lapi.c" 94 | 95 | /* auxiliary library -- used by all */ 96 | #include "lauxlib.c" 97 | 98 | /* standard library -- not used by luac */ 99 | #ifndef MAKE_LUAC 100 | #include "lbaselib.c" 101 | #include "lcorolib.c" 102 | #include "ldblib.c" 103 | #include "liolib.c" 104 | #include "lmathlib.c" 105 | #include "loadlib.c" 106 | #include "loslib.c" 107 | #include "lstrlib.c" 108 | #include "ltablib.c" 109 | #include "lutf8lib.c" 110 | #include "linit.c" 111 | #endif 112 | 113 | /* lua */ 114 | #ifdef MAKE_LUA 115 | #include "lua.c" 116 | #endif 117 | 118 | /* luac */ 119 | #ifdef MAKE_LUAC 120 | #include "luac.c" 121 | #endif 122 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/testes/big.lua: -------------------------------------------------------------------------------- 1 | -- $Id: testes/big.lua $ 2 | -- See Copyright Notice in file all.lua 3 | 4 | if _soft then 5 | return 'a' 6 | end 7 | 8 | print "testing large tables" 9 | 10 | local debug = require"debug" 11 | 12 | local lim = 2^18 + 1000 13 | local prog = { "local y = {0" } 14 | for i = 1, lim do prog[#prog + 1] = i end 15 | prog[#prog + 1] = "}\n" 16 | prog[#prog + 1] = "X = y\n" 17 | prog[#prog + 1] = ("assert(X[%d] == %d)"):format(lim - 1, lim - 2) 18 | prog[#prog + 1] = "return 0" 19 | prog = table.concat(prog, ";") 20 | 21 | local env = {string = string, assert = assert} 22 | local f = assert(load(prog, nil, nil, env)) 23 | 24 | f() 25 | assert(env.X[lim] == lim - 1 and env.X[lim + 1] == lim) 26 | for k in pairs(env) do env[k] = undef end 27 | 28 | -- yields during accesses larger than K (in RK) 29 | setmetatable(env, { 30 | __index = function (t, n) coroutine.yield('g'); return _G[n] end, 31 | __newindex = function (t, n, v) coroutine.yield('s'); _G[n] = v end, 32 | }) 33 | 34 | X = nil 35 | local co = coroutine.wrap(f) 36 | assert(co() == 's') 37 | assert(co() == 'g') 38 | assert(co() == 'g') 39 | assert(co() == 0) 40 | 41 | assert(X[lim] == lim - 1 and X[lim + 1] == lim) 42 | 43 | -- errors in accesses larger than K (in RK) 44 | getmetatable(env).__index = function () end 45 | getmetatable(env).__newindex = function () end 46 | local e, m = pcall(f) 47 | assert(not e and m:find("global 'X'")) 48 | 49 | -- errors in metamethods 50 | getmetatable(env).__newindex = function () error("hi") end 51 | local e, m = xpcall(f, debug.traceback) 52 | assert(not e and m:find("'newindex'")) 53 | 54 | f, X = nil 55 | 56 | coroutine.yield'b' 57 | 58 | if 2^32 == 0 then -- (small integers) { 59 | 60 | print "testing string length overflow" 61 | 62 | local repstrings = 192 -- number of strings to be concatenated 63 | local ssize = math.ceil(2.0^32 / repstrings) + 1 -- size of each string 64 | 65 | assert(repstrings * ssize > 2.0^32) -- it should be larger than maximum size 66 | 67 | local longs = string.rep("\0", ssize) -- create one long string 68 | 69 | -- create function to concatenate 'repstrings' copies of its argument 70 | local rep = assert(load( 71 | "local a = ...; return " .. string.rep("a", repstrings, ".."))) 72 | 73 | local a, b = pcall(rep, longs) -- call that function 74 | 75 | -- it should fail without creating string (result would be too large) 76 | assert(not a and string.find(b, "overflow")) 77 | 78 | end -- } 79 | 80 | print'OK' 81 | 82 | return 'a' 83 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/testes/bwcoercion.lua: -------------------------------------------------------------------------------- 1 | local tonumber, tointeger = tonumber, math.tointeger 2 | local type, getmetatable, rawget, error = type, getmetatable, rawget, error 3 | local strsub = string.sub 4 | 5 | local print = print 6 | 7 | _ENV = nil 8 | 9 | -- Try to convert a value to an integer, without assuming any coercion. 10 | local function toint (x) 11 | x = tonumber(x) -- handle numerical strings 12 | if not x then 13 | return false -- not coercible to a number 14 | end 15 | return tointeger(x) 16 | end 17 | 18 | 19 | -- If operation fails, maybe second operand has a metamethod that should 20 | -- have been called if not for this string metamethod, so try to 21 | -- call it. 22 | local function trymt (x, y, mtname) 23 | if type(y) ~= "string" then -- avoid recalling original metamethod 24 | local mt = getmetatable(y) 25 | local mm = mt and rawget(mt, mtname) 26 | if mm then 27 | return mm(x, y) 28 | end 29 | end 30 | -- if any test fails, there is no other metamethod to be called 31 | error("attempt to '" .. strsub(mtname, 3) .. 32 | "' a " .. type(x) .. " with a " .. type(y), 4) 33 | end 34 | 35 | 36 | local function checkargs (x, y, mtname) 37 | local xi = toint(x) 38 | local yi = toint(y) 39 | if xi and yi then 40 | return xi, yi 41 | else 42 | return trymt(x, y, mtname), nil 43 | end 44 | end 45 | 46 | 47 | local smt = getmetatable("") 48 | 49 | smt.__band = function (x, y) 50 | local x, y = checkargs(x, y, "__band") 51 | return y and x & y or x 52 | end 53 | 54 | smt.__bor = function (x, y) 55 | local x, y = checkargs(x, y, "__bor") 56 | return y and x | y or x 57 | end 58 | 59 | smt.__bxor = function (x, y) 60 | local x, y = checkargs(x, y, "__bxor") 61 | return y and x ~ y or x 62 | end 63 | 64 | smt.__shl = function (x, y) 65 | local x, y = checkargs(x, y, "__shl") 66 | return y and x << y or x 67 | end 68 | 69 | smt.__shr = function (x, y) 70 | local x, y = checkargs(x, y, "__shr") 71 | return y and x >> y or x 72 | end 73 | 74 | smt.__bnot = function (x) 75 | local x, y = checkargs(x, x, "__bnot") 76 | return y and ~x or x 77 | end 78 | 79 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/testes/db.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/assarbad/msvc-undoc/138af4734840d078c585cffeec4d8daa63e337f7/InvokeCompilerPass/lua/testes/db.lua -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/testes/files.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/assarbad/msvc-undoc/138af4734840d078c585cffeec4d8daa63e337f7/InvokeCompilerPass/lua/testes/files.lua -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/testes/libs/P1/dummy: -------------------------------------------------------------------------------- 1 | # This is a dummy file just to make git keep the otherwise empty 2 | # directory 'P1' in the repository. 3 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/testes/libs/lib1.c: -------------------------------------------------------------------------------- 1 | #include "lua.h" 2 | #include "lauxlib.h" 3 | 4 | static int id (lua_State *L) { 5 | return lua_gettop(L); 6 | } 7 | 8 | 9 | static const struct luaL_Reg funcs[] = { 10 | {"id", id}, 11 | {NULL, NULL} 12 | }; 13 | 14 | 15 | /* function used by lib11.c */ 16 | LUAMOD_API int lib1_export (lua_State *L) { 17 | lua_pushstring(L, "exported"); 18 | return 1; 19 | } 20 | 21 | 22 | LUAMOD_API int onefunction (lua_State *L) { 23 | luaL_checkversion(L); 24 | lua_settop(L, 2); 25 | lua_pushvalue(L, 1); 26 | return 2; 27 | } 28 | 29 | 30 | LUAMOD_API int anotherfunc (lua_State *L) { 31 | luaL_checkversion(L); 32 | lua_pushfstring(L, "%d%%%d\n", (int)lua_tointeger(L, 1), 33 | (int)lua_tointeger(L, 2)); 34 | return 1; 35 | } 36 | 37 | 38 | LUAMOD_API int luaopen_lib1_sub (lua_State *L) { 39 | lua_setglobal(L, "y"); /* 2nd arg: extra value (file name) */ 40 | lua_setglobal(L, "x"); /* 1st arg: module name */ 41 | luaL_newlib(L, funcs); 42 | return 1; 43 | } 44 | 45 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/testes/libs/lib11.c: -------------------------------------------------------------------------------- 1 | #include "lua.h" 2 | 3 | /* function from lib1.c */ 4 | int lib1_export (lua_State *L); 5 | 6 | LUAMOD_API int luaopen_lib11 (lua_State *L) { 7 | return lib1_export(L); 8 | } 9 | 10 | 11 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/testes/libs/lib2.c: -------------------------------------------------------------------------------- 1 | #include "lua.h" 2 | #include "lauxlib.h" 3 | 4 | static int id (lua_State *L) { 5 | return lua_gettop(L); 6 | } 7 | 8 | 9 | static const struct luaL_Reg funcs[] = { 10 | {"id", id}, 11 | {NULL, NULL} 12 | }; 13 | 14 | 15 | LUAMOD_API int luaopen_lib2 (lua_State *L) { 16 | lua_settop(L, 2); 17 | lua_setglobal(L, "y"); /* y gets 2nd parameter */ 18 | lua_setglobal(L, "x"); /* x gets 1st parameter */ 19 | luaL_newlib(L, funcs); 20 | return 1; 21 | } 22 | 23 | 24 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/testes/libs/lib21.c: -------------------------------------------------------------------------------- 1 | #include "lua.h" 2 | 3 | 4 | int luaopen_lib2 (lua_State *L); 5 | 6 | LUAMOD_API int luaopen_lib21 (lua_State *L) { 7 | return luaopen_lib2(L); 8 | } 9 | 10 | 11 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/testes/libs/lib22.c: -------------------------------------------------------------------------------- 1 | #include "lua.h" 2 | #include "lauxlib.h" 3 | 4 | static int id (lua_State *L) { 5 | lua_pushboolean(L, 1); 6 | lua_insert(L, 1); 7 | return lua_gettop(L); 8 | } 9 | 10 | 11 | static const struct luaL_Reg funcs[] = { 12 | {"id", id}, 13 | {NULL, NULL} 14 | }; 15 | 16 | 17 | LUAMOD_API int luaopen_lib2 (lua_State *L) { 18 | lua_settop(L, 2); 19 | lua_setglobal(L, "y"); /* y gets 2nd parameter */ 20 | lua_setglobal(L, "x"); /* x gets 1st parameter */ 21 | luaL_newlib(L, funcs); 22 | return 1; 23 | } 24 | 25 | 26 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/testes/libs/makefile: -------------------------------------------------------------------------------- 1 | # change this variable to point to the directory with Lua headers 2 | # of the version being tested 3 | LUA_DIR = ../../ 4 | 5 | CC = gcc 6 | 7 | # compilation should generate Dynamic-Link Libraries 8 | CFLAGS = -Wall -std=gnu99 -O2 -I$(LUA_DIR) -fPIC -shared 9 | 10 | # libraries used by the tests 11 | all: lib1.so lib11.so lib2.so lib21.so lib2-v2.so 12 | touch all 13 | 14 | lib1.so: lib1.c $(LUA_DIR)/luaconf.h $(LUA_DIR)/lua.h 15 | $(CC) $(CFLAGS) -o lib1.so lib1.c 16 | 17 | lib11.so: lib11.c $(LUA_DIR)/luaconf.h $(LUA_DIR)/lua.h 18 | $(CC) $(CFLAGS) -o lib11.so lib11.c 19 | 20 | lib2.so: lib2.c $(LUA_DIR)/luaconf.h $(LUA_DIR)/lua.h 21 | $(CC) $(CFLAGS) -o lib2.so lib2.c 22 | 23 | lib21.so: lib21.c $(LUA_DIR)/luaconf.h $(LUA_DIR)/lua.h 24 | $(CC) $(CFLAGS) -o lib21.so lib21.c 25 | 26 | lib2-v2.so: lib21.c $(LUA_DIR)/luaconf.h $(LUA_DIR)/lua.h 27 | $(CC) $(CFLAGS) -o lib2-v2.so lib22.c 28 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/testes/packtests: -------------------------------------------------------------------------------- 1 | NAME=$1"-tests" 2 | 3 | ln -s . $NAME 4 | ln -s .. ltests 5 | 6 | tar --create --gzip --no-recursion --file=$NAME.tar.gz \ 7 | $NAME/all.lua \ 8 | $NAME/api.lua \ 9 | $NAME/attrib.lua \ 10 | $NAME/big.lua \ 11 | $NAME/bitwise.lua \ 12 | $NAME/bwcoercion.lua \ 13 | $NAME/calls.lua \ 14 | $NAME/closure.lua \ 15 | $NAME/code.lua \ 16 | $NAME/constructs.lua \ 17 | $NAME/coroutine.lua \ 18 | $NAME/cstack.lua \ 19 | $NAME/db.lua \ 20 | $NAME/errors.lua \ 21 | $NAME/events.lua \ 22 | $NAME/files.lua \ 23 | $NAME/gc.lua \ 24 | $NAME/gengc.lua \ 25 | $NAME/goto.lua \ 26 | $NAME/heavy.lua \ 27 | $NAME/literals.lua \ 28 | $NAME/locals.lua \ 29 | $NAME/main.lua \ 30 | $NAME/math.lua \ 31 | $NAME/nextvar.lua \ 32 | $NAME/pm.lua \ 33 | $NAME/sort.lua \ 34 | $NAME/strings.lua \ 35 | $NAME/tpack.lua \ 36 | $NAME/tracegc.lua \ 37 | $NAME/utf8.lua \ 38 | $NAME/vararg.lua \ 39 | $NAME/verybig.lua \ 40 | $NAME/libs/makefile \ 41 | $NAME/libs/P1 \ 42 | $NAME/libs/lib1.c \ 43 | $NAME/libs/lib11.c \ 44 | $NAME/libs/lib2.c \ 45 | $NAME/libs/lib21.c \ 46 | $NAME/libs/lib22.c \ 47 | $NAME/ltests/ltests.h \ 48 | $NAME/ltests/ltests.c 49 | 50 | \rm -I $NAME 51 | \rm -I ltests 52 | 53 | echo ${NAME}.tar.gz" created" 54 | 55 | 56 | -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/testes/pm.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/assarbad/msvc-undoc/138af4734840d078c585cffeec4d8daa63e337f7/InvokeCompilerPass/lua/testes/pm.lua -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/testes/sort.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/assarbad/msvc-undoc/138af4734840d078c585cffeec4d8daa63e337f7/InvokeCompilerPass/lua/testes/sort.lua -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/testes/strings.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/assarbad/msvc-undoc/138af4734840d078c585cffeec4d8daa63e337f7/InvokeCompilerPass/lua/testes/strings.lua -------------------------------------------------------------------------------- /InvokeCompilerPass/lua/testes/tracegc.lua: -------------------------------------------------------------------------------- 1 | -- track collections 2 | 3 | local M = {} 4 | 5 | -- import list 6 | local setmetatable, stderr, collectgarbage = 7 | setmetatable, io.stderr, collectgarbage 8 | 9 | _ENV = nil 10 | 11 | local active = false 12 | 13 | 14 | -- each time a table is collected, remark it for finalization on next 15 | -- cycle 16 | local mt = {} 17 | function mt.__gc (o) 18 | stderr:write'.' -- mark progress 19 | if active then 20 | setmetatable(o, mt) -- remark object for finalization 21 | end 22 | end 23 | 24 | 25 | function M.start () 26 | if not active then 27 | active = true 28 | setmetatable({}, mt) -- create initial object 29 | end 30 | end 31 | 32 | 33 | function M.stop () 34 | if active then 35 | active = false 36 | collectgarbage() -- call finalizer for the last time 37 | end 38 | end 39 | 40 | return M 41 | -------------------------------------------------------------------------------- /InvokeCompilerPass/luaall.c: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: Unlicense 2 | #pragma warning(push) 3 | #pragma warning(disable : 4244) 4 | #pragma warning(disable : 4267) 5 | #pragma warning(disable : 4310) 6 | #pragma warning(disable : 4324) 7 | #pragma warning(disable : 4334) 8 | #pragma warning(disable : 4701) 9 | #pragma warning(disable : 4702) 10 | #pragma warning(disable : 4996) 11 | // #include "lua/onelua.c" 12 | #define MAKE_LIB // just in case this is used somewhere in the included files 13 | 14 | #include "lprefix.h" 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | /* setup for luaconf.h */ 33 | #define LUA_CORE 34 | #define LUA_LIB 35 | #define ltable_c 36 | #define lvm_c 37 | #include "luaconf.h" 38 | 39 | /* do not export internal symbols */ 40 | #undef LUAI_FUNC 41 | #undef LUAI_DDEC 42 | #undef LUAI_DDEF 43 | #define LUAI_FUNC static 44 | #define LUAI_DDEC(def) /* empty */ 45 | #define LUAI_DDEF static 46 | 47 | /* core -- used by all */ 48 | #include "lzio.c" 49 | #include "lctype.c" 50 | #include "lopcodes.c" 51 | #include "lmem.c" 52 | #include "lundump.c" 53 | #include "ldump.c" 54 | #include "lstate.c" 55 | #include "lgc.c" 56 | #include "llex.c" 57 | #include "lcode.c" 58 | #include "lparser.c" 59 | #include "ldebug.c" 60 | #include "lfunc.c" 61 | #include "lobject.c" 62 | #include "ltm.c" 63 | #include "lstring.c" 64 | #include "ltable.c" 65 | #include "ldo.c" 66 | #include "lvm.c" 67 | #include "lapi.c" 68 | 69 | /* auxiliary library -- used by all */ 70 | #include "lauxlib.c" 71 | 72 | /* standard library -- not used by luac */ 73 | #include "lbaselib.c" 74 | // #include "lcorolib.c" 75 | #include "ldblib.c" 76 | #include "liolib.c" 77 | #include "lmathlib.c" 78 | // #include "loadlib.c" 79 | // #include "loslib.c" 80 | #include "lstrlib.c" 81 | #include "ltablib.c" 82 | #include "lutf8lib.c" 83 | // #include "linit.c" 84 | static const luaL_Reg loadedlibs[] = {{LUA_GNAME, luaopen_base}, 85 | {LUA_TABLIBNAME, luaopen_table}, 86 | {LUA_IOLIBNAME, luaopen_io}, 87 | {LUA_STRLIBNAME, luaopen_string}, 88 | {LUA_MATHLIBNAME, luaopen_math}, 89 | {LUA_UTF8LIBNAME, luaopen_utf8}, 90 | {LUA_DBLIBNAME, luaopen_debug}, 91 | {NULL, NULL}}; 92 | 93 | LUALIB_API void luaL_openlibs(lua_State* L) 94 | { 95 | const luaL_Reg* lib; 96 | /* "require" functions from 'loadedlibs' and set results to global table */ 97 | for (lib = loadedlibs; lib->func; lib++) 98 | { 99 | luaL_requiref(L, lib->name, lib->func, 1); 100 | lua_pop(L, 1); /* remove lib */ 101 | } 102 | } 103 | #pragma warning(pop) 104 | -------------------------------------------------------------------------------- /InvokeCompilerPass/project.early.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <_PropertySheetDisplayName>Project-specific overrides (early) 5 | false 6 | Static 7 | 8 | 9 | -------------------------------------------------------------------------------- /InvokeCompilerPass/utfcpp/.clang-format: -------------------------------------------------------------------------------- 1 | DisableFormat: true 2 | -------------------------------------------------------------------------------- /InvokeCompilerPass/utfcpp/source/utf8.h: -------------------------------------------------------------------------------- 1 | // Copyright 2006 Nemanja Trifunovic 2 | 3 | /* 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | 28 | #ifndef UTF8_FOR_CPP_2675DCD0_9480_4c0c_B92A_CC14C027B731 29 | #define UTF8_FOR_CPP_2675DCD0_9480_4c0c_B92A_CC14C027B731 30 | 31 | #include "utf8/checked.h" 32 | #include "utf8/unchecked.h" 33 | 34 | #endif // header guard 35 | -------------------------------------------------------------------------------- /InvokeCompilerPass/utfcpp/source/utf8/cpp17.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Nemanja Trifunovic 2 | 3 | /* 4 | Permission is hereby granted, free of charge, to any person or organization 5 | obtaining a copy of the software and accompanying documentation covered by 6 | this license (the "Software") to use, reproduce, display, distribute, 7 | execute, and transmit the Software, and to prepare derivative works of the 8 | Software, and to permit third-parties to whom the Software is furnished to 9 | do so, all subject to the following: 10 | 11 | The copyright notices in the Software and this entire statement, including 12 | the above license grant, this restriction and the following disclaimer, 13 | must be included in all copies of the Software, in whole or in part, and 14 | all derivative works of the Software, unless such copies or derivative 15 | works are solely in the form of machine-executable object code generated by 16 | a source language processor. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | 28 | #ifndef UTF8_FOR_CPP_7e906c01_03a3_4daf_b420_ea7ea952b3c9 29 | #define UTF8_FOR_CPP_7e906c01_03a3_4daf_b420_ea7ea952b3c9 30 | 31 | #include "checked.h" 32 | #include 33 | 34 | namespace utf8 35 | { 36 | 37 | inline void append(char32_t cp, std::string& s) 38 | { 39 | append(uint32_t(cp), std::back_inserter(s)); 40 | } 41 | 42 | inline std::string utf16to8(std::u16string_view s) 43 | { 44 | std::string result; 45 | utf16to8(s.begin(), s.end(), std::back_inserter(result)); 46 | return result; 47 | } 48 | 49 | inline std::u16string utf8to16(std::string_view s) 50 | { 51 | std::u16string result; 52 | utf8to16(s.begin(), s.end(), std::back_inserter(result)); 53 | return result; 54 | } 55 | 56 | inline std::string utf32to8(std::u32string_view s) 57 | { 58 | std::string result; 59 | utf32to8(s.begin(), s.end(), std::back_inserter(result)); 60 | return result; 61 | } 62 | 63 | inline std::u32string utf8to32(std::string_view s) 64 | { 65 | std::u32string result; 66 | utf8to32(s.begin(), s.end(), std::back_inserter(result)); 67 | return result; 68 | } 69 | 70 | inline std::size_t find_invalid(std::string_view s) 71 | { 72 | std::string_view::const_iterator invalid = find_invalid(s.begin(), s.end()); 73 | return (invalid == s.end()) ? std::string_view::npos : static_cast(invalid - s.begin()); 74 | } 75 | 76 | inline bool is_valid(std::string_view s) 77 | { 78 | return is_valid(s.begin(), s.end()); 79 | } 80 | 81 | inline std::string replace_invalid(std::string_view s, char32_t replacement) 82 | { 83 | std::string result; 84 | replace_invalid(s.begin(), s.end(), std::back_inserter(result), replacement); 85 | return result; 86 | } 87 | 88 | inline std::string replace_invalid(std::string_view s) 89 | { 90 | std::string result; 91 | replace_invalid(s.begin(), s.end(), std::back_inserter(result)); 92 | return result; 93 | } 94 | 95 | inline bool starts_with_bom(std::string_view s) 96 | { 97 | return starts_with_bom(s.begin(), s.end()); 98 | } 99 | 100 | } // namespace utf8 101 | 102 | #endif // header guard 103 | 104 | -------------------------------------------------------------------------------- /NOTES.md: -------------------------------------------------------------------------------- 1 | # Some random stuff 2 | 3 | * `c2switch_t` holds the details of switches ("cmd") parsed by `c2.dll`: struct differs from `c1.dll` and `c1xx.dll` 4 | * first field is the offset to a `wchar_t*` containing the canonical form of the switch 5 | * second field is the offset to the storage of whatever gets set 6 | * ... 7 | * `c1switch_t` seems to be the same struct for `c1.dll` and `c1xx.dll` 8 | * first field is the offset to a `char*` containing the canonical form of the switch 9 | * second field is the offset to the storage of whatever gets set (or a callback function, depending on the type 10 | * third field (offs 0x10) could be the `x` from `/dx` (e.g. `/d1`) 11 | * fourth fields (offs 0x11) appears to indicate the type: 12 | * 1: `bool` (1 byte) 13 | * 5: `bool` (1 byte) inverted 14 | * 0xA: some callback function 15 | * 0x22: C string, i.e. `char*` 16 | * 0x24: `unsigned int*` ??? 17 | * 0x26: list of `char*` ??? 18 | * 0x29: some callback function 19 | 20 | * `/d1...` switches correspond to `c1*.dll` I _think_ 21 | * `/d2...` switches correspond to `c2.dll` I _think_ 22 | * `DummyFlag` and `DummyString` exist to catch stuff that was probably supported in the past but is now only handled for compat.? 23 | -------------------------------------------------------------------------------- /UNLICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /help-output/14.29.30133-16.11.30/Hostx64/arm/armasm.exe-14.29.30152.0.txt: -------------------------------------------------------------------------------- 1 | Microsoft (R) ARM Macro Assembler Version 14.29.30152.0 2 | Copyright (C) Microsoft Corporation. All rights reserved. 3 | 4 | Usage: armasm [] sourcefile objectfile 5 | armasm [] -o objectfile sourcefile 6 | armasm -h for help 7 | 8 | : (Upper case shows allowable abbreviation) 9 | -Errors errorsfile redirect stderr diagnostics to errorsfile 10 | -I dir[;dir] add dirs to include search path 11 | -PreDefine directive pre-execute a SET{L,A,S} directive 12 | -NOWarn turn off warning messages 13 | -ignore don't report warning-num 14 | -oldit generate pre-ARMv8 IT blocks 15 | -help help (this information) 16 | -via read further arguments from 17 | -machine set the PE machine type field 18 | -16 assemble source as 16 bit Thumb instructions 19 | -32 assemble source as 32 bit ARM instructions 20 | -coff_thumb2_only allow only Thumb-2 code 21 | -g generate debugging info 22 | -gh:SHA_256 use SHA256 for file checksum in debug info (experimental) 23 | -errorReport: