From 64298f234d4751d094ef91833830337417404e82 Mon Sep 17 00:00:00 2001 From: Stefan Radomski Date: Thu, 23 Jun 2016 13:06:59 +0200 Subject: Smaller bug-fixes and refactorings --- CMakeLists.txt | 4 +- apps/uscxml-browser.cpp | 43 ++++-- apps/uscxml-debugger.html | 5 +- contrib/src/uscxml/InterpreterOptions.cpp | 187 ++++++++++++++++++++++++ contrib/src/uscxml/InterpreterOptions.h | 81 ++++++++++ src/uscxml/Interpreter.cpp | 153 ------------------- src/uscxml/Interpreter.h | 44 ------ src/uscxml/debug/DebugSession.cpp | 48 ++++-- src/uscxml/debug/DebugSession.h | 1 + src/uscxml/debug/DebuggerServlet.cpp | 5 +- src/uscxml/debug/DebuggerServlet.h | 6 +- src/uscxml/interpreter/BasicContentExecutor.cpp | 2 +- src/uscxml/messages/Data.h | 2 +- src/uscxml/util/DOM.h | 1 - 14 files changed, 355 insertions(+), 227 deletions(-) create mode 100644 contrib/src/uscxml/InterpreterOptions.cpp create mode 100644 contrib/src/uscxml/InterpreterOptions.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 40743b7..f5946d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,10 +92,12 @@ include_directories(contrib/src) include_directories(${CMAKE_BINARY_DIR}) include_directories(${PROJECT_SOURCE_DIR}/contrib/src/jsmn) include_directories(${PROJECT_SOURCE_DIR}/contrib/src/evws) + +set(GETOPT_FILES ${PROJECT_SOURCE_DIR}/contrib/src/uscxml/InterpreterOptions.cpp) if (WIN32) include_directories(${PROJECT_SOURCE_DIR}/contrib/src/getopt) include_directories(${PROJECT_SOURCE_DIR}/contrib/src/inttypes) - set(GETOPT_FILES ${PROJECT_SOURCE_DIR}/contrib/src/getopt/getopt.c) + list(APPEND GETOPT_FILES ${PROJECT_SOURCE_DIR}/contrib/src/getopt/getopt.c) endif() ################################ diff --git a/apps/uscxml-browser.cpp b/apps/uscxml-browser.cpp index a57b79b..5f48842 100644 --- a/apps/uscxml-browser.cpp +++ b/apps/uscxml-browser.cpp @@ -1,6 +1,8 @@ #include "uscxml/config.h" #include "uscxml/Interpreter.h" +#include "uscxml/InterpreterOptions.h" #include "uscxml/debug/InterpreterIssue.h" +#include "uscxml/debug/DebuggerServlet.h" #include "uscxml/interpreter/InterpreterMonitor.h" #include "uscxml/util/DOM.h" @@ -87,22 +89,37 @@ int main(int argc, char** argv) { } } + if (options.withDebugger) { + DebuggerServlet* debugger; + debugger = new DebuggerServlet(); + debugger->copyToInvokers(true); + HTTPServer::getInstance()->registerServlet("/debug", debugger); + for (auto interpreter : interpreters) { + interpreter.addMonitor(debugger); + } + } + // run interpreters - try { - std::list::iterator interpreterIter = interpreters.begin(); - while (interpreters.size() > 0) { - while(interpreterIter != interpreters.end()) { - InterpreterState state = interpreterIter->step(); - if (state == USCXML_FINISHED) { - interpreterIter = interpreters.erase(interpreterIter); - } else { - interpreterIter++; + if (interpreters.size() > 0) { + try { + std::list::iterator interpreterIter = interpreters.begin(); + while (interpreters.size() > 0) { + while(interpreterIter != interpreters.end()) { + InterpreterState state = interpreterIter->step(); + if (state == USCXML_FINISHED) { + interpreterIter = interpreters.erase(interpreterIter); + } else { + interpreterIter++; + } } + interpreterIter = interpreters.begin(); } - interpreterIter = interpreters.begin(); + } catch (Event e) { + std::cout << e << std::endl; } - } catch (Event e) { - std::cout << e << std::endl; - } + } else if (options.withDebugger) { + while(true) + std::this_thread::sleep_for(std::chrono::seconds(1)); + } return EXIT_SUCCESS; } \ No newline at end of file diff --git a/apps/uscxml-debugger.html b/apps/uscxml-debugger.html index 3aece02..fa49554 100644 --- a/apps/uscxml-debugger.html +++ b/apps/uscxml-debugger.html @@ -1099,11 +1099,14 @@ // we found a document, enable "recent" button $(this.recentDocumentsNode).prev().attr('disabled', false); + console.log(recentURL); + var recentDocumentItem = $('\
  • ' + key + '
  • \ '); var recentDocumentFeatures = $(recentDocumentItem).find("span.recent-document-features"); - $(recentDocumentItem).children("a").click(function() { + $(recentDocumentItem).children("a").unbind('click').click(function() { + console.log("recentURL: " + recentURL); $(debug.loadFromURLModalNode).find("input#loadFromURLModalInput").val(recentURL); $(debug.recentDocumentsNode).dropdown("toggle"); return false; diff --git a/contrib/src/uscxml/InterpreterOptions.cpp b/contrib/src/uscxml/InterpreterOptions.cpp new file mode 100644 index 0000000..d3d50be --- /dev/null +++ b/contrib/src/uscxml/InterpreterOptions.cpp @@ -0,0 +1,187 @@ +/** + * @file + * @author 2016 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de) + * @copyright Simplified BSD + * + * @cond + * This program is free software: you can redistribute it and/or modify + * it under the terms of the FreeBSD license as published by the FreeBSD + * project. + * + * 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. + * + * You should have received a copy of the FreeBSD license along with this + * program. If not, see . + * @endcond + */ + +#include "uscxml/InterpreterOptions.h" +#include "uscxml/util/String.h" +#include "uscxml/util/Convenience.h" +#include "getopt.h" + +#include + +#include + +namespace uscxml { + +void InterpreterOptions::printUsageAndExit(const char* progName) { + + // remove path from program name + std::string progStr(progName); + if (progStr.find_last_of(PATH_SEPERATOR) != std::string::npos) { + progStr = progStr.substr(progStr.find_last_of(PATH_SEPERATOR) + 1, progStr.length() - (progStr.find_last_of(PATH_SEPERATOR) + 1)); + } + + printf("%s version " USCXML_VERSION " (" CMAKE_BUILD_TYPE " build - " CMAKE_COMPILER_STRING ")\n", progStr.c_str()); + printf("Usage\n"); + printf("\t%s", progStr.c_str()); + printf(" [-v] [-d] [-lN]"); +#ifdef BUILD_AS_PLUGINS + printf(" [-p pluginPath]"); +#endif + printf(" [-tN]"); +#ifdef EVENT_SSL_FOUND + printf(" [-sN] [--certificate=FILE | --private-key=FILE --public-key=FILE] "); +#endif + printf(" \\\n\t\t URL1 [--disable-http] [--option1=value1 --option2=value2]"); + printf(" \\\n\t\t[URL2 [--disable-http] [--option3=value3 --option4=value4]]"); + printf(" \\\n\t\t[URLN [--disable-http] [--optionN=valueN --optionM=valueM]]"); + printf("\n"); + printf("Options\n"); +#ifdef BUILD_AS_PLUGINS + printf("\t-p : path to the uSCXML plugins (or export USCXML_PLUGIN_PATH)\n"); +#endif + printf("\t-v : be verbose\n"); + printf("\t-c : perform some sanity checks on the state-chart\n"); + printf("\t-lN : set loglevel to N\n"); + printf("\t-tN : port for HTTP server\n"); + printf("\t-sN : port for HTTPS server\n"); + printf("\t-wN : port for WebSocket server\n"); + printf("\t-d : start with debugger attachable\n"); + printf("\n"); + exit(1); +} + +InterpreterOptions InterpreterOptions::fromCmdLine(int argc, char** argv) { + InterpreterOptions options; + optind = 0; + struct option longOptions[] = { + {"check", no_argument, 0, 'c'}, + {"verbose", no_argument, 0, 'v'}, + {"debug", no_argument, 0, 'd'}, + {"port", required_argument, 0, 't'}, + {"ssl-port", required_argument, 0, 's'}, + {"ws-port", required_argument, 0, 'w'}, + {"certificate", required_argument, 0, 0}, + {"private-key", required_argument, 0, 0}, + {"public-key", required_argument, 0, 0}, + {"plugin-path", required_argument, 0, 'p'}, + {"loglevel", required_argument, 0, 'l'}, + {0, 0, 0, 0} + }; + + opterr = 0; + InterpreterOptions* currOptions = &options; + + // parse global options + int optionInd = 0; + int option; + for (;;) { + option = getopt_long_only(argc, argv, "+vcdt:s:w:p:l:", longOptions, &optionInd); + if (option == -1) { + if (optind == argc) + // we are done with parsing + goto DONE_PARSING_CMD; + + std::string url = argv[optind]; + + options.interpreters.push_back(std::make_pair(url, new InterpreterOptions())); + currOptions = options.interpreters.back().second; + + argc -= optind; + argv += optind; + optind = 0; + + if (argc <= 1) + goto DONE_PARSING_CMD; + + } + switch(option) { + // cases without short option + case 0: { + if (iequals(longOptions[optionInd].name, "disable-http")) { + currOptions->withHTTP = false; + } else if (iequals(longOptions[optionInd].name, "private-key")) { + currOptions->privateKey = optarg; + } else if (iequals(longOptions[optionInd].name, "certificate")) { + currOptions->certificate = optarg; + } else if (iequals(longOptions[optionInd].name, "public-key")) { + currOptions->publicKey = optarg; + } + break; + } + // cases with short-hand options + case 'l': + currOptions->logLevel = strTo(optarg); + break; + case 'p': + currOptions->pluginPath = optarg; + break; + case 'c': + currOptions->validate = true; + break; + case 'd': + currOptions->withDebugger = true; + break; + case 't': + currOptions->httpPort = strTo(optarg); + break; + case 's': + currOptions->httpsPort = strTo(optarg); + break; + case 'w': + currOptions->wsPort = strTo(optarg); + break; + case 'v': + currOptions->verbose = true; + break; + case '?': { + std::string param = argv[optind - 1]; + if (boost::starts_with(param, "--")) { + param = param.substr(2, param.length() - 2); + } else if (boost::starts_with(param, "-")) { + param = param.substr(1, param.length() - 1); + } else { + break; + } + boost::trim(param); + + size_t equalPos = param.find("="); + if (equalPos != std::string::npos) { + std::string key = param.substr(0, equalPos); + std::string value = param.substr(equalPos + 1, param.length() - (equalPos + 1)); + currOptions->additionalParameters[key] = value; + } else { + currOptions->additionalParameters[param] = ""; + } + break; + } + default: + break; + } + } + +DONE_PARSING_CMD: + + if (options.interpreters.size() == 0 && !options.withDebugger) + options.error = "No SCXML document to evaluate"; + + return options; +} + + +} diff --git a/contrib/src/uscxml/InterpreterOptions.h b/contrib/src/uscxml/InterpreterOptions.h new file mode 100644 index 0000000..44bb399 --- /dev/null +++ b/contrib/src/uscxml/InterpreterOptions.h @@ -0,0 +1,81 @@ +/** + * @file + * @author 2016 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de) + * @copyright Simplified BSD + * + * @cond + * This program is free software: you can redistribute it and/or modify + * it under the terms of the FreeBSD license as published by the FreeBSD + * project. + * + * 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. + * + * You should have received a copy of the FreeBSD license along with this + * program. If not, see . + * @endcond + */ + +#ifndef INTERPRETEROPTIONS_H_9D94370D +#define INTERPRETEROPTIONS_H_9D94370D + +#include "uscxml/config.h" +#include "uscxml/Common.h" + +#include +#include +#include + +namespace uscxml { + +/** + * @ingroup interpreter + * Options to pass into an interpreter. + */ +class USCXML_API InterpreterOptions { +public: + InterpreterOptions() : + verbose(false), + validate(false), + withHTTP(true), + withHTTPS(true), + withWS(true), + withDebugger(true), + logLevel(0), + httpPort(5080), + httpsPort(5443), + wsPort(5081) { + } + + bool verbose; + bool validate; + bool withHTTP; + bool withHTTPS; + bool withWS; + bool withDebugger; + int logLevel; + unsigned short httpPort; + unsigned short httpsPort; + unsigned short wsPort; + std::string pluginPath; + std::string certificate; + std::string privateKey; + std::string publicKey; + std::vector > interpreters; + std::map additionalParameters; + + std::string error; + + operator bool() { + return error.length() == 0; + } + + static void printUsageAndExit(const char* progName); + static InterpreterOptions fromCmdLine(int argc, char** argv); + +}; + +} + +#endif /* end of include guard: INTERPRETEROPTIONS_H_9D94370D */ diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp index d21ec6a..ff6de81 100644 --- a/src/uscxml/Interpreter.cpp +++ b/src/uscxml/Interpreter.cpp @@ -40,8 +40,6 @@ #include #include -#include "getopt.h" - #include "easylogging++.h" INITIALIZE_EASYLOGGINGPP @@ -294,155 +292,4 @@ void StateTransitionMonitor::beforeMicroStep(InterpreterImpl* impl) { std::cerr << "}" << std::endl; } -void InterpreterOptions::printUsageAndExit(const char* progName) { - // remove path from program name - std::string progStr(progName); - if (progStr.find_last_of(PATH_SEPERATOR) != std::string::npos) { - progStr = progStr.substr(progStr.find_last_of(PATH_SEPERATOR) + 1, progStr.length() - (progStr.find_last_of(PATH_SEPERATOR) + 1)); - } - - printf("%s version " USCXML_VERSION " (" CMAKE_BUILD_TYPE " build - " CMAKE_COMPILER_STRING ")\n", progStr.c_str()); - printf("Usage\n"); - printf("\t%s", progStr.c_str()); - printf(" [-v] [-d] [-lN]"); -#ifdef BUILD_AS_PLUGINS - printf(" [-p pluginPath]"); -#endif - printf(" [-tN]"); -#ifdef EVENT_SSL_FOUND - printf(" [-sN] [--certificate=FILE | --private-key=FILE --public-key=FILE] "); -#endif - printf(" \\\n\t\t URL1 [--disable-http] [--option1=value1 --option2=value2]"); - printf(" \\\n\t\t[URL2 [--disable-http] [--option3=value3 --option4=value4]]"); - printf(" \\\n\t\t[URLN [--disable-http] [--optionN=valueN --optionM=valueM]]"); - printf("\n"); - printf("Options\n"); -#ifdef BUILD_AS_PLUGINS - printf("\t-p : path to the uSCXML plugins (or export USCXML_PLUGIN_PATH)\n"); -#endif - printf("\t-v : be verbose\n"); - printf("\t-c : perform some sanity checks on the state-chart\n"); - printf("\t-lN : set loglevel to N\n"); - printf("\t-tN : port for HTTP server\n"); - printf("\t-sN : port for HTTPS server\n"); - printf("\t-wN : port for WebSocket server\n"); - printf("\n"); - exit(1); -} - -InterpreterOptions InterpreterOptions::fromCmdLine(int argc, char** argv) { - InterpreterOptions options; - optind = 0; - struct option longOptions[] = { - {"check", no_argument, 0, 'c'}, - {"verbose", no_argument, 0, 'v'}, - {"debug", no_argument, 0, 'd'}, - {"port", required_argument, 0, 't'}, - {"ssl-port", required_argument, 0, 's'}, - {"ws-port", required_argument, 0, 'w'}, - {"certificate", required_argument, 0, 0}, - {"private-key", required_argument, 0, 0}, - {"public-key", required_argument, 0, 0}, - {"plugin-path", required_argument, 0, 'p'}, - {"loglevel", required_argument, 0, 'l'}, - {0, 0, 0, 0} - }; - - opterr = 0; - InterpreterOptions* currOptions = &options; - - // parse global options - int optionInd = 0; - int option; - for (;;) { - option = getopt_long_only(argc, argv, "+vcdt:s:w:p:l:", longOptions, &optionInd); - if (option == -1) { - if (optind == argc) - // we are done with parsing - goto DONE_PARSING_CMD; - - std::string url = argv[optind]; - - options.interpreters.push_back(std::make_pair(url, new InterpreterOptions())); - currOptions = options.interpreters.back().second; - - argc -= optind; - argv += optind; - optind = 0; - - if (argc <= 1) - goto DONE_PARSING_CMD; - - } - switch(option) { - // cases without short option - case 0: { - if (iequals(longOptions[optionInd].name, "disable-http")) { - currOptions->withHTTP = false; - } else if (iequals(longOptions[optionInd].name, "private-key")) { - currOptions->privateKey = optarg; - } else if (iequals(longOptions[optionInd].name, "certificate")) { - currOptions->certificate = optarg; - } else if (iequals(longOptions[optionInd].name, "public-key")) { - currOptions->publicKey = optarg; - } - break; - } - // cases with short-hand options - case 'l': - currOptions->logLevel = strTo(optarg); - break; - case 'p': - currOptions->pluginPath = optarg; - break; - case 'c': - currOptions->validate = true; - break; - case 't': - currOptions->httpPort = strTo(optarg); - break; - case 's': - currOptions->httpsPort = strTo(optarg); - break; - case 'w': - currOptions->wsPort = strTo(optarg); - break; - case 'v': - currOptions->verbose = true; - break; - case '?': { - std::string param = argv[optind - 1]; - if (boost::starts_with(param, "--")) { - param = param.substr(2, param.length() - 2); - } else if (boost::starts_with(param, "-")) { - param = param.substr(1, param.length() - 1); - } else { - break; - } - boost::trim(param); - - size_t equalPos = param.find("="); - if (equalPos != std::string::npos) { - std::string key = param.substr(0, equalPos); - std::string value = param.substr(equalPos + 1, param.length() - (equalPos + 1)); - currOptions->additionalParameters[key] = value; - } else { - currOptions->additionalParameters[param] = ""; - } - break; - } - default: - break; - } - } - -DONE_PARSING_CMD: - - if (options.interpreters.size() == 0) - options.error = "No SCXML document to evaluate"; - - return options; -} - - } diff --git a/src/uscxml/Interpreter.h b/src/uscxml/Interpreter.h index 0d7573c..c3cd7c4 100644 --- a/src/uscxml/Interpreter.h +++ b/src/uscxml/Interpreter.h @@ -42,50 +42,6 @@ class InterpreterMonitor; class InterpreterImpl; class InterpreterIssue; -/** - * @ingroup interpreter - * Options to pass into an interpreter. - */ -class USCXML_API InterpreterOptions { -public: - InterpreterOptions() : - verbose(false), - validate(false), - withHTTP(true), - withHTTPS(true), - withWS(true), - logLevel(0), - httpPort(5080), - httpsPort(5443), - wsPort(5081) { - } - - bool verbose; - bool validate; - bool withHTTP; - bool withHTTPS; - bool withWS; - int logLevel; - unsigned short httpPort; - unsigned short httpsPort; - unsigned short wsPort; - std::string pluginPath; - std::string certificate; - std::string privateKey; - std::string publicKey; - std::vector > interpreters; - std::map additionalParameters; - - std::string error; - - operator bool() { - return error.length() == 0; - } - - static void printUsageAndExit(const char* progName); - static InterpreterOptions fromCmdLine(int argc, char** argv); - -}; /** * @ingroup interpreter diff --git a/src/uscxml/debug/DebugSession.cpp b/src/uscxml/debug/DebugSession.cpp index ef4d469..042235e 100644 --- a/src/uscxml/debug/DebugSession.cpp +++ b/src/uscxml/debug/DebugSession.cpp @@ -21,6 +21,8 @@ #include "uscxml/debug/Debugger.h" #include "uscxml/util/Predicates.h" +#include + namespace uscxml { void DebugSession::checkBreakpoints(const std::list qualifiedBreakpoints) { @@ -177,15 +179,39 @@ Data DebugSession::debugStart(const Data& data) { replyData.compound["reason"] = Data("No interpreter attached or loaded", Data::VERBATIM); replyData.compound["status"] = Data("failure", Data::VERBATIM); } else { - //_interpreter.start(); - assert(false); - + _isRunning = true; + _interpreterThread = new std::thread(DebugSession::run, this); replyData.compound["status"] = Data("success", Data::VERBATIM); } return replyData; } +void DebugSession::run(void* instance) { + DebugSession* INSTANCE = (DebugSession*)instance; + +#ifdef APPLE + std::string threadName; + threadName += "uscxml::"; + threadName += (INSTANCE->_interpreter.getImpl()->_name.size() > 0 ? INSTANCE->_interpreter.getImpl()->_name : "anon"); + threadName += ".debug"; + + pthread_setname_np(threadName.c_str()); +#endif + + InterpreterState state = USCXML_UNDEF; + while(state != USCXML_FINISHED && INSTANCE->_isRunning) { + state = INSTANCE->_interpreter.step(100); + + // if (!INSTANCE->_isStarted) { + // // we have been cancelled + // INSTANCE->_isActive = false; + // return; + // } + } + LOG(DEBUG) << "done"; +} + Data DebugSession::debugStop(const Data& data) { Data replyData; @@ -194,9 +220,11 @@ Data DebugSession::debugStop(const Data& data) { _debugger->detachSession(_interpreter.getImpl().get()); } - if (_interpreter && !_isAttached) - assert(false); - //_interpreter.stop(); + if (_isRunning && _interpreterThread != NULL) { + _isRunning = false; + _interpreterThread->join(); + delete(_interpreterThread); + } // unblock _resumeCond.notify_all(); @@ -218,9 +246,11 @@ Data DebugSession::debugStep(const Data& data) { Data replyData; if (_interpreter) { // register ourself as a monitor - if (!_isRunning) - //_interpreter.start(); - assert(false); + if (!_isRunning) { + _isRunning = true; + _interpreterThread = new std::thread(DebugSession::run, this); + + } replyData.compound["status"] = Data("success", Data::VERBATIM); } else { diff --git a/src/uscxml/debug/DebugSession.h b/src/uscxml/debug/DebugSession.h index a1ecaa0..c4f2564 100644 --- a/src/uscxml/debug/DebugSession.h +++ b/src/uscxml/debug/DebugSession.h @@ -90,6 +90,7 @@ protected: std::thread* _interpreterThread = NULL; bool _isRunning; + static void run(void* instance); bool _markedForDeletion; Debugger* _debugger; diff --git a/src/uscxml/debug/DebuggerServlet.cpp b/src/uscxml/debug/DebuggerServlet.cpp index 2b035a6..25df9dd 100644 --- a/src/uscxml/debug/DebuggerServlet.cpp +++ b/src/uscxml/debug/DebuggerServlet.cpp @@ -87,7 +87,7 @@ void DebuggerServlet::handleCORS(const HTTPServer::Request& request) { HTTPServer::reply(corsReply); } -bool DebuggerServlet::httpRecvRequest(const HTTPServer::Request& request) { +bool DebuggerServlet::requestFromHTTP(const HTTPServer::Request& request) { if (!request.data.hasKey("path")) return false; // returnError(request); @@ -238,6 +238,9 @@ void DebuggerServlet::processListSessions(const HTTPServer::Request& request) { returnData(request, replyData); } +void DebuggerServlet::handle(const el::LogDispatchData* data) { +} + /* void DebuggerServlet::send(google::LogSeverity severity, const char* full_filename, const char* base_filename, int line, diff --git a/src/uscxml/debug/DebuggerServlet.h b/src/uscxml/debug/DebuggerServlet.h index dc6b0ee..2ed1879 100644 --- a/src/uscxml/debug/DebuggerServlet.h +++ b/src/uscxml/debug/DebuggerServlet.h @@ -29,7 +29,7 @@ namespace uscxml { -class USCXML_API DebuggerServlet : public Debugger, public HTTPServlet { +class USCXML_API DebuggerServlet : public Debugger, public HTTPServlet, public el::LogDispatchCallback { public: class LogMessage : public Data { public: @@ -58,7 +58,7 @@ public: bool isCORS(const HTTPServer::Request& request); void handleCORS(const HTTPServer::Request& request); - bool httpRecvRequest(const HTTPServer::Request& request); + bool requestFromHTTP(const HTTPServer::Request& request); void setURL(const std::string& url) { _url = url; } @@ -92,6 +92,8 @@ public: const struct ::tm* tm_time, const char* message, size_t message_len); */ + void handle(const el::LogDispatchData* data); + protected: void serverPushData(std::shared_ptr); diff --git a/src/uscxml/interpreter/BasicContentExecutor.cpp b/src/uscxml/interpreter/BasicContentExecutor.cpp index 0f5a67f..2582bb0 100644 --- a/src/uscxml/interpreter/BasicContentExecutor.cpp +++ b/src/uscxml/interpreter/BasicContentExecutor.cpp @@ -597,7 +597,7 @@ Data BasicContentExecutor::elementAsData(XERCESC_NS::DOMElement* element) { Data d; XERCESC_NS::DOMDocument* doc = parser.adoptDocument(); - d.adoptedDoc = std::make_shared(doc); + d.adoptedDoc = std::shared_ptr(doc); d.node = doc->getDocumentElement(); return d; diff --git a/src/uscxml/messages/Data.h b/src/uscxml/messages/Data.h index 73640f0..899ede9 100644 --- a/src/uscxml/messages/Data.h +++ b/src/uscxml/messages/Data.h @@ -220,7 +220,7 @@ protected: #endif XERCESC_NS::DOMNode* node; - std::shared_ptr adoptedDoc; + std::shared_ptr adoptedDoc; std::map compound; std::list array; std::string atom; diff --git a/src/uscxml/util/DOM.h b/src/uscxml/util/DOM.h index 86fa813..ae5fa60 100644 --- a/src/uscxml/util/DOM.h +++ b/src/uscxml/util/DOM.h @@ -62,7 +62,6 @@ public: static const XERCESC_NS::DOMElement* getNearestAncestor(const XERCESC_NS::DOMNode* node, const std::string tagName); static bool isDescendant(const XERCESC_NS::DOMNode* s1, const XERCESC_NS::DOMNode* s2); - static bool hasIntersection(const std::list& l1, const std::list& l2); static bool isMember(const XERCESC_NS::DOMElement* node, const std::list& list); -- cgit v0.12