yake-svn Mailing List for Yake Engine (Page 8)
Status: Beta
Brought to you by:
psyclonist
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(17) |
Sep
(51) |
Oct
(2) |
Nov
(18) |
Dec
(66) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(44) |
Feb
(13) |
Mar
(73) |
Apr
(61) |
May
|
Jun
(4) |
Jul
(19) |
Aug
(50) |
Sep
(47) |
Oct
(7) |
Nov
(7) |
Dec
(14) |
2008 |
Jan
(2) |
Feb
|
Mar
(4) |
Apr
(4) |
May
(5) |
Jun
(7) |
Jul
(4) |
Aug
|
Sep
(5) |
Oct
|
Nov
(1) |
Dec
(4) |
2009 |
Jan
|
Feb
(22) |
Mar
(12) |
Apr
(1) |
May
(1) |
Jun
(4) |
Jul
(4) |
Aug
|
Sep
|
Oct
(17) |
Nov
(3) |
Dec
|
2010 |
Jan
|
Feb
|
Mar
(12) |
Apr
(11) |
May
|
Jun
(5) |
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <psy...@us...> - 2007-09-15 23:42:08
|
Revision: 1862 http://yake.svn.sourceforge.net/yake/?rev=1862&view=rev Author: psyclonist Date: 2007-09-15 16:42:12 -0700 (Sat, 15 Sep 2007) Log Message: ----------- * [scriptingLua] open 'package' module by calling Lua function Modified Paths: -------------- trunk/yake/src/plugins/scriptingLua/ScriptingSystemLua.cpp Modified: trunk/yake/src/plugins/scriptingLua/ScriptingSystemLua.cpp =================================================================== --- trunk/yake/src/plugins/scriptingLua/ScriptingSystemLua.cpp 2007-09-15 23:39:30 UTC (rev 1861) +++ trunk/yake/src/plugins/scriptingLua/ScriptingSystemLua.cpp 2007-09-15 23:42:12 UTC (rev 1862) @@ -71,7 +71,11 @@ if (IS_MASK_SET(libs, LUALIB_DEBUG)) luaopen_debug( mLuaState ); if (IS_MASK_SET(libs, LUALIB_PACKAGE)) - luaopen_package( mLuaState ); + { + lua_pushcfunction(mLuaState, luaopen_package); + lua_pushstring(mLuaState, "package"); + lua_call(mLuaState, 1, 0); + } luabind::open( mLuaState ); } @@ -123,7 +127,7 @@ std::string err; try { //YAKE_ASSERT( pScript->getCreator()->getLanguage() == scripting::IScriptingSystem::L_LUA ); - //if ( ( pScript->getCreator()->getLanguage() != scripting::IScriptingSystem::L_LUA ) || + //if ( ( pScript->getCreator()->getLanguage() != scripting::IScriptingSystem::L_LUA ) || // ( 0 == mLuaState ) ) // return; YAKE_ASSERT( dynamic_cast<LuaScript*>(pScript.get()) != 0 ).debug("incompatible language"); @@ -228,11 +232,11 @@ } //------------------------------------------------------ - bool LuaScript::isLoaded() + bool LuaScript::isLoaded() { return !mCode.empty(); } - + //------------------------------------------------------ void LuaScript::setData( const String& rData ) { @@ -264,7 +268,7 @@ } //------------------------------------------------------ - const LuaScript::CodeBuffer& LuaScript::getData() const + const LuaScript::CodeBuffer& LuaScript::getData() const { return mCode; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-15 23:39:26
|
Revision: 1861 http://yake.svn.sourceforge.net/yake/?rev=1861&view=rev Author: psyclonist Date: 2007-09-15 16:39:30 -0700 (Sat, 15 Sep 2007) Log Message: ----------- * [base] moved Color c'tor for MinGW/GCC (it died with an 'internal error') * [base] pull Rectangle into namespace yake Modified Paths: -------------- trunk/yake/yake/base/math/yakeColor.h trunk/yake/yake/base/math/yakeColor.inl trunk/yake/yake/base/math/yakeGeometry.h Modified: trunk/yake/yake/base/math/yakeColor.h =================================================================== --- trunk/yake/yake/base/math/yakeColor.h 2007-09-15 23:35:46 UTC (rev 1860) +++ trunk/yake/yake/base/math/yakeColor.h 2007-09-15 23:39:30 UTC (rev 1861) @@ -47,9 +47,9 @@ { public: // Constructor. - Color(); - Color( real fRed, real fGreen, real fBlue, real fAlpha = 1.0f ); - Color( real Coordinates[ 4 ] ); + Color() : r(0), g(0), b(0), a(0) {} + Color( real fRed, real fGreen, real fBlue, real fAlpha = 1.0f ) : r(fRed), g(fGreen), b(fBlue), a(fAlpha) {} + Color( real Coordinates[ 4 ] ) : r(Coordinates[ 0 ]), g(Coordinates[ 1 ]), b(Coordinates[ 2 ]), a(Coordinates[ 3 ]) {} Color( const Color& rIn ) : r(rIn.r), g(rIn.g), b(rIn.b), a(rIn.a) {} // Assignment Operator. Modified: trunk/yake/yake/base/math/yakeColor.inl =================================================================== --- trunk/yake/yake/base/math/yakeColor.inl 2007-09-15 23:35:46 UTC (rev 1860) +++ trunk/yake/yake/base/math/yakeColor.inl 2007-09-15 23:39:30 UTC (rev 1861) @@ -33,30 +33,6 @@ return Color( rColor.r * fScalar, rColor.g * fScalar, rColor.b * fScalar, rColor.a * fScalar ); } - -inline Color::Color() -{ - r = g = b = a = 0.0f; -} - - -inline Color::Color( real fRed, real fGreen, real fBlue, real fAlpha ) -{ - r = fRed; - g = fGreen; - b = fBlue; - a = fAlpha; -} - -inline Color::Color( real Coordinates[ 4 ] ) -{ - r = Coordinates[ 0 ]; - g = Coordinates[ 1 ]; - b = Coordinates[ 2 ]; - a = Coordinates[ 3 ]; -} - - inline Color& Color::operator=( const Color& rIn ) { r = rIn.r; Modified: trunk/yake/yake/base/math/yakeGeometry.h =================================================================== --- trunk/yake/yake/base/math/yakeGeometry.h 2007-09-15 23:35:46 UTC (rev 1860) +++ trunk/yake/yake/base/math/yakeGeometry.h 2007-09-15 23:39:30 UTC (rev 1861) @@ -60,7 +60,7 @@ /** rectangle (2D) */ - struct YAKE_BASE_API Rectangle + struct YAKE_BASE_API Rectangle { Rectangle(const Rectangle & rect) : min(rect.min), max(rect.max) {} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-15 23:35:43
|
Revision: 1860 http://yake.svn.sourceforge.net/yake/?rev=1860&view=rev Author: psyclonist Date: 2007-09-15 16:35:46 -0700 (Sat, 15 Sep 2007) Log Message: ----------- * [demo] added sampleRafLua2.cfg Added Paths: ----------- trunk/yake/samples/bin/debug/sampleRafLua2.cfg Added: trunk/yake/samples/bin/debug/sampleRafLua2.cfg =================================================================== --- trunk/yake/samples/bin/debug/sampleRafLua2.cfg (rev 0) +++ trunk/yake/samples/bin/debug/sampleRafLua2.cfg 2007-09-15 23:35:46 UTC (rev 1860) @@ -0,0 +1,16 @@ +[resource.sources] # <- evaluated by RAF +file=../../../common/media/scripts/ # <- do NOT forget trialing '/' !! + +#----------------------------------- +[raf.startup.libraries] +# Libraries to be loaded automatically at startup + +graphicsOgre +inputOgreOIS + +#----------------------------------- +[raf.startup.systems] +# System to be created & initialized automatically + +graphics=ogre3d +input=ois This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-15 18:22:41
|
Revision: 1859 http://yake.svn.sourceforge.net/yake/?rev=1859&view=rev Author: psyclonist Date: 2007-09-15 11:22:43 -0700 (Sat, 15 Sep 2007) Log Message: ----------- * [bindings.lua] SignalConnection is now held as shared_ptr in Lua Modified Paths: -------------- trunk/yake/src/bindings.lua/detail/input.lua.cpp Modified: trunk/yake/src/bindings.lua/detail/input.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/input.lua.cpp 2007-09-15 18:21:53 UTC (rev 1858) +++ trunk/yake/src/bindings.lua/detail/input.lua.cpp 2007-09-15 18:22:43 UTC (rev 1859) @@ -45,28 +45,39 @@ #include <luabind/adopt_policy.hpp> namespace yake { + typedef SharedPtr<SignalConnection> SignalConnectionPtr; namespace input { struct NullType {}; - SignalConnection* ActionMap_connectToAction(ActionMap* map, const ActionId& id, luabind::object o) + + // NB This workaround is required for at least MinGW. + // Why? boost::signals::connection::disconnect() is const + // and for some reason this collides with the Luabind binding + // of SignalConnection::disconnect. + void SignalConnection_disconnect(SignalConnectionPtr conn) { + if (conn) + conn->disconnect(); + } + SignalConnectionPtr ActionMap_connectToAction(ActionMap* map, const ActionId& id, luabind::object o) + { YAKE_ASSERT( map ); //YAKE_ASSERT( luabind::type(o) == LUA_TFUNCTION ); if (luabind::type(o) != LUA_TFUNCTION) - return 0; - return new SignalConnection(map->subscribeToActionIdV( id, o )); + return SignalConnectionPtr(); + return SignalConnectionPtr(new SignalConnection(map->subscribeToActionIdV( id, o ))); } - SignalConnection* ActionMap_connectToActionByName(ActionMap* map, const char* name, luabind::object o) + SignalConnectionPtr ActionMap_connectToActionByName(ActionMap* map, const char* name, luabind::object o) { const ActionId id = ActionIdRegistry::getByName(name); return ActionMap_connectToAction( map, id, o ); } - SignalConnection* ActionMap_connectToActionResult(ActionMap* map, const ActionId& id, luabind::object o) + SignalConnectionPtr ActionMap_connectToActionResult(ActionMap* map, const ActionId& id, luabind::object o) { YAKE_ASSERT( map ); //YAKE_ASSERT( luabind::type(o) == LUA_TFUNCTION ); if (luabind::type(o) != LUA_TFUNCTION) - return 0; - return new SignalConnection(map->subscribeToActionIdR( id, o )); + return SignalConnectionPtr(); + return SignalConnectionPtr(new SignalConnection(map->subscribeToActionIdR( id, o ))); } ConditionConnection* ActionMap_reg(ActionMap* map, const ActionId & actionId, SharedPtr<ActionCondition> condition) { @@ -157,16 +168,16 @@ class_<ConditionConnection>("ConditionConnection") .def("disconnect",&ConditionConnection::disconnect) , - class_<SignalConnection>("SignalConnection") //@todo move out from "yake.input" into "yake" - .def("disconnect",&SignalConnection::disconnect) + class_<SignalConnection,SignalConnectionPtr>("SignalConnection") //@todo move out from "yake.input" into "yake" + .def("disconnect",&SignalConnection_disconnect) , class_<ActionMap>("ActionMap") .def("start", &ActionMap::start) .def("stop", &ActionMap::stop) .def("clear", &ActionMap::clear) - .def("connectToAction", &ActionMap_connectToAction, adopt(result)) - .def("connectToAction", &ActionMap_connectToActionByName, adopt(result)) - .def("connectToActionResult", &ActionMap_connectToActionResult, adopt(result)) + .def("connectToAction", &ActionMap_connectToAction/*, adopt(result)*/) + .def("connectToAction", &ActionMap_connectToActionByName/*, adopt(result)*/) + .def("connectToActionResult", &ActionMap_connectToActionResult/*, adopt(result)*/) .def("reg", &ActionMap_reg, adopt(result)) .def("reg", &ActionMap_regByName, adopt(result)) .def("save", &ActionMap::saveToFile) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-15 18:21:49
|
Revision: 1858 http://yake.svn.sourceforge.net/yake/?rev=1858&view=rev Author: psyclonist Date: 2007-09-15 11:21:53 -0700 (Sat, 15 Sep 2007) Log Message: ----------- * [build] fixed binding options for Lua and Luabind for MinGW Modified Paths: -------------- trunk/yake/scripts/premake/deps.lua Modified: trunk/yake/scripts/premake/deps.lua =================================================================== --- trunk/yake/scripts/premake/deps.lua 2007-09-15 18:20:49 UTC (rev 1857) +++ trunk/yake/scripts/premake/deps.lua 2007-09-15 18:21:53 UTC (rev 1858) @@ -99,6 +99,8 @@ defDepLibrary("lua","lua","ReleaseLib") defDepLibrary("lua","luad","Debug") defDepLibrary("lua","luad","DebugLib") +elseif windows and cb_gcc then + defDepLibrary("lua51.dll","lua") else defDepLibrary("lua","lua") end @@ -115,6 +117,8 @@ defDepLibrary("luabind","luabind","ReleaseWithSymbols") defDepLibrary("luabind","luabindd","Debug") defDepLibrary("luabind","luabindd","DebugLib") +elseif windows and cb_gcc then + defDepLibrary("luabind.dll","luabind") else defDepLibrary("luabind","luabind") end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-15 18:20:45
|
Revision: 1857 http://yake.svn.sourceforge.net/yake/?rev=1857&view=rev Author: psyclonist Date: 2007-09-15 11:20:49 -0700 (Sat, 15 Sep 2007) Log Message: ----------- * [demo] res/lua1: improved code clarity Modified Paths: -------------- trunk/yake/samples/res/lua1/demo.cpp Modified: trunk/yake/samples/res/lua1/demo.cpp =================================================================== --- trunk/yake/samples/res/lua1/demo.cpp 2007-09-15 18:20:08 UTC (rev 1856) +++ trunk/yake/samples/res/lua1/demo.cpp 2007-09-15 18:20:49 UTC (rev 1857) @@ -1,10 +1,8 @@ +#include <yake/base/yakeLog.h> +#include <yake/base/yakeStderrLog.h> #include <yake/scripting/yakeScriptingSystem.h> #include <yake/raf/yakeRaf.h> - -#include <yake/plugins/scriptingLua/ScriptingSystemLua.h> #include <yake/bindings.lua/bindings.lua.h> -#include <yake/bindings.lua/common/yake.lua.common.h> - #include <yake/res/res.h> using namespace yake; @@ -25,7 +23,9 @@ scripting::IScriptingSystem* sys = getScriptingSystem("lua"); YAKE_ASSERT( sys ); scripting::VMPtr vm = sys->createVM(); - bind_all(vm.get()); + bind_base(vm.get()); + bind_math(vm.get()); + bind_res(vm.get()); //bind { @@ -40,7 +40,9 @@ // Load & run script try { + std::cout << "loading script...\n"; scripting::ScriptPtr script = sys->createScriptFromFile("res1.lua"); + std::cout << "running script...\n"; vm->execute( script ); } catch (Exception& ex) @@ -52,9 +54,14 @@ } }; -#include <yake/base/yakeConfigFile.h> int main( int argc, char** argv ) { + typedef SharedPtr<logging::log_listener> log_listener_ptr; + + // create and attach log listeners + log_listener_ptr toStdErr( new yake::logging::stderr_listener() ); + yake::logging::addListener( toStdErr.get() ); + // Use default executor for convenience. // It's always possible to manually execute TheApp::initialise() etc. TheApp app; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-15 18:20:06
|
Revision: 1856 http://yake.svn.sourceforge.net/yake/?rev=1856&view=rev Author: psyclonist Date: 2007-09-15 11:20:08 -0700 (Sat, 15 Sep 2007) Log Message: ----------- * [base] explicit test for is_open() Modified Paths: -------------- trunk/yake/src/base/yakeConfigFile.cpp Modified: trunk/yake/src/base/yakeConfigFile.cpp =================================================================== --- trunk/yake/src/base/yakeConfigFile.cpp 2007-09-15 18:19:33 UTC (rev 1855) +++ trunk/yake/src/base/yakeConfigFile.cpp 2007-09-15 18:20:08 UTC (rev 1856) @@ -230,7 +230,7 @@ bool IniFile::load(const String& filename) { std::ifstream in(filename.c_str(), std::ios::in); - if (!in) + if (!in.is_open()) return false; String currSection; String line; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-15 18:19:29
|
Revision: 1855 http://yake.svn.sourceforge.net/yake/?rev=1855&view=rev Author: psyclonist Date: 2007-09-15 11:19:33 -0700 (Sat, 15 Sep 2007) Log Message: ----------- * [demo] fixed destruction order Modified Paths: -------------- trunk/yake/samples/base/scripting/lua/yakeDemo.cpp Modified: trunk/yake/samples/base/scripting/lua/yakeDemo.cpp =================================================================== --- trunk/yake/samples/base/scripting/lua/yakeDemo.cpp 2007-09-15 02:43:06 UTC (rev 1854) +++ trunk/yake/samples/base/scripting/lua/yakeDemo.cpp 2007-09-15 18:19:33 UTC (rev 1855) @@ -31,7 +31,6 @@ YAKE_ASSERT( binderLib ).debug("Cannot load Lua bindings."); SharedPtr<scripting::IScriptingSystem> scriptingSys = templates::create_default<scripting::IScriptingSystem>(); - SharedPtr<scripting::IScriptingSystem> scriptingBindings = templates::create_default<scripting::IScriptingSystem>(); scripting::VMPtr vm( scriptingSys->createVM() ); YAKE_ASSERT( vm ); @@ -45,7 +44,7 @@ // Setup resources res::SourceFactory::global().reg<res::FileSource>("file"); - res::SourceManager::global().addSource("file","../../common/media/samples/"); + res::SourceManager::global().addSource("file","../../../common/media/samples/"); // Execute a script created from a file. { @@ -55,6 +54,7 @@ } vm.reset(); + scriptingSys.reset(); binderLib.reset(); lib.reset(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-15 02:43:05
|
Revision: 1854 http://yake.svn.sourceforge.net/yake/?rev=1854&view=rev Author: psyclonist Date: 2007-09-14 19:43:06 -0700 (Fri, 14 Sep 2007) Log Message: ----------- * moved Color copy c'tor from .inl to .h as it crashed MinGW (internal compiler error) (MinGW Toolbox WR1 as downloaded from ogre3d.org) Modified Paths: -------------- trunk/yake/yake/base/math/yakeColor.h trunk/yake/yake/base/math/yakeColor.inl Modified: trunk/yake/yake/base/math/yakeColor.h =================================================================== --- trunk/yake/yake/base/math/yakeColor.h 2007-09-14 23:06:01 UTC (rev 1853) +++ trunk/yake/yake/base/math/yakeColor.h 2007-09-15 02:43:06 UTC (rev 1854) @@ -50,7 +50,7 @@ Color(); Color( real fRed, real fGreen, real fBlue, real fAlpha = 1.0f ); Color( real Coordinates[ 4 ] ); - Color( const Color& rIn ); + Color( const Color& rIn ) : r(rIn.r), g(rIn.g), b(rIn.b), a(rIn.a) {} // Assignment Operator. Color& operator=( const Color& rIn ); Modified: trunk/yake/yake/base/math/yakeColor.inl =================================================================== --- trunk/yake/yake/base/math/yakeColor.inl 2007-09-14 23:06:01 UTC (rev 1853) +++ trunk/yake/yake/base/math/yakeColor.inl 2007-09-15 02:43:06 UTC (rev 1854) @@ -57,16 +57,6 @@ } -inline Color::Color( const Color& rIn ) -{ - r = rIn.r; - g = rIn.g; - b = rIn.b; - a = rIn.a; -} - - - inline Color& Color::operator=( const Color& rIn ) { r = rIn.r; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-14 23:05:59
|
Revision: 1853 http://yake.svn.sourceforge.net/yake/?rev=1853&view=rev Author: psyclonist Date: 2007-09-14 16:06:01 -0700 (Fri, 14 Sep 2007) Log Message: ----------- * [demo] fixed some lua related demos * [base] fixed prerequisites settings for MinGW * [build] fixed premake scripts for dealing with CodeBlocks/MinGW Modified Paths: -------------- trunk/yake/samples/base/scripting/lua/yakeDemo.cpp trunk/yake/samples/property/lua1/demo.cpp trunk/yake/scripts/cb_gnu_win/patch_cbp.lua trunk/yake/scripts/premake/deps.lua trunk/yake/scripts/premake/tools.lua trunk/yake/yake/base/prerequisites/yakePrerequisitesGCCWin.h Modified: trunk/yake/samples/base/scripting/lua/yakeDemo.cpp =================================================================== --- trunk/yake/samples/base/scripting/lua/yakeDemo.cpp 2007-09-12 19:59:48 UTC (rev 1852) +++ trunk/yake/samples/base/scripting/lua/yakeDemo.cpp 2007-09-14 23:06:01 UTC (rev 1853) @@ -8,6 +8,8 @@ #include <yake/base/yake.h> #include <yake/scripting/yakeScriptingSystem.h> #include <yake/bindings.lua/bindings.lua.h> +#include <yake/plugins/scriptingLua/ScriptingSystemLua.h> +#include <yake/res/res.h> using namespace yake; // We don't expect collisions. @@ -20,7 +22,7 @@ int main(int argc, char* argv[]) { - try + try { SharedPtr<base::Library> lib = loadLib(YAKE_DYNLIB_NAME("scriptingLua")); YAKE_ASSERT( lib ).debug("Cannot load Lua scripting plugin."); @@ -34,15 +36,20 @@ scripting::VMPtr vm( scriptingSys->createVM() ); YAKE_ASSERT( vm ); - bind_all( vm.get() ); + bind_base( vm.get() ); + bind_math( vm.get() ); // This prints 'hello from lua scripting ;)' to stdout using // the Lua function print(). vm->execute("print('hello from lua scripting ;)');"); + // Setup resources + res::SourceFactory::global().reg<res::FileSource>("file"); + res::SourceManager::global().addSource("file","../../common/media/samples/"); + // Execute a script created from a file. { - scripting::ScriptPtr script( scriptingSys->createScriptFromFile("../../../common/media/samples/scriptingLua/test.lua") ); + scripting::ScriptPtr script( scriptingSys->createScriptFromFile("scriptingLua/test.lua") ); YAKE_ASSERT( script ); vm->execute( script ); } Modified: trunk/yake/samples/property/lua1/demo.cpp =================================================================== --- trunk/yake/samples/property/lua1/demo.cpp 2007-09-12 19:59:48 UTC (rev 1852) +++ trunk/yake/samples/property/lua1/demo.cpp 2007-09-14 23:06:01 UTC (rev 1853) @@ -4,7 +4,7 @@ #include "yake/base/yakeLog.h" #include "yake/base/yakeStderrLog.h" -void main() +int main() { using namespace yake; @@ -34,12 +34,14 @@ // run Lua script scripting::ScriptPtr demoScript( scriptingSys.createScriptFromFile("property/demo.lua") ); vm->execute( demoScript ); - + // clean up vm.reset(); } catch (Exception& ex) { std::cerr << "Exception: " << ex.what() << "\n"; + return 1; } + return 0; } Modified: trunk/yake/scripts/cb_gnu_win/patch_cbp.lua =================================================================== --- trunk/yake/scripts/cb_gnu_win/patch_cbp.lua 2007-09-12 19:59:48 UTC (rev 1852) +++ trunk/yake/scripts/cb_gnu_win/patch_cbp.lua 2007-09-14 23:06:01 UTC (rev 1853) @@ -10,9 +10,26 @@ local s = string.gmatch(line,"%<Build%>")() if s and #s > 0 then cbp:write("\t\t<Linker>\n") - cbp:write("\t\t\t<Add option=\"-s\"/>\n") + --cbp:write("\t\t\t<Add option=\"-s\"/>\n") + cbp:write("\t\t\t") + cbp:write([[<Add option="-Wl,--enable-auto-image-base" />]]) + cbp:write("\n") + cbp:write("\t\t\t") + cbp:write([[<Add option="-Wl,--add-stdcall-alias" />]]) + cbp:write("\n") cbp:write("\t\t</Linker>\n") + + cbp:write(line.."\n") + else + s = string.gmatch(line,"createStaticLib=\"0\"")() + if s and #s > 0 then + cbp:write("\t\t\t\t") + cbp:write([[<Option createStaticLib="1"/>]]) + cbp:write("\n") + else + cbp:write(line.."\n") + end end - cbp:write(line.."\n") end cbp:close() +os.remove(fname..".orig") Modified: trunk/yake/scripts/premake/deps.lua =================================================================== --- trunk/yake/scripts/premake/deps.lua 2007-09-12 19:59:48 UTC (rev 1852) +++ trunk/yake/scripts/premake/deps.lua 2007-09-14 23:06:01 UTC (rev 1853) @@ -10,8 +10,8 @@ defDepLibrary("boost","boost_signals") defDepLibrary("boost","boost_thread") elseif cb_gcc then - defDepLibrary("boost","libboost_signals-mgw34-mt-d-1_34_1.a") - defDepLibrary("boost","libboost_thread-mgw34-mt-d-1_34_1.a") + defDepLibrary("boost","boost_signals-mgw34-mt-d-1_34_1") + defDepLibrary("boost","boost_thread-mgw34-mt-d-1_34_1") end -------------------------------------- Modified: trunk/yake/scripts/premake/tools.lua =================================================================== --- trunk/yake/scripts/premake/tools.lua 2007-09-12 19:59:48 UTC (rev 1852) +++ trunk/yake/scripts/premake/tools.lua 2007-09-14 23:06:01 UTC (rev 1853) @@ -2,6 +2,7 @@ -- Various utility functions for -- the YAKE build file make script -------------------------------------- +dofile("config.lua") -------------------------------------- -- INTERNAL @@ -172,15 +173,30 @@ package.buildoptions = {} if (linux or cb_gcc) then --TODO should be 'if gcc' - package.buildoptions = {"-s"} + --package.buildoptions = {"-s"} --< TODO release builds only end + if (cb_gcc) then + --TODO some options only for dynamic targets: + --table.insert(package.buildoptions,"-Wall") + table.insert(package.buildoptions,"-mthreads") + table.insert(package.buildoptions,"-fmessage-length=0") + table.insert(package.buildoptions,"-fexceptions") + table.insert(package.buildoptions,"-fident") + table.insert(package.buildoptions,"-pipe") + end package.includepaths = {rootdir} package.defines = {} if (windows) then - addDefine("_CRT_SECURE_NO_DEPRECATE") - addDefine("_CRT_NOFORCE_MANIFEST") -- No manifests for DLLs. Let the executable decide. addDefine("WIN32") + addDefine("_WINDOWS") + if (not linux and not cb_gcc) then --MSVC: + addDefine("_CRT_SECURE_NO_DEPRECATE") + addDefine("_CRT_NOFORCE_MANIFEST") -- No manifests for DLLs. Let the executable decide. + end + if (cb_gcc) then + addDefine("_REENTRANT") + end else addDefine("_REENTRANT") end @@ -192,7 +208,7 @@ debug.target = (LIBFILE_PREFIX)..name..(DEBUG_DLL_SUFFIX) debug.defines = {"_DEBUG"} debug.buildflags = {"no-pch"} - if windows then + if windows and not cb_gcc then local targetfile = targetBaseDir .. debug.target .. "." .. DLL_EXTENSION local args = targetfile.. " " .. rootdir .. "samples/bin/debug" Modified: trunk/yake/yake/base/prerequisites/yakePrerequisitesGCCWin.h =================================================================== --- trunk/yake/yake/base/prerequisites/yakePrerequisitesGCCWin.h 2007-09-12 19:59:48 UTC (rev 1852) +++ trunk/yake/yake/base/prerequisites/yakePrerequisitesGCCWin.h 2007-09-14 23:06:01 UTC (rev 1853) @@ -51,7 +51,7 @@ // we can just remove the following typedefs and add an #include <cstdint>. // SK: put it into namespace because it collided with other libs: -namespace yake +namespace yake { typedef signed char int8; typedef unsigned char uint8; @@ -70,7 +70,7 @@ // #else // # define HashMap ::stdext::hash_map // #endif - + #else # error("Yake: GCC/Win32: No configuration file set for the selected platform/compiler!") #endif @@ -81,9 +81,9 @@ //============================================================================ #define YAKE_VSNPRINTF vsnprintf -#define DLLEXPORT -#define DLLIMPORT -#define LIBRARY_EXTENSION ( "so" ) +#define DLLEXPORT __declspec(dllexport) +#define DLLIMPORT __declspec(dllimport) +#define LIBRARY_EXTENSION ( "dll" ) #ifdef _DEBUG # define YAKE_DEBUG_BUILD This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-12 19:59:49
|
Revision: 1852 http://yake.svn.sourceforge.net/yake/?rev=1852&view=rev Author: psyclonist Date: 2007-09-12 12:59:48 -0700 (Wed, 12 Sep 2007) Log Message: ----------- * [build] adjusted dependency settings for CodeBlocks/MinGW Modified Paths: -------------- trunk/yake/scripts/premake/deps.lua Modified: trunk/yake/scripts/premake/deps.lua =================================================================== --- trunk/yake/scripts/premake/deps.lua 2007-09-12 19:46:47 UTC (rev 1851) +++ trunk/yake/scripts/premake/deps.lua 2007-09-12 19:59:48 UTC (rev 1852) @@ -93,7 +93,7 @@ defDep("lua") defDepIncludePath("lua", "dependencies/lua/src") defDepLibraryPath("lua","dependencies/lua/lib") -if windows then +if windows and not cb_gcc then defDepLibrary("lua","lua","Release") defDepLibrary("lua","lua","ReleaseWithSymbols") defDepLibrary("lua","lua","ReleaseLib") @@ -109,7 +109,7 @@ defDep("luabind") defDepIncludePath("luabind", "dependencies/luabind") defDepLibraryPath("luabind","dependencies/luabind/lib") -if windows then +if windows and not cb_gcc then defDepLibrary("luabind","luabind","Release") defDepLibrary("luabind","luabind","ReleaseLib") defDepLibrary("luabind","luabind","ReleaseWithSymbols") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-12 19:46:43
|
Revision: 1851 http://yake.svn.sourceforge.net/yake/?rev=1851&view=rev Author: psyclonist Date: 2007-09-12 12:46:47 -0700 (Wed, 12 Sep 2007) Log Message: ----------- * [raf] disable CEGUI by default for mingw Modified Paths: -------------- trunk/yake/yake/raf/yakePrerequisites.h Modified: trunk/yake/yake/raf/yakePrerequisites.h =================================================================== --- trunk/yake/yake/raf/yakePrerequisites.h 2007-09-12 19:38:15 UTC (rev 1850) +++ trunk/yake/yake/raf/yakePrerequisites.h 2007-09-12 19:46:47 UTC (rev 1851) @@ -34,7 +34,7 @@ #endif // configuration -#if YAKE_PLATFORM == PLATFORM_WIN32 //@todo fixme make it work on linux +#if YAKE_PLATFORM == PLATFORM_WIN32 and YAKE_COMPILER == MSVC //@todo fixme make it work on linux and mingw etc # define YAKE_RAF_USES_CEGUI 1 #else # define YAKE_RAF_USES_CEGUI 0 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-12 19:38:12
|
Revision: 1850 http://yake.svn.sourceforge.net/yake/?rev=1850&view=rev Author: psyclonist Date: 2007-09-12 12:38:15 -0700 (Wed, 12 Sep 2007) Log Message: ----------- * [build] CEGUI only for MSVC available, at the moment * [build] safer mechanism for adding 'matching' files to projects Modified Paths: -------------- trunk/yake/scripts/premake/tools.lua trunk/yake/scripts/premake/yake.lua Modified: trunk/yake/scripts/premake/tools.lua =================================================================== --- trunk/yake/scripts/premake/tools.lua 2007-09-12 19:34:44 UTC (rev 1849) +++ trunk/yake/scripts/premake/tools.lua 2007-09-12 19:38:15 UTC (rev 1850) @@ -34,6 +34,13 @@ end end end +function _extractCopyTableValues(from,to) + if from and table.getn(from) > 0 then + for k,v in pairs(from) do + table.insert(to,v) + end + end +end -------------------------------------- -- PUBLIC @@ -52,10 +59,23 @@ end function addMatching(filter) - tinsert(package.files,matchfiles(rootdir..filter)) + local files = matchfiles(rootdir..filter) +--[[ + if (type(files) == "string") then + tinsert(package.files,files) + elseif (type(files) == "table") then + for k,v in pairs(files) do + tinsert(package.files,v) + end + end +--]] + --tinsert(package.files,files) + _extractCopyTableValues(files,package.files) end function addRecursive(filter) - tinsert(package.files,matchrecursive(rootdir..filter)) + --tinsert(package.files,matchrecursive(rootdir..filter)) + local files = matchrecursive(rootdir..filter) + _extractCopyTableValues(files,package.files) end function addDependency(lib,cfg) if (cfg) then @@ -312,15 +332,19 @@ -------------------------------------- -- PRIVATE -------------------------------------- - function doMakeComponent(name,exportDefine,pathOffset) makePackage(name) local componentPath = (pathOffset)..name.."/" - package.files = { - matchrecursive(rootdir.."yake/"..componentPath.."*.h"), - matchrecursive(rootdir.."yake/"..componentPath.."*.inl"), - matchrecursive(rootdir.."src/"..componentPath.."*.cpp") - } + package.files = {} + local files = matchrecursive(rootdir.."yake/"..componentPath.."*.h") + _extractCopyTableValues(files,package.files) + + files = matchrecursive(rootdir.."yake/"..componentPath.."*.inl") + _extractCopyTableValues(files,package.files) + + files = matchrecursive(rootdir.."src/"..componentPath.."*.cpp") + _extractCopyTableValues(files,package.files) + if (exportDefine) then tinsert(package.defines,exportDefine) end Modified: trunk/yake/scripts/premake/yake.lua =================================================================== --- trunk/yake/scripts/premake/yake.lua 2007-09-12 19:34:44 UTC (rev 1849) +++ trunk/yake/scripts/premake/yake.lua 2007-09-12 19:38:15 UTC (rev 1850) @@ -143,15 +143,15 @@ makeComponent("scripting","YAKE_SCRIPTING_EXPORTS") addDependency("base") - -------------------------------------- makeComponent("data","YAKE_DATA_EXPORTS") -addDependency("base") -- Compile TinyXML into yake::data: addMatching("dependencies/tinyxml/*.h") addMatching("dependencies/tinyxml/*.cpp") +addDependency("base") + -------------------------------------- makeComponent("model","YAKE_MODEL_EXPORTS") addDependency("base") @@ -228,8 +228,8 @@ addDependency("ent") addDependency("scripting") --- @todo FIXME works on linux, too... -if not linux then +-- @todo FIXME should work on linux and with mingw etc, too... +if not linux and not cb_gcc then useDep("cegui") end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-12 19:34:40
|
Revision: 1849 http://yake.svn.sourceforge.net/yake/?rev=1849&view=rev Author: psyclonist Date: 2007-09-12 12:34:44 -0700 (Wed, 12 Sep 2007) Log Message: ----------- * [res] const_cast seems to be required for stream's is_open() as it isn't const... (many threads on the web...) Modified Paths: -------------- trunk/yake/src/res/datastream.cpp Modified: trunk/yake/src/res/datastream.cpp =================================================================== --- trunk/yake/src/res/datastream.cpp 2007-09-12 19:32:59 UTC (rev 1848) +++ trunk/yake/src/res/datastream.cpp 2007-09-12 19:34:44 UTC (rev 1849) @@ -34,8 +34,8 @@ namespace res { DataStreamBase::~DataStreamBase() {} - + FileDataStream::FileDataStream(const std::string & fn) : in_(fn.c_str()), size_(0) { assert( in_.is_open() ); @@ -58,7 +58,7 @@ } bool FileDataStream::eof() const { - return in_.is_open() ? in_.eof() : false; + return const_cast<std::ifstream&>(in_).is_open() ? in_.eof() : false; } size_t FileDataStream::size() const { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-12 19:32:55
|
Revision: 1848 http://yake.svn.sourceforge.net/yake/?rev=1848&view=rev Author: psyclonist Date: 2007-09-12 12:32:59 -0700 (Wed, 12 Sep 2007) Log Message: ----------- * [input] added missing include for boost::any Modified Paths: -------------- trunk/yake/yake/input/yakeInputSystem.h Modified: trunk/yake/yake/input/yakeInputSystem.h =================================================================== --- trunk/yake/yake/input/yakeInputSystem.h 2007-09-12 19:31:48 UTC (rev 1847) +++ trunk/yake/yake/input/yakeInputSystem.h 2007-09-12 19:32:59 UTC (rev 1848) @@ -31,6 +31,7 @@ #include <yake/input/yakePrerequisites.h> #endif #include <yake/base/math/yakeGeometry.h> +#include <boost/any.hpp> namespace yake { namespace input { @@ -220,7 +221,7 @@ class YAKE_INPUT_API KeyboardDevice : public InputDevice { - public: + public: virtual InputDeviceType getType() const { return IDT_KEYBOARD; } @@ -241,7 +242,7 @@ }; class YAKE_INPUT_API MouseDevice : public InputDevice { - public: + public: virtual InputDeviceType getType() const { return IDT_MOUSE; } @@ -255,7 +256,7 @@ class YAKE_INPUT_API JoystickDevice : public InputDevice { - public: + public: static const uint16 HAT_CENTERED = 0x0010; static const uint16 HAT_LEFT = 0x0001; static const uint16 HAT_RIGHT = 0x0002; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-12 19:31:46
|
Revision: 1847 http://yake.svn.sourceforge.net/yake/?rev=1847&view=rev Author: psyclonist Date: 2007-09-12 12:31:48 -0700 (Wed, 12 Sep 2007) Log Message: ----------- removed whitespace Modified Paths: -------------- trunk/yake/yake/property/detail/property.impl.h Modified: trunk/yake/yake/property/detail/property.impl.h =================================================================== --- trunk/yake/yake/property/detail/property.impl.h 2007-09-12 19:30:22 UTC (rev 1846) +++ trunk/yake/yake/property/detail/property.impl.h 2007-09-12 19:31:48 UTC (rev 1847) @@ -134,7 +134,7 @@ { //YAKE_ASSERT( &typeid(T) == prop.typeinfo() ); if (&typeid(T) != prop.typeinfo()) - throw BadCastException(String("try_cast<> failed: '") + getCleanTypeName<T>() + throw BadCastException(String("try_cast<> failed: '") + getCleanTypeName<T>() + "' to '" + prop.typeinfo()->name() + "'."); typedef Property<T> to_t; return static_cast<to_t&>(prop); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-12 19:30:19
|
Revision: 1846 http://yake.svn.sourceforge.net/yake/?rev=1846&view=rev Author: psyclonist Date: 2007-09-12 12:30:22 -0700 (Wed, 12 Sep 2007) Log Message: ----------- [sample] res/lua1: fixed compatibility with gcc Modified Paths: -------------- trunk/yake/samples/res/lua1/demo.cpp Modified: trunk/yake/samples/res/lua1/demo.cpp =================================================================== --- trunk/yake/samples/res/lua1/demo.cpp 2007-09-11 23:14:21 UTC (rev 1845) +++ trunk/yake/samples/res/lua1/demo.cpp 2007-09-12 19:30:22 UTC (rev 1846) @@ -26,7 +26,7 @@ YAKE_ASSERT( sys ); scripting::VMPtr vm = sys->createVM(); bind_all(vm.get()); - + //bind { /* @@ -57,6 +57,7 @@ { // Use default executor for convenience. // It's always possible to manually execute TheApp::initialise() etc. - return (raf::runApplication( TheApp() )) ? 0 : 1; + TheApp app; + return (raf::runApplication(app)) ? 0 : 1; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-11 23:14:26
|
Revision: 1845 http://yake.svn.sourceforge.net/yake/?rev=1845&view=rev Author: psyclonist Date: 2007-09-11 16:14:21 -0700 (Tue, 11 Sep 2007) Log Message: ----------- * [build] added cb_gnu_win/patch_cbp.lua for setting the "-s" option (strip symbols) in CodeBlocks project files * [premake] various changes to the build files for compatibility with CodeBlocks * [premake] precompiled headers are disabled by default (option for premake 3.4) * [base] removed deprecated code (IInputStream, IInputStreamDecorator, ...) * [base] fixed includes for use with premake 3.4 generated CodeBlocks projects * [physics] fixed includes for use with premake 3.4 generated CodeBlocks projects Modified Paths: -------------- trunk/yake/scripts/cb_gnu_win/build.cmd trunk/yake/scripts/premake/tools.lua trunk/yake/yake/base/math/yakeAsmMath.h trunk/yake/yake/base/math/yakeColor.h trunk/yake/yake/base/math/yakeInterpolator.h trunk/yake/yake/base/math/yakeMersenneTwister.h trunk/yake/yake/base/math/yakePlane.h trunk/yake/yake/base/math/yakePoint3.h trunk/yake/yake/base/math/yakeQuaternion.h trunk/yake/yake/base/math/yakeRay.h trunk/yake/yake/base/math/yakeVector4.h trunk/yake/yake/base/templates/yakeAssociator.h trunk/yake/yake/base/yake.h trunk/yake/yake/base/yakeResource.h trunk/yake/yake/base/yakeTaggedListenerManager.h trunk/yake/yake/base/yakeTimer.h trunk/yake/yake/base/yakeUniqueId.h trunk/yake/yake/base/yakeUniqueName.h trunk/yake/yake/base/yakeVersion.h trunk/yake/yake/physics/yakeAffectorZone.h trunk/yake/yake/physics/yakePhysicsActor.h trunk/yake/yake/physics/yakePhysicsAffectors.h trunk/yake/yake/physics/yakePhysicsAvatar.h trunk/yake/yake/physics/yakePhysicsBody.h trunk/yake/yake/physics/yakePhysicsBodyGroup.h trunk/yake/yake/physics/yakePhysicsMotors.h trunk/yake/yake/physics/yakePhysicsPrerequisites.h trunk/yake/yake/physics/yakePhysicsWorld.h trunk/yake/yake/plugins/physicsODE/OdeActor.h trunk/yake/yake/plugins/physicsODE/yakePrerequisites.h Added Paths: ----------- trunk/yake/scripts/cb_gnu_win/patch_cbp.lua Removed Paths: ------------- trunk/yake/src/base/yakeInputStream.cpp trunk/yake/src/base/yakeOutputStream.cpp trunk/yake/yake/base/yakeByteSwapInputStreamDecorator.h trunk/yake/yake/base/yakeByteSwapOutputStreamDecorator.h trunk/yake/yake/base/yakeDebugOutputStream.h trunk/yake/yake/base/yakeInputStream.h trunk/yake/yake/base/yakeInputStreamDecorator.h trunk/yake/yake/base/yakeOutputStream.h trunk/yake/yake/base/yakeOutputStreamDecorator.h Modified: trunk/yake/scripts/cb_gnu_win/build.cmd =================================================================== --- trunk/yake/scripts/cb_gnu_win/build.cmd 2007-09-10 21:31:51 UTC (rev 1844) +++ trunk/yake/scripts/cb_gnu_win/build.cmd 2007-09-11 23:14:21 UTC (rev 1845) @@ -4,4 +4,6 @@ set SOLUTION_TARGET_DIR=cb_gnu_win premake --file yake.lua --target cb-gcc --os windows popd +for %%i in (*.cbp) do d:\tools\luabin\lua5.1 patch_cbp.lua %%i +echo done pause Added: trunk/yake/scripts/cb_gnu_win/patch_cbp.lua =================================================================== --- trunk/yake/scripts/cb_gnu_win/patch_cbp.lua (rev 0) +++ trunk/yake/scripts/cb_gnu_win/patch_cbp.lua 2007-09-11 23:14:21 UTC (rev 1845) @@ -0,0 +1,18 @@ +if not arg[1] then + print("patch_cbp: nothing to do") + return +end +local fname = arg[1] +print("patching "..fname.." ...") +os.rename(fname,fname..".orig") +local cbp = io.open(fname,"w") +for line in io.lines(fname..".orig") do + local s = string.gmatch(line,"%<Build%>")() + if s and #s > 0 then + cbp:write("\t\t<Linker>\n") + cbp:write("\t\t\t<Add option=\"-s\"/>\n") + cbp:write("\t\t</Linker>\n") + end + cbp:write(line.."\n") +end +cbp:close() Modified: trunk/yake/scripts/premake/tools.lua =================================================================== --- trunk/yake/scripts/premake/tools.lua 2007-09-10 21:31:51 UTC (rev 1844) +++ trunk/yake/scripts/premake/tools.lua 2007-09-11 23:14:21 UTC (rev 1845) @@ -148,7 +148,12 @@ package.objdir = rootdir.."common/obj/"..name - package.buildflags = {} + package.buildflags = {"no-pch"} + + package.buildoptions = {} + if (linux or cb_gcc) then --TODO should be 'if gcc' + package.buildoptions = {"-s"} + end package.includepaths = {rootdir} package.defines = {} @@ -166,7 +171,7 @@ --debug.target = targetBaseDir.."debug/"..(LIBFILE_PREFIX)..name..(DEBUG_DLL_SUFFIX) debug.target = (LIBFILE_PREFIX)..name..(DEBUG_DLL_SUFFIX) debug.defines = {"_DEBUG"} - debug.buildflags = {} + debug.buildflags = {"no-pch"} if windows then local targetfile = targetBaseDir .. debug.target .. "." .. DLL_EXTENSION @@ -178,9 +183,7 @@ releaseWithSym = package.config.ReleaseWithSymbols releaseWithSym.target = (LIBFILE_PREFIX)..name.."_sym" releaseWithSym.defines = {} - releaseWithSym.buildflags = { - "optimize-speed" - } + releaseWithSym.buildflags = {"optimize-speed","no-pch"} if windows then local targetfile = targetBaseDir .. releaseWithSym.target .. "." .. DLL_EXTENSION @@ -193,6 +196,7 @@ release.target = (LIBFILE_PREFIX)..name release.defines = {} release.buildflags = { + "no-pch", "no-symbols", "optimize-speed", "no-frame-pointer" @@ -209,13 +213,14 @@ debugLib.kind = "lib" debugLib.target = (LIBFILE_PREFIX)..name.."_s"..(DEBUG_DLL_SUFFIX) debugLib.defines = {"_DEBUG","YAKE_STATIC"} - debugLib.buildflags = {} + debugLib.buildflags = {"no-pch"} releaseLib = package.config.ReleaseLib releaseLib.kind = "lib" releaseLib.target = (LIBFILE_PREFIX)..name.."_s" releaseLib.defines = {"YAKE_STATIC"} releaseLib.buildflags = { + "no-pch", "no-symbols", "optimize-speed", "no-frame-pointer" @@ -461,7 +466,13 @@ package.objdir = rootdir.."common/obj/"..name package.bindir = rootdir.."samples/bin" - package.buildflags = {} + package.buildflags = {"no-pch"} + + package.buildoptions = {} + if (linux or cb_gcc) then --TODO should be 'if gcc' + package.buildoptions = {"-s"} + end + package.includepaths = {rootdir} package.defines = {} @@ -479,12 +490,13 @@ debug = package.config.Debug debug.target = rootdir.."samples/bin/debug/"..name.."_d"..(EXEFILE_SUFFIX) debug.defines = {"_DEBUG"} - debug.buildflags = {} + debug.buildflags = {"no-pch"} releaseWithSym = package.config.ReleaseWithSymbols releaseWithSym.target = rootdir.."samples/bin/release_sym/"..name.."_sym"..(EXEFILE_SUFFIX) releaseWithSym.defines = {} releaseWithSym.buildflags = { + "no-pch", "optimize-speed" } @@ -492,6 +504,7 @@ release.target = rootdir.."samples/bin/release/"..name..(EXEFILE_SUFFIX) release.defines = {} release.buildflags = { + "no-pch", "no-symbols", "optimize-speed", "no-frame-pointer" @@ -500,12 +513,12 @@ debugLib = package.config.DebugLib debugLib.target = rootdir.."samples/bin/debug/"..name.."_s_d"..(EXEFILE_SUFFIX) debugLib.defines = {"_DEBUG","YAKE_STATIC"} - debugLib.buildflags = {} + debugLib.buildflags = {"no-pch"} releaseLib = package.config.ReleaseLib releaseLib.target = rootdir.."samples/bin/release/"..name.."_s"..(EXEFILE_SUFFIX) releaseLib.defines = {"YAKE_STATIC"} - releaseLib.buildflags = {} + releaseLib.buildflags = {"no-pch"} -- add sources addMatching(path.."/*.cpp") Deleted: trunk/yake/src/base/yakeInputStream.cpp =================================================================== --- trunk/yake/src/base/yakeInputStream.cpp 2007-09-10 21:31:51 UTC (rev 1844) +++ trunk/yake/src/base/yakeInputStream.cpp 2007-09-11 23:14:21 UTC (rev 1845) @@ -1,47 +0,0 @@ -/* - ------------------------------------------------------------------------------------ - This file is part of YAKE - Copyright (c) 2004 - 2008 The YAKE Team - For the latest information visit http://www.yake.org - ------------------------------------------------------------------------------------ - This program is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any later - version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 Temple - Place - Suite 330, Boston, MA 02111-1307, USA, or go to - http://www.gnu.org/copyleft/lesser.txt. - ------------------------------------------------------------------------------------ - If you are interested in another license model contact the Yake Team via - E-Mail: te...@ya.... - For more information see the LICENSE file in the root directory of the - source code distribution. - ------------------------------------------------------------------------------------ -*/ - -//============================================================================ -// IMPLEMENTATION HEADERS -//============================================================================ -#include <yake/base/yakePCH.h> -#include <yake/base/yakeInputStream.h> - -//============================================================================ -// INTERFACE STRUCTURES / UTILITY CLASSES -//============================================================================ -namespace yake -{ -namespace base -{ - -IInputStream::~IInputStream() -{ -} - -} // base -} // yake Deleted: trunk/yake/src/base/yakeOutputStream.cpp =================================================================== --- trunk/yake/src/base/yakeOutputStream.cpp 2007-09-10 21:31:51 UTC (rev 1844) +++ trunk/yake/src/base/yakeOutputStream.cpp 2007-09-11 23:14:21 UTC (rev 1845) @@ -1,47 +0,0 @@ -/* - ------------------------------------------------------------------------------------ - This file is part of YAKE - Copyright (c) 2004 - 2008 The YAKE Team - For the latest information visit http://www.yake.org - ------------------------------------------------------------------------------------ - This program is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any later - version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 Temple - Place - Suite 330, Boston, MA 02111-1307, USA, or go to - http://www.gnu.org/copyleft/lesser.txt. - ------------------------------------------------------------------------------------ - If you are interested in another license model contact the Yake Team via - E-Mail: te...@ya.... - For more information see the LICENSE file in the root directory of the - source code distribution. - ------------------------------------------------------------------------------------ -*/ - -//============================================================================ -// IMPLEMENTATION HEADERS -//============================================================================ -#include <yake/base/yakePCH.h> -#include <yake/base/yakeOutputStream.h> - -//============================================================================ -// INTERFACE STRUCTURES / UTILITY CLASSES -//============================================================================ -namespace yake -{ -namespace base -{ - -IOutputStream::~IOutputStream() -{ -} - -} // base -} // yake Modified: trunk/yake/yake/base/math/yakeAsmMath.h =================================================================== --- trunk/yake/yake/base/math/yakeAsmMath.h 2007-09-10 21:31:51 UTC (rev 1844) +++ trunk/yake/yake/base/math/yakeAsmMath.h 2007-09-11 23:14:21 UTC (rev 1845) @@ -27,6 +27,9 @@ #ifndef YAKE_BASE_MATH_ASMMATH_H #define YAKE_BASE_MATH_ASMMATH_H +#include "../yakePrerequisites.h" +#include <math.h> + /*============================================================================= ASM math routines posted by davepermen et al on flipcode forums =============================================================================*/ @@ -35,16 +38,16 @@ const float half_pi = 0.5f * pi; /*============================================================================= - NO EXPLICIT RETURN REQUIRED FROM THESE METHODS!! + NO EXPLICIT RETURN REQUIRED FROM THESE METHODS!! =============================================================================*/ #if YAKE_COMPILER == COMPILER_MSVC # pragma warning( push ) -# pragma warning( disable: 4035 ) +# pragma warning( disable: 4035 ) #endif float asm_arccos( float r ) { // return half_pi + arctan( r / -sqr( 1.f - r * r ) ); - + #if YAKE_COMPILER == COMPILER_MSVC float asm_one = 1.f; @@ -139,7 +142,7 @@ } // returns r0 #elif YAKE_COMPILER == COMPILER_GNUC - + return cos( r ); #endif @@ -159,7 +162,7 @@ } // returns r0 #elif YAKE_COMPILER == COMPILER_GNUC - + return tan( r ); #endif @@ -279,7 +282,7 @@ #endif // returns a random number -FORCEINLINE float asm_rand() +inline float asm_rand() { #if YAKE_COMPILER == COMPILER_MSVC @@ -315,7 +318,7 @@ } // returns the maximum random number -FORCEINLINE float asm_rand_max() +inline float asm_rand_max() { #if YAKE_COMPILER == COMPILER_MSVC @@ -338,7 +341,7 @@ } // returns log2( r ) / log2( e ) -float asm_ln( float r ) { +inline float asm_ln( float r ) { #if YAKE_COMPILER == COMPILER_MSVC Modified: trunk/yake/yake/base/math/yakeColor.h =================================================================== --- trunk/yake/yake/base/math/yakeColor.h 2007-09-10 21:31:51 UTC (rev 1844) +++ trunk/yake/yake/base/math/yakeColor.h 2007-09-11 23:14:21 UTC (rev 1845) @@ -32,7 +32,7 @@ //============================================================================ // Standard headers #ifndef YAKE_BASE_PREREQUISITES_H -# include "yakePrerequisites.h" +# include "../yakePrerequisites.h" #endif // Yake #include "yake/base/math/yakeMath.h" Modified: trunk/yake/yake/base/math/yakeInterpolator.h =================================================================== --- trunk/yake/yake/base/math/yakeInterpolator.h 2007-09-10 21:31:51 UTC (rev 1844) +++ trunk/yake/yake/base/math/yakeInterpolator.h 2007-09-11 23:14:21 UTC (rev 1845) @@ -27,6 +27,8 @@ #ifndef YAKE_BASE__MATH_INTERPOLATOR_H #define YAKE_BASE__MATH_INTERPOLATOR_H +#include "../yakePrerequisites.h" + //============================================================================ // INTERFACE STRUCTURES / UTILITY CLASSES //============================================================================ @@ -83,7 +85,7 @@ { mElapsed += time; real pos = clamp< real >( mElapsed / mTotal, 0., 1. ); - mVal = mStart * ( 1 - pos ) + mEnd * pos; + Interpolator< T >::smVal = mStart * ( 1 - pos ) + mEnd * pos; } }; @@ -106,7 +108,7 @@ mElapsed += time; real b = clamp< real >( mElapsed / mTotal, 0., 1. ); real a = 1 - b; - mVal = mStart * a * a + mMid * 2 * a * b + mEnd * b * b; + Interpolator< T >::mVal = mStart * a * a + mMid * 2 * a * b + mEnd * b * b; } }; @@ -129,7 +131,7 @@ mElapsed += time; real b = clamp< real >( mElapsed / mTotal, 0., 1. ); real a = 1 - b; - mVal = mStart * a * a * a + mMid1 * 3 * a * a * b + mMid2 * 3 * a * b * b + mEnd * b * b * b; + Interpolator< T >::mVal = mStart * a * a * a + mMid1 * 3 * a * a * b + mMid2 * 3 * a * b * b + mEnd * b * b * b; } }; Modified: trunk/yake/yake/base/math/yakeMersenneTwister.h =================================================================== --- trunk/yake/yake/base/math/yakeMersenneTwister.h 2007-09-10 21:31:51 UTC (rev 1844) +++ trunk/yake/yake/base/math/yakeMersenneTwister.h 2007-09-11 23:14:21 UTC (rev 1845) @@ -43,7 +43,7 @@ // Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, // Copyright (C) 2000 - 2003, Richard J. Wagner -// All rights reserved. +// All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions @@ -56,8 +56,8 @@ // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // -// 3. The names of its contributors may not be used to endorse or promote -// products derived from this software without specific prior written +// 3. The names of its contributors may not be used to endorse or promote +// products derived from this software without specific prior written // permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS @@ -91,8 +91,10 @@ //============================================================================ // Standard headers #ifndef YAKE_BASE_PREREQUISITES_H -# include "yakePrerequisites.h" +# include "../yakePrerequisites.h" #endif +#include <iostream> +#include <math.h> //============================================================================ // INTERFACE STRUCTURES / UTILITY CLASSES @@ -104,13 +106,13 @@ // Data public: typedef unsigned long uint32; // unsigned integer type, at least 32 bits - + enum { N = 624 }; // length of state vector enum { SAVE = N + 1 }; // length of array for save() protected: enum { M = 397 }; // period parameter - + uint32 state[N]; // internal state uint32 *pNext; // next value to get from state int left; // number of values left before reload needed @@ -121,11 +123,11 @@ MTRand( const uint32& oneSeed ); // initialize with a simple uint32 MTRand( uint32 *const bigSeed, uint32 const seedLength = N ); // or an array MTRand(); // auto-initialize with /dev/urandom or time() and clock() - + // Do NOT use for CRYPTOGRAPHY without securely hashing several returned // values together, otherwise the generator state can be learned after // reading 624 consecutive values. - + // Access to 32-bit random numbers double rand(); // real number in [0,1] double rand( const double& n ); // real number in [0,n] @@ -136,18 +138,18 @@ uint32 randInt(); // integer in [0,2^32-1] uint32 randInt( const uint32& n ); // integer in [0,n] for n < 2^32 double operator()() { return rand(); } // same as rand() - + // Access to 53-bit random numbers (capacity of IEEE double precision) double rand53(); // real number in [0,1) - + // Access to nonuniform random number distributions double randNorm( const double& mean = 0.0, const double& variance = 0.0 ); - + // Re-seeding functions with same behavior as initializers void seed( const uint32 oneSeed ); void seed( uint32 *const bigSeed, const uint32 seedLength = N ); void seed(); - + // Saving and loading generator state void save( uint32* saveArray ) const; // to array of size SAVE void load( uint32 *const loadArray ); // from such array @@ -214,10 +216,10 @@ { // Pull a 32-bit integer from the generator state // Every other access function simply transforms the numbers extracted here - + if( left == 0 ) reload(); --left; - + register uint32 s1; s1 = *pNext++; s1 ^= (s1 >> 11); @@ -236,7 +238,7 @@ used |= used >> 4; used |= used >> 8; used |= used >> 16; - + // Draw numbers until one is found in [0,n] uint32 i; do @@ -294,7 +296,7 @@ { // Seed the generator with an array from /dev/urandom if available // Otherwise use a hash of time() and clock() values - + // First try getting an array from /dev/urandom FILE* urandom = fopen( "/dev/urandom", "rb" ); if( urandom ) @@ -308,7 +310,7 @@ fclose(urandom); if( success ) { seed( bigSeed, N ); return; } } - + // Was not successful, so use time() and clock() instead seed( hash( time(NULL), clock() ) ); } Modified: trunk/yake/yake/base/math/yakePlane.h =================================================================== --- trunk/yake/yake/base/math/yakePlane.h 2007-09-10 21:31:51 UTC (rev 1844) +++ trunk/yake/yake/base/math/yakePlane.h 2007-09-11 23:14:21 UTC (rev 1845) @@ -29,7 +29,7 @@ // Yake #ifndef YAKE_BASE_PREREQUISITES_H -# include "yakePrerequisites.h" +# include "../yakePrerequisites.h" #endif #include "yakeMath.h" #include "yakeVector3.h" Modified: trunk/yake/yake/base/math/yakePoint3.h =================================================================== --- trunk/yake/yake/base/math/yakePoint3.h 2007-09-10 21:31:51 UTC (rev 1844) +++ trunk/yake/yake/base/math/yakePoint3.h 2007-09-11 23:14:21 UTC (rev 1845) @@ -30,6 +30,7 @@ #include "yake/base/yakePrerequisites.h" #include "yake/base/math/yakeMath.h" #include "yake/base/math/yakeQuaternion.h" +#include "yake/base/math/yakeVector3.h" namespace yake { namespace math { @@ -39,10 +40,10 @@ class YAKE_BASE_API Point3 { public: - real x, y, z; + real x, y, z; public: - inline Point3( real fX = 0, real fY = 0, real fZ = 0) + inline Point3( real fX = 0, real fY = 0, real fZ = 0) : x( fX ), y( fY ), z( fZ ) { } @@ -87,7 +88,7 @@ { x = rkVector.x; y = rkVector.y; - z = rkVector.z; + z = rkVector.z; return *this; } Modified: trunk/yake/yake/base/math/yakeQuaternion.h =================================================================== --- trunk/yake/yake/base/math/yakeQuaternion.h 2007-09-10 21:31:51 UTC (rev 1844) +++ trunk/yake/yake/base/math/yakeQuaternion.h 2007-09-11 23:14:21 UTC (rev 1845) @@ -32,10 +32,11 @@ //============================================================================ // Standard headers #ifndef YAKE_BASE_PREREQUISITES_H -# include "yake/base/math/yakePrerequisites.h" +# include "../yakePrerequisites.h" #endif // Yake #include "yake/base/math/yakeMath.h" +#include <iostream> //============================================================================ // INTERFACE STRUCTURES / UTILITY CLASSES Modified: trunk/yake/yake/base/math/yakeRay.h =================================================================== --- trunk/yake/yake/base/math/yakeRay.h 2007-09-10 21:31:51 UTC (rev 1844) +++ trunk/yake/yake/base/math/yakeRay.h 2007-09-11 23:14:21 UTC (rev 1845) @@ -29,7 +29,7 @@ // Yake #ifndef YAKE_BASE_PREREQUISITES_H -# include "yakePrerequisites.h" +# include "../yakePrerequisites.h" #endif #include "yakeMath.h" #include "yakeVector3.h" Modified: trunk/yake/yake/base/math/yakeVector4.h =================================================================== --- trunk/yake/yake/base/math/yakeVector4.h 2007-09-10 21:31:51 UTC (rev 1844) +++ trunk/yake/yake/base/math/yakeVector4.h 2007-09-11 23:14:21 UTC (rev 1845) @@ -28,8 +28,9 @@ #define YAKE_MATH_VECTOR4_H #ifndef YAKE_BASE_PREREQUISITES_H -# include <yake/base/yakePrerequisites.h> +# include "../yakePrerequisites.h" #endif +#include "yakeVector3.h" namespace yake { namespace math { @@ -43,7 +44,7 @@ public: union { struct { - real x, y, z, w; + real x, y, z, w; }; real val[4]; }; @@ -53,7 +54,7 @@ { } - inline Vector4( real fX, real fY, real fZ, real fW ) + inline Vector4( real fX, real fY, real fZ, real fW ) : x( fX ), y( fY ), z( fZ ), w( fW) { } @@ -61,7 +62,7 @@ inline Vector4( real afCoordinate[4] ) : x( afCoordinate[0] ), y( afCoordinate[1] ), - z( afCoordinate[2] ), + z( afCoordinate[2] ), w (afCoordinate[3] ) { } @@ -106,24 +107,24 @@ { x = rkVector.x; y = rkVector.y; - z = rkVector.z; - w = rkVector.w; + z = rkVector.z; + w = rkVector.w; return *this; } inline bool operator == ( const Vector4& rkVector ) const { - return ( x == rkVector.x && - y == rkVector.y && + return ( x == rkVector.x && + y == rkVector.y && z == rkVector.z && w == rkVector.w ); } inline bool operator != ( const Vector4& rkVector ) const { - return ( x != rkVector.x || - y != rkVector.y || + return ( x != rkVector.x || + y != rkVector.y || z != rkVector.z || w != rkVector.w ); } Modified: trunk/yake/yake/base/templates/yakeAssociator.h =================================================================== --- trunk/yake/yake/base/templates/yakeAssociator.h 2007-09-10 21:31:51 UTC (rev 1844) +++ trunk/yake/yake/base/templates/yakeAssociator.h 2007-09-11 23:14:21 UTC (rev 1845) @@ -27,15 +27,12 @@ #ifndef YAKE_BASE_TEMPLATES_ASSOCIATOR_H #define YAKE_BASE_TEMPLATES_ASSOCIATOR_H -//============================================================================ -// IMPLEMENTATION HEADERS -//============================================================================ -// Standard headers #ifndef YAKE_BASEPREREQUISITES_H -# include "yakePrerequisites.h" +# include "../yakePrerequisites.h" #endif -// Yake +#include "../yakeString.h" + //============================================================================ // INTERFACE STRUCTURES / UTILITY CLASSES //============================================================================ @@ -77,7 +74,7 @@ virtual void removeAndDestroyAll() { - for (ObjectNameMap::const_iterator it = mObjectNames.begin(); it != mObjectNames.end(); ++it) + for (typename ObjectNameMap::const_iterator it = mObjectNames.begin(); it != mObjectNames.end(); ++it) { if (it->second) delete it->second; Modified: trunk/yake/yake/base/yake.h =================================================================== --- trunk/yake/yake/base/yake.h 2007-09-10 21:31:51 UTC (rev 1844) +++ trunk/yake/yake/base/yake.h 2007-09-11 23:14:21 UTC (rev 1845) @@ -54,15 +54,14 @@ #include "yakeLog.h" #include "yakeStderrLog.h" #include "yakeFileLog.h" -#include "yakeOutputStream.h" #include "yakeUniqueName.h" #include "yakePlugin.h" -//#include "yakeDebugOutputStream.h" #include "yakeLibrary.h" #include <yake/base/type_info.h> #include "math/yakeQuaternion.h" #include "math/yakeVector3.h" +#include "math/yakePoint3.h" #include "math/yakeVector4.h" #include "math/yakeMatrix3.h" #include "math/yakeMatrix4.h" Deleted: trunk/yake/yake/base/yakeByteSwapInputStreamDecorator.h =================================================================== --- trunk/yake/yake/base/yakeByteSwapInputStreamDecorator.h 2007-09-10 21:31:51 UTC (rev 1844) +++ trunk/yake/yake/base/yakeByteSwapInputStreamDecorator.h 2007-09-11 23:14:21 UTC (rev 1845) @@ -1,93 +0,0 @@ -/* - ------------------------------------------------------------------------------------ - This file is part of YAKE - Copyright (c) 2004 - 2008 The YAKE Team - For the latest information visit http://www.yake.org - ------------------------------------------------------------------------------------ - This program is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any later - version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 Temple - Place - Suite 330, Boston, MA 02111-1307, USA, or go to - http://www.gnu.org/copyleft/lesser.txt. - ------------------------------------------------------------------------------------ - If you are interested in another license model contact the Yake Team via - E-Mail: te...@ya.... - For more information see the LICENSE file in the root directory of the - source code distribution. - ------------------------------------------------------------------------------------ -*/ -#ifndef YAKE_BASE_BYTESWAPINPUTSTREAMDECORATOR_H -#define YAKE_BASE_BYTESWAPINPUTSTREAMDECORATOR_H - -//============================================================================ -// IMPLEMENTATION HEADERS -//============================================================================ -// Standard headers -#ifndef YAKE_BASE_PREREQUISITES_H -# include "yakePrerequisites.h" -#endif -// Yake - -//============================================================================ -// INTERFACE STRUCTURES / UTILITY CLASSES -//============================================================================ -namespace yake -{ -namespace base -{ - -// This macro converts a native stream into a little endian stream. -#ifdef YAKE_BIG_ENDIAN -# define YAKE_LITTLE_ENDIAN_INPUT_STREAM( inputStreamPointer ) create< yake::base::ByteSwapInputStreamDecorator >( inputStreamPointer ) -#else -# define YAKE_LITTLE_ENDIAN_INPUT_STREAM( inputStreamPointer ) inputStreamPointer -#endif - - -class YAKE_BASE_API ByteSwapInputStreamDecorator : public IInputStreamDecorator -{ -// Class -public: - ByteSwapInputStreamDecorator( const SharedPtr< IInputStream >& pDecorated ) - : IInputStreamDecorator( pDecorated ) - {} - -// Methods -public: - IInputStream& operator>>( bool& rB ) { ( *getDecorated() ) >> rB; swapBytes( rB ); return *this; } - IInputStream& operator>>( signed char& rChar ) { ( *getDecorated() ) >> rChar; swapBytes( rChar ); return *this; } - IInputStream& operator>>( unsigned char& rChar ) { ( *getDecorated() ) >> rChar; swapBytes( rChar ); return *this; } - IInputStream& operator>>( signed short& rNumber ) { ( *getDecorated() ) >> rNumber; swapBytes( rNumber ); return *this; } - IInputStream& operator>>( unsigned short& rNumber ) { ( *getDecorated() ) >> rNumber; swapBytes( rNumber ); return *this; } - IInputStream& operator>>( signed int& rNumber ) { ( *getDecorated() ) >> rNumber; swapBytes( rNumber ); return *this; } - IInputStream& operator>>( unsigned int& rNumber ) { ( *getDecorated() ) >> rNumber; swapBytes( rNumber ); return *this; } - IInputStream& operator>>( signed long& rNumber ) { ( *getDecorated() ) >> rNumber; swapBytes( rNumber ); return *this; } - IInputStream& operator>>( unsigned long& rNumber ) { ( *getDecorated() ) >> rNumber; swapBytes( rNumber ); return *this; } - IInputStream& operator>>( float& rNumber ) { ( *getDecorated() ) >> rNumber; swapBytes( rNumber ); return *this; } - IInputStream& operator>>( double& rNumber ) { ( *getDecorated() ) >> rNumber; swapBytes( rNumber ); return *this; } - - int read( bool* pBuffer, int count ) { int read = getDecorated()->read( pBuffer, count ); swapBytes( pBuffer, read ); return read; } - int read( signed char* pBuffer, int count ) { int read = getDecorated()->read( pBuffer, count ); swapBytes( pBuffer, read ); return read; } - int read( unsigned char* pBuffer, int count ) { int read = getDecorated()->read( pBuffer, count ); swapBytes( pBuffer, read ); return read; } - int read( signed short* pBuffer, int count ) { int read = getDecorated()->read( pBuffer, count ); swapBytes( pBuffer, read ); return read; } - int read( unsigned short* pBuffer, int count ) { int read = getDecorated()->read( pBuffer, count ); swapBytes( pBuffer, read ); return read; } - int read( signed int* pBuffer, int count ) { int read = getDecorated()->read( pBuffer, count ); swapBytes( pBuffer, read ); return read; } - int read( unsigned int* pBuffer, int count ) { int read = getDecorated()->read( pBuffer, count ); swapBytes( pBuffer, read ); return read; } - int read( signed long* pBuffer, int count ) { int read = getDecorated()->read( pBuffer, count ); swapBytes( pBuffer, read ); return read; } - int read( unsigned long* pBuffer, int count ) { int read = getDecorated()->read( pBuffer, count ); swapBytes( pBuffer, read ); return read; } - int read( float* pBuffer, int count ) { int read = getDecorated()->read( pBuffer, count ); swapBytes( pBuffer, read ); return read; } - int read( double* pBuffer, int count ) { int read = getDecorated()->read( pBuffer, count ); swapBytes( pBuffer, read ); return read; } -}; - -} // base -} // yake - -#endif // YAKE_BASE_BYTESWAPINPUTSTREAMDECORATOR_H Deleted: trunk/yake/yake/base/yakeByteSwapOutputStreamDecorator.h =================================================================== --- trunk/yake/yake/base/yakeByteSwapOutputStreamDecorator.h 2007-09-10 21:31:51 UTC (rev 1844) +++ trunk/yake/yake/base/yakeByteSwapOutputStreamDecorator.h 2007-09-11 23:14:21 UTC (rev 1845) @@ -1,126 +0,0 @@ -/* - ------------------------------------------------------------------------------------ - This file is part of YAKE - Copyright (c) 2004 - 2008 The YAKE Team - For the latest information visit http://www.yake.org - ------------------------------------------------------------------------------------ - This program is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any later - version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 Temple - Place - Suite 330, Boston, MA 02111-1307, USA, or go to - http://www.gnu.org/copyleft/lesser.txt. - ------------------------------------------------------------------------------------ - If you are interested in another license model contact the Yake Team via - E-Mail: te...@ya.... - For more information see the LICENSE file in the root directory of the - source code distribution. - ------------------------------------------------------------------------------------ -*/ -#ifndef YAKE_BASE_BYTESWAPOUTPUTSTREAMDECORATOR_H -#define YAKE_BASE_BYTESWAPOUTPUTSTREAMDECORATOR_H - -//============================================================================ -// IMPLEMENTATION HEADERS -//============================================================================ -// Standard headers -#ifndef YAKE_BASE_PREREQUISITES_H -# include "yakePrerequisites.h" -#endif -// Yake - -#define YAKE_SWAP_AND_OUTPUT_ARRAY( variable, type, count ) \ - type* temp = new type[ count ]; \ - memcpy( temp, variable, count ); \ - swapBytes( temp, count ); \ - int written = ( *getDecorated() ).write( temp, count ); \ - delete[] temp; \ - return written; - -//============================================================================ -// INTERFACE STRUCTURES / UTILITY CLASSES -//============================================================================ -namespace yake -{ -namespace base -{ - -// This macro converts a native stream into a little endian stream. -#ifdef YAKE_BIG_ENDIAN -# define YAKE_LITTLE_ENDIAN_OUTPUT_STREAM( outputStreamPointer ) create< yake::base::ByteSwapOutputStreamDecorator >( outputStreamPointer ) -#else -# define YAKE_LITTLE_ENDIAN_OUTPUT_STREAM( outputStreamPointer ) outputStreamPointer -#endif - - -class YAKE_BASE_API ByteSwapOutputStreamDecorator : public IOutputStreamDecorator -{ -// Class -public: - ByteSwapOutputStreamDecorator( const SharedPtr< IOutputStream >& pDecorated ) - : IOutputStreamDecorator( pDecorated ) - {} - -// Methods -public: - IOutputStream& operator<<( bool b ) { swapBytes( b ); return ( *getDecorated() ) << b; } - IOutputStream& operator<<( signed char ch ) { swapBytes( ch ); return ( *getDecorated() ) << ch; } - IOutputStream& operator<<( unsigned char ch ) { swapBytes( ch ); return ( *getDecorated() ) << ch; } - IOutputStream& operator<<( signed short number ) { swapBytes( number ); return ( *getDecorated() ) << number; } - IOutputStream& operator<<( unsigned short number ) { swapBytes( number ); return ( *getDecorated() ) << number; } - IOutputStream& operator<<( signed int number ) { swapBytes( number ); return ( *getDecorated() ) << number; } - IOutputStream& operator<<( unsigned int number ) { swapBytes( number ); return ( *getDecorated() ) << number; } - IOutputStream& operator<<( signed long number ) { swapBytes( number ); return ( *getDecorated() ) << number; } - IOutputStream& operator<<( unsigned long number ) { swapBytes( number ); return ( *getDecorated() ) << number; } - IOutputStream& operator<<( float number ) { swapBytes( number ); return ( *getDecorated() ) << number; } - IOutputStream& operator<<( double number ) { swapBytes( number ); return ( *getDecorated() ) << number; } - - IOutputStream& operator<<( const char* pString ) - { - int count = strlen( pString ); - char* temp = new char[ count ]; - memcpy( temp, pString, count ); - swapBytes( temp, count ); - ( *getDecorated() ) << temp; - delete[] temp; - return *this; - } - - IOutputStream& operator<<( const wchar_t* pString ) - { - int count = wcslen( pString ); - wchar_t* temp = new wchar_t[ count ]; - memcpy( temp, pString, count ); - swapBytes( temp, count ); - ( *getDecorated() ) << temp; - delete[] temp; - return *this; - } - - - int write( const bool* pBuffer, int count ) { YAKE_SWAP_AND_OUTPUT_ARRAY( pBuffer, bool, count ) } - int write( const signed char* pBuffer, int count ) { YAKE_SWAP_AND_OUTPUT_ARRAY( pBuffer, signed char, count ) } - int write( const unsigned char* pBuffer, int count ) { YAKE_SWAP_AND_OUTPUT_ARRAY( pBuffer, unsigned char, count ) } - int write( const signed short* pBuffer, int count ) { YAKE_SWAP_AND_OUTPUT_ARRAY( pBuffer, signed short, count ) } - int write( const unsigned short* pBuffer, int count ) { YAKE_SWAP_AND_OUTPUT_ARRAY( pBuffer, unsigned short, count ) } - int write( const signed int* pBuffer, int count ) { YAKE_SWAP_AND_OUTPUT_ARRAY( pBuffer, signed int, count ) } - int write( const unsigned int* pBuffer, int count ) { YAKE_SWAP_AND_OUTPUT_ARRAY( pBuffer, unsigned int, count ) } - int write( const signed long* pBuffer, int count ) { YAKE_SWAP_AND_OUTPUT_ARRAY( pBuffer, signed long, count ) } - int write( const unsigned long* pBuffer, int count ) { YAKE_SWAP_AND_OUTPUT_ARRAY( pBuffer, unsigned long, count ) } - int write( const float* pBuffer, int count ) { YAKE_SWAP_AND_OUTPUT_ARRAY( pBuffer, float, count ) } - int write( const double* pBuffer, int count ) { YAKE_SWAP_AND_OUTPUT_ARRAY( pBuffer, double, count ) } -}; - -#undef YAKE_SWAP_AND_OUTPUT_ARRAY - -} // base -} // yake - -#endif // YAKE_BASE_BYTESWAPOUTPUTSTREAMDECORATOR_H Deleted: trunk/yake/yake/base/yakeDebugOutputStream.h =================================================================== --- trunk/yake/yake/base/yakeDebugOutputStream.h 2007-09-10 21:31:51 UTC (rev 1844) +++ trunk/yake/yake/base/yakeDebugOutputStream.h 2007-09-11 23:14:21 UTC (rev 1845) @@ -1,93 +0,0 @@ -/* - ------------------------------------------------------------------------------------ - This file is part of YAKE - Copyright (c) 2004 - 2008 The YAKE Team - For the latest information visit http://www.yake.org - ------------------------------------------------------------------------------------ - This program is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any later - version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 Temple - Place - Suite 330, Boston, MA 02111-1307, USA, or go to - http://www.gnu.org/copyleft/lesser.txt. - ------------------------------------------------------------------------------------ - If you are interested in another license model contact the Yake Team via - E-Mail: te...@ya.... - For more information see the LICENSE file in the root directory of the - source code distribution. - ------------------------------------------------------------------------------------ -*/ -#ifndef YAKE_BASE_DEBUGOUTPUTSTREAM_H -#define YAKE_BASE_DEBUGOUTPUTSTREAM_H - -//============================================================================ -// IMPLEMENTATION HEADERS -//============================================================================ -// Standard headers -#ifndef YAKE_BASE_PREREQUISITES_H -# include "yakePrerequisites.h" -#endif -// Yake -#include <yake/base/yakeOutputStream.h> -#include <yake/base/templates/yakeSingleton.h> - -//============================================================================ -// INTERFACE STRUCTURES / UTILITY CLASSES -//============================================================================ -namespace yake -{ -namespace base -{ - -class YAKE_BASE_API DebugOutputStream : public IOutputStream -{ -YAKE_DECLARE_CLASS( yake::base::DebugOutputStream ) -// Class -public: - DebugOutputStream(); - -// Methods -public: - int seek( int offset, SeekBase base ); - int tell() const; - bool isEos() const; - - IOutputStream& operator<<( bool b ); - IOutputStream& operator<<( signed char ch ); - IOutputStream& operator<<( unsigned char ch ); - IOutputStream& operator<<( signed short rNumber ); - IOutputStream& operator<<( unsigned short rNumber ); - IOutputStream& operator<<( signed int rNumber ); - IOutputStream& operator<<( unsigned int rNumber ); - IOutputStream& operator<<( signed long rNumber ); - IOutputStream& operator<<( unsigned long rNumber ); - IOutputStream& operator<<( float rNumber ); - IOutputStream& operator<<( double rNumber ); - IOutputStream& operator<<( const char* pString ); - - int write( const bool* pBuffer, int count ); - int write( const signed char* pBuffer, int count ); - int write( const unsigned char* pBuffer, int count ); - int write( const signed short* pBuffer, int count ); - int write( const unsigned short* pBuffer, int count ); - int write( const signed int* pBuffer, int count ); - int write( const unsigned int* pBuffer, int count ); - int write( const signed long* pBuffer, int count ); - int write( const unsigned long* pBuffer, int count ); - int write( const float* pBuffer, int count ); - int write( const double* pBuffer, int count ); - -YAKE_BUILD_SINGLETON( DebugOutputStream ) -}; - -} // base -} // yake - -#endif // YAKE_BASE_DEBUGOUTPUTSTREAM_H Deleted: trunk/yake/yake/base/yakeInputStream.h =================================================================== --- trunk/yake/yake/base/yakeInputStream.h 2007-09-10 21:31:51 UTC (rev 1844) +++ trunk/yake/yake/base/yakeInputStream.h 2007-09-11 23:14:21 UTC (rev 1845) @@ -1,92 +0,0 @@ -/* - ------------------------------------------------------------------------------------ - This file is part of YAKE - Copyright (c) 2004 - 2008 The YAKE Team - For the latest information visit http://www.yake.org - ------------------------------------------------------------------------------------ - This program is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any later - version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 Temple - Place - Suite 330, Boston, MA 02111-1307, USA, or go to - http://www.gnu.org/copyleft/lesser.txt. - ------------------------------------------------------------------------------------ - If you are interested in another license model contact the Yake Team via - E-Mail: te...@ya.... - For more information see the LICENSE file in the root directory of the - source code distribution. - ------------------------------------------------------------------------------------ -*/ -#ifndef YAKE_BASE_INPUTSTREAM_H -#define YAKE_BASE_INPUTSTREAM_H - -//============================================================================ -// IMPLEMENTATION HEADERS -//============================================================================ -// Standard headers -#ifndef YAKE_BASE_PREREQUISITES_H -# include "yakePrerequisites.h" -#endif -// Yake - -//============================================================================ -// INTERFACE STRUCTURES / UTILITY CLASSES -//============================================================================ -namespace yake -{ -namespace base -{ - -class YAKE_BASE_API IInputStream -{ -// Types -public: - enum SeekBase - { BEGIN, CURRENT, END }; - -// Class -public: - virtual ~IInputStream(); - -// Methods -public: - virtual int seek( int offset, SeekBase base ) = 0; - virtual int tell() const = 0; - virtual bool isEos() const = 0; - - virtual IInputStream& operator>>( bool& rB ) = 0; - virtual IInputStream& operator>>( signed char& rCh ) = 0; - virtual IInputStream& operator>>( unsigned char& rCh ) = 0; - virtual IInputStream& operator>>( signed short& rNumber ) = 0; - virtual IInputStream& operator>>( unsigned short& rNumber ) = 0; - virtual IInputStream& operator>>( signed int& rNumber ) = 0; - virtual IInputStream& operator>>( unsigned int& rNumber ) = 0; - virtual IInputStream& operator>>( signed long& rNumber ) = 0; - virtual IInputStream& operator>>( unsigned long& rNumber ) = 0; - virtual IInputStream& operator>>( float& rNumber ) = 0; - virtual IInputStream& operator>>( double& rNumber ) = 0; - - virtual int Read( bool* pBuffer, int count ) = 0; - virtual int Read( signed char* pBuffer, int count ) = 0; - virtual int Read( unsigned char* pBuffer, int count ) = 0; - virtual int Read( signed short* pBuffer, int count ) = 0; - virtual int Read( unsigned short* pBuffer, int count ) = 0; - virtual int Read( signed int* pBuffer, int count ) = 0; - virtual int Read( unsigned int* pBuffer, int count ) = 0; - virtual int Read( signed long* pBuffer, int count ) = 0; - virtual int Read( unsigned long* pBuffer, int count ) = 0; - virtual int Read( float* pBuffer, int count ) = 0; - virtual int Read( double* pBuffer, int count ) = 0; -}; - -} // base -} // yake - -#endif // YAKE_BASE_INPUTSTREAM_H Deleted: trunk/yake/yake/base/yakeInputStreamDecorator.h =================================================================== --- trunk/yake/yake/base/yakeInputStreamDecorator.h 2007-09-10 21:31:51 UTC (rev 1844) +++ trunk/yake/yake/base/yakeInputStreamDecorator.h 2007-09-11 23:14:21 UTC (rev 1845) @@ -1,95 +0,0 @@ -/* - ------------------------------------------------------------------------------------ - This file is part of YAKE - Copyright (c) 2004 - 2008 The YAKE Team - For the latest information visit http://www.yake.org - ------------------------------------------------------------------------------------ - This program is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any later - version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 Temple - Place - Suite 330, Boston, MA 02111-1307, USA, or go to - http://www.gnu.org/copyleft/lesser.txt. - ------------------------------------------------------------------------------------ - If you are interested in another license model contact the Yake Team via - E-Mail: te...@ya.... - For more information see the LICENSE file in the root directory of the - source code distribution. - ------------------------------------------------------------------------------------ -*/ -#ifndef YAKE_BASE_INPUTSTREAMDECORATOR_H -#define YAKE_BASE_INPUTSTREAMDECORATOR_H - -//============================================================================ -// IMPLEMENTATION HEADERS -//============================================================================ -// Standard headers -#ifndef YAKE_BASE_PREREQUISITES_H -# include "yakePrerequisites.h" -#endif -// Yake -#include <yake/base/yakeInputStream.h> -#include <yake/base/Templates/yakePointer.h> - -//============================================================================ -// INTERFACE STRUCTURES / UTILITY CLASSES -//============================================================================ -namespace yake -{ -namespace base -{ - -class YAKE_BASE_API IInputStreamDecorator : public IInputStream -{ -// Class -public: - IInputStreamDecorator( const SharedPtr< IInputStream >& pDecorated ) - : mpDecorated( pDecorated ) - {} - -// Methods -public: - - const SharedPtr< IInputStream >& getDecorated() { return mpDecorated; } - - int Seek( int offset, SeekBase base ) { return mpDecorated->Seek( offset, base ); } - int Tell() const { return mpDecorated->Tell(); } - bool IsEos() const { return mpDecorated->IsEos(); } - - IInputStream& operator>>( bool& rB ) { return ( *mpDecorated ) >> rB; } - IInputStream& operator>>( signed char& rChar ) { return ( *mpDecorated ) >> rChar; } - IInputStream& operator>>( unsigned char& rChar ) { return ( *mpDecorated ) >> rChar; } - IInputStream& operator>>( signed short& rNumber ) { return ( *mpDecorated ) >> rNumber; } - IInputStream& operator>>( unsigned short& rNumber ) { return ( *mpDecorated ) >> rNumber; } - IInputStream& operator>>( signed int& rNumber ) { return ( *mpDecorated ) >> rNumber; } - IInputStream& operator>>( unsigned int& rNumber ) { return ( *mpDecorated ) >> rNumber; } - IInputStream& operator>>( signed long& rNumber ) { return ( *mpDecorated ) >> rNumber; } - IInputStream& operator>>( unsigned long& rNumber ) { return ( *mpDecorated ) >> rNumber; } - - int read( bool* ppBuffer, int icount ) { return mpDecorated->read( pBuffer, count ); } - int read( signed char* pBuffer, int count ) { return mpDecorated->read( pBuffer, count ); } - int read( unsigned char* pBuffer, int count ) { return mpDecorated->read( pBuffer, count ); } - int read( signed short* pBuffer, int count ) { return mpDecorated->read( pBuffer, count ); } - int read( unsigned short* pBuffer, int count ) { return mpDecorated->read( pBuffer, count ); } - int read( signed int* pBuffer, int count ) { return mpDecorated->read( pBuffer, count ); } - int read( unsigned int* pBuffer, int count ) { return mpDecorated->read( pBuffer, count ); } - int read( signed long* pBuffer, int count ) { return mpDecorated->read( pBuffer, count ); } - int read( unsigned long* pBuffer, int count ) { return mpDecorated->read( pBuffer, count ); } - int read( float* pBuffer, int count ) { return mpDecorated->read( pBuffer, count ); } - int read( double* pBuffer, int count ) { return mpDecorated->read( pBuffer, count ); } - -private: - SharedPtr< IInputStream > mpDecorated; -}; - -} // base -} // yake - -#endif // YAKE_BASE_INPUTSTREAMDECORATOR_H Deleted: trunk/yake/yake/base/yakeOutputStream.h =================================================================== --- trunk/yake/yake/base/yakeOutputStream.h 2007-09-10 21:31:51 UTC (rev 1844) +++ trunk/yake/yake/base/yakeOutputStream.h 2007-09-11 23:14:21 UTC (rev 1845) @@ -1,95 +0,0 @@ -/* - ------------------------------------------------------------------------------------ - This file is part of YAKE - Copyright (c) 2004 - 2008 The YAKE Team - For the latest information visit http://www.yake.org - ------------------------------------------------------------------------------------ - This program is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any later - version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 Temple - Place - Suite 330, Boston, MA 02111-1307, USA, or go to - http://www.gnu.org/copyleft/lesser.txt. - ------------------------------------------------------------------------------------ - If you are interested in another license model contact the Yake Team via - E-Mail: te...@ya.... - For more information see the LICENSE file in the root directory of the - source code distribution. - ------------------------------------------------------------------------------------ -*/ -#ifndef YAKE_BASE_OUTPUTSTREAM_H -#define YAKE_BASE_OUTPUTSTREAM_H - -//============================================================================ -// IMPLEMENTATION HEADERS -//============================================================================ -// Standard headers -#ifndef YAKE_BASE_PREREQUISITES_H -# include "yakePrerequisites.h" -#endif -// Yake -#include <yake/base/yakeString.h> - -//============================================================================ -// INTERFACE STRUCTURES / UTILITY CLASSES -//============================================================================ -namespace yake -{ -namespace base -{ - -class YAKE_BASE_API IOutputStream -{ -public: - virtual ~IOutputStream(); - - enum SeekBase - { BEGIN, CURRENT, END }; - - virtual int seek( int offset, SeekBase base ) = 0; - virtual int tell() const = 0; - virtual bool isEos() const = 0; - - virtual IOutputStream& operator<<( bool b ) = 0; - virtual IOutputStream& operator<<( signed char ch ) = 0; - virtual IOutputStream& operator<<( unsigned char ch ) = 0; - virtual IOutputStream& operator<<( signed short rNumber ) = 0; - virtual IOutputStream& operator<<( unsigned short rNumber ) = 0; - virtual IOutputStream& operator<<( signed int rNumber ) = 0; - virtual IOutputStream& operator<<( unsigned int rNumber ) = 0; - virtual IOutputStream& operator<<( signed long rNumber ) = 0; - virtual IOutputStream& operator<<( unsigned long rNumber ) = 0; - virtual IOutputStream& operator<<( float rNumber ) = 0; - virtual IOutputStream& operator<<( double rNumber ) = 0; - virtual IOutputStream& operator<<( const char* pString ) = 0; - - virtual int write( const bool* pBuffer, int count ) = 0; - virtual int write( const signed char* pBuffer, int count ) = 0; - virtual int write( const unsigned char* pBuffer, int count ) = 0; - virtual int write( const signed short* pBuffer, int count ) = 0; - virtual int write( const unsigned short* pBuffer, int count ) = 0; - virtual int write( const signed int* pBuffer, int count ) = 0; - virtual int write( const unsigned int* pBuffer, int count ) = 0; - virtual int write( const signed long* pBuffer, int count ) = 0; - virtual int write( const unsigned long* pBuffer, int count ) = 0; - virtual int write( const float* pBuffer, int count ) = 0; - virtual int write( const double* pBuffer, int count ) = 0; -}; - -inline IOutputStream& operator<<( IOutputStream& rOut, const String& rString ) -{ - return rOut << rString.c_str(); -} - - -} // base -} // yake - -#endif // YAKE_BASE_OUTPUTSTREAM_H Deleted: trunk/yake/yake/base/yakeOutputStreamDecorator.h =================================================================== --- trunk/yake/yake/base/yakeOutputStreamDecorator.h 2007-09-10 21:31:51 UTC (rev 1844) +++ trunk/yake/yake/base/yakeOutputStreamDecorator.h 2007-09-11 23:14:21 UTC (rev 1845) @@ -1,95 +0,0 @@ -/* - ------------------------------------------------------------------------------------ - This file is part of YAKE - Copyright (c) 2004 - 2008 The YAKE Team - For the latest information visit http://www.yake.org - ------------------------------------------------------------------------------------ - This program is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any later - version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along with - this program; if not, write to the Free Software Foundation, Inc., 59 Temple - Place - Suite 330, Boston, MA 02111-1307, USA, or go to - http://www.gnu.org/copyleft/lesser.txt. - ------------------------------------------------------------------------------------ - If you are interested in another license model contact the Yake Team via - E-Mail: te...@ya.... - For more information see the LICENSE file in the root directory of the - source code distribution. - ------------------------------------------------------------------------------------ -*/ -#ifndef YAKE_BASE_OUTPUTSTREAMDECORATOR_H -#define YAKE_BASE_OUTPUTSTREAMDECORATOR_H - -//============================================================================ -// IMPLEMENTATION HEADERS -//============================================================================ -// Standard headers -#ifndef YAKE_BASE_PREREQUISITES_H -# include "yakePrerequisites.h" -#endif -// Yake -#include <yake/base/yakeOutputStre... [truncated message content] |
From: <psy...@us...> - 2007-09-10 21:31:50
|
Revision: 1844 http://yake.svn.sourceforge.net/yake/?rev=1844&view=rev Author: psyclonist Date: 2007-09-10 14:31:51 -0700 (Mon, 10 Sep 2007) Log Message: ----------- * [build] yake.base now compiles with CodeBlocks+MinGW Modified Paths: -------------- trunk/yake/scripts/premake/config.lua trunk/yake/scripts/premake/deps.lua trunk/yake/scripts/premake/yake.lua Modified: trunk/yake/scripts/premake/config.lua =================================================================== --- trunk/yake/scripts/premake/config.lua 2007-09-09 23:04:14 UTC (rev 1843) +++ trunk/yake/scripts/premake/config.lua 2007-09-10 21:31:51 UTC (rev 1844) @@ -3,6 +3,8 @@ -- the YAKE build file make script -------------------------------------- +cb_gcc = target == "cb-gcc" -- do not touch + rootdir = "../../" -- set via environment variable: Modified: trunk/yake/scripts/premake/deps.lua =================================================================== --- trunk/yake/scripts/premake/deps.lua 2007-09-09 23:04:14 UTC (rev 1843) +++ trunk/yake/scripts/premake/deps.lua 2007-09-10 21:31:51 UTC (rev 1844) @@ -1,3 +1,5 @@ +dofile("config.lua") + -------------------------------------- -- Dependency package boost -------------------------------------- @@ -3,8 +5,11 @@ defDep("boost") defDepIncludePath("boost","dependencies/boost") -defDepLibraryPath("boost","dependencies/boost/stage/lib") -if linux then - defDepLibrary("boost","boost_signals") - defDepLibrary("boost","boost_thread") +defDepLibraryPath("boost","dependencies/boost/stage/lib") +if linux then + defDepLibrary("boost","boost_signals") + defDepLibrary("boost","boost_thread") +elseif cb_gcc then + defDepLibrary("boost","libboost_signals-mgw34-mt-d-1_34_1.a") + defDepLibrary("boost","libboost_thread-mgw34-mt-d-1_34_1.a") end @@ -87,15 +92,15 @@ -------------------------------------- defDep("lua") defDepIncludePath("lua", "dependencies/lua/src") -defDepLibraryPath("lua","dependencies/lua/lib") +defDepLibraryPath("lua","dependencies/lua/lib") if windows then defDepLibrary("lua","lua","Release") defDepLibrary("lua","lua","ReleaseWithSymbols") defDepLibrary("lua","lua","ReleaseLib") defDepLibrary("lua","luad","Debug") - defDepLibrary("lua","luad","DebugLib") -else - defDepLibrary("lua","lua") + defDepLibrary("lua","luad","DebugLib") +else + defDepLibrary("lua","lua") end -------------------------------------- @@ -103,15 +108,15 @@ -------------------------------------- defDep("luabind") defDepIncludePath("luabind", "dependencies/luabind") -defDepLibraryPath("luabind","dependencies/luabind/lib") +defDepLibraryPath("luabind","dependencies/luabind/lib") if windows then defDepLibrary("luabind","luabind","Release") defDepLibrary("luabind","luabind","ReleaseLib") defDepLibrary("luabind","luabind","ReleaseWithSymbols") defDepLibrary("luabind","luabindd","Debug") - defDepLibrary("luabind","luabindd","DebugLib") -else - defDepLibrary("luabind","luabind") + defDepLibrary("luabind","luabindd","DebugLib") +else + defDepLibrary("luabind","luabind") end -------------------------------------- Modified: trunk/yake/scripts/premake/yake.lua =================================================================== --- trunk/yake/scripts/premake/yake.lua 2007-09-09 23:04:14 UTC (rev 1843) +++ trunk/yake/scripts/premake/yake.lua 2007-09-10 21:31:51 UTC (rev 1844) @@ -110,7 +110,9 @@ addMatching("src/base/templates/*.cpp") if (windows) then addMatching("src/base/native/win32/*.cpp") - addMatching("yake/base/native/win32/*.rc") + if (not cb_gcc) then --TODO fix compilation of .rc when using CB + addMatching("yake/base/native/win32/*.rc") + end addDependency("winmm") addDependency("user32") addDependency("gdi32") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-09 23:04:11
|
Revision: 1843 http://yake.svn.sourceforge.net/yake/?rev=1843&view=rev Author: psyclonist Date: 2007-09-09 16:04:14 -0700 (Sun, 09 Sep 2007) Log Message: ----------- * [bindings.lua] added implicit casting to derived classes for makeObject() etc * [bindings.lua] added class registry for implicit casters etc * [scriptingLua] added 'package' package * [ent] added ObjectCreationParameters * [demos] cleaned up Lua entity scripts * [base] improved ParamHolder interface Modified Paths: -------------- trunk/yake/common/media/scripts/o_entity.lua trunk/yake/common/media/scripts/o_trigger2.lua trunk/yake/common/media/scripts/raf2.lua trunk/yake/samples/raf/lua2/demo.cpp trunk/yake/src/base/yakeParamHolder.cpp trunk/yake/src/bindings.lua/detail/ent.lua.cpp trunk/yake/src/ent/object_mgr.cpp trunk/yake/src/ent/vm_holder.cpp trunk/yake/src/plugins/scriptingLua/ScriptingSystemLua.cpp trunk/yake/yake/base/yakeParamHolder.h trunk/yake/yake/base/yakeString.h trunk/yake/yake/bindings.lua/bindings.lua.ent.h trunk/yake/yake/ent/object.h trunk/yake/yake/ent/object_mgr.h trunk/yake/yake/ent/object_mgr_listener.h trunk/yake/yake/plugins/scriptingLua/ScriptingSystemLua.h Added Paths: ----------- trunk/yake/common/media/scripts/o_ball.lua trunk/yake/src/bindings.lua/detail/ent.listener.lua.cpp trunk/yake/src/bindings.lua/detail/ent.registry.lua.cpp trunk/yake/yake/bindings.lua/bindings.lua.ent.registry.h Removed Paths: ------------- trunk/yake/common/media/scripts/o_trigger.lua Added: trunk/yake/common/media/scripts/o_ball.lua =================================================================== --- trunk/yake/common/media/scripts/o_ball.lua (rev 0) +++ trunk/yake/common/media/scripts/o_ball.lua 2007-09-09 23:04:14 UTC (rev 1843) @@ -0,0 +1,16 @@ +function onTick() +end +function main() + this.events.tick:connect( onTick ) + this.model = yake.Model() + + local g = yake.Graphical() + this.model:add(g) + + local sn = sim.gworld:createSceneNode() + g:addSceneNode( sn ) + local e = sim.gworld:createEntity("sphere_d1.mesh") + sn:attach(e) + + this:setPositionSource(sn) +end Modified: trunk/yake/common/media/scripts/o_entity.lua =================================================================== --- trunk/yake/common/media/scripts/o_entity.lua 2007-09-07 13:57:17 UTC (rev 1842) +++ trunk/yake/common/media/scripts/o_entity.lua 2007-09-09 23:04:14 UTC (rev 1843) @@ -1,14 +1,7 @@ -print("> Starting object script..."); function onTick() - --this.position = this.position + yake.Vector3( 0, 0, 1 ) + -- TODO your code here end -function startup() +function main() this.events.tick:connect( onTick ) end -print("> Object script up."); -function main() - print(" script main()") - startup() -end - Deleted: trunk/yake/common/media/scripts/o_trigger.lua =================================================================== --- trunk/yake/common/media/scripts/o_trigger.lua 2007-09-07 13:57:17 UTC (rev 1842) +++ trunk/yake/common/media/scripts/o_trigger.lua 2007-09-09 23:04:14 UTC (rev 1843) @@ -1,99 +0,0 @@ -print("> Starting object script..."); -function startup() - --this:fsm("main"):connectTo("alive",fn) -- connects to 'enter', 'tick', 'exit' - --this:fsm("main"):connectToEnter("dead",fn) -- connects to 'enter' only - --this:fsm("main"):connect("alive", fnEnter, fnTick, fnExit) - - this:events("spawn"):connect( - function() - - end - ) -end -event = { - on_spawn = function() - print(" script event.on_spawn") - end, - on_tick = function() - print(" script event.on_tick") - end, - on_die = function() - print(" script event.on_die") - end, - -- various: - onArrived = function() --triggered as a result of "go to" - end, - -- Trigger - on_toggle = function(a) - print("event.on_toggle") - end -} -fsm = { - main = { - states = { - awakening, - alive, - dead - }, - transitions = { - {awakening,"spawn",alive}, - {alive,"die",dead} - } - } -} -state = { - ticks = 0, - off = { - on_enter = function() - print("state.off.enter()") - - this:setCondition(function() return (state.ticks >= 1 and state.ticks <= 3) end) - this:events():get("onTriggered"):connect( function(a) print("TRIGGER:onTriggered:",a) end ) - end, - on_tick = function() - state.ticks = state.ticks + 1 - print("TRIGGER off.tick()",state.ticks) - -- - --if (state.off.ticks == 1) then - -- this:processFsmEvent("trigger") - --end - -- - end, - on_exit = function() - print("state.off.exit()") - end - } - , - on = { - on_enter = function() - print("state.on.enter()") - --this:processFsmEvent("trigger") - --this:events():get("onTriggered"):fire() - end, - on_tick = function() - state.ticks = state.ticks + 1 - print("TRIGGER on.tick()",state.ticks) - end, - on_exit = function() - print("state.on.exit()") - end - } - , - dead = { - on_enter = function() - print(" script state.dead.on_enter") - end, - on_tick = function() - print(" script state.dead.on_tick") - end, - on_exit = function() - print(" script state.dead.on_exit") - end - } -} -print("> Object script up."); - -function main() - print("main()") -end - Modified: trunk/yake/common/media/scripts/o_trigger2.lua =================================================================== --- trunk/yake/common/media/scripts/o_trigger2.lua 2007-09-07 13:57:17 UTC (rev 1842) +++ trunk/yake/common/media/scripts/o_trigger2.lua 2007-09-09 23:04:14 UTC (rev 1843) @@ -4,12 +4,10 @@ function onTick() if this.volumes and this.volumes.size > 0 then - assert( objMgr, "no obj mgr" ) - local objs = objMgr:getAllObjects() + assert( sim.objMgr, "no obj mgr" ) + local objs = sim.objMgr:getAllObjects() - for id,obj in pairs(objs) do - --print(obj:isA()) - local ent = yake.asEntity(obj) + for id,ent in pairs(objs) do if ent and id ~= this.id then -- ignore self, and non-Entity objects local intersects = this.volumes:intersectsWith( ent.position ) if not this.on and intersects then @@ -28,7 +26,7 @@ --end end end -function startup() +function main() -- common ent::Object events this.events.tick:connect( onTick ) @@ -39,12 +37,5 @@ -- VolumeTrigger stuff this.properties:create("volumes", yake.VolumeContainerRef()) - --this.createProperty("volumes", yake.VolumeContainerRef()) end print("> Object script up."); - -function main() - print(" script main()") - startup() -end - Modified: trunk/yake/common/media/scripts/raf2.lua =================================================================== --- trunk/yake/common/media/scripts/raf2.lua 2007-09-07 13:57:17 UTC (rev 1842) +++ trunk/yake/common/media/scripts/raf2.lua 2007-09-09 23:04:14 UTC (rev 1843) @@ -1,85 +1,28 @@ - -- -- raf/lua2 demo - main application script -- -- available bindings: --- * res (including loads, i.e. yake.dofile) --- * graphics, ent, raf, and more +-- * res (including yake.dofile) +-- * graphics, physics, ent, raf, model and more +-- * demo specific bindings (sim.* and app.*) -- --- -local gworld = scene.gworld -local defaultCam = scene.activeCamera +local gworld = sim.gworld +local defaultCam = sim.activeCamera +local objMgr = sim.objMgr local actionMap = app.actionMap local input = yake.input -print(type(sim)) -print(type(sim.objMgr)) -local objMgr = sim.objMgr +local io = require 'io' -------------------------------------- --- Syntactic sugar for objMgr and --- objects / entities and their --- properties and events --- @todo do this on C++ side --- (g_casters -> probably as part of ThisBinder mechanism...) --------------------------------------- - --- register "Entity" -> DerivedEntity casters --- @todo lookup via "RtiiClass*" instead of string (-> faster...) -g_casters = {} -g_casters["Entity"] = yake.asEntity -g_casters["Trigger"] = yake.asTrigger - --- makes accessing properties and events --- syntactically simpler. --- -> Adds (syntactic) sugar. Instant pleasure. -function wrapEventsAndProperties(obj) - assert( obj ) - --obj.events = {} - --wrapEventsTable(obj.events,obj:eventAccessor(),false) - --obj.properties = {} - --wrapPropertiesTable(obj.properties,obj:propertyAccessor(),false) - return obj -end - --- Attempts to cast to most derived class. --- Returns the input object on failure, so obj stays valid. -function tryCastToDerived(obj) - local caster = g_casters[obj:isA().name] - assert( caster, "no caster available - returning as-is "..tostring(obj:isA()) ) - if not caster then - return obj, false - end - obj = caster( obj ) - assert( obj, "cast failed" ) - return obj, true -end - --- Attempts to cast to most derived class and --- also wraps event and property access for syntactic sugar. --- Returned obj is at least as valid as the original obj. :) -function tryOpen(obj) - local ok = false - obj,ok = tryCastToDerived(obj) - obj = wrapEventsAndProperties(obj) - return obj -end - --- Redefine objMgr.makeObject() to take advantage of wrapEventsAndProperties() -objMgr.old_makeObject = objMgr.makeObject -objMgr.makeObject = function(self,clsid) - local o = tryOpen( self:old_makeObject(clsid) ) - print("(lua)objMgr.makeObject created "..tostring(o.id)) - return o -end - --------------------------------------- -- demo methods which make creating various objects simpler -------------------------------------- function makeProximityTrigger(radius) local trigger = objMgr:makeObject("Trigger") assert( trigger ) + trigger.volumes:add( yake.Sphere(radius or 2) ) + -- create DEBUG geometry local m = yake.Model() trigger.model = m @@ -96,31 +39,11 @@ g:addSceneNode(sn) --ent:setPositionSource(sn) -- - trigger.volumes:add( yake.Sphere(radius or 2) ) - -- return trigger end -yake.Entity.makeSimpleGraphical = function(self,meshname) - assert(self, "missing self") - assert(meshname, "missing mesh name") - - local m = yake.Model() - self.model = m - - local g = yake.Graphical() - m:add(g) - - local sn = gworld:createSceneNode() - g:addSceneNode( sn ) - local e = gworld:createEntity(meshname) - sn:attach(e) - - self:setPositionSource(sn) -end function createBall() - local ent = yake.asEntity( objMgr:makeObject("Entity") ) - assert( ent ) - ent.model = ent:makeSimpleGraphical("sphere_d1.mesh") + local ent = objMgr:makeObject("Ball") + print("BALL at position ",ent.position) --< This actually accesses a static (!) property of a derived (!) class! return ent end @@ -146,7 +69,7 @@ -- configure active (=default) camera -local cam = scene.activeCamera +local cam = sim.activeCamera assert(cam) cam.nearClipDistance = 0.1 cam.position = yake.Point3(0,2,-10) @@ -158,14 +81,12 @@ -- create ball local ball = createBall() -ball.translate = function(self,delta) - ball.position = ball.position + delta -end cam:lookAt( ball.position ) -- Now look at our ball! -- create trigger local trigger = makeProximityTrigger(2) +-- trigger callback function onTrigger(yes) if yes then print("TRIGGERED",trigger.id,trigger.on) @@ -176,12 +97,20 @@ end end +-- connect trigger callback to trigger event trigger.events.onTriggered:connect(onTrigger) -------------------------------------- -- Configure input -------------------------------------- +--class 'DemoApp' +--function DemoApp:__init() +-- self.actionMap = app.actionMap +--end +--local app = DemoApp() +-- + local activeKeys = {} -- Store the keys that are active in current frame. -- We demonstrate two ways to bind Lua callbacks to a keyboard action. @@ -234,12 +163,12 @@ end) ----------------- F r a m e H a n d l e r --------------- -local currAngle = 0. +ball.currAngle = 0. function onFrame(timeElapsed) -- Move our little ball on a spherical trajectory so -- that it regularly passes the trigger volume boundary. - currAngle = currAngle + 1.2 * timeElapsed - ball.position = yake.Point3( math.cos(currAngle), math.sin(currAngle), 0 ) + yake.Vector3(-2,0,0) + ball.currAngle = ball.currAngle + 1.2 * timeElapsed + ball.position = yake.Point3( math.cos(ball.currAngle), math.sin(ball.currAngle), 0 ) + yake.Vector3(-2,0,0) -- Handle user moving the camera: local distance = 25 * timeElapsed @@ -257,4 +186,4 @@ -- prepare for next frame: activeKeys = {} -end \ No newline at end of file +end Modified: trunk/yake/samples/raf/lua2/demo.cpp =================================================================== --- trunk/yake/samples/raf/lua2/demo.cpp 2007-09-07 13:57:17 UTC (rev 1842) +++ trunk/yake/samples/raf/lua2/demo.cpp 2007-09-09 23:04:14 UTC (rev 1843) @@ -10,6 +10,7 @@ #include "yake/bindings.lua/bindings.lua.h" #include "yake/bindings.lua/common/yake.lua.common.h" #include "yake/bindings.lua/bindings.lua.ent.h" +#include "yake/bindings.lua/bindings.lua.ent.registry.h" #include "yake/res/res.h" using namespace yake; @@ -19,17 +20,7 @@ YAKE_ASSERT( script ); vm.execute( script ); } -void enable_entity_accessorwrappers(scripting::IVM& vm) -{ - scripting::ScriptPtr script = vm.getCreator()->createScriptFromFile("entityeventaccess.lua"); - YAKE_ASSERT( script ); - vm.execute( script ); - script = vm.getCreator()->createScriptFromFile("entitypropertyaccess.lua"); - YAKE_ASSERT( script ); - vm.execute( script ); -} - namespace env { struct Environment : public noncopyable { @@ -41,6 +32,12 @@ } ~Environment() { + YAKE_FOR_EACH(Instances::const_iterator, it, instances_) + { + if (it->second.deleter) + it->second.deleter(); + } + instances_.clear(); } private: template<typename T> @@ -49,13 +46,19 @@ delete t; } public: + enum OwnershipTransfer + { + DoNotTransferOwnership = 0, + TransferOwnership = 1 + }; template<typename T> - void set(T* t) + void set(T* t, const OwnershipTransfer ownership = DoNotTransferOwnership) { InstanceEntry e; e.px = t; - e.deleter =boost::bind(&Environment::doDelete<T>,t); + if (ownership == TransferOwnership) + e.deleter =boost::bind(&Environment::doDelete<T>,t); instances_[ TypeId<T>() ] = e; } template<typename T> @@ -82,85 +85,14 @@ }; } // namespace env -struct entObject_InstanceBinder_Traits -{ - typedef ent::Object base_type; - typedef RttiClass* index_type; - - template<class ConcreteT> - static index_type getIndex() +namespace { + struct RegisterObjectClasses { - return ConcreteT::cls(); - } - - static index_type getIndex(const base_type& o) - { - return o.isA(); - } -}; - -template<class TraitsT> -struct ClassInstanceBinder -{ - typedef TraitsT traits_type; - typedef typename TraitsT::base_type base_type; - typedef typename TraitsT::index_type index_type; - typedef base_type* base_pointer; - - typedef boost::function<void(luabind::object,base_pointer)> BinderFn; - - template<class ConcreteT> - void registerBinder(BinderFn fn) - { - binders_[ traits_type::getIndex<ConcreteT>() ] = fn; - } - - void bind(luabind::object tbl, base_pointer obj) - { - YAKE_ASSERT( obj ); - YAKE_ASSERT( tbl.is_valid() ); - YAKE_ASSERT( luabind::type(tbl) == LUA_TTABLE ); - BinderMap::const_iterator it = binders_.find( traits_type::getIndex(*obj) ); - YAKE_ASSERT( it != binders_.end() ).debug("Cannot lookup ThisBinder through parents, at the moment!"); - it->second(tbl,obj); - } -private: - typedef std::map<index_type,BinderFn> BinderMap; - - BinderMap binders_; -}; -typedef ClassInstanceBinder<entObject_InstanceBinder_Traits> ObjectThisBinders; -ObjectThisBinders& thisBinders() -{ - static ObjectThisBinders s_instance; - return s_instance; -} - -template<class T> -void do_register_bindThis(luabind::object tbl, ent::Object* o) -{ - YAKE_ASSERT(o); - YAKE_ASSERT(tbl.is_valid()); - YAKE_ASSERT(luabind::type(tbl) == LUA_TTABLE); - T* t = T::cast(o); - YAKE_ASSERT(t)(o->isA()->name()).error("Type mismatch!"); - tbl["this"] = t; -} - -template<class T> -void register_bindThis() -{ - thisBinders().registerBinder<T>( boost::bind(&do_register_bindThis<T>,_1,_2) ); -} - -namespace { - struct RegisterThisBinders - { - RegisterThisBinders() + RegisterObjectClasses() { - register_bindThis<ent::Object>(); - register_bindThis<ent::Entity>(); - register_bindThis<ent::Trigger>(); + ent::registerClass<ent::Object>(); + ent::registerClass<ent::Entity>(); + ent::registerClass<ent::Trigger>(); } } g_doRegister; } // namespace @@ -168,136 +100,58 @@ /** Binds 'this' in object's Lua VMs. */ struct My_ObjectListener : public ent::ObjectManagerListener { - My_ObjectListener(scripting::IScriptingSystem& scriptingSys, - const StringVector& startupScripts, - ent::ObjectManager* objMgr) : - scriptingSys_(scriptingSys), objMgr_(objMgr) + My_ObjectListener() { - YAKE_ASSERT( objMgr_ ); - YAKE_FOR_EACH( StringVector::const_iterator, it, startupScripts ) - { - ScriptPtr script = scriptingSys_.createScriptFromFile( *it ); - YAKE_ASSERT( script != 0 ); - if (script) - startupScripts_.push_back( script ); - } } private: - scripting::IScriptingSystem& scriptingSys_; - typedef scripting::ScriptPtr ScriptPtr; - typedef std::deque<ScriptPtr> ScriptPtrList; - ScriptPtrList startupScripts_; - ent::ObjectManager* objMgr_; -private: - virtual void onObjectCreated(ent::Object* obj) + virtual void onObjectCreated(ent::Object* obj, const ent::ObjectCreationParameters& params) { YAKE_ASSERT( obj ); YAKE_LOG( "MOL", "onObjectCreated: class is '" + obj->isA()->name() + "'" ); - - ent::Entity* ent = ent::Entity::cast(obj); - YAKE_ASSERT( ent ); - if (!ent) - return; - - scripting::VMPtr vm = scriptingSys_.createVM(); - YAKE_ASSERT( vm ); - bind_all( vm.get() ); - - ent->attachVM(vm,"main"); - - lua_State* L = static_cast<scripting::LuaVM*>(vm.get())->getLuaState(); - YAKE_ASSERT(L); - - // - enable_entity_accessorwrappers( *vm ); - thisBinders().bind( luabind::globals(L), obj ); - - // - luabind::globals(L)["objMgr"] = objMgr_; - - String err; - try - { - ScriptPtr script; - if (ent::Trigger::cast(ent)) - script = scriptingSys_.createScriptFromFile("o_trigger2.lua"); - else - script = scriptingSys_.createScriptFromFile("o_entity.lua"); - vm->execute( script ); - } - catch (std::exception& ex) - { - err += "Failed to run startup script:"; - err += ex.what(); - } - if (!err.empty()) - YAKE_EXCEPT( err ); - - /*@todo - YAKE_FOR_EACH( ScriptPtrList::const_iterator, it, startupScripts_ ) - { - String err; - try - { - vm->execute( *it ); - } - catch (std::exception& ex) - { - err += "Failed to run startup script:"; - err += ex.what(); - } - if (!err.empty()) - YAKE_EXCEPT( err ); - } - */ } virtual void onDestroyObject(ent::Object* obj) { - ent::Entity* ent = ent::Entity::cast(obj); - YAKE_ASSERT( ent ); - - scripting::VMPtr vm = ent->detachVM("main"); - YAKE_ASSERT( vm ); - // vm will destruct when scope is left. } - virtual void onObjectInitialized(ent::Object* obj) + virtual void onObjectInitialized(ent::Object* obj, const ent::ObjectCreationParameters& params) { - ent::Entity* ent = ent::Entity::cast(obj); - YAKE_ASSERT( ent ); - - ent->processFsmEvent("spawn"); } }; struct Simulation : public noncopyable { - Simulation(env::Environment& parentEnv) : env_(parentEnv) + Simulation(env::Environment& parentEnv, + ent::LuaObjectManagerListener::BinderFn appBinderFn) : env_(parentEnv), appBinderFn_(appBinderFn) { scripting::IScriptingSystem* scriptSys = env_.get<scripting::IScriptingSystem>(); YAKE_ASSERT( scriptSys ); // Register object class(es) that we may want to use in this simulation: - ent::RegistrationResult ret = objMgr_.registerClass<ent::Entity>("Entity"); + ent::ObjectCreationParameters params; + params.set("lua.startup",(MakeStringVector() << "o_entity.lua").get()); + ent::RegistrationResult ret = objMgr_.registerClass<ent::Entity>("Entity",params); YAKE_ASSERT( ret.first == object::RC_OK ); - ret = objMgr_.registerClass<ent::Trigger>("Trigger"); + params.set("lua.startup",(MakeStringVector() << "o_trigger2.lua").get()); + ret = objMgr_.registerClass<ent::Trigger>("Trigger",params); YAKE_ASSERT( ret.first == object::RC_OK ); + params.set("lua.startup",(MakeStringVector() << "o_ball.lua").get()); + ret = objMgr_.registerClass<ent::Entity>("Ball",params); + YAKE_ASSERT( ret.first == object::RC_OK ); // // Create & attach the listener which handles the connection to the Lua VM and the bindings. - luaObjListener_.reset( new ent::LuaObjectManagerListener(*scriptSys) ); - objMgr_.attachListener( luaObjListener_.get(), "luaFsm", ent::ObjectManager::kKeepOwnership ); + luaObjListener_.reset( new ent::LuaObjectManagerListener(*scriptSys,"main") ); + luaObjListener_->addBinder( appBinderFn_ ); //@todo allow more + objMgr_.attachListener( luaObjListener_.get(), "luaOML", ent::ObjectManager::kKeepOwnership ); // Object listener for init'ing our objects - StringVector startupScripts; - startupScripts.push_back("o_trigger2.lua"); - myObjListener_.reset( new My_ObjectListener(*scriptSys,startupScripts,&this->objMgr_) ); + myObjListener_.reset( new My_ObjectListener() ); objMgr_.attachListener( myObjListener_.get(), "Simulation.myObjListener_", ent::ObjectManager::kKeepOwnership ); } void start() { - // Create trigger + // Create objects { //ent::Trigger* trigger = ent::Trigger::cast(objMgr_.makeObject("Trigger")); //YAKE_ASSERT( trigger ); @@ -311,16 +165,28 @@ } void step() { - objMgr_.tick(); + String err; + try + { + objMgr_.tick(); + } + catch (luabind::error& e) + { + const char* code = lua_tostring(e.state(),-1); + err = e.what(); + err += code; + } + if (!err.empty()) + YAKE_EXCEPT("Simulation.step(): " + err); } ent::ObjectManager* __getObjMgr() { return &objMgr_; } private: - env::Environment env_; - ent::ObjectManager objMgr_; - SharedPtr<My_ObjectListener> myObjListener_; + env::Environment env_; + ent::ObjectManager objMgr_; + SharedPtr<My_ObjectListener> myObjListener_; SharedPtr<ent::LuaObjectManagerListener> luaObjListener_; - //ent::LuaObjectManagerListener luaObjMgrListener_; + ent::LuaObjectManagerListener::BinderFn appBinderFn_; }; /** Main application state */ @@ -333,15 +199,51 @@ { enableInstantQuitByKey( input::KC_ESCAPE ); env_.set<scripting::IScriptingSystem>(app_.getScriptingSystem()); + env_.set<raf::Application>(&app_); + env_.set<input::ActionMap>(&actionMap_); env_.set<graphics::IWorld>(this->getGraphicalWorld()); + //env_.set<graphics::ICamera>(this->getDefaultCamera()); } private: SharedPtr<Simulation> sim_; +private: + void onBindApplication(scripting::IVM& vm) + { + raf::Application* app = env_.get<raf::Application>(); + YAKE_ASSERT(app); + + scripting::LuaVM* luavm = static_cast<scripting::LuaVM*>(&vm); + YAKE_ASSERT(luavm); + lua_State* L = luavm->getLuaState(); + YAKE_ASSERT(L); + + // base + + bind_all( &vm ); + + // application + + luabind::globals(L)["app"] = app; + luabind::globals(L)["app"]["actionMap"] = env_.get<input::ActionMap>(); + + // sim + + luabind::module(L) + [ + luabind::class_<Simulation>("Simulation") + ]; + + YAKE_ASSERT(sim_); + luabind::globals(L)["sim"] = sim_.get(); + luabind::globals(L)["sim"]["objMgr"] = sim_->__getObjMgr(); + luabind::globals(L)["sim"]["gworld"] = this->getGraphicalWorld(); + luabind::globals(L)["sim"]["activeCamera"] = this->getDefaultCamera(); + } protected: virtual void onEnter() { actionMap_.start(); - sim_.reset( new Simulation(env_) ); + sim_.reset( new Simulation(env_,boost::bind(&TheMainState::onBindApplication,this,_1)) ); raf::RtMainState::onEnter(); // triggers onCreateScene() } @@ -369,33 +271,12 @@ YAKE_ASSERT( sys ); YAKE_ASSERT( !vm_ ); vm_ = sys->createVM(); - bind_all(vm_.get()); - - //bind application vm - { - lua_State* L = static_cast<scripting::LuaVM*>(vm_.get())->getLuaState(); - luabind::globals(L)["app"] = &app_; - luabind::globals(L)["app"]["actionMap"] = &actionMap_; - - luabind::object scene = luabind::newtable(L); - scene["gworld"] = this->getGraphicalWorld(); - scene["activeCamera"] = this->getDefaultCamera(); - luabind::globals(L)["scene"] = scene; - - luabind::module(L) - [ - luabind::class_<Simulation>("Simulation") - ]; - - luabind::globals(L)["sim"] = sim_.get(); - luabind::globals(L)["sim"]["objMgr"] = sim_->__getObjMgr(); - } - - // + onBindApplication(*vm_); enable_res_loaders( *vm_ ); - enable_entity_accessorwrappers( *vm_ ); + ent::classRegistry().bindCasters( static_cast<scripting::LuaVM*>(vm_.get())->getLuaState() ); + // Create ninja model, position camera and look at the ninja: All done in Lua script: scripting::ScriptPtr script = sys->createScriptFromFile("raf2.lua"); vm_->execute( script ); Modified: trunk/yake/src/base/yakeParamHolder.cpp =================================================================== --- trunk/yake/src/base/yakeParamHolder.cpp 2007-09-07 13:57:17 UTC (rev 1842) +++ trunk/yake/src/base/yakeParamHolder.cpp 2007-09-09 23:04:14 UTC (rev 1843) @@ -47,17 +47,28 @@ keys.push_back( it->first ); return keys; } - const ParamHolder::Value& ParamHolder::get( const String & id ) const + const ParamHolder::Value& ParamHolder::getValue( const String & id ) const { ParamMap::const_iterator itFind = mParams.find( id ); if (itFind != mParams.end()) return itFind->second; - return mParamNone; + return mParamNone; //todo throw NotFound? } - ParamHolder::Value ParamHolder::operator [] ( const String & id ) const + ParamHolder::Value& ParamHolder::getValue( const String & id ) { - return get( id ); + ParamMap::iterator itFind = mParams.find( id ); + if (itFind != mParams.end()) + return itFind->second; + return mParamNone; //todo throw NotFound? } + const ParamHolder::Value& ParamHolder::operator [] ( const String & id ) const + { + return getValue( id ); + } + ParamHolder::Value& ParamHolder::operator [] ( const String & id ) + { + return getValue( id ); + } bool ParamHolder::set( const String & id, const Value& value ) { YAKE_ASSERT( !id.empty() ); Added: trunk/yake/src/bindings.lua/detail/ent.listener.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/ent.listener.lua.cpp (rev 0) +++ trunk/yake/src/bindings.lua/detail/ent.listener.lua.cpp 2007-09-09 23:04:14 UTC (rev 1843) @@ -0,0 +1,234 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#include <yake/config.h> +#if YAKE_ENABLE_LUA_ENT == 1 + +#include <yake/bindings.lua/bindings.lua.h> // Don't forget to include this for proper dllexport! + +#include <yake/base/templates/yakeSmartAssert.h> +#include <yake/bindings.lua/bindings.lua.ent.h> +#include <yake/bindings.lua/bindings.lua.ent.registry.h> + +#include <yake/bindings.lua/common/yake.lua.shared_ptr.h> +#include <yake/bindings.lua/common/yake.lua.any_converter.h> +#include <yake/bindings.lua/detail/private.h> +#include <yake/bindings.lua/detail/property.lua.h> + + +namespace yake { +namespace ent { + //------------------------------------------------------------------------- + namespace detail { + LuaFsmObjectListener::LuaFsmObjectListener(scripting::IScriptingSystem& scriptingSystem, + const String& vmName) : + scriptingSystem_(scriptingSystem), vmName_(vmName) + { + } + void LuaFsmObjectListener::onInit(Object& obj) + { + Entity* ent = Entity::cast(&obj); + if (ent) + { + YAKE_ASSERT( ent->getFsmVM() ); + + // Retrieve Lua state + scripting::VMPtr vm = ent->getVM(vmName_); + YAKE_ASSERT(vm); + scripting::LuaVM* luavm = static_cast<scripting::LuaVM*>(vm.get()); + YAKE_ASSERT( vm ); + lua_State* L = luavm->getLuaState(); + YAKE_ASSERT( L ); + + // Init VM + ent::classRegistry().bindCasters( L ); + ent::classRegistry().bindThis( luabind::globals(L), &obj ); + + // Start 'main' + String err; + try + { + luabind::call_function<void>(L,"main"); + } + catch (luabind::error& ex) + { + const char* code = lua_tostring( ex.state(), -1 ); + err += ex.what(); + err += ":"; + err += code; + YAKE_LOG_ERROR("ent.lua",String("LuaFsmObjectListener.onInit:") + code); + } + catch (std::exception& ex) + { + err = ex.what(); + YAKE_LOG_ERROR("ent.lua",String("LuaFsmObjectListener.onInit:") + err); + } + if (!err.empty()) + YAKE_EXCEPT(err); + } + } + void LuaFsmObjectListener::onTick(Object& obj) + { +#if 0 + Entity* ent = Entity::cast(&obj); + if (ent) + { + scripting::VMPtr vm = ent->getFsmVM(); + vm->execute("event.on_tick()"); + detail::executeOfTable_2(*vm,"state",ent->getCurrentFsmState(),"on_tick"); + } +#endif + } + void LuaFsmObjectListener::onFsmEventHandled(Object& obj, const object_fsm&, const object_fsm::event_type& evt) + { +#if 0 + Entity* ent = Entity::cast(&obj); + if (ent) + { + ent->getFsmVM()->execute("event.on_" + evt + "()"); + } +#endif + } + void LuaFsmObjectListener::onFsmEnterState(Object& obj,/*const std::string& fsmName, */const object_fsm&, const object_fsm::state_type& state) + { +#if 0 + Entity* ent = Entity::cast(&obj); + if (ent) + { + scripting::VMPtr vm = ent->getFsmVM(); + YAKE_ASSERT( vm ); + detail::executeOfTable_2(*vm,"state",state,"on_enter"); + } +#endif + } + void LuaFsmObjectListener::onFsmExitState(Object& obj,/*const std::string& fsmName, */const object_fsm&, const object_fsm::state_type& state) + { +#if 0 + Entity* ent = Entity::cast(&obj); + if (ent) + { + scripting::VMPtr vm = ent->getFsmVM(); + YAKE_ASSERT( vm ); + detail::executeOfTable_2(*vm,"state",state,"on_exit"); + } +#endif + } + } // namespace detail + + //------------------------------------------------------------------------- + LuaObjectManagerListener::LuaObjectManagerListener(scripting::IScriptingSystem& scriptingSystem, const String& vmName) : + fsmListener_(scriptingSystem,vmName), + scriptingSystem_(scriptingSystem), + vmName_(vmName) + { + } + void LuaObjectManagerListener::addBinder(BinderFn fn) + { + YAKE_ASSERT(fn); + if (fn) + binders_.push_back(fn); + } + void LuaObjectManagerListener::onDestroyObject(Object* obj) + { + ent::Entity* ent = ent::Entity::cast(obj); + if (ent) + { + scripting::VMPtr vm = ent->detachVM("main"); + YAKE_ASSERT( vm ); + // vm will destruct when scope is left. + } + } + void LuaObjectManagerListener::onObjectCreated(Object* obj, const ObjectCreationParameters& params) + { + YAKE_LOG( "LuaMOL", "onObjectCreated: class is '" + obj->isA()->name() + "'" ); + Entity* ent = Entity::cast(obj); + if (ent) + { + // create & attach a Lua VM + scripting::VMPtr vm = ent->getVM(vmName_); + if (!vm) + { + vm = scriptingSystem_.createVM(); + YAKE_ASSERT( vm ); + ent->attachVM(vm,vmName_); + } + + // attach object listener + YAKE_ASSERT( ent ); + ent->attachListener( &fsmListener_, "lua_listener", ObjectListenerManager::kKeepOwnership ); + + // Do basic binding: + + // Retrieve Lua state + lua_State* L = static_cast<scripting::LuaVM*>(vm.get())->getLuaState(); + YAKE_ASSERT(L); + + // Bind app specific code + YAKE_FOR_EACH(Binders::const_iterator, it, binders_) + { + (*it)(*vm); + } + + // Run startup scripts and run 'spawn' + boost::optional<StringVector> startupScripts = params.get<StringVector>("lua.startup"); + String err; + try + { + // Run class specific scripts + if (startupScripts) + { + YAKE_FOR_EACH( StringVector::const_iterator, it, (*startupScripts) ) + { + scripting::ScriptPtr script; + const String& scriptFile = *it; + //@todo cache these scripts + script = scriptingSystem_.createScriptFromFile(scriptFile); + vm->execute( script ); + } + } + + // Trigger 'spawn' event //@todo trigger 'spawn' here??? + ent->processFsmEvent("spawn"); + } + catch (luabind::error& ex) + { + err += "Failed to run startup script:"; + const char* code = lua_tostring(ex.state(),-1); + err += code; + } + catch (std::exception& ex) + { + err += "Failed to run startup script:"; + err += ex.what(); + } + if (!err.empty()) + YAKE_EXCEPT( err ); + } + } + +} // namespace ent +} // namespace yake +#endif // YAKE_ENABLE_LUA_ENT Modified: trunk/yake/src/bindings.lua/detail/ent.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/ent.lua.cpp 2007-09-07 13:57:17 UTC (rev 1842) +++ trunk/yake/src/bindings.lua/detail/ent.lua.cpp 2007-09-09 23:04:14 UTC (rev 1843) @@ -56,20 +56,10 @@ } // namespace //------------------------------------------------------------------------- - luabind::object ObjectManager_getAllObjects(ObjectManager& objMgr, lua_State* L) - { - YAKE_ASSERT( L ); - const ObjectManager::const_object_iterator itEnd = objMgr.endObjects(); - ObjectManager::const_object_iterator it = objMgr.beginObjects(); - luabind::object o = luabind::newtable(L); - for (; it != itEnd; ++it) - { - Object* obj = *it; - //@todo luabind::object[ obj->id() ] = cast_to_this(obj->isA()); - o[ obj->id() ] = obj; - } - return o; - } + luabind::object ObjectManager_makeObject(ObjectManager& objMgr, const char* clsid, lua_State* L); + //luabind::object ObjectManager_makeObject(ObjectManager& objMgr, const char* clsid); + luabind::object ObjectManager_getObject(ObjectManager& objMgr, const ObjectId& id, lua_State* L); + luabind::object ObjectManager_getAllObjects(ObjectManager& objMgr, lua_State* L); //------------------------------------------------------------------------- // For Lua's tostring(): // std::ostream& operator<<(std::ostream& out, const ObjectId& rhs) @@ -454,8 +444,11 @@ module( YAKE_MODEL_MODULE ) [ class_<ObjectManager>( "ObjectManager" ) - .def( "makeObject", (Object*(ObjectManager::*)(const String&))&ObjectManager::makeObject ) - .def( "getObject", &ObjectManager::getObject ) + //.def( "makeObject", (Object*(ObjectManager::*)(const String&))&ObjectManager::makeObject ) + //.def( "getObject", &ObjectManager::getObject ) + .def( "makeObject", &ObjectManager_makeObject, raw(_3) ) + .def( "getObject", &ObjectManager_getObject, raw(_3) ) + .def( "destroyObject", &ObjectManager::destroyObject ) .def( "getClassNamesAndIds", &ObjectManager::getClassNamesAndIds ) .def( "getAllObjects", &ObjectManager_getAllObjects, raw(_2) ) @@ -848,113 +841,6 @@ } } } - - //------------------------------------------------------------------------- - namespace detail { - LuaFsmObjectListener::LuaFsmObjectListener(scripting::IScriptingSystem& scriptingSystem) : - scriptingSystem_(scriptingSystem) - { - //startScript_ = scriptingSystem_.createScriptFromFile("o_access.lua"); - //YAKE_ASSERT( startScript_.get() ); - } - void LuaFsmObjectListener::onInit(Object& obj) - { - Entity* ent = Entity::cast(&obj); - if (ent) - { - YAKE_ASSERT( ent->getFsmVM() ); - ent->getFsmVM()->execute("print('initializing...')"); - if (startScript_) - ent->getFsmVM()->execute( startScript_ ); - - scripting::LuaVM* vm = static_cast<scripting::LuaVM*>(ent->getFsmVM().get()); - YAKE_ASSERT( vm ); - //ent->getFsmVM()->execute("c = coroutine.create(main)\ncoroutine.resume(c,1)"); - String err; - try - { - luabind::call_function<void>(vm->getLuaState(),"main"); - } - catch (luabind::error& ex) - { - const char* code = lua_tostring( ex.state(), -1 ); - err += ex.what(); - err += ":"; - err += code; - YAKE_LOG_ERROR("ent.lua",String("LuaFsmObjectListener.onInit:") + code); - } - catch (std::exception& ex) - { - err = ex.what(); - YAKE_LOG_ERROR("ent.lua",String("LuaFsmObjectListener.onInit:") + err); - } - if (!err.empty()) - YAKE_EXCEPT(err); - } - } - void LuaFsmObjectListener::onTick(Object& obj) - { -#if 0 - Entity* ent = Entity::cast(&obj); - if (ent) - { - scripting::VMPtr vm = ent->getFsmVM(); - vm->execute("event.on_tick()"); - detail::executeOfTable_2(*vm,"state",ent->getCurrentFsmState(),"on_tick"); - } -#endif - } - void LuaFsmObjectListener::onFsmEventHandled(Object& obj, const object_fsm&, const object_fsm::event_type& evt) - { -#if 0 - Entity* ent = Entity::cast(&obj); - if (ent) - { - ent->getFsmVM()->execute("event.on_" + evt + "()"); - } -#endif - } - void LuaFsmObjectListener::onFsmEnterState(Object& obj,/*const std::string& fsmName, */const object_fsm&, const object_fsm::state_type& state) - { -#if 0 - Entity* ent = Entity::cast(&obj); - if (ent) - { - scripting::VMPtr vm = ent->getFsmVM(); - YAKE_ASSERT( vm ); - detail::executeOfTable_2(*vm,"state",state,"on_enter"); - } -#endif - } - void LuaFsmObjectListener::onFsmExitState(Object& obj,/*const std::string& fsmName, */const object_fsm&, const object_fsm::state_type& state) - { -#if 0 - Entity* ent = Entity::cast(&obj); - if (ent) - { - scripting::VMPtr vm = ent->getFsmVM(); - YAKE_ASSERT( vm ); - detail::executeOfTable_2(*vm,"state",state,"on_exit"); - } -#endif - } - } // namespace detail - - //------------------------------------------------------------------------- - LuaObjectManagerListener::LuaObjectManagerListener(scripting::IScriptingSystem& scriptingSystem) : - fsmListener_(scriptingSystem) - { - } - void LuaObjectManagerListener::onObjectCreated(Object* obj) - { - Entity* ent = Entity::cast(obj); - if (ent) - { - YAKE_ASSERT( ent ); - ent->attachListener( &fsmListener_, "lua_listener", ObjectListenerManager::kKeepOwnership ); - } - } - } // namespace ent //------------------------------------------------------------------------- void bind_ent(lua_State* L) Added: trunk/yake/src/bindings.lua/detail/ent.registry.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/ent.registry.lua.cpp (rev 0) +++ trunk/yake/src/bindings.lua/detail/ent.registry.lua.cpp 2007-09-09 23:04:14 UTC (rev 1843) @@ -0,0 +1,87 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#include <yake/config.h> +#if YAKE_ENABLE_LUA_ENT == 1 + +#include <yake/bindings.lua/bindings.lua.h> // Don't forget to include this for proper dllexport! + +#include <yake/base/templates/yakeSmartAssert.h> +#include <yake/bindings.lua/bindings.lua.ent.registry.h> + +#include <yake/bindings.lua/common/yake.lua.shared_ptr.h> +#include <yake/bindings.lua/detail/private.h> + +namespace yake { +namespace ent { + //------------------------------------------------------------------------- + TheClassRegistry& classRegistry() + { + static TheClassRegistry s_instance; + return s_instance; + } + + //------------------------------------------------------------------------- + luabind::object ObjectManager_makeObject(ObjectManager& objMgr, const char* clsid, lua_State* L) + { + Object* o = objMgr.makeObject(clsid); + if (!o) + return luabind::object(L,false); + boost::optional<luabind::object> out = classRegistry().castToDerived(L,o); + if (out) + return *out; + return luabind::object(L,false); + } + luabind::object ObjectManager_getObject(ObjectManager& objMgr, const ObjectId& id, lua_State* L) + { + Object* o = objMgr.getObject(id); + if (!o) + return luabind::object(L,false); + boost::optional<luabind::object> out = classRegistry().castToDerived(L,o); + if (out) + return *out; + return luabind::object(L,false); + } + luabind::object ObjectManager_getAllObjects(ObjectManager& objMgr, lua_State* L) + { + YAKE_ASSERT( L ); + const ObjectManager::const_object_iterator itEnd = objMgr.endObjects(); + ObjectManager::const_object_iterator it = objMgr.beginObjects(); + luabind::object o = luabind::newtable(L); + for (; it != itEnd; ++it) + { + Object* obj = *it; + boost::optional<luabind::object> out = classRegistry().castToDerived(L,obj); + if (out) + o[ obj->id() ] = *out; + else + o[ obj->id() ] = obj; + } + return o; + } +} // namespace ent +} // namespace yake +#endif // YAKE_ENABLE_LUA_ENT Modified: trunk/yake/src/ent/object_mgr.cpp =================================================================== --- trunk/yake/src/ent/object_mgr.cpp 2007-09-07 13:57:17 UTC (rev 1842) +++ trunk/yake/src/ent/object_mgr.cpp 2007-09-09 23:04:14 UTC (rev 1843) @@ -42,19 +42,20 @@ YAKE_ASSERT( !strClsId.empty() )(strClsId); std::pair<object::ResultCode,ClassId> ret = objMgr_.getClassId(strClsId); YAKE_ASSERT( ret.first == object::RC_OK )(ret.first)(ret.second); + return makeObject( ret.second ); } - void ObjectManager::setupObjectPostCreate(Object* obj) + void ObjectManager::setupObjectPostCreate(Object* obj, const ObjectCreationParameters& params) { YAKE_ASSERT( obj ); obj->registerMessageListeners(msgRouter_); - listeners_onObjectCreated(obj); + listeners_onObjectCreated(obj,params); obj->init(); - listeners_onObjectInitialized(obj); + listeners_onObjectInitialized(obj,params); } Object* ObjectManager::makeObject(const ObjectId objId) { @@ -62,8 +63,10 @@ YAKE_ASSERT( obj )(objId); objs_.push_back( obj ); - this->setupObjectPostCreate(obj); + class_option_map::const_iterator itOpt = objClsOptions_.find(objId.classId()); + this->setupObjectPostCreate(obj, (itOpt != objClsOptions_.end()) ? (itOpt->second) : ObjectCreationParameters()); + return obj; } Object* ObjectManager::makeObject(const ClassId clsId) @@ -72,8 +75,10 @@ YAKE_ASSERT( obj )(clsId); objs_.push_back( obj ); - this->setupObjectPostCreate(obj); + class_option_map::const_iterator itOpt = objClsOptions_.find(clsId); + this->setupObjectPostCreate(obj, (itOpt != objClsOptions_.end()) ? (itOpt->second) : ObjectCreationParameters()); + return obj; } void ObjectManager::destroyAllObjects() @@ -110,23 +115,23 @@ while (it.hasMoreElements()) it.getNext()->tick(); } - void ObjectManager::listeners_onObjectCreated(Object* obj) + void ObjectManager::listeners_onObjectCreated(Object* obj, const ObjectCreationParameters& params) { assert( obj ); if (!obj) return; yake::ConstVectorIterator<listener_mgr_type::listener_list> it(listeners_); while (it.hasMoreElements()) - it.getNext().first->onObjectCreated(obj); + it.getNext().first->onObjectCreated(obj,params); } - void ObjectManager::listeners_onObjectInitialized(Object* obj) + void ObjectManager::listeners_onObjectInitialized(Object* obj, const ObjectCreationParameters& params) { assert( obj ); if (!obj) return; yake::ConstVectorIterator<listener_mgr_type::listener_list> it(listeners_); while (it.hasMoreElements()) - it.getNext().first->onObjectInitialized(obj); + it.getNext().first->onObjectInitialized(obj, params); } void ObjectManager::listeners_onDestroyObject(Object* obj) { Modified: trunk/yake/src/ent/vm_holder.cpp =================================================================== --- trunk/yake/src/ent/vm_holder.cpp 2007-09-07 13:57:17 UTC (rev 1842) +++ trunk/yake/src/ent/vm_holder.cpp 2007-09-09 23:04:14 UTC (rev 1843) @@ -80,7 +80,7 @@ if (tag.empty()) return scripting::VMPtr(); VmMap::const_iterator it = vms_.find(tag); - YAKE_ASSERT( it != vms_.end() )(tag).debug("tag not found."); + //YAKE_ASSERT( it != vms_.end() )(tag).debug("tag not found."); if (vms_.end() == it) return scripting::VMPtr(); return it->second; Modified: trunk/yake/src/plugins/scriptingLua/ScriptingSystemLua.cpp =================================================================== --- trunk/yake/src/plugins/scriptingLua/ScriptingSystemLua.cpp 2007-09-07 13:57:17 UTC (rev 1842) +++ trunk/yake/src/plugins/scriptingLua/ScriptingSystemLua.cpp 2007-09-09 23:04:14 UTC (rev 1843) @@ -70,6 +70,8 @@ luaopen_math( mLuaState ); if (IS_MASK_SET(libs, LUALIB_DEBUG)) luaopen_debug( mLuaState ); + if (IS_MASK_SET(libs, LUALIB_PACKAGE)) + luaopen_package( mLuaState ); luabind::open( mLuaState ); } Modified: trunk/yake/yake/base/yakeParamHolder.h =================================================================== --- trunk/yake/yake/base/yakeParamHolder.h 2007-09-07 13:57:17 UTC (rev 1842) +++ trunk/yake/yake/base/yakeParamHolder.h 2007-09-09 23:04:14 UTC (rev 1843) @@ -31,6 +31,7 @@ #include <yake/base/templates/yakeVector.h> #include <yake/base/yakeString.h> #include <boost/any.hpp> +#include <boost/optional.hpp> namespace yake { @@ -53,10 +54,25 @@ StringVector getKeys() const; /** Returns the parameter value for a given key (id). */ - const Value& get( const String & id ) const; + const Value& getValue( const String & id ) const; + Value& getValue( const String & id ); + template<typename T> + boost::optional<T> get( const String & id ) const + { + try { + boost::optional<T> out = boost::any_cast<T>(getValue(id)); + return out; + } + catch (boost::bad_any_cast&) + { + return false; + } + } + /** Returns the parameter value for a given key (id). */ - Value operator [] ( const String & id ) const; + const Value& operator [] ( const String & id ) const; + Value& operator [] ( const String & id ); /** Sets the value of a given parameter identified by a key (id) to an uint32. */ bool set( const String & id, const Value& value ); Modified: trunk/yake/yake/base/yakeString.h =================================================================== --- trunk/yake/yake/base/yakeString.h 2007-09-07 13:57:17 UTC (rev 1842) +++ trunk/yake/yake/base/yakeString.h 2007-09-09 23:04:14 UTC (rev 1843) @@ -110,6 +110,10 @@ { return m_strings; } + const StringVector& get() const + { + return m_strings; + } private: StringVector m_strings; }; Modified: trunk/yake/yake/bindings.lua/bindings.lua.ent.h =================================================================== --- trunk/yake/yake/bindings.lua/bindings.lua.ent.h 2007-09-07 13:57:17 UTC (rev 1842) +++ trunk/yake/yake/bindings.lua/bindings.lua.ent.h 2007-09-09 23:04:14 UTC (rev 1843) @@ -39,7 +39,8 @@ namespace detail { struct YAKE_BINDINGS_LUA_API LuaFsmObjectListener : public ObjectListener { - LuaFsmObjectListener(scripting::IScriptingSystem& scriptingSystem); + LuaFsmObjectListener(scripting::IScriptingSystem& scriptingSystem, + const String& vmName); virtual void onInit(Object& obj); virtual void onTick(Object& obj); virtual void onFsmEventHandled(Object& obj, const object_fsm&, const object_fsm::event_type& evt); @@ -48,14 +49,23 @@ private: scripting::IScriptingSystem& scriptingSystem_; boost::shared_ptr<scripting::IScript> startScript_; + String vmName_; }; } // namespace detail struct YAKE_BINDINGS_LUA_API LuaObjectManagerListener : public ObjectManagerListener { - LuaObjectManagerListener(scripting::IScriptingSystem& scriptingSystem); - virtual void onObjectCreated(Object* obj); + typedef boost::function<void(scripting::IVM&)> BinderFn; + LuaObjectManagerListener(scripting::IScriptingSystem& scriptingSystem, const String& vmName); + void addBinder(BinderFn); private: + virtual void onObjectCreated(Object* obj, const ObjectCreationParameters&); + virtual void onDestroyObject(Object* obj); + private: detail::LuaFsmObjectListener fsmListener_; + scripting::IScriptingSystem& scriptingSystem_; + String vmName_; + typedef std::deque<BinderFn> Binders; + Binders binders_; }; } // namespace ent } // namespace yake Added: trunk/yake/yake/bindings.lua/bindings.lua.ent.registry.h =================================================================== --- trunk/yake/yake/bindings.lua/bindings.lua.ent.registry.h (rev 0) +++ trunk/yake/yake/bindings.lua/bindings.lua.ent.registry.h 2007-09-09 23:04:14 UTC (rev 1843) @@ -0,0 +1,245 @@ +/* + ------------------------------------------------------------------------------------ + This file is part of YAKE + Copyright (c) 2004 - 2008 The YAKE Team + For the latest information visit http://www.yake.org + ------------------------------------------------------------------------------------ + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA, or go to + http://www.gnu.org/copyleft/lesser.txt. + ------------------------------------------------------------------------------------ + If you are interested in another license model contact the Yake Team via + E-Mail: te...@ya.... + For more information see the LICENSE file in the root directory of the + source code distribution. + ------------------------------------------------------------------------------------ +*/ +#ifndef YAKE_LUA_BINDINGS_ENT_REGISTRY_H +#define YAKE_LUA_BINDINGS_ENT_REGISTRY_H + +#include <yake/bindings.lua/prerequisites.h> +#include <yake/base/yake.h> +#include <yake/base/templates/yakePointer.h> +#include <yake/ent/ent.h> +#include <yake/scripting/yakeScriptingSystem.h> +#include <yake/bindings.lua/common/yake.lua.common.h> + +namespace yake { +namespace ent { + //----------------------------- + struct entObject_InstanceBinder_Traits + { + typedef ent::Object root_type; + typedef RttiClass* index_type; + + template<class ConcreteT> + static index_type getIndex() + { + return ConcreteT::cls(); + } + + static index_type getIndex(const root_type& o) + { + return o.isA(); + } + }; + //----------------------------- + template<typename T> + int entlua_castToDerived(lua_State* L) + { + luaL_argcheck(L,lua_isuserdata(L,-1),1,"object expected"); + luaL_argcheck(L,lua_isuserdata(L,lua_upvalueindex(1)),2,"rx class as upvalue expected"); + + RttiClass* rx = static_cast<RttiClass*>(lua_touserdata(L,lua_upvalueindex(1))); + YAKE_ASSERT(rx); + + luabind::detail::object_rep* orep = static_cast<luabind::detail::object_rep*>(lua_touserdata(L, -1)); + YAKE_ASSERT(orep); + + luabind::detail::class_rep* crep = orep->crep(); + YAKE_ASSERT(crep); + void* p1 = 0; //@todo find out what's this for. + #if 0 + void* p = crep->convert_to( LUABIND_TYPEID(T), orep, p1 ); + T* derived = reinterpret_cast<T*>(p); + #else + void* p = crep->convert_to( LUABIND_TYPEID(ent::Object), orep, p1 ); + ent::Object* obj = reinterpret_cast<ent::Object*>(p); + T* derived = dynamic_cast<T*>(obj); + #endif + + YAKE_ASSERT(derived); + if (!derived) + { + lua_pushnil(L); + } + else + { + YAKE_ASSERT( derived->isA() == rx ); + luabind::object out(L,derived); + out.push(L); + } + return 1; + } + //----------------------------- + template<class TraitsT> + struct ClassRegistry + { + typedef TraitsT traits_type; + typedef typename TraitsT::root_type root_type; + typedef typename TraitsT::index_type index_type; + typedef root_type* root_pointer; + + // places casted pointer in "this" in table (param 1). + typedef boost::function<void(luabind::object,root_pointer)> ThisBinderFn; + + private: + struct caster + { + virtual ~caster() = 0; + virtual void addToTable(lua_State* L) = 0; + virtual boost::optional<luabind::object> returnCastedToDerived(lua_State* L, root_pointer obj) = 0; + }; + template<typename T> + caster* makeCaster() + { + struct caster_impl : public caster + { + caster_impl(RttiClass* rx) : rx_(rx) + {} + virtual void addToTable(lua_State* L) + { + luaL_checktype(L,-1,LUA_TTABLE); + lua_pushstring(L,rx_->name().c_str()); + lua_pushlightuserdata(L,rx_); + lua_pushcclosure(L,&entlua_castToDerived<T>,1); // 1 up value + lua_rawset(L,-3); + } + virtual boost::optional<luabind::object> returnCastedToDerived(lua_State* L, root_pointer obj) + { + if (!obj) + return false; + T* derived = dynamic_cast<T*>(obj); + if (!derived) + return false; + luabind::object out(L,derived); + return out; + } + private: + RttiClass* rx_; + }; + return new caster_impl(T::cls()); + } + public: + template<class ConcreteT> + void registerClass(ThisBinderFn fn) + { + index_type idx = traits_type::getIndex<ConcreteT>(); + ClassInfo cls; + cls.thisBinder = fn; + cls.castToDerived.reset( makeCaster<ConcreteT>() ); + classes_[idx] = cls; + } + void bindThis(luabind::object tbl, root_pointer obj) + { + YAKE_ASSERT( obj ); + YAKE_ASSERT( tbl.is_valid() ); + YAKE_ASSERT( luabind::type(tbl) == LUA_TTABLE ); + ClassMap::const_iterator it = classes_.find( traits_type::getIndex(*obj) ); + YAKE_ASSERT( it != classes_.end() ).debug("Cannot lookup ThisBinder through parents, at the moment!"); + const ClassInfo& cls = it->second; + YAKE_ASSERT( cls.thisBinder ); + cls.thisBinder(tbl,obj); + } + void bindCasters(lua_State* L) + { + lua_pushstring(L,"__yake_ent_casters"); + lua_newtable(L); + YAKE_FOR_EACH(ClassMap::const_iterator,it,classes_) + { + it->second.castToDerived->addToTable(L); + } + lua_settable(L, LUA_GLOBALSINDEX); + } + int returnCastedToDerived(lua_State* L, root_pointer obj) + { + YAKE_ASSERT(obj); + if (!obj) + { + lua_pushnil(L); + return 1; + } + ClassMap::const_iterator it = classes_.find( traits_type::getIndex(*obj) ); + YAKE_ASSERT( it != classes_.end() ).debug("Cannot lookup ThisBinder through parents, at the moment!"); + const ClassInfo& cls = it->second; + YAKE_ASSERT( cls.castToDerived ); + boost::optional<luabind::object> derived = cls.castToDerived->returnCastedToDerived(L,obj); + if (derived) + { + (*derived).push(L); + } + else + lua_pushnil(L); + return 1; + } + boost::optional<luabind::object> castToDerived(lua_State* L, root_pointer obj) + { + YAKE_ASSERT(obj); + if (!obj) + return false; + ClassMap::const_iterator it = classes_.find( traits_type::getIndex(*obj) ); + YAKE_ASSERT( it != classes_.end() ).debug("Cannot lookup ThisBinder through parents, at the moment!"); + const ClassInfo& cls = it->second; + YAKE_ASSERT( cls.castToDerived ); + boost::optional<luabind::object> out = cls.castToDerived->returnCastedToDerived(L,obj); + return out; + } + private: + struct ClassInfo + { + ThisBinderFn thisBinder; + SharedPtr<caster> castToDerived; + }; + typedef std::map<index_type,ClassInfo> ClassMap; + ClassMap classes_; + }; + template<class TraitsT> + ClassRegistry<TraitsT>::caster::~caster() {} + + //------------------------------------------------------------------------- + typedef ClassRegistry<entObject_InstanceBinder_Traits> TheClassRegistry; + YAKE_BINDINGS_LUA_API TheClassRegistry& classRegistry(); + + // + namespace detail { + template<class T> + inline void do_register_bindThis(luabind::object tbl, ent::Object* o) + { + YAKE_ASSERT(o); + YAKE_ASSERT(tbl.is_valid()); + YAKE_ASSERT(luabind::type(tbl) == LUA_TTABLE); + T* t = T::cast(o); + YAKE_ASSERT(t)(o->isA()->name()).error("Type mismatch!"); + tbl["this"] = t; + } + } // namespace detail + + template<class T> + inline void registerClass() + { + classRegistry().registerClass<T>( boost::bind(&detail::do_register_bindThis<T>,_1,_2) ); + } +} // namespace ent +} // namespace yake + +#endif Modified: trunk/yake/yake/ent/object.h =================================================================== --- trunk/yake/yake/ent/object.h 2007-09-07 13:57:17 UTC (rev 1842) +++ trunk/yake/yake/ent/object.h 2007-09-09 23:04:14 UTC (rev 1843) @@ -39,6 +39,7 @@ namespace yake { namespace ent { + typedef ParamHolder ObjectCreationParameters; struct LuaBinder; #define DECL_OBJECT(CLASS,DESC) \ Modified: trunk/yake/yake/ent/object_mgr.h =================================================================== --- trunk/yake/yake/ent/object_mgr.h 2007-09-07 13:57:17 UTC (rev 1842) +++ trunk/yake/yake/ent/object_mgr.h 2007-09-09 23:04:14 UTC (rev 1843) @@ -86,12 +86,12 @@ string identifiers has to be maintained and C++ classes have been replaced with different ones. */ template<typename T> - inline RegistrationResult registerClass(const String& name, const StringMap& options = MakeStringMap() ) + inline RegistrationResult registerClass(const String& name, const ObjectCreationParameters& options = ObjectCreationParameters() ) { RegistrationResult ret = objMgr_.registerClass(name,&T::create,&T::destroy); if (ret.first == object::RC_OK) { - objClsOptions_[ name ] = options; + objClsOptions_[ ret.second ] = options; clsNameIdMap_[ name ] = ret.second; } return ret; @@ -173,11 +173,11 @@ private: // typedef ListenerManager<ObjectManagerListener> listener_mgr_type; - void listeners_onObjectCreated(Object* obj); - void listeners_onObjectInitialized(Object* obj); + void listeners_onObjectCreated(Object* obj,const ObjectCreationParameters&); + void listeners_onObjectInitialized(Object* obj,const ObjectCreationParameters&); void listeners_onDestroyObject(Object* obj); private: - void setupObjectPostCreate(Object*); + void setupObjectPostCreate(Object*, const ObjectCreationParameters& params); o... [truncated message content] |
From: <psy...@us...> - 2007-09-07 13:57:13
|
Revision: 1842 http://yake.svn.sourceforge.net/yake/?rev=1842&view=rev Author: psyclonist Date: 2007-09-07 06:57:17 -0700 (Fri, 07 Sep 2007) Log Message: ----------- * [luadocs] added documentation and improved scripts to partially handle 'free' text Modified Paths: -------------- tools/luadocs/index.html tools/luadocs/lua_bindings_2_rst.cmd tools/luadocs/lua_bindings_2_rst.lua tools/luadocs/project.txt Modified: tools/luadocs/index.html =================================================================== --- tools/luadocs/index.html 2007-09-07 13:56:59 UTC (rev 1841) +++ tools/luadocs/index.html 2007-09-07 13:57:17 UTC (rev 1842) @@ -18,7 +18,7 @@ <tbody valign="top"> <tr><th class="docinfo-name">Author:</th> <td>LuaBindingsDoc</td></tr> -<tr class="field"><th class="docinfo-name">Generated on:</th><td class="field-body">31 Aug 2007</td> +<tr class="field"><th class="docinfo-name">Generated on:</th><td class="field-body">06 Sep 2007</td> </tr> <tr><th class="docinfo-name">Status:</th> <td>Draft</td></tr> @@ -511,6 +511,8 @@ dev:poll(yeeha) </pre> </blockquote> +<p>description</p> +<p>description</p> <p><strong>Properties</strong></p> <blockquote> <ul class="simple"> @@ -587,11 +589,14 @@ </blockquote> </li> </ul> +<blockquote> +<p>Code:</p> <pre class="literal-block"> this = ... --assign Object instance to 'this' myName = this.properties["name"] -- retrieve value this.properties["name"] = myName .. " Meyes" -- set value </pre> +</blockquote> <ul> <li><p class="first"><strong>operator.(name)</strong></p> <blockquote> @@ -600,10 +605,13 @@ </blockquote> </li> </ul> +<blockquote> +<p>Code:</p> <pre class="literal-block"> myName = this.properties.name -- retrieve value this.properties.name = "Jack" -- set value </pre> +</blockquote> <ul> <li><p class="first"><strong>create(name,value)</strong></p> <blockquote> @@ -612,11 +620,14 @@ </blockquote> </li> </ul> +<blockquote> +<p>Code:</p> <pre class="literal-block"> this.properties:create("name","Jack") -- constructs property of type 'string' this.properties:create("health",10) -- constructs property of type 'number' this.properties:create("model",yake.Model()) -- constructs custom typed property </pre> +</blockquote> <ul> <li><p class="first"><strong>foreach(op)</strong></p> <blockquote> @@ -624,17 +635,33 @@ </blockquote> </li> </ul> +<blockquote> +<p>Code:</p> <pre class="literal-block"> this.properties.each( function(name,value) print("property " .. name .. " = " .. value) end ) </pre> </blockquote> +</blockquote> </div> <div class="section" id="object"> <h3><a class="toc-backref" href="#id41">Object</a></h3> <p><strong>Code</strong></p> <blockquote> +<p>Accessing properties::</p> +<pre class="literal-block"> +this = ... --assign Object instance to 'this' + +this.properties:create("name","Jack") +myName = this.name +myName = this.properties["name"] +myName = this.properties.name +</pre> +</blockquote> +<p>The shortcut syntax (this.name) is available as long as the name +does not collide with a method or built-in property of the object.</p> +<blockquote> <p>Accessing events::</p> <pre class="literal-block"> this = ... --assign Object instance to 'this' @@ -650,14 +677,6 @@ -- fire event: this.events.toggled(true) -- prints "TOGGLED!" to the console </pre> -<p>Accessing properties::</p> -<pre class="literal-block"> -this = ... --assign Object instance to 'this' - -this.properties:create("name","Jack") -myName = this.properties["name"] -myName = this.properties.name -</pre> </blockquote> <p><strong>Properties</strong></p> <blockquote> @@ -764,12 +783,15 @@ </blockquote> </li> </ul> +<blockquote> +<p>Code:</p> <pre class="literal-block"> -- both of the following calls do the same trigger:addVolume( yake.Sphere(5, this.properties.position ) ) trigger.volumes:add( yake.Sphere(5, this.properties.position ) ) </pre> </blockquote> +</blockquote> </div> </div> </div> Modified: tools/luadocs/lua_bindings_2_rst.cmd =================================================================== --- tools/luadocs/lua_bindings_2_rst.cmd 2007-09-07 13:56:59 UTC (rev 1841) +++ tools/luadocs/lua_bindings_2_rst.cmd 2007-09-07 13:57:17 UTC (rev 1842) @@ -1,5 +1,5 @@ @echo off d:\tools\luabin\lua5.1 lua_bindings_2_rst.lua -d:\doc\docutils\tools\rst2html.py --link-stylesheet --stylesheet-path lua_bindings.css project.rst.txt index.html +d:\tools\doc\docutils\tools\rst2html.py --link-stylesheet --stylesheet-path lua_bindings.css project.rst.txt index.html pause Modified: tools/luadocs/lua_bindings_2_rst.lua =================================================================== --- tools/luadocs/lua_bindings_2_rst.lua 2007-09-07 13:56:59 UTC (rev 1841) +++ tools/luadocs/lua_bindings_2_rst.lua 2007-09-07 13:57:17 UTC (rev 1842) @@ -43,7 +43,7 @@ parent.scopes[id].functions = {} parent.scopes[id].functionOrder = {} parent.scopes[id].constants = {} - parent.scopes[id].codes = {} + parent.scopes[id].docs = {} unique_insert(parent.scopeOrder,id) db.currScope = parent.scopes[id] @@ -131,7 +131,7 @@ local fn = fnBase.overloads[uniqueSignature] fn.params = {} fn.returns = {} - fn.codes = {} + fn.docs = {} fn.signature = signature fn.tag = tag @@ -176,33 +176,89 @@ db.getCurrClass = function() return db.currScope end -db.newCode = function(name,content) +db.DOC_CODE = {} +db.DOC_TEXT = {} +db.newDocBlock = function(name,content,type) + if name then + name = string.gmatch(name,"%s(.*)")() + end + print("NEW BLOCK",name) + db.endDoc() local scope = db.currentFn or db.getCurrClass() assert(scope) - assert(scope.codes) - --print("newCode '"..name.."'") - scope.codes[name] = "" - db.currCode = name - db.currCodeScope = scope.codes + assert(scope.docs) + --print("newDocBlock '"..name.."'") + local e = {} + e.name = name + e.type = type + e.content = {} + table.insert(scope.docs,e) + db.currDoc = scope.docs[#scope.docs] + db.currDocScope = scope.docs end -db.newCodeLine = function(line) - assert(db.currCode) - assert(db.currCodeScope) +db.newTextLine = function(line) + local scope = db.currentFn or db.getCurrClass() + if not scope or not scope.docs then + return + end + --print("newDocBlock '"..name.."'") + if db.currDoc and db.currDoc.type ~= db.DOC_TEXT then + db.endDoc() + end + if not db.currDoc then + db.newDocBlock(nil,line,db.DOC_TEXT) + end + db.newDocLine(line) +end +db.closeText = function() + db.endDoc() +end +db.newDocLine = function(line) + assert(db.currDoc) + assert(db.currDocScope) assert(line) --print("newCodeLine '" .. db.currCode .. "': '" .. line .. "'") - assert(db.currCodeScope) - assert(db.currCodeScope[db.currCode]) + assert(db.currDocScope) + assert(db.currDoc) - db.currCodeScope[db.currCode] = db.currCodeScope[db.currCode] .. line .. "\n" + -- Remove leading spaces for regular text. + -- NB But keep indentation for CODE !!! + if db.currDoc.type == db.DOC_TEXT then + line = string.gmatch(line,"[%s]*(.*)")() + end + + if #db.currDoc.content == 0 and #line == 0 then + -- ignore leading empty lines + else + table.insert(db.currDoc.content,line) + end - return db.newCodeLine,"codeend" + return db.newDocLine,"codeend" end +db.endDoc = function() + -- if doc block is empty, remove it + if db.currDoc then + if #db.currDoc.content == 0 then + table.remove( db.currDocScope, #db.currDocScope ) + end + end + db.currDoc = nil + db.currDocScope = nil +end +db.newCode = function(name,content) + db.newDocBlock(name,content,db.DOC_CODE) +end +db.newCodeLine = function(line) + return db.newDocLine(line) +end db.endCode = function() - db.currCode = nil - db.currCodeScope = nil + db.endDoc() end +db.endText = function() + db.endDoc() +end jump = {} jump["project"] = function(line) @@ -383,6 +439,9 @@ elseif lineHandler then lineHandler,cmdStop = lineHandler(line) print(line) + else -- default line handler + print("POSSIBLE DOC:"..line) + db.newTextLine(line) end end end @@ -552,9 +611,18 @@ rst.f:write("\n") rst.f:write("**Code**\n\n") end -rst.onCode = function(name,content) - rst.f:write(" "..(name or "Code") .. "::\n\n") - rst.f:write(content) +rst.onCode = function(name,type,content) + if #content == 0 then + return + end + if type == db.DOC_CODE then + rst.f:write(" "..(name or "Code") .. "::\n\n") + else --db.DOC_TEXT + rst.f:write("\n\n") + end + for _,line in pairs(content) do + rst.f:write(line .. "\n") + end rst.f:write("\n") rst.f:write("\n") end @@ -654,7 +722,7 @@ if codes and getn(codes) > 0 then --rst.f:write(" Code\n\n") for k,v in pairs(codes) do - rst.onCode(k,v) + rst.onCode(v.name,v.type,v.content) end end end @@ -690,10 +758,11 @@ print(lvl.."SCOPE",scopeName,strParents) -- code - if scope.codes and getn(scope.codes) > 0 then + if scope.docs and getn(scope.docs) > 0 then rst.onBeginCodes() - for k,v in pairs(scope.codes) do - rst.onCode(k,v) + for k,v in pairs(scope.docs) do + print(lvl.."DOC",v.name,v.type,v.content) + rst.onCode(v.name,v.type,v.content) end end @@ -740,7 +809,7 @@ params = params .. v.name end print(lvl.." FUNCTION " .. fnName .. "(" .. params .. ")") - rst.onFunction(fnName,fnObj.signature,fnObj.params,fnObj.returns,fnObj.codes, + rst.onFunction(fnName,fnObj.signature,fnObj.params,fnObj.returns,fnObj.docs, function(type) return db.reverseLookupType(parents,type) end Modified: tools/luadocs/project.txt =================================================================== --- tools/luadocs/project.txt 2007-09-07 13:56:59 UTC (rev 1841) +++ tools/luadocs/project.txt 2007-09-07 13:57:17 UTC (rev 1842) @@ -280,9 +280,16 @@ this = ... --assign Object instance to 'this' this.properties:create("name","Jack") + myName = this.name myName = this.properties["name"] myName = this.properties.name @codeend + + The shortcut syntax (this.name) is available as long as the name + does not collide with a method or built-in property of the object. + + + @code Accessing events: this = ... --assign Object instance to 'this' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-07 13:56:56
|
Revision: 1841 http://yake.svn.sourceforge.net/yake/?rev=1841&view=rev Author: psyclonist Date: 2007-09-07 06:56:59 -0700 (Fri, 07 Sep 2007) Log Message: ----------- * [Lua scripts] cleaned up entity scripts * [bindings.lua] new property access syntax (this.prop instead of this.properties.prop) and implementation * [bindings.lua] new event access implementation Modified Paths: -------------- trunk/yake/src/bindings.lua/detail/ent.lua.cpp Modified: trunk/yake/src/bindings.lua/detail/ent.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/ent.lua.cpp 2007-09-07 13:56:40 UTC (rev 1840) +++ trunk/yake/src/bindings.lua/detail/ent.lua.cpp 2007-09-07 13:56:59 UTC (rev 1841) @@ -265,6 +265,56 @@ } }; //------------------------------------------------------------------------- + int redirect_luabind_cppclass_metatable_index(lua_State*); + /* + static const luaL_Reg ent_m { + {"__index",ent_index}, + {0,0} + };*/ + struct LuaStack : public noncopyable + { + LuaStack(lua_State* l) : L(l) + { + YAKE_ASSERT(L); + } + void pushvalue(int idx) + { + //std::cout << "stack push " << idx << "\n"; + lua_pushvalue(L,idx); + } + void dump(int startidx) + { +#if 1 + const int top = lua_gettop(L); + std::cout << "STACK (" << startidx << " -> " << top << ")\n"; + for (int i=startidx; i<top; ++i) + { + const int type = lua_type(L,i); + std::cout << " [" << i << "] (" << lua_typename(L,type) << ")\n"; + } + const std::string str = luabind::detail::stack_content_by_name(L,startidx); + std::cout << " Luabind:\n"; + std::cout << " " << str << "\n"; +#endif + } + void dumpTable() // exptects -1 to be a table + { + luaL_argcheck(L, lua_istable(L,-1), 1, "table expected"); + lua_pushnil(L); + while (lua_next(L, -2)) + { + int type = lua_type(L,-1); + type = lua_type(L,-2); + if (type == LUA_TSTRING) + { + std::cout << "K " << std::string(lua_tostring(L,-2)) << "\n"; + } + lua_pop(L,1); + } + } + private: + lua_State* L; + }; void bind( lua_State* L ) { YAKE_ASSERT( L ); @@ -352,10 +402,10 @@ .property( "id", &Object::getId, &Object::setId ) .def( "isA", &Object::isA) .def( "evts", &getObjectEventsTable, raw(_2) ) - .def( "events", &getObjectEventsAccessor ) + //.def( "events", &getObjectEventsAccessor ) .def( "eventAccessor", &getObjectEventsAccessor ) .def( "property", &getPropertyOfObject ) - .def( "properties", &getObjectPoperties ) + //.def( "properties", &getObjectPoperties ) .def( "propertyAccessor", &getObjectPopertiesAccessor ) //.def( "properties", return_reference_to(_1) ) .def(tostring(const_self)) @@ -410,8 +460,346 @@ .def( "getClassNamesAndIds", &ObjectManager::getClassNamesAndIds ) .def( "getAllObjects", &ObjectManager_getAllObjects, raw(_2) ) ]; + typedef luabind::detail::class_registry class_registry; + class_registry* reg = luabind::detail::class_registry::get_registry(L); + YAKE_ASSERT( reg ); +#if 0 + typedef luabind::detail::class_rep class_rep; + class_rep* cls = reg->find_class( LUABIND_TYPEID(Entity) ); + cls->add_static_constant("STUFF", 42); +#endif + +#define HIJACK_CPPINSTANCE 1 + +#define YAKE_ASSERT_TYPE( CHECK, STATE, IDX ) \ + YAKE_ASSERT( CHECK( STATE, IDX ) )(lua_type(STATE,IDX)).debug("type mismatch") + +#if HIJACK_CPPINSTANCE == 1 + LuaStack stack(L); + //stack.dump(-2); + + // Retrieve Luabind metatable for instances + lua_rawgeti(L, LUA_REGISTRYINDEX, reg->cpp_instance()); + int type = lua_type(L,-1); + YAKE_ASSERT_TYPE( lua_istable, L, -1 ); + + // Retrieve "__index" + lua_getfield(L,-1,"__index"); + type = lua_type(L,-1); + YAKE_ASSERT_TYPE( lua_isfunction, L, -1 ); + + // Replace with custom "__index". + // NB We keep the old function in upvalue as we use it as a default in our implementation! + lua_pushcclosure(L, redirect_luabind_cppclass_metatable_index, 1 ); + lua_setfield(L,-2,"__index"); + + // At -1 is the now cpp instance metatable. (reg->cpp_instance(), see above) +#endif } + typedef luabind::detail::object_rep object_rep; + typedef luabind::detail::class_registry class_registry; + typedef luabind::detail::class_rep class_rep; + bool is_derived_from(class_rep* a, class_rep* base) + { + YAKE_ASSERT( a && base ); + typedef luabind::detail::class_rep::base_info base_info; + typedef std::vector<base_info> baselist; + const baselist& bases = a->bases(); + YAKE_FOR_EACH( baselist::const_iterator, it, bases ) + { + const base_info& bi = *it; + if (bi.base == base) + return true; + if (is_derived_from(bi.base, base)) + return true; + } + return false; + } + int ent_event_metatable_index(lua_State* L) + { + luaL_argcheck(L, lua_islightuserdata(L,lua_upvalueindex(1)), 1, "expected to be lightuserdata (ent::Object*)" ); + ent::Object* ent = (ent::Object*)(lua_touserdata(L,lua_upvalueindex(1))); + YAKE_ASSERT( ent ); + luaL_argcheck(L, lua_isstring(L,-1), 2, "key expected to be of type string"); + const char* key = lua_tostring(L,-1); + Object::Event::pointer evt = ent->events().get(key); + if (!evt) + { + lua_pushnil(L); + return 1; + } + luabind::object ret(L,evt); + ret.push(L); + return 1; + } + int ent_event_create(lua_State* L) + { + luaL_argcheck(L, lua_islightuserdata(L,lua_upvalueindex(1)), 1, "expected to be lightuserdata (ent::Object*)" ); + ent::Object* ent = (ent::Object*)(lua_touserdata(L,lua_upvalueindex(1))); + YAKE_ASSERT( ent ); + luaL_argcheck(L, lua_isstring(L,-1), 2, "key expected to be of type string"); + const char* key = lua_tostring(L,-1); + Object::Event::pointer evt = ent->events().get(key); + if (!evt) + evt = ent->events().createAndAdd(key); + if (!evt) + { + lua_pushnil(L); + return 1; + } + luabind::object ret(L,evt); + ret.push(L); + return 1; + } + int ent_event_metatable_gc(lua_State* L) + { + LuaStack stack(L); + YAKE_ASSERT( false ).debug("ent_event_metatable_gc not implemented"); + stack.dumpTable(); + return 1; + } + //---- + int ent_property_metatable_index(lua_State* L) + { + luaL_argcheck(L, lua_islightuserdata(L,lua_upvalueindex(1)), 1, "expected to be lightuserdata (ent::Object*)" ); + ent::Object* ent = (ent::Object*)(lua_touserdata(L,lua_upvalueindex(1))); + YAKE_ASSERT( ent ); + luaL_argcheck(L, lua_isstring(L,-1), 2, "key expected to be of type string"); + const char* key = lua_tostring(L,-1); + PropertyPtr prop = ent->properties().get(key); + if (!prop) + { + lua_pushnil(L); + return 1; + } + luabind::converters::convert_cpp_to_lua( L, prop->getAny() ); + return 1; + } + int ent_property_create(lua_State* L) + { + luaL_argcheck(L, lua_islightuserdata(L,lua_upvalueindex(1)), 1, "expected to be lightuserdata (ent::Object*)" ); + ent::Object* ent = (ent::Object*)(lua_touserdata(L,lua_upvalueindex(1))); + YAKE_ASSERT( ent ); + luaL_argcheck(L, lua_isstring(L,-2), 2, "key expected to be of type string"); + const char* key = lua_tostring(L,-2); + PropertyPtr prop = ent->properties().get(key); + if (prop) + { + luabind::object ret(L,prop.get()); + ret.push(L); + return 1; + } + + // @todo less conversions possible? + boost::any value = luabind::converters::convert_lua_to_cpp( L, luabind::detail::by_value<boost::any>(), -1 ); + prop = property::createPropertyFromAny( value ); + if (!prop) + { + lua_pushnil(L); + return 1; + } + ent->properties().add( key, prop ); + luabind::object ret(L,prop.get()); + ret.push(L); + return 1; + } + int ent_property_metatable_gc(lua_State* L) + { + LuaStack stack(L); + YAKE_ASSERT( false ).debug("ent_property_metatable_gc not implemented"); + stack.dumpTable(); + return 1; + } + //---- + int redirect_luabind_cppclass_metatable_index(lua_State* L) + { + LuaStack stack(L); +#if HIJACK_CPPINSTANCE == 1 + + // __index(t,k) => t in -2, k in -1 + + const int keyType = lua_type(L, -1); // 4=LUA_TSTRING //@todo support for numbers etc? + luaL_argcheck( L, lua_isstring(L,-1), 1, "Luabind class metatable expected" ); + const char* key = lua_tostring(L,-1); + + int t2 = lua_type(L, -2); // 7=LUA_TUSERDATA + luaL_argcheck( L, lua_isuserdata(L,-2), 1, "Luabind class metatable expected" ); + + // + //object_rep* obj = static_cast<object_rep*>(lua_touserdata(L, -2)); + object_rep* obj = luabind::detail::is_class_object(L,-2); + + // in upvalue there's the original __index function as created by Luabind + int up = lua_upvalueindex(1); + + // Run original Luabind __index function. + // Prepare parameters (same as for this __index replacement) + // like __index(t,k) where t @ -2 and k @ -1. + // + + luaL_checktype(L,up,LUA_TFUNCTION); + stack.pushvalue(up); // push original __index (stored in upvalue) + luaL_checktype(L,-1,LUA_TFUNCTION); // just to be sure. + + luaL_checktype(L,-3,LUA_TUSERDATA); + stack.pushvalue(-3); // push userdata/object + + luaL_checktype(L,-3,keyType); + stack.pushvalue(-3); // push index + + // Call original Lua __index meta function + // 2 args, 1 return value + int errcode = lua_pcall(L, 2, 1, 0); //@todo error handler? + if (errcode != 0) + { + const std::string fn = lua_tostring(L,-1); + YAKE_ASSERT( false )(errcode)(fn).debug("error running __index"); + lua_pop(L,1); + lua_pushnil(L); + } + else // NB return value is in -1 + { + const int rt = lua_type(L,-1); + if (rt == LUA_TNIL && obj) + { + class_rep* objCls = obj->crep(); + YAKE_ASSERT( objCls ); + + // retrieve base class info for objects with 'dynamic properties': + // ent::Object: + class_registry* reg = luabind::detail::class_registry::get_registry(L); + YAKE_ASSERT( reg ); + class_rep* root = reg->find_class( LUABIND_TYPEID(Object) ); + YAKE_ASSERT( root ); + + // determine whether obj's class is derived from this class: + // Q: do we need the cast or does convert_to() handle this? + // A: Yes, we have to do this as convert_to() results in assert() if + // cast fails. + if (is_derived_from( objCls, root )) + { + void* p1 = 0; //@todo find out what's this for. + void* p = objCls->convert_to( LUABIND_TYPEID(Object), obj, p1 ); + Object* ent = reinterpret_cast<Object*>(p); + if (ent) // <- I don't know of any case where this fails but to be safe... + { + // There's probably a very simple way to implement this 'properly', + // .i.e via a table key. + if (strcmp(key,"events") == 0) + { + // Return pseudo-events table instead + + lua_pop(L,1); // pop the 'nil' + + // 'events' table + lua_newtable(L); + lua_pushstring(L,"magic"); + lua_pushnumber(L,123); + lua_rawset(L,-3); + + lua_pushstring(L,"create"); + lua_pushlightuserdata(L,ent); + lua_pushcclosure(L,ent_event_create,1); + lua_rawset(L,-3); + + lua_pushstring(L,"__gc"); + lua_pushlightuserdata(L,ent); + lua_pushcclosure(L,ent_event_metatable_gc,1); + lua_rawset(L,-3); + + + // metatable for 'events' table + lua_newtable(L); + + lua_pushstring(L,"__gc"); + lua_pushlightuserdata(L,ent); + lua_pushcclosure(L,ent_event_metatable_gc,1); + lua_rawset(L,-3); + + //stack.dump(-2); + //stack.dumpTable(); + + lua_pushstring(L,"__index"); + lua_pushlightuserdata(L,ent); + lua_pushcclosure(L,ent_event_metatable_index,1); + lua_rawset(L,-3); + + //stack.dump(-2); + //stack.dumpTable(); + + /* + lua_pushstring(L,"__call"); + lua_pushlightuserdata(L,ent); + lua_pushcclosure(L,ent_event_metatable_call,0); + lua_rawset(L,-3); + */ + + lua_setmetatable(L,-2); + /* + luaL_checktype(L, -2, LUA_TSTRING); // orig. param "k" + int t2 = lua_type(L, -2); + + luaL_checktype(L, -3, LUA_TUSERDATA); // orig. param "t" + int t3 = lua_type(L, -3); + */ + } + else if (strcmp(key,"properties") == 0) + { + // Return pseudo-properties table instead + + lua_pop(L,1); // pop the 'nil' + + // 'properties' table + lua_newtable(L); + lua_pushstring(L,"magic"); + lua_pushnumber(L,123); + lua_rawset(L,-3); + + lua_pushstring(L,"create"); + lua_pushlightuserdata(L,ent); + lua_pushcclosure(L,ent_property_create,1); + lua_rawset(L,-3); + + lua_pushstring(L,"__gc"); + lua_pushlightuserdata(L,ent); + lua_pushcclosure(L,ent_property_metatable_gc,1); + lua_rawset(L,-3); + + + // metatable for 'properties' table + lua_newtable(L); + + lua_pushstring(L,"__gc"); + lua_pushlightuserdata(L,ent); + lua_pushcclosure(L,ent_property_metatable_gc,1); + lua_rawset(L,-3); + + lua_pushstring(L,"__index"); + lua_pushlightuserdata(L,ent); + lua_pushcclosure(L,ent_property_metatable_index,1); + lua_rawset(L,-3); + + lua_setmetatable(L,-2); + } + else + { + PropertyPtr prop = ent->properties().get(key); + if (prop) + { + lua_pop(L,1); // pop the 'nil' from pcall + // use yake.lua.any_converter: + luabind::converters::convert_cpp_to_lua(L,prop->getAny()); + } + } + } + } + } + } +#endif + return 1; + } + //------------------------------------------------------------------------- YAKE_WRAP_BINDER(ent,::yake::ent::bind); @@ -487,6 +875,14 @@ { luabind::call_function<void>(vm->getLuaState(),"main"); } + catch (luabind::error& ex) + { + const char* code = lua_tostring( ex.state(), -1 ); + err += ex.what(); + err += ":"; + err += code; + YAKE_LOG_ERROR("ent.lua",String("LuaFsmObjectListener.onInit:") + code); + } catch (std::exception& ex) { err = ex.what(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-07 13:56:37
|
Revision: 1840 http://yake.svn.sourceforge.net/yake/?rev=1840&view=rev Author: psyclonist Date: 2007-09-07 06:56:40 -0700 (Fri, 07 Sep 2007) Log Message: ----------- * new materials Added Paths: ----------- trunk/yake/common/media/graphics.materials/scripts/helpers.material Added: trunk/yake/common/media/graphics.materials/scripts/helpers.material =================================================================== --- trunk/yake/common/media/graphics.materials/scripts/helpers.material (rev 0) +++ trunk/yake/common/media/graphics.materials/scripts/helpers.material 2007-09-07 13:56:40 UTC (rev 1840) @@ -0,0 +1,31 @@ +material trigger_off +{ + receive_shadows on + technique + { + pass + { + ambient .5 .5 .5 + diffuse 0.5 0.5 1.0 0.5 + + //scene_blend add add seems nice for rendering a moon on a sky... + scene_blend alpha_blend + depth_check off + } + } +} +material trigger_on +{ + receive_shadows on + technique + { + pass + { + ambient .5 .5 .5 + diffuse 1.0 0.5 0.5 0.5 + + scene_blend alpha_blend + depth_check off + } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-07 13:56:14
|
Revision: 1839 http://yake.svn.sourceforge.net/yake/?rev=1839&view=rev Author: psyclonist Date: 2007-09-07 06:56:18 -0700 (Fri, 07 Sep 2007) Log Message: ----------- * [sample/raf/lua2] refactored to 'trigger sample' Modified Paths: -------------- trunk/yake/samples/raf/lua2/demo.cpp Modified: trunk/yake/samples/raf/lua2/demo.cpp =================================================================== --- trunk/yake/samples/raf/lua2/demo.cpp 2007-09-07 13:55:40 UTC (rev 1838) +++ trunk/yake/samples/raf/lua2/demo.cpp 2007-09-07 13:56:18 UTC (rev 1839) @@ -413,6 +413,11 @@ try { luabind::call_function<void>( L, "onFrame", timeElapsed ); } + catch (luabind::error& ex) + { + const char* code = lua_tostring(L,-1); + YAKE_LOG_ERROR("demo",String(ex.what()) + ":" + code); + } catch (std::exception& ex) { YAKE_LOG_ERROR("demo",ex.what()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-09-07 13:55:39
|
Revision: 1838 http://yake.svn.sourceforge.net/yake/?rev=1838&view=rev Author: psyclonist Date: 2007-09-07 06:55:40 -0700 (Fri, 07 Sep 2007) Log Message: ----------- * [scriptingLua] improved error reporting Modified Paths: -------------- trunk/yake/src/plugins/scriptingLua/ScriptingSystemLua.cpp Modified: trunk/yake/src/plugins/scriptingLua/ScriptingSystemLua.cpp =================================================================== --- trunk/yake/src/plugins/scriptingLua/ScriptingSystemLua.cpp 2007-09-07 13:55:12 UTC (rev 1837) +++ trunk/yake/src/plugins/scriptingLua/ScriptingSystemLua.cpp 2007-09-07 13:55:40 UTC (rev 1838) @@ -158,7 +158,10 @@ catch (luabind::error& e) { logging::log(logging::S_ERROR,"scriptingLua","Luabind error"); - throw Exception(String("LuaVM: caught Luabind error") + e.what()); + + const char* code = lua_tostring( e.state(), -1 ); + + throw Exception(String("LuaVM: caught Luabind error") + e.what() + code); } catch (luabind::cast_failed& e) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |