diff options
author | Stefan Radomski <sradomski@mintwerk.de> | 2016-02-04 00:10:57 (GMT) |
---|---|---|
committer | Stefan Radomski <sradomski@mintwerk.de> | 2016-02-04 00:10:57 (GMT) |
commit | 7afc6a257e193986c9305364701085e65c4ccea5 (patch) | |
tree | 4bc967a50d872e0267d5cf970ab9b88d87dee16b /src/uscxml/Interpreter.cpp | |
parent | 0b313e00915b31c8c03980b7225f82ac2e9513e6 (diff) | |
download | uscxml-7afc6a257e193986c9305364701085e65c4ccea5.zip uscxml-7afc6a257e193986c9305364701085e65c4ccea5.tar.gz uscxml-7afc6a257e193986c9305364701085e65c4ccea5.tar.bz2 |
Preliminary support for SCXML invocations in generated C machines
Diffstat (limited to 'src/uscxml/Interpreter.cpp')
-rw-r--r-- | src/uscxml/Interpreter.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp index a05fe39..2510ef4 100644 --- a/src/uscxml/Interpreter.cpp +++ b/src/uscxml/Interpreter.cpp @@ -779,7 +779,7 @@ NodeSet<std::string> InterpreterImpl::getDocumentInitialTransitions() { } return initialTransitions; } - + InterpreterState InterpreterImpl::step(int waitForMS) { try { tthread::lock_guard<tthread::recursive_mutex> lock(_mutex); @@ -2374,6 +2374,7 @@ void InterpreterImpl::cancelInvoke(const Arabica::DOM::Element<std::string>& ele // see: http://www.w3.org/TR/scxml/#EventDescriptors bool InterpreterImpl::nameMatch(const std::string& eventDescs, const std::string& eventName) { +#if 1 if(eventDescs.length() == 0 || eventName.length() == 0) return false; @@ -2422,6 +2423,38 @@ NEXT_DESC: } } return false; +#else + const char* dPtr = eventDescs.c_str(); + const char* ePtr = eventName.c_str(); + while(*dPtr != 0) { + + if (*dPtr == '*' && *ePtr != 0) // something following + return true; + + // descriptor differs from event name + if (*dPtr != *ePtr) { + // move to next descriptor + while(*dPtr != ' ' && *dPtr != 0) { + dPtr++; + } + if (*dPtr == 0) + return false; + dPtr++; + ePtr = eventName.c_str(); + } else { + // move both pointers one character + dPtr++; + ePtr++; + + } + + // descriptor is done, return match + if (((*dPtr == 0 || *dPtr == ' ') && (*ePtr == 0 || *ePtr == ' ')) || // exact match, end of string + (*dPtr == ' ' && *ePtr == '.') || (*dPtr == 0 && *ePtr == '.')) // prefix match + return true; + } + return false; +#endif } |