diff --git a/src/backend/thread-wrapper.hpp b/src/backend/thread-wrapper.hpp index 8a76cb5cf..23c553724 100644 --- a/src/backend/thread-wrapper.hpp +++ b/src/backend/thread-wrapper.hpp @@ -40,7 +40,7 @@ namespace backend { using std::tr1::bind; using std::tr1::function; - using lumiera::Literal; + using lib::Literal; using lib::Sync; using lib::RecursiveLock_Waitable; using lib::NonrecursiveLock_Waitable; @@ -180,7 +180,7 @@ namespace backend { , &run // invoking the run helper and.. , this // passing this start context as parameter , joinCond // maybe wait-blocking for the thread to terminate - , purpose.c_str() + , purpose.c() , logging_flag ); @@ -205,7 +205,7 @@ namespace backend { * copied onto the stack of the new thread, thus it can be transient. * */ - Thread (Literal& purpose, Operation const& operation, NoBugFlag logging_flag = &NOBUG_FLAG(thread)) + Thread (Literal purpose, Operation const& operation, NoBugFlag logging_flag = &NOBUG_FLAG(thread)) : started_(false), operation_(operation) { @@ -217,7 +217,7 @@ namespace backend { * to wait-blocking on the termination of this newly created thread * */ - Thread (Literal& purpose, Operation const& operation, + Thread (Literal purpose, Operation const& operation, JoinHandle& join, NoBugFlag logging_flag = &NOBUG_FLAG(thread)) : started_(false), operation_(operation) diff --git a/src/common/appstate.hpp b/src/common/appstate.hpp index ca77f7128..69775aec4 100644 --- a/src/common/appstate.hpp +++ b/src/common/appstate.hpp @@ -35,7 +35,7 @@ #ifndef LUMIERA_APPSTATE_H #define LUMIERA_APPSTATE_H -#include "include/symbol.hpp" +#include "lib/symbol.hpp" #include "common/option.hpp" #include "common/subsys.hpp" diff --git a/src/common/configrules.hpp b/src/common/configrules.hpp index 66c2c95ec..2b23fd68b 100644 --- a/src/common/configrules.hpp +++ b/src/common/configrules.hpp @@ -48,6 +48,7 @@ #include "lib/p.hpp" #include "lib/query.hpp" +#include "lib/symbol.hpp" #include "lib/meta/generator.hpp" #include "lib/singleton-subclass.hpp" @@ -92,8 +93,17 @@ namespace lumiera }; + using lib::Symbol; + using lib::Literal; + +/** placeholder definition for later. + * @todo intention is to integrate with lib::Symbol + */ +#define SYMBOL uint + + template - < const Symbol SYM, // Predicate symbol + < SYMBOL SYM, // Predicate symbol typename SIG = bool(string) // Signature > class Pred @@ -119,10 +129,10 @@ namespace lumiera { static const TY NIL; - template + template TY find (Pred capability); - template + template TY make (Pred capability, TY& refObj =NIL); }; diff --git a/src/common/external/libgavl.hpp b/src/common/external/libgavl.hpp index d8d7bc412..505fc4325 100644 --- a/src/common/external/libgavl.hpp +++ b/src/common/external/libgavl.hpp @@ -33,7 +33,7 @@ namespace lib { namespace external { - using lumiera::Symbol; + using lib::Symbol; using lumiera::StreamType; typedef StreamType::ImplFacade ImplFacade; diff --git a/src/common/query/fake-configrules.cpp b/src/common/query/fake-configrules.cpp index db7d453d1..5b6c9c23f 100644 --- a/src/common/query/fake-configrules.cpp +++ b/src/common/query/fake-configrules.cpp @@ -59,11 +59,12 @@ namespace lumiera { /** helper especially for creating structural assets from a capability query */ template - AnyPair entry_Struct(Symbol caps) + AnyPair entry_Struct(Literal caps) { typedef typename WrapReturn::Wrapper Ptr; - Query query(caps); + string capabilities (caps); + Query query (capabilities); Ptr obj = Struct::create (query); return AnyPair(query.asKey(), obj); } @@ -125,7 +126,7 @@ namespace lumiera { { typedef WrapReturn::Wrapper Ptr; - Ptr newPipe (Struct::create (Query ("make(PP), "+q))); + Ptr newPipe (Struct::create (Query (string("make(PP), ")+q))); answer_->insert (entry (q, newPipe)); return true; } diff --git a/src/include/lifecycle.h b/src/include/lifecycle.h index 40634bc95..26e649569 100644 --- a/src/include/lifecycle.h +++ b/src/include/lifecycle.h @@ -39,18 +39,20 @@ #ifdef __cplusplus -#include "include/symbol.hpp" +#include "lib/symbol.hpp" #include namespace lumiera { - extern Symbol ON_BASIC_INIT; ///< automatic static init. treated specially - extern Symbol ON_GLOBAL_INIT; ///< to be triggered in main() @note no magic! - extern Symbol ON_GLOBAL_SHUTDOWN; ///< to be triggered at the end of main() @note no magic! + using lib::Symbol; - extern Symbol ON_EMERGENCY; ///< activated on shutdown after premature failure of a subsystem + extern const char * ON_BASIC_INIT; ///< automatic static init. treated specially + extern const char * ON_GLOBAL_INIT; ///< to be triggered in main() @note no magic! + extern const char * ON_GLOBAL_SHUTDOWN; ///< to be triggered at the end of main() @note no magic! + + extern const char * ON_EMERGENCY; ///< activated on shutdown after premature failure of a subsystem // client code is free to register and use additional lifecycle events diff --git a/src/include/symbol.hpp b/src/include/symbol.hpp deleted file mode 100644 index 00e19571d..000000000 --- a/src/include/symbol.hpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - SYMBOL.hpp - symbolic constant datatype - - Copyright (C) Lumiera.org - 2008, Hermann Vosseler - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU 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 General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -/** @file symbol.hpp - ** WIP placeholder definition for a planned Symbol datatype. - ** - ** @todo for the (currently just planned as of 11/08) rules based configuration - ** in the Proc-Layer a explicit Symbol datatype will probably very helpful. - ** For now we just a typedef is sufficient. A real Symbol datatype should - ** - be definable by string constant - ** - integrate smoothly with std::string - ** - provide a unique numeric index for each distinct Symbol - ** - automatically maintain a symbol table at runtime to support this - ** - provide some magic (macros) allowing to build distinct types based on symbols. - ** - ** @see symbol-impl.cpp - ** @see configrules.hpp - ** @see query.hpp - */ - - -#ifndef LUMIERA_SYMBOL_H -#define LUMIERA_SYMBOL_H - - -#include - - -namespace lumiera { - - typedef const char * const Symbol; ///< Token or Atom with distinct identity @todo define a real Symbol class, i.e. same literal string==same pointer, - - typedef const std::string Literal; ///< inline string literal @todo improve interaction with Symbol - - - -} // namespace lumiera - -#endif diff --git a/src/lib/format.hpp b/src/lib/format.hpp index 9b472dd82..084a5c941 100644 --- a/src/lib/format.hpp +++ b/src/lib/format.hpp @@ -34,7 +34,7 @@ //#include "lib/util.hpp" #include "lib/meta/trait.hpp" -#include "include/symbol.hpp" +#include "lib/symbol.hpp" #include #include @@ -48,7 +48,7 @@ namespace util { using lumiera::typelist::can_ToString; using lumiera::typelist::can_lexical2string; - using lumiera::Symbol; + using lib::Symbol; using boost::enable_if; using boost::disable_if; using std::string; @@ -121,7 +121,7 @@ namespace util { return string(prefix) + res; } - return fallback? fallback + return fallback? string(fallback) : tyStr(val); } } diff --git a/src/lib/lifecycle.cpp b/src/lib/lifecycle.cpp index 553a9fc32..939e3e252 100644 --- a/src/lib/lifecycle.cpp +++ b/src/lib/lifecycle.cpp @@ -63,11 +63,11 @@ namespace lumiera { - Symbol ON_BASIC_INIT ("ON_BASIC_INIT"); - Symbol ON_GLOBAL_INIT ("ON_GLOBAL_INIT"); - Symbol ON_GLOBAL_SHUTDOWN ("ON_GLOBAL_SHUTDOWN"); + const char * ON_BASIC_INIT ("ON_BASIC_INIT"); + const char * ON_GLOBAL_INIT ("ON_GLOBAL_INIT"); + const char * ON_GLOBAL_SHUTDOWN ("ON_GLOBAL_SHUTDOWN"); - Symbol ON_EMERGENCY ("ON_EMERGENCY"); + const char * ON_EMERGENCY ("ON_EMERGENCY"); } // namespace lumiera diff --git a/src/lib/lifecycleregistry.hpp b/src/lib/lifecycleregistry.hpp index 3d14e2209..4a426e2e6 100644 --- a/src/lib/lifecycleregistry.hpp +++ b/src/lib/lifecycleregistry.hpp @@ -74,14 +74,14 @@ namespace lumiera { /** @note only one copy of each distinct callback remembered */ - bool enrol (const string label, Hook toCall) + bool enrol (Symbol label, Hook toCall) { return table_[label] .insert(toCall) .second; // true if actually stored } - void execute (const string label) + void execute (Symbol label) { Callbacks& cbs (table_[label]); Iter e = cbs.end(); @@ -102,7 +102,7 @@ namespace lumiera { private: - std::map table_; + std::map table_; LifecycleRegistry () { execute (ON_BASIC_INIT); // just to be sure, typically a NOP, because nothing is registered yet diff --git a/src/lib/query.cpp b/src/lib/query.cpp index 59be860a3..931d07ff4 100644 --- a/src/lib/query.cpp +++ b/src/lib/query.cpp @@ -81,7 +81,7 @@ namespace lumiera { getTermRegex (Symbol sym) { if (!contains (regexTable, sym)) - regexTable[sym] = regex (string(sym)+=matchArgument); + regexTable[sym] = regex (string(sym)+matchArgument); return regexTable[sym]; } } diff --git a/src/lib/query.hpp b/src/lib/query.hpp index 911acaabf..52430e0c6 100644 --- a/src/lib/query.hpp +++ b/src/lib/query.hpp @@ -30,11 +30,13 @@ #include -#include "include/symbol.hpp" +#include "lib/symbol.hpp" namespace lumiera { - + + using lib::Symbol; + using lib::Literal; using std::string; using boost::format; @@ -50,7 +52,7 @@ namespace lumiera { class Query : public std::string { public: - explicit Query (const string& predicate="") : string(predicate) {} + explicit Query (string const& predicate="") : string(predicate) {} explicit Query (format& pattern) : string(str(pattern)) {} const string asKey() const @@ -62,8 +64,7 @@ namespace lumiera { }; // for calling removeTerm on the string-ref.... - namespace query - { + namespace query { /** ensure standard format for a given id string. * Trim, sanitise and ensure the first letter is lower case. @@ -84,7 +85,5 @@ namespace lumiera { const string removeTerm (Symbol, string& termString); - } // namespace query - -} // namespace lumiera +}} // namespace lumiera::query #endif diff --git a/src/lib/streamtype.hpp b/src/lib/streamtype.hpp index bde5e8e94..6dc5747fc 100644 --- a/src/lib/streamtype.hpp +++ b/src/lib/streamtype.hpp @@ -35,14 +35,17 @@ #define LUMIERA_STREAMTYPE_HPP +#include "lib/symbol.hpp" #include "lib/query.hpp" #include namespace lumiera { - - + + using lib::Symbol; + + /** * */ @@ -160,7 +163,7 @@ namespace lumiera { * opaque placeholder (type erasure) * for implementation specific type info. * Intended to be passed to a concrete - * MediaImplLib to build an ImplFacade. + * MediaImplLib to build an ImplFacade. */ class StreamType::ImplFacade::TypeTag { diff --git a/src/lib/symbol-impl.cpp b/src/lib/symbol-impl.cpp index 4b5e9bb35..f852b1ffb 100644 --- a/src/lib/symbol-impl.cpp +++ b/src/lib/symbol-impl.cpp @@ -21,21 +21,23 @@ * *****************************************************/ /** @file symbol-impl.hpp - ** Collection of helpers for working with the lumiera::Symbol. + ** Collection of helpers for working with the lib::Symbol. ** ** @todo currently as of 9/09 this is more of a placeholder. ** And maybe a location for collecting small bits of implementation, ** which could be usable later for real Symbol and Literal datatypes. ** - ** lumiera::Symbol + ** lib::Symbol ** control::CommandRegistry for usage example of the hash function. ** */ -#include "include/symbol.hpp" +#include "lib/symbol.hpp" +extern "C" { #include "lib/safeclib.h" +} #include #include @@ -46,12 +48,12 @@ using boost::hash_combine; -namespace lumiera { +namespace lib { /** equality on Symbol values is defined * based on the content, not the address. */ - inline bool - operator== (Symbol sy1, Symbol sy2) + bool + operator== (Literal sy1, Literal sy2) { return lumiera_strncmp (sy1,sy2, STRING_MAX_RELEVANT); } @@ -62,7 +64,7 @@ namespace lumiera { and should be usable both with \c std::tr1 and \c . It is implemented similar as the boost::hash specialisation for std::string */ - size_t hash_value (Symbol sym) + size_t hash_value (Literal sym) { size_t hash=0; const char *pos = sym; @@ -75,4 +77,4 @@ namespace lumiera { -} // namespace lumiera +} // namespace lib diff --git a/src/lib/symbol.hpp b/src/lib/symbol.hpp new file mode 100644 index 000000000..562a6bf09 --- /dev/null +++ b/src/lib/symbol.hpp @@ -0,0 +1,145 @@ +/* + SYMBOL.hpp - symbolic constant datatype + + Copyright (C) Lumiera.org + 2008, Hermann Vosseler + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU 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 General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +/** @file symbol.hpp + ** WIP placeholder definition for a planned Symbol datatype. + ** + ** @todo for the (currently just planned as of 11/08) rules based configuration + ** in the Proc-Layer a explicit Symbol datatype will probably very helpful. + ** For now we just a typedef is sufficient. A real Symbol datatype should + ** - be definable by string constant + ** - integrate smoothly with std::string + ** - provide a unique numeric index for each distinct Symbol + ** - automatically maintain a symbol table at runtime to support this + ** - provide some magic (macros) allowing to build distinct types based on symbols. + ** + ** @see symbol-impl.cpp + ** @see configrules.hpp + ** @see query.hpp + */ + + +#ifndef LIB_SYMBOL_H +#define LIB_SYMBOL_H + + +#include +#include + + +namespace lib { + + /** inline string literal + * @todo improve interaction with Symbol + * @todo make it non-nullable + */ + class Literal + { + const char * str_; + + public: + Literal (const char* literal) + : str_(literal) + { } + + Literal (Literal const& o) + : str_(o.str_) + { } + + operator const char* () const { return str_; } + const char* c() const { return str_; } + + bool + empty() const + { + return !str_ || 0 == std::strlen(str_); + } + + protected: + /** Assignment prohibited */ + Literal& operator= (const char* newStr) + { + str_ = newStr; + return *this; + } + }; + + + /** Token or Atom with distinct identity + * @todo define a real Symbol class, i.e. same literal string==same pointer, + */ + class Symbol + : public Literal + { + public: + Symbol (const char* lit =0) + : Literal(lit) + { } + + Symbol (Symbol const& o) + : Literal(o) + { } + + Symbol& + operator= (Literal const& otherSym) + { + Literal::operator= (otherSym); + return *this; + } + }; + + + /** safety guard: maximum number of chars to process. + * For comparisons, hash calculations etc., when dealing + * with raw char ptrs (typically literal values) */ + const size_t STRING_MAX_RELEVANT = 1000; + + + /* ===== to be picked up by ADL ===== */ + + size_t hash_value (Literal); + + bool operator== (Literal sy1, Literal sy2); + + inline bool + operator!= (Literal sy1, Literal sy2) + { + return ! (sy1 == sy2); + } + + inline std::string + operator+ (std::string str, Literal const& sym) + { + const char* symP (sym); + return str + symP; + } + + inline std::string + operator+ (Literal const& sym, std::string str) + { + const char* symP (sym); + return symP + str; + } + +} // namespace lib + +#endif diff --git a/src/lib/test/test-helper.cpp b/src/lib/test/test-helper.cpp index fbe7f1d4a..401690788 100644 --- a/src/lib/test/test-helper.cpp +++ b/src/lib/test/test-helper.cpp @@ -34,7 +34,7 @@ namespace test{ string - showSizeof (size_t siz, Symbol name) + showSizeof (size_t siz, const char* name) { static format fmt ("sizeof( %s ) %|30t|= %3d"); return str (fmt % (name? name:"?") % siz); diff --git a/src/lib/test/test-helper.hpp b/src/lib/test/test-helper.hpp index ef004ec88..26d3b5616 100644 --- a/src/lib/test/test-helper.hpp +++ b/src/lib/test/test-helper.hpp @@ -25,7 +25,7 @@ #define LIB_TEST_TESTHELPER_H -#include "include/symbol.hpp" +#include "lib/symbol.hpp" #include "lib/lumitime.hpp" #include @@ -37,7 +37,7 @@ namespace lib { namespace test{ - using lumiera::Symbol; + using lib::Literal; using lumiera::Time; using std::string; using std::rand; @@ -52,10 +52,10 @@ namespace test{ * type identification as implemented by the compiler. */ template - inline const char* - showType (T const& obj, Symbol name=0) + inline Literal + showType (T const& obj, Literal name=0) { - return name? name : typeid(obj).name(); + return name? name : Literal(typeid(obj).name()); } /** get a sensible display for a type @@ -65,36 +65,36 @@ namespace test{ * type identification as implemented by the compiler. */ template - inline const char* - showType (Symbol name=0) + inline Literal + showType (Literal name=0) { - return name? name : typeid(T).name(); + return name? name : Literal(typeid(T).name()); } /** for printing sizeof(). * prints the given size and name literally, without any further magic */ string - showSizeof (size_t siz, Symbol name); + showSizeof (size_t siz, const char* name); /** for printing sizeof(), trying to figure out the type name automatically */ template inline string - showSizeof(Symbol name=0) + showSizeof(const char* name=0) { return showSizeof (sizeof (T), showType (name)); } template inline string - showSizeof(T const& obj, Symbol name=0) + showSizeof(T const& obj, const char* name=0) { return showSizeof (sizeof (obj), showType (obj,name)); } template inline string - showSizeof(T *obj, Symbol name=0) + showSizeof(T *obj, const char* name=0) { return obj? showSizeof (*obj, name) : showSizeof (name); diff --git a/src/proc/asset/buildinstruct.hpp b/src/proc/asset/buildinstruct.hpp index dee85d58d..1b1129762 100644 --- a/src/proc/asset/buildinstruct.hpp +++ b/src/proc/asset/buildinstruct.hpp @@ -32,6 +32,8 @@ #define ASSET_BUILDINSTRUCT_H +#include "lib/symbol.hpp" + #include #include @@ -39,9 +41,11 @@ using std::string; -namespace asset - { +namespace asset { + using lumiera::P; + using lib::Symbol; + using lib::Literal; class Proc; class ProcPatt; @@ -57,7 +61,7 @@ namespace asset vector nodes; /** identifying the point where the nodes should be attached */ - string point; + Literal point; DoAttach (Symbol where = CURRENT) : point(where) diff --git a/src/proc/asset/category.hpp b/src/proc/asset/category.hpp index c644f2acc..aee5a8a9e 100644 --- a/src/proc/asset/category.hpp +++ b/src/proc/asset/category.hpp @@ -24,6 +24,8 @@ #ifndef ASSET_CATEGORY_H #define ASSET_CATEGORY_H +#include "lib/symbol.hpp" + #include #include #include @@ -31,6 +33,8 @@ namespace asset { + + using lib::Literal; using std::string; using std::ostream; @@ -70,7 +74,7 @@ namespace asset { string path_; public: - Category (const Kind root, string subfolder ="") + Category (const Kind root, Literal subfolder ="") : kind_(root), path_(subfolder) {}; bool operator== (Category const& other) const { return kind_== other.kind_ && path_== other.path_; } diff --git a/src/proc/asset/procpatt.cpp b/src/proc/asset/procpatt.cpp index 95e985134..4663a3ec7 100644 --- a/src/proc/asset/procpatt.cpp +++ b/src/proc/asset/procpatt.cpp @@ -64,7 +64,7 @@ namespace asset ProcPatt::newCopy (string newID) const { TODO ("implement the Pattern-ID within the propDescriptor!"); - TODO ("implement a consitent struct asset naming scheme at one central location!!!!!"); + TODO ("implement a consistent struct asset naming scheme at one central location!!!!!"); const Asset::Ident newIdi ( this->ident.name+".X" , this->ident.category ); diff --git a/src/proc/asset/procpatt.hpp b/src/proc/asset/procpatt.hpp index 4eee80fb2..227679afb 100644 --- a/src/proc/asset/procpatt.hpp +++ b/src/proc/asset/procpatt.hpp @@ -36,7 +36,7 @@ using std::vector; namespace asset { using lumiera::P; - using lumiera::Symbol; + using lib::Symbol; class Proc; class ProcPatt; diff --git a/src/proc/asset/struct.cpp b/src/proc/asset/struct.cpp index 9774f1786..79c5d26a4 100644 --- a/src/proc/asset/struct.cpp +++ b/src/proc/asset/struct.cpp @@ -37,7 +37,7 @@ using boost::format; -using lumiera::Symbol; +using lib::Symbol; using lumiera::query::normaliseID; using lumiera::query::QueryHandler; using lumiera::ConfigRules; diff --git a/src/proc/common.hpp b/src/proc/common.hpp index 7c0680b91..c7da68e24 100644 --- a/src/proc/common.hpp +++ b/src/proc/common.hpp @@ -45,7 +45,7 @@ #include "lib/p.hpp" #include "lib/util.hpp" #include "lib/lumitime.hpp" -#include "include/symbol.hpp" +#include "lib/symbol.hpp" #include "lib/error.hpp" ///< pulls in NoBug via loggging.h diff --git a/src/proc/control/command-def.hpp b/src/proc/control/command-def.hpp index 16b494102..2decf0c4c 100644 --- a/src/proc/control/command-def.hpp +++ b/src/proc/control/command-def.hpp @@ -50,7 +50,7 @@ //#include "pre.hpp" #include "lib/error.hpp" #include "include/logging.h" -#include "include/symbol.hpp" +#include "lib/symbol.hpp" #include "proc/control/command.hpp" #include "proc/control/command-impl.hpp" /////TODO: any chance to get rid of this import here?? #include "proc/control/command-registry.hpp" @@ -75,7 +75,7 @@ namespace control { using std::tr1::shared_ptr; using std::tr1::function; - using lumiera::Symbol; + using lib::Symbol; using util::cStr; using lumiera::typelist::FunctionSignature; @@ -240,7 +240,7 @@ namespace control { : id_(cmdID) , prototype_(Command::fetchDef(cmdID)) { - TRACE (command_dbg, "starting CommandDef('%s')...", cmdID); + TRACE (command_dbg, "starting CommandDef('%s')...", cmdID.c() ); } template diff --git a/src/proc/control/command-invocation.hpp b/src/proc/control/command-invocation.hpp index f8ab945cb..bc1ff54b9 100644 --- a/src/proc/control/command-invocation.hpp +++ b/src/proc/control/command-invocation.hpp @@ -40,7 +40,7 @@ #define CONTROL_COMMAND_INVOCACTION_H //#include "pre.hpp" -//#include "include/symbol.hpp" +//#include "lib/symbol.hpp" //#include "lib/meta/typelist.hpp" //#include "lib/meta/tuple.hpp" #include "proc/control/command.hpp" @@ -55,7 +55,7 @@ namespace control { -// using lumiera::Symbol; +// using lib::Symbol; // using std::tr1::shared_ptr; using namespace lumiera::typelist; @@ -158,5 +158,14 @@ namespace control { return com::RuntimeCheckedCommandInvoker (command); } + + inline + com::RuntimeCheckedCommandInvoker + invoke (const char* cmdID) + { + return invoke(Symbol(cmdID)); + } + + } // namespace control #endif diff --git a/src/proc/control/command-signature.hpp b/src/proc/control/command-signature.hpp index 5c403cace..150e3db0b 100644 --- a/src/proc/control/command-signature.hpp +++ b/src/proc/control/command-signature.hpp @@ -47,7 +47,7 @@ #define CONTROL_COMMAND_SIGNATURE_H //#include "pre.hpp" -//#include "include/symbol.hpp" +//#include "lib/symbol.hpp" #include "lib/meta/function.hpp" #include "lib/meta/typelist.hpp" #include "lib/meta/typelist-util.hpp" @@ -62,7 +62,7 @@ namespace control { -// using lumiera::Symbol; +// using lib::Symbol; // using std::tr1::shared_ptr; using std::tr1::function; diff --git a/src/proc/control/command.hpp b/src/proc/control/command.hpp index fe66a53ee..130cea17b 100644 --- a/src/proc/control/command.hpp +++ b/src/proc/control/command.hpp @@ -54,7 +54,7 @@ #include "pre.hpp" #include "lib/error.hpp" -#include "include/symbol.hpp" +#include "lib/symbol.hpp" #include "proc/control/command-binding.hpp" #include "proc/control/argument-erasure.hpp" #include "proc/control/handling-pattern.hpp" @@ -71,7 +71,7 @@ namespace control { using std::string; - using lumiera::Symbol; + using lib::Symbol; using std::tr1::shared_ptr; using lumiera::typelist::Tuple; diff --git a/src/proc/control/handling-pattern.cpp b/src/proc/control/handling-pattern.cpp index d48f39d30..7df3c41d5 100644 --- a/src/proc/control/handling-pattern.cpp +++ b/src/proc/control/handling-pattern.cpp @@ -25,7 +25,7 @@ #include "proc/control/handling-pattern.hpp" #include "proc/control/handling-patterns.hpp" -#include "include/symbol.hpp" +#include "lib/symbol.hpp" #include "include/logging.h" #include "lib/util.hpp" //#include "proc/mobject/mobject-ref.hpp" @@ -59,7 +59,7 @@ namespace control { ExecResult HandlingPattern::invoke (CommandImpl& command, Symbol name) const { - TRACE (proc_dbg, "invoking %s...", name); + TRACE (proc_dbg, "invoking %s...", name.c()); static format err_pre ("Error state detected, %s *NOT* invoked."); static format err_post ("Error state after %s invocation."); static format err_fatal ("Execution of %s raised unknown error."); @@ -83,21 +83,21 @@ namespace control { catch (lumiera::Error& problem) { Symbol errID = lumiera_error(); - WARN (command, "Invocation of %s failed: %s", name, problem.what()); - TRACE (proc_dbg, "Error flag was: %s", errID); + WARN (command, "Invocation of %s failed: %s", name.c(), problem.what()); + TRACE (proc_dbg, "Error flag was: %s", errID.c()); return ExecResult (problem); } catch (std::exception& library_problem) { Symbol errID = lumiera_error(); - WARN (command, "Invocation of %s failed: %s", name, library_problem.what()); - TRACE (proc_dbg, "Error flag was: %s", errID); + WARN (command, "Invocation of %s failed: %s", name.c(), library_problem.what()); + TRACE (proc_dbg, "Error flag was: %s", errID.c()); return ExecResult (error::External (library_problem)); } catch (...) { Symbol errID = lumiera_error(); - ERROR (command, "Invocation of %s failed with unknown exception; error flag is: %s", name, errID); + ERROR (command, "Invocation of %s failed with unknown exception; error flag is: %s", name.c(), errID.c()); throw error::Fatal (str (err_fatal % command), errID); } } diff --git a/src/proc/control/handling-pattern.hpp b/src/proc/control/handling-pattern.hpp index c52b26075..5422bfb31 100644 --- a/src/proc/control/handling-pattern.hpp +++ b/src/proc/control/handling-pattern.hpp @@ -47,7 +47,7 @@ //#include "pre.hpp" #include "lib/error.hpp" #include "lib/bool-checkable.hpp" -#include "include/symbol.hpp" +#include "lib/symbol.hpp" //#include #include @@ -57,7 +57,7 @@ namespace control { using std::string; - using lumiera::Symbol; + using lib::Symbol; // using std::tr1::shared_ptr; diff --git a/src/proc/control/handling-patterns.hpp b/src/proc/control/handling-patterns.hpp index b3e56f36c..f4d62cc7b 100644 --- a/src/proc/control/handling-patterns.hpp +++ b/src/proc/control/handling-patterns.hpp @@ -49,7 +49,7 @@ #include "proc/control/command-impl.hpp" #include "proc/mobject/session.hpp" #include "include/lifecycle.h" -//#include "include/symbol.hpp" +//#include "lib/symbol.hpp" //#include //#include @@ -63,7 +63,7 @@ namespace control { using std::vector; // using std::string; -// using lumiera::Symbol; +// using lib::Symbol; // using std::tr1::shared_ptr; diff --git a/src/proc/control/mediaimpllib.hpp b/src/proc/control/mediaimpllib.hpp index 958d65a12..6150c3f4e 100644 --- a/src/proc/control/mediaimpllib.hpp +++ b/src/proc/control/mediaimpllib.hpp @@ -31,7 +31,7 @@ namespace control { - using lumiera::Symbol; + using lib::Symbol; class MediaImplLib diff --git a/src/proc/control/proc-dispatcher.hpp b/src/proc/control/proc-dispatcher.hpp index b0783a940..61352bc47 100644 --- a/src/proc/control/proc-dispatcher.hpp +++ b/src/proc/control/proc-dispatcher.hpp @@ -36,7 +36,7 @@ #define CONTROL_PROC_DISPATCHER_H //#include "pre.hpp" -//#include "include/symbol.hpp" +//#include "lib/symbol.hpp" #include "proc/control/command.hpp" //#include @@ -45,7 +45,7 @@ namespace control { -// using lumiera::Symbol; +// using lib::Symbol; // using std::tr1::shared_ptr; diff --git a/src/proc/control/stypemanager.cpp b/src/proc/control/stypemanager.cpp index d2f798a8b..30e34f644 100644 --- a/src/proc/control/stypemanager.cpp +++ b/src/proc/control/stypemanager.cpp @@ -30,7 +30,7 @@ namespace control { using lumiera::StreamType; - using lumiera::Symbol; + using lib::Symbol; /* ======= stream type manager lifecycle ==========*/ @@ -63,7 +63,7 @@ namespace control { * their basic setup functions using this hook, which can be done via * the C interface functions */ - Symbol ON_STREAMTYPES_RESET ("ON_STREAMTYPES_RESET"); + const char* ON_STREAMTYPES_RESET ("ON_STREAMTYPES_RESET"); diff --git a/src/proc/control/stypemanager.hpp b/src/proc/control/stypemanager.hpp index 31ec08675..b35334124 100644 --- a/src/proc/control/stypemanager.hpp +++ b/src/proc/control/stypemanager.hpp @@ -33,7 +33,7 @@ namespace control { - using lumiera::Symbol; + using lib::Symbol; using lumiera::StreamType; @@ -90,7 +90,7 @@ namespace control { ImplFacade const& fetchImpl (StreamType::ImplFacade::TypeTag); }; - extern Symbol ON_STREAMTYPES_RESET; ///< triggered to load the generic pristine default + extern const char* ON_STREAMTYPES_RESET; ///< triggered to load the generic pristine default template diff --git a/src/proc/mobject/builder/mould.hpp b/src/proc/mobject/builder/mould.hpp index 425e76b30..9a0108104 100644 --- a/src/proc/mobject/builder/mould.hpp +++ b/src/proc/mobject/builder/mould.hpp @@ -35,7 +35,7 @@ namespace mobject { using std::vector; using asset::PProcPatt; - using lumiera::Symbol; + using lib::Symbol; /** diff --git a/src/proc/mobject/session.hpp b/src/proc/mobject/session.hpp index 7ce03ed62..0542e1da2 100644 --- a/src/proc/mobject/session.hpp +++ b/src/proc/mobject/session.hpp @@ -36,7 +36,7 @@ #include "proc/mobject/placement.hpp" #include "proc/mobject/session/defsmanager.hpp" #include "lib/singleton.hpp" -#include "include/symbol.hpp" +#include "lib/symbol.hpp" #include #include @@ -99,9 +99,9 @@ namespace mobject { }; - extern lumiera::Symbol ON_SESSION_START; ///< triggered before loading any content into a newly created session - extern lumiera::Symbol ON_SESSION_INIT; ///< triggered when initialising a new session, after adding content - extern lumiera::Symbol ON_SESSION_END; ///< triggered before discarding an existing session + extern const char* ON_SESSION_START; ///< triggered before loading any content into a newly created session + extern const char* ON_SESSION_INIT; ///< triggered when initialising a new session, after adding content + extern const char* ON_SESSION_END; ///< triggered before discarding an existing session namespace session { diff --git a/src/proc/mobject/session/session.cpp b/src/proc/mobject/session/session.cpp index 1a75c5e9b..f466259b3 100644 --- a/src/proc/mobject/session/session.cpp +++ b/src/proc/mobject/session/session.cpp @@ -35,11 +35,11 @@ #include "proc/mobject/session/defsmanager.hpp" #include "proc/mobject/session/session-impl.hpp" -#include "include/symbol.hpp" +#include "lib/symbol.hpp" #include "lib/singleton.hpp" -using lumiera::Symbol; +using lib::Symbol; using lumiera::Singleton; using mobject::session::SessManager; using mobject::session::SessManagerImpl; @@ -69,7 +69,7 @@ namespace mobject { * session should register their basic setup functions using this hook, which can be * done via the C interface functions defined in lifecycle.h */ - Symbol ON_SESSION_START ("ON_SESSION_START"); + const char* ON_SESSION_START ("ON_SESSION_START"); /** \par * LifecycleHook, to perform any initialisation, wiring and registrations necessary @@ -77,7 +77,7 @@ namespace mobject { * and configuration has already be loaded. Any subsystems requiring to build some indices * or wiring to keep track of the session's content should register here. */ - Symbol ON_SESSION_INIT ("ON_SESSION_INIT"); + const char* ON_SESSION_INIT ("ON_SESSION_INIT"); /** \par * LifecycleHook, to perform any state saving, deregistration or de-activation necessary @@ -87,7 +87,7 @@ namespace mobject { * specific/internal information into the persisted state, besides actually attaching * data to objects within the session? */ - Symbol ON_SESSION_END ("ON_SESSION_END"); + const char* ON_SESSION_END ("ON_SESSION_END"); diff --git a/tests/components/proc/control/command-registry-test.cpp b/tests/components/proc/control/command-registry-test.cpp index a4d473db8..d03ef200f 100644 --- a/tests/components/proc/control/command-registry-test.cpp +++ b/tests/components/proc/control/command-registry-test.cpp @@ -36,7 +36,7 @@ #include "proc/control/command-registry.hpp" #include "proc/control/command-def.hpp" //#include "lib/lumitime.hpp" -#include "include/symbol.hpp" +#include "lib/symbol.hpp" #include "lib/util.hpp" #include "proc/control/test-dummy-commands.hpp" @@ -68,7 +68,7 @@ namespace test { // using util::contains; // using session::test::TestClip; - using lumiera::Symbol; + using lib::Symbol; // using lumiera::P; diff --git a/tests/components/proc/mobject/session/defsmanagerimpltest.cpp b/tests/components/proc/mobject/session/defsmanagerimpltest.cpp index 89cbc4368..c3a260876 100644 --- a/tests/components/proc/mobject/session/defsmanagerimpltest.cpp +++ b/tests/components/proc/mobject/session/defsmanagerimpltest.cpp @@ -43,7 +43,7 @@ namespace asset { namespace test { using mobject::Session; - using lumiera::Symbol; + using lib::Symbol; using lumiera::Query; using lumiera::query::normaliseID; diff --git a/tests/components/proc/mobject/test-dummy-mobject.hpp b/tests/components/proc/mobject/test-dummy-mobject.hpp index 28988c473..d301fbd81 100644 --- a/tests/components/proc/mobject/test-dummy-mobject.hpp +++ b/tests/components/proc/mobject/test-dummy-mobject.hpp @@ -43,7 +43,7 @@ #include "proc/mobject/builder/buildertool.hpp" #include "proc/mobject/session/abstractmo.hpp" #include "proc/mobject/placement.hpp" -#include "include/symbol.hpp" +#include "lib/symbol.hpp" #include "lib/util.hpp" #include @@ -61,7 +61,7 @@ using std::cout; namespace mobject { namespace test { - using lumiera::Symbol; + using lib::Symbol; using builder::BuilderTool; diff --git a/tests/lib/lifecycletest.cpp b/tests/lib/lifecycletest.cpp index 8b98373e5..00b43fd36 100644 --- a/tests/lib/lifecycletest.cpp +++ b/tests/lib/lifecycletest.cpp @@ -39,7 +39,7 @@ namespace test { void basicInitHook () { ++basicInit; } void myCallback() { ++customCallback; } - Symbol MY_DEADLY_EVENT = "dial M for murder"; + const char* MY_DEADLY_EVENT = "dial M for murder"; namespace // register them to be invoked by lifecycle event id diff --git a/tests/lib/query/queryutilstest.cpp b/tests/lib/query/queryutilstest.cpp index 6f642ea49..61b464118 100644 --- a/tests/lib/query/queryutilstest.cpp +++ b/tests/lib/query/queryutilstest.cpp @@ -139,7 +139,7 @@ namespace lumiera { } void - ASSERT_removeTerm (Symbol sym, string input, Symbol extracted, Symbol modified) + ASSERT_removeTerm (Symbol sym, string input, string extracted, string modified) { ASSERT (extracted == removeTerm (sym, input)); ASSERT (modified == input); diff --git a/tests/lib/singletontestmocktest.cpp b/tests/lib/singletontestmocktest.cpp index 131603c49..797916f6a 100644 --- a/tests/lib/singletontestmocktest.cpp +++ b/tests/lib/singletontestmocktest.cpp @@ -57,11 +57,11 @@ namespace lumiera TestSingletonO(Symbol ty="TestSingletonO") : callCnt (0), typid(ty), msg ("%s::doIt() call=%d\n") { - TRACE (test, "ctor %s", typid); + TRACE (test, "ctor %s", typid.c()); } virtual ~TestSingletonO() { - TRACE (test, "dtor %s", typid); + TRACE (test, "dtor %s", typid.c()); } void doIt () @@ -158,7 +158,7 @@ namespace lumiera sing->doIt(); ASSERT (sing->getCnt() == 1); - instance.injectSubclass (0); // unshaddowing original instance + instance.injectSubclass (0); // un-shadowing original instance sing = &instance(); ASSERT (sing->getCnt() == 2); sing->doIt(); diff --git a/tests/lib/subsystem-runner-test.cpp b/tests/lib/subsystem-runner-test.cpp index 8585ee563..e86e0af05 100644 --- a/tests/lib/subsystem-runner-test.cpp +++ b/tests/lib/subsystem-runner-test.cpp @@ -27,7 +27,7 @@ #include "common/subsystem-runner.hpp" #include "common/option.hpp" -#include "include/symbol.hpp" +#include "lib/symbol.hpp" #include "backend/thread-wrapper.hpp" #include "lib/error.hpp" #include "lib/query.hpp" @@ -89,7 +89,7 @@ namespace test { public Sync { Literal id_; - Literal spec_; + const string spec_; volatile bool isUp_; volatile bool didRun_; @@ -101,7 +101,7 @@ namespace test { bool shouldStart (lumiera::Option&) { - Literal startSpec (extractID ("start",spec_)); + string startSpec (extractID ("start",spec_)); return "true" ==startSpec || "fail" ==startSpec || "throw"==startSpec; @@ -160,7 +160,7 @@ namespace test { void run (Subsys::SigTerm termination) { - Literal runSpec (extractID ("run",spec_)); + string runSpec (extractID ("run",spec_)); ASSERT (!isnil (runSpec)); { // run-status handshake diff --git a/tests/lib/thread-wrapper-join-test.cpp b/tests/lib/thread-wrapper-join-test.cpp index e7e80cd08..93257e794 100644 --- a/tests/lib/thread-wrapper-join-test.cpp +++ b/tests/lib/thread-wrapper-join-test.cpp @@ -23,7 +23,7 @@ #include "lib/test/run.hpp" -#include "include/symbol.hpp" +#include "lib/symbol.hpp" #include "backend/thread-wrapper.hpp" #include "lib/error.hpp" #include "lib/sync.hpp" diff --git a/tests/lib/thread-wrapper-test.cpp b/tests/lib/thread-wrapper-test.cpp index 9c66b4145..edd9660f1 100644 --- a/tests/lib/thread-wrapper-test.cpp +++ b/tests/lib/thread-wrapper-test.cpp @@ -23,7 +23,7 @@ #include "lib/test/run.hpp" -#include "include/symbol.hpp" +#include "lib/symbol.hpp" #include "backend/thread-wrapper.hpp" #include "lib/sync.hpp" diff --git a/tests/lib/typed-allocation-manager-test.cpp b/tests/lib/typed-allocation-manager-test.cpp index 09c5254e8..c8cf35de1 100644 --- a/tests/lib/typed-allocation-manager-test.cpp +++ b/tests/lib/typed-allocation-manager-test.cpp @@ -27,7 +27,7 @@ #include "proc/control/typed-allocation-manager.hpp" //#include "proc/control/command-def.hpp" //#include "lib/lumitime.hpp" -//#include "include/symbol.hpp" +//#include "lib/symbol.hpp" #include "lib/util.hpp" @@ -58,7 +58,7 @@ namespace test { // using util::contains; // using session::test::TestClip; -// using lumiera::Symbol; +// using lib::Symbol; // using lumiera::P;