diff --git a/src/common/advice.hpp b/src/common/advice.hpp index 46014d1fe..a188b6610 100644 --- a/src/common/advice.hpp +++ b/src/common/advice.hpp @@ -107,7 +107,7 @@ namespace lumiera{ namespace advice { - using lib::Symbol; + using lib::Literal; using util::isSameObject; @@ -358,7 +358,7 @@ namespace advice { } catch(...) { - Symbol errID = lumiera_error(); + Literal errID = lumiera_error(); releaseBuffer (storage, sizeof(Holder)); throw lumiera::error::Fatal ("Failure to store advice data", errID); } diff --git a/src/common/advice/advice.cpp b/src/common/advice/advice.cpp index 178b288cf..23e10bf1a 100644 --- a/src/common/advice/advice.cpp +++ b/src/common/advice/advice.cpp @@ -101,7 +101,7 @@ #include -using lib::Symbol; +using lib::Literal; using lib::DelStash; using util::unConst; @@ -216,7 +216,7 @@ namespace advice { catch(...) { - Symbol errID = lumiera_error(); + Literal errID = lumiera_error(); WARN (library, "Problems on deregistration of advice request: %s", errID.c()); } } diff --git a/src/lib/format-string.hpp b/src/lib/format-string.hpp index 327f009a4..a781f9ee3 100644 --- a/src/lib/format-string.hpp +++ b/src/lib/format-string.hpp @@ -409,8 +409,13 @@ namespace util { template<> struct _Fmt::Converter - : _Fmt::Converter - { }; + { + static void + dump (lib::Symbol const& symbol, Implementation& impl) + { + format (symbol.c(), impl); + } + }; /** some custom types explicitly provide a string representation */ template diff --git a/src/lib/lifecycle.cpp b/src/lib/lifecycle.cpp index 6b0f003c4..e643505e2 100644 --- a/src/lib/lifecycle.cpp +++ b/src/lib/lifecycle.cpp @@ -53,7 +53,7 @@ namespace lumiera { { bool isNew = LifecycleRegistry::instance().enrol (eventLabel,callbackFun); - if (isNew && !strcmp(ON_BASIC_INIT, eventLabel)) + if (isNew and eventLabel == ON_BASIC_INIT) callbackFun(); // when this code executes, // then per definition we are already post "basic init" // (which happens in the AppState ctor); thus fire it immediately diff --git a/src/lib/symbol.hpp b/src/lib/symbol.hpp index d844e8f21..66199f805 100644 --- a/src/lib/symbol.hpp +++ b/src/lib/symbol.hpp @@ -42,7 +42,6 @@ #define LIB_SYMBOL_H #include "lib/hash-standard.hpp" -#include "include/logging.h" /////////////TODO only temporarily #include #include @@ -51,9 +50,7 @@ namespace lib { /** inline string literal - * @todo improve interaction with Symbol - * @todo make it non-nullable - * @todo maybe use boost/operators Ticket #417 + * This is a marker type to handle literally given C-Strings. */ class Literal { @@ -126,6 +123,12 @@ namespace lib { explicit operator bool() const { return not empty(); } bool empty() const { return *this == BOTTOM; } + + size_t + length() const + { + return std::strlen(c()); + } }; diff --git a/src/proc/control/command-registry.hpp b/src/proc/control/command-registry.hpp index 8b6827f7c..ffb7f767f 100644 --- a/src/proc/control/command-registry.hpp +++ b/src/proc/control/command-registry.hpp @@ -205,7 +205,7 @@ namespace control { findDefinition (Command const& cmdInstance) const { Lock sync(this); - return getValue_or_default (ridx_, &cmdInstance, 0 ); + return getValue_or_default (ridx_, &cmdInstance, Symbol::BOTTOM ); } //used as Key diff --git a/tests/core/proc/control/command-use1-test.cpp b/tests/core/proc/control/command-use1-test.cpp index f288063dd..10bad27fd 100644 --- a/tests/core/proc/control/command-use1-test.cpp +++ b/tests/core/proc/control/command-use1-test.cpp @@ -221,6 +221,7 @@ namespace test { CHECK (c2); CHECK (c2.canExec()); CHECK (!c2.canUndo()); + CHECK (c2.isAnonymous()); CHECK (c1 == c2); CHECK (!isSameObject(c1, c2)); @@ -267,6 +268,8 @@ namespace test { CHECK (c4); CHECK (c4.canExec()); CHECK (c4.canUndo()); + CHECK (not c4.isAnonymous()); + CHECK ( c2.isAnonymous()); CHECK (c4 == c2); CHECK (c4 != c1); c4();