[Yake-svn] SF.net SVN: yake: [1679] trunk/yake
Status: Beta
Brought to you by:
psyclonist
From: <psy...@us...> - 2007-03-16 02:42:56
|
Revision: 1679 http://svn.sourceforge.net/yake/?rev=1679&view=rev Author: psyclonist Date: 2007-03-15 19:42:57 -0700 (Thu, 15 Mar 2007) Log Message: ----------- fixed various issues related to logging, DLL handling, exceptions Modified Paths: -------------- trunk/yake/samples/cmdrmayhem/yakeDemo.cpp trunk/yake/samples/common/exapp/yakeExampleApplication.h trunk/yake/samples/gui/console/yakeConsoleDemo.cpp trunk/yake/samples/net/packet/demo.cpp trunk/yake/samples/physics/demo/yakeDemo.cpp trunk/yake/src/base/native/win32/yakeConfig.cpp trunk/yake/src/plugins/graphicsOgre/graphicsOgreCore.cpp trunk/yake/yake/gui_addons/console/yakeConsoleLuaProcessor.h Removed Paths: ------------- trunk/yake/samples/net/packet/pch.cpp trunk/yake/samples/physics/demo/pch.cpp Modified: trunk/yake/samples/cmdrmayhem/yakeDemo.cpp =================================================================== --- trunk/yake/samples/cmdrmayhem/yakeDemo.cpp 2007-03-16 02:40:39 UTC (rev 1678) +++ trunk/yake/samples/cmdrmayhem/yakeDemo.cpp 2007-03-16 02:42:57 UTC (rev 1679) @@ -247,8 +247,9 @@ using namespace input; // load key<->action bindings - ActionMap::loadFromFile( actionMap, "../../media/samples/character/demo.actionmap.txt", keyboard, - boost::bind(&ControllableCharacter::addInputConditionConnection,this,_1) ); + if (!ActionMap::loadFromFile( actionMap, "../../../common/media/samples/character/demo.actionmap.txt", keyboard, + boost::bind(&ControllableCharacter::addInputConditionConnection,this,_1) )) + throw Exception("could not load action map"); // bind functions/callbacks to input actions this->addInputSignalConnection( Modified: trunk/yake/samples/common/exapp/yakeExampleApplication.h =================================================================== --- trunk/yake/samples/common/exapp/yakeExampleApplication.h 2007-03-16 02:40:39 UTC (rev 1678) +++ trunk/yake/samples/common/exapp/yakeExampleApplication.h 2007-03-16 02:42:57 UTC (rev 1679) @@ -57,6 +57,7 @@ SharedPtr< input::IInputSystem > mInputSystem; SharedPtr< audio::IAudioSystem > mAudioSystem; bool mShutdownRequested; + SharedPtr< logging::log_listener > mFileLogger; protected: input::KeyboardEventGenerator mKeyboardEventGenerator; input::MouseEventGenerator mMouseEventGenerator; @@ -81,12 +82,16 @@ mLoadScriptingBindings( loadScriptingBindings ), mLoadAudioSystem( loadAudio ) { + mFileLogger.reset( new logging::file_listener("exapp.log") ); + logging::addListener( mFileLogger.get() ); } virtual ~ExampleApplication() { destroyAllSystems(); unloadAllPlugins(); + logging::removeListener( mFileLogger.get() ); + mFileLogger.reset(); } void requestShutdown() Modified: trunk/yake/samples/gui/console/yakeConsoleDemo.cpp =================================================================== --- trunk/yake/samples/gui/console/yakeConsoleDemo.cpp 2007-03-16 02:40:39 UTC (rev 1678) +++ trunk/yake/samples/gui/console/yakeConsoleDemo.cpp 2007-03-16 02:42:57 UTC (rev 1679) @@ -40,15 +40,12 @@ // Yake #include <yake/base/yake.h> -#include <yake/base/yakeDebugOutputStream.h> -#include <yake/base/yakeLog.h> -#include <yake/base/yakeLibrary.h> #include <yake/scripting/yakeScriptingSystem.h> #include <yake/plugins/scriptingLua/ScriptingSystemLua.h> #include <yake/graphics/yakeGraphicsSystem.h> +#include <yake/data/yakeData.h> -#include <yake/samples/common/yakeExampleApplication.h> -#include <yake/data/yakeData.h> +#include <samples/common/exapp/yakeExampleApplication.h> #include <yake/common/yakeCEGUIRendererAdapter.h> #include <yake/common/yakeCEGUIHelpers.h> #include <yake/model/model.h> @@ -318,12 +315,12 @@ if (mListBox) mConsole.setOutputWidget( mListBox ); - yake::scripting::IVM* pVM = getScriptingSystem().createVM(); - YAKE_ASSERT( pVM ); + yake::scripting::VMPtr vm = getScriptingSystem().createVM(); + YAKE_ASSERT( vm ); - mConsole.setScriptingVirtualMachine( pVM ); + mConsole.setScriptingVirtualMachine( vm ); - scripting::LuaVM* pL = static_cast<scripting::LuaVM*>( pVM ); + scripting::LuaVM* pL = static_cast<scripting::LuaVM*>( vm.get() ); YAKE_ASSERT( pL ); if (!pL) return; @@ -350,8 +347,8 @@ // executing console initialisation script //pL->execute( "dofile( '../../../media/gui.addons.scripts/console_redirect.lua' );" ); - SharedPtr<scripting::IScript> script( getScriptingSystem().createScriptFromFile("../../../common/media/gui.addons.scripts/console_redirect.lua")); - pL->execute( script.get() ); + scripting::ScriptPtr script( getScriptingSystem().createScriptFromFile("../../../common/media/gui.addons.scripts/console_redirect.lua")); + pL->execute( script ); } /** @@ -503,11 +500,16 @@ theApp.initialise(); theApp.run(); } - catch ( const yake::Exception& rException ) + catch ( yake::Exception& rException ) { YAKE_LOG_ERROR( "demo", rException.what() ); std::cin.get(); } + catch ( ... ) + { + YAKE_LOG_ERROR( "demo", "Caught unhandled exception." ); + std::cin.get(); + } return 0; } Modified: trunk/yake/samples/net/packet/demo.cpp =================================================================== --- trunk/yake/samples/net/packet/demo.cpp 2007-03-16 02:40:39 UTC (rev 1678) +++ trunk/yake/samples/net/packet/demo.cpp 2007-03-16 02:42:57 UTC (rev 1679) @@ -1,7 +1,7 @@ -#include <yake/samples/net/packet/pch.h> +#include <yake/base/yakePrerequisites.h> #include <yake/net/net.h> #include <yake/base/yake.h> // for YAKE_ASSERT etc -#include <yake/samples/net/common/common.h> +#include <boost/bind.hpp> using namespace yake; @@ -111,8 +111,13 @@ YAKE_LOG_INFORMATION_X(" client " << peerId << " packet(size=" << pckt->payload().size() << ") on channel " << int(channel) << "\n"); } +#include <yake/base/yakeStderrLog.h> + int main(int argc, char* argv[]) { + SharedPtr<logging::log_listener> to_stderr( new logging::stderr_listener() ); + logging::addListener( to_stderr.get() ); + net::initialize(); // server @@ -136,9 +141,12 @@ //net::native::sleep(500); // unfortunately, this is still necessary... // main loop - YAKE_LOG("demo","waiting for key press..."); + YAKE_LOG("demo","(running for 5 seconds...)"); bool sentHello = false; - while (!_kbhit()) + size_t time = 0; + net::Timer t; + t.start(); + while (t.getTime() < 5.) { net::native::sleep(10); net::update(); @@ -150,8 +158,6 @@ sentHello = true; } } - if (_kbhit()) - _getch(); // cleanup YAKE_LOG("demo","stopping clients...\n"); Deleted: trunk/yake/samples/net/packet/pch.cpp =================================================================== --- trunk/yake/samples/net/packet/pch.cpp 2007-03-16 02:40:39 UTC (rev 1678) +++ trunk/yake/samples/net/packet/pch.cpp 2007-03-16 02:42:57 UTC (rev 1679) @@ -1 +0,0 @@ -#include <yake/samples/net/packet/pch.h> Deleted: trunk/yake/samples/physics/demo/pch.cpp =================================================================== --- trunk/yake/samples/physics/demo/pch.cpp 2007-03-16 02:40:39 UTC (rev 1678) +++ trunk/yake/samples/physics/demo/pch.cpp 2007-03-16 02:42:57 UTC (rev 1679) @@ -1 +0,0 @@ -#include <yake/samples/physics/demo/pch.h> Modified: trunk/yake/samples/physics/demo/yakeDemo.cpp =================================================================== --- trunk/yake/samples/physics/demo/yakeDemo.cpp 2007-03-16 02:40:39 UTC (rev 1678) +++ trunk/yake/samples/physics/demo/yakeDemo.cpp 2007-03-16 02:42:57 UTC (rev 1679) @@ -1,4 +1,4 @@ -#include <yake/samples/physics/demo/pch.h> +#include <yake/base/yake.h> #include <yake/graphics/yakeGraphicsSystem.h> #include <yake/physics/yakePhysics.h> @@ -237,7 +237,7 @@ // physics 2 #ifdef USE_SECOND_PHYSICS_PLUGIN - pLib = loadLib("physicsNX" ); + SharedPtr<base::Library> pLib2 = loadLib("physicsNX" ); YAKE_ASSERT( pLib ).debug("Cannot load physics plugin 2."); mPhysics2 = templates::create< physics::IPhysicsSystem >("nx"); @@ -249,8 +249,8 @@ #endif // graphics - pLib = loadLib(YAKE_DYNLIB_NAME("graphicsOgre")); - YAKE_ASSERT( pLib ).debug("Cannot load graphics plugin."); + SharedPtr<base::Library> pLibG = loadLib(YAKE_DYNLIB_NAME("graphicsOgre")); + YAKE_ASSERT( pLibG ).debug("Cannot load graphics plugin."); mGraphics = templates::create_default< graphics::IGraphicsSystem >(); YAKE_ASSERT( mGraphics ).debug("Cannot create graphics system."); @@ -482,7 +482,7 @@ #endif } -int main() +int main(int,char**) { try { Modified: trunk/yake/src/base/native/win32/yakeConfig.cpp =================================================================== --- trunk/yake/src/base/native/win32/yakeConfig.cpp 2007-03-16 02:40:39 UTC (rev 1678) +++ trunk/yake/src/base/native/win32/yakeConfig.cpp 2007-03-16 02:42:57 UTC (rev 1679) @@ -49,7 +49,6 @@ } // yake #pragma message("WARNING: g_hInstance is not set") -#if defined(_DLL) && 0 BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID ) { if( dwReason == DLL_PROCESS_ATTACH ) @@ -57,4 +56,3 @@ return TRUE; } -#endif Modified: trunk/yake/src/plugins/graphicsOgre/graphicsOgreCore.cpp =================================================================== --- trunk/yake/src/plugins/graphicsOgre/graphicsOgreCore.cpp 2007-03-16 02:40:39 UTC (rev 1678) +++ trunk/yake/src/plugins/graphicsOgre/graphicsOgreCore.cpp 2007-03-16 02:42:57 UTC (rev 1679) @@ -180,6 +180,7 @@ catch (Ogre::Exception& e) { mReady = false; + YAKE_LOG_ERROR("graphicsOgre",e.getFullDescription().c_str()); YAKE_GRAPHICS_EXCEPT2(e.getFullDescription().c_str(), "[yake.graphics.ogre] OGRE EXCEPTION"); } } Modified: trunk/yake/yake/gui_addons/console/yakeConsoleLuaProcessor.h =================================================================== --- trunk/yake/yake/gui_addons/console/yakeConsoleLuaProcessor.h 2007-03-16 02:40:39 UTC (rev 1678) +++ trunk/yake/yake/gui_addons/console/yakeConsoleLuaProcessor.h 2007-03-16 02:42:57 UTC (rev 1679) @@ -48,7 +48,7 @@ * Set scripting virtual machine to use as input interpreter * @param pLuaVM Pointer to Lua virtual machine */ - void setScriptingVirtualMachine( yake::scripting::IVM* pLuaVM ) + void setScriptingVirtualMachine( yake::scripting::VMPtr pLuaVM ) { YAKE_ASSERT( pLuaVM != NULL ).error( "Oh no! How could you do that?!! Monster!" ); lua_ = pLuaVM; @@ -66,7 +66,7 @@ private: /// Pointer to Lua scripting VM - yake::scripting::IVM* lua_; + yake::scripting::VMPtr lua_; }; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |