Initial commit
This commit is contained in:
commit
f3de9e31d8
25 changed files with 1014 additions and 0 deletions
BIN
Release/CL.read.1.tlog
Normal file
BIN
Release/CL.read.1.tlog
Normal file
Binary file not shown.
BIN
Release/CL.write.1.tlog
Normal file
BIN
Release/CL.write.1.tlog
Normal file
Binary file not shown.
BIN
Release/cl.command.1.tlog
Normal file
BIN
Release/cl.command.1.tlog
Normal file
Binary file not shown.
10
Release/gmcl_jack_win32.dll.intermediate.manifest
Normal file
10
Release/gmcl_jack_win32.dll.intermediate.manifest
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
|
||||||
|
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
|
||||||
|
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<security>
|
||||||
|
<requestedPrivileges>
|
||||||
|
<requestedExecutionLevel level='asInvoker' uiAccess='false' />
|
||||||
|
</requestedPrivileges>
|
||||||
|
</security>
|
||||||
|
</trustInfo>
|
||||||
|
</assembly>
|
||||||
2
Release/gmcl_jack_win32.lastbuildstate
Normal file
2
Release/gmcl_jack_win32.lastbuildstate
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
#v4.0:v100:false
|
||||||
|
Release|Win32|D:\GMHax\|
|
||||||
29
Release/gmcl_jack_win32.log
Normal file
29
Release/gmcl_jack_win32.log
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
Build started 09.05.2017 1:38:12.
|
||||||
|
1>Project "D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj" on node 2 (build target(s)).
|
||||||
|
1>InitializeBuildStatus:
|
||||||
|
Creating "Release\gmcl_jack_win32.unsuccessfulbuild" because "AlwaysCreate" was specified.
|
||||||
|
ClCompile:
|
||||||
|
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /Zi /nologo /W3 /WX- /O2 /Oi /Oy- /GL /D _WINDLL /D _MBCS /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Release\\" /Fd"Release\vc100.pdb" /Gd /TP /analyze- /errorReport:prompt state.cpp
|
||||||
|
state.cpp
|
||||||
|
1>state.cpp(116): warning C4996: 'vsnprintf': This function or variable may be unsafe. Consider using vsnprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
|
||||||
|
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(354): см. объявление "vsnprintf"
|
||||||
|
1>state.cpp(140): warning C4800: int: принудительно задано логическое значение "true" или "false" (предупреждение о производительности)
|
||||||
|
1>state.cpp(325): warning C4996: '_snprintf': This function or variable may be unsafe. Consider using _snprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
|
||||||
|
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(363): см. объявление "_snprintf"
|
||||||
|
Link:
|
||||||
|
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"D:\GMHax\Release\gmcl_jack_win32.dll" /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /ManifestFile:"Release\gmcl_jack_win32.dll.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"D:\GMHax\Release\gmcl_jack_win32.pdb" /OPT:REF /OPT:ICF /LTCG /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"D:\GMHax\Release\gmcl_jack_win32.lib" /MACHINE:X86 /DLL Release\main.obj
|
||||||
|
Release\state.obj
|
||||||
|
Создается библиотека D:\GMHax\Release\gmcl_jack_win32.lib и объект D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
Создание кода
|
||||||
|
Создание кода завершено
|
||||||
|
gmcl_jack_win32.vcxproj -> D:\GMHax\Release\gmcl_jack_win32.dll
|
||||||
|
Manifest:
|
||||||
|
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\mt.exe /nologo /verbose /outputresource:"D:\GMHax\Release\gmcl_jack_win32.dll;#2" /manifest Release\gmcl_jack_win32.dll.intermediate.manifest
|
||||||
|
FinalizeBuildStatus:
|
||||||
|
Deleting file "Release\gmcl_jack_win32.unsuccessfulbuild".
|
||||||
|
Touching "Release\gmcl_jack_win32.lastbuildstate".
|
||||||
|
1>Done Building Project "D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj" (build target(s)).
|
||||||
|
|
||||||
|
Построение успешно завершено.
|
||||||
|
|
||||||
|
Time Elapsed 00:00:02.79
|
||||||
BIN
Release/gmcl_jack_win32.vcxprojResolveAssemblyReference.cache
Normal file
BIN
Release/gmcl_jack_win32.vcxprojResolveAssemblyReference.cache
Normal file
Binary file not shown.
135
Release/gmcl_jack_win32.write.1.tlog
Normal file
135
Release/gmcl_jack_win32.write.1.tlog
Normal file
|
|
@ -0,0 +1,135 @@
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
^D:\GMHax\gmcl_jack_win32\gmcl_jack_win32.vcxproj
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.lib
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
|
D:\GMHax\Release\gmcl_jack_win32.exp
|
||||||
BIN
Release/link.command.1.tlog
Normal file
BIN
Release/link.command.1.tlog
Normal file
Binary file not shown.
BIN
Release/link.read.1.tlog
Normal file
BIN
Release/link.read.1.tlog
Normal file
Binary file not shown.
BIN
Release/link.write.1.tlog
Normal file
BIN
Release/link.write.1.tlog
Normal file
Binary file not shown.
BIN
Release/main.obj
Normal file
BIN
Release/main.obj
Normal file
Binary file not shown.
BIN
Release/mt.command.1.tlog
Normal file
BIN
Release/mt.command.1.tlog
Normal file
Binary file not shown.
BIN
Release/mt.read.1.tlog
Normal file
BIN
Release/mt.read.1.tlog
Normal file
Binary file not shown.
BIN
Release/mt.write.1.tlog
Normal file
BIN
Release/mt.write.1.tlog
Normal file
Binary file not shown.
BIN
Release/state.obj
Normal file
BIN
Release/state.obj
Normal file
Binary file not shown.
BIN
Release/vc100.pdb
Normal file
BIN
Release/vc100.pdb
Normal file
Binary file not shown.
74
gmcl_jack_win32.vcxproj
Normal file
74
gmcl_jack_win32.vcxproj
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.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>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>{14BE7A2F-5B95-442B-9650-391727398D18}</ProjectGuid>
|
||||||
|
<RootNamespace>gmcl_jack_win32</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>MultiByte</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</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>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="main.cpp" />
|
||||||
|
<ClCompile Include="state.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="interface.h" />
|
||||||
|
<ClInclude Include="lua.h" />
|
||||||
|
<ClInclude Include="state.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
36
gmcl_jack_win32.vcxproj.filters
Normal file
36
gmcl_jack_win32.vcxproj.filters
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Файлы исходного кода">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Заголовочные файлы">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Файлы ресурсов">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="main.cpp">
|
||||||
|
<Filter>Файлы исходного кода</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="state.cpp">
|
||||||
|
<Filter>Файлы исходного кода</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="lua.h">
|
||||||
|
<Filter>Заголовочные файлы</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="state.h">
|
||||||
|
<Filter>Заголовочные файлы</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="interface.h">
|
||||||
|
<Filter>Заголовочные файлы</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
3
gmcl_jack_win32.vcxproj.user
Normal file
3
gmcl_jack_win32.vcxproj.user
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
</Project>
|
||||||
37
interface.h
Normal file
37
interface.h
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
#ifndef __INTERFACE_H
|
||||||
|
#define __INTERFACE_H
|
||||||
|
|
||||||
|
#include "lua.h"
|
||||||
|
#include "state.h"
|
||||||
|
|
||||||
|
class CLuaInterface;
|
||||||
|
|
||||||
|
class CLuaShared
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void** vtable;
|
||||||
|
char tmp[88];
|
||||||
|
CLuaInterface* m_pClient;
|
||||||
|
CLuaInterface* m_pServer;
|
||||||
|
CLuaInterface* m_pMenu;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CLuaInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void** vtable;
|
||||||
|
CLuaState* m_pState;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifndef DLL_EXPORT
|
||||||
|
#if defined(__GCC__)
|
||||||
|
#define DLL_EXPORT __attribute__((dllexport))
|
||||||
|
#elif defined (_MSC_VER)
|
||||||
|
#define DLL_EXPORT __declspec(dllexport)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define GMOD_MODULE_OPEN() extern "C" DLL_EXPORT int gmod13_open(CLuaState* L)
|
||||||
|
#define GMOD_MODULE_CLOSE() extern "C" DLL_EXPORT int gmod13_close(CLuaState* L)
|
||||||
|
|
||||||
|
#endif
|
||||||
87
lua.h
Normal file
87
lua.h
Normal file
|
|
@ -0,0 +1,87 @@
|
||||||
|
#ifndef __LUA_H
|
||||||
|
#define __LUA_H
|
||||||
|
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#define LUA_REGISTRYINDEX (-10000)
|
||||||
|
#define LUA_ENVIRONINDEX (-10001)
|
||||||
|
#define LUA_GLOBALSINDEX (-10002)
|
||||||
|
|
||||||
|
class CLuaState;
|
||||||
|
typedef int (*CLuaFunction)(CLuaState*);
|
||||||
|
|
||||||
|
typedef int (*lua_type) (CLuaState *L, int idx);
|
||||||
|
typedef const char *(*lua_typename) (CLuaState *L, int tp);
|
||||||
|
|
||||||
|
typedef int (*lua_gettop) (CLuaState *L);
|
||||||
|
typedef void (*lua_settop) (CLuaState *L, int idx);
|
||||||
|
typedef void (*lua_pushvalue) (CLuaState *L, int idx);
|
||||||
|
|
||||||
|
typedef double (*lua_tonumber) (CLuaState *L, int idx);
|
||||||
|
typedef int (*lua_toboolean) (CLuaState *L, int idx);
|
||||||
|
typedef const char *(*lua_tolstring) (CLuaState *L, int idx, size_t *len);
|
||||||
|
typedef CLuaFunction (*lua_tocfunction) (CLuaState *L, int idx);
|
||||||
|
typedef void *(*lua_touserdata) (CLuaState *L, int idx);
|
||||||
|
typedef CLuaState *(*lua_tothread) (CLuaState *L, int idx);
|
||||||
|
typedef const void *(*lua_topointer) (CLuaState *L, int idx);
|
||||||
|
|
||||||
|
typedef void (*lua_pushnil) (CLuaState *L);
|
||||||
|
typedef void (*lua_pushnumber) (CLuaState *L, double n);
|
||||||
|
typedef void (*lua_pushlstring) (CLuaState *L, const char *s, size_t l);
|
||||||
|
typedef void (*lua_pushcclosure) (CLuaState *L, CLuaFunction fn, int n);
|
||||||
|
typedef void (*lua_pushboolean) (CLuaState *L, int b);
|
||||||
|
typedef void (*lua_pushlightuserdata) (CLuaState *L, void *p);
|
||||||
|
typedef int (*lua_pushthread) (CLuaState *L);
|
||||||
|
|
||||||
|
typedef void (*lua_gettable) (CLuaState *L, int idx);
|
||||||
|
typedef void (*lua_getfield) (CLuaState *L, int idx, const char *k);
|
||||||
|
typedef void (*lua_rawget) (CLuaState *L, int idx);
|
||||||
|
typedef void (*lua_rawgeti) (CLuaState *L, int idx, int n);
|
||||||
|
typedef void (*lua_createtable) (CLuaState *L, int narr, int nrec);
|
||||||
|
typedef void *(*lua_newuserdata) (CLuaState *L, size_t sz);
|
||||||
|
typedef int (*lua_getmetatable) (CLuaState *L, int objindex);
|
||||||
|
typedef void (*lua_getfenv) (CLuaState *L, int idx);
|
||||||
|
|
||||||
|
typedef void (*lua_settable) (CLuaState *L, int idx);
|
||||||
|
typedef void (*lua_setfield) (CLuaState *L, int idx, const char *k);
|
||||||
|
typedef void (*lua_rawset) (CLuaState *L, int idx);
|
||||||
|
typedef void (*lua_rawseti) (CLuaState *L, int idx, int n);
|
||||||
|
typedef int (*lua_setmetatable) (CLuaState *L, int objindex);
|
||||||
|
typedef int (*lua_setfenv) (CLuaState *L, int idx);
|
||||||
|
|
||||||
|
typedef void (*lua_call) (CLuaState *L, int nargs, int nresults);
|
||||||
|
typedef int (*lua_pcall) (CLuaState *L, int nargs, int nresults, int errfunc);
|
||||||
|
|
||||||
|
typedef int (*luaL_loadbufferx)(CLuaState *L, const char *buff,
|
||||||
|
size_t sz,const char *name,const char* mode);
|
||||||
|
typedef int (*luaL_newmetatable) (CLuaState *L, const char *tname);
|
||||||
|
typedef void (*luaL_checktype) (CLuaState *L, int narg, int t);
|
||||||
|
typedef size_t (*lua_objlen) (CLuaState *L, int idx);
|
||||||
|
typedef void (*lua_pushinteger)(CLuaState *L, int n);
|
||||||
|
typedef int (*lua_tointeger)(CLuaState* L,int idx);
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
OK = 0,
|
||||||
|
YIELD,
|
||||||
|
ERRRUN,
|
||||||
|
ERRSYNTAX,
|
||||||
|
ERRMEM,
|
||||||
|
ERRERR
|
||||||
|
} ret_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
NONE = -1,
|
||||||
|
NIL,
|
||||||
|
TBOOLEAN,
|
||||||
|
LIGHTUSERDATA,
|
||||||
|
NUMBER,
|
||||||
|
STRING,
|
||||||
|
TABLE,
|
||||||
|
FUNCTION,
|
||||||
|
USERDATA,
|
||||||
|
THREAD,
|
||||||
|
} luatype_t;
|
||||||
|
|
||||||
|
#endif
|
||||||
156
main.cpp
Normal file
156
main.cpp
Normal file
|
|
@ -0,0 +1,156 @@
|
||||||
|
#include <Windows.h>
|
||||||
|
#include "interface.h"
|
||||||
|
|
||||||
|
#define BALL_NAME "luaL_Ball"
|
||||||
|
#define BALL_TYPE 195
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int mass;
|
||||||
|
int speed;
|
||||||
|
} ball_t;
|
||||||
|
|
||||||
|
int refId;
|
||||||
|
|
||||||
|
int TestFunc(CLuaState* L)
|
||||||
|
{
|
||||||
|
L->PushString("Hello World!");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CallBack(CLuaState* L)
|
||||||
|
{
|
||||||
|
L->CheckType(1,FUNCTION);
|
||||||
|
L->CheckType(2,NUMBER);
|
||||||
|
int n = L->GetNumber(2);
|
||||||
|
|
||||||
|
L->Push(1);
|
||||||
|
L->Call(0,n);
|
||||||
|
L->Pop(n);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CreateBall(CLuaState* L)
|
||||||
|
{
|
||||||
|
L->CheckType(1,NUMBER);
|
||||||
|
L->CheckType(2,NUMBER);
|
||||||
|
ball_t* pBall = new ball_t;
|
||||||
|
|
||||||
|
pBall->mass = L->GetNumber(1);
|
||||||
|
pBall->speed = L->GetNumber(2);
|
||||||
|
|
||||||
|
userdata_t* pData = L->NewUserData();
|
||||||
|
pData->data = pBall;
|
||||||
|
pData->type = BALL_TYPE;
|
||||||
|
|
||||||
|
L->GetMetaFromRegistry(BALL_NAME);
|
||||||
|
L->SetMetaTable(-2);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ball_t* CheckBall(CLuaState* L,int idx)
|
||||||
|
{
|
||||||
|
userdata_t* pData = L->GetUserData(idx);
|
||||||
|
if(pData->type == BALL_TYPE)
|
||||||
|
return (ball_t*)pData->data;
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ball_tostring(CLuaState* L)
|
||||||
|
{
|
||||||
|
ball_t* pBall = CheckBall(L,1);
|
||||||
|
if(!pBall)
|
||||||
|
L->PushString("pBall = NULL");
|
||||||
|
else
|
||||||
|
L->PushFString("[Ball with mass %d and speed %d]",pBall->mass,pBall->speed);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ball_eq(CLuaState *L)
|
||||||
|
{
|
||||||
|
ball_t* pBall1 = CheckBall(L,1),*pBall2 = CheckBall(L,2);
|
||||||
|
L->PushBool(((pBall1->mass == pBall2->mass) && (pBall1->speed == pBall2->speed)));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ball_add(CLuaState *L)
|
||||||
|
{
|
||||||
|
ball_t* pBall1 = CheckBall(L,1),*pBall2 = CheckBall(L,2);
|
||||||
|
|
||||||
|
L->PushCFunction(CreateBall);
|
||||||
|
L->PushNumber(pBall1->mass + pBall2->mass);
|
||||||
|
L->PushNumber(pBall1->speed + pBall2->speed);
|
||||||
|
L->Call(2,1);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ball_gc(CLuaState* L)
|
||||||
|
{
|
||||||
|
ball_t* pBall = CheckBall(L,1);
|
||||||
|
delete pBall;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ball_increment(CLuaState* L)
|
||||||
|
{
|
||||||
|
ball_t* pBall = CheckBall(L,1);
|
||||||
|
pBall->mass++;
|
||||||
|
pBall->speed++;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
GMOD_MODULE_OPEN()
|
||||||
|
{
|
||||||
|
L->CreateMetaTable(BALL_NAME);
|
||||||
|
|
||||||
|
L->PushCFunction(ball_tostring);
|
||||||
|
L->SetField(-2,"__tostring");
|
||||||
|
|
||||||
|
L->PushCFunction(ball_eq);
|
||||||
|
L->SetField(-2,"__eq");
|
||||||
|
|
||||||
|
L->PushCFunction(ball_gc);
|
||||||
|
L->SetField(-2,"__gc");
|
||||||
|
|
||||||
|
L->PushCFunction(ball_add);
|
||||||
|
L->SetField(-2,"__add");
|
||||||
|
|
||||||
|
L->PushCFunction(ball_increment);
|
||||||
|
L->SetField(-2,"Increment");
|
||||||
|
|
||||||
|
L->Push(-1);
|
||||||
|
L->SetField(-2,"__index");
|
||||||
|
|
||||||
|
L->CreateTable();
|
||||||
|
|
||||||
|
L->PushCFunction(TestFunc);
|
||||||
|
L->SetField(-2,"TestFunc");
|
||||||
|
|
||||||
|
L->PushCFunction(CallBack);
|
||||||
|
L->SetField(-2,"CallBack");
|
||||||
|
|
||||||
|
L->PushCFunction(CreateBall);
|
||||||
|
L->SetField(-2,"CreateBall");
|
||||||
|
|
||||||
|
L->SetGlobal("jack");
|
||||||
|
|
||||||
|
L->PushString("Hello World!");
|
||||||
|
refId = L->ReferenceCreate();
|
||||||
|
L->Print("Reference ID: %d",refId);
|
||||||
|
|
||||||
|
L->GetGlobal("print");
|
||||||
|
L->ReferencePush(refId);
|
||||||
|
L->Call(1,0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
GMOD_MODULE_CLOSE()
|
||||||
|
{
|
||||||
|
L->ReferenceFree(refId);
|
||||||
|
|
||||||
|
L->PushNil();
|
||||||
|
L->SetGlobal("jack");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
343
state.cpp
Normal file
343
state.cpp
Normal file
|
|
@ -0,0 +1,343 @@
|
||||||
|
#include "state.h"
|
||||||
|
|
||||||
|
func_t lua_api[] = {
|
||||||
|
{"lua_gettop",NULL}, //0
|
||||||
|
{"lua_settop",NULL}, //1
|
||||||
|
{"lua_pushvalue",NULL}, //2
|
||||||
|
{"lua_tonumber",NULL}, //3
|
||||||
|
{"lua_toboolean",NULL}, //4
|
||||||
|
{"lua_tolstring",NULL}, //5
|
||||||
|
{"lua_tocfunction",NULL}, //6
|
||||||
|
{"lua_touserdata",NULL}, //7
|
||||||
|
{"lua_tothread",NULL}, //8
|
||||||
|
{"lua_topointer",NULL}, //9
|
||||||
|
{"lua_pushnil",NULL}, //10
|
||||||
|
{"lua_pushnumber",NULL}, //11
|
||||||
|
{"lua_pushlstring",NULL}, //12
|
||||||
|
{"lua_pushcclosure",NULL}, //13
|
||||||
|
{"lua_pushboolean",NULL}, //14
|
||||||
|
{"lua_pushlightuserdata",NULL}, //15
|
||||||
|
{"lua_pushthread",NULL}, //16
|
||||||
|
{"lua_gettable",NULL}, //17
|
||||||
|
{"lua_getfield",NULL}, //18
|
||||||
|
{"lua_rawget",NULL}, //19
|
||||||
|
{"lua_rawgeti",NULL}, //20
|
||||||
|
{"lua_createtable",NULL}, //21
|
||||||
|
{"lua_getmetatable",NULL}, //22
|
||||||
|
{"lua_newuserdata",NULL}, //23
|
||||||
|
{"lua_getfenv",NULL}, //24
|
||||||
|
{"lua_settable",NULL}, //25
|
||||||
|
{"lua_setfield",NULL}, //26
|
||||||
|
{"lua_rawset",NULL}, //27
|
||||||
|
{"lua_rawseti",NULL}, //28
|
||||||
|
{"lua_setmetatable",NULL}, //29
|
||||||
|
{"lua_setfenv",NULL}, //30
|
||||||
|
{"lua_call",NULL}, //31
|
||||||
|
{"lua_pcall",NULL}, //32
|
||||||
|
{"luaL_loadbufferx",NULL}, //33
|
||||||
|
{"luaL_newmetatable",NULL}, //34
|
||||||
|
{"lua_type",NULL}, //35
|
||||||
|
{"lua_typename",NULL}, //36
|
||||||
|
{"luaL_checktype",NULL}, //37
|
||||||
|
{"lua_objlen",NULL}, //38
|
||||||
|
{"lua_pushinteger",NULL}, //39
|
||||||
|
{"lua_tointeger",NULL}, //40
|
||||||
|
{NULL,NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
CLuaState::CLuaState()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CLuaState::~CLuaState()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaState::GetTop()
|
||||||
|
{
|
||||||
|
return (((lua_gettop)lua_api[0].ptr))(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::SetTop(int n)
|
||||||
|
{
|
||||||
|
(((lua_settop)lua_api[1].ptr))(this,n);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::SetField(int idx,const char* name)
|
||||||
|
{
|
||||||
|
(((lua_setfield)lua_api[26].ptr))(this,idx,name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::GetField(int idx,const char* name)
|
||||||
|
{
|
||||||
|
(((lua_getfield)lua_api[18].ptr))(this,idx,name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::Push(int idx)
|
||||||
|
{
|
||||||
|
(((lua_pushvalue)lua_api[2].ptr))(this,idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::PushNil()
|
||||||
|
{
|
||||||
|
(((lua_pushnil)lua_api[10].ptr))(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::PushBool(bool val)
|
||||||
|
{
|
||||||
|
(((lua_pushboolean)lua_api[14].ptr))(this,val);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::PushNumber(double num)
|
||||||
|
{
|
||||||
|
(((lua_pushnumber)lua_api[11].ptr))(this,num);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::PushInteger(int n)
|
||||||
|
{
|
||||||
|
(((lua_pushinteger)lua_api[39].ptr))(this,n);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::PushCClosure(CLuaFunction fn,int n)
|
||||||
|
{
|
||||||
|
(((lua_pushcclosure)lua_api[13].ptr))(this,fn,n);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::PushString(const char* str,size_t len)
|
||||||
|
{
|
||||||
|
if(!len)
|
||||||
|
len = strlen(str);
|
||||||
|
(((lua_pushlstring)lua_api[12].ptr))(this,str,len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::PushVString(const char* fmt,va_list ap)
|
||||||
|
{
|
||||||
|
char buf[512];
|
||||||
|
vsnprintf(buf,512,fmt,ap);
|
||||||
|
PushString(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::PushFString(const char* fmt,...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap,fmt);
|
||||||
|
PushVString(fmt,ap);
|
||||||
|
va_end(ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::PushLightUserData(void* p)
|
||||||
|
{
|
||||||
|
(((lua_pushlightuserdata)lua_api[15].ptr))(this,p);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::PushThread(CLuaState* L)
|
||||||
|
{
|
||||||
|
(((lua_pushthread)lua_api[16].ptr))(L);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CLuaState::GetBool(int idx)
|
||||||
|
{
|
||||||
|
return (((lua_toboolean)lua_api[4].ptr))(this,idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
double CLuaState::GetNumber(int idx)
|
||||||
|
{
|
||||||
|
return (((lua_tonumber)lua_api[3].ptr))(this,idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaState::GetInteger(int idx)
|
||||||
|
{
|
||||||
|
return (((lua_tointeger)lua_api[40].ptr))(this,idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* CLuaState::GetString(int idx,size_t* len)
|
||||||
|
{
|
||||||
|
return (((lua_tolstring)lua_api[5].ptr))(this,idx,len);
|
||||||
|
}
|
||||||
|
|
||||||
|
userdata_t* CLuaState::GetUserData(int idx)
|
||||||
|
{
|
||||||
|
return (userdata_t*)(((lua_touserdata)lua_api[7].ptr))(this,idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
CLuaFunction CLuaState::GetCFunction(int idx)
|
||||||
|
{
|
||||||
|
return (((lua_tocfunction)lua_api[6].ptr))(this,idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
CLuaState* CLuaState::GetThread(int idx)
|
||||||
|
{
|
||||||
|
return (((lua_tothread)lua_api[8].ptr))(this,idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
const void* CLuaState::GetPointer(int idx)
|
||||||
|
{
|
||||||
|
return (((lua_topointer)lua_api[9].ptr))(this,idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::CreateTable()
|
||||||
|
{
|
||||||
|
(((lua_createtable)lua_api[21].ptr))(this,0,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::GetTable(int idx)
|
||||||
|
{
|
||||||
|
(((lua_gettable)lua_api[17].ptr))(this,idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::SetTable(int idx)
|
||||||
|
{
|
||||||
|
(((lua_settable)lua_api[25].ptr))(this,idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::RawGet(int idx)
|
||||||
|
{
|
||||||
|
(((lua_rawget)lua_api[19].ptr))(this,idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::RawGeti(int idx,int n)
|
||||||
|
{
|
||||||
|
(((lua_rawgeti)lua_api[20].ptr))(this,idx,n);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::RawSet(int idx)
|
||||||
|
{
|
||||||
|
(((lua_rawset)lua_api[27].ptr))(this,idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::RawSeti(int idx,int n)
|
||||||
|
{
|
||||||
|
(((lua_rawseti)lua_api[28].ptr))(this,idx,n);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::GetEnvironment(int idx)
|
||||||
|
{
|
||||||
|
(((lua_getfenv)lua_api[24].ptr))(this,idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::SetEnvironment(int idx)
|
||||||
|
{
|
||||||
|
(((lua_setfenv)lua_api[30].ptr))(this,idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
userdata_t* CLuaState::NewUserData()
|
||||||
|
{
|
||||||
|
return (userdata_t*)(((lua_newuserdata)lua_api[23].ptr))(this,sizeof(userdata_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::CreateMetaTable(const char* name)
|
||||||
|
{
|
||||||
|
(((luaL_newmetatable)lua_api[34].ptr))(this,name);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaState::GetMetaTable(int idx)
|
||||||
|
{
|
||||||
|
return (((lua_getmetatable)lua_api[22].ptr))(this,idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaState::SetMetaTable(int idx)
|
||||||
|
{
|
||||||
|
return (((lua_setmetatable)lua_api[29].ptr))(this,idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
luatype_t CLuaState::Type(int idx)
|
||||||
|
{
|
||||||
|
return (luatype_t)(((lua_type)lua_api[35].ptr))(this,idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* CLuaState::TypeName(int idx)
|
||||||
|
{
|
||||||
|
return (((lua_typename)lua_api[36].ptr))(this,Type(idx));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::CheckType(int idx,luatype_t tp)
|
||||||
|
{
|
||||||
|
(((luaL_checktype)lua_api[37].ptr))(this,idx,tp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::Call(int nargs,int nret)
|
||||||
|
{
|
||||||
|
(((lua_call)lua_api[31].ptr))(this,nargs,nret);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaState::PCall(int nargs,int nret,int errfunc)
|
||||||
|
{
|
||||||
|
return (((lua_pcall)lua_api[32].ptr))(this,nargs,nret,errfunc);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::Print(const char* msg,...)
|
||||||
|
{
|
||||||
|
GetGlobal("print");
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap,msg);
|
||||||
|
PushVString(msg,ap);
|
||||||
|
va_end(ap);
|
||||||
|
Call(1,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaState::ObjLen(int idx)
|
||||||
|
{
|
||||||
|
return (((lua_objlen)lua_api[38].ptr))(this,idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaState::ReferenceCreate()
|
||||||
|
{
|
||||||
|
int len = ObjLen(-1);
|
||||||
|
len++;
|
||||||
|
PushInteger(len);
|
||||||
|
Push(-2);
|
||||||
|
SetTable(LUA_REGISTRYINDEX);
|
||||||
|
Pop();
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::ReferencePush(int refId)
|
||||||
|
{
|
||||||
|
PushInteger(refId);
|
||||||
|
GetTable(LUA_REGISTRYINDEX);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLuaState::ReferenceFree(int refId)
|
||||||
|
{
|
||||||
|
PushInteger(refId);
|
||||||
|
PushNil();
|
||||||
|
SetTable(LUA_REGISTRYINDEX);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* CLuaState::RunString(const char* name,const char* buf,size_t len)
|
||||||
|
{
|
||||||
|
const char* err = NULL;
|
||||||
|
if( (((luaL_loadbufferx)lua_api[33].ptr))(this,buf,len,name,NULL) != OK)
|
||||||
|
{
|
||||||
|
err = GetString(-1);
|
||||||
|
Pop();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
PCall(0,0,0);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL WINAPI ConnectLuaShared()
|
||||||
|
{
|
||||||
|
HMODULE hLuaShared = NULL;
|
||||||
|
char szDebugInfo[128];
|
||||||
|
if(!(hLuaShared = GetModuleHandle("lua_shared.dll")))
|
||||||
|
return FALSE;
|
||||||
|
for(func_t* i = lua_api; i->name; i++)
|
||||||
|
{
|
||||||
|
if(!(i->ptr = (void*)GetProcAddress(hLuaShared,i->name)))
|
||||||
|
{
|
||||||
|
_snprintf(szDebugInfo,128,"GetProcAddress failed at %s",i->name);
|
||||||
|
MessageBoxA(NULL,szDebugInfo,"ConnectLuaShared",MB_ICONHAND);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL APIENTRY DllMain(HINSTANCE hDll,DWORD fdwReason,LPVOID lpReserved)
|
||||||
|
{
|
||||||
|
if(fdwReason == DLL_PROCESS_ATTACH)
|
||||||
|
return ConnectLuaShared();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
102
state.h
Normal file
102
state.h
Normal file
|
|
@ -0,0 +1,102 @@
|
||||||
|
#ifndef __STATE_H
|
||||||
|
#define __STATE_H
|
||||||
|
|
||||||
|
#include "lua.h"
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <varargs.h>
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
const char* name;
|
||||||
|
void* ptr;
|
||||||
|
} func_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
void* data;
|
||||||
|
unsigned char type;
|
||||||
|
} userdata_t;
|
||||||
|
|
||||||
|
class CLuaState
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CLuaState();
|
||||||
|
~CLuaState();
|
||||||
|
|
||||||
|
int GetTop();
|
||||||
|
void SetTop(int n);
|
||||||
|
|
||||||
|
void SetField(int idx,const char* name);
|
||||||
|
void GetField(int idx,const char* name);
|
||||||
|
|
||||||
|
inline void GetGlobal(const char* name){GetField(LUA_GLOBALSINDEX,name);}
|
||||||
|
inline void SetGlobal(const char* name){SetField(LUA_GLOBALSINDEX,name);}
|
||||||
|
inline void GetMetaFromRegistry(const char* name){GetField(LUA_REGISTRYINDEX,name);}
|
||||||
|
|
||||||
|
void Push(int idx);
|
||||||
|
void Pop(int amt = 1){SetTop(-(amt)-1);}
|
||||||
|
|
||||||
|
void PushNil();
|
||||||
|
void PushBool(bool val);
|
||||||
|
void PushNumber(double num);
|
||||||
|
void PushInteger(int n);
|
||||||
|
void PushCClosure(CLuaFunction fn,int n);
|
||||||
|
inline void PushCFunction(CLuaFunction fn){PushCClosure(fn,0);}
|
||||||
|
void PushString(const char* str,size_t len = 0);
|
||||||
|
void PushVString(const char* fmt,va_list ap);
|
||||||
|
void PushFString(const char* fmt,...);
|
||||||
|
void PushLightUserData(void* p);
|
||||||
|
void PushThread(CLuaState* L);
|
||||||
|
|
||||||
|
bool GetBool(int idx);
|
||||||
|
double GetNumber(int idx);
|
||||||
|
int GetInteger(int idx);
|
||||||
|
const char* GetString(int idx,size_t* len = NULL);
|
||||||
|
userdata_t* GetUserData(int idx);
|
||||||
|
CLuaFunction GetCFunction(int idx);
|
||||||
|
CLuaState* GetThread(int idx);
|
||||||
|
const void* GetPointer(int idx);
|
||||||
|
|
||||||
|
void CreateTable();
|
||||||
|
void GetTable(int idx);
|
||||||
|
void SetTable(int idx);
|
||||||
|
|
||||||
|
void RawGet(int idx);
|
||||||
|
void RawGeti(int idx,int n);
|
||||||
|
void RawSet(int idx);
|
||||||
|
void RawSeti(int idx,int n);
|
||||||
|
|
||||||
|
void GetEnvironment(int idx);
|
||||||
|
void SetEnvironment(int idx);
|
||||||
|
|
||||||
|
userdata_t* NewUserData();
|
||||||
|
void CreateMetaTable(const char* name);
|
||||||
|
int GetMetaTable(int idx);
|
||||||
|
int SetMetaTable(int idx);
|
||||||
|
|
||||||
|
luatype_t Type(int idx);
|
||||||
|
const char* TypeName(int idx);
|
||||||
|
void CheckType(int idx,luatype_t tp);
|
||||||
|
|
||||||
|
void Call(int nargs,int nret);
|
||||||
|
int PCall(int nargs,int nret,int errfunc);
|
||||||
|
|
||||||
|
int ObjLen(int idx);
|
||||||
|
int ReferenceCreate();
|
||||||
|
void ReferencePush(int refId);
|
||||||
|
void ReferenceFree(int refId);
|
||||||
|
|
||||||
|
void Print(const char*,...);
|
||||||
|
const char* RunString(const char* name,const char* buf,size_t len);
|
||||||
|
|
||||||
|
inline bool IsNil(int idx){return (Type(idx) == NIL);}
|
||||||
|
inline bool IsBool(int idx){return (Type(idx) == TBOOLEAN);}
|
||||||
|
inline bool IsLightUserData(int idx){return (Type(idx) == LIGHTUSERDATA);}
|
||||||
|
inline bool IsNumber(int idx){return (Type(idx) == NUMBER);}
|
||||||
|
inline bool IsString(int idx){return (Type(idx) == STRING);}
|
||||||
|
inline bool IsTable(int idx){return (Type(idx) == TABLE);}
|
||||||
|
inline bool IsFunction(int idx){return (Type(idx) == FUNCTION);}
|
||||||
|
inline bool IsUserData(int idx){return (Type(idx) == USERDATA);}
|
||||||
|
inline bool IsThread(int idx){return (Type(idx) == THREAD);}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
Add table
Reference in a new issue