From 5342ef51367116726454ebdbd4bc27f0de3354b2 Mon Sep 17 00:00:00 2001 From: Stefan Radomski Date: Sat, 13 Apr 2013 19:04:54 +0200 Subject: Windows port compiles again --- apps/mmi-browser.cpp | 2 +- src/bindings/swig/php/uscxmlNativePHP.php | 2 +- src/uscxml/concurrency/tinythread.h | 1 + .../plugins/datamodel/xpath/XPathDataModel.cpp | 42 +++++++++++----------- .../invoker/filesystem/dirmon/DirMonInvoker.cpp | 11 +++--- test/CMakeLists.txt | 2 +- test/src/test-w3c.cpp | 2 +- 7 files changed, 30 insertions(+), 32 deletions(-) diff --git a/apps/mmi-browser.cpp b/apps/mmi-browser.cpp index ff326f1..a6db6ec 100644 --- a/apps/mmi-browser.cpp +++ b/apps/mmi-browser.cpp @@ -124,7 +124,7 @@ int main(int argc, char** argv) { std::set_terminate(customTerminate); -#ifdef HAS_SIGNAL_H +#if defined(HAS_SIGNAL_H) && !defined(WIN32) signal(SIGPIPE, SIG_IGN); #endif diff --git a/src/bindings/swig/php/uscxmlNativePHP.php b/src/bindings/swig/php/uscxmlNativePHP.php index eb66b3d..25ce9fa 100644 --- a/src/bindings/swig/php/uscxmlNativePHP.php +++ b/src/bindings/swig/php/uscxmlNativePHP.php @@ -2,7 +2,7 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.9 + * Version 2.0.7 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make diff --git a/src/uscxml/concurrency/tinythread.h b/src/uscxml/concurrency/tinythread.h index 9dd2fcb..71edf6c 100644 --- a/src/uscxml/concurrency/tinythread.h +++ b/src/uscxml/concurrency/tinythread.h @@ -59,6 +59,7 @@ freely, subject to the following restrictions: #if !defined(_TTHREAD_PLATFORM_DEFINED_) #if defined(_WIN32) || defined(__WIN32__) || defined(__WINDOWS__) #define _TTHREAD_WIN32_ +#include #else #define _TTHREAD_POSIX_ #endif diff --git a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp index 6f28464..8f7e5e9 100644 --- a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp +++ b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp @@ -188,16 +188,16 @@ bool XPathDataModel::evalAsBool(const std::string& expr) { std::string XPathDataModel::evalAsString(const std::string& expr) { XPathValue result = _xpath.evaluate_expr(expr, _doc); switch (result.type()) { - case STRING: + case Arabica::XPath::STRING: return result.asString(); break; - case BOOL: + case Arabica::XPath::BOOL: return (result.asBool() ? "true" : "false"); break; - case NUMBER: + case Arabica::XPath::NUMBER: return toStr(result.asNumber()); break; - case NODE_SET: { + case Arabica::XPath::NODE_SET: { NodeSet nodeSet = result.asNodeSet(); std::stringstream ss; for (int i = 0; i < nodeSet.size(); i++) { @@ -206,7 +206,7 @@ std::string XPathDataModel::evalAsString(const std::string& expr) { return ss.str(); break; } - case ANY: + case Arabica::XPath::ANY: throw Event("error.execution", Event::PLATFORM); break; } @@ -369,19 +369,19 @@ void XPathDataModel::assign(XPathValue& key, const XPathValue& value, const Arabica::DOM::Element& assignElem) { switch (value.type()) { - case STRING: + case Arabica::XPath::STRING: assign(key, value.asString(), assignElem); break; - case BOOL: + case Arabica::XPath::BOOL: assign(key, value.asBool(), assignElem); break; - case NUMBER: + case Arabica::XPath::NUMBER: assign(key, value.asNumber(), assignElem); break; - case NODE_SET: + case Arabica::XPath::NODE_SET: assign(key, value.asNodeSet(), assignElem); break; - case ANY: + case Arabica::XPath::ANY: throw Event("error.execution", Event::PLATFORM); } } @@ -390,7 +390,7 @@ void XPathDataModel::assign(XPathValue& key, const std::string& value, const Arabica::DOM::Element& assignElem) { switch (key.type()) { - case NODE_SET: { + case Arabica::XPath::NODE_SET: { if (key.asNodeSet().size() == 0) return; for (int i = 0; i < key.asNodeSet().size(); i++) { @@ -430,10 +430,10 @@ void XPathDataModel::assign(XPathValue& key, } break; } - case STRING: - case BOOL: - case NUMBER: - case ANY: + case Arabica::XPath::STRING: + case Arabica::XPath::BOOL: + case Arabica::XPath::NUMBER: + case Arabica::XPath::ANY: throw Event("error.execution", Event::PLATFORM); break; default: @@ -456,7 +456,7 @@ void XPathDataModel::assign(XPathValue& key, const NodeSet& value, const Arabica::DOM::Element& assignElem) { switch (key.type()) { - case NODE_SET: { + case Arabica::XPath::NODE_SET: { if (key.asNodeSet().size() == 0) return; for (int i = 0; i < key.asNodeSet().size(); i++) { @@ -535,10 +535,10 @@ void XPathDataModel::assign(XPathValue& key, } break; } - case STRING: - case BOOL: - case NUMBER: - case ANY: + case Arabica::XPath::STRING: + case Arabica::XPath::BOOL: + case Arabica::XPath::NUMBER: + case Arabica::XPath::ANY: throw Event("error.execution", Event::PLATFORM); break; } @@ -574,7 +574,7 @@ bool XPathFunctionIn::doEvaluate(const Node& context, const ExecutionContext& executionContext) const { for (int i = 0; i < argCount(); i++) { XPathValue stateName = arg(i, context, executionContext); - if (stateName.type() == STRING) { + if (stateName.type() == Arabica::XPath::STRING) { if (!Interpreter::isMember(_interpreter->getState(stateName.asString()), _interpreter->getConfiguration())) { return false; } diff --git a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp index b2a16f3..882c174 100644 --- a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp +++ b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp @@ -275,23 +275,21 @@ void DirectoryWatch::updateEntries(bool reportAsExisting) { hFind = FindFirstFile(szDir, &ffd); do { - string dname = ffd.cFileName; + std::string dname = ffd.cFileName; #endif // see if the file was changed - char* filename; - asprintf(&filename, "%s/%s", (_dir + _relDir).c_str(), dname.c_str()); + std::string filename = _dir + _relDir + "/" + dname; +// asprintf(&filename, "%s/%s", (_dir + _relDir).c_str(), dname.c_str()); struct stat fileStat; - if (stat(filename, &fileStat) != 0) { + if (stat(filename.c_str(), &fileStat) != 0) { LOG(ERROR) << "Error with stat on directory entry: " << filename << ": " << strerror(errno); - free(filename); continue; } if (fileStat.st_mode & S_IFDIR) { if (boost::equals(dname, ".") || boost::equals(dname, "..")) { - free(filename); continue; // do not report . or .. } } @@ -330,7 +328,6 @@ void DirectoryWatch::updateEntries(bool reportAsExisting) { } } - free(filename); _knownEntries[dname] = fileStat; // gets copied on insertion #ifndef WIN32 } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 7022d3c..7439abc 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -70,7 +70,7 @@ set_target_properties(scxml-test-framework-client PROPERTIES FOLDER "Tests") if (RUN_W3C_TESTS) - add_executable(test-w3c src/test-w3c.cpp) + add_executable(test-w3c src/test-w3c.cpp ${PROJECT_SOURCE_DIR}/contrib/src/getopt/XGetopt.cpp) target_link_libraries(test-w3c uscxml) set_target_properties(test-w3c PROPERTIES FOLDER "Tests") diff --git a/test/src/test-w3c.cpp b/test/src/test-w3c.cpp index 3b6c43a..f18b339 100644 --- a/test/src/test-w3c.cpp +++ b/test/src/test-w3c.cpp @@ -109,7 +109,7 @@ int main(int argc, char** argv) { std::set_terminate(customTerminate); -#ifdef HAS_SIGNAL_H +#if defined(HAS_SIGNAL_H) && !defined(WIN32) signal(SIGPIPE, SIG_IGN); #endif -- cgit v0.12