diff options
author | chai <chaifix@163.com> | 2019-09-13 15:08:43 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-09-13 15:08:43 +0800 |
commit | 20535cb86266d7a4828009f3ddca42e35269b9e2 (patch) | |
tree | 796e77e4a34ed52b6c92fb58ec432c69ed4232e1 | |
parent | 695eadc9d2a6d2f499b24ee6858325f6e22da077 (diff) |
*格式化代码
115 files changed, 5750 insertions, 5795 deletions
diff --git a/bin/SDL2.dll b/bin/SDL2.dll Binary files differindex 2859c3e..80be23a 100644 --- a/bin/SDL2.dll +++ b/bin/SDL2.dll diff --git a/bin/cembed.exe b/bin/cembed.exe Binary files differindex 36433c2..a7584cd 100644 --- a/bin/cembed.exe +++ b/bin/cembed.exe diff --git a/bin/jin.exe b/bin/jin.exe Binary files differindex 5bc125e..0c230d4 100644 --- a/bin/jin.exe +++ b/bin/jin.exe diff --git a/bin/lua51.dll b/bin/lua51.dll Binary files differindex a94b437..11d2d14 100644 --- a/bin/lua51.dll +++ b/bin/lua51.dll diff --git a/build/vc++/3rdparty/Lua51/Lua51.vcxproj b/build/vc++/3rdparty/Lua51/Lua51.vcxproj index 40aa665..2c043f4 100644 --- a/build/vc++/3rdparty/Lua51/Lua51.vcxproj +++ b/build/vc++/3rdparty/Lua51/Lua51.vcxproj @@ -22,7 +22,7 @@ <VCProjectVersion>15.0</VCProjectVersion> <ProjectGuid>{4156CD69-6FC4-4B32-B008-BB94C8AE17F5}</ProjectGuid> <RootNamespace>Lua51</RootNamespace> - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> + <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> diff --git a/build/vc++/3rdparty/LuaJIT-2.0.5/LuaJIT-2.0.5.vcxproj b/build/vc++/3rdparty/LuaJIT-2.0.5/LuaJIT-2.0.5.vcxproj index 59e6f10..30333ce 100644 --- a/build/vc++/3rdparty/LuaJIT-2.0.5/LuaJIT-2.0.5.vcxproj +++ b/build/vc++/3rdparty/LuaJIT-2.0.5/LuaJIT-2.0.5.vcxproj @@ -22,7 +22,7 @@ <VCProjectVersion>15.0</VCProjectVersion> <ProjectGuid>{45AC0438-98A8-4369-A21D-BBCBE7995B34}</ProjectGuid> <RootNamespace>LuaJIT205</RootNamespace> - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> + <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> diff --git a/build/vc++/3rdparty/SDL2/SDL2.vcxproj b/build/vc++/3rdparty/SDL2/SDL2.vcxproj index 359b967..0f08b60 100644 --- a/build/vc++/3rdparty/SDL2/SDL2.vcxproj +++ b/build/vc++/3rdparty/SDL2/SDL2.vcxproj @@ -22,7 +22,7 @@ <VCProjectVersion>15.0</VCProjectVersion> <ProjectGuid>{8658F91C-9AAE-4819-9005-77D09C61D97F}</ProjectGuid> <RootNamespace>SDL2</RootNamespace> - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> + <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> diff --git a/build/vc++/3rdparty/luax/luax.vcxproj b/build/vc++/3rdparty/luax/luax.vcxproj index 2fb5520..354e437 100644 --- a/build/vc++/3rdparty/luax/luax.vcxproj +++ b/build/vc++/3rdparty/luax/luax.vcxproj @@ -22,7 +22,7 @@ <VCProjectVersion>15.0</VCProjectVersion> <ProjectGuid>{C6B16179-5640-4D41-8756-0525D25EB569}</ProjectGuid> <RootNamespace>luax</RootNamespace> - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> + <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> diff --git a/build/vc++/3rdparty/smount/smount.vcxproj b/build/vc++/3rdparty/smount/smount.vcxproj index 63eab3a..887725f 100644 --- a/build/vc++/3rdparty/smount/smount.vcxproj +++ b/build/vc++/3rdparty/smount/smount.vcxproj @@ -22,7 +22,7 @@ <VCProjectVersion>15.0</VCProjectVersion> <ProjectGuid>{3FC3E8B7-380E-41E6-91FF-82FA5E622D29}</ProjectGuid> <RootNamespace>smount</RootNamespace> - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> + <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> diff --git a/build/vc++/3rdparty/stb/stb.vcxproj b/build/vc++/3rdparty/stb/stb.vcxproj index e48ddc9..7a038b7 100644 --- a/build/vc++/3rdparty/stb/stb.vcxproj +++ b/build/vc++/3rdparty/stb/stb.vcxproj @@ -22,7 +22,7 @@ <VCProjectVersion>15.0</VCProjectVersion> <ProjectGuid>{E9A7ECC9-1437-45A8-B970-E9E75BD1F8E0}</ProjectGuid> <RootNamespace>stb</RootNamespace> - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> + <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> diff --git a/build/vc++/3rdparty/tekcos/tekcos.vcxproj b/build/vc++/3rdparty/tekcos/tekcos.vcxproj index ec2a716..159110c 100644 --- a/build/vc++/3rdparty/tekcos/tekcos.vcxproj +++ b/build/vc++/3rdparty/tekcos/tekcos.vcxproj @@ -22,7 +22,7 @@ <VCProjectVersion>15.0</VCProjectVersion> <ProjectGuid>{B88DC691-FE8A-4C5E-8D57-EBCC6B13C744}</ProjectGuid> <RootNamespace>tekcos</RootNamespace> - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> + <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> diff --git a/build/vc++/3rdparty/wav/wav.vcxproj b/build/vc++/3rdparty/wav/wav.vcxproj index 0ae6d75..1e68483 100644 --- a/build/vc++/3rdparty/wav/wav.vcxproj +++ b/build/vc++/3rdparty/wav/wav.vcxproj @@ -22,7 +22,7 @@ <VCProjectVersion>15.0</VCProjectVersion> <ProjectGuid>{9A0EAD3F-5A23-41C8-8FFD-8F6B71F43342}</ProjectGuid> <RootNamespace>wav</RootNamespace> - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> + <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> diff --git a/build/vc++/jin/jin.vcxproj b/build/vc++/jin/jin.vcxproj index e1b42d9..499c7da 100644 --- a/build/vc++/jin/jin.vcxproj +++ b/build/vc++/jin/jin.vcxproj @@ -22,7 +22,7 @@ <VCProjectVersion>15.0</VCProjectVersion> <ProjectGuid>{05128A0C-74E2-43EF-B5F4-B0DA70D47940}</ProjectGuid> <RootNamespace>jin</RootNamespace> - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> + <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion> <ProjectName>jin</ProjectName> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> @@ -147,6 +147,15 @@ <Project>{a3e35eca-62eb-45ce-8152-674fbc7f7a3b}</Project> </ProjectReference> </ItemGroup> + <ItemGroup> + <ClInclude Include="resource.h" /> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="jin.rc" /> + </ItemGroup> + <ItemGroup> + <Image Include="C:\Users\chaifeixiang\Downloads\icon.ico" /> + </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> diff --git a/build/vc++/jin/jin.vcxproj.filters b/build/vc++/jin/jin.vcxproj.filters index c17d229..6b4e28f 100644 --- a/build/vc++/jin/jin.vcxproj.filters +++ b/build/vc++/jin/jin.vcxproj.filters @@ -3,4 +3,13 @@ <ItemGroup> <ClCompile Include="..\..\..\src\jin\main.cpp" /> </ItemGroup> + <ItemGroup> + <ClInclude Include="resource.h" /> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="jin.rc" /> + </ItemGroup> + <ItemGroup> + <Image Include="C:\Users\chaifeixiang\Downloads\icon.ico" /> + </ItemGroup> </Project>
\ No newline at end of file diff --git a/build/vc++/libjin-lua/libjin-lua.vcxproj b/build/vc++/libjin-lua/libjin-lua.vcxproj index 54b5a62..3d18d67 100644 --- a/build/vc++/libjin-lua/libjin-lua.vcxproj +++ b/build/vc++/libjin-lua/libjin-lua.vcxproj @@ -21,7 +21,7 @@ <PropertyGroup Label="Globals"> <ProjectGuid>{A3E35ECA-62EB-45CE-8152-674FBC7F7A3B}</ProjectGuid> <RootNamespace>jin</RootNamespace> - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> + <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion> <ProjectName>libjin-lua</ProjectName> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> diff --git a/build/vc++/libjin-lua/libjin-lua.vcxproj.filters b/build/vc++/libjin-lua/libjin-lua.vcxproj.filters index 7785d86..f884e5f 100644 --- a/build/vc++/libjin-lua/libjin-lua.vcxproj.filters +++ b/build/vc++/libjin-lua/libjin-lua.vcxproj.filters @@ -1,9 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> - <Filter Include="source\scripts"> - <UniqueIdentifier>{352f5242-a96e-4cd1-a2e2-15777d354e42}</UniqueIdentifier> - </Filter> <Filter Include="common"> <UniqueIdentifier>{2264d908-20ee-41c2-8bdc-bc1117959c4f}</UniqueIdentifier> </Filter> diff --git a/build/vc++/libjin/libjin.vcxproj b/build/vc++/libjin/libjin.vcxproj index 2697bde..d52cb25 100644 --- a/build/vc++/libjin/libjin.vcxproj +++ b/build/vc++/libjin/libjin.vcxproj @@ -22,7 +22,7 @@ <VCProjectVersion>15.0</VCProjectVersion> <ProjectGuid>{9EE02090-C15E-4520-9C05-C435E45EF2FC}</ProjectGuid> <RootNamespace>libjin</RootNamespace> - <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> + <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion> <ProjectName>libjin</ProjectName> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> diff --git a/src/3rdparty/LuaJIT-2.0.5/src/buildvm.lib b/src/3rdparty/LuaJIT-2.0.5/src/buildvm.lib Binary files differindex d4372fd..c7be727 100644 --- a/src/3rdparty/LuaJIT-2.0.5/src/buildvm.lib +++ b/src/3rdparty/LuaJIT-2.0.5/src/buildvm.lib diff --git a/src/3rdparty/LuaJIT-2.0.5/src/minilua.lib b/src/3rdparty/LuaJIT-2.0.5/src/minilua.lib Binary files differindex a3cce18..e2b3ac3 100644 --- a/src/3rdparty/LuaJIT-2.0.5/src/minilua.lib +++ b/src/3rdparty/LuaJIT-2.0.5/src/minilua.lib diff --git a/src/3rdparty/luax/luax.h b/src/3rdparty/luax/luax.h index 08411f9..7218e3a 100644 --- a/src/3rdparty/luax/luax.h +++ b/src/3rdparty/luax/luax.h @@ -136,6 +136,8 @@ inline void luax_errorf(lua_State* L, const char* fmt, ...) #define luax_pushnil lua_pushnil #define luax_pushvalue lua_pushvalue #define luax_pushliteral lua_pushliteral +#define luax_pushcfunction lua_pushcfunction //lua_pushcclosure(L, (f), 0) +#define luax_pushcclosure lua_pushcclosure #define luax_setmetatable lua_setmetatable @@ -244,7 +246,7 @@ inline void luax_newtype(lua_State* L, const char* tname, const luaL_Reg* f) if (f != NULL) luaL_register(L, NULL, f); - + lua_pop(L, 1); // Pops metatable. } diff --git a/src/libjin-lua/common/je_lua.h b/src/libjin-lua/common/je_lua.h index 629874c..302fea6 100644 --- a/src/libjin-lua/common/je_lua.h +++ b/src/libjin-lua/common/je_lua.h @@ -12,72 +12,72 @@ namespace JinEngine { - namespace Lua - { - - // Extends luax.h library. - - /// - /// - /// - LuaObject* luax_newinstance(lua_State* L, const char* type, Shared* shared); - - /// - /// Copy instance to another lua state. - /// - LuaObject* luax_copyinstance(lua_State* to, LuaObject* src); - - /// - /// - /// - LuaObject* luax_checkobject(lua_State* L, int idx, const char* type); - - /// - /// Access lua object by object pointer. - /// - int luax_getobject(lua_State* L, LuaObject* obj); - - /// - /// Get object's reference table. - /// - void luax_getreference(lua_State* L, LuaObject* obj); - - /// - /// - /// - bool luax_addreference(lua_State* L, LuaObject* obj, LuaObject* dep); - - /// - /// - /// - void luax_removereference(lua_State* L, LuaObject* obj); - - /// - /// - /// - void luax_removereference(lua_State* L, LuaObject* obj, LuaObject* dep); - - /// - /// - /// - void luax_removeobject(lua_State* L, LuaObject* obj); - - /// - /// - /// - int luax_getobjectstable(lua_State* L); - - /// - /// - /// - int luax_getmodulestable(lua_State* L); - - /// - /// - /// - int luax_getreferencestable(lua_State* L); - - } + namespace Lua + { + + // Extends luax.h library. + + /// + /// + /// + LuaObject* luax_newinstance(lua_State* L, const char* type, Shared* shared); + + /// + /// Copy instance to another lua state. + /// + LuaObject* luax_copyinstance(lua_State* to, LuaObject* src); + + /// + /// + /// + LuaObject* luax_checkobject(lua_State* L, int idx, const char* type); + + /// + /// Access lua object by object pointer. + /// + int luax_getobject(lua_State* L, LuaObject* obj); + + /// + /// Get object's reference table. + /// + void luax_getreference(lua_State* L, LuaObject* obj); + + /// + /// + /// + bool luax_addreference(lua_State* L, LuaObject* obj, LuaObject* dep); + + /// + /// + /// + void luax_removereference(lua_State* L, LuaObject* obj); + + /// + /// + /// + void luax_removereference(lua_State* L, LuaObject* obj, LuaObject* dep); + + /// + /// + /// + void luax_removeobject(lua_State* L, LuaObject* obj); + + /// + /// + /// + int luax_getobjectstable(lua_State* L); + + /// + /// + /// + int luax_getmodulestable(lua_State* L); + + /// + /// + /// + int luax_getreferencestable(lua_State* L); + + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/common/l_callback.cpp b/src/libjin-lua/common/l_callback.cpp index a2adcea..4165ca6 100644 --- a/src/libjin-lua/common/l_callback.cpp +++ b/src/libjin-lua/common/l_callback.cpp @@ -2,42 +2,42 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - LuaCallback::LuaCallback(lua_State* L) - : mLuaFunc(nullptr) - , mParams(0) - , mL(L) - { - } + LuaCallback::LuaCallback(lua_State* L) + : mLuaFunc(nullptr) + , mParams(0) + , mL(L) + { + } - LuaCallback::~LuaCallback() - { - delete mLuaFunc; - for (auto p : mParams) - delete p; - } + LuaCallback::~LuaCallback() + { + delete mLuaFunc; + for (auto p : mParams) + delete p; + } - void LuaCallback::setFunc(int i) - { - if (mLuaFunc != nullptr) - delete mLuaFunc; - mLuaFunc = new LuaRef(mL, i); - } + void LuaCallback::setFunc(int i) + { + if (mLuaFunc != nullptr) + delete mLuaFunc; + mLuaFunc = new LuaRef(mL, i); + } - void LuaCallback::pushParam(int i) - { - mParams.push_back(new LuaRef(mL, i)); - } + void LuaCallback::pushParam(int i) + { + mParams.push_back(new LuaRef(mL, i)); + } - void LuaCallback::call() - { - mLuaFunc->push(); - for (auto p : mParams) - p->push(); - luax_call(mL, mParams.size(), 0); - } + void LuaCallback::call() + { + mLuaFunc->push(); + for (auto p : mParams) + p->push(); + luax_call(mL, mParams.size(), 0); + } - } + } }
\ No newline at end of file diff --git a/src/libjin-lua/common/l_callback.h b/src/libjin-lua/common/l_callback.h index af7200c..c6ab5b4 100644 --- a/src/libjin-lua/common/l_callback.h +++ b/src/libjin-lua/common/l_callback.h @@ -8,59 +8,59 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - /// - /// - /// - class LuaCallback - { - public: - /// - /// - /// - LuaCallback(lua_State* L); + /// + /// + /// + class LuaCallback + { + public: + /// + /// + /// + LuaCallback(lua_State* L); - /// - /// - /// - ~LuaCallback(); + /// + /// + /// + ~LuaCallback(); - /// - /// - /// - void setFunc(int i); + /// + /// + /// + void setFunc(int i); - /// - /// - /// - void pushParam(int i); + /// + /// + /// + void pushParam(int i); - /// - /// - /// - void call(); + /// + /// + /// + void call(); - private: - /// - /// - /// - LuaRef* mLuaFunc; + private: + /// + /// + /// + LuaRef* mLuaFunc; - /// - /// - /// - std::vector<LuaRef*> mParams; + /// + /// + /// + std::vector<LuaRef*> mParams; - /// - /// - /// - lua_State* const mL; + /// + /// + /// + lua_State* const mL; - }; + }; - } // namespace Lua + } // namespace Lua } // namespace JinEngine #endif // __JIN_COMMON_REFERENCE_H
\ No newline at end of file diff --git a/src/libjin-lua/common/l_constant.h b/src/libjin-lua/common/l_constant.h index c173b88..05d3b0c 100644 --- a/src/libjin-lua/common/l_constant.h +++ b/src/libjin-lua/common/l_constant.h @@ -3,12 +3,12 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/common/l_object.cpp b/src/libjin-lua/common/l_object.cpp index e3ac158..8117079 100644 --- a/src/libjin-lua/common/l_object.cpp +++ b/src/libjin-lua/common/l_object.cpp @@ -3,110 +3,110 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - void LuaObject::bind(Shared* obj) - { - if (obj) - { - shared = obj; - shared->retain(); - dependencies = new std::map<uint, LuaObject*>(); - } - } + void LuaObject::bind(Shared* obj) + { + if (obj) + { + shared = obj; + shared->retain(); + dependencies = new std::map<uint, LuaObject*>(); + } + } - void LuaObject::release() - { - // Delete lua shared table reference and references. - if (dependencies) - { - clearDependencies(); - delete dependencies; - dependencies = nullptr; - } - // Try delete engine side shared. - if (shared) - { - shared->release(); - shared = nullptr; - } - } + void LuaObject::release() + { + // Delete lua shared table reference and references. + if (dependencies) + { + clearDependencies(); + delete dependencies; + dependencies = nullptr; + } + // Try delete engine side shared. + if (shared) + { + shared->release(); + shared = nullptr; + } + } - const char* LuaObject::getObjectType() - { - return type; - } + const char* LuaObject::getObjectType() + { + return type; + } - Shared* LuaObject::getShared() - { - return shared; - } + Shared* LuaObject::getShared() + { + return shared; + } - void LuaObject::setDependency(uint key, LuaObject* dep) - { - removeDependency(key); - dependencies->insert(std::pair<uint, LuaObject*>(key, dep)); - luax_addreference(state, this, dep); - } + void LuaObject::setDependency(uint key, LuaObject* dep) + { + removeDependency(key); + dependencies->insert(std::pair<uint, LuaObject*>(key, dep)); + luax_addreference(state, this, dep); + } - void LuaObject::removeDependency(uint key) - { - if (!isDependOn(key)) - return; - DepsMap::iterator it = dependencies->find(key); - LuaObject* dep = it->second; - luax_removereference(state, this, dep); - dependencies->erase(it); - } + void LuaObject::removeDependency(uint key) + { + if (!isDependOn(key)) + return; + DepsMap::iterator it = dependencies->find(key); + LuaObject* dep = it->second; + luax_removereference(state, this, dep); + dependencies->erase(it); + } - void LuaObject::removeDependency(LuaObject* dependency) - { - for (DepsMap::iterator it = dependencies->begin(); it != dependencies->end();) - { - LuaObject* dep = it->second; - if (dep == dependency) - { - luax_removereference(state, this, dep); - dependencies->erase(it); - } - else - ++it; - } - } + void LuaObject::removeDependency(LuaObject* dependency) + { + for (DepsMap::iterator it = dependencies->begin(); it != dependencies->end();) + { + LuaObject* dep = it->second; + if (dep == dependency) + { + luax_removereference(state, this, dep); + dependencies->erase(it); + } + else + ++it; + } + } - bool LuaObject::isDependOn(uint key) - { - return dependencies->find(key) != dependencies->end(); - } + bool LuaObject::isDependOn(uint key) + { + return dependencies->find(key) != dependencies->end(); + } - bool LuaObject::isDependOn(LuaObject* shared) - { - for (std::pair<uint, LuaObject*> dep : (*dependencies)) - { - if (dep.second == shared) - return true; - } - return false; - } + bool LuaObject::isDependOn(LuaObject* shared) + { + for (std::pair<uint, LuaObject*> dep : (*dependencies)) + { + if (dep.second == shared) + return true; + } + return false; + } - void LuaObject::clearDependencies() - { - luax_removereference(state, this); - dependencies->clear(); - } + void LuaObject::clearDependencies() + { + luax_removereference(state, this); + dependencies->clear(); + } - LuaObject* LuaObject::getDependency(uint key) - { - if (!isDependOn(key)) - return nullptr; - return dependencies->find(key)->second; - } + LuaObject* LuaObject::getDependency(uint key) + { + if (!isDependOn(key)) + return nullptr; + return dependencies->find(key)->second; + } - int LuaObject::getDependenciesCount() - { - return dependencies->size(); - } + int LuaObject::getDependenciesCount() + { + return dependencies->size(); + } - } + } }
\ No newline at end of file diff --git a/src/libjin-lua/common/l_object.h b/src/libjin-lua/common/l_object.h index 15bd79d..84d16d7 100644 --- a/src/libjin-lua/common/l_object.h +++ b/src/libjin-lua/common/l_object.h @@ -8,62 +8,62 @@ struct lua_State; namespace JinEngine { - namespace Lua - { + namespace Lua + { - class LuaObject - { - public: - /// - /// Set lua_State and object it bind. - /// - void bind(Shared* obj); + class LuaObject + { + public: + /// + /// Set lua_State and object it bind. + /// + void bind(Shared* obj); - void release(); + void release(); - const char* getObjectType(); + const char* getObjectType(); - Shared* getShared(); + Shared* getShared(); - template<class T> - T* getObject() - { - return shared->getObject<T>(); - } + template<class T> + T* getObject() + { + return shared->getObject<T>(); + } - void setDependency(uint key, LuaObject* dep); + void setDependency(uint key, LuaObject* dep); - void removeDependency(uint key); + void removeDependency(uint key); - void removeDependency(LuaObject* dep); + void removeDependency(LuaObject* dep); - bool isDependOn(uint key); + bool isDependOn(uint key); - bool isDependOn(LuaObject* shared); + bool isDependOn(LuaObject* shared); - void clearDependencies(); + void clearDependencies(); - LuaObject* getDependency(uint key); + LuaObject* getDependency(uint key); - int getDependenciesCount(); + int getDependenciesCount(); - ////////////////////////////////////////////////////////////////////////////////////////////////////// - // Lua state object. - ////////////////////////////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////////////////////////////// + // Lua state object. + ////////////////////////////////////////////////////////////////////////////////////////////////////// - using DepsMap = std::map<uint, LuaObject*>; + using DepsMap = std::map<uint, LuaObject*>; - lua_State* state; + lua_State* state; - Shared* shared; + Shared* shared; - const char* type; + const char* type; - DepsMap* dependencies; + DepsMap* dependencies; - }; + }; - } // namespace Lua + } // namespace Lua } // namespace JinEngine #endif // __JIN_COMMON_OBJECT_H__
\ No newline at end of file diff --git a/src/libjin-lua/common/l_reference.cpp b/src/libjin-lua/common/l_reference.cpp index 2fcf792..550ff73 100644 --- a/src/libjin-lua/common/l_reference.cpp +++ b/src/libjin-lua/common/l_reference.cpp @@ -4,39 +4,39 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - LuaRef::LuaRef(lua_State* L, int i) - : mL(L) - { - // Get value. - luax_pushvalue(mL, i); - // Set reference. - luax_getreferencestable(L); - luax_pushvalue(mL, -2); - mIndex = luax_ref(mL, -2); - luax_pop(L, 3); - } + LuaRef::LuaRef(lua_State* L, int i) + : mL(L) + { + // Get value. + luax_pushvalue(mL, i); + // Set reference. + luax_getreferencestable(L); + luax_pushvalue(mL, -2); + mIndex = luax_ref(mL, -2); + luax_pop(L, 3); + } - LuaRef::~LuaRef() - { - unref(); - } + LuaRef::~LuaRef() + { + unref(); + } - void LuaRef::unref() - { - luax_getreferencestable(mL); - luax_unref(mL, -1, mIndex); - luax_pop(mL, 1); - } + void LuaRef::unref() + { + luax_getreferencestable(mL); + luax_unref(mL, -1, mIndex); + luax_pop(mL, 1); + } - void LuaRef::push() - { - luax_getreferencestable(mL); - luax_rawgeti(mL, -1, mIndex); - luax_remove(mL, -2); - } + void LuaRef::push() + { + luax_getreferencestable(mL); + luax_rawgeti(mL, -1, mIndex); + luax_remove(mL, -2); + } - } + } }
\ No newline at end of file diff --git a/src/libjin-lua/common/l_reference.h b/src/libjin-lua/common/l_reference.h index 1a62dba..4c4756f 100644 --- a/src/libjin-lua/common/l_reference.h +++ b/src/libjin-lua/common/l_reference.h @@ -5,50 +5,50 @@ namespace JinEngine { - namespace Lua - { - - /// - /// This class wraps the reference functionality built into Lua, which allows C++ code to refer to Lua - /// variables. - /// - class LuaRef - { - public: - /// - /// - /// - LuaRef(lua_State* L, int i); - - /// - /// - /// - ~LuaRef(); - - /// - /// - /// - void unref(); - - /// - /// Push value onto the stack. - /// - void push(); - - private: - /// - /// - /// - lua_State* const mL; - - /// - /// - /// - int mIndex; - - }; - - } // namespace Lua + namespace Lua + { + + /// + /// This class wraps the reference functionality built into Lua, which allows C++ code to refer to Lua + /// variables. + /// + class LuaRef + { + public: + /// + /// + /// + LuaRef(lua_State* L, int i); + + /// + /// + /// + ~LuaRef(); + + /// + /// + /// + void unref(); + + /// + /// Push value onto the stack. + /// + void push(); + + private: + /// + /// + /// + lua_State* const mL; + + /// + /// + /// + int mIndex; + + }; + + } // namespace Lua } // namespace JinEngine #endif // __JIN_COMMON_REFERENCE_H
\ No newline at end of file diff --git a/src/libjin-lua/common/l_runtime.cpp b/src/libjin-lua/common/l_runtime.cpp index 0972ee5..d57259f 100644 --- a/src/libjin-lua/common/l_runtime.cpp +++ b/src/libjin-lua/common/l_runtime.cpp @@ -8,208 +8,208 @@ using namespace JinEngine::Math; namespace JinEngine { - namespace Lua - { - - static const char* Jin_Lua_Objects_Table = "Jin_Objects_Table"; - - static const char* Jin_Lua_Reference_Table = "Jin_Reference_Table"; - - static const char* Jin_Lua_Modules_Table = "Jin_Modules_Table"; - - using DepsMap = LuaObject::DepsMap; - - LuaObject* luax_newinstance(lua_State* L, const char* type, Shared* shared) - { - LuaObject* obj = static_cast<LuaObject*>(luax_newinstance(L, type, sizeof(LuaObject))); - obj->state = L; - obj->type = type; - obj->bind(shared); - // Add to objects_table, objects_table[shared] = luaObj - luax_getobjectstable(L); - luax_pushlightuserdata(L, shared); - luax_pushvalue(L, -3); - luax_settable(L, -3); - luax_pop(L, 1); // Pop objects table. - return obj; - } - - LuaObject* luax_checkobject(lua_State* L, int idx, const char* type) - { - return (LuaObject*)luax_checktype(L, idx, type); - } - - LuaObject* luax_copyinstance(lua_State* to, LuaObject* src) - { - if (to == src->state) - return nullptr; - // Copy dependencies. - DepsMap& srcDeps = *src->dependencies; - for (DepsMap::iterator it = srcDeps.begin(); it != srcDeps.end(); ++it) - { - LuaObject* obj = it->second; - Shared* shr = obj->shared; - // Try get lua object. - luax_getobject(src->state, obj); - LuaObject* luaObj = (LuaObject*)luax_checktype(src->state, -1, obj->getObjectType()); - luax_pop(src->state, 1); // Pop lua object. - luax_copyinstance(to, luaObj); - luax_pop(to, 1); // Pop reference object. - } - Shared* shr = src->getShared(); - LuaObject* obj = luax_newinstance(to, src->getObjectType(), shr); - (*obj->dependencies) = (*src->dependencies); - // Add to objects_table. - luax_getobjectstable(to); - luax_pushlightuserdata(to, shr); - luax_pushvalue(to, -3); - luax_settable(to, -3); - luax_pop(to, 1); // Pop objects table. - // Set dependencies. - DepsMap& deps = *obj->dependencies; - DepsMap::iterator it = deps.begin(); - for (; it != deps.end(); ++it) - { - LuaObject* dep = it->second; - luax_addreference(to, src, dep); - } - return obj; - } - - int luax_getobject(lua_State* L, LuaObject* obj) - { - luax_getobjectstable(L); - luax_pushlightuserdata(L, obj->shared); - luax_gettable(L, -2); - luax_remove(L, -2); // Remove objects table on stack. - return 1; - } - - void luax_removeobject(lua_State* L, LuaObject* obj) - { - luax_getobjectstable(L); - luax_pushlightuserdata(L, obj->shared); - luax_pushnil(L); - luax_settable(L, -3); - luax_pop(L, 1); - } - - int luax_getobjectstable(lua_State* L) - { - luax_getfield(L, LUA_REGISTRYINDEX, Jin_Lua_Objects_Table); - // If no such table, add one. - if (luax_isnil(L, -1) || !luax_istable(L, -1)) - { - luax_pop(L, 1); - luax_newtable(L); - - // metatable - luax_newtable(L); - // weak table - luax_pushliteral(L, "v"); - luax_setfield(L, -2, "__mode"); - // setmetatable(newtable, metatable) - luax_setmetatable(L, -2); - - luax_pushvalue(L, -1); - luax_setfield(L, LUA_REGISTRYINDEX, Jin_Lua_Objects_Table); - } - return 1; - } - - int luax_getmodulestable(lua_State* L) - { - luax_getfield(L, LUA_REGISTRYINDEX, Jin_Lua_Modules_Table); - // If no such table, add one. - if (luax_isnil(L, -1) || !luax_istable(L, -1)) - { - luax_pop(L, 1); - luax_newtable(L); - - // metatable - luax_newtable(L); - // weak table - luax_pushliteral(L, "v"); - luax_setfield(L, -2, "__mode"); - // setmetatable(newtable, metatable) - luax_setmetatable(L, -2); - - luax_pushvalue(L, -1); - luax_setfield(L, LUA_REGISTRYINDEX, Jin_Lua_Modules_Table); - } - return 1; - } - - int luax_getreferencestable(lua_State* L) - { - luax_getfield(L, LUA_REGISTRYINDEX, Jin_Lua_Reference_Table); - // If no such table, add one. - if (luax_isnil(L, -1) || !luax_istable(L, -1)) - { - luax_pop(L, 1); - luax_newtable(L); - luax_pushvalue(L, -1); - luax_setfield(L, LUA_REGISTRYINDEX, Jin_Lua_Reference_Table); - } - return 1; - } - - void luax_getreference(lua_State* L, LuaObject* obj) - { - luax_getreferencestable(L); - luax_pushlightuserdata(L, obj->shared); - luax_gettable(L, -2); - luax_remove(L, -2); - } - - bool luax_addreference(lua_State* L, LuaObject* obj, LuaObject* dep) - { - luax_getreference(L, obj); - // If no dependencies table, add one. - if (luax_isnil(L, -1)) - { - luax_pop(L, 1); - luax_getreferencestable(L); - luax_newtable(L); - luax_pushlightuserdata(L, obj->shared); - luax_pushvalue(L, -2); - luax_settable(L, -4); - luax_remove(L, -2); // Remove references table. - } - luax_pushlightuserdata(L, dep->shared); - luax_getobject(L, dep); - if (luax_isnil(L, -1)) - { - luax_pop(L, 3); // Pop nil, dep, reftbl. - return false; - } - luax_settable(L, -3); - luax_pop(L, 1); - return true; - } - - void luax_removereference(lua_State* L, LuaObject* obj) - { - luax_getreferencestable(L); - luax_pushlightuserdata(L, obj->shared); - luax_pushnil(L); - luax_settable(L, -3); - luax_pop(L, 1); - } - - void luax_removereference(lua_State* L, LuaObject* obj, LuaObject* dep) - { - luax_getreference(L, obj); - if (luax_isnil(L, -1)) - { - luax_pop(L, 1); - return; - } - luax_pushlightuserdata(L, dep->shared); - luax_pushnil(L); - luax_settable(L, -3); - luax_pop(L, 1); - } - - } + namespace Lua + { + + static const char* Jin_Lua_Objects_Table = "Jin_Objects_Table"; + + static const char* Jin_Lua_Reference_Table = "Jin_Reference_Table"; + + static const char* Jin_Lua_Modules_Table = "Jin_Modules_Table"; + + using DepsMap = LuaObject::DepsMap; + + LuaObject* luax_newinstance(lua_State* L, const char* type, Shared* shared) + { + LuaObject* obj = static_cast<LuaObject*>(luax_newinstance(L, type, sizeof(LuaObject))); + obj->state = L; + obj->type = type; + obj->bind(shared); + // Add to objects_table, objects_table[shared] = luaObj + luax_getobjectstable(L); + luax_pushlightuserdata(L, shared); + luax_pushvalue(L, -3); + luax_settable(L, -3); + luax_pop(L, 1); // Pop objects table. + return obj; + } + + LuaObject* luax_checkobject(lua_State* L, int idx, const char* type) + { + return (LuaObject*)luax_checktype(L, idx, type); + } + + LuaObject* luax_copyinstance(lua_State* to, LuaObject* src) + { + if (to == src->state) + return nullptr; + // Copy dependencies. + DepsMap& srcDeps = *src->dependencies; + for (DepsMap::iterator it = srcDeps.begin(); it != srcDeps.end(); ++it) + { + LuaObject* obj = it->second; + Shared* shr = obj->shared; + // Try get lua object. + luax_getobject(src->state, obj); + LuaObject* luaObj = (LuaObject*)luax_checktype(src->state, -1, obj->getObjectType()); + luax_pop(src->state, 1); // Pop lua object. + luax_copyinstance(to, luaObj); + luax_pop(to, 1); // Pop reference object. + } + Shared* shr = src->getShared(); + LuaObject* obj = luax_newinstance(to, src->getObjectType(), shr); + (*obj->dependencies) = (*src->dependencies); + // Add to objects_table. + luax_getobjectstable(to); + luax_pushlightuserdata(to, shr); + luax_pushvalue(to, -3); + luax_settable(to, -3); + luax_pop(to, 1); // Pop objects table. + // Set dependencies. + DepsMap& deps = *obj->dependencies; + DepsMap::iterator it = deps.begin(); + for (; it != deps.end(); ++it) + { + LuaObject* dep = it->second; + luax_addreference(to, src, dep); + } + return obj; + } + + int luax_getobject(lua_State* L, LuaObject* obj) + { + luax_getobjectstable(L); + luax_pushlightuserdata(L, obj->shared); + luax_gettable(L, -2); + luax_remove(L, -2); // Remove objects table on stack. + return 1; + } + + void luax_removeobject(lua_State* L, LuaObject* obj) + { + luax_getobjectstable(L); + luax_pushlightuserdata(L, obj->shared); + luax_pushnil(L); + luax_settable(L, -3); + luax_pop(L, 1); + } + + int luax_getobjectstable(lua_State* L) + { + luax_getfield(L, LUA_REGISTRYINDEX, Jin_Lua_Objects_Table); + // If no such table, add one. + if (luax_isnil(L, -1) || !luax_istable(L, -1)) + { + luax_pop(L, 1); + luax_newtable(L); + + // metatable + luax_newtable(L); + // weak table + luax_pushliteral(L, "v"); + luax_setfield(L, -2, "__mode"); + // setmetatable(newtable, metatable) + luax_setmetatable(L, -2); + + luax_pushvalue(L, -1); + luax_setfield(L, LUA_REGISTRYINDEX, Jin_Lua_Objects_Table); + } + return 1; + } + + int luax_getmodulestable(lua_State* L) + { + luax_getfield(L, LUA_REGISTRYINDEX, Jin_Lua_Modules_Table); + // If no such table, add one. + if (luax_isnil(L, -1) || !luax_istable(L, -1)) + { + luax_pop(L, 1); + luax_newtable(L); + + // metatable + luax_newtable(L); + // weak table + luax_pushliteral(L, "v"); + luax_setfield(L, -2, "__mode"); + // setmetatable(newtable, metatable) + luax_setmetatable(L, -2); + + luax_pushvalue(L, -1); + luax_setfield(L, LUA_REGISTRYINDEX, Jin_Lua_Modules_Table); + } + return 1; + } + + int luax_getreferencestable(lua_State* L) + { + luax_getfield(L, LUA_REGISTRYINDEX, Jin_Lua_Reference_Table); + // If no such table, add one. + if (luax_isnil(L, -1) || !luax_istable(L, -1)) + { + luax_pop(L, 1); + luax_newtable(L); + luax_pushvalue(L, -1); + luax_setfield(L, LUA_REGISTRYINDEX, Jin_Lua_Reference_Table); + } + return 1; + } + + void luax_getreference(lua_State* L, LuaObject* obj) + { + luax_getreferencestable(L); + luax_pushlightuserdata(L, obj->shared); + luax_gettable(L, -2); + luax_remove(L, -2); + } + + bool luax_addreference(lua_State* L, LuaObject* obj, LuaObject* dep) + { + luax_getreference(L, obj); + // If no dependencies table, add one. + if (luax_isnil(L, -1)) + { + luax_pop(L, 1); + luax_getreferencestable(L); + luax_newtable(L); + luax_pushlightuserdata(L, obj->shared); + luax_pushvalue(L, -2); + luax_settable(L, -4); + luax_remove(L, -2); // Remove references table. + } + luax_pushlightuserdata(L, dep->shared); + luax_getobject(L, dep); + if (luax_isnil(L, -1)) + { + luax_pop(L, 3); // Pop nil, dep, reftbl. + return false; + } + luax_settable(L, -3); + luax_pop(L, 1); + return true; + } + + void luax_removereference(lua_State* L, LuaObject* obj) + { + luax_getreferencestable(L); + luax_pushlightuserdata(L, obj->shared); + luax_pushnil(L); + luax_settable(L, -3); + luax_pop(L, 1); + } + + void luax_removereference(lua_State* L, LuaObject* obj, LuaObject* dep) + { + luax_getreference(L, obj); + if (luax_isnil(L, -1)) + { + luax_pop(L, 1); + return; + } + luax_pushlightuserdata(L, dep->shared); + luax_pushnil(L); + luax_settable(L, -3); + luax_pop(L, 1); + } + + } }
\ No newline at end of file diff --git a/src/libjin-lua/common/l_shared.cpp b/src/libjin-lua/common/l_shared.cpp index 03303da..047905e 100644 --- a/src/libjin-lua/common/l_shared.cpp +++ b/src/libjin-lua/common/l_shared.cpp @@ -4,8 +4,8 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - } + } }
\ No newline at end of file diff --git a/src/libjin-lua/common/l_shared.hpp b/src/libjin-lua/common/l_shared.hpp index 6a58ab3..11f28b3 100644 --- a/src/libjin-lua/common/l_shared.hpp +++ b/src/libjin-lua/common/l_shared.hpp @@ -9,76 +9,76 @@ namespace JinEngine { - namespace Lua - { - - class LuaObject; - - /// - /// Thread shared object wrapper. - /// - class Shared - { - public: - Shared(Object* obj) - : mCount(0) - , mObject(obj) - { - } - - inline Object* operator->() - { - return static_cast<Object*>(mObject); - } - - inline Object* getObject() - { - return static_cast<Object*>(mObject); - } - - template<class T> - inline T* getObject() - { - return static_cast<T*>(mObject); - } - - private: - friend class LuaObject; - - // Disable copy. - Shared(const Shared& shared); - - /// - /// Sharedֻڶ - /// - ~Shared() - { - delete mObject; - } - - /// - /// ͬһ̵߳lua_StateУLuaObjectEngineObjectӦһһӦLuaObject(lua runtime)ü - /// ͻաEngine-sideüΪά̵ͬ߳lua_StateͬһEngineObjectÿLuaObjectһ - /// Sharedʱһüͬһ߳УһEngineObjectֻһLuaObjectnew - /// instanceУômCountͱEngineObjectĹ߳ - /// - inline void Shared::retain() - { - ++mCount; - } - - inline void Shared::release() - { - if (--mCount <= 0) - delete this; - } - - Object* mObject; - int mCount; - - }; - - } // namespace Lua + namespace Lua + { + + class LuaObject; + + /// + /// Thread shared object wrapper. + /// + class Shared + { + public: + Shared(Object* obj) + : mCount(0) + , mObject(obj) + { + } + + inline Object* operator->() + { + return static_cast<Object*>(mObject); + } + + inline Object* getObject() + { + return static_cast<Object*>(mObject); + } + + template<class T> + inline T* getObject() + { + return static_cast<T*>(mObject); + } + + private: + friend class LuaObject; + + // Disable copy. + Shared(const Shared& shared); + + /// + /// Sharedֻڶ + /// + ~Shared() + { + delete mObject; + } + + /// + /// ͬһ̵߳lua_StateУLuaObjectEngineObjectӦһһӦLuaObject(lua runtime)ü + /// ͻաEngine-sideüΪά̵ͬ߳lua_StateͬһEngineObjectÿLuaObjectһ + /// Sharedʱһüͬһ߳УһEngineObjectֻһLuaObjectnew + /// instanceУômCountͱEngineObjectĹ߳ + /// + inline void Shared::retain() + { + ++mCount; + } + + inline void Shared::release() + { + if (--mCount <= 0) + delete this; + } + + Object* mObject; + int mCount; + + }; + + } // namespace Lua } // namespace JinEngine #endif
\ No newline at end of file diff --git a/src/libjin-lua/l_jin.cpp b/src/libjin-lua/l_jin.cpp index 6a0809a..9972684 100644 --- a/src/libjin-lua/l_jin.cpp +++ b/src/libjin-lua/l_jin.cpp @@ -6,182 +6,182 @@ namespace JinEngine { - namespace Lua - { - - LUA_IMPLEMENT int l_getversion(lua_State* L) - { - luax_pushstring(L, VERSION); - return 1; - } - - LUA_IMPLEMENT int l_getAuthor(lua_State* L) - { - luax_pushstring(L, AUTHOR); - return 1; - } - - LUA_IMPLEMENT int l_getOS(lua_State* L) - { - #ifdef _WIN32 - luax_pushstring(L, "windows"); - #elif defined __unix__ - luax_pushstring(L, "unix"); - #elif defined __APPLE__ - luax_pushstring(L, "macos"); - #endif - return 1; - } - - LUA_IMPLEMENT int l_revision(lua_State* L) - { - luax_pushnumber(L, REVISION); - return 1; - } - - // Register jin module, keep it on the top of stack. - // The reason why not using luaL_register is because we want register some variables into jin module. - LUA_EXPORT void open(lua_State* L) - { - jin_log_info("Openning jin library."); - - luax_globaltable(L, MODULE_NAME); - - const luax_Str s[] = { - { "version", VERSION }, - { "author", AUTHOR }, - { "codename", CODE_NAME }, - { 0, 0 } - }; - const luax_Num n[] = { - { "revision", REVISION }, - { 0, 0 } - }; - // Register values. - luax_setfieldstrings(L, s); - luax_setfieldnumbers(L, n); - - luax_Reg modules[] = { - { "core", luaopen_core }, - { "event", luaopen_event }, - { "graphics", luaopen_graphics }, - { "time", luaopen_time }, - { "mouse", luaopen_mouse }, - { "keyboard", luaopen_keyboard }, - { "filesystem", luaopen_filesystem }, - { "net", luaopen_net }, - { "audio", luaopen_audio }, - { "joypad", luaopen_joypad }, - { "math", luaopen_math }, - { "thread", luaopen_thread }, - { "bit", luaopen_bit }, - //{"ai", luaopen_ai }, - { 0, 0 } - }; - - // Register sub modules. - for (int i = 0; modules[i].name; ++i) - { - modules[i].func(L); - luax_setfield(L, -2, modules[i].name); - } - - // Pop jin table. - luax_pop(L, 1); - - jin_log_info("Done."); - } - - // Embed structure. - struct jin_Embed - { - const char* file; - const char* source; - }; - - // Embed scripts. - #include "scripts/ai/state_machine.lua.h" - #include "scripts/graphics/graphics.lua.h" - #include "scripts/keyboard/keyboard.lua.h" - #include "scripts/mouse/mouse.lua.h" - #include "scripts/path/path.lua.h" - #include "scripts/time/time.lua.h" - #include "scripts/utils/json.lua.h" - #include "scripts/utils/xml.lua.h" - #include "scripts/log.lua.h" - #include "scripts/tiledmap/tiledmap.lua.h" - #include "scripts/physics/physics.lua.h" - #include "scripts/audio/audio.lua.h" - - #include "scripts/app.lua.h" - - // In order. - static const jin_Embed modules[] = { - // ai - { "state_machine.lua", state_machine_lua }, - // keyboard - { "keyboard.lua", keyboard_lua }, - { "mouse.lua", mouse_lua }, - { "graphics.lua", graphics_lua }, - { "path.lua", path_lua }, - { "time.lua", time_lua }, - { "json.lua", json_lua }, - { "xml.lua", xml_lua }, - { "tiledmap.lua", tiledmap_lua }, - { "physics.lua", physics_lua }, - { "audio.lua", audio_lua }, - // - { "log.lua", log_lua }, - { 0, 0 } - }; - - static const jin_Embed bootscript = { "app.lua", app_lua }; - - static void embed(lua_State* L) - { - jin_log_info("Load embeded scripts."); - const char* file, *source; - for (int i = 0; modules[i].file != 0; ++i) - { - file = modules[i].file; - source = modules[i].source; - jin_log_info("Embed script \"%s\".", file); - luax_clearstack(L); - if (luax_loadbuffer(L, source, strlen(source), file) == 0) - { - luax_call(L, 0, 0); - } - else - { - jin_log_error("Embed script \"%s\" failed.", file); - } - } - } - - static void run(lua_State* L) - { - const char* file, *source; - file = bootscript.file; - source = bootscript.source; - jin_log_info("Run boot script \"%s\".", file); - luax_clearstack(L); - if (luax_loadbuffer(L, source, strlen(source), file) == 0) - { - luax_call(L, 0, 0); - } - } - - LUA_EXPORT void boot(lua_State* L, const char* cwd) - { - luax_clearstack(L); - luax_getglobal(L, MODULE_NAME); - luax_newtable(L); - luax_setfieldstring(L, "cwd", cwd); - luax_setfield(L, -2, "args"); - luax_clearstack(L); - embed(L); - run(L); - } - - } // namespace Lua + namespace Lua + { + + LUA_IMPLEMENT int l_getversion(lua_State* L) + { + luax_pushstring(L, VERSION); + return 1; + } + + LUA_IMPLEMENT int l_getAuthor(lua_State* L) + { + luax_pushstring(L, AUTHOR); + return 1; + } + + LUA_IMPLEMENT int l_getOS(lua_State* L) + { + #ifdef _WIN32 + luax_pushstring(L, "windows"); + #elif defined __unix__ + luax_pushstring(L, "unix"); + #elif defined __APPLE__ + luax_pushstring(L, "macos"); + #endif + return 1; + } + + LUA_IMPLEMENT int l_revision(lua_State* L) + { + luax_pushnumber(L, REVISION); + return 1; + } + + // Register jin module, keep it on the top of stack. + // The reason why not using luaL_register is because we want register some variables into jin module. + LUA_EXPORT void open(lua_State* L) + { + jin_log_info("Openning jin library."); + + luax_globaltable(L, MODULE_NAME); + + const luax_Str s[] = { + { "version", VERSION }, + { "author", AUTHOR }, + { "codename", CODE_NAME }, + { 0, 0 } + }; + const luax_Num n[] = { + { "revision", REVISION }, + { 0, 0 } + }; + // Register values. + luax_setfieldstrings(L, s); + luax_setfieldnumbers(L, n); + + luax_Reg modules[] = { + { "core", luaopen_core }, + { "event", luaopen_event }, + { "graphics", luaopen_graphics }, + { "time", luaopen_time }, + { "mouse", luaopen_mouse }, + { "keyboard", luaopen_keyboard }, + { "filesystem", luaopen_filesystem }, + { "net", luaopen_net }, + { "audio", luaopen_audio }, + { "joypad", luaopen_joypad }, + { "math", luaopen_math }, + { "thread", luaopen_thread }, + { "bit", luaopen_bit }, + //{"ai", luaopen_ai }, + { 0, 0 } + }; + + // Register sub modules. + for (int i = 0; modules[i].name; ++i) + { + modules[i].func(L); + luax_setfield(L, -2, modules[i].name); + } + + // Pop jin table. + luax_pop(L, 1); + + jin_log_info("Done."); + } + + // Embed structure. + struct jin_Embed + { + const char* file; + const char* source; + }; + + // Embed scripts. + #include "scripts/ai/state_machine.lua.h" + #include "scripts/graphics/graphics.lua.h" + #include "scripts/keyboard/keyboard.lua.h" + #include "scripts/mouse/mouse.lua.h" + #include "scripts/path/path.lua.h" + #include "scripts/time/time.lua.h" + #include "scripts/utils/json.lua.h" + #include "scripts/utils/xml.lua.h" + #include "scripts/log.lua.h" + #include "scripts/tiledmap/tiledmap.lua.h" + #include "scripts/physics/physics.lua.h" + #include "scripts/audio/audio.lua.h" + + #include "scripts/app.lua.h" + + // In order. + static const jin_Embed modules[] = { + // ai + { "state_machine.lua", state_machine_lua }, + // keyboard + { "keyboard.lua", keyboard_lua }, + { "mouse.lua", mouse_lua }, + { "graphics.lua", graphics_lua }, + { "path.lua", path_lua }, + { "time.lua", time_lua }, + { "json.lua", json_lua }, + { "xml.lua", xml_lua }, + { "tiledmap.lua", tiledmap_lua }, + { "physics.lua", physics_lua }, + { "audio.lua", audio_lua }, + // + { "log.lua", log_lua }, + { 0, 0 } + }; + + static const jin_Embed bootscript = { "app.lua", app_lua }; + + static void embed(lua_State* L) + { + jin_log_info("Load embeded scripts."); + const char* file, *source; + for (int i = 0; modules[i].file != 0; ++i) + { + file = modules[i].file; + source = modules[i].source; + jin_log_info("Embed script \"%s\".", file); + luax_clearstack(L); + if (luax_loadbuffer(L, source, strlen(source), file) == 0) + { + luax_call(L, 0, 0); + } + else + { + jin_log_error("Embed script \"%s\" failed.", file); + } + } + } + + static void run(lua_State* L) + { + const char* file, *source; + file = bootscript.file; + source = bootscript.source; + jin_log_info("Run boot script \"%s\".", file); + luax_clearstack(L); + if (luax_loadbuffer(L, source, strlen(source), file) == 0) + { + luax_call(L, 0, 0); + } + } + + LUA_EXPORT void boot(lua_State* L, const char* cwd) + { + luax_clearstack(L); + luax_getglobal(L, MODULE_NAME); + luax_newtable(L); + luax_setfieldstring(L, "cwd", cwd); + luax_setfield(L, -2, "args"); + luax_clearstack(L); + embed(L); + run(L); + } + + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/l_jin.h b/src/libjin-lua/l_jin.h index 64db4c2..925ebad 100644 --- a/src/libjin-lua/l_jin.h +++ b/src/libjin-lua/l_jin.h @@ -10,27 +10,27 @@ #define MODULE_NAME "jin" #define CODE_NAME "Side Part" -#define VERSION "0.1.1" +#define VERSION "0.1.1" #define REVISION_S "101" -#define REVISION 101 -#define AUTHOR "chai" +#define REVISION 101 +#define AUTHOR "chai" namespace JinEngine { - namespace Lua - { + namespace Lua + { - /// - /// open jin module. - /// - LUA_EXPORT void open(lua_State* L); + /// + /// open jin module. + /// + LUA_EXPORT void open(lua_State* L); - /// - /// Boot jin. - /// - LUA_EXPORT void boot(lua_State* L, const char* cwd); + /// + /// Boot jin. + /// + LUA_EXPORT void boot(lua_State* L, const char* cwd); - } // namespace JinEngine + } // namespace JinEngine } // namespace Lua #endif // __JIN_M_JIN_H__
\ No newline at end of file diff --git a/src/libjin-lua/modules/ai/l_ai.cpp b/src/libjin-lua/modules/ai/l_ai.cpp index 4afd625..0b3ac85 100644 --- a/src/libjin-lua/modules/ai/l_ai.cpp +++ b/src/libjin-lua/modules/ai/l_ai.cpp @@ -4,10 +4,10 @@ using namespace JinEngine::AI; namespace JinEngine { - namespace Lua - { + namespace Lua + { - } + } }
\ No newline at end of file diff --git a/src/libjin-lua/modules/ai/l_ai.h b/src/libjin-lua/modules/ai/l_ai.h index 919c0a3..eaee6b9 100644 --- a/src/libjin-lua/modules/ai/l_ai.h +++ b/src/libjin-lua/modules/ai/l_ai.h @@ -6,12 +6,12 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - int luaopen_ai(lua_State* L); + int luaopen_ai(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/ai/l_behavior_tree.cpp b/src/libjin-lua/modules/ai/l_behavior_tree.cpp index 20e8e55..8027c5f 100644 --- a/src/libjin-lua/modules/ai/l_behavior_tree.cpp +++ b/src/libjin-lua/modules/ai/l_behavior_tree.cpp @@ -2,10 +2,10 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - const char* Jin_Lua_BehaviorTree = "Texture"; + const char* Jin_Lua_BehaviorTree = "Texture"; - } + } }
\ No newline at end of file diff --git a/src/libjin-lua/modules/ai/l_behavior_tree.h b/src/libjin-lua/modules/ai/l_behavior_tree.h index 083d12b..faace67 100644 --- a/src/libjin-lua/modules/ai/l_behavior_tree.h +++ b/src/libjin-lua/modules/ai/l_behavior_tree.h @@ -3,12 +3,12 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - extern const char* Jin_Lua_BehaviorTree; + extern const char* Jin_Lua_BehaviorTree; - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/ai/l_state_machine.cpp b/src/libjin-lua/modules/ai/l_state_machine.cpp index 1825de5..8095bfb 100644 --- a/src/libjin-lua/modules/ai/l_state_machine.cpp +++ b/src/libjin-lua/modules/ai/l_state_machine.cpp @@ -5,21 +5,21 @@ using namespace JinEngine::AI; namespace JinEngine { - namespace Lua - { - - const char* Jin_Lua_StateMachine = "StateMachine"; + namespace Lua + { + + const char* Jin_Lua_StateMachine = "StateMachine"; - LUA_IMPLEMENT int l_addEnterCallback(lua_State* L) - { - //StateMachine* sm; - //sm->addEnterListener("", [](void* p) -> void{ + LUA_IMPLEMENT int l_addEnterCallback(lua_State* L) + { + //StateMachine* sm; + //sm->addEnterListener("", [](void* p) -> void{ - // - //}); + // + //}); - return 0; - } + return 0; + } - } + } }
\ No newline at end of file diff --git a/src/libjin-lua/modules/ai/l_state_machine.h b/src/libjin-lua/modules/ai/l_state_machine.h index 3c78f75..772531e 100644 --- a/src/libjin-lua/modules/ai/l_state_machine.h +++ b/src/libjin-lua/modules/ai/l_state_machine.h @@ -3,12 +3,12 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - extern const char* Jin_Lua_StateMachine; + extern const char* Jin_Lua_StateMachine; - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/audio/l_source.cpp b/src/libjin-lua/modules/audio/l_source.cpp index 72af871..29b928b 100644 --- a/src/libjin-lua/modules/audio/l_source.cpp +++ b/src/libjin-lua/modules/audio/l_source.cpp @@ -6,109 +6,109 @@ using namespace JinEngine::Audio; namespace JinEngine { - namespace Lua - { + namespace Lua + { - const char* Jin_Lua_Source = "Source"; - - LUA_IMPLEMENT inline Source* checkSource(lua_State* L) - { - LuaObject* luaObj = luax_checkobject(L, 1, Jin_Lua_Source); - Source* source = luaObj->getObject<Source>(); - return source; - } + const char* Jin_Lua_Source = "Source"; + + LUA_IMPLEMENT inline Source* checkSource(lua_State* L) + { + LuaObject* luaObj = luax_checkobject(L, 1, Jin_Lua_Source); + Source* source = luaObj->getObject<Source>(); + return source; + } - LUA_IMPLEMENT int l_play(lua_State* L) - { - Source* source = checkSource(L); - source->play(); - return 0; - } + LUA_IMPLEMENT int l_play(lua_State* L) + { + Source* source = checkSource(L); + source->play(); + return 0; + } - LUA_IMPLEMENT int l_stop(lua_State* L) - { - Source* source = checkSource(L); - source->stop(); - return 0; - } + LUA_IMPLEMENT int l_stop(lua_State* L) + { + Source* source = checkSource(L); + source->stop(); + return 0; + } - LUA_IMPLEMENT int l_pause(lua_State* L) - { - Source* source = checkSource(L); - source->pause(); - return 0; - } + LUA_IMPLEMENT int l_pause(lua_State* L) + { + Source* source = checkSource(L); + source->pause(); + return 0; + } - LUA_IMPLEMENT int l_rewind(lua_State* L) - { - Source* source = checkSource(L); - source->rewind(); - return 0; - } + LUA_IMPLEMENT int l_rewind(lua_State* L) + { + Source* source = checkSource(L); + source->rewind(); + return 0; + } - LUA_IMPLEMENT int l_resume(lua_State* L) - { - Source* source = checkSource(L); - source->resume(); - return 0; - } + LUA_IMPLEMENT int l_resume(lua_State* L) + { + Source* source = checkSource(L); + source->resume(); + return 0; + } - LUA_IMPLEMENT int l_isStop(lua_State* L) - { - Source* source = checkSource(L); - bool isStop = source->isStopped(); - luax_pushboolean(L, isStop); - return 1; - } + LUA_IMPLEMENT int l_isStop(lua_State* L) + { + Source* source = checkSource(L); + bool isStop = source->isStopped(); + luax_pushboolean(L, isStop); + return 1; + } - LUA_IMPLEMENT int l_isPaused(lua_State* L) - { - Source* source = checkSource(L); - bool isPaused = source->isPaused(); - luax_pushboolean(L, isPaused); - return 1; - } + LUA_IMPLEMENT int l_isPaused(lua_State* L) + { + Source* source = checkSource(L); + bool isPaused = source->isPaused(); + luax_pushboolean(L, isPaused); + return 1; + } - LUA_IMPLEMENT int l_setVolume(lua_State* L) - { - Source* source = checkSource(L); - float volume = luax_checknumber(L, 2); - source->setVolume(volume); - return 0; - } + LUA_IMPLEMENT int l_setVolume(lua_State* L) + { + Source* source = checkSource(L); + float volume = luax_checknumber(L, 2); + source->setVolume(volume); + return 0; + } - LUA_IMPLEMENT int l_setLoop(lua_State* L) - { - Source* source = checkSource(L); - bool loop = luax_checkbool(L, 2); - source->setLoop(loop); - return 0; - } + LUA_IMPLEMENT int l_setLoop(lua_State* L) + { + Source* source = checkSource(L); + bool loop = luax_checkbool(L, 2); + source->setLoop(loop); + return 0; + } - LUA_IMPLEMENT int l_gc(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Source); - luaObj->release(); - return 0; - } - - LUA_EXPORT void luaopen_Source(lua_State* L) - { - luaL_Reg methods[] = { - { "__gc", l_gc }, - { "play", l_play }, - { "stop", l_stop }, - { "pause", l_pause }, - { "resume", l_resume }, - { "rewind", l_rewind }, - { "isStop", l_isStop }, - { "isPaused", l_isPaused }, - { "setVolume", l_setVolume }, - { "setLoop", l_setLoop }, - { 0, 0 } - }; - luax_newtype(L, Jin_Lua_Source, methods); - } + LUA_IMPLEMENT int l_gc(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Source); + luaObj->release(); + return 0; + } + + LUA_EXPORT void luaopen_Source(lua_State* L) + { + luaL_Reg methods[] = { + { "__gc", l_gc }, + { "play", l_play }, + { "stop", l_stop }, + { "pause", l_pause }, + { "resume", l_resume }, + { "rewind", l_rewind }, + { "isStop", l_isStop }, + { "isPaused", l_isPaused }, + { "setVolume", l_setVolume }, + { "setLoop", l_setLoop }, + { 0, 0 } + }; + luax_newtype(L, Jin_Lua_Source, methods); + } - } // namespace Lua + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/audio/l_source.h b/src/libjin-lua/modules/audio/l_source.h index f7e6b48..eee3439 100644 --- a/src/libjin-lua/modules/audio/l_source.h +++ b/src/libjin-lua/modules/audio/l_source.h @@ -3,14 +3,14 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - extern const char* Jin_Lua_Source; + extern const char* Jin_Lua_Source; - void luaopen_Source(lua_State* L); + void luaopen_Source(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/bit/l_bit.cpp b/src/libjin-lua/modules/bit/l_bit.cpp index 43be892..2e4a3a6 100644 --- a/src/libjin-lua/modules/bit/l_bit.cpp +++ b/src/libjin-lua/modules/bit/l_bit.cpp @@ -6,81 +6,81 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - LUA_IMPLEMENT int l_and(lua_State* L) - { - int a = luax_checkinteger(L, 1); - int b = luax_checkinteger(L, 2); - luax_pushinteger(L, a & b); - return 1; - } + LUA_IMPLEMENT int l_and(lua_State* L) + { + int a = luax_checkinteger(L, 1); + int b = luax_checkinteger(L, 2); + luax_pushinteger(L, a & b); + return 1; + } - LUA_IMPLEMENT int l_or(lua_State* L) - { - int a = luax_checkinteger(L, 1); - int b = luax_checkinteger(L, 2); - luax_pushinteger(L, a | b); - return 1; - } + LUA_IMPLEMENT int l_or(lua_State* L) + { + int a = luax_checkinteger(L, 1); + int b = luax_checkinteger(L, 2); + luax_pushinteger(L, a | b); + return 1; + } - LUA_IMPLEMENT int l_xor(lua_State* L) - { - int a = luax_checkinteger(L, 1); - int b = luax_checkinteger(L, 2); - luax_pushinteger(L, a ^ b); - return 1; - } + LUA_IMPLEMENT int l_xor(lua_State* L) + { + int a = luax_checkinteger(L, 1); + int b = luax_checkinteger(L, 2); + luax_pushinteger(L, a ^ b); + return 1; + } - LUA_IMPLEMENT int l_not(lua_State* L) - { - int n = luax_checkinteger(L, 1); - luax_pushinteger(L, ~n); - return 1; - } + LUA_IMPLEMENT int l_not(lua_State* L) + { + int n = luax_checkinteger(L, 1); + luax_pushinteger(L, ~n); + return 1; + } - LUA_IMPLEMENT int l_lshift(lua_State* L) - { - int a = luax_checkinteger(L, 1); - int b = luax_checkinteger(L, 2); - luax_pushinteger(L, a << b); - return 1; - } + LUA_IMPLEMENT int l_lshift(lua_State* L) + { + int a = luax_checkinteger(L, 1); + int b = luax_checkinteger(L, 2); + luax_pushinteger(L, a << b); + return 1; + } - LUA_IMPLEMENT int l_rshift(lua_State* L) - { - int a = luax_checkinteger(L, 1); - int b = luax_checkinteger(L, 2); - luax_pushinteger(L, a >> b); - return 1; - } + LUA_IMPLEMENT int l_rshift(lua_State* L) + { + int a = luax_checkinteger(L, 1); + int b = luax_checkinteger(L, 2); + luax_pushinteger(L, a >> b); + return 1; + } - LUA_IMPLEMENT int l_include(lua_State* L) - { - int a = luax_checkinteger(L, 1); - int b = luax_checkinteger(L, 2); - luax_pushboolean(L, (a & b) == b); - return 1; - } - - LUA_EXPORT int luaopen_bit(lua_State* L) - { - luaL_Reg methods[] = { - { "bAnd", l_and }, - { "bOr" , l_or }, - { "bXor", l_xor }, - { "bNot", l_not }, - { "bLs", l_lshift }, - { "bRs", l_rshift }, - { "bInc", l_include }, - { 0, 0 } - }; + LUA_IMPLEMENT int l_include(lua_State* L) + { + int a = luax_checkinteger(L, 1); + int b = luax_checkinteger(L, 2); + luax_pushboolean(L, (a & b) == b); + return 1; + } + + LUA_EXPORT int luaopen_bit(lua_State* L) + { + luaL_Reg methods[] = { + { "bAnd", l_and }, + { "bOr" , l_or }, + { "bXor", l_xor }, + { "bNot", l_not }, + { "bLs", l_lshift }, + { "bRs", l_rshift }, + { "bInc", l_include }, + { 0, 0 } + }; - luax_newlib(L, methods); + luax_newlib(L, methods); - return 1; - } + return 1; + } - } // namespace Lua + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/bit/l_bit.h b/src/libjin-lua/modules/bit/l_bit.h index 21cf064..31d3585 100644 --- a/src/libjin-lua/modules/bit/l_bit.h +++ b/src/libjin-lua/modules/bit/l_bit.h @@ -3,12 +3,12 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - int luaopen_bit(lua_State* L); + int luaopen_bit(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/core/l_core.cpp b/src/libjin-lua/modules/core/l_core.cpp index 68b8156..6935179 100644 --- a/src/libjin-lua/modules/core/l_core.cpp +++ b/src/libjin-lua/modules/core/l_core.cpp @@ -6,41 +6,41 @@ using namespace JinEngine::Game; namespace JinEngine { - namespace Lua - { - - LUA_IMPLEMENT int l_running(lua_State* L) - { - static Application* app = Application::get(); - bool running = app->running(); - luax_pushboolean(L, running); - return 1; - } - - LUA_IMPLEMENT int l_stop(lua_State* L) - { - Application::get()->stop(); - return 0; - } - - LUA_IMPLEMENT int l_quit(lua_State* L) - { - Application::get()->quit(); - return 0; - } - - LUA_EXPORT int luaopen_core(lua_State* L) - { - luaL_Reg methods[] = { - { "running", l_running }, - { "stop", l_stop }, - { "quit", l_quit }, - { 0, 0 } - }; - luax_newlib(L, methods); - - return 1; - } - - } // namespace Lua + namespace Lua + { + + LUA_IMPLEMENT int l_running(lua_State* L) + { + static Application* app = Application::get(); + bool running = app->running(); + luax_pushboolean(L, running); + return 1; + } + + LUA_IMPLEMENT int l_stop(lua_State* L) + { + Application::get()->stop(); + return 0; + } + + LUA_IMPLEMENT int l_quit(lua_State* L) + { + Application::get()->quit(); + return 0; + } + + LUA_EXPORT int luaopen_core(lua_State* L) + { + luaL_Reg methods[] = { + { "running", l_running }, + { "stop", l_stop }, + { "quit", l_quit }, + { 0, 0 } + }; + luax_newlib(L, methods); + + return 1; + } + + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/core/l_core.h b/src/libjin-lua/modules/core/l_core.h index 037ac4b..86b20a4 100644 --- a/src/libjin-lua/modules/core/l_core.h +++ b/src/libjin-lua/modules/core/l_core.h @@ -3,12 +3,12 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - int luaopen_core(lua_State* L); + int luaopen_core(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/event/l_event.cpp b/src/libjin-lua/modules/event/l_event.cpp index 8287238..c9d6a13 100644 --- a/src/libjin-lua/modules/event/l_event.cpp +++ b/src/libjin-lua/modules/event/l_event.cpp @@ -10,121 +10,121 @@ using namespace JinEngine::Input; namespace JinEngine { - namespace Lua - { + namespace Lua + { - /** - * Load event poll, return a iterator(a table). - */ - LUA_IMPLEMENT int l_event_poll(lua_State *L) - { - /* table to store events */ - luax_newtable(L); - static Event e; - int i = 1; - poll: - while (pollEvent(&e)) - { - /** - * TODO: ڴСıʱҪtransform - * - */ - luax_newtable(L); - switch (e.type) - { - case EventType::QUIT: - luax_setfieldstring(L, "type", "Quit"); - break; + /** + * Load event poll, return a iterator(a table). + */ + LUA_IMPLEMENT int l_event_poll(lua_State *L) + { + /* table to store events */ + luax_newtable(L); + static Event e; + int i = 1; + poll: + while (pollEvent(&e)) + { + /** + * TODO: ڴСıʱҪtransform + * + */ + luax_newtable(L); + switch (e.type) + { + case EventType::QUIT: + luax_setfieldstring(L, "type", "Quit"); + break; - case EventType::KEY_DOWN: - case EventType::KEY_UP: - luax_setfieldstring(L, "type", e.type == EventType::KEY_DOWN ? "KeyDown" : "KeyUp"); - luax_setfieldstring(L, "key", getKeyName(e.key.keysym.sym)); - break; - - case EventType::MOUSE_MOTION: - luax_setfieldstring(L, "type", "MouseMotion"); - luax_setfieldnumber(L, "x", e.motion.x); - luax_setfieldnumber(L, "y", e.motion.y); - break; - - case EventType::MOUSE_BUTTON_DOWN: - case EventType::MOUSE_BUTTON_UP: - luax_setfieldstring(L, "type", e.type == EventType::MOUSE_BUTTON_DOWN ? "MouseButtonDown" : "MouseButtonUp"); - luax_setfieldstring(L, "button", getButtonName(e.button.button)); - luax_setfieldnumber(L, "x", e.button.x); - luax_setfieldnumber(L, "y", e.button.y); - break; - - case EventType::MOUSE_WHEEL: - luax_setfieldstring(L, "type", "Wheel"); - if(e.wheel.x == -1) - luax_setfieldstring(L, "x", "Left"); - else if(e.wheel.x == 1) - luax_setfieldstring(L, "x", "Right"); - else - luax_setfieldstring(L, "x", "None"); - if (e.wheel.y == -1) - luax_setfieldstring(L, "y", "Near"); - else if (e.wheel.y == 1) - luax_setfieldstring(L, "y", "Far"); - else - luax_setfieldstring(L, "y", "None"); - break; - - case EventType::JOYBUTTONDOWN: - case EventType::JOYBUTTONUP: - luax_setfieldstring(L, "type", e.type == EventType::JOYBUTTONDOWN ? "JoyButtonDown" : "JoyButtonUp"); - luax_setfieldinteger(L, "which", e.jbutton.which); - luax_setfieldstring(L, "button", Input::getJoyButtonName(e.jbutton.button)); - break; + case EventType::KEY_DOWN: + case EventType::KEY_UP: + luax_setfieldstring(L, "type", e.type == EventType::KEY_DOWN ? "KeyDown" : "KeyUp"); + luax_setfieldstring(L, "key", getKeyName(e.key.keysym.sym)); + break; + + case EventType::MOUSE_MOTION: + luax_setfieldstring(L, "type", "MouseMotion"); + luax_setfieldnumber(L, "x", e.motion.x); + luax_setfieldnumber(L, "y", e.motion.y); + break; + + case EventType::MOUSE_BUTTON_DOWN: + case EventType::MOUSE_BUTTON_UP: + luax_setfieldstring(L, "type", e.type == EventType::MOUSE_BUTTON_DOWN ? "MouseButtonDown" : "MouseButtonUp"); + luax_setfieldstring(L, "button", getButtonName(e.button.button)); + luax_setfieldnumber(L, "x", e.button.x); + luax_setfieldnumber(L, "y", e.button.y); + break; + + case EventType::MOUSE_WHEEL: + luax_setfieldstring(L, "type", "Wheel"); + if(e.wheel.x == -1) + luax_setfieldstring(L, "x", "Left"); + else if(e.wheel.x == 1) + luax_setfieldstring(L, "x", "Right"); + else + luax_setfieldstring(L, "x", "None"); + if (e.wheel.y == -1) + luax_setfieldstring(L, "y", "Near"); + else if (e.wheel.y == 1) + luax_setfieldstring(L, "y", "Far"); + else + luax_setfieldstring(L, "y", "None"); + break; + + case EventType::JOYBUTTONDOWN: + case EventType::JOYBUTTONUP: + luax_setfieldstring(L, "type", e.type == EventType::JOYBUTTONDOWN ? "JoyButtonDown" : "JoyButtonUp"); + luax_setfieldinteger(L, "which", e.jbutton.which); + luax_setfieldstring(L, "button", Input::getJoyButtonName(e.jbutton.button)); + break; - case EventType::JOYAXISMOTION: - luax_setfieldstring(L, "type", "JoyAxisMotion"); - luax_setfieldinteger(L, "which", e.jaxis.which); - luax_setfieldfstring(L, "axis", Input::getJoyAxisName(e.jaxis.axis)); - break; + case EventType::JOYAXISMOTION: + luax_setfieldstring(L, "type", "JoyAxisMotion"); + luax_setfieldinteger(L, "which", e.jaxis.which); + luax_setfieldfstring(L, "axis", Input::getJoyAxisName(e.jaxis.axis)); + break; - case EventType::JOYBALLMOTION: - case EventType::JOYHATMOTION: + case EventType::JOYBALLMOTION: + case EventType::JOYHATMOTION: - case EventType::JOYDEVICEADDED: - case EventType::JOYDEVICEREMOVED: - luax_setfieldfstring(L, "type", e.type == EventType::JOYDEVICEADDED ? "JoyDeviceAdded" : "JoyDeviceRemoved"); - luax_setfieldinteger(L, "which", e.jdevice.which); - break; + case EventType::JOYDEVICEADDED: + case EventType::JOYDEVICEREMOVED: + luax_setfieldfstring(L, "type", e.type == EventType::JOYDEVICEADDED ? "JoyDeviceAdded" : "JoyDeviceRemoved"); + luax_setfieldinteger(L, "which", e.jdevice.which); + break; - //https://stackoverflow.com/questions/50022316/what-is-sdl-joystick-and-what-is-sdl-gamecontroller-what-are-the-relationships - case EventType::CONTROLLERBUTTONDOWN: - case EventType::CONTROLLERBUTTONUP: + //https://stackoverflow.com/questions/50022316/what-is-sdl-joystick-and-what-is-sdl-gamecontroller-what-are-the-relationships + case EventType::CONTROLLERBUTTONDOWN: + case EventType::CONTROLLERBUTTONUP: - case EventType::CONTROLLERAXISMOTION: + case EventType::CONTROLLERAXISMOTION: - default: - // Ignore oter events and pop up the event table. - luax_pop(L, 1); - goto poll; - break; - } - luax_rawseti(L, -2, i++); - } - return 1; - } + default: + // Ignore oter events and pop up the event table. + luax_pop(L, 1); + goto poll; + break; + } + luax_rawseti(L, -2, i++); + } + return 1; + } - /** - * load event module - */ - LUA_EXPORT int luaopen_event(lua_State* L) - { - luaL_Reg methods[] = { - { "poll", l_event_poll }, - { 0, 0 } - }; - luax_newlib(L, methods); + /** + * load event module + */ + LUA_EXPORT int luaopen_event(lua_State* L) + { + luaL_Reg methods[] = { + { "poll", l_event_poll }, + { 0, 0 } + }; + luax_newlib(L, methods); - return 1; - } + return 1; + } - } // namespace Lua + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/event/l_event.h b/src/libjin-lua/modules/event/l_event.h index 7a75459..1b593c8 100644 --- a/src/libjin-lua/modules/event/l_event.h +++ b/src/libjin-lua/modules/event/l_event.h @@ -3,12 +3,12 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - int luaopen_event(lua_State* L); + int luaopen_event(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/filesystem/l_filesystem.h b/src/libjin-lua/modules/filesystem/l_filesystem.h index 1e1ff23..b47b3c0 100644 --- a/src/libjin-lua/modules/filesystem/l_filesystem.h +++ b/src/libjin-lua/modules/filesystem/l_filesystem.h @@ -3,12 +3,12 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - int luaopen_filesystem(lua_State* L); + int luaopen_filesystem(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_animation.cpp b/src/libjin-lua/modules/graphics/l_animation.cpp index 0bf133f..9fb7590 100644 --- a/src/libjin-lua/modules/graphics/l_animation.cpp +++ b/src/libjin-lua/modules/graphics/l_animation.cpp @@ -16,107 +16,107 @@ using namespace JinEngine::Graphics::Animations; namespace JinEngine { - namespace Lua - { - const char* Jin_Lua_Animation = "Animation"; + namespace Lua + { + const char* Jin_Lua_Animation = "Animation"; - LUA_IMPLEMENT inline Animation* checkAnimation(lua_State* L) - { - LuaObject* luaObj = luax_checkobject(L, 1, Jin_Lua_Animation); - return luaObj->getObject<Animation>(); - } + LUA_IMPLEMENT inline Animation* checkAnimation(lua_State* L) + { + LuaObject* luaObj = luax_checkobject(L, 1, Jin_Lua_Animation); + return luaObj->getObject<Animation>(); + } - LUA_IMPLEMENT int l_gc(lua_State* L) - { - LuaObject* p = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animation); - p->release(); - return 0; - } + LUA_IMPLEMENT int l_gc(lua_State* L) + { + LuaObject* p = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animation); + p->release(); + return 0; + } - // addFrame(frame) - LUA_IMPLEMENT int l_addFrame(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animation); - Animation* animation = luaObj->getObject<Animation>(); - LuaObject* luaSprite = (LuaObject*)luax_checktype(L, 2, Jin_Lua_Sprite); - Sprite* sprite = luaSprite->getObject<Sprite>(); - animation->addFrame(sprite); - int i = animation->getFrameCount() - 1; - luaObj->setDependency((int)AnimationDependency::DEP_SPRITES + i, luaSprite); - return 0; - } + // addFrame(frame) + LUA_IMPLEMENT int l_addFrame(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animation); + Animation* animation = luaObj->getObject<Animation>(); + LuaObject* luaSprite = (LuaObject*)luax_checktype(L, 2, Jin_Lua_Sprite); + Sprite* sprite = luaSprite->getObject<Sprite>(); + animation->addFrame(sprite); + int i = animation->getFrameCount() - 1; + luaObj->setDependency((int)AnimationDependency::DEP_SPRITES + i, luaSprite); + return 0; + } - // addFrames(frames table) - LUA_IMPLEMENT int l_addFrames(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animation); - Animation* shrAnimation = luaObj->getObject<Animation>(); - if (!luax_istable(L, 2)) - { - luax_typerror(L, 2, "sprites table"); - return 1; - } - int n = luax_tableidxlen(L, 2); - for (int i = 1; i <= n; ++i) - { - luax_rawgeti(L, 2, i); - LuaObject* luaSprite = (LuaObject*)luax_checktype(L, -1, Jin_Lua_Sprite); - Sprite* sprite = luaSprite->getObject<Sprite>(); - shrAnimation->addFrame(sprite); - int index = shrAnimation->getFrameCount() - 1; - luaObj->setDependency((int)AnimationDependency::DEP_SPRITES + index, luaSprite); - } - return 0; - } + // addFrames(frames table) + LUA_IMPLEMENT int l_addFrames(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animation); + Animation* shrAnimation = luaObj->getObject<Animation>(); + if (!luax_istable(L, 2)) + { + luax_typerror(L, 2, "sprites table"); + return 1; + } + int n = luax_tableidxlen(L, 2); + for (int i = 1; i <= n; ++i) + { + luax_rawgeti(L, 2, i); + LuaObject* luaSprite = (LuaObject*)luax_checktype(L, -1, Jin_Lua_Sprite); + Sprite* sprite = luaSprite->getObject<Sprite>(); + shrAnimation->addFrame(sprite); + int index = shrAnimation->getFrameCount() - 1; + luaObj->setDependency((int)AnimationDependency::DEP_SPRITES + index, luaSprite); + } + return 0; + } - LUA_IMPLEMENT int l_isLoop(lua_State* L) - { - Animation* shrAnimation = checkAnimation(L); - bool loop = shrAnimation->isLoop(); - luax_pushboolean(L, loop); - return 1; - } + LUA_IMPLEMENT int l_isLoop(lua_State* L) + { + Animation* shrAnimation = checkAnimation(L); + bool loop = shrAnimation->isLoop(); + luax_pushboolean(L, loop); + return 1; + } - LUA_IMPLEMENT int l_getSpeed(lua_State* L) - { - Animation* shrAnimation = checkAnimation(L); - float speed = shrAnimation->getSpeed(); - luax_pushnumber(L, speed); - return 1; - } + LUA_IMPLEMENT int l_getSpeed(lua_State* L) + { + Animation* shrAnimation = checkAnimation(L); + float speed = shrAnimation->getSpeed(); + luax_pushnumber(L, speed); + return 1; + } - LUA_IMPLEMENT int l_getFrame(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animation); - Animation* shrAnimation = luaObj->getObject<Animation>(); - int i = luax_checkinteger(L, 2); - LuaObject* frame = luaObj->getDependency((int)AnimationDependency::DEP_SPRITES + i); - luax_getobject(L, frame); - return 1; - } + LUA_IMPLEMENT int l_getFrame(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animation); + Animation* shrAnimation = luaObj->getObject<Animation>(); + int i = luax_checkinteger(L, 2); + LuaObject* frame = luaObj->getDependency((int)AnimationDependency::DEP_SPRITES + i); + luax_getobject(L, frame); + return 1; + } - LUA_IMPLEMENT int getFrameCount(lua_State* L) - { - Animation* shrAnimation = checkAnimation(L); - int n = shrAnimation->getFrameCount(); - luax_pushinteger(L, n); - return 1; - } + LUA_IMPLEMENT int getFrameCount(lua_State* L) + { + Animation* shrAnimation = checkAnimation(L); + int n = shrAnimation->getFrameCount(); + luax_pushinteger(L, n); + return 1; + } - LUA_EXPORT void luaopen_Animation(lua_State* L) - { - luaL_Reg methods[] = { - { "__gc", l_gc }, - { "addFrame", l_addFrame }, - { "addFrames", l_addFrames }, - { "isLoop", l_isLoop }, - { "getSpeed", l_getSpeed }, - { "getFrameCount", getFrameCount }, - { "getFrame", l_getFrame }, - { 0, 0 } - }; - luax_newtype(L, Jin_Lua_Animation, methods); - } + LUA_EXPORT void luaopen_Animation(lua_State* L) + { + luaL_Reg methods[] = { + { "__gc", l_gc }, + { "addFrame", l_addFrame }, + { "addFrames", l_addFrames }, + { "isLoop", l_isLoop }, + { "getSpeed", l_getSpeed }, + { "getFrameCount", getFrameCount }, + { "getFrame", l_getFrame }, + { 0, 0 } + }; + luax_newtype(L, Jin_Lua_Animation, methods); + } - } // namespace Lua + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_animation.h b/src/libjin-lua/modules/graphics/l_animation.h index 1b32ec3..eb308a8 100644 --- a/src/libjin-lua/modules/graphics/l_animation.h +++ b/src/libjin-lua/modules/graphics/l_animation.h @@ -3,22 +3,22 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - extern const char* Jin_Lua_Animation; + extern const char* Jin_Lua_Animation; - /// - /// - /// - enum class AnimationDependency - { - DEP_SPRITES = 1 ///< Index from 1 - }; + /// + /// + /// + enum class AnimationDependency + { + DEP_SPRITES = 1 ///< Index from 1 + }; - void luaopen_Animation(lua_State* L); + void luaopen_Animation(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_animator.cpp b/src/libjin-lua/modules/graphics/l_animator.cpp index 7927ca4..404fa26 100644 --- a/src/libjin-lua/modules/graphics/l_animator.cpp +++ b/src/libjin-lua/modules/graphics/l_animator.cpp @@ -16,148 +16,148 @@ using namespace JinEngine::Graphics::Animations; namespace JinEngine { - namespace Lua - { - const char* Jin_Lua_Animator = "Animator"; - - LUA_IMPLEMENT inline Animator* checkAnimator(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animator); - return luaObj->getObject<Animator>(); - } - - LUA_IMPLEMENT int l_gc(lua_State* L) - { - LuaObject* obj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animation); - obj->release(); - return 0; - } - - LUA_IMPLEMENT int l_update(lua_State* L) - { - Animator* animator = checkAnimator(L); - float dt = luax_checknumber(L, 2); - animator->update(dt); - return 0; - } - - LUA_IMPLEMENT int l_play(lua_State* L) - { - Animator* animator = checkAnimator(L); - animator->play(); - return 0; - } - - LUA_IMPLEMENT int l_pause(lua_State* L) - { - Animator* animator = checkAnimator(L); - animator->pause(); - return 0; - } - - LUA_IMPLEMENT int l_resume(lua_State* L) - { - Animator* animator = checkAnimator(L); - animator->resume(); - return 0; - } - - LUA_IMPLEMENT int l_rewind(lua_State* L) - { - Animator* animator = checkAnimator(L); - animator->rewind(); - return 0; - } - - LUA_IMPLEMENT int l_render(lua_State* L) - { - Animator* animator = checkAnimator(L); - float x = luax_checknumber(L, 2); - float y = luax_checknumber(L, 3); - float sx = luax_checknumber(L, 4); - float sy = luax_checknumber(L, 5); - float r = luax_checknumber(L, 6); - animator->render(x, y, sx, sy, r); - return 0; - } - - LUA_IMPLEMENT int l_setAnimation(lua_State* L) - { - LuaObject* luaAnimator = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animator); - Animator* animator = luaAnimator->getObject<Animator>(); - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animation); - luaAnimator->setDependency((int)AnimatorDependency::DEP_ANIMATION, luaObj); - animator->setAnimation(luaObj->getObject<Animation>()); - return 0; - } - - LUA_IMPLEMENT int l_forceToFrame(lua_State* L) - { - Animator* shrAnimator = checkAnimator(L); - int index = luax_checkinteger(L, 2); - shrAnimator->forceToFrame(index); - return 0; - } - - LUA_IMPLEMENT int l_setSpeed(lua_State* L) - { - Animator* shrAnimator = checkAnimator(L); - float fps = luax_checknumber(L, 2); - shrAnimator->setSpeed(fps); - return 0; - } - - LUA_IMPLEMENT int l_setDefaultSpeed(lua_State* L) - { - Animator* shrAnimator = checkAnimator(L); - shrAnimator->setDefaultSpeed(); - return 0; - } - - LUA_IMPLEMENT int l_setLoop(lua_State* L) - { - Animator* shrAnimator = checkAnimator(L); - bool loop = luax_checkbool(L, 2); - shrAnimator->setLoop(loop); - return 0; - } - - LUA_IMPLEMENT int l_setDefaultLoop(lua_State* L) - { - Animator* shrAnimator = checkAnimator(L); - shrAnimator->setDefaultLoop(); - return 0; - } - - LUA_IMPLEMENT int l_getSpeed(lua_State* L) - { - Animator* shrAnimator = checkAnimator(L); - float speed = shrAnimator->getSpeed(); - luax_pushnumber(L, speed); - return 1; - } - - LUA_EXPORT void luaopen_Animator(lua_State* L) - { - luaL_Reg methods[] = { - { "__gc", l_gc }, - { "update", l_update }, - { "play", l_play }, - { "pause", l_pause }, - { "resume", l_resume }, - { "rewind", l_rewind }, - { "render", l_render }, - { "setAnimation", l_setAnimation }, - { "forceToFrame", l_forceToFrame }, - { "setSpeed", l_setSpeed }, - { "setDefaultSpeed", l_setDefaultSpeed }, - { "setLoop", l_setLoop }, - { "setDefaultLoop", l_setDefaultLoop }, - { "getSpeed", l_getSpeed }, - { 0, 0 } - }; - luax_newtype(L, Jin_Lua_Animator, methods); - } - - } // namespace Lua + namespace Lua + { + const char* Jin_Lua_Animator = "Animator"; + + LUA_IMPLEMENT inline Animator* checkAnimator(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animator); + return luaObj->getObject<Animator>(); + } + + LUA_IMPLEMENT int l_gc(lua_State* L) + { + LuaObject* obj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animation); + obj->release(); + return 0; + } + + LUA_IMPLEMENT int l_update(lua_State* L) + { + Animator* animator = checkAnimator(L); + float dt = luax_checknumber(L, 2); + animator->update(dt); + return 0; + } + + LUA_IMPLEMENT int l_play(lua_State* L) + { + Animator* animator = checkAnimator(L); + animator->play(); + return 0; + } + + LUA_IMPLEMENT int l_pause(lua_State* L) + { + Animator* animator = checkAnimator(L); + animator->pause(); + return 0; + } + + LUA_IMPLEMENT int l_resume(lua_State* L) + { + Animator* animator = checkAnimator(L); + animator->resume(); + return 0; + } + + LUA_IMPLEMENT int l_rewind(lua_State* L) + { + Animator* animator = checkAnimator(L); + animator->rewind(); + return 0; + } + + LUA_IMPLEMENT int l_render(lua_State* L) + { + Animator* animator = checkAnimator(L); + float x = luax_checknumber(L, 2); + float y = luax_checknumber(L, 3); + float sx = luax_checknumber(L, 4); + float sy = luax_checknumber(L, 5); + float r = luax_checknumber(L, 6); + animator->render(x, y, sx, sy, r); + return 0; + } + + LUA_IMPLEMENT int l_setAnimation(lua_State* L) + { + LuaObject* luaAnimator = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animator); + Animator* animator = luaAnimator->getObject<Animator>(); + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Animation); + luaAnimator->setDependency((int)AnimatorDependency::DEP_ANIMATION, luaObj); + animator->setAnimation(luaObj->getObject<Animation>()); + return 0; + } + + LUA_IMPLEMENT int l_forceToFrame(lua_State* L) + { + Animator* shrAnimator = checkAnimator(L); + int index = luax_checkinteger(L, 2); + shrAnimator->forceToFrame(index); + return 0; + } + + LUA_IMPLEMENT int l_setSpeed(lua_State* L) + { + Animator* shrAnimator = checkAnimator(L); + float fps = luax_checknumber(L, 2); + shrAnimator->setSpeed(fps); + return 0; + } + + LUA_IMPLEMENT int l_setDefaultSpeed(lua_State* L) + { + Animator* shrAnimator = checkAnimator(L); + shrAnimator->setDefaultSpeed(); + return 0; + } + + LUA_IMPLEMENT int l_setLoop(lua_State* L) + { + Animator* shrAnimator = checkAnimator(L); + bool loop = luax_checkbool(L, 2); + shrAnimator->setLoop(loop); + return 0; + } + + LUA_IMPLEMENT int l_setDefaultLoop(lua_State* L) + { + Animator* shrAnimator = checkAnimator(L); + shrAnimator->setDefaultLoop(); + return 0; + } + + LUA_IMPLEMENT int l_getSpeed(lua_State* L) + { + Animator* shrAnimator = checkAnimator(L); + float speed = shrAnimator->getSpeed(); + luax_pushnumber(L, speed); + return 1; + } + + LUA_EXPORT void luaopen_Animator(lua_State* L) + { + luaL_Reg methods[] = { + { "__gc", l_gc }, + { "update", l_update }, + { "play", l_play }, + { "pause", l_pause }, + { "resume", l_resume }, + { "rewind", l_rewind }, + { "render", l_render }, + { "setAnimation", l_setAnimation }, + { "forceToFrame", l_forceToFrame }, + { "setSpeed", l_setSpeed }, + { "setDefaultSpeed", l_setDefaultSpeed }, + { "setLoop", l_setLoop }, + { "setDefaultLoop", l_setDefaultLoop }, + { "getSpeed", l_getSpeed }, + { 0, 0 } + }; + luax_newtype(L, Jin_Lua_Animator, methods); + } + + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_animator.h b/src/libjin-lua/modules/graphics/l_animator.h index 0292a77..0fdd78c 100644 --- a/src/libjin-lua/modules/graphics/l_animator.h +++ b/src/libjin-lua/modules/graphics/l_animator.h @@ -5,19 +5,19 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - extern const char* Jin_Lua_Animator; + extern const char* Jin_Lua_Animator; - enum class AnimatorDependency - { - DEP_ANIMATION = 1 - }; + enum class AnimatorDependency + { + DEP_ANIMATION = 1 + }; - void luaopen_Animator(lua_State* L); + void luaopen_Animator(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_bitmap.cpp b/src/libjin-lua/modules/graphics/l_bitmap.cpp index c081cef..6b4bbce 100644 --- a/src/libjin-lua/modules/graphics/l_bitmap.cpp +++ b/src/libjin-lua/modules/graphics/l_bitmap.cpp @@ -8,103 +8,103 @@ using namespace JinEngine::Graphics; namespace JinEngine { - namespace Lua - { + namespace Lua + { - const char* Jin_Lua_Bitmap = "Bitmap"; + const char* Jin_Lua_Bitmap = "Bitmap"; - LUA_IMPLEMENT inline Bitmap* checkBitmap(lua_State* L) - { - LuaObject* luaObj = luax_checkobject(L, 1, Jin_Lua_Bitmap); - return luaObj->getObject<Bitmap>(); - } + LUA_IMPLEMENT inline Bitmap* checkBitmap(lua_State* L) + { + LuaObject* luaObj = luax_checkobject(L, 1, Jin_Lua_Bitmap); + return luaObj->getObject<Bitmap>(); + } - LUA_IMPLEMENT int l_gc(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Bitmap); - luaObj->release(); - return 0; - } + LUA_IMPLEMENT int l_gc(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Bitmap); + luaObj->release(); + return 0; + } - LUA_IMPLEMENT int l_getWidth(lua_State* L) - { - Bitmap* bitmap = checkBitmap(L); - int w = bitmap->getWidth(); - luax_pushinteger(L, w); - return 1; - } + LUA_IMPLEMENT int l_getWidth(lua_State* L) + { + Bitmap* bitmap = checkBitmap(L); + int w = bitmap->getWidth(); + luax_pushinteger(L, w); + return 1; + } - LUA_IMPLEMENT int l_getHeight(lua_State* L) - { - Bitmap* bitmap = checkBitmap(L); - int h = bitmap->getHeight(); - luax_pushinteger(L, h); - return 1; - } + LUA_IMPLEMENT int l_getHeight(lua_State* L) + { + Bitmap* bitmap = checkBitmap(L); + int h = bitmap->getHeight(); + luax_pushinteger(L, h); + return 1; + } - LUA_IMPLEMENT int l_getSize(lua_State* L) - { - Bitmap* bitmap = checkBitmap(L); - int w = bitmap->getWidth(); - int h = bitmap->getHeight(); - luax_pushinteger(L, w); - luax_pushinteger(L, h); - return 2; - } + LUA_IMPLEMENT int l_getSize(lua_State* L) + { + Bitmap* bitmap = checkBitmap(L); + int w = bitmap->getWidth(); + int h = bitmap->getHeight(); + luax_pushinteger(L, w); + luax_pushinteger(L, h); + return 2; + } - LUA_IMPLEMENT int l_getPixel(lua_State* L) - { - Bitmap* bitmap = checkBitmap(L); - int x = luax_checkinteger(L, 2); - int y = luax_checkinteger(L, 3); - Color col = bitmap->getPixel(x, y); - luax_pushinteger(L, col.r); - luax_pushinteger(L, col.g); - luax_pushinteger(L, col.b); - luax_pushinteger(L, col.a); - return 4; - } + LUA_IMPLEMENT int l_getPixel(lua_State* L) + { + Bitmap* bitmap = checkBitmap(L); + int x = luax_checkinteger(L, 2); + int y = luax_checkinteger(L, 3); + Color col = bitmap->getPixel(x, y); + luax_pushinteger(L, col.r); + luax_pushinteger(L, col.g); + luax_pushinteger(L, col.b); + luax_pushinteger(L, col.a); + return 4; + } - LUA_IMPLEMENT int l_setPixel(lua_State* L) - { - Bitmap* bitmap = checkBitmap(L); - int x = luax_checkinteger(L, 2); - int y = luax_checkinteger(L, 3); - if (!luax_istable(L, 4)) - { - luax_typerror(L, 4, "table"); - return 1; - } - unsigned int r = luax_rawgetnumber(L, 4, 1); - unsigned int g = luax_rawgetnumber(L, 4, 2); - unsigned int b = luax_rawgetnumber(L, 4, 3); - unsigned int a = luax_rawgetnumber(L, 4, 4); - bitmap->setPixel(Color(r, g, b, a), x, y); - return 0; - } + LUA_IMPLEMENT int l_setPixel(lua_State* L) + { + Bitmap* bitmap = checkBitmap(L); + int x = luax_checkinteger(L, 2); + int y = luax_checkinteger(L, 3); + if (!luax_istable(L, 4)) + { + luax_typerror(L, 4, "table"); + return 1; + } + unsigned int r = luax_rawgetnumber(L, 4, 1); + unsigned int g = luax_rawgetnumber(L, 4, 2); + unsigned int b = luax_rawgetnumber(L, 4, 3); + unsigned int a = luax_rawgetnumber(L, 4, 4); + bitmap->setPixel(Color(r, g, b, a), x, y); + return 0; + } - LUA_IMPLEMENT int l_clone(lua_State* L) - { - Bitmap* bitmap = checkBitmap(L); - Bitmap* b = bitmap->clone(); - LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Bitmap, new Shared(b)); - return 1; - } - - LUA_EXPORT void luaopen_Bitmap(lua_State* L) - { - luaL_Reg methods[] = { - { "__gc", l_gc }, - { "getWidth", l_getWidth }, - { "getHeight", l_getHeight }, - { "getSize", l_getSize }, - { "getPixel", l_getPixel }, - { "setPixel", l_setPixel }, - { "clone", l_clone }, - { 0, 0 } - }; - luax_newtype(L, Jin_Lua_Bitmap, methods); - } + LUA_IMPLEMENT int l_clone(lua_State* L) + { + Bitmap* bitmap = checkBitmap(L); + Bitmap* b = bitmap->clone(); + LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Bitmap, new Shared(b)); + return 1; + } + + LUA_EXPORT void luaopen_Bitmap(lua_State* L) + { + luaL_Reg methods[] = { + { "__gc", l_gc }, + { "getWidth", l_getWidth }, + { "getHeight", l_getHeight }, + { "getSize", l_getSize }, + { "getPixel", l_getPixel }, + { "setPixel", l_setPixel }, + { "clone", l_clone }, + { 0, 0 } + }; + luax_newtype(L, Jin_Lua_Bitmap, methods); + } - } // namespace Graphics + } // namespace Graphics } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_bitmap.h b/src/libjin-lua/modules/graphics/l_bitmap.h index b463d83..51a69f1 100644 --- a/src/libjin-lua/modules/graphics/l_bitmap.h +++ b/src/libjin-lua/modules/graphics/l_bitmap.h @@ -3,14 +3,14 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - extern const char* Jin_Lua_Bitmap; + extern const char* Jin_Lua_Bitmap; - void luaopen_Bitmap(lua_State* L); + void luaopen_Bitmap(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_canvas.cpp b/src/libjin-lua/modules/graphics/l_canvas.cpp index 3979085..87737e9 100644 --- a/src/libjin-lua/modules/graphics/l_canvas.cpp +++ b/src/libjin-lua/modules/graphics/l_canvas.cpp @@ -7,57 +7,57 @@ using namespace JinEngine::Graphics; namespace JinEngine { - namespace Lua - { - - const char* Jin_Lua_Canvas = "Canvas"; - - LUA_IMPLEMENT inline Canvas* checkCanvas(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Canvas); - return luaObj->getObject<Canvas>(); - } - - LUA_IMPLEMENT int l_getWidth(lua_State* L) - { - Canvas* canvas = checkCanvas(L); - luax_pushnumber(L, canvas->getWidth()); - return 1; - } - - LUA_IMPLEMENT int l_getHeight(lua_State* L) - { - Canvas* canvas = checkCanvas(L); - luax_pushnumber(L, canvas->getHeight()); - return 1; - } - - LUA_IMPLEMENT int l_getSize(lua_State* L) - { - Canvas* canvas = checkCanvas(L); - luax_pushnumber(L, canvas->getWidth()); - luax_pushnumber(L, canvas->getHeight()); - return 2; - } - - LUA_IMPLEMENT int l_gc(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Canvas); - luaObj->release(); - return 0; - } - - LUA_EXPORT void luaopen_Canvas(lua_State* L) - { - luaL_Reg methods[] = { - { "__gc", l_gc }, - { "getWidth", l_getWidth }, - { "getHeight", l_getHeight }, - { "getSize", l_getSize }, - { 0, 0 } - }; - luax_newtype(L, Jin_Lua_Canvas, methods); - } - - } // namespace Lua + namespace Lua + { + + const char* Jin_Lua_Canvas = "Canvas"; + + LUA_IMPLEMENT inline Canvas* checkCanvas(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Canvas); + return luaObj->getObject<Canvas>(); + } + + LUA_IMPLEMENT int l_getWidth(lua_State* L) + { + Canvas* canvas = checkCanvas(L); + luax_pushnumber(L, canvas->getWidth()); + return 1; + } + + LUA_IMPLEMENT int l_getHeight(lua_State* L) + { + Canvas* canvas = checkCanvas(L); + luax_pushnumber(L, canvas->getHeight()); + return 1; + } + + LUA_IMPLEMENT int l_getSize(lua_State* L) + { + Canvas* canvas = checkCanvas(L); + luax_pushnumber(L, canvas->getWidth()); + luax_pushnumber(L, canvas->getHeight()); + return 2; + } + + LUA_IMPLEMENT int l_gc(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Canvas); + luaObj->release(); + return 0; + } + + LUA_EXPORT void luaopen_Canvas(lua_State* L) + { + luaL_Reg methods[] = { + { "__gc", l_gc }, + { "getWidth", l_getWidth }, + { "getHeight", l_getHeight }, + { "getSize", l_getSize }, + { 0, 0 } + }; + luax_newtype(L, Jin_Lua_Canvas, methods); + } + + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_canvas.h b/src/libjin-lua/modules/graphics/l_canvas.h index d1fa885..80f5329 100644 --- a/src/libjin-lua/modules/graphics/l_canvas.h +++ b/src/libjin-lua/modules/graphics/l_canvas.h @@ -3,14 +3,14 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - extern const char* Jin_Lua_Canvas; + extern const char* Jin_Lua_Canvas; - void luaopen_Canvas(lua_State* L); + void luaopen_Canvas(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_graphics.h b/src/libjin-lua/modules/graphics/l_graphics.h index 02a2c63..7bfb84b 100644 --- a/src/libjin-lua/modules/graphics/l_graphics.h +++ b/src/libjin-lua/modules/graphics/l_graphics.h @@ -3,12 +3,12 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - int luaopen_graphics(lua_State* L); + int luaopen_graphics(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_mesh.cpp b/src/libjin-lua/modules/graphics/l_mesh.cpp index 73e0024..8e7581c 100644 --- a/src/libjin-lua/modules/graphics/l_mesh.cpp +++ b/src/libjin-lua/modules/graphics/l_mesh.cpp @@ -9,79 +9,79 @@ using namespace JinEngine::Graphics; namespace JinEngine { - namespace Lua - { + namespace Lua + { - const char* Jin_Lua_Mesh = "Mesh"; + const char* Jin_Lua_Mesh = "Mesh"; - LUA_IMPLEMENT inline Mesh* checkMesh(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Mesh); - return luaObj->getObject<Mesh>(); - } + LUA_IMPLEMENT inline Mesh* checkMesh(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Mesh); + return luaObj->getObject<Mesh>(); + } - LUA_IMPLEMENT int l_getBound(lua_State* L) - { - Mesh* mesh = checkMesh(L); - BBox bbox = mesh->getBound(); - luax_pushnumber(L, bbox.l); - luax_pushnumber(L, bbox.r); - luax_pushnumber(L, bbox.t); - luax_pushnumber(L, bbox.b); - return 4; - } + LUA_IMPLEMENT int l_getBound(lua_State* L) + { + Mesh* mesh = checkMesh(L); + BBox bbox = mesh->getBound(); + luax_pushnumber(L, bbox.l); + luax_pushnumber(L, bbox.r); + luax_pushnumber(L, bbox.t); + luax_pushnumber(L, bbox.b); + return 4; + } - LUA_IMPLEMENT int l_setGraphic(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Mesh); - Mesh* mesh = luaObj->getObject<Mesh>(); - luaObj->removeDependency((int)MeshDependency::DEP_GRAPHIC); - LuaObject* obj = (LuaObject*)luax_checktype(L, 2, Jin_Lua_Texture); - mesh->setGraphic(obj->getObject<Texture>()); - luaObj->setDependency((int)MeshDependency::DEP_GRAPHIC, obj); - return 0; - } + LUA_IMPLEMENT int l_setGraphic(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Mesh); + Mesh* mesh = luaObj->getObject<Mesh>(); + luaObj->removeDependency((int)MeshDependency::DEP_GRAPHIC); + LuaObject* obj = (LuaObject*)luax_checktype(L, 2, Jin_Lua_Texture); + mesh->setGraphic(obj->getObject<Texture>()); + luaObj->setDependency((int)MeshDependency::DEP_GRAPHIC, obj); + return 0; + } - // x, y, u, v, color_table - LUA_IMPLEMENT int l_pushVertex(lua_State* L) - { - Mesh* mesh = checkMesh(L); - float x = luax_checknumber(L, 2); - float y = luax_checknumber(L, 3); - float u = luax_checknumber(L, 4); - float v = luax_checknumber(L, 5); - if (!luax_istable(L, 6)) - { - luax_typerror(L, 6, "color table"); - return 1; - } - Color c; - c.r = luax_rawgetnumberthenpop(L, -1, 1); - c.g = luax_rawgetnumberthenpop(L, -1, 2); - c.b = luax_rawgetnumberthenpop(L, -1, 3); - c.a = luax_rawgetnumberthenpop(L, -1, 4); - mesh->pushVertex(x, y, u, v, c); - return 0; - } + // x, y, u, v, color_table + LUA_IMPLEMENT int l_pushVertex(lua_State* L) + { + Mesh* mesh = checkMesh(L); + float x = luax_checknumber(L, 2); + float y = luax_checknumber(L, 3); + float u = luax_checknumber(L, 4); + float v = luax_checknumber(L, 5); + if (!luax_istable(L, 6)) + { + luax_typerror(L, 6, "color table"); + return 1; + } + Color c; + c.r = luax_rawgetnumberthenpop(L, -1, 1); + c.g = luax_rawgetnumberthenpop(L, -1, 2); + c.b = luax_rawgetnumberthenpop(L, -1, 3); + c.a = luax_rawgetnumberthenpop(L, -1, 4); + mesh->pushVertex(x, y, u, v, c); + return 0; + } - LUA_IMPLEMENT int l_gc(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Mesh); - luaObj->release(); - return 0; - } + LUA_IMPLEMENT int l_gc(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Mesh); + luaObj->release(); + return 0; + } - LUA_EXPORT void luaopen_Mesh(lua_State* L) - { - luaL_Reg methods[] = { - { "__gc", l_gc }, - { "getBound", l_getBound }, - { "setGraphic", l_setGraphic }, - { "pushVertex", l_pushVertex }, - { 0, 0 } - }; - luax_newtype(L, Jin_Lua_Mesh, methods); - } + LUA_EXPORT void luaopen_Mesh(lua_State* L) + { + luaL_Reg methods[] = { + { "__gc", l_gc }, + { "getBound", l_getBound }, + { "setGraphic", l_setGraphic }, + { "pushVertex", l_pushVertex }, + { 0, 0 } + }; + luax_newtype(L, Jin_Lua_Mesh, methods); + } - } // namespace Lua + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_mesh.h b/src/libjin-lua/modules/graphics/l_mesh.h index b3fa00e..25ad108 100644 --- a/src/libjin-lua/modules/graphics/l_mesh.h +++ b/src/libjin-lua/modules/graphics/l_mesh.h @@ -3,19 +3,19 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - enum class MeshDependency - { - DEP_GRAPHIC = 1, - }; + enum class MeshDependency + { + DEP_GRAPHIC = 1, + }; - extern const char* Jin_Lua_Mesh; + extern const char* Jin_Lua_Mesh; - void luaopen_Mesh(lua_State* L); + void luaopen_Mesh(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_page.cpp b/src/libjin-lua/modules/graphics/l_page.cpp index b7aeb95..1b3f05d 100644 --- a/src/libjin-lua/modules/graphics/l_page.cpp +++ b/src/libjin-lua/modules/graphics/l_page.cpp @@ -10,57 +10,57 @@ using namespace JinEngine::Graphics::Shaders; namespace JinEngine { - namespace Lua - { + namespace Lua + { - const char* Jin_Lua_Page = "Page"; + const char* Jin_Lua_Page = "Page"; - Page* getPage(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Page); - return luaObj->getObject<Page>(); - } + Page* getPage(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Page); + return luaObj->getObject<Page>(); + } - LUA_IMPLEMENT int l_gc(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Page); - luaObj->release(); - return 0; - } + LUA_IMPLEMENT int l_gc(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Page); + luaObj->release(); + return 0; + } - LUA_IMPLEMENT int l_getSize(lua_State* L) - { - Page* page = getPage(L); - luax_pushinteger(L, page->size.w()); - luax_pushinteger(L, page->size.h()); - return 2; - } + LUA_IMPLEMENT int l_getSize(lua_State* L) + { + Page* page = getPage(L); + luax_pushinteger(L, page->size.w()); + luax_pushinteger(L, page->size.h()); + return 2; + } - LUA_IMPLEMENT int l_getWidth(lua_State* L) - { - Page* page = getPage(L); - luax_pushinteger(L, page->size.w()); - return 1; - } + LUA_IMPLEMENT int l_getWidth(lua_State* L) + { + Page* page = getPage(L); + luax_pushinteger(L, page->size.w()); + return 1; + } - LUA_IMPLEMENT int l_getHeight(lua_State* L) - { - Page* page = getPage(L); - luax_pushinteger(L, page->size.h()); - return 1; - } + LUA_IMPLEMENT int l_getHeight(lua_State* L) + { + Page* page = getPage(L); + luax_pushinteger(L, page->size.h()); + return 1; + } - LUA_EXPORT void luaopen_Page(lua_State* L) - { - luaL_Reg methods[] = { - { "__gc", l_gc }, - { "getSize", l_getSize }, - { "getWidth", l_getWidth }, - { "getHeight", l_getHeight }, - { 0, 0 } - }; - luax_newtype(L, Jin_Lua_Page, methods); - } + LUA_EXPORT void luaopen_Page(lua_State* L) + { + luaL_Reg methods[] = { + { "__gc", l_gc }, + { "getSize", l_getSize }, + { "getWidth", l_getWidth }, + { "getHeight", l_getHeight }, + { 0, 0 } + }; + luax_newtype(L, Jin_Lua_Page, methods); + } - } // namespace Lua + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_page.h b/src/libjin-lua/modules/graphics/l_page.h index e4a21a3..c781e66 100644 --- a/src/libjin-lua/modules/graphics/l_page.h +++ b/src/libjin-lua/modules/graphics/l_page.h @@ -3,20 +3,20 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - enum class PageDependency - { - DEP_TTF = 1, - DEP_TEXTURE_FONT = 2, - }; + enum class PageDependency + { + DEP_TTF = 1, + DEP_TEXTURE_FONT = 2, + }; - extern const char* Jin_Lua_Page; + extern const char* Jin_Lua_Page; - void luaopen_Page(lua_State* L); + void luaopen_Page(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_particle_system.cpp b/src/libjin-lua/modules/graphics/l_particle_system.cpp index 5830221..8847552 100644 --- a/src/libjin-lua/modules/graphics/l_particle_system.cpp +++ b/src/libjin-lua/modules/graphics/l_particle_system.cpp @@ -14,409 +14,409 @@ using namespace JinEngine::Graphics::Particles; namespace JinEngine { - namespace Lua - { - - const char* Jin_Lua_ParticleSystem = "ParticleSystem"; - - LUA_IMPLEMENT inline ParticleSystem* checkPS(lua_State* L) - { - LuaObject* luaObj = luax_checkobject(L, 1, Jin_Lua_ParticleSystem); - return luaObj->getObject<ParticleSystem>(); - } - - LUA_IMPLEMENT int l_gc(lua_State* L) - { - LuaObject* luaObj = luax_checkobject(L, 1, Jin_Lua_ParticleSystem); - luaObj->release(); - return 0; - } - - LUA_IMPLEMENT int l_update(lua_State* L) - { - ParticleSystem* ps = checkPS(L); - float dt = luax_checknumber(L, 2); - ps->update(dt); - return 0; - } - - LUA_IMPLEMENT int l_render(lua_State* L) - { - ParticleSystem* ps = checkPS(L); - ps->render(); - return 0; - } - - LUA_IMPLEMENT int l_setPosition(lua_State* L) - { - ParticleSystem* ps = checkPS(L); - float x = luax_checknumber(L, 2); - float y = luax_checknumber(L, 3); - ps->setPosition(x, y); - return 0; - } - - LUA_IMPLEMENT int l_setScale(lua_State* L) - { - ParticleSystem* ps = checkPS(L); - float sx = luax_checknumber(L, 2); - float sy = luax_checknumber(L, 3); - //ps->setScale(sx, sy); - return 0; - } - - LUA_IMPLEMENT int l_pause(lua_State* L) - { - ParticleSystem* ps = checkPS(L); - bool b = luax_checkbool(L, 2); - //ps->pause(b); - return 0; - } - - LUA_IMPLEMENT int l_clear(lua_State* L) - { - ParticleSystem* ps = checkPS(L); - //ps->clear(); - return 0; - } - - LUA_IMPLEMENT int l_setEmitRate(lua_State* L) - { - ParticleSystem* ps = checkPS(L); - if (luax_gettop(L) >= 3) - { - float floor = luax_checknumber(L, 2); - float ceil = luax_checknumber(L, 3); - ps->setEmitRate(floor, ceil); - } - else if (luax_gettop(L) >= 2) - { - float n = luax_checknumber(L, 2); - ps->setEmitRate(n); - } - return 0; - } - - LUA_IMPLEMENT int l_setEmitForce(lua_State* L) - { - ParticleSystem* ps = checkPS(L); - if (luax_gettop(L) >= 3) - { - float floor = luax_checknumber(L, 2); - float ceil = luax_checknumber(L, 3); - ps->setEmitForce(floor, ceil); - } - else if (luax_gettop(L) >= 2) - { - float n = luax_checknumber(L, 2); - ps->setEmitForce(n); - } - return 0; - } - - LUA_IMPLEMENT int l_setEmitDirection(lua_State* L) - { - ParticleSystem* ps = checkPS(L); - if (luax_gettop(L) >= 3) - { - float floor = luax_checknumber(L, 2); - float ceil = luax_checknumber(L, 3); - ps->setEmitDirection(floor, ceil); - } - else if (luax_gettop(L) >= 2) - { - float n = luax_checknumber(L, 2); - ps->setEmitDirection(n); - } - return 0; - } - - LUA_IMPLEMENT int l_setEmitPosition(lua_State* L) - { - ParticleSystem* ps = checkPS(L); - if (luax_gettop(L) >= 3) - { - if (!luax_istable(L, 2)) - { - luax_typerror(L, 2, "table"); - return 1; - } - if (!luax_istable(L, 3)) - { - luax_typerror(L, 3, "table"); - return 1; - } - Vector2<float> floor, ceil; - floor.x() = luax_rawgetnumber(L, 2, 1); - floor.y() = luax_rawgetnumber(L, 2, 2); - ceil.x() = luax_rawgetnumber(L, 3, 1); - ceil.y() = luax_rawgetnumber(L, 3, 2); - ps->setEmitPosition(floor, ceil); - } - else if (luax_gettop(L) >= 2) - { - if (!luax_istable(L, 2)) - { - luax_typerror(L, 2, "table"); - return 1; - } - Vector2<float> pos; - pos.x() = luax_rawgetnumber(L, 2, 1); - pos.y() = luax_rawgetnumber(L, 2, 2); - ps->setEmitPosition(pos); - } - return 0; - } - - LUA_IMPLEMENT int l_setParticleLife(lua_State* L) - { - ParticleSystem* ps = checkPS(L); - if (luax_gettop(L) >= 3) - { - float floor = luax_checknumber(L, 2); - float ceil = luax_checknumber(L, 3); - ps->setParticleLife(floor, ceil); - } - else if (luax_gettop(L) >= 2) - { - float n = luax_checknumber(L, 2); - ps->setParticleLife(n); - } - return 0; - } - - LUA_IMPLEMENT int l_setParticleLinearAccelaration(lua_State* L) - { - ParticleSystem* ps = checkPS(L); - if (!luax_istable(L, 2)) - { - luax_typerror(L, 2, "table"); - return 1; - } - Vector2<float> ac; - ac.x() = luax_rawgetnumber(L, 2, 1); - ac.y() = luax_rawgetnumber(L, 2, 2); - ps->setParticleLinearAccelaration(ac); - return 0; - } - - LUA_IMPLEMENT int l_setParticleRadialAccelaration(lua_State* L) - { - ParticleSystem* ps = checkPS(L); - float ra = luax_checknumber(L, 2); - ps->setParticleRadialAccelaration(ra); - return 0; - } - - LUA_IMPLEMENT int l_setParticleAngularSpeed(lua_State* L) - { - ParticleSystem* ps = checkPS(L); - if (luax_gettop(L) >= 3) - { - float floor = luax_checknumber(L, 2); - float ceil = luax_checknumber(L, 3); - ps->setParticleAngularSpeed(floor, ceil); - } - else if (luax_gettop(L) >= 2) - { - float n = luax_checknumber(L, 2); - ps->setParticleAngularSpeed(n); - } - return 0; - } - - LUA_IMPLEMENT int l_setParticleSpritesMode(lua_State* L) - { - ParticleSystem* ps = checkPS(L); - int n = luax_checkinteger(L, 2); - SpriteMode mode = static_cast<SpriteMode>(n); - ps->setParticleSpritesMode(mode); - return 0; - } - - LUA_IMPLEMENT int l_addParticleSprite(lua_State* L) - { - LuaObject* obj = luax_checkobject(L, 1, Jin_Lua_ParticleSystem); - ParticleSystem* ps = obj->getObject<ParticleSystem>(); - LuaObject* objSpr = luax_checkobject(L, 2, Jin_Lua_Sprite); - Sprite* spr = objSpr->getObject<Sprite>(); - ps->addParticleSprite(spr); - int depn = (*obj).getDependenciesCount(); - (*obj).setDependency((int)ParticleSystemDependency::DEP_SPRITES + depn, objSpr); - return 0; - } - - LUA_IMPLEMENT int l_addParticleSprites(lua_State* L) - { - LuaObject* obj = luax_checkobject(L, 1, Jin_Lua_ParticleSystem); - ParticleSystem* ps = obj->getObject<ParticleSystem>(); - if (!luax_istable(L, 2)) - { - luax_typerror(L, 2, "sprites table"); - return 1; - } - int n = luax_tableidxlen(L, 2); - int depn = (*obj).getDependenciesCount(); - for (int i = 1; i <= n; ++i) - { - luax_rawgeti(L, 2, i); - LuaObject* objSpr = luax_checkobject(L, -1, Jin_Lua_Sprite); - luax_pop(L, 1); - Sprite* spr = objSpr->getObject<Sprite>(); - ps->addParticleSprite(spr); - (*obj).setDependency((int)ParticleSystemDependency::DEP_SPRITES + depn + i - 1, objSpr); - } - return 0; - } - - // From 0 - LUA_IMPLEMENT int l_removeParticleSprite(lua_State* L) - { - LuaObject* obj = luax_checkobject(L, 1, Jin_Lua_ParticleSystem); - ParticleSystem* ps = obj->getObject<ParticleSystem>(); - int n = luax_checkinteger(L, 2); - ps->removeParticleSprite(n); - (*obj).removeDependency((int)ParticleSystemDependency::DEP_SPRITES + n); - return 0; - } - - LUA_IMPLEMENT int l_enableParticleBlendAdditive(lua_State* L) - { - ParticleSystem* ps = checkPS(L); - bool enable = luax_checkbool(L, 2); - ps->enableParticleBlendAdditive(enable); - return 0; - } - - LUA_IMPLEMENT int l_setParticleScale(lua_State* L) - { - ParticleSystem* ps = checkPS(L); - float scale = luax_checknumber(L, 2); - ps->setParticleScale(scale); - return 0; - } - - LUA_IMPLEMENT int l_addParticleScalePoint(lua_State* L) - { - ParticleSystem* ps = checkPS(L); - float scale = luax_checknumber(L, 2); - float t = luax_checknumber(L, 3); - ps->addParticleScalePoint(scale, t); - return 0; - } - - LUA_IMPLEMENT int l_removeParticleScalePoint(lua_State* L) - { - ParticleSystem* ps = checkPS(L); - int i = luax_checkinteger(L, 2); - ps->removeParticleScalePoint(i); - return 0; - } - - LUA_IMPLEMENT int l_setParticleColor(lua_State* L) - { - ParticleSystem* ps = checkPS(L); - if (!luax_istable(L, 2)) - { - luax_typerror(L, 2, "color table"); - return 1; - } - Color c; - c.r = luax_rawgetnumber(L, 2, 1); - c.g = luax_rawgetnumber(L, 2, 2); - c.b = luax_rawgetnumber(L, 2, 3); - c.a = luax_rawgetnumber(L, 2, 4); - ps->setParticleColor(c); - return 0; - } - - LUA_IMPLEMENT int l_addParticleColorPoint(lua_State* L) - { - ParticleSystem* ps = checkPS(L); - if (!luax_istable(L, 2)) - { - luax_typerror(L, 2, "color table"); - return 1; - } - Color c; - c.r = luax_rawgetnumber(L, 2, 1); - c.g = luax_rawgetnumber(L, 2, 2); - c.b = luax_rawgetnumber(L, 2, 3); - c.a = luax_rawgetnumber(L, 2, 4); - float t = luax_checknumber(L, 3); - ps->addParticleColorPoint(c, t); - return 0; - } - - LUA_IMPLEMENT int l_removeParticleColorPoint(lua_State* L) - { - ParticleSystem* ps = checkPS(L); - int i = luax_checkinteger(L, 2); - ps->removeParticleColorPoint(i); - return 0; - } - - LUA_IMPLEMENT int l_setParticleTransparency(lua_State* L) - { - ParticleSystem* ps = checkPS(L); - float transparency = luax_checknumber(L, 2); - ps->setParticleTransparency(transparency); - return 0; - } - - LUA_IMPLEMENT int l_addParticleTransparencyPoint(lua_State* L) - { - ParticleSystem* ps = checkPS(L); - float transparency = luax_checknumber(L, 2); - float t = luax_checknumber(L, 3); - ps->addParticleTransparencyPoint(transparency, t); - return 0; - } - - LUA_IMPLEMENT int l_removeParticleTransparencyPoint(lua_State* L) - { - ParticleSystem* ps = checkPS(L); - int i = luax_checkinteger(L, 2); - ps->removeParticleTransparencyPoint(i); - return 0; - } - - LUA_EXPORT void luaopen_ParticleSystem(lua_State* L) - { - luaL_Reg methods[] = { - { "__gc", l_gc }, - { "update", l_update }, - { "render", l_render }, - { "setPosition", l_setPosition }, - { "setScale", l_setScale }, - { "pause", l_pause }, - { "clear", l_clear }, - { "setEmitRate", l_setEmitRate }, - { "setEmitForce", l_setEmitForce }, - { "setEmitDirection", l_setEmitDirection }, - { "setEmitPosition", l_setEmitPosition }, - { "setParticleLife", l_setParticleLife }, - { "setParticleLinearAccelaration", l_setParticleLinearAccelaration }, - { "setParticleRadialAccelaration", l_setParticleRadialAccelaration }, - { "setParticleAngularSpeed", l_setParticleAngularSpeed }, - { "setParticleSpritesMode", l_setParticleSpritesMode }, - { "addParticleSprite", l_addParticleSprite }, - { "addParticleSprites", l_addParticleSprites }, - { "removeParticleSprite", l_removeParticleSprite }, - { "enableParticleBlendAdditive", l_enableParticleBlendAdditive }, - { "setParticleScale", l_setParticleScale }, - { "addParticleScalePoint", l_addParticleScalePoint }, - { "removeParticleScalePoint", l_removeParticleScalePoint }, - { "setParticleColor", l_setParticleColor }, - { "addParticleColorPoint", l_addParticleColorPoint }, - { "removeParticleColorPoint", l_removeParticleColorPoint }, - { "setParticleTransparency", l_setParticleTransparency }, - { "addParticleTransparencyPoint", l_addParticleTransparencyPoint }, - { "removeParticleTransparencyPoint", l_removeParticleTransparencyPoint }, - { 0, 0 } - }; - luax_newtype(L, Jin_Lua_ParticleSystem, methods); - } - - } // namespace Lua + namespace Lua + { + + const char* Jin_Lua_ParticleSystem = "ParticleSystem"; + + LUA_IMPLEMENT inline ParticleSystem* checkPS(lua_State* L) + { + LuaObject* luaObj = luax_checkobject(L, 1, Jin_Lua_ParticleSystem); + return luaObj->getObject<ParticleSystem>(); + } + + LUA_IMPLEMENT int l_gc(lua_State* L) + { + LuaObject* luaObj = luax_checkobject(L, 1, Jin_Lua_ParticleSystem); + luaObj->release(); + return 0; + } + + LUA_IMPLEMENT int l_update(lua_State* L) + { + ParticleSystem* ps = checkPS(L); + float dt = luax_checknumber(L, 2); + ps->update(dt); + return 0; + } + + LUA_IMPLEMENT int l_render(lua_State* L) + { + ParticleSystem* ps = checkPS(L); + ps->render(); + return 0; + } + + LUA_IMPLEMENT int l_setPosition(lua_State* L) + { + ParticleSystem* ps = checkPS(L); + float x = luax_checknumber(L, 2); + float y = luax_checknumber(L, 3); + ps->setPosition(x, y); + return 0; + } + + LUA_IMPLEMENT int l_setScale(lua_State* L) + { + ParticleSystem* ps = checkPS(L); + float sx = luax_checknumber(L, 2); + float sy = luax_checknumber(L, 3); + //ps->setScale(sx, sy); + return 0; + } + + LUA_IMPLEMENT int l_pause(lua_State* L) + { + ParticleSystem* ps = checkPS(L); + bool b = luax_checkbool(L, 2); + //ps->pause(b); + return 0; + } + + LUA_IMPLEMENT int l_clear(lua_State* L) + { + ParticleSystem* ps = checkPS(L); + //ps->clear(); + return 0; + } + + LUA_IMPLEMENT int l_setEmitRate(lua_State* L) + { + ParticleSystem* ps = checkPS(L); + if (luax_gettop(L) >= 3) + { + float floor = luax_checknumber(L, 2); + float ceil = luax_checknumber(L, 3); + ps->setEmitRate(floor, ceil); + } + else if (luax_gettop(L) >= 2) + { + float n = luax_checknumber(L, 2); + ps->setEmitRate(n); + } + return 0; + } + + LUA_IMPLEMENT int l_setEmitForce(lua_State* L) + { + ParticleSystem* ps = checkPS(L); + if (luax_gettop(L) >= 3) + { + float floor = luax_checknumber(L, 2); + float ceil = luax_checknumber(L, 3); + ps->setEmitForce(floor, ceil); + } + else if (luax_gettop(L) >= 2) + { + float n = luax_checknumber(L, 2); + ps->setEmitForce(n); + } + return 0; + } + + LUA_IMPLEMENT int l_setEmitDirection(lua_State* L) + { + ParticleSystem* ps = checkPS(L); + if (luax_gettop(L) >= 3) + { + float floor = luax_checknumber(L, 2); + float ceil = luax_checknumber(L, 3); + ps->setEmitDirection(floor, ceil); + } + else if (luax_gettop(L) >= 2) + { + float n = luax_checknumber(L, 2); + ps->setEmitDirection(n); + } + return 0; + } + + LUA_IMPLEMENT int l_setEmitPosition(lua_State* L) + { + ParticleSystem* ps = checkPS(L); + if (luax_gettop(L) >= 3) + { + if (!luax_istable(L, 2)) + { + luax_typerror(L, 2, "table"); + return 1; + } + if (!luax_istable(L, 3)) + { + luax_typerror(L, 3, "table"); + return 1; + } + Vector2<float> floor, ceil; + floor.x() = luax_rawgetnumber(L, 2, 1); + floor.y() = luax_rawgetnumber(L, 2, 2); + ceil.x() = luax_rawgetnumber(L, 3, 1); + ceil.y() = luax_rawgetnumber(L, 3, 2); + ps->setEmitPosition(floor, ceil); + } + else if (luax_gettop(L) >= 2) + { + if (!luax_istable(L, 2)) + { + luax_typerror(L, 2, "table"); + return 1; + } + Vector2<float> pos; + pos.x() = luax_rawgetnumber(L, 2, 1); + pos.y() = luax_rawgetnumber(L, 2, 2); + ps->setEmitPosition(pos); + } + return 0; + } + + LUA_IMPLEMENT int l_setParticleLife(lua_State* L) + { + ParticleSystem* ps = checkPS(L); + if (luax_gettop(L) >= 3) + { + float floor = luax_checknumber(L, 2); + float ceil = luax_checknumber(L, 3); + ps->setParticleLife(floor, ceil); + } + else if (luax_gettop(L) >= 2) + { + float n = luax_checknumber(L, 2); + ps->setParticleLife(n); + } + return 0; + } + + LUA_IMPLEMENT int l_setParticleLinearAccelaration(lua_State* L) + { + ParticleSystem* ps = checkPS(L); + if (!luax_istable(L, 2)) + { + luax_typerror(L, 2, "table"); + return 1; + } + Vector2<float> ac; + ac.x() = luax_rawgetnumber(L, 2, 1); + ac.y() = luax_rawgetnumber(L, 2, 2); + ps->setParticleLinearAccelaration(ac); + return 0; + } + + LUA_IMPLEMENT int l_setParticleRadialAccelaration(lua_State* L) + { + ParticleSystem* ps = checkPS(L); + float ra = luax_checknumber(L, 2); + ps->setParticleRadialAccelaration(ra); + return 0; + } + + LUA_IMPLEMENT int l_setParticleAngularSpeed(lua_State* L) + { + ParticleSystem* ps = checkPS(L); + if (luax_gettop(L) >= 3) + { + float floor = luax_checknumber(L, 2); + float ceil = luax_checknumber(L, 3); + ps->setParticleAngularSpeed(floor, ceil); + } + else if (luax_gettop(L) >= 2) + { + float n = luax_checknumber(L, 2); + ps->setParticleAngularSpeed(n); + } + return 0; + } + + LUA_IMPLEMENT int l_setParticleSpritesMode(lua_State* L) + { + ParticleSystem* ps = checkPS(L); + int n = luax_checkinteger(L, 2); + SpriteMode mode = static_cast<SpriteMode>(n); + ps->setParticleSpritesMode(mode); + return 0; + } + + LUA_IMPLEMENT int l_addParticleSprite(lua_State* L) + { + LuaObject* obj = luax_checkobject(L, 1, Jin_Lua_ParticleSystem); + ParticleSystem* ps = obj->getObject<ParticleSystem>(); + LuaObject* objSpr = luax_checkobject(L, 2, Jin_Lua_Sprite); + Sprite* spr = objSpr->getObject<Sprite>(); + ps->addParticleSprite(spr); + int depn = (*obj).getDependenciesCount(); + (*obj).setDependency((int)ParticleSystemDependency::DEP_SPRITES + depn, objSpr); + return 0; + } + + LUA_IMPLEMENT int l_addParticleSprites(lua_State* L) + { + LuaObject* obj = luax_checkobject(L, 1, Jin_Lua_ParticleSystem); + ParticleSystem* ps = obj->getObject<ParticleSystem>(); + if (!luax_istable(L, 2)) + { + luax_typerror(L, 2, "sprites table"); + return 1; + } + int n = luax_tableidxlen(L, 2); + int depn = (*obj).getDependenciesCount(); + for (int i = 1; i <= n; ++i) + { + luax_rawgeti(L, 2, i); + LuaObject* objSpr = luax_checkobject(L, -1, Jin_Lua_Sprite); + luax_pop(L, 1); + Sprite* spr = objSpr->getObject<Sprite>(); + ps->addParticleSprite(spr); + (*obj).setDependency((int)ParticleSystemDependency::DEP_SPRITES + depn + i - 1, objSpr); + } + return 0; + } + + // From 0 + LUA_IMPLEMENT int l_removeParticleSprite(lua_State* L) + { + LuaObject* obj = luax_checkobject(L, 1, Jin_Lua_ParticleSystem); + ParticleSystem* ps = obj->getObject<ParticleSystem>(); + int n = luax_checkinteger(L, 2); + ps->removeParticleSprite(n); + (*obj).removeDependency((int)ParticleSystemDependency::DEP_SPRITES + n); + return 0; + } + + LUA_IMPLEMENT int l_enableParticleBlendAdditive(lua_State* L) + { + ParticleSystem* ps = checkPS(L); + bool enable = luax_checkbool(L, 2); + ps->enableParticleBlendAdditive(enable); + return 0; + } + + LUA_IMPLEMENT int l_setParticleScale(lua_State* L) + { + ParticleSystem* ps = checkPS(L); + float scale = luax_checknumber(L, 2); + ps->setParticleScale(scale); + return 0; + } + + LUA_IMPLEMENT int l_addParticleScalePoint(lua_State* L) + { + ParticleSystem* ps = checkPS(L); + float scale = luax_checknumber(L, 2); + float t = luax_checknumber(L, 3); + ps->addParticleScalePoint(scale, t); + return 0; + } + + LUA_IMPLEMENT int l_removeParticleScalePoint(lua_State* L) + { + ParticleSystem* ps = checkPS(L); + int i = luax_checkinteger(L, 2); + ps->removeParticleScalePoint(i); + return 0; + } + + LUA_IMPLEMENT int l_setParticleColor(lua_State* L) + { + ParticleSystem* ps = checkPS(L); + if (!luax_istable(L, 2)) + { + luax_typerror(L, 2, "color table"); + return 1; + } + Color c; + c.r = luax_rawgetnumber(L, 2, 1); + c.g = luax_rawgetnumber(L, 2, 2); + c.b = luax_rawgetnumber(L, 2, 3); + c.a = luax_rawgetnumber(L, 2, 4); + ps->setParticleColor(c); + return 0; + } + + LUA_IMPLEMENT int l_addParticleColorPoint(lua_State* L) + { + ParticleSystem* ps = checkPS(L); + if (!luax_istable(L, 2)) + { + luax_typerror(L, 2, "color table"); + return 1; + } + Color c; + c.r = luax_rawgetnumber(L, 2, 1); + c.g = luax_rawgetnumber(L, 2, 2); + c.b = luax_rawgetnumber(L, 2, 3); + c.a = luax_rawgetnumber(L, 2, 4); + float t = luax_checknumber(L, 3); + ps->addParticleColorPoint(c, t); + return 0; + } + + LUA_IMPLEMENT int l_removeParticleColorPoint(lua_State* L) + { + ParticleSystem* ps = checkPS(L); + int i = luax_checkinteger(L, 2); + ps->removeParticleColorPoint(i); + return 0; + } + + LUA_IMPLEMENT int l_setParticleTransparency(lua_State* L) + { + ParticleSystem* ps = checkPS(L); + float transparency = luax_checknumber(L, 2); + ps->setParticleTransparency(transparency); + return 0; + } + + LUA_IMPLEMENT int l_addParticleTransparencyPoint(lua_State* L) + { + ParticleSystem* ps = checkPS(L); + float transparency = luax_checknumber(L, 2); + float t = luax_checknumber(L, 3); + ps->addParticleTransparencyPoint(transparency, t); + return 0; + } + + LUA_IMPLEMENT int l_removeParticleTransparencyPoint(lua_State* L) + { + ParticleSystem* ps = checkPS(L); + int i = luax_checkinteger(L, 2); + ps->removeParticleTransparencyPoint(i); + return 0; + } + + LUA_EXPORT void luaopen_ParticleSystem(lua_State* L) + { + luaL_Reg methods[] = { + { "__gc", l_gc }, + { "update", l_update }, + { "render", l_render }, + { "setPosition", l_setPosition }, + { "setScale", l_setScale }, + { "pause", l_pause }, + { "clear", l_clear }, + { "setEmitRate", l_setEmitRate }, + { "setEmitForce", l_setEmitForce }, + { "setEmitDirection", l_setEmitDirection }, + { "setEmitPosition", l_setEmitPosition }, + { "setParticleLife", l_setParticleLife }, + { "setParticleLinearAccelaration", l_setParticleLinearAccelaration }, + { "setParticleRadialAccelaration", l_setParticleRadialAccelaration }, + { "setParticleAngularSpeed", l_setParticleAngularSpeed }, + { "setParticleSpritesMode", l_setParticleSpritesMode }, + { "addParticleSprite", l_addParticleSprite }, + { "addParticleSprites", l_addParticleSprites }, + { "removeParticleSprite", l_removeParticleSprite }, + { "enableParticleBlendAdditive", l_enableParticleBlendAdditive }, + { "setParticleScale", l_setParticleScale }, + { "addParticleScalePoint", l_addParticleScalePoint }, + { "removeParticleScalePoint", l_removeParticleScalePoint }, + { "setParticleColor", l_setParticleColor }, + { "addParticleColorPoint", l_addParticleColorPoint }, + { "removeParticleColorPoint", l_removeParticleColorPoint }, + { "setParticleTransparency", l_setParticleTransparency }, + { "addParticleTransparencyPoint", l_addParticleTransparencyPoint }, + { "removeParticleTransparencyPoint", l_removeParticleTransparencyPoint }, + { 0, 0 } + }; + luax_newtype(L, Jin_Lua_ParticleSystem, methods); + } + + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_particle_system.h b/src/libjin-lua/modules/graphics/l_particle_system.h index b75b569..fb0616d 100644 --- a/src/libjin-lua/modules/graphics/l_particle_system.h +++ b/src/libjin-lua/modules/graphics/l_particle_system.h @@ -3,19 +3,19 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - enum class ParticleSystemDependency - { - DEP_SPRITES = 1, - }; + enum class ParticleSystemDependency + { + DEP_SPRITES = 1, + }; - extern const char* Jin_Lua_ParticleSystem; + extern const char* Jin_Lua_ParticleSystem; - void luaopen_ParticleSystem(lua_State* L); + void luaopen_ParticleSystem(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_shader.cpp b/src/libjin-lua/modules/graphics/l_shader.cpp index bdf82b4..4fda837 100644 --- a/src/libjin-lua/modules/graphics/l_shader.cpp +++ b/src/libjin-lua/modules/graphics/l_shader.cpp @@ -11,122 +11,122 @@ using namespace JinEngine::Graphics::Shaders; namespace JinEngine { - namespace Lua - { + namespace Lua + { - const char* Jin_Lua_Shader = "Shader"; + const char* Jin_Lua_Shader = "Shader"; - static inline Shader* checkShader(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Shader); - return luaObj->getObject<Shader>(); - } - - /** - * jsl:sendNumber("variable", 0.1) - */ - LUA_IMPLEMENT int l_sendNumber(lua_State* L) - { - Shader* shader = checkShader(L); - const char* variable = luax_checkstring(L, 2); - float number = luax_checknumber(L, 3); - shader->sendFloat(variable, number); - return 0; - } + static inline Shader* checkShader(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Shader); + return luaObj->getObject<Shader>(); + } + + /** + * jsl:sendNumber("variable", 0.1) + */ + LUA_IMPLEMENT int l_sendNumber(lua_State* L) + { + Shader* shader = checkShader(L); + const char* variable = luax_checkstring(L, 2); + float number = luax_checknumber(L, 3); + shader->sendFloat(variable, number); + return 0; + } - LUA_IMPLEMENT int l_sendTexture(lua_State* L) - { - Shader* shader = checkShader(L); - const char* variable = luax_checkstring(L, 2); - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 3, Jin_Lua_Texture); - shader->sendTexture(variable, luaObj->getObject<Texture>()); - return 0; - } + LUA_IMPLEMENT int l_sendTexture(lua_State* L) + { + Shader* shader = checkShader(L); + const char* variable = luax_checkstring(L, 2); + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 3, Jin_Lua_Texture); + shader->sendTexture(variable, luaObj->getObject<Texture>()); + return 0; + } - LUA_IMPLEMENT int l_sendCanvas(lua_State* L) - { - Shader* shader = checkShader(L); - const char* variable = luax_checkstring(L, 2); - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 3, Jin_Lua_Canvas); - shader->sendCanvas(variable, luaObj->getObject<Canvas>()); - return 0; - } + LUA_IMPLEMENT int l_sendCanvas(lua_State* L) + { + Shader* shader = checkShader(L); + const char* variable = luax_checkstring(L, 2); + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 3, Jin_Lua_Canvas); + shader->sendCanvas(variable, luaObj->getObject<Canvas>()); + return 0; + } - LUA_IMPLEMENT int l_sendVec2(lua_State* L) - { - Shader* shader = checkShader(L); - const char* variable = luax_checkstring(L, 2); - if (!luax_istable(L, 3)) - { - luax_typerror(L, 3, "table"); - return 1; - } - float x = luax_rawgetnumber(L, 3, 1); - float y = luax_rawgetnumber(L, 3, 2); - shader->sendVec2(variable, x, y); - return 0; - } + LUA_IMPLEMENT int l_sendVec2(lua_State* L) + { + Shader* shader = checkShader(L); + const char* variable = luax_checkstring(L, 2); + if (!luax_istable(L, 3)) + { + luax_typerror(L, 3, "table"); + return 1; + } + float x = luax_rawgetnumber(L, 3, 1); + float y = luax_rawgetnumber(L, 3, 2); + shader->sendVec2(variable, x, y); + return 0; + } - LUA_IMPLEMENT int l_sendVec3(lua_State* L) - { - Shader* shader = checkShader(L); - const char* variable = luax_checkstring(L, 2); - if (!luax_istable(L, 3)) - { - luax_typerror(L, 3, "table"); - return 1; - } - float x = luax_rawgetnumber(L, 3, 1); - float y = luax_rawgetnumber(L, 3, 2); - float z = luax_rawgetnumber(L, 3, 3); - shader->sendVec3(variable, x, y, z); - return 0; - } + LUA_IMPLEMENT int l_sendVec3(lua_State* L) + { + Shader* shader = checkShader(L); + const char* variable = luax_checkstring(L, 2); + if (!luax_istable(L, 3)) + { + luax_typerror(L, 3, "table"); + return 1; + } + float x = luax_rawgetnumber(L, 3, 1); + float y = luax_rawgetnumber(L, 3, 2); + float z = luax_rawgetnumber(L, 3, 3); + shader->sendVec3(variable, x, y, z); + return 0; + } - LUA_IMPLEMENT int l_sendVec4(lua_State* L) - { - Shader* shader = checkShader(L); - const char* variable = luax_checkstring(L, 2); - if (!luax_istable(L, 3)) - { - luax_typerror(L, 3, "table"); - return 1; - } - float x = luax_rawgetnumber(L, 3, 1); - float y = luax_rawgetnumber(L, 3, 2); - float z = luax_rawgetnumber(L, 3, 3); - float w = luax_rawgetnumber(L, 3, 4); - shader->sendVec4(variable, x, y, z, w); - return 0; - } + LUA_IMPLEMENT int l_sendVec4(lua_State* L) + { + Shader* shader = checkShader(L); + const char* variable = luax_checkstring(L, 2); + if (!luax_istable(L, 3)) + { + luax_typerror(L, 3, "table"); + return 1; + } + float x = luax_rawgetnumber(L, 3, 1); + float y = luax_rawgetnumber(L, 3, 2); + float z = luax_rawgetnumber(L, 3, 3); + float w = luax_rawgetnumber(L, 3, 4); + shader->sendVec4(variable, x, y, z, w); + return 0; + } - LUA_IMPLEMENT int l_sendColor(lua_State* L) - { - return l_sendVec4(L); - } + LUA_IMPLEMENT int l_sendColor(lua_State* L) + { + return l_sendVec4(L); + } - LUA_IMPLEMENT int l_gc(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Shader); - luaObj->release(); - return 0; - } + LUA_IMPLEMENT int l_gc(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Shader); + luaObj->release(); + return 0; + } - LUA_EXPORT void luaopen_Shader(lua_State* L) - { - luaL_Reg methods[] = { - { "__gc", l_gc }, - { "sendNumber", l_sendNumber }, - { "sendTexture", l_sendTexture }, - { "sendCanvas", l_sendCanvas }, - { "sendVec2", l_sendVec2 }, - { "sendVec3", l_sendVec3 }, - { "sendVec4", l_sendVec4 }, - { "sendColor", l_sendColor }, - { 0, 0 } - }; - luax_newtype(L, Jin_Lua_Shader, methods); - } + LUA_EXPORT void luaopen_Shader(lua_State* L) + { + luaL_Reg methods[] = { + { "__gc", l_gc }, + { "sendNumber", l_sendNumber }, + { "sendTexture", l_sendTexture }, + { "sendCanvas", l_sendCanvas }, + { "sendVec2", l_sendVec2 }, + { "sendVec3", l_sendVec3 }, + { "sendVec4", l_sendVec4 }, + { "sendColor", l_sendColor }, + { 0, 0 } + }; + luax_newtype(L, Jin_Lua_Shader, methods); + } - } // namespace Lua + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_shader.h b/src/libjin-lua/modules/graphics/l_shader.h index 5a84372..39b6a07 100644 --- a/src/libjin-lua/modules/graphics/l_shader.h +++ b/src/libjin-lua/modules/graphics/l_shader.h @@ -3,14 +3,14 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - extern const char* Jin_Lua_Shader; + extern const char* Jin_Lua_Shader; - void luaopen_Shader(lua_State* L); + void luaopen_Shader(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_sprite.cpp b/src/libjin-lua/modules/graphics/l_sprite.cpp index 1469042..9296a6d 100644 --- a/src/libjin-lua/modules/graphics/l_sprite.cpp +++ b/src/libjin-lua/modules/graphics/l_sprite.cpp @@ -13,54 +13,54 @@ using namespace JinEngine::Graphics::Shaders; namespace JinEngine { - namespace Lua - { - const char* Jin_Lua_Sprite = "Sprite"; + namespace Lua + { + const char* Jin_Lua_Sprite = "Sprite"; - LUA_IMPLEMENT inline Sprite* checkSprite(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Sprite); - return luaObj->getObject<Sprite>(); - } + LUA_IMPLEMENT inline Sprite* checkSprite(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Sprite); + return luaObj->getObject<Sprite>(); + } - LUA_IMPLEMENT int l_gc(lua_State* L) - { - LuaObject* p = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Sprite); - p->release(); - return 0; - } + LUA_IMPLEMENT int l_gc(lua_State* L) + { + LuaObject* p = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Sprite); + p->release(); + return 0; + } - LUA_IMPLEMENT int l_render(lua_State* L) - { - Sprite* sprite = checkSprite(L); - float x = luax_checknumber(L, 2); - float y = luax_checknumber(L, 3); - float sx = luax_checknumber(L, 4); - float sy = luax_checknumber(L, 5); - float r = luax_checknumber(L, 6); - sprite->render(x, y, sx, sy, r); - return 0; - } + LUA_IMPLEMENT int l_render(lua_State* L) + { + Sprite* sprite = checkSprite(L); + float x = luax_checknumber(L, 2); + float y = luax_checknumber(L, 3); + float sx = luax_checknumber(L, 4); + float sy = luax_checknumber(L, 5); + float r = luax_checknumber(L, 6); + sprite->render(x, y, sx, sy, r); + return 0; + } - LUA_IMPLEMENT int l_getSize(lua_State* L) - { - Sprite* sprite = checkSprite(L); - Vector2<int> size = sprite->getSize(); - luax_pushinteger(L, size.x()); - luax_pushinteger(L, size.y()); - return 1; - } + LUA_IMPLEMENT int l_getSize(lua_State* L) + { + Sprite* sprite = checkSprite(L); + Vector2<int> size = sprite->getSize(); + luax_pushinteger(L, size.x()); + luax_pushinteger(L, size.y()); + return 1; + } - LUA_EXPORT void luaopen_Sprite(lua_State* L) - { - luaL_Reg methods[] = { - { "__gc", l_gc }, - { "render", l_render }, - { "getSize", l_getSize }, - { 0, 0 } - }; - luax_newtype(L, Jin_Lua_Sprite, methods); - } + LUA_EXPORT void luaopen_Sprite(lua_State* L) + { + luaL_Reg methods[] = { + { "__gc", l_gc }, + { "render", l_render }, + { "getSize", l_getSize }, + { 0, 0 } + }; + luax_newtype(L, Jin_Lua_Sprite, methods); + } - } // namespace Lua + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_sprite.h b/src/libjin-lua/modules/graphics/l_sprite.h index 02c44bf..eec5461 100644 --- a/src/libjin-lua/modules/graphics/l_sprite.h +++ b/src/libjin-lua/modules/graphics/l_sprite.h @@ -3,22 +3,22 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - // Sprite dependency slots. - enum class SpriteDependency - { - DEP_GRAPHIC = 1, - DEP_SHADER = 2, - DEP_SPRITESHEET = 3 - }; + // Sprite dependency slots. + enum class SpriteDependency + { + DEP_GRAPHIC = 1, + DEP_SHADER = 2, + DEP_SPRITESHEET = 3 + }; - extern const char* Jin_Lua_Sprite; + extern const char* Jin_Lua_Sprite; - void luaopen_Sprite(lua_State* L); + void luaopen_Sprite(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_spritesheet.cpp b/src/libjin-lua/modules/graphics/l_spritesheet.cpp index e8400c3..b720723 100644 --- a/src/libjin-lua/modules/graphics/l_spritesheet.cpp +++ b/src/libjin-lua/modules/graphics/l_spritesheet.cpp @@ -12,107 +12,107 @@ using namespace JinEngine::Graphics; namespace JinEngine { - namespace Lua - { + namespace Lua + { - const char* Jin_Lua_SpriteSheet = "SpriteSheet"; + const char* Jin_Lua_SpriteSheet = "SpriteSheet"; - LUA_IMPLEMENT int l_gc(lua_State* L) - { - LuaObject* luaSSheet = (LuaObject*)luax_checktype(L, 1, Jin_Lua_SpriteSheet); - luaSSheet->release(); - return 0; - } + LUA_IMPLEMENT int l_gc(lua_State* L) + { + LuaObject* luaSSheet = (LuaObject*)luax_checktype(L, 1, Jin_Lua_SpriteSheet); + luaSSheet->release(); + return 0; + } - LUA_IMPLEMENT int l_newSprite(lua_State* L) - { - LuaObject* luaSSheet = (LuaObject*)luax_checktype(L, 1, Jin_Lua_SpriteSheet); - SpriteSheet* sheet = luaSSheet->getObject<SpriteSheet>(); - Quad quad; - quad.x = luax_rawgetnumberthenpop(L, 2, 1); - quad.y = luax_rawgetnumberthenpop(L, 2, 2); - quad.w = luax_rawgetnumberthenpop(L, 2, 3); - quad.h = luax_rawgetnumberthenpop(L, 2, 4); - Sprite* spr = nullptr; - if (luax_gettop(L) >= 4) - { - float ox = luax_checknumber(L, 3); - float oy = luax_checknumber(L, 4); - spr = sheet->createSprite(quad, ox, oy); - } - else if (luax_gettop(L) == 3) - { - int o = luax_checkinteger(L, 3); - Origin origin; - origin = static_cast<Origin>(o); - spr = sheet->createSprite(quad, origin); - } - Shared* shrSprite = new Shared(spr); - LuaObject* luaSprite = luax_newinstance(L, Jin_Lua_Sprite, shrSprite); - luaSprite->setDependency((int)SpriteDependency::DEP_SPRITESHEET, luaSSheet); - return 1; - } + LUA_IMPLEMENT int l_newSprite(lua_State* L) + { + LuaObject* luaSSheet = (LuaObject*)luax_checktype(L, 1, Jin_Lua_SpriteSheet); + SpriteSheet* sheet = luaSSheet->getObject<SpriteSheet>(); + Quad quad; + quad.x = luax_rawgetnumberthenpop(L, 2, 1); + quad.y = luax_rawgetnumberthenpop(L, 2, 2); + quad.w = luax_rawgetnumberthenpop(L, 2, 3); + quad.h = luax_rawgetnumberthenpop(L, 2, 4); + Sprite* spr = nullptr; + if (luax_gettop(L) >= 4) + { + float ox = luax_checknumber(L, 3); + float oy = luax_checknumber(L, 4); + spr = sheet->createSprite(quad, ox, oy); + } + else if (luax_gettop(L) == 3) + { + int o = luax_checkinteger(L, 3); + Origin origin; + origin = static_cast<Origin>(o); + spr = sheet->createSprite(quad, origin); + } + Shared* shrSprite = new Shared(spr); + LuaObject* luaSprite = luax_newinstance(L, Jin_Lua_Sprite, shrSprite); + luaSprite->setDependency((int)SpriteDependency::DEP_SPRITESHEET, luaSSheet); + return 1; + } - // {} = newSprites - LUA_IMPLEMENT int l_newSprites(lua_State* L) - { - LuaObject* luaSS = (LuaObject*)luax_checktype(L, 1, Jin_Lua_SpriteSheet); - SpriteSheet* ss = luaSS->getObject<SpriteSheet>(); - int count = luax_checkinteger(L, 2); - int r = luax_checkinteger(L, 3); - int c = luax_checkinteger(L, 4); - int w = luax_checkinteger(L, 5); - int h = luax_checkinteger(L, 6); - vector<Sprite*> sprs; - int argc = luax_gettop(L); - if (argc == 6) - { - sprs = ss->createSprites(count, r, c, w, h, Origin::TOPLEFT); - } - else if (argc >= 8) - { - int ox = luax_checkinteger(L, 7); - int oy = luax_checkinteger(L, 8); - int offx = luax_optinteger(L, 9, 0); - int offy = luax_optinteger(L, 10, 0); - sprs = ss->createSprites(count, r, c, w, h, ox, oy, offx, offy); - } - else if (argc >= 7) - { - int o = luax_checkinteger(L, 7); - Origin origin = static_cast<Origin>(o); - int offx = luax_optinteger(L, 8, 0); - int offy = luax_optinteger(L, 9, 0); - sprs = ss->createSprites(count, r, c, w, h, origin, offx, offy); - } - else - { - luax_error(L, "No matched override function."); - return 1; - } - luax_newtable(L); - LuaObject* graphic = luaSS->getDependency((int)SpriteSheetDependency::DEP_GRAPHIC); - for (int i = 0; i < sprs.size(); ++i) - { - Sprite* spr = sprs[i]; - Shared* shrSpr = new Shared(spr); - LuaObject* luaSpr = (LuaObject*)luax_newinstance(L, Jin_Lua_Sprite, shrSpr); - luaSpr->setDependency((int)SpriteDependency::DEP_GRAPHIC, graphic); - luax_rawseti(L, -2, i + 1); - } - return 1; - } + // {} = newSprites + LUA_IMPLEMENT int l_newSprites(lua_State* L) + { + LuaObject* luaSS = (LuaObject*)luax_checktype(L, 1, Jin_Lua_SpriteSheet); + SpriteSheet* ss = luaSS->getObject<SpriteSheet>(); + int count = luax_checkinteger(L, 2); + int r = luax_checkinteger(L, 3); + int c = luax_checkinteger(L, 4); + int w = luax_checkinteger(L, 5); + int h = luax_checkinteger(L, 6); + vector<Sprite*> sprs; + int argc = luax_gettop(L); + if (argc == 6) + { + sprs = ss->createSprites(count, r, c, w, h, Origin::TOPLEFT); + } + else if (argc >= 8) + { + int ox = luax_checkinteger(L, 7); + int oy = luax_checkinteger(L, 8); + int offx = luax_optinteger(L, 9, 0); + int offy = luax_optinteger(L, 10, 0); + sprs = ss->createSprites(count, r, c, w, h, ox, oy, offx, offy); + } + else if (argc >= 7) + { + int o = luax_checkinteger(L, 7); + Origin origin = static_cast<Origin>(o); + int offx = luax_optinteger(L, 8, 0); + int offy = luax_optinteger(L, 9, 0); + sprs = ss->createSprites(count, r, c, w, h, origin, offx, offy); + } + else + { + luax_error(L, "No matched override function."); + return 1; + } + luax_newtable(L); + LuaObject* graphic = luaSS->getDependency((int)SpriteSheetDependency::DEP_GRAPHIC); + for (int i = 0; i < sprs.size(); ++i) + { + Sprite* spr = sprs[i]; + Shared* shrSpr = new Shared(spr); + LuaObject* luaSpr = (LuaObject*)luax_newinstance(L, Jin_Lua_Sprite, shrSpr); + luaSpr->setDependency((int)SpriteDependency::DEP_GRAPHIC, graphic); + luax_rawseti(L, -2, i + 1); + } + return 1; + } - LUA_EXPORT void luaopen_SpriteSheet(lua_State* L) - { - luaL_Reg methods[] = { - { "__gc", l_gc }, - { "newSprite", l_newSprite }, - { "newSprites", l_newSprites }, - { 0, 0 } - }; - luax_newtype(L, Jin_Lua_SpriteSheet, methods); - } + LUA_EXPORT void luaopen_SpriteSheet(lua_State* L) + { + luaL_Reg methods[] = { + { "__gc", l_gc }, + { "newSprite", l_newSprite }, + { "newSprites", l_newSprites }, + { 0, 0 } + }; + luax_newtype(L, Jin_Lua_SpriteSheet, methods); + } - } + } }
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_spritesheet.h b/src/libjin-lua/modules/graphics/l_spritesheet.h index bcae60b..9395e3d 100644 --- a/src/libjin-lua/modules/graphics/l_spritesheet.h +++ b/src/libjin-lua/modules/graphics/l_spritesheet.h @@ -3,19 +3,19 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - enum class SpriteSheetDependency - { - DEP_GRAPHIC = 1 - }; + enum class SpriteSheetDependency + { + DEP_GRAPHIC = 1 + }; - extern const char* Jin_Lua_SpriteSheet; + extern const char* Jin_Lua_SpriteSheet; - void luaopen_SpriteSheet(lua_State* L); + void luaopen_SpriteSheet(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_text.cpp b/src/libjin-lua/modules/graphics/l_text.cpp index b634947..d20018e 100644 --- a/src/libjin-lua/modules/graphics/l_text.cpp +++ b/src/libjin-lua/modules/graphics/l_text.cpp @@ -6,26 +6,26 @@ using namespace JinEngine::Graphics; namespace JinEngine { - namespace Lua - { + namespace Lua + { - const char* Jin_Lua_Text = "Text"; + const char* Jin_Lua_Text = "Text"; - LUA_IMPLEMENT int l_gc(lua_State* L) - { - LuaObject* p = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Text); - p->release(); - return 0; - } + LUA_IMPLEMENT int l_gc(lua_State* L) + { + LuaObject* p = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Text); + p->release(); + return 0; + } - LUA_EXPORT void luaopen_Text(lua_State* L) - { - luaL_Reg methods[] = { - { "__gc", l_gc }, - { 0, 0 } - }; - luax_newtype(L, Jin_Lua_Text, methods); - } + LUA_EXPORT void luaopen_Text(lua_State* L) + { + luaL_Reg methods[] = { + { "__gc", l_gc }, + { 0, 0 } + }; + luax_newtype(L, Jin_Lua_Text, methods); + } - } // namespace Lua + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_text.h b/src/libjin-lua/modules/graphics/l_text.h index dfcc9cc..db9c684 100644 --- a/src/libjin-lua/modules/graphics/l_text.h +++ b/src/libjin-lua/modules/graphics/l_text.h @@ -3,14 +3,14 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - extern const char* Jin_Lua_Text; + extern const char* Jin_Lua_Text; - void luaopen_Text(lua_State* L); + void luaopen_Text(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_texture.cpp b/src/libjin-lua/modules/graphics/l_texture.cpp index efef2cb..ba69379 100644 --- a/src/libjin-lua/modules/graphics/l_texture.cpp +++ b/src/libjin-lua/modules/graphics/l_texture.cpp @@ -7,57 +7,57 @@ using namespace JinEngine::Graphics; namespace JinEngine { - namespace Lua - { - - const char* Jin_Lua_Texture = "Texture"; - - LUA_IMPLEMENT inline Texture* checkTexture(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Texture); - return luaObj->getObject<Texture>(); - } - - LUA_IMPLEMENT int l_getWidth(lua_State* L) - { - Texture* shared = checkTexture(L); - luax_pushnumber(L, shared->getWidth()); - return 1; - } - - LUA_IMPLEMENT int l_getHeight(lua_State *L) - { - Texture* shared = checkTexture(L); - luax_pushnumber(L, shared->getHeight()); - return 1; - } - - LUA_IMPLEMENT int l_getSize(lua_State* L) - { - Texture* shared = checkTexture(L); - luax_pushnumber(L, shared->getWidth()); - luax_pushnumber(L, shared->getHeight()); - return 2; - } - - LUA_IMPLEMENT int l_gc(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Texture); - luaObj->release(); - return 0; - } - - LUA_EXPORT void luaopen_Texture(lua_State* L) - { - luaL_Reg methods[] = { - { "__gc", l_gc }, - { "getWidth", l_getWidth }, - { "getHeight", l_getHeight }, - { "getSize", l_getSize }, - { 0, 0 } - }; - luax_newtype(L, Jin_Lua_Texture, methods); - } - - }// namespace Lua + namespace Lua + { + + const char* Jin_Lua_Texture = "Texture"; + + LUA_IMPLEMENT inline Texture* checkTexture(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Texture); + return luaObj->getObject<Texture>(); + } + + LUA_IMPLEMENT int l_getWidth(lua_State* L) + { + Texture* shared = checkTexture(L); + luax_pushnumber(L, shared->getWidth()); + return 1; + } + + LUA_IMPLEMENT int l_getHeight(lua_State *L) + { + Texture* shared = checkTexture(L); + luax_pushnumber(L, shared->getHeight()); + return 1; + } + + LUA_IMPLEMENT int l_getSize(lua_State* L) + { + Texture* shared = checkTexture(L); + luax_pushnumber(L, shared->getWidth()); + luax_pushnumber(L, shared->getHeight()); + return 2; + } + + LUA_IMPLEMENT int l_gc(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Texture); + luaObj->release(); + return 0; + } + + LUA_EXPORT void luaopen_Texture(lua_State* L) + { + luaL_Reg methods[] = { + { "__gc", l_gc }, + { "getWidth", l_getWidth }, + { "getHeight", l_getHeight }, + { "getSize", l_getSize }, + { 0, 0 } + }; + luax_newtype(L, Jin_Lua_Texture, methods); + } + + }// namespace Lua }// namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_texture.h b/src/libjin-lua/modules/graphics/l_texture.h index c8bb71c..fe6a83d 100644 --- a/src/libjin-lua/modules/graphics/l_texture.h +++ b/src/libjin-lua/modules/graphics/l_texture.h @@ -3,14 +3,14 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - extern const char* Jin_Lua_Texture; + extern const char* Jin_Lua_Texture; - void luaopen_Texture(lua_State* L); + void luaopen_Texture(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_texture_font.cpp b/src/libjin-lua/modules/graphics/l_texture_font.cpp index d9801ef..20ed739 100644 --- a/src/libjin-lua/modules/graphics/l_texture_font.cpp +++ b/src/libjin-lua/modules/graphics/l_texture_font.cpp @@ -10,54 +10,54 @@ using namespace JinEngine::Graphics::Fonts; namespace JinEngine { - namespace Lua - { - - const char* Jin_Lua_TextureFont = "TextureFont"; - - LUA_IMPLEMENT int l_gc(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_TextureFont); - luaObj->release(); - return 0; - } - - /* typeset(Text | string, lineheight, spacing) */ - LUA_IMPLEMENT int l_typeset(lua_State* L) - { - LuaObject* luaTexFont = (LuaObject*)luax_checktype(L, 1, Jin_Lua_TextureFont); - TextureFont* tf = luaTexFont->getObject<TextureFont>(); - int lineheight = luax_checkinteger(L, 3); - int spacing = luax_optnumber(L, 4, 0); - Page* page = nullptr; - if (luax_isstring(L, 2)) - { - unsigned length; - const char* str = luax_checklstring(L, 2, &length); - Text text(Encode::UTF8, str, length); - page = tf->typeset(text, lineheight, spacing); - } - else if (luax_istype(L, 2, Jin_Lua_Text)) - { - LuaObject* p2 = (LuaObject*)luax_checktype(L, 2, Jin_Lua_Text); - Text* text = p2->getObject<Text>(); - page = tf->typeset(*text, lineheight, spacing); - } - Shared* shrPage = new Shared(page); - LuaObject* luaPage = luax_newinstance(L, Jin_Lua_Page, shrPage); - luaPage->setDependency((int)PageDependency::DEP_TEXTURE_FONT, luaTexFont); - return 1; - } - - LUA_EXPORT void luaopen_TextureFont(lua_State* L) - { - luaL_Reg methods[] = { - { "__gc", l_gc }, - { "typeset", l_typeset }, - { 0, 0 } - }; - luax_newtype(L, Jin_Lua_TextureFont, methods); - } - - } // namespace Lua + namespace Lua + { + + const char* Jin_Lua_TextureFont = "TextureFont"; + + LUA_IMPLEMENT int l_gc(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_TextureFont); + luaObj->release(); + return 0; + } + + /* typeset(Text | string, lineheight, spacing) */ + LUA_IMPLEMENT int l_typeset(lua_State* L) + { + LuaObject* luaTexFont = (LuaObject*)luax_checktype(L, 1, Jin_Lua_TextureFont); + TextureFont* tf = luaTexFont->getObject<TextureFont>(); + int lineheight = luax_checkinteger(L, 3); + int spacing = luax_optnumber(L, 4, 0); + Page* page = nullptr; + if (luax_isstring(L, 2)) + { + unsigned length; + const char* str = luax_checklstring(L, 2, &length); + Text text(Encode::UTF8, str, length); + page = tf->typeset(text, lineheight, spacing); + } + else if (luax_istype(L, 2, Jin_Lua_Text)) + { + LuaObject* p2 = (LuaObject*)luax_checktype(L, 2, Jin_Lua_Text); + Text* text = p2->getObject<Text>(); + page = tf->typeset(*text, lineheight, spacing); + } + Shared* shrPage = new Shared(page); + LuaObject* luaPage = luax_newinstance(L, Jin_Lua_Page, shrPage); + luaPage->setDependency((int)PageDependency::DEP_TEXTURE_FONT, luaTexFont); + return 1; + } + + LUA_EXPORT void luaopen_TextureFont(lua_State* L) + { + luaL_Reg methods[] = { + { "__gc", l_gc }, + { "typeset", l_typeset }, + { 0, 0 } + }; + luax_newtype(L, Jin_Lua_TextureFont, methods); + } + + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_texture_font.h b/src/libjin-lua/modules/graphics/l_texture_font.h index d1fffe5..ef57d48 100644 --- a/src/libjin-lua/modules/graphics/l_texture_font.h +++ b/src/libjin-lua/modules/graphics/l_texture_font.h @@ -3,14 +3,14 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - extern const char* Jin_Lua_TextureFont; + extern const char* Jin_Lua_TextureFont; - void luaopen_TextureFont(lua_State* L); + void luaopen_TextureFont(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_ttf.cpp b/src/libjin-lua/modules/graphics/l_ttf.cpp index cc9db8e..4c74a4d 100644 --- a/src/libjin-lua/modules/graphics/l_ttf.cpp +++ b/src/libjin-lua/modules/graphics/l_ttf.cpp @@ -10,54 +10,54 @@ using namespace JinEngine::Graphics::Fonts; namespace JinEngine { - namespace Lua - { - - const char* Jin_Lua_TTF = "TTF"; - - LUA_IMPLEMENT int l_gc(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_TTF); - luaObj->release(); - return 0; - } - - /* typeset(Text | string, lineheight, spacing) */ - LUA_IMPLEMENT int l_typeset(lua_State* L) - { - LuaObject* luaTTF = (LuaObject*)luax_checktype(L, 1, Jin_Lua_TTF); - TTF* ttf = luaTTF->getObject<TTF>(); - int lineheight = luax_optnumber(L, 3, ttf->getFontSize()); - int spacing = luax_optnumber(L, 4, 0); - Page* page = nullptr; - if (luax_isstring(L, 2)) - { - unsigned length; - const char* str = luax_checklstring(L, 2, &length); - Text text(Encode::UTF8, str, length); - page = ttf->typeset(text, lineheight, spacing); - } - else if (luax_istype(L, 2, Jin_Lua_Text)) - { - LuaObject* luaText = (LuaObject*)luax_checktype(L, 2, Jin_Lua_Text); - Text* text = luaText->getObject<Text>(); - page = ttf->typeset(*text, lineheight, spacing); - } - Shared* refPage = new Shared(page); - LuaObject* luaPage = luax_newinstance(L, Jin_Lua_Page, refPage); - luaPage->setDependency((int)PageDependency::DEP_TTF, luaTTF); - return 1; - } - - LUA_EXPORT void luaopen_TTF(lua_State* L) - { - luaL_Reg methods[] = { - { "__gc", l_gc }, - { "typeset", l_typeset }, - { 0, 0 } - }; - luax_newtype(L, Jin_Lua_TTF, methods); - } - - } // namespace Lua + namespace Lua + { + + const char* Jin_Lua_TTF = "TTF"; + + LUA_IMPLEMENT int l_gc(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_TTF); + luaObj->release(); + return 0; + } + + /* typeset(Text | string, lineheight, spacing) */ + LUA_IMPLEMENT int l_typeset(lua_State* L) + { + LuaObject* luaTTF = (LuaObject*)luax_checktype(L, 1, Jin_Lua_TTF); + TTF* ttf = luaTTF->getObject<TTF>(); + int lineheight = luax_optnumber(L, 3, ttf->getFontSize()); + int spacing = luax_optnumber(L, 4, 0); + Page* page = nullptr; + if (luax_isstring(L, 2)) + { + unsigned length; + const char* str = luax_checklstring(L, 2, &length); + Text text(Encode::UTF8, str, length); + page = ttf->typeset(text, lineheight, spacing); + } + else if (luax_istype(L, 2, Jin_Lua_Text)) + { + LuaObject* luaText = (LuaObject*)luax_checktype(L, 2, Jin_Lua_Text); + Text* text = luaText->getObject<Text>(); + page = ttf->typeset(*text, lineheight, spacing); + } + Shared* refPage = new Shared(page); + LuaObject* luaPage = luax_newinstance(L, Jin_Lua_Page, refPage); + luaPage->setDependency((int)PageDependency::DEP_TTF, luaTTF); + return 1; + } + + LUA_EXPORT void luaopen_TTF(lua_State* L) + { + luaL_Reg methods[] = { + { "__gc", l_gc }, + { "typeset", l_typeset }, + { 0, 0 } + }; + luax_newtype(L, Jin_Lua_TTF, methods); + } + + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_ttf.h b/src/libjin-lua/modules/graphics/l_ttf.h index bfe503d..587136a 100644 --- a/src/libjin-lua/modules/graphics/l_ttf.h +++ b/src/libjin-lua/modules/graphics/l_ttf.h @@ -3,14 +3,14 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - extern const char* Jin_Lua_TTF; + extern const char* Jin_Lua_TTF; - void luaopen_TTF(lua_State* L); + void luaopen_TTF(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_ttf_data.cpp b/src/libjin-lua/modules/graphics/l_ttf_data.cpp index 1c8c653..9cc629e 100644 --- a/src/libjin-lua/modules/graphics/l_ttf_data.cpp +++ b/src/libjin-lua/modules/graphics/l_ttf_data.cpp @@ -10,40 +10,40 @@ using namespace JinEngine::Graphics::Fonts; namespace JinEngine { - namespace Lua - { - - const char* Jin_Lua_TTFData = "TTFData"; - - LUA_IMPLEMENT int l_newTTF(lua_State* L) - { - LuaObject* luaTTFData = (LuaObject*)luax_checktype(L, 1, Jin_Lua_TTFData); - int fontsize = luax_checkinteger(L, 2); - TTFData* fontData = luaTTFData->getObject<TTFData>(); - TTF* font = fontData->createTTF(fontsize); - Shared* shrTTF = new Shared(font); - LuaObject* luaTTF = luax_newinstance(L, Jin_Lua_TTF, shrTTF); - luaTTF->setDependency((int)TTFDependency::DEP_TTFDATA, luaTTFData); - return 1; - } - - LUA_IMPLEMENT int l_gc(lua_State* L) - { - LuaObject* p = (LuaObject*)luax_checktype(L, 1, Jin_Lua_TTFData); - p->release(); - return 0; - } - - LUA_EXPORT void luaopen_TTFData(lua_State* L) - { - luaL_Reg methods[] = { - { "__gc", l_gc }, - { "newTTF", l_newTTF }, - { 0, 0 } - }; - luax_newtype(L, Jin_Lua_TTFData, methods); - - } - - } // namespace Lua + namespace Lua + { + + const char* Jin_Lua_TTFData = "TTFData"; + + LUA_IMPLEMENT int l_newTTF(lua_State* L) + { + LuaObject* luaTTFData = (LuaObject*)luax_checktype(L, 1, Jin_Lua_TTFData); + int fontsize = luax_checkinteger(L, 2); + TTFData* fontData = luaTTFData->getObject<TTFData>(); + TTF* font = fontData->createTTF(fontsize); + Shared* shrTTF = new Shared(font); + LuaObject* luaTTF = luax_newinstance(L, Jin_Lua_TTF, shrTTF); + luaTTF->setDependency((int)TTFDependency::DEP_TTFDATA, luaTTFData); + return 1; + } + + LUA_IMPLEMENT int l_gc(lua_State* L) + { + LuaObject* p = (LuaObject*)luax_checktype(L, 1, Jin_Lua_TTFData); + p->release(); + return 0; + } + + LUA_EXPORT void luaopen_TTFData(lua_State* L) + { + luaL_Reg methods[] = { + { "__gc", l_gc }, + { "newTTF", l_newTTF }, + { 0, 0 } + }; + luax_newtype(L, Jin_Lua_TTFData, methods); + + } + + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/graphics/l_ttf_data.h b/src/libjin-lua/modules/graphics/l_ttf_data.h index 1fd832d..1777375 100644 --- a/src/libjin-lua/modules/graphics/l_ttf_data.h +++ b/src/libjin-lua/modules/graphics/l_ttf_data.h @@ -3,19 +3,19 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - enum class TTFDependency - { - DEP_TTFDATA = 1, - }; + enum class TTFDependency + { + DEP_TTFDATA = 1, + }; - extern const char* Jin_Lua_TTFData; + extern const char* Jin_Lua_TTFData; - void luaopen_TTFData(lua_State* L); + void luaopen_TTFData(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/joypad/l_joypad.cpp b/src/libjin-lua/modules/joypad/l_joypad.cpp index a955978..6027998 100644 --- a/src/libjin-lua/modules/joypad/l_joypad.cpp +++ b/src/libjin-lua/modules/joypad/l_joypad.cpp @@ -4,18 +4,18 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - LUA_EXPORT int luaopen_joypad(lua_State* L) - { - luaL_Reg methods[] = { - { 0, 0 } - }; - luax_newlib(L, methods); + LUA_EXPORT int luaopen_joypad(lua_State* L) + { + luaL_Reg methods[] = { + { 0, 0 } + }; + luax_newlib(L, methods); - return 1; - } - /*SDL_JoystickGetButton*/ - } // namespace Lua + return 1; + } + /*SDL_JoystickGetButton*/ + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/joypad/l_joypad.h b/src/libjin-lua/modules/joypad/l_joypad.h index ec0e20f..48841ce 100644 --- a/src/libjin-lua/modules/joypad/l_joypad.h +++ b/src/libjin-lua/modules/joypad/l_joypad.h @@ -3,12 +3,12 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - int luaopen_joypad(lua_State* L); + int luaopen_joypad(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/keyboard/l_keyboard.cpp b/src/libjin-lua/modules/keyboard/l_keyboard.cpp index 4eba31d..21a7c43 100644 --- a/src/libjin-lua/modules/keyboard/l_keyboard.cpp +++ b/src/libjin-lua/modules/keyboard/l_keyboard.cpp @@ -3,15 +3,15 @@ namespace JinEngine { - namespace Lua - { - //https://wiki.libsdl.org/SDL_Keycode + namespace Lua + { + //https://wiki.libsdl.org/SDL_Keycode - LUA_EXPORT int luaopen_keyboard(lua_State* L) - { - luax_newlib(L, 0); - return 1; - } + LUA_EXPORT int luaopen_keyboard(lua_State* L) + { + luax_newlib(L, 0); + return 1; + } - } // namespace Lua + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/keyboard/l_keyboard.h b/src/libjin-lua/modules/keyboard/l_keyboard.h index bf00f83..04327d0 100644 --- a/src/libjin-lua/modules/keyboard/l_keyboard.h +++ b/src/libjin-lua/modules/keyboard/l_keyboard.h @@ -3,12 +3,12 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - int luaopen_keyboard(lua_State* L); + int luaopen_keyboard(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/math/l_math.cpp b/src/libjin-lua/modules/math/l_math.cpp index f7caa16..7a60152 100644 --- a/src/libjin-lua/modules/math/l_math.cpp +++ b/src/libjin-lua/modules/math/l_math.cpp @@ -4,27 +4,27 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - LUA_IMPLEMENT int l_mod(lua_State* L) - { - int n = luax_checkinteger(L, 1); - int m = luax_checkinteger(L, 2); - int mod = n % m; - luax_pushinteger(L, mod); - return 1; - } + LUA_IMPLEMENT int l_mod(lua_State* L) + { + int n = luax_checkinteger(L, 1); + int m = luax_checkinteger(L, 2); + int mod = n % m; + luax_pushinteger(L, mod); + return 1; + } - LUA_EXPORT int luaopen_math(lua_State* L) - { - luaL_Reg methods[] = { - { "mod", l_mod }, - { 0, 0 } - }; - luax_newlib(L, methods); - return 1; - } + LUA_EXPORT int luaopen_math(lua_State* L) + { + luaL_Reg methods[] = { + { "mod", l_mod }, + { 0, 0 } + }; + luax_newlib(L, methods); + return 1; + } - } // namespace Lua + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/math/l_math.h b/src/libjin-lua/modules/math/l_math.h index 2e7010c..5ffde76 100644 --- a/src/libjin-lua/modules/math/l_math.h +++ b/src/libjin-lua/modules/math/l_math.h @@ -3,12 +3,12 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - int luaopen_math(lua_State* L); + int luaopen_math(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/mouse/l_mouse.cpp b/src/libjin-lua/modules/mouse/l_mouse.cpp index f6864ee..2f0dfb4 100644 --- a/src/libjin-lua/modules/mouse/l_mouse.cpp +++ b/src/libjin-lua/modules/mouse/l_mouse.cpp @@ -6,37 +6,37 @@ using namespace JinEngine::Input; namespace JinEngine { - namespace Lua - { + namespace Lua + { - LUA_IMPLEMENT int l_pos(lua_State* L) - { - static Mouse* mouse = Mouse::get(); - int x, y; - mouse->getState(&x, &y); - luax_pushnumber(L, x); - luax_pushnumber(L, y); - return 2; - } + LUA_IMPLEMENT int l_pos(lua_State* L) + { + static Mouse* mouse = Mouse::get(); + int x, y; + mouse->getState(&x, &y); + luax_pushnumber(L, x); + luax_pushnumber(L, y); + return 2; + } - LUA_IMPLEMENT int l_setVisible(lua_State* L) - { - bool visible = luax_checkbool(L, 1); - Mouse* mouse = Mouse::get(); - mouse->setVisible(visible); - return 0; - } - - LUA_EXPORT int luaopen_mouse(lua_State* L) - { - luaL_Reg methods[] = { - { "getPosition", l_pos }, - { "setVisible", l_setVisible }, - { 0, 0 } - }; - luax_newlib(L, methods); - return 1; - } + LUA_IMPLEMENT int l_setVisible(lua_State* L) + { + bool visible = luax_checkbool(L, 1); + Mouse* mouse = Mouse::get(); + mouse->setVisible(visible); + return 0; + } + + LUA_EXPORT int luaopen_mouse(lua_State* L) + { + luaL_Reg methods[] = { + { "getPosition", l_pos }, + { "setVisible", l_setVisible }, + { 0, 0 } + }; + luax_newlib(L, methods); + return 1; + } - } // namespace Lua + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/mouse/l_mouse.h b/src/libjin-lua/modules/mouse/l_mouse.h index 09738f5..7a70873 100644 --- a/src/libjin-lua/modules/mouse/l_mouse.h +++ b/src/libjin-lua/modules/mouse/l_mouse.h @@ -3,12 +3,12 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - int luaopen_mouse(lua_State* L); + int luaopen_mouse(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/net/l_buffer.cpp b/src/libjin-lua/modules/net/l_buffer.cpp index 546787e..5170a58 100644 --- a/src/libjin-lua/modules/net/l_buffer.cpp +++ b/src/libjin-lua/modules/net/l_buffer.cpp @@ -7,130 +7,130 @@ using namespace JinEngine::Lua::Net; namespace JinEngine { - namespace Lua - { + namespace Lua + { - const char* Jin_Lua_Buffer = "Buffer"; + const char* Jin_Lua_Buffer = "Buffer"; - static inline Net::Buffer* checkNetBuffer(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Buffer); - return luaObj->getObject<Net::Buffer>(); - } + static inline Net::Buffer* checkNetBuffer(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Buffer); + return luaObj->getObject<Net::Buffer>(); + } - // net.Buffer:append(value) -> value_length - LUA_IMPLEMENT int l_append(lua_State* L) - { - Buffer* buffer = checkNetBuffer(L); - const int vp = 2; - if (luax_isintegerstrict(L, vp)) - { - int n = luax_checkinteger(L, vp); - int size = sizeof(n); - buffer->append(&n, size); - luax_pushinteger(L, size); - return 1; - } - else if (luax_isfloatstrict(L, vp)) - { - float n = luax_checknumber(L, vp); - int size = sizeof(n); - buffer->append(&n, size); - luax_pushinteger(L, size); - return 1; - } - else if (luax_isbooleanstrict(L, vp)) - { - bool n = luax_checkbool(L, vp); - int size = sizeof(n); - buffer->append(&n, size); - luax_pushinteger(L, size); - return 1; - } - else if (luax_isstringstrict(L, vp)) - { - const char* str = luax_checkstring(L, vp); - int size = strlen(str) + 1; - buffer->append(str, size); - luax_pushinteger(L, size); - return 1; - } - else - { - luax_typerror(L, vp, "number, bool or string"); - return 0; - } - } + // net.Buffer:append(value) -> value_length + LUA_IMPLEMENT int l_append(lua_State* L) + { + Buffer* buffer = checkNetBuffer(L); + const int vp = 2; + if (luax_isintegerstrict(L, vp)) + { + int n = luax_checkinteger(L, vp); + int size = sizeof(n); + buffer->append(&n, size); + luax_pushinteger(L, size); + return 1; + } + else if (luax_isfloatstrict(L, vp)) + { + float n = luax_checknumber(L, vp); + int size = sizeof(n); + buffer->append(&n, size); + luax_pushinteger(L, size); + return 1; + } + else if (luax_isbooleanstrict(L, vp)) + { + bool n = luax_checkbool(L, vp); + int size = sizeof(n); + buffer->append(&n, size); + luax_pushinteger(L, size); + return 1; + } + else if (luax_isstringstrict(L, vp)) + { + const char* str = luax_checkstring(L, vp); + int size = strlen(str) + 1; + buffer->append(str, size); + luax_pushinteger(L, size); + return 1; + } + else + { + luax_typerror(L, vp, "number, bool or string"); + return 0; + } + } - // net.Buffer:grabString(offset) -> string, length - LUA_IMPLEMENT int l_grabString(lua_State* L) - { - Buffer* buffer = checkNetBuffer(L); - int offset = luax_checkinteger(L, 2); - unsigned int len; - char* data = buffer->grabString(&len, offset); - Array<char> str; - str.bind(data, len); - luax_pushstring(L, &str); - luax_pushinteger(L, str.count()); - return 2; - } + // net.Buffer:grabString(offset) -> string, length + LUA_IMPLEMENT int l_grabString(lua_State* L) + { + Buffer* buffer = checkNetBuffer(L); + int offset = luax_checkinteger(L, 2); + unsigned int len; + char* data = buffer->grabString(&len, offset); + Array<char> str; + str.bind(data, len); + luax_pushstring(L, &str); + luax_pushinteger(L, str.count()); + return 2; + } - // net.Buffer:grabInteger(offset) -> integer, length - LUA_IMPLEMENT int l_grabInteger(lua_State* L) - { - Buffer* buffer = checkNetBuffer(L); - int offset = luax_checkinteger(L, 2); - int len; - int integer = buffer->grabInteger(&len, offset); - luax_pushinteger(L, integer); - luax_pushinteger(L, len); - return 2; - } + // net.Buffer:grabInteger(offset) -> integer, length + LUA_IMPLEMENT int l_grabInteger(lua_State* L) + { + Buffer* buffer = checkNetBuffer(L); + int offset = luax_checkinteger(L, 2); + int len; + int integer = buffer->grabInteger(&len, offset); + luax_pushinteger(L, integer); + luax_pushinteger(L, len); + return 2; + } - LUA_IMPLEMENT int l_grabFloat(lua_State* L) - { - Buffer* buffer = checkNetBuffer(L); - int offset = luax_checkinteger(L, 2); - int len; - float floatv = buffer->grabFloat(&len, offset); - luax_pushnumber(L, floatv); - luax_pushinteger(L, len); - return 2; - } + LUA_IMPLEMENT int l_grabFloat(lua_State* L) + { + Buffer* buffer = checkNetBuffer(L); + int offset = luax_checkinteger(L, 2); + int len; + float floatv = buffer->grabFloat(&len, offset); + luax_pushnumber(L, floatv); + luax_pushinteger(L, len); + return 2; + } - LUA_IMPLEMENT int l_grabBoolean(lua_State* L) - { - Buffer* buffer = checkNetBuffer(L); - int offset = luax_checkinteger(L, 2); - int len; - bool boolean = buffer->grabBoolean(&len, offset); - luax_pushboolean(L, boolean); - luax_pushinteger(L, len); - return 2; - } + LUA_IMPLEMENT int l_grabBoolean(lua_State* L) + { + Buffer* buffer = checkNetBuffer(L); + int offset = luax_checkinteger(L, 2); + int len; + bool boolean = buffer->grabBoolean(&len, offset); + luax_pushboolean(L, boolean); + luax_pushinteger(L, len); + return 2; + } - LUA_IMPLEMENT int l_gc(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Buffer); - luaObj->release(); - return 0; - } + LUA_IMPLEMENT int l_gc(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Buffer); + luaObj->release(); + return 0; + } - LUA_EXPORT void luaopen_Buffer(lua_State* L) - { - luaL_Reg netbuffer_function[] = { - { "__gc", l_gc }, - { "append", l_append }, - { "grabString", l_grabString }, - { "grabInteger", l_grabInteger }, - { "grabBoolean", l_grabBoolean }, - { "grabFloat", l_grabFloat }, - { 0, 0 } - }; + LUA_EXPORT void luaopen_Buffer(lua_State* L) + { + luaL_Reg netbuffer_function[] = { + { "__gc", l_gc }, + { "append", l_append }, + { "grabString", l_grabString }, + { "grabInteger", l_grabInteger }, + { "grabBoolean", l_grabBoolean }, + { "grabFloat", l_grabFloat }, + { 0, 0 } + }; - luax_newtype(L, Jin_Lua_Buffer, netbuffer_function); - } + luax_newtype(L, Jin_Lua_Buffer, netbuffer_function); + } - } // namespace Lua + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/net/l_buffer.h b/src/libjin-lua/modules/net/l_buffer.h index 4ff9be6..7cf6061 100644 --- a/src/libjin-lua/modules/net/l_buffer.h +++ b/src/libjin-lua/modules/net/l_buffer.h @@ -7,96 +7,96 @@ namespace JinEngine { - namespace Lua - { - - extern const char* Jin_Lua_Buffer; - - void luaopen_Buffer(lua_State* L); - - namespace Net - { - - class Buffer : public Object - { - public: - Buffer(size_t s = 0) - : size(s) - { - buffer = new char[size]; - memset(buffer, 0, size); - } - - Buffer(const char* data, size_t s) - : size(s) - { - buffer = new char[size]; - memcpy(buffer, data, size); - } - - ~Buffer() - { - if (buffer != nullptr) - { - delete[] buffer; - buffer = nullptr; - size = 0; - } - } - - void append(const void* data, size_t s) - { - if (data == nullptr) - return; - char* buf = buffer; - buffer = new char[size + s]; - memcpy(buffer, buf, size); - memcpy(buffer + size, data, s); - delete[] buf; - size += s; - return; - } - - /* grab and create a string */ - char* grabString(unsigned int* length, int offset = 0) - { - int l = offset; - for (; l < size; ++l) - { - if (buffer[l] == 0) - break; - } - *length = l - offset + 1; - char* str = (char*)malloc(*length); - memcpy(str, buffer + offset, *length); - return str; - } - - int grabInteger(int* length, int offset = 0) - { - *length = sizeof(int); - return *((int*)(buffer + offset)); - } - - float grabFloat(int* length, int offset = 0) - { - *length = sizeof(float); - return *((float*)(buffer + offset)); - } - - bool grabBoolean(int* length, int offset = 0) - { - *length = sizeof(bool); - return *((bool*)(buffer + offset)); - } - - char* buffer; - size_t size; - - }; - - } // namespace Net - } // namespace Lua + namespace Lua + { + + extern const char* Jin_Lua_Buffer; + + void luaopen_Buffer(lua_State* L); + + namespace Net + { + + class Buffer : public Object + { + public: + Buffer(size_t s = 0) + : size(s) + { + buffer = new char[size]; + memset(buffer, 0, size); + } + + Buffer(const char* data, size_t s) + : size(s) + { + buffer = new char[size]; + memcpy(buffer, data, size); + } + + ~Buffer() + { + if (buffer != nullptr) + { + delete[] buffer; + buffer = nullptr; + size = 0; + } + } + + void append(const void* data, size_t s) + { + if (data == nullptr) + return; + char* buf = buffer; + buffer = new char[size + s]; + memcpy(buffer, buf, size); + memcpy(buffer + size, data, s); + delete[] buf; + size += s; + return; + } + + /* grab and create a string */ + char* grabString(unsigned int* length, int offset = 0) + { + int l = offset; + for (; l < size; ++l) + { + if (buffer[l] == 0) + break; + } + *length = l - offset + 1; + char* str = (char*)malloc(*length); + memcpy(str, buffer + offset, *length); + return str; + } + + int grabInteger(int* length, int offset = 0) + { + *length = sizeof(int); + return *((int*)(buffer + offset)); + } + + float grabFloat(int* length, int offset = 0) + { + *length = sizeof(float); + return *((float*)(buffer + offset)); + } + + bool grabBoolean(int* length, int offset = 0) + { + *length = sizeof(bool); + return *((bool*)(buffer + offset)); + } + + char* buffer; + size_t size; + + }; + + } // namespace Net + } // namespace Lua } // namespace JinEngine #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/net/l_net.cpp b/src/libjin-lua/modules/net/l_net.cpp index 5569381..512cf9a 100644 --- a/src/libjin-lua/modules/net/l_net.cpp +++ b/src/libjin-lua/modules/net/l_net.cpp @@ -7,73 +7,73 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - using namespace JinEngine::Lua::Net; - using namespace JinEngine::Net; + using namespace JinEngine::Lua::Net; + using namespace JinEngine::Net; - LUA_IMPLEMENT int l_initNetwork(lua_State* L) - { - JinEngine::Net::NetManager::get()->start(); - return 1; - } - - LUA_IMPLEMENT int l_Socket(lua_State* L) - { - SocketInformation info = { 0 }; - { - const char* socketType = luax_checkstring(L, 1); - if (strcmp(socketType, "TCP") == 0) - info.type = SocketType::TCP; - else if (strcmp(socketType, "UDP") == 0) - info.type = SocketType::UDP; - else - { - luax_error(L, "jin.net.Socket() first paramter wrong, must be TCP or UDP"); - return 0; - } - // type, port - if (luax_gettop(L) == 2) - { - info.port = luax_checkinteger(L, 2); - } - // type, address, port - else if (luax_gettop(L) == 3) - { - if (luax_isstringstrict(L, 2)) - info.address = tk_strtohl(luax_checkstring(L, 2)); - else if (luax_isintegerstrict(L, 2)) - info.address = luax_checkinteger(L, 2); - info.port = luax_checkinteger(L, 3); - } - } - Socket* socket = new Socket(info); - LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Socket, new Shared(socket)); - return 1; - } + LUA_IMPLEMENT int l_initNetwork(lua_State* L) + { + JinEngine::Net::NetManager::get()->start(); + return 1; + } + + LUA_IMPLEMENT int l_Socket(lua_State* L) + { + SocketInformation info = { 0 }; + { + const char* socketType = luax_checkstring(L, 1); + if (strcmp(socketType, "TCP") == 0) + info.type = SocketType::TCP; + else if (strcmp(socketType, "UDP") == 0) + info.type = SocketType::UDP; + else + { + luax_error(L, "jin.net.Socket() first paramter wrong, must be TCP or UDP"); + return 0; + } + // type, port + if (luax_gettop(L) == 2) + { + info.port = luax_checkinteger(L, 2); + } + // type, address, port + else if (luax_gettop(L) == 3) + { + if (luax_isstringstrict(L, 2)) + info.address = tk_strtohl(luax_checkstring(L, 2)); + else if (luax_isintegerstrict(L, 2)) + info.address = luax_checkinteger(L, 2); + info.port = luax_checkinteger(L, 3); + } + } + Socket* socket = new Socket(info); + LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Socket, new Shared(socket)); + return 1; + } - LUA_IMPLEMENT int l_Buffer(lua_State* L) - { - int size = luax_checkinteger(L, 1); - Net::Buffer* buffer = new Net::Buffer(size); - LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Buffer, new Shared(buffer)); - return 1; - } + LUA_IMPLEMENT int l_Buffer(lua_State* L) + { + int size = luax_checkinteger(L, 1); + Net::Buffer* buffer = new Net::Buffer(size); + LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Buffer, new Shared(buffer)); + return 1; + } - LUA_EXPORT int luaopen_net(lua_State* L) - { - luaopen_Socket(L); - luaopen_Buffer(L); - luaL_Reg methods[] = { - { "init", l_initNetwork }, - { "newSocket", l_Socket }, - { "newBuffer", l_Buffer }, - { 0, 0 } - }; - luax_newlib(L, methods); - return 1; - } + LUA_EXPORT int luaopen_net(lua_State* L) + { + luaopen_Socket(L); + luaopen_Buffer(L); + luaL_Reg methods[] = { + { "init", l_initNetwork }, + { "newSocket", l_Socket }, + { "newBuffer", l_Buffer }, + { 0, 0 } + }; + luax_newlib(L, methods); + return 1; + } - } // namespace Lua + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/net/l_net.h b/src/libjin-lua/modules/net/l_net.h index 1542791..e41ed18 100644 --- a/src/libjin-lua/modules/net/l_net.h +++ b/src/libjin-lua/modules/net/l_net.h @@ -3,12 +3,12 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - int luaopen_net(lua_State* L); + int luaopen_net(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/net/l_socket.cpp b/src/libjin-lua/modules/net/l_socket.cpp index 1e86ea9..c5ed2b4 100644 --- a/src/libjin-lua/modules/net/l_socket.cpp +++ b/src/libjin-lua/modules/net/l_socket.cpp @@ -8,116 +8,116 @@ using namespace JinEngine::Lua::Net; namespace JinEngine { - namespace Lua - { + namespace Lua + { - const char* Jin_Lua_Socket = "Socket"; + const char* Jin_Lua_Socket = "Socket"; - const int BUFFER_SIZE = 1024; + const int BUFFER_SIZE = 1024; - LUA_IMPLEMENT inline Socket* checkSocket(lua_State* L, int pos = 1) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, pos, Jin_Lua_Socket); - return luaObj->getObject<Socket>(); - } + LUA_IMPLEMENT inline Socket* checkSocket(lua_State* L, int pos = 1) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, pos, Jin_Lua_Socket); + return luaObj->getObject<Socket>(); + } - LUA_IMPLEMENT inline Buffer* checkNetBuffer(lua_State* L, int pos = 1) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, pos, Jin_Lua_Buffer); - return luaObj->getObject<Buffer>(); - } + LUA_IMPLEMENT inline Buffer* checkNetBuffer(lua_State* L, int pos = 1) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, pos, Jin_Lua_Buffer); + return luaObj->getObject<Buffer>(); + } - // return net.Socket - LUA_IMPLEMENT int l_accept(lua_State* L) - { - Socket* socket = checkSocket(L); - Socket* client = socket->accept(); - LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Socket, new Shared(client)); - return 1; - } - - // return net.Buffer - LUA_IMPLEMENT int l_receive(lua_State* L) - { - Socket* socket = checkSocket(L); - char buffer[BUFFER_SIZE] = {0}; - int size = socket->receive(buffer, BUFFER_SIZE); - Net::Buffer* netBuffer = new Net::Buffer(buffer, size); - LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Buffer, new Shared(netBuffer)); - return 1; - } - - // Socket:receiveFrom(address, port) - LUA_IMPLEMENT int l_receiveFrom(lua_State* L) - { - Socket* socket = checkSocket(L); - int address = luax_checkinteger(L, 2); - int port = luax_checkinteger(L, 3); - char buffer[BUFFER_SIZE]; - int size = socket->receiveFrom(buffer, BUFFER_SIZE, address, port); - Net::Buffer* netBuffer = new Net::Buffer(buffer, size); - LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Buffer, new Shared(netBuffer)); - return 1; - } + // return net.Socket + LUA_IMPLEMENT int l_accept(lua_State* L) + { + Socket* socket = checkSocket(L); + Socket* client = socket->accept(); + LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Socket, new Shared(client)); + return 1; + } + + // return net.Buffer + LUA_IMPLEMENT int l_receive(lua_State* L) + { + Socket* socket = checkSocket(L); + char buffer[BUFFER_SIZE] = {0}; + int size = socket->receive(buffer, BUFFER_SIZE); + Net::Buffer* netBuffer = new Net::Buffer(buffer, size); + LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Buffer, new Shared(netBuffer)); + return 1; + } + + // Socket:receiveFrom(address, port) + LUA_IMPLEMENT int l_receiveFrom(lua_State* L) + { + Socket* socket = checkSocket(L); + int address = luax_checkinteger(L, 2); + int port = luax_checkinteger(L, 3); + char buffer[BUFFER_SIZE]; + int size = socket->receiveFrom(buffer, BUFFER_SIZE, address, port); + Net::Buffer* netBuffer = new Net::Buffer(buffer, size); + LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Buffer, new Shared(netBuffer)); + return 1; + } - // Socket:send(net.Buffer) -> data_length - LUA_IMPLEMENT int l_send(lua_State* L) - { - Socket* socket = checkSocket(L); - Buffer* buffer = checkNetBuffer(L, 2); - int len = socket->send(buffer->buffer, buffer->size); - luax_pushinteger(L, len); - return 1; - } - - // Socket:sendTo(address, port, net.Buffer) - LUA_IMPLEMENT int l_sendTo(lua_State* L) - { - Socket* socket = checkSocket(L); - int address = luax_checkinteger(L, 2); - int port = luax_checkinteger(L, 3); - Buffer* buffer = checkNetBuffer(L, 4); - socket->sendTo(buffer->buffer, buffer->size, address, port); - return 0; - } - - LUA_IMPLEMENT int l_close(lua_State* L) - { - Socket* socket = checkSocket(L); - socket->close(); - return 0; - } + // Socket:send(net.Buffer) -> data_length + LUA_IMPLEMENT int l_send(lua_State* L) + { + Socket* socket = checkSocket(L); + Buffer* buffer = checkNetBuffer(L, 2); + int len = socket->send(buffer->buffer, buffer->size); + luax_pushinteger(L, len); + return 1; + } + + // Socket:sendTo(address, port, net.Buffer) + LUA_IMPLEMENT int l_sendTo(lua_State* L) + { + Socket* socket = checkSocket(L); + int address = luax_checkinteger(L, 2); + int port = luax_checkinteger(L, 3); + Buffer* buffer = checkNetBuffer(L, 4); + socket->sendTo(buffer->buffer, buffer->size, address, port); + return 0; + } + + LUA_IMPLEMENT int l_close(lua_State* L) + { + Socket* socket = checkSocket(L); + socket->close(); + return 0; + } - LUA_IMPLEMENT int l_configBlocking(lua_State* L) - { - Socket* socket = checkSocket(L); - bool blocking = luax_checkbool(L, 2); - socket->configureBlocking(blocking); - return 0; - } + LUA_IMPLEMENT int l_configBlocking(lua_State* L) + { + Socket* socket = checkSocket(L); + bool blocking = luax_checkbool(L, 2); + socket->configureBlocking(blocking); + return 0; + } - LUA_IMPLEMENT int l_gc(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Socket); - luaObj->release(); - return 0; - } + LUA_IMPLEMENT int l_gc(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Socket); + luaObj->release(); + return 0; + } - LUA_EXPORT void luaopen_Socket(lua_State* L) - { - luaL_Reg socket_function[] = { - { "__gc", l_gc }, - { "accept", l_accept }, - { "receive", l_receive }, - { "receiveFrom", l_receiveFrom }, - { "send", l_send }, - { "sendTo", l_sendTo }, - { "close", l_close }, - { "configBlocking", l_configBlocking }, - { 0, 0 } - }; - luax_newtype(L, Jin_Lua_Socket, socket_function); - } + LUA_EXPORT void luaopen_Socket(lua_State* L) + { + luaL_Reg socket_function[] = { + { "__gc", l_gc }, + { "accept", l_accept }, + { "receive", l_receive }, + { "receiveFrom", l_receiveFrom }, + { "send", l_send }, + { "sendTo", l_sendTo }, + { "close", l_close }, + { "configBlocking", l_configBlocking }, + { 0, 0 } + }; + luax_newtype(L, Jin_Lua_Socket, socket_function); + } - } // namespace Lua + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/net/l_socket.h b/src/libjin-lua/modules/net/l_socket.h index b33fac6..54542e4 100644 --- a/src/libjin-lua/modules/net/l_socket.h +++ b/src/libjin-lua/modules/net/l_socket.h @@ -3,14 +3,14 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - extern const char* Jin_Lua_Socket; + extern const char* Jin_Lua_Socket; - void luaopen_Socket(lua_State* L); + void luaopen_Socket(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/thread/l_thread.cpp b/src/libjin-lua/modules/thread/l_thread.cpp index 757244a..4fef77a 100644 --- a/src/libjin-lua/modules/thread/l_thread.cpp +++ b/src/libjin-lua/modules/thread/l_thread.cpp @@ -7,234 +7,234 @@ namespace JinEngine { - namespace Lua - { - - const char* Jin_Lua_Thread = "Thread"; - - int luaopen_thread(lua_State* L); - - static inline Thread* checkThread(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Thread); - return luaObj->getObject<Thread>(); - } - - LUA_IMPLEMENT int threadRunner(void* t) - { - Shared* shared = (Shared*)t; - Thread* thread = shared->getObject<Thread>(); - lua_State* L = lua_open(); - luax_openlibs(L); - open(L); - luax_getglobal(L, MODULE_NAME); - LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Thread, shared); - luax_setfield(L, -2, "_curThread"); - luax_dostring(L, thread->code.c_str()); - luax_close(L); - return 0; - } - - LUA_IMPLEMENT int l_thread_gc(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Thread); - luaObj->release(); - return 0; - } - - LUA_IMPLEMENT int l_start(lua_State* L) - { - Thread* shared = checkThread(L); - bool result = shared->start(&shared); - luax_pushboolean(L, result); - return 1; - } - - LUA_IMPLEMENT int l_wait(lua_State* L) - { - Thread* shared = checkThread(L); - shared->wait(); - return 0; - } - - LUA_IMPLEMENT int l_send(lua_State* L) - { - Thread* shared = checkThread(L); - int slot = luax_checkinteger(L, 2); - const int vp = 3; - if (luax_isnumberstrict(L, vp)) - { - float real = luax_checknumber(L, vp); - shared->send(slot, real); - } - else if (luax_isbooleanstrict(L, vp)) - { - bool bol = luax_checkbool(L, vp); - shared->send(slot, bol); - } - else if (luax_isstringstrict(L, vp)) - { - const char* str = luax_checkstring(L, vp); - shared->send(slot, str); - } - else if (luax_isuserdata(L, vp)) - { - LuaObject* luaObj = (LuaObject*)luax_touserdata(L, vp); - shared->send(slot, luaObj); - }/* - else if (luax_islightuserdata(L, vp)) - { - void* p = luax_tolightuserdata(L, vp); - shared->send(slot, p); - }*/ - return 0; - } - - LUA_IMPLEMENT int l_receive(lua_State* L) - { - Thread* shared = checkThread(L); - int slot = luax_checkinteger(L, 2); - bool result = shared->receive(slot); - luax_pushboolean(L, result); - return 1; - } - - LUA_IMPLEMENT int l_fetch(lua_State* L) - { - Thread* shared = checkThread(L); - int slot = luax_checkinteger(L, 2); - Thread::Variant v = shared->fetch(slot); - switch (v.type) - { - case Thread::Variant::INTERGER: - luax_pushinteger(L, v.integer); - break; - - case Thread::Variant::BOOLEAN: - luax_pushboolean(L, v.boolean); - break; - - case Thread::Variant::CSTRING: - luax_pushstring(L, v.cstring); - break; - - case Thread::Variant::REAL: - luax_pushnumber(L, v.real); - break; - - case Thread::Variant::POINTER: - LuaObject* p = (LuaObject*)v.pointer; - // Create lua object from other lua_State. - LuaObject* luaObj = luax_copyinstance(L, p); - break; - - } - return 1; - } - - LUA_IMPLEMENT int l_demand(lua_State* L) - { - Thread* shared = checkThread(L); - int slot = luax_checkinteger(L, 2); - Thread::Variant v = shared->demand(slot); - switch (v.type) - { - case Thread::Variant::INTERGER: - luax_pushinteger(L, v.integer); - break; - - case Thread::Variant::BOOLEAN: - luax_pushboolean(L, v.boolean); - break; - - case Thread::Variant::CSTRING: - luax_pushstring(L, v.cstring); - break; - - case Thread::Variant::REAL: - luax_pushnumber(L, v.real); - break; - - case Thread::Variant::POINTER: - LuaObject* p = (LuaObject*)v.pointer; - // Create lua object from other lua_State. - LuaObject* luaObj = luax_copyinstance(L, p); - break; - - } - return 1; - } - - LUA_IMPLEMENT int l_remove(lua_State* L) - { - Thread* shared = checkThread(L); - int slot = luax_checkinteger(L, 2); - shared->remove(slot); - return 0; - } - - LUA_IMPLEMENT int l_getName(lua_State* L) - { - Thread* shared = checkThread(L); - const char* name = shared->getName(); - luax_pushstring(L, name); - return 1; - } - - LUA_IMPLEMENT int l_isRunning(lua_State* L) - { - Thread* shared = checkThread(L); - bool running = shared->isRunning(); - luax_pushboolean(L, running); - return 1; - } - - LUA_IMPLEMENT int luaopen_Thread(lua_State* L) - { - luaL_Reg thread_function[] = { - { "__gc", l_thread_gc }, - { "start", l_start }, - { "wait", l_wait }, - { "send", l_send }, - { "receive", l_receive }, - { "fetch", l_fetch }, - { "demand", l_demand }, - { "remove", l_remove }, - { "getName", l_getName }, - { "isRunning", l_isRunning }, - { 0, 0 } - }; - luax_newtype(L, Jin_Lua_Thread, thread_function); - return 0; - } - - LUA_IMPLEMENT int l_newThread(lua_State* L) - { - const char* name = luax_checkstring(L, 1); - const char* code = luax_checkstring(L, 2); - Thread* thread = new Thread(name, code, threadRunner); - LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Thread, new Shared(thread)); - return 1; - } - - LUA_IMPLEMENT int l_getThread(lua_State* L) - { - luax_getglobal(L, MODULE_NAME); - luax_getfield(L, -1, "_curThread"); - return 1; - } - - LUA_EXPORT int luaopen_thread(lua_State* L) - { - luaopen_Thread(L); - luaL_Reg methods[] = { - { "newThread", l_newThread }, - { "getThread", l_getThread }, - { 0, 0 } - }; - luax_newlib(L, methods); - return 1; - } - - } // namespace Lua + namespace Lua + { + + const char* Jin_Lua_Thread = "Thread"; + + int luaopen_thread(lua_State* L); + + static inline Thread* checkThread(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Thread); + return luaObj->getObject<Thread>(); + } + + LUA_IMPLEMENT int threadRunner(void* t) + { + Shared* shared = (Shared*)t; + Thread* thread = shared->getObject<Thread>(); + lua_State* L = lua_open(); + luax_openlibs(L); + open(L); + luax_getglobal(L, MODULE_NAME); + LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Thread, shared); + luax_setfield(L, -2, "_curThread"); + luax_dostring(L, thread->code.c_str()); + luax_close(L); + return 0; + } + + LUA_IMPLEMENT int l_thread_gc(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Thread); + luaObj->release(); + return 0; + } + + LUA_IMPLEMENT int l_start(lua_State* L) + { + Thread* shared = checkThread(L); + bool result = shared->start(&shared); + luax_pushboolean(L, result); + return 1; + } + + LUA_IMPLEMENT int l_wait(lua_State* L) + { + Thread* shared = checkThread(L); + shared->wait(); + return 0; + } + + LUA_IMPLEMENT int l_send(lua_State* L) + { + Thread* shared = checkThread(L); + int slot = luax_checkinteger(L, 2); + const int vp = 3; + if (luax_isnumberstrict(L, vp)) + { + float real = luax_checknumber(L, vp); + shared->send(slot, real); + } + else if (luax_isbooleanstrict(L, vp)) + { + bool bol = luax_checkbool(L, vp); + shared->send(slot, bol); + } + else if (luax_isstringstrict(L, vp)) + { + const char* str = luax_checkstring(L, vp); + shared->send(slot, str); + } + else if (luax_isuserdata(L, vp)) + { + LuaObject* luaObj = (LuaObject*)luax_touserdata(L, vp); + shared->send(slot, luaObj); + }/* + else if (luax_islightuserdata(L, vp)) + { + void* p = luax_tolightuserdata(L, vp); + shared->send(slot, p); + }*/ + return 0; + } + + LUA_IMPLEMENT int l_receive(lua_State* L) + { + Thread* shared = checkThread(L); + int slot = luax_checkinteger(L, 2); + bool result = shared->receive(slot); + luax_pushboolean(L, result); + return 1; + } + + LUA_IMPLEMENT int l_fetch(lua_State* L) + { + Thread* shared = checkThread(L); + int slot = luax_checkinteger(L, 2); + Thread::Variant v = shared->fetch(slot); + switch (v.type) + { + case Thread::Variant::INTERGER: + luax_pushinteger(L, v.integer); + break; + + case Thread::Variant::BOOLEAN: + luax_pushboolean(L, v.boolean); + break; + + case Thread::Variant::CSTRING: + luax_pushstring(L, v.cstring); + break; + + case Thread::Variant::REAL: + luax_pushnumber(L, v.real); + break; + + case Thread::Variant::POINTER: + LuaObject* p = (LuaObject*)v.pointer; + // Create lua object from other lua_State. + LuaObject* luaObj = luax_copyinstance(L, p); + break; + + } + return 1; + } + + LUA_IMPLEMENT int l_demand(lua_State* L) + { + Thread* shared = checkThread(L); + int slot = luax_checkinteger(L, 2); + Thread::Variant v = shared->demand(slot); + switch (v.type) + { + case Thread::Variant::INTERGER: + luax_pushinteger(L, v.integer); + break; + + case Thread::Variant::BOOLEAN: + luax_pushboolean(L, v.boolean); + break; + + case Thread::Variant::CSTRING: + luax_pushstring(L, v.cstring); + break; + + case Thread::Variant::REAL: + luax_pushnumber(L, v.real); + break; + + case Thread::Variant::POINTER: + LuaObject* p = (LuaObject*)v.pointer; + // Create lua object from other lua_State. + LuaObject* luaObj = luax_copyinstance(L, p); + break; + + } + return 1; + } + + LUA_IMPLEMENT int l_remove(lua_State* L) + { + Thread* shared = checkThread(L); + int slot = luax_checkinteger(L, 2); + shared->remove(slot); + return 0; + } + + LUA_IMPLEMENT int l_getName(lua_State* L) + { + Thread* shared = checkThread(L); + const char* name = shared->getName(); + luax_pushstring(L, name); + return 1; + } + + LUA_IMPLEMENT int l_isRunning(lua_State* L) + { + Thread* shared = checkThread(L); + bool running = shared->isRunning(); + luax_pushboolean(L, running); + return 1; + } + + LUA_IMPLEMENT int luaopen_Thread(lua_State* L) + { + luaL_Reg thread_function[] = { + { "__gc", l_thread_gc }, + { "start", l_start }, + { "wait", l_wait }, + { "send", l_send }, + { "receive", l_receive }, + { "fetch", l_fetch }, + { "demand", l_demand }, + { "remove", l_remove }, + { "getName", l_getName }, + { "isRunning", l_isRunning }, + { 0, 0 } + }; + luax_newtype(L, Jin_Lua_Thread, thread_function); + return 0; + } + + LUA_IMPLEMENT int l_newThread(lua_State* L) + { + const char* name = luax_checkstring(L, 1); + const char* code = luax_checkstring(L, 2); + Thread* thread = new Thread(name, code, threadRunner); + LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Thread, new Shared(thread)); + return 1; + } + + LUA_IMPLEMENT int l_getThread(lua_State* L) + { + luax_getglobal(L, MODULE_NAME); + luax_getfield(L, -1, "_curThread"); + return 1; + } + + LUA_EXPORT int luaopen_thread(lua_State* L) + { + luaopen_Thread(L); + luaL_Reg methods[] = { + { "newThread", l_newThread }, + { "getThread", l_getThread }, + { 0, 0 } + }; + luax_newlib(L, methods); + return 1; + } + + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/thread/l_thread.h b/src/libjin-lua/modules/thread/l_thread.h index 8203134..957abb1 100644 --- a/src/libjin-lua/modules/thread/l_thread.h +++ b/src/libjin-lua/modules/thread/l_thread.h @@ -3,93 +3,93 @@ namespace JinEngine { - namespace Lua - { - - extern const char* Jin_Lua_Thread; - - class Thread : public Object - { - public: - typedef JinEngine::Threads::Thread::Variant Variant; - typedef JinEngine::Threads::Thread::ThreadRunner ThreadRunner; - - Thread(std::string _name, std::string _code, ThreadRunner runner) - : name(_name) - , code(_code) - { - thread = new JinEngine::Threads::Thread(_name, runner); - } - - ~Thread() - { - delete thread; - } - - bool start(void* p) - { - return thread->start(p); - } - - void wait() - { - thread->wait(); - } - - void send(int slot, const Variant& value) - { - thread->send(slot, value); - } - - bool receive(int slot) - { - return thread->receive(slot); - } - - Variant fetch(int slot) - { - return thread->fetch(slot); - } - - Variant demand(int slot) - { - return thread->demand(slot); - } - - void remove(int slot) - { - thread->remove(slot); - } - - const char* getName() - { - return name.c_str(); - } - - bool isRunning() - { - return thread->isRunning(); - } - - void lock() - { - thread->lock(); - } - - void unlock() - { - thread->unlock(); - } - - const std::string name; - const std::string code; - - private: - JinEngine::Threads::Thread* thread; - - }; - - int luaopen_thread(lua_State* L); - - } // namespace Lua + namespace Lua + { + + extern const char* Jin_Lua_Thread; + + class Thread : public Object + { + public: + typedef JinEngine::Threads::Thread::Variant Variant; + typedef JinEngine::Threads::Thread::ThreadRunner ThreadRunner; + + Thread(std::string _name, std::string _code, ThreadRunner runner) + : name(_name) + , code(_code) + { + thread = new JinEngine::Threads::Thread(_name, runner); + } + + ~Thread() + { + delete thread; + } + + bool start(void* p) + { + return thread->start(p); + } + + void wait() + { + thread->wait(); + } + + void send(int slot, const Variant& value) + { + thread->send(slot, value); + } + + bool receive(int slot) + { + return thread->receive(slot); + } + + Variant fetch(int slot) + { + return thread->fetch(slot); + } + + Variant demand(int slot) + { + return thread->demand(slot); + } + + void remove(int slot) + { + thread->remove(slot); + } + + const char* getName() + { + return name.c_str(); + } + + bool isRunning() + { + return thread->isRunning(); + } + + void lock() + { + thread->lock(); + } + + void unlock() + { + thread->unlock(); + } + + const std::string name; + const std::string code; + + private: + JinEngine::Threads::Thread* thread; + + }; + + int luaopen_thread(lua_State* L); + + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/time/l_time.cpp b/src/libjin-lua/modules/time/l_time.cpp index 0e39f9e..b88b485 100644 --- a/src/libjin-lua/modules/time/l_time.cpp +++ b/src/libjin-lua/modules/time/l_time.cpp @@ -9,57 +9,57 @@ using namespace JinEngine::Time; namespace JinEngine { - namespace Lua - { + namespace Lua + { - LUA_IMPLEMENT int l_sec(lua_State* L) - { - luax_pushnumber(L, getSecond()); - return 1; - } + LUA_IMPLEMENT int l_sec(lua_State* L) + { + luax_pushnumber(L, getSecond()); + return 1; + } - LUA_IMPLEMENT int l_sleep(lua_State* L) - { - double sec = luax_checknumber(L, 1); - sleep(sec * 1000.0f); - return 0; - } + LUA_IMPLEMENT int l_sleep(lua_State* L) + { + double sec = luax_checknumber(L, 1); + sleep(sec * 1000.0f); + return 0; + } - LUA_IMPLEMENT int l_newTimer(lua_State* L) - { - Shared* shrTimer = new Shared(new Timer()); - luax_newinstance(L, Jin_Lua_Timer, shrTimer); - return 1; - } + LUA_IMPLEMENT int l_newTimer(lua_State* L) + { + Shared* shrTimer = new Shared(new Timer()); + luax_newinstance(L, Jin_Lua_Timer, shrTimer); + return 1; + } - LUA_IMPLEMENT int l_getDelta(lua_State* L) - { - luax_pushnumber(L, Time::getDeltaTime()); - return 1; - } + LUA_IMPLEMENT int l_getDelta(lua_State* L) + { + luax_pushnumber(L, Time::getDeltaTime()); + return 1; + } - LUA_IMPLEMENT int l_step(lua_State* L) - { - Time::step(); - return 0; - } - - LUA_EXPORT int luaopen_time(lua_State* L) - { - // Types. - luaopen_Timer(L); - // Functions. - luaL_Reg methods[] = { - { "second", l_sec }, - { "sleep", l_sleep }, - { "newTimer", l_newTimer }, - { "step", l_step }, - { "getDelta", l_getDelta }, - { 0, 0 }, - }; - luax_newlib(L, methods); - return 1; - } + LUA_IMPLEMENT int l_step(lua_State* L) + { + Time::step(); + return 0; + } + + LUA_EXPORT int luaopen_time(lua_State* L) + { + // Types. + luaopen_Timer(L); + // Functions. + luaL_Reg methods[] = { + { "second", l_sec }, + { "sleep", l_sleep }, + { "newTimer", l_newTimer }, + { "step", l_step }, + { "getDelta", l_getDelta }, + { 0, 0 }, + }; + luax_newlib(L, methods); + return 1; + } - } // namespace Lua + } // namespace Lua } // namespace JinEngine
\ No newline at end of file diff --git a/src/libjin-lua/modules/time/l_time.h b/src/libjin-lua/modules/time/l_time.h index 3c75221..a92e33b 100644 --- a/src/libjin-lua/modules/time/l_time.h +++ b/src/libjin-lua/modules/time/l_time.h @@ -3,12 +3,12 @@ namespace JinEngine { - namespace Lua - { + namespace Lua + { - int luaopen_time(lua_State* L); + int luaopen_time(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/modules/time/l_timer.cpp b/src/libjin-lua/modules/time/l_timer.cpp index 8886913..82a1398 100644 --- a/src/libjin-lua/modules/time/l_timer.cpp +++ b/src/libjin-lua/modules/time/l_timer.cpp @@ -6,127 +6,127 @@ using namespace JinEngine::Time; namespace JinEngine { - namespace Lua - { - - const char* Jin_Lua_Timer = "Timer"; - - const char* Jin_Lua_Handler = "Handler"; - - static Timer::TimerCallback timerCallback = [](void* data)->void - { - LuaCallback* func = static_cast<LuaCallback*>(data); - func->call(); - }; - - static Timer::FinishCallback finishCallback = [](void* data)->void - { - LuaCallback* func = static_cast<LuaCallback*>(data); - delete func; - }; - - LUA_IMPLEMENT inline Timer* checkTimer(lua_State* L) - { - LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Timer); - return luaObj->getObject<Timer>(); - } - - // timer:every(time, callback, parameter) - LUA_IMPLEMENT int l_every(lua_State* L) - { - int n = luax_gettop(L); - Timer* shared = checkTimer(L); - float s = luax_checknumber(L, 2); - LuaCallback* func = new LuaCallback(L); - func->setFunc(3); - for(int i = 4; i <= n; ++i) - func->pushParam(i); - Timer::Handler* handler = shared->every(s, timerCallback, func, finishCallback); - Shared* shrHandler = new Shared(handler); - LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Handler, shrHandler); - return 1; - } - - // timer:after(time, callback, parameter) - LUA_IMPLEMENT int l_after(lua_State* L) - { - int n = luax_gettop(L); - Timer* shared = checkTimer(L); - float s = luax_checknumber(L, 2); - LuaCallback* func = new LuaCallback(L); - func->setFunc(3); - for (int i = 4; i <= n; ++i) - func->pushParam(i); - Timer::Handler* handler = shared->after(s, timerCallback, func, finishCallback); - Shared* shrHandler = new Shared(handler); - LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Handler, shrHandler); - return 1; - } - - // timer:repeat(time, callback, parameter) - LUA_IMPLEMENT int l_repeat(lua_State* L) - { - int n = luax_gettop(L); - Timer* shared = checkTimer(L); - float s = luax_checknumber(L, 2); - int count = luax_checkinteger(L, 3); - LuaCallback* func = new LuaCallback(L); - func->setFunc(4); - for (int i = 5; i <= n; ++i) - func->pushParam(i); - Timer::Handler* handler = shared->repeat(s, count, timerCallback, func, finishCallback); - Shared* shrHandler = new Shared(handler); - LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Handler, shrHandler); - return 1; - } - - LUA_IMPLEMENT int l_update(lua_State* L) - { - Timer* shared = checkTimer(L); - float s = luax_checknumber(L, 2); - shared->update(s); - return 0; - } - - LUA_IMPLEMENT int l_cancel(lua_State* L) - { - LuaObject* p = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Timer); - Timer* timer = p->getObject<Timer>(); - LuaObject* ph = (LuaObject*)luax_checktype(L, 2, Jin_Lua_Handler); - Timer::Handler* handler = ph->getObject<Timer::Handler>(); - timer->cancel(handler); - return 0; - } - - LUA_IMPLEMENT int l_cancelAll(lua_State* L) - { - LuaObject* p = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Timer); - Timer* timer = p->getObject<Timer>(); - timer->cancelAll(); - return 0; - } - - LUA_IMPLEMENT int l_gc(lua_State* L) - { - LuaObject* p = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Timer); - p->release(); - return 0; - } - - LUA_EXPORT void luaopen_Timer(lua_State* L) - { - luaL_Reg methods[] = { - { "__gc", l_gc }, - { "every", l_every }, - { "after", l_after }, - { "duplicate", l_repeat }, - { "update", l_update }, - { "cancel", l_cancel }, - { "cancelAll", l_cancelAll }, - { 0, 0 } - }; - luax_newtype(L, Jin_Lua_Timer, methods); - } - - } + namespace Lua + { + + const char* Jin_Lua_Timer = "Timer"; + + const char* Jin_Lua_Handler = "Handler"; + + static Timer::TimerCallback timerCallback = [](void* data)->void + { + LuaCallback* func = static_cast<LuaCallback*>(data); + func->call(); + }; + + static Timer::FinishCallback finishCallback = [](void* data)->void + { + LuaCallback* func = static_cast<LuaCallback*>(data); + delete func; + }; + + LUA_IMPLEMENT inline Timer* checkTimer(lua_State* L) + { + LuaObject* luaObj = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Timer); + return luaObj->getObject<Timer>(); + } + + // timer:every(time, callback, parameter) + LUA_IMPLEMENT int l_every(lua_State* L) + { + int n = luax_gettop(L); + Timer* shared = checkTimer(L); + float s = luax_checknumber(L, 2); + LuaCallback* func = new LuaCallback(L); + func->setFunc(3); + for(int i = 4; i <= n; ++i) + func->pushParam(i); + Timer::Handler* handler = shared->every(s, timerCallback, func, finishCallback); + Shared* shrHandler = new Shared(handler); + LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Handler, shrHandler); + return 1; + } + + // timer:after(time, callback, parameter) + LUA_IMPLEMENT int l_after(lua_State* L) + { + int n = luax_gettop(L); + Timer* shared = checkTimer(L); + float s = luax_checknumber(L, 2); + LuaCallback* func = new LuaCallback(L); + func->setFunc(3); + for (int i = 4; i <= n; ++i) + func->pushParam(i); + Timer::Handler* handler = shared->after(s, timerCallback, func, finishCallback); + Shared* shrHandler = new Shared(handler); + LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Handler, shrHandler); + return 1; + } + + // timer:repeat(time, callback, parameter) + LUA_IMPLEMENT int l_repeat(lua_State* L) + { + int n = luax_gettop(L); + Timer* shared = checkTimer(L); + float s = luax_checknumber(L, 2); + int count = luax_checkinteger(L, 3); + LuaCallback* func = new LuaCallback(L); + func->setFunc(4); + for (int i = 5; i <= n; ++i) + func->pushParam(i); + Timer::Handler* handler = shared->repeat(s, count, timerCallback, func, finishCallback); + Shared* shrHandler = new Shared(handler); + LuaObject* luaObj = luax_newinstance(L, Jin_Lua_Handler, shrHandler); + return 1; + } + + LUA_IMPLEMENT int l_update(lua_State* L) + { + Timer* shared = checkTimer(L); + float s = luax_checknumber(L, 2); + shared->update(s); + return 0; + } + + LUA_IMPLEMENT int l_cancel(lua_State* L) + { + LuaObject* p = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Timer); + Timer* timer = p->getObject<Timer>(); + LuaObject* ph = (LuaObject*)luax_checktype(L, 2, Jin_Lua_Handler); + Timer::Handler* handler = ph->getObject<Timer::Handler>(); + timer->cancel(handler); + return 0; + } + + LUA_IMPLEMENT int l_cancelAll(lua_State* L) + { + LuaObject* p = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Timer); + Timer* timer = p->getObject<Timer>(); + timer->cancelAll(); + return 0; + } + + LUA_IMPLEMENT int l_gc(lua_State* L) + { + LuaObject* p = (LuaObject*)luax_checktype(L, 1, Jin_Lua_Timer); + p->release(); + return 0; + } + + LUA_EXPORT void luaopen_Timer(lua_State* L) + { + luaL_Reg methods[] = { + { "__gc", l_gc }, + { "every", l_every }, + { "after", l_after }, + { "duplicate", l_repeat }, + { "update", l_update }, + { "cancel", l_cancel }, + { "cancelAll", l_cancelAll }, + { 0, 0 } + }; + luax_newtype(L, Jin_Lua_Timer, methods); + } + + } }
\ No newline at end of file diff --git a/src/libjin-lua/modules/time/l_timer.h b/src/libjin-lua/modules/time/l_timer.h index 35ec15d..e41bfd0 100644 --- a/src/libjin-lua/modules/time/l_timer.h +++ b/src/libjin-lua/modules/time/l_timer.h @@ -5,16 +5,16 @@ namespace JinEngine { - namespace Lua - { - - extern const char* Jin_Lua_Timer; + namespace Lua + { + + extern const char* Jin_Lua_Timer; - extern const char* Jin_Lua_Handler; + extern const char* Jin_Lua_Handler; - void luaopen_Timer(lua_State* L); + void luaopen_Timer(lua_State* L); - } + } } #endif
\ No newline at end of file diff --git a/src/libjin-lua/scripts/ai/state_machine.lua b/src/libjin-lua/scripts/ai/state_machine.lua index adeceb4..aac6239 100644 --- a/src/libjin-lua/scripts/ai/state_machine.lua +++ b/src/libjin-lua/scripts/ai/state_machine.lua @@ -12,7 +12,7 @@ local ASYNC = "async" local function call_handler(handler, params) if handler then - return handler(unpack(params)) + return handler(unpack(params)) end end @@ -20,56 +20,56 @@ local function create_transition(name) local can, to, from, params local function transition(self, ...) - if self.asyncState == NONE then - can, to = self:can(name) - from = self.current - params = { self, name, from, to, ...} - - if not can then return false end - self.currentTransitioningEvent = name - - local beforeReturn = call_handler(self["onbefore" .. name], params) - local leaveReturn = call_handler(self["onleave" .. from], params) - - if beforeReturn == false or leaveReturn == false then - return false - end - - self.asyncState = name .. "WaitingOnLeave" - - if leaveReturn ~= ASYNC then - transition(self, ...) - end - - return true - elseif self.asyncState == name .. "WaitingOnLeave" then - self.current = to - - local enterReturn = call_handler(self["onenter" .. to] or self["on" .. to], params) - - self.asyncState = name .. "WaitingOnEnter" - - if enterReturn ~= ASYNC then - transition(self, ...) - end - - return true - elseif self.asyncState == name .. "WaitingOnEnter" then - call_handler(self["onafter" .. name] or self["on" .. name], params) - call_handler(self["onstatechange"], params) - self.asyncState = NONE - self.currentTransitioningEvent = nil - return true - else - if string.find(self.asyncState, "WaitingOnLeave") or string.find(self.asyncState, "WaitingOnEnter") then - self.asyncState = NONE - transition(self, ...) - return true - end - end - - self.currentTransitioningEvent = nil - return false + if self.asyncState == NONE then + can, to = self:can(name) + from = self.current + params = { self, name, from, to, ...} + + if not can then return false end + self.currentTransitioningEvent = name + + local beforeReturn = call_handler(self["onbefore" .. name], params) + local leaveReturn = call_handler(self["onleave" .. from], params) + + if beforeReturn == false or leaveReturn == false then + return false + end + + self.asyncState = name .. "WaitingOnLeave" + + if leaveReturn ~= ASYNC then + transition(self, ...) + end + + return true + elseif self.asyncState == name .. "WaitingOnLeave" then + self.current = to + + local enterReturn = call_handler(self["onenter" .. to] or self["on" .. to], params) + + self.asyncState = name .. "WaitingOnEnter" + + if enterReturn ~= ASYNC then + transition(self, ...) + end + + return true + elseif self.asyncState == name .. "WaitingOnEnter" then + call_handler(self["onafter" .. name] or self["on" .. name], params) + call_handler(self["onstatechange"], params) + self.asyncState = NONE + self.currentTransitioningEvent = nil + return true + else + if string.find(self.asyncState, "WaitingOnLeave") or string.find(self.asyncState, "WaitingOnEnter") then + self.asyncState = NONE + transition(self, ...) + return true + end + end + + self.currentTransitioningEvent = nil + return false end return transition @@ -77,11 +77,11 @@ end local function add_to_map(map, event) if type(event.from) == 'string' then - map[event.from] = event.to + map[event.from] = event.to else - for _, from in ipairs(event.from) do - map[from] = event.to - end + for _, from in ipairs(event.from) do + map[from] = event.to + end end end @@ -97,14 +97,14 @@ function machine.create(options) fsm.events = {} for _, event in ipairs(options.events or {}) do - local name = event.name - fsm[name] = fsm[name] or create_transition(name) - fsm.events[name] = fsm.events[name] or { map = {} } - add_to_map(fsm.events[name].map, event) + local name = event.name + fsm[name] = fsm[name] or create_transition(name) + fsm.events[name] = fsm.events[name] or { map = {} } + add_to_map(fsm.events[name].map, event) end for name, callback in pairs(options.callbacks or {}) do - fsm[name] = callback + fsm[name] = callback end return fsm @@ -128,16 +128,16 @@ function machine:todot(filename) local dotfile = io.open(filename,'w') dotfile:write('digraph {\n') local transition = function(event,from,to) - dotfile:write(string.format('%s -> %s [label=%s];\n',from,to,event)) + dotfile:write(string.format('%s -> %s [label=%s];\n',from,to,event)) end for _, event in pairs(self.options.events) do - if type(event.from) == 'table' then - for _, from in ipairs(event.from) do - transition(event.name,from,event.to) - end - else - transition(event.name,event.from,event.to) - end + if type(event.from) == 'table' then + for _, from in ipairs(event.from) do + transition(event.name,from,event.to) + end + else + transition(event.name,event.from,event.to) + end end dotfile:write('}\n') dotfile:close() @@ -145,14 +145,14 @@ end function machine:transition(event) if self.currentTransitioningEvent == event then - return self[self.currentTransitioningEvent](self) + return self[self.currentTransitioningEvent](self) end end function machine:cancelTransition(event) if self.currentTransitioningEvent == event then - self.asyncState = NONE - self.currentTransitioningEvent = nil + self.asyncState = NONE + self.currentTransitioningEvent = nil end end diff --git a/src/libjin-lua/scripts/ai/state_machine.lua.h b/src/libjin-lua/scripts/ai/state_machine.lua.h index 1c845a9..cc76bd0 100644 --- a/src/libjin-lua/scripts/ai/state_machine.lua.h +++ b/src/libjin-lua/scripts/ai/state_machine.lua.h @@ -23,208 +23,198 @@ static char state_machine_lua[] = { 110,99,34,13,10,13,10,108,111,99,97,108,32,102,117,110,99,116,105,111, 110,32,99,97,108,108,95,104,97,110,100,108,101,114,40,104,97,110,100,108, 101,114,44,32,112,97,114,97,109,115,41,13,10,32,32,105,102,32,104,97, -110,100,108,101,114,32,116,104,101,110,13,10,32,32,32,32,114,101,116,117, -114,110,32,104,97,110,100,108,101,114,40,117,110,112,97,99,107,40,112,97, -114,97,109,115,41,41,13,10,32,32,101,110,100,13,10,101,110,100,13,10, -13,10,108,111,99,97,108,32,102,117,110,99,116,105,111,110,32,99,114,101, -97,116,101,95,116,114,97,110,115,105,116,105,111,110,40,110,97,109,101,41, -13,10,32,32,108,111,99,97,108,32,99,97,110,44,32,116,111,44,32,102, -114,111,109,44,32,112,97,114,97,109,115,13,10,13,10,32,32,108,111,99, -97,108,32,102,117,110,99,116,105,111,110,32,116,114,97,110,115,105,116,105, -111,110,40,115,101,108,102,44,32,46,46,46,41,13,10,32,32,32,32,105, -102,32,115,101,108,102,46,97,115,121,110,99,83,116,97,116,101,32,61,61, -32,78,79,78,69,32,116,104,101,110,13,10,32,32,32,32,32,32,99,97, -110,44,32,116,111,32,61,32,115,101,108,102,58,99,97,110,40,110,97,109, -101,41,13,10,32,32,32,32,32,32,102,114,111,109,32,61,32,115,101,108, -102,46,99,117,114,114,101,110,116,13,10,32,32,32,32,32,32,112,97,114, -97,109,115,32,61,32,123,32,115,101,108,102,44,32,110,97,109,101,44,32, -102,114,111,109,44,32,116,111,44,32,46,46,46,125,13,10,13,10,32,32, -32,32,32,32,105,102,32,110,111,116,32,99,97,110,32,116,104,101,110,32, -114,101,116,117,114,110,32,102,97,108,115,101,32,101,110,100,13,10,32,32, -32,32,32,32,115,101,108,102,46,99,117,114,114,101,110,116,84,114,97,110, -115,105,116,105,111,110,105,110,103,69,118,101,110,116,32,61,32,110,97,109, -101,13,10,13,10,32,32,32,32,32,32,108,111,99,97,108,32,98,101,102, -111,114,101,82,101,116,117,114,110,32,61,32,99,97,108,108,95,104,97,110, -100,108,101,114,40,115,101,108,102,91,34,111,110,98,101,102,111,114,101,34, -32,46,46,32,110,97,109,101,93,44,32,112,97,114,97,109,115,41,13,10, -32,32,32,32,32,32,108,111,99,97,108,32,108,101,97,118,101,82,101,116, -117,114,110,32,61,32,99,97,108,108,95,104,97,110,100,108,101,114,40,115, -101,108,102,91,34,111,110,108,101,97,118,101,34,32,46,46,32,102,114,111, -109,93,44,32,112,97,114,97,109,115,41,13,10,13,10,32,32,32,32,32, -32,105,102,32,98,101,102,111,114,101,82,101,116,117,114,110,32,61,61,32, -102,97,108,115,101,32,111,114,32,108,101,97,118,101,82,101,116,117,114,110, -32,61,61,32,102,97,108,115,101,32,116,104,101,110,13,10,32,32,32,32, -32,32,32,32,114,101,116,117,114,110,32,102,97,108,115,101,13,10,32,32, -32,32,32,32,101,110,100,13,10,13,10,32,32,32,32,32,32,115,101,108, -102,46,97,115,121,110,99,83,116,97,116,101,32,61,32,110,97,109,101,32, -46,46,32,34,87,97,105,116,105,110,103,79,110,76,101,97,118,101,34,13, -10,13,10,32,32,32,32,32,32,105,102,32,108,101,97,118,101,82,101,116, -117,114,110,32,126,61,32,65,83,89,78,67,32,116,104,101,110,13,10,32, -32,32,32,32,32,32,32,116,114,97,110,115,105,116,105,111,110,40,115,101, -108,102,44,32,46,46,46,41,13,10,32,32,32,32,32,32,101,110,100,13, -10,32,32,32,32,32,32,13,10,32,32,32,32,32,32,114,101,116,117,114, -110,32,116,114,117,101,13,10,32,32,32,32,101,108,115,101,105,102,32,115, -101,108,102,46,97,115,121,110,99,83,116,97,116,101,32,61,61,32,110,97, -109,101,32,46,46,32,34,87,97,105,116,105,110,103,79,110,76,101,97,118, -101,34,32,116,104,101,110,13,10,32,32,32,32,32,32,115,101,108,102,46, -99,117,114,114,101,110,116,32,61,32,116,111,13,10,13,10,32,32,32,32, -32,32,108,111,99,97,108,32,101,110,116,101,114,82,101,116,117,114,110,32, -61,32,99,97,108,108,95,104,97,110,100,108,101,114,40,115,101,108,102,91, -34,111,110,101,110,116,101,114,34,32,46,46,32,116,111,93,32,111,114,32, -115,101,108,102,91,34,111,110,34,32,46,46,32,116,111,93,44,32,112,97, -114,97,109,115,41,13,10,13,10,32,32,32,32,32,32,115,101,108,102,46, +110,100,108,101,114,32,116,104,101,110,13,10,9,114,101,116,117,114,110,32, +104,97,110,100,108,101,114,40,117,110,112,97,99,107,40,112,97,114,97,109, +115,41,41,13,10,32,32,101,110,100,13,10,101,110,100,13,10,13,10,108, +111,99,97,108,32,102,117,110,99,116,105,111,110,32,99,114,101,97,116,101, +95,116,114,97,110,115,105,116,105,111,110,40,110,97,109,101,41,13,10,32, +32,108,111,99,97,108,32,99,97,110,44,32,116,111,44,32,102,114,111,109, +44,32,112,97,114,97,109,115,13,10,13,10,32,32,108,111,99,97,108,32, +102,117,110,99,116,105,111,110,32,116,114,97,110,115,105,116,105,111,110,40, +115,101,108,102,44,32,46,46,46,41,13,10,9,105,102,32,115,101,108,102, +46,97,115,121,110,99,83,116,97,116,101,32,61,61,32,78,79,78,69,32, +116,104,101,110,13,10,9,32,32,99,97,110,44,32,116,111,32,61,32,115, +101,108,102,58,99,97,110,40,110,97,109,101,41,13,10,9,32,32,102,114, +111,109,32,61,32,115,101,108,102,46,99,117,114,114,101,110,116,13,10,9, +32,32,112,97,114,97,109,115,32,61,32,123,32,115,101,108,102,44,32,110, +97,109,101,44,32,102,114,111,109,44,32,116,111,44,32,46,46,46,125,13, +10,13,10,9,32,32,105,102,32,110,111,116,32,99,97,110,32,116,104,101, +110,32,114,101,116,117,114,110,32,102,97,108,115,101,32,101,110,100,13,10, +9,32,32,115,101,108,102,46,99,117,114,114,101,110,116,84,114,97,110,115, +105,116,105,111,110,105,110,103,69,118,101,110,116,32,61,32,110,97,109,101, +13,10,13,10,9,32,32,108,111,99,97,108,32,98,101,102,111,114,101,82, +101,116,117,114,110,32,61,32,99,97,108,108,95,104,97,110,100,108,101,114, +40,115,101,108,102,91,34,111,110,98,101,102,111,114,101,34,32,46,46,32, +110,97,109,101,93,44,32,112,97,114,97,109,115,41,13,10,9,32,32,108, +111,99,97,108,32,108,101,97,118,101,82,101,116,117,114,110,32,61,32,99, +97,108,108,95,104,97,110,100,108,101,114,40,115,101,108,102,91,34,111,110, +108,101,97,118,101,34,32,46,46,32,102,114,111,109,93,44,32,112,97,114, +97,109,115,41,13,10,13,10,9,32,32,105,102,32,98,101,102,111,114,101, +82,101,116,117,114,110,32,61,61,32,102,97,108,115,101,32,111,114,32,108, +101,97,118,101,82,101,116,117,114,110,32,61,61,32,102,97,108,115,101,32, +116,104,101,110,13,10,9,9,114,101,116,117,114,110,32,102,97,108,115,101, +13,10,9,32,32,101,110,100,13,10,13,10,9,32,32,115,101,108,102,46, 97,115,121,110,99,83,116,97,116,101,32,61,32,110,97,109,101,32,46,46, -32,34,87,97,105,116,105,110,103,79,110,69,110,116,101,114,34,13,10,13, -10,32,32,32,32,32,32,105,102,32,101,110,116,101,114,82,101,116,117,114, -110,32,126,61,32,65,83,89,78,67,32,116,104,101,110,13,10,32,32,32, -32,32,32,32,32,116,114,97,110,115,105,116,105,111,110,40,115,101,108,102, -44,32,46,46,46,41,13,10,32,32,32,32,32,32,101,110,100,13,10,32, -32,32,32,32,32,13,10,32,32,32,32,32,32,114,101,116,117,114,110,32, -116,114,117,101,13,10,32,32,32,32,101,108,115,101,105,102,32,115,101,108, -102,46,97,115,121,110,99,83,116,97,116,101,32,61,61,32,110,97,109,101, -32,46,46,32,34,87,97,105,116,105,110,103,79,110,69,110,116,101,114,34, -32,116,104,101,110,13,10,32,32,32,32,32,32,99,97,108,108,95,104,97, -110,100,108,101,114,40,115,101,108,102,91,34,111,110,97,102,116,101,114,34, -32,46,46,32,110,97,109,101,93,32,111,114,32,115,101,108,102,91,34,111, -110,34,32,46,46,32,110,97,109,101,93,44,32,112,97,114,97,109,115,41, -13,10,32,32,32,32,32,32,99,97,108,108,95,104,97,110,100,108,101,114, -40,115,101,108,102,91,34,111,110,115,116,97,116,101,99,104,97,110,103,101, -34,93,44,32,112,97,114,97,109,115,41,13,10,32,32,32,32,32,32,115, -101,108,102,46,97,115,121,110,99,83,116,97,116,101,32,61,32,78,79,78, -69,13,10,32,32,32,32,32,32,115,101,108,102,46,99,117,114,114,101,110, -116,84,114,97,110,115,105,116,105,111,110,105,110,103,69,118,101,110,116,32, -61,32,110,105,108,13,10,32,32,32,32,32,32,114,101,116,117,114,110,32, -116,114,117,101,13,10,32,32,32,32,101,108,115,101,13,10,32,32,32,32, -32,32,105,102,32,115,116,114,105,110,103,46,102,105,110,100,40,115,101,108, -102,46,97,115,121,110,99,83,116,97,116,101,44,32,34,87,97,105,116,105, -110,103,79,110,76,101,97,118,101,34,41,32,111,114,32,115,116,114,105,110, -103,46,102,105,110,100,40,115,101,108,102,46,97,115,121,110,99,83,116,97, -116,101,44,32,34,87,97,105,116,105,110,103,79,110,69,110,116,101,114,34, -41,32,116,104,101,110,13,10,32,32,32,32,32,32,32,32,115,101,108,102, +32,34,87,97,105,116,105,110,103,79,110,76,101,97,118,101,34,13,10,13, +10,9,32,32,105,102,32,108,101,97,118,101,82,101,116,117,114,110,32,126, +61,32,65,83,89,78,67,32,116,104,101,110,13,10,9,9,116,114,97,110, +115,105,116,105,111,110,40,115,101,108,102,44,32,46,46,46,41,13,10,9, +32,32,101,110,100,13,10,9,32,32,13,10,9,32,32,114,101,116,117,114, +110,32,116,114,117,101,13,10,9,101,108,115,101,105,102,32,115,101,108,102, +46,97,115,121,110,99,83,116,97,116,101,32,61,61,32,110,97,109,101,32, +46,46,32,34,87,97,105,116,105,110,103,79,110,76,101,97,118,101,34,32, +116,104,101,110,13,10,9,32,32,115,101,108,102,46,99,117,114,114,101,110, +116,32,61,32,116,111,13,10,13,10,9,32,32,108,111,99,97,108,32,101, +110,116,101,114,82,101,116,117,114,110,32,61,32,99,97,108,108,95,104,97, +110,100,108,101,114,40,115,101,108,102,91,34,111,110,101,110,116,101,114,34, +32,46,46,32,116,111,93,32,111,114,32,115,101,108,102,91,34,111,110,34, +32,46,46,32,116,111,93,44,32,112,97,114,97,109,115,41,13,10,13,10, +9,32,32,115,101,108,102,46,97,115,121,110,99,83,116,97,116,101,32,61, +32,110,97,109,101,32,46,46,32,34,87,97,105,116,105,110,103,79,110,69, +110,116,101,114,34,13,10,13,10,9,32,32,105,102,32,101,110,116,101,114, +82,101,116,117,114,110,32,126,61,32,65,83,89,78,67,32,116,104,101,110, +13,10,9,9,116,114,97,110,115,105,116,105,111,110,40,115,101,108,102,44, +32,46,46,46,41,13,10,9,32,32,101,110,100,13,10,9,32,32,13,10, +9,32,32,114,101,116,117,114,110,32,116,114,117,101,13,10,9,101,108,115, +101,105,102,32,115,101,108,102,46,97,115,121,110,99,83,116,97,116,101,32, +61,61,32,110,97,109,101,32,46,46,32,34,87,97,105,116,105,110,103,79, +110,69,110,116,101,114,34,32,116,104,101,110,13,10,9,32,32,99,97,108, +108,95,104,97,110,100,108,101,114,40,115,101,108,102,91,34,111,110,97,102, +116,101,114,34,32,46,46,32,110,97,109,101,93,32,111,114,32,115,101,108, +102,91,34,111,110,34,32,46,46,32,110,97,109,101,93,44,32,112,97,114, +97,109,115,41,13,10,9,32,32,99,97,108,108,95,104,97,110,100,108,101, +114,40,115,101,108,102,91,34,111,110,115,116,97,116,101,99,104,97,110,103, +101,34,93,44,32,112,97,114,97,109,115,41,13,10,9,32,32,115,101,108, +102,46,97,115,121,110,99,83,116,97,116,101,32,61,32,78,79,78,69,13, +10,9,32,32,115,101,108,102,46,99,117,114,114,101,110,116,84,114,97,110, +115,105,116,105,111,110,105,110,103,69,118,101,110,116,32,61,32,110,105,108, +13,10,9,32,32,114,101,116,117,114,110,32,116,114,117,101,13,10,9,101, +108,115,101,13,10,9,32,32,105,102,32,115,116,114,105,110,103,46,102,105, +110,100,40,115,101,108,102,46,97,115,121,110,99,83,116,97,116,101,44,32, +34,87,97,105,116,105,110,103,79,110,76,101,97,118,101,34,41,32,111,114, +32,115,116,114,105,110,103,46,102,105,110,100,40,115,101,108,102,46,97,115, +121,110,99,83,116,97,116,101,44,32,34,87,97,105,116,105,110,103,79,110, +69,110,116,101,114,34,41,32,116,104,101,110,13,10,9,9,115,101,108,102, 46,97,115,121,110,99,83,116,97,116,101,32,61,32,78,79,78,69,13,10, -32,32,32,32,32,32,32,32,116,114,97,110,115,105,116,105,111,110,40,115, -101,108,102,44,32,46,46,46,41,13,10,32,32,32,32,32,32,32,32,114, -101,116,117,114,110,32,116,114,117,101,13,10,32,32,32,32,32,32,101,110, -100,13,10,32,32,32,32,101,110,100,13,10,13,10,32,32,32,32,115,101, -108,102,46,99,117,114,114,101,110,116,84,114,97,110,115,105,116,105,111,110, -105,110,103,69,118,101,110,116,32,61,32,110,105,108,13,10,32,32,32,32, -114,101,116,117,114,110,32,102,97,108,115,101,13,10,32,32,101,110,100,13, -10,13,10,32,32,114,101,116,117,114,110,32,116,114,97,110,115,105,116,105, -111,110,13,10,101,110,100,13,10,13,10,108,111,99,97,108,32,102,117,110, -99,116,105,111,110,32,97,100,100,95,116,111,95,109,97,112,40,109,97,112, -44,32,101,118,101,110,116,41,13,10,32,32,105,102,32,116,121,112,101,40, -101,118,101,110,116,46,102,114,111,109,41,32,61,61,32,39,115,116,114,105, -110,103,39,32,116,104,101,110,13,10,32,32,32,32,109,97,112,91,101,118, -101,110,116,46,102,114,111,109,93,32,61,32,101,118,101,110,116,46,116,111, -13,10,32,32,101,108,115,101,13,10,32,32,32,32,102,111,114,32,95,44, -32,102,114,111,109,32,105,110,32,105,112,97,105,114,115,40,101,118,101,110, -116,46,102,114,111,109,41,32,100,111,13,10,32,32,32,32,32,32,109,97, -112,91,102,114,111,109,93,32,61,32,101,118,101,110,116,46,116,111,13,10, -32,32,32,32,101,110,100,13,10,32,32,101,110,100,13,10,101,110,100,13, -10,13,10,102,117,110,99,116,105,111,110,32,109,97,99,104,105,110,101,46, -99,114,101,97,116,101,40,111,112,116,105,111,110,115,41,13,10,32,32,97, -115,115,101,114,116,40,111,112,116,105,111,110,115,46,101,118,101,110,116,115, -41,13,10,13,10,32,32,108,111,99,97,108,32,102,115,109,32,61,32,123, -125,13,10,32,32,115,101,116,109,101,116,97,116,97,98,108,101,40,102,115, -109,44,32,109,97,99,104,105,110,101,41,13,10,13,10,32,32,102,115,109, -46,111,112,116,105,111,110,115,32,61,32,111,112,116,105,111,110,115,13,10, -32,32,102,115,109,46,99,117,114,114,101,110,116,32,61,32,111,112,116,105, -111,110,115,46,105,110,105,116,105,97,108,32,111,114,32,39,110,111,110,101, -39,13,10,32,32,102,115,109,46,97,115,121,110,99,83,116,97,116,101,32, -61,32,78,79,78,69,13,10,32,32,102,115,109,46,101,118,101,110,116,115, -32,61,32,123,125,13,10,13,10,32,32,102,111,114,32,95,44,32,101,118, -101,110,116,32,105,110,32,105,112,97,105,114,115,40,111,112,116,105,111,110, -115,46,101,118,101,110,116,115,32,111,114,32,123,125,41,32,100,111,13,10, -32,32,32,32,108,111,99,97,108,32,110,97,109,101,32,61,32,101,118,101, -110,116,46,110,97,109,101,13,10,32,32,32,32,102,115,109,91,110,97,109, -101,93,32,61,32,102,115,109,91,110,97,109,101,93,32,111,114,32,99,114, -101,97,116,101,95,116,114,97,110,115,105,116,105,111,110,40,110,97,109,101, -41,13,10,32,32,32,32,102,115,109,46,101,118,101,110,116,115,91,110,97, -109,101,93,32,61,32,102,115,109,46,101,118,101,110,116,115,91,110,97,109, -101,93,32,111,114,32,123,32,109,97,112,32,61,32,123,125,32,125,13,10, -32,32,32,32,97,100,100,95,116,111,95,109,97,112,40,102,115,109,46,101, -118,101,110,116,115,91,110,97,109,101,93,46,109,97,112,44,32,101,118,101, -110,116,41,13,10,32,32,101,110,100,13,10,32,32,13,10,32,32,102,111, -114,32,110,97,109,101,44,32,99,97,108,108,98,97,99,107,32,105,110,32, -112,97,105,114,115,40,111,112,116,105,111,110,115,46,99,97,108,108,98,97, -99,107,115,32,111,114,32,123,125,41,32,100,111,13,10,32,32,32,32,102, -115,109,91,110,97,109,101,93,32,61,32,99,97,108,108,98,97,99,107,13, -10,32,32,101,110,100,13,10,13,10,32,32,114,101,116,117,114,110,32,102, -115,109,13,10,101,110,100,13,10,13,10,102,117,110,99,116,105,111,110,32, -109,97,99,104,105,110,101,58,105,115,40,115,116,97,116,101,41,13,10,32, -32,114,101,116,117,114,110,32,115,101,108,102,46,99,117,114,114,101,110,116, -32,61,61,32,115,116,97,116,101,13,10,101,110,100,13,10,13,10,102,117, -110,99,116,105,111,110,32,109,97,99,104,105,110,101,58,99,97,110,40,101, -41,13,10,32,32,108,111,99,97,108,32,101,118,101,110,116,32,61,32,115, -101,108,102,46,101,118,101,110,116,115,91,101,93,13,10,32,32,108,111,99, -97,108,32,116,111,32,61,32,101,118,101,110,116,32,97,110,100,32,101,118, -101,110,116,46,109,97,112,91,115,101,108,102,46,99,117,114,114,101,110,116, -93,32,111,114,32,101,118,101,110,116,46,109,97,112,91,39,42,39,93,13, -10,32,32,114,101,116,117,114,110,32,116,111,32,126,61,32,110,105,108,44, -32,116,111,13,10,101,110,100,13,10,13,10,102,117,110,99,116,105,111,110, -32,109,97,99,104,105,110,101,58,99,97,110,110,111,116,40,101,41,13,10, -32,32,114,101,116,117,114,110,32,110,111,116,32,115,101,108,102,58,99,97, -110,40,101,41,13,10,101,110,100,13,10,13,10,102,117,110,99,116,105,111, -110,32,109,97,99,104,105,110,101,58,116,111,100,111,116,40,102,105,108,101, -110,97,109,101,41,13,10,32,32,108,111,99,97,108,32,100,111,116,102,105, -108,101,32,61,32,105,111,46,111,112,101,110,40,102,105,108,101,110,97,109, -101,44,39,119,39,41,13,10,32,32,100,111,116,102,105,108,101,58,119,114, -105,116,101,40,39,100,105,103,114,97,112,104,32,123,92,110,39,41,13,10, -32,32,108,111,99,97,108,32,116,114,97,110,115,105,116,105,111,110,32,61, -32,102,117,110,99,116,105,111,110,40,101,118,101,110,116,44,102,114,111,109, -44,116,111,41,13,10,32,32,32,32,100,111,116,102,105,108,101,58,119,114, -105,116,101,40,115,116,114,105,110,103,46,102,111,114,109,97,116,40,39,37, -115,32,45,62,32,37,115,32,91,108,97,98,101,108,61,37,115,93,59,92, -110,39,44,102,114,111,109,44,116,111,44,101,118,101,110,116,41,41,13,10, -32,32,101,110,100,13,10,32,32,102,111,114,32,95,44,32,101,118,101,110, -116,32,105,110,32,112,97,105,114,115,40,115,101,108,102,46,111,112,116,105, -111,110,115,46,101,118,101,110,116,115,41,32,100,111,13,10,32,32,32,32, -105,102,32,116,121,112,101,40,101,118,101,110,116,46,102,114,111,109,41,32, -61,61,32,39,116,97,98,108,101,39,32,116,104,101,110,13,10,32,32,32, -32,32,32,102,111,114,32,95,44,32,102,114,111,109,32,105,110,32,105,112, +9,9,116,114,97,110,115,105,116,105,111,110,40,115,101,108,102,44,32,46, +46,46,41,13,10,9,9,114,101,116,117,114,110,32,116,114,117,101,13,10, +9,32,32,101,110,100,13,10,9,101,110,100,13,10,13,10,9,115,101,108, +102,46,99,117,114,114,101,110,116,84,114,97,110,115,105,116,105,111,110,105, +110,103,69,118,101,110,116,32,61,32,110,105,108,13,10,9,114,101,116,117, +114,110,32,102,97,108,115,101,13,10,32,32,101,110,100,13,10,13,10,32, +32,114,101,116,117,114,110,32,116,114,97,110,115,105,116,105,111,110,13,10, +101,110,100,13,10,13,10,108,111,99,97,108,32,102,117,110,99,116,105,111, +110,32,97,100,100,95,116,111,95,109,97,112,40,109,97,112,44,32,101,118, +101,110,116,41,13,10,32,32,105,102,32,116,121,112,101,40,101,118,101,110, +116,46,102,114,111,109,41,32,61,61,32,39,115,116,114,105,110,103,39,32, +116,104,101,110,13,10,9,109,97,112,91,101,118,101,110,116,46,102,114,111, +109,93,32,61,32,101,118,101,110,116,46,116,111,13,10,32,32,101,108,115, +101,13,10,9,102,111,114,32,95,44,32,102,114,111,109,32,105,110,32,105, +112,97,105,114,115,40,101,118,101,110,116,46,102,114,111,109,41,32,100,111, +13,10,9,32,32,109,97,112,91,102,114,111,109,93,32,61,32,101,118,101, +110,116,46,116,111,13,10,9,101,110,100,13,10,32,32,101,110,100,13,10, +101,110,100,13,10,13,10,102,117,110,99,116,105,111,110,32,109,97,99,104, +105,110,101,46,99,114,101,97,116,101,40,111,112,116,105,111,110,115,41,13, +10,32,32,97,115,115,101,114,116,40,111,112,116,105,111,110,115,46,101,118, +101,110,116,115,41,13,10,13,10,32,32,108,111,99,97,108,32,102,115,109, +32,61,32,123,125,13,10,32,32,115,101,116,109,101,116,97,116,97,98,108, +101,40,102,115,109,44,32,109,97,99,104,105,110,101,41,13,10,13,10,32, +32,102,115,109,46,111,112,116,105,111,110,115,32,61,32,111,112,116,105,111, +110,115,13,10,32,32,102,115,109,46,99,117,114,114,101,110,116,32,61,32, +111,112,116,105,111,110,115,46,105,110,105,116,105,97,108,32,111,114,32,39, +110,111,110,101,39,13,10,32,32,102,115,109,46,97,115,121,110,99,83,116, +97,116,101,32,61,32,78,79,78,69,13,10,32,32,102,115,109,46,101,118, +101,110,116,115,32,61,32,123,125,13,10,13,10,32,32,102,111,114,32,95, +44,32,101,118,101,110,116,32,105,110,32,105,112,97,105,114,115,40,111,112, +116,105,111,110,115,46,101,118,101,110,116,115,32,111,114,32,123,125,41,32, +100,111,13,10,9,108,111,99,97,108,32,110,97,109,101,32,61,32,101,118, +101,110,116,46,110,97,109,101,13,10,9,102,115,109,91,110,97,109,101,93, +32,61,32,102,115,109,91,110,97,109,101,93,32,111,114,32,99,114,101,97, +116,101,95,116,114,97,110,115,105,116,105,111,110,40,110,97,109,101,41,13, +10,9,102,115,109,46,101,118,101,110,116,115,91,110,97,109,101,93,32,61, +32,102,115,109,46,101,118,101,110,116,115,91,110,97,109,101,93,32,111,114, +32,123,32,109,97,112,32,61,32,123,125,32,125,13,10,9,97,100,100,95, +116,111,95,109,97,112,40,102,115,109,46,101,118,101,110,116,115,91,110,97, +109,101,93,46,109,97,112,44,32,101,118,101,110,116,41,13,10,32,32,101, +110,100,13,10,32,32,13,10,32,32,102,111,114,32,110,97,109,101,44,32, +99,97,108,108,98,97,99,107,32,105,110,32,112,97,105,114,115,40,111,112, +116,105,111,110,115,46,99,97,108,108,98,97,99,107,115,32,111,114,32,123, +125,41,32,100,111,13,10,9,102,115,109,91,110,97,109,101,93,32,61,32, +99,97,108,108,98,97,99,107,13,10,32,32,101,110,100,13,10,13,10,32, +32,114,101,116,117,114,110,32,102,115,109,13,10,101,110,100,13,10,13,10, +102,117,110,99,116,105,111,110,32,109,97,99,104,105,110,101,58,105,115,40, +115,116,97,116,101,41,13,10,32,32,114,101,116,117,114,110,32,115,101,108, +102,46,99,117,114,114,101,110,116,32,61,61,32,115,116,97,116,101,13,10, +101,110,100,13,10,13,10,102,117,110,99,116,105,111,110,32,109,97,99,104, +105,110,101,58,99,97,110,40,101,41,13,10,32,32,108,111,99,97,108,32, +101,118,101,110,116,32,61,32,115,101,108,102,46,101,118,101,110,116,115,91, +101,93,13,10,32,32,108,111,99,97,108,32,116,111,32,61,32,101,118,101, +110,116,32,97,110,100,32,101,118,101,110,116,46,109,97,112,91,115,101,108, +102,46,99,117,114,114,101,110,116,93,32,111,114,32,101,118,101,110,116,46, +109,97,112,91,39,42,39,93,13,10,32,32,114,101,116,117,114,110,32,116, +111,32,126,61,32,110,105,108,44,32,116,111,13,10,101,110,100,13,10,13, +10,102,117,110,99,116,105,111,110,32,109,97,99,104,105,110,101,58,99,97, +110,110,111,116,40,101,41,13,10,32,32,114,101,116,117,114,110,32,110,111, +116,32,115,101,108,102,58,99,97,110,40,101,41,13,10,101,110,100,13,10, +13,10,102,117,110,99,116,105,111,110,32,109,97,99,104,105,110,101,58,116, +111,100,111,116,40,102,105,108,101,110,97,109,101,41,13,10,32,32,108,111, +99,97,108,32,100,111,116,102,105,108,101,32,61,32,105,111,46,111,112,101, +110,40,102,105,108,101,110,97,109,101,44,39,119,39,41,13,10,32,32,100, +111,116,102,105,108,101,58,119,114,105,116,101,40,39,100,105,103,114,97,112, +104,32,123,92,110,39,41,13,10,32,32,108,111,99,97,108,32,116,114,97, +110,115,105,116,105,111,110,32,61,32,102,117,110,99,116,105,111,110,40,101, +118,101,110,116,44,102,114,111,109,44,116,111,41,13,10,9,100,111,116,102, +105,108,101,58,119,114,105,116,101,40,115,116,114,105,110,103,46,102,111,114, +109,97,116,40,39,37,115,32,45,62,32,37,115,32,91,108,97,98,101,108, +61,37,115,93,59,92,110,39,44,102,114,111,109,44,116,111,44,101,118,101, +110,116,41,41,13,10,32,32,101,110,100,13,10,32,32,102,111,114,32,95, +44,32,101,118,101,110,116,32,105,110,32,112,97,105,114,115,40,115,101,108, +102,46,111,112,116,105,111,110,115,46,101,118,101,110,116,115,41,32,100,111, +13,10,9,105,102,32,116,121,112,101,40,101,118,101,110,116,46,102,114,111, +109,41,32,61,61,32,39,116,97,98,108,101,39,32,116,104,101,110,13,10, +9,32,32,102,111,114,32,95,44,32,102,114,111,109,32,105,110,32,105,112, 97,105,114,115,40,101,118,101,110,116,46,102,114,111,109,41,32,100,111,13, -10,32,32,32,32,32,32,32,32,116,114,97,110,115,105,116,105,111,110,40, -101,118,101,110,116,46,110,97,109,101,44,102,114,111,109,44,101,118,101,110, -116,46,116,111,41,13,10,32,32,32,32,32,32,101,110,100,13,10,32,32, -32,32,101,108,115,101,13,10,32,32,32,32,32,32,116,114,97,110,115,105, -116,105,111,110,40,101,118,101,110,116,46,110,97,109,101,44,101,118,101,110, -116,46,102,114,111,109,44,101,118,101,110,116,46,116,111,41,13,10,32,32, -32,32,101,110,100,13,10,32,32,101,110,100,13,10,32,32,100,111,116,102, -105,108,101,58,119,114,105,116,101,40,39,125,92,110,39,41,13,10,32,32, -100,111,116,102,105,108,101,58,99,108,111,115,101,40,41,13,10,101,110,100, -13,10,13,10,102,117,110,99,116,105,111,110,32,109,97,99,104,105,110,101, -58,116,114,97,110,115,105,116,105,111,110,40,101,118,101,110,116,41,13,10, -32,32,105,102,32,115,101,108,102,46,99,117,114,114,101,110,116,84,114,97, -110,115,105,116,105,111,110,105,110,103,69,118,101,110,116,32,61,61,32,101, -118,101,110,116,32,116,104,101,110,13,10,32,32,32,32,114,101,116,117,114, -110,32,115,101,108,102,91,115,101,108,102,46,99,117,114,114,101,110,116,84, -114,97,110,115,105,116,105,111,110,105,110,103,69,118,101,110,116,93,40,115, -101,108,102,41,13,10,32,32,101,110,100,13,10,101,110,100,13,10,13,10, -102,117,110,99,116,105,111,110,32,109,97,99,104,105,110,101,58,99,97,110, -99,101,108,84,114,97,110,115,105,116,105,111,110,40,101,118,101,110,116,41, +10,9,9,116,114,97,110,115,105,116,105,111,110,40,101,118,101,110,116,46, +110,97,109,101,44,102,114,111,109,44,101,118,101,110,116,46,116,111,41,13, +10,9,32,32,101,110,100,13,10,9,101,108,115,101,13,10,9,32,32,116, +114,97,110,115,105,116,105,111,110,40,101,118,101,110,116,46,110,97,109,101, +44,101,118,101,110,116,46,102,114,111,109,44,101,118,101,110,116,46,116,111, +41,13,10,9,101,110,100,13,10,32,32,101,110,100,13,10,32,32,100,111, +116,102,105,108,101,58,119,114,105,116,101,40,39,125,92,110,39,41,13,10, +32,32,100,111,116,102,105,108,101,58,99,108,111,115,101,40,41,13,10,101, +110,100,13,10,13,10,102,117,110,99,116,105,111,110,32,109,97,99,104,105, +110,101,58,116,114,97,110,115,105,116,105,111,110,40,101,118,101,110,116,41, 13,10,32,32,105,102,32,115,101,108,102,46,99,117,114,114,101,110,116,84, 114,97,110,115,105,116,105,111,110,105,110,103,69,118,101,110,116,32,61,61, -32,101,118,101,110,116,32,116,104,101,110,13,10,32,32,32,32,115,101,108, -102,46,97,115,121,110,99,83,116,97,116,101,32,61,32,78,79,78,69,13, -10,32,32,32,32,115,101,108,102,46,99,117,114,114,101,110,116,84,114,97, -110,115,105,116,105,111,110,105,110,103,69,118,101,110,116,32,61,32,110,105, -108,13,10,32,32,101,110,100,13,10,101,110,100,13,10,13,10,109,97,99, -104,105,110,101,46,78,79,78,69,32,61,32,78,79,78,69,13,10,109,97, -99,104,105,110,101,46,65,83,89,78,67,32,61,32,65,83,89,78,67,13, -10,13,10,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, +32,101,118,101,110,116,32,116,104,101,110,13,10,9,114,101,116,117,114,110, +32,115,101,108,102,91,115,101,108,102,46,99,117,114,114,101,110,116,84,114, +97,110,115,105,116,105,111,110,105,110,103,69,118,101,110,116,93,40,115,101, +108,102,41,13,10,32,32,101,110,100,13,10,101,110,100,13,10,13,10,102, +117,110,99,116,105,111,110,32,109,97,99,104,105,110,101,58,99,97,110,99, +101,108,84,114,97,110,115,105,116,105,111,110,40,101,118,101,110,116,41,13, +10,32,32,105,102,32,115,101,108,102,46,99,117,114,114,101,110,116,84,114, +97,110,115,105,116,105,111,110,105,110,103,69,118,101,110,116,32,61,61,32, +101,118,101,110,116,32,116,104,101,110,13,10,9,115,101,108,102,46,97,115, +121,110,99,83,116,97,116,101,32,61,32,78,79,78,69,13,10,9,115,101, +108,102,46,99,117,114,114,101,110,116,84,114,97,110,115,105,116,105,111,110, +105,110,103,69,118,101,110,116,32,61,32,110,105,108,13,10,32,32,101,110, +100,13,10,101,110,100,13,10,13,10,109,97,99,104,105,110,101,46,78,79, +78,69,32,61,32,78,79,78,69,13,10,109,97,99,104,105,110,101,46,65, +83,89,78,67,32,61,32,65,83,89,78,67,13,10,13,10,45,45,45,45, +45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, -45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,13,10,45, -45,32,69,120,112,111,114,116,32,116,111,32,74,105,110,46,32,13,10,45, +45,45,45,45,45,45,45,45,45,45,13,10,45,45,32,69,120,112,111,114, +116,32,116,111,32,74,105,110,46,32,13,10,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, -45,45,45,45,45,45,45,45,45,45,45,45,45,13,10,13,10,106,105,110, -46,97,105,46,110,101,119,83,116,97,116,101,77,97,99,104,105,110,101,32, -61,32,109,97,99,104,105,110,101,46,99,114,101,97,116,101,13,10,0 +45,45,45,45,45,45,13,10,13,10,106,105,110,46,97,105,46,110,101,119, +83,116,97,116,101,77,97,99,104,105,110,101,32,61,32,109,97,99,104,105, +110,101,46,99,114,101,97,116,101,13,10,0 }; diff --git a/src/libjin-lua/scripts/graphics/graphics.lua b/src/libjin-lua/scripts/graphics/graphics.lua index beb5712..2388b52 100644 --- a/src/libjin-lua/scripts/graphics/graphics.lua +++ b/src/libjin-lua/scripts/graphics/graphics.lua @@ -147,6 +147,15 @@ jg.reset = function() jg.unuseShader() end +local _useshader = jg.useShader +jg.useShader = function(shader) + if shader == nil then + jg.unuseShader() + return + end + _useshader(shader) +end + jg.unuseShader = function() jg.useShader(jg.Shaders.Default) end @@ -173,4 +182,4 @@ jg.newShaderf = function(file) else return shader end -end +end
\ No newline at end of file diff --git a/src/libjin-lua/scripts/graphics/graphics.lua.h b/src/libjin-lua/scripts/graphics/graphics.lua.h index d56f8fe..d4228c3 100644 --- a/src/libjin-lua/scripts/graphics/graphics.lua.h +++ b/src/libjin-lua/scripts/graphics/graphics.lua.h @@ -152,36 +152,44 @@ static char graphics_lua[] = { 44,32,48,44,32,48,41,13,10,32,32,106,103,46,99,108,101,97,114,40, 41,13,10,32,32,106,103,46,117,110,115,101,116,70,111,110,116,40,41,13, 10,32,32,106,103,46,117,110,117,115,101,83,104,97,100,101,114,40,41,13, -10,101,110,100,13,10,13,10,106,103,46,117,110,117,115,101,83,104,97,100, -101,114,32,61,32,102,117,110,99,116,105,111,110,40,41,13,10,32,32,106, -103,46,117,115,101,83,104,97,100,101,114,40,106,103,46,83,104,97,100,101, -114,115,46,68,101,102,97,117,108,116,41,13,10,101,110,100,13,10,13,10, -108,111,99,97,108,32,95,110,101,119,83,104,97,100,101,114,32,61,32,106, -103,46,110,101,119,83,104,97,100,101,114,13,10,13,10,106,103,46,110,101, -119,83,104,97,100,101,114,32,61,32,102,117,110,99,116,105,111,110,40,112, -114,111,103,114,97,109,41,32,13,10,32,32,108,111,99,97,108,32,115,104, -97,100,101,114,32,61,32,95,110,101,119,83,104,97,100,101,114,40,112,114, -111,103,114,97,109,41,13,10,32,32,105,102,32,115,104,97,100,101,114,32, -61,61,32,110,105,108,32,116,104,101,110,32,13,10,32,32,32,32,106,105, -110,46,108,111,103,46,101,114,114,111,114,40,34,67,111,109,112,105,108,101, -32,115,104,97,100,101,114,32,102,97,105,108,101,100,58,92,110,34,32,46, -46,32,100,101,98,117,103,46,116,114,97,99,101,98,97,99,107,40,41,41, -13,10,32,32,32,32,114,101,116,117,114,110,32,106,103,46,83,104,97,100, -101,114,115,46,69,114,114,111,114,13,10,32,32,101,108,115,101,13,10,32, -32,32,32,114,101,116,117,114,110,32,115,104,97,100,101,114,13,10,32,32, -101,110,100,13,10,101,110,100,13,10,13,10,108,111,99,97,108,32,95,110, -101,119,83,104,97,100,101,114,102,32,61,32,106,103,46,110,101,119,83,104, -97,100,101,114,102,13,10,13,10,106,103,46,110,101,119,83,104,97,100,101, -114,102,32,61,32,102,117,110,99,116,105,111,110,40,102,105,108,101,41,13, -10,32,32,108,111,99,97,108,32,115,104,97,100,101,114,32,61,32,95,110, -101,119,83,104,97,100,101,114,102,40,102,105,108,101,41,13,10,32,32,105, -102,32,115,104,97,100,101,114,32,61,61,32,110,105,108,32,116,104,101,110, -32,13,10,32,32,32,32,106,105,110,46,108,111,103,46,101,114,114,111,114, -40,34,67,111,109,112,105,108,101,32,115,104,97,100,101,114,32,102,97,105, -108,101,100,58,92,110,34,32,46,46,32,100,101,98,117,103,46,116,114,97, -99,101,98,97,99,107,40,41,41,13,10,32,32,32,32,114,101,116,117,114, -110,32,106,103,46,83,104,97,100,101,114,115,46,69,114,114,111,114,13,10, -32,32,101,108,115,101,13,10,32,32,32,32,114,101,116,117,114,110,32,115, -104,97,100,101,114,13,10,32,32,101,110,100,13,10,101,110,100,13,10,0 +10,101,110,100,13,10,13,10,108,111,99,97,108,32,95,117,115,101,115,104, +97,100,101,114,32,61,32,106,103,46,117,115,101,83,104,97,100,101,114,32, +13,10,106,103,46,117,115,101,83,104,97,100,101,114,32,61,32,102,117,110, +99,116,105,111,110,40,115,104,97,100,101,114,41,13,10,9,105,102,32,115, +104,97,100,101,114,32,61,61,32,110,105,108,32,116,104,101,110,32,13,10, +9,9,106,103,46,117,110,117,115,101,83,104,97,100,101,114,40,41,32,13, +10,9,9,114,101,116,117,114,110,32,13,10,9,101,110,100,32,13,10,9, +95,117,115,101,115,104,97,100,101,114,40,115,104,97,100,101,114,41,13,10, +101,110,100,13,10,13,10,106,103,46,117,110,117,115,101,83,104,97,100,101, +114,32,61,32,102,117,110,99,116,105,111,110,40,41,13,10,32,32,106,103, +46,117,115,101,83,104,97,100,101,114,40,106,103,46,83,104,97,100,101,114, +115,46,68,101,102,97,117,108,116,41,13,10,101,110,100,13,10,13,10,108, +111,99,97,108,32,95,110,101,119,83,104,97,100,101,114,32,61,32,106,103, +46,110,101,119,83,104,97,100,101,114,13,10,13,10,106,103,46,110,101,119, +83,104,97,100,101,114,32,61,32,102,117,110,99,116,105,111,110,40,112,114, +111,103,114,97,109,41,32,13,10,32,32,108,111,99,97,108,32,115,104,97, +100,101,114,32,61,32,95,110,101,119,83,104,97,100,101,114,40,112,114,111, +103,114,97,109,41,13,10,32,32,105,102,32,115,104,97,100,101,114,32,61, +61,32,110,105,108,32,116,104,101,110,32,13,10,32,32,32,32,106,105,110, +46,108,111,103,46,101,114,114,111,114,40,34,67,111,109,112,105,108,101,32, +115,104,97,100,101,114,32,102,97,105,108,101,100,58,92,110,34,32,46,46, +32,100,101,98,117,103,46,116,114,97,99,101,98,97,99,107,40,41,41,13, +10,32,32,32,32,114,101,116,117,114,110,32,106,103,46,83,104,97,100,101, +114,115,46,69,114,114,111,114,13,10,32,32,101,108,115,101,13,10,32,32, +32,32,114,101,116,117,114,110,32,115,104,97,100,101,114,13,10,32,32,101, +110,100,13,10,101,110,100,13,10,13,10,108,111,99,97,108,32,95,110,101, +119,83,104,97,100,101,114,102,32,61,32,106,103,46,110,101,119,83,104,97, +100,101,114,102,13,10,13,10,106,103,46,110,101,119,83,104,97,100,101,114, +102,32,61,32,102,117,110,99,116,105,111,110,40,102,105,108,101,41,13,10, +32,32,108,111,99,97,108,32,115,104,97,100,101,114,32,61,32,95,110,101, +119,83,104,97,100,101,114,102,40,102,105,108,101,41,13,10,32,32,105,102, +32,115,104,97,100,101,114,32,61,61,32,110,105,108,32,116,104,101,110,32, +13,10,32,32,32,32,106,105,110,46,108,111,103,46,101,114,114,111,114,40, +34,67,111,109,112,105,108,101,32,115,104,97,100,101,114,32,102,97,105,108, +101,100,58,92,110,34,32,46,46,32,100,101,98,117,103,46,116,114,97,99, +101,98,97,99,107,40,41,41,13,10,32,32,32,32,114,101,116,117,114,110, +32,106,103,46,83,104,97,100,101,114,115,46,69,114,114,111,114,13,10,32, +32,101,108,115,101,13,10,32,32,32,32,114,101,116,117,114,110,32,115,104, +97,100,101,114,13,10,32,32,101,110,100,13,10,101,110,100,0 }; diff --git a/src/libjin-lua/scripts/log.lua b/src/libjin-lua/scripts/log.lua index a0e2310..f8ddd6d 100644 --- a/src/libjin-lua/scripts/log.lua +++ b/src/libjin-lua/scripts/log.lua @@ -37,11 +37,11 @@ local _tostring = tostring local tostring = function(...) local t = {} for i = 1, select('#', ...) do - local x = select(i, ...) - if type(x) == "number" then - x = round(x, .01) - end - t[#t + 1] = _tostring(x) + local x = select(i, ...) + if type(x) == "number" then + x = round(x, .01) + end + t[#t + 1] = _tostring(x) end return table.concat(t, " ") end @@ -50,33 +50,33 @@ end for i, x in ipairs(modes) do local nameupper = x.name:upper() log[x.name] = function(...) - - -- Return early if we're below the log level - if i < levels[log.level] then - return - end - - local msg = tostring(...) - local info = debug.getinfo(2, "Sl") - local lineinfo = info.short_src .. ":" .. info.currentline - - -- Output to console - print(string.format("%s[%-6s%s]%s %s: %s", - log.usecolor and x.color or "", - nameupper, - os.date("%H:%M:%S"), - log.usecolor and "\27[0m" or "", - lineinfo, - msg)) - - -- Output to log file - if log.outfile then - local fp = io.open(log.outfile, "a") - local str = string.format("[%-6s%s] %s: %s\n", - nameupper, os.date(), lineinfo, msg) - fp:write(str) - fp:close() - end + + -- Return early if we're below the log level + if i < levels[log.level] then + return + end + + local msg = tostring(...) + local info = debug.getinfo(2, "Sl") + local lineinfo = info.short_src .. ":" .. info.currentline + + -- Output to console + print(string.format("%s[%-6s%s]%s %s: %s", + log.usecolor and x.color or "", + nameupper, + os.date("%H:%M:%S"), + log.usecolor and "\27[0m" or "", + lineinfo, + msg)) + + -- Output to log file + if log.outfile then + local fp = io.open(log.outfile, "a") + local str = string.format("[%-6s%s] %s: %s\n", + nameupper, os.date(), lineinfo, msg) + fp:write(str) + fp:close() + end end end diff --git a/src/libjin-lua/scripts/log.lua.h b/src/libjin-lua/scripts/log.lua.h index bfa872c..93d7abb 100644 --- a/src/libjin-lua/scripts/log.lua.h +++ b/src/libjin-lua/scripts/log.lua.h @@ -50,77 +50,67 @@ static char log_lua[] = { 97,108,32,116,111,115,116,114,105,110,103,32,61,32,102,117,110,99,116,105, 111,110,40,46,46,46,41,13,10,32,32,108,111,99,97,108,32,116,32,61, 32,123,125,13,10,32,32,102,111,114,32,105,32,61,32,49,44,32,115,101, -108,101,99,116,40,39,35,39,44,32,46,46,46,41,32,100,111,13,10,32, -32,32,32,108,111,99,97,108,32,120,32,61,32,115,101,108,101,99,116,40, -105,44,32,46,46,46,41,13,10,32,32,32,32,105,102,32,116,121,112,101, -40,120,41,32,61,61,32,34,110,117,109,98,101,114,34,32,116,104,101,110, -13,10,32,32,32,32,32,32,120,32,61,32,114,111,117,110,100,40,120,44, -32,46,48,49,41,13,10,32,32,32,32,101,110,100,13,10,32,32,32,32, -116,91,35,116,32,43,32,49,93,32,61,32,95,116,111,115,116,114,105,110, -103,40,120,41,13,10,32,32,101,110,100,13,10,32,32,114,101,116,117,114, -110,32,116,97,98,108,101,46,99,111,110,99,97,116,40,116,44,32,34,32, -34,41,13,10,101,110,100,13,10,13,10,13,10,102,111,114,32,105,44,32, -120,32,105,110,32,105,112,97,105,114,115,40,109,111,100,101,115,41,32,100, -111,13,10,32,32,108,111,99,97,108,32,110,97,109,101,117,112,112,101,114, -32,61,32,120,46,110,97,109,101,58,117,112,112,101,114,40,41,13,10,32, -32,108,111,103,91,120,46,110,97,109,101,93,32,61,32,102,117,110,99,116, -105,111,110,40,46,46,46,41,13,10,32,32,32,32,13,10,32,32,32,32, -45,45,32,82,101,116,117,114,110,32,101,97,114,108,121,32,105,102,32,119, -101,39,114,101,32,98,101,108,111,119,32,116,104,101,32,108,111,103,32,108, -101,118,101,108,13,10,32,32,32,32,105,102,32,105,32,60,32,108,101,118, -101,108,115,91,108,111,103,46,108,101,118,101,108,93,32,116,104,101,110,13, -10,32,32,32,32,32,32,114,101,116,117,114,110,13,10,32,32,32,32,101, -110,100,13,10,13,10,32,32,32,32,108,111,99,97,108,32,109,115,103,32, -61,32,116,111,115,116,114,105,110,103,40,46,46,46,41,13,10,32,32,32, -32,108,111,99,97,108,32,105,110,102,111,32,61,32,100,101,98,117,103,46, -103,101,116,105,110,102,111,40,50,44,32,34,83,108,34,41,13,10,32,32, -32,32,108,111,99,97,108,32,108,105,110,101,105,110,102,111,32,61,32,105, -110,102,111,46,115,104,111,114,116,95,115,114,99,32,46,46,32,34,58,34, -32,46,46,32,105,110,102,111,46,99,117,114,114,101,110,116,108,105,110,101, -13,10,13,10,32,32,32,32,45,45,32,79,117,116,112,117,116,32,116,111, -32,99,111,110,115,111,108,101,13,10,32,32,32,32,112,114,105,110,116,40, -115,116,114,105,110,103,46,102,111,114,109,97,116,40,34,37,115,91,37,45, -54,115,37,115,93,37,115,32,37,115,58,32,37,115,34,44,13,10,32,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -32,32,108,111,103,46,117,115,101,99,111,108,111,114,32,97,110,100,32,120, -46,99,111,108,111,114,32,111,114,32,34,34,44,13,10,32,32,32,32,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,110, -97,109,101,117,112,112,101,114,44,13,10,32,32,32,32,32,32,32,32,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,111,115,46,100,97, -116,101,40,34,37,72,58,37,77,58,37,83,34,41,44,13,10,32,32,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -32,108,111,103,46,117,115,101,99,111,108,111,114,32,97,110,100,32,34,92, -50,55,91,48,109,34,32,111,114,32,34,34,44,13,10,32,32,32,32,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,108, -105,110,101,105,110,102,111,44,13,10,32,32,32,32,32,32,32,32,32,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,109,115,103,41,41,13, -10,13,10,32,32,32,32,45,45,32,79,117,116,112,117,116,32,116,111,32, -108,111,103,32,102,105,108,101,13,10,32,32,32,32,105,102,32,108,111,103, -46,111,117,116,102,105,108,101,32,116,104,101,110,13,10,32,32,32,32,32, -32,108,111,99,97,108,32,102,112,32,61,32,105,111,46,111,112,101,110,40, -108,111,103,46,111,117,116,102,105,108,101,44,32,34,97,34,41,13,10,32, -32,32,32,32,32,108,111,99,97,108,32,115,116,114,32,61,32,115,116,114, -105,110,103,46,102,111,114,109,97,116,40,34,91,37,45,54,115,37,115,93, -32,37,115,58,32,37,115,92,110,34,44,13,10,32,32,32,32,32,32,32, -32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -32,32,32,32,32,110,97,109,101,117,112,112,101,114,44,32,111,115,46,100, -97,116,101,40,41,44,32,108,105,110,101,105,110,102,111,44,32,109,115,103, -41,13,10,32,32,32,32,32,32,102,112,58,119,114,105,116,101,40,115,116, -114,41,13,10,32,32,32,32,32,32,102,112,58,99,108,111,115,101,40,41, -13,10,32,32,32,32,101,110,100,13,10,13,10,32,32,101,110,100,13,10, -101,110,100,13,10,13,10,45,45,45,45,45,45,45,45,45,45,45,45,45, -45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, -45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, -45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, -45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, -45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, -45,13,10,45,45,32,69,120,112,111,114,116,32,116,111,32,74,105,110,46, -32,13,10,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, -45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, -45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, -45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, -45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, -45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,13,10,13, -10,106,105,110,46,108,111,103,32,61,32,108,111,103,13,10,0 +108,101,99,116,40,39,35,39,44,32,46,46,46,41,32,100,111,13,10,9, +108,111,99,97,108,32,120,32,61,32,115,101,108,101,99,116,40,105,44,32, +46,46,46,41,13,10,9,105,102,32,116,121,112,101,40,120,41,32,61,61, +32,34,110,117,109,98,101,114,34,32,116,104,101,110,13,10,9,32,32,120, +32,61,32,114,111,117,110,100,40,120,44,32,46,48,49,41,13,10,9,101, +110,100,13,10,9,116,91,35,116,32,43,32,49,93,32,61,32,95,116,111, +115,116,114,105,110,103,40,120,41,13,10,32,32,101,110,100,13,10,32,32, +114,101,116,117,114,110,32,116,97,98,108,101,46,99,111,110,99,97,116,40, +116,44,32,34,32,34,41,13,10,101,110,100,13,10,13,10,13,10,102,111, +114,32,105,44,32,120,32,105,110,32,105,112,97,105,114,115,40,109,111,100, +101,115,41,32,100,111,13,10,32,32,108,111,99,97,108,32,110,97,109,101, +117,112,112,101,114,32,61,32,120,46,110,97,109,101,58,117,112,112,101,114, +40,41,13,10,32,32,108,111,103,91,120,46,110,97,109,101,93,32,61,32, +102,117,110,99,116,105,111,110,40,46,46,46,41,13,10,9,13,10,9,45, +45,32,82,101,116,117,114,110,32,101,97,114,108,121,32,105,102,32,119,101, +39,114,101,32,98,101,108,111,119,32,116,104,101,32,108,111,103,32,108,101, +118,101,108,13,10,9,105,102,32,105,32,60,32,108,101,118,101,108,115,91, +108,111,103,46,108,101,118,101,108,93,32,116,104,101,110,13,10,9,32,32, +114,101,116,117,114,110,13,10,9,101,110,100,13,10,13,10,9,108,111,99, +97,108,32,109,115,103,32,61,32,116,111,115,116,114,105,110,103,40,46,46, +46,41,13,10,9,108,111,99,97,108,32,105,110,102,111,32,61,32,100,101, +98,117,103,46,103,101,116,105,110,102,111,40,50,44,32,34,83,108,34,41, +13,10,9,108,111,99,97,108,32,108,105,110,101,105,110,102,111,32,61,32, +105,110,102,111,46,115,104,111,114,116,95,115,114,99,32,46,46,32,34,58, +34,32,46,46,32,105,110,102,111,46,99,117,114,114,101,110,116,108,105,110, +101,13,10,13,10,9,45,45,32,79,117,116,112,117,116,32,116,111,32,99, +111,110,115,111,108,101,13,10,9,112,114,105,110,116,40,115,116,114,105,110, +103,46,102,111,114,109,97,116,40,34,37,115,91,37,45,54,115,37,115,93, +37,115,32,37,115,58,32,37,115,34,44,13,10,9,9,9,9,9,9,108, +111,103,46,117,115,101,99,111,108,111,114,32,97,110,100,32,120,46,99,111, +108,111,114,32,111,114,32,34,34,44,13,10,9,9,9,9,9,9,110,97, +109,101,117,112,112,101,114,44,13,10,9,9,9,9,9,9,111,115,46,100, +97,116,101,40,34,37,72,58,37,77,58,37,83,34,41,44,13,10,9,9, +9,9,9,9,108,111,103,46,117,115,101,99,111,108,111,114,32,97,110,100, +32,34,92,50,55,91,48,109,34,32,111,114,32,34,34,44,13,10,9,9, +9,9,9,9,108,105,110,101,105,110,102,111,44,13,10,9,9,9,9,9, +9,109,115,103,41,41,13,10,13,10,9,45,45,32,79,117,116,112,117,116, +32,116,111,32,108,111,103,32,102,105,108,101,13,10,9,105,102,32,108,111, +103,46,111,117,116,102,105,108,101,32,116,104,101,110,13,10,9,32,32,108, +111,99,97,108,32,102,112,32,61,32,105,111,46,111,112,101,110,40,108,111, +103,46,111,117,116,102,105,108,101,44,32,34,97,34,41,13,10,9,32,32, +108,111,99,97,108,32,115,116,114,32,61,32,115,116,114,105,110,103,46,102, +111,114,109,97,116,40,34,91,37,45,54,115,37,115,93,32,37,115,58,32, +37,115,92,110,34,44,13,10,9,9,9,9,9,9,9,9,110,97,109,101, +117,112,112,101,114,44,32,111,115,46,100,97,116,101,40,41,44,32,108,105, +110,101,105,110,102,111,44,32,109,115,103,41,13,10,9,32,32,102,112,58, +119,114,105,116,101,40,115,116,114,41,13,10,9,32,32,102,112,58,99,108, +111,115,101,40,41,13,10,9,101,110,100,13,10,13,10,32,32,101,110,100, +13,10,101,110,100,13,10,13,10,45,45,45,45,45,45,45,45,45,45,45, +45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, +45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, +45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, +45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, +45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, +45,45,45,13,10,45,45,32,69,120,112,111,114,116,32,116,111,32,74,105, +110,46,32,13,10,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, +45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, +45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, +45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, +45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, +45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,13, +10,13,10,106,105,110,46,108,111,103,32,61,32,108,111,103,13,10,0 }; diff --git a/src/libjin-lua/scripts/physics/physics.lua b/src/libjin-lua/scripts/physics/physics.lua index 9b24a55..897af8d 100644 --- a/src/libjin-lua/scripts/physics/physics.lua +++ b/src/libjin-lua/scripts/physics/physics.lua @@ -69,22 +69,22 @@ local function rect_getSegmentIntersectionIndices(x,y,w,h, x1,y1,x2,y2, ti1,ti2) if side == 1 then nx,ny,p,q = -1, 0, -dx, x1 - x -- left elseif side == 2 then nx,ny,p,q = 1, 0, dx, x + w - x1 -- right elseif side == 3 then nx,ny,p,q = 0, -1, -dy, y1 - y -- top - else nx,ny,p,q = 0, 1, dy, y + h - y1 -- bottom + else nx,ny,p,q = 0, 1, dy, y + h - y1 -- bottom end if p == 0 then - if q <= 0 then return nil end + if q <= 0 then return nil end else - r = q / p - if p < 0 then - if r > ti2 then return nil - elseif r > ti1 then ti1,nx1,ny1 = r,nx,ny - end - else -- p > 0 - if r < ti1 then return nil - elseif r < ti2 then ti2,nx2,ny2 = r,nx,ny - end - end + r = q / p + if p < 0 then + if r > ti2 then return nil + elseif r > ti1 then ti1,nx1,ny1 = r,nx,ny + end + else -- p > 0 + if r < ti1 then return nil + elseif r < ti2 then ti2,nx2,ny2 = r,nx,ny + end + end end end @@ -94,19 +94,19 @@ end -- Calculates the minkowsky difference between 2 rects, which is another rect local function rect_getDiff(x1,y1,w1,h1, x2,y2,w2,h2) return x2 - x1 - w1, - y2 - y1 - h1, - w1 + w2, - h1 + h2 + y2 - y1 - h1, + w1 + w2, + h1 + h2 end local function rect_containsPoint(x,y,w,h, px,py) - return px - x > DELTA and py - y > DELTA and - x + w - px > DELTA and y + h - py > DELTA + return px - x > DELTA and py - y > DELTA and + x + w - px > DELTA and y + h - py > DELTA end local function rect_isIntersecting(x1,y1,w1,h1, x2,y2,w2,h2) return x1 < x2+w2 and x2 < x1+w1 and - y1 < y2+h2 and y2 < y1+h1 + y1 < y2+h2 and y2 < y1+h1 end local function rect_getSquareDistance(x1,y1,w1,h1, x2,y2,w2,h2) @@ -119,7 +119,7 @@ local function rect_detectCollision(x1,y1,w1,h1, x2,y2,w2,h2, goalX, goalY) goalX = goalX or x1 goalY = goalY or y1 - local dx, dy = goalX - x1, goalY - y1 + local dx, dy = goalX - x1, goalY - y1 local x,y,w,h = rect_getDiff(x1,y1,w1,h1, x2,y2,w2,h2) local overlaps, ti, nx, ny @@ -127,7 +127,7 @@ local function rect_detectCollision(x1,y1,w1,h1, x2,y2,w2,h2, goalX, goalY) if rect_containsPoint(x,y,w,h, 0,0) then -- item was intersecting other local px, py = rect_getNearestCorner(x,y,w,h, 0, 0) local wi, hi = min(w1, abs(px)), min(h1, abs(py)) -- area of intersection - ti = -wi * hi -- ti is the negative area of intersection + ti = -wi * hi -- ti is the negative area of intersection overlaps = true else local ti1,ti2,nx1,ny1 = rect_getSegmentIntersectionIndices(x,y,w,h, 0,0,dx,dy, -math.huge, math.huge) @@ -137,10 +137,10 @@ local function rect_detectCollision(x1,y1,w1,h1, x2,y2,w2,h2, goalX, goalY) and ti1 < 1 and (abs(ti1 - ti2) >= DELTA) -- special case for rect going through another rect's corner and (0 < ti1 + DELTA - or 0 == ti1 and ti2 > 0) + or 0 == ti1 and ti2 > 0) then - ti, nx, ny = ti1, nx1, ny1 - overlaps = false + ti, nx, ny = ti1, nx1, ny1 + overlaps = false end end @@ -150,17 +150,17 @@ local function rect_detectCollision(x1,y1,w1,h1, x2,y2,w2,h2, goalX, goalY) if overlaps then if dx == 0 and dy == 0 then - -- intersecting and not moving - use minimum displacement vector - local px, py = rect_getNearestCorner(x,y,w,h, 0,0) - if abs(px) < abs(py) then py = 0 else px = 0 end - nx, ny = sign(px), sign(py) - tx, ty = x1 + px, y1 + py + -- intersecting and not moving - use minimum displacement vector + local px, py = rect_getNearestCorner(x,y,w,h, 0,0) + if abs(px) < abs(py) then py = 0 else px = 0 end + nx, ny = sign(px), sign(py) + tx, ty = x1 + px, y1 + py else - -- intersecting and moving - move in the opposite direction - local ti1, _ - ti1,_,nx,ny = rect_getSegmentIntersectionIndices(x,y,w,h, 0,0,dx,dy, -math.huge, 1) - if not ti1 then return end - tx, ty = x1 + dx * ti1, y1 + dy * ti1 + -- intersecting and moving - move in the opposite direction + local ti1, _ + ti1,_,nx,ny = rect_getSegmentIntersectionIndices(x,y,w,h, 0,0,dx,dy, -math.huge, 1) + if not ti1 then return end + tx, ty = x1 + dx * ti1, y1 + dy * ti1 end else -- tunnel tx, ty = x1 + dx * ti, y1 + dy * ti @@ -168,8 +168,8 @@ local function rect_detectCollision(x1,y1,w1,h1, x2,y2,w2,h2, goalX, goalY) return { overlaps = overlaps, - ti = ti, - move = {x = dx, y = dy}, + ti = ti, + move = {x = dx, y = dy}, normal = {x = nx, y = ny}, touch = {x = tx, y = ty}, itemRect = {x = x1, y = y1, w = w1, h = h1}, @@ -206,11 +206,11 @@ local function grid_traverse_initStep(cellSize, ct, t1, t2) end local function grid_traverse(cellSize, x1,y1,x2,y2, f) - local cx1,cy1 = grid_toCell(cellSize, x1,y1) - local cx2,cy2 = grid_toCell(cellSize, x2,y2) + local cx1,cy1 = grid_toCell(cellSize, x1,y1) + local cx2,cy2 = grid_toCell(cellSize, x2,y2) local stepX, dx, tx = grid_traverse_initStep(cellSize, cx1, x1, x2) local stepY, dy, ty = grid_traverse_initStep(cellSize, cy1, y1, y2) - local cx,cy = cx1,cy1 + local cx,cy = cx1,cy1 f(cx, cy) @@ -219,13 +219,13 @@ local function grid_traverse(cellSize, x1,y1,x2,y2, f) -- when we are *next* to the last cell while abs(cx - cx2) + abs(cy - cy2) > 1 do if tx < ty then - tx, cx = tx + dx, cx + stepX - f(cx, cy) + tx, cx = tx + dx, cx + stepX + f(cx, cy) else - -- Addition: include both cells when going through corners - if tx == ty then f(cx + stepX, cy) end - ty, cy = ty + dy, cy + stepY - f(cx, cy) + -- Addition: include both cells when going through corners + if tx == ty then f(cx + stepX, cy) end + ty, cy = ty + dy, cy + stepY + f(cx, cy) end end @@ -260,9 +260,9 @@ local slide = function(world, col, x,y,w,h, goalX, goalY, filter) local tch, move = col.touch, col.move if move.x ~= 0 or move.y ~= 0 then if col.normal.x ~= 0 then - goalX = tch.x + goalX = tch.x else - goalY = tch.y + goalY = tch.y end end @@ -289,7 +289,7 @@ local bounce = function(world, col, x,y,w,h, goalX, goalY, filter) end col.bounce = {x = bx, y = by} - x,y = tch.x, tch.y + x,y = tch.x, tch.y goalX, goalY = bx, by local cols, len = world:project(col.item, x,y,w,h, goalX, goalY, filter) @@ -347,14 +347,14 @@ local function getDictItemsInCellRect(self, cl,ct,cw,ch) for cy=ct,ct+ch-1 do local row = self.rows[cy] if row then - for cx=cl,cl+cw-1 do - local cell = row[cx] - if cell and cell.itemCount > 0 then -- no cell.itemCount > 1 because tunneling - for item,_ in pairs(cell.items) do - items_dict[item] = true - end - end - end + for cx=cl,cl+cw-1 do + local cell = row[cx] + if cell and cell.itemCount > 0 then -- no cell.itemCount > 1 because tunneling + for item,_ in pairs(cell.items) do + items_dict[item] = true + end + end + end end end @@ -386,21 +386,21 @@ local function getInfoAboutItemsTouchedBySegment(self, x1,y1, x2,y2, filter) for i=1,len do cell = cells[i] for item in pairs(cell.items) do - if not visited[item] then - visited[item] = true - if (not filter or filter(item)) then - rect = self.rects[item] - l,t,w,h = rect.x,rect.y,rect.w,rect.h - - ti1,ti2 = rect_getSegmentIntersectionIndices(l,t,w,h, x1,y1, x2,y2, 0, 1) - if ti1 and ((0 < ti1 and ti1 < 1) or (0 < ti2 and ti2 < 1)) then - -- the sorting is according to the t of an infinite line, not the segment - tii0,tii1 = rect_getSegmentIntersectionIndices(l,t,w,h, x1,y1, x2,y2, -math.huge, math.huge) - itemInfoLen = itemInfoLen + 1 - itemInfo[itemInfoLen] = {item = item, ti1 = ti1, ti2 = ti2, weight = min(tii0,tii1)} - end - end - end + if not visited[item] then + visited[item] = true + if (not filter or filter(item)) then + rect = self.rects[item] + l,t,w,h = rect.x,rect.y,rect.w,rect.h + + ti1,ti2 = rect_getSegmentIntersectionIndices(l,t,w,h, x1,y1, x2,y2, 0, 1) + if ti1 and ((0 < ti1 and ti1 < 1) or (0 < ti2 and ti2 < 1)) then + -- the sorting is according to the t of an infinite line, not the segment + tii0,tii1 = rect_getSegmentIntersectionIndices(l,t,w,h, x1,y1, x2,y2, -math.huge, math.huge) + itemInfoLen = itemInfoLen + 1 + itemInfo[itemInfoLen] = {item = item, ti1 = ti1, ti2 = ti2, weight = min(tii0,tii1)} + end + end + end end end table.sort(itemInfo, sortByWeight) @@ -436,7 +436,7 @@ function World:project(item, x,y,w,h, goalX, goalY, filter) -- This could probably be done with less cells using a polygon raster over the cells instead of a -- bounding rect of the whole movement. Conditional to building a queryPolygon method - local tl, tt = min(goalX, x), min(goalY, y) + local tl, tt = min(goalX, x), min(goalY, y) local tr, tb = max(goalX + w, x+w), max(goalY + h, y+h) local tw, th = tr-tl, tb-tt @@ -446,22 +446,22 @@ function World:project(item, x,y,w,h, goalX, goalY, filter) for other,_ in pairs(dictItemsInCellRect) do if not visited[other] then - visited[other] = true + visited[other] = true - local responseName = filter(item, other) - if responseName then - local ox,oy,ow,oh = self:getRect(other) - local col = rect_detectCollision(x,y,w,h, ox,oy,ow,oh, goalX, goalY) + local responseName = filter(item, other) + if responseName then + local ox,oy,ow,oh = self:getRect(other) + local col = rect_detectCollision(x,y,w,h, ox,oy,ow,oh, goalX, goalY) - if col then - col.other = other - col.item = item - col.type = responseName + if col then + col.other = other + col.item = item + col.type = responseName - len = len + 1 - collisions[len] = col - end - end + len = len + 1 + collisions[len] = col + end + end end end @@ -474,7 +474,7 @@ function World:countCells() local count = 0 for _,row in pairs(self.rows) do for _,_ in pairs(row) do - count = count + 1 + count = count + 1 end end return count @@ -533,8 +533,8 @@ function World:queryRect(x,y,w,h, filter) if (not filter or filter(item)) and rect_isIntersecting(x,y,w,h, rect.x, rect.y, rect.w, rect.h) then - len = len + 1 - items[len] = item + len = len + 1 + items[len] = item end end @@ -553,8 +553,8 @@ function World:queryPoint(x,y, filter) if (not filter or filter(item)) and rect_containsPoint(rect.x, rect.y, rect.w, rect.h, x, y) then - len = len + 1 - items[len] = item + len = len + 1 + items[len] = item end end @@ -572,7 +572,7 @@ end function World:querySegmentWithCoords(x1, y1, x2, y2, filter) local itemInfo, len = getInfoAboutItemsTouchedBySegment(self, x1, y1, x2, y2, filter) - local dx, dy = x2-x1, y2-y1 + local dx, dy = x2-x1, y2-y1 local info, ti1, ti2 for i=1, len do info = itemInfo[i] @@ -580,10 +580,10 @@ function World:querySegmentWithCoords(x1, y1, x2, y2, filter) ti2 = info.ti2 info.weight = nil - info.x1 = x1 + dx * ti1 - info.y1 = y1 + dy * ti1 - info.x2 = x1 + dx * ti2 - info.y2 = y1 + dy * ti2 + info.x1 = x1 + dx * ti1 + info.y1 = y1 + dy * ti1 + info.x2 = x1 + dx * ti2 + info.y2 = y1 + dy * ti2 end return itemInfo, len end @@ -603,7 +603,7 @@ function World:add(item, x,y,w,h) local cl,ct,cw,ch = grid_toCellRect(self.cellSize, x,y,w,h) for cy = ct, ct+ch-1 do for cx = cl, cl+cw-1 do - addItemToCell(self, item, cx, cy) + addItemToCell(self, item, cx, cy) end end @@ -617,7 +617,7 @@ function World:remove(item) local cl,ct,cw,ch = grid_toCellRect(self.cellSize, x,y,w,h) for cy = ct, ct+ch-1 do for cx = cl, cl+cw-1 do - removeItemFromCell(self, item, cx, cy) + removeItemFromCell(self, item, cx, cy) end end end @@ -635,27 +635,27 @@ function World:update(item, x2,y2,w2,h2) if cl1 ~= cl2 or ct1 ~= ct2 or cw1 ~= cw2 or ch1 ~= ch2 then - local cr1, cb1 = cl1+cw1-1, ct1+ch1-1 - local cr2, cb2 = cl2+cw2-1, ct2+ch2-1 - local cyOut + local cr1, cb1 = cl1+cw1-1, ct1+ch1-1 + local cr2, cb2 = cl2+cw2-1, ct2+ch2-1 + local cyOut - for cy = ct1, cb1 do - cyOut = cy < ct2 or cy > cb2 - for cx = cl1, cr1 do - if cyOut or cx < cl2 or cx > cr2 then - removeItemFromCell(self, item, cx, cy) - end - end - end + for cy = ct1, cb1 do + cyOut = cy < ct2 or cy > cb2 + for cx = cl1, cr1 do + if cyOut or cx < cl2 or cx > cr2 then + removeItemFromCell(self, item, cx, cy) + end + end + end - for cy = ct2, cb2 do - cyOut = cy < ct1 or cy > cb1 - for cx = cl2, cr2 do - if cyOut or cx < cl1 or cx > cr1 then - addItemToCell(self, item, cx, cy) - end - end - end + for cy = ct2, cb2 do + cyOut = cy < ct1 or cy > cb1 + for cx = cl2, cr2 do + if cyOut or cx < cl1 or cx > cr1 then + addItemToCell(self, item, cx, cy) + end + end + end end @@ -690,7 +690,7 @@ function World:check(item, goalX, goalY, filter) while projected_len > 0 do local col = projected_cols[1] - len = len + 1 + len = len + 1 cols[len] = col visited[col.other] = true @@ -698,11 +698,11 @@ function World:check(item, goalX, goalY, filter) local response = getResponseByName(self, col.type) goalX, goalY, projected_cols, projected_len = response( - self, - col, - x, y, w, h, - goalX, goalY, - visitedFilter + self, + col, + x, y, w, h, + goalX, goalY, + visitedFilter ) end @@ -716,9 +716,9 @@ bump.newWorld = function(cellSize) cellSize = cellSize or 64 assertIsPositiveNumber(cellSize, 'cellSize') local world = setmetatable({ - cellSize = cellSize, - rects = {}, - rows = {}, + cellSize = cellSize, + rects = {}, + rows = {}, nonEmptyCells = {}, responses = {} }, World_mt) @@ -732,13 +732,13 @@ bump.newWorld = function(cellSize) end bump.rect = { - getNearestCorner = rect_getNearestCorner, + getNearestCorner = rect_getNearestCorner, getSegmentIntersectionIndices = rect_getSegmentIntersectionIndices, - getDiff = rect_getDiff, - containsPoint = rect_containsPoint, - isIntersecting = rect_isIntersecting, - getSquareDistance = rect_getSquareDistance, - detectCollision = rect_detectCollision + getDiff = rect_getDiff, + containsPoint = rect_containsPoint, + isIntersecting = rect_isIntersecting, + getSquareDistance = rect_getSquareDistance, + detectCollision = rect_detectCollision } bump.responses = { diff --git a/src/libjin-lua/scripts/physics/physics.lua.h b/src/libjin-lua/scripts/physics/physics.lua.h index 01a0cff..4c80947 100644 --- a/src/libjin-lua/scripts/physics/physics.lua.h +++ b/src/libjin-lua/scripts/physics/physics.lua.h @@ -122,70 +122,67 @@ static char physics_lua[] = { 13,10,32,32,101,108,115,101,105,102,32,115,105,100,101,32,61,61,32,51, 32,116,104,101,110,32,110,120,44,110,121,44,112,44,113,32,61,32,32,48, 44,32,45,49,44,32,45,100,121,44,32,121,49,32,45,32,121,32,32,32, -45,45,32,116,111,112,13,10,32,32,101,108,115,101,32,32,32,32,32,32, -32,32,32,32,110,120,44,110,121,44,112,44,113,32,61,32,32,48,44,32, -32,49,44,32,32,100,121,44,32,121,32,43,32,104,32,45,32,121,49,32, -45,45,32,98,111,116,116,111,109,13,10,32,32,101,110,100,13,10,13,10, -32,32,105,102,32,112,32,61,61,32,48,32,116,104,101,110,13,10,32,32, -32,32,105,102,32,113,32,60,61,32,48,32,116,104,101,110,32,114,101,116, -117,114,110,32,110,105,108,32,101,110,100,13,10,32,32,101,108,115,101,13, -10,32,32,32,32,114,32,61,32,113,32,47,32,112,13,10,32,32,32,32, -105,102,32,112,32,60,32,48,32,116,104,101,110,13,10,32,32,32,32,105, -102,32,32,32,114,32,62,32,116,105,50,32,116,104,101,110,32,114,101,116, -117,114,110,32,110,105,108,13,10,32,32,32,32,101,108,115,101,105,102,32, -114,32,62,32,116,105,49,32,116,104,101,110,32,116,105,49,44,110,120,49, -44,110,121,49,32,61,32,114,44,110,120,44,110,121,13,10,32,32,32,32, -101,110,100,13,10,32,32,32,32,101,108,115,101,32,45,45,32,112,32,62, -32,48,13,10,32,32,32,32,105,102,32,32,32,114,32,60,32,116,105,49, -32,116,104,101,110,32,114,101,116,117,114,110,32,110,105,108,13,10,32,32, -32,32,101,108,115,101,105,102,32,114,32,60,32,116,105,50,32,116,104,101, -110,32,116,105,50,44,110,120,50,44,110,121,50,32,61,32,114,44,110,120, -44,110,121,13,10,32,32,32,32,101,110,100,13,10,32,32,32,32,101,110, -100,13,10,32,32,101,110,100,13,10,32,32,101,110,100,13,10,13,10,32, -32,114,101,116,117,114,110,32,116,105,49,44,116,105,50,44,32,110,120,49, -44,110,121,49,44,32,110,120,50,44,110,121,50,13,10,101,110,100,13,10, -13,10,45,45,32,67,97,108,99,117,108,97,116,101,115,32,116,104,101,32, -109,105,110,107,111,119,115,107,121,32,100,105,102,102,101,114,101,110,99,101, -32,98,101,116,119,101,101,110,32,50,32,114,101,99,116,115,44,32,119,104, -105,99,104,32,105,115,32,97,110,111,116,104,101,114,32,114,101,99,116,13, -10,108,111,99,97,108,32,102,117,110,99,116,105,111,110,32,114,101,99,116, -95,103,101,116,68,105,102,102,40,120,49,44,121,49,44,119,49,44,104,49, -44,32,120,50,44,121,50,44,119,50,44,104,50,41,13,10,32,32,114,101, -116,117,114,110,32,120,50,32,45,32,120,49,32,45,32,119,49,44,13,10, -32,32,32,32,32,121,50,32,45,32,121,49,32,45,32,104,49,44,13,10, -32,32,32,32,32,119,49,32,43,32,119,50,44,13,10,32,32,32,32,32, -104,49,32,43,32,104,50,13,10,101,110,100,13,10,13,10,108,111,99,97, -108,32,102,117,110,99,116,105,111,110,32,114,101,99,116,95,99,111,110,116, -97,105,110,115,80,111,105,110,116,40,120,44,121,44,119,44,104,44,32,112, -120,44,112,121,41,13,10,32,32,114,101,116,117,114,110,32,112,120,32,45, -32,120,32,62,32,68,69,76,84,65,32,32,32,32,97,110,100,32,112,121, -32,45,32,121,32,62,32,68,69,76,84,65,32,97,110,100,13,10,32,32, -32,32,32,120,32,43,32,119,32,45,32,112,120,32,62,32,68,69,76,84, -65,32,32,97,110,100,32,121,32,43,32,104,32,45,32,112,121,32,62,32, -68,69,76,84,65,13,10,101,110,100,13,10,13,10,108,111,99,97,108,32, -102,117,110,99,116,105,111,110,32,114,101,99,116,95,105,115,73,110,116,101, -114,115,101,99,116,105,110,103,40,120,49,44,121,49,44,119,49,44,104,49, -44,32,120,50,44,121,50,44,119,50,44,104,50,41,13,10,32,32,114,101, -116,117,114,110,32,120,49,32,60,32,120,50,43,119,50,32,97,110,100,32, -120,50,32,60,32,120,49,43,119,49,32,97,110,100,13,10,32,32,32,32, -32,121,49,32,60,32,121,50,43,104,50,32,97,110,100,32,121,50,32,60, -32,121,49,43,104,49,13,10,101,110,100,13,10,13,10,108,111,99,97,108, -32,102,117,110,99,116,105,111,110,32,114,101,99,116,95,103,101,116,83,113, -117,97,114,101,68,105,115,116,97,110,99,101,40,120,49,44,121,49,44,119, -49,44,104,49,44,32,120,50,44,121,50,44,119,50,44,104,50,41,13,10, -32,32,108,111,99,97,108,32,100,120,32,61,32,120,49,32,45,32,120,50, -32,43,32,40,119,49,32,45,32,119,50,41,47,50,13,10,32,32,108,111, -99,97,108,32,100,121,32,61,32,121,49,32,45,32,121,50,32,43,32,40, -104,49,32,45,32,104,50,41,47,50,13,10,32,32,114,101,116,117,114,110, -32,100,120,42,100,120,32,43,32,100,121,42,100,121,13,10,101,110,100,13, -10,13,10,108,111,99,97,108,32,102,117,110,99,116,105,111,110,32,114,101, -99,116,95,100,101,116,101,99,116,67,111,108,108,105,115,105,111,110,40,120, -49,44,121,49,44,119,49,44,104,49,44,32,120,50,44,121,50,44,119,50, -44,104,50,44,32,103,111,97,108,88,44,32,103,111,97,108,89,41,13,10, -32,32,103,111,97,108,88,32,61,32,103,111,97,108,88,32,111,114,32,120, -49,13,10,32,32,103,111,97,108,89,32,61,32,103,111,97,108,89,32,111, -114,32,121,49,13,10,13,10,32,32,108,111,99,97,108,32,100,120,44,32, -100,121,32,32,32,32,61,32,103,111,97,108,88,32,45,32,120,49,44,32, +45,45,32,116,111,112,13,10,32,32,101,108,115,101,9,9,32,32,110,120, +44,110,121,44,112,44,113,32,61,32,32,48,44,32,32,49,44,32,32,100, +121,44,32,121,32,43,32,104,32,45,32,121,49,32,45,45,32,98,111,116, +116,111,109,13,10,32,32,101,110,100,13,10,13,10,32,32,105,102,32,112, +32,61,61,32,48,32,116,104,101,110,13,10,9,105,102,32,113,32,60,61, +32,48,32,116,104,101,110,32,114,101,116,117,114,110,32,110,105,108,32,101, +110,100,13,10,32,32,101,108,115,101,13,10,9,114,32,61,32,113,32,47, +32,112,13,10,9,105,102,32,112,32,60,32,48,32,116,104,101,110,13,10, +9,105,102,32,32,32,114,32,62,32,116,105,50,32,116,104,101,110,32,114, +101,116,117,114,110,32,110,105,108,13,10,9,101,108,115,101,105,102,32,114, +32,62,32,116,105,49,32,116,104,101,110,32,116,105,49,44,110,120,49,44, +110,121,49,32,61,32,114,44,110,120,44,110,121,13,10,9,101,110,100,13, +10,9,101,108,115,101,32,45,45,32,112,32,62,32,48,13,10,9,105,102, +32,32,32,114,32,60,32,116,105,49,32,116,104,101,110,32,114,101,116,117, +114,110,32,110,105,108,13,10,9,101,108,115,101,105,102,32,114,32,60,32, +116,105,50,32,116,104,101,110,32,116,105,50,44,110,120,50,44,110,121,50, +32,61,32,114,44,110,120,44,110,121,13,10,9,101,110,100,13,10,9,101, +110,100,13,10,32,32,101,110,100,13,10,32,32,101,110,100,13,10,13,10, +32,32,114,101,116,117,114,110,32,116,105,49,44,116,105,50,44,32,110,120, +49,44,110,121,49,44,32,110,120,50,44,110,121,50,13,10,101,110,100,13, +10,13,10,45,45,32,67,97,108,99,117,108,97,116,101,115,32,116,104,101, +32,109,105,110,107,111,119,115,107,121,32,100,105,102,102,101,114,101,110,99, +101,32,98,101,116,119,101,101,110,32,50,32,114,101,99,116,115,44,32,119, +104,105,99,104,32,105,115,32,97,110,111,116,104,101,114,32,114,101,99,116, +13,10,108,111,99,97,108,32,102,117,110,99,116,105,111,110,32,114,101,99, +116,95,103,101,116,68,105,102,102,40,120,49,44,121,49,44,119,49,44,104, +49,44,32,120,50,44,121,50,44,119,50,44,104,50,41,13,10,32,32,114, +101,116,117,114,110,32,120,50,32,45,32,120,49,32,45,32,119,49,44,13, +10,9,32,121,50,32,45,32,121,49,32,45,32,104,49,44,13,10,9,32, +119,49,32,43,32,119,50,44,13,10,9,32,104,49,32,43,32,104,50,13, +10,101,110,100,13,10,13,10,108,111,99,97,108,32,102,117,110,99,116,105, +111,110,32,114,101,99,116,95,99,111,110,116,97,105,110,115,80,111,105,110, +116,40,120,44,121,44,119,44,104,44,32,112,120,44,112,121,41,13,10,32, +32,114,101,116,117,114,110,32,112,120,32,45,32,120,32,62,32,68,69,76, +84,65,9,97,110,100,32,112,121,32,45,32,121,32,62,32,68,69,76,84, +65,32,97,110,100,13,10,9,32,120,32,43,32,119,32,45,32,112,120,32, +62,32,68,69,76,84,65,32,32,97,110,100,32,121,32,43,32,104,32,45, +32,112,121,32,62,32,68,69,76,84,65,13,10,101,110,100,13,10,13,10, +108,111,99,97,108,32,102,117,110,99,116,105,111,110,32,114,101,99,116,95, +105,115,73,110,116,101,114,115,101,99,116,105,110,103,40,120,49,44,121,49, +44,119,49,44,104,49,44,32,120,50,44,121,50,44,119,50,44,104,50,41, +13,10,32,32,114,101,116,117,114,110,32,120,49,32,60,32,120,50,43,119, +50,32,97,110,100,32,120,50,32,60,32,120,49,43,119,49,32,97,110,100, +13,10,9,32,121,49,32,60,32,121,50,43,104,50,32,97,110,100,32,121, +50,32,60,32,121,49,43,104,49,13,10,101,110,100,13,10,13,10,108,111, +99,97,108,32,102,117,110,99,116,105,111,110,32,114,101,99,116,95,103,101, +116,83,113,117,97,114,101,68,105,115,116,97,110,99,101,40,120,49,44,121, +49,44,119,49,44,104,49,44,32,120,50,44,121,50,44,119,50,44,104,50, +41,13,10,32,32,108,111,99,97,108,32,100,120,32,61,32,120,49,32,45, +32,120,50,32,43,32,40,119,49,32,45,32,119,50,41,47,50,13,10,32, +32,108,111,99,97,108,32,100,121,32,61,32,121,49,32,45,32,121,50,32, +43,32,40,104,49,32,45,32,104,50,41,47,50,13,10,32,32,114,101,116, +117,114,110,32,100,120,42,100,120,32,43,32,100,121,42,100,121,13,10,101, +110,100,13,10,13,10,108,111,99,97,108,32,102,117,110,99,116,105,111,110, +32,114,101,99,116,95,100,101,116,101,99,116,67,111,108,108,105,115,105,111, +110,40,120,49,44,121,49,44,119,49,44,104,49,44,32,120,50,44,121,50, +44,119,50,44,104,50,44,32,103,111,97,108,88,44,32,103,111,97,108,89, +41,13,10,32,32,103,111,97,108,88,32,61,32,103,111,97,108,88,32,111, +114,32,120,49,13,10,32,32,103,111,97,108,89,32,61,32,103,111,97,108, +89,32,111,114,32,121,49,13,10,13,10,32,32,108,111,99,97,108,32,100, +120,44,32,100,121,9,61,32,103,111,97,108,88,32,45,32,120,49,44,32, 103,111,97,108,89,32,45,32,121,49,13,10,32,32,108,111,99,97,108,32, 120,44,121,44,119,44,104,32,32,32,61,32,114,101,99,116,95,103,101,116, 68,105,102,102,40,120,49,44,121,49,44,119,49,44,104,49,44,32,120,50, @@ -201,140 +198,137 @@ static char physics_lua[] = { 111,99,97,108,32,119,105,44,32,104,105,32,32,61,32,109,105,110,40,119, 49,44,32,97,98,115,40,112,120,41,41,44,32,109,105,110,40,104,49,44, 32,97,98,115,40,112,121,41,41,32,45,45,32,97,114,101,97,32,111,102, -32,105,110,116,101,114,115,101,99,116,105,111,110,13,10,32,32,116,105,32, -32,32,32,32,32,32,32,61,32,45,119,105,32,42,32,104,105,32,45,45, -32,116,105,32,105,115,32,116,104,101,32,110,101,103,97,116,105,118,101,32, -97,114,101,97,32,111,102,32,105,110,116,101,114,115,101,99,116,105,111,110, -13,10,32,32,111,118,101,114,108,97,112,115,32,61,32,116,114,117,101,13, -10,32,32,101,108,115,101,13,10,32,32,108,111,99,97,108,32,116,105,49, -44,116,105,50,44,110,120,49,44,110,121,49,32,61,32,114,101,99,116,95, -103,101,116,83,101,103,109,101,110,116,73,110,116,101,114,115,101,99,116,105, -111,110,73,110,100,105,99,101,115,40,120,44,121,44,119,44,104,44,32,48, -44,48,44,100,120,44,100,121,44,32,45,109,97,116,104,46,104,117,103,101, -44,32,109,97,116,104,46,104,117,103,101,41,13,10,13,10,32,32,45,45, -32,105,116,101,109,32,116,117,110,110,101,108,115,32,105,110,116,111,32,111, -116,104,101,114,13,10,32,32,105,102,32,116,105,49,13,10,32,32,97,110, -100,32,116,105,49,32,60,32,49,13,10,32,32,97,110,100,32,40,97,98, -115,40,116,105,49,32,45,32,116,105,50,41,32,62,61,32,68,69,76,84, -65,41,32,45,45,32,115,112,101,99,105,97,108,32,99,97,115,101,32,102, -111,114,32,114,101,99,116,32,103,111,105,110,103,32,116,104,114,111,117,103, -104,32,97,110,111,116,104,101,114,32,114,101,99,116,39,115,32,99,111,114, -110,101,114,13,10,32,32,97,110,100,32,40,48,32,60,32,116,105,49,32, -43,32,68,69,76,84,65,13,10,32,32,32,32,111,114,32,48,32,61,61, -32,116,105,49,32,97,110,100,32,116,105,50,32,62,32,48,41,13,10,32, -32,116,104,101,110,13,10,32,32,32,32,116,105,44,32,110,120,44,32,110, -121,32,61,32,116,105,49,44,32,110,120,49,44,32,110,121,49,13,10,32, -32,32,32,111,118,101,114,108,97,112,115,32,32,32,61,32,102,97,108,115, -101,13,10,32,32,101,110,100,13,10,32,32,101,110,100,13,10,13,10,32, -32,105,102,32,110,111,116,32,116,105,32,116,104,101,110,32,114,101,116,117, -114,110,32,101,110,100,13,10,13,10,32,32,108,111,99,97,108,32,116,120, -44,32,116,121,13,10,13,10,32,32,105,102,32,111,118,101,114,108,97,112, -115,32,116,104,101,110,13,10,32,32,105,102,32,100,120,32,61,61,32,48, -32,97,110,100,32,100,121,32,61,61,32,48,32,116,104,101,110,13,10,32, -32,32,32,45,45,32,105,110,116,101,114,115,101,99,116,105,110,103,32,97, -110,100,32,110,111,116,32,109,111,118,105,110,103,32,45,32,117,115,101,32, -109,105,110,105,109,117,109,32,100,105,115,112,108,97,99,101,109,101,110,116, -32,118,101,99,116,111,114,13,10,32,32,32,32,108,111,99,97,108,32,112, -120,44,32,112,121,32,61,32,114,101,99,116,95,103,101,116,78,101,97,114, -101,115,116,67,111,114,110,101,114,40,120,44,121,44,119,44,104,44,32,48, -44,48,41,13,10,32,32,32,32,105,102,32,97,98,115,40,112,120,41,32, -60,32,97,98,115,40,112,121,41,32,116,104,101,110,32,112,121,32,61,32, -48,32,101,108,115,101,32,112,120,32,61,32,48,32,101,110,100,13,10,32, -32,32,32,110,120,44,32,110,121,32,61,32,115,105,103,110,40,112,120,41, -44,32,115,105,103,110,40,112,121,41,13,10,32,32,32,32,116,120,44,32, -116,121,32,61,32,120,49,32,43,32,112,120,44,32,121,49,32,43,32,112, -121,13,10,32,32,101,108,115,101,13,10,32,32,32,32,45,45,32,105,110, -116,101,114,115,101,99,116,105,110,103,32,97,110,100,32,109,111,118,105,110, -103,32,45,32,109,111,118,101,32,105,110,32,116,104,101,32,111,112,112,111, -115,105,116,101,32,100,105,114,101,99,116,105,111,110,13,10,32,32,32,32, -108,111,99,97,108,32,116,105,49,44,32,95,13,10,32,32,32,32,116,105, -49,44,95,44,110,120,44,110,121,32,61,32,114,101,99,116,95,103,101,116, -83,101,103,109,101,110,116,73,110,116,101,114,115,101,99,116,105,111,110,73, -110,100,105,99,101,115,40,120,44,121,44,119,44,104,44,32,48,44,48,44, -100,120,44,100,121,44,32,45,109,97,116,104,46,104,117,103,101,44,32,49, -41,13,10,32,32,32,32,105,102,32,110,111,116,32,116,105,49,32,116,104, -101,110,32,114,101,116,117,114,110,32,101,110,100,13,10,32,32,32,32,116, -120,44,32,116,121,32,61,32,120,49,32,43,32,100,120,32,42,32,116,105, -49,44,32,121,49,32,43,32,100,121,32,42,32,116,105,49,13,10,32,32, -101,110,100,13,10,32,32,101,108,115,101,32,45,45,32,116,117,110,110,101, -108,13,10,32,32,116,120,44,32,116,121,32,61,32,120,49,32,43,32,100, -120,32,42,32,116,105,44,32,121,49,32,43,32,100,121,32,42,32,116,105, -13,10,32,32,101,110,100,13,10,13,10,32,32,114,101,116,117,114,110,32, -123,13,10,32,32,111,118,101,114,108,97,112,115,32,32,61,32,111,118,101, -114,108,97,112,115,44,13,10,32,32,116,105,32,32,32,32,61,32,116,105, -44,13,10,32,32,109,111,118,101,32,32,32,32,61,32,123,120,32,61,32, -100,120,44,32,121,32,61,32,100,121,125,44,13,10,32,32,110,111,114,109, -97,108,32,32,61,32,123,120,32,61,32,110,120,44,32,121,32,61,32,110, -121,125,44,13,10,32,32,116,111,117,99,104,32,32,32,61,32,123,120,32, -61,32,116,120,44,32,121,32,61,32,116,121,125,44,13,10,32,32,105,116, -101,109,82,101,99,116,32,32,61,32,123,120,32,61,32,120,49,44,32,121, -32,61,32,121,49,44,32,119,32,61,32,119,49,44,32,104,32,61,32,104, -49,125,44,13,10,32,32,111,116,104,101,114,82,101,99,116,32,61,32,123, -120,32,61,32,120,50,44,32,121,32,61,32,121,50,44,32,119,32,61,32, -119,50,44,32,104,32,61,32,104,50,125,13,10,32,32,125,13,10,101,110, -100,13,10,13,10,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, +32,105,110,116,101,114,115,101,99,116,105,111,110,13,10,32,32,116,105,9, +9,61,32,45,119,105,32,42,32,104,105,32,45,45,32,116,105,32,105,115, +32,116,104,101,32,110,101,103,97,116,105,118,101,32,97,114,101,97,32,111, +102,32,105,110,116,101,114,115,101,99,116,105,111,110,13,10,32,32,111,118, +101,114,108,97,112,115,32,61,32,116,114,117,101,13,10,32,32,101,108,115, +101,13,10,32,32,108,111,99,97,108,32,116,105,49,44,116,105,50,44,110, +120,49,44,110,121,49,32,61,32,114,101,99,116,95,103,101,116,83,101,103, +109,101,110,116,73,110,116,101,114,115,101,99,116,105,111,110,73,110,100,105, +99,101,115,40,120,44,121,44,119,44,104,44,32,48,44,48,44,100,120,44, +100,121,44,32,45,109,97,116,104,46,104,117,103,101,44,32,109,97,116,104, +46,104,117,103,101,41,13,10,13,10,32,32,45,45,32,105,116,101,109,32, +116,117,110,110,101,108,115,32,105,110,116,111,32,111,116,104,101,114,13,10, +32,32,105,102,32,116,105,49,13,10,32,32,97,110,100,32,116,105,49,32, +60,32,49,13,10,32,32,97,110,100,32,40,97,98,115,40,116,105,49,32, +45,32,116,105,50,41,32,62,61,32,68,69,76,84,65,41,32,45,45,32, +115,112,101,99,105,97,108,32,99,97,115,101,32,102,111,114,32,114,101,99, +116,32,103,111,105,110,103,32,116,104,114,111,117,103,104,32,97,110,111,116, +104,101,114,32,114,101,99,116,39,115,32,99,111,114,110,101,114,13,10,32, +32,97,110,100,32,40,48,32,60,32,116,105,49,32,43,32,68,69,76,84, +65,13,10,9,111,114,32,48,32,61,61,32,116,105,49,32,97,110,100,32, +116,105,50,32,62,32,48,41,13,10,32,32,116,104,101,110,13,10,9,116, +105,44,32,110,120,44,32,110,121,32,61,32,116,105,49,44,32,110,120,49, +44,32,110,121,49,13,10,9,111,118,101,114,108,97,112,115,32,32,32,61, +32,102,97,108,115,101,13,10,32,32,101,110,100,13,10,32,32,101,110,100, +13,10,13,10,32,32,105,102,32,110,111,116,32,116,105,32,116,104,101,110, +32,114,101,116,117,114,110,32,101,110,100,13,10,13,10,32,32,108,111,99, +97,108,32,116,120,44,32,116,121,13,10,13,10,32,32,105,102,32,111,118, +101,114,108,97,112,115,32,116,104,101,110,13,10,32,32,105,102,32,100,120, +32,61,61,32,48,32,97,110,100,32,100,121,32,61,61,32,48,32,116,104, +101,110,13,10,9,45,45,32,105,110,116,101,114,115,101,99,116,105,110,103, +32,97,110,100,32,110,111,116,32,109,111,118,105,110,103,32,45,32,117,115, +101,32,109,105,110,105,109,117,109,32,100,105,115,112,108,97,99,101,109,101, +110,116,32,118,101,99,116,111,114,13,10,9,108,111,99,97,108,32,112,120, +44,32,112,121,32,61,32,114,101,99,116,95,103,101,116,78,101,97,114,101, +115,116,67,111,114,110,101,114,40,120,44,121,44,119,44,104,44,32,48,44, +48,41,13,10,9,105,102,32,97,98,115,40,112,120,41,32,60,32,97,98, +115,40,112,121,41,32,116,104,101,110,32,112,121,32,61,32,48,32,101,108, +115,101,32,112,120,32,61,32,48,32,101,110,100,13,10,9,110,120,44,32, +110,121,32,61,32,115,105,103,110,40,112,120,41,44,32,115,105,103,110,40, +112,121,41,13,10,9,116,120,44,32,116,121,32,61,32,120,49,32,43,32, +112,120,44,32,121,49,32,43,32,112,121,13,10,32,32,101,108,115,101,13, +10,9,45,45,32,105,110,116,101,114,115,101,99,116,105,110,103,32,97,110, +100,32,109,111,118,105,110,103,32,45,32,109,111,118,101,32,105,110,32,116, +104,101,32,111,112,112,111,115,105,116,101,32,100,105,114,101,99,116,105,111, +110,13,10,9,108,111,99,97,108,32,116,105,49,44,32,95,13,10,9,116, +105,49,44,95,44,110,120,44,110,121,32,61,32,114,101,99,116,95,103,101, +116,83,101,103,109,101,110,116,73,110,116,101,114,115,101,99,116,105,111,110, +73,110,100,105,99,101,115,40,120,44,121,44,119,44,104,44,32,48,44,48, +44,100,120,44,100,121,44,32,45,109,97,116,104,46,104,117,103,101,44,32, +49,41,13,10,9,105,102,32,110,111,116,32,116,105,49,32,116,104,101,110, +32,114,101,116,117,114,110,32,101,110,100,13,10,9,116,120,44,32,116,121, +32,61,32,120,49,32,43,32,100,120,32,42,32,116,105,49,44,32,121,49, +32,43,32,100,121,32,42,32,116,105,49,13,10,32,32,101,110,100,13,10, +32,32,101,108,115,101,32,45,45,32,116,117,110,110,101,108,13,10,32,32, +116,120,44,32,116,121,32,61,32,120,49,32,43,32,100,120,32,42,32,116, +105,44,32,121,49,32,43,32,100,121,32,42,32,116,105,13,10,32,32,101, +110,100,13,10,13,10,32,32,114,101,116,117,114,110,32,123,13,10,32,32, +111,118,101,114,108,97,112,115,32,32,61,32,111,118,101,114,108,97,112,115, +44,13,10,32,32,116,105,9,61,32,116,105,44,13,10,32,32,109,111,118, +101,9,61,32,123,120,32,61,32,100,120,44,32,121,32,61,32,100,121,125, +44,13,10,32,32,110,111,114,109,97,108,32,32,61,32,123,120,32,61,32, +110,120,44,32,121,32,61,32,110,121,125,44,13,10,32,32,116,111,117,99, +104,32,32,32,61,32,123,120,32,61,32,116,120,44,32,121,32,61,32,116, +121,125,44,13,10,32,32,105,116,101,109,82,101,99,116,32,32,61,32,123, +120,32,61,32,120,49,44,32,121,32,61,32,121,49,44,32,119,32,61,32, +119,49,44,32,104,32,61,32,104,49,125,44,13,10,32,32,111,116,104,101, +114,82,101,99,116,32,61,32,123,120,32,61,32,120,50,44,32,121,32,61, +32,121,50,44,32,119,32,61,32,119,50,44,32,104,32,61,32,104,50,125, +13,10,32,32,125,13,10,101,110,100,13,10,13,10,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, -45,45,45,45,45,45,45,13,10,45,45,32,71,114,105,100,32,102,117,110, -99,116,105,111,110,115,13,10,45,45,45,45,45,45,45,45,45,45,45,45, +45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,13,10,45,45, +32,71,114,105,100,32,102,117,110,99,116,105,111,110,115,13,10,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, -45,45,45,45,45,45,45,45,45,45,13,10,13,10,108,111,99,97,108,32, -102,117,110,99,116,105,111,110,32,103,114,105,100,95,116,111,87,111,114,108, -100,40,99,101,108,108,83,105,122,101,44,32,99,120,44,32,99,121,41,13, -10,32,32,114,101,116,117,114,110,32,40,99,120,32,45,32,49,41,42,99, -101,108,108,83,105,122,101,44,32,40,99,121,45,49,41,42,99,101,108,108, -83,105,122,101,13,10,101,110,100,13,10,13,10,108,111,99,97,108,32,102, -117,110,99,116,105,111,110,32,103,114,105,100,95,116,111,67,101,108,108,40, -99,101,108,108,83,105,122,101,44,32,120,44,32,121,41,13,10,32,32,114, -101,116,117,114,110,32,102,108,111,111,114,40,120,32,47,32,99,101,108,108, -83,105,122,101,41,32,43,32,49,44,32,102,108,111,111,114,40,121,32,47, -32,99,101,108,108,83,105,122,101,41,32,43,32,49,13,10,101,110,100,13, -10,13,10,45,45,32,103,114,105,100,95,116,114,97,118,101,114,115,101,42, -32,102,117,110,99,116,105,111,110,115,32,97,114,101,32,98,97,115,101,100, -32,111,110,32,34,65,32,70,97,115,116,32,86,111,120,101,108,32,84,114, -97,118,101,114,115,97,108,32,65,108,103,111,114,105,116,104,109,32,102,111, -114,32,82,97,121,32,84,114,97,99,105,110,103,34,44,13,10,45,45,32, -98,121,32,74,111,104,110,32,65,109,97,110,105,100,101,115,32,97,110,100, -32,65,110,100,114,101,119,32,87,111,111,32,45,32,104,116,116,112,58,47, -47,119,119,119,46,99,115,101,46,121,111,114,107,117,46,99,97,47,126,97, -109,97,110,97,47,114,101,115,101,97,114,99,104,47,103,114,105,100,46,112, -100,102,13,10,45,45,32,73,116,32,104,97,115,32,98,101,101,110,32,109, -111,100,105,102,105,101,100,32,116,111,32,105,110,99,108,117,100,101,32,98, -111,116,104,32,99,101,108,108,115,32,119,104,101,110,32,116,104,101,32,114, -97,121,32,34,116,111,117,99,104,101,115,32,97,32,103,114,105,100,32,99, -111,114,110,101,114,34,44,13,10,45,45,32,97,110,100,32,119,105,116,104, -32,97,32,100,105,102,102,101,114,101,110,116,32,101,120,105,116,32,99,111, -110,100,105,116,105,111,110,13,10,13,10,108,111,99,97,108,32,102,117,110, -99,116,105,111,110,32,103,114,105,100,95,116,114,97,118,101,114,115,101,95, -105,110,105,116,83,116,101,112,40,99,101,108,108,83,105,122,101,44,32,99, -116,44,32,116,49,44,32,116,50,41,13,10,32,32,108,111,99,97,108,32, -118,32,61,32,116,50,32,45,32,116,49,13,10,32,32,105,102,32,32,32, -118,32,62,32,48,32,116,104,101,110,13,10,32,32,114,101,116,117,114,110, -32,32,49,44,32,32,99,101,108,108,83,105,122,101,32,47,32,118,44,32, -40,40,99,116,32,43,32,118,41,32,42,32,99,101,108,108,83,105,122,101, -32,45,32,116,49,41,32,47,32,118,13,10,32,32,101,108,115,101,105,102, -32,118,32,60,32,48,32,116,104,101,110,13,10,32,32,114,101,116,117,114, -110,32,45,49,44,32,45,99,101,108,108,83,105,122,101,32,47,32,118,44, -32,40,40,99,116,32,43,32,118,32,45,32,49,41,32,42,32,99,101,108, -108,83,105,122,101,32,45,32,116,49,41,32,47,32,118,13,10,32,32,101, -108,115,101,13,10,32,32,114,101,116,117,114,110,32,48,44,32,109,97,116, -104,46,104,117,103,101,44,32,109,97,116,104,46,104,117,103,101,13,10,32, -32,101,110,100,13,10,101,110,100,13,10,13,10,108,111,99,97,108,32,102, -117,110,99,116,105,111,110,32,103,114,105,100,95,116,114,97,118,101,114,115, -101,40,99,101,108,108,83,105,122,101,44,32,120,49,44,121,49,44,120,50, -44,121,50,44,32,102,41,13,10,32,32,108,111,99,97,108,32,99,120,49, -44,99,121,49,32,32,32,32,61,32,103,114,105,100,95,116,111,67,101,108, -108,40,99,101,108,108,83,105,122,101,44,32,120,49,44,121,49,41,13,10, -32,32,108,111,99,97,108,32,99,120,50,44,99,121,50,32,32,32,32,61, -32,103,114,105,100,95,116,111,67,101,108,108,40,99,101,108,108,83,105,122, -101,44,32,120,50,44,121,50,41,13,10,32,32,108,111,99,97,108,32,115, -116,101,112,88,44,32,100,120,44,32,116,120,32,32,61,32,103,114,105,100, -95,116,114,97,118,101,114,115,101,95,105,110,105,116,83,116,101,112,40,99, -101,108,108,83,105,122,101,44,32,99,120,49,44,32,120,49,44,32,120,50, -41,13,10,32,32,108,111,99,97,108,32,115,116,101,112,89,44,32,100,121, -44,32,116,121,32,32,61,32,103,114,105,100,95,116,114,97,118,101,114,115, -101,95,105,110,105,116,83,116,101,112,40,99,101,108,108,83,105,122,101,44, -32,99,121,49,44,32,121,49,44,32,121,50,41,13,10,32,32,108,111,99, -97,108,32,99,120,44,99,121,32,32,32,32,32,32,61,32,99,120,49,44, +45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,13, +10,13,10,108,111,99,97,108,32,102,117,110,99,116,105,111,110,32,103,114, +105,100,95,116,111,87,111,114,108,100,40,99,101,108,108,83,105,122,101,44, +32,99,120,44,32,99,121,41,13,10,32,32,114,101,116,117,114,110,32,40, +99,120,32,45,32,49,41,42,99,101,108,108,83,105,122,101,44,32,40,99, +121,45,49,41,42,99,101,108,108,83,105,122,101,13,10,101,110,100,13,10, +13,10,108,111,99,97,108,32,102,117,110,99,116,105,111,110,32,103,114,105, +100,95,116,111,67,101,108,108,40,99,101,108,108,83,105,122,101,44,32,120, +44,32,121,41,13,10,32,32,114,101,116,117,114,110,32,102,108,111,111,114, +40,120,32,47,32,99,101,108,108,83,105,122,101,41,32,43,32,49,44,32, +102,108,111,111,114,40,121,32,47,32,99,101,108,108,83,105,122,101,41,32, +43,32,49,13,10,101,110,100,13,10,13,10,45,45,32,103,114,105,100,95, +116,114,97,118,101,114,115,101,42,32,102,117,110,99,116,105,111,110,115,32, +97,114,101,32,98,97,115,101,100,32,111,110,32,34,65,32,70,97,115,116, +32,86,111,120,101,108,32,84,114,97,118,101,114,115,97,108,32,65,108,103, +111,114,105,116,104,109,32,102,111,114,32,82,97,121,32,84,114,97,99,105, +110,103,34,44,13,10,45,45,32,98,121,32,74,111,104,110,32,65,109,97, +110,105,100,101,115,32,97,110,100,32,65,110,100,114,101,119,32,87,111,111, +32,45,32,104,116,116,112,58,47,47,119,119,119,46,99,115,101,46,121,111, +114,107,117,46,99,97,47,126,97,109,97,110,97,47,114,101,115,101,97,114, +99,104,47,103,114,105,100,46,112,100,102,13,10,45,45,32,73,116,32,104, +97,115,32,98,101,101,110,32,109,111,100,105,102,105,101,100,32,116,111,32, +105,110,99,108,117,100,101,32,98,111,116,104,32,99,101,108,108,115,32,119, +104,101,110,32,116,104,101,32,114,97,121,32,34,116,111,117,99,104,101,115, +32,97,32,103,114,105,100,32,99,111,114,110,101,114,34,44,13,10,45,45, +32,97,110,100,32,119,105,116,104,32,97,32,100,105,102,102,101,114,101,110, +116,32,101,120,105,116,32,99,111,110,100,105,116,105,111,110,13,10,13,10, +108,111,99,97,108,32,102,117,110,99,116,105,111,110,32,103,114,105,100,95, +116,114,97,118,101,114,115,101,95,105,110,105,116,83,116,101,112,40,99,101, +108,108,83,105,122,101,44,32,99,116,44,32,116,49,44,32,116,50,41,13, +10,32,32,108,111,99,97,108,32,118,32,61,32,116,50,32,45,32,116,49, +13,10,32,32,105,102,32,32,32,118,32,62,32,48,32,116,104,101,110,13, +10,32,32,114,101,116,117,114,110,32,32,49,44,32,32,99,101,108,108,83, +105,122,101,32,47,32,118,44,32,40,40,99,116,32,43,32,118,41,32,42, +32,99,101,108,108,83,105,122,101,32,45,32,116,49,41,32,47,32,118,13, +10,32,32,101,108,115,101,105,102,32,118,32,60,32,48,32,116,104,101,110, +13,10,32,32,114,101,116,117,114,110,32,45,49,44,32,45,99,101,108,108, +83,105,122,101,32,47,32,118,44,32,40,40,99,116,32,43,32,118,32,45, +32,49,41,32,42,32,99,101,108,108,83,105,122,101,32,45,32,116,49,41, +32,47,32,118,13,10,32,32,101,108,115,101,13,10,32,32,114,101,116,117, +114,110,32,48,44,32,109,97,116,104,46,104,117,103,101,44,32,109,97,116, +104,46,104,117,103,101,13,10,32,32,101,110,100,13,10,101,110,100,13,10, +13,10,108,111,99,97,108,32,102,117,110,99,116,105,111,110,32,103,114,105, +100,95,116,114,97,118,101,114,115,101,40,99,101,108,108,83,105,122,101,44, +32,120,49,44,121,49,44,120,50,44,121,50,44,32,102,41,13,10,32,32, +108,111,99,97,108,32,99,120,49,44,99,121,49,9,61,32,103,114,105,100, +95,116,111,67,101,108,108,40,99,101,108,108,83,105,122,101,44,32,120,49, +44,121,49,41,13,10,32,32,108,111,99,97,108,32,99,120,50,44,99,121, +50,9,61,32,103,114,105,100,95,116,111,67,101,108,108,40,99,101,108,108, +83,105,122,101,44,32,120,50,44,121,50,41,13,10,32,32,108,111,99,97, +108,32,115,116,101,112,88,44,32,100,120,44,32,116,120,32,32,61,32,103, +114,105,100,95,116,114,97,118,101,114,115,101,95,105,110,105,116,83,116,101, +112,40,99,101,108,108,83,105,122,101,44,32,99,120,49,44,32,120,49,44, +32,120,50,41,13,10,32,32,108,111,99,97,108,32,115,116,101,112,89,44, +32,100,121,44,32,116,121,32,32,61,32,103,114,105,100,95,116,114,97,118, +101,114,115,101,95,105,110,105,116,83,116,101,112,40,99,101,108,108,83,105, +122,101,44,32,99,121,49,44,32,121,49,44,32,121,50,41,13,10,32,32, +108,111,99,97,108,32,99,120,44,99,121,9,32,32,61,32,99,120,49,44, 99,121,49,13,10,13,10,32,32,102,40,99,120,44,32,99,121,41,13,10, 13,10,32,32,45,45,32,84,104,101,32,100,101,102,97,117,108,116,32,105, 109,112,108,101,109,101,110,116,97,116,105,111,110,32,104,97,100,32,97,110, @@ -348,524 +342,515 @@ static char physics_lua[] = { 108,13,10,32,32,119,104,105,108,101,32,97,98,115,40,99,120,32,45,32, 99,120,50,41,32,43,32,97,98,115,40,99,121,32,45,32,99,121,50,41, 32,62,32,49,32,100,111,13,10,32,32,105,102,32,116,120,32,60,32,116, -121,32,116,104,101,110,13,10,32,32,32,32,116,120,44,32,99,120,32,61, -32,116,120,32,43,32,100,120,44,32,99,120,32,43,32,115,116,101,112,88, -13,10,32,32,32,32,102,40,99,120,44,32,99,121,41,13,10,32,32,101, -108,115,101,13,10,32,32,32,32,45,45,32,65,100,100,105,116,105,111,110, -58,32,105,110,99,108,117,100,101,32,98,111,116,104,32,99,101,108,108,115, -32,119,104,101,110,32,103,111,105,110,103,32,116,104,114,111,117,103,104,32, -99,111,114,110,101,114,115,13,10,32,32,32,32,105,102,32,116,120,32,61, -61,32,116,121,32,116,104,101,110,32,102,40,99,120,32,43,32,115,116,101, -112,88,44,32,99,121,41,32,101,110,100,13,10,32,32,32,32,116,121,44, -32,99,121,32,61,32,116,121,32,43,32,100,121,44,32,99,121,32,43,32, -115,116,101,112,89,13,10,32,32,32,32,102,40,99,120,44,32,99,121,41, -13,10,32,32,101,110,100,13,10,32,32,101,110,100,13,10,13,10,32,32, -45,45,32,73,102,32,119,101,32,104,97,118,101,32,110,111,116,32,97,114, -114,105,118,101,100,32,116,111,32,116,104,101,32,108,97,115,116,32,99,101, -108,108,44,32,117,115,101,32,105,116,13,10,32,32,105,102,32,99,120,32, -126,61,32,99,120,50,32,111,114,32,99,121,32,126,61,32,99,121,50,32, -116,104,101,110,32,102,40,99,120,50,44,32,99,121,50,41,32,101,110,100, -13,10,13,10,101,110,100,13,10,13,10,108,111,99,97,108,32,102,117,110, -99,116,105,111,110,32,103,114,105,100,95,116,111,67,101,108,108,82,101,99, -116,40,99,101,108,108,83,105,122,101,44,32,120,44,121,44,119,44,104,41, -13,10,32,32,108,111,99,97,108,32,99,120,44,99,121,32,61,32,103,114, -105,100,95,116,111,67,101,108,108,40,99,101,108,108,83,105,122,101,44,32, -120,44,32,121,41,13,10,32,32,108,111,99,97,108,32,99,114,44,99,98, -32,61,32,99,101,105,108,40,40,120,43,119,41,32,47,32,99,101,108,108, -83,105,122,101,41,44,32,99,101,105,108,40,40,121,43,104,41,32,47,32, -99,101,108,108,83,105,122,101,41,13,10,32,32,114,101,116,117,114,110,32, -99,120,44,32,99,121,44,32,99,114,32,45,32,99,120,32,43,32,49,44, -32,99,98,32,45,32,99,121,32,43,32,49,13,10,101,110,100,13,10,13, -10,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, -45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, -45,45,45,13,10,45,45,32,82,101,115,112,111,110,115,101,115,13,10,45, +121,32,116,104,101,110,13,10,9,116,120,44,32,99,120,32,61,32,116,120, +32,43,32,100,120,44,32,99,120,32,43,32,115,116,101,112,88,13,10,9, +102,40,99,120,44,32,99,121,41,13,10,32,32,101,108,115,101,13,10,9, +45,45,32,65,100,100,105,116,105,111,110,58,32,105,110,99,108,117,100,101, +32,98,111,116,104,32,99,101,108,108,115,32,119,104,101,110,32,103,111,105, +110,103,32,116,104,114,111,117,103,104,32,99,111,114,110,101,114,115,13,10, +9,105,102,32,116,120,32,61,61,32,116,121,32,116,104,101,110,32,102,40, +99,120,32,43,32,115,116,101,112,88,44,32,99,121,41,32,101,110,100,13, +10,9,116,121,44,32,99,121,32,61,32,116,121,32,43,32,100,121,44,32, +99,121,32,43,32,115,116,101,112,89,13,10,9,102,40,99,120,44,32,99, +121,41,13,10,32,32,101,110,100,13,10,32,32,101,110,100,13,10,13,10, +32,32,45,45,32,73,102,32,119,101,32,104,97,118,101,32,110,111,116,32, +97,114,114,105,118,101,100,32,116,111,32,116,104,101,32,108,97,115,116,32, +99,101,108,108,44,32,117,115,101,32,105,116,13,10,32,32,105,102,32,99, +120,32,126,61,32,99,120,50,32,111,114,32,99,121,32,126,61,32,99,121, +50,32,116,104,101,110,32,102,40,99,120,50,44,32,99,121,50,41,32,101, +110,100,13,10,13,10,101,110,100,13,10,13,10,108,111,99,97,108,32,102, +117,110,99,116,105,111,110,32,103,114,105,100,95,116,111,67,101,108,108,82, +101,99,116,40,99,101,108,108,83,105,122,101,44,32,120,44,121,44,119,44, +104,41,13,10,32,32,108,111,99,97,108,32,99,120,44,99,121,32,61,32, +103,114,105,100,95,116,111,67,101,108,108,40,99,101,108,108,83,105,122,101, +44,32,120,44,32,121,41,13,10,32,32,108,111,99,97,108,32,99,114,44, +99,98,32,61,32,99,101,105,108,40,40,120,43,119,41,32,47,32,99,101, +108,108,83,105,122,101,41,44,32,99,101,105,108,40,40,121,43,104,41,32, +47,32,99,101,108,108,83,105,122,101,41,13,10,32,32,114,101,116,117,114, +110,32,99,120,44,32,99,121,44,32,99,114,32,45,32,99,120,32,43,32, +49,44,32,99,98,32,45,32,99,121,32,43,32,49,13,10,101,110,100,13, +10,13,10,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, +45,45,45,45,45,13,10,45,45,32,82,101,115,112,111,110,115,101,115,13, +10,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, -45,13,10,13,10,108,111,99,97,108,32,116,111,117,99,104,32,61,32,102, -117,110,99,116,105,111,110,40,119,111,114,108,100,44,32,99,111,108,44,32, -120,44,121,44,119,44,104,44,32,103,111,97,108,88,44,32,103,111,97,108, -89,44,32,102,105,108,116,101,114,41,13,10,32,32,114,101,116,117,114,110, -32,99,111,108,46,116,111,117,99,104,46,120,44,32,99,111,108,46,116,111, -117,99,104,46,121,44,32,123,125,44,32,48,13,10,101,110,100,13,10,13, -10,108,111,99,97,108,32,99,114,111,115,115,32,61,32,102,117,110,99,116, -105,111,110,40,119,111,114,108,100,44,32,99,111,108,44,32,120,44,121,44, -119,44,104,44,32,103,111,97,108,88,44,32,103,111,97,108,89,44,32,102, -105,108,116,101,114,41,13,10,32,32,108,111,99,97,108,32,99,111,108,115, -44,32,108,101,110,32,61,32,119,111,114,108,100,58,112,114,111,106,101,99, +45,45,45,13,10,13,10,108,111,99,97,108,32,116,111,117,99,104,32,61, +32,102,117,110,99,116,105,111,110,40,119,111,114,108,100,44,32,99,111,108, +44,32,120,44,121,44,119,44,104,44,32,103,111,97,108,88,44,32,103,111, +97,108,89,44,32,102,105,108,116,101,114,41,13,10,32,32,114,101,116,117, +114,110,32,99,111,108,46,116,111,117,99,104,46,120,44,32,99,111,108,46, +116,111,117,99,104,46,121,44,32,123,125,44,32,48,13,10,101,110,100,13, +10,13,10,108,111,99,97,108,32,99,114,111,115,115,32,61,32,102,117,110, +99,116,105,111,110,40,119,111,114,108,100,44,32,99,111,108,44,32,120,44, +121,44,119,44,104,44,32,103,111,97,108,88,44,32,103,111,97,108,89,44, +32,102,105,108,116,101,114,41,13,10,32,32,108,111,99,97,108,32,99,111, +108,115,44,32,108,101,110,32,61,32,119,111,114,108,100,58,112,114,111,106, +101,99,116,40,99,111,108,46,105,116,101,109,44,32,120,44,121,44,119,44, +104,44,32,103,111,97,108,88,44,32,103,111,97,108,89,44,32,102,105,108, +116,101,114,41,13,10,32,32,114,101,116,117,114,110,32,103,111,97,108,88, +44,32,103,111,97,108,89,44,32,99,111,108,115,44,32,108,101,110,13,10, +101,110,100,13,10,13,10,108,111,99,97,108,32,115,108,105,100,101,32,61, +32,102,117,110,99,116,105,111,110,40,119,111,114,108,100,44,32,99,111,108, +44,32,120,44,121,44,119,44,104,44,32,103,111,97,108,88,44,32,103,111, +97,108,89,44,32,102,105,108,116,101,114,41,13,10,32,32,103,111,97,108, +88,32,61,32,103,111,97,108,88,32,111,114,32,120,13,10,32,32,103,111, +97,108,89,32,61,32,103,111,97,108,89,32,111,114,32,121,13,10,13,10, +32,32,108,111,99,97,108,32,116,99,104,44,32,109,111,118,101,32,32,61, +32,99,111,108,46,116,111,117,99,104,44,32,99,111,108,46,109,111,118,101, +13,10,32,32,105,102,32,109,111,118,101,46,120,32,126,61,32,48,32,111, +114,32,109,111,118,101,46,121,32,126,61,32,48,32,116,104,101,110,13,10, +32,32,105,102,32,99,111,108,46,110,111,114,109,97,108,46,120,32,126,61, +32,48,32,116,104,101,110,13,10,9,103,111,97,108,88,32,61,32,116,99, +104,46,120,13,10,32,32,101,108,115,101,13,10,9,103,111,97,108,89,32, +61,32,116,99,104,46,121,13,10,32,32,101,110,100,13,10,32,32,101,110, +100,13,10,13,10,32,32,99,111,108,46,115,108,105,100,101,32,61,32,123, +120,32,61,32,103,111,97,108,88,44,32,121,32,61,32,103,111,97,108,89, +125,13,10,13,10,32,32,120,44,121,32,61,32,116,99,104,46,120,44,32, +116,99,104,46,121,13,10,32,32,108,111,99,97,108,32,99,111,108,115,44, +32,108,101,110,32,32,61,32,119,111,114,108,100,58,112,114,111,106,101,99, 116,40,99,111,108,46,105,116,101,109,44,32,120,44,121,44,119,44,104,44, 32,103,111,97,108,88,44,32,103,111,97,108,89,44,32,102,105,108,116,101, 114,41,13,10,32,32,114,101,116,117,114,110,32,103,111,97,108,88,44,32, 103,111,97,108,89,44,32,99,111,108,115,44,32,108,101,110,13,10,101,110, -100,13,10,13,10,108,111,99,97,108,32,115,108,105,100,101,32,61,32,102, -117,110,99,116,105,111,110,40,119,111,114,108,100,44,32,99,111,108,44,32, -120,44,121,44,119,44,104,44,32,103,111,97,108,88,44,32,103,111,97,108, -89,44,32,102,105,108,116,101,114,41,13,10,32,32,103,111,97,108,88,32, -61,32,103,111,97,108,88,32,111,114,32,120,13,10,32,32,103,111,97,108, -89,32,61,32,103,111,97,108,89,32,111,114,32,121,13,10,13,10,32,32, -108,111,99,97,108,32,116,99,104,44,32,109,111,118,101,32,32,61,32,99, +100,13,10,13,10,108,111,99,97,108,32,98,111,117,110,99,101,32,61,32, +102,117,110,99,116,105,111,110,40,119,111,114,108,100,44,32,99,111,108,44, +32,120,44,121,44,119,44,104,44,32,103,111,97,108,88,44,32,103,111,97, +108,89,44,32,102,105,108,116,101,114,41,13,10,32,32,103,111,97,108,88, +32,61,32,103,111,97,108,88,32,111,114,32,120,13,10,32,32,103,111,97, +108,89,32,61,32,103,111,97,108,89,32,111,114,32,121,13,10,13,10,32, +32,108,111,99,97,108,32,116,99,104,44,32,109,111,118,101,32,61,32,99, 111,108,46,116,111,117,99,104,44,32,99,111,108,46,109,111,118,101,13,10, +32,32,108,111,99,97,108,32,116,120,44,32,116,121,32,61,32,116,99,104, +46,120,44,32,116,99,104,46,121,13,10,13,10,32,32,108,111,99,97,108, +32,98,120,44,32,98,121,32,61,32,116,120,44,32,116,121,13,10,13,10, 32,32,105,102,32,109,111,118,101,46,120,32,126,61,32,48,32,111,114,32, 109,111,118,101,46,121,32,126,61,32,48,32,116,104,101,110,13,10,32,32, -105,102,32,99,111,108,46,110,111,114,109,97,108,46,120,32,126,61,32,48, -32,116,104,101,110,13,10,32,32,32,32,103,111,97,108,88,32,61,32,116, -99,104,46,120,13,10,32,32,101,108,115,101,13,10,32,32,32,32,103,111, -97,108,89,32,61,32,116,99,104,46,121,13,10,32,32,101,110,100,13,10, -32,32,101,110,100,13,10,13,10,32,32,99,111,108,46,115,108,105,100,101, -32,61,32,123,120,32,61,32,103,111,97,108,88,44,32,121,32,61,32,103, -111,97,108,89,125,13,10,13,10,32,32,120,44,121,32,61,32,116,99,104, -46,120,44,32,116,99,104,46,121,13,10,32,32,108,111,99,97,108,32,99, -111,108,115,44,32,108,101,110,32,32,61,32,119,111,114,108,100,58,112,114, -111,106,101,99,116,40,99,111,108,46,105,116,101,109,44,32,120,44,121,44, -119,44,104,44,32,103,111,97,108,88,44,32,103,111,97,108,89,44,32,102, -105,108,116,101,114,41,13,10,32,32,114,101,116,117,114,110,32,103,111,97, -108,88,44,32,103,111,97,108,89,44,32,99,111,108,115,44,32,108,101,110, -13,10,101,110,100,13,10,13,10,108,111,99,97,108,32,98,111,117,110,99, -101,32,61,32,102,117,110,99,116,105,111,110,40,119,111,114,108,100,44,32, -99,111,108,44,32,120,44,121,44,119,44,104,44,32,103,111,97,108,88,44, -32,103,111,97,108,89,44,32,102,105,108,116,101,114,41,13,10,32,32,103, -111,97,108,88,32,61,32,103,111,97,108,88,32,111,114,32,120,13,10,32, -32,103,111,97,108,89,32,61,32,103,111,97,108,89,32,111,114,32,121,13, -10,13,10,32,32,108,111,99,97,108,32,116,99,104,44,32,109,111,118,101, -32,61,32,99,111,108,46,116,111,117,99,104,44,32,99,111,108,46,109,111, -118,101,13,10,32,32,108,111,99,97,108,32,116,120,44,32,116,121,32,61, -32,116,99,104,46,120,44,32,116,99,104,46,121,13,10,13,10,32,32,108, -111,99,97,108,32,98,120,44,32,98,121,32,61,32,116,120,44,32,116,121, -13,10,13,10,32,32,105,102,32,109,111,118,101,46,120,32,126,61,32,48, -32,111,114,32,109,111,118,101,46,121,32,126,61,32,48,32,116,104,101,110, -13,10,32,32,108,111,99,97,108,32,98,110,120,44,32,98,110,121,32,61, -32,103,111,97,108,88,32,45,32,116,120,44,32,103,111,97,108,89,32,45, -32,116,121,13,10,32,32,105,102,32,99,111,108,46,110,111,114,109,97,108, -46,120,32,61,61,32,48,32,116,104,101,110,32,98,110,121,32,61,32,45, -98,110,121,32,101,108,115,101,32,98,110,120,32,61,32,45,98,110,120,32, -101,110,100,13,10,32,32,98,120,44,32,98,121,32,61,32,116,120,32,43, -32,98,110,120,44,32,116,121,32,43,32,98,110,121,13,10,32,32,101,110, -100,13,10,13,10,32,32,99,111,108,46,98,111,117,110,99,101,32,32,32, -61,32,123,120,32,61,32,98,120,44,32,32,121,32,61,32,98,121,125,13, -10,32,32,120,44,121,32,32,32,32,32,32,61,32,116,99,104,46,120,44, -32,116,99,104,46,121,13,10,32,32,103,111,97,108,88,44,32,103,111,97, -108,89,32,61,32,98,120,44,32,98,121,13,10,13,10,32,32,108,111,99, -97,108,32,99,111,108,115,44,32,108,101,110,32,32,61,32,119,111,114,108, -100,58,112,114,111,106,101,99,116,40,99,111,108,46,105,116,101,109,44,32, -120,44,121,44,119,44,104,44,32,103,111,97,108,88,44,32,103,111,97,108, -89,44,32,102,105,108,116,101,114,41,13,10,32,32,114,101,116,117,114,110, -32,103,111,97,108,88,44,32,103,111,97,108,89,44,32,99,111,108,115,44, -32,108,101,110,13,10,101,110,100,13,10,13,10,45,45,45,45,45,45,45, +108,111,99,97,108,32,98,110,120,44,32,98,110,121,32,61,32,103,111,97, +108,88,32,45,32,116,120,44,32,103,111,97,108,89,32,45,32,116,121,13, +10,32,32,105,102,32,99,111,108,46,110,111,114,109,97,108,46,120,32,61, +61,32,48,32,116,104,101,110,32,98,110,121,32,61,32,45,98,110,121,32, +101,108,115,101,32,98,110,120,32,61,32,45,98,110,120,32,101,110,100,13, +10,32,32,98,120,44,32,98,121,32,61,32,116,120,32,43,32,98,110,120, +44,32,116,121,32,43,32,98,110,121,13,10,32,32,101,110,100,13,10,13, +10,32,32,99,111,108,46,98,111,117,110,99,101,32,32,32,61,32,123,120, +32,61,32,98,120,44,32,32,121,32,61,32,98,121,125,13,10,32,32,120, +44,121,9,32,32,61,32,116,99,104,46,120,44,32,116,99,104,46,121,13, +10,32,32,103,111,97,108,88,44,32,103,111,97,108,89,32,61,32,98,120, +44,32,98,121,13,10,13,10,32,32,108,111,99,97,108,32,99,111,108,115, +44,32,108,101,110,32,32,61,32,119,111,114,108,100,58,112,114,111,106,101, +99,116,40,99,111,108,46,105,116,101,109,44,32,120,44,121,44,119,44,104, +44,32,103,111,97,108,88,44,32,103,111,97,108,89,44,32,102,105,108,116, +101,114,41,13,10,32,32,114,101,116,117,114,110,32,103,111,97,108,88,44, +32,103,111,97,108,89,44,32,99,111,108,115,44,32,108,101,110,13,10,101, +110,100,13,10,13,10,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, -45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,13,10,45,45,32, -87,111,114,108,100,13,10,45,45,45,45,45,45,45,45,45,45,45,45,45, +45,45,45,45,45,45,45,45,13,10,45,45,32,87,111,114,108,100,13,10, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, -45,45,45,45,45,45,45,45,45,13,10,13,10,108,111,99,97,108,32,87, -111,114,108,100,32,61,32,123,125,13,10,108,111,99,97,108,32,87,111,114, -108,100,95,109,116,32,61,32,123,95,95,105,110,100,101,120,32,61,32,87, -111,114,108,100,125,13,10,13,10,45,45,32,80,114,105,118,97,116,101,32, -102,117,110,99,116,105,111,110,115,32,97,110,100,32,109,101,116,104,111,100, -115,13,10,13,10,108,111,99,97,108,32,102,117,110,99,116,105,111,110,32, -115,111,114,116,66,121,87,101,105,103,104,116,40,97,44,98,41,32,114,101, -116,117,114,110,32,97,46,119,101,105,103,104,116,32,60,32,98,46,119,101, -105,103,104,116,32,101,110,100,13,10,13,10,108,111,99,97,108,32,102,117, -110,99,116,105,111,110,32,115,111,114,116,66,121,84,105,65,110,100,68,105, -115,116,97,110,99,101,40,97,44,98,41,13,10,32,32,105,102,32,97,46, -116,105,32,61,61,32,98,46,116,105,32,116,104,101,110,13,10,32,32,108, -111,99,97,108,32,105,114,44,32,97,114,44,32,98,114,32,61,32,97,46, -105,116,101,109,82,101,99,116,44,32,97,46,111,116,104,101,114,82,101,99, -116,44,32,98,46,111,116,104,101,114,82,101,99,116,13,10,32,32,108,111, -99,97,108,32,97,100,32,61,32,114,101,99,116,95,103,101,116,83,113,117, -97,114,101,68,105,115,116,97,110,99,101,40,105,114,46,120,44,105,114,46, -121,44,105,114,46,119,44,105,114,46,104,44,32,97,114,46,120,44,97,114, -46,121,44,97,114,46,119,44,97,114,46,104,41,13,10,32,32,108,111,99, -97,108,32,98,100,32,61,32,114,101,99,116,95,103,101,116,83,113,117,97, -114,101,68,105,115,116,97,110,99,101,40,105,114,46,120,44,105,114,46,121, -44,105,114,46,119,44,105,114,46,104,44,32,98,114,46,120,44,98,114,46, -121,44,98,114,46,119,44,98,114,46,104,41,13,10,32,32,114,101,116,117, -114,110,32,97,100,32,60,32,98,100,13,10,32,32,101,110,100,13,10,32, -32,114,101,116,117,114,110,32,97,46,116,105,32,60,32,98,46,116,105,13, -10,101,110,100,13,10,13,10,108,111,99,97,108,32,102,117,110,99,116,105, -111,110,32,97,100,100,73,116,101,109,84,111,67,101,108,108,40,115,101,108, -102,44,32,105,116,101,109,44,32,99,120,44,32,99,121,41,13,10,32,32, -115,101,108,102,46,114,111,119,115,91,99,121,93,32,61,32,115,101,108,102, -46,114,111,119,115,91,99,121,93,32,111,114,32,115,101,116,109,101,116,97, -116,97,98,108,101,40,123,125,44,32,123,95,95,109,111,100,101,32,61,32, -39,118,39,125,41,13,10,32,32,108,111,99,97,108,32,114,111,119,32,61, -32,115,101,108,102,46,114,111,119,115,91,99,121,93,13,10,32,32,114,111, -119,91,99,120,93,32,61,32,114,111,119,91,99,120,93,32,111,114,32,123, -105,116,101,109,67,111,117,110,116,32,61,32,48,44,32,120,32,61,32,99, -120,44,32,121,32,61,32,99,121,44,32,105,116,101,109,115,32,61,32,115, -101,116,109,101,116,97,116,97,98,108,101,40,123,125,44,32,123,95,95,109, -111,100,101,32,61,32,39,107,39,125,41,125,13,10,32,32,108,111,99,97, -108,32,99,101,108,108,32,61,32,114,111,119,91,99,120,93,13,10,32,32, -115,101,108,102,46,110,111,110,69,109,112,116,121,67,101,108,108,115,91,99, -101,108,108,93,32,61,32,116,114,117,101,13,10,32,32,105,102,32,110,111, -116,32,99,101,108,108,46,105,116,101,109,115,91,105,116,101,109,93,32,116, -104,101,110,13,10,32,32,99,101,108,108,46,105,116,101,109,115,91,105,116, -101,109,93,32,61,32,116,114,117,101,13,10,32,32,99,101,108,108,46,105, -116,101,109,67,111,117,110,116,32,61,32,99,101,108,108,46,105,116,101,109, -67,111,117,110,116,32,43,32,49,13,10,32,32,101,110,100,13,10,101,110, +45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, +45,45,13,10,13,10,108,111,99,97,108,32,87,111,114,108,100,32,61,32, +123,125,13,10,108,111,99,97,108,32,87,111,114,108,100,95,109,116,32,61, +32,123,95,95,105,110,100,101,120,32,61,32,87,111,114,108,100,125,13,10, +13,10,45,45,32,80,114,105,118,97,116,101,32,102,117,110,99,116,105,111, +110,115,32,97,110,100,32,109,101,116,104,111,100,115,13,10,13,10,108,111, +99,97,108,32,102,117,110,99,116,105,111,110,32,115,111,114,116,66,121,87, +101,105,103,104,116,40,97,44,98,41,32,114,101,116,117,114,110,32,97,46, +119,101,105,103,104,116,32,60,32,98,46,119,101,105,103,104,116,32,101,110, 100,13,10,13,10,108,111,99,97,108,32,102,117,110,99,116,105,111,110,32, -114,101,109,111,118,101,73,116,101,109,70,114,111,109,67,101,108,108,40,115, -101,108,102,44,32,105,116,101,109,44,32,99,120,44,32,99,121,41,13,10, +115,111,114,116,66,121,84,105,65,110,100,68,105,115,116,97,110,99,101,40, +97,44,98,41,13,10,32,32,105,102,32,97,46,116,105,32,61,61,32,98, +46,116,105,32,116,104,101,110,13,10,32,32,108,111,99,97,108,32,105,114, +44,32,97,114,44,32,98,114,32,61,32,97,46,105,116,101,109,82,101,99, +116,44,32,97,46,111,116,104,101,114,82,101,99,116,44,32,98,46,111,116, +104,101,114,82,101,99,116,13,10,32,32,108,111,99,97,108,32,97,100,32, +61,32,114,101,99,116,95,103,101,116,83,113,117,97,114,101,68,105,115,116, +97,110,99,101,40,105,114,46,120,44,105,114,46,121,44,105,114,46,119,44, +105,114,46,104,44,32,97,114,46,120,44,97,114,46,121,44,97,114,46,119, +44,97,114,46,104,41,13,10,32,32,108,111,99,97,108,32,98,100,32,61, +32,114,101,99,116,95,103,101,116,83,113,117,97,114,101,68,105,115,116,97, +110,99,101,40,105,114,46,120,44,105,114,46,121,44,105,114,46,119,44,105, +114,46,104,44,32,98,114,46,120,44,98,114,46,121,44,98,114,46,119,44, +98,114,46,104,41,13,10,32,32,114,101,116,117,114,110,32,97,100,32,60, +32,98,100,13,10,32,32,101,110,100,13,10,32,32,114,101,116,117,114,110, +32,97,46,116,105,32,60,32,98,46,116,105,13,10,101,110,100,13,10,13, +10,108,111,99,97,108,32,102,117,110,99,116,105,111,110,32,97,100,100,73, +116,101,109,84,111,67,101,108,108,40,115,101,108,102,44,32,105,116,101,109, +44,32,99,120,44,32,99,121,41,13,10,32,32,115,101,108,102,46,114,111, +119,115,91,99,121,93,32,61,32,115,101,108,102,46,114,111,119,115,91,99, +121,93,32,111,114,32,115,101,116,109,101,116,97,116,97,98,108,101,40,123, +125,44,32,123,95,95,109,111,100,101,32,61,32,39,118,39,125,41,13,10, 32,32,108,111,99,97,108,32,114,111,119,32,61,32,115,101,108,102,46,114, -111,119,115,91,99,121,93,13,10,32,32,105,102,32,110,111,116,32,114,111, -119,32,111,114,32,110,111,116,32,114,111,119,91,99,120,93,32,111,114,32, -110,111,116,32,114,111,119,91,99,120,93,46,105,116,101,109,115,91,105,116, -101,109,93,32,116,104,101,110,32,114,101,116,117,114,110,32,102,97,108,115, -101,32,101,110,100,13,10,13,10,32,32,108,111,99,97,108,32,99,101,108, -108,32,61,32,114,111,119,91,99,120,93,13,10,32,32,99,101,108,108,46, -105,116,101,109,115,91,105,116,101,109,93,32,61,32,110,105,108,13,10,32, -32,99,101,108,108,46,105,116,101,109,67,111,117,110,116,32,61,32,99,101, -108,108,46,105,116,101,109,67,111,117,110,116,32,45,32,49,13,10,32,32, -105,102,32,99,101,108,108,46,105,116,101,109,67,111,117,110,116,32,61,61, -32,48,32,116,104,101,110,13,10,32,32,115,101,108,102,46,110,111,110,69, -109,112,116,121,67,101,108,108,115,91,99,101,108,108,93,32,61,32,110,105, -108,13,10,32,32,101,110,100,13,10,32,32,114,101,116,117,114,110,32,116, -114,117,101,13,10,101,110,100,13,10,13,10,108,111,99,97,108,32,102,117, -110,99,116,105,111,110,32,103,101,116,68,105,99,116,73,116,101,109,115,73, -110,67,101,108,108,82,101,99,116,40,115,101,108,102,44,32,99,108,44,99, -116,44,99,119,44,99,104,41,13,10,32,32,108,111,99,97,108,32,105,116, -101,109,115,95,100,105,99,116,32,61,32,123,125,13,10,32,32,102,111,114, -32,99,121,61,99,116,44,99,116,43,99,104,45,49,32,100,111,13,10,32, -32,108,111,99,97,108,32,114,111,119,32,61,32,115,101,108,102,46,114,111, -119,115,91,99,121,93,13,10,32,32,105,102,32,114,111,119,32,116,104,101, -110,13,10,32,32,32,32,102,111,114,32,99,120,61,99,108,44,99,108,43, -99,119,45,49,32,100,111,13,10,32,32,32,32,108,111,99,97,108,32,99, -101,108,108,32,61,32,114,111,119,91,99,120,93,13,10,32,32,32,32,105, -102,32,99,101,108,108,32,97,110,100,32,99,101,108,108,46,105,116,101,109, -67,111,117,110,116,32,62,32,48,32,116,104,101,110,32,45,45,32,110,111, -32,99,101,108,108,46,105,116,101,109,67,111,117,110,116,32,62,32,49,32, -98,101,99,97,117,115,101,32,116,117,110,110,101,108,105,110,103,13,10,32, -32,32,32,32,32,102,111,114,32,105,116,101,109,44,95,32,105,110,32,112, -97,105,114,115,40,99,101,108,108,46,105,116,101,109,115,41,32,100,111,13, -10,32,32,32,32,32,32,105,116,101,109,115,95,100,105,99,116,91,105,116, -101,109,93,32,61,32,116,114,117,101,13,10,32,32,32,32,32,32,101,110, -100,13,10,32,32,32,32,101,110,100,13,10,32,32,32,32,101,110,100,13, -10,32,32,101,110,100,13,10,32,32,101,110,100,13,10,13,10,32,32,114, -101,116,117,114,110,32,105,116,101,109,115,95,100,105,99,116,13,10,101,110, +111,119,115,91,99,121,93,13,10,32,32,114,111,119,91,99,120,93,32,61, +32,114,111,119,91,99,120,93,32,111,114,32,123,105,116,101,109,67,111,117, +110,116,32,61,32,48,44,32,120,32,61,32,99,120,44,32,121,32,61,32, +99,121,44,32,105,116,101,109,115,32,61,32,115,101,116,109,101,116,97,116, +97,98,108,101,40,123,125,44,32,123,95,95,109,111,100,101,32,61,32,39, +107,39,125,41,125,13,10,32,32,108,111,99,97,108,32,99,101,108,108,32, +61,32,114,111,119,91,99,120,93,13,10,32,32,115,101,108,102,46,110,111, +110,69,109,112,116,121,67,101,108,108,115,91,99,101,108,108,93,32,61,32, +116,114,117,101,13,10,32,32,105,102,32,110,111,116,32,99,101,108,108,46, +105,116,101,109,115,91,105,116,101,109,93,32,116,104,101,110,13,10,32,32, +99,101,108,108,46,105,116,101,109,115,91,105,116,101,109,93,32,61,32,116, +114,117,101,13,10,32,32,99,101,108,108,46,105,116,101,109,67,111,117,110, +116,32,61,32,99,101,108,108,46,105,116,101,109,67,111,117,110,116,32,43, +32,49,13,10,32,32,101,110,100,13,10,101,110,100,13,10,13,10,108,111, +99,97,108,32,102,117,110,99,116,105,111,110,32,114,101,109,111,118,101,73, +116,101,109,70,114,111,109,67,101,108,108,40,115,101,108,102,44,32,105,116, +101,109,44,32,99,120,44,32,99,121,41,13,10,32,32,108,111,99,97,108, +32,114,111,119,32,61,32,115,101,108,102,46,114,111,119,115,91,99,121,93, +13,10,32,32,105,102,32,110,111,116,32,114,111,119,32,111,114,32,110,111, +116,32,114,111,119,91,99,120,93,32,111,114,32,110,111,116,32,114,111,119, +91,99,120,93,46,105,116,101,109,115,91,105,116,101,109,93,32,116,104,101, +110,32,114,101,116,117,114,110,32,102,97,108,115,101,32,101,110,100,13,10, +13,10,32,32,108,111,99,97,108,32,99,101,108,108,32,61,32,114,111,119, +91,99,120,93,13,10,32,32,99,101,108,108,46,105,116,101,109,115,91,105, +116,101,109,93,32,61,32,110,105,108,13,10,32,32,99,101,108,108,46,105, +116,101,109,67,111,117,110,116,32,61,32,99,101,108,108,46,105,116,101,109, +67,111,117,110,116,32,45,32,49,13,10,32,32,105,102,32,99,101,108,108, +46,105,116,101,109,67,111,117,110,116,32,61,61,32,48,32,116,104,101,110, +13,10,32,32,115,101,108,102,46,110,111,110,69,109,112,116,121,67,101,108, +108,115,91,99,101,108,108,93,32,61,32,110,105,108,13,10,32,32,101,110, +100,13,10,32,32,114,101,116,117,114,110,32,116,114,117,101,13,10,101,110, 100,13,10,13,10,108,111,99,97,108,32,102,117,110,99,116,105,111,110,32, -103,101,116,67,101,108,108,115,84,111,117,99,104,101,100,66,121,83,101,103, -109,101,110,116,40,115,101,108,102,44,32,120,49,44,121,49,44,120,50,44, -121,50,41,13,10,13,10,32,32,108,111,99,97,108,32,99,101,108,108,115, -44,32,99,101,108,108,115,76,101,110,44,32,118,105,115,105,116,101,100,32, -61,32,123,125,44,32,48,44,32,123,125,13,10,13,10,32,32,103,114,105, -100,95,116,114,97,118,101,114,115,101,40,115,101,108,102,46,99,101,108,108, -83,105,122,101,44,32,120,49,44,121,49,44,120,50,44,121,50,44,32,102, -117,110,99,116,105,111,110,40,99,120,44,32,99,121,41,13,10,32,32,108, -111,99,97,108,32,114,111,119,32,32,61,32,115,101,108,102,46,114,111,119, -115,91,99,121,93,13,10,32,32,105,102,32,110,111,116,32,114,111,119,32, -116,104,101,110,32,114,101,116,117,114,110,32,101,110,100,13,10,32,32,108, -111,99,97,108,32,99,101,108,108,32,61,32,114,111,119,91,99,120,93,13, -10,32,32,105,102,32,110,111,116,32,99,101,108,108,32,111,114,32,118,105, -115,105,116,101,100,91,99,101,108,108,93,32,116,104,101,110,32,114,101,116, -117,114,110,32,101,110,100,13,10,13,10,32,32,118,105,115,105,116,101,100, -91,99,101,108,108,93,32,61,32,116,114,117,101,13,10,32,32,99,101,108, -108,115,76,101,110,32,61,32,99,101,108,108,115,76,101,110,32,43,32,49, -13,10,32,32,99,101,108,108,115,91,99,101,108,108,115,76,101,110,93,32, -61,32,99,101,108,108,13,10,32,32,101,110,100,41,13,10,13,10,32,32, -114,101,116,117,114,110,32,99,101,108,108,115,44,32,99,101,108,108,115,76, -101,110,13,10,101,110,100,13,10,13,10,108,111,99,97,108,32,102,117,110, -99,116,105,111,110,32,103,101,116,73,110,102,111,65,98,111,117,116,73,116, -101,109,115,84,111,117,99,104,101,100,66,121,83,101,103,109,101,110,116,40, -115,101,108,102,44,32,120,49,44,121,49,44,32,120,50,44,121,50,44,32, -102,105,108,116,101,114,41,13,10,32,32,108,111,99,97,108,32,99,101,108, -108,115,44,32,108,101,110,32,61,32,103,101,116,67,101,108,108,115,84,111, -117,99,104,101,100,66,121,83,101,103,109,101,110,116,40,115,101,108,102,44, -32,120,49,44,121,49,44,120,50,44,121,50,41,13,10,32,32,108,111,99, -97,108,32,99,101,108,108,44,32,114,101,99,116,44,32,108,44,116,44,119, -44,104,44,32,116,105,49,44,116,105,50,44,32,116,105,105,48,44,116,105, -105,49,13,10,32,32,108,111,99,97,108,32,118,105,115,105,116,101,100,44, -32,105,116,101,109,73,110,102,111,44,32,105,116,101,109,73,110,102,111,76, -101,110,32,61,32,123,125,44,123,125,44,48,13,10,32,32,102,111,114,32, -105,61,49,44,108,101,110,32,100,111,13,10,32,32,99,101,108,108,32,61, -32,99,101,108,108,115,91,105,93,13,10,32,32,102,111,114,32,105,116,101, -109,32,105,110,32,112,97,105,114,115,40,99,101,108,108,46,105,116,101,109, -115,41,32,100,111,13,10,32,32,32,32,105,102,32,110,111,116,32,118,105, -115,105,116,101,100,91,105,116,101,109,93,32,116,104,101,110,13,10,32,32, -32,32,118,105,115,105,116,101,100,91,105,116,101,109,93,32,32,61,32,116, -114,117,101,13,10,32,32,32,32,105,102,32,40,110,111,116,32,102,105,108, +103,101,116,68,105,99,116,73,116,101,109,115,73,110,67,101,108,108,82,101, +99,116,40,115,101,108,102,44,32,99,108,44,99,116,44,99,119,44,99,104, +41,13,10,32,32,108,111,99,97,108,32,105,116,101,109,115,95,100,105,99, +116,32,61,32,123,125,13,10,32,32,102,111,114,32,99,121,61,99,116,44, +99,116,43,99,104,45,49,32,100,111,13,10,32,32,108,111,99,97,108,32, +114,111,119,32,61,32,115,101,108,102,46,114,111,119,115,91,99,121,93,13, +10,32,32,105,102,32,114,111,119,32,116,104,101,110,13,10,9,102,111,114, +32,99,120,61,99,108,44,99,108,43,99,119,45,49,32,100,111,13,10,9, +108,111,99,97,108,32,99,101,108,108,32,61,32,114,111,119,91,99,120,93, +13,10,9,105,102,32,99,101,108,108,32,97,110,100,32,99,101,108,108,46, +105,116,101,109,67,111,117,110,116,32,62,32,48,32,116,104,101,110,32,45, +45,32,110,111,32,99,101,108,108,46,105,116,101,109,67,111,117,110,116,32, +62,32,49,32,98,101,99,97,117,115,101,32,116,117,110,110,101,108,105,110, +103,13,10,9,32,32,102,111,114,32,105,116,101,109,44,95,32,105,110,32, +112,97,105,114,115,40,99,101,108,108,46,105,116,101,109,115,41,32,100,111, +13,10,9,32,32,105,116,101,109,115,95,100,105,99,116,91,105,116,101,109, +93,32,61,32,116,114,117,101,13,10,9,32,32,101,110,100,13,10,9,101, +110,100,13,10,9,101,110,100,13,10,32,32,101,110,100,13,10,32,32,101, +110,100,13,10,13,10,32,32,114,101,116,117,114,110,32,105,116,101,109,115, +95,100,105,99,116,13,10,101,110,100,13,10,13,10,108,111,99,97,108,32, +102,117,110,99,116,105,111,110,32,103,101,116,67,101,108,108,115,84,111,117, +99,104,101,100,66,121,83,101,103,109,101,110,116,40,115,101,108,102,44,32, +120,49,44,121,49,44,120,50,44,121,50,41,13,10,13,10,32,32,108,111, +99,97,108,32,99,101,108,108,115,44,32,99,101,108,108,115,76,101,110,44, +32,118,105,115,105,116,101,100,32,61,32,123,125,44,32,48,44,32,123,125, +13,10,13,10,32,32,103,114,105,100,95,116,114,97,118,101,114,115,101,40, +115,101,108,102,46,99,101,108,108,83,105,122,101,44,32,120,49,44,121,49, +44,120,50,44,121,50,44,32,102,117,110,99,116,105,111,110,40,99,120,44, +32,99,121,41,13,10,32,32,108,111,99,97,108,32,114,111,119,32,32,61, +32,115,101,108,102,46,114,111,119,115,91,99,121,93,13,10,32,32,105,102, +32,110,111,116,32,114,111,119,32,116,104,101,110,32,114,101,116,117,114,110, +32,101,110,100,13,10,32,32,108,111,99,97,108,32,99,101,108,108,32,61, +32,114,111,119,91,99,120,93,13,10,32,32,105,102,32,110,111,116,32,99, +101,108,108,32,111,114,32,118,105,115,105,116,101,100,91,99,101,108,108,93, +32,116,104,101,110,32,114,101,116,117,114,110,32,101,110,100,13,10,13,10, +32,32,118,105,115,105,116,101,100,91,99,101,108,108,93,32,61,32,116,114, +117,101,13,10,32,32,99,101,108,108,115,76,101,110,32,61,32,99,101,108, +108,115,76,101,110,32,43,32,49,13,10,32,32,99,101,108,108,115,91,99, +101,108,108,115,76,101,110,93,32,61,32,99,101,108,108,13,10,32,32,101, +110,100,41,13,10,13,10,32,32,114,101,116,117,114,110,32,99,101,108,108, +115,44,32,99,101,108,108,115,76,101,110,13,10,101,110,100,13,10,13,10, +108,111,99,97,108,32,102,117,110,99,116,105,111,110,32,103,101,116,73,110, +102,111,65,98,111,117,116,73,116,101,109,115,84,111,117,99,104,101,100,66, +121,83,101,103,109,101,110,116,40,115,101,108,102,44,32,120,49,44,121,49, +44,32,120,50,44,121,50,44,32,102,105,108,116,101,114,41,13,10,32,32, +108,111,99,97,108,32,99,101,108,108,115,44,32,108,101,110,32,61,32,103, +101,116,67,101,108,108,115,84,111,117,99,104,101,100,66,121,83,101,103,109, +101,110,116,40,115,101,108,102,44,32,120,49,44,121,49,44,120,50,44,121, +50,41,13,10,32,32,108,111,99,97,108,32,99,101,108,108,44,32,114,101, +99,116,44,32,108,44,116,44,119,44,104,44,32,116,105,49,44,116,105,50, +44,32,116,105,105,48,44,116,105,105,49,13,10,32,32,108,111,99,97,108, +32,118,105,115,105,116,101,100,44,32,105,116,101,109,73,110,102,111,44,32, +105,116,101,109,73,110,102,111,76,101,110,32,61,32,123,125,44,123,125,44, +48,13,10,32,32,102,111,114,32,105,61,49,44,108,101,110,32,100,111,13, +10,32,32,99,101,108,108,32,61,32,99,101,108,108,115,91,105,93,13,10, +32,32,102,111,114,32,105,116,101,109,32,105,110,32,112,97,105,114,115,40, +99,101,108,108,46,105,116,101,109,115,41,32,100,111,13,10,9,105,102,32, +110,111,116,32,118,105,115,105,116,101,100,91,105,116,101,109,93,32,116,104, +101,110,13,10,9,118,105,115,105,116,101,100,91,105,116,101,109,93,32,32, +61,32,116,114,117,101,13,10,9,105,102,32,40,110,111,116,32,102,105,108, 116,101,114,32,111,114,32,102,105,108,116,101,114,40,105,116,101,109,41,41, -32,116,104,101,110,13,10,32,32,32,32,32,32,114,101,99,116,32,32,32, -32,32,32,32,61,32,115,101,108,102,46,114,101,99,116,115,91,105,116,101, -109,93,13,10,32,32,32,32,32,32,108,44,116,44,119,44,104,32,32,32, -32,61,32,114,101,99,116,46,120,44,114,101,99,116,46,121,44,114,101,99, -116,46,119,44,114,101,99,116,46,104,13,10,13,10,32,32,32,32,32,32, -116,105,49,44,116,105,50,32,61,32,114,101,99,116,95,103,101,116,83,101, -103,109,101,110,116,73,110,116,101,114,115,101,99,116,105,111,110,73,110,100, -105,99,101,115,40,108,44,116,44,119,44,104,44,32,120,49,44,121,49,44, -32,120,50,44,121,50,44,32,48,44,32,49,41,13,10,32,32,32,32,32, -32,105,102,32,116,105,49,32,97,110,100,32,40,40,48,32,60,32,116,105, -49,32,97,110,100,32,116,105,49,32,60,32,49,41,32,111,114,32,40,48, -32,60,32,116,105,50,32,97,110,100,32,116,105,50,32,60,32,49,41,41, -32,116,104,101,110,13,10,32,32,32,32,32,32,45,45,32,116,104,101,32, -115,111,114,116,105,110,103,32,105,115,32,97,99,99,111,114,100,105,110,103, -32,116,111,32,116,104,101,32,116,32,111,102,32,97,110,32,105,110,102,105, -110,105,116,101,32,108,105,110,101,44,32,110,111,116,32,116,104,101,32,115, -101,103,109,101,110,116,13,10,32,32,32,32,32,32,116,105,105,48,44,116, -105,105,49,32,32,61,32,114,101,99,116,95,103,101,116,83,101,103,109,101, -110,116,73,110,116,101,114,115,101,99,116,105,111,110,73,110,100,105,99,101, -115,40,108,44,116,44,119,44,104,44,32,120,49,44,121,49,44,32,120,50, -44,121,50,44,32,45,109,97,116,104,46,104,117,103,101,44,32,109,97,116, -104,46,104,117,103,101,41,13,10,32,32,32,32,32,32,105,116,101,109,73, -110,102,111,76,101,110,32,32,61,32,105,116,101,109,73,110,102,111,76,101, -110,32,43,32,49,13,10,32,32,32,32,32,32,105,116,101,109,73,110,102, -111,91,105,116,101,109,73,110,102,111,76,101,110,93,32,61,32,123,105,116, -101,109,32,61,32,105,116,101,109,44,32,116,105,49,32,61,32,116,105,49, -44,32,116,105,50,32,61,32,116,105,50,44,32,119,101,105,103,104,116,32, -61,32,109,105,110,40,116,105,105,48,44,116,105,105,49,41,125,13,10,32, -32,32,32,32,32,101,110,100,13,10,32,32,32,32,101,110,100,13,10,32, -32,32,32,101,110,100,13,10,32,32,101,110,100,13,10,32,32,101,110,100, -13,10,32,32,116,97,98,108,101,46,115,111,114,116,40,105,116,101,109,73, -110,102,111,44,32,115,111,114,116,66,121,87,101,105,103,104,116,41,13,10, -32,32,114,101,116,117,114,110,32,105,116,101,109,73,110,102,111,44,32,105, -116,101,109,73,110,102,111,76,101,110,13,10,101,110,100,13,10,13,10,108, -111,99,97,108,32,102,117,110,99,116,105,111,110,32,103,101,116,82,101,115, -112,111,110,115,101,66,121,78,97,109,101,40,115,101,108,102,44,32,110,97, -109,101,41,13,10,32,32,108,111,99,97,108,32,114,101,115,112,111,110,115, -101,32,61,32,115,101,108,102,46,114,101,115,112,111,110,115,101,115,91,110, -97,109,101,93,13,10,32,32,105,102,32,110,111,116,32,114,101,115,112,111, -110,115,101,32,116,104,101,110,13,10,32,32,101,114,114,111,114,40,40,39, -85,110,107,110,111,119,110,32,99,111,108,108,105,115,105,111,110,32,116,121, -112,101,58,32,37,115,32,40,37,115,41,39,41,58,102,111,114,109,97,116, -40,110,97,109,101,44,32,116,121,112,101,40,110,97,109,101,41,41,41,13, -10,32,32,101,110,100,13,10,32,32,114,101,116,117,114,110,32,114,101,115, -112,111,110,115,101,13,10,101,110,100,13,10,13,10,13,10,45,45,32,77, -105,115,99,32,80,117,98,108,105,99,32,77,101,116,104,111,100,115,13,10, -13,10,102,117,110,99,116,105,111,110,32,87,111,114,108,100,58,97,100,100, -82,101,115,112,111,110,115,101,40,110,97,109,101,44,32,114,101,115,112,111, -110,115,101,41,13,10,32,32,115,101,108,102,46,114,101,115,112,111,110,115, -101,115,91,110,97,109,101,93,32,61,32,114,101,115,112,111,110,115,101,13, -10,101,110,100,13,10,13,10,102,117,110,99,116,105,111,110,32,87,111,114, -108,100,58,112,114,111,106,101,99,116,40,105,116,101,109,44,32,120,44,121, -44,119,44,104,44,32,103,111,97,108,88,44,32,103,111,97,108,89,44,32, -102,105,108,116,101,114,41,13,10,32,32,97,115,115,101,114,116,73,115,82, -101,99,116,40,120,44,121,44,119,44,104,41,13,10,13,10,32,32,103,111, -97,108,88,32,61,32,103,111,97,108,88,32,111,114,32,120,13,10,32,32, -103,111,97,108,89,32,61,32,103,111,97,108,89,32,111,114,32,121,13,10, -32,32,102,105,108,116,101,114,32,32,61,32,102,105,108,116,101,114,32,32, -111,114,32,100,101,102,97,117,108,116,70,105,108,116,101,114,13,10,13,10, -32,32,108,111,99,97,108,32,99,111,108,108,105,115,105,111,110,115,44,32, -108,101,110,32,61,32,123,125,44,32,48,13,10,13,10,32,32,108,111,99, -97,108,32,118,105,115,105,116,101,100,32,61,32,123,125,13,10,32,32,105, -102,32,105,116,101,109,32,126,61,32,110,105,108,32,116,104,101,110,32,118, -105,115,105,116,101,100,91,105,116,101,109,93,32,61,32,116,114,117,101,32, -101,110,100,13,10,13,10,32,32,45,45,32,84,104,105,115,32,99,111,117, -108,100,32,112,114,111,98,97,98,108,121,32,98,101,32,100,111,110,101,32, -119,105,116,104,32,108,101,115,115,32,99,101,108,108,115,32,117,115,105,110, -103,32,97,32,112,111,108,121,103,111,110,32,114,97,115,116,101,114,32,111, -118,101,114,32,116,104,101,32,99,101,108,108,115,32,105,110,115,116,101,97, -100,32,111,102,32,97,13,10,32,32,45,45,32,98,111,117,110,100,105,110, -103,32,114,101,99,116,32,111,102,32,116,104,101,32,119,104,111,108,101,32, -109,111,118,101,109,101,110,116,46,32,67,111,110,100,105,116,105,111,110,97, -108,32,116,111,32,98,117,105,108,100,105,110,103,32,97,32,113,117,101,114, -121,80,111,108,121,103,111,110,32,109,101,116,104,111,100,13,10,32,32,108, -111,99,97,108,32,116,108,44,32,116,116,32,61,32,109,105,110,40,103,111, -97,108,88,44,32,120,41,44,32,32,32,32,32,109,105,110,40,103,111,97, -108,89,44,32,121,41,13,10,32,32,108,111,99,97,108,32,116,114,44,32, -116,98,32,61,32,109,97,120,40,103,111,97,108,88,32,43,32,119,44,32, -120,43,119,41,44,32,109,97,120,40,103,111,97,108,89,32,43,32,104,44, -32,121,43,104,41,13,10,32,32,108,111,99,97,108,32,116,119,44,32,116, -104,32,61,32,116,114,45,116,108,44,32,116,98,45,116,116,13,10,13,10, -32,32,108,111,99,97,108,32,99,108,44,99,116,44,99,119,44,99,104,32, -61,32,103,114,105,100,95,116,111,67,101,108,108,82,101,99,116,40,115,101, -108,102,46,99,101,108,108,83,105,122,101,44,32,116,108,44,116,116,44,116, -119,44,116,104,41,13,10,13,10,32,32,108,111,99,97,108,32,100,105,99, -116,73,116,101,109,115,73,110,67,101,108,108,82,101,99,116,32,61,32,103, -101,116,68,105,99,116,73,116,101,109,115,73,110,67,101,108,108,82,101,99, -116,40,115,101,108,102,44,32,99,108,44,99,116,44,99,119,44,99,104,41, -13,10,13,10,32,32,102,111,114,32,111,116,104,101,114,44,95,32,105,110, -32,112,97,105,114,115,40,100,105,99,116,73,116,101,109,115,73,110,67,101, -108,108,82,101,99,116,41,32,100,111,13,10,32,32,105,102,32,110,111,116, -32,118,105,115,105,116,101,100,91,111,116,104,101,114,93,32,116,104,101,110, -13,10,32,32,32,32,118,105,115,105,116,101,100,91,111,116,104,101,114,93, -32,61,32,116,114,117,101,13,10,13,10,32,32,32,32,108,111,99,97,108, -32,114,101,115,112,111,110,115,101,78,97,109,101,32,61,32,102,105,108,116, -101,114,40,105,116,101,109,44,32,111,116,104,101,114,41,13,10,32,32,32, -32,105,102,32,114,101,115,112,111,110,115,101,78,97,109,101,32,116,104,101, -110,13,10,32,32,32,32,108,111,99,97,108,32,111,120,44,111,121,44,111, -119,44,111,104,32,32,32,61,32,115,101,108,102,58,103,101,116,82,101,99, -116,40,111,116,104,101,114,41,13,10,32,32,32,32,108,111,99,97,108,32, -99,111,108,32,32,32,32,32,32,32,61,32,114,101,99,116,95,100,101,116, +32,116,104,101,110,13,10,9,32,32,114,101,99,116,9,32,32,32,61,32, +115,101,108,102,46,114,101,99,116,115,91,105,116,101,109,93,13,10,9,32, +32,108,44,116,44,119,44,104,9,61,32,114,101,99,116,46,120,44,114,101, +99,116,46,121,44,114,101,99,116,46,119,44,114,101,99,116,46,104,13,10, +13,10,9,32,32,116,105,49,44,116,105,50,32,61,32,114,101,99,116,95, +103,101,116,83,101,103,109,101,110,116,73,110,116,101,114,115,101,99,116,105, +111,110,73,110,100,105,99,101,115,40,108,44,116,44,119,44,104,44,32,120, +49,44,121,49,44,32,120,50,44,121,50,44,32,48,44,32,49,41,13,10, +9,32,32,105,102,32,116,105,49,32,97,110,100,32,40,40,48,32,60,32, +116,105,49,32,97,110,100,32,116,105,49,32,60,32,49,41,32,111,114,32, +40,48,32,60,32,116,105,50,32,97,110,100,32,116,105,50,32,60,32,49, +41,41,32,116,104,101,110,13,10,9,32,32,45,45,32,116,104,101,32,115, +111,114,116,105,110,103,32,105,115,32,97,99,99,111,114,100,105,110,103,32, +116,111,32,116,104,101,32,116,32,111,102,32,97,110,32,105,110,102,105,110, +105,116,101,32,108,105,110,101,44,32,110,111,116,32,116,104,101,32,115,101, +103,109,101,110,116,13,10,9,32,32,116,105,105,48,44,116,105,105,49,32, +32,61,32,114,101,99,116,95,103,101,116,83,101,103,109,101,110,116,73,110, +116,101,114,115,101,99,116,105,111,110,73,110,100,105,99,101,115,40,108,44, +116,44,119,44,104,44,32,120,49,44,121,49,44,32,120,50,44,121,50,44, +32,45,109,97,116,104,46,104,117,103,101,44,32,109,97,116,104,46,104,117, +103,101,41,13,10,9,32,32,105,116,101,109,73,110,102,111,76,101,110,32, +32,61,32,105,116,101,109,73,110,102,111,76,101,110,32,43,32,49,13,10, +9,32,32,105,116,101,109,73,110,102,111,91,105,116,101,109,73,110,102,111, +76,101,110,93,32,61,32,123,105,116,101,109,32,61,32,105,116,101,109,44, +32,116,105,49,32,61,32,116,105,49,44,32,116,105,50,32,61,32,116,105, +50,44,32,119,101,105,103,104,116,32,61,32,109,105,110,40,116,105,105,48, +44,116,105,105,49,41,125,13,10,9,32,32,101,110,100,13,10,9,101,110, +100,13,10,9,101,110,100,13,10,32,32,101,110,100,13,10,32,32,101,110, +100,13,10,32,32,116,97,98,108,101,46,115,111,114,116,40,105,116,101,109, +73,110,102,111,44,32,115,111,114,116,66,121,87,101,105,103,104,116,41,13, +10,32,32,114,101,116,117,114,110,32,105,116,101,109,73,110,102,111,44,32, +105,116,101,109,73,110,102,111,76,101,110,13,10,101,110,100,13,10,13,10, +108,111,99,97,108,32,102,117,110,99,116,105,111,110,32,103,101,116,82,101, +115,112,111,110,115,101,66,121,78,97,109,101,40,115,101,108,102,44,32,110, +97,109,101,41,13,10,32,32,108,111,99,97,108,32,114,101,115,112,111,110, +115,101,32,61,32,115,101,108,102,46,114,101,115,112,111,110,115,101,115,91, +110,97,109,101,93,13,10,32,32,105,102,32,110,111,116,32,114,101,115,112, +111,110,115,101,32,116,104,101,110,13,10,32,32,101,114,114,111,114,40,40, +39,85,110,107,110,111,119,110,32,99,111,108,108,105,115,105,111,110,32,116, +121,112,101,58,32,37,115,32,40,37,115,41,39,41,58,102,111,114,109,97, +116,40,110,97,109,101,44,32,116,121,112,101,40,110,97,109,101,41,41,41, +13,10,32,32,101,110,100,13,10,32,32,114,101,116,117,114,110,32,114,101, +115,112,111,110,115,101,13,10,101,110,100,13,10,13,10,13,10,45,45,32, +77,105,115,99,32,80,117,98,108,105,99,32,77,101,116,104,111,100,115,13, +10,13,10,102,117,110,99,116,105,111,110,32,87,111,114,108,100,58,97,100, +100,82,101,115,112,111,110,115,101,40,110,97,109,101,44,32,114,101,115,112, +111,110,115,101,41,13,10,32,32,115,101,108,102,46,114,101,115,112,111,110, +115,101,115,91,110,97,109,101,93,32,61,32,114,101,115,112,111,110,115,101, +13,10,101,110,100,13,10,13,10,102,117,110,99,116,105,111,110,32,87,111, +114,108,100,58,112,114,111,106,101,99,116,40,105,116,101,109,44,32,120,44, +121,44,119,44,104,44,32,103,111,97,108,88,44,32,103,111,97,108,89,44, +32,102,105,108,116,101,114,41,13,10,32,32,97,115,115,101,114,116,73,115, +82,101,99,116,40,120,44,121,44,119,44,104,41,13,10,13,10,32,32,103, +111,97,108,88,32,61,32,103,111,97,108,88,32,111,114,32,120,13,10,32, +32,103,111,97,108,89,32,61,32,103,111,97,108,89,32,111,114,32,121,13, +10,32,32,102,105,108,116,101,114,32,32,61,32,102,105,108,116,101,114,32, +32,111,114,32,100,101,102,97,117,108,116,70,105,108,116,101,114,13,10,13, +10,32,32,108,111,99,97,108,32,99,111,108,108,105,115,105,111,110,115,44, +32,108,101,110,32,61,32,123,125,44,32,48,13,10,13,10,32,32,108,111, +99,97,108,32,118,105,115,105,116,101,100,32,61,32,123,125,13,10,32,32, +105,102,32,105,116,101,109,32,126,61,32,110,105,108,32,116,104,101,110,32, +118,105,115,105,116,101,100,91,105,116,101,109,93,32,61,32,116,114,117,101, +32,101,110,100,13,10,13,10,32,32,45,45,32,84,104,105,115,32,99,111, +117,108,100,32,112,114,111,98,97,98,108,121,32,98,101,32,100,111,110,101, +32,119,105,116,104,32,108,101,115,115,32,99,101,108,108,115,32,117,115,105, +110,103,32,97,32,112,111,108,121,103,111,110,32,114,97,115,116,101,114,32, +111,118,101,114,32,116,104,101,32,99,101,108,108,115,32,105,110,115,116,101, +97,100,32,111,102,32,97,13,10,32,32,45,45,32,98,111,117,110,100,105, +110,103,32,114,101,99,116,32,111,102,32,116,104,101,32,119,104,111,108,101, +32,109,111,118,101,109,101,110,116,46,32,67,111,110,100,105,116,105,111,110, +97,108,32,116,111,32,98,117,105,108,100,105,110,103,32,97,32,113,117,101, +114,121,80,111,108,121,103,111,110,32,109,101,116,104,111,100,13,10,32,32, +108,111,99,97,108,32,116,108,44,32,116,116,32,61,32,109,105,110,40,103, +111,97,108,88,44,32,120,41,44,9,32,109,105,110,40,103,111,97,108,89, +44,32,121,41,13,10,32,32,108,111,99,97,108,32,116,114,44,32,116,98, +32,61,32,109,97,120,40,103,111,97,108,88,32,43,32,119,44,32,120,43, +119,41,44,32,109,97,120,40,103,111,97,108,89,32,43,32,104,44,32,121, +43,104,41,13,10,32,32,108,111,99,97,108,32,116,119,44,32,116,104,32, +61,32,116,114,45,116,108,44,32,116,98,45,116,116,13,10,13,10,32,32, +108,111,99,97,108,32,99,108,44,99,116,44,99,119,44,99,104,32,61,32, +103,114,105,100,95,116,111,67,101,108,108,82,101,99,116,40,115,101,108,102, +46,99,101,108,108,83,105,122,101,44,32,116,108,44,116,116,44,116,119,44, +116,104,41,13,10,13,10,32,32,108,111,99,97,108,32,100,105,99,116,73, +116,101,109,115,73,110,67,101,108,108,82,101,99,116,32,61,32,103,101,116, +68,105,99,116,73,116,101,109,115,73,110,67,101,108,108,82,101,99,116,40, +115,101,108,102,44,32,99,108,44,99,116,44,99,119,44,99,104,41,13,10, +13,10,32,32,102,111,114,32,111,116,104,101,114,44,95,32,105,110,32,112, +97,105,114,115,40,100,105,99,116,73,116,101,109,115,73,110,67,101,108,108, +82,101,99,116,41,32,100,111,13,10,32,32,105,102,32,110,111,116,32,118, +105,115,105,116,101,100,91,111,116,104,101,114,93,32,116,104,101,110,13,10, +9,118,105,115,105,116,101,100,91,111,116,104,101,114,93,32,61,32,116,114, +117,101,13,10,13,10,9,108,111,99,97,108,32,114,101,115,112,111,110,115, +101,78,97,109,101,32,61,32,102,105,108,116,101,114,40,105,116,101,109,44, +32,111,116,104,101,114,41,13,10,9,105,102,32,114,101,115,112,111,110,115, +101,78,97,109,101,32,116,104,101,110,13,10,9,108,111,99,97,108,32,111, +120,44,111,121,44,111,119,44,111,104,32,32,32,61,32,115,101,108,102,58, +103,101,116,82,101,99,116,40,111,116,104,101,114,41,13,10,9,108,111,99, +97,108,32,99,111,108,9,32,32,32,61,32,114,101,99,116,95,100,101,116, 101,99,116,67,111,108,108,105,115,105,111,110,40,120,44,121,44,119,44,104, 44,32,111,120,44,111,121,44,111,119,44,111,104,44,32,103,111,97,108,88, -44,32,103,111,97,108,89,41,13,10,13,10,32,32,32,32,105,102,32,99, -111,108,32,116,104,101,110,13,10,32,32,32,32,32,32,99,111,108,46,111, -116,104,101,114,32,32,61,32,111,116,104,101,114,13,10,32,32,32,32,32, -32,99,111,108,46,105,116,101,109,32,32,32,61,32,105,116,101,109,13,10, -32,32,32,32,32,32,99,111,108,46,116,121,112,101,32,32,32,61,32,114, -101,115,112,111,110,115,101,78,97,109,101,13,10,13,10,32,32,32,32,32, -32,108,101,110,32,61,32,108,101,110,32,43,32,49,13,10,32,32,32,32, -32,32,99,111,108,108,105,115,105,111,110,115,91,108,101,110,93,32,61,32, -99,111,108,13,10,32,32,32,32,101,110,100,13,10,32,32,32,32,101,110, -100,13,10,32,32,101,110,100,13,10,32,32,101,110,100,13,10,13,10,32, -32,116,97,98,108,101,46,115,111,114,116,40,99,111,108,108,105,115,105,111, -110,115,44,32,115,111,114,116,66,121,84,105,65,110,100,68,105,115,116,97, -110,99,101,41,13,10,13,10,32,32,114,101,116,117,114,110,32,99,111,108, -108,105,115,105,111,110,115,44,32,108,101,110,13,10,101,110,100,13,10,13, -10,102,117,110,99,116,105,111,110,32,87,111,114,108,100,58,99,111,117,110, -116,67,101,108,108,115,40,41,13,10,32,32,108,111,99,97,108,32,99,111, -117,110,116,32,61,32,48,13,10,32,32,102,111,114,32,95,44,114,111,119, -32,105,110,32,112,97,105,114,115,40,115,101,108,102,46,114,111,119,115,41, -32,100,111,13,10,32,32,102,111,114,32,95,44,95,32,105,110,32,112,97, -105,114,115,40,114,111,119,41,32,100,111,13,10,32,32,32,32,99,111,117, -110,116,32,61,32,99,111,117,110,116,32,43,32,49,13,10,32,32,101,110, -100,13,10,32,32,101,110,100,13,10,32,32,114,101,116,117,114,110,32,99, -111,117,110,116,13,10,101,110,100,13,10,13,10,102,117,110,99,116,105,111, -110,32,87,111,114,108,100,58,104,97,115,73,116,101,109,40,105,116,101,109, -41,13,10,32,32,114,101,116,117,114,110,32,110,111,116,32,110,111,116,32, -115,101,108,102,46,114,101,99,116,115,91,105,116,101,109,93,13,10,101,110, +44,32,103,111,97,108,89,41,13,10,13,10,9,105,102,32,99,111,108,32, +116,104,101,110,13,10,9,32,32,99,111,108,46,111,116,104,101,114,32,32, +61,32,111,116,104,101,114,13,10,9,32,32,99,111,108,46,105,116,101,109, +32,32,32,61,32,105,116,101,109,13,10,9,32,32,99,111,108,46,116,121, +112,101,32,32,32,61,32,114,101,115,112,111,110,115,101,78,97,109,101,13, +10,13,10,9,32,32,108,101,110,32,61,32,108,101,110,32,43,32,49,13, +10,9,32,32,99,111,108,108,105,115,105,111,110,115,91,108,101,110,93,32, +61,32,99,111,108,13,10,9,101,110,100,13,10,9,101,110,100,13,10,32, +32,101,110,100,13,10,32,32,101,110,100,13,10,13,10,32,32,116,97,98, +108,101,46,115,111,114,116,40,99,111,108,108,105,115,105,111,110,115,44,32, +115,111,114,116,66,121,84,105,65,110,100,68,105,115,116,97,110,99,101,41, +13,10,13,10,32,32,114,101,116,117,114,110,32,99,111,108,108,105,115,105, +111,110,115,44,32,108,101,110,13,10,101,110,100,13,10,13,10,102,117,110, +99,116,105,111,110,32,87,111,114,108,100,58,99,111,117,110,116,67,101,108, +108,115,40,41,13,10,32,32,108,111,99,97,108,32,99,111,117,110,116,32, +61,32,48,13,10,32,32,102,111,114,32,95,44,114,111,119,32,105,110,32, +112,97,105,114,115,40,115,101,108,102,46,114,111,119,115,41,32,100,111,13, +10,32,32,102,111,114,32,95,44,95,32,105,110,32,112,97,105,114,115,40, +114,111,119,41,32,100,111,13,10,9,99,111,117,110,116,32,61,32,99,111, +117,110,116,32,43,32,49,13,10,32,32,101,110,100,13,10,32,32,101,110, +100,13,10,32,32,114,101,116,117,114,110,32,99,111,117,110,116,13,10,101, +110,100,13,10,13,10,102,117,110,99,116,105,111,110,32,87,111,114,108,100, +58,104,97,115,73,116,101,109,40,105,116,101,109,41,13,10,32,32,114,101, +116,117,114,110,32,110,111,116,32,110,111,116,32,115,101,108,102,46,114,101, +99,116,115,91,105,116,101,109,93,13,10,101,110,100,13,10,13,10,102,117, +110,99,116,105,111,110,32,87,111,114,108,100,58,103,101,116,73,116,101,109, +115,40,41,13,10,32,32,108,111,99,97,108,32,105,116,101,109,115,44,32, +108,101,110,32,61,32,123,125,44,32,48,13,10,32,32,102,111,114,32,105, +116,101,109,44,95,32,105,110,32,112,97,105,114,115,40,115,101,108,102,46, +114,101,99,116,115,41,32,100,111,13,10,32,32,108,101,110,32,61,32,108, +101,110,32,43,32,49,13,10,32,32,105,116,101,109,115,91,108,101,110,93, +32,61,32,105,116,101,109,13,10,32,32,101,110,100,13,10,32,32,114,101, +116,117,114,110,32,105,116,101,109,115,44,32,108,101,110,13,10,101,110,100, +13,10,13,10,102,117,110,99,116,105,111,110,32,87,111,114,108,100,58,99, +111,117,110,116,73,116,101,109,115,40,41,13,10,32,32,108,111,99,97,108, +32,108,101,110,32,61,32,48,13,10,32,32,102,111,114,32,95,32,105,110, +32,112,97,105,114,115,40,115,101,108,102,46,114,101,99,116,115,41,32,100, +111,32,108,101,110,32,61,32,108,101,110,32,43,32,49,32,101,110,100,13, +10,32,32,114,101,116,117,114,110,32,108,101,110,13,10,101,110,100,13,10, +13,10,102,117,110,99,116,105,111,110,32,87,111,114,108,100,58,103,101,116, +82,101,99,116,40,105,116,101,109,41,13,10,32,32,108,111,99,97,108,32, +114,101,99,116,32,61,32,115,101,108,102,46,114,101,99,116,115,91,105,116, +101,109,93,13,10,32,32,105,102,32,110,111,116,32,114,101,99,116,32,116, +104,101,110,13,10,32,32,101,114,114,111,114,40,39,73,116,101,109,32,39, +32,46,46,32,116,111,115,116,114,105,110,103,40,105,116,101,109,41,32,46, +46,32,39,32,109,117,115,116,32,98,101,32,97,100,100,101,100,32,116,111, +32,116,104,101,32,119,111,114,108,100,32,98,101,102,111,114,101,32,103,101, +116,116,105,110,103,32,105,116,115,32,114,101,99,116,46,32,85,115,101,32, +119,111,114,108,100,58,97,100,100,40,105,116,101,109,44,32,120,44,121,44, +119,44,104,41,32,116,111,32,97,100,100,32,105,116,32,102,105,114,115,116, +46,39,41,13,10,32,32,101,110,100,13,10,32,32,114,101,116,117,114,110, +32,114,101,99,116,46,120,44,32,114,101,99,116,46,121,44,32,114,101,99, +116,46,119,44,32,114,101,99,116,46,104,13,10,101,110,100,13,10,13,10, +102,117,110,99,116,105,111,110,32,87,111,114,108,100,58,116,111,87,111,114, +108,100,40,99,120,44,32,99,121,41,13,10,32,32,114,101,116,117,114,110, +32,103,114,105,100,95,116,111,87,111,114,108,100,40,115,101,108,102,46,99, +101,108,108,83,105,122,101,44,32,99,120,44,32,99,121,41,13,10,101,110, 100,13,10,13,10,102,117,110,99,116,105,111,110,32,87,111,114,108,100,58, -103,101,116,73,116,101,109,115,40,41,13,10,32,32,108,111,99,97,108,32, -105,116,101,109,115,44,32,108,101,110,32,61,32,123,125,44,32,48,13,10, +116,111,67,101,108,108,40,120,44,121,41,13,10,32,32,114,101,116,117,114, +110,32,103,114,105,100,95,116,111,67,101,108,108,40,115,101,108,102,46,99, +101,108,108,83,105,122,101,44,32,120,44,32,121,41,13,10,101,110,100,13, +10,13,10,13,10,45,45,45,32,81,117,101,114,121,32,109,101,116,104,111, +100,115,13,10,13,10,102,117,110,99,116,105,111,110,32,87,111,114,108,100, +58,113,117,101,114,121,82,101,99,116,40,120,44,121,44,119,44,104,44,32, +102,105,108,116,101,114,41,13,10,13,10,32,32,97,115,115,101,114,116,73, +115,82,101,99,116,40,120,44,121,44,119,44,104,41,13,10,13,10,32,32, +108,111,99,97,108,32,99,108,44,99,116,44,99,119,44,99,104,32,61,32, +103,114,105,100,95,116,111,67,101,108,108,82,101,99,116,40,115,101,108,102, +46,99,101,108,108,83,105,122,101,44,32,120,44,121,44,119,44,104,41,13, +10,32,32,108,111,99,97,108,32,100,105,99,116,73,116,101,109,115,73,110, +67,101,108,108,82,101,99,116,32,61,32,103,101,116,68,105,99,116,73,116, +101,109,115,73,110,67,101,108,108,82,101,99,116,40,115,101,108,102,44,32, +99,108,44,99,116,44,99,119,44,99,104,41,13,10,13,10,32,32,108,111, +99,97,108,32,105,116,101,109,115,44,32,108,101,110,32,61,32,123,125,44, +32,48,13,10,13,10,32,32,108,111,99,97,108,32,114,101,99,116,13,10, 32,32,102,111,114,32,105,116,101,109,44,95,32,105,110,32,112,97,105,114, -115,40,115,101,108,102,46,114,101,99,116,115,41,32,100,111,13,10,32,32, -108,101,110,32,61,32,108,101,110,32,43,32,49,13,10,32,32,105,116,101, -109,115,91,108,101,110,93,32,61,32,105,116,101,109,13,10,32,32,101,110, -100,13,10,32,32,114,101,116,117,114,110,32,105,116,101,109,115,44,32,108, -101,110,13,10,101,110,100,13,10,13,10,102,117,110,99,116,105,111,110,32, -87,111,114,108,100,58,99,111,117,110,116,73,116,101,109,115,40,41,13,10, -32,32,108,111,99,97,108,32,108,101,110,32,61,32,48,13,10,32,32,102, -111,114,32,95,32,105,110,32,112,97,105,114,115,40,115,101,108,102,46,114, -101,99,116,115,41,32,100,111,32,108,101,110,32,61,32,108,101,110,32,43, -32,49,32,101,110,100,13,10,32,32,114,101,116,117,114,110,32,108,101,110, -13,10,101,110,100,13,10,13,10,102,117,110,99,116,105,111,110,32,87,111, -114,108,100,58,103,101,116,82,101,99,116,40,105,116,101,109,41,13,10,32, -32,108,111,99,97,108,32,114,101,99,116,32,61,32,115,101,108,102,46,114, -101,99,116,115,91,105,116,101,109,93,13,10,32,32,105,102,32,110,111,116, -32,114,101,99,116,32,116,104,101,110,13,10,32,32,101,114,114,111,114,40, -39,73,116,101,109,32,39,32,46,46,32,116,111,115,116,114,105,110,103,40, -105,116,101,109,41,32,46,46,32,39,32,109,117,115,116,32,98,101,32,97, -100,100,101,100,32,116,111,32,116,104,101,32,119,111,114,108,100,32,98,101, -102,111,114,101,32,103,101,116,116,105,110,103,32,105,116,115,32,114,101,99, -116,46,32,85,115,101,32,119,111,114,108,100,58,97,100,100,40,105,116,101, -109,44,32,120,44,121,44,119,44,104,41,32,116,111,32,97,100,100,32,105, -116,32,102,105,114,115,116,46,39,41,13,10,32,32,101,110,100,13,10,32, -32,114,101,116,117,114,110,32,114,101,99,116,46,120,44,32,114,101,99,116, -46,121,44,32,114,101,99,116,46,119,44,32,114,101,99,116,46,104,13,10, -101,110,100,13,10,13,10,102,117,110,99,116,105,111,110,32,87,111,114,108, -100,58,116,111,87,111,114,108,100,40,99,120,44,32,99,121,41,13,10,32, -32,114,101,116,117,114,110,32,103,114,105,100,95,116,111,87,111,114,108,100, -40,115,101,108,102,46,99,101,108,108,83,105,122,101,44,32,99,120,44,32, -99,121,41,13,10,101,110,100,13,10,13,10,102,117,110,99,116,105,111,110, -32,87,111,114,108,100,58,116,111,67,101,108,108,40,120,44,121,41,13,10, -32,32,114,101,116,117,114,110,32,103,114,105,100,95,116,111,67,101,108,108, -40,115,101,108,102,46,99,101,108,108,83,105,122,101,44,32,120,44,32,121, -41,13,10,101,110,100,13,10,13,10,13,10,45,45,45,32,81,117,101,114, -121,32,109,101,116,104,111,100,115,13,10,13,10,102,117,110,99,116,105,111, -110,32,87,111,114,108,100,58,113,117,101,114,121,82,101,99,116,40,120,44, -121,44,119,44,104,44,32,102,105,108,116,101,114,41,13,10,13,10,32,32, -97,115,115,101,114,116,73,115,82,101,99,116,40,120,44,121,44,119,44,104, -41,13,10,13,10,32,32,108,111,99,97,108,32,99,108,44,99,116,44,99, -119,44,99,104,32,61,32,103,114,105,100,95,116,111,67,101,108,108,82,101, -99,116,40,115,101,108,102,46,99,101,108,108,83,105,122,101,44,32,120,44, -121,44,119,44,104,41,13,10,32,32,108,111,99,97,108,32,100,105,99,116, -73,116,101,109,115,73,110,67,101,108,108,82,101,99,116,32,61,32,103,101, -116,68,105,99,116,73,116,101,109,115,73,110,67,101,108,108,82,101,99,116, -40,115,101,108,102,44,32,99,108,44,99,116,44,99,119,44,99,104,41,13, -10,13,10,32,32,108,111,99,97,108,32,105,116,101,109,115,44,32,108,101, -110,32,61,32,123,125,44,32,48,13,10,13,10,32,32,108,111,99,97,108, -32,114,101,99,116,13,10,32,32,102,111,114,32,105,116,101,109,44,95,32, -105,110,32,112,97,105,114,115,40,100,105,99,116,73,116,101,109,115,73,110, -67,101,108,108,82,101,99,116,41,32,100,111,13,10,32,32,114,101,99,116, -32,61,32,115,101,108,102,46,114,101,99,116,115,91,105,116,101,109,93,13, -10,32,32,105,102,32,40,110,111,116,32,102,105,108,116,101,114,32,111,114, -32,102,105,108,116,101,114,40,105,116,101,109,41,41,13,10,32,32,97,110, -100,32,114,101,99,116,95,105,115,73,110,116,101,114,115,101,99,116,105,110, -103,40,120,44,121,44,119,44,104,44,32,114,101,99,116,46,120,44,32,114, -101,99,116,46,121,44,32,114,101,99,116,46,119,44,32,114,101,99,116,46, -104,41,13,10,32,32,116,104,101,110,13,10,32,32,32,32,108,101,110,32, -61,32,108,101,110,32,43,32,49,13,10,32,32,32,32,105,116,101,109,115, -91,108,101,110,93,32,61,32,105,116,101,109,13,10,32,32,101,110,100,13, -10,32,32,101,110,100,13,10,13,10,32,32,114,101,116,117,114,110,32,105, -116,101,109,115,44,32,108,101,110,13,10,101,110,100,13,10,13,10,102,117, -110,99,116,105,111,110,32,87,111,114,108,100,58,113,117,101,114,121,80,111, -105,110,116,40,120,44,121,44,32,102,105,108,116,101,114,41,13,10,32,32, -108,111,99,97,108,32,99,120,44,99,121,32,61,32,115,101,108,102,58,116, -111,67,101,108,108,40,120,44,121,41,13,10,32,32,108,111,99,97,108,32, -100,105,99,116,73,116,101,109,115,73,110,67,101,108,108,82,101,99,116,32, -61,32,103,101,116,68,105,99,116,73,116,101,109,115,73,110,67,101,108,108, -82,101,99,116,40,115,101,108,102,44,32,99,120,44,99,121,44,49,44,49, -41,13,10,13,10,32,32,108,111,99,97,108,32,105,116,101,109,115,44,32, -108,101,110,32,61,32,123,125,44,32,48,13,10,13,10,32,32,108,111,99, -97,108,32,114,101,99,116,13,10,32,32,102,111,114,32,105,116,101,109,44, -95,32,105,110,32,112,97,105,114,115,40,100,105,99,116,73,116,101,109,115, -73,110,67,101,108,108,82,101,99,116,41,32,100,111,13,10,32,32,114,101, -99,116,32,61,32,115,101,108,102,46,114,101,99,116,115,91,105,116,101,109, -93,13,10,32,32,105,102,32,40,110,111,116,32,102,105,108,116,101,114,32, -111,114,32,102,105,108,116,101,114,40,105,116,101,109,41,41,13,10,32,32, -97,110,100,32,114,101,99,116,95,99,111,110,116,97,105,110,115,80,111,105, -110,116,40,114,101,99,116,46,120,44,32,114,101,99,116,46,121,44,32,114, -101,99,116,46,119,44,32,114,101,99,116,46,104,44,32,120,44,32,121,41, -13,10,32,32,116,104,101,110,13,10,32,32,32,32,108,101,110,32,61,32, -108,101,110,32,43,32,49,13,10,32,32,32,32,105,116,101,109,115,91,108, -101,110,93,32,61,32,105,116,101,109,13,10,32,32,101,110,100,13,10,32, -32,101,110,100,13,10,13,10,32,32,114,101,116,117,114,110,32,105,116,101, -109,115,44,32,108,101,110,13,10,101,110,100,13,10,13,10,102,117,110,99, -116,105,111,110,32,87,111,114,108,100,58,113,117,101,114,121,83,101,103,109, -101,110,116,40,120,49,44,32,121,49,44,32,120,50,44,32,121,50,44,32, -102,105,108,116,101,114,41,13,10,32,32,108,111,99,97,108,32,105,116,101, -109,73,110,102,111,44,32,108,101,110,32,61,32,103,101,116,73,110,102,111, -65,98,111,117,116,73,116,101,109,115,84,111,117,99,104,101,100,66,121,83, -101,103,109,101,110,116,40,115,101,108,102,44,32,120,49,44,32,121,49,44, -32,120,50,44,32,121,50,44,32,102,105,108,116,101,114,41,13,10,32,32, -108,111,99,97,108,32,105,116,101,109,115,32,61,32,123,125,13,10,32,32, -102,111,114,32,105,61,49,44,32,108,101,110,32,100,111,13,10,32,32,105, -116,101,109,115,91,105,93,32,61,32,105,116,101,109,73,110,102,111,91,105, -93,46,105,116,101,109,13,10,32,32,101,110,100,13,10,32,32,114,101,116, -117,114,110,32,105,116,101,109,115,44,32,108,101,110,13,10,101,110,100,13, -10,13,10,102,117,110,99,116,105,111,110,32,87,111,114,108,100,58,113,117, -101,114,121,83,101,103,109,101,110,116,87,105,116,104,67,111,111,114,100,115, -40,120,49,44,32,121,49,44,32,120,50,44,32,121,50,44,32,102,105,108, -116,101,114,41,13,10,32,32,108,111,99,97,108,32,105,116,101,109,73,110, -102,111,44,32,108,101,110,32,61,32,103,101,116,73,110,102,111,65,98,111, -117,116,73,116,101,109,115,84,111,117,99,104,101,100,66,121,83,101,103,109, -101,110,116,40,115,101,108,102,44,32,120,49,44,32,121,49,44,32,120,50, -44,32,121,50,44,32,102,105,108,116,101,114,41,13,10,32,32,108,111,99, -97,108,32,100,120,44,32,100,121,32,32,32,32,61,32,120,50,45,120,49, -44,32,121,50,45,121,49,13,10,32,32,108,111,99,97,108,32,105,110,102, -111,44,32,116,105,49,44,32,116,105,50,13,10,32,32,102,111,114,32,105, -61,49,44,32,108,101,110,32,100,111,13,10,32,32,105,110,102,111,32,32, -61,32,105,116,101,109,73,110,102,111,91,105,93,13,10,32,32,116,105,49, -32,32,32,61,32,105,110,102,111,46,116,105,49,13,10,32,32,116,105,50, -32,32,32,61,32,105,110,102,111,46,116,105,50,13,10,13,10,32,32,105, -110,102,111,46,119,101,105,103,104,116,32,32,61,32,110,105,108,13,10,32, -32,105,110,102,111,46,120,49,32,32,32,32,61,32,120,49,32,43,32,100, -120,32,42,32,116,105,49,13,10,32,32,105,110,102,111,46,121,49,32,32, -32,32,61,32,121,49,32,43,32,100,121,32,42,32,116,105,49,13,10,32, -32,105,110,102,111,46,120,50,32,32,32,32,61,32,120,49,32,43,32,100, -120,32,42,32,116,105,50,13,10,32,32,105,110,102,111,46,121,50,32,32, -32,32,61,32,121,49,32,43,32,100,121,32,42,32,116,105,50,13,10,32, -32,101,110,100,13,10,32,32,114,101,116,117,114,110,32,105,116,101,109,73, -110,102,111,44,32,108,101,110,13,10,101,110,100,13,10,13,10,13,10,45, -45,45,32,77,97,105,110,32,109,101,116,104,111,100,115,13,10,13,10,102, -117,110,99,116,105,111,110,32,87,111,114,108,100,58,97,100,100,40,105,116, -101,109,44,32,120,44,121,44,119,44,104,41,13,10,32,32,108,111,99,97, -108,32,114,101,99,116,32,61,32,115,101,108,102,46,114,101,99,116,115,91, -105,116,101,109,93,13,10,32,32,105,102,32,114,101,99,116,32,116,104,101, -110,13,10,32,32,101,114,114,111,114,40,39,73,116,101,109,32,39,32,46, -46,32,116,111,115,116,114,105,110,103,40,105,116,101,109,41,32,46,46,32, -39,32,97,100,100,101,100,32,116,111,32,116,104,101,32,119,111,114,108,100, -32,116,119,105,99,101,46,39,41,13,10,32,32,101,110,100,13,10,32,32, -97,115,115,101,114,116,73,115,82,101,99,116,40,120,44,121,44,119,44,104, -41,13,10,13,10,32,32,115,101,108,102,46,114,101,99,116,115,91,105,116, -101,109,93,32,61,32,123,120,61,120,44,121,61,121,44,119,61,119,44,104, -61,104,125,13,10,13,10,32,32,108,111,99,97,108,32,99,108,44,99,116, -44,99,119,44,99,104,32,61,32,103,114,105,100,95,116,111,67,101,108,108, -82,101,99,116,40,115,101,108,102,46,99,101,108,108,83,105,122,101,44,32, -120,44,121,44,119,44,104,41,13,10,32,32,102,111,114,32,99,121,32,61, -32,99,116,44,32,99,116,43,99,104,45,49,32,100,111,13,10,32,32,102, -111,114,32,99,120,32,61,32,99,108,44,32,99,108,43,99,119,45,49,32, -100,111,13,10,32,32,32,32,97,100,100,73,116,101,109,84,111,67,101,108, -108,40,115,101,108,102,44,32,105,116,101,109,44,32,99,120,44,32,99,121, -41,13,10,32,32,101,110,100,13,10,32,32,101,110,100,13,10,13,10,32, -32,114,101,116,117,114,110,32,105,116,101,109,13,10,101,110,100,13,10,13, -10,102,117,110,99,116,105,111,110,32,87,111,114,108,100,58,114,101,109,111, -118,101,40,105,116,101,109,41,13,10,32,32,108,111,99,97,108,32,120,44, -121,44,119,44,104,32,61,32,115,101,108,102,58,103,101,116,82,101,99,116, -40,105,116,101,109,41,13,10,13,10,32,32,115,101,108,102,46,114,101,99, -116,115,91,105,116,101,109,93,32,61,32,110,105,108,13,10,32,32,108,111, -99,97,108,32,99,108,44,99,116,44,99,119,44,99,104,32,61,32,103,114, -105,100,95,116,111,67,101,108,108,82,101,99,116,40,115,101,108,102,46,99, -101,108,108,83,105,122,101,44,32,120,44,121,44,119,44,104,41,13,10,32, -32,102,111,114,32,99,121,32,61,32,99,116,44,32,99,116,43,99,104,45, -49,32,100,111,13,10,32,32,102,111,114,32,99,120,32,61,32,99,108,44, -32,99,108,43,99,119,45,49,32,100,111,13,10,32,32,32,32,114,101,109, +115,40,100,105,99,116,73,116,101,109,115,73,110,67,101,108,108,82,101,99, +116,41,32,100,111,13,10,32,32,114,101,99,116,32,61,32,115,101,108,102, +46,114,101,99,116,115,91,105,116,101,109,93,13,10,32,32,105,102,32,40, +110,111,116,32,102,105,108,116,101,114,32,111,114,32,102,105,108,116,101,114, +40,105,116,101,109,41,41,13,10,32,32,97,110,100,32,114,101,99,116,95, +105,115,73,110,116,101,114,115,101,99,116,105,110,103,40,120,44,121,44,119, +44,104,44,32,114,101,99,116,46,120,44,32,114,101,99,116,46,121,44,32, +114,101,99,116,46,119,44,32,114,101,99,116,46,104,41,13,10,32,32,116, +104,101,110,13,10,9,108,101,110,32,61,32,108,101,110,32,43,32,49,13, +10,9,105,116,101,109,115,91,108,101,110,93,32,61,32,105,116,101,109,13, +10,32,32,101,110,100,13,10,32,32,101,110,100,13,10,13,10,32,32,114, +101,116,117,114,110,32,105,116,101,109,115,44,32,108,101,110,13,10,101,110, +100,13,10,13,10,102,117,110,99,116,105,111,110,32,87,111,114,108,100,58, +113,117,101,114,121,80,111,105,110,116,40,120,44,121,44,32,102,105,108,116, +101,114,41,13,10,32,32,108,111,99,97,108,32,99,120,44,99,121,32,61, +32,115,101,108,102,58,116,111,67,101,108,108,40,120,44,121,41,13,10,32, +32,108,111,99,97,108,32,100,105,99,116,73,116,101,109,115,73,110,67,101, +108,108,82,101,99,116,32,61,32,103,101,116,68,105,99,116,73,116,101,109, +115,73,110,67,101,108,108,82,101,99,116,40,115,101,108,102,44,32,99,120, +44,99,121,44,49,44,49,41,13,10,13,10,32,32,108,111,99,97,108,32, +105,116,101,109,115,44,32,108,101,110,32,61,32,123,125,44,32,48,13,10, +13,10,32,32,108,111,99,97,108,32,114,101,99,116,13,10,32,32,102,111, +114,32,105,116,101,109,44,95,32,105,110,32,112,97,105,114,115,40,100,105, +99,116,73,116,101,109,115,73,110,67,101,108,108,82,101,99,116,41,32,100, +111,13,10,32,32,114,101,99,116,32,61,32,115,101,108,102,46,114,101,99, +116,115,91,105,116,101,109,93,13,10,32,32,105,102,32,40,110,111,116,32, +102,105,108,116,101,114,32,111,114,32,102,105,108,116,101,114,40,105,116,101, +109,41,41,13,10,32,32,97,110,100,32,114,101,99,116,95,99,111,110,116, +97,105,110,115,80,111,105,110,116,40,114,101,99,116,46,120,44,32,114,101, +99,116,46,121,44,32,114,101,99,116,46,119,44,32,114,101,99,116,46,104, +44,32,120,44,32,121,41,13,10,32,32,116,104,101,110,13,10,9,108,101, +110,32,61,32,108,101,110,32,43,32,49,13,10,9,105,116,101,109,115,91, +108,101,110,93,32,61,32,105,116,101,109,13,10,32,32,101,110,100,13,10, +32,32,101,110,100,13,10,13,10,32,32,114,101,116,117,114,110,32,105,116, +101,109,115,44,32,108,101,110,13,10,101,110,100,13,10,13,10,102,117,110, +99,116,105,111,110,32,87,111,114,108,100,58,113,117,101,114,121,83,101,103, +109,101,110,116,40,120,49,44,32,121,49,44,32,120,50,44,32,121,50,44, +32,102,105,108,116,101,114,41,13,10,32,32,108,111,99,97,108,32,105,116, +101,109,73,110,102,111,44,32,108,101,110,32,61,32,103,101,116,73,110,102, +111,65,98,111,117,116,73,116,101,109,115,84,111,117,99,104,101,100,66,121, +83,101,103,109,101,110,116,40,115,101,108,102,44,32,120,49,44,32,121,49, +44,32,120,50,44,32,121,50,44,32,102,105,108,116,101,114,41,13,10,32, +32,108,111,99,97,108,32,105,116,101,109,115,32,61,32,123,125,13,10,32, +32,102,111,114,32,105,61,49,44,32,108,101,110,32,100,111,13,10,32,32, +105,116,101,109,115,91,105,93,32,61,32,105,116,101,109,73,110,102,111,91, +105,93,46,105,116,101,109,13,10,32,32,101,110,100,13,10,32,32,114,101, +116,117,114,110,32,105,116,101,109,115,44,32,108,101,110,13,10,101,110,100, +13,10,13,10,102,117,110,99,116,105,111,110,32,87,111,114,108,100,58,113, +117,101,114,121,83,101,103,109,101,110,116,87,105,116,104,67,111,111,114,100, +115,40,120,49,44,32,121,49,44,32,120,50,44,32,121,50,44,32,102,105, +108,116,101,114,41,13,10,32,32,108,111,99,97,108,32,105,116,101,109,73, +110,102,111,44,32,108,101,110,32,61,32,103,101,116,73,110,102,111,65,98, +111,117,116,73,116,101,109,115,84,111,117,99,104,101,100,66,121,83,101,103, +109,101,110,116,40,115,101,108,102,44,32,120,49,44,32,121,49,44,32,120, +50,44,32,121,50,44,32,102,105,108,116,101,114,41,13,10,32,32,108,111, +99,97,108,32,100,120,44,32,100,121,9,61,32,120,50,45,120,49,44,32, +121,50,45,121,49,13,10,32,32,108,111,99,97,108,32,105,110,102,111,44, +32,116,105,49,44,32,116,105,50,13,10,32,32,102,111,114,32,105,61,49, +44,32,108,101,110,32,100,111,13,10,32,32,105,110,102,111,32,32,61,32, +105,116,101,109,73,110,102,111,91,105,93,13,10,32,32,116,105,49,32,32, +32,61,32,105,110,102,111,46,116,105,49,13,10,32,32,116,105,50,32,32, +32,61,32,105,110,102,111,46,116,105,50,13,10,13,10,32,32,105,110,102, +111,46,119,101,105,103,104,116,32,32,61,32,110,105,108,13,10,32,32,105, +110,102,111,46,120,49,9,61,32,120,49,32,43,32,100,120,32,42,32,116, +105,49,13,10,32,32,105,110,102,111,46,121,49,9,61,32,121,49,32,43, +32,100,121,32,42,32,116,105,49,13,10,32,32,105,110,102,111,46,120,50, +9,61,32,120,49,32,43,32,100,120,32,42,32,116,105,50,13,10,32,32, +105,110,102,111,46,121,50,9,61,32,121,49,32,43,32,100,121,32,42,32, +116,105,50,13,10,32,32,101,110,100,13,10,32,32,114,101,116,117,114,110, +32,105,116,101,109,73,110,102,111,44,32,108,101,110,13,10,101,110,100,13, +10,13,10,13,10,45,45,45,32,77,97,105,110,32,109,101,116,104,111,100, +115,13,10,13,10,102,117,110,99,116,105,111,110,32,87,111,114,108,100,58, +97,100,100,40,105,116,101,109,44,32,120,44,121,44,119,44,104,41,13,10, +32,32,108,111,99,97,108,32,114,101,99,116,32,61,32,115,101,108,102,46, +114,101,99,116,115,91,105,116,101,109,93,13,10,32,32,105,102,32,114,101, +99,116,32,116,104,101,110,13,10,32,32,101,114,114,111,114,40,39,73,116, +101,109,32,39,32,46,46,32,116,111,115,116,114,105,110,103,40,105,116,101, +109,41,32,46,46,32,39,32,97,100,100,101,100,32,116,111,32,116,104,101, +32,119,111,114,108,100,32,116,119,105,99,101,46,39,41,13,10,32,32,101, +110,100,13,10,32,32,97,115,115,101,114,116,73,115,82,101,99,116,40,120, +44,121,44,119,44,104,41,13,10,13,10,32,32,115,101,108,102,46,114,101, +99,116,115,91,105,116,101,109,93,32,61,32,123,120,61,120,44,121,61,121, +44,119,61,119,44,104,61,104,125,13,10,13,10,32,32,108,111,99,97,108, +32,99,108,44,99,116,44,99,119,44,99,104,32,61,32,103,114,105,100,95, +116,111,67,101,108,108,82,101,99,116,40,115,101,108,102,46,99,101,108,108, +83,105,122,101,44,32,120,44,121,44,119,44,104,41,13,10,32,32,102,111, +114,32,99,121,32,61,32,99,116,44,32,99,116,43,99,104,45,49,32,100, +111,13,10,32,32,102,111,114,32,99,120,32,61,32,99,108,44,32,99,108, +43,99,119,45,49,32,100,111,13,10,9,97,100,100,73,116,101,109,84,111, +67,101,108,108,40,115,101,108,102,44,32,105,116,101,109,44,32,99,120,44, +32,99,121,41,13,10,32,32,101,110,100,13,10,32,32,101,110,100,13,10, +13,10,32,32,114,101,116,117,114,110,32,105,116,101,109,13,10,101,110,100, +13,10,13,10,102,117,110,99,116,105,111,110,32,87,111,114,108,100,58,114, +101,109,111,118,101,40,105,116,101,109,41,13,10,32,32,108,111,99,97,108, +32,120,44,121,44,119,44,104,32,61,32,115,101,108,102,58,103,101,116,82, +101,99,116,40,105,116,101,109,41,13,10,13,10,32,32,115,101,108,102,46, +114,101,99,116,115,91,105,116,101,109,93,32,61,32,110,105,108,13,10,32, +32,108,111,99,97,108,32,99,108,44,99,116,44,99,119,44,99,104,32,61, +32,103,114,105,100,95,116,111,67,101,108,108,82,101,99,116,40,115,101,108, +102,46,99,101,108,108,83,105,122,101,44,32,120,44,121,44,119,44,104,41, +13,10,32,32,102,111,114,32,99,121,32,61,32,99,116,44,32,99,116,43, +99,104,45,49,32,100,111,13,10,32,32,102,111,114,32,99,120,32,61,32, +99,108,44,32,99,108,43,99,119,45,49,32,100,111,13,10,9,114,101,109, 111,118,101,73,116,101,109,70,114,111,109,67,101,108,108,40,115,101,108,102, 44,32,105,116,101,109,44,32,99,120,44,32,99,121,41,13,10,32,32,101, 110,100,13,10,32,32,101,110,100,13,10,101,110,100,13,10,13,10,102,117, @@ -890,74 +875,71 @@ static char physics_lua[] = { 50,44,104,50,41,13,10,13,10,32,32,105,102,32,99,108,49,32,126,61, 32,99,108,50,32,111,114,32,99,116,49,32,126,61,32,99,116,50,32,111, 114,32,99,119,49,32,126,61,32,99,119,50,32,111,114,32,99,104,49,32, -126,61,32,99,104,50,32,116,104,101,110,13,10,13,10,32,32,32,32,108, -111,99,97,108,32,99,114,49,44,32,99,98,49,32,61,32,99,108,49,43, -99,119,49,45,49,44,32,99,116,49,43,99,104,49,45,49,13,10,32,32, -32,32,108,111,99,97,108,32,99,114,50,44,32,99,98,50,32,61,32,99, -108,50,43,99,119,50,45,49,44,32,99,116,50,43,99,104,50,45,49,13, -10,32,32,32,32,108,111,99,97,108,32,99,121,79,117,116,13,10,13,10, -32,32,32,32,102,111,114,32,99,121,32,61,32,99,116,49,44,32,99,98, -49,32,100,111,13,10,32,32,32,32,99,121,79,117,116,32,61,32,99,121, -32,60,32,99,116,50,32,111,114,32,99,121,32,62,32,99,98,50,13,10, -32,32,32,32,102,111,114,32,99,120,32,61,32,99,108,49,44,32,99,114, -49,32,100,111,13,10,32,32,32,32,32,32,105,102,32,99,121,79,117,116, -32,111,114,32,99,120,32,60,32,99,108,50,32,111,114,32,99,120,32,62, -32,99,114,50,32,116,104,101,110,13,10,32,32,32,32,32,32,114,101,109, -111,118,101,73,116,101,109,70,114,111,109,67,101,108,108,40,115,101,108,102, -44,32,105,116,101,109,44,32,99,120,44,32,99,121,41,13,10,32,32,32, -32,32,32,101,110,100,13,10,32,32,32,32,101,110,100,13,10,32,32,32, -32,101,110,100,13,10,13,10,32,32,32,32,102,111,114,32,99,121,32,61, -32,99,116,50,44,32,99,98,50,32,100,111,13,10,32,32,32,32,99,121, -79,117,116,32,61,32,99,121,32,60,32,99,116,49,32,111,114,32,99,121, -32,62,32,99,98,49,13,10,32,32,32,32,102,111,114,32,99,120,32,61, -32,99,108,50,44,32,99,114,50,32,100,111,13,10,32,32,32,32,32,32, -105,102,32,99,121,79,117,116,32,111,114,32,99,120,32,60,32,99,108,49, -32,111,114,32,99,120,32,62,32,99,114,49,32,116,104,101,110,13,10,32, -32,32,32,32,32,97,100,100,73,116,101,109,84,111,67,101,108,108,40,115, -101,108,102,44,32,105,116,101,109,44,32,99,120,44,32,99,121,41,13,10, -32,32,32,32,32,32,101,110,100,13,10,32,32,32,32,101,110,100,13,10, -32,32,32,32,101,110,100,13,10,13,10,32,32,101,110,100,13,10,13,10, -32,32,108,111,99,97,108,32,114,101,99,116,32,61,32,115,101,108,102,46, -114,101,99,116,115,91,105,116,101,109,93,13,10,32,32,114,101,99,116,46, -120,44,32,114,101,99,116,46,121,44,32,114,101,99,116,46,119,44,32,114, -101,99,116,46,104,32,61,32,120,50,44,121,50,44,119,50,44,104,50,13, -10,13,10,32,32,101,110,100,13,10,101,110,100,13,10,13,10,102,117,110, -99,116,105,111,110,32,87,111,114,108,100,58,109,111,118,101,40,105,116,101, -109,44,32,103,111,97,108,88,44,32,103,111,97,108,89,44,32,102,105,108, -116,101,114,41,13,10,32,32,108,111,99,97,108,32,97,99,116,117,97,108, -88,44,32,97,99,116,117,97,108,89,44,32,99,111,108,115,44,32,108,101, -110,32,61,32,115,101,108,102,58,99,104,101,99,107,40,105,116,101,109,44, -32,103,111,97,108,88,44,32,103,111,97,108,89,44,32,102,105,108,116,101, -114,41,13,10,13,10,32,32,115,101,108,102,58,117,112,100,97,116,101,40, -105,116,101,109,44,32,97,99,116,117,97,108,88,44,32,97,99,116,117,97, -108,89,41,13,10,13,10,32,32,114,101,116,117,114,110,32,97,99,116,117, -97,108,88,44,32,97,99,116,117,97,108,89,44,32,99,111,108,115,44,32, -108,101,110,13,10,101,110,100,13,10,13,10,102,117,110,99,116,105,111,110, -32,87,111,114,108,100,58,99,104,101,99,107,40,105,116,101,109,44,32,103, -111,97,108,88,44,32,103,111,97,108,89,44,32,102,105,108,116,101,114,41, -13,10,32,32,102,105,108,116,101,114,32,61,32,102,105,108,116,101,114,32, -111,114,32,100,101,102,97,117,108,116,70,105,108,116,101,114,13,10,13,10, -32,32,108,111,99,97,108,32,118,105,115,105,116,101,100,32,61,32,123,91, -105,116,101,109,93,32,61,32,116,114,117,101,125,13,10,32,32,108,111,99, -97,108,32,118,105,115,105,116,101,100,70,105,108,116,101,114,32,61,32,102, -117,110,99,116,105,111,110,40,105,116,109,44,32,111,116,104,101,114,41,13, -10,32,32,105,102,32,118,105,115,105,116,101,100,91,111,116,104,101,114,93, -32,116,104,101,110,32,114,101,116,117,114,110,32,102,97,108,115,101,32,101, -110,100,13,10,32,32,114,101,116,117,114,110,32,102,105,108,116,101,114,40, -105,116,109,44,32,111,116,104,101,114,41,13,10,32,32,101,110,100,13,10, -13,10,32,32,108,111,99,97,108,32,99,111,108,115,44,32,108,101,110,32, -61,32,123,125,44,32,48,13,10,13,10,32,32,108,111,99,97,108,32,120, -44,121,44,119,44,104,32,61,32,115,101,108,102,58,103,101,116,82,101,99, -116,40,105,116,101,109,41,13,10,13,10,32,32,108,111,99,97,108,32,112, -114,111,106,101,99,116,101,100,95,99,111,108,115,44,32,112,114,111,106,101, -99,116,101,100,95,108,101,110,32,61,32,115,101,108,102,58,112,114,111,106, -101,99,116,40,105,116,101,109,44,32,120,44,121,44,119,44,104,44,32,103, -111,97,108,88,44,103,111,97,108,89,44,32,118,105,115,105,116,101,100,70, -105,108,116,101,114,41,13,10,13,10,32,32,119,104,105,108,101,32,112,114, -111,106,101,99,116,101,100,95,108,101,110,32,62,32,48,32,100,111,13,10, -32,32,108,111,99,97,108,32,99,111,108,32,61,32,112,114,111,106,101,99, -116,101,100,95,99,111,108,115,91,49,93,13,10,32,32,108,101,110,32,32, -32,32,32,61,32,108,101,110,32,43,32,49,13,10,32,32,99,111,108,115, +126,61,32,99,104,50,32,116,104,101,110,13,10,13,10,9,108,111,99,97, +108,32,99,114,49,44,32,99,98,49,32,61,32,99,108,49,43,99,119,49, +45,49,44,32,99,116,49,43,99,104,49,45,49,13,10,9,108,111,99,97, +108,32,99,114,50,44,32,99,98,50,32,61,32,99,108,50,43,99,119,50, +45,49,44,32,99,116,50,43,99,104,50,45,49,13,10,9,108,111,99,97, +108,32,99,121,79,117,116,13,10,13,10,9,102,111,114,32,99,121,32,61, +32,99,116,49,44,32,99,98,49,32,100,111,13,10,9,99,121,79,117,116, +32,61,32,99,121,32,60,32,99,116,50,32,111,114,32,99,121,32,62,32, +99,98,50,13,10,9,102,111,114,32,99,120,32,61,32,99,108,49,44,32, +99,114,49,32,100,111,13,10,9,32,32,105,102,32,99,121,79,117,116,32, +111,114,32,99,120,32,60,32,99,108,50,32,111,114,32,99,120,32,62,32, +99,114,50,32,116,104,101,110,13,10,9,32,32,114,101,109,111,118,101,73, +116,101,109,70,114,111,109,67,101,108,108,40,115,101,108,102,44,32,105,116, +101,109,44,32,99,120,44,32,99,121,41,13,10,9,32,32,101,110,100,13, +10,9,101,110,100,13,10,9,101,110,100,13,10,13,10,9,102,111,114,32, +99,121,32,61,32,99,116,50,44,32,99,98,50,32,100,111,13,10,9,99, +121,79,117,116,32,61,32,99,121,32,60,32,99,116,49,32,111,114,32,99, +121,32,62,32,99,98,49,13,10,9,102,111,114,32,99,120,32,61,32,99, +108,50,44,32,99,114,50,32,100,111,13,10,9,32,32,105,102,32,99,121, +79,117,116,32,111,114,32,99,120,32,60,32,99,108,49,32,111,114,32,99, +120,32,62,32,99,114,49,32,116,104,101,110,13,10,9,32,32,97,100,100, +73,116,101,109,84,111,67,101,108,108,40,115,101,108,102,44,32,105,116,101, +109,44,32,99,120,44,32,99,121,41,13,10,9,32,32,101,110,100,13,10, +9,101,110,100,13,10,9,101,110,100,13,10,13,10,32,32,101,110,100,13, +10,13,10,32,32,108,111,99,97,108,32,114,101,99,116,32,61,32,115,101, +108,102,46,114,101,99,116,115,91,105,116,101,109,93,13,10,32,32,114,101, +99,116,46,120,44,32,114,101,99,116,46,121,44,32,114,101,99,116,46,119, +44,32,114,101,99,116,46,104,32,61,32,120,50,44,121,50,44,119,50,44, +104,50,13,10,13,10,32,32,101,110,100,13,10,101,110,100,13,10,13,10, +102,117,110,99,116,105,111,110,32,87,111,114,108,100,58,109,111,118,101,40, +105,116,101,109,44,32,103,111,97,108,88,44,32,103,111,97,108,89,44,32, +102,105,108,116,101,114,41,13,10,32,32,108,111,99,97,108,32,97,99,116, +117,97,108,88,44,32,97,99,116,117,97,108,89,44,32,99,111,108,115,44, +32,108,101,110,32,61,32,115,101,108,102,58,99,104,101,99,107,40,105,116, +101,109,44,32,103,111,97,108,88,44,32,103,111,97,108,89,44,32,102,105, +108,116,101,114,41,13,10,13,10,32,32,115,101,108,102,58,117,112,100,97, +116,101,40,105,116,101,109,44,32,97,99,116,117,97,108,88,44,32,97,99, +116,117,97,108,89,41,13,10,13,10,32,32,114,101,116,117,114,110,32,97, +99,116,117,97,108,88,44,32,97,99,116,117,97,108,89,44,32,99,111,108, +115,44,32,108,101,110,13,10,101,110,100,13,10,13,10,102,117,110,99,116, +105,111,110,32,87,111,114,108,100,58,99,104,101,99,107,40,105,116,101,109, +44,32,103,111,97,108,88,44,32,103,111,97,108,89,44,32,102,105,108,116, +101,114,41,13,10,32,32,102,105,108,116,101,114,32,61,32,102,105,108,116, +101,114,32,111,114,32,100,101,102,97,117,108,116,70,105,108,116,101,114,13, +10,13,10,32,32,108,111,99,97,108,32,118,105,115,105,116,101,100,32,61, +32,123,91,105,116,101,109,93,32,61,32,116,114,117,101,125,13,10,32,32, +108,111,99,97,108,32,118,105,115,105,116,101,100,70,105,108,116,101,114,32, +61,32,102,117,110,99,116,105,111,110,40,105,116,109,44,32,111,116,104,101, +114,41,13,10,32,32,105,102,32,118,105,115,105,116,101,100,91,111,116,104, +101,114,93,32,116,104,101,110,32,114,101,116,117,114,110,32,102,97,108,115, +101,32,101,110,100,13,10,32,32,114,101,116,117,114,110,32,102,105,108,116, +101,114,40,105,116,109,44,32,111,116,104,101,114,41,13,10,32,32,101,110, +100,13,10,13,10,32,32,108,111,99,97,108,32,99,111,108,115,44,32,108, +101,110,32,61,32,123,125,44,32,48,13,10,13,10,32,32,108,111,99,97, +108,32,120,44,121,44,119,44,104,32,61,32,115,101,108,102,58,103,101,116, +82,101,99,116,40,105,116,101,109,41,13,10,13,10,32,32,108,111,99,97, +108,32,112,114,111,106,101,99,116,101,100,95,99,111,108,115,44,32,112,114, +111,106,101,99,116,101,100,95,108,101,110,32,61,32,115,101,108,102,58,112, +114,111,106,101,99,116,40,105,116,101,109,44,32,120,44,121,44,119,44,104, +44,32,103,111,97,108,88,44,103,111,97,108,89,44,32,118,105,115,105,116, +101,100,70,105,108,116,101,114,41,13,10,13,10,32,32,119,104,105,108,101, +32,112,114,111,106,101,99,116,101,100,95,108,101,110,32,62,32,48,32,100, +111,13,10,32,32,108,111,99,97,108,32,99,111,108,32,61,32,112,114,111, +106,101,99,116,101,100,95,99,111,108,115,91,49,93,13,10,32,32,108,101, +110,9,32,61,32,108,101,110,32,43,32,49,13,10,32,32,99,111,108,115, 91,108,101,110,93,32,61,32,99,111,108,13,10,13,10,32,32,118,105,115, 105,116,101,100,91,99,111,108,46,111,116,104,101,114,93,32,61,32,116,114, 117,101,13,10,13,10,32,32,108,111,99,97,108,32,114,101,115,112,111,110, @@ -966,55 +948,52 @@ static char physics_lua[] = { 13,10,32,32,103,111,97,108,88,44,32,103,111,97,108,89,44,32,112,114, 111,106,101,99,116,101,100,95,99,111,108,115,44,32,112,114,111,106,101,99, 116,101,100,95,108,101,110,32,61,32,114,101,115,112,111,110,115,101,40,13, -10,32,32,32,32,115,101,108,102,44,13,10,32,32,32,32,99,111,108,44, -13,10,32,32,32,32,120,44,32,121,44,32,119,44,32,104,44,13,10,32, -32,32,32,103,111,97,108,88,44,32,103,111,97,108,89,44,13,10,32,32, -32,32,118,105,115,105,116,101,100,70,105,108,116,101,114,13,10,32,32,41, -13,10,32,32,101,110,100,13,10,13,10,32,32,114,101,116,117,114,110,32, -103,111,97,108,88,44,32,103,111,97,108,89,44,32,99,111,108,115,44,32, -108,101,110,13,10,101,110,100,13,10,13,10,13,10,45,45,32,80,117,98, -108,105,99,32,108,105,98,114,97,114,121,32,102,117,110,99,116,105,111,110, -115,13,10,13,10,98,117,109,112,46,110,101,119,87,111,114,108,100,32,61, -32,102,117,110,99,116,105,111,110,40,99,101,108,108,83,105,122,101,41,13, -10,32,32,99,101,108,108,83,105,122,101,32,61,32,99,101,108,108,83,105, -122,101,32,111,114,32,54,52,13,10,32,32,97,115,115,101,114,116,73,115, -80,111,115,105,116,105,118,101,78,117,109,98,101,114,40,99,101,108,108,83, -105,122,101,44,32,39,99,101,108,108,83,105,122,101,39,41,13,10,32,32, -108,111,99,97,108,32,119,111,114,108,100,32,61,32,115,101,116,109,101,116, -97,116,97,98,108,101,40,123,13,10,32,32,99,101,108,108,83,105,122,101, -32,32,32,32,32,61,32,99,101,108,108,83,105,122,101,44,13,10,32,32, -114,101,99,116,115,32,32,32,32,32,32,61,32,123,125,44,13,10,32,32, -114,111,119,115,32,32,32,32,32,32,32,61,32,123,125,44,13,10,32,32, -110,111,110,69,109,112,116,121,67,101,108,108,115,32,32,61,32,123,125,44, -13,10,32,32,114,101,115,112,111,110,115,101,115,32,61,32,123,125,13,10, -32,32,125,44,32,87,111,114,108,100,95,109,116,41,13,10,13,10,32,32, -119,111,114,108,100,58,97,100,100,82,101,115,112,111,110,115,101,40,39,116, -111,117,99,104,39,44,32,116,111,117,99,104,41,13,10,32,32,119,111,114, -108,100,58,97,100,100,82,101,115,112,111,110,115,101,40,39,99,114,111,115, -115,39,44,32,99,114,111,115,115,41,13,10,32,32,119,111,114,108,100,58, -97,100,100,82,101,115,112,111,110,115,101,40,39,115,108,105,100,101,39,44, -32,115,108,105,100,101,41,13,10,32,32,119,111,114,108,100,58,97,100,100, -82,101,115,112,111,110,115,101,40,39,98,111,117,110,99,101,39,44,32,98, -111,117,110,99,101,41,13,10,13,10,32,32,114,101,116,117,114,110,32,119, -111,114,108,100,13,10,101,110,100,13,10,13,10,98,117,109,112,46,114,101, -99,116,32,61,32,123,13,10,32,32,103,101,116,78,101,97,114,101,115,116, -67,111,114,110,101,114,32,32,32,32,32,32,32,32,61,32,114,101,99,116, -95,103,101,116,78,101,97,114,101,115,116,67,111,114,110,101,114,44,13,10, -32,32,103,101,116,83,101,103,109,101,110,116,73,110,116,101,114,115,101,99, -116,105,111,110,73,110,100,105,99,101,115,32,61,32,114,101,99,116,95,103, -101,116,83,101,103,109,101,110,116,73,110,116,101,114,115,101,99,116,105,111, -110,73,110,100,105,99,101,115,44,13,10,32,32,103,101,116,68,105,102,102, -32,32,32,32,32,32,32,32,32,32,32,32,32,61,32,114,101,99,116,95, -103,101,116,68,105,102,102,44,13,10,32,32,99,111,110,116,97,105,110,115, -80,111,105,110,116,32,32,32,32,32,32,32,32,32,61,32,114,101,99,116, -95,99,111,110,116,97,105,110,115,80,111,105,110,116,44,13,10,32,32,105, -115,73,110,116,101,114,115,101,99,116,105,110,103,32,32,32,32,32,32,32, -32,61,32,114,101,99,116,95,105,115,73,110,116,101,114,115,101,99,116,105, -110,103,44,13,10,32,32,103,101,116,83,113,117,97,114,101,68,105,115,116, -97,110,99,101,32,32,32,32,32,32,32,61,32,114,101,99,116,95,103,101, -116,83,113,117,97,114,101,68,105,115,116,97,110,99,101,44,13,10,32,32, -100,101,116,101,99,116,67,111,108,108,105,115,105,111,110,32,32,32,32,32, -32,32,32,32,61,32,114,101,99,116,95,100,101,116,101,99,116,67,111,108, +10,9,115,101,108,102,44,13,10,9,99,111,108,44,13,10,9,120,44,32, +121,44,32,119,44,32,104,44,13,10,9,103,111,97,108,88,44,32,103,111, +97,108,89,44,13,10,9,118,105,115,105,116,101,100,70,105,108,116,101,114, +13,10,32,32,41,13,10,32,32,101,110,100,13,10,13,10,32,32,114,101, +116,117,114,110,32,103,111,97,108,88,44,32,103,111,97,108,89,44,32,99, +111,108,115,44,32,108,101,110,13,10,101,110,100,13,10,13,10,13,10,45, +45,32,80,117,98,108,105,99,32,108,105,98,114,97,114,121,32,102,117,110, +99,116,105,111,110,115,13,10,13,10,98,117,109,112,46,110,101,119,87,111, +114,108,100,32,61,32,102,117,110,99,116,105,111,110,40,99,101,108,108,83, +105,122,101,41,13,10,32,32,99,101,108,108,83,105,122,101,32,61,32,99, +101,108,108,83,105,122,101,32,111,114,32,54,52,13,10,32,32,97,115,115, +101,114,116,73,115,80,111,115,105,116,105,118,101,78,117,109,98,101,114,40, +99,101,108,108,83,105,122,101,44,32,39,99,101,108,108,83,105,122,101,39, +41,13,10,32,32,108,111,99,97,108,32,119,111,114,108,100,32,61,32,115, +101,116,109,101,116,97,116,97,98,108,101,40,123,13,10,32,32,99,101,108, +108,83,105,122,101,9,32,61,32,99,101,108,108,83,105,122,101,44,13,10, +32,32,114,101,99,116,115,9,32,32,61,32,123,125,44,13,10,32,32,114, +111,119,115,9,32,32,32,61,32,123,125,44,13,10,32,32,110,111,110,69, +109,112,116,121,67,101,108,108,115,32,32,61,32,123,125,44,13,10,32,32, +114,101,115,112,111,110,115,101,115,32,61,32,123,125,13,10,32,32,125,44, +32,87,111,114,108,100,95,109,116,41,13,10,13,10,32,32,119,111,114,108, +100,58,97,100,100,82,101,115,112,111,110,115,101,40,39,116,111,117,99,104, +39,44,32,116,111,117,99,104,41,13,10,32,32,119,111,114,108,100,58,97, +100,100,82,101,115,112,111,110,115,101,40,39,99,114,111,115,115,39,44,32, +99,114,111,115,115,41,13,10,32,32,119,111,114,108,100,58,97,100,100,82, +101,115,112,111,110,115,101,40,39,115,108,105,100,101,39,44,32,115,108,105, +100,101,41,13,10,32,32,119,111,114,108,100,58,97,100,100,82,101,115,112, +111,110,115,101,40,39,98,111,117,110,99,101,39,44,32,98,111,117,110,99, +101,41,13,10,13,10,32,32,114,101,116,117,114,110,32,119,111,114,108,100, +13,10,101,110,100,13,10,13,10,98,117,109,112,46,114,101,99,116,32,61, +32,123,13,10,32,32,103,101,116,78,101,97,114,101,115,116,67,111,114,110, +101,114,9,9,61,32,114,101,99,116,95,103,101,116,78,101,97,114,101,115, +116,67,111,114,110,101,114,44,13,10,32,32,103,101,116,83,101,103,109,101, +110,116,73,110,116,101,114,115,101,99,116,105,111,110,73,110,100,105,99,101, +115,32,61,32,114,101,99,116,95,103,101,116,83,101,103,109,101,110,116,73, +110,116,101,114,115,101,99,116,105,111,110,73,110,100,105,99,101,115,44,13, +10,32,32,103,101,116,68,105,102,102,9,9,9,32,61,32,114,101,99,116, +95,103,101,116,68,105,102,102,44,13,10,32,32,99,111,110,116,97,105,110, +115,80,111,105,110,116,9,9,32,61,32,114,101,99,116,95,99,111,110,116, +97,105,110,115,80,111,105,110,116,44,13,10,32,32,105,115,73,110,116,101, +114,115,101,99,116,105,110,103,9,9,61,32,114,101,99,116,95,105,115,73, +110,116,101,114,115,101,99,116,105,110,103,44,13,10,32,32,103,101,116,83, +113,117,97,114,101,68,105,115,116,97,110,99,101,9,32,32,32,61,32,114, +101,99,116,95,103,101,116,83,113,117,97,114,101,68,105,115,116,97,110,99, +101,44,13,10,32,32,100,101,116,101,99,116,67,111,108,108,105,115,105,111, +110,9,9,32,61,32,114,101,99,116,95,100,101,116,101,99,116,67,111,108, 108,105,115,105,111,110,13,10,125,13,10,13,10,98,117,109,112,46,114,101, 115,112,111,110,115,101,115,32,61,32,123,13,10,32,32,116,111,117,99,104, 32,32,61,32,116,111,117,99,104,44,13,10,32,32,99,114,111,115,115,32, diff --git a/src/libjin-lua/scripts/time/time.lua b/src/libjin-lua/scripts/time/time.lua index 4f4a37b..c4e8cb6 100644 --- a/src/libjin-lua/scripts/time/time.lua +++ b/src/libjin-lua/scripts/time/time.lua @@ -16,10 +16,10 @@ jin.time.step = function() -- Update fps t = t + jin.time.getDelta() if t > 1 then - t = t - 1 - fps = f + 1 - f = 0 + t = t - 1 + fps = f + 1 + f = 0 else - f = f + 1 + f = f + 1 end end diff --git a/src/libjin-lua/scripts/time/time.lua.h b/src/libjin-lua/scripts/time/time.lua.h index 537648d..471978c 100644 --- a/src/libjin-lua/scripts/time/time.lua.h +++ b/src/libjin-lua/scripts/time/time.lua.h @@ -13,10 +13,9 @@ static char time_lua[] = { 45,32,85,112,100,97,116,101,32,102,112,115,13,10,32,32,116,32,61,32, 116,32,43,32,106,105,110,46,116,105,109,101,46,103,101,116,68,101,108,116, 97,40,41,32,13,10,32,32,105,102,32,116,32,62,32,49,32,116,104,101, -110,32,13,10,32,32,32,32,116,32,61,32,116,32,45,32,49,32,13,10, -32,32,32,32,102,112,115,32,61,32,102,32,43,32,49,13,10,32,32,32, -32,102,32,61,32,48,13,10,32,32,101,108,115,101,32,13,10,32,32,32, -32,102,32,61,32,102,32,43,32,49,13,10,32,32,101,110,100,13,10,101, -110,100,32,13,10,0 +110,32,13,10,9,116,32,61,32,116,32,45,32,49,32,13,10,9,102,112, +115,32,61,32,102,32,43,32,49,13,10,9,102,32,61,32,48,13,10,32, +32,101,108,115,101,32,13,10,9,102,32,61,32,102,32,43,32,49,13,10, +32,32,101,110,100,13,10,101,110,100,32,13,10,0 }; diff --git a/src/libjin-lua/scripts/utils/json.lua b/src/libjin-lua/scripts/utils/json.lua index 4f84400..7805500 100644 --- a/src/libjin-lua/scripts/utils/json.lua +++ b/src/libjin-lua/scripts/utils/json.lua @@ -49,34 +49,34 @@ local function encode_table(val, stack) stack[val] = true if val[1] ~= nil or next(val) == nil then - -- Treat as array -- check keys are valid and it is not sparse - local n = 0 - for k in pairs(val) do - if type(k) ~= "number" then - error("invalid table: mixed or invalid key types") - end - n = n + 1 - end - if n ~= #val then - error("invalid table: sparse array") - end - -- Encode - for i, v in ipairs(val) do - table.insert(res, encode(v, stack)) - end - stack[val] = nil - return "[" .. table.concat(res, ",") .. "]" + -- Treat as array -- check keys are valid and it is not sparse + local n = 0 + for k in pairs(val) do + if type(k) ~= "number" then + error("invalid table: mixed or invalid key types") + end + n = n + 1 + end + if n ~= #val then + error("invalid table: sparse array") + end + -- Encode + for i, v in ipairs(val) do + table.insert(res, encode(v, stack)) + end + stack[val] = nil + return "[" .. table.concat(res, ",") .. "]" else - -- Treat as an object - for k, v in pairs(val) do - if type(k) ~= "string" then - error("invalid table: mixed or invalid key types") - end - table.insert(res, encode(k, stack) .. ":" .. encode(v, stack)) - end - stack[val] = nil - return "{" .. table.concat(res, ",") .. "}" + -- Treat as an object + for k, v in pairs(val) do + if type(k) ~= "string" then + error("invalid table: mixed or invalid key types") + end + table.insert(res, encode(k, stack) .. ":" .. encode(v, stack)) + end + stack[val] = nil + return "{" .. table.concat(res, ",") .. "}" end end @@ -89,14 +89,14 @@ end local function encode_number(val) -- Check for NaN, -inf and inf if val ~= val or val <= -math.huge or val >= math.huge then - error("unexpected number value '" .. tostring(val) .. "'") + error("unexpected number value '" .. tostring(val) .. "'") end return string.format("%.14g", val) end local type_func_map = { - [ "nil" ] = encode_nil, + [ "nil" ] = encode_nil, [ "table" ] = encode_table, [ "string" ] = encode_string, [ "number" ] = encode_number, @@ -108,7 +108,7 @@ encode = function(val, stack) local t = type(val) local f = type_func_map[t] if f then - return f(val, stack) + return f(val, stack) end error("unexpected type '" .. t .. "'") end @@ -128,7 +128,7 @@ local parse local function create_set(...) local res = {} for i = 1, select("#", ...) do - res[ select(i, ...) ] = true + res[ select(i, ...) ] = true end return res end @@ -136,7 +136,7 @@ end local space_chars = create_set(" ", "\t", "\r", "\n") local delim_chars = create_set(" ", "\t", "\r", "\n", "]", "}", ",") local escape_chars = create_set("\\", "/", '"', "b", "f", "n", "r", "t", "u") -local literals = create_set("true", "false", "null") +local literals = create_set("true", "false", "null") local literal_map = { [ "true" ] = true, @@ -147,9 +147,9 @@ local literal_map = { local function next_char(str, idx, set, negate) for i = idx, #str do - if set[str:sub(i, i)] ~= negate then - return i - end + if set[str:sub(i, i)] ~= negate then + return i + end end return #str + 1 end @@ -159,11 +159,11 @@ local function decode_error(str, idx, msg) local line_count = 1 local col_count = 1 for i = 1, idx - 1 do - col_count = col_count + 1 - if str:sub(i, i) == "\n" then - line_count = line_count + 1 - col_count = 1 - end + col_count = col_count + 1 + if str:sub(i, i) == "\n" then + line_count = line_count + 1 + col_count = 1 + end end error( string.format("%s at line %d col %d", msg, line_count, col_count) ) end @@ -173,14 +173,14 @@ local function codepoint_to_utf8(n) -- http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=iws-appendixa local f = math.floor if n <= 0x7f then - return string.char(n) + return string.char(n) elseif n <= 0x7ff then - return string.char(f(n / 64) + 192, n % 64 + 128) + return string.char(f(n / 64) + 192, n % 64 + 128) elseif n <= 0xffff then - return string.char(f(n / 4096) + 224, f(n % 4096 / 64) + 128, n % 64 + 128) + return string.char(f(n / 4096) + 224, f(n % 4096 / 64) + 128, n % 64 + 128) elseif n <= 0x10ffff then - return string.char(f(n / 262144) + 240, f(n % 262144 / 4096) + 128, - f(n % 4096 / 64) + 128, n % 64 + 128) + return string.char(f(n / 262144) + 240, f(n % 262144 / 4096) + 128, + f(n % 4096 / 64) + 128, n % 64 + 128) end error( string.format("invalid unicode codepoint '%x'", n) ) end @@ -191,9 +191,9 @@ local function parse_unicode_escape(s) local n2 = tonumber( s:sub(9, 12), 16 ) -- Surrogate pair? if n2 then - return codepoint_to_utf8((n1 - 0xd800) * 0x400 + (n2 - 0xdc00) + 0x10000) + return codepoint_to_utf8((n1 - 0xd800) * 0x400 + (n2 - 0xdc00) + 0x10000) else - return codepoint_to_utf8(n1) + return codepoint_to_utf8(n1) end end @@ -204,48 +204,48 @@ local function parse_string(str, i) local has_escape = false local last for j = i + 1, #str do - local x = str:byte(j) - - if x < 32 then - decode_error(str, j, "control character in string") - end - - if last == 92 then -- "\\" (escape char) - if x == 117 then -- "u" (unicode escape sequence) - local hex = str:sub(j + 1, j + 5) - if not hex:find("%x%x%x%x") then - decode_error(str, j, "invalid unicode escape in string") - end - if hex:find("^[dD][89aAbB]") then - has_surrogate_escape = true - else - has_unicode_escape = true - end - else - local c = string.char(x) - if not escape_chars[c] then - decode_error(str, j, "invalid escape char '" .. c .. "' in string") - end - has_escape = true - end - last = nil - - elseif x == 34 then -- '"' (end of string) - local s = str:sub(i + 1, j - 1) - if has_surrogate_escape then - s = s:gsub("\\u[dD][89aAbB]..\\u....", parse_unicode_escape) - end - if has_unicode_escape then - s = s:gsub("\\u....", parse_unicode_escape) - end - if has_escape then - s = s:gsub("\\.", escape_char_map_inv) - end - return s, j + 1 - - else - last = x - end + local x = str:byte(j) + + if x < 32 then + decode_error(str, j, "control character in string") + end + + if last == 92 then -- "\\" (escape char) + if x == 117 then -- "u" (unicode escape sequence) + local hex = str:sub(j + 1, j + 5) + if not hex:find("%x%x%x%x") then + decode_error(str, j, "invalid unicode escape in string") + end + if hex:find("^[dD][89aAbB]") then + has_surrogate_escape = true + else + has_unicode_escape = true + end + else + local c = string.char(x) + if not escape_chars[c] then + decode_error(str, j, "invalid escape char '" .. c .. "' in string") + end + has_escape = true + end + last = nil + + elseif x == 34 then -- '"' (end of string) + local s = str:sub(i + 1, j - 1) + if has_surrogate_escape then + s = s:gsub("\\u[dD][89aAbB]..\\u....", parse_unicode_escape) + end + if has_unicode_escape then + s = s:gsub("\\u....", parse_unicode_escape) + end + if has_escape then + s = s:gsub("\\.", escape_char_map_inv) + end + return s, j + 1 + + else + last = x + end end decode_error(str, i, "expected closing quote for string") end @@ -256,7 +256,7 @@ local function parse_number(str, i) local s = str:sub(i, x - 1) local n = tonumber(s) if not n then - decode_error(str, i, "invalid number '" .. s .. "'") + decode_error(str, i, "invalid number '" .. s .. "'") end return n, x end @@ -266,7 +266,7 @@ local function parse_literal(str, i) local x = next_char(str, i, delim_chars) local word = str:sub(i, x - 1) if not literals[word] then - decode_error(str, i, "invalid literal '" .. word .. "'") + decode_error(str, i, "invalid literal '" .. word .. "'") end return literal_map[word], x end @@ -277,23 +277,23 @@ local function parse_array(str, i) local n = 1 i = i + 1 while 1 do - local x - i = next_char(str, i, space_chars, true) - -- Empty / end of array? - if str:sub(i, i) == "]" then - i = i + 1 - break - end - -- Read token - x, i = parse(str, i) - res[n] = x - n = n + 1 - -- Next token - i = next_char(str, i, space_chars, true) - local chr = str:sub(i, i) - i = i + 1 - if chr == "]" then break end - if chr ~= "," then decode_error(str, i, "expected ']' or ','") end + local x + i = next_char(str, i, space_chars, true) + -- Empty / end of array? + if str:sub(i, i) == "]" then + i = i + 1 + break + end + -- Read token + x, i = parse(str, i) + res[n] = x + n = n + 1 + -- Next token + i = next_char(str, i, space_chars, true) + local chr = str:sub(i, i) + i = i + 1 + if chr == "]" then break end + if chr ~= "," then decode_error(str, i, "expected ']' or ','") end end return res, i end @@ -303,34 +303,34 @@ local function parse_object(str, i) local res = {} i = i + 1 while 1 do - local key, val - i = next_char(str, i, space_chars, true) - -- Empty / end of object? - if str:sub(i, i) == "}" then - i = i + 1 - break - end - -- Read key - if str:sub(i, i) ~= '"' then - decode_error(str, i, "expected string for key") - end - key, i = parse(str, i) - -- Read ':' delimiter - i = next_char(str, i, space_chars, true) - if str:sub(i, i) ~= ":" then - decode_error(str, i, "expected ':' after key") - end - i = next_char(str, i + 1, space_chars, true) - -- Read value - val, i = parse(str, i) - -- Set - res[key] = val - -- Next token - i = next_char(str, i, space_chars, true) - local chr = str:sub(i, i) - i = i + 1 - if chr == "}" then break end - if chr ~= "," then decode_error(str, i, "expected '}' or ','") end + local key, val + i = next_char(str, i, space_chars, true) + -- Empty / end of object? + if str:sub(i, i) == "}" then + i = i + 1 + break + end + -- Read key + if str:sub(i, i) ~= '"' then + decode_error(str, i, "expected string for key") + end + key, i = parse(str, i) + -- Read ':' delimiter + i = next_char(str, i, space_chars, true) + if str:sub(i, i) ~= ":" then + decode_error(str, i, "expected ':' after key") + end + i = next_char(str, i + 1, space_chars, true) + -- Read value + val, i = parse(str, i) + -- Set + res[key] = val + -- Next token + i = next_char(str, i, space_chars, true) + local chr = str:sub(i, i) + i = i + 1 + if chr == "}" then break end + if chr ~= "," then decode_error(str, i, "expected '}' or ','") end end return res, i end @@ -361,7 +361,7 @@ parse = function(str, idx) local chr = str:sub(idx, idx) local f = char_func_map[chr] if f then - return f(str, idx) + return f(str, idx) end decode_error(str, idx, "unexpected character '" .. chr .. "'") end @@ -369,12 +369,12 @@ end function json.decode(str) if type(str) ~= "string" then - error("expected argument of type string, got " .. type(str)) + error("expected argument of type string, got " .. type(str)) end local res, idx = parse(str, next_char(str, 1, space_chars, true)) idx = next_char(str, idx, space_chars, true) if idx <= #str then - decode_error(str, idx, "trailing garbage") + decode_error(str, idx, "trailing garbage") end return res end diff --git a/src/libjin-lua/scripts/utils/json.lua.h b/src/libjin-lua/scripts/utils/json.lua.h index 4b95a44..0fa9d03 100644 --- a/src/libjin-lua/scripts/utils/json.lua.h +++ b/src/libjin-lua/scripts/utils/json.lua.h @@ -62,435 +62,411 @@ static char json_lua[] = { 118,97,108,93,32,61,32,116,114,117,101,13,10,13,10,32,32,105,102,32, 118,97,108,91,49,93,32,126,61,32,110,105,108,32,111,114,32,110,101,120, 116,40,118,97,108,41,32,61,61,32,110,105,108,32,116,104,101,110,13,10, -32,32,32,32,45,45,32,84,114,101,97,116,32,97,115,32,97,114,114,97, -121,32,45,45,32,99,104,101,99,107,32,107,101,121,115,32,97,114,101,32, -118,97,108,105,100,32,97,110,100,32,105,116,32,105,115,32,110,111,116,32, -115,112,97,114,115,101,13,10,32,32,32,32,108,111,99,97,108,32,110,32, -61,32,48,13,10,32,32,32,32,102,111,114,32,107,32,105,110,32,112,97, -105,114,115,40,118,97,108,41,32,100,111,13,10,32,32,32,32,32,32,105, -102,32,116,121,112,101,40,107,41,32,126,61,32,34,110,117,109,98,101,114, -34,32,116,104,101,110,13,10,32,32,32,32,32,32,32,32,101,114,114,111, -114,40,34,105,110,118,97,108,105,100,32,116,97,98,108,101,58,32,109,105, -120,101,100,32,111,114,32,105,110,118,97,108,105,100,32,107,101,121,32,116, -121,112,101,115,34,41,13,10,32,32,32,32,32,32,101,110,100,13,10,32, -32,32,32,32,32,110,32,61,32,110,32,43,32,49,13,10,32,32,32,32, -101,110,100,13,10,32,32,32,32,105,102,32,110,32,126,61,32,35,118,97, -108,32,116,104,101,110,13,10,32,32,32,32,32,32,101,114,114,111,114,40, -34,105,110,118,97,108,105,100,32,116,97,98,108,101,58,32,115,112,97,114, -115,101,32,97,114,114,97,121,34,41,13,10,32,32,32,32,101,110,100,13, -10,32,32,32,32,45,45,32,69,110,99,111,100,101,13,10,32,32,32,32, -102,111,114,32,105,44,32,118,32,105,110,32,105,112,97,105,114,115,40,118, -97,108,41,32,100,111,13,10,32,32,32,32,32,32,116,97,98,108,101,46, -105,110,115,101,114,116,40,114,101,115,44,32,101,110,99,111,100,101,40,118, -44,32,115,116,97,99,107,41,41,13,10,32,32,32,32,101,110,100,13,10, -32,32,32,32,115,116,97,99,107,91,118,97,108,93,32,61,32,110,105,108, -13,10,32,32,32,32,114,101,116,117,114,110,32,34,91,34,32,46,46,32, +9,45,45,32,84,114,101,97,116,32,97,115,32,97,114,114,97,121,32,45, +45,32,99,104,101,99,107,32,107,101,121,115,32,97,114,101,32,118,97,108, +105,100,32,97,110,100,32,105,116,32,105,115,32,110,111,116,32,115,112,97, +114,115,101,13,10,9,108,111,99,97,108,32,110,32,61,32,48,13,10,9, +102,111,114,32,107,32,105,110,32,112,97,105,114,115,40,118,97,108,41,32, +100,111,13,10,9,32,32,105,102,32,116,121,112,101,40,107,41,32,126,61, +32,34,110,117,109,98,101,114,34,32,116,104,101,110,13,10,9,9,101,114, +114,111,114,40,34,105,110,118,97,108,105,100,32,116,97,98,108,101,58,32, +109,105,120,101,100,32,111,114,32,105,110,118,97,108,105,100,32,107,101,121, +32,116,121,112,101,115,34,41,13,10,9,32,32,101,110,100,13,10,9,32, +32,110,32,61,32,110,32,43,32,49,13,10,9,101,110,100,13,10,9,105, +102,32,110,32,126,61,32,35,118,97,108,32,116,104,101,110,13,10,9,32, +32,101,114,114,111,114,40,34,105,110,118,97,108,105,100,32,116,97,98,108, +101,58,32,115,112,97,114,115,101,32,97,114,114,97,121,34,41,13,10,9, +101,110,100,13,10,9,45,45,32,69,110,99,111,100,101,13,10,9,102,111, +114,32,105,44,32,118,32,105,110,32,105,112,97,105,114,115,40,118,97,108, +41,32,100,111,13,10,9,32,32,116,97,98,108,101,46,105,110,115,101,114, +116,40,114,101,115,44,32,101,110,99,111,100,101,40,118,44,32,115,116,97, +99,107,41,41,13,10,9,101,110,100,13,10,9,115,116,97,99,107,91,118, +97,108,93,32,61,32,110,105,108,13,10,9,114,101,116,117,114,110,32,34, +91,34,32,46,46,32,116,97,98,108,101,46,99,111,110,99,97,116,40,114, +101,115,44,32,34,44,34,41,32,46,46,32,34,93,34,13,10,13,10,32, +32,101,108,115,101,13,10,9,45,45,32,84,114,101,97,116,32,97,115,32, +97,110,32,111,98,106,101,99,116,13,10,9,102,111,114,32,107,44,32,118, +32,105,110,32,112,97,105,114,115,40,118,97,108,41,32,100,111,13,10,9, +32,32,105,102,32,116,121,112,101,40,107,41,32,126,61,32,34,115,116,114, +105,110,103,34,32,116,104,101,110,13,10,9,9,101,114,114,111,114,40,34, +105,110,118,97,108,105,100,32,116,97,98,108,101,58,32,109,105,120,101,100, +32,111,114,32,105,110,118,97,108,105,100,32,107,101,121,32,116,121,112,101, +115,34,41,13,10,9,32,32,101,110,100,13,10,9,32,32,116,97,98,108, +101,46,105,110,115,101,114,116,40,114,101,115,44,32,101,110,99,111,100,101, +40,107,44,32,115,116,97,99,107,41,32,46,46,32,34,58,34,32,46,46, +32,101,110,99,111,100,101,40,118,44,32,115,116,97,99,107,41,41,13,10, +9,101,110,100,13,10,9,115,116,97,99,107,91,118,97,108,93,32,61,32, +110,105,108,13,10,9,114,101,116,117,114,110,32,34,123,34,32,46,46,32, 116,97,98,108,101,46,99,111,110,99,97,116,40,114,101,115,44,32,34,44, -34,41,32,46,46,32,34,93,34,13,10,13,10,32,32,101,108,115,101,13, -10,32,32,32,32,45,45,32,84,114,101,97,116,32,97,115,32,97,110,32, -111,98,106,101,99,116,13,10,32,32,32,32,102,111,114,32,107,44,32,118, -32,105,110,32,112,97,105,114,115,40,118,97,108,41,32,100,111,13,10,32, -32,32,32,32,32,105,102,32,116,121,112,101,40,107,41,32,126,61,32,34, -115,116,114,105,110,103,34,32,116,104,101,110,13,10,32,32,32,32,32,32, -32,32,101,114,114,111,114,40,34,105,110,118,97,108,105,100,32,116,97,98, -108,101,58,32,109,105,120,101,100,32,111,114,32,105,110,118,97,108,105,100, -32,107,101,121,32,116,121,112,101,115,34,41,13,10,32,32,32,32,32,32, -101,110,100,13,10,32,32,32,32,32,32,116,97,98,108,101,46,105,110,115, -101,114,116,40,114,101,115,44,32,101,110,99,111,100,101,40,107,44,32,115, -116,97,99,107,41,32,46,46,32,34,58,34,32,46,46,32,101,110,99,111, -100,101,40,118,44,32,115,116,97,99,107,41,41,13,10,32,32,32,32,101, -110,100,13,10,32,32,32,32,115,116,97,99,107,91,118,97,108,93,32,61, -32,110,105,108,13,10,32,32,32,32,114,101,116,117,114,110,32,34,123,34, -32,46,46,32,116,97,98,108,101,46,99,111,110,99,97,116,40,114,101,115, -44,32,34,44,34,41,32,46,46,32,34,125,34,13,10,32,32,101,110,100, -13,10,101,110,100,13,10,13,10,13,10,108,111,99,97,108,32,102,117,110, -99,116,105,111,110,32,101,110,99,111,100,101,95,115,116,114,105,110,103,40, -118,97,108,41,13,10,32,32,114,101,116,117,114,110,32,39,34,39,32,46, -46,32,118,97,108,58,103,115,117,98,40,39,91,37,122,92,49,45,92,51, -49,92,92,34,93,39,44,32,101,115,99,97,112,101,95,99,104,97,114,41, -32,46,46,32,39,34,39,13,10,101,110,100,13,10,13,10,13,10,108,111, -99,97,108,32,102,117,110,99,116,105,111,110,32,101,110,99,111,100,101,95, -110,117,109,98,101,114,40,118,97,108,41,13,10,32,32,45,45,32,67,104, -101,99,107,32,102,111,114,32,78,97,78,44,32,45,105,110,102,32,97,110, -100,32,105,110,102,13,10,32,32,105,102,32,118,97,108,32,126,61,32,118, -97,108,32,111,114,32,118,97,108,32,60,61,32,45,109,97,116,104,46,104, -117,103,101,32,111,114,32,118,97,108,32,62,61,32,109,97,116,104,46,104, -117,103,101,32,116,104,101,110,13,10,32,32,32,32,101,114,114,111,114,40, -34,117,110,101,120,112,101,99,116,101,100,32,110,117,109,98,101,114,32,118, -97,108,117,101,32,39,34,32,46,46,32,116,111,115,116,114,105,110,103,40, -118,97,108,41,32,46,46,32,34,39,34,41,13,10,32,32,101,110,100,13, -10,32,32,114,101,116,117,114,110,32,115,116,114,105,110,103,46,102,111,114, -109,97,116,40,34,37,46,49,52,103,34,44,32,118,97,108,41,13,10,101, -110,100,13,10,13,10,13,10,108,111,99,97,108,32,116,121,112,101,95,102, -117,110,99,95,109,97,112,32,61,32,123,13,10,32,32,91,32,34,110,105, -108,34,32,32,32,32,32,93,32,61,32,101,110,99,111,100,101,95,110,105, -108,44,13,10,32,32,91,32,34,116,97,98,108,101,34,32,32,32,93,32, -61,32,101,110,99,111,100,101,95,116,97,98,108,101,44,13,10,32,32,91, -32,34,115,116,114,105,110,103,34,32,32,93,32,61,32,101,110,99,111,100, -101,95,115,116,114,105,110,103,44,13,10,32,32,91,32,34,110,117,109,98, -101,114,34,32,32,93,32,61,32,101,110,99,111,100,101,95,110,117,109,98, -101,114,44,13,10,32,32,91,32,34,98,111,111,108,101,97,110,34,32,93, -32,61,32,116,111,115,116,114,105,110,103,44,13,10,125,13,10,13,10,13, -10,101,110,99,111,100,101,32,61,32,102,117,110,99,116,105,111,110,40,118, -97,108,44,32,115,116,97,99,107,41,13,10,32,32,108,111,99,97,108,32, -116,32,61,32,116,121,112,101,40,118,97,108,41,13,10,32,32,108,111,99, -97,108,32,102,32,61,32,116,121,112,101,95,102,117,110,99,95,109,97,112, -91,116,93,13,10,32,32,105,102,32,102,32,116,104,101,110,13,10,32,32, -32,32,114,101,116,117,114,110,32,102,40,118,97,108,44,32,115,116,97,99, -107,41,13,10,32,32,101,110,100,13,10,32,32,101,114,114,111,114,40,34, -117,110,101,120,112,101,99,116,101,100,32,116,121,112,101,32,39,34,32,46, -46,32,116,32,46,46,32,34,39,34,41,13,10,101,110,100,13,10,13,10, -13,10,102,117,110,99,116,105,111,110,32,106,115,111,110,46,101,110,99,111, -100,101,40,118,97,108,41,13,10,32,32,114,101,116,117,114,110,32,40,32, -101,110,99,111,100,101,40,118,97,108,41,32,41,13,10,101,110,100,13,10, -13,10,13,10,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, +34,41,32,46,46,32,34,125,34,13,10,32,32,101,110,100,13,10,101,110, +100,13,10,13,10,13,10,108,111,99,97,108,32,102,117,110,99,116,105,111, +110,32,101,110,99,111,100,101,95,115,116,114,105,110,103,40,118,97,108,41, +13,10,32,32,114,101,116,117,114,110,32,39,34,39,32,46,46,32,118,97, +108,58,103,115,117,98,40,39,91,37,122,92,49,45,92,51,49,92,92,34, +93,39,44,32,101,115,99,97,112,101,95,99,104,97,114,41,32,46,46,32, +39,34,39,13,10,101,110,100,13,10,13,10,13,10,108,111,99,97,108,32, +102,117,110,99,116,105,111,110,32,101,110,99,111,100,101,95,110,117,109,98, +101,114,40,118,97,108,41,13,10,32,32,45,45,32,67,104,101,99,107,32, +102,111,114,32,78,97,78,44,32,45,105,110,102,32,97,110,100,32,105,110, +102,13,10,32,32,105,102,32,118,97,108,32,126,61,32,118,97,108,32,111, +114,32,118,97,108,32,60,61,32,45,109,97,116,104,46,104,117,103,101,32, +111,114,32,118,97,108,32,62,61,32,109,97,116,104,46,104,117,103,101,32, +116,104,101,110,13,10,9,101,114,114,111,114,40,34,117,110,101,120,112,101, +99,116,101,100,32,110,117,109,98,101,114,32,118,97,108,117,101,32,39,34, +32,46,46,32,116,111,115,116,114,105,110,103,40,118,97,108,41,32,46,46, +32,34,39,34,41,13,10,32,32,101,110,100,13,10,32,32,114,101,116,117, +114,110,32,115,116,114,105,110,103,46,102,111,114,109,97,116,40,34,37,46, +49,52,103,34,44,32,118,97,108,41,13,10,101,110,100,13,10,13,10,13, +10,108,111,99,97,108,32,116,121,112,101,95,102,117,110,99,95,109,97,112, +32,61,32,123,13,10,32,32,91,32,34,110,105,108,34,9,32,93,32,61, +32,101,110,99,111,100,101,95,110,105,108,44,13,10,32,32,91,32,34,116, +97,98,108,101,34,32,32,32,93,32,61,32,101,110,99,111,100,101,95,116, +97,98,108,101,44,13,10,32,32,91,32,34,115,116,114,105,110,103,34,32, +32,93,32,61,32,101,110,99,111,100,101,95,115,116,114,105,110,103,44,13, +10,32,32,91,32,34,110,117,109,98,101,114,34,32,32,93,32,61,32,101, +110,99,111,100,101,95,110,117,109,98,101,114,44,13,10,32,32,91,32,34, +98,111,111,108,101,97,110,34,32,93,32,61,32,116,111,115,116,114,105,110, +103,44,13,10,125,13,10,13,10,13,10,101,110,99,111,100,101,32,61,32, +102,117,110,99,116,105,111,110,40,118,97,108,44,32,115,116,97,99,107,41, +13,10,32,32,108,111,99,97,108,32,116,32,61,32,116,121,112,101,40,118, +97,108,41,13,10,32,32,108,111,99,97,108,32,102,32,61,32,116,121,112, +101,95,102,117,110,99,95,109,97,112,91,116,93,13,10,32,32,105,102,32, +102,32,116,104,101,110,13,10,9,114,101,116,117,114,110,32,102,40,118,97, +108,44,32,115,116,97,99,107,41,13,10,32,32,101,110,100,13,10,32,32, +101,114,114,111,114,40,34,117,110,101,120,112,101,99,116,101,100,32,116,121, +112,101,32,39,34,32,46,46,32,116,32,46,46,32,34,39,34,41,13,10, +101,110,100,13,10,13,10,13,10,102,117,110,99,116,105,111,110,32,106,115, +111,110,46,101,110,99,111,100,101,40,118,97,108,41,13,10,32,32,114,101, +116,117,114,110,32,40,32,101,110,99,111,100,101,40,118,97,108,41,32,41, +13,10,101,110,100,13,10,13,10,13,10,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, -45,45,45,13,10,45,45,32,68,101,99,111,100,101,13,10,45,45,45,45, +45,45,45,45,45,45,45,45,45,45,13,10,45,45,32,68,101,99,111,100, +101,13,10,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, -45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,13,10,13,10,108, -111,99,97,108,32,112,97,114,115,101,13,10,13,10,108,111,99,97,108,32, -102,117,110,99,116,105,111,110,32,99,114,101,97,116,101,95,115,101,116,40, -46,46,46,41,13,10,32,32,108,111,99,97,108,32,114,101,115,32,61,32, -123,125,13,10,32,32,102,111,114,32,105,32,61,32,49,44,32,115,101,108, -101,99,116,40,34,35,34,44,32,46,46,46,41,32,100,111,13,10,32,32, -32,32,114,101,115,91,32,115,101,108,101,99,116,40,105,44,32,46,46,46, -41,32,93,32,61,32,116,114,117,101,13,10,32,32,101,110,100,13,10,32, -32,114,101,116,117,114,110,32,114,101,115,13,10,101,110,100,13,10,13,10, -108,111,99,97,108,32,115,112,97,99,101,95,99,104,97,114,115,32,32,32, -61,32,99,114,101,97,116,101,95,115,101,116,40,34,32,34,44,32,34,92, -116,34,44,32,34,92,114,34,44,32,34,92,110,34,41,13,10,108,111,99, -97,108,32,100,101,108,105,109,95,99,104,97,114,115,32,32,32,61,32,99, -114,101,97,116,101,95,115,101,116,40,34,32,34,44,32,34,92,116,34,44, -32,34,92,114,34,44,32,34,92,110,34,44,32,34,93,34,44,32,34,125, -34,44,32,34,44,34,41,13,10,108,111,99,97,108,32,101,115,99,97,112, -101,95,99,104,97,114,115,32,32,61,32,99,114,101,97,116,101,95,115,101, -116,40,34,92,92,34,44,32,34,47,34,44,32,39,34,39,44,32,34,98, -34,44,32,34,102,34,44,32,34,110,34,44,32,34,114,34,44,32,34,116, -34,44,32,34,117,34,41,13,10,108,111,99,97,108,32,108,105,116,101,114, -97,108,115,32,32,32,32,32,32,61,32,99,114,101,97,116,101,95,115,101, -116,40,34,116,114,117,101,34,44,32,34,102,97,108,115,101,34,44,32,34, -110,117,108,108,34,41,13,10,13,10,108,111,99,97,108,32,108,105,116,101, -114,97,108,95,109,97,112,32,61,32,123,13,10,32,32,91,32,34,116,114, -117,101,34,32,32,93,32,61,32,116,114,117,101,44,13,10,32,32,91,32, -34,102,97,108,115,101,34,32,93,32,61,32,102,97,108,115,101,44,13,10, -32,32,91,32,34,110,117,108,108,34,32,32,93,32,61,32,110,105,108,44, -13,10,125,13,10,13,10,13,10,108,111,99,97,108,32,102,117,110,99,116, -105,111,110,32,110,101,120,116,95,99,104,97,114,40,115,116,114,44,32,105, -100,120,44,32,115,101,116,44,32,110,101,103,97,116,101,41,13,10,32,32, -102,111,114,32,105,32,61,32,105,100,120,44,32,35,115,116,114,32,100,111, -13,10,32,32,32,32,105,102,32,115,101,116,91,115,116,114,58,115,117,98, -40,105,44,32,105,41,93,32,126,61,32,110,101,103,97,116,101,32,116,104, -101,110,13,10,32,32,32,32,32,32,114,101,116,117,114,110,32,105,13,10, -32,32,32,32,101,110,100,13,10,32,32,101,110,100,13,10,32,32,114,101, -116,117,114,110,32,35,115,116,114,32,43,32,49,13,10,101,110,100,13,10, -13,10,13,10,108,111,99,97,108,32,102,117,110,99,116,105,111,110,32,100, -101,99,111,100,101,95,101,114,114,111,114,40,115,116,114,44,32,105,100,120, -44,32,109,115,103,41,13,10,32,32,108,111,99,97,108,32,108,105,110,101, -95,99,111,117,110,116,32,61,32,49,13,10,32,32,108,111,99,97,108,32, -99,111,108,95,99,111,117,110,116,32,61,32,49,13,10,32,32,102,111,114, -32,105,32,61,32,49,44,32,105,100,120,32,45,32,49,32,100,111,13,10, -32,32,32,32,99,111,108,95,99,111,117,110,116,32,61,32,99,111,108,95, -99,111,117,110,116,32,43,32,49,13,10,32,32,32,32,105,102,32,115,116, -114,58,115,117,98,40,105,44,32,105,41,32,61,61,32,34,92,110,34,32, -116,104,101,110,13,10,32,32,32,32,32,32,108,105,110,101,95,99,111,117, -110,116,32,61,32,108,105,110,101,95,99,111,117,110,116,32,43,32,49,13, -10,32,32,32,32,32,32,99,111,108,95,99,111,117,110,116,32,61,32,49, -13,10,32,32,32,32,101,110,100,13,10,32,32,101,110,100,13,10,32,32, -101,114,114,111,114,40,32,115,116,114,105,110,103,46,102,111,114,109,97,116, -40,34,37,115,32,97,116,32,108,105,110,101,32,37,100,32,99,111,108,32, -37,100,34,44,32,109,115,103,44,32,108,105,110,101,95,99,111,117,110,116, -44,32,99,111,108,95,99,111,117,110,116,41,32,41,13,10,101,110,100,13, -10,13,10,13,10,108,111,99,97,108,32,102,117,110,99,116,105,111,110,32, -99,111,100,101,112,111,105,110,116,95,116,111,95,117,116,102,56,40,110,41, -13,10,32,32,45,45,32,104,116,116,112,58,47,47,115,99,114,105,112,116, -115,46,115,105,108,46,111,114,103,47,99,109,115,47,115,99,114,105,112,116, -115,47,112,97,103,101,46,112,104,112,63,115,105,116,101,95,105,100,61,110, -114,115,105,38,105,100,61,105,119,115,45,97,112,112,101,110,100,105,120,97, -13,10,32,32,108,111,99,97,108,32,102,32,61,32,109,97,116,104,46,102, -108,111,111,114,13,10,32,32,105,102,32,110,32,60,61,32,48,120,55,102, -32,116,104,101,110,13,10,32,32,32,32,114,101,116,117,114,110,32,115,116, -114,105,110,103,46,99,104,97,114,40,110,41,13,10,32,32,101,108,115,101, -105,102,32,110,32,60,61,32,48,120,55,102,102,32,116,104,101,110,13,10, -32,32,32,32,114,101,116,117,114,110,32,115,116,114,105,110,103,46,99,104, -97,114,40,102,40,110,32,47,32,54,52,41,32,43,32,49,57,50,44,32, -110,32,37,32,54,52,32,43,32,49,50,56,41,13,10,32,32,101,108,115, -101,105,102,32,110,32,60,61,32,48,120,102,102,102,102,32,116,104,101,110, -13,10,32,32,32,32,114,101,116,117,114,110,32,115,116,114,105,110,103,46, -99,104,97,114,40,102,40,110,32,47,32,52,48,57,54,41,32,43,32,50, -50,52,44,32,102,40,110,32,37,32,52,48,57,54,32,47,32,54,52,41, -32,43,32,49,50,56,44,32,110,32,37,32,54,52,32,43,32,49,50,56, -41,13,10,32,32,101,108,115,101,105,102,32,110,32,60,61,32,48,120,49, -48,102,102,102,102,32,116,104,101,110,13,10,32,32,32,32,114,101,116,117, -114,110,32,115,116,114,105,110,103,46,99,104,97,114,40,102,40,110,32,47, -32,50,54,50,49,52,52,41,32,43,32,50,52,48,44,32,102,40,110,32, -37,32,50,54,50,49,52,52,32,47,32,52,48,57,54,41,32,43,32,49, -50,56,44,13,10,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, -32,32,32,32,32,32,32,32,102,40,110,32,37,32,52,48,57,54,32,47, -32,54,52,41,32,43,32,49,50,56,44,32,110,32,37,32,54,52,32,43, -32,49,50,56,41,13,10,32,32,101,110,100,13,10,32,32,101,114,114,111, -114,40,32,115,116,114,105,110,103,46,102,111,114,109,97,116,40,34,105,110, -118,97,108,105,100,32,117,110,105,99,111,100,101,32,99,111,100,101,112,111, -105,110,116,32,39,37,120,39,34,44,32,110,41,32,41,13,10,101,110,100, -13,10,13,10,13,10,108,111,99,97,108,32,102,117,110,99,116,105,111,110, -32,112,97,114,115,101,95,117,110,105,99,111,100,101,95,101,115,99,97,112, -101,40,115,41,13,10,32,32,108,111,99,97,108,32,110,49,32,61,32,116, -111,110,117,109,98,101,114,40,32,115,58,115,117,98,40,51,44,32,54,41, -44,32,32,49,54,32,41,13,10,32,32,108,111,99,97,108,32,110,50,32, -61,32,116,111,110,117,109,98,101,114,40,32,115,58,115,117,98,40,57,44, -32,49,50,41,44,32,49,54,32,41,13,10,32,32,45,45,32,83,117,114, -114,111,103,97,116,101,32,112,97,105,114,63,13,10,32,32,105,102,32,110, -50,32,116,104,101,110,13,10,32,32,32,32,114,101,116,117,114,110,32,99, -111,100,101,112,111,105,110,116,95,116,111,95,117,116,102,56,40,40,110,49, -32,45,32,48,120,100,56,48,48,41,32,42,32,48,120,52,48,48,32,43, -32,40,110,50,32,45,32,48,120,100,99,48,48,41,32,43,32,48,120,49, -48,48,48,48,41,13,10,32,32,101,108,115,101,13,10,32,32,32,32,114, +45,45,13,10,13,10,108,111,99,97,108,32,112,97,114,115,101,13,10,13, +10,108,111,99,97,108,32,102,117,110,99,116,105,111,110,32,99,114,101,97, +116,101,95,115,101,116,40,46,46,46,41,13,10,32,32,108,111,99,97,108, +32,114,101,115,32,61,32,123,125,13,10,32,32,102,111,114,32,105,32,61, +32,49,44,32,115,101,108,101,99,116,40,34,35,34,44,32,46,46,46,41, +32,100,111,13,10,9,114,101,115,91,32,115,101,108,101,99,116,40,105,44, +32,46,46,46,41,32,93,32,61,32,116,114,117,101,13,10,32,32,101,110, +100,13,10,32,32,114,101,116,117,114,110,32,114,101,115,13,10,101,110,100, +13,10,13,10,108,111,99,97,108,32,115,112,97,99,101,95,99,104,97,114, +115,32,32,32,61,32,99,114,101,97,116,101,95,115,101,116,40,34,32,34, +44,32,34,92,116,34,44,32,34,92,114,34,44,32,34,92,110,34,41,13, +10,108,111,99,97,108,32,100,101,108,105,109,95,99,104,97,114,115,32,32, +32,61,32,99,114,101,97,116,101,95,115,101,116,40,34,32,34,44,32,34, +92,116,34,44,32,34,92,114,34,44,32,34,92,110,34,44,32,34,93,34, +44,32,34,125,34,44,32,34,44,34,41,13,10,108,111,99,97,108,32,101, +115,99,97,112,101,95,99,104,97,114,115,32,32,61,32,99,114,101,97,116, +101,95,115,101,116,40,34,92,92,34,44,32,34,47,34,44,32,39,34,39, +44,32,34,98,34,44,32,34,102,34,44,32,34,110,34,44,32,34,114,34, +44,32,34,116,34,44,32,34,117,34,41,13,10,108,111,99,97,108,32,108, +105,116,101,114,97,108,115,9,32,32,61,32,99,114,101,97,116,101,95,115, +101,116,40,34,116,114,117,101,34,44,32,34,102,97,108,115,101,34,44,32, +34,110,117,108,108,34,41,13,10,13,10,108,111,99,97,108,32,108,105,116, +101,114,97,108,95,109,97,112,32,61,32,123,13,10,32,32,91,32,34,116, +114,117,101,34,32,32,93,32,61,32,116,114,117,101,44,13,10,32,32,91, +32,34,102,97,108,115,101,34,32,93,32,61,32,102,97,108,115,101,44,13, +10,32,32,91,32,34,110,117,108,108,34,32,32,93,32,61,32,110,105,108, +44,13,10,125,13,10,13,10,13,10,108,111,99,97,108,32,102,117,110,99, +116,105,111,110,32,110,101,120,116,95,99,104,97,114,40,115,116,114,44,32, +105,100,120,44,32,115,101,116,44,32,110,101,103,97,116,101,41,13,10,32, +32,102,111,114,32,105,32,61,32,105,100,120,44,32,35,115,116,114,32,100, +111,13,10,9,105,102,32,115,101,116,91,115,116,114,58,115,117,98,40,105, +44,32,105,41,93,32,126,61,32,110,101,103,97,116,101,32,116,104,101,110, +13,10,9,32,32,114,101,116,117,114,110,32,105,13,10,9,101,110,100,13, +10,32,32,101,110,100,13,10,32,32,114,101,116,117,114,110,32,35,115,116, +114,32,43,32,49,13,10,101,110,100,13,10,13,10,13,10,108,111,99,97, +108,32,102,117,110,99,116,105,111,110,32,100,101,99,111,100,101,95,101,114, +114,111,114,40,115,116,114,44,32,105,100,120,44,32,109,115,103,41,13,10, +32,32,108,111,99,97,108,32,108,105,110,101,95,99,111,117,110,116,32,61, +32,49,13,10,32,32,108,111,99,97,108,32,99,111,108,95,99,111,117,110, +116,32,61,32,49,13,10,32,32,102,111,114,32,105,32,61,32,49,44,32, +105,100,120,32,45,32,49,32,100,111,13,10,9,99,111,108,95,99,111,117, +110,116,32,61,32,99,111,108,95,99,111,117,110,116,32,43,32,49,13,10, +9,105,102,32,115,116,114,58,115,117,98,40,105,44,32,105,41,32,61,61, +32,34,92,110,34,32,116,104,101,110,13,10,9,32,32,108,105,110,101,95, +99,111,117,110,116,32,61,32,108,105,110,101,95,99,111,117,110,116,32,43, +32,49,13,10,9,32,32,99,111,108,95,99,111,117,110,116,32,61,32,49, +13,10,9,101,110,100,13,10,32,32,101,110,100,13,10,32,32,101,114,114, +111,114,40,32,115,116,114,105,110,103,46,102,111,114,109,97,116,40,34,37, +115,32,97,116,32,108,105,110,101,32,37,100,32,99,111,108,32,37,100,34, +44,32,109,115,103,44,32,108,105,110,101,95,99,111,117,110,116,44,32,99, +111,108,95,99,111,117,110,116,41,32,41,13,10,101,110,100,13,10,13,10, +13,10,108,111,99,97,108,32,102,117,110,99,116,105,111,110,32,99,111,100, +101,112,111,105,110,116,95,116,111,95,117,116,102,56,40,110,41,13,10,32, +32,45,45,32,104,116,116,112,58,47,47,115,99,114,105,112,116,115,46,115, +105,108,46,111,114,103,47,99,109,115,47,115,99,114,105,112,116,115,47,112, +97,103,101,46,112,104,112,63,115,105,116,101,95,105,100,61,110,114,115,105, +38,105,100,61,105,119,115,45,97,112,112,101,110,100,105,120,97,13,10,32, +32,108,111,99,97,108,32,102,32,61,32,109,97,116,104,46,102,108,111,111, +114,13,10,32,32,105,102,32,110,32,60,61,32,48,120,55,102,32,116,104, +101,110,13,10,9,114,101,116,117,114,110,32,115,116,114,105,110,103,46,99, +104,97,114,40,110,41,13,10,32,32,101,108,115,101,105,102,32,110,32,60, +61,32,48,120,55,102,102,32,116,104,101,110,13,10,9,114,101,116,117,114, +110,32,115,116,114,105,110,103,46,99,104,97,114,40,102,40,110,32,47,32, +54,52,41,32,43,32,49,57,50,44,32,110,32,37,32,54,52,32,43,32, +49,50,56,41,13,10,32,32,101,108,115,101,105,102,32,110,32,60,61,32, +48,120,102,102,102,102,32,116,104,101,110,13,10,9,114,101,116,117,114,110, +32,115,116,114,105,110,103,46,99,104,97,114,40,102,40,110,32,47,32,52, +48,57,54,41,32,43,32,50,50,52,44,32,102,40,110,32,37,32,52,48, +57,54,32,47,32,54,52,41,32,43,32,49,50,56,44,32,110,32,37,32, +54,52,32,43,32,49,50,56,41,13,10,32,32,101,108,115,101,105,102,32, +110,32,60,61,32,48,120,49,48,102,102,102,102,32,116,104,101,110,13,10, +9,114,101,116,117,114,110,32,115,116,114,105,110,103,46,99,104,97,114,40, +102,40,110,32,47,32,50,54,50,49,52,52,41,32,43,32,50,52,48,44, +32,102,40,110,32,37,32,50,54,50,49,52,52,32,47,32,52,48,57,54, +41,32,43,32,49,50,56,44,13,10,9,9,9,9,9,32,32,32,102,40, +110,32,37,32,52,48,57,54,32,47,32,54,52,41,32,43,32,49,50,56, +44,32,110,32,37,32,54,52,32,43,32,49,50,56,41,13,10,32,32,101, +110,100,13,10,32,32,101,114,114,111,114,40,32,115,116,114,105,110,103,46, +102,111,114,109,97,116,40,34,105,110,118,97,108,105,100,32,117,110,105,99, +111,100,101,32,99,111,100,101,112,111,105,110,116,32,39,37,120,39,34,44, +32,110,41,32,41,13,10,101,110,100,13,10,13,10,13,10,108,111,99,97, +108,32,102,117,110,99,116,105,111,110,32,112,97,114,115,101,95,117,110,105, +99,111,100,101,95,101,115,99,97,112,101,40,115,41,13,10,32,32,108,111, +99,97,108,32,110,49,32,61,32,116,111,110,117,109,98,101,114,40,32,115, +58,115,117,98,40,51,44,32,54,41,44,32,32,49,54,32,41,13,10,32, +32,108,111,99,97,108,32,110,50,32,61,32,116,111,110,117,109,98,101,114, +40,32,115,58,115,117,98,40,57,44,32,49,50,41,44,32,49,54,32,41, +13,10,32,32,45,45,32,83,117,114,114,111,103,97,116,101,32,112,97,105, +114,63,13,10,32,32,105,102,32,110,50,32,116,104,101,110,13,10,9,114, 101,116,117,114,110,32,99,111,100,101,112,111,105,110,116,95,116,111,95,117, -116,102,56,40,110,49,41,13,10,32,32,101,110,100,13,10,101,110,100,13, -10,13,10,13,10,108,111,99,97,108,32,102,117,110,99,116,105,111,110,32, -112,97,114,115,101,95,115,116,114,105,110,103,40,115,116,114,44,32,105,41, -13,10,32,32,108,111,99,97,108,32,104,97,115,95,117,110,105,99,111,100, -101,95,101,115,99,97,112,101,32,61,32,102,97,108,115,101,13,10,32,32, -108,111,99,97,108,32,104,97,115,95,115,117,114,114,111,103,97,116,101,95, -101,115,99,97,112,101,32,61,32,102,97,108,115,101,13,10,32,32,108,111, -99,97,108,32,104,97,115,95,101,115,99,97,112,101,32,61,32,102,97,108, -115,101,13,10,32,32,108,111,99,97,108,32,108,97,115,116,13,10,32,32, -102,111,114,32,106,32,61,32,105,32,43,32,49,44,32,35,115,116,114,32, -100,111,13,10,32,32,32,32,108,111,99,97,108,32,120,32,61,32,115,116, -114,58,98,121,116,101,40,106,41,13,10,13,10,32,32,32,32,105,102,32, -120,32,60,32,51,50,32,116,104,101,110,13,10,32,32,32,32,32,32,100, -101,99,111,100,101,95,101,114,114,111,114,40,115,116,114,44,32,106,44,32, -34,99,111,110,116,114,111,108,32,99,104,97,114,97,99,116,101,114,32,105, -110,32,115,116,114,105,110,103,34,41,13,10,32,32,32,32,101,110,100,13, -10,13,10,32,32,32,32,105,102,32,108,97,115,116,32,61,61,32,57,50, -32,116,104,101,110,32,45,45,32,34,92,92,34,32,40,101,115,99,97,112, -101,32,99,104,97,114,41,13,10,32,32,32,32,32,32,105,102,32,120,32, -61,61,32,49,49,55,32,116,104,101,110,32,45,45,32,34,117,34,32,40, -117,110,105,99,111,100,101,32,101,115,99,97,112,101,32,115,101,113,117,101, -110,99,101,41,13,10,32,32,32,32,32,32,32,32,108,111,99,97,108,32, +116,102,56,40,40,110,49,32,45,32,48,120,100,56,48,48,41,32,42,32, +48,120,52,48,48,32,43,32,40,110,50,32,45,32,48,120,100,99,48,48, +41,32,43,32,48,120,49,48,48,48,48,41,13,10,32,32,101,108,115,101, +13,10,9,114,101,116,117,114,110,32,99,111,100,101,112,111,105,110,116,95, +116,111,95,117,116,102,56,40,110,49,41,13,10,32,32,101,110,100,13,10, +101,110,100,13,10,13,10,13,10,108,111,99,97,108,32,102,117,110,99,116, +105,111,110,32,112,97,114,115,101,95,115,116,114,105,110,103,40,115,116,114, +44,32,105,41,13,10,32,32,108,111,99,97,108,32,104,97,115,95,117,110, +105,99,111,100,101,95,101,115,99,97,112,101,32,61,32,102,97,108,115,101, +13,10,32,32,108,111,99,97,108,32,104,97,115,95,115,117,114,114,111,103, +97,116,101,95,101,115,99,97,112,101,32,61,32,102,97,108,115,101,13,10, +32,32,108,111,99,97,108,32,104,97,115,95,101,115,99,97,112,101,32,61, +32,102,97,108,115,101,13,10,32,32,108,111,99,97,108,32,108,97,115,116, +13,10,32,32,102,111,114,32,106,32,61,32,105,32,43,32,49,44,32,35, +115,116,114,32,100,111,13,10,9,108,111,99,97,108,32,120,32,61,32,115, +116,114,58,98,121,116,101,40,106,41,13,10,13,10,9,105,102,32,120,32, +60,32,51,50,32,116,104,101,110,13,10,9,32,32,100,101,99,111,100,101, +95,101,114,114,111,114,40,115,116,114,44,32,106,44,32,34,99,111,110,116, +114,111,108,32,99,104,97,114,97,99,116,101,114,32,105,110,32,115,116,114, +105,110,103,34,41,13,10,9,101,110,100,13,10,13,10,9,105,102,32,108, +97,115,116,32,61,61,32,57,50,32,116,104,101,110,32,45,45,32,34,92, +92,34,32,40,101,115,99,97,112,101,32,99,104,97,114,41,13,10,9,32, +32,105,102,32,120,32,61,61,32,49,49,55,32,116,104,101,110,32,45,45, +32,34,117,34,32,40,117,110,105,99,111,100,101,32,101,115,99,97,112,101, +32,115,101,113,117,101,110,99,101,41,13,10,9,9,108,111,99,97,108,32, 104,101,120,32,61,32,115,116,114,58,115,117,98,40,106,32,43,32,49,44, -32,106,32,43,32,53,41,13,10,32,32,32,32,32,32,32,32,105,102,32, -110,111,116,32,104,101,120,58,102,105,110,100,40,34,37,120,37,120,37,120, -37,120,34,41,32,116,104,101,110,13,10,32,32,32,32,32,32,32,32,32, -32,100,101,99,111,100,101,95,101,114,114,111,114,40,115,116,114,44,32,106, -44,32,34,105,110,118,97,108,105,100,32,117,110,105,99,111,100,101,32,101, -115,99,97,112,101,32,105,110,32,115,116,114,105,110,103,34,41,13,10,32, -32,32,32,32,32,32,32,101,110,100,13,10,32,32,32,32,32,32,32,32, -105,102,32,104,101,120,58,102,105,110,100,40,34,94,91,100,68,93,91,56, -57,97,65,98,66,93,34,41,32,116,104,101,110,13,10,32,32,32,32,32, -32,32,32,32,32,104,97,115,95,115,117,114,114,111,103,97,116,101,95,101, -115,99,97,112,101,32,61,32,116,114,117,101,13,10,32,32,32,32,32,32, -32,32,101,108,115,101,13,10,32,32,32,32,32,32,32,32,32,32,104,97, -115,95,117,110,105,99,111,100,101,95,101,115,99,97,112,101,32,61,32,116, -114,117,101,13,10,32,32,32,32,32,32,32,32,101,110,100,13,10,32,32, -32,32,32,32,101,108,115,101,13,10,32,32,32,32,32,32,32,32,108,111, -99,97,108,32,99,32,61,32,115,116,114,105,110,103,46,99,104,97,114,40, -120,41,13,10,32,32,32,32,32,32,32,32,105,102,32,110,111,116,32,101, -115,99,97,112,101,95,99,104,97,114,115,91,99,93,32,116,104,101,110,13, -10,32,32,32,32,32,32,32,32,32,32,100,101,99,111,100,101,95,101,114, -114,111,114,40,115,116,114,44,32,106,44,32,34,105,110,118,97,108,105,100, -32,101,115,99,97,112,101,32,99,104,97,114,32,39,34,32,46,46,32,99, -32,46,46,32,34,39,32,105,110,32,115,116,114,105,110,103,34,41,13,10, -32,32,32,32,32,32,32,32,101,110,100,13,10,32,32,32,32,32,32,32, -32,104,97,115,95,101,115,99,97,112,101,32,61,32,116,114,117,101,13,10, -32,32,32,32,32,32,101,110,100,13,10,32,32,32,32,32,32,108,97,115, -116,32,61,32,110,105,108,13,10,13,10,32,32,32,32,101,108,115,101,105, -102,32,120,32,61,61,32,51,52,32,116,104,101,110,32,45,45,32,39,34, -39,32,40,101,110,100,32,111,102,32,115,116,114,105,110,103,41,13,10,32, -32,32,32,32,32,108,111,99,97,108,32,115,32,61,32,115,116,114,58,115, -117,98,40,105,32,43,32,49,44,32,106,32,45,32,49,41,13,10,32,32, -32,32,32,32,105,102,32,104,97,115,95,115,117,114,114,111,103,97,116,101, -95,101,115,99,97,112,101,32,116,104,101,110,13,10,32,32,32,32,32,32, -32,32,115,32,61,32,115,58,103,115,117,98,40,34,92,92,117,91,100,68, -93,91,56,57,97,65,98,66,93,46,46,92,92,117,46,46,46,46,34,44, -32,112,97,114,115,101,95,117,110,105,99,111,100,101,95,101,115,99,97,112, -101,41,13,10,32,32,32,32,32,32,101,110,100,13,10,32,32,32,32,32, -32,105,102,32,104,97,115,95,117,110,105,99,111,100,101,95,101,115,99,97, -112,101,32,116,104,101,110,13,10,32,32,32,32,32,32,32,32,115,32,61, -32,115,58,103,115,117,98,40,34,92,92,117,46,46,46,46,34,44,32,112, +32,106,32,43,32,53,41,13,10,9,9,105,102,32,110,111,116,32,104,101, +120,58,102,105,110,100,40,34,37,120,37,120,37,120,37,120,34,41,32,116, +104,101,110,13,10,9,9,32,32,100,101,99,111,100,101,95,101,114,114,111, +114,40,115,116,114,44,32,106,44,32,34,105,110,118,97,108,105,100,32,117, +110,105,99,111,100,101,32,101,115,99,97,112,101,32,105,110,32,115,116,114, +105,110,103,34,41,13,10,9,9,101,110,100,13,10,9,9,105,102,32,104, +101,120,58,102,105,110,100,40,34,94,91,100,68,93,91,56,57,97,65,98, +66,93,34,41,32,116,104,101,110,13,10,9,9,32,32,104,97,115,95,115, +117,114,114,111,103,97,116,101,95,101,115,99,97,112,101,32,61,32,116,114, +117,101,13,10,9,9,101,108,115,101,13,10,9,9,32,32,104,97,115,95, +117,110,105,99,111,100,101,95,101,115,99,97,112,101,32,61,32,116,114,117, +101,13,10,9,9,101,110,100,13,10,9,32,32,101,108,115,101,13,10,9, +9,108,111,99,97,108,32,99,32,61,32,115,116,114,105,110,103,46,99,104, +97,114,40,120,41,13,10,9,9,105,102,32,110,111,116,32,101,115,99,97, +112,101,95,99,104,97,114,115,91,99,93,32,116,104,101,110,13,10,9,9, +32,32,100,101,99,111,100,101,95,101,114,114,111,114,40,115,116,114,44,32, +106,44,32,34,105,110,118,97,108,105,100,32,101,115,99,97,112,101,32,99, +104,97,114,32,39,34,32,46,46,32,99,32,46,46,32,34,39,32,105,110, +32,115,116,114,105,110,103,34,41,13,10,9,9,101,110,100,13,10,9,9, +104,97,115,95,101,115,99,97,112,101,32,61,32,116,114,117,101,13,10,9, +32,32,101,110,100,13,10,9,32,32,108,97,115,116,32,61,32,110,105,108, +13,10,13,10,9,101,108,115,101,105,102,32,120,32,61,61,32,51,52,32, +116,104,101,110,32,45,45,32,39,34,39,32,40,101,110,100,32,111,102,32, +115,116,114,105,110,103,41,13,10,9,32,32,108,111,99,97,108,32,115,32, +61,32,115,116,114,58,115,117,98,40,105,32,43,32,49,44,32,106,32,45, +32,49,41,13,10,9,32,32,105,102,32,104,97,115,95,115,117,114,114,111, +103,97,116,101,95,101,115,99,97,112,101,32,116,104,101,110,13,10,9,9, +115,32,61,32,115,58,103,115,117,98,40,34,92,92,117,91,100,68,93,91, +56,57,97,65,98,66,93,46,46,92,92,117,46,46,46,46,34,44,32,112, 97,114,115,101,95,117,110,105,99,111,100,101,95,101,115,99,97,112,101,41, -13,10,32,32,32,32,32,32,101,110,100,13,10,32,32,32,32,32,32,105, -102,32,104,97,115,95,101,115,99,97,112,101,32,116,104,101,110,13,10,32, -32,32,32,32,32,32,32,115,32,61,32,115,58,103,115,117,98,40,34,92, -92,46,34,44,32,101,115,99,97,112,101,95,99,104,97,114,95,109,97,112, -95,105,110,118,41,13,10,32,32,32,32,32,32,101,110,100,13,10,32,32, -32,32,32,32,114,101,116,117,114,110,32,115,44,32,106,32,43,32,49,13, -10,13,10,32,32,32,32,101,108,115,101,13,10,32,32,32,32,32,32,108, -97,115,116,32,61,32,120,13,10,32,32,32,32,101,110,100,13,10,32,32, -101,110,100,13,10,32,32,100,101,99,111,100,101,95,101,114,114,111,114,40, -115,116,114,44,32,105,44,32,34,101,120,112,101,99,116,101,100,32,99,108, -111,115,105,110,103,32,113,117,111,116,101,32,102,111,114,32,115,116,114,105, -110,103,34,41,13,10,101,110,100,13,10,13,10,13,10,108,111,99,97,108, -32,102,117,110,99,116,105,111,110,32,112,97,114,115,101,95,110,117,109,98, -101,114,40,115,116,114,44,32,105,41,13,10,32,32,108,111,99,97,108,32, +13,10,9,32,32,101,110,100,13,10,9,32,32,105,102,32,104,97,115,95, +117,110,105,99,111,100,101,95,101,115,99,97,112,101,32,116,104,101,110,13, +10,9,9,115,32,61,32,115,58,103,115,117,98,40,34,92,92,117,46,46, +46,46,34,44,32,112,97,114,115,101,95,117,110,105,99,111,100,101,95,101, +115,99,97,112,101,41,13,10,9,32,32,101,110,100,13,10,9,32,32,105, +102,32,104,97,115,95,101,115,99,97,112,101,32,116,104,101,110,13,10,9, +9,115,32,61,32,115,58,103,115,117,98,40,34,92,92,46,34,44,32,101, +115,99,97,112,101,95,99,104,97,114,95,109,97,112,95,105,110,118,41,13, +10,9,32,32,101,110,100,13,10,9,32,32,114,101,116,117,114,110,32,115, +44,32,106,32,43,32,49,13,10,13,10,9,101,108,115,101,13,10,9,32, +32,108,97,115,116,32,61,32,120,13,10,9,101,110,100,13,10,32,32,101, +110,100,13,10,32,32,100,101,99,111,100,101,95,101,114,114,111,114,40,115, +116,114,44,32,105,44,32,34,101,120,112,101,99,116,101,100,32,99,108,111, +115,105,110,103,32,113,117,111,116,101,32,102,111,114,32,115,116,114,105,110, +103,34,41,13,10,101,110,100,13,10,13,10,13,10,108,111,99,97,108,32, +102,117,110,99,116,105,111,110,32,112,97,114,115,101,95,110,117,109,98,101, +114,40,115,116,114,44,32,105,41,13,10,32,32,108,111,99,97,108,32,120, +32,61,32,110,101,120,116,95,99,104,97,114,40,115,116,114,44,32,105,44, +32,100,101,108,105,109,95,99,104,97,114,115,41,13,10,32,32,108,111,99, +97,108,32,115,32,61,32,115,116,114,58,115,117,98,40,105,44,32,120,32, +45,32,49,41,13,10,32,32,108,111,99,97,108,32,110,32,61,32,116,111, +110,117,109,98,101,114,40,115,41,13,10,32,32,105,102,32,110,111,116,32, +110,32,116,104,101,110,13,10,9,100,101,99,111,100,101,95,101,114,114,111, +114,40,115,116,114,44,32,105,44,32,34,105,110,118,97,108,105,100,32,110, +117,109,98,101,114,32,39,34,32,46,46,32,115,32,46,46,32,34,39,34, +41,13,10,32,32,101,110,100,13,10,32,32,114,101,116,117,114,110,32,110, +44,32,120,13,10,101,110,100,13,10,13,10,13,10,108,111,99,97,108,32, +102,117,110,99,116,105,111,110,32,112,97,114,115,101,95,108,105,116,101,114, +97,108,40,115,116,114,44,32,105,41,13,10,32,32,108,111,99,97,108,32, 120,32,61,32,110,101,120,116,95,99,104,97,114,40,115,116,114,44,32,105, 44,32,100,101,108,105,109,95,99,104,97,114,115,41,13,10,32,32,108,111, -99,97,108,32,115,32,61,32,115,116,114,58,115,117,98,40,105,44,32,120, -32,45,32,49,41,13,10,32,32,108,111,99,97,108,32,110,32,61,32,116, -111,110,117,109,98,101,114,40,115,41,13,10,32,32,105,102,32,110,111,116, -32,110,32,116,104,101,110,13,10,32,32,32,32,100,101,99,111,100,101,95, -101,114,114,111,114,40,115,116,114,44,32,105,44,32,34,105,110,118,97,108, -105,100,32,110,117,109,98,101,114,32,39,34,32,46,46,32,115,32,46,46, -32,34,39,34,41,13,10,32,32,101,110,100,13,10,32,32,114,101,116,117, -114,110,32,110,44,32,120,13,10,101,110,100,13,10,13,10,13,10,108,111, -99,97,108,32,102,117,110,99,116,105,111,110,32,112,97,114,115,101,95,108, -105,116,101,114,97,108,40,115,116,114,44,32,105,41,13,10,32,32,108,111, -99,97,108,32,120,32,61,32,110,101,120,116,95,99,104,97,114,40,115,116, -114,44,32,105,44,32,100,101,108,105,109,95,99,104,97,114,115,41,13,10, -32,32,108,111,99,97,108,32,119,111,114,100,32,61,32,115,116,114,58,115, -117,98,40,105,44,32,120,32,45,32,49,41,13,10,32,32,105,102,32,110, -111,116,32,108,105,116,101,114,97,108,115,91,119,111,114,100,93,32,116,104, -101,110,13,10,32,32,32,32,100,101,99,111,100,101,95,101,114,114,111,114, -40,115,116,114,44,32,105,44,32,34,105,110,118,97,108,105,100,32,108,105, -116,101,114,97,108,32,39,34,32,46,46,32,119,111,114,100,32,46,46,32, -34,39,34,41,13,10,32,32,101,110,100,13,10,32,32,114,101,116,117,114, -110,32,108,105,116,101,114,97,108,95,109,97,112,91,119,111,114,100,93,44, -32,120,13,10,101,110,100,13,10,13,10,13,10,108,111,99,97,108,32,102, -117,110,99,116,105,111,110,32,112,97,114,115,101,95,97,114,114,97,121,40, -115,116,114,44,32,105,41,13,10,32,32,108,111,99,97,108,32,114,101,115, -32,61,32,123,125,13,10,32,32,108,111,99,97,108,32,110,32,61,32,49, -13,10,32,32,105,32,61,32,105,32,43,32,49,13,10,32,32,119,104,105, -108,101,32,49,32,100,111,13,10,32,32,32,32,108,111,99,97,108,32,120, -13,10,32,32,32,32,105,32,61,32,110,101,120,116,95,99,104,97,114,40, -115,116,114,44,32,105,44,32,115,112,97,99,101,95,99,104,97,114,115,44, -32,116,114,117,101,41,13,10,32,32,32,32,45,45,32,69,109,112,116,121, -32,47,32,101,110,100,32,111,102,32,97,114,114,97,121,63,13,10,32,32, -32,32,105,102,32,115,116,114,58,115,117,98,40,105,44,32,105,41,32,61, -61,32,34,93,34,32,116,104,101,110,13,10,32,32,32,32,32,32,105,32, -61,32,105,32,43,32,49,13,10,32,32,32,32,32,32,98,114,101,97,107, -13,10,32,32,32,32,101,110,100,13,10,32,32,32,32,45,45,32,82,101, -97,100,32,116,111,107,101,110,13,10,32,32,32,32,120,44,32,105,32,61, -32,112,97,114,115,101,40,115,116,114,44,32,105,41,13,10,32,32,32,32, -114,101,115,91,110,93,32,61,32,120,13,10,32,32,32,32,110,32,61,32, -110,32,43,32,49,13,10,32,32,32,32,45,45,32,78,101,120,116,32,116, -111,107,101,110,13,10,32,32,32,32,105,32,61,32,110,101,120,116,95,99, -104,97,114,40,115,116,114,44,32,105,44,32,115,112,97,99,101,95,99,104, -97,114,115,44,32,116,114,117,101,41,13,10,32,32,32,32,108,111,99,97, -108,32,99,104,114,32,61,32,115,116,114,58,115,117,98,40,105,44,32,105, -41,13,10,32,32,32,32,105,32,61,32,105,32,43,32,49,13,10,32,32, -32,32,105,102,32,99,104,114,32,61,61,32,34,93,34,32,116,104,101,110, -32,98,114,101,97,107,32,101,110,100,13,10,32,32,32,32,105,102,32,99, -104,114,32,126,61,32,34,44,34,32,116,104,101,110,32,100,101,99,111,100, -101,95,101,114,114,111,114,40,115,116,114,44,32,105,44,32,34,101,120,112, -101,99,116,101,100,32,39,93,39,32,111,114,32,39,44,39,34,41,32,101, -110,100,13,10,32,32,101,110,100,13,10,32,32,114,101,116,117,114,110,32, -114,101,115,44,32,105,13,10,101,110,100,13,10,13,10,13,10,108,111,99, -97,108,32,102,117,110,99,116,105,111,110,32,112,97,114,115,101,95,111,98, -106,101,99,116,40,115,116,114,44,32,105,41,13,10,32,32,108,111,99,97, -108,32,114,101,115,32,61,32,123,125,13,10,32,32,105,32,61,32,105,32, -43,32,49,13,10,32,32,119,104,105,108,101,32,49,32,100,111,13,10,32, -32,32,32,108,111,99,97,108,32,107,101,121,44,32,118,97,108,13,10,32, -32,32,32,105,32,61,32,110,101,120,116,95,99,104,97,114,40,115,116,114, -44,32,105,44,32,115,112,97,99,101,95,99,104,97,114,115,44,32,116,114, -117,101,41,13,10,32,32,32,32,45,45,32,69,109,112,116,121,32,47,32, -101,110,100,32,111,102,32,111,98,106,101,99,116,63,13,10,32,32,32,32, -105,102,32,115,116,114,58,115,117,98,40,105,44,32,105,41,32,61,61,32, -34,125,34,32,116,104,101,110,13,10,32,32,32,32,32,32,105,32,61,32, -105,32,43,32,49,13,10,32,32,32,32,32,32,98,114,101,97,107,13,10, -32,32,32,32,101,110,100,13,10,32,32,32,32,45,45,32,82,101,97,100, -32,107,101,121,13,10,32,32,32,32,105,102,32,115,116,114,58,115,117,98, -40,105,44,32,105,41,32,126,61,32,39,34,39,32,116,104,101,110,13,10, -32,32,32,32,32,32,100,101,99,111,100,101,95,101,114,114,111,114,40,115, -116,114,44,32,105,44,32,34,101,120,112,101,99,116,101,100,32,115,116,114, -105,110,103,32,102,111,114,32,107,101,121,34,41,13,10,32,32,32,32,101, -110,100,13,10,32,32,32,32,107,101,121,44,32,105,32,61,32,112,97,114, -115,101,40,115,116,114,44,32,105,41,13,10,32,32,32,32,45,45,32,82, -101,97,100,32,39,58,39,32,100,101,108,105,109,105,116,101,114,13,10,32, -32,32,32,105,32,61,32,110,101,120,116,95,99,104,97,114,40,115,116,114, +99,97,108,32,119,111,114,100,32,61,32,115,116,114,58,115,117,98,40,105, +44,32,120,32,45,32,49,41,13,10,32,32,105,102,32,110,111,116,32,108, +105,116,101,114,97,108,115,91,119,111,114,100,93,32,116,104,101,110,13,10, +9,100,101,99,111,100,101,95,101,114,114,111,114,40,115,116,114,44,32,105, +44,32,34,105,110,118,97,108,105,100,32,108,105,116,101,114,97,108,32,39, +34,32,46,46,32,119,111,114,100,32,46,46,32,34,39,34,41,13,10,32, +32,101,110,100,13,10,32,32,114,101,116,117,114,110,32,108,105,116,101,114, +97,108,95,109,97,112,91,119,111,114,100,93,44,32,120,13,10,101,110,100, +13,10,13,10,13,10,108,111,99,97,108,32,102,117,110,99,116,105,111,110, +32,112,97,114,115,101,95,97,114,114,97,121,40,115,116,114,44,32,105,41, +13,10,32,32,108,111,99,97,108,32,114,101,115,32,61,32,123,125,13,10, +32,32,108,111,99,97,108,32,110,32,61,32,49,13,10,32,32,105,32,61, +32,105,32,43,32,49,13,10,32,32,119,104,105,108,101,32,49,32,100,111, +13,10,9,108,111,99,97,108,32,120,13,10,9,105,32,61,32,110,101,120, +116,95,99,104,97,114,40,115,116,114,44,32,105,44,32,115,112,97,99,101, +95,99,104,97,114,115,44,32,116,114,117,101,41,13,10,9,45,45,32,69, +109,112,116,121,32,47,32,101,110,100,32,111,102,32,97,114,114,97,121,63, +13,10,9,105,102,32,115,116,114,58,115,117,98,40,105,44,32,105,41,32, +61,61,32,34,93,34,32,116,104,101,110,13,10,9,32,32,105,32,61,32, +105,32,43,32,49,13,10,9,32,32,98,114,101,97,107,13,10,9,101,110, +100,13,10,9,45,45,32,82,101,97,100,32,116,111,107,101,110,13,10,9, +120,44,32,105,32,61,32,112,97,114,115,101,40,115,116,114,44,32,105,41, +13,10,9,114,101,115,91,110,93,32,61,32,120,13,10,9,110,32,61,32, +110,32,43,32,49,13,10,9,45,45,32,78,101,120,116,32,116,111,107,101, +110,13,10,9,105,32,61,32,110,101,120,116,95,99,104,97,114,40,115,116, +114,44,32,105,44,32,115,112,97,99,101,95,99,104,97,114,115,44,32,116, +114,117,101,41,13,10,9,108,111,99,97,108,32,99,104,114,32,61,32,115, +116,114,58,115,117,98,40,105,44,32,105,41,13,10,9,105,32,61,32,105, +32,43,32,49,13,10,9,105,102,32,99,104,114,32,61,61,32,34,93,34, +32,116,104,101,110,32,98,114,101,97,107,32,101,110,100,13,10,9,105,102, +32,99,104,114,32,126,61,32,34,44,34,32,116,104,101,110,32,100,101,99, +111,100,101,95,101,114,114,111,114,40,115,116,114,44,32,105,44,32,34,101, +120,112,101,99,116,101,100,32,39,93,39,32,111,114,32,39,44,39,34,41, +32,101,110,100,13,10,32,32,101,110,100,13,10,32,32,114,101,116,117,114, +110,32,114,101,115,44,32,105,13,10,101,110,100,13,10,13,10,13,10,108, +111,99,97,108,32,102,117,110,99,116,105,111,110,32,112,97,114,115,101,95, +111,98,106,101,99,116,40,115,116,114,44,32,105,41,13,10,32,32,108,111, +99,97,108,32,114,101,115,32,61,32,123,125,13,10,32,32,105,32,61,32, +105,32,43,32,49,13,10,32,32,119,104,105,108,101,32,49,32,100,111,13, +10,9,108,111,99,97,108,32,107,101,121,44,32,118,97,108,13,10,9,105, +32,61,32,110,101,120,116,95,99,104,97,114,40,115,116,114,44,32,105,44, +32,115,112,97,99,101,95,99,104,97,114,115,44,32,116,114,117,101,41,13, +10,9,45,45,32,69,109,112,116,121,32,47,32,101,110,100,32,111,102,32, +111,98,106,101,99,116,63,13,10,9,105,102,32,115,116,114,58,115,117,98, +40,105,44,32,105,41,32,61,61,32,34,125,34,32,116,104,101,110,13,10, +9,32,32,105,32,61,32,105,32,43,32,49,13,10,9,32,32,98,114,101, +97,107,13,10,9,101,110,100,13,10,9,45,45,32,82,101,97,100,32,107, +101,121,13,10,9,105,102,32,115,116,114,58,115,117,98,40,105,44,32,105, +41,32,126,61,32,39,34,39,32,116,104,101,110,13,10,9,32,32,100,101, +99,111,100,101,95,101,114,114,111,114,40,115,116,114,44,32,105,44,32,34, +101,120,112,101,99,116,101,100,32,115,116,114,105,110,103,32,102,111,114,32, +107,101,121,34,41,13,10,9,101,110,100,13,10,9,107,101,121,44,32,105, +32,61,32,112,97,114,115,101,40,115,116,114,44,32,105,41,13,10,9,45, +45,32,82,101,97,100,32,39,58,39,32,100,101,108,105,109,105,116,101,114, +13,10,9,105,32,61,32,110,101,120,116,95,99,104,97,114,40,115,116,114, 44,32,105,44,32,115,112,97,99,101,95,99,104,97,114,115,44,32,116,114, -117,101,41,13,10,32,32,32,32,105,102,32,115,116,114,58,115,117,98,40, -105,44,32,105,41,32,126,61,32,34,58,34,32,116,104,101,110,13,10,32, -32,32,32,32,32,100,101,99,111,100,101,95,101,114,114,111,114,40,115,116, -114,44,32,105,44,32,34,101,120,112,101,99,116,101,100,32,39,58,39,32, -97,102,116,101,114,32,107,101,121,34,41,13,10,32,32,32,32,101,110,100, -13,10,32,32,32,32,105,32,61,32,110,101,120,116,95,99,104,97,114,40, -115,116,114,44,32,105,32,43,32,49,44,32,115,112,97,99,101,95,99,104, -97,114,115,44,32,116,114,117,101,41,13,10,32,32,32,32,45,45,32,82, -101,97,100,32,118,97,108,117,101,13,10,32,32,32,32,118,97,108,44,32, -105,32,61,32,112,97,114,115,101,40,115,116,114,44,32,105,41,13,10,32, -32,32,32,45,45,32,83,101,116,13,10,32,32,32,32,114,101,115,91,107, -101,121,93,32,61,32,118,97,108,13,10,32,32,32,32,45,45,32,78,101, -120,116,32,116,111,107,101,110,13,10,32,32,32,32,105,32,61,32,110,101, -120,116,95,99,104,97,114,40,115,116,114,44,32,105,44,32,115,112,97,99, -101,95,99,104,97,114,115,44,32,116,114,117,101,41,13,10,32,32,32,32, -108,111,99,97,108,32,99,104,114,32,61,32,115,116,114,58,115,117,98,40, -105,44,32,105,41,13,10,32,32,32,32,105,32,61,32,105,32,43,32,49, -13,10,32,32,32,32,105,102,32,99,104,114,32,61,61,32,34,125,34,32, -116,104,101,110,32,98,114,101,97,107,32,101,110,100,13,10,32,32,32,32, -105,102,32,99,104,114,32,126,61,32,34,44,34,32,116,104,101,110,32,100, +117,101,41,13,10,9,105,102,32,115,116,114,58,115,117,98,40,105,44,32, +105,41,32,126,61,32,34,58,34,32,116,104,101,110,13,10,9,32,32,100, 101,99,111,100,101,95,101,114,114,111,114,40,115,116,114,44,32,105,44,32, -34,101,120,112,101,99,116,101,100,32,39,125,39,32,111,114,32,39,44,39, -34,41,32,101,110,100,13,10,32,32,101,110,100,13,10,32,32,114,101,116, -117,114,110,32,114,101,115,44,32,105,13,10,101,110,100,13,10,13,10,13, -10,108,111,99,97,108,32,99,104,97,114,95,102,117,110,99,95,109,97,112, -32,61,32,123,13,10,32,32,91,32,39,34,39,32,93,32,61,32,112,97, -114,115,101,95,115,116,114,105,110,103,44,13,10,32,32,91,32,34,48,34, +34,101,120,112,101,99,116,101,100,32,39,58,39,32,97,102,116,101,114,32, +107,101,121,34,41,13,10,9,101,110,100,13,10,9,105,32,61,32,110,101, +120,116,95,99,104,97,114,40,115,116,114,44,32,105,32,43,32,49,44,32, +115,112,97,99,101,95,99,104,97,114,115,44,32,116,114,117,101,41,13,10, +9,45,45,32,82,101,97,100,32,118,97,108,117,101,13,10,9,118,97,108, +44,32,105,32,61,32,112,97,114,115,101,40,115,116,114,44,32,105,41,13, +10,9,45,45,32,83,101,116,13,10,9,114,101,115,91,107,101,121,93,32, +61,32,118,97,108,13,10,9,45,45,32,78,101,120,116,32,116,111,107,101, +110,13,10,9,105,32,61,32,110,101,120,116,95,99,104,97,114,40,115,116, +114,44,32,105,44,32,115,112,97,99,101,95,99,104,97,114,115,44,32,116, +114,117,101,41,13,10,9,108,111,99,97,108,32,99,104,114,32,61,32,115, +116,114,58,115,117,98,40,105,44,32,105,41,13,10,9,105,32,61,32,105, +32,43,32,49,13,10,9,105,102,32,99,104,114,32,61,61,32,34,125,34, +32,116,104,101,110,32,98,114,101,97,107,32,101,110,100,13,10,9,105,102, +32,99,104,114,32,126,61,32,34,44,34,32,116,104,101,110,32,100,101,99, +111,100,101,95,101,114,114,111,114,40,115,116,114,44,32,105,44,32,34,101, +120,112,101,99,116,101,100,32,39,125,39,32,111,114,32,39,44,39,34,41, +32,101,110,100,13,10,32,32,101,110,100,13,10,32,32,114,101,116,117,114, +110,32,114,101,115,44,32,105,13,10,101,110,100,13,10,13,10,13,10,108, +111,99,97,108,32,99,104,97,114,95,102,117,110,99,95,109,97,112,32,61, +32,123,13,10,32,32,91,32,39,34,39,32,93,32,61,32,112,97,114,115, +101,95,115,116,114,105,110,103,44,13,10,32,32,91,32,34,48,34,32,93, +32,61,32,112,97,114,115,101,95,110,117,109,98,101,114,44,13,10,32,32, +91,32,34,49,34,32,93,32,61,32,112,97,114,115,101,95,110,117,109,98, +101,114,44,13,10,32,32,91,32,34,50,34,32,93,32,61,32,112,97,114, +115,101,95,110,117,109,98,101,114,44,13,10,32,32,91,32,34,51,34,32, +93,32,61,32,112,97,114,115,101,95,110,117,109,98,101,114,44,13,10,32, +32,91,32,34,52,34,32,93,32,61,32,112,97,114,115,101,95,110,117,109, +98,101,114,44,13,10,32,32,91,32,34,53,34,32,93,32,61,32,112,97, +114,115,101,95,110,117,109,98,101,114,44,13,10,32,32,91,32,34,54,34, 32,93,32,61,32,112,97,114,115,101,95,110,117,109,98,101,114,44,13,10, -32,32,91,32,34,49,34,32,93,32,61,32,112,97,114,115,101,95,110,117, -109,98,101,114,44,13,10,32,32,91,32,34,50,34,32,93,32,61,32,112, -97,114,115,101,95,110,117,109,98,101,114,44,13,10,32,32,91,32,34,51, +32,32,91,32,34,55,34,32,93,32,61,32,112,97,114,115,101,95,110,117, +109,98,101,114,44,13,10,32,32,91,32,34,56,34,32,93,32,61,32,112, +97,114,115,101,95,110,117,109,98,101,114,44,13,10,32,32,91,32,34,57, 34,32,93,32,61,32,112,97,114,115,101,95,110,117,109,98,101,114,44,13, -10,32,32,91,32,34,52,34,32,93,32,61,32,112,97,114,115,101,95,110, -117,109,98,101,114,44,13,10,32,32,91,32,34,53,34,32,93,32,61,32, -112,97,114,115,101,95,110,117,109,98,101,114,44,13,10,32,32,91,32,34, -54,34,32,93,32,61,32,112,97,114,115,101,95,110,117,109,98,101,114,44, -13,10,32,32,91,32,34,55,34,32,93,32,61,32,112,97,114,115,101,95, -110,117,109,98,101,114,44,13,10,32,32,91,32,34,56,34,32,93,32,61, -32,112,97,114,115,101,95,110,117,109,98,101,114,44,13,10,32,32,91,32, -34,57,34,32,93,32,61,32,112,97,114,115,101,95,110,117,109,98,101,114, -44,13,10,32,32,91,32,34,45,34,32,93,32,61,32,112,97,114,115,101, -95,110,117,109,98,101,114,44,13,10,32,32,91,32,34,116,34,32,93,32, -61,32,112,97,114,115,101,95,108,105,116,101,114,97,108,44,13,10,32,32, -91,32,34,102,34,32,93,32,61,32,112,97,114,115,101,95,108,105,116,101, -114,97,108,44,13,10,32,32,91,32,34,110,34,32,93,32,61,32,112,97, -114,115,101,95,108,105,116,101,114,97,108,44,13,10,32,32,91,32,34,91, -34,32,93,32,61,32,112,97,114,115,101,95,97,114,114,97,121,44,13,10, -32,32,91,32,34,123,34,32,93,32,61,32,112,97,114,115,101,95,111,98, -106,101,99,116,44,13,10,125,13,10,13,10,13,10,112,97,114,115,101,32, -61,32,102,117,110,99,116,105,111,110,40,115,116,114,44,32,105,100,120,41, -13,10,32,32,108,111,99,97,108,32,99,104,114,32,61,32,115,116,114,58, -115,117,98,40,105,100,120,44,32,105,100,120,41,13,10,32,32,108,111,99, -97,108,32,102,32,61,32,99,104,97,114,95,102,117,110,99,95,109,97,112, -91,99,104,114,93,13,10,32,32,105,102,32,102,32,116,104,101,110,13,10, -32,32,32,32,114,101,116,117,114,110,32,102,40,115,116,114,44,32,105,100, -120,41,13,10,32,32,101,110,100,13,10,32,32,100,101,99,111,100,101,95, -101,114,114,111,114,40,115,116,114,44,32,105,100,120,44,32,34,117,110,101, -120,112,101,99,116,101,100,32,99,104,97,114,97,99,116,101,114,32,39,34, -32,46,46,32,99,104,114,32,46,46,32,34,39,34,41,13,10,101,110,100, -13,10,13,10,13,10,102,117,110,99,116,105,111,110,32,106,115,111,110,46, -100,101,99,111,100,101,40,115,116,114,41,13,10,32,32,105,102,32,116,121, -112,101,40,115,116,114,41,32,126,61,32,34,115,116,114,105,110,103,34,32, -116,104,101,110,13,10,32,32,32,32,101,114,114,111,114,40,34,101,120,112, -101,99,116,101,100,32,97,114,103,117,109,101,110,116,32,111,102,32,116,121, -112,101,32,115,116,114,105,110,103,44,32,103,111,116,32,34,32,46,46,32, -116,121,112,101,40,115,116,114,41,41,13,10,32,32,101,110,100,13,10,32, -32,108,111,99,97,108,32,114,101,115,44,32,105,100,120,32,61,32,112,97, -114,115,101,40,115,116,114,44,32,110,101,120,116,95,99,104,97,114,40,115, -116,114,44,32,49,44,32,115,112,97,99,101,95,99,104,97,114,115,44,32, -116,114,117,101,41,41,13,10,32,32,105,100,120,32,61,32,110,101,120,116, -95,99,104,97,114,40,115,116,114,44,32,105,100,120,44,32,115,112,97,99, -101,95,99,104,97,114,115,44,32,116,114,117,101,41,13,10,32,32,105,102, -32,105,100,120,32,60,61,32,35,115,116,114,32,116,104,101,110,13,10,32, -32,32,32,100,101,99,111,100,101,95,101,114,114,111,114,40,115,116,114,44, -32,105,100,120,44,32,34,116,114,97,105,108,105,110,103,32,103,97,114,98, -97,103,101,34,41,13,10,32,32,101,110,100,13,10,32,32,114,101,116,117, -114,110,32,114,101,115,13,10,101,110,100,13,10,13,10,45,45,45,45,45, -45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, +10,32,32,91,32,34,45,34,32,93,32,61,32,112,97,114,115,101,95,110, +117,109,98,101,114,44,13,10,32,32,91,32,34,116,34,32,93,32,61,32, +112,97,114,115,101,95,108,105,116,101,114,97,108,44,13,10,32,32,91,32, +34,102,34,32,93,32,61,32,112,97,114,115,101,95,108,105,116,101,114,97, +108,44,13,10,32,32,91,32,34,110,34,32,93,32,61,32,112,97,114,115, +101,95,108,105,116,101,114,97,108,44,13,10,32,32,91,32,34,91,34,32, +93,32,61,32,112,97,114,115,101,95,97,114,114,97,121,44,13,10,32,32, +91,32,34,123,34,32,93,32,61,32,112,97,114,115,101,95,111,98,106,101, +99,116,44,13,10,125,13,10,13,10,13,10,112,97,114,115,101,32,61,32, +102,117,110,99,116,105,111,110,40,115,116,114,44,32,105,100,120,41,13,10, +32,32,108,111,99,97,108,32,99,104,114,32,61,32,115,116,114,58,115,117, +98,40,105,100,120,44,32,105,100,120,41,13,10,32,32,108,111,99,97,108, +32,102,32,61,32,99,104,97,114,95,102,117,110,99,95,109,97,112,91,99, +104,114,93,13,10,32,32,105,102,32,102,32,116,104,101,110,13,10,9,114, +101,116,117,114,110,32,102,40,115,116,114,44,32,105,100,120,41,13,10,32, +32,101,110,100,13,10,32,32,100,101,99,111,100,101,95,101,114,114,111,114, +40,115,116,114,44,32,105,100,120,44,32,34,117,110,101,120,112,101,99,116, +101,100,32,99,104,97,114,97,99,116,101,114,32,39,34,32,46,46,32,99, +104,114,32,46,46,32,34,39,34,41,13,10,101,110,100,13,10,13,10,13, +10,102,117,110,99,116,105,111,110,32,106,115,111,110,46,100,101,99,111,100, +101,40,115,116,114,41,13,10,32,32,105,102,32,116,121,112,101,40,115,116, +114,41,32,126,61,32,34,115,116,114,105,110,103,34,32,116,104,101,110,13, +10,9,101,114,114,111,114,40,34,101,120,112,101,99,116,101,100,32,97,114, +103,117,109,101,110,116,32,111,102,32,116,121,112,101,32,115,116,114,105,110, +103,44,32,103,111,116,32,34,32,46,46,32,116,121,112,101,40,115,116,114, +41,41,13,10,32,32,101,110,100,13,10,32,32,108,111,99,97,108,32,114, +101,115,44,32,105,100,120,32,61,32,112,97,114,115,101,40,115,116,114,44, +32,110,101,120,116,95,99,104,97,114,40,115,116,114,44,32,49,44,32,115, +112,97,99,101,95,99,104,97,114,115,44,32,116,114,117,101,41,41,13,10, +32,32,105,100,120,32,61,32,110,101,120,116,95,99,104,97,114,40,115,116, +114,44,32,105,100,120,44,32,115,112,97,99,101,95,99,104,97,114,115,44, +32,116,114,117,101,41,13,10,32,32,105,102,32,105,100,120,32,60,61,32, +35,115,116,114,32,116,104,101,110,13,10,9,100,101,99,111,100,101,95,101, +114,114,111,114,40,115,116,114,44,32,105,100,120,44,32,34,116,114,97,105, +108,105,110,103,32,103,97,114,98,97,103,101,34,41,13,10,32,32,101,110, +100,13,10,32,32,114,101,116,117,114,110,32,114,101,115,13,10,101,110,100, +13,10,13,10,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, -45,45,45,45,45,45,45,45,45,13,10,45,45,32,69,120,112,111,114,116, -32,116,111,32,74,105,110,46,13,10,45,45,45,45,45,45,45,45,45,45, +45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,13,10, +45,45,32,69,120,112,111,114,116,32,116,111,32,74,105,110,46,13,10,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, -45,45,45,45,13,10,13,10,106,105,110,46,117,116,105,108,115,46,106,115, -111,110,32,61,32,106,115,111,110,13,10,0 +45,45,45,45,45,45,45,45,45,45,45,45,45,13,10,13,10,106,105,110, +46,117,116,105,108,115,46,106,115,111,110,32,61,32,106,115,111,110,13,10,0 }; diff --git a/src/libjin-lua/scripts/utils/xml.lua b/src/libjin-lua/scripts/utils/xml.lua index 8512dd3..665e490 100644 --- a/src/libjin-lua/scripts/utils/xml.lua +++ b/src/libjin-lua/scripts/utils/xml.lua @@ -13,21 +13,21 @@ function XmlParser.toXmlString(value) value = string.gsub(value, ">", ">"); -- '>' -> ">" value = string.gsub(value, "\"", """); -- '"' -> """ value = string.gsub(value, "([^%w%&%;%p%\t% ])", - function(c) - return string.format("&#x%X;", string.byte(c)) - end); + function(c) + return string.format("&#x%X;", string.byte(c)) + end); return value; end function XmlParser.fromXmlString(value) value = string.gsub(value, "&#x([%x]+)%;", - function(h) - return string.char(tonumber(h, 16)) - end); + function(h) + return string.char(tonumber(h, 16)) + end); value = string.gsub(value, "&#([0-9]+)%;", - function(h) - return string.char(tonumber(h, 10)) - end); + function(h) + return string.char(tonumber(h, 10)) + end); value = string.gsub(value, """, "\""); value = string.gsub(value, "'", "'"); value = string.gsub(value, ">", ">"); @@ -38,7 +38,7 @@ end function XmlParser.parseArgs(node, s) string.gsub(s, "(%w+)=([\"'])(.-)%2", function(w, _, a) - node:addProperty(w, XmlParser.fromXmlString(a)) + node:addProperty(w, XmlParser.fromXmlString(a)) end) end @@ -56,34 +56,34 @@ local function newNode(name) function node:children() return self.___children end function node:numChildren() return #self.___children end function node:addChild(child) - if self[child:name()] ~= nil then - if type(self[child:name()].name) == "function" then - local tempTable = {} - table.insert(tempTable, self[child:name()]) - self[child:name()] = tempTable - end - table.insert(self[child:name()], child) - else - self[child:name()] = child - end - table.insert(self.___children, child) + if self[child:name()] ~= nil then + if type(self[child:name()].name) == "function" then + local tempTable = {} + table.insert(tempTable, self[child:name()]) + self[child:name()] = tempTable + end + table.insert(self[child:name()], child) + else + self[child:name()] = child + end + table.insert(self.___children, child) end function node:properties() return self.___props end function node:numProperties() return #self.___props end function node:addProperty(name, value) - local lName = "@" .. name - if self[lName] ~= nil then - if type(self[lName]) == "string" then - local tempTable = {} - table.insert(tempTable, self[lName]) - self[lName] = tempTable - end - table.insert(self[lName], value) - else - self[lName] = value - end - table.insert(self.___props, { name = name, value = self[name] }) + local lName = "@" .. name + if self[lName] ~= nil then + if type(self[lName]) == "string" then + local tempTable = {} + table.insert(tempTable, self[lName]) + self[lName] = tempTable + end + table.insert(self[lName], value) + else + self[lName] = value + end + table.insert(self.___props, { name = name, value = self[name] }) end return node @@ -96,58 +96,58 @@ function XmlParser.parseXmlText(xmlText) local ni, c, label, xarg, empty local i, j = 1, 1 while true do - ni, j, c, label, xarg, empty = string.find(xmlText, "<(%/?)([%w_:]+)(.-)(%/?)>", i) - if not ni then break end - local text = string.sub(xmlText, i, ni - 1); - if not string.find(text, "^%s*$") then - local lVal = (top:value() or "") .. XmlParser.fromXmlString(text) - stack[#stack]:setValue(lVal) - end - if empty == "/" then -- empty element tag - local lNode = newNode(label) - XmlParser.parseArgs(lNode, xarg) - top:addChild(lNode) - elseif c == "" then -- start tag - local lNode = newNode(label) - XmlParser.parseArgs(lNode, xarg) - table.insert(stack, lNode) + ni, j, c, label, xarg, empty = string.find(xmlText, "<(%/?)([%w_:]+)(.-)(%/?)>", i) + if not ni then break end + local text = string.sub(xmlText, i, ni - 1); + if not string.find(text, "^%s*$") then + local lVal = (top:value() or "") .. XmlParser.fromXmlString(text) + stack[#stack]:setValue(lVal) + end + if empty == "/" then -- empty element tag + local lNode = newNode(label) + XmlParser.parseArgs(lNode, xarg) + top:addChild(lNode) + elseif c == "" then -- start tag + local lNode = newNode(label) + XmlParser.parseArgs(lNode, xarg) + table.insert(stack, lNode) top = lNode - else -- end tag - local toclose = table.remove(stack) -- remove top - - top = stack[#stack] - if #stack < 1 then - error("XmlParser. nothing to close with " .. label) - end - if toclose:name() ~= label then - error("XmlParser. trying to close " .. toclose.name .. " with " .. label) - end - top:addChild(toclose) - end - i = j + 1 + else -- end tag + local toclose = table.remove(stack) -- remove top + + top = stack[#stack] + if #stack < 1 then + error("XmlParser. nothing to close with " .. label) + end + if toclose:name() ~= label then + error("XmlParser. trying to close " .. toclose.name .. " with " .. label) + end + top:addChild(toclose) + end + i = j + 1 end local text = string.sub(xmlText, i); if #stack > 1 then - error("XmlParser. unclosed " .. stack[#stack]:name()) + error("XmlParser. unclosed " .. stack[#stack]:name()) end return top end function XmlParser.loadFile(xmlFilename, base) if not base then - base = system.ResourceDirectory + base = system.ResourceDirectory end local path = system.pathForFile(xmlFilename, base) local hFile, err = io.open(path, "r"); if hFile and not err then - local xmlText = hFile:read("*a"); -- read file content - io.close(hFile); - return XmlParser.parseXmlText(xmlText), nil; + local xmlText = hFile:read("*a"); -- read file content + io.close(hFile); + return XmlParser.parseXmlText(xmlText), nil; else - print(err) - return nil + print(err) + return nil end end diff --git a/src/libjin-lua/scripts/utils/xml.lua.h b/src/libjin-lua/scripts/utils/xml.lua.h index 7fd910e..474b9ac 100644 --- a/src/libjin-lua/scripts/utils/xml.lua.h +++ b/src/libjin-lua/scripts/utils/xml.lua.h @@ -34,223 +34,211 @@ static char xml_lua[] = { 45,62,32,34,38,113,117,111,116,59,34,13,10,32,32,118,97,108,117,101, 32,61,32,115,116,114,105,110,103,46,103,115,117,98,40,118,97,108,117,101, 44,32,34,40,91,94,37,119,37,38,37,59,37,112,37,92,116,37,32,93, -41,34,44,13,10,32,32,32,32,102,117,110,99,116,105,111,110,40,99,41, -13,10,32,32,32,32,32,32,114,101,116,117,114,110,32,115,116,114,105,110, -103,46,102,111,114,109,97,116,40,34,38,35,120,37,88,59,34,44,32,115, -116,114,105,110,103,46,98,121,116,101,40,99,41,41,13,10,32,32,32,32, -101,110,100,41,59,13,10,32,32,114,101,116,117,114,110,32,118,97,108,117, -101,59,13,10,101,110,100,13,10,13,10,102,117,110,99,116,105,111,110,32, -88,109,108,80,97,114,115,101,114,46,102,114,111,109,88,109,108,83,116,114, -105,110,103,40,118,97,108,117,101,41,13,10,32,32,118,97,108,117,101,32, -61,32,115,116,114,105,110,103,46,103,115,117,98,40,118,97,108,117,101,44, -32,34,38,35,120,40,91,37,120,93,43,41,37,59,34,44,13,10,32,32, -32,32,102,117,110,99,116,105,111,110,40,104,41,13,10,32,32,32,32,32, -32,114,101,116,117,114,110,32,115,116,114,105,110,103,46,99,104,97,114,40, -116,111,110,117,109,98,101,114,40,104,44,32,49,54,41,41,13,10,32,32, -32,32,101,110,100,41,59,13,10,32,32,118,97,108,117,101,32,61,32,115, -116,114,105,110,103,46,103,115,117,98,40,118,97,108,117,101,44,32,34,38, -35,40,91,48,45,57,93,43,41,37,59,34,44,13,10,32,32,32,32,102, -117,110,99,116,105,111,110,40,104,41,13,10,32,32,32,32,32,32,114,101, -116,117,114,110,32,115,116,114,105,110,103,46,99,104,97,114,40,116,111,110, -117,109,98,101,114,40,104,44,32,49,48,41,41,13,10,32,32,32,32,101, -110,100,41,59,13,10,32,32,118,97,108,117,101,32,61,32,115,116,114,105, -110,103,46,103,115,117,98,40,118,97,108,117,101,44,32,34,38,113,117,111, -116,59,34,44,32,34,92,34,34,41,59,13,10,32,32,118,97,108,117,101, -32,61,32,115,116,114,105,110,103,46,103,115,117,98,40,118,97,108,117,101, -44,32,34,38,97,112,111,115,59,34,44,32,34,39,34,41,59,13,10,32, +41,34,44,13,10,9,102,117,110,99,116,105,111,110,40,99,41,13,10,9, +32,32,114,101,116,117,114,110,32,115,116,114,105,110,103,46,102,111,114,109, +97,116,40,34,38,35,120,37,88,59,34,44,32,115,116,114,105,110,103,46, +98,121,116,101,40,99,41,41,13,10,9,101,110,100,41,59,13,10,32,32, +114,101,116,117,114,110,32,118,97,108,117,101,59,13,10,101,110,100,13,10, +13,10,102,117,110,99,116,105,111,110,32,88,109,108,80,97,114,115,101,114, +46,102,114,111,109,88,109,108,83,116,114,105,110,103,40,118,97,108,117,101, +41,13,10,32,32,118,97,108,117,101,32,61,32,115,116,114,105,110,103,46, +103,115,117,98,40,118,97,108,117,101,44,32,34,38,35,120,40,91,37,120, +93,43,41,37,59,34,44,13,10,9,102,117,110,99,116,105,111,110,40,104, +41,13,10,9,32,32,114,101,116,117,114,110,32,115,116,114,105,110,103,46, +99,104,97,114,40,116,111,110,117,109,98,101,114,40,104,44,32,49,54,41, +41,13,10,9,101,110,100,41,59,13,10,32,32,118,97,108,117,101,32,61, +32,115,116,114,105,110,103,46,103,115,117,98,40,118,97,108,117,101,44,32, +34,38,35,40,91,48,45,57,93,43,41,37,59,34,44,13,10,9,102,117, +110,99,116,105,111,110,40,104,41,13,10,9,32,32,114,101,116,117,114,110, +32,115,116,114,105,110,103,46,99,104,97,114,40,116,111,110,117,109,98,101, +114,40,104,44,32,49,48,41,41,13,10,9,101,110,100,41,59,13,10,32, 32,118,97,108,117,101,32,61,32,115,116,114,105,110,103,46,103,115,117,98, -40,118,97,108,117,101,44,32,34,38,103,116,59,34,44,32,34,62,34,41, -59,13,10,32,32,118,97,108,117,101,32,61,32,115,116,114,105,110,103,46, -103,115,117,98,40,118,97,108,117,101,44,32,34,38,108,116,59,34,44,32, -34,60,34,41,59,13,10,32,32,118,97,108,117,101,32,61,32,115,116,114, -105,110,103,46,103,115,117,98,40,118,97,108,117,101,44,32,34,38,97,109, -112,59,34,44,32,34,38,34,41,59,13,10,32,32,114,101,116,117,114,110, -32,118,97,108,117,101,59,13,10,101,110,100,13,10,13,10,102,117,110,99, -116,105,111,110,32,88,109,108,80,97,114,115,101,114,46,112,97,114,115,101, -65,114,103,115,40,110,111,100,101,44,32,115,41,13,10,32,32,115,116,114, -105,110,103,46,103,115,117,98,40,115,44,32,34,40,37,119,43,41,61,40, -91,92,34,39,93,41,40,46,45,41,37,50,34,44,32,102,117,110,99,116, -105,111,110,40,119,44,32,95,44,32,97,41,13,10,32,32,32,32,110,111, -100,101,58,97,100,100,80,114,111,112,101,114,116,121,40,119,44,32,88,109, -108,80,97,114,115,101,114,46,102,114,111,109,88,109,108,83,116,114,105,110, -103,40,97,41,41,13,10,32,32,101,110,100,41,13,10,101,110,100,13,10, -32,32,13,10,108,111,99,97,108,32,102,117,110,99,116,105,111,110,32,110, -101,119,78,111,100,101,40,110,97,109,101,41,13,10,32,32,108,111,99,97, -108,32,110,111,100,101,32,61,32,123,125,13,10,32,32,110,111,100,101,46, -95,95,95,118,97,108,117,101,32,61,32,110,105,108,13,10,32,32,110,111, -100,101,46,95,95,95,110,97,109,101,32,61,32,110,97,109,101,13,10,32, -32,110,111,100,101,46,95,95,95,99,104,105,108,100,114,101,110,32,61,32, -123,125,13,10,32,32,110,111,100,101,46,95,95,95,112,114,111,112,115,32, -61,32,123,125,13,10,13,10,32,32,102,117,110,99,116,105,111,110,32,110, -111,100,101,58,118,97,108,117,101,40,41,32,114,101,116,117,114,110,32,115, -101,108,102,46,95,95,95,118,97,108,117,101,32,101,110,100,13,10,32,32, -102,117,110,99,116,105,111,110,32,110,111,100,101,58,115,101,116,86,97,108, -117,101,40,118,97,108,41,32,115,101,108,102,46,95,95,95,118,97,108,117, -101,32,61,32,118,97,108,32,101,110,100,13,10,32,32,102,117,110,99,116, -105,111,110,32,110,111,100,101,58,110,97,109,101,40,41,32,114,101,116,117, -114,110,32,115,101,108,102,46,95,95,95,110,97,109,101,32,101,110,100,13, -10,32,32,102,117,110,99,116,105,111,110,32,110,111,100,101,58,115,101,116, -78,97,109,101,40,110,97,109,101,41,32,115,101,108,102,46,95,95,95,110, -97,109,101,32,61,32,110,97,109,101,32,101,110,100,13,10,32,32,102,117, -110,99,116,105,111,110,32,110,111,100,101,58,99,104,105,108,100,114,101,110, -40,41,32,114,101,116,117,114,110,32,115,101,108,102,46,95,95,95,99,104, -105,108,100,114,101,110,32,101,110,100,13,10,32,32,102,117,110,99,116,105, -111,110,32,110,111,100,101,58,110,117,109,67,104,105,108,100,114,101,110,40, -41,32,114,101,116,117,114,110,32,35,115,101,108,102,46,95,95,95,99,104, -105,108,100,114,101,110,32,101,110,100,13,10,32,32,102,117,110,99,116,105, -111,110,32,110,111,100,101,58,97,100,100,67,104,105,108,100,40,99,104,105, -108,100,41,13,10,32,32,32,32,105,102,32,115,101,108,102,91,99,104,105, -108,100,58,110,97,109,101,40,41,93,32,126,61,32,110,105,108,32,116,104, -101,110,13,10,32,32,32,32,32,32,105,102,32,116,121,112,101,40,115,101, -108,102,91,99,104,105,108,100,58,110,97,109,101,40,41,93,46,110,97,109, -101,41,32,61,61,32,34,102,117,110,99,116,105,111,110,34,32,116,104,101, -110,13,10,32,32,32,32,32,32,32,32,108,111,99,97,108,32,116,101,109, -112,84,97,98,108,101,32,61,32,123,125,13,10,32,32,32,32,32,32,32, -32,116,97,98,108,101,46,105,110,115,101,114,116,40,116,101,109,112,84,97, -98,108,101,44,32,115,101,108,102,91,99,104,105,108,100,58,110,97,109,101, -40,41,93,41,13,10,32,32,32,32,32,32,32,32,115,101,108,102,91,99, -104,105,108,100,58,110,97,109,101,40,41,93,32,61,32,116,101,109,112,84, -97,98,108,101,13,10,32,32,32,32,32,32,101,110,100,13,10,32,32,32, -32,32,32,116,97,98,108,101,46,105,110,115,101,114,116,40,115,101,108,102, -91,99,104,105,108,100,58,110,97,109,101,40,41,93,44,32,99,104,105,108, -100,41,13,10,32,32,32,32,101,108,115,101,13,10,32,32,32,32,32,32, +40,118,97,108,117,101,44,32,34,38,113,117,111,116,59,34,44,32,34,92, +34,34,41,59,13,10,32,32,118,97,108,117,101,32,61,32,115,116,114,105, +110,103,46,103,115,117,98,40,118,97,108,117,101,44,32,34,38,97,112,111, +115,59,34,44,32,34,39,34,41,59,13,10,32,32,118,97,108,117,101,32, +61,32,115,116,114,105,110,103,46,103,115,117,98,40,118,97,108,117,101,44, +32,34,38,103,116,59,34,44,32,34,62,34,41,59,13,10,32,32,118,97, +108,117,101,32,61,32,115,116,114,105,110,103,46,103,115,117,98,40,118,97, +108,117,101,44,32,34,38,108,116,59,34,44,32,34,60,34,41,59,13,10, +32,32,118,97,108,117,101,32,61,32,115,116,114,105,110,103,46,103,115,117, +98,40,118,97,108,117,101,44,32,34,38,97,109,112,59,34,44,32,34,38, +34,41,59,13,10,32,32,114,101,116,117,114,110,32,118,97,108,117,101,59, +13,10,101,110,100,13,10,13,10,102,117,110,99,116,105,111,110,32,88,109, +108,80,97,114,115,101,114,46,112,97,114,115,101,65,114,103,115,40,110,111, +100,101,44,32,115,41,13,10,32,32,115,116,114,105,110,103,46,103,115,117, +98,40,115,44,32,34,40,37,119,43,41,61,40,91,92,34,39,93,41,40, +46,45,41,37,50,34,44,32,102,117,110,99,116,105,111,110,40,119,44,32, +95,44,32,97,41,13,10,9,110,111,100,101,58,97,100,100,80,114,111,112, +101,114,116,121,40,119,44,32,88,109,108,80,97,114,115,101,114,46,102,114, +111,109,88,109,108,83,116,114,105,110,103,40,97,41,41,13,10,32,32,101, +110,100,41,13,10,101,110,100,13,10,32,32,13,10,108,111,99,97,108,32, +102,117,110,99,116,105,111,110,32,110,101,119,78,111,100,101,40,110,97,109, +101,41,13,10,32,32,108,111,99,97,108,32,110,111,100,101,32,61,32,123, +125,13,10,32,32,110,111,100,101,46,95,95,95,118,97,108,117,101,32,61, +32,110,105,108,13,10,32,32,110,111,100,101,46,95,95,95,110,97,109,101, +32,61,32,110,97,109,101,13,10,32,32,110,111,100,101,46,95,95,95,99, +104,105,108,100,114,101,110,32,61,32,123,125,13,10,32,32,110,111,100,101, +46,95,95,95,112,114,111,112,115,32,61,32,123,125,13,10,13,10,32,32, +102,117,110,99,116,105,111,110,32,110,111,100,101,58,118,97,108,117,101,40, +41,32,114,101,116,117,114,110,32,115,101,108,102,46,95,95,95,118,97,108, +117,101,32,101,110,100,13,10,32,32,102,117,110,99,116,105,111,110,32,110, +111,100,101,58,115,101,116,86,97,108,117,101,40,118,97,108,41,32,115,101, +108,102,46,95,95,95,118,97,108,117,101,32,61,32,118,97,108,32,101,110, +100,13,10,32,32,102,117,110,99,116,105,111,110,32,110,111,100,101,58,110, +97,109,101,40,41,32,114,101,116,117,114,110,32,115,101,108,102,46,95,95, +95,110,97,109,101,32,101,110,100,13,10,32,32,102,117,110,99,116,105,111, +110,32,110,111,100,101,58,115,101,116,78,97,109,101,40,110,97,109,101,41, +32,115,101,108,102,46,95,95,95,110,97,109,101,32,61,32,110,97,109,101, +32,101,110,100,13,10,32,32,102,117,110,99,116,105,111,110,32,110,111,100, +101,58,99,104,105,108,100,114,101,110,40,41,32,114,101,116,117,114,110,32, +115,101,108,102,46,95,95,95,99,104,105,108,100,114,101,110,32,101,110,100, +13,10,32,32,102,117,110,99,116,105,111,110,32,110,111,100,101,58,110,117, +109,67,104,105,108,100,114,101,110,40,41,32,114,101,116,117,114,110,32,35, +115,101,108,102,46,95,95,95,99,104,105,108,100,114,101,110,32,101,110,100, +13,10,32,32,102,117,110,99,116,105,111,110,32,110,111,100,101,58,97,100, +100,67,104,105,108,100,40,99,104,105,108,100,41,13,10,9,105,102,32,115, +101,108,102,91,99,104,105,108,100,58,110,97,109,101,40,41,93,32,126,61, +32,110,105,108,32,116,104,101,110,13,10,9,32,32,105,102,32,116,121,112, +101,40,115,101,108,102,91,99,104,105,108,100,58,110,97,109,101,40,41,93, +46,110,97,109,101,41,32,61,61,32,34,102,117,110,99,116,105,111,110,34, +32,116,104,101,110,13,10,9,9,108,111,99,97,108,32,116,101,109,112,84, +97,98,108,101,32,61,32,123,125,13,10,9,9,116,97,98,108,101,46,105, +110,115,101,114,116,40,116,101,109,112,84,97,98,108,101,44,32,115,101,108, +102,91,99,104,105,108,100,58,110,97,109,101,40,41,93,41,13,10,9,9, 115,101,108,102,91,99,104,105,108,100,58,110,97,109,101,40,41,93,32,61, -32,99,104,105,108,100,13,10,32,32,32,32,101,110,100,13,10,32,32,32, -32,116,97,98,108,101,46,105,110,115,101,114,116,40,115,101,108,102,46,95, -95,95,99,104,105,108,100,114,101,110,44,32,99,104,105,108,100,41,13,10, -32,32,101,110,100,13,10,13,10,32,32,102,117,110,99,116,105,111,110,32, -110,111,100,101,58,112,114,111,112,101,114,116,105,101,115,40,41,32,114,101, -116,117,114,110,32,115,101,108,102,46,95,95,95,112,114,111,112,115,32,101, -110,100,13,10,32,32,102,117,110,99,116,105,111,110,32,110,111,100,101,58, -110,117,109,80,114,111,112,101,114,116,105,101,115,40,41,32,114,101,116,117, -114,110,32,35,115,101,108,102,46,95,95,95,112,114,111,112,115,32,101,110, -100,13,10,32,32,102,117,110,99,116,105,111,110,32,110,111,100,101,58,97, -100,100,80,114,111,112,101,114,116,121,40,110,97,109,101,44,32,118,97,108, -117,101,41,13,10,32,32,32,32,108,111,99,97,108,32,108,78,97,109,101, -32,61,32,34,64,34,32,46,46,32,110,97,109,101,13,10,32,32,32,32, -105,102,32,115,101,108,102,91,108,78,97,109,101,93,32,126,61,32,110,105, -108,32,116,104,101,110,13,10,32,32,32,32,32,32,105,102,32,116,121,112, -101,40,115,101,108,102,91,108,78,97,109,101,93,41,32,61,61,32,34,115, -116,114,105,110,103,34,32,116,104,101,110,13,10,32,32,32,32,32,32,32, -32,108,111,99,97,108,32,116,101,109,112,84,97,98,108,101,32,61,32,123, -125,13,10,32,32,32,32,32,32,32,32,116,97,98,108,101,46,105,110,115, -101,114,116,40,116,101,109,112,84,97,98,108,101,44,32,115,101,108,102,91, -108,78,97,109,101,93,41,13,10,32,32,32,32,32,32,32,32,115,101,108, -102,91,108,78,97,109,101,93,32,61,32,116,101,109,112,84,97,98,108,101, -13,10,32,32,32,32,32,32,101,110,100,13,10,32,32,32,32,32,32,116, -97,98,108,101,46,105,110,115,101,114,116,40,115,101,108,102,91,108,78,97, -109,101,93,44,32,118,97,108,117,101,41,13,10,32,32,32,32,101,108,115, -101,13,10,32,32,32,32,32,32,115,101,108,102,91,108,78,97,109,101,93, -32,61,32,118,97,108,117,101,13,10,32,32,32,32,101,110,100,13,10,32, -32,32,32,116,97,98,108,101,46,105,110,115,101,114,116,40,115,101,108,102, -46,95,95,95,112,114,111,112,115,44,32,123,32,110,97,109,101,32,61,32, -110,97,109,101,44,32,118,97,108,117,101,32,61,32,115,101,108,102,91,110, -97,109,101,93,32,125,41,13,10,32,32,101,110,100,13,10,13,10,32,32, -114,101,116,117,114,110,32,110,111,100,101,13,10,101,110,100,13,10,13,10, -102,117,110,99,116,105,111,110,32,88,109,108,80,97,114,115,101,114,46,112, -97,114,115,101,88,109,108,84,101,120,116,40,120,109,108,84,101,120,116,41, -13,10,32,32,108,111,99,97,108,32,115,116,97,99,107,32,61,32,123,125, -13,10,32,32,108,111,99,97,108,32,116,111,112,32,61,32,110,101,119,78, -111,100,101,40,41,13,10,32,32,116,97,98,108,101,46,105,110,115,101,114, -116,40,115,116,97,99,107,44,32,116,111,112,41,13,10,32,32,108,111,99, -97,108,32,110,105,44,32,99,44,32,108,97,98,101,108,44,32,120,97,114, -103,44,32,101,109,112,116,121,13,10,32,32,108,111,99,97,108,32,105,44, -32,106,32,61,32,49,44,32,49,13,10,32,32,119,104,105,108,101,32,116, -114,117,101,32,100,111,13,10,32,32,32,32,110,105,44,32,106,44,32,99, +32,116,101,109,112,84,97,98,108,101,13,10,9,32,32,101,110,100,13,10, +9,32,32,116,97,98,108,101,46,105,110,115,101,114,116,40,115,101,108,102, +91,99,104,105,108,100,58,110,97,109,101,40,41,93,44,32,99,104,105,108, +100,41,13,10,9,101,108,115,101,13,10,9,32,32,115,101,108,102,91,99, +104,105,108,100,58,110,97,109,101,40,41,93,32,61,32,99,104,105,108,100, +13,10,9,101,110,100,13,10,9,116,97,98,108,101,46,105,110,115,101,114, +116,40,115,101,108,102,46,95,95,95,99,104,105,108,100,114,101,110,44,32, +99,104,105,108,100,41,13,10,32,32,101,110,100,13,10,13,10,32,32,102, +117,110,99,116,105,111,110,32,110,111,100,101,58,112,114,111,112,101,114,116, +105,101,115,40,41,32,114,101,116,117,114,110,32,115,101,108,102,46,95,95, +95,112,114,111,112,115,32,101,110,100,13,10,32,32,102,117,110,99,116,105, +111,110,32,110,111,100,101,58,110,117,109,80,114,111,112,101,114,116,105,101, +115,40,41,32,114,101,116,117,114,110,32,35,115,101,108,102,46,95,95,95, +112,114,111,112,115,32,101,110,100,13,10,32,32,102,117,110,99,116,105,111, +110,32,110,111,100,101,58,97,100,100,80,114,111,112,101,114,116,121,40,110, +97,109,101,44,32,118,97,108,117,101,41,13,10,9,108,111,99,97,108,32, +108,78,97,109,101,32,61,32,34,64,34,32,46,46,32,110,97,109,101,13, +10,9,105,102,32,115,101,108,102,91,108,78,97,109,101,93,32,126,61,32, +110,105,108,32,116,104,101,110,13,10,9,32,32,105,102,32,116,121,112,101, +40,115,101,108,102,91,108,78,97,109,101,93,41,32,61,61,32,34,115,116, +114,105,110,103,34,32,116,104,101,110,13,10,9,9,108,111,99,97,108,32, +116,101,109,112,84,97,98,108,101,32,61,32,123,125,13,10,9,9,116,97, +98,108,101,46,105,110,115,101,114,116,40,116,101,109,112,84,97,98,108,101, +44,32,115,101,108,102,91,108,78,97,109,101,93,41,13,10,9,9,115,101, +108,102,91,108,78,97,109,101,93,32,61,32,116,101,109,112,84,97,98,108, +101,13,10,9,32,32,101,110,100,13,10,9,32,32,116,97,98,108,101,46, +105,110,115,101,114,116,40,115,101,108,102,91,108,78,97,109,101,93,44,32, +118,97,108,117,101,41,13,10,9,101,108,115,101,13,10,9,32,32,115,101, +108,102,91,108,78,97,109,101,93,32,61,32,118,97,108,117,101,13,10,9, +101,110,100,13,10,9,116,97,98,108,101,46,105,110,115,101,114,116,40,115, +101,108,102,46,95,95,95,112,114,111,112,115,44,32,123,32,110,97,109,101, +32,61,32,110,97,109,101,44,32,118,97,108,117,101,32,61,32,115,101,108, +102,91,110,97,109,101,93,32,125,41,13,10,32,32,101,110,100,13,10,13, +10,32,32,114,101,116,117,114,110,32,110,111,100,101,13,10,101,110,100,13, +10,13,10,102,117,110,99,116,105,111,110,32,88,109,108,80,97,114,115,101, +114,46,112,97,114,115,101,88,109,108,84,101,120,116,40,120,109,108,84,101, +120,116,41,13,10,32,32,108,111,99,97,108,32,115,116,97,99,107,32,61, +32,123,125,13,10,32,32,108,111,99,97,108,32,116,111,112,32,61,32,110, +101,119,78,111,100,101,40,41,13,10,32,32,116,97,98,108,101,46,105,110, +115,101,114,116,40,115,116,97,99,107,44,32,116,111,112,41,13,10,32,32, +108,111,99,97,108,32,110,105,44,32,99,44,32,108,97,98,101,108,44,32, +120,97,114,103,44,32,101,109,112,116,121,13,10,32,32,108,111,99,97,108, +32,105,44,32,106,32,61,32,49,44,32,49,13,10,32,32,119,104,105,108, +101,32,116,114,117,101,32,100,111,13,10,9,110,105,44,32,106,44,32,99, 44,32,108,97,98,101,108,44,32,120,97,114,103,44,32,101,109,112,116,121, 32,61,32,115,116,114,105,110,103,46,102,105,110,100,40,120,109,108,84,101, 120,116,44,32,34,60,40,37,47,63,41,40,91,37,119,95,58,93,43,41, -40,46,45,41,40,37,47,63,41,62,34,44,32,105,41,13,10,32,32,32, -32,105,102,32,110,111,116,32,110,105,32,116,104,101,110,32,98,114,101,97, -107,32,101,110,100,13,10,32,32,32,32,108,111,99,97,108,32,116,101,120, -116,32,61,32,115,116,114,105,110,103,46,115,117,98,40,120,109,108,84,101, -120,116,44,32,105,44,32,110,105,32,45,32,49,41,59,13,10,32,32,32, -32,105,102,32,110,111,116,32,115,116,114,105,110,103,46,102,105,110,100,40, -116,101,120,116,44,32,34,94,37,115,42,36,34,41,32,116,104,101,110,13, -10,32,32,32,32,32,32,108,111,99,97,108,32,108,86,97,108,32,61,32, -40,116,111,112,58,118,97,108,117,101,40,41,32,111,114,32,34,34,41,32, -46,46,32,88,109,108,80,97,114,115,101,114,46,102,114,111,109,88,109,108, -83,116,114,105,110,103,40,116,101,120,116,41,13,10,32,32,32,32,32,32, -115,116,97,99,107,91,35,115,116,97,99,107,93,58,115,101,116,86,97,108, -117,101,40,108,86,97,108,41,13,10,32,32,32,32,101,110,100,13,10,32, -32,32,32,105,102,32,101,109,112,116,121,32,61,61,32,34,47,34,32,116, -104,101,110,32,45,45,32,101,109,112,116,121,32,101,108,101,109,101,110,116, -32,116,97,103,13,10,32,32,32,32,32,32,108,111,99,97,108,32,108,78, -111,100,101,32,61,32,110,101,119,78,111,100,101,40,108,97,98,101,108,41, -13,10,32,32,32,32,32,32,88,109,108,80,97,114,115,101,114,46,112,97, -114,115,101,65,114,103,115,40,108,78,111,100,101,44,32,120,97,114,103,41, -13,10,32,32,32,32,32,32,116,111,112,58,97,100,100,67,104,105,108,100, -40,108,78,111,100,101,41,13,10,32,32,32,32,101,108,115,101,105,102,32, -99,32,61,61,32,34,34,32,116,104,101,110,32,45,45,32,115,116,97,114, -116,32,116,97,103,13,10,32,32,32,32,32,32,108,111,99,97,108,32,108, -78,111,100,101,32,61,32,110,101,119,78,111,100,101,40,108,97,98,101,108, -41,13,10,32,32,32,32,32,32,88,109,108,80,97,114,115,101,114,46,112, -97,114,115,101,65,114,103,115,40,108,78,111,100,101,44,32,120,97,114,103, -41,13,10,32,32,32,32,32,32,116,97,98,108,101,46,105,110,115,101,114, -116,40,115,116,97,99,107,44,32,108,78,111,100,101,41,13,10,32,32,116, -111,112,32,61,32,108,78,111,100,101,13,10,32,32,32,32,101,108,115,101, -32,45,45,32,101,110,100,32,116,97,103,13,10,32,32,32,32,32,32,108, -111,99,97,108,32,116,111,99,108,111,115,101,32,61,32,116,97,98,108,101, -46,114,101,109,111,118,101,40,115,116,97,99,107,41,32,45,45,32,114,101, -109,111,118,101,32,116,111,112,13,10,13,10,32,32,32,32,32,32,116,111, -112,32,61,32,115,116,97,99,107,91,35,115,116,97,99,107,93,13,10,32, -32,32,32,32,32,105,102,32,35,115,116,97,99,107,32,60,32,49,32,116, -104,101,110,13,10,32,32,32,32,32,32,32,32,101,114,114,111,114,40,34, +40,46,45,41,40,37,47,63,41,62,34,44,32,105,41,13,10,9,105,102, +32,110,111,116,32,110,105,32,116,104,101,110,32,98,114,101,97,107,32,101, +110,100,13,10,9,108,111,99,97,108,32,116,101,120,116,32,61,32,115,116, +114,105,110,103,46,115,117,98,40,120,109,108,84,101,120,116,44,32,105,44, +32,110,105,32,45,32,49,41,59,13,10,9,105,102,32,110,111,116,32,115, +116,114,105,110,103,46,102,105,110,100,40,116,101,120,116,44,32,34,94,37, +115,42,36,34,41,32,116,104,101,110,13,10,9,32,32,108,111,99,97,108, +32,108,86,97,108,32,61,32,40,116,111,112,58,118,97,108,117,101,40,41, +32,111,114,32,34,34,41,32,46,46,32,88,109,108,80,97,114,115,101,114, +46,102,114,111,109,88,109,108,83,116,114,105,110,103,40,116,101,120,116,41, +13,10,9,32,32,115,116,97,99,107,91,35,115,116,97,99,107,93,58,115, +101,116,86,97,108,117,101,40,108,86,97,108,41,13,10,9,101,110,100,13, +10,9,105,102,32,101,109,112,116,121,32,61,61,32,34,47,34,32,116,104, +101,110,32,45,45,32,101,109,112,116,121,32,101,108,101,109,101,110,116,32, +116,97,103,13,10,9,32,32,108,111,99,97,108,32,108,78,111,100,101,32, +61,32,110,101,119,78,111,100,101,40,108,97,98,101,108,41,13,10,9,32, +32,88,109,108,80,97,114,115,101,114,46,112,97,114,115,101,65,114,103,115, +40,108,78,111,100,101,44,32,120,97,114,103,41,13,10,9,32,32,116,111, +112,58,97,100,100,67,104,105,108,100,40,108,78,111,100,101,41,13,10,9, +101,108,115,101,105,102,32,99,32,61,61,32,34,34,32,116,104,101,110,32, +45,45,32,115,116,97,114,116,32,116,97,103,13,10,9,32,32,108,111,99, +97,108,32,108,78,111,100,101,32,61,32,110,101,119,78,111,100,101,40,108, +97,98,101,108,41,13,10,9,32,32,88,109,108,80,97,114,115,101,114,46, +112,97,114,115,101,65,114,103,115,40,108,78,111,100,101,44,32,120,97,114, +103,41,13,10,9,32,32,116,97,98,108,101,46,105,110,115,101,114,116,40, +115,116,97,99,107,44,32,108,78,111,100,101,41,13,10,32,32,116,111,112, +32,61,32,108,78,111,100,101,13,10,9,101,108,115,101,32,45,45,32,101, +110,100,32,116,97,103,13,10,9,32,32,108,111,99,97,108,32,116,111,99, +108,111,115,101,32,61,32,116,97,98,108,101,46,114,101,109,111,118,101,40, +115,116,97,99,107,41,32,45,45,32,114,101,109,111,118,101,32,116,111,112, +13,10,13,10,9,32,32,116,111,112,32,61,32,115,116,97,99,107,91,35, +115,116,97,99,107,93,13,10,9,32,32,105,102,32,35,115,116,97,99,107, +32,60,32,49,32,116,104,101,110,13,10,9,9,101,114,114,111,114,40,34, 88,109,108,80,97,114,115,101,114,46,32,110,111,116,104,105,110,103,32,116, 111,32,99,108,111,115,101,32,119,105,116,104,32,34,32,46,46,32,108,97, -98,101,108,41,13,10,32,32,32,32,32,32,101,110,100,13,10,32,32,32, -32,32,32,105,102,32,116,111,99,108,111,115,101,58,110,97,109,101,40,41, -32,126,61,32,108,97,98,101,108,32,116,104,101,110,13,10,32,32,32,32, -32,32,32,32,101,114,114,111,114,40,34,88,109,108,80,97,114,115,101,114, -46,32,116,114,121,105,110,103,32,116,111,32,99,108,111,115,101,32,34,32, -46,46,32,116,111,99,108,111,115,101,46,110,97,109,101,32,46,46,32,34, -32,119,105,116,104,32,34,32,46,46,32,108,97,98,101,108,41,13,10,32, -32,32,32,32,32,101,110,100,13,10,32,32,32,32,32,32,116,111,112,58, -97,100,100,67,104,105,108,100,40,116,111,99,108,111,115,101,41,13,10,32, -32,32,32,101,110,100,13,10,32,32,32,32,105,32,61,32,106,32,43,32, -49,13,10,32,32,101,110,100,13,10,32,32,108,111,99,97,108,32,116,101, -120,116,32,61,32,115,116,114,105,110,103,46,115,117,98,40,120,109,108,84, -101,120,116,44,32,105,41,59,13,10,32,32,105,102,32,35,115,116,97,99, -107,32,62,32,49,32,116,104,101,110,13,10,32,32,32,32,101,114,114,111, -114,40,34,88,109,108,80,97,114,115,101,114,46,32,117,110,99,108,111,115, -101,100,32,34,32,46,46,32,115,116,97,99,107,91,35,115,116,97,99,107, -93,58,110,97,109,101,40,41,41,13,10,32,32,101,110,100,13,10,32,32, -114,101,116,117,114,110,32,116,111,112,13,10,101,110,100,13,10,13,10,102, -117,110,99,116,105,111,110,32,88,109,108,80,97,114,115,101,114,46,108,111, -97,100,70,105,108,101,40,120,109,108,70,105,108,101,110,97,109,101,44,32, -98,97,115,101,41,13,10,32,32,105,102,32,110,111,116,32,98,97,115,101, -32,116,104,101,110,13,10,32,32,32,32,98,97,115,101,32,61,32,115,121, -115,116,101,109,46,82,101,115,111,117,114,99,101,68,105,114,101,99,116,111, -114,121,13,10,32,32,101,110,100,13,10,13,10,32,32,108,111,99,97,108, -32,112,97,116,104,32,61,32,115,121,115,116,101,109,46,112,97,116,104,70, -111,114,70,105,108,101,40,120,109,108,70,105,108,101,110,97,109,101,44,32, -98,97,115,101,41,13,10,32,32,108,111,99,97,108,32,104,70,105,108,101, -44,32,101,114,114,32,61,32,105,111,46,111,112,101,110,40,112,97,116,104, -44,32,34,114,34,41,59,13,10,13,10,32,32,105,102,32,104,70,105,108, -101,32,97,110,100,32,110,111,116,32,101,114,114,32,116,104,101,110,13,10, -32,32,32,32,108,111,99,97,108,32,120,109,108,84,101,120,116,32,61,32, -104,70,105,108,101,58,114,101,97,100,40,34,42,97,34,41,59,32,45,45, -32,114,101,97,100,32,102,105,108,101,32,99,111,110,116,101,110,116,13,10, -32,32,32,32,105,111,46,99,108,111,115,101,40,104,70,105,108,101,41,59, -13,10,32,32,32,32,114,101,116,117,114,110,32,88,109,108,80,97,114,115, -101,114,46,112,97,114,115,101,88,109,108,84,101,120,116,40,120,109,108,84, -101,120,116,41,44,32,110,105,108,59,13,10,32,32,101,108,115,101,13,10, -32,32,32,32,112,114,105,110,116,40,101,114,114,41,13,10,32,32,32,32, -114,101,116,117,114,110,32,110,105,108,13,10,32,32,101,110,100,13,10,101, -110,100,13,10,13,10,45,45,45,45,45,45,45,45,45,45,45,45,45,45, +98,101,108,41,13,10,9,32,32,101,110,100,13,10,9,32,32,105,102,32, +116,111,99,108,111,115,101,58,110,97,109,101,40,41,32,126,61,32,108,97, +98,101,108,32,116,104,101,110,13,10,9,9,101,114,114,111,114,40,34,88, +109,108,80,97,114,115,101,114,46,32,116,114,121,105,110,103,32,116,111,32, +99,108,111,115,101,32,34,32,46,46,32,116,111,99,108,111,115,101,46,110, +97,109,101,32,46,46,32,34,32,119,105,116,104,32,34,32,46,46,32,108, +97,98,101,108,41,13,10,9,32,32,101,110,100,13,10,9,32,32,116,111, +112,58,97,100,100,67,104,105,108,100,40,116,111,99,108,111,115,101,41,13, +10,9,101,110,100,13,10,9,105,32,61,32,106,32,43,32,49,13,10,32, +32,101,110,100,13,10,32,32,108,111,99,97,108,32,116,101,120,116,32,61, +32,115,116,114,105,110,103,46,115,117,98,40,120,109,108,84,101,120,116,44, +32,105,41,59,13,10,32,32,105,102,32,35,115,116,97,99,107,32,62,32, +49,32,116,104,101,110,13,10,9,101,114,114,111,114,40,34,88,109,108,80, +97,114,115,101,114,46,32,117,110,99,108,111,115,101,100,32,34,32,46,46, +32,115,116,97,99,107,91,35,115,116,97,99,107,93,58,110,97,109,101,40, +41,41,13,10,32,32,101,110,100,13,10,32,32,114,101,116,117,114,110,32, +116,111,112,13,10,101,110,100,13,10,13,10,102,117,110,99,116,105,111,110, +32,88,109,108,80,97,114,115,101,114,46,108,111,97,100,70,105,108,101,40, +120,109,108,70,105,108,101,110,97,109,101,44,32,98,97,115,101,41,13,10, +32,32,105,102,32,110,111,116,32,98,97,115,101,32,116,104,101,110,13,10, +9,98,97,115,101,32,61,32,115,121,115,116,101,109,46,82,101,115,111,117, +114,99,101,68,105,114,101,99,116,111,114,121,13,10,32,32,101,110,100,13, +10,13,10,32,32,108,111,99,97,108,32,112,97,116,104,32,61,32,115,121, +115,116,101,109,46,112,97,116,104,70,111,114,70,105,108,101,40,120,109,108, +70,105,108,101,110,97,109,101,44,32,98,97,115,101,41,13,10,32,32,108, +111,99,97,108,32,104,70,105,108,101,44,32,101,114,114,32,61,32,105,111, +46,111,112,101,110,40,112,97,116,104,44,32,34,114,34,41,59,13,10,13, +10,32,32,105,102,32,104,70,105,108,101,32,97,110,100,32,110,111,116,32, +101,114,114,32,116,104,101,110,13,10,9,108,111,99,97,108,32,120,109,108, +84,101,120,116,32,61,32,104,70,105,108,101,58,114,101,97,100,40,34,42, +97,34,41,59,32,45,45,32,114,101,97,100,32,102,105,108,101,32,99,111, +110,116,101,110,116,13,10,9,105,111,46,99,108,111,115,101,40,104,70,105, +108,101,41,59,13,10,9,114,101,116,117,114,110,32,88,109,108,80,97,114, +115,101,114,46,112,97,114,115,101,88,109,108,84,101,120,116,40,120,109,108, +84,101,120,116,41,44,32,110,105,108,59,13,10,32,32,101,108,115,101,13, +10,9,112,114,105,110,116,40,101,114,114,41,13,10,9,114,101,116,117,114, +110,32,110,105,108,13,10,32,32,101,110,100,13,10,101,110,100,13,10,13, +10,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, +45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,13,10,45,45,32, +69,120,112,111,114,116,32,116,111,32,74,105,110,46,32,13,10,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, -13,10,45,45,32,69,120,112,111,114,116,32,116,111,32,74,105,110,46,32, -13,10,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, 45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45, -45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,13,10,13,10, -106,105,110,46,117,116,105,108,115,46,120,109,108,32,61,32,88,109,108,80, -97,114,115,101,114,0 +45,45,45,45,45,45,45,45,45,45,45,13,10,13,10,106,105,110,46,117, +116,105,108,115,46,120,109,108,32,61,32,88,109,108,80,97,114,115,101,114,0 }; diff --git a/src/libjin/graphics/opengl.cpp b/src/libjin/graphics/opengl.cpp index da3659d..c1696f4 100644 --- a/src/libjin/graphics/opengl.cpp +++ b/src/libjin/graphics/opengl.cpp @@ -52,11 +52,12 @@ namespace JinEngine void OpenGL::init() { enable(GL_BLEND); + + unbindCanvas(); + unuseShader(); setClearColor(0, 0, 0, 0xff); setColor(0xff, 0xff, 0xff, 0xff); setBlendMode(OpenGL::BlendMode::ALPHA); - unbindCanvas(); - unuseShader(); } void OpenGL::enable(GLenum cap) @@ -337,18 +338,15 @@ namespace JinEngine if (mCanvas != canvas && canvas) { GLuint fbo = canvas->getGLFrameBuffer(); - gl.bindFrameBuffer(fbo); + bindFrameBuffer(fbo); int w = canvas->getWidth(); int h = canvas->getHeight(); glViewport(0, 0, w, h); - gl.setProjectionMatrix(0, w, 0, h, -1, 1); + setProjectionMatrix(0, w, 0, h, -1, 1); mCanvas = canvas; - gl.enable(GL_BLEND); - gl.enable(GL_TEXTURE_2D); - - gl.setBlendMode(OpenGL::BlendMode::ALPHA); + setBlendMode(OpenGL::BlendMode::ALPHA); ++mStats.canvasSwitches; } @@ -367,11 +365,12 @@ namespace JinEngine return; // Get window size as viewport. Window* wnd = Window::get(); - int w = wnd->getW(); - int h = wnd->getH(); - glBindFramebuffer(GL_FRAMEBUFFER, 0); + glBindFramebuffer(GL_FRAMEBUFFER, 0); + int w = wnd->getW(), h = wnd->getH(); glViewport(0, 0, w, h); - gl.setProjectionMatrix(0, w, h, 0, -1, 1); + setProjectionMatrix(0, w, h, 0, -1, 1); + + setBlendMode(OpenGL::BlendMode::ALPHA); mCanvas = SCREEN; } diff --git a/src/libjin/math/matrix.cpp b/src/libjin/math/matrix.cpp index d9324df..9d1c77b 100644 --- a/src/libjin/math/matrix.cpp +++ b/src/libjin/math/matrix.cpp @@ -191,5 +191,5 @@ namespace JinEngine } } - } // namespace Math -} // namespace JinEngine
\ No newline at end of file + } +}
\ No newline at end of file |