From 03ef761afd6a4c597c0e3fa1714cc947581e2a48 Mon Sep 17 00:00:00 2001 From: Stefan Radomski Date: Fri, 2 Dec 2016 15:18:33 +0100 Subject: Fixed Lua wchar problem for old swig intallations --- .../generated/org/uscxml/StateChartJava5Impl.java | 5 +- docs/BUILDING.md | 11 +++-- src/bindings/CMakeLists.txt | 10 ++-- src/bindings/swig/csharp/CMakeLists.txt | 3 +- src/bindings/swig/csharp/uscxml.i | 54 +++++++++++++--------- src/bindings/swig/lua/uscxml.i | 6 +++ test/CMakeLists.txt | 3 ++ 7 files changed, 57 insertions(+), 35 deletions(-) diff --git a/contrib/java/generated/org/uscxml/StateChartJava5Impl.java b/contrib/java/generated/org/uscxml/StateChartJava5Impl.java index 381a214..3bf1bb2 100644 --- a/contrib/java/generated/org/uscxml/StateChartJava5Impl.java +++ b/contrib/java/generated/org/uscxml/StateChartJava5Impl.java @@ -10,10 +10,11 @@ package org.uscxml; public class StateChartJava5Impl extends StateChart { + DataModel dataModel; + @Override public boolean isTrue(String expression) { - // TODO Auto-generated method stub - return false; + return dataModel.evalAsBool(expression); } @Override diff --git a/docs/BUILDING.md b/docs/BUILDING.md index d627208..cfe5bd6 100644 --- a/docs/BUILDING.md +++ b/docs/BUILDING.md @@ -5,7 +5,7 @@ [TOC] This page describes how to build uSCXML from source, starting with either a git -checkout or from a downloaded archive. The source code is built using CMake, +checkout or from a downloaded archive. The source code is built using CMake and the process of building uscxml is essentially the same on every platform. 1. Read the [Platform Notes](#platform-notes) below to prepare your system. @@ -40,7 +40,7 @@ directory anywhere else. This only applies to the Eclipse CDT project generator. generator as it croaks when calling SWIG, just have another build directory with the "NMake Makefiles" project generator. -Note: In order to compile with `MinGW` on windows you will ave to adapt the build scripts in `contrib/cmake/Build*`. If you succeed, a pull request would be most appreciated. +Note: In order to compile with `MinGW` on windows you will have to adapt the build scripts in `contrib/cmake/Build*`. If you succeed, a pull request would be most appreciated. \section deps Build Dependencies @@ -87,8 +87,7 @@ Overview of the uSCXML dependencies. See the [Platform Notes](#platform-notes) f >= 1.8 Used by make docs to generate this documentation from source comments. - - + Mac OSX XCode
required @@ -188,6 +187,10 @@ This would be all distributions based on Debian, like Ubuntu, Linux Mint and the # uscxml required dependencies (built if not installed) $ sudo apt-get install libxerces-c-dev libevent-dev libcurl4-openssl-dev + # optional dependencies for language bindings + $ sudo apt-get install ant swig liblua5.2-0-dev mono-devel + + There may still be packages missing due to the set of dependencies among packages in the various distributons. Try to run CMake and resolve dependencies until you are satisfied. diff --git a/src/bindings/CMakeLists.txt b/src/bindings/CMakeLists.txt index e75d8f2..123ec9c 100644 --- a/src/bindings/CMakeLists.txt +++ b/src/bindings/CMakeLists.txt @@ -18,7 +18,7 @@ if (WIN32) endif() LIST(APPEND CMAKE_PROGRAM_PATH $ENV{SWIG_DIR}) -find_package(SWIG) +# find_package(SWIG) if (SWIG_FOUND) if(SWIG_VERSION VERSION_GREATER 2.0.4) @@ -30,9 +30,9 @@ if (SWIG_FOUND) if (BUILD_BINDING_LUA) add_subdirectory(swig/lua) endif() - # if (BUILD_BINDING_CSHARP) - # add_subdirectory(swig/csharp) - # endif() + if (BUILD_BINDING_CSHARP) + add_subdirectory(swig/csharp) + endif() # if (BUILD_BINDING_PHP) # add_subdirectory(swig/php) # endif() @@ -44,6 +44,6 @@ if (SWIG_FOUND) 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") + message(STATUS "No swig binary found, skipping wrapper generation") endif() set(USCXML_LANGUAGE_BINDINGS ${USCXML_LANGUAGE_BINDINGS} PARENT_SCOPE) diff --git a/src/bindings/swig/csharp/CMakeLists.txt b/src/bindings/swig/csharp/CMakeLists.txt index 384507b..966f740 100644 --- a/src/bindings/swig/csharp/CMakeLists.txt +++ b/src/bindings/swig/csharp/CMakeLists.txt @@ -10,7 +10,6 @@ FIND_PROGRAM(DMCS_EXECUTABLE dmcs PATHS $ENV{DMCS_HOME} ENV PATH ) # Mono compil FIND_PROGRAM(CSC_EXECUTABLE csc PATHS $ENV{CSC_HOME} ENV PATH ) # CSharp compiler if (DMCS_EXECUTABLE OR CSC_EXECUTABLE) - # unset all library suffixes as swig will hardcode a library without SET(LIB_POSTFIX ${CMAKE_LIBRARY_POSTFIX}) @@ -85,4 +84,6 @@ if (DMCS_EXECUTABLE OR CSC_EXECUTABLE) set_target_properties(csharp PROPERTIES FOLDER "Bindings") set(USCXML_LANGUAGE_BINDINGS ${USCXML_LANGUAGE_BINDINGS} PARENT_SCOPE) +else() + message(STATUS "Could not find dmcs or csc binary, not building csharp bindings") endif() \ No newline at end of file diff --git a/src/bindings/swig/csharp/uscxml.i b/src/bindings/swig/csharp/uscxml.i index fbc5f20..e9f94f2 100644 --- a/src/bindings/swig/csharp/uscxml.i +++ b/src/bindings/swig/csharp/uscxml.i @@ -16,8 +16,6 @@ typedef uscxml::Blob Blob; typedef uscxml::Data Data; typedef uscxml::Event Event; -typedef uscxml::InvokeRequest InvokeRequest; -typedef uscxml::SendRequest SendRequest; typedef uscxml::Invoker Invoker; typedef uscxml::IOProcessor IOProcessor; typedef uscxml::DataModel DataModel; @@ -61,25 +59,33 @@ typedef uscxml::InterpreterIssue InterpreterIssue; %{ -#include "../../../uscxml/Message.h" -#include "../../../uscxml/Factory.h" +#include "uscxml/config.h" #include "../../../uscxml/Interpreter.h" -#include "../../../uscxml/concurrency/BlockingQueue.h" -#include "../../../uscxml/server/HTTPServer.h" -//#include "../../../uscxml/debug/DebuggerServlet.h" +#include "../../../uscxml/debug/InterpreterIssue.h" +#include "../../../uscxml/interpreter/InterpreterState.h" +#include "../../../uscxml/interpreter/InterpreterMonitor.h" + +#include "../../../uscxml/messages/Data.h" +#include "../../../uscxml/messages/Event.h" +#include "../../../uscxml/util/DOM.h" + +#include "../../../uscxml/plugins/Factory.h" +#include "../../../uscxml/plugins/DataModelImpl.h" #include "../wrapped/WrappedInvoker.h" #include "../wrapped/WrappedDataModel.h" +#include "../wrapped/WrappedActionLanguage.h" #include "../wrapped/WrappedExecutableContent.h" #include "../wrapped/WrappedIOProcessor.h" #include "../wrapped/WrappedInterpreterMonitor.h" using namespace uscxml; -using namespace Arabica::DOM; +using namespace XERCESC_NS; // the wrapped* C++ classes get rid of DOM nodes and provide more easily wrapped base classes #include "../wrapped/WrappedInvoker.cpp" #include "../wrapped/WrappedDataModel.cpp" +#include "../wrapped/WrappedActionLanguage.cpp" #include "../wrapped/WrappedExecutableContent.cpp" #include "../wrapped/WrappedIOProcessor.cpp" #include "../wrapped/WrappedInterpreterMonitor.cpp" @@ -160,8 +166,6 @@ WRAP_THROW_EXCEPTION(uscxml::Interpreter::interpret); WRAP_TO_STRING(uscxml::Event); WRAP_TO_STRING(uscxml::Data); -WRAP_TO_STRING(uscxml::SendRequest); -WRAP_TO_STRING(uscxml::InvokeRequest); WRAP_TO_STRING(uscxml::InterpreterIssue); %include "../uscxml_ignores.i" @@ -390,33 +394,38 @@ using System.Runtime.InteropServices; //*********************************************** %include "../../../uscxml/Common.h" -%include "../../../uscxml/Factory.h" -%include "../../../uscxml/Message.h" -%include "../../../uscxml/Interpreter.h" -%include "../../../uscxml/concurrency/BlockingQueue.h" -%include "../../../uscxml/server/HTTPServer.h" -//%include "../../../uscxml/debug/DebuggerServlet.h" -%include "../../../uscxml/debug/InterpreterIssue.h" - %include "../../../uscxml/messages/Blob.h" %include "../../../uscxml/messages/Data.h" %include "../../../uscxml/messages/Event.h" -%include "../../../uscxml/messages/InvokeRequest.h" -%include "../../../uscxml/messages/SendRequest.h" -%include "../../../uscxml/plugins/DataModel.h" +%include "../../../uscxml/plugins/Factory.h" +%include "../../../uscxml/interpreter/InterpreterState.h" +%include "../../../uscxml/interpreter/InterpreterMonitor.h" + +//%include "../../../uscxml/interpreter/MicroStep.h" +//%include "../../../uscxml/interpreter/ContentExecutor.h" + +%include "../../../uscxml/Interpreter.h" +%include "../../../uscxml/debug/InterpreterIssue.h" + %include "../../../uscxml/plugins/EventHandler.h" + +%include "../../../uscxml/plugins/DataModel.h" +%include "../../../uscxml/plugins/DataModelImpl.h" %include "../../../uscxml/plugins/ExecutableContent.h" +%include "../../../uscxml/plugins/ExecutableContentImpl.h" %include "../../../uscxml/plugins/Invoker.h" +%include "../../../uscxml/plugins/InvokerImpl.h" %include "../../../uscxml/plugins/IOProcessor.h" +%include "../../../uscxml/plugins/IOProcessorImpl.h" %include "../wrapped/WrappedInvoker.h" %include "../wrapped/WrappedDataModel.h" +%include "../wrapped/WrappedActionLanguage.h" %include "../wrapped/WrappedExecutableContent.h" %include "../wrapped/WrappedIOProcessor.h" %include "../wrapped/WrappedInterpreterMonitor.h" - %template(IssueList) std::list; %template(DataList) std::list; %template(DataMap) std::map; @@ -426,4 +435,3 @@ using System.Runtime.InteropServices; %template(ParamMap) std::map >; %template(IOProcMap) std::map; %template(InvokerMap) std::map; -%template(ParentQueue) uscxml::concurrency::BlockingQueue; diff --git a/src/bindings/swig/lua/uscxml.i b/src/bindings/swig/lua/uscxml.i index 9774cba..9c2f115 100644 --- a/src/bindings/swig/lua/uscxml.i +++ b/src/bindings/swig/lua/uscxml.i @@ -3,6 +3,12 @@ // provide a macro for the header files #define SWIGIMPORTED 1 +// fixing a bug for old swig versions with lua wchar: +// https://github.com/swig/swig/commit/c7ef5935496a04f3a83c70af6f841abf3ad7606e +%{ +#define wchar wchar_t +%} + %include %include %include diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 850aa21..bac3759 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -5,6 +5,9 @@ find_program(SPIN_BIN spin) find_program(CC_BIN gcc) find_program(CXX_BIN g++) find_program(ANT_BIN ant) +if (NOT ANT_BIN) + message(STATUS "No ant binary found, not generating Java tests / bindings") +endif() find_program(PERL_BIN perl) find_program(GHDL_BIN ghdl) -- cgit v0.12