From 1e56658c2415d154428fe419d8f0134c59856b6e Mon Sep 17 00:00:00 2001 From: Stefan Radomski Date: Fri, 9 Dec 2016 13:54:46 +0100 Subject: Oh how I despise MSVC --- README.md | 4 ++ apps/uscxml-browser.cpp | 4 +- apps/uscxml-transform.cpp | 4 +- src/uscxml/Interpreter.cpp | 8 +-- src/uscxml/debug/DebugSession.cpp | 2 +- src/uscxml/interpreter/BasicContentExecutor.cpp | 8 +-- src/uscxml/interpreter/BasicEventQueue.cpp | 2 +- src/uscxml/interpreter/FastMicroStep.cpp | 16 ++--- src/uscxml/interpreter/InterpreterImpl.cpp | 4 +- src/uscxml/interpreter/InterpreterMonitor.h | 6 +- src/uscxml/interpreter/Logging.h | 8 --- src/uscxml/messages/Data.cpp | 10 +-- .../datamodel/ecmascript/v8/V8DataModel.cpp | 26 ++++---- src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp | 2 +- .../plugins/datamodel/promela/PromelaDataModel.cpp | 2 +- .../plugins/invoker/dirmon/DirMonInvoker.cpp | 10 +-- src/uscxml/server/HTTPServer.cpp | 26 ++++---- src/uscxml/transform/ChartToPromela.cpp | 2 +- src/uscxml/util/DOM.cpp | 2 +- src/uscxml/util/URL.cpp | 72 +++++++++++----------- test/src/test-stress.cpp | 2 +- test/src/test-url.cpp | 2 +- 22 files changed, 109 insertions(+), 113 deletions(-) diff --git a/README.md b/README.md index 9baa5e8..fdcb3e9 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,10 @@ uSCXML is a platform to work with state-charts given as 3. `uscxml-transform`: A collection of [transformation](#for-transformations) implementations to transpile SCXML, e.g. onto ANSI-C and VHDL. +The status of the various datamodels, bindings and generators with regard to the [W3C IRP +tests](https://www.w3.org/Voice/2013/scxml-irp/) can be checked in the [test +table](test/w3c/TESTS.md). + ## Installation There are no installers yet and we do not feature any releases. Just check for [open issues](https://github.com/tklab-tud/uscxml/issues) and [build from source](http://tklab-tud.github.io/uscxml/building.html). If you did download and build locally, you can create installers via `make packages` though. diff --git a/apps/uscxml-browser.cpp b/apps/uscxml-browser.cpp index dff207b..99f646f 100644 --- a/apps/uscxml-browser.cpp +++ b/apps/uscxml-browser.cpp @@ -56,7 +56,7 @@ int main(int argc, char** argv) { InterpreterOptions* currOptions = options.interpreters[0].second; std::string documentURL = options.interpreters[0].first; - LOG(INFO) << "Processing " << documentURL; + LOG(USCXML_INFO) << "Processing " << documentURL; try { Interpreter interpreter = Interpreter::fromURL(documentURL); @@ -82,7 +82,7 @@ int main(int argc, char** argv) { interpreters.push_back(interpreter); } else { - LOG(ERROR) << "Cannot create interpreter from " << documentURL; + LOG(USCXML_ERROR) << "Cannot create interpreter from " << documentURL; } } catch (Event e) { std::cout << e << std::endl; diff --git a/apps/uscxml-transform.cpp b/apps/uscxml-transform.cpp index a4c5e3e..0cf538c 100644 --- a/apps/uscxml-transform.cpp +++ b/apps/uscxml-transform.cpp @@ -211,7 +211,7 @@ int main(int argc, char** argv) { Interpreter interpreter; try { if (inputFile.size() == 0 || inputFile == "-") { - LOG(INFO) << "Reading SCXML from STDIN"; + LOG(USCXML_INFO) << "Reading SCXML from STDIN"; std::stringstream ss; std::string line; while (std::getline(std::cin, line)) { @@ -254,7 +254,7 @@ int main(int argc, char** argv) { } if (!interpreter) { - LOG(ERROR) << "Cannot create interpreter from " << inputFile; + LOG(USCXML_ERROR) << "Cannot create interpreter from " << inputFile; exit(EXIT_FAILURE); } diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp index 9f4322f..190240f 100644 --- a/src/uscxml/Interpreter.cpp +++ b/src/uscxml/Interpreter.cpp @@ -170,13 +170,13 @@ Interpreter Interpreter::fromURL(const std::string& url) { } catch (const XERCESC_NS::SAXParseException& toCatch) { - LOG(ERROR) << X(toCatch.getMessage()); + LOG(USCXML_ERROR) << X(toCatch.getMessage()); } catch (const XERCESC_NS::RuntimeException& toCatch) { - LOG(ERROR) << X(toCatch.getMessage()); + LOG(USCXML_ERROR) << X(toCatch.getMessage()); } catch (const XERCESC_NS::XMLException& toCatch) { - LOG(ERROR) << X(toCatch.getMessage()); + LOG(USCXML_ERROR) << X(toCatch.getMessage()); } catch (const XERCESC_NS::DOMException& toCatch) { - LOG(ERROR) << X(toCatch.getMessage()); + LOG(USCXML_ERROR) << X(toCatch.getMessage()); } return interpreter; diff --git a/src/uscxml/debug/DebugSession.cpp b/src/uscxml/debug/DebugSession.cpp index 116e20e..5b68f8e 100644 --- a/src/uscxml/debug/DebugSession.cpp +++ b/src/uscxml/debug/DebugSession.cpp @@ -215,7 +215,7 @@ void DebugSession::run(void* instance) { // return; // } } - LOG(DEBUG) << "done"; + LOG(USCXML_DEBUG) << "done"; } Data DebugSession::debugStop(const Data& data) { diff --git a/src/uscxml/interpreter/BasicContentExecutor.cpp b/src/uscxml/interpreter/BasicContentExecutor.cpp index 1cf9c2f..0c77dfd 100644 --- a/src/uscxml/interpreter/BasicContentExecutor.cpp +++ b/src/uscxml/interpreter/BasicContentExecutor.cpp @@ -144,7 +144,7 @@ void BasicContentExecutor::processSend(XERCESC_NS::DOMElement* element) { } else if (delayAttr.unit.length() == 0) { // unit less delay is interpreted as milliseconds delayMs = strTo(delayAttr.value); } else { - LOG(ERROR) << "Cannot make sense of delay value " << delay << ": does not end in 's' or 'ms'"; + LOG(USCXML_ERROR) << "Cannot make sense of delay value " << delay << ": does not end in 's' or 'ms'"; } } } catch (Event e) { @@ -355,14 +355,14 @@ void BasicContentExecutor::process(XERCESC_NS::DOMElement* block, const X& xmlPr } else if (iequals(tagName, xmlPrefix.str() + "script")) { processScript(block); } else { - LOG(ERROR) << tagName; + LOG(USCXML_ERROR) << tagName; assert(false); } } catch (ErrorEvent exc) { Event e(exc); _callbacks->enqueueInternal(e); - LOG(ERROR) << exc << std::endl; + LOG(USCXML_ERROR) << exc << std::endl; USCXML_MONITOR_CALLBACK1(_callbacks->getMonitors(), afterExecutingContent, block); throw e; // will be catched in microstepper @@ -646,7 +646,7 @@ Data BasicContentExecutor::elementAsData(XERCESC_NS::DOMElement* element) { } } -// LOG(WARNING) << "Element " << DOMUtils::xPathForNode(element) << " did not yield any data"; +// LOG(USCXML_WARN) << "Element " << DOMUtils::xPathForNode(element) << " did not yield any data"; return Data(); } diff --git a/src/uscxml/interpreter/BasicEventQueue.cpp b/src/uscxml/interpreter/BasicEventQueue.cpp index 04ffc7c..3adbd2f 100644 --- a/src/uscxml/interpreter/BasicEventQueue.cpp +++ b/src/uscxml/interpreter/BasicEventQueue.cpp @@ -47,7 +47,7 @@ Event BasicEventQueue::dequeue(size_t blockMs) { if (_queue.size() > 0) { Event event = _queue.front(); _queue.pop_front(); -// LOG(ERROR) << event.name; +// LOG(USCXML_ERROR) << event.name; return event; } return Event(); diff --git a/src/uscxml/interpreter/FastMicroStep.cpp b/src/uscxml/interpreter/FastMicroStep.cpp index 8711b62..6a5f9a1 100644 --- a/src/uscxml/interpreter/FastMicroStep.cpp +++ b/src/uscxml/interpreter/FastMicroStep.cpp @@ -1098,14 +1098,14 @@ bool FastMicroStep::hasLegalConfiguration() { DOMElement* state = *sIter; if (isMember(state, config)) { if (foundScxmlChild) { - LOG(ERROR) << "Invalid configuration: Multiple childs of scxml root are active '" << ATTR_CAST(foundScxmlChild, "id") << "' and '" << ATTR_CAST(scxmlChilds[i], "id") << "'"; + LOG(USCXML_ERROR) << "Invalid configuration: Multiple childs of scxml root are active '" << ATTR_CAST(foundScxmlChild, "id") << "' and '" << ATTR_CAST(scxmlChilds[i], "id") << "'"; return false; } foundScxmlChild = scxmlChilds[i]; } } if (!foundScxmlChild) { - LOG(ERROR) << "Invalid configuration: No childs of scxml root are active"; + LOG(USCXML_ERROR) << "Invalid configuration: No childs of scxml root are active"; return false; } @@ -1119,14 +1119,14 @@ bool FastMicroStep::hasLegalConfiguration() { } } if (!foundAtomicState) { - LOG(ERROR) << "Invalid configuration: No atomic state is active"; + LOG(USCXML_ERROR) << "Invalid configuration: No atomic state is active"; return false; } // the configuration contains no history pseudo-states for (size_t i = 0; i < config.size(); i++) { if (isHistory(Element(config[i]))) { - LOG(ERROR) << "Invalid configuration: history state " << ATTR_CAST(config[i], "id") << " is active"; + LOG(USCXML_ERROR) << "Invalid configuration: history state " << ATTR_CAST(config[i], "id") << " is active"; return false; } } @@ -1142,7 +1142,7 @@ bool FastMicroStep::hasLegalConfiguration() { (iequals(LOCALNAME(parent), "state") || iequals(LOCALNAME(parent), "parallel"))) { if (!isMember(parent, config)) { - LOG(ERROR) << "Invalid configuration: atomic state '" << ATTR_CAST(config[i], "id") << "' is active, but parent '" << ATTR_CAST(parent, "id") << "' is not"; + LOG(USCXML_ERROR) << "Invalid configuration: atomic state '" << ATTR_CAST(config[i], "id") << "' is active, but parent '" << ATTR_CAST(parent, "id") << "' is not"; return false; } } @@ -1161,7 +1161,7 @@ bool FastMicroStep::hasLegalConfiguration() { //std::cerr << childs[j] << std::endl; if (isMember(childs[j], config)) { if (foundChildState) { - LOG(ERROR) << "Invalid configuration: Multiple childs of compound '" << ATTR_CAST(config[i], "id") + LOG(USCXML_ERROR) << "Invalid configuration: Multiple childs of compound '" << ATTR_CAST(config[i], "id") << "' are active '" << ATTR_CAST(foundChildState, "id") << "' and '" << ATTR_CAST(childs[j], "id") << "'"; return false; } @@ -1169,7 +1169,7 @@ bool FastMicroStep::hasLegalConfiguration() { } } if (!foundChildState) { - LOG(ERROR) << "Invalid configuration: No childs of compound '" << ATTR_CAST(config[i], "id") << "' are active"; + LOG(USCXML_ERROR) << "Invalid configuration: No childs of compound '" << ATTR_CAST(config[i], "id") << "' are active"; return false; } } @@ -1181,7 +1181,7 @@ bool FastMicroStep::hasLegalConfiguration() { NodeSet childs = getChildStates(config[i]); for (size_t j = 0; j < childs.size(); j++) { if (!isMember(childs[j], config) && !isHistory(Element(childs[j]))) { - LOG(ERROR) << "Invalid configuration: Not all children of parallel '" << ATTR_CAST(config[i], "id") << "' are active i.e. '" << ATTR_CAST(childs[j], "id") << "' is not"; + LOG(USCXML_ERROR) << "Invalid configuration: Not all children of parallel '" << ATTR_CAST(config[i], "id") << "' are active i.e. '" << ATTR_CAST(childs[j], "id") << "' is not"; return false; } } diff --git a/src/uscxml/interpreter/InterpreterImpl.cpp b/src/uscxml/interpreter/InterpreterImpl.cpp index 7b79988..0f77285 100644 --- a/src/uscxml/interpreter/InterpreterImpl.cpp +++ b/src/uscxml/interpreter/InterpreterImpl.cpp @@ -248,7 +248,7 @@ bool InterpreterImpl::isTrue(const std::string& expr) { } catch (ErrorEvent e) { // test 244: deliver error execution - LOG(ERROR) << e; + LOG(USCXML_ERROR) << e; // test 344 enqueueInternal(e); @@ -280,7 +280,7 @@ Event InterpreterImpl::dequeueExternal(size_t blockMs) { if (_currEvent) { _dataModel.setEvent(_currEvent); -// LOG(ERROR) << e.name; +// LOG(USCXML_ERROR) << e.name; // test 233 if (_currEvent.invokeid.size() > 0 && diff --git a/src/uscxml/interpreter/InterpreterMonitor.h b/src/uscxml/interpreter/InterpreterMonitor.h index 2519cfd..80065f7 100644 --- a/src/uscxml/interpreter/InterpreterMonitor.h +++ b/src/uscxml/interpreter/InterpreterMonitor.h @@ -28,9 +28,9 @@ #include #define USCXML_MONITOR_CATCH(callback) \ -catch (Event e) { LOG(ERROR) << "Syntax error when calling " #callback " on monitors: " << std::endl << e << std::endl; } \ -catch (std::bad_weak_ptr e) { LOG(ERROR) << "Unclean shutdown " << std::endl; } \ -catch (...) { LOG(ERROR) << "An exception occurred when calling " #callback " on monitors"; } \ +catch (Event e) { LOG(USCXML_ERROR) << "Syntax error when calling " #callback " on monitors: " << std::endl << e << std::endl; } \ +catch (std::bad_weak_ptr e) { LOG(USCXML_ERROR) << "Unclean shutdown " << std::endl; } \ +catch (...) { LOG(USCXML_ERROR) << "An exception occurred when calling " #callback " on monitors"; } \ if (_state == USCXML_DESTROYED) { throw std::bad_weak_ptr(); } #define USCXML_MONITOR_CALLBACK(callbacks, function) { \ diff --git a/src/uscxml/interpreter/Logging.h b/src/uscxml/interpreter/Logging.h index 7746998..85d28ca 100644 --- a/src/uscxml/interpreter/Logging.h +++ b/src/uscxml/interpreter/Logging.h @@ -31,14 +31,6 @@ #define LOG(lvl) uscxml::Logger::getDefault().log(lvl) #define LOG2(lvl, thing) uscxml::Logger::getDefault().log(lvl, thing); -#define SCXML USCXML_SCXML -#define TRACE USCXML_TRACE -#define DEBUG USCXML_DEBUG -#define INFO USCXML_INFO -#define WARNING USCXML_WARN -#define ERROR USCXML_ERROR -#define FATAL USCXML_FATAL - namespace uscxml { enum LogSeverity { diff --git a/src/uscxml/messages/Data.cpp b/src/uscxml/messages/Data.cpp index a75e774..5d7dbf2 100644 --- a/src/uscxml/messages/Data.cpp +++ b/src/uscxml/messages/Data.cpp @@ -97,11 +97,11 @@ Data Data::fromJSON(const std::string& jsonString) { int nrTokens = trimmed.size() / frac; if (t != NULL) { free(t); -// LOG(INFO) << "Increasing JSON length to token ratio to 1/" << frac; +// LOG(USCXML_INFO) << "Increasing JSON length to token ratio to 1/" << frac; } t = (jsmntok_t*)malloc((nrTokens + 1) * sizeof(jsmntok_t)); if (t == NULL) { - LOG(ERROR) << "Cannot parse JSON, ran out of memory!"; + LOG(USCXML_ERROR) << "Cannot parse JSON, ran out of memory!"; return data; } memset(t, 0, (nrTokens + 1) * sizeof(jsmntok_t)); @@ -112,13 +112,13 @@ Data Data::fromJSON(const std::string& jsonString) { if (rv != 0) { switch (rv) { case JSMN_ERROR_NOMEM: - LOG(ERROR) << "Cannot parse JSON, not enough tokens were provided!"; + LOG(USCXML_ERROR) << "Cannot parse JSON, not enough tokens were provided!"; break; case JSMN_ERROR_INVAL: - LOG(ERROR) << "Cannot parse JSON, invalid character inside JSON string!"; + LOG(USCXML_ERROR) << "Cannot parse JSON, invalid character inside JSON string!"; break; case JSMN_ERROR_PART: - LOG(ERROR) << "Cannot parse JSON, the string is not a full JSON packet, more bytes expected!"; + LOG(USCXML_ERROR) << "Cannot parse JSON, the string is not a full JSON packet, more bytes expected!"; break; default: break; diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp index 3ff48c4..f916ae9 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp @@ -485,27 +485,27 @@ Data V8DataModel::getValueAsData(const v8::Local& value, std::setIsBoolean()) { data.atom = (value->ToBoolean()->Value() ? "true" : "false"); } else if (value->IsBooleanObject()) { - LOG(ERROR) << "IsBooleanObject is unimplemented" << std::endl; + LOG(USCXML_ERROR) << "IsBooleanObject is unimplemented" << std::endl; } else if (value->IsDate()) { - LOG(ERROR) << "IsDate is unimplemented" << std::endl; + LOG(USCXML_ERROR) << "IsDate is unimplemented" << std::endl; } else if (value->IsExternal()) { - LOG(ERROR) << "IsExternal is unimplemented" << std::endl; + LOG(USCXML_ERROR) << "IsExternal is unimplemented" << std::endl; } else if (value->IsFalse()) { - LOG(ERROR) << "IsFalse is unimplemented" << std::endl; + LOG(USCXML_ERROR) << "IsFalse is unimplemented" << std::endl; } else if (value->IsFunction()) { - LOG(ERROR) << "IsFunction is unimplemented" << std::endl; + LOG(USCXML_ERROR) << "IsFunction is unimplemented" << std::endl; } else if (value->IsInt32()) { int32_t prop = value->Int32Value(); data.atom = toStr(prop); } else if (value->IsNativeError()) { - LOG(ERROR) << "IsNativeError is unimplemented" << std::endl; + LOG(USCXML_ERROR) << "IsNativeError is unimplemented" << std::endl; } else if (value->IsNull()) { - LOG(ERROR) << "IsNull is unimplemented" << std::endl; + LOG(USCXML_ERROR) << "IsNull is unimplemented" << std::endl; } else if (value->IsNumber()) { v8::String::AsciiValue prop(v8::Local::Cast(v8::Local::Cast(value))); data.atom = *prop; } else if (value->IsNumberObject()) { - LOG(ERROR) << "IsNumberObject is unimplemented" << std::endl; + LOG(USCXML_ERROR) << "IsNumberObject is unimplemented" << std::endl; } else if (value->IsObject()) { // if (V8ArrayBuffer::hasInstance(value)) { @@ -529,21 +529,21 @@ Data V8DataModel::getValueAsData(const v8::Local& value, std::setIsRegExp()) { - LOG(ERROR) << "IsRegExp is unimplemented" << std::endl; + LOG(USCXML_ERROR) << "IsRegExp is unimplemented" << std::endl; } else if(value->IsString()) { v8::String::AsciiValue property(v8::Local::Cast(value)); data.atom = *property; data.type = Data::VERBATIM; } else if(value->IsStringObject()) { - LOG(ERROR) << "IsStringObject is unimplemented" << std::endl; + LOG(USCXML_ERROR) << "IsStringObject is unimplemented" << std::endl; } else if(value->IsTrue()) { - LOG(ERROR) << "IsTrue is unimplemented" << std::endl; + LOG(USCXML_ERROR) << "IsTrue is unimplemented" << std::endl; } else if(value->IsUint32()) { - LOG(ERROR) << "IsUint32 is unimplemented" << std::endl; + LOG(USCXML_ERROR) << "IsUint32 is unimplemented" << std::endl; } else if(value->IsUndefined()) { data.atom = "undefined"; } else { - LOG(ERROR) << "Value's type is unknown!" << std::endl; + LOG(USCXML_ERROR) << "Value's type is unknown!" << std::endl; } return data; } diff --git a/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp b/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp index 6429cba..59c2427 100644 --- a/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp +++ b/src/uscxml/plugins/datamodel/lua/LuaDataModel.cpp @@ -204,7 +204,7 @@ std::shared_ptr LuaDataModel::create(DataModelCallbacks* callback luabridge::setGlobal(dm->_luaState, resultLxpLOM, "lxp.lom"); } } catch (luabridge::LuaException e) { - LOG(INFO) << e.what(); + LOG(USCXML_INFO) << e.what(); } luabridge::getGlobalNamespace(dm->_luaState).beginClass("DataModel").endClass(); diff --git a/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp b/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp index 4c5674e..a13dd07 100644 --- a/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp +++ b/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp @@ -193,7 +193,7 @@ void PromelaDataModel::setEvent(const Event& event) { try { PromelaParser parser(expr); } catch (Event e) { - LOG(ERROR) << e << std::endl; + LOG(USCXML_ERROR) << e << std::endl; return false; } return true; diff --git a/src/uscxml/plugins/invoker/dirmon/DirMonInvoker.cpp b/src/uscxml/plugins/invoker/dirmon/DirMonInvoker.cpp index fca6e11..de5994a 100644 --- a/src/uscxml/plugins/invoker/dirmon/DirMonInvoker.cpp +++ b/src/uscxml/plugins/invoker/dirmon/DirMonInvoker.cpp @@ -99,7 +99,7 @@ void DirMonInvoker::eventFromSCXML(const Event& event) { void DirMonInvoker::invoke(const std::string& source, const Event& req) { if (req.params.find("dir") == req.params.end()) { - LOG(ERROR) << "No dir param given"; + LOG(USCXML_ERROR) << "No dir param given"; return; } @@ -137,7 +137,7 @@ void DirMonInvoker::invoke(const std::string& source, const Event& req) { URL url = URL::resolve(dirIter->second.atom, _interpreter->getBaseURL()); if (!url.isAbsolute()) { - LOG(ERROR) << "Given directory '" << dirIter->second << "' cannot be transformed to absolute path"; + LOG(USCXML_ERROR) << "Given directory '" << dirIter->second << "' cannot be transformed to absolute path"; } else { _dir = url.path(); } @@ -313,7 +313,7 @@ void DirectoryWatch::updateEntries(bool reportAsExisting) { // stat directory for modification date struct stat dirStat; if (stat((_dir + _relDir).c_str(), &dirStat) != 0) { - LOG(ERROR) << "Error with stat on directory " << _dir << ": " << strerror(errno); + LOG(USCXML_ERROR) << "Error with stat on directory " << _dir << ": " << strerror(errno); return; } @@ -327,7 +327,7 @@ void DirectoryWatch::updateEntries(bool reportAsExisting) { DIR *dp; dp = opendir((_dir + _relDir).c_str()); if (dp == NULL) { - LOG(ERROR) << "Error opening directory " << _dir + _relDir << ": " << strerror(errno); + LOG(USCXML_ERROR) << "Error opening directory " << _dir + _relDir << ": " << strerror(errno); return; } // iterate all entries and see what changed @@ -352,7 +352,7 @@ void DirectoryWatch::updateEntries(bool reportAsExisting) { struct stat fileStat; if (stat(filename.c_str(), &fileStat) != 0) { - LOG(ERROR) << "Error with stat on directory entry: " << filename << ": " << strerror(errno); + LOG(USCXML_ERROR) << "Error with stat on directory entry: " << filename << ": " << strerror(errno); continue; } diff --git a/src/uscxml/server/HTTPServer.cpp b/src/uscxml/server/HTTPServer.cpp index a5dcb8b..82e5cef 100644 --- a/src/uscxml/server/HTTPServer.cpp +++ b/src/uscxml/server/HTTPServer.cpp @@ -93,9 +93,9 @@ HTTPServer::HTTPServer(unsigned short port, unsigned short wsPort, SSLConfig* ss if (_port > 0) { _httpHandle = evhttp_bind_socket_with_handle(_http, NULL, _port); if (_httpHandle) { - LOG(INFO) << "HTTP server listening on tcp/" << _port; + LOG(USCXML_INFO) << "HTTP server listening on tcp/" << _port; } else { - LOG(ERROR) << "HTTP server cannot bind to tcp/" << _port; + LOG(USCXML_ERROR) << "HTTP server cannot bind to tcp/" << _port; } } @@ -103,9 +103,9 @@ HTTPServer::HTTPServer(unsigned short port, unsigned short wsPort, SSLConfig* ss if (_wsPort > 0) { _wsHandle = evws_bind_socket(_evws, _wsPort); if (_wsHandle) { - LOG(INFO) << "WebSocket server listening on tcp/" << _wsPort; + LOG(USCXML_INFO) << "WebSocket server listening on tcp/" << _wsPort; } else { - LOG(ERROR) << "WebSocket server cannot bind to tcp/" << _wsPort; + LOG(USCXML_ERROR) << "WebSocket server cannot bind to tcp/" << _wsPort; } } @@ -146,9 +146,9 @@ HTTPServer::HTTPServer(unsigned short port, unsigned short wsPort, SSLConfig* ss if (_sslPort > 0) { _sslHandle = evhttp_bind_socket_with_handle(_https, INADDR_ANY, _sslPort); if (_sslHandle) { - LOG(INFO) << "HTTPS server listening on tcp/" << _wsPort; + LOG(USCXML_INFO) << "HTTPS server listening on tcp/" << _wsPort; } else { - LOG(ERROR) << "HTTPS server cannot bind to tcp/" << _wsPort; + LOG(USCXML_ERROR) << "HTTPS server cannot bind to tcp/" << _wsPort; } } @@ -408,7 +408,7 @@ void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackD assert(0); // NameSpacingParser parser = NameSpacingParser::fromXML(request.data.compound["content"].atom); // if (parser.errorsReported()) { -// LOG(ERROR) << "Cannot parse contents of HTTP request as XML"; +// LOG(USCXML_ERROR) << "Cannot parse contents of HTTP request as XML"; // } else { // request.data.compound["content"].node = parser.getDocument().getDocumentElement(); // } @@ -462,7 +462,7 @@ void HTTPServer::processByMatchingServlet(const Request& request) { matchesIter++; } - LOG(INFO) << "Got an HTTP request at " << actualPath << " but no servlet is registered there or at a prefix"; + LOG(USCXML_INFO) << "Got an HTTP request at " << actualPath << " but no servlet is registered there or at a prefix"; evhttp_send_error(request.evhttpReq, 404, NULL); } @@ -505,7 +505,7 @@ void HTTPServer::replyCallback(evutil_socket_t fd, short what, void *arg) { Reply* reply = (Reply*)arg; if (reply->content.size() > 0 && reply->headers.find("Content-Type") == reply->headers.end()) { - LOG(INFO) << "Sending content without Content-Type header"; + LOG(USCXML_INFO) << "Sending content without Content-Type header"; } std::map::const_iterator headerIter = reply->headers.begin(); @@ -565,7 +565,7 @@ bool HTTPServer::registerServlet(const std::string& path, HTTPServlet* servlet) HTTPServer* INSTANCE = getInstance(); if (!INSTANCE->_httpHandle) { - LOG(INFO) << "Registering at unstarted HTTP Server"; + LOG(USCXML_INFO) << "Registering at unstarted HTTP Server"; return true; // this is the culprit! } @@ -594,7 +594,7 @@ bool HTTPServer::registerServlet(const std::string& path, HTTPServlet* servlet) servlet->setURL(servletURL.str()); INSTANCE->_httpServlets[suffixedPath] = servlet; -// LOG(INFO) << "HTTP Servlet listening at: " << servletURL.str(); +// LOG(USCXML_INFO) << "HTTP Servlet listening at: " << servletURL.str(); // register callback evhttp_set_cb(INSTANCE->_http, ("/" + suffixedPath).c_str(), HTTPServer::httpRecvReqCallback, servlet); @@ -648,7 +648,7 @@ bool HTTPServer::registerServlet(const std::string& path, WebSocketServlet* serv INSTANCE->_wsServlets[suffixedPath] = servlet; - // LOG(INFO) << "HTTP Servlet listening at: " << servletURL.str() << std::endl; + // LOG(USCXML_INFO) << "HTTP Servlet listening at: " << servletURL.str() << std::endl; // register callback evws_set_cb(INSTANCE->_evws, ("/" + suffixedPath).c_str(), HTTPServer::wsRecvReqCallback, NULL, servlet); @@ -702,7 +702,7 @@ void HTTPServer::run(void* instance) { while(INSTANCE->_isRunning) { event_base_dispatch(INSTANCE->_base); } - LOG(INFO) << "HTTP Server stopped"; + LOG(USCXML_INFO) << "HTTP Server stopped"; } void HTTPServer::determineAddress() { diff --git a/src/uscxml/transform/ChartToPromela.cpp b/src/uscxml/transform/ChartToPromela.cpp index a140386..48037c0 100644 --- a/src/uscxml/transform/ChartToPromela.cpp +++ b/src/uscxml/transform/ChartToPromela.cpp @@ -694,7 +694,7 @@ void ChartToPromela::writeVariables(std::ostream& stream) { if (allTypes.types.find(identifier) != allTypes.types.end()) { type = allTypes.types[identifier].name; } else { - LOG(ERROR) << "Automatic or no type for '" << identifier << "' but no type resolved"; + LOG(USCXML_ERROR) << "Automatic or no type for '" << identifier << "' but no type resolved"; continue; } } diff --git a/src/uscxml/util/DOM.cpp b/src/uscxml/util/DOM.cpp index cc1e2d7..9540d04 100644 --- a/src/uscxml/util/DOM.cpp +++ b/src/uscxml/util/DOM.cpp @@ -146,7 +146,7 @@ std::string DOMUtils::xPathForNode(const DOMNode* node, const std::string& ns) { case DOMNode::DOCUMENT_NODE: return xPath; default: - LOG(ERROR) << "Only nodes of type element supported for now"; + LOG(USCXML_ERROR) << "Only nodes of type element supported for now"; return ""; break; } diff --git a/src/uscxml/util/URL.cpp b/src/uscxml/util/URL.cpp index 1dd6154..3ba4595 100644 --- a/src/uscxml/util/URL.cpp +++ b/src/uscxml/util/URL.cpp @@ -236,7 +236,7 @@ CURL* URLImpl::getCurlHandle() { if (_handle == NULL) { _handle = curl_easy_init(); if (_handle == NULL) - LOG(ERROR) << "curl_easy_init returned NULL, this is bad!"; + LOG(USCXML_ERROR) << "curl_easy_init returned NULL, this is bad!"; } return _handle; } @@ -268,7 +268,7 @@ size_t URLImpl::headerHandler(void *ptr, size_t size, size_t nmemb, void *userda } void URLImpl::downloadStarted() { - // LOG(INFO) << "Starting download of " << asString() << std::endl; + // LOG(USCXML_INFO) << "Starting download of " << asString() << std::endl; _rawInContent.str(""); _rawInContent.clear(); _rawInHeader.str(""); @@ -458,54 +458,54 @@ URLFetcher::URLFetcher() { /* Name of proxy to use. */ if (envProxy) (curlError = curl_easy_setopt(_multiHandle, CURLOPT_PROXY, envProxy)) == CURLE_OK || - LOG(ERROR) << "Cannot set curl proxy: " << curl_easy_strerror(curlError); + LOG(USCXML_ERROR) << "Cannot set curl proxy: " << curl_easy_strerror(curlError); /* set transfer mode (;type=) when doing FTP via an HTTP proxy */ if (envProxyTransferMode) (curlError = curl_easy_setopt(_multiHandle, CURLOPT_PROXY_TRANSFER_MODE, envProxyTransferMode)) == CURLE_OK || - LOG(ERROR) << "Cannot set curl proxy transfer mode: " << curl_easy_strerror(curlError); + LOG(USCXML_ERROR) << "Cannot set curl proxy transfer mode: " << curl_easy_strerror(curlError); /* Set this to a bitmask value to enable the particular authentications methods you like. Use this in combination with CURLOPT_PROXYUSERPWD. Note that setting multiple bits may cause extra network round-trips. */ if (envProxyAuth) (curlError = curl_easy_setopt(_multiHandle, CURLOPT_PROXYAUTH, envProxyAuth)) == CURLE_OK || - LOG(ERROR) << "Cannot set curl proxy authentication: " << curl_easy_strerror(curlError); + LOG(USCXML_ERROR) << "Cannot set curl proxy authentication: " << curl_easy_strerror(curlError); #if 0 /* This points to a linked list of headers used for proxy requests only, struct curl_slist kind */ if (envProxyHeader && unsupported) (curlError = curl_easy_setopt(_multiHandle, CURLOPT_PROXYHEADER, envProxyHeader)) == CURLE_OK || - LOG(ERROR) << "Cannot set curl proxy header: " << curl_easy_strerror(curlError); + LOG(USCXML_ERROR) << "Cannot set curl proxy header: " << curl_easy_strerror(curlError); #endif /* "name" and "pwd" to use with Proxy when fetching. */ if (envProxyUsername) (curlError = curl_easy_setopt(_multiHandle, CURLOPT_PROXYUSERNAME, envProxyUsername)) == CURLE_OK || - LOG(ERROR) << "Cannot set curl proxy username: " << curl_easy_strerror(curlError); + LOG(USCXML_ERROR) << "Cannot set curl proxy username: " << curl_easy_strerror(curlError); if (envProxyPassword) (curlError = curl_easy_setopt(_multiHandle, CURLOPT_PROXYPASSWORD, envProxyPassword)) == CURLE_OK || - LOG(ERROR) << "Cannot set curl proxy password: " << curl_easy_strerror(curlError); + LOG(USCXML_ERROR) << "Cannot set curl proxy password: " << curl_easy_strerror(curlError); /* Port of the proxy, can be set in the proxy string as well with: "[host]:[port]" */ if (envProxyPort) (curlError = curl_easy_setopt(_multiHandle, CURLOPT_PROXYPORT, envProxyPort)) == CURLE_OK || - LOG(ERROR) << "Cannot set curl proxy port: " << curl_easy_strerror(curlError); + LOG(USCXML_ERROR) << "Cannot set curl proxy port: " << curl_easy_strerror(curlError); #if 0 /* indicates type of proxy. accepted values are CURLPROXY_HTTP (default), CURLPROXY_SOCKS4, CURLPROXY_SOCKS4A and CURLPROXY_SOCKS5. */ if (envProxyType && unsupported) (curlError = curl_easy_setopt(_multiHandle, CURLOPT_PROXYTYPE, envProxyType)) == CURLE_OK || - LOG(ERROR) << "Cannot set curl proxy type: " << curl_easy_strerror(curlError); + LOG(USCXML_ERROR) << "Cannot set curl proxy type: " << curl_easy_strerror(curlError); #endif /* "user:password" to use with proxy. */ if (envProxyUserPwd) (curlError = curl_easy_setopt(_multiHandle, CURLOPT_PROXYUSERPWD, envProxyUserPwd)) == CURLE_OK || - LOG(ERROR) << "Cannot set curl proxy user password: " << curl_easy_strerror(curlError); + LOG(USCXML_ERROR) << "Cannot set curl proxy user password: " << curl_easy_strerror(curlError); #endif start(); @@ -531,55 +531,55 @@ void URLFetcher::fetchURL(URL& url) { std::string fromURL(url); (curlError = curl_easy_setopt(handle, CURLOPT_URL, fromURL.c_str())) == CURLE_OK || - LOG(ERROR) << "Cannot set url to " << std::string(url) << ": " << curl_easy_strerror(curlError); + LOG(USCXML_ERROR) << "Cannot set url to " << std::string(url) << ": " << curl_easy_strerror(curlError); // (curlError = curl_easy_setopt(handle, CURLOPT_NOSIGNAL, 1)) == CURLE_OK || - // LOG(ERROR) << "Cannot set curl to ignore signals: " << curl_easy_strerror(curlError); + // LOG(USCXML_ERROR) << "Cannot set curl to ignore signals: " << curl_easy_strerror(curlError); // (curlError = curl_easy_setopt(handle, CURLOPT_FORBID_REUSE, 1)) == CURLE_OK || - // LOG(ERROR) << "Cannot force noreuse: " << curl_easy_strerror(curlError); + // LOG(USCXML_ERROR) << "Cannot force noreuse: " << curl_easy_strerror(curlError); // (curlError = curl_easy_setopt(handle, CURLOPT_VERBOSE, 1)) == CURLE_OK || - // LOG(ERROR) << "Cannot set verbose: " << curl_easy_strerror(curlError); + // LOG(USCXML_ERROR) << "Cannot set verbose: " << curl_easy_strerror(curlError); (curlError = curl_easy_setopt(handle, CURLOPT_WRITEDATA, url._impl.get())) == CURLE_OK || - LOG(ERROR) << "Cannot register this as write userdata: " << curl_easy_strerror(curlError); + LOG(USCXML_ERROR) << "Cannot register this as write userdata: " << curl_easy_strerror(curlError); (curlError = curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, URLImpl::writeHandler)) == CURLE_OK || - LOG(ERROR) << "Cannot set write callback: " << curl_easy_strerror(curlError); + LOG(USCXML_ERROR) << "Cannot set write callback: " << curl_easy_strerror(curlError); (curlError = curl_easy_setopt(handle, CURLOPT_HEADERFUNCTION, URLImpl::headerHandler)) == CURLE_OK || - LOG(ERROR) << "Cannot request header from curl: " << curl_easy_strerror(curlError); + LOG(USCXML_ERROR) << "Cannot request header from curl: " << curl_easy_strerror(curlError); (curlError = curl_easy_setopt(handle, CURLOPT_HEADERDATA, url._impl.get())) == CURLE_OK || - LOG(ERROR) << "Cannot register this as header userdata: " << curl_easy_strerror(curlError); + LOG(USCXML_ERROR) << "Cannot register this as header userdata: " << curl_easy_strerror(curlError); (curlError = curl_easy_setopt(handle, CURLOPT_SSL_VERIFYPEER, false)) == CURLE_OK || - LOG(ERROR) << "Cannot forfeit peer verification: " << curl_easy_strerror(curlError); + LOG(USCXML_ERROR) << "Cannot forfeit peer verification: " << curl_easy_strerror(curlError); (curlError = curl_easy_setopt(handle, CURLOPT_USERAGENT, "uscxml/" USCXML_VERSION)) == CURLE_OK || - LOG(ERROR) << "Cannot set our user agent string: " << curl_easy_strerror(curlError); + LOG(USCXML_ERROR) << "Cannot set our user agent string: " << curl_easy_strerror(curlError); (curlError = curl_easy_setopt(handle, CURLOPT_FOLLOWLOCATION, true)) == CURLE_OK || - LOG(ERROR) << "Cannot enable follow redirects: " << curl_easy_strerror(curlError); + LOG(USCXML_ERROR) << "Cannot enable follow redirects: " << curl_easy_strerror(curlError); if (instance->_envProxy) (curlError = curl_easy_setopt(handle, CURLOPT_PROXY, instance->_envProxy)) == CURLE_OK || - LOG(ERROR) << "Cannot set curl proxy: " << curl_easy_strerror(curlError); + LOG(USCXML_ERROR) << "Cannot set curl proxy: " << curl_easy_strerror(curlError); if (url._impl->_requestType == URLRequestType::POST) { (curlError = curl_easy_setopt(handle, CURLOPT_POST, 1)) == CURLE_OK || - LOG(ERROR) << "Cannot set request type to post for " << std::string(url) << ": " << curl_easy_strerror(curlError); + LOG(USCXML_ERROR) << "Cannot set request type to post for " << std::string(url) << ": " << curl_easy_strerror(curlError); (curlError = curl_easy_setopt(handle, CURLOPT_COPYPOSTFIELDS, url._impl->_outContent.c_str())) == CURLE_OK || - LOG(ERROR) << "Cannot set post data " << std::string(url) << ": " << curl_easy_strerror(curlError); + LOG(USCXML_ERROR) << "Cannot set post data " << std::string(url) << ": " << curl_easy_strerror(curlError); // Disable "Expect: 100-continue" // curl_slist* disallowed_headers = 0; // disallowed_headers = curl_slist_append(disallowed_headers, "Expect:"); // (curlError = curl_easy_setopt(handle, CURLOPT_HTTPHEADER, disallowed_headers)) == CURLE_OK || - // LOG(ERROR) << "Cannot disable Expect 100 header: " << curl_easy_strerror(curlError); + // LOG(USCXML_ERROR) << "Cannot disable Expect 100 header: " << curl_easy_strerror(curlError); struct curl_slist* headers = NULL; std::map::iterator paramIter = url._impl->_outHeader.begin(); @@ -603,14 +603,14 @@ void URLFetcher::fetchURL(URL& url) { instance->_handlesToHeaders[handle] = headers; (curlError = curl_easy_setopt(handle, CURLOPT_HTTPHEADER, headers)) == CURLE_OK || - LOG(ERROR) << "Cannot headers for " << std::string(url) << ": " << curl_easy_strerror(curlError); + LOG(USCXML_ERROR) << "Cannot headers for " << std::string(url) << ": " << curl_easy_strerror(curlError); // curl_slist_free_all(headers); } else if (url._impl->_requestType == URLRequestType::GET) { (curlError = curl_easy_setopt(handle, CURLOPT_HTTPGET, 1)) == CURLE_OK || - LOG(ERROR) << "Cannot set request type to get for " << std::string(url) << ": " << curl_easy_strerror(curlError); + LOG(USCXML_ERROR) << "Cannot set request type to get for " << std::string(url) << ": " << curl_easy_strerror(curlError); } url._impl->downloadStarted(); @@ -660,7 +660,7 @@ void URLFetcher::run(void* instance) { while(fetcher->_isStarted) { fetcher->perform(); } - LOG(ERROR) << "URLFetcher thread stopped!"; + LOG(USCXML_ERROR) << "URLFetcher thread stopped!"; } void URLFetcher::perform() { @@ -677,7 +677,7 @@ void URLFetcher::perform() { } err = curl_multi_perform(_multiHandle, &stillRunning); if (err != CURLM_OK) { - LOG(WARNING) << "curl_multi_perform: " << curl_multi_strerror(err); + LOG(USCXML_WARN) << "curl_multi_perform: " << curl_multi_strerror(err); } } @@ -701,7 +701,7 @@ void URLFetcher::perform() { std::lock_guard lock(_mutex); err = curl_multi_timeout(_multiHandle, &curlTimeOut); if (err != CURLM_OK) { - LOG(WARNING) << "curl_multi_timeout: " << curl_multi_strerror(err); + LOG(USCXML_WARN) << "curl_multi_timeout: " << curl_multi_strerror(err); } } @@ -719,7 +719,7 @@ void URLFetcher::perform() { std::lock_guard lock(_mutex); err = curl_multi_fdset(_multiHandle, &fdread, &fdwrite, &fdexcep, &maxfd); if (err != CURLM_OK) { - LOG(WARNING) << "curl_multi_fdset: " << curl_multi_strerror(err); + LOG(USCXML_WARN) << "curl_multi_fdset: " << curl_multi_strerror(err); } } @@ -734,7 +734,7 @@ void URLFetcher::perform() { std::lock_guard lock(_mutex); err = curl_multi_perform(_multiHandle, &stillRunning); if (err != CURLM_OK) { - LOG(WARNING) << "curl_multi_perform: " << curl_multi_strerror(err); + LOG(USCXML_WARN) << "curl_multi_perform: " << curl_multi_strerror(err); } break; } @@ -749,7 +749,7 @@ void URLFetcher::perform() { _handlesToURLs[msg->easy_handle]._impl->downloadCompleted(); err = curl_multi_remove_handle(_multiHandle, msg->easy_handle); if (err != CURLM_OK) { - LOG(WARNING) << "curl_multi_remove_handle: " << curl_multi_strerror(err); + LOG(USCXML_WARN) << "curl_multi_remove_handle: " << curl_multi_strerror(err); } break; @@ -757,7 +757,7 @@ void URLFetcher::perform() { _handlesToURLs[msg->easy_handle]._impl->downloadFailed(msg->data.result); err = curl_multi_remove_handle(_multiHandle, msg->easy_handle); if (err != CURLM_OK) { - LOG(WARNING) << "curl_multi_remove_handle: " << curl_multi_strerror(err); + LOG(USCXML_WARN) << "curl_multi_remove_handle: " << curl_multi_strerror(err); } break; @@ -767,7 +767,7 @@ void URLFetcher::perform() { _handlesToHeaders.erase(msg->easy_handle); } else { - LOG(ERROR) << "Curl reports info on unfinished download?!"; + LOG(USCXML_ERROR) << "Curl reports info on unfinished download?!"; } } } diff --git a/test/src/test-stress.cpp b/test/src/test-stress.cpp index 6312ae4..d3253b4 100644 --- a/test/src/test-stress.cpp +++ b/test/src/test-stress.cpp @@ -79,7 +79,7 @@ int main(int argc, char** argv) { Interpreter interpreter = Interpreter::fromURL(std::string(argv[optind]) + PATH_SEPERATOR + entryIter->first); // Interpreter interpreter = Interpreter::fromURL("/Users/sradomski/Documents/TK/Code/uscxml/test/w3c/ecma/test422.scxml"); - LOG(INFO) << "Processing " << interpreter.getImpl()->getBaseURL(); + LOG(USCXML_INFO) << "Processing " << interpreter.getImpl()->getBaseURL(); if (interpreter) { interpreter.addMonitor(&vm); diff --git a/test/src/test-url.cpp b/test/src/test-url.cpp index 3d46c03..94c47e9 100644 --- a/test/src/test-url.cpp +++ b/test/src/test-url.cpp @@ -145,7 +145,7 @@ int main(int argc, char** argv) { try { testFileURLs(); } catch (Event e) { - LOG(ERROR) << e; + LOG(USCXML_ERROR) << e; exit(EXIT_FAILURE); } -- cgit v0.12