yake-svn Mailing List for Yake Engine (Page 15)
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-03-21 23:35:49
|
Revision: 1687 http://svn.sourceforge.net/yake/?rev=1687&view=rev Author: psyclonist Date: 2007-03-21 16:35:45 -0700 (Wed, 21 Mar 2007) Log Message: ----------- more options Modified Paths: -------------- trunk/yake/scripts/premake/config.lua trunk/yake/scripts/premake/yake.lua Modified: trunk/yake/scripts/premake/config.lua =================================================================== --- trunk/yake/scripts/premake/config.lua 2007-03-20 21:22:35 UTC (rev 1686) +++ trunk/yake/scripts/premake/config.lua 2007-03-21 23:35:45 UTC (rev 1687) @@ -46,9 +46,10 @@ -- the compilation of the binding code for this component and thereby -- save compilation time. ENABLE_LUA_BASE = true -- includes 'base' and 'math' binders -ENABLE_LUA_ENT = true -- 'ent' binder ENABLE_LUA_MODEL = true -- 'model' binder ENABLE_LUA_TASK = true -- 'task' binder (+executor) +ENABLE_LUA_PROPERTY = true -- 'property' binder +ENABLE_LUA_ENT = true -- 'ent' binder (requires BASE, MODEL and PROPERTY binders!) -------------------------------------- -- Samples Modified: trunk/yake/scripts/premake/yake.lua =================================================================== --- trunk/yake/scripts/premake/yake.lua 2007-03-20 21:22:35 UTC (rev 1686) +++ trunk/yake/scripts/premake/yake.lua 2007-03-21 23:35:45 UTC (rev 1687) @@ -10,6 +10,28 @@ dofile("tools.lua") -------------------------------------- +-- configuration checks +-------------------------------------- +if LUA_BINDINGS then + + -- Enable ENABLE_LUA_BASE because without it most of the other Lua bindings won't work, anyway. + if not ENABLE_LUA_BASE then + ENABLE_LUA_BASE = true + print("WARNING: ENABLE_LUA_BASE automatically enabled due to LUA_BINDINGS!") + end + + -- Other checks: + if ENABLE_LUA_ENT and not ENABLE_LUA_PROPERTY then + print("ERROR: ENABLE_LUA_ENT requires ENABLE_LUA_PROPERTY to be enabled, too!") + return 3 + end + if ENABLE_LUA_ENT and not ENABLE_LUA_MODEL then + print("ERROR: ENABLE_LUA_ENT requires ENABLE_LUA_MODEL to be enabled, too!") + return 3 + end +end + +-------------------------------------- -- project setup -------------------------------------- @@ -47,9 +69,10 @@ f:write("#define YAKE_LIBFILE_PREFIX \"" .. LIBFILE_PREFIX .. "\"\n") f:write("#define YAKE_LUA_BINDINGS " .. bool_to_int(LUA_BINDINGS) .. "\n") f:write("#define YAKE_ENABLE_LUA_BASE " .. bool_to_int(ENABLE_LUA_BASE) .. "\n") - f:write("#define YAKE_ENABLE_LUA_ENT " .. bool_to_int(ENABLE_LUA_ENT) .. "\n") f:write("#define YAKE_ENABLE_LUA_MODEL " .. bool_to_int(ENABLE_LUA_MODEL) .. "\n") f:write("#define YAKE_ENABLE_LUA_TASK " .. bool_to_int(ENABLE_LUA_TASK) .. "\n") + f:write("#define YAKE_ENABLE_LUA_ENT " .. bool_to_int(ENABLE_LUA_ENT) .. "\n") + f:write("#define YAKE_ENABLE_LUA_PROPERTY " .. bool_to_int(ENABLE_LUA_PROPERTY) .. "\n") f:write("\n") f:write("#endif\n") io.close(f) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-20 21:36:29
|
Revision: 1684 http://svn.sourceforge.net/yake/?rev=1684&view=rev Author: psyclonist Date: 2007-03-20 14:19:32 -0700 (Tue, 20 Mar 2007) Log Message: ----------- provided static add() function for easy log listener registration, made destructor of log_listener auto-deregister listener Modified Paths: -------------- trunk/yake/src/base/yakeFileLog.cpp trunk/yake/src/base/yakeStderrLog.cpp trunk/yake/yake/base/yakeFileLog.h trunk/yake/yake/base/yakeLog.h trunk/yake/yake/base/yakeStderrLog.h Modified: trunk/yake/src/base/yakeFileLog.cpp =================================================================== --- trunk/yake/src/base/yakeFileLog.cpp 2007-03-20 21:17:35 UTC (rev 1683) +++ trunk/yake/src/base/yakeFileLog.cpp 2007-03-20 21:19:32 UTC (rev 1684) @@ -48,6 +48,12 @@ formatLogMessage(fp_, sev, msg, logId, procId, threadId ); fp_.flush(); } + log_listener_ptr file_listener::add(const std::string& fileName) + { + log_listener_ptr l( new file_listener(fileName) ); + addListener( l.get() ); + return l; + } } // logging } // yake Modified: trunk/yake/src/base/yakeStderrLog.cpp =================================================================== --- trunk/yake/src/base/yakeStderrLog.cpp 2007-03-20 21:17:35 UTC (rev 1683) +++ trunk/yake/src/base/yakeStderrLog.cpp 2007-03-20 21:19:32 UTC (rev 1684) @@ -49,6 +49,12 @@ else std::cerr << ss.str(); } + log_listener_ptr stderr_listener::add() + { + log_listener_ptr l( new stderr_listener() ); + addListener( l.get() ); + return l; + } } // logging } // yake Modified: trunk/yake/yake/base/yakeFileLog.h =================================================================== --- trunk/yake/yake/base/yakeFileLog.h 2007-03-20 21:17:35 UTC (rev 1683) +++ trunk/yake/yake/base/yakeFileLog.h 2007-03-20 21:19:32 UTC (rev 1684) @@ -38,6 +38,8 @@ file_listener(const std::string& fileName); virtual ~file_listener(); virtual void write(const severity_t sev, const char* msg, const char* logId, const char* procId, threadid_t threadId); + + static log_listener_ptr add(const std::string& fileName); private: std::ofstream fp_; }; Modified: trunk/yake/yake/base/yakeLog.h =================================================================== --- trunk/yake/yake/base/yakeLog.h 2007-03-20 21:17:35 UTC (rev 1683) +++ trunk/yake/yake/base/yakeLog.h 2007-03-20 21:19:32 UTC (rev 1684) @@ -33,6 +33,7 @@ #include <yake/base/yakeNoncopyable.h> #include <yake/base/yakeString.h> #include <yake/base/templates/yakeSingleton.h> +#include <yake/base/templates/yakePointer.h> #include <yake/base/native/yakeThreads.h> #include <boost/thread/mutex.hpp> @@ -62,9 +63,10 @@ /** */ struct YAKE_BASE_API log_listener : public boost::noncopyable { - virtual ~log_listener() = 0; + virtual ~log_listener(); virtual void write(const severity_t sev, const char* msg, const char* logId, const char* procId, threadid_t threadId) = 0; }; + typedef SharedPtr<log_listener> log_listener_ptr; /** */ struct YAKE_BASE_API logger : public boost::noncopyable Modified: trunk/yake/yake/base/yakeStderrLog.h =================================================================== --- trunk/yake/yake/base/yakeStderrLog.h 2007-03-20 21:17:35 UTC (rev 1683) +++ trunk/yake/yake/base/yakeStderrLog.h 2007-03-20 21:19:32 UTC (rev 1684) @@ -39,6 +39,8 @@ stderr_listener(); virtual ~stderr_listener(); virtual void write(const severity_t sev, const char* msg, const char* logId, const char* procId, threadid_t threadId); + + static log_listener_ptr add(); }; } // namespace logging This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-20 21:35:55
|
Revision: 1685 http://svn.sourceforge.net/yake/?rev=1685&view=rev Author: psyclonist Date: 2007-03-20 14:21:04 -0700 (Tue, 20 Mar 2007) Log Message: ----------- added library 'property' along with a C++ demo Modified Paths: -------------- trunk/yake/scripts/premake/samples.lua trunk/yake/scripts/premake/yake.lua Added Paths: ----------- trunk/yake/samples/property/ trunk/yake/samples/property/demo1/ trunk/yake/samples/property/demo1/demo.cpp trunk/yake/yake/property/ trunk/yake/yake/property/accessors.h trunk/yake/yake/property/detail/ trunk/yake/yake/property/detail/property.impl.h trunk/yake/yake/property/function_accessor.h trunk/yake/yake/property/prerequisites.h trunk/yake/yake/property/property.h trunk/yake/yake/property/property_container.h trunk/yake/yake/property/stream_operators.h Added: trunk/yake/samples/property/demo1/demo.cpp =================================================================== --- trunk/yake/samples/property/demo1/demo.cpp (rev 0) +++ trunk/yake/samples/property/demo1/demo.cpp 2007-03-20 21:21:04 UTC (rev 1685) @@ -0,0 +1,99 @@ +#include <yake/property/property.h> + +using namespace yake; + +//------------------------------------------- +namespace yake { + YAKE_DEFINE_EXCEPTION(TestFailedException); +} // namespace yake + +#define ASSERT_BOOL(OP,VALUE) \ + { \ + std::cout << "-----------------------------------------------------------[\n"; \ + std::cout << "TEST: " << String(# OP) << " == " << #VALUE << "\n"; \ + if (VALUE == (OP)) \ + std::cout << "=> TEST OK\n"; \ + else \ + std::cout << "=> TEST FAILED!\n"; \ + std::cout << "]-----------------------------------------------------------\n"; \ + } + +#define ASSERT_EXCEPTION(OP,EXCEPTION) \ + { \ + try { \ + std::cout << "-----------------------------------------------------------[\n"; \ + std::cout << "TEST TRY: " << String(# OP) << "\n"; \ + OP; \ + } \ + catch (EXCEPTION&) \ + { \ + std::cout << "=> TEST OK (Caught expected exception " << # EXCEPTION << ")\n"; \ + } \ + catch (...) \ + { \ + std::cerr << "=> TEST FAILED (Caught unexpected exception instead of " << # EXCEPTION << ")\n"; \ + throw TestFailedException("TEST FAILED (Caught unexpected exception)"); \ + } \ + std::cout << "]-----------------------------------------------------------\n"; \ + } + +//------------------------------------------- +struct object : public boost::noncopyable +{ + object() + { + properties().add("name",property::makePointerProperty<String>(&name_)); + } + typedef property::PropertyContainer<String> property_container_t; + property_container_t& properties() + { return props_; } + const property_container_t& properties() const + { return props_; } +private: + property_container_t props_; + String name_; +}; +#include <yake/base/yakeStderrLog.h> + +//------------------------------------------- +int main(int argc,char* argv[]) +{ + logging::log_listener_ptr to_stderr = logging::stderr_listener::add(); + + using namespace yake::property; // We don't expect collisions in this demo. + + try { + //property_def<int,storage_accessor> i_s(12); + //property<int> p_i(new storage_accessor<int>()); + + { + object o; + // indirect access via property_base and boost::any: + o.properties().get("name").setAny(String("o1")); + boost::any_cast<String>(o.properties().get("name").getAny()); + } + + { + PropertyContainer<String> props; + props.add("a", makeValueProperty<int>(33)); + //props += std::make_pair(String("a"),property_ptr(newValueProperty<int>(33))); + ASSERT_BOOL( props.has("a"), true ); + ASSERT_EXCEPTION(props.add("a",0),InvalidInputException); + ASSERT_EXCEPTION(props.add("a",makeValueProperty<int>(33)),AlreadyExistsException); + ASSERT_EXCEPTION(props.get("noname"),NotFoundException); + std::cout << "'a' : " << props.get("a") << "\n"; + try_cast_set<int>(props.get("a"),44); + try_cast<int>(props.get("a")).set(55); + ASSERT_EXCEPTION( try_cast_set<String>(props.get("a"),"66"), BadCastException ); + std::cout << props << "\n"; + } + } + catch (std::exception& ex) + { + std::cerr << "----------------------------------------------------\n"; + std::cerr << "EXCEPTION: " << ex.what() << "\n"; + std::cerr << "----------------------------------------------------\n"; + } + + return 0; +} Modified: trunk/yake/scripts/premake/samples.lua =================================================================== --- trunk/yake/scripts/premake/samples.lua 2007-03-20 21:19:32 UTC (rev 1684) +++ trunk/yake/scripts/premake/samples.lua 2007-03-20 21:21:04 UTC (rev 1685) @@ -101,6 +101,11 @@ useDep("luabind") -------------------------------------- +makeSample("sampleProperty1","samples/property/demo1") +sampleUsesConsole() +useComponent("base") + +-------------------------------------- if SAMPLES_NET then makeSample("sampleNetPacket","samples/net/packet") sampleUsesConsole() Modified: trunk/yake/scripts/premake/yake.lua =================================================================== --- trunk/yake/scripts/premake/yake.lua 2007-03-20 21:19:32 UTC (rev 1684) +++ trunk/yake/scripts/premake/yake.lua 2007-03-20 21:21:04 UTC (rev 1685) @@ -184,6 +184,10 @@ --addDependency("base") -------------------------------------- +makeComponent("property","YAKE_PROPERTY_EXPORTS") +addDependency("base") + +-------------------------------------- makeComponent("task","YAKE_TASK_EXPORTS") addDependency("base") Added: trunk/yake/yake/property/accessors.h =================================================================== --- trunk/yake/yake/property/accessors.h (rev 0) +++ trunk/yake/yake/property/accessors.h 2007-03-20 21:21:04 UTC (rev 1685) @@ -0,0 +1,105 @@ +/* + ------------------------------------------------------------------------------------ + 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_PROPERTY_ACCESSORS_H +#define YAKE_PROPERTY_ACCESSORS_H + +#include "prerequisites.h" +#include <boost/function.hpp> + +namespace yake { +namespace property { + + //------------------------------------------- + // accessors + //------------------------------------------- + + template<typename T> + struct AccessorBase + { + virtual ~AccessorBase() = 0; + virtual void set(const T&) = 0; + virtual T get() const = 0; + }; + template<typename T> + AccessorBase<T>::~AccessorBase() {} + + + // + + template<typename T> + class ValueHolder : public AccessorBase<T> + { + public: + ValueHolder() + {} + ValueHolder(const T& initialValue) : value_(initialValue) + {} + virtual void set(const T& rhs) + { value_ = rhs; } + virtual T get() const + { return value_; } + protected: + T value_; + }; + template<typename T, typename ArgT> + inline ValueHolder<T>* makeValueHolder(const ArgT& defaultValue = ArgT()) + { + return new ValueHolder<T>(defaultValue); + } + + template<typename T> + class PointerAccessor : public AccessorBase<T> + { + public: + typedef T* value_ptr; + PointerAccessor(value_ptr px) : px_(px) + { + assert( px_ ); + } + void set(const T& v) + { + assert( px_ ); + *px_ = v; + } + T get() const + { + assert( px_ ); + return *px_; + } + private: + value_ptr px_; + }; + template<typename T> + inline PointerAccessor<T>* makePointerAccessor(T* px) + { + return new PointerAccessor<T>(px); + } + +} // namespace prop +} // namespace yake + +#endif Added: trunk/yake/yake/property/detail/property.impl.h =================================================================== --- trunk/yake/yake/property/detail/property.impl.h (rev 0) +++ trunk/yake/yake/property/detail/property.impl.h 2007-03-20 21:21:04 UTC (rev 1685) @@ -0,0 +1,160 @@ +/* + ------------------------------------------------------------------------------------ + 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_PROPERTY_IMPL_H +#define YAKE_PROPERTY_IMPL_H + +#include "../prerequisites.h" +#include "../accessors.h" +#include "../function_accessor.h" +#include <yake/base/templates/yakeSignals.h> +#include <yake/base/templates/yakePointer.h> +#include <yake/base/templates/yakeSmartAssert.h> + +namespace yake { +namespace property { + + struct PropertyBase; + typedef SharedPtr<PropertyBase> PropertyPtr; + + /** */ + struct PropertyBase : public boost::noncopyable + { + PropertyBase(const String& type, const type_info* typeInfo) : typeName_(type), typeInfo_(typeInfo) + { + } + virtual ~PropertyBase() + { + } + + const String& type() const + { + return typeName_; + } + const type_info* typeinfo() const + { + return typeInfo_; + } + + // signals + typedef boost::signal<void(void)> ValueChanged; + ValueChanged valueChanged; + + // from/to boost::any + virtual void setAny(const boost::any& v) = 0; + virtual void getAny(boost::any& out) const = 0; + boost::any getAny() const + { + boost::any out; + this->getAny(out); + return out; + } + + // streams + void out(std::ostream& out) const + { + out << "property<" << typeName_ << ">"; + } + private: + String typeName_; + //property_def_base& def_; + const type_info* typeInfo_; + }; + + /** */ + template<typename T> + struct Property : public PropertyBase + { + typedef AccessorBase<T> accessor_t; + + template<template <typename> class AccT> + Property(AccT<T>* a) : PropertyBase(getCleanTypeName<T>(),&typeid(T)), acc(a) + { + } + virtual ~Property() + { + } + void set(const T& v) + { + acc->set(v); + } + T get() const + { + return acc->get(); + } + // with boost::any support: + virtual void setAny(const boost::any& v) + { + try { + acc->set( boost::any_cast<T>(v) ); + } + catch (boost::bad_any_cast&) + { + throw; + } + } + virtual void getAny(boost::any& out) const + { + out = acc->get(); + } + private: + SharedPtr<accessor_t> acc; + }; + + template<typename T> + Property<T>& try_cast(PropertyBase& prop) + { + //YAKE_ASSERT( &typeid(T) == prop.typeinfo() ); + if (&typeid(T) != prop.typeinfo()) + throw BadCastException(String("try_cast<> failed: '") + getCleanTypeName<T>() + + "' to '" + prop.typeinfo()->name() + "'."); + typedef Property<T> to_t; + return static_cast<to_t&>(prop); + } + template<typename T/*, template <typename> class AccT*/> + void try_cast_set(PropertyBase& prop, const T& newValue) + { + typedef Property<T> to_t; + to_t& propCasted = try_cast<T>(prop); + propCasted.set( newValue ); + } + template<typename T> + void try_cast_set_from_any(PropertyBase& prop, const boost::any& rhs) + { + //YAKE_ASSERT( &typeid(T) == rhs.typeinfo() ); + if (&typeid(T) != rhs.typeinfo()) + throw BadCastException(String("try_cast_set_from_any<> failed: bad cast")); + //safe: + //prop.setAny(rhs); // from any + + //fast: + try_cast_set<T>(prop, boost::any_cast<T>(rhs)); // may throw! + } +} // namespace property +} // namespace yake + +#endif + Added: trunk/yake/yake/property/function_accessor.h =================================================================== --- trunk/yake/yake/property/function_accessor.h (rev 0) +++ trunk/yake/yake/property/function_accessor.h 2007-03-20 21:21:04 UTC (rev 1685) @@ -0,0 +1,69 @@ +/* + ------------------------------------------------------------------------------------ + 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_PROPERTY_FUNCTION_ACCESSOR_H +#define YAKE_PROPERTY_FUNCTION_ACCESSOR_H + +#include "accessors.h" +#include <boost/function.hpp> + +namespace yake { +namespace property { + + //------------------------------------------- + // SetGetAccessor + //------------------------------------------- + + template<typename T> + struct FunctionAccessor : public AccessorBase<T> + { + typedef boost::function<void(const T&)> SetT; + typedef boost::function<T(void)> GetT; + FunctionAccessor(const SetT& setFn, const GetT& getFn) : setFn_(setFn), getFn_(getFn) + { + } + virtual void set(const T& v) + { + setFn_(v); + } + virtual T get() const + { + return getFn_(); + } + private: + SetT setFn_; + GetT getFn_; + }; + template<typename T> + inline FunctionAccessor<T>* makeFunctionAccessor(const typename FunctionAccessor<T>::SetT& setFn, const typename FunctionAccessor<T>::GetT& getFn) + { + return new FunctionAccessor<T>(setFn,getFn); + } + +} // namespace property +} // namespace yake + +#endif Added: trunk/yake/yake/property/prerequisites.h =================================================================== --- trunk/yake/yake/property/prerequisites.h (rev 0) +++ trunk/yake/yake/property/prerequisites.h 2007-03-20 21:21:04 UTC (rev 1685) @@ -0,0 +1,56 @@ +/* + ------------------------------------------------------------------------------------ + 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_PROPERTY_PREREQUISITES_H +#define YAKE_PROPERTY_PREREQUISITES_H + +#include <yake/base/yakePrerequisites.h> +#include <yake/base/yakeException.h> + +#include <map> +#include <deque> +#include <boost/any.hpp> + +namespace yake { +namespace property { + + //------------------------------------------- + template<typename T> + inline String getCleanTypeName() + { + return typeid(T).name(); + } + template<> + inline String getCleanTypeName<String>() + { + return "String"; + } + +} // namespace property +} // namespace yake + +#endif + Added: trunk/yake/yake/property/property.h =================================================================== --- trunk/yake/yake/property/property.h (rev 0) +++ trunk/yake/yake/property/property.h 2007-03-20 21:21:04 UTC (rev 1685) @@ -0,0 +1,56 @@ +/* + ------------------------------------------------------------------------------------ + 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_PROPERTY_H +#define YAKE_PROPERTY_H + +#include "prerequisites.h" +#include "accessors.h" +#include "function_accessor.h" +#include "detail/property.impl.h" //@todo exclude by default? +#include "property_container.h" //@todo exclude by default? + +#include "stream_operators.h" //@todo exclude by default? + +namespace yake { +namespace property { + + template<typename T> + inline Property<T>* makePointerProperty(T* px) + { + return new Property<T>(makePointerAccessor(px)); + } + template<typename T, typename ArgT> + inline Property<T>* makeValueProperty(const ArgT& defaultValue = ArgT()) + { + return new Property<T>(makeValueHolder<T>(defaultValue)); + } + +} // namespace property +} // namespace yake + +#endif + Added: trunk/yake/yake/property/property_container.h =================================================================== --- trunk/yake/yake/property/property_container.h (rev 0) +++ trunk/yake/yake/property/property_container.h 2007-03-20 21:21:04 UTC (rev 1685) @@ -0,0 +1,135 @@ +/* + ------------------------------------------------------------------------------------ + 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_PROPERTY_CONTAINER_H +#define YAKE_PROPERTY_CONTAINER_H + +#include "prerequisites.h" +#include "detail/property.impl.h" + +namespace yake { +namespace property { + + //------------------------------------------- + template<typename Kt> + struct DefaultErrorPolicy + { + void onNotFound(const Kt& key) + { + throw NotFoundException("id/key not found"); + } + void onInvalidInput(const String& msg) + { + throw InvalidInputException(msg); + } + void onAlreadyExists(const Kt& id) + { + throw AlreadyExistsException("id/key already exists"); + } + }; + /* + template<typename T> + struct OperatorPolicy + { + T& operator += (const property_ptr prop) + { + T::addProperty(prop); + return static_cast<T&>(*this); + } + }; + */ + template<typename Kt, template <typename> class ErrorPolicy = DefaultErrorPolicy> + struct PropertyContainer : public boost::noncopyable, public ErrorPolicy<Kt>//, public OperatorPolicy<PropertyContainer<Kt,ErrorPolicy> > + { + typedef ErrorPolicy<Kt> error_policy_t; + typedef Kt key_type; + void add(const key_type& id, PropertyBase* prop); + const PropertyBase& get(const key_type& id) const; + PropertyBase& get(const key_type& id); + bool has(const key_type& id) const; + + private: + typedef std::map<key_type,PropertyPtr> PropertyMap; + public: + typedef typename PropertyMap::const_iterator const_property_iterator; + const_property_iterator begin() const + { return properties_.begin(); } + const_property_iterator end() const + { return properties_.end(); } + + private: + PropertyMap properties_; + }; + template<typename Kt, template <typename> class ErrorPolicy> + void PropertyContainer<Kt,ErrorPolicy>::add(const key_type &id, PropertyBase *prop) + { + if (!prop) + { + this->onInvalidInput("null pointer"); + return; + } + PropertyMap::const_iterator it = properties_.find( id ); + if (it != properties_.end()) + { + this->onAlreadyExists(id); //@todo possible memory leak if client doesn't clean up "prop" + return; + } + properties_.insert( std::make_pair(id,PropertyPtr(prop)) ); + } + template<typename Kt, template <typename> class ErrorPolicy> + const PropertyBase& PropertyContainer<Kt,ErrorPolicy>::get(const key_type& id) const + { + PropertyMap::const_iterator it = properties_.find( id ); + if (it == properties_.end()) + { + this->onNotFound(id); // should throw! + throw NotFoundException("property with this id not found"); // fallback if error handler doesn't throw + } + return *it->second; + } + template<typename Kt, template <typename> class ErrorPolicy> + PropertyBase& PropertyContainer<Kt,ErrorPolicy>::get(const key_type& id) + { + PropertyMap::const_iterator it = properties_.find( id ); + if (it == properties_.end()) + { + this->onNotFound(id); // should throw! + throw NotFoundException("property with this id not found"); // fallback if error handler doesn't throw + } + return *it->second; + } + template<typename Kt, template <typename> class ErrorPolicy> + bool PropertyContainer<Kt,ErrorPolicy>::has(const key_type& id) const + { + PropertyMap::const_iterator it = properties_.find( id ); + return (it != properties_.end()); + } + +} // namespace property +} // namespace yake + +#endif + Added: trunk/yake/yake/property/stream_operators.h =================================================================== --- trunk/yake/yake/property/stream_operators.h (rev 0) +++ trunk/yake/yake/property/stream_operators.h 2007-03-20 21:21:04 UTC (rev 1685) @@ -0,0 +1,72 @@ +/* + ------------------------------------------------------------------------------------ + 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_PROPERTY_STREAM_OPERATORS_H +#define YAKE_PROPERTY_STREAM_OPERATORS_H + +#include <iostream> + +#include "prerequisites.h" +#include "accessors.h" +#include "function_accessor.h" +#include "property.h" +#include "detail/property.impl.h" +#include "property_container.h" + +namespace yake { +namespace property { + + inline std::ostream& operator << (std::ostream& out, const PropertyBase& rhs) + { + rhs.out(out); + return out; + } + + template<typename T> + inline std::ostream& operator << (std::ostream& out, const Property<T>& rhs) + { + out << "property<" << rhs.type() << ">(" << rhs.get() << ")"; + return out; + } + + template<typename Kt, typename ErrorPolicy> + inline std::ostream& operator << (std::ostream& out, const PropertyContainer<Kt,ErrorPolicy>& rhs) + { + typedef PropertyContainer<Kt,ErrorPolicy> cont_t; + out << "PropertyContainer<Kt=" << getCleanTypeName<Kt>() << ",ErrorPolicy=..." /*<< getCleanTypeName<typename cont_t::error_policy_t>() <<*/ ">(\n"; + for (cont_t::const_property_iterator it = rhs.begin(); it != rhs.end(); ++it) + { + out << " '" << it->first << "': " << *it->second << "\n"; + } + out << " )\n"; + return out; + } + +} // namespace property +} // namespace yake + +#endif + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-20 21:35:07
|
Revision: 1686 http://svn.sourceforge.net/yake/?rev=1686&view=rev Author: psyclonist Date: 2007-03-20 14:22:35 -0700 (Tue, 20 Mar 2007) Log Message: ----------- fixes Modified Paths: -------------- trunk/yake/samples/property/demo1/demo.cpp trunk/yake/src/base/yakeLog.cpp Modified: trunk/yake/samples/property/demo1/demo.cpp =================================================================== --- trunk/yake/samples/property/demo1/demo.cpp 2007-03-20 21:21:04 UTC (rev 1685) +++ trunk/yake/samples/property/demo1/demo.cpp 2007-03-20 21:22:35 UTC (rev 1686) @@ -3,6 +3,8 @@ using namespace yake; //------------------------------------------- +// primitive test harness: +//------------------------------------------- namespace yake { YAKE_DEFINE_EXCEPTION(TestFailedException); } // namespace yake @@ -53,12 +55,16 @@ property_container_t props_; String name_; }; + +//------------------------------------------- #include <yake/base/yakeStderrLog.h> +//#include <yake/base/yakeFileLog.h> //------------------------------------------- int main(int argc,char* argv[]) { logging::log_listener_ptr to_stderr = logging::stderr_listener::add(); + //logging::log_listener_ptr to_file = logging::file_listener::add("prop.log"); using namespace yake::property; // We don't expect collisions in this demo. Modified: trunk/yake/src/base/yakeLog.cpp =================================================================== --- trunk/yake/src/base/yakeLog.cpp 2007-03-20 21:21:04 UTC (rev 1685) +++ trunk/yake/src/base/yakeLog.cpp 2007-03-20 21:22:35 UTC (rev 1686) @@ -31,7 +31,10 @@ namespace yake { namespace logging { - log_listener::~log_listener() {} + log_listener::~log_listener() + { + removeListener(this); + } void formatLogMessage(std::ostream& out, const severity_t sev, const char* msg, const char* logId, const char* procId, threadid_t threadId) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-20 21:17:50
|
Revision: 1683 http://svn.sourceforge.net/yake/?rev=1683&view=rev Author: psyclonist Date: 2007-03-20 14:17:35 -0700 (Tue, 20 Mar 2007) Log Message: ----------- provided more exception types Modified Paths: -------------- trunk/yake/yake/base/yakeException.h Modified: trunk/yake/yake/base/yakeException.h =================================================================== --- trunk/yake/yake/base/yakeException.h 2007-03-16 02:48:11 UTC (rev 1682) +++ trunk/yake/yake/base/yakeException.h 2007-03-20 21:17:35 UTC (rev 1683) @@ -86,9 +86,12 @@ YAKE_DEFINE_EXCEPTION(NotFoundException); YAKE_DEFINE_EXCEPTION(AlreadyRegisteredException); + YAKE_DEFINE_EXCEPTION(AlreadyExistsException); + YAKE_DEFINE_EXCEPTION(BadCastException); YAKE_DEFINE_EXCEPTION(AllocationFailedException); + YAKE_DEFINE_EXCEPTION(InvalidInputException); -#undef YAKE_DEFINE_EXCEPTION +//#undef YAKE_DEFINE_EXCEPTION } // yake This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-16 02:48:11
|
Revision: 1682 http://svn.sourceforge.net/yake/?rev=1682&view=rev Author: psyclonist Date: 2007-03-15 19:48:11 -0700 (Thu, 15 Mar 2007) Log Message: ----------- added reference to manual Modified Paths: -------------- trunk/yake/BUILD trunk/yake/INSTALL Modified: trunk/yake/BUILD =================================================================== --- trunk/yake/BUILD 2007-03-16 02:46:10 UTC (rev 1681) +++ trunk/yake/BUILD 2007-03-16 02:48:11 UTC (rev 1682) @@ -26,6 +26,10 @@ You can find it here: http://www.yake.org/wiki/ . +The manual can be found here: http://www.yake.org/docs/manual/multi/ . +The sources to the manual can be found in this source release +in the 'documentation/manual' subdirectory. + For help visit the Forums: http://www.yake.org/forum/ . For reporting/tracking bugs visit http://bugs.yake.org/ . Modified: trunk/yake/INSTALL =================================================================== --- trunk/yake/INSTALL 2007-03-16 02:46:10 UTC (rev 1681) +++ trunk/yake/INSTALL 2007-03-16 02:48:11 UTC (rev 1682) @@ -4,6 +4,7 @@ For build instructions see BUILD. If you encounter problems visit: + the manual at http://www.yake.org/docs/manual/multi/ the forums at http://www.yake.org/forum/ the wiki at http://www.yake.org/wiki/ report/track bugs at http://bugs.yake.org/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-16 02:46:10
|
Revision: 1681 http://svn.sourceforge.net/yake/?rev=1681&view=rev Author: psyclonist Date: 2007-03-15 19:46:10 -0700 (Thu, 15 Mar 2007) Log Message: ----------- scons replaced by premake Removed Paths: ------------- trunk/yake/SConstruct trunk/yake/autogen.sh trunk/yake/build.py trunk/yake/buildspec.xml Deleted: trunk/yake/SConstruct =================================================================== --- trunk/yake/SConstruct 2007-03-16 02:45:24 UTC (rev 1680) +++ trunk/yake/SConstruct 2007-03-16 02:46:10 UTC (rev 1681) @@ -1,140 +0,0 @@ -print """ - ################################################# - # # - # SCons build system......... # - # # - # Project Yake @ www.yake.org # - # # - ################################################# - """ - -title = "Builder for Yake" -last_modified = "on 01/11/2005 by Nikita Buida (mj)" - - -print title -print 'This file was last modified ', last_modified - -Help( """ - Usage. - Issue - % scons - shell command. That will build all targets - defined in buildspec.xml - - To install libraries to LibInstallDir (see buildspec.xml) type - # scons install - as root. - - That's it. Enjoy. Find some bugs, improve program, send a patch ;) - -""" ) - -import build - -import os -import os.path -import sys -import glob - -cc_flags = '-DGCC_3_1 -DEXT_HASH -DYAKE_DEBUG -DYAKE_DEBUG_BUILD' - -# optimization flags -optimization_flags = ' -O3 ' - -# debug flag. -g[Level] -debug_flags = ' -g2 -O0' - -# if you want to profile with GNU gprof -profiler_flags = ' -pg ' - -# if you want to test code coverage with GNU gcov -code_coverage_flags = ' -fprofile-arcs -ftest-coverage ' - - -lib_includes = build.commonIncludes -build_dir = build.commonPaths['ObjectDir'] -bin_build_dir = build.commonPaths['ProgramInstallDir'] -lib_dir = build.commonPaths['LibDir'] -lib_install_dir = build.commonPaths['LibInstallDir'] - -print 'Common object dir is:', build.commonPaths['ObjectDir'] -print 'Build dir is', build_dir - -BuildDir( build_dir, '.', duplicate = 0 ) - -cc_flags += debug_flags - -env = Environment( CCFLAGS = cc_flags ) - -####################################################### -# utility functions -####################################################### -def CollectSources( path ): - sources = glob.glob( path + '/' + '*.cpp' ) - sources_build = [] - for src_name in sources: - sources_build.append( build_dir + '/' + src_name ) - return sources_build - -def BuildLibrary( name, path, link_to ): - """ Builds shared library """ - - lib_sources_build = CollectSources( path ) - lib_name = build_dir + '/' + name - return env.SharedLibrary( lib_name, lib_sources_build, CPPPATH = lib_includes, LIBS = link_to, LIBPATH = lib_dir ) - -def BuildProgram( name, path, link_to ): - bin_src = CollectSources( path ) - bin_name = bin_build_dir + '/' + name - return env.Program( bin_name, bin_src, CPPPATH = lib_includes, LIBS = link_to, LIBPATH = lib_dir ) - -###################################################### - -#Library add handling -libadds = {} - -def processLibadds( ent_libadd ): - result = [] - for la in ent_libadd: - if libadds.has_key( la ): - result = result + libadds[ la ] - else: - result.append( la ) - return result - - -# if command line target is specified -if len( COMMAND_LINE_TARGETS ) <> 0 and 'install' not in COMMAND_LINE_TARGETS: - print 'COMMAND_LINE_TARGETS: ', map(str, COMMAND_LINE_TARGETS) - object_name = str( COMMAND_LINE_TARGETS[0] ) - object = env.Object( build_dir + '/' + object_name, CPPPATH = lib_includes ) - env.Alias( object_name, object ) -else: - # else continue with normal build or install - #Collection of libraries to install - yakeLibs = [] - - - #reading shared libs - for name, buildentity in build.sharedLibs.iteritems(): - libadd = processLibadds( buildentity.libadd ) - ent_name = str(name) - yakeLibs.append( BuildLibrary( ent_name, str(buildentity.src), libadd )) - libadds[ ent_name ] = libadd + [ ent_name ] - - #reading programs libs - for name, buildentity in build.programs.iteritems(): - - if not build.quiet: - print name, buildentity, buildentity.src, buildentity.libadd - - libadd = processLibadds( buildentity.libadd ) - ent_name = str(name) - BuildProgram( ent_name, str(buildentity.src), libadd ) - - #handle install - env.Install( lib_install_dir, yakeLibs ) - env.Alias( 'install', lib_install_dir ) - - Deleted: trunk/yake/autogen.sh =================================================================== --- trunk/yake/autogen.sh 2007-03-16 02:45:24 UTC (rev 1680) +++ trunk/yake/autogen.sh 2007-03-16 02:46:10 UTC (rev 1681) @@ -1,8 +0,0 @@ -#!/bin/bash - -libtoolize --force --copy -aclocal -autoheader -automake -a -autoconf - Deleted: trunk/yake/build.py =================================================================== --- trunk/yake/build.py 2007-03-16 02:45:24 UTC (rev 1680) +++ trunk/yake/build.py 2007-03-16 02:46:10 UTC (rev 1681) @@ -1,206 +0,0 @@ -#!/usr/bin/python - -# global variable controlling verboseness -quiet = True - -# Dictionary with common paths -commonPaths = { 'ObjectDir':'obj' } - -commonIncludes = [] - -# Utility lists of strings are stored here -listsSet = {} - -# Dictionary containing all shared libs BuildEntities -sharedLibs = {} -programs = {} - -def setCommonLibInstallDir( dir ): - if not quiet: - print 'Setting common lib install dir to', dir - - commonPaths['LibInstallDir'] = str(dir) - - -def setCommonProgramInstallDir( dir ): - if not quiet: - print 'Setting common program install dir to', dir - - commonPaths['ProgramInstallDir'] = str(dir) - - -def setCommonObjectDir( dir ): - if not quiet: - print 'Setting common object dir to', dir - - commonPaths['ObjectDir'] = str(dir) - -def setCommonLibDir( dir ): - if not quiet: - print 'Setting common lib dir to', dir - - commonPaths['LibDir'] = str(dir) - -class BuildEntity: - """ Class representing build entity (program, lib, shared lib)""" - src = '' - libadd = [] - - def __init__( self ): - self.src = '' - self.libadd = [] - - -def readAllTextElemsToList( src_node, tagName ): - val_list = [] - elems = src_node.getElementsByTagName( tagName ) - for idx in range( elems.length ): - val = elems.item( idx ).firstChild.nodeValue - val_list.append( str(val) ) - if not quiet: - print val - return val_list - -def readListsFromElement( src_elem ): - """ Reads all lists defined as <List>...</List> into listsSet storage """ - if not quiet: - print 'Reading lists...' - - lists = src_elem.getElementsByTagName( 'List' ) - for idx in range( lists.length ): - lst = lists.item( idx ) - lst_name = lst.attributes.item(0).nodeValue #only one name - - if not quiet: - print 'Adding list', lst_name - - items = readAllTextElemsToList( lst, 'item' ) - listsSet[ lst_name ] = items - - -def readProgramInstructions( src_element ): - """ Reads program build instructions """ - - -def readSharedLibsInstructions( src_element ): - """ Reads shared libs build instructions """ - - if not quiet: - print 'Reading shared libs build instructions...' - - so_libs = src_element.getElementsByTagName( 'BuildSharedLibrary' ) - for idx in range( so_libs.length ): - so_lib = so_libs.item( idx ) - lib_name = '' - lib_src = '' - for at_idx in range( so_lib.attributes.length ): - attr = so_lib.attributes.item( at_idx ) - if attr.name == 'name': - lib_name = attr.nodeValue - if not quiet: - print 'Library:', lib_name - elif attr.name == 'src': - lib_src = attr.nodeValue - if not quiet: - print 'Library src:', lib_src - - libadds = [] - - libadds_spec = readAllTextElemsToList( so_lib, 'libadd' ) - - for la in libadds_spec: - if listsSet.has_key( la ): - if not quiet: - print 'Loading libadd from list', la, 'it is:', listsSet[ la ] - libadds = libadds + listsSet[ la ] - else: - libadds.append( la ) - - - lib = BuildEntity() - lib.src = lib_src - lib.libadd = libadds - #adding to dictionary - sharedLibs[ lib_name ] = lib - - -def readProgramInstructions( src_element ): - """ Reads program build instructions """ - - if not quiet: - print 'Reading program build instructions...' - - so_libs = src_element.getElementsByTagName( 'BuildProgram' ) - for idx in range( so_libs.length ): - so_lib = so_libs.item( idx ) - lib_name = '' - lib_src = '' - for at_idx in range( so_lib.attributes.length ): - attr = so_lib.attributes.item( at_idx ) - if attr.name == 'name': - lib_name = attr.nodeValue - if not quiet: - print 'Program:', lib_name - elif attr.name == 'src': - lib_src = attr.nodeValue - if not quiet: - print 'Program src:', lib_src - - libadds = [] - - libadds_spec = readAllTextElemsToList( so_lib, 'libadd' ) - - for la in libadds_spec: - if listsSet.has_key( la ): - if not quiet: - print 'Loading libadd from list', la, 'it is:', listsSet[ la ] - libadds = libadds + listsSet[ la ] - else: - libadds.append( la ) - - - lib = BuildEntity() - lib.src = lib_src - lib.libadd = libadds - #adding to dictionary - programs[ lib_name ] = lib - - -def readBuildInstructions( src_element ): - if not quiet: - print 'Reading build instructions...' - - readSharedLibsInstructions( src_element ) - readProgramInstructions( src_element ) - - - - -# Actual parsing occurs here -import xml.dom.minidom - -dom = xml.dom.minidom.parse( 'buildspec.xml' ) - -if not quiet: - print 'Reading root element', dom.documentElement.tagName - -common = dom.documentElement.getElementsByTagName( 'Common' )[0] #assuming only one Common - -commonAttribs = common.attributes - -for at_index in range( commonAttribs.length ): - at = commonAttribs.item( at_index ) - - if at.name == 'LibInstallDir': - setCommonLibInstallDir( at.nodeValue ) - elif at.name == 'ProgramInstallDir': - setCommonProgramInstallDir( at.nodeValue ) - elif at.name == 'ObjectDir': - setCommonObjectDir( at.nodeValue ) - elif at.name == 'LibDir': - setCommonLibDir( at.nodeValue ) - -commonIncludes = readAllTextElemsToList( common, 'include' ) -readListsFromElement( dom.documentElement ) -readBuildInstructions( dom.documentElement ) - Deleted: trunk/yake/buildspec.xml =================================================================== --- trunk/yake/buildspec.xml 2007-03-16 02:45:24 UTC (rev 1680) +++ trunk/yake/buildspec.xml 2007-03-16 02:46:10 UTC (rev 1681) @@ -1,466 +0,0 @@ -<BuildSpec> - <Common - LibInstallDir="/usr/local/lib" - ProgramInstallDir="common/bin" - ObjectDir="build" - LibDir="build" - > - - <include>dependencies</include> - <include>.</include> - <include>dependencies/OGRE</include> - <include>dependencies/PLSM</include> - <include>dependencies/ode/include</include> - <include>dependencies/luabind</include> - <include>/usr/include/CEGUI</include> - <include>/usr/local/include/CEGUI</include> - </Common> - - <!-- One can define lists of strings to be used later --> - <List name="dynamic_loader" > - <item>dl</item> - </List> - - <BuildSharedLibrary - name="yakeNative" - src="src/yake/base/native/Linux" - > - <libadd>dynamic_loader</libadd> - - </BuildSharedLibrary> - - <!-- YAKE core libraries... --> - <BuildSharedLibrary - name="yakeTemplates" - src="src/yake/base/templates" - > - <libadd>yakeNative</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yakeMath" - src="src/yake/base/math" - /> - - <BuildSharedLibrary - name="yakeBase" - src="src/yake/base" - > - <libadd>yakeNative</libadd> - <libadd>yakeTemplates</libadd> - <libadd>yakeMath</libadd> - <libadd>boost_signals</libadd> - - </BuildSharedLibrary> - - - <BuildSharedLibrary - name="yakeAudio" - src="src/yake/audio" - > - <libadd>yakeBase</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="depTinyXML" - src="dependencies/tinyxml" - > - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yakeData" - src="src/yake/data" - > - <libadd>yakeBase</libadd> - <libadd>depTinyXML</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yakeGraphics" - src="src/yake/graphics" - > - <libadd>yakeBase</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yakeInput" - src="src/yake/input" - > - <libadd>yakeBase</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yakePhysics" - src="src/yake/physics" - > - <libadd>yakeBase</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yakeScripting" - src="src/yake/scripting" - > - <libadd>yakeBase</libadd> - </BuildSharedLibrary> -<!--@todo yakeNet - <BuildSharedLibrary - name="yakeNet" - src="src/yake/net" - > - <libadd>yakeBase</libadd> - </BuildSharedLibrary> ---> - <BuildSharedLibrary - name="yakeLoader" - src="src/yake/loader" - > - <libadd>yakeBase</libadd> - </BuildSharedLibrary> - - - - <BuildSharedLibrary - name="yakeModel" - src="src/yake/model" - > - <libadd>yakeBase</libadd> - <libadd>yakeLoader</libadd> - </BuildSharedLibrary> - - - <!-- Uncomment if you want to use it :D - <BuildSharedLibrary - name="yakeThread" - src="src/yake/thread" - > - <libadd>yakeBase</libadd> - <libadd>ZThread</libadd> - </BuildSharedLibrary> - --> - - <!-- doesn't contain any files - <BuildSharedLibrary - name="yakeStatemachine" - src="src/yake/statemachine" - > - <libadd>yakeBase</libadd> - </BuildSharedLibrary> - --> - - <!-- doesn't contain any files - <BuildSharedLibrary - name="yakeObject" - src="src/yake/object" - > - <libadd>yakeBase</libadd> - </BuildSharedLibrary> - --> - - <BuildSharedLibrary - name="yakeEnt" - src="src/yake/ent" - > - <libadd>yakeBase</libadd> - <!--<libadd>yakeObject</libadd>--> - <!--<libadd>yakeStatemachine</libadd>--> - </BuildSharedLibrary> - -<!-- - <BuildSharedLibrary - name="yakeEntLua" - src="src/yake/plugins/entLua" - > - <libadd>yakeBase</libadd> - <libadd>yakeEnt</libadd> - <libadd>lua</libadd> - <libadd>luabind</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yakeRx" - src="src/yake/rx" - > - <libadd>yakeBase</libadd> - </BuildSharedLibrary> ---> -<!-- - <BuildSharedLibrary - name="yakeaudioOpenAL" - src="src/yake/plugins/audioOpenAL" - > - <libadd>openalpp</libadd> - <libadd>yakeAudio</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yakegraphicsOgre" - src="src/yake/plugins/graphicsOgre" - > - <libadd>yakeGraphics</libadd> - <libadd>OgreMain</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yakeinputOgre" - src="src/yake/plugins/inputOgre" - > - <libadd>yakeInput</libadd> - <libadd>OgreMain</libadd> - </BuildSharedLibrary> ---> - <BuildSharedLibrary - name="yakephysicsODE" - src="src/yake/plugins/physicsODE" - > - <libadd>yakePhysics</libadd> - <libadd>ode</libadd> - </BuildSharedLibrary> -<!-- - <BuildSharedLibrary - name="yakescriptingLua" - src="src/yake/plugins/scriptingLua" - > - <libadd>yakeBase</libadd> - <libadd>luabind</libadd> - <libadd>lua</libadd> - </BuildSharedLibrary> ---> - <!-- TODO Rename this thing? --> - <BuildSharedLibrary - name="yakescriptingBindingsLua" - src="src/yake/plugins/scriptingLuaBindings" - > - <libadd>yakeBase</libadd> - <libadd>luabind</libadd> - <libadd>lua</libadd> - </BuildSharedLibrary> - - <!--@todo reenable. it just took so long to compile/link ... - <BuildSharedLibrary - name="yakegraphicsLuaBindings" - src="src/yake/plugins/graphicsLuaBindings" - > - <libadd>yakeBase</libadd> - <libadd>luabind</libadd> - <libadd>lua</libadd> - </BuildSharedLibrary> - --> - - <BuildSharedLibrary - name="yakebaseLuaBindings" - src="src/yake/plugins/baseLuaBindings" - > - <libadd>yakeBase</libadd> - <libadd>luabind</libadd> - <libadd>lua</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yappBase" - src="src/yapp/base" - > - <libadd>yakeBase</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yakeLoader" - src="src/yake/loader" - > - <libadd>yappBase</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yakeModel" - src="src/yake/model" - > - <libadd>yakeBase</libadd> - <libadd>yakeLoader</libadd> - </BuildSharedLibrary> - --> - - <BuildSharedLibrary - name="yappMsg" - src="src/yapp/msg" - > - <libadd>yappBase</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yappVehicle" - src="src/yapp/vehicle" - > - <libadd>yappBase</libadd> - <libadd>yakephysicsODE</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yappraf" - src="src/yapp/raf" - > - <libadd>yappBase</libadd> - <!-- - <libadd>yakeCEGUIOgreAdapter</libadd> - <libadd>CEGUIOgreRenderer</libadd> - --> - </BuildSharedLibrary> -<!-- - <BuildSharedLibrary - name="yakeCEGUIOgreAdapter" - src="src/yapp/plugins/ceguiOgreRendererAdapter" - > - <libadd>CEGUIBase</libadd> - <libadd>OgreMain</libadd> - </BuildSharedLibrary> ---> - <!--<BuildSharedLibrary - name="yappEntLua" - src="src/yapp/plugins/entLua" - > - <libadd>yappEnt</libadd> - </BuildSharedLibrary> - - <BuildSharedLibrary - name="yappmodelLuaBindings" - src="src/yapp/plugins/modelLuaBindings" - > - <libadd>luabind</libadd> - </BuildSharedLibrary> - --> -<!-- - <BuildSharedLibrary - name="yappTerrainPhysicsManager" - src="src/yapp/plugins/terrainPhysMgr" - > - <libadd>PagingLandscape</libadd> - </BuildSharedLibrary> ---> -<!-- SAMPLES --> - <List name="common_libs"> - <item>yakeBase</item> - <item>yakeAudio</item> - <item>yakeGraphics</item> - <item>yakeInput</item> - <item>yakePhysics</item> - <item>yakeData</item> - <item>yakeScripting</item> - </List> - - <BuildProgram - name="DemoDebug" - src="src/yake/samples/base/debug" - > - <libadd>common_libs</libadd> - </BuildProgram> - -<!-- - <BuildProgram - name="GraphicsDemo" - src="src/yake/samples/graphics/demo" - > - <libadd>common_libs</libadd> - </BuildProgram> ---> - <!-- - <BuildProgram - name="DotSceneGraphicsDemo" - src="src/yapp/samples/graphics/dotScene" - > - <libadd>common_libs</libadd> - <libadd>yappModel</libadd> - </BuildProgram> - - <BuildProgram - name="XODELoaderDemo" - src="src/yapp/samples/model/XODE" - > - <libadd>common_libs</libadd> - <libadd>yappModel</libadd> - <libadd>yappLoader</libadd> - </BuildProgram> - - <BuildProgram - name="dotLinkLoaderDemo" - src="src/yapp/samples/model/dotLink" - > - <libadd>common_libs</libadd> - <libadd>yappModel</libadd> - <libadd>yappLoader</libadd> - </BuildProgram> - --> - - <!-- - <BuildProgram - name="roserver" - src="src/yake/samples/net/roserver" - > - <libadd>common_libs</libadd> - </BuildProgram> - - <BuildProgram - name="roclient" - src="src/yake/samples/net/roclient" - > - <libadd>common_libs</libadd> - </BuildProgram> ---> -<!-- - <BuildProgram - name="VehicleDemo" - src="src/yapp/samples/base/vehicle" - > - <libadd>common_libs</libadd> - <libadd>yappModel</libadd> - <libadd>yappVehicle</libadd> - <libadd>yappraf</libadd> - </BuildProgram> - - <BuildProgram - name="sampleEntFSM" - src="src/yake/samples/ent/sampleEntFsm" - > - <libadd>common_libs</libadd> - <libadd>yakeEnt</libadd> - <libadd>yakeEntLua</libadd> - <libadd>yakescriptingLua</libadd> - </BuildProgram> ---> - -<!-- - <BuildProgram - name="TerrainDemo" - src="src/yapp/samples/ode_terrain_demo" - > - <libadd>common_libs</libadd> - <libadd>yappModel</libadd> - <libadd>yappStatemachine</libadd> - <libadd>yappVehicle</libadd> - <libadd>yappraf</libadd> - <libadd>PagingLandscape</libadd> - <libadd>yappTerrainPhysicsManager</libadd> - <libadd>dl</libadd> - </BuildProgram> - - <BuildProgram - name="consoleDemo" - src="src/yapp/samples/gui/console" - > - <libadd>common_libs</libadd> - <libadd>yakeCEGUIOgreAdapter</libadd> - <libadd>lua</libadd> - <libadd>luabind</libadd> - <libadd>CEGUIOgreRenderer</libadd> - </BuildProgram> - --> - <!--<BuildProgram - name="cmdrmayhem" - src="src/yapp/samples/misc/cmdrmayhem" - > - <libadd>common_libs</libadd> - <libadd>yappModel</libadd> - <libadd>yappVehicle</libadd> - <libadd>yappraf</libadd> - </BuildProgram> - --> - -</BuildSpec> - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-16 02:45:23
|
Revision: 1680 http://svn.sourceforge.net/yake/?rev=1680&view=rev Author: psyclonist Date: 2007-03-15 19:45:24 -0700 (Thu, 15 Mar 2007) Log Message: ----------- added parameters to main() to make it conform to the standard (and fix a msvc8 debugging issue) Modified Paths: -------------- trunk/yake/samples/application/unit_test.cpp trunk/yake/samples/base/abstract_factory_pars/unit_test.cpp trunk/yake/samples/base/abstractfactory/yakeUnitTest.cpp trunk/yake/samples/base/data/demo/yakeDataDemo.cpp trunk/yake/samples/base/events/yakeDemo.cpp trunk/yake/samples/base/graphics/demo/yakeGraphicsDemo.cpp trunk/yake/samples/base/model/dotScene/demo.cpp trunk/yake/samples/base/objects/yakeDemo.cpp trunk/yake/samples/base/rx/basics/yakeDemo.cpp trunk/yake/samples/base/scripting/lua/yakeDemo.cpp trunk/yake/samples/base/thread/demo1/yakeDemo.cpp Modified: trunk/yake/samples/application/unit_test.cpp =================================================================== --- trunk/yake/samples/application/unit_test.cpp 2007-03-16 02:42:57 UTC (rev 1679) +++ trunk/yake/samples/application/unit_test.cpp 2007-03-16 02:45:24 UTC (rev 1680) @@ -76,7 +76,7 @@ //============================================================================ // IMPLEMENTATION FUNCTIONS //============================================================================ -int main() +int main(int argc, char* argv[]) { using namespace yake::testsuite; Modified: trunk/yake/samples/base/abstract_factory_pars/unit_test.cpp =================================================================== --- trunk/yake/samples/base/abstract_factory_pars/unit_test.cpp 2007-03-16 02:42:57 UTC (rev 1679) +++ trunk/yake/samples/base/abstract_factory_pars/unit_test.cpp 2007-03-16 02:45:24 UTC (rev 1680) @@ -68,7 +68,7 @@ //============================================================================ // IMPLEMENTATION FUNCTIONS //============================================================================ -int main() +int main(int argc, char* argv[]) { // abstract factory { Modified: trunk/yake/samples/base/abstractfactory/yakeUnitTest.cpp =================================================================== --- trunk/yake/samples/base/abstractfactory/yakeUnitTest.cpp 2007-03-16 02:42:57 UTC (rev 1679) +++ trunk/yake/samples/base/abstractfactory/yakeUnitTest.cpp 2007-03-16 02:45:24 UTC (rev 1680) @@ -138,7 +138,7 @@ //============================================================================ // IMPLEMENTATION FUNCTIONS //============================================================================ -int main() +int main(int argc, char* argv[]) { // Linear { Modified: trunk/yake/samples/base/data/demo/yakeDataDemo.cpp =================================================================== --- trunk/yake/samples/base/data/demo/yakeDataDemo.cpp 2007-03-16 02:42:57 UTC (rev 1679) +++ trunk/yake/samples/base/data/demo/yakeDataDemo.cpp 2007-03-16 02:45:24 UTC (rev 1680) @@ -56,7 +56,7 @@ } } -int main() +int main(int argc, char* argv[]) { try { Modified: trunk/yake/samples/base/events/yakeDemo.cpp =================================================================== --- trunk/yake/samples/base/events/yakeDemo.cpp 2007-03-16 02:42:57 UTC (rev 1679) +++ trunk/yake/samples/base/events/yakeDemo.cpp 2007-03-16 02:45:24 UTC (rev 1680) @@ -167,7 +167,7 @@ } }; -int main() +int main(int argc, char* argv[]) { try { Modified: trunk/yake/samples/base/graphics/demo/yakeGraphicsDemo.cpp =================================================================== --- trunk/yake/samples/base/graphics/demo/yakeGraphicsDemo.cpp 2007-03-16 02:42:57 UTC (rev 1679) +++ trunk/yake/samples/base/graphics/demo/yakeGraphicsDemo.cpp 2007-03-16 02:45:24 UTC (rev 1680) @@ -405,7 +405,7 @@ // IMPLEMENTATION FUNCTIONS //============================================================================ -int main() +int main(int argc, char* argv[]) { try { Modified: trunk/yake/samples/base/model/dotScene/demo.cpp =================================================================== --- trunk/yake/samples/base/model/dotScene/demo.cpp 2007-03-16 02:42:57 UTC (rev 1679) +++ trunk/yake/samples/base/model/dotScene/demo.cpp 2007-03-16 02:45:24 UTC (rev 1680) @@ -215,7 +215,7 @@ // IMPLEMENTATION FUNCTIONS //============================================================================ -int main() +int main(int argc, char* argv[]) { try { Modified: trunk/yake/samples/base/objects/yakeDemo.cpp =================================================================== --- trunk/yake/samples/base/objects/yakeDemo.cpp 2007-03-16 02:42:57 UTC (rev 1679) +++ trunk/yake/samples/base/objects/yakeDemo.cpp 2007-03-16 02:45:24 UTC (rev 1680) @@ -459,7 +459,7 @@ } }; -int main() +int main(int argc, char* argv[]) { try { Modified: trunk/yake/samples/base/rx/basics/yakeDemo.cpp =================================================================== --- trunk/yake/samples/base/rx/basics/yakeDemo.cpp 2007-03-16 02:42:57 UTC (rev 1679) +++ trunk/yake/samples/base/rx/basics/yakeDemo.cpp 2007-03-16 02:45:24 UTC (rev 1680) @@ -215,7 +215,7 @@ //============================================================================ YAKE_DECLARE_GLOBAL -int main() +int main(int argc, char* argv[]) { try { Modified: trunk/yake/samples/base/scripting/lua/yakeDemo.cpp =================================================================== --- trunk/yake/samples/base/scripting/lua/yakeDemo.cpp 2007-03-16 02:42:57 UTC (rev 1679) +++ trunk/yake/samples/base/scripting/lua/yakeDemo.cpp 2007-03-16 02:45:24 UTC (rev 1680) @@ -18,7 +18,7 @@ return pDynLib; } -int main() +int main(int argc, char* argv[]) { try { Modified: trunk/yake/samples/base/thread/demo1/yakeDemo.cpp =================================================================== --- trunk/yake/samples/base/thread/demo1/yakeDemo.cpp 2007-03-16 02:42:57 UTC (rev 1679) +++ trunk/yake/samples/base/thread/demo1/yakeDemo.cpp 2007-03-16 02:45:24 UTC (rev 1680) @@ -46,7 +46,7 @@ int n_; }; -int main() +int main(int argc, char* argv[]) { try { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <psy...@us...> - 2007-03-16 02:40:39
|
Revision: 1678 http://svn.sourceforge.net/yake/?rev=1678&view=rev Author: psyclonist Date: 2007-03-15 19:40:39 -0700 (Thu, 15 Mar 2007) Log Message: ----------- enabled option Modified Paths: -------------- trunk/yake/scripts/premake/config.lua trunk/yake/scripts/premake/samples.lua Modified: trunk/yake/scripts/premake/config.lua =================================================================== --- trunk/yake/scripts/premake/config.lua 2007-03-16 02:40:15 UTC (rev 1677) +++ trunk/yake/scripts/premake/config.lua 2007-03-16 02:40:39 UTC (rev 1678) @@ -68,6 +68,6 @@ -- !! UNUSED FOR NOW !! SAMPLES_BASE = true -SAMPLES_RAF = true +SAMPLES_RAF = true --OK SAMPLES_NET = true --OK SAMPLES_TASK = true --OK Modified: trunk/yake/scripts/premake/samples.lua =================================================================== --- trunk/yake/scripts/premake/samples.lua 2007-03-16 02:40:15 UTC (rev 1677) +++ trunk/yake/scripts/premake/samples.lua 2007-03-16 02:40:39 UTC (rev 1678) @@ -73,16 +73,19 @@ useDep("cegui") -------------------------------------- -makeSample("sampleRafMinimal","samples/raf/minimal") -sampleUsesConsole() -useComponent("base") -useComponent("raf") -useComponent("scripting") +if SAMPLES_RAF then + -------------------------------------- + makeSample("sampleRafMinimal","samples/raf/minimal") + sampleUsesConsole() + useComponent("base") + useComponent("raf") + useComponent("scripting") --------------------------------------- -makeSample("sampleRafDemo1","samples/raf/demo1") -useComponent("base") -useComponent("raf") + -------------------------------------- + makeSample("sampleRafDemo1","samples/raf/demo1") + useComponent("base") + useComponent("raf") +end -------------------------------------- makeSample("sampleGuiConsole","samples/gui/console") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-16 02:40:19
|
Revision: 1677 http://svn.sourceforge.net/yake/?rev=1677&view=rev Author: psyclonist Date: 2007-03-15 19:40:15 -0700 (Thu, 15 Mar 2007) Log Message: ----------- pass-through parameters Modified Paths: -------------- trunk/yake/scripts/msvc80/build.cmd Modified: trunk/yake/scripts/msvc80/build.cmd =================================================================== --- trunk/yake/scripts/msvc80/build.cmd 2007-03-16 02:40:11 UTC (rev 1676) +++ trunk/yake/scripts/msvc80/build.cmd 2007-03-16 02:40:15 UTC (rev 1677) @@ -6,7 +6,7 @@ ) setlocal set SOLUTION_TARGET_DIR=msvc80 -premake --file yake.lua --target vs2005 +premake --file yake.lua --target vs2005 %1 %2 %3 popd -pause \ No newline at end of file +pause This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-16 02:40:12
|
Revision: 1676 http://svn.sourceforge.net/yake/?rev=1676&view=rev Author: psyclonist Date: 2007-03-15 19:40:11 -0700 (Thu, 15 Mar 2007) Log Message: ----------- fixed resource compilation for yake::base on windows Modified Paths: -------------- trunk/yake/scripts/premake/yake.lua Modified: trunk/yake/scripts/premake/yake.lua =================================================================== --- trunk/yake/scripts/premake/yake.lua 2007-03-16 02:39:36 UTC (rev 1675) +++ trunk/yake/scripts/premake/yake.lua 2007-03-16 02:40:11 UTC (rev 1676) @@ -70,12 +70,12 @@ --package.pchsource = rootdir.."src/base/yakePCH.cpp" addMatching("yake/base/*.h") addMatching("yake/base/*.inl") - addMatching("yake/base/*.rc") addMatching("src/base/*.cpp") addMatching("src/base/math/*.cpp") addMatching("src/base/templates/*.cpp") if (windows) then addMatching("src/base/native/win32/*.cpp") + addMatching("yake/base/native/win32/*.rc") 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-03-16 02:39:35
|
Revision: 1675 http://svn.sourceforge.net/yake/?rev=1675&view=rev Author: psyclonist Date: 2007-03-15 19:39:36 -0700 (Thu, 15 Mar 2007) Log Message: ----------- removed MFC related _USRDLL define Modified Paths: -------------- trunk/yake/scripts/premake/tools.lua Modified: trunk/yake/scripts/premake/tools.lua =================================================================== --- trunk/yake/scripts/premake/tools.lua 2007-03-16 02:38:57 UTC (rev 1674) +++ trunk/yake/scripts/premake/tools.lua 2007-03-16 02:39:36 UTC (rev 1675) @@ -93,7 +93,6 @@ if (windows) then addDefine("_CRT_SECURE_NO_DEPRECATE") addDefine("WIN32") - addDefine("_USRDLL") else addDefine("_REENTRANT") end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-16 02:38:56
|
Revision: 1674 http://svn.sourceforge.net/yake/?rev=1674&view=rev Author: psyclonist Date: 2007-03-15 19:38:57 -0700 (Thu, 15 Mar 2007) Log Message: ----------- added NOTES Added Paths: ----------- trunk/yake/NOTES Added: trunk/yake/NOTES =================================================================== --- trunk/yake/NOTES (rev 0) +++ trunk/yake/NOTES 2007-03-16 02:38:57 UTC (rev 1674) @@ -0,0 +1,9 @@ + +16 Mar 2007 + Problem: Debugging sample apps from within MSVC 8 Prof. did not work well. + Symptoms: When throwing or rethrowing exceptions the msvcrt related callstack + looks messed up and quite different on each run (but always related to the + Cxx... exception functions and some application functions...). + BUT: The application runs fine when run from the explorer. + Solution: change: int main() to: int main(int,char**) + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-16 00:02:22
|
Revision: 1673 http://svn.sourceforge.net/yake/?rev=1673&view=rev Author: psyclonist Date: 2007-03-15 17:02:15 -0700 (Thu, 15 Mar 2007) Log Message: ----------- added default logging to file Modified Paths: -------------- trunk/yake/src/raf/yakeApplication.cpp trunk/yake/yake/raf/yakeApplication.h Modified: trunk/yake/src/raf/yakeApplication.cpp =================================================================== --- trunk/yake/src/raf/yakeApplication.cpp 2007-03-15 23:53:24 UTC (rev 1672) +++ trunk/yake/src/raf/yakeApplication.cpp 2007-03-16 00:02:15 UTC (rev 1673) @@ -335,11 +335,20 @@ #endif bool Application::initialise() { + // register logging target + mLogListeners.push_back( log_listener_ptr( new logging::file_listener("raf.log") ) ); + logging::addListener( mLogListeners.back().get() ); + + YAKE_LOG_INFORMATION("raf","Initialising application..."); + + // + YAKE_LOG_INFORMATION("raf","loading configuration..."); ApplicationConfiguration& cfg = getConfiguration(); mUseExtGraphicsSystem = cfg.useExternalGraphicsSystem().get() != 0; // load libs + YAKE_LOG_INFORMATION("raf","loading libraries..."); StringVector libs = cfg.getLibraries(); ConstVectorIterator<StringVector> itLib( libs ); while (itLib.hasMoreElements()) @@ -348,6 +357,7 @@ } // load & init systems + YAKE_LOG_INFORMATION("raf","loading and initialising systems..."); loadAndInitSystems<scripting::IScriptingSystem>( cfg.getScriptingSystems(), mScriptingSystems ); loadAndInitSystems<audio::IAudioSystem>( cfg.getAudioSystems(), mAudioSystems ); if (mUseExtGraphicsSystem) @@ -370,18 +380,22 @@ #endif // application state machine + YAKE_LOG_INFORMATION("raf","initialising application machine..."); mMachine = new AppMachine(); YAKE_ASSERT( mMachine ); if (!mMachine) return false; + YAKE_LOG_INFORMATION("raf","creating main application state..."); mMainState = createMainState(); YAKE_ASSERT( mMainState ); if (!mMainState) return false; + YAKE_LOG_INFORMATION("raf","main application state created."); mMachine->addState( "main", mMainState ); mMachine->addState( "dead", new ApplicationState(*this) ); // user application init + YAKE_LOG_INFORMATION("raf","finalizing application initialisation..."); if (!onInitialise()) { // clean up @@ -391,8 +405,10 @@ } bool Application::shutdown() { + YAKE_LOG_INFORMATION("raf","shutting down..."); bool ret = onShutdown(); + YAKE_LOG_INFORMATION("raf","shutting down machine..."); YAKE_ASSERT( mMachine ); if (mMachine) { @@ -408,6 +424,7 @@ YAKE_SAFE_DELETE( mCeguiRendererAdapter ); } #endif + YAKE_LOG_INFORMATION("raf","shutting down systems..."); YAKE_SAFE_DELETE( mKeyboardEventGenerator ); YAKE_SAFE_DELETE( mMouseEventGenerator ); mInputSystems.clear(); @@ -417,6 +434,12 @@ mScriptingSystems.clear(); mLibs.clear(); + // + YAKE_LOG_INFORMATION("raf","removing logger."); + YAKE_FOR_EACH(LogListeners::iterator,itLogListener,mLogListeners) + logging::removeListener( (*itLogListener).get() ); + mLogListeners.clear(); + return ret; } bool Application::run() @@ -425,6 +448,7 @@ } bool Application::onRun() { + YAKE_LOG_INFORMATION("raf","Application::onRun()"); YAKE_ASSERT( mMachine ); if (!mMachine) return false; @@ -443,6 +467,7 @@ } base::Library* Application::loadLibrary( const String& file ) { + YAKE_LOG_INFORMATION("raf","attempting to load '" + file + "'..."); YAKE_ASSERT( !file.empty() ); if (file.empty()) return 0; @@ -453,6 +478,7 @@ return 0; mLibs.push_back( pDynLib ); + YAKE_LOG_INFORMATION("raf","'" + file + "' loaded."); return pDynLib.get(); } scripting::IScriptingSystem* Application::getScriptingSystem(const String& name) Modified: trunk/yake/yake/raf/yakeApplication.h =================================================================== --- trunk/yake/yake/raf/yakeApplication.h 2007-03-15 23:53:24 UTC (rev 1672) +++ trunk/yake/yake/raf/yakeApplication.h 2007-03-16 00:02:15 UTC (rev 1673) @@ -207,6 +207,9 @@ bool mCeguiMouseInputEnabled; bool mCeguiKeyboardInputEnabled; #endif + typedef SharedPtr<logging::log_listener> log_listener_ptr; + typedef std::deque<log_listener_ptr> LogListeners; + LogListeners mLogListeners; }; /** An example base application class provided for convenience. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-15 23:53:22
|
Revision: 1672 http://svn.sourceforge.net/yake/?rev=1672&view=rev Author: psyclonist Date: 2007-03-15 16:53:24 -0700 (Thu, 15 Mar 2007) Log Message: ----------- adjusted path Modified Paths: -------------- trunk/yake/yake/plugins/ceguiOgreRendererAdapter/pch.h Modified: trunk/yake/yake/plugins/ceguiOgreRendererAdapter/pch.h =================================================================== --- trunk/yake/yake/plugins/ceguiOgreRendererAdapter/pch.h 2007-03-15 23:53:01 UTC (rev 1671) +++ trunk/yake/yake/plugins/ceguiOgreRendererAdapter/pch.h 2007-03-15 23:53:24 UTC (rev 1672) @@ -28,14 +28,11 @@ #include <iostream> // Yake #include <yake/base/yake.h> -#include <yake/base/yakeDebugOutputStream.h> -#include <yake/base/yakeLog.h> -#include <yake/base/yakeLibrary.h> +#include <yake/data/yakeData.h> #include <yake/scripting/yakeScriptingSystem.h> #include <yake/graphics/yakeGraphicsSystem.h> -#include <yake/samples/common/yakeExampleApplication.h> -#include <yake/data/yakeData.h> +#include <samples/common/exapp/yakeExampleApplication.h> #include "Ogre.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-15 23:53:11
|
Revision: 1671 http://svn.sourceforge.net/yake/?rev=1671&view=rev Author: psyclonist Date: 2007-03-15 16:53:01 -0700 (Thu, 15 Mar 2007) Log Message: ----------- removed compiler message Modified Paths: -------------- trunk/yake/yake/base/templates/yakeSignals.h Modified: trunk/yake/yake/base/templates/yakeSignals.h =================================================================== --- trunk/yake/yake/base/templates/yakeSignals.h 2007-03-15 23:52:21 UTC (rev 1670) +++ trunk/yake/yake/base/templates/yakeSignals.h 2007-03-15 23:53:01 UTC (rev 1671) @@ -62,7 +62,7 @@ #endif #if defined( YAKE_SIGNALS_USE_BOOST ) -# pragma message("Yake signal config: yake.signals uses boost") +//# pragma message("Yake signal config: yake.signals uses boost") # define BindX boost::bind # if YAKE_COMPILER == COMPILER_MSVC && YAKE_COMP_VER == 1300 # define Bind0( METHOD, OBJECT ) boost::bind( METHOD, OBJECT, _1 ) @@ -95,7 +95,7 @@ # define Ref( REFOBJECT ) boost::ref( REFOBJECT ) */ #elif defined( YAKE_SIGNALS_USE_TTL ) -# pragma message("Yake signal config: yake.signals uses ttl") +//# pragma message("Yake signal config: yake.signals uses ttl") # if YAKE_COMPILER == COMPILER_MSVC && YAKE_COMP_VER > 1300 # define Bind0( METHOD, OBJECT ) boost::bind( METHOD, OBJECT, _1 ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-15 23:52:22
|
Revision: 1670 http://svn.sourceforge.net/yake/?rev=1670&view=rev Author: psyclonist Date: 2007-03-15 16:52:21 -0700 (Thu, 15 Mar 2007) Log Message: ----------- adjusted bindings to change in logging interface Modified Paths: -------------- trunk/yake/src/bindings.lua/detail/base.lua.cpp Modified: trunk/yake/src/bindings.lua/detail/base.lua.cpp =================================================================== --- trunk/yake/src/bindings.lua/detail/base.lua.cpp 2007-03-15 23:51:59 UTC (rev 1669) +++ trunk/yake/src/bindings.lua/detail/base.lua.cpp 2007-03-15 23:52:21 UTC (rev 1670) @@ -231,14 +231,25 @@ value( "INFORMATION", 6 ), value( "DEBUG", 7 ) ] + .def( "log", &logging::logger::log ) .scope [ - def( "log", (void(*)(const logging::severity_t, const char* logId, const char* msg))&logging::logger::log ), + def( "instance", logging::logger::instance ), + //def( "log", (void(*)(const logging::severity_t, const char* logId, const char* msg))&logging::log<const char*> ), def( "enableLog", logging::enableLog ), def( "enableSeverity", logging::enableSeverity ), def( "setProcessId", logging::setProcessId ) //def( "addTarget", logging::addTarget ) ] + /*Lua: + function log(...) + local out + for ... args + out = out .. tostring(..) + end + Log.instance():log(Log:INFORMATION,"lua",out) + end + */ ]; // Exporting log singleton as logger object This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-15 23:51:58
|
Revision: 1669 http://svn.sourceforge.net/yake/?rev=1669&view=rev Author: psyclonist Date: 2007-03-15 16:51:59 -0700 (Thu, 15 Mar 2007) Log Message: ----------- removed references to deprecated libs Modified Paths: -------------- trunk/yake/scripts/premake/samples.lua Modified: trunk/yake/scripts/premake/samples.lua =================================================================== --- trunk/yake/scripts/premake/samples.lua 2007-03-15 23:51:19 UTC (rev 1668) +++ trunk/yake/scripts/premake/samples.lua 2007-03-15 23:51:59 UTC (rev 1669) @@ -115,9 +115,7 @@ useComponent("netsvc") useComponent("netrepsvc") useComponent("model") - useComponent("modelLua") useComponent("ent") - useComponent("entLua") addIncludePath("dependencies/boost") addMatching("samples/net/roclient/roclient*") addMatching("samples/net/roserver/roserver*") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-15 23:51:20
|
Revision: 1668 http://svn.sourceforge.net/yake/?rev=1668&view=rev Author: psyclonist Date: 2007-03-15 16:51:19 -0700 (Thu, 15 Mar 2007) Log Message: ----------- removed warning Modified Paths: -------------- trunk/yake/src/plugins/physicsODE/OdeAvatar.cpp Modified: trunk/yake/src/plugins/physicsODE/OdeAvatar.cpp =================================================================== --- trunk/yake/src/plugins/physicsODE/OdeAvatar.cpp 2007-03-15 23:50:58 UTC (rev 1667) +++ trunk/yake/src/plugins/physicsODE/OdeAvatar.cpp 2007-03-15 23:51:19 UTC (rev 1668) @@ -236,7 +236,7 @@ mTopRay->_clearIntersection(); //@todo fix gravity - mActor->getBody().addForce( Force(-mUp*9.81, RF_GLOBAL) ); + mActor->getBody().addForce( Force(-mUp*real(9.81), RF_GLOBAL) ); //mActor->getBody().addForce( Force(-mUp*4, RF_GLOBAL) ); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-15 23:51:03
|
Revision: 1667 http://svn.sourceforge.net/yake/?rev=1667&view=rev Author: psyclonist Date: 2007-03-15 16:50:58 -0700 (Thu, 15 Mar 2007) Log Message: ----------- added two demos Modified Paths: -------------- trunk/yake/BUILD Modified: trunk/yake/BUILD =================================================================== --- trunk/yake/BUILD 2007-03-15 23:50:41 UTC (rev 1666) +++ trunk/yake/BUILD 2007-03-15 23:50:58 UTC (rev 1667) @@ -58,9 +58,10 @@ yake/yake - includes for components (in each subdirectory) yake/src - implementation for components (in respective subdirectories) - yake/samples - sources to demo applications yake/common/bin - target directory for dynamic link libraries yake/common/lib - target directory for .lib/.a (static and dll) + yake/samples - sources to demo applications + yake/samples/bin - target directory for sample executables yake/scripts/premake - main build script generation files/scripts yake/scripts/linux - build script generation for Linux platforms yake/scripts/msvc71 - build script generation for Windows/MSVC7.1 platform This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-15 23:50:41
|
Revision: 1666 http://svn.sourceforge.net/yake/?rev=1666&view=rev Author: psyclonist Date: 2007-03-15 16:50:41 -0700 (Thu, 15 Mar 2007) Log Message: ----------- Modified Paths: -------------- trunk/yake/documentation/manual/yake-manual.txt Modified: trunk/yake/documentation/manual/yake-manual.txt =================================================================== --- trunk/yake/documentation/manual/yake-manual.txt 2007-03-15 23:39:50 UTC (rev 1665) +++ trunk/yake/documentation/manual/yake-manual.txt 2007-03-15 23:50:41 UTC (rev 1666) @@ -604,23 +604,32 @@ ~~~~~~~~ Models are used to represent more complex objects. They can also be used to -combine different representations (e.g. physics and graphics). +combine different representations (e.g. physics and graphics) as well as +links between these representations. Models own any number of ModelComponents and ModelLinks. -ModelComponents are very generic and can be nearly anything. Common components are model::Graphical (which manages a set of scene nodes, entities and other graphical objects), model::Physical (which manages physical actors, joints and other physical objects) and vehicle::VehicleModelComponent which adapts Yake's vehicle component and interacts with other ModelComponents in the same Model. +ModelComponents are very generic objects and can therefore represent nearly anything. +Common components are model::Graphical (which manages a set of scene nodes, entities +and other graphical objects), model::Physical (which manages physical actors, joints +and other physical objects) and vehicle::VehicleModelComponent which adapts Yake's vehicle +component and interacts with other ModelComponents in the same Model. ModelLinks are used to link ModelComponents and their contained objects. -For example, a movable graphical entity/mesh can be linked to a physical dynamics actor in such a way that the graphical entity inherits the transformation of the physics object. In short, we have created a ball. +For example, a movable graphical entity/mesh can be linked to a physical dynamics actor +in such a way that the graphical entity inherits the transformation of the physics object. +In short, we have created a ball. The exact layout of models and their components as well as the model links can be defined either in code or using a special short cut string representation or, and this is the suggested method for most use cases, it can be defined in an XML file (.model and .link). +As noted above, Yake ships with a variety of ModelComponents and ModelLinks as +well as their corresponding loaders and creators. Have a look at the API documentation +for more details. + dotModel and dotLink file formats ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Examples -~~~~~~~~ Property -------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-15 23:39:50
|
Revision: 1665 http://svn.sourceforge.net/yake/?rev=1665&view=rev Author: psyclonist Date: 2007-03-15 16:39:50 -0700 (Thu, 15 Mar 2007) Log Message: ----------- improved consistency in build scripts, implemented new configuration options Modified Paths: -------------- trunk/yake/scripts/premake/config.lua trunk/yake/scripts/premake/samples.lua trunk/yake/scripts/premake/tools.lua trunk/yake/scripts/premake/yake.lua Modified: trunk/yake/scripts/premake/config.lua =================================================================== --- trunk/yake/scripts/premake/config.lua 2007-03-15 23:38:37 UTC (rev 1664) +++ trunk/yake/scripts/premake/config.lua 2007-03-15 23:39:50 UTC (rev 1665) @@ -59,8 +59,7 @@ -------------------------------------- -- If set to true the sample makefiles are included the core solution. --- !! UNUSED FOR NOW !! -SAMPLES_INCLUDED_IN_CORE_SOLUTION = false +SAMPLES_INCLUDED_IN_CORE_SOLUTION = true -- Set to true to force the samples to use static linking. -- Supported targets for static linking: Release, Debug @@ -70,4 +69,5 @@ -- !! UNUSED FOR NOW !! SAMPLES_BASE = true SAMPLES_RAF = true -SAMPLES_NET = true +SAMPLES_NET = true --OK +SAMPLES_TASK = true --OK Modified: trunk/yake/scripts/premake/samples.lua =================================================================== --- trunk/yake/scripts/premake/samples.lua 2007-03-15 23:38:37 UTC (rev 1664) +++ trunk/yake/scripts/premake/samples.lua 2007-03-15 23:39:50 UTC (rev 1665) @@ -3,31 +3,43 @@ -------------------------------------- -------------------------------------- -dofile("tools.lua") -dofile("config.lua") +if not SAMPLES_INCLUDED_IN_CORE_SOLUTION then + dofile("config.lua") + dofile("tools.lua") --------------------------------------- --- project setup --------------------------------------- + -------------------------------------- + -- project setup + -------------------------------------- + makeExeProject("yake_samples") -makeExeProject("yake_samples") + -------------------------------------- + -- create dependency packages + -------------------------------------- + dofile("deps.lua") +else + -- samples.lua has been run from within yake.lua so + -- just modify the already existing project: + project.configs = + { + "Debug", + "ReleaseWithSymbols", + "Release", + } +end --------------------------------------- --- create dependency packages --------------------------------------- -dofile("deps.lua") - -------------------------------------- -- create samples/demos -------------------------------------- -------------------------------------- makeSample("sampleLog","samples/sampleLog") +sampleUsesConsole() useComponent("base") -------------------------------------- makeSample("sampleEntFsm","samples/ent/sampleEntFsm") +sampleUsesConsole() useComponent("base") useComponent("scripting") useComponent("ent") @@ -62,8 +74,10 @@ -------------------------------------- makeSample("sampleRafMinimal","samples/raf/minimal") +sampleUsesConsole() useComponent("base") useComponent("raf") +useComponent("scripting") -------------------------------------- makeSample("sampleRafDemo1","samples/raf/demo1") @@ -84,58 +98,76 @@ useDep("luabind") -------------------------------------- -makeSample("sampleNetPacket","samples/net/packet") -addDefine("YAKE_MODEL_LUA_EXPORTS") -useComponent("base") -useComponent("net") +if SAMPLES_NET then + makeSample("sampleNetPacket","samples/net/packet") + sampleUsesConsole() + useComponent("base") + useComponent("net") +end -------------------------------------- -makeSample("sampleNetInprocess","samples/net/inprocess") -useComponent("base") -useComponent("scripting") -useComponent("net") -useComponent("netsvc") -useComponent("netrepsvc") -useComponent("model") -useComponent("modelLua") -useComponent("ent") -useComponent("entLua") -addIncludePath("dependencies/boost") -addMatching("samples/net/roclient/roclient*") -addMatching("samples/net/roserver/roserver*") +if SAMPLES_NET then + makeSample("sampleNetInprocess","samples/net/inprocess") + sampleUsesConsole() + useComponent("base") + useComponent("scripting") + useComponent("net") + useComponent("netsvc") + useComponent("netrepsvc") + useComponent("model") + useComponent("modelLua") + useComponent("ent") + useComponent("entLua") + addIncludePath("dependencies/boost") + addMatching("samples/net/roclient/roclient*") + addMatching("samples/net/roserver/roserver*") +end -------------------------------------- -makeSample("sampleNetCommServer","samples/net/commserver") -useComponent("base") -useComponent("net") -useComponent("netsvc") -addIncludePath("dependencies/boost") -addMatching("samples/net/roserver/roserver*") +if SAMPLES_NET then + makeSample("sampleNetCommServer","samples/net/commserver") + sampleUsesConsole() + useComponent("base") + useComponent("net") + useComponent("netsvc") + addIncludePath("dependencies/boost") + addMatching("samples/net/roserver/roserver*") +end -------------------------------------- -makeSample("sampleNetCommClient","samples/net/commclient") -useComponent("base") -useComponent("net") -useComponent("netsvc") -addIncludePath("dependencies/boost") -addMatching("samples/net/roclient/roclient*") +if SAMPLES_NET then + makeSample("sampleNetCommClient","samples/net/commclient") + sampleUsesConsole() + useComponent("base") + useComponent("net") + useComponent("netsvc") + addIncludePath("dependencies/boost") + addMatching("samples/net/roclient/roclient*") +end -------------------------------------- -makeSample("sampleScripting1","samples/base/scripting/lua") -useComponent("base") -useComponent("scripting") -useComponent("bindings.lua") +if LUA_BINDINGS then + makeSample("sampleScripting1","samples/base/scripting/lua") + sampleUsesConsole() + useComponent("base") + useComponent("scripting") + useComponent("bindings.lua") +end --------------------------------------- -makeSample("sampleTask1","samples/task/demo1") -useComponent("base") -useComponent("task") +if SAMPLES_TASK then + -------------------------------------- + makeSample("sampleTask1","samples/task/demo1") + sampleUsesConsole() + useComponent("base") + useComponent("task") --------------------------------------- -if LUA_BINDINGS then - makeSample("sampleTaskLua1","samples/task/lua1") - useComponent("base") - useComponent("task") - useComponent("scripting") - useComponent("bindings.lua") + -------------------------------------- + if LUA_BINDINGS and ENABLE_LUA_BASE and ENABLE_LUA_TASK then + makeSample("sampleTaskLua1","samples/task/lua1") + sampleUsesConsole() + useComponent("base") + useComponent("task") + useComponent("scripting") + useComponent("bindings.lua") + end end Modified: trunk/yake/scripts/premake/tools.lua =================================================================== --- trunk/yake/scripts/premake/tools.lua 2007-03-15 23:38:37 UTC (rev 1664) +++ trunk/yake/scripts/premake/tools.lua 2007-03-15 23:39:50 UTC (rev 1665) @@ -46,10 +46,15 @@ end end -function makeLibProject(name) +function makeCommonProject(name) project.name = name project.bindir = rootdir.."common/bin" project.libdir = rootdir.."common/lib" + project.path = rootdir.."scripts/"..solutionTargetDir +end + +function makeLibProject(name) + makeCommonProject(name) project.configs = { "Debug", @@ -58,20 +63,17 @@ "DebugLib", "ReleaseLib" } - project.path = rootdir.."scripts/"..solutionTargetDir end function makeExeProject(name) - project.name = name + makeCommonProject(name) project.bindir = rootdir.."samples/bin" - project.libdir = rootdir.."common/lib" project.configs = { "Debug", "ReleaseWithSymbols", "Release", } - project.path = rootdir.."scripts/"..solutionTargetDir end function makePackage(name) @@ -99,21 +101,31 @@ local targetBaseDir = rootdir.."common/bin/" debug = package.config.Debug - debug.target = targetBaseDir.."debug/"..(LIBFILE_PREFIX)..name..(DEBUG_DLL_SUFFIX) + --debug.target = targetBaseDir.."debug/"..(LIBFILE_PREFIX)..name..(DEBUG_DLL_SUFFIX) + debug.target = (LIBFILE_PREFIX)..name..(DEBUG_DLL_SUFFIX) debug.defines = {"_DEBUG"} debug.buildflags = {} if windows then - local args = debug.target .. "." .. DLL_EXTENSION .. " " .. rootdir .. "samples/bin/debug" + local targetfile = targetBaseDir .. debug.target .. "." .. DLL_EXTENSION + + local args = targetfile.. " " .. rootdir .. "samples/bin/debug" args = string.gsub(args,"/","\\") - debug.postbuildcommands = {"copy /Y " .. args} + table.insert(debug.postbuildcommands,"copy /Y " .. args) end releaseWithSym = package.config.ReleaseWithSymbols - releaseWithSym.target = targetBaseDir.."release_sym/"..(LIBFILE_PREFIX)..name.."_sym" + releaseWithSym.target = (LIBFILE_PREFIX)..name.."_sym" releaseWithSym.defines = {} releaseWithSym.buildflags = { "optimize-speed" } + if windows then + local targetfile = targetBaseDir .. releaseWithSym.target .. "." .. DLL_EXTENSION + + local args = targetfile .. " " .. rootdir .. "samples/bin/release_sym" + args = string.gsub(args,"/","\\") + table.insert(releaseWithSym.postbuildcommands,"copy /Y " .. args) + end release = package.config.Release release.target = targetBaseDir.."release/"..(LIBFILE_PREFIX)..name @@ -124,9 +136,11 @@ "no-frame-pointer" } if windows then - local args = release.target .. "." .. DLL_EXTENSION .. " " .. rootdir .. "samples/bin/release" + local targetfile = targetBaseDir .. release.target .. "." .. DLL_EXTENSION + + local args = targetfile .. " " .. rootdir .. "samples/bin/release" args = string.gsub(args,"/","\\") - release.postbuildcommands = {"copy /Y " .. args} + table.insert(release.postbuildcommands,"copy /Y " .. args) end debugLib = package.config.DebugLib @@ -261,10 +275,19 @@ -------------------------------------- -- PUBLIC -------------------------------------- +function sampleUsesConsole() + if windows then + package.kind = "exe" + end +end function makeSample(name,path) package = newpackage() package.name = name - package.kind = "exe" + if windows then + package.kind = "winexe" -- "exe" is the console application, "winexe" the one without the console + else + package.kind = "exe" + end package.language = "c++" package.path = rootdir.."scripts/"..solutionTargetDir @@ -320,7 +343,11 @@ if (SAMPLES_USE_STATIC_LINKING) then STATIC_LINKING_STR = "_s" end - addDependency(LIBFILE_PREFIX..name..STATIC_LINKING_STR..DEBUG_DLL_SUFFIX,"Debug") - addDependency(LIBFILE_PREFIX..name..STATIC_LINKING_STR,"Release") - addDependency(LIBFILE_PREFIX..name.."_sym","ReleaseWithSymbols") -- dynamic linking only + if SAMPLES_INCLUDED_IN_CORE_SOLUTION then + addDependency(name) + else + addDependency(LIBFILE_PREFIX..name..STATIC_LINKING_STR..DEBUG_DLL_SUFFIX,"Debug") + addDependency(LIBFILE_PREFIX..name..STATIC_LINKING_STR,"Release") + addDependency(LIBFILE_PREFIX..name.."_sym","ReleaseWithSymbols") -- dynamic linking only + end end Modified: trunk/yake/scripts/premake/yake.lua =================================================================== --- trunk/yake/scripts/premake/yake.lua 2007-03-15 23:38:37 UTC (rev 1664) +++ trunk/yake/scripts/premake/yake.lua 2007-03-15 23:39:50 UTC (rev 1665) @@ -6,8 +6,8 @@ -------------------------------------- +dofile("config.lua") dofile("tools.lua") -dofile("config.lua") -------------------------------------- -- project setup @@ -214,4 +214,11 @@ -------------------------------------- dofile("plugins.lua") +-------------------------------------- +-- create samples +-------------------------------------- +if SAMPLES_INCLUDED_IN_CORE_SOLUTION then + dofile("samples.lua") +end + -- the end This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-15 23:38:39
|
Revision: 1664 http://svn.sourceforge.net/yake/?rev=1664&view=rev Author: psyclonist Date: 2007-03-15 16:38:37 -0700 (Thu, 15 Mar 2007) Log Message: ----------- replaced 'function pointer' by 'listener' approach for logging targets, added two logging listeners (stderr_listener, file_listener), disabled default stderr/console logging target, updated samples due to interface changes Modified Paths: -------------- trunk/yake/samples/raf/minimal/yakeDemo.cpp trunk/yake/samples/sampleLog/demo.cpp trunk/yake/src/base/native/Linux/yakeDebug.cpp trunk/yake/src/base/native/win32/yakeDebug.cpp trunk/yake/src/base/yakeLog.cpp trunk/yake/yake/base/native/yakeNative.h trunk/yake/yake/base/yake.h trunk/yake/yake/base/yakeLog.h Added Paths: ----------- trunk/yake/samples/bin/release/ trunk/yake/src/base/yakeFileLog.cpp trunk/yake/src/base/yakeStderrLog.cpp trunk/yake/yake/base/yakeFileLog.h trunk/yake/yake/base/yakeStderrLog.h Modified: trunk/yake/samples/raf/minimal/yakeDemo.cpp =================================================================== --- trunk/yake/samples/raf/minimal/yakeDemo.cpp 2007-03-15 22:06:56 UTC (rev 1663) +++ trunk/yake/samples/raf/minimal/yakeDemo.cpp 2007-03-15 23:38:37 UTC (rev 1664) @@ -22,13 +22,12 @@ protected: virtual bool onRun() { - scripting::IVM* pVM = getScriptingSystem("lua")->createVM(); - YAKE_ASSERT( pVM ).debug("We need a valid VM!"); - if (!pVM) + scripting::VMPtr vm = getScriptingSystem("lua")->createVM(); + YAKE_ASSERT( vm ).debug("We need a valid VM!"); + if (!vm) return false; - pVM->execute("print('Hello from script!')"); - delete pVM; + vm->execute("print('Hello from script!')"); return true; } Modified: trunk/yake/samples/sampleLog/demo.cpp =================================================================== --- trunk/yake/samples/sampleLog/demo.cpp 2007-03-15 22:06:56 UTC (rev 1663) +++ trunk/yake/samples/sampleLog/demo.cpp 2007-03-15 23:38:37 UTC (rev 1664) @@ -6,6 +6,16 @@ { try { + 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() ); + + log_listener_ptr toFile( new yake::logging::file_listener("sampleLog.log") ); + yake::logging::addListener( toFile.get() ); + + // log something: yake::logging::setProcessId("demo"); YAKE_LOG_INFORMATION("demo","aloha"); YAKE_LOG_WARNING("demo","aloha"); Modified: trunk/yake/src/base/native/Linux/yakeDebug.cpp =================================================================== --- trunk/yake/src/base/native/Linux/yakeDebug.cpp 2007-03-15 22:06:56 UTC (rev 1663) +++ trunk/yake/src/base/native/Linux/yakeDebug.cpp 2007-03-15 23:38:37 UTC (rev 1664) @@ -42,6 +42,11 @@ namespace yake { namespace native { +bool debug_Log_available() +{ + return true; +} + void debug_Log( const std::string& what, logging::severity_t sev ) { if (sev <= logging::S_ERROR) Modified: trunk/yake/src/base/native/win32/yakeDebug.cpp =================================================================== --- trunk/yake/src/base/native/win32/yakeDebug.cpp 2007-03-15 22:06:56 UTC (rev 1663) +++ trunk/yake/src/base/native/win32/yakeDebug.cpp 2007-03-15 23:38:37 UTC (rev 1664) @@ -139,13 +139,23 @@ void Print( const char * text, WORD wAttributes ) { - AllocConsole(); + //AllocConsole(); // this would actually open a console window... - SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), wAttributes ); + HANDLE outHandle = GetStdHandle( STD_ERROR_HANDLE ); + if (!outHandle) + return; + + CONSOLE_SCREEN_BUFFER_INFO csbiInfo; + ::GetConsoleScreenBufferInfo( outHandle, &csbiInfo ); + + SetConsoleTextAttribute( outHandle, wAttributes ); DWORD dwWritten; - int length = (int)strlen( text ); - ::BOOL bSuccess = WriteConsoleA( GetStdHandle( STD_OUTPUT_HANDLE ), text, ( DWORD )length, &dwWritten, 0 ); + int length = (int)strlen( text ); + ::BOOL bSuccess = WriteConsoleA( outHandle, text, ( DWORD )length, &dwWritten, 0 ); assert( bSuccess ); + + // restore settings + ::SetConsoleTextAttribute( outHandle, csbiInfo.wAttributes ); } private: @@ -153,12 +163,21 @@ static bool consoleApp_; } logConsole_g; +bool debug_Log_available() +{ + return (GetStdHandle( STD_ERROR_HANDLE ) != 0); +} + void debug_Log( const std::string& what, logging::severity_t sev ) { if (what.empty()) return; + //AllocConsole(); // this would actually open a console window... + // save settings HANDLE outHandle = GetStdHandle( STD_ERROR_HANDLE ); + if (!outHandle) + return; CONSOLE_SCREEN_BUFFER_INFO csbiInfo; ::GetConsoleScreenBufferInfo( outHandle, &csbiInfo ); Added: trunk/yake/src/base/yakeFileLog.cpp =================================================================== --- trunk/yake/src/base/yakeFileLog.cpp (rev 0) +++ trunk/yake/src/base/yakeFileLog.cpp 2007-03-15 23:38:37 UTC (rev 1664) @@ -0,0 +1,53 @@ +/* + ------------------------------------------------------------------------------------ + 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/base/yakePCH.h> +#include <yake/base/yakeLog.h> +#include <yake/base/yakeFileLog.h> +#include <boost/lexical_cast.hpp> + +namespace yake { +namespace logging { + + file_listener::file_listener(const std::string& fileName) + { + fp_.open(fileName.c_str()); + fp_ << "// format:\n"; + fp_ << "// [processId][logId][threadId] [logLevel] message\n"; + fp_.flush(); + } + file_listener::~file_listener() + { + fp_.close(); + } + void file_listener::write(const severity_t sev, const char* msg, const char* logId, const char* procId, threadid_t threadId) + { + formatLogMessage(fp_, sev, msg, logId, procId, threadId ); + fp_.flush(); + } + +} // logging +} // yake Modified: trunk/yake/src/base/yakeLog.cpp =================================================================== --- trunk/yake/src/base/yakeLog.cpp 2007-03-15 22:06:56 UTC (rev 1663) +++ trunk/yake/src/base/yakeLog.cpp 2007-03-15 23:38:37 UTC (rev 1664) @@ -31,30 +31,29 @@ namespace yake { namespace logging { - void toStdErr(const severity_t sev, const char* logId, const char* procId, threadid_t threadId, const char* msg) + log_listener::~log_listener() {} + + void formatLogMessage(std::ostream& out, const severity_t sev, const char* msg, const char* logId, const char* procId, threadid_t threadId) { - std::ostringstream ss; - ss << "[" << (procId ? procId : "") << "]"; + out << "[" << (procId ? procId : "") << "]"; - ss << "[" << (logId ? logId : "") << "]"; + out << "[" << (logId ? logId : "") << "]"; - ss << "["; - ss << std::hex << threadId; - ss << "] "; + out << "["; + out << std::hex << threadId; + out << "] "; - ss << "["; - ss << toString(Severity(sev)); + out << "["; + out << toString(Severity(sev)); if (sev >= S_LAST) { - ss << "("; - ss << boost::lexical_cast<std::string>(sev); - ss << ")"; + out << "("; + out << boost::lexical_cast<std::string>(sev); + out << ")"; } - ss << "]"; + out << "]"; - ss << " " << msg << "\n"; - - native::debug_Log( ss.str(), sev ); + out << " " << msg << "\n"; } const char* toString(const Severity sev) @@ -84,19 +83,27 @@ void logger::enableSeverity(const severity_t sev, const bool on) { scoped_lock lock; - instance().enabledSeverities_[ sev ] = on; + this->enabledSeverities_[ sev ] = on; } void logger::enableLog(const char* logId, const bool on) { scoped_lock lock; instance().enabledLogs_[ std::string(logId ? logId : "") ] = on; } - int logger::addTarget(const LogFn fn) + void logger::addListener(log_listener* l) { + if (!l) + return; scoped_lock lock; - instance().targets_.push_back( fn ); - return 1; + instance().targets_.push_back( l ); } + void logger::removeListener(log_listener* l) + { + if (!l) + return; + scoped_lock lock; + instance().targets_.erase( std::find(instance().targets_.begin(), instance().targets_.end(), l) ); + } void logger::log(const severity_t sev, const char *logId, const char *msg) { instance().doLog(sev, logId, msg); @@ -114,10 +121,11 @@ return; const threadid_t threadId = native::getCurrentThreadId(); - TargetFnList::const_iterator itEnd = targets_.end(); - for (TargetFnList::const_iterator it = targets_.begin(); it != itEnd; ++it) + ListenerList::const_iterator itEnd = targets_.end(); + for (ListenerList::const_iterator it = targets_.begin(); it != itEnd; ++it) { - (**it)(sev,logId,instance().procId_.c_str(),threadId,msg); + (*it)->write(sev,msg,logId,procId_.c_str(),threadId); + //(**it)(sev,logId,instance().procId_.c_str(),threadId,msg); } } void logger::setProcessId(const String& pId) @@ -131,7 +139,7 @@ enableLog(0,true); for (severity_t i=0; i<S_LAST; ++i) enableSeverity( i, true ); - addTarget(&toStdErr); + //addTarget(&toStdErr); } } // logging Added: trunk/yake/src/base/yakeStderrLog.cpp =================================================================== --- trunk/yake/src/base/yakeStderrLog.cpp (rev 0) +++ trunk/yake/src/base/yakeStderrLog.cpp 2007-03-15 23:38:37 UTC (rev 1664) @@ -0,0 +1,54 @@ +/* + ------------------------------------------------------------------------------------ + 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/base/yakePCH.h> +#include <yake/base/yakeLog.h> +#include <yake/base/yakeStderrLog.h> +#include <yake/base/native/yakeNative.h> +#include <boost/lexical_cast.hpp> + +namespace yake { +namespace logging { + + stderr_listener::stderr_listener() + { + } + stderr_listener::~stderr_listener() + { + } + void stderr_listener::write(const severity_t sev, const char* msg, const char* logId, const char* procId, threadid_t threadId) + { + std::ostringstream ss; + formatLogMessage(ss, sev, msg, logId, procId, threadId ); + + if (native::debug_Log_available()) //@todo potential performance problem + native::debug_Log( ss.str(), sev ); + else + std::cerr << ss.str(); + } + +} // logging +} // yake Modified: trunk/yake/yake/base/native/yakeNative.h =================================================================== --- trunk/yake/yake/base/native/yakeNative.h 2007-03-15 22:06:56 UTC (rev 1663) +++ trunk/yake/yake/base/native/yakeNative.h 2007-03-15 23:38:37 UTC (rev 1664) @@ -46,6 +46,7 @@ // Debugging Interface. YAKE_BASE_API bool debug_AssertFailed( const char* pszMessage, const char* pszCondition, const char* pszFile, int nLine, bool& rbIgnoreAlways ); + YAKE_BASE_API bool debug_Log_available(); YAKE_BASE_API void debug_Log( const std::string& what, logging::severity_t ); YAKE_BASE_API void debug_Print( const char* string ); Modified: trunk/yake/yake/base/yake.h =================================================================== --- trunk/yake/yake/base/yake.h 2007-03-15 22:06:56 UTC (rev 1663) +++ trunk/yake/yake/base/yake.h 2007-03-15 23:38:37 UTC (rev 1664) @@ -52,6 +52,8 @@ #include "yakeString.h" #include "yakeException.h" #include "yakeLog.h" +#include "yakeStderrLog.h" +#include "yakeFileLog.h" #include "yakeOutputStream.h" #include "yakeUniqueName.h" #include "yakePlugin.h" Added: trunk/yake/yake/base/yakeFileLog.h =================================================================== --- trunk/yake/yake/base/yakeFileLog.h (rev 0) +++ trunk/yake/yake/base/yakeFileLog.h 2007-03-15 23:38:37 UTC (rev 1664) @@ -0,0 +1,48 @@ +/* + ------------------------------------------------------------------------------------ + 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_LOGGING_FILE_LOG_H +#define YAKE_LOGGING_FILE_LOG_H + +#include <yake/base/yakeLog.h> +#include <fstream> + +namespace yake { +namespace logging { + + struct YAKE_BASE_API file_listener : public log_listener + { + file_listener(const std::string& fileName); + virtual ~file_listener(); + virtual void write(const severity_t sev, const char* msg, const char* logId, const char* procId, threadid_t threadId); + private: + std::ofstream fp_; + }; +} // namespace logging +} // namespace yake + +#endif // YAKE_LOGGING_FILE_LOG_H + Modified: trunk/yake/yake/base/yakeLog.h =================================================================== --- trunk/yake/yake/base/yakeLog.h 2007-03-15 22:06:56 UTC (rev 1663) +++ trunk/yake/yake/base/yakeLog.h 2007-03-15 23:38:37 UTC (rev 1664) @@ -57,30 +57,41 @@ //helper: YAKE_BASE_API const char* toString(const Severity sev); + YAKE_BASE_API void formatLogMessage(std::ostream&, const severity_t sev, const char* msg, const char* logId, const char* procId, threadid_t threadId); - /** severity, processId, threadId, message */ - typedef void(*LogFn)(const severity_t, const char*, const char*, threadid_t, const char*); + /** */ + struct YAKE_BASE_API log_listener : public boost::noncopyable + { + virtual ~log_listener() = 0; + virtual void write(const severity_t sev, const char* msg, const char* logId, const char* procId, threadid_t threadId) = 0; + }; + + /** */ struct YAKE_BASE_API logger : public boost::noncopyable { //YAKE_BUILD_PHOENIX_SINGLETON(logger) //public private: //Make it private if PHOENIX is not used! logger(); - static logger& instance(); static logger instance_; public: + static logger& instance(); //static void log(const severity_t, const char* env, const char* src, const char* msg); - static void log(const severity_t, const char* logId, const char* msg); - static void setProcessId(const String&); - static int addTarget(const LogFn); - static void enableSeverity(const severity_t, const bool); - static void enableLog(const char* logId, const bool); + void log(const severity_t, const char* logId, const char* msg); + void setProcessId(const String&); + + /** @note Ownership is not transferred! */ + void addListener(log_listener*); + void removeListener(log_listener*); + + void enableSeverity(const severity_t, const bool); + void enableLog(const char* logId, const bool); private: //void doLog(const severity_t, const char* env, const char* msg); void doLog(const severity_t, const char* logId, const char* msg); private: String procId_; - typedef std::vector<LogFn> TargetFnList; - TargetFnList targets_; + typedef std::vector<log_listener*> ListenerList; + ListenerList targets_; typedef std::map<severity_t,bool> EnableMap; EnableMap enabledSeverities_; typedef std::map<std::string,bool> EnableLogIdMap; @@ -108,7 +119,7 @@ { std::stringstream ss; ss << LOG_TYPE(rhs); - logger::log(sev, logId, ss.str().c_str()); + logger::instance().log(sev, logId, ss.str().c_str()); } template<typename T1, typename T2> inline void log(const severity_t sev, const char* logId, const T1& rhs1, const T2& rhs2) @@ -116,7 +127,7 @@ std::stringstream ss; ss << LOG_TYPE(rhs1); ss << LOG_TYPE(rhs2); - logger::log(sev, logId, ss.str().c_str()); + logger::instance().log(sev, logId, ss.str().c_str()); } template<typename T1, typename T2, typename T3> inline void log(const severity_t sev, const char* logId, const T1& rhs1, const T2& rhs2, const T3& rhs3) @@ -125,26 +136,30 @@ ss << LOG_TYPE(rhs1); ss << LOG_TYPE(rhs2); ss << LOG_TYPE(rhs3); - logger::log(sev, logId, ss.str().c_str()); + logger::instance().log(sev, logId, ss.str().c_str()); } // short cuts inline void setProcessId(const String& procId) { - logger::setProcessId(procId); + logger::instance().setProcessId(procId); } inline void enableSeverity(const severity_t sev, const bool on) { - logger::enableSeverity(sev,on); + logger::instance().enableSeverity(sev,on); } inline void enableLog(const char* logId, const bool on) { - logger::enableLog(logId,on); + logger::instance().enableLog(logId,on); } - inline void addTarget(const LogFn fn) + inline void addListener(log_listener* l) { - logger::addTarget(fn); + logger::instance().addListener(l); } + inline void removeListener(log_listener* l) + { + logger::instance().removeListener(l); + } // helper stream operators inline std::ostream& operator << (std::ostream& out, const std::exception& rhs) Added: trunk/yake/yake/base/yakeStderrLog.h =================================================================== --- trunk/yake/yake/base/yakeStderrLog.h (rev 0) +++ trunk/yake/yake/base/yakeStderrLog.h 2007-03-15 23:38:37 UTC (rev 1664) @@ -0,0 +1,48 @@ +/* + ------------------------------------------------------------------------------------ + 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_LOGGING_STDERR_LOG_H +#define YAKE_LOGGING_STDERR_LOG_H + +#include <yake/base/yakeLog.h> +#include <fstream> + +namespace yake { +namespace logging { + + /** */ + struct YAKE_BASE_API stderr_listener : public log_listener + { + stderr_listener(); + virtual ~stderr_listener(); + virtual void write(const severity_t sev, const char* msg, const char* logId, const char* procId, threadid_t threadId); + }; + +} // namespace logging +} // namespace yake + +#endif // YAKE_LOGGING_STDERR_LOG_H + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <psy...@us...> - 2007-03-15 22:06:55
|
Revision: 1663 http://svn.sourceforge.net/yake/?rev=1663&view=rev Author: psyclonist Date: 2007-03-15 15:06:56 -0700 (Thu, 15 Mar 2007) Log Message: ----------- restructuring Added Paths: ----------- trunk/yake/common/bin/.keepme Removed Paths: ------------- trunk/yake/common/bin/release/ Added: trunk/yake/common/bin/.keepme =================================================================== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |