diff options
author | chai <chaifix@163.com> | 2018-12-07 20:16:33 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-12-07 20:16:33 +0800 |
commit | a059088c90fafb9ef21840db338f6bd04023b096 (patch) | |
tree | 00d2a75f1237011209fe79f3422da9fcb8e39b53 | |
parent | f065d7884d353c3545535850e4e8bdf8e10025ca (diff) |
-rw-r--r-- | .gitignore | 21 | ||||
-rw-r--r-- | build/vs/Tests/Test/Test.vcxproj | 138 | ||||
-rw-r--r-- | build/vs/Tests/Test/Test.vcxproj.filters | 6 | ||||
-rw-r--r-- | build/vs/Tests/Test/Test.vcxproj.user | 4 | ||||
-rw-r--r-- | build/vs/lua51/lua51.vcxproj | 188 | ||||
-rw-r--r-- | build/vs/lua51/lua51.vcxproj.filters | 64 | ||||
-rw-r--r-- | build/vs/lua51/lua51.vcxproj.user | 4 | ||||
-rw-r--r-- | build/vs/luax/luax.sln | 59 | ||||
-rw-r--r-- | build/vs/luax/luax.vcxproj | 139 | ||||
-rw-r--r-- | build/vs/luax/luax.vcxproj.filters | 17 | ||||
-rw-r--r-- | build/vs/luax/luax.vcxproj.user | 4 | ||||
-rw-r--r-- | src/luax.h | 340 | ||||
-rw-r--r-- | src/luax_object.h | 19 | ||||
-rw-r--r-- | src/luax_runtime.h | 11 | ||||
-rw-r--r-- | src/luax_state.cpp | 8 | ||||
-rw-r--r-- | src/luax_state.h | 27 | ||||
-rw-r--r-- | tests/main.cpp | 22 |
17 files changed, 740 insertions, 331 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f943d9f --- /dev/null +++ b/.gitignore @@ -0,0 +1,21 @@ + +*.ilk +*.pdb +*.lib +*.exp +*.obj +*.tlog +*.lastbuildstate +*.log +*.ipch +*.idb +*.res +*.db +*.suo +*.opendb +*.db-shm +*.db-wal +*.iobj +*.ipdb +*.sbr +*.bsc diff --git a/build/vs/Tests/Test/Test.vcxproj b/build/vs/Tests/Test/Test.vcxproj new file mode 100644 index 0000000..990932b --- /dev/null +++ b/build/vs/Tests/Test/Test.vcxproj @@ -0,0 +1,138 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <VCProjectVersion>15.0</VCProjectVersion> + <ProjectGuid>{CF3E2490-ECD1-4E73-8507-8255B757DBAC}</ProjectGuid> + <RootNamespace>Test</RootNamespace> + <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="Shared"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>$(SolutionDir)..\..\..\..\bin</OutDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>$(SolutionDir)..\..\..\..\bin</OutDir> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + <AdditionalIncludeDirectories>$(ProjectDir)..\..\..\..\src;$(ProjectDir)..\..\..\..\libs\lua-5.1.5\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + <AdditionalIncludeDirectories>$(ProjectDir)..\..\..\..\src;$(ProjectDir)..\..\..\..\libs\lua-5.1.5\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + <Link> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\..\tests\main.cpp" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\lua51\lua51.vcxproj"> + <Project>{a5d20e8f-8105-414f-8b84-1d389fc6628d}</Project> + </ProjectReference> + <ProjectReference Include="..\..\luax\luax.vcxproj"> + <Project>{d2570cc8-74b4-4eec-a03a-990ea0f0ea6f}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/build/vs/Tests/Test/Test.vcxproj.filters b/build/vs/Tests/Test/Test.vcxproj.filters new file mode 100644 index 0000000..8f3de10 --- /dev/null +++ b/build/vs/Tests/Test/Test.vcxproj.filters @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <ClCompile Include="..\..\..\..\tests\main.cpp" /> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/build/vs/Tests/Test/Test.vcxproj.user b/build/vs/Tests/Test/Test.vcxproj.user new file mode 100644 index 0000000..be25078 --- /dev/null +++ b/build/vs/Tests/Test/Test.vcxproj.user @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup /> +</Project>
\ No newline at end of file diff --git a/build/vs/lua51/lua51.vcxproj b/build/vs/lua51/lua51.vcxproj new file mode 100644 index 0000000..988b9c5 --- /dev/null +++ b/build/vs/lua51/lua51.vcxproj @@ -0,0 +1,188 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <VCProjectVersion>15.0</VCProjectVersion> + <ProjectGuid>{A5D20E8F-8105-414F-8B84-1D389FC6628D}</ProjectGuid> + <RootNamespace>lua51</RootNamespace> + <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="Shared"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>$(SolutionDir)..\..\..\..\bin</OutDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>$(SolutionDir)..\..\..\..\bin</OutDir> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + </ClCompile> + <Link> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + <Link> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lapi.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lauxlib.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lbaselib.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lcode.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\ldblib.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\ldebug.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\ldo.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\ldump.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lfunc.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lgc.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\linit.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\liolib.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\llex.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lmathlib.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lmem.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\loadlib.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lobject.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lopcodes.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\loslib.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lparser.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lstate.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lstring.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lstrlib.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\ltable.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\ltablib.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\ltm.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\luac.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lundump.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lvm.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lzio.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\print.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lapi.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lauxlib.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lcode.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\ldebug.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\ldo.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lfunc.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lgc.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\llex.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\llimits.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lmem.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lobject.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lopcodes.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lparser.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lstate.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lstring.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\ltable.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\ltm.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lua.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\luaconf.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lualib.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lundump.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lvm.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lzio.h" /> + </ItemGroup> + <ItemGroup> + <None Include="..\..\..\libs\lua-5.1.5\src\Makefile" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/build/vs/lua51/lua51.vcxproj.filters b/build/vs/lua51/lua51.vcxproj.filters new file mode 100644 index 0000000..889613c --- /dev/null +++ b/build/vs/lua51/lua51.vcxproj.filters @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lapi.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lauxlib.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lbaselib.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lcode.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\ldblib.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\ldebug.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\ldo.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\ldump.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lfunc.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lgc.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\linit.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\liolib.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\llex.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lmathlib.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lmem.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\loadlib.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lobject.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lopcodes.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\loslib.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lparser.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lstate.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lstring.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lstrlib.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\ltable.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\ltablib.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\ltm.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\luac.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lundump.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lvm.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\lzio.c" /> + <ClCompile Include="..\..\..\libs\lua-5.1.5\src\print.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lapi.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lauxlib.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lcode.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\ldebug.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\ldo.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lfunc.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lgc.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\llex.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\llimits.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lmem.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lobject.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lopcodes.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lparser.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lstate.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lstring.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\ltable.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\ltm.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lua.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\luaconf.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lualib.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lundump.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lvm.h" /> + <ClInclude Include="..\..\..\libs\lua-5.1.5\src\lzio.h" /> + </ItemGroup> + <ItemGroup> + <None Include="..\..\..\libs\lua-5.1.5\src\Makefile" /> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/build/vs/lua51/lua51.vcxproj.user b/build/vs/lua51/lua51.vcxproj.user new file mode 100644 index 0000000..be25078 --- /dev/null +++ b/build/vs/lua51/lua51.vcxproj.user @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup /> +</Project>
\ No newline at end of file diff --git a/build/vs/luax/luax.sln b/build/vs/luax/luax.sln new file mode 100644 index 0000000..bf9bbbe --- /dev/null +++ b/build/vs/luax/luax.sln @@ -0,0 +1,59 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27703.2047 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "luax", "luax.vcxproj", "{D2570CC8-74B4-4EEC-A03A-990EA0F0EA6F}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lua", "Lua", "{C11B7F81-3690-4CDD-ACC0-F26635BAFB75}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lua51", "..\lua51\lua51.vcxproj", "{A5D20E8F-8105-414F-8B84-1D389FC6628D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{66261502-0FB8-41DE-A4BC-6F44C29A1E5D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test", "..\Tests\Test\Test.vcxproj", "{CF3E2490-ECD1-4E73-8507-8255B757DBAC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D2570CC8-74B4-4EEC-A03A-990EA0F0EA6F}.Debug|x64.ActiveCfg = Debug|x64 + {D2570CC8-74B4-4EEC-A03A-990EA0F0EA6F}.Debug|x64.Build.0 = Debug|x64 + {D2570CC8-74B4-4EEC-A03A-990EA0F0EA6F}.Debug|x86.ActiveCfg = Debug|Win32 + {D2570CC8-74B4-4EEC-A03A-990EA0F0EA6F}.Debug|x86.Build.0 = Debug|Win32 + {D2570CC8-74B4-4EEC-A03A-990EA0F0EA6F}.Release|x64.ActiveCfg = Release|x64 + {D2570CC8-74B4-4EEC-A03A-990EA0F0EA6F}.Release|x64.Build.0 = Release|x64 + {D2570CC8-74B4-4EEC-A03A-990EA0F0EA6F}.Release|x86.ActiveCfg = Release|Win32 + {D2570CC8-74B4-4EEC-A03A-990EA0F0EA6F}.Release|x86.Build.0 = Release|Win32 + {A5D20E8F-8105-414F-8B84-1D389FC6628D}.Debug|x64.ActiveCfg = Debug|x64 + {A5D20E8F-8105-414F-8B84-1D389FC6628D}.Debug|x64.Build.0 = Debug|x64 + {A5D20E8F-8105-414F-8B84-1D389FC6628D}.Debug|x86.ActiveCfg = Debug|Win32 + {A5D20E8F-8105-414F-8B84-1D389FC6628D}.Debug|x86.Build.0 = Debug|Win32 + {A5D20E8F-8105-414F-8B84-1D389FC6628D}.Release|x64.ActiveCfg = Release|x64 + {A5D20E8F-8105-414F-8B84-1D389FC6628D}.Release|x64.Build.0 = Release|x64 + {A5D20E8F-8105-414F-8B84-1D389FC6628D}.Release|x86.ActiveCfg = Release|Win32 + {A5D20E8F-8105-414F-8B84-1D389FC6628D}.Release|x86.Build.0 = Release|Win32 + {CF3E2490-ECD1-4E73-8507-8255B757DBAC}.Debug|x64.ActiveCfg = Debug|x64 + {CF3E2490-ECD1-4E73-8507-8255B757DBAC}.Debug|x64.Build.0 = Debug|x64 + {CF3E2490-ECD1-4E73-8507-8255B757DBAC}.Debug|x86.ActiveCfg = Debug|Win32 + {CF3E2490-ECD1-4E73-8507-8255B757DBAC}.Debug|x86.Build.0 = Debug|Win32 + {CF3E2490-ECD1-4E73-8507-8255B757DBAC}.Release|x64.ActiveCfg = Release|x64 + {CF3E2490-ECD1-4E73-8507-8255B757DBAC}.Release|x64.Build.0 = Release|x64 + {CF3E2490-ECD1-4E73-8507-8255B757DBAC}.Release|x86.ActiveCfg = Release|Win32 + {CF3E2490-ECD1-4E73-8507-8255B757DBAC}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {A5D20E8F-8105-414F-8B84-1D389FC6628D} = {C11B7F81-3690-4CDD-ACC0-F26635BAFB75} + {CF3E2490-ECD1-4E73-8507-8255B757DBAC} = {66261502-0FB8-41DE-A4BC-6F44C29A1E5D} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C0B44CC5-3D2B-4C59-A0DE-10B9D7DF57A0} + EndGlobalSection +EndGlobal diff --git a/build/vs/luax/luax.vcxproj b/build/vs/luax/luax.vcxproj new file mode 100644 index 0000000..7f86401 --- /dev/null +++ b/build/vs/luax/luax.vcxproj @@ -0,0 +1,139 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <VCProjectVersion>15.0</VCProjectVersion> + <ProjectGuid>{D2570CC8-74B4-4EEC-A03A-990EA0F0EA6F}</ProjectGuid> + <RootNamespace>luax</RootNamespace> + <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>StaticLibrary</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="Shared"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>$(SolutionDir)..\..\..\..\bin</OutDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>$(SolutionDir)..\..\..\..\bin</OutDir> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + <Link> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <SDLCheck>true</SDLCheck> + <ConformanceMode>true</ConformanceMode> + </ClCompile> + <Link> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\..\src\luax.cpp" /> + <ClCompile Include="..\..\..\src\luax_object.cpp" /> + <ClCompile Include="..\..\..\src\luax_ref.cpp" /> + <ClCompile Include="..\..\..\src\luax_runtime.cpp" /> + <ClCompile Include="..\..\..\src\luax_state.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\src\luax.h" /> + <ClInclude Include="..\..\..\src\luax_object.h" /> + <ClInclude Include="..\..\..\src\luax_ref.h" /> + <ClInclude Include="..\..\..\src\luax_runtime.h" /> + <ClInclude Include="..\..\..\src\luax_state.h" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/build/vs/luax/luax.vcxproj.filters b/build/vs/luax/luax.vcxproj.filters new file mode 100644 index 0000000..698a6bc --- /dev/null +++ b/build/vs/luax/luax.vcxproj.filters @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <ClCompile Include="..\..\..\src\luax.cpp" /> + <ClCompile Include="..\..\..\src\luax_object.cpp" /> + <ClCompile Include="..\..\..\src\luax_ref.cpp" /> + <ClCompile Include="..\..\..\src\luax_runtime.cpp" /> + <ClCompile Include="..\..\..\src\luax_state.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\src\luax.h" /> + <ClInclude Include="..\..\..\src\luax_object.h" /> + <ClInclude Include="..\..\..\src\luax_ref.h" /> + <ClInclude Include="..\..\..\src\luax_runtime.h" /> + <ClInclude Include="..\..\..\src\luax_state.h" /> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/build/vs/luax/luax.vcxproj.user b/build/vs/luax/luax.vcxproj.user new file mode 100644 index 0000000..be25078 --- /dev/null +++ b/build/vs/luax/luax.vcxproj.user @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup /> +</Project>
\ No newline at end of file @@ -1,335 +1,13 @@ -/** -* Copyright (C) 2018 chai -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is furnished -* to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all -* copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A -* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ -/** -* include following 3 files before this -* lua.h -* lauxlib.h -* lualib.h -*/ -#ifndef __LUAX_H -#define __LUAX_H -// for lua 5.1 -#if LUA_VERSION_NUM == 501 +#ifndef __LUAX_H__ +#define __LUAX_H__ -#define LUAX_VERSION "0.1.0" +// Pre declaration. +struct lua_State; -#define luax_newstate luaL_newstate -#define luax_openlibs luaL_openlibs -// load chunk but dont run it -#define luax_loadbuffer luaL_loadbuffer -#define luax_pcall lua_pcall -#define luax_setglobal lua_setglobal -#define luax_pop lua_pop -#define luax_newtable lua_newtable - -/** -* -*/ -#define luax_setglobal_string(L, n, v) (lua_pushstring(L, v), lua_setglobal(L, n)) - -/** -* Get number of args -*/ -#define luax_gettop lua_gettop - -#define luax_gettable lua_gettable - -/** -* Check userdata type. -*/ -#define luax_checktype luaL_checkudata -#define luax_checknumber luaL_checknumber -#define luax_checkinteger luaL_checkinteger -#define luax_checkstring luaL_checkstring -#define luax_checkbool luaL_checkinteger -//bool luax_checkbool(lua_State *L, int numArg) -//{ -// bool b = false; -// if (lua_type(L, numArg) == LUA_TBOOLEAN) -// { -// b = lua_toboolean(L, numArg); -// } -// else -// { -// luaL_typerror(L, numArg, lua_typename(L, LUA_TBOOLEAN)); -// } -// return b; -//} - -/** -* Oprating tables. -*/ -#define luax_rawgetnumber(L, i, k) (lua_rawgeti(L,i, k), lua_tonumber(L, -1)) - -/** -* -*/ -#define luax_typerror luaL_typerror - - -/** -* Error checking -*/ -#define luax_error luaL_error - -/** -* Push value on the top of stack. -*/ -#define luax_pushnumber lua_pushnumber -#define luax_pushstring lua_pushstring -#define luax_pushinteger lua_pushinteger -#define luax_pushboolean lua_pushboolean - -#define luax_rawseti lua_rawseti - -/** -* Set field -*/ -#define luax_setfield lua_setfield -#define luax_setfield_(T, L, k, v)\ - do { lua_push##T(L, v); lua_setfield(L, -2, k); } while (0) - -#define luax_setfield_number(L, k, v) luax_setfield_(number, L, k, v) -#define luax_setfield_string(L, k, v) luax_setfield_(string, L, k, v) -#define luax_setfield_bool(L, k, v) luax_setfield_(boolean, L, k, v) -#define luax_setfield_udata(L, k, v) luax_setfield_(lightuserdata, L, k, v) -#define luax_setfield_cfunc(L, k, v) luax_setfield_(cfunction, L, k, v) -#define luax_setfield_fstring(L, k, ...)\ - do { lua_pushfstring(L, __VA_ARGS__); lua_setfield(L, -2, k); } while (0) - -/** -* If nosuch field push a nil at the top of stack. -*/ -#define luax_getfield(L, I, N) lua_getfield(L, I, N) -inline float luax_getfield_number(lua_State* L, int I, const char* N) -{ - luax_getfield(L, I, N); - float n = luax_checknumber(L, -1); - return n; -} -inline int luax_getfield_integer(lua_State* L, int I, const char* N) -{ - luax_getfield(L, I, N); - int bin = luax_checkinteger(L, -1); - return bin; -} -inline const char* luax_getfield_string(lua_State* L, int I, const char* N) -{ - luax_getfield(L, I, N); - const char* str = luax_checkstring(L, -1); - return str; -} -inline char luax_getfield_bool(lua_State* L, int I, const char* N) -{ - luax_getfield(L, I, N); - char bin = lua_toboolean(L, -1); - return bin; -} - -/** -* Set raw -*/ -#define luax_setraw_(T, L, idx, i, v)\ - (lua_push##T(L, v), lua_rawseti(L, idx, i)) - -#define luax_setraw_string(L, idx, i, v) luax_setraw_(string, L, idx, i, v) -#define luax_setraw_number(L, idx, i, v) luax_setraw_(number, L, idx, i, v) -#define luax_setraw_bool(L, idx, i, v) luax_setraw_(boolean, L, idx, i, v) - -/** -* -*/ -#define luax_optboolean(L, i, x)\ - (!lua_isnoneornil(L, i) ? lua_toboolean(L, i) : (x)) -#define luax_optudata(L, i, name, x)\ - (!lua_isnoneornil(L, i) ? luaL_checkudata(L, i, name) : (x)) -#define luax_optnumber luaL_optnumber - -inline int luax_newlib(lua_State* L, const luaL_Reg* f) -{ - lua_createtable(L, 0, sizeof(f)); - for (; f && f->name; ++f) - { - lua_pushcfunction(L, f->func); - lua_setfield(L, -2, f->name); - } - return 1; // leave lib table on top of stack -} - -/** -* Register a userdefined lua type with given type name. -*/ -inline void luax_newtype(lua_State* L, const char* tname, const luaL_Reg* f) -{ - luaL_newmetatable(L, tname); - - // m.__index = m - lua_pushvalue(L, -1); - lua_setfield(L, -2, "__index"); - - if (f != 0) - luaL_register(L, 0, f); - - lua_pop(L, 1); // Pops metatable. -} - -/** -* Instance of a type. -*/ -inline void* luax_newinstance(lua_State* L, const char* tname, int size) -{ - void* p = lua_newuserdata(L, size); - - luaL_newmetatable(L, tname); - lua_setmetatable(L, -2); - - return p; -} - -/** -* require a module -*/ -inline int luax_require(lua_State* L, const char* mname, lua_CFunction openf, int glb) -{ - openf(L); - if (glb) - { - lua_setglobal(L, mname); - return 0; - } - return 1; -} - -/** -* Return 1 if match. -*/ -inline int luax_istype(lua_State* L, int idx, const char* tname) -{ - if (lua_getmetatable(L, idx)) - { - /* get metatable called tname */ - lua_getfield(L, LUA_REGISTRYINDEX, tname); - if (lua_rawequal(L, -1, -2)) - { - lua_pop(L, 2); // pop both metatables - return 1; - } - lua_pop(L, 2); - return 0; - } - /* value at idx has no metatable */ - return 0; -} - -#define luax_is(T, L, i) (lua_is##T(L, i)) -#define luax_isnumber(L, i) luax_is(number, L, i) -#define luax_isstring(L, i) luax_is(string, L, i) -#define luax_istable(L, i) luax_is(table, L, i) -#define luax_isnil(L, i) luax_is(nil, L, i) -/** -* To userdata. -*/ -inline void* luax_toudata(lua_State* L, int idx) -{ - void* p = lua_touserdata(L, idx); - if (p == NULL) - luaL_typerror(L, idx, "userdata"); // if p is not userdata - return p; -} - -/** -* Get table index size. -*/ -inline int luax_tableidxlen(lua_State* L, int i) -{ - return lua_objlen(L, i); -} - -/** -* Get table hash size -inline int luax_tbalehashlen(lua_State* L, int i) -{ - -} -*/ - -/** -* Get table hash and index size -inline int luax_tablelen(lua_State* L, int i) -{ - -} -*/ - -/** -* Set value i in stack a global value called v, and -* don't pop it. -*/ -#define luax_justglobal(L, i, v) (lua_pushvalue(L, i), lua_setglobal(L, v)) - -inline int luax_table_insert(lua_State * L, int tindex, int vindex, int pos) -{ - if (tindex < 0) - tindex = lua_gettop(L) + 1 + tindex; - if (vindex < 0) - vindex = lua_gettop(L) + 1 + vindex; - if (pos == -1) - { - lua_pushvalue(L, vindex); - lua_rawseti(L, tindex, lua_objlen(L, tindex) + 1); - return 0; - } - else if (pos < 0) - pos = lua_objlen(L, tindex) + 1 + pos; - for (int i = lua_objlen(L, tindex) + 1; i > pos; --i) - { - lua_rawgeti(L, tindex, i - 1); - lua_rawseti(L, tindex, i); - } - lua_pushvalue(L, vindex); - lua_rawseti(L, tindex, pos); - return 0; -} - -/** -* Add the package loader to the package.loaders table. -*/ -inline int luax_register_searcher(lua_State * L, lua_CFunction f, int pos) -{ - lua_getglobal(L, "package"); - - if (lua_isnil(L, -1)) - return luaL_error(L, "Can't register searcher: package table does not exist."); - - lua_getfield(L, -1, "loaders"); - - if (lua_isnil(L, -1)) - return luaL_error(L, "Can't register searcher: package.loaders table does not exist."); - - lua_pushcfunction(L, f); - luax_table_insert(L, -2, -1, pos); - lua_pop(L, 3); - return 0; -} - -#endif +// include lua.hpp before this +#include "luax_runtime.h" +#include "luax_state.h" +#include "luax_ref.h" +#include "luax_object.h" #endif
\ No newline at end of file diff --git a/src/luax_object.h b/src/luax_object.h index e69de29..b16a3bb 100644 --- a/src/luax_object.h +++ b/src/luax_object.h @@ -0,0 +1,19 @@ +#ifndef __LUAX_OBJECT_H__ +#define __LUAX_OBJECT_H__ + +#include <vector> + +namespace Luax +{ + + class LuaxObject + { + public: + + private: + + }; + +} + +#endif
\ No newline at end of file diff --git a/src/luax_runtime.h b/src/luax_runtime.h index e69de29..a0dbea3 100644 --- a/src/luax_runtime.h +++ b/src/luax_runtime.h @@ -0,0 +1,11 @@ +#ifndef __LUAX_RUNTIME_H__ +#define __LUAX_RUNTIME_H__ + +namespace Luax +{ + + + +} + +#endif
\ No newline at end of file diff --git a/src/luax_state.cpp b/src/luax_state.cpp index e69de29..3fc1645 100644 --- a/src/luax_state.cpp +++ b/src/luax_state.cpp @@ -0,0 +1,8 @@ +//#include "luax_state.h" + +namespace Luax +{ + + + +}
\ No newline at end of file diff --git a/src/luax_state.h b/src/luax_state.h index e69de29..1f80fda 100644 --- a/src/luax_state.h +++ b/src/luax_state.h @@ -0,0 +1,27 @@ +#ifndef __LUAX_STATE_H__ +#define __LUAX_STATE_H__ + +namespace Luax +{ + + class LuaxState + { + public: + LuaxState(lua_State* state); + ~LuaxState(); + + operator lua_State*(); + operator bool(); + inline lua_State* operator ->() { return mState; }; + inline lua_State& operator *() { return *mState; }; + + private: + void* operator new(size_t size); + + lua_State* mState; + + }; + +} + +#endif
\ No newline at end of file diff --git a/tests/main.cpp b/tests/main.cpp new file mode 100644 index 0000000..f82897f --- /dev/null +++ b/tests/main.cpp @@ -0,0 +1,22 @@ +extern "C" { +#include "lua.h" +#include "lualib.h" +#include "lauxlib.h" +} +#include "luax.h" + +using namespace Luax; + +class Player : public LuaxObject +{ +public: + + +}; + +int main() +{ + lua_State* L = luaL_newstate(); + LuaxState state(L); + +}
\ No newline at end of file |