You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(622) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(303) |
Feb
(64) |
Mar
(5) |
Apr
(63) |
May
(82) |
Jun
(53) |
Jul
(50) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: stephan b. <sg...@us...> - 2004-12-28 22:46:12
|
Update of /cvsroot/pclasses/pclasses2/src/Util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23822/src/Util Modified Files: Makefile.am Log Message: Added: SimplePropertyStore.cpp StringTool.cpp Index: Makefile.am =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/Util/Makefile.am,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Makefile.am 22 Dec 2004 17:54:35 -0000 1.1.1.1 +++ Makefile.am 28 Dec 2004 22:46:03 -0000 1.2 @@ -1,6 +1,6 @@ INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include $(all_includes) METASOURCES = AUTO lib_LTLIBRARIES = libpclasses_util.la -libpclasses_util_la_SOURCES = ManagedThread.cpp ThreadPool.cpp WorkQueue.cpp +libpclasses_util_la_SOURCES = ManagedThread.cpp SimplePropertyStore.cpp StringTool.cpp ThreadPool.cpp WorkQueue.cpp libpclasses_util_la_LIBADD = $(top_builddir)/src/System/libpclasses_system.la \ $(top_builddir)/src/libpclasses.la |
From: Marc D. <ma...@us...> - 2004-12-28 22:36:53
|
Update of /cvsroot/pclasses/pclasses2/src/Util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21640/src/Util Added Files: Prefs.cpp Variant.cpp Log Message: added Prefs and Variant class to Util module --- NEW FILE: Variant.cpp --- #include "Variant.h" #include <sstream> #include <iostream> using namespace std; namespace P { namespace Ext { } } --- NEW FILE: Prefs.cpp --- #include "Prefs.h" #include <sstream> #include <iostream> using namespace std; namespace P { namespace Ext { Prefs::Section::Section(const std::string& name) { } Prefs::Section::~Section() { clear(); } void Prefs::Section::clear() { for(list<Section*>::iterator it = _sections.begin(); it != _sections.end(); ++it) { delete *it; } _sections.clear(); for(list<Entry*>::iterator it = _entries.begin(); it != _entries.end(); ++it) { delete *it; } _entries.clear(); } Prefs::Entry* Prefs::Section::entry(const std::string& name) { for(list<Entry*>::iterator it = _entries.begin(); it != _entries.end(); ++it) { if( (*it)->name() == name ) { return *it; } } return 0; } void Prefs::Section::addEntry(Prefs::Entry* entry) { _entries.push_back(entry); } void Prefs::Section::removeEntries(const std::string& name) { list<Entry*>::iterator it = _entries.begin(); while( it != _entries.end() ) { if( (*it)->name() == name ) { delete *it; it = _entries.erase(it); } else { ++it; } } } Prefs::Section* Prefs::Section::section(const std::string& name) { for(list<Section*>::iterator it = _sections.begin(); it != _sections.end(); ++it) { if( (*it)->name() == name ) { return *it; } } return 0; } void Prefs::Section::addSection(Section* section) { _sections.push_back(section); } void Prefs::Section::removeSections(const std::string& name) { list<Section*>::iterator it = _sections.begin(); while( it != _sections.end() ) { if( (*it)->name() == name ) { delete *it; it = _sections.erase(it); } else { ++it; } } } Prefs::Prefs(PrefsStore* store, const std::string& name) : _root(name), _store(store) { load(); } Prefs::~Prefs() { if(_store) delete _store; clear(); } void Prefs::clear() { _root.clear(); } void Prefs::load() throw(P::IOError) { if(!_store) return; clear(); _store->load(_root); } void Prefs::save() throw(P::IOError) { if(!_store) return; _store->update(_root); } Prefs::Section& Prefs::root() { return _root; } const Prefs::Section& Prefs::root() const { return _root; } PrefsStore* Prefs::store() { return _store; } const PrefsStore* Prefs::store() const { return _store; } void Prefs::setStore(PrefsStore* store) { _store = store; } } } |
From: Marc D. <ma...@us...> - 2004-12-28 22:36:52
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/Util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21640/include/pclasses/Util Added Files: Prefs.h Variant.h Log Message: added Prefs and Variant class to Util module --- NEW FILE: Prefs.h --- #ifndef Pext_Prefs_h #define Pext_Prefs_h #include <Variant.h> #include <pclasses/pexception.h> #include <string> #include <list> namespace P { namespace Ext { class PrefsStore; //! A class for preference management. class Prefs { public: //! Entries consist of a value and a name. class Entry { public: //! Constructs a new Entry. Entry(const std::string& name, const Variant& value) : _name(name), _value(value) {} //! Destructor. virtual ~Entry() {} //! Returns the name of the entry. const std::string name() const { return _name; } //! Sets the name of this entry void setName(const std::string& name) { _name = name; } //! Returns the value of this entry const Variant& value() { return _value; } //! Sets the value of this entry void setValue(const Variant& value) { _value = value; } //! Returns the value as string. virtual const std::string str() const {return _value.str();} private: std::string _name; Variant _value; }; //! Sections have a name and hold subsections and entries class Section { public: //! Constructs a new Section. Section(const std::string& name); //! Destructor. virtual ~Section(); //! Returns the name of this section. const std::string& name() const {return _name;} //! Sets the name of this section void setName(const std::string& name) {_name = name;} //! Removes all entries and subsections void clear(); //! Returns a list of all Entries. const std::list<Entry*>& entries() const { return _entries; } //! Finds an entry by name. Returns 0 if not found. Entry* entry(const std::string& name); //! Needs to be created with new void addEntry(Entry* entry); //! removes all entries with name. void removeEntries(const std::string& name); //! Returns a list of subsections const std::list<Section*>& sections() const {return _sections;} //! Finds section by name. Returns 0 if not found. Section* section(const std::string& name); //! Needs to be created with new. void addSection(Section* section); //! removes all sections with name void removeSections(const std::string& name); private: std::string _name; std::list<Entry*> _entries; std::list<Section*> _sections; }; public: Prefs(PrefsStore* store = 0, const std::string& name = "root"); virtual ~Prefs(); virtual void clear(); virtual void load() throw(P::IOError); virtual void save() throw(P::IOError); Section& root(); const Section& root() const; PrefsStore* store(); const PrefsStore* store() const; void setStore(PrefsStore* store); private: Section _root; PrefsStore* _store; }; class PrefsStore { public: PrefsStore() {} virtual ~PrefsStore() {} virtual void load(Prefs::Section& root) throw(P::IOError) = 0; virtual void update(Prefs::Section& root) throw(P::IOError) = 0; }; } // namespace P } // namesoace Ext #endif --- NEW FILE: Variant.h --- #ifndef P_Ext_Variant_h #define P_Ext_Variant_h #include <string> #include <iostream> #include <sstream> namespace P { namespace Ext { class Variant { public: Variant() throw() {} ~Variant() throw() {} template <typename T> Variant(const T & t ) throw() { operator=(t); } //! Efficiency overload. Variant( const std::string& f) throw() : m_data(f) { } //! See operator=(const char *) for a note about why this exists. Variant( const char* str ) throw() : m_data(str? str : "") { } //! Copies rhs's data to this object. Variant( const Variant& rhs ) throw() : m_data(rhs.m_data) { } //! Copies rhs's data and returns this object. inline Variant& operator=(const Variant& rhs ) throw() { if( &rhs != this ) this->m_data = rhs.m_data; return *this; } //! Sets this object's value and returns this object. template <typename T> inline Variant& operator=(const T& type ) throw() { std::ostringstream os; os << std::fixed << type; this->m_data = os.str(); return *this; } //! This overload exists to keep the compiler/linker //! from generating a new instantiation of this function //! for each differently-lengthed (const char *) //! which is assigned to a lex_t. inline Variant& operator=( const char* rhs ) throw() { this->m_data = rhs ? rhs : ""; return *this; } //! Returns (this-<str() < rhs.str()). inline bool operator<(const Variant& rhs) const { return this->str() < rhs.str(); } //! Returns (this-<str() > rhs.str()). inline bool operator>(const Variant& rhs) const { return this->str() > rhs.str(); } //! Returns (this-<str() < rhs.str()). inline bool operator<=(const Variant& rhs) const { return this->str() <= rhs.str(); } //! Returns (this-<str() > rhs.str()). inline bool operator>=(const Variant& rhs) const { return this->str() >= rhs.str(); } /** lexically casts str() to a Type, returning defVal if the cast fails. When calling this function you may need to use the following syntax to avoid compile errors: Foo foo = variant.template cast_to<Foo>(); (It's weird, i know, and the first time i saw it, finding the solution to took me days. (Thank you, Nicolai Josuttis!)) However, in normal usage you won't need to use this function, as the generic type conversion operator does the exact same thing: NOTE: why not throw an exception? */ template <typename T> T cast_to( const T& defVal = T() ) const throw() { std::istringstream is(this->m_data); if( !is ) return defVal; T retVal = T(); if(is >> retVal) return retVal; return defVal; } /** i used to LOVE C++... After writing this function i WORSHIP C++. The grace with which C++ handles this is pure magic, my friends. 16.8.2004 ----- stephan */ template <typename T> inline operator T() const throw() { return this->template cast_to<T>(); } //!Overload to avoid ambiguity in some cases. inline operator std::string() const throw() { return this->str(); } //! Returns the same as str(). operator std::string&() throw() { return this->m_data; } //! Returns the same as str(). operator const std::string&() const throw() { return this->m_data; } //! Overload to avoid ambiguity in some cases. //! Useful for mixing C and C++ APIs: inline operator const char*() const throw() { return this->str().c_str(); } //! Returns a reference to this object's raw string data. inline std::string & str() throw() { return this->m_data; } //! Returns a const reference to this object's raw string data. inline const std::string & str() const throw() { return this->m_data; } //! Returns true if this object contains no data, else false. inline bool empty() const { return this->m_data.empty(); } private: std::string m_data; }; //! Copies a.str() to std::ostream. inline std::ostream& operator<<(std::ostream& os, const Variant& v ) { return os << v.str(); } /** Reads from the input stream, appending to a.str() until the stream gives up. If the implementation of this function seems "wrong" to you, please read the justification in this paper: http://s11n.net/papers/lexically_casting.html NOTE: Url doesnt exist. Are we keeping this? */ inline std::istream & operator>>(std::istream& is, Variant& v) { char c; // while( std::getline( is, v.str() ).good() ); // ^^^ eeek! strips newlines! while( ! is.get(c).eof() ) { v.str().append( &c ); } return is; } /** Casts lhs to a T object and returns true only if that object compares as equal to rhs. NOTE: Is there an advantage not to have this operator in Variant? */ template <typename T> inline bool operator==(const Variant& lhs, const T& rhs ) { return lhs.template cast_to<T>() == rhs; } //! Returns lhs.str() == rhs.str(). inline bool operator==( const Variant& lhs, const Variant& rhs ) { return lhs.str() == rhs.str(); } /** Avoid an ambiguity... If rhs == 0 then this function returns true if lhs.empty(). */ inline bool operator==( const Variant& lhs, const char* rhs ) { if( ! rhs ) return lhs.empty(); return lhs.str() == std::string(rhs); } //! Avoid an ambiguity... inline bool operator==( const Variant& lhs, const std::string& rhs ) { return lhs.str() == rhs; } } } #include <Variant.tpp> #endif |
From: stephan b. <sg...@us...> - 2004-12-28 22:11:38
|
Update of /cvsroot/pclasses/pclasses2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17213 Modified Files: configure.pclasses2 Log Message: Fiddling with the placement of the -lexpat flag. Index: configure.pclasses2 =================================================================== RCS file: /cvsroot/pclasses/pclasses2/configure.pclasses2,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- configure.pclasses2 28 Dec 2004 19:52:48 -0000 1.16 +++ configure.pclasses2 28 Dec 2004 22:11:24 -0000 1.17 @@ -203,7 +203,7 @@ toc_export LIBPUTIL_CFLAGS="${THREADS_CFLAGS}" toc_export LIBPS11N_BASENAME=pclasses_s11n -toc_export LIBPS11N_LDADD="${expat_ldadd}" +toc_export LIBPS11N_LDADD="${LIBEXPAT_CLIENT_LDADD}" toc_export LIBPS11N_CLIENT_LDADD="-l${LIBPS11N_BASENAME}" toc_export LIBPS11N_CFLAGS="" |
From: stephan b. <sg...@us...> - 2004-12-28 22:04:34
|
Update of /cvsroot/pclasses/pclasses2/src/s11n In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15792/src/s11n Modified Files: S11nNode.h Log Message: Extended interface to include de/serialize() functions. Serializer-related funcs (load/save()) are not here, because that requires circular deps on the Serializers and S11nNode. Index: S11nNode.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/S11nNode.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- S11nNode.h 28 Dec 2004 16:05:15 -0000 1.2 +++ S11nNode.h 28 Dec 2004 22:04:23 -0000 1.3 @@ -5,6 +5,7 @@ #include <string> #include <pclasses/Util/SimplePropertyStore.h> #include <pclasses/s11n/traits.h> +#include <pclasses/s11n/data_node_serialize.h> namespace P { namespace SIO { @@ -25,19 +26,30 @@ use in s11n are defined in the s11n library manual (http://s11n.net/download/). + Maintainer reminder: don't just go changing this API + unless you also implement or change the node_traits + type to accomodate it. + */ class S11nNode : public ::P::Util::SimplePropertyStore { public: + typedef ::P::s11n::node_traits<S11nNode> traits_type; typedef ::P::Util::SimplePropertyStore ParentType; + /** Expected by s11n algos.*/ typedef ParentType::map_type map_type; + /** Expected by s11n algos.*/ typedef map_type::key_type key; + /** Expected by s11n algos.*/ typedef map_type::value_type value; + /** Expected by s11n algos.*/ typedef map_type::mapped_type mapped; + /** Expected by s11n algos.*/ typedef map_type::iterator iterator; + /** Expected by s11n algos.*/ typedef map_type::const_iterator const_iterator; - + /** Expected by s11n algos.*/ typedef std::list<S11nNode *> child_list_type; @@ -65,6 +77,45 @@ iterator S11nNode::end(); const_iterator S11nNode::end() const; + + template <typename SerializableT> + bool serialize( const SerializableT & src ) + { + return ::P::s11n::serialize<S11nNode,SerializableT>( *this, src ); + } + + template <typename SerializableType> + SerializableType * deserialize() const + { + return ::P::s11n::deserialize<S11nNode,SerializableType>( *this ); + } + + template <typename DeserializableT> + bool deserialize( DeserializableT & target ) const + { + return ::P::s11n::deserialize<S11nNode,DeserializableT>( *this, target ); + } + + template <typename SerializableType> + bool serializeSubnode( const std::string & subnodename, + const SerializableType & src ) + { + return ::P::s11n::serialize_subnode<S11nNode,SerializableType>( *this, subnodename, src ); + } + + template <typename DeserializableT> + DeserializableT * deserializeSubnode( const std::string & subnodename ) const + { + return ::P::s11n::deserialize_subnode<S11nNode,DeserializableT>( *this, subnodename ); + } + + template <typename DeserializableT> + bool deserializeSubnode(const std::string & subnodename, + DeserializableT & target ) const + { + return ::P::s11n::deserialize_subnode<S11nNode,DeserializableT>( *this, subnodename, target ); + } + protected: void copy( const S11nNode & rhs ); void clear_properties(); |
From: stephan b. <sg...@us...> - 2004-12-28 22:03:20
|
Update of /cvsroot/pclasses/pclasses2/src/s11n In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15557/src/s11n Modified Files: traits.h Log Message: Fixed a call to node.template get<>(), which is not the case any longer. Reminder to self: see if that same change works in the s11n 1.0.0 tree. Index: traits.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/traits.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- traits.h 26 Dec 2004 14:39:01 -0000 1.5 +++ traits.h 28 Dec 2004 22:03:11 -0000 1.6 @@ -231,7 +231,7 @@ const std::string & key, const ValueT & default_value ) { - return node.template get<ValueT>( key, default_value ); + return node.get( key, default_value ); } /** |
From: stephan b. <sg...@us...> - 2004-12-28 21:59:20
|
Update of /cvsroot/pclasses/pclasses2/src/s11n In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14504/src/s11n Modified Files: data_node_algo.h Log Message: Worked around a really weird type conversion problem caused by LexT(const T &) and S11nNode's use of map<string,LexT>. Index: data_node_algo.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/data_node_algo.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- data_node_algo.h 28 Dec 2004 04:18:52 -0000 1.4 +++ data_node_algo.h 28 Dec 2004 21:59:09 -0000 1.5 @@ -116,11 +116,42 @@ { typedef node_traits<NodeT> TR; typedef typename NodeT::child_list_type::const_iterator CIT; - CIT it = std::find_if( TR::children(parent).begin(), - TR::children(parent).end(), - same_name<NodeT>( name ) - ); - return (TR::children(parent).end() == it) ? 0 : *it; + CIT et = TR::children(parent).end(); + CIT it = TR::children(parent).begin(); + for( ; et != it; ++it ) + { + if( TR::name(*(*it)) == name ) + { + return *it; + } + } + +/************************************ + + Using find_if(), in some unusual circumstances: + +../include/pclasses/s11n/data_node_algo.h: In function `const NodeT* + P::s11n::find_child_by_name(const NodeT&, const std::string&) [with NodeT = + P::SIO::S11nNode]': +../include/pclasses/s11n/data_node_serialize.h:273: instantiated from `bool P::s11n::deserialize_subnode(const DataNodeType&, const std::string&,DeserializableT&) [with DataNodeType = P::SIO::S11nNode, DeserializableT = P::Time]' +../include/pclasses/s11n/proxy/Time_s11n.h:149: instantiated from here +../include/pclasses/s11n/data_node_algo.h:124: error: ISO C++ says that `bool + std::_List_iterator_base::operator==(const std::_List_iterator_base&) const' + and `bool P::Util::operator==(const P::Util::LexT&, const T&) [with T = + std::_List_iterator<P::SIO::S11nNode*, P::SIO::S11nNode* const&, + P::SIO::S11nNode* const*>]' are ambiguous even though the worst conversion + for the former is better than the worst conversion for the latter + +// it = std::find_if( TR::children(parent).begin(), +// et, +// same_name<NodeT>( name ) +// ); +// if( et == it ) +// { +// return (NodeT*)0; +// } +*******************************************/ + return 0; } /** @@ -140,11 +171,26 @@ { typedef node_traits<NodeT> TR; typedef typename NodeT::child_list_type::iterator IT; - IT it = std::find_if( TR::children(parent).begin(), - TR::children(parent).end(), - same_name<NodeT>( name ) - ); - return (TR::children(parent).end() == it) ? 0 : *it; + IT et = TR::children(parent).end(); + IT it = TR::children(parent).begin(); + for( ; et != it; ++it ) + { + if( TR::name(*(*it)) == name ) + { + return *it; + } + } + return 0; +// see notes in const version of this func: +// IT it = std::find_if( TR::children(parent).begin(), +// TR::children(parent).end(), +// same_name<NodeT>( name ) +// ); +// if( TR::children(parent).end() == it) +// { +// return (NodeT*)0; +// } +// return (NodeT *)*it; } |
From: stephan b. <sg...@us...> - 2004-12-28 21:58:38
|
Update of /cvsroot/pclasses/pclasses2/src/s11n/proxy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14309/src/s11n/proxy Modified Files: Time_s11n.h Log Message: Deser now works for Time/Date/DateTime. Index: Time_s11n.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/proxy/Time_s11n.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Time_s11n.h 28 Dec 2004 17:30:00 -0000 1.1 +++ Time_s11n.h 28 Dec 2004 21:58:25 -0000 1.2 @@ -12,23 +12,28 @@ #else +#define CONCRETE_NODE_TYPE ::P::SIO::S11nNode + //////////////////////////////////////////////////////////////////////// // Time proxy //////////////////////////////////////////////////////////////////////// #if !defined(p_TIME_REGISTERED_WITH_S11N) # define p_TIME_REGISTERED_WITH_S11N 1 # include <pclasses/Time.h> + namespace P { + using ::P::Time; struct Time_s11n { // serialize - template <typename NodeT> - bool operator()( NodeT & dest, const Time & src ) const +// template <typename CONCRETE_NODE_TYPE> + bool operator()( CONCRETE_NODE_TYPE & dest, const Time & src ) const { - typedef ::P::s11n::node_traits<NodeT> TR; - TR::class_name( dest, ::classname<Time>() ); + typedef ::P::s11n::node_traits<CONCRETE_NODE_TYPE> TR; + TR::class_name( dest, "P::Time" ); + // don't use ::classname<Time>() here: it causes an ODR violation :( # define SSET(K,F) TR::set( dest, std::string(K), src.F() ); SSET("sec", second ); SSET("min", minute ); @@ -39,15 +44,15 @@ } // deserialize - template <typename NodeT> - bool operator()( const NodeT & src, tm & dest ) const +// template <typename CONCRETE_NODE_TYPE> + bool operator()( const CONCRETE_NODE_TYPE & src, Time & dest ) const { - typedef s11n::node_traits<NodeT> TR; -# define SGET(K,SF,GF) dest.SF( TR::get( src, std::string(K), src.GF() ) ); - SET("sec", setSecond, second ); - SET("min", setMinute, minute ); - SET("hour", setHour, hour ); - SET("usec", setUsec, usec ); + typedef s11n::node_traits<CONCRETE_NODE_TYPE> TR; +# define SGET(K,SF,GF) dest.SF( TR::get( src, std::string(K), dest.GF() ) ); + SGET("sec", setSecond, second ); + SGET("min", setMinute, minute ); + SGET("hour", setHour, hour ); + SGET("usec", setUsec, usec ); # undef SGET return true; @@ -70,15 +75,16 @@ # include <pclasses/Date.h> namespace P { + using ::P::Date; struct Date_s11n { // serialize - template <typename NodeT> - bool operator()( NodeT & dest, const Date & src ) const +// template <typename CONCRETE_NODE_TYPE> + bool operator()( CONCRETE_NODE_TYPE & dest, const Date & src ) const { - typedef ::P::s11n::node_traits<NodeT> TR; - TR::class_name( dest, ::classname<Date>() ); + typedef ::P::s11n::node_traits<CONCRETE_NODE_TYPE> TR; + TR::class_name( dest, "P::Date" ); # define SSET(K,F) TR::set( dest, std::string(K), src.F() ); SSET("year", year ); SSET("month", month ); @@ -88,14 +94,14 @@ } // deserialize - template <typename NodeT> - bool operator()( const NodeT & src, tm & dest ) const +// template <typename CONCRETE_NODE_TYPE> + bool operator()( const CONCRETE_NODE_TYPE & src, Date & dest ) const { - typedef s11n::node_traits<NodeT> TR; -# define SGET(K,SF,GF) dest.SF( TR::get( src, std::string(K), src.GF() ) ); - SET("year", setYear, year ); - SET("month", setMonth, month ); - SET("day", setDay, day ); + typedef s11n::node_traits<CONCRETE_NODE_TYPE> TR; +# define SGET(K,SF,GF) dest.SF( TR::get( src, std::string(K), dest.GF() ) ); + SGET("year", setYear, year ); + SGET("month", setMonth, month ); + SGET("day", setDay, day ); # undef SGET return true; @@ -118,29 +124,33 @@ # include <pclasses/DateTime.h> namespace P { + using ::P::DateTime; struct DateTime_s11n { // serialize - template <typename NodeT> - bool operator()( NodeT & dest, const DateTime & src ) const +// template <typename CONCRETE_NODE_TYPE> + bool operator()( CONCRETE_NODE_TYPE & dest, const DateTime & src ) const { - typedef ::P::s11n::node_traits<NodeT> TR; - TR::class_name( dest, ::classname<DateTime>() ); + typedef ::P::s11n::node_traits<CONCRETE_NODE_TYPE> TR; + TR::class_name( dest, "P::DateTime" ); using namespace ::P::s11n; - bool worked = serialize_subnode<NodeT,Time>( dest, "time", src ); - worked = worked && serialize_subnode<NodeT,Date>( dest, "date", src ); + bool worked = serialize_subnode<CONCRETE_NODE_TYPE,Time>( dest, "time", src ); + worked = worked && serialize_subnode<CONCRETE_NODE_TYPE,Date>( dest, "date", src ); return worked; } // deserialize - template <typename NodeT> - bool operator()( const NodeT & src, tm & dest ) const +// template <typename CONCRETE_NODE_TYPE> + bool operator()( const CONCRETE_NODE_TYPE & src, DateTime & dest ) const { - typedef s11n::node_traits<NodeT> TR; + typedef s11n::node_traits<CONCRETE_NODE_TYPE> TR; using namespace ::P::s11n; - bool worked = deserialize_subnode<NodeT,Time>( src, "time", dest ); - worked = worked && deserialize_subnode<NodeT,Date>( dest, "date", dest ); + bool worked = deserialize_subnode<CONCRETE_NODE_TYPE,Time>( src, "time", dest ); + if( worked ) + { + worked = deserialize_subnode<CONCRETE_NODE_TYPE,Date>( src, "date", dest ); + } return worked; } }; // DateTime_s11n @@ -152,7 +162,7 @@ # include <pclasses/s11n/reg_serializable_traits.h> #endif // p_DATETIME_REGISTERED_WITH_S11N - +#undef CONCRETE_NODE_TYPE #endif // PCLASSES_S11N_INCLUDED //////////////////////////////////////////////////////////////////////// |
From: Christian P. <cp...@us...> - 2004-12-28 20:39:14
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32446/src/System Modified Files: SystemClock.win32.cpp Log Message: Fixed SystemClock::now() - should compile now. Index: SystemClock.win32.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/SystemClock.win32.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- SystemClock.win32.cpp 28 Dec 2004 20:19:44 -0000 1.1 +++ SystemClock.win32.cpp 28 Dec 2004 20:39:02 -0000 1.2 @@ -32,7 +32,7 @@ switch(mode) { - case Local: tzname = currentTimeZone(); + case Local: tzname = timeZone(); GetLocalTime(&st); break; |
From: Christian P. <cp...@us...> - 2004-12-28 20:35:58
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31913/src/System Modified Files: Makefile.am Log Message: Fixed typo SharedLib.comon.cpp ==> SharedLib.common.cpp. Added SystemClock sources. Index: Makefile.am =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/Makefile.am,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Makefile.am 28 Dec 2004 15:10:52 -0000 1.4 +++ Makefile.am 28 Dec 2004 20:35:47 -0000 1.5 @@ -65,6 +65,14 @@ IO_Sources = Pipe.win32.cpp File.win32.cpp FileInfo.win32.cpp Directory.win32.cpp endif +if WITH_POSIX_TIME +Time_Sources = SystemClock.posix.cpp +endif + +if WITH_WIN32_TIME +Time_Sources = SystemClock.win32.cpp +endif + INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include $(all_includes) METASOURCES = AUTO @@ -73,7 +81,8 @@ libpclasses_system_la_SOURCES = timeout.cpp SystemError.cpp \ CriticalSection.cpp Mutex.cpp $(Thread_Sources) \ $(Semaphore_Sources) $(SharedMem_Sources) $(SharedLib_Sources) \ - SharedLib.comon.cpp FileInfo.common.cpp $(IO_Sources) + SharedLib.common.cpp FileInfo.common.cpp $(IO_Sources) \ + $(Time_Sources) libpclasses_system_la_LDFLAGS = -no-undefined libpclasses_system_la_LIBADD = $(top_builddir)/src/libpclasses.la \ |
From: Christian P. <cp...@us...> - 2004-12-28 20:34:28
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31657/include/pclasses/System Modified Files: SystemClock.h Log Message: Added default arg for mode Index: SystemClock.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/System/SystemClock.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- SystemClock.h 28 Dec 2004 20:08:29 -0000 1.1 +++ SystemClock.h 28 Dec 2004 20:34:19 -0000 1.2 @@ -37,7 +37,7 @@ }; //! Fetch current system time - static DateTime now(NowMode mode); + static DateTime now(NowMode mode = Local); //! Fetch current system timezone static std::string timeZone(); |
From: Christian P. <cp...@us...> - 2004-12-28 20:28:32
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30536/include/pclasses/System Modified Files: Makefile.am Log Message: Added SystemClock.h Index: Makefile.am =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/System/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile.am 27 Dec 2004 07:07:20 -0000 1.2 +++ Makefile.am 28 Dec 2004 20:28:21 -0000 1.3 @@ -2,4 +2,4 @@ METASOURCES = AUTO pkginclude_HEADERS = SystemError.h SharedMemory.h CriticalSection.h Mutex.h \ Condition.h Semaphore.h Thread.h SharedLib.h File.h FileInfo.h \ - Directory.h + Directory.h SystemClock.h |
From: stephan b. <sg...@us...> - 2004-12-28 20:21:32
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29446/src/System Modified Files: Makefile.toc Log Message: Added SystemClock.win32 Index: Makefile.toc =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/Makefile.toc,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- Makefile.toc 28 Dec 2004 20:20:18 -0000 1.16 +++ Makefile.toc 28 Dec 2004 20:21:19 -0000 1.17 @@ -63,7 +63,8 @@ CriticalSection.win32.cpp \ Mutex.win32.cpp \ Semaphore.win32.cpp \ - SharedLib.win32.cpp + SharedLib.win32.cpp \ + SystemClock.win32.cpp ############################################## # TODO: use the config-mandated BUILD_SOURCES! |
From: stephan b. <sg...@us...> - 2004-12-28 20:20:28
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29270/src/System Modified Files: Makefile.toc Log Message: Added SystemClock. Index: Makefile.toc =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/Makefile.toc,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- Makefile.toc 28 Dec 2004 18:39:43 -0000 1.15 +++ Makefile.toc 28 Dec 2004 20:20:18 -0000 1.16 @@ -56,6 +56,7 @@ Pipe.posix.cpp \ Semaphore.posix.cpp \ SharedMemory.posix.cpp \ + SystemClock.posix.cpp \ Thread.posix.cpp SOURCES_WIN32 = Condition.win32.cpp \ |
From: Christian P. <cp...@us...> - 2004-12-28 20:19:53
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29088/src/System Added Files: SystemClock.win32.cpp Log Message: Added win32 implementation of SystemClock class --- NEW FILE: SystemClock.win32.cpp --- /*************************************************************************** * Copyright (C) 2004 by Christian Prochnow * * cp...@se... * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library 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 General Public License for more details. * * * * You should have received a copy of the GNU Library 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. * ***************************************************************************/ #include "pclasses/System/SystemClock.h" #include <windows.h> namespace P { namespace System { DateTime SystemClock::now(NowMode mode) { SYSTEMTIME st; std::string tzname; switch(mode) { case Local: tzname = currentTimeZone(); GetLocalTime(&st); break; case UTC: tzname = "UTC"; GetSystemTime(&st); break; }; return DateTime(Date(st.wYear, st.wMonth, st.wDay), Time(st.wHour, st.wMinute, st.wSecond, st.wMilliseconds * 1000), tzname); } std::string SystemClock::timeZone() { time_t timet = time(0); std::string tz_name; struct tm* currtm = localtime(&timet); char tmp[256]; sprintf(tmp, "GMT%+d", -(_timezone / 3600)); tz_name = tmp; /*if(!currtm) tz_name = tzname[0]; else tz_name = currtm->tm_isdst > 0 ? _tzname[1] : _tzname[0];*/ return tz_name; } } // !namespace System } // !namespace P |
From: Christian P. <cp...@us...> - 2004-12-28 20:08:41
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26758/src/System Added Files: SystemClock.posix.cpp Log Message: Added System::SystemClock class --- NEW FILE: SystemClock.posix.cpp --- /*************************************************************************** * Copyright (C) 2004 by Christian Prochnow * * cp...@se... * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library 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 General Public License for more details. * * * * You should have received a copy of the GNU Library 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. * ***************************************************************************/ #include "pclasses/pclasses-config.h" #include "pclasses/System/CriticalSection.h" #include "pclasses/System/SystemClock.h" #ifdef PCLASSES_HAVE_GETTIMEOFDAY # include <sys/time.h> #endif namespace P { namespace System { #ifndef PCLASSES_HAVE_LOCALTIME_R static CriticalSection localtimeCs; #endif #ifndef PCLASSES_HAVE_GMTIME_R static CriticalSection gmtimeCs; #endif const std::string& get_tz_name(struct tm* tztime) { static bool tz_name_Init = false; static std::string tz_names[3]; /* init timezone names copying it from libc's external variable */ if(!tz_name_Init) { static CriticalSection tz_name_InitCs; CriticalSection::ScopedLock lock(tz_name_InitCs); tz_name_Init = true; tz_names[0] = tzname[0]; tz_names[1] = tzname[1]; tz_names[2] = "Unknown"; } if(tztime->tm_isdst > 0) { /* daylight saving time */ return tz_names[1]; } else if(tztime->tm_isdst == 0) { /* no daylight saving time */ return tz_names[2]; } /* daylight saving time is unknown */ return tz_names[3]; } DateTime SystemClock::now(NowMode mode) { std::string timezone_name; time_t secs, usecs; struct tm currtm, *currtmp; #ifdef PCLASSES_HAVE_CLOCK_GETTIME { struct timespec tp; clock_gettime(CLOCK_REALTIME, &tp); secs = tp.tv_sec; usecs = tp.tv_nsec / 1000; } #elif defined(PCLASSES_HAVE_GETTIMEOFDAY) { struct timeval tv; gettimeofday(&tv, 0); secs = tv.tv_sec; usecs = tv.tv_usec; } #else { secs = time(0); usecs = 0; } #endif switch(mode) { case Local: #ifdef PCLASSES_HAVE_LOCALTIME_R { currtmp = localtime_r(&secs, &currtm); if(!currtmp) return DateTime(); } #else { CriticalSection::ScopedLock l(localtimeCs); currtmp = localtime(&secs); if(!currtmp) return DateTime(); currtm = *currtmp; currtmp = &currtm; } #endif timezone_name = get_tz_name(currtmp); break; case UTC: #ifdef PCLASSES_HAVE_GMTIME_R { currtmp = gmtime_r(&secs, &currtm); if(!currtmp) return DateTime(); } #else { CriticalSection::ScopedLock l(gmtimeCs); currtmp = gmtime(&secs); if(!currtmp) return DateTime(); currtm = *currtmp; currtmp = &currtm; } #endif timezone_name = "UTC"; break; } return DateTime(Date(currtmp->tm_year + 1900, currtmp->tm_mon + 1, currtmp->tm_mday), Time(currtmp->tm_hour, currtmp->tm_min, currtmp->tm_sec, usecs), timezone_name); } std::string SystemClock::timeZone() { time_t timet = time(0); struct tm* currtmp; #ifdef PCLASSES_HAVE_LOCALTIME_R struct tm currtm; currtmp = localtime_r(&timet, &currtm); #else CriticalSection::ScopedLock l(localtimeCs); currtmp = localtime(&timet); #endif return get_tz_name(currtmp); } } // !namespace System } // !namespace P |
From: Christian P. <cp...@us...> - 2004-12-28 20:08:39
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26758/include/pclasses/System Added Files: SystemClock.h Log Message: Added System::SystemClock class --- NEW FILE: SystemClock.h --- /*************************************************************************** * Copyright (C) 2004 by Christian Prochnow * * cp...@se... * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library 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 General Public License for more details. * * * * You should have received a copy of the GNU Library 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. * ***************************************************************************/ #ifndef P_System_SystemClock_h #define P_System_SystemClock_h #include <pclasses/DateTime.h> #include <string> namespace P { namespace System { class SystemClock { public: //! Operation mode for now() enum NowMode { Local, /*!< Retrieve current system time in local time */ UTC /*!< Retrieve current system time in UTC */ }; //! Fetch current system time static DateTime now(NowMode mode); //! Fetch current system timezone static std::string timeZone(); }; } //! namespace System } //! namespace P #endif |
From: stephan b. <sg...@us...> - 2004-12-28 19:52:58
|
Update of /cvsroot/pclasses/pclasses2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24285 Modified Files: configure.pclasses2 Log Message: Added wget check when src/Unicode/UnicodeData.txt does not exist. Index: configure.pclasses2 =================================================================== RCS file: /cvsroot/pclasses/pclasses2/configure.pclasses2,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- configure.pclasses2 26 Dec 2004 14:39:48 -0000 1.15 +++ configure.pclasses2 28 Dec 2004 19:52:48 -0000 1.16 @@ -28,6 +28,13 @@ toc_test bzlib toc_test zlib +UCD=./src/Unicode/UnicodeData.txt +test -e $UCD || { + echo "Download of $UCD needs wget..." + toc_find wget "${configure_with_wget}:${prefix}/bin:$PATH}" \ + && toc_export WGET_BIN="${TOC_FIND_RESULT}" +} + ############################################################ # supplemental libs |
From: stephan b. <sg...@us...> - 2004-12-28 19:49:14
|
Update of /cvsroot/pclasses/pclasses2/src/Unicode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23657 Modified Files: Makefile.toc Log Message: seem to have fixed a deps problem Index: Makefile.toc =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/Unicode/Makefile.toc,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Makefile.toc 28 Dec 2004 19:43:45 -0000 1.6 +++ Makefile.toc 28 Dec 2004 19:49:05 -0000 1.7 @@ -27,6 +27,8 @@ UNICODE_DATA_FILE = UnicodeData.txt UNICODE_DATA_URL = http://www.unicode.org/Public/UNIDATA/$(UNICODE_DATA_FILE) +UD_GENERATOR = ./unicodedata.awk + DIST_FILES += $(SOURCES) $(UNICODE_DATA_FILE) $(SOURCES_UNICODE_GEN) @@ -50,6 +52,7 @@ # If we have wget we will try to use it to "build" $(UNICODE_DATA_FILE). ifneq (,$(WGET_BIN)) $(UNICODE_DATA_FILE): + @echo "Trying to download $(UNICODE_DATA_FILE)..." $(WGET_BIN) --passive-ftp $(UNICODE_DATA_URL) else $(UNICODE_DATA_FILE): @@ -66,7 +69,7 @@ ifeq (1,$(THIS_IS_A_DEV_TREE)) CLEAN_FILES += $(SOURCES_UNICODE_GEN) $(SOURCES_UNICODE_GEN): $(UNICODE_DATA_FILE) - $(AWK_BIN) -f $(top_srcdir)/src/Unicode/unicodedata.awk $(UNICODE_DATA_FILE) >unicodedata.h + $(AWK_BIN) -f $(UD_GENERATOR) $(UNICODE_DATA_FILE) >unicodedata.h else ###### for "mere mortal" trees, use the shipped copies and don't delete them: $(SOURCES_UNICODE_GEN): |
From: stephan b. <sg...@us...> - 2004-12-28 19:43:55
|
Update of /cvsroot/pclasses/pclasses2/src/Unicode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22850/src/Unicode Modified Files: Makefile.toc Log Message: Now differentiates between dev and dist trees for purposes of cleaning (or not) unicode-related in/out files. Index: Makefile.toc =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/Unicode/Makefile.toc,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Makefile.toc 24 Dec 2004 23:06:27 -0000 1.5 +++ Makefile.toc 28 Dec 2004 19:43:45 -0000 1.6 @@ -1,55 +1,81 @@ #!/usr/bin/make -f include toc.make +######################################################################## +# If this is a dev tree we need to treat some generated files differently +# than a dist tree... +ifneq (,$(wildcard ./CVS/*)) + THIS_IS_A_DEV_TREE = 1 +else + THIS_IS_A_DEV_TREE = 0 +endif + SOURCES = Char.cpp \ String.cpp \ TextStream.cpp -SOURCES_GEN = unicodedata.h unicodedata_extra.h +SOURCES_UNICODE_GEN = unicodedata.h unicodedata_extra.h + +INSTALL_HEADERS = $(SOURCES_UNICODE_GEN) OBJECTS = Char.o \ String.o \ TextStream.o -$(OBJECTS): $(SOURCES_GEN) +$(OBJECTS): $(SOURCES_UNICODE_GEN) + +UNICODE_DATA_FILE = UnicodeData.txt +UNICODE_DATA_URL = http://www.unicode.org/Public/UNIDATA/$(UNICODE_DATA_FILE) -DIST_FILES += $(SOURCES) + +DIST_FILES += $(SOURCES) $(UNICODE_DATA_FILE) $(SOURCES_UNICODE_GEN) CLEAN_FILES += $(OBJECTS) -build_libs = 1 LIBNAME = lib$(LIBPUNICODE_BASENAME) -ifeq (1,$(build_libs)) - STATIC_LIBS = $(LIBNAME) - SHARED_LIBS = $(STATIC_LIBS) - SHARED_LIBS_LDADD = $(P_BACKLINK_LDADD) $(LIBPUNICODE_LDADD) - $(LIBNAME)_a_OBJECTS = $(OBJECTS) - $(LIBNAME)_so_OBJECTS = $($(LIBNAME)_a_OBJECTS) - $(LIBNAME)_so_VERSION = $(PACKAGE_VERSION) +STATIC_LIBS = $(LIBNAME) +SHARED_LIBS = $(STATIC_LIBS) +SHARED_LIBS_LDADD = $(P_BACKLINK_LDADD) $(LIBPUNICODE_LDADD) +$(LIBNAME)_a_OBJECTS = $(OBJECTS) +$(LIBNAME)_so_OBJECTS = $($(LIBNAME)_a_OBJECTS) +$(LIBNAME)_so_VERSION = $(PACKAGE_VERSION) # $(LIBNAME)_so_LDADD = - include $(TOC_MAKESDIR)/SHARED_LIBS.make - include $(TOC_MAKESDIR)/STATIC_LIBS.make - # Run targets STATIC_LIBS and SHARED_LIBS build these. -endif +include $(TOC_MAKESDIR)/SHARED_LIBS.make +include $(TOC_MAKESDIR)/STATIC_LIBS.make +# Run targets STATIC_LIBS and SHARED_LIBS build these. -UNICODE_DATA_FILE = UnicodeData.txt -UNICODE_DATA_URL = http://www.unicode.org/Public/UNIDATA/$(UNICODE_DATA_FILE) -INSTALL_HEADERS = $(SOURCES_GEN) -$(UNICODE_DATA_FILE): - wget --passive-ftp $(UNICODE_DATA_URL) -$(SOURCES_GEN): $(UNICODE_DATA_FILE) - $(AWK_BIN) -f $(top_srcdir)/src/Unicode/unicodedata.awk $(UNICODE_DATA_FILE) >unicodedata.h -UNICODE_CLEAN_FILES = $(SOURCES_GEN) +######################################################################## +# If we have wget we will try to use it to "build" $(UNICODE_DATA_FILE). +ifneq (,$(WGET_BIN)) +$(UNICODE_DATA_FILE): + $(WGET_BIN) --passive-ftp $(UNICODE_DATA_URL) +else +$(UNICODE_DATA_FILE): + @echo "You need to install a copy of $(UNICODE_DATA_URL) in this dir!"; \ + echo "If configure finds 'wget' this can be done automatically."; \ + exit 1 +endif +# ^^^^ !WGET_BIN +######################################################################## -ifneq (,$(wildcard $(UNICODE_DATA_FILE))) -CLEAN_FILES += $(UNICODE_CLEAN_FILES) -# we can afford this if we don't need to download the data file + +######################################################################## +# For dev tree allow clean and rebuild of gen'd files... +ifeq (1,$(THIS_IS_A_DEV_TREE)) +CLEAN_FILES += $(SOURCES_UNICODE_GEN) +$(SOURCES_UNICODE_GEN): $(UNICODE_DATA_FILE) + $(AWK_BIN) -f $(top_srcdir)/src/Unicode/unicodedata.awk $(UNICODE_DATA_FILE) >unicodedata.h +else +###### for "mere mortal" trees, use the shipped copies and don't delete them: +$(SOURCES_UNICODE_GEN): + @true endif +######################################################################## -STATIC_LIBS: $(SOURCES_GEN) +STATIC_LIBS: $(SOURCES_UNICODE_GEN) SHARED_LIBS: STATIC_LIBS all: STATIC_LIBS SHARED_LIBS |
From: stephan b. <sg...@us...> - 2004-12-28 18:39:53
|
Update of /cvsroot/pclasses/pclasses2/src/System In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9438/src/System Modified Files: Makefile.toc Log Message: Removed the conditional around the libs build - we always want them built. Index: Makefile.toc =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/System/Makefile.toc,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- Makefile.toc 28 Dec 2004 15:10:52 -0000 1.14 +++ Makefile.toc 28 Dec 2004 18:39:43 -0000 1.15 @@ -9,7 +9,6 @@ INSTALL_PACKAGE_HEADERS = $(HEADERS) INSTALL_PACKAGE_HEADERS_DEST = $(INSTALL_PACKAGE_HEADERS_BASE)/System - SOURCES_COMMON = \ CriticalSection.cpp \ CriticalSection.generic.cpp \ @@ -85,21 +84,17 @@ # $(warning LIBPSYSTEM_LDADD=$(LIBPSYSTEM_LDADD)) LIBNAME = lib$(LIBPSYSTEM_BASENAME) -build_libs = 1 -ifeq (1,$(build_libs)) - STATIC_LIBS = $(LIBNAME) - SHARED_LIBS = $(STATIC_LIBS) +STATIC_LIBS = $(LIBNAME) +SHARED_LIBS = $(STATIC_LIBS) # SHARED_LIBS_LDADD = $(LIBPSYSTEM_LDADD) - $(LIBNAME)_a_OBJECTS = $(OBJECTS) - $(LIBNAME)_so_OBJECTS = $($(LIBNAME)_a_OBJECTS) - $(LIBNAME)_so_VERSION = $(PACKAGE_VERSION) - $(LIBNAME)_so_LDADD = $(P_BACKLINK_LDADD) $(LIBPSYSTEM_LDADD) -# $(warning $(LIBNAME)_so_LDADD = $($(LIBNAME)_so_LDADD)) - include $(TOC_MAKESDIR)/SHARED_LIBS.make - include $(TOC_MAKESDIR)/STATIC_LIBS.make - # Run targets STATIC_LIBS and SHARED_LIBS build these. +$(LIBNAME)_a_OBJECTS = $(OBJECTS) +$(LIBNAME)_so_OBJECTS = $($(LIBNAME)_a_OBJECTS) +$(LIBNAME)_so_VERSION = $(PACKAGE_VERSION) +$(LIBNAME)_so_LDADD = $(P_BACKLINK_LDADD) $(LIBPSYSTEM_LDADD) +include $(TOC_MAKESDIR)/SHARED_LIBS.make +include $(TOC_MAKESDIR)/STATIC_LIBS.make SHARED_LIBS: STATIC_LIBS -endif + BIN_PROGRAMS = testPathFinder testMime testPathFinder_bin_OBJECTS = testPathFinder.o PathFinder.o @@ -107,7 +102,5 @@ include $(TOC_MAKESDIR)/BIN_PROGRAMS.make BIN_PROGRAMS: SHARED_LIBS + all: SHARED_LIBS -################################################### -# end auto-generated rules -################################################### |
From: stephan b. <sg...@us...> - 2004-12-28 17:32:29
|
Update of /cvsroot/pclasses/pclasses2/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28211/test Modified Files: s11nTest.cpp Log Message: Now demonstrates Time, Date, and DateTime s11n. Index: s11nTest.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/test/s11nTest.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- s11nTest.cpp 28 Dec 2004 04:24:17 -0000 1.6 +++ s11nTest.cpp 28 Dec 2004 17:32:19 -0000 1.7 @@ -5,7 +5,10 @@ #include <pclasses/s11n/pods_streamable.h> #include <pclasses/s11n/list.h> #include <pclasses/s11n/map.h> -#include <pclasses/Util/LexT.h> + +#include <pclasses/s11n/proxy/Time_s11n.h> +#include <pclasses/s11n/proxy/LexT_s11n.h> + #include <pclasses/Util/StringTool.h> #include <memory> // auto_ptr #include <cassert> @@ -18,7 +21,7 @@ typedef std::list<std::string> TestListType2; typedef std::list<P::Util::LexT> TestListType; -// compiler bug, gcc 3.3.5 20040809 +// compiler bug, gcc 3.3.5 20040809: // When adding :: before P in the above decl it fails // with a 'parse error before :', but it allows // me to do :: on the map here: @@ -444,5 +447,17 @@ CERR << "casted-to list (size=="<<list2.size()<<"):\n"; save( list2, std::cout ); + + CERR << "Time...\n"; + using P::Time; + using P::Date; + using P::DateTime; + Time thetime( 12, 13, 14 ); + Date thedate( 2005, 1, 30 ); + DateTime dt( thedate, thetime ); + save( thetime, std::cout ); + save( thedate, std::cout ); + save( dt, std::cout ); + return 0; } |
From: stephan b. <sg...@us...> - 2004-12-28 17:31:54
|
Update of /cvsroot/pclasses/pclasses2/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28053/test Modified Files: SimplePropertyStoreTest.cpp Log Message: Accomodated s11n-related changes. Index: SimplePropertyStoreTest.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/test/SimplePropertyStoreTest.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- SimplePropertyStoreTest.cpp 27 Dec 2004 23:14:11 -0000 1.3 +++ SimplePropertyStoreTest.cpp 28 Dec 2004 17:31:40 -0000 1.4 @@ -4,6 +4,7 @@ #include <pclasses/s11n/pods_streamable.h> #include <pclasses/s11n/map.h> #include <pclasses/Util/SimplePropertyStore.h> +#include <pclasses/s11n/proxy/SimplePropertyStore_s11n.h> #include <memory> // auto_ptr #include <cassert> #include <list> @@ -15,23 +16,6 @@ #define PropMap P::Util::SimplePropertyStore -#define USE_FAT_PROXIES 0 -#if ! USE_FAT_PROXIES -# define PS11N_TYPE PropMap -# define PS11N_TYPE_NAME "SomeSillyPropertyMap" -# define PS11N_SERIALIZE_FUNCTOR \ - ::P::s11n::map::map_serializable_proxy -// ::P::s11n::map::streamable_map_serializable_proxy -# include <pclasses/s11n/reg_serializable_traits.h> -#endif // ! USE_FAT_PROXIES - - -#define SERIALIZE(Node,SType,SObj) serialize< SType >( Node, SObj ) -#define DESERIALIZE(Node,SType) deserialize< SType >( Node ) - -// #define SERIALIZER_CLASS_NAME "parens" -#define SERIALIZER_CLASS_NAME "expat" - // i wish i could make this a P::App... int main( int argc, char ** argv ) { @@ -47,8 +31,10 @@ m["days_in_december"] = 31; m["days_in_february"] = 28.5; m["the_letter_a"] = 'a'; - m["0"] = false; - m["1"] = true; +// note: numeric keys are inherently dangerous because not all Serializers +// can read them (e.g., XML-compliant Serializers). +// m["0"] = false; +// m["1"] = true; CERR << "days_in_february == " << m["days_in_february"] << "\n"; |
From: stephan b. <sg...@us...> - 2004-12-28 17:31:29
|
Update of /cvsroot/pclasses/pclasses2/src/s11n/proxy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27984/src/s11n/proxy Modified Files: createRegSerTraits.sh Log Message: syntax error fix. Index: createRegSerTraits.sh =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/proxy/createRegSerTraits.sh,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- createRegSerTraits.sh 28 Dec 2004 15:51:17 -0000 1.3 +++ createRegSerTraits.sh 28 Dec 2004 17:31:20 -0000 1.4 @@ -27,7 +27,7 @@ -n SerializableClassName [${o_clname}] Default is that from -c. - -r <inc/registration_header.h> [${o_reg_h}] + -r <inc/registration_header.h> [${o_reg_h}] -p SerializableProxyClass [${o_proxy}] Sets the s11n proxy class. SerializableClass @@ -37,14 +37,6 @@ operator()(NodeType) overloads, as described in the libs11n manual. - -ns namespace_of_s11n [${o_sns}] - An obscure option to help me port code between - pclasses.com::s11n and s11n.net::s11n. - If used, this option needs to be as early - in the args list as possible (BUG: must come - before any options which rely on the namespace). - e.g.: -ns P::s11n - -list SerializableClass is compatible with the std::list proxy, and should use it. @@ -63,8 +55,23 @@ must be i/ostreamable. -ios - Like -list, but installs a proxy which works using - the i/ostream operators of SerializableClass. + Like -list, but installs a proxy which works using + the i/ostream operators of SerializableClass. + + ************************************************** + Options intended for use by the s11n maintainer: + ************************************************** + + -macro-prefix XXX [${o_macro_prefix}] + Prepends XXX to the start of the reg macros. + + -ns namespace_of_s11n [${o_sns}] + An obscure option to help me port code between + pclasses.com::s11n and s11n.net::s11n. + If used, this option needs to be as early + in the args list as possible (BUG: must come + before any options which rely on the namespace). + e.g.: -ns P::s11n EOF } # show_help() @@ -76,6 +83,7 @@ i_proxy_map='${o_sns}::map::map_serializable_proxy' i_proxy_map_s='${o_sns}::map::streamable_map_serializable_proxy' i_proxy_s='${o_sns}::streamable_type_serialization_proxy' +o_macro_prefix=P # prefix for registration macros. Use 'P' for P::s11n ############################## args parsing... while test x != "x$1"; do @@ -135,6 +143,11 @@ : ${o_proxy="$(eval echo ${i_proxy_map_s})"} continue ;; + -macro-prefix) + o_macro_prefix=$1 + shift; + continue; + ;; -?|--help|-h) o_show_help=1 # We collect all the args before showing help @@ -155,7 +168,6 @@ : ${o_base=${o_class}} : ${o_reg_h="<pclasses/s11n/reg_serializable_traits.h>"} : ${o_show_help=0} -: ${o_macro_prefix=P} # prefix for registration macros. Use 'P' for P::s11n |
From: stephan b. <sg...@us...> - 2004-12-28 17:30:21
|
Update of /cvsroot/pclasses/pclasses2/src/s11n/proxy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27622/src/s11n/proxy Added Files: Time_s11n.h Log Message: egg: Time, Date, and DateTime s11n proxies. --- NEW FILE: Time_s11n.h --- //////////////////////////////////////////////////////////////////////// // Defines an s11n proxy for the Time, Date and DateTime types. // Should be included from any code which wants to de/serialize // these types using the standard s11n interface. // // Conventions: // - Clients must include SIO support before including this. //////////////////////////////////////////////////////////////////////// #if !defined(PCLASSES_S11N_INCLUDED) # error "s11n.h or SIO.h must be included before plugging in s11n proxies!" #else //////////////////////////////////////////////////////////////////////// // Time proxy //////////////////////////////////////////////////////////////////////// #if !defined(p_TIME_REGISTERED_WITH_S11N) # define p_TIME_REGISTERED_WITH_S11N 1 # include <pclasses/Time.h> namespace P { struct Time_s11n { // serialize template <typename NodeT> bool operator()( NodeT & dest, const Time & src ) const { typedef ::P::s11n::node_traits<NodeT> TR; TR::class_name( dest, ::classname<Time>() ); # define SSET(K,F) TR::set( dest, std::string(K), src.F() ); SSET("sec", second ); SSET("min", minute ); SSET("hour", hour ); SSET("usec", usec ); # undef SSET return true; } // deserialize template <typename NodeT> bool operator()( const NodeT & src, tm & dest ) const { typedef s11n::node_traits<NodeT> TR; # define SGET(K,SF,GF) dest.SF( TR::get( src, std::string(K), src.GF() ) ); SET("sec", setSecond, second ); SET("min", setMinute, minute ); SET("hour", setHour, hour ); SET("usec", setUsec, usec ); # undef SGET return true; } }; // Time_s11n }// namespace P # define PS11N_TYPE ::P::Time # define PS11N_TYPE_NAME "P::Time" # define PS11N_SERIALIZE_FUNCTOR P::Time_s11n # include <pclasses/s11n/reg_serializable_traits.h> #endif // p_TIME_REGISTERED_WITH_S11N //////////////////////////////////////////////////////////////////////// // Date proxy //////////////////////////////////////////////////////////////////////// #if !defined(p_DATE_REGISTERED_WITH_S11N) # define p_DATE_REGISTERED_WITH_S11N 1 # include <pclasses/Date.h> namespace P { struct Date_s11n { // serialize template <typename NodeT> bool operator()( NodeT & dest, const Date & src ) const { typedef ::P::s11n::node_traits<NodeT> TR; TR::class_name( dest, ::classname<Date>() ); # define SSET(K,F) TR::set( dest, std::string(K), src.F() ); SSET("year", year ); SSET("month", month ); SSET("day", day ); # undef SSET return true; } // deserialize template <typename NodeT> bool operator()( const NodeT & src, tm & dest ) const { typedef s11n::node_traits<NodeT> TR; # define SGET(K,SF,GF) dest.SF( TR::get( src, std::string(K), src.GF() ) ); SET("year", setYear, year ); SET("month", setMonth, month ); SET("day", setDay, day ); # undef SGET return true; } }; // Date_s11n }// namespace P # define PS11N_TYPE ::P::Date # define PS11N_TYPE_NAME "P::Date" # define PS11N_SERIALIZE_FUNCTOR P::Date_s11n # include <pclasses/s11n/reg_serializable_traits.h> #endif // p_DATE_REGISTERED_WITH_S11N //////////////////////////////////////////////////////////////////////// // DateTime proxy //////////////////////////////////////////////////////////////////////// #if !defined(p_DATETIME_REGISTERED_WITH_S11N) # define p_DATETIME_REGISTERED_WITH_S11N 1 # include <pclasses/DateTime.h> namespace P { struct DateTime_s11n { // serialize template <typename NodeT> bool operator()( NodeT & dest, const DateTime & src ) const { typedef ::P::s11n::node_traits<NodeT> TR; TR::class_name( dest, ::classname<DateTime>() ); using namespace ::P::s11n; bool worked = serialize_subnode<NodeT,Time>( dest, "time", src ); worked = worked && serialize_subnode<NodeT,Date>( dest, "date", src ); return worked; } // deserialize template <typename NodeT> bool operator()( const NodeT & src, tm & dest ) const { typedef s11n::node_traits<NodeT> TR; using namespace ::P::s11n; bool worked = deserialize_subnode<NodeT,Time>( src, "time", dest ); worked = worked && deserialize_subnode<NodeT,Date>( dest, "date", dest ); return worked; } }; // DateTime_s11n }// namespace P # define PS11N_TYPE ::P::DateTime # define PS11N_TYPE_NAME "P::DateTime" # define PS11N_SERIALIZE_FUNCTOR P::DateTime_s11n # include <pclasses/s11n/reg_serializable_traits.h> #endif // p_DATETIME_REGISTERED_WITH_S11N #endif // PCLASSES_S11N_INCLUDED //////////////////////////////////////////////////////////////////////// |