summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bindings/CMakeLists.txt7
-rw-r--r--src/bindings/swig/java/CMakeLists.txt4
-rw-r--r--src/uscxml/Interpreter.cpp27
-rw-r--r--src/uscxml/Interpreter.h1
-rw-r--r--src/uscxml/URL.cpp28
-rw-r--r--src/uscxml/URL.h4
6 files changed, 44 insertions, 27 deletions
diff --git a/src/bindings/CMakeLists.txt b/src/bindings/CMakeLists.txt
index 25c11a1..edddc31 100644
--- a/src/bindings/CMakeLists.txt
+++ b/src/bindings/CMakeLists.txt
@@ -11,8 +11,9 @@ if (WIN32)
LIST(APPEND CMAKE_PROGRAM_PATH "${PROJECT_BINARY_DIR}/../../swig/")
endif()
- LIST(APPEND CMAKE_PROGRAM_PATH "C:/Program Files/swig") # swig.exe
- LIST(APPEND CMAKE_PROGRAM_PATH "C:/Program Files (x86)/swig") # swig.exe
+ file(GLOB POTENTIAL_SWIG "C:/Program Files/swig*" "C:/Program Files (x86)/swig*")
+ LIST(APPEND CMAKE_PROGRAM_PATH ${POTENTIAL_SWIG}) # swig.exe
+ # message(FATAL_ERROR "POTENTIAL_SWIG: ${POTENTIAL_SWIG}")
endif()
LIST(APPEND CMAKE_PROGRAM_PATH $ENV{SWIG_DIR})
@@ -29,7 +30,7 @@ if (SWIG_FOUND)
message(STATUS "SWIG version > 3.0 is recommended, found ${SWIG_VERSION}")
endif()
else()
- message(STATUS "SWIG version 2.0.5 is required, found ${SWIG_VERSION} - skipping java wrapper generation")
+ message(STATUS "SWIG version 2.0.5 is required, found ${SWIG_VERSION} - skipping wrapper generation")
endif()
else()
message(STATUS "SWIG not found - skipping wrapper generation")
diff --git a/src/bindings/swig/java/CMakeLists.txt b/src/bindings/swig/java/CMakeLists.txt
index eb51f83..de2a161 100644
--- a/src/bindings/swig/java/CMakeLists.txt
+++ b/src/bindings/swig/java/CMakeLists.txt
@@ -31,7 +31,9 @@ set_target_properties(uscxmlNativeJava PROPERTIES COMPILE_FLAGS "-DSWIG")
swig_link_libraries(uscxmlNativeJava uscxml)
-FIND_PROGRAM(ANT_EXECUTABLE ant PATHS $ENV{ANT_HOME}/bin ENV PATH )
+file(GLOB POTENTIAL_ANT "C:/Program Files/apache-ant**/bin" "C:/Program Files (x86)/apache-ant**/bin")
+
+FIND_PROGRAM(ANT_EXECUTABLE ant PATHS $ENV{ANT_HOME}/bin ${POTENTIAL_ANT} ENV PATH )
if (ANT_EXECUTABLE)
set(USCXML_LANGUAGE_BINDINGS "java ${USCXML_LANGUAGE_BINDINGS}")
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp
index 5d9d1cd..dc53906 100644
--- a/src/uscxml/Interpreter.cpp
+++ b/src/uscxml/Interpreter.cpp
@@ -407,13 +407,9 @@ Interpreter Interpreter::fromXML(const std::string& xml) {
return fromInputSource(inputSource);
}
-Interpreter Interpreter::fromURI(const std::string& uri) {
- URL url(uri);
- return fromURI(url);
-}
-Interpreter Interpreter::fromURI(const URL& uri) {
- URL absUrl = uri;
+Interpreter Interpreter::fromURI(const std::string& uri) {
+ URL absUrl(uri);
if (!absUrl.isAbsolute()) {
if (!absUrl.toAbsoluteCwd()) {
ERROR_COMMUNICATION_THROW("URL is not absolute or does not have file schema");
@@ -426,15 +422,8 @@ Interpreter Interpreter::fromURI(const URL& uri) {
Arabica::SAX::InputSource<std::string> inputSource;
inputSource.setSystemId(absUrl.asString());
interpreter = fromInputSource(inputSource);
-#if 0
- } else if (iequals(absUrl.scheme(), "http")) {
- // handle http per arabica - this will not follow redirects
- Arabica::SAX::InputSource<std::string> inputSource;
- inputSource.setSystemId(absUrl.asString());
- interpreter = fromInputSource(inputSource);
-#endif
} else {
- // use curl for everything else
+ // use curl for everything !file - even for http as arabica won't follow redirects
std::stringstream ss;
ss << absUrl;
if (absUrl.downloadFailed()) {
@@ -547,14 +536,14 @@ InterpreterImpl::~InterpreterImpl() {
event.name = "unblock.and.die";
receive(event);
- _thread->join();
- delete(_thread);
} else {
// this can happen with a shared_from_this at an interpretermonitor
setInterpreterState(USCXML_DESTROYED);
}
+ _thread->join();
+ delete(_thread);
}
- join();
+
if (_sendQueue)
delete _sendQueue;
@@ -1153,8 +1142,8 @@ bool InterpreterImpl::runOnMainThread(int fps, bool blocking) {
return false;
if (fps > 0) {
- uint64_t nextRun = _lastRunOnMainThread + (1000 / fps);
- if (blocking) {
+ if (blocking && _lastRunOnMainThread > 0) {
+ uint64_t nextRun = _lastRunOnMainThread + (1000 / fps);
while(nextRun > tthread::timeStamp()) {
tthread::this_thread::sleep_for(tthread::chrono::milliseconds(nextRun - tthread::timeStamp()));
}
diff --git a/src/uscxml/Interpreter.h b/src/uscxml/Interpreter.h
index 70c9c0e..d6da7bd 100644
--- a/src/uscxml/Interpreter.h
+++ b/src/uscxml/Interpreter.h
@@ -586,7 +586,6 @@ public:
const NameSpaceInfo& nameSpaceInfo);
static Interpreter fromXML(const std::string& xml);
static Interpreter fromURI(const std::string& uri);
- static Interpreter fromURI(const URL& uri);
static Interpreter fromClone(const Interpreter& other);
Interpreter() : _impl() {} // the empty, invalid interpreter
diff --git a/src/uscxml/URL.cpp b/src/uscxml/URL.cpp
index d18b55c..b1297d5 100644
--- a/src/uscxml/URL.cpp
+++ b/src/uscxml/URL.cpp
@@ -52,6 +52,21 @@
namespace uscxml {
+void URL::dump() {
+ std::cout << ">>>" << asString() << "<<< ";
+ std::cout << (isAbsolute() ? "absolute" : "relative") << std::endl;
+ std::cout << "[scheme]" << scheme();
+ std::cout << "[host]" << host();
+ std::cout << "[port]" << port();
+ std::cout << "[path]" << path();
+ std::cout << "[file]" << file() << std::endl;
+ std::cout << "[segmts " << pathComponents().size() << "]: ";
+ for (int i = 0; i < pathComponents().size(); i++) {
+ std::cout << pathComponents()[i] << ", ";
+ }
+ std::cout << std::endl << std::endl;
+}
+
std::string URL::tmpDir() {
// try hard to find a temporary directory
const char* tmpDir = NULL;
@@ -157,7 +172,12 @@ std::string URL::getResourceDir() {
}
#endif
-URLImpl::URLImpl(const std::string& url) : _handle(NULL), _uri(url), _isDownloaded(false), _hasFailed(false) {
+URLImpl::URLImpl(const std::string& url) : _handle(NULL), _isDownloaded(false), _hasFailed(false) {
+ if (url[0] == '/') {
+ _uri = Arabica::io::URI("file://" + url);
+ } else {
+ _uri = Arabica::io::URI(url);
+ }
std::stringstream ss(_uri.path());
std::string item;
while(std::getline(ss, item, '/')) {
@@ -472,8 +492,11 @@ const bool URLImpl::toAbsolute(const std::string& baseUrl) {
return true;
std::string uriStr = _uri.as_string();
+// std::cout << "## bas # " << baseUrl << std::endl;
+// std::cout << "## rel # " << _uri.as_string() << std::endl;
+
#ifdef _WIN32
- if (baseUrl.find("file://") == 0) {
+ if (baseUrl.find("file://") == 0 && false) {
_uri = Arabica::io::URI("file:///" + baseUrl.substr(7), _uri.as_string());
} else {
_uri = Arabica::io::URI(baseUrl, _uri.as_string());
@@ -481,6 +504,7 @@ const bool URLImpl::toAbsolute(const std::string& baseUrl) {
#else
_uri = Arabica::io::URI(baseUrl, _uri.as_string());
#endif
+// std::cout << "## abs # " << _uri.as_string() << std::endl;
if (!_uri.is_absolute())
return false;
diff --git a/src/uscxml/URL.h b/src/uscxml/URL.h
index 00c2b30..09d5ed0 100644
--- a/src/uscxml/URL.h
+++ b/src/uscxml/URL.h
@@ -231,13 +231,15 @@ public:
return URL(impl);
}
+ void dump();
+
void addMonitor(URLMonitor* monitor) {
_impl->addMonitor(monitor);
}
void removeMonitor(URLMonitor* monitor) {
_impl->removeMonitor(monitor);
}
-
+
bool downloadFailed() {
return _impl->downloadFailed();
}