summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-07-03 01:10:03 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-07-03 01:10:03 (GMT)
commitb542369263782dc8b85893e218119ed070efa7b3 (patch)
tree0a18012a0af991755ceab98a457b46b79c14129f
parent193a01614dc3290eec51745a91be65c166c3763b (diff)
downloaduscxml-b542369263782dc8b85893e218119ed070efa7b3.zip
uscxml-b542369263782dc8b85893e218119ed070efa7b3.tar.gz
uscxml-b542369263782dc8b85893e218119ed070efa7b3.tar.bz2
Got ready for cmake3 and some minor fixes
-rw-r--r--CMakeLists.txt14
-rw-r--r--README.md19
-rw-r--r--contrib/cmake/FindCURLPP.cmake20
-rw-r--r--docs/BUILDING.md136
-rw-r--r--docs/CentOS.txt (renamed from docs/CentOS.md)0
-rw-r--r--docs/Ubuntu-LTS.txt (renamed from docs/Ubuntu-LTS.md)0
-rw-r--r--embedding/csharp/uSCXMLEmbedding.suobin30208 -> 37376 bytes
-rw-r--r--embedding/csharp/uSCXMLEmbedding/Extensions/CustomDataModel.cs4
-rw-r--r--embedding/csharp/uSCXMLEmbedding/Extensions/CustomExecutableContent.cs4
-rw-r--r--embedding/csharp/uSCXMLEmbedding/Extensions/CustomIOProc.cs36
-rw-r--r--embedding/csharp/uSCXMLEmbedding/Extensions/CustomInvoker.cs20
-rw-r--r--embedding/csharp/uSCXMLEmbedding/RunTests.cs39
-rw-r--r--embedding/java/src/org/uscxml/datamodel/ecmascript/ECMAScriptDataModel.java21
-rw-r--r--embedding/java/src/org/uscxml/tests/execContent/TestCustomExecContent.java4
-rw-r--r--embedding/java/src/org/uscxml/tests/invoker/TestCustomInvoker.java5
-rw-r--r--embedding/java/src/org/uscxml/tests/ioprocessor/TestCustomIOProc.java3
-rw-r--r--src/bindings/CMakeLists.txt5
-rw-r--r--src/bindings/swig/csharp/CMakeLists.txt3
-rw-r--r--src/bindings/swig/csharp/uscxml.i57
-rw-r--r--src/bindings/swig/java/uscxml.i57
-rw-r--r--src/bindings/swig/uscxml_beautify.i52
-rw-r--r--src/bindings/swig/wrapped/WrappedIOProcessor.h2
-rw-r--r--src/uscxml/Factory.cpp2
-rw-r--r--src/uscxml/Interpreter.cpp25
-rw-r--r--src/uscxml/Interpreter.h2
-rw-r--r--src/uscxml/interpreter/InterpreterDraft6.cpp6
-rw-r--r--src/uscxml/messages/SendRequest.h2
-rw-r--r--src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp2
-rw-r--r--test/src/test-lifecycle.cpp114
-rw-r--r--test/w3c/confEcma.xsl17
-rw-r--r--test/w3c/confXPath.xsl17
-rw-r--r--test/w3c/ecma/test252.scxml4
-rw-r--r--test/w3c/ecma/test343.scxml2
-rw-r--r--test/w3c/ecma/test354.scxml4
-rw-r--r--test/w3c/ecma/test487.scxml3
-rw-r--r--test/w3c/ecma/test553.scxml4
-rw-r--r--test/w3c/ecma/test554.scxml4
-rw-r--r--test/w3c/txml/test252.txml4
-rw-r--r--test/w3c/txml/test343.txml2
-rw-r--r--test/w3c/txml/test354.txml4
-rw-r--r--test/w3c/txml/test487.txml3
-rw-r--r--test/w3c/txml/test553.txml4
-rw-r--r--test/w3c/txml/test554.txml4
-rw-r--r--test/w3c/xpath/test252.scxml4
-rw-r--r--test/w3c/xpath/test343.scxml2
-rw-r--r--test/w3c/xpath/test354.scxml4
-rw-r--r--test/w3c/xpath/test487.scxml3
-rw-r--r--test/w3c/xpath/test553.scxml4
-rw-r--r--test/w3c/xpath/test554.scxml4
49 files changed, 502 insertions, 249 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6a26928..2de5bee 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -149,8 +149,8 @@ if(CMAKE_CROSSCOMPILING)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM "BOTH")
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE "BOTH")
SET(USCXML_PREBUILT_LIBRARY_PATH "${PROJECT_SOURCE_DIR}/contrib/prebuilt/android/${ANDROID_ABI}")
- LIST(APPEND CMAKE_FIND_ROOT_PATH "/usr/local/bin") # this is needed to find swig
- LIST(APPEND CMAKE_FIND_ROOT_PATH "/opt/local/bin") # this is needed to find protoc
+ LIST(APPEND CMAKE_PREFIX_PATH "/usr/local/bin") # this is needed to find swig
+ LIST(APPEND CMAKE_PREFIX_PATH "/opt/local/bin") # this is needed to find protoc
endif ()
else ()
# SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM "BOTH")
@@ -265,19 +265,20 @@ endif()
if (CMAKE_CROSSCOMPILING)
# always prefer prebuilt libraries for cross-compiling
OPTION(BUILD_PREFER_PREBUILT_LIBS "Search libraries in contrib/prebuilt first" ON)
- SET(CMAKE_FIND_ROOT_PATH "${USCXML_PREBUILT_LIBRARY_PATH};${USCXML_PREBUILT_HEADER_PATH};${CMAKE_FIND_ROOT_PATH}")
+ SET(CMAKE_PREFIX_PATH "${USCXML_PREBUILT_LIBRARY_PATH};${USCXML_PREBUILT_HEADER_PATH};${CMAKE_PREFIX_PATH}")
else()
OPTION(BUILD_PREFER_PREBUILT_LIBS "Search libraries in contrib/prebuilt first" ON)
if (BUILD_PREFER_PREBUILT_LIBS)
# for everything, we start our search in contrib/prebuilt
- SET(CMAKE_FIND_ROOT_PATH "${USCXML_PREBUILT_LIBRARY_PATH};${USCXML_PREBUILT_HEADER_PATH};${CMAKE_FIND_ROOT_PATH}")
+ SET(CMAKE_PREFIX_PATH "${USCXML_PREBUILT_LIBRARY_PATH};${USCXML_PREBUILT_HEADER_PATH};${CMAKE_PREFIX_PATH}")
else()
# using this trick, we search paths from find_* before CMAKE_FIND_ROOT_PATH as '/' is prepended first
- SET(CMAKE_FIND_ROOT_PATH "/;${CMAKE_FIND_ROOT_PATH};${USCXML_PREBUILT_LIBRARY_PATH};${USCXML_PREBUILT_HEADER_PATH}")
+ SET(CMAKE_PREFIX_PATH "/;${CMAKE_PREFIX_PATH};${USCXML_PREBUILT_LIBRARY_PATH};${USCXML_PREBUILT_HEADER_PATH}")
endif()
endif()
include_directories(${USCXML_PREBUILT_LIBRARY_PATH}/include)
+#set(CMAKE_PREFIX_PATH ${CMAKE_FIND_ROOT_PATH})
#message(STATUS "Searching for prebuilt libraries in: ${CMAKE_FIND_ROOT_PATH}")
if (WIN32)
@@ -351,6 +352,7 @@ if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
add_definitions(-Wall)
# add_definitions(-Wno-parentheses-equality)
add_definitions(-Wno-attributes)
+ add_definitions(-Wno-unused-variable)
# we cannot tread warning as error with the "narrowing problem"
# add_definitions(-Werror)
@@ -358,8 +360,6 @@ if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
if(GCC_VERSION VERSION_EQUAL 4.7 OR GCC_VERSION VERSION_GREATER 4.7)
# when compiling as C++11, narrowing is a warning but older compilers complain about the option
add_definitions(-Wno-narrowing)
- # recent gcc started to complain about unused globals
- add_definitions(-Wno-unused-variable)
endif()
if(GCC_VERSION VERSION_EQUAL 4.8 OR GCC_VERSION VERSION_GREATER 4.8)
diff --git a/README.md b/README.md
index 1e18c5f..f0a9ea2 100644
--- a/README.md
+++ b/README.md
@@ -47,6 +47,18 @@ uSCXML still fails the following ecmascript tests:
<table>
<tr><th>Test#</th><th>Status</th><th>Description</th><th>Comment</th></tr>
<tr>
+ <td><tt><a href="https://github.com/tklab-tud/uscxml/blob/master/test/w3c/ecma/test553.scxml">553</a></tt></td>
+ <td><tt>Failed</tt></td>
+ <td>"test that the processor does not dispatch the event if evaluation of &lt;send>'s args causes an error."</td>
+ <td>We cannot correctly identify <emph>location expressions</emph> (valid LHS) for ecmascript. Send is performed anyway.</td>
+ </tr>
+ <tr>
+ <td><tt><a href="https://github.com/tklab-tud/uscxml/blob/master/test/w3c/ecma/test554.scxml">554</a></tt></td>
+ <td><tt>Failed</tt></td>
+ <td>"test that if the evaluation of &lt;invoke>'s args causes an error, the invocation is cancelled."</td>
+ <td>We cannot correctly identify <emph>location expressions</emph> (valid LHS) for ecmascript. Invoke is performed anyway.</td>
+ </tr>
+ <tr>
<td><tt><a href="https://github.com/tklab-tud/uscxml/blob/master/test/w3c/ecma/test579.scxml">579</a></tt></td>
<td><tt>Failed</tt></td>
<td>"Before the parent state has been visited for the first time, if a transition is executed that takes the history state as its target, the SCXML processor MUST execute any executable content in the transition after the parent state's onentry content and any content in a possible initial transition."</td>
@@ -128,7 +140,12 @@ internal phase is reached.
## Embedding uSCXML
-There are bindings for Java and C# with some examples in the <tt>embedding</tt> directory.
+There are bindings for Java and C# with some examples in the <tt>embedding</tt> directory. The bindings consist of
+two parts each (i) the C++ uscxml interpreter compiled as a loadable module for the target language and (ii) a target
+language specific module (uscxml.jar / uscxmlCSharp.dll) with the wrapper classes. The first one is loaded by the
+target language (System.loadLibrary / SetDLLDirectory) while the second is to be included in your actual project.
+Have a look at the examples in <tt>embedding</tt> and adapt the paths to reflect your setup. See the [build
+instructions](https://github.com/tklab-tud/uscxml/blob/master/docs/BUILDING.md) for details on how to build these.
## Extending uSCXML
diff --git a/contrib/cmake/FindCURLPP.cmake b/contrib/cmake/FindCURLPP.cmake
deleted file mode 100644
index 853265d..0000000
--- a/contrib/cmake/FindCURLPP.cmake
+++ /dev/null
@@ -1,20 +0,0 @@
-FIND_PATH(CURLPP_INCLUDE_DIR curlpp/cURLpp.hpp
- PATH_SUFFIXES include
- PATHS
- /usr/local
- /usr
- /sw # Fink
- /opt/local # DarwinPorts
- /opt/csw # Blastwave
- /opt
- HINTS $ENV{CURLPP_SRC}
-)
-
-FIND_LIBRARY(CURLPP_LIBRARY
- NAMES curlpp
- HINTS $ENV{CURLPP_SRC}/.libs/
-)
-
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(CURLPP DEFAULT_MSG CURLPP_LIBRARY CURLPP_INCLUDE_DIR)
-MARK_AS_ADVANCED(CURLPP_LIBRARY CURLPP_INCLUDE_DIR)
diff --git a/docs/BUILDING.md b/docs/BUILDING.md
index 01a52d7..fb87943 100644
--- a/docs/BUILDING.md
+++ b/docs/BUILDING.md
@@ -12,19 +12,27 @@ essentially the same on every platform:
in <tt>&lt;USCXML_SRC&gt;/build/</tt>.
4. Run cmake (or ccmake / CMake-GUI) to create the files required by your actual build-system.
5. Use your actual build-system or development environment to build uscxml.
-6. Read the SCXML draft and have a look at the tests to get started.
+6. Optionally build the [language bindings](#language-bindings) to embed the SCXML interpreter in another language.
+7. Read the SCXML draft and have a look at the tests to get started.
If you want to build for another IDE or build-system, just create a new
-*out-of-source* build directory and start over with cmake. To get an idea of
+*out-of-source* build directory and start over with CMake. To get an idea of
supported IDEs and build-environments on your platform, type <tt>cmake --help</tt>
or run the CMake-GUI and look for the *Generators* section at the end of the
output. Default on Unices is Makefiles.
+<b>Note:</b> If you plan to use Eclipse CDT, you cannot have a build directory anywhere under
+the source directory - just create the build directory anywhere else. This only applies to the Eclipse CDT
+project generator.
+
+<b>Note:</b> You cannot build the language bindings with the Visual Studio project as it croaks when calling SWIG,
+just have another build directory with the "NMake Makefiles" project generator.
+
# Build Dependencies
Overview of the uscxml dependencies. See the [Platform Notes](#platform-notes) for details.
-<b>Note:</b> We download pre-compiled versions of most dependencies at cmake configure-time. If you want
+<b>Note:</b> We download pre-compiled versions of most dependencies at CMake configure-time. If you want
to provide you own libraries, remove them from <tt>&lt;USCXML_SRC&gt;/contrib/prebuilt/</tt> and provide
your own.
@@ -36,11 +44,15 @@ your own.
<td>>=&nbsp;2.8.6</td>
<td>The build-system used for uscxml.</td></tr>
<tr>
+ <td><a href="http://www.swig.org">SWIG</a><br />optional</td>
+ <td>>=&nbsp;2.0.6</td>
+ <td>Generates language bindings to embed uSCXML in other target languages.</td></tr>
+ <tr>
<td><a href="http://libevent.org">libevent</a><br />pre-compiled</td>
<td>>=&nbsp;2.1.x</td>
<td>Event queues with callbacks and the HTTP server.</td></tr>
<tr>
- <td><a href="http://curl.haxx.se">curl</a><br />required</td>
+ <td><a href="http://curl.haxx.se">curl</a><br />pre-compiled / required</td>
<td>>=&nbsp;7.29.0</td>
<td>URL downloads.</td></tr>
<tr>
@@ -110,7 +122,7 @@ This section will detail the preparation of the respective platforms to ultimate
## Mac OSX
-You will have to install <tt>cmake</tt> via Macports:
+You will have to install <tt>CMake</tt> via Macports:
sudo port install cmake
@@ -126,9 +138,9 @@ Just download the source and invoke CMake to create Makefiles or a Xcode project
-- Build files have been written to: .../build/cli
$ make
-You can test whether everything works by starting the mmi-browser with a test.scxml file:
+You can test whether everything works by starting the uscxml-browser with a test.scxml file:
- $ ./bin/mmi-browser ../../test/samples/uscxml/test-ecmascript.scxml
+ $ ./bin/uscxml-browser ../../test/uscxml/test-ecmascript.scxml
### Xcode
@@ -157,7 +169,7 @@ This would be all distributions based on Debian, like Ubuntu, Linux Mint and the
$ sudo apt-get install libxml2-dev libcurl4-openssl-dev
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
+in the various distributons. Try to run CMake and resolve dependencies until you
are satisfied.
### Preparing *yum based* distributions
@@ -214,34 +226,28 @@ Instructions are a literal copy of building uscxml for MacOSX on the console fro
-- Build files have been written to: .../build/cli
$ make
-You can test whether everything works by starting the mmi-browser with a test.scxml file:
+You can test whether everything works by starting the uscxml-browser with a test.scxml file:
- $ ./bin/mmi-browser ../../test/samples/uscxml/test-ecmascript.scxml
+ $ ./bin/uscxml-browser ../../test/uscxml/test-ecmascript.scxml
### Eclipse CDT
<b>Note:</b> Eclipse does not like the project to be a subdirectory in the source.
You have to choose your build directory with the generated project accordingly.
- $ mkdir -p build/uscxml/eclipse && cd build/uscxml/eclipse
+ $ mkdir -p ~/Desktop/build/uscxml/eclipse && cd ~/Desktop/build/uscxml/eclipse
$ cmake -G "Eclipse CDT4 - Unix Makefiles" <USCXML_SRCDIR>
[...]
-- Build files have been written to: .../build/uscxml/eclipse
Now open Eclipse CDT and import the out-of-source directory as an existing project into workspace, leaving the "Copy projects
into workspace" checkbox unchecked. There are some more [detailed instruction](http://www.cmake.org/Wiki/Eclipse_CDT4_Generator) available
-in the cmake wiki as well.
-
-### Compiling Dependencies
-
-If the packages in your distribution are too old, you will have to compile current
-binaries. This applies especially for SWI and CMake as they *need* to be rather
-current. Have a look at the build dependencies above for minimum versions.
+in the CMake wiki as well.
## Windows
-Building from source on windows is somewhat more involved and instructions are necessarily in prose form. These instructions were
-created using Windows 7 and MS Visual Studio 2010.
+Building from source on windows is somewhat more involved and instructions are necessarily in prose form. These
+instructions were created using Windows 7 and MS Visual Studio 2010.
### Prepare compilation
@@ -262,3 +268,93 @@ Just open it up to continue in your IDE.
<b>Note:</b> We only tested with the MSVC compiler. You can try to compile
with MinGW but you would have to build all the dependent libraries as well.
+<b>Note:</b> We do no provide prebuilt dependencies for MSVC18.x (Visual Studio 2012 / 2013).
+You can still use the bindings for C#, but not the native C++ libraries.
+
+## Language Bindings
+
+In order to build any language bindings, you will need to have SWIG and the development kit of your target language
+installed. The set of available language bindings is printed at the end of the CMake invocation:
+
+ $ cmake <USCXML_SRC>
+ ...
+ -- Available custom elements ...... : respond file postpone fetch
+ -- Available language bindings .... : csharp java
+ -- General information:
+ ...
+
+### Java
+
+We are relying on CMake's [FindJNI.CMake](http://www.cmake.org/cmake/help/v2.8.12/cmake.html#module:FindJNI) module
+to find the JNI headers and respective libraries. On unices, it's easiest to check whether <tt>jni.h</tt> is available
+in <tt>JAVA_HOME</tt>:
+
+ $ find $JAVA_HOME -name jni.h
+ /usr/lib/jvm/java-7-openjdk-i386/include/jni.h
+
+In addition, you will need apache's <tt>ant</tt> in the path or in <tt>$ENV{ANT_HOME}/bin</tt>:
+
+ $ ant -version
+ Apache Ant(TM) version 1.8.2 compiled on September 22 2011
+
+If both of these are given, you ought to get <tt>java</tt> as an available language binding and a new target called
+<tt>java</tt> for your build system. If you used plain Makefiles (default on unices), you will get everything you need via:
+
+ $ make && make java
+ $ ls lib/*.jnilib lib/*.jar
+ lib/libuscxmlNativeJava64.jnilib lib/uscxml.jar
+
+The <tt>uscxml.jar</tt> is to be added to your project's classpath, while the <tt>libuscxmlNativeJava64.jnilib</tt>
+(or .so, .dll) needs to be loaded <b>once</b> via <tt>System.load()</tt> before you can use native objects.
+
+### CSharp
+
+For the CSharp bindings, we need to find either <tt>csc.exe</tt> from the Microsoft.NET framework or <tt>dmcs</tt>
+from the mono project. We search the following places for these:
+
+ $ENV{CSC_HOME}; $ENV{DMCS_HOME}
+ "C:/Windows/Microsoft.NET/Framework/v3.5"
+ "C:/Windows/Microsoft.NET/Framework/v4.0.30319"
+
+If we find one of those binaries (and SWIG obviously), we will enable the language bindings.
+
+ $ which dmcs
+ /opt/local/bin/dmcs
+
+Again, if you used plain Makefiles, you will get everything you need via:
+
+ $ make && make csharp
+ $ $ find lib -type f -iname *csharp*
+ lib/csharp/libuscxmlNativeCSharp.so
+ lib/uscxmlCSharp.dll
+
+The <tt>libuscxmlNativeCSharp.so</tt> has to be available to your C# runtime, either by installing it in
+<tt>/usr/local/lib</tt> or (preferred) by using <tt>LD_PRELOAD</tt> or <tt>SetDllDirectory</tt>. See the
+embedding examples. The <tt>uscxmlCSharp.dll</tt> contains the managed code portion and needs to be added
+to your C# project as a reference.
+
+<b>Note:</b> You cannot use uSCXML with Xamarin Studio / Mono on Mac out of the box, as they <emph>still</emph>
+have no 64Bit support. The last Macintosh without 64Bit support was the (late 2006) Mac Mini with an Intel Core Duo.
+
+### Important Note for Windows
+
+You cannot use CMake projects generated for Visual Studio to build the target language specific part of the
+various bindings - you have to use <tt>nmake</tt> at a command prompt. Open a <tt>Visual Studio [x64 Win64]
+Command Prompt (2010)</tt> and type:
+
+ > cd c:\path\to\build\dir
+ > cmake -G"NMake Makefiles" c:\path\to\uscxml\source
+ ...
+ > nmake && nmake csharp && nmake java
+ ...
+
+## About 32/64Bit Support
+
+We do support both, 32 and 64Bit for Linux and Windows. On Macintosh, most prebuilt dependencies are compiled as
+universal binaries with 32/64Bit but we build 64Bit binaries exclusively. The reason is that e.g. <tt>curl</tt>
+cannot be compiled as a universal binary as its header files make assumptions about the bit-depth of an int.
+Furthermore, most libraries used by invokers and provided by brew or Macports will be 64Bit only and fail to link.
+
+If you feel adventurous, you can uncomment <tt>set(CMAKE_OSX_ARCHITECTURES "i386;x86_64")</tt> in the topmost
+<tt>CMakeLists.txt</tt> and fight your way through the linker errors.
+ \ No newline at end of file
diff --git a/docs/CentOS.md b/docs/CentOS.txt
index 8a3424e..8a3424e 100644
--- a/docs/CentOS.md
+++ b/docs/CentOS.txt
diff --git a/docs/Ubuntu-LTS.md b/docs/Ubuntu-LTS.txt
index df687ab..df687ab 100644
--- a/docs/Ubuntu-LTS.md
+++ b/docs/Ubuntu-LTS.txt
diff --git a/embedding/csharp/uSCXMLEmbedding.suo b/embedding/csharp/uSCXMLEmbedding.suo
index 9bacedf..823eecc 100644
--- a/embedding/csharp/uSCXMLEmbedding.suo
+++ b/embedding/csharp/uSCXMLEmbedding.suo
Binary files differ
diff --git a/embedding/csharp/uSCXMLEmbedding/Extensions/CustomDataModel.cs b/embedding/csharp/uSCXMLEmbedding/Extensions/CustomDataModel.cs
index b2ee1de..65e517a 100644
--- a/embedding/csharp/uSCXMLEmbedding/Extensions/CustomDataModel.cs
+++ b/embedding/csharp/uSCXMLEmbedding/Extensions/CustomDataModel.cs
@@ -10,7 +10,9 @@ namespace embedding
{
public override DataModel create(Interpreter interpreter)
{
- return new CustomDataModel();
+ CustomDataModel dm = new CustomDataModel();
+ dm.swigCMemOwn = false;
+ return dm;
}
public override void eval(string scriptElem, string expr)
diff --git a/embedding/csharp/uSCXMLEmbedding/Extensions/CustomExecutableContent.cs b/embedding/csharp/uSCXMLEmbedding/Extensions/CustomExecutableContent.cs
index 94cf111..ac79065 100644
--- a/embedding/csharp/uSCXMLEmbedding/Extensions/CustomExecutableContent.cs
+++ b/embedding/csharp/uSCXMLEmbedding/Extensions/CustomExecutableContent.cs
@@ -25,7 +25,9 @@ namespace embedding
public override ExecutableContent create(Interpreter interpreter)
{
- return new CustomExecutableContent();
+ CustomExecutableContent execContent = new CustomExecutableContent();
+ execContent.swigCMemOwn = false;
+ return execContent;
}
diff --git a/embedding/csharp/uSCXMLEmbedding/Extensions/CustomIOProc.cs b/embedding/csharp/uSCXMLEmbedding/Extensions/CustomIOProc.cs
index 0480a34..866c148 100644
--- a/embedding/csharp/uSCXMLEmbedding/Extensions/CustomIOProc.cs
+++ b/embedding/csharp/uSCXMLEmbedding/Extensions/CustomIOProc.cs
@@ -3,6 +3,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using org.uscxml;
+using System.Xml;
+using System.Xml.XPath;
+using System.IO;
namespace embedding
{
@@ -10,7 +13,9 @@ namespace embedding
{
public override IOProcessor create(Interpreter interpreter)
{
- return new CustomIOProc();
+ CustomIOProc ioProc = new CustomIOProc();
+ ioProc.swigCMemOwn = false;
+ return ioProc;
}
public override Data getDataModelVariables()
@@ -22,12 +27,39 @@ namespace embedding
public override StringList getNames()
{
StringList names = new StringList();
- names.add("simple");
+ names.add("custom");
return names;
}
public override void send(SendRequest req)
{
+ Console.WriteLine(req);
+ // send in s1.onentry
+ if ("This is some content!" == req.getContent())
+ {
+ returnEvent(new Event("received1"));
+ return;
+ }
+ // send in s2.onentry
+ if (req.getParams().ContainsKey("foo")
+ && "bar" == (req.getParams()["foo"][0].getAtom()))
+ {
+ returnEvent(new Event("received2"));
+ return;
+ }
+ // send in s3
+ if (req.getXML().Length > 0)
+ {
+ XmlReaderSettings set = new XmlReaderSettings();
+ set.ConformanceLevel = ConformanceLevel.Fragment;
+ XPathDocument doc = new XPathDocument(XmlReader.Create(new StringReader(req.getXML()), set));
+ XPathNavigator nav = doc.CreateNavigator();
+
+ Console.WriteLine("Root element :" + nav.SelectSingleNode("/").Value);
+ returnEvent(new Event("received3"));
+ return;
+ }
+
}
}
}
diff --git a/embedding/csharp/uSCXMLEmbedding/Extensions/CustomInvoker.cs b/embedding/csharp/uSCXMLEmbedding/Extensions/CustomInvoker.cs
index da941b0..7c174ed 100644
--- a/embedding/csharp/uSCXMLEmbedding/Extensions/CustomInvoker.cs
+++ b/embedding/csharp/uSCXMLEmbedding/Extensions/CustomInvoker.cs
@@ -13,7 +13,9 @@ namespace embedding
{
public override Invoker create(Interpreter interpreter)
{
- return new CustomInvoker();
+ CustomInvoker invoker = new CustomInvoker();
+ invoker.swigCMemOwn = false;
+ return invoker;
}
public override Data getDataModelVariables()
@@ -31,20 +33,20 @@ namespace embedding
public override void invoke(InvokeRequest req)
{
- }
-
- public override void send(SendRequest req)
- {
Console.WriteLine(req);
// send in s1.onentry
- if ("This is some content!" == req.getContent())
+ if ("Some string content" == req.getContent())
{
- returnEvent(new Event("received1"));
+ returnEvent(new Event("received1"), true);
return;
}
+ }
+
+ public override void send(SendRequest req)
+ {
+ Console.WriteLine(req);
// send in s2.onentry
- if (req.getParams().ContainsKey("foo")
- && "bar" == (req.getParams()["foo"][0].getAtom()))
+ if (req.getName() == "foo")
{
returnEvent(new Event("received2"));
return;
diff --git a/embedding/csharp/uSCXMLEmbedding/RunTests.cs b/embedding/csharp/uSCXMLEmbedding/RunTests.cs
index d98bca1..38e3736 100644
--- a/embedding/csharp/uSCXMLEmbedding/RunTests.cs
+++ b/embedding/csharp/uSCXMLEmbedding/RunTests.cs
@@ -29,14 +29,19 @@ namespace embedding
SetDllDirectory("C:\\Users\\sradomski\\Desktop\\build\\uscxml\\lib\\csharp");
}
- testLifeCycle();
- testExecutableContent();
- testIOProcessor();
- testInvoker();
+ int i = 1;
+ while (i-- > 0)
+ {
+ testLifeCycle();
+ testExecutableContent();
+ testIOProcessor();
+ testInvoker();
+ }
Console.ReadKey();
}
public static void testInvoker() {
+ Console.WriteLine("testInvoker");
CustomInvoker invoker = new CustomInvoker();
// just register prototype at global factory
Factory.getInstance().registerInvoker(invoker);
@@ -47,13 +52,15 @@ namespace embedding
" <invoke type=\"custom\" id=\"custominvoker1\">" +
" <content>Some string content</content>" +
" </invoke>" +
- " <invoke type=\"java\" id=\"custominvoker2\" />" +
+ " <invoke type=\"custom\" id=\"custominvoker2\" />" +
" <state id=\"s11\">" +
- " <transition event=\"received1\" target=\"s12\" />" +
+ " <transition event=\"received1\" target=\"s12\">" +
+ " </transition>" +
" </state>" +
" <state id=\"s12\">" +
" <onentry>" +
" <send target=\"#_custominvoker2\" event=\"foo\" />" +
+ " <log label=\"label\" expr=\"foo\" />" +
" </onentry>" +
" <transition event=\"received2\" target=\"done\" />" +
" </state>" +
@@ -69,6 +76,7 @@ namespace embedding
public static void testIOProcessor()
{
+ Console.WriteLine("testIOProcessor");
CustomIOProc ioproc = new CustomIOProc();
// just register prototype at global factory
Factory.getInstance().registerIOProcessor(ioproc);
@@ -77,7 +85,7 @@ namespace embedding
"<scxml>" +
" <state id=\"s1\">" +
" <onentry>" +
- " <send type=\"java\">" +
+ " <send type=\"custom\">" +
" <content>This is some content!</content>" +
" </send>" +
" </onentry>" +
@@ -85,7 +93,7 @@ namespace embedding
" </state>" +
" <state id=\"s2\">" +
" <onentry>" +
- " <send type=\"java\">" +
+ " <send type=\"custom\">" +
" <param name=\"foo\" expr=\"bar\" />" +
" </send>" +
" </onentry>" +
@@ -93,7 +101,7 @@ namespace embedding
" </state>" +
" <state id=\"s3\">" +
" <onentry>" +
- " <send type=\"java\">" +
+ " <send type=\"custom\">" +
" <content>" +
" <this><is><xml/></is></this>" +
" </content>" +
@@ -112,6 +120,7 @@ namespace embedding
public static void testExecutableContent()
{
+ Console.WriteLine("testExecutableContent");
CustomExecutableContent execContent = new CustomExecutableContent();
Factory.getInstance().registerExecutableContent(execContent);
@@ -119,12 +128,12 @@ namespace embedding
"<scxml>\n" +
" <state id=\"s0\">\n" +
" <onentry>\n" +
- " <custom foo=\"bar\">\n" +
+ " <!-- custom foo=\"bar\">\n" +
" <something></something>\n" +
" </custom>\n" +
" <custom foo=\"bar\">\n" +
" <something></something>\n" +
- " </custom>\n" +
+ " </custom -->\n" +
" </onentry>\n" +
" <transition target=\"exit\" />" +
" </state>\n" +
@@ -132,10 +141,12 @@ namespace embedding
"</scxml>\n"
);
interpreter.interpret();
+ interpreter.Dispose();
}
public static void testLifeCycle()
{
+ Console.WriteLine("testLifeCycle");
// syntactic xml parse error -> throws
try
{
@@ -145,7 +156,7 @@ namespace embedding
}
catch (InterpreterException e)
{
- Console.WriteLine(e);
+// Console.WriteLine(e);
}
// semantic xml parse error -> throws
@@ -159,7 +170,7 @@ namespace embedding
}
catch (InterpreterException e)
{
- Console.WriteLine(e);
+// Console.WriteLine(e);
}
// request unknown datamodel
@@ -179,7 +190,7 @@ namespace embedding
}
catch (InterpreterException e)
{
- Console.WriteLine(e);
+// Console.WriteLine(e);
}
diff --git a/embedding/java/src/org/uscxml/datamodel/ecmascript/ECMAScriptDataModel.java b/embedding/java/src/org/uscxml/datamodel/ecmascript/ECMAScriptDataModel.java
index 0b2b576..679581d 100644
--- a/embedding/java/src/org/uscxml/datamodel/ecmascript/ECMAScriptDataModel.java
+++ b/embedding/java/src/org/uscxml/datamodel/ecmascript/ECMAScriptDataModel.java
@@ -1,6 +1,7 @@
package org.uscxml.datamodel.ecmascript;
import java.lang.reflect.Method;
+import java.util.Map;
import org.mozilla.javascript.Callable;
import org.mozilla.javascript.Context;
@@ -14,8 +15,9 @@ import org.uscxml.Data;
import org.uscxml.DataModel;
import org.uscxml.Event;
import org.uscxml.Interpreter;
+import org.uscxml.NativeIOProcessor;
+import org.uscxml.NativeInvoker;
import org.uscxml.StringList;
-import org.uscxml.StringVector;
public class ECMAScriptDataModel extends DataModel {
@@ -84,6 +86,7 @@ public class ECMAScriptDataModel extends DataModel {
*/
ECMAScriptDataModel newDM = new ECMAScriptDataModel();
+ newDM.swigReleaseOwnership();
newDM.interpreter = interpreter;
newDM.ctx = Context.enter();
@@ -99,11 +102,9 @@ public class ECMAScriptDataModel extends DataModel {
// ioProcessors
{
Data ioProcs = new Data();
- StringVector keys = interpreter.getIOProcessorKeys();
- for (int i = 0; i < keys.size(); i++) {
- ioProcs.put(keys.get(i), interpreter
- .getIOProcessors().get(keys.get(i))
- .getDataModelVariables());
+ Map<String, NativeIOProcessor> ioProcNatives = interpreter.getIOProcessors();
+ for (String key : ioProcNatives.keySet()) {
+ ioProcs.put(key, ioProcNatives.get(key).getDataModelVariables());
}
newDM.scope
.put("_ioprocessors", newDM.scope, new ECMAData(ioProcs));
@@ -112,11 +113,9 @@ public class ECMAScriptDataModel extends DataModel {
// invokers
{
Data invokers = new Data();
- StringVector keys = interpreter.getInvokerKeys();
- for (int i = 0; i < keys.size(); i++) {
- invokers.put(keys.get(i), interpreter
- .getInvokers().get(keys.get(i))
- .getDataModelVariables());
+ Map<String, NativeInvoker> invokersNatives = interpreter.getInvokers();
+ for (String key : invokersNatives.keySet()) {
+ invokers.put(key, invokersNatives.get(key).getDataModelVariables());
}
newDM.scope
.put("_ioprocessors", newDM.scope, new ECMAData(invokers));
diff --git a/embedding/java/src/org/uscxml/tests/execContent/TestCustomExecContent.java b/embedding/java/src/org/uscxml/tests/execContent/TestCustomExecContent.java
index 7a97ab4..805e6f7 100644
--- a/embedding/java/src/org/uscxml/tests/execContent/TestCustomExecContent.java
+++ b/embedding/java/src/org/uscxml/tests/execContent/TestCustomExecContent.java
@@ -42,7 +42,9 @@ public class TestCustomExecContent extends ExecutableContent {
@Override
public ExecutableContent create(Interpreter interpreter) {
- return new TestCustomExecContent();
+ TestCustomExecContent execContent = new TestCustomExecContent();
+ execContent.swigReleaseOwnership();
+ return execContent;
}
/**
diff --git a/embedding/java/src/org/uscxml/tests/invoker/TestCustomInvoker.java b/embedding/java/src/org/uscxml/tests/invoker/TestCustomInvoker.java
index 25420ed..ecbff9b 100644
--- a/embedding/java/src/org/uscxml/tests/invoker/TestCustomInvoker.java
+++ b/embedding/java/src/org/uscxml/tests/invoker/TestCustomInvoker.java
@@ -47,7 +47,9 @@ public class TestCustomInvoker extends Invoker {
@Override
public Invoker create(Interpreter interpreter) {
- return new TestCustomInvoker();
+ TestCustomInvoker invoker = new TestCustomInvoker();
+ invoker.swigReleaseOwnership();
+ return invoker;
}
/**
@@ -73,6 +75,7 @@ public class TestCustomInvoker extends Invoker {
" </state>" +
" <state id=\"s12\">" +
" <onentry>" +
+ " <log label=\"label\" expr=\"foo\" />" +
" <send target=\"#_javainvoker2\" event=\"foo\" />" +
" </onentry>" +
" <transition event=\"received2\" target=\"done\" />" +
diff --git a/embedding/java/src/org/uscxml/tests/ioprocessor/TestCustomIOProc.java b/embedding/java/src/org/uscxml/tests/ioprocessor/TestCustomIOProc.java
index 277c505..8a72abe 100644
--- a/embedding/java/src/org/uscxml/tests/ioprocessor/TestCustomIOProc.java
+++ b/embedding/java/src/org/uscxml/tests/ioprocessor/TestCustomIOProc.java
@@ -89,6 +89,7 @@ public class TestCustomIOProc extends IOProcessor {
public IOProcessor create(Interpreter interpreter) {
TestCustomIOProc ioProc = new TestCustomIOProc();
ioProc.interpreter = interpreter;
+ ioProc.swigReleaseOwnership();
return ioProc;
}
@@ -102,7 +103,7 @@ public class TestCustomIOProc extends IOProcessor {
TestCustomIOProc ioproc = new TestCustomIOProc();
// just register prototype at global factory
Factory.getInstance().registerIOProcessor(ioproc);
-
+
String xml =
"<scxml>" +
" <state id=\"s1\">" +
diff --git a/src/bindings/CMakeLists.txt b/src/bindings/CMakeLists.txt
index ca5b774..25c11a1 100644
--- a/src/bindings/CMakeLists.txt
+++ b/src/bindings/CMakeLists.txt
@@ -12,6 +12,8 @@ if (WIN32)
endif()
LIST(APPEND CMAKE_PROGRAM_PATH "C:/Program Files/swig") # swig.exe
+ LIST(APPEND CMAKE_PROGRAM_PATH "C:/Program Files (x86)/swig") # swig.exe
+
endif()
LIST(APPEND CMAKE_PROGRAM_PATH $ENV{SWIG_DIR})
@@ -23,6 +25,9 @@ if (SWIG_FOUND)
INCLUDE(${SWIG_USE_FILE})
add_subdirectory(swig/java)
add_subdirectory(swig/csharp)
+ if(SWIG_VERSION VERSION_LESS 3.0.0)
+ 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")
endif()
diff --git a/src/bindings/swig/csharp/CMakeLists.txt b/src/bindings/swig/csharp/CMakeLists.txt
index 80d093e..ee37bf7 100644
--- a/src/bindings/swig/csharp/CMakeLists.txt
+++ b/src/bindings/swig/csharp/CMakeLists.txt
@@ -2,9 +2,8 @@
# Make from within Eclipse fails miserably with the whole thing
if (WIN32)
- LIST(APPEND CMAKE_PROGRAM_PATH "C:/Program Files (x86)/swig") # swig.exe
- #LIST(APPEND CMAKE_PROGRAM_PATH "C:/Windows/Microsoft.NET/Framework/v4.0.30319") # CSharp compiler
LIST(APPEND CMAKE_PROGRAM_PATH "C:/Windows/Microsoft.NET/Framework/v3.5") # CSharp compiler
+ LIST(APPEND CMAKE_PROGRAM_PATH "C:/Windows/Microsoft.NET/Framework/v4.0.30319") # CSharp compiler
endif()
FIND_PROGRAM(DMCS_EXECUTABLE dmcs PATHS $ENV{DMCS_HOME} ENV PATH ) # Mono compiler
diff --git a/src/bindings/swig/csharp/uscxml.i b/src/bindings/swig/csharp/uscxml.i
index 8e9a297..2a1ac07 100644
--- a/src/bindings/swig/csharp/uscxml.i
+++ b/src/bindings/swig/csharp/uscxml.i
@@ -36,6 +36,8 @@ typedef uscxml::ExecutableContentImpl ExecutableContentImpl;
#pragma SWIG nowarn=401
// do not warn when we override symbols via extend
#pragma SWIG nowarn=302
+// do not warn when ignoring overrided method
+#pragma SWIG nowarn=516
%csconst(1);
@@ -133,14 +135,69 @@ WRAP_THROW_EXCEPTION(uscxml::Interpreter::step);
WRAP_THROW_EXCEPTION(uscxml::Interpreter::interpret);
+%define WRAP_TO_STRING( CLASSNAME )
+%csmethodmodifiers CLASSNAME::ToString() "public override";
+%extend CLASSNAME {
+ virtual std::string ToString() {
+ std::stringstream ss;
+ ss << *self;
+ return ss.str();
+ }
+};
+%enddef
+
+WRAP_TO_STRING(uscxml::Event);
+WRAP_TO_STRING(uscxml::Data);
+WRAP_TO_STRING(uscxml::SendRequest);
+WRAP_TO_STRING(uscxml::InvokeRequest);
+
%include "../uscxml_ignores.i"
//***********************************************
// Beautify important classes
//***********************************************
+%csmethodmodifiers uscxml::Event::getParamMap() "private";
+%csmethodmodifiers uscxml::Event::getParamMapKeys() "private";
+%csmethodmodifiers uscxml::Event::setParamMap(const std::map<std::string, std::list<uscxml::Data> >&) "private";
+%csmethodmodifiers uscxml::Event::getNameListKeys() "private";
+%csmethodmodifiers uscxml::Interpreter::getIOProcessorKeys() "private";
+%csmethodmodifiers uscxml::Interpreter::getInvokerKeys() "private";
+%csmethodmodifiers uscxml::Interpreter::getInvokers() "private";
+%csmethodmodifiers uscxml::Interpreter::getIOProcessors() "private";
+%csmethodmodifiers uscxml::Data::getCompoundKeys() "private";
+
%include "../uscxml_beautify.i"
+%typemap(csimports) uscxml::Interpreter %{
+using System;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+%}
+
+%typemap(cscode) uscxml::Interpreter %{
+ public Dictionary<string, NativeIOProcessor> getIOProcessors() {
+ Dictionary<string, NativeIOProcessor> ioProcs = new Dictionary<string, NativeIOProcessor>();
+ StringVector keys = getIOProcessorKeys();
+ IOProcMap ioProcMap = getIOProcessorsNative();
+ for (int i = 0; i < keys.Count; i++) {
+ ioProcs[keys[i]] = ioProcMap[keys[i]];
+ }
+ return ioProcs;
+ }
+
+ public Dictionary<string, NativeInvoker> getInvokers() {
+ Dictionary<string, NativeInvoker> invokers = new Dictionary<string, NativeInvoker>();
+ StringVector keys = getInvokerKeys();
+ InvokerMap invokerMap = getInvokersNative();
+ for (int i = 0; i < keys.Count; i++) {
+ invokers[keys[i]] = invokerMap[keys[i]];
+ }
+ return invokers;
+ }
+
+%}
+
%rename(getCompoundNative) uscxml::Data::getCompound();
%rename(getArrayNative) uscxml::Data::getArray();
diff --git a/src/bindings/swig/java/uscxml.i b/src/bindings/swig/java/uscxml.i
index cb760e4..ee95eb0 100644
--- a/src/bindings/swig/java/uscxml.i
+++ b/src/bindings/swig/java/uscxml.i
@@ -36,6 +36,8 @@ typedef uscxml::ExecutableContentImpl ExecutableContentImpl;
#pragma SWIG nowarn=401
// do not warn when we override symbols via extend
#pragma SWIG nowarn=302
+// do not warn when ignoring overrided method
+#pragma SWIG nowarn=516
%javaconst(1);
@@ -93,6 +95,21 @@ WRAP_THROW_EXCEPTION(uscxml::Interpreter::step);
WRAP_THROW_EXCEPTION(uscxml::Interpreter::interpret);
+%define WRAP_TO_STRING( CLASSNAME )
+%extend CLASSNAME {
+ virtual std::string toString() {
+ std::stringstream ss;
+ ss << *self;
+ return ss.str();
+ }
+};
+%enddef
+
+WRAP_TO_STRING(uscxml::Event);
+WRAP_TO_STRING(uscxml::Data);
+WRAP_TO_STRING(uscxml::SendRequest);
+WRAP_TO_STRING(uscxml::InvokeRequest);
+
%include "../uscxml_ignores.i"
// see http://swig.org/Doc2.0/Java.html#Java_date_marshalling
@@ -153,9 +170,49 @@ BEAUTIFY_NATIVE(uscxml::InvokeRequest, InvokeRequest, InvokeRequestNative);
// Beautify important classes
//***********************************************
+%javamethodmodifiers uscxml::Event::getParamMap() "private";
+%javamethodmodifiers uscxml::Event::getParamMapKeys() "private";
+%javamethodmodifiers uscxml::Event::setParamMap(const std::map<std::string, std::list<uscxml::Data> >&) "private";
+%javamethodmodifiers uscxml::Event::getNameListKeys() "private";
+%javamethodmodifiers uscxml::Interpreter::getIOProcessorKeys() "private";
+%javamethodmodifiers uscxml::Interpreter::getInvokerKeys() "private";
+%javamethodmodifiers uscxml::Interpreter::getInvokers() "private";
+%javamethodmodifiers uscxml::Interpreter::getIOProcessors() "private";
+%javamethodmodifiers uscxml::Data::getCompoundKeys() "private";
+
%include "../uscxml_beautify.i"
+%typemap(javaimports) uscxml::Interpreter %{
+import java.util.Map;
+import java.util.HashMap;
+import java.util.List;
+import java.util.LinkedList;
+%}
+
+%typemap(javacode) uscxml::Interpreter %{
+ public Map<String, NativeIOProcessor> getIOProcessors() {
+ Map<String, NativeIOProcessor> ioProcs = new HashMap<String, NativeIOProcessor>();
+ StringVector keys = getIOProcessorKeys();
+ IOProcMap ioProcMap = getIOProcessorsNative();
+ for (int i = 0; i < keys.size(); i++) {
+ ioProcs.put(keys.get(i), ioProcMap.get(keys.get(i)));
+ }
+ return ioProcs;
+ }
+
+ public Map<String, NativeInvoker> getInvokers() {
+ Map<String, NativeInvoker> invokers = new HashMap<String, NativeInvoker>();
+ StringVector keys = getInvokerKeys();
+ InvokerMap invokerMap = getInvokersNative();
+ for (int i = 0; i < keys.size(); i++) {
+ invokers.put(keys.get(i), invokerMap.get(keys.get(i)));
+ }
+ return invokers;
+ }
+
+%}
+
%rename(getCompoundNative) uscxml::Data::getCompound();
%rename(getArrayNative) uscxml::Data::getArray();
%rename(setCompoundNative) uscxml::Data::setCompound(const std::map<std::string, Data>&);
diff --git a/src/bindings/swig/uscxml_beautify.i b/src/bindings/swig/uscxml_beautify.i
index ac3ed44..6daba77 100644
--- a/src/bindings/swig/uscxml_beautify.i
+++ b/src/bindings/swig/uscxml_beautify.i
@@ -9,34 +9,10 @@
%rename(NativeInterpreterMonitor) InterpreterMonitor;
%rename(InterpreterMonitor) WrappedInterpreterMonitor;
-%extend uscxml::Event {
-/* std::vector<std::pair<std::string, uscxml::Data> > getParamPairs() {
- std::vector<std::pair<std::string, Data> > pairs;
- std::multimap<std::string, Data>::iterator paramPairIter = self->getParams().begin();
- while(paramPairIter != self->getParams().end()) {
- pairs.push_back(*paramPairIter);
- paramPairIter++;
- }
- return pairs;
- }
+%rename(getInvokersNative) uscxml::Interpreter::getInvokers();
+%rename(getIOProcessorsNative) uscxml::Interpreter::getIOProcessors();
- void setParamPairs(const std::vector<std::pair<std::string, uscxml::Data> >& pairs) {
- std::multimap<std::string, Data> params;
- std::vector<std::pair<std::string, Data> >::const_iterator pairIter = pairs.begin();
- while(pairIter != pairs.end()) {
- params.insert(std::make_pair(pairIter->first, pairIter->second));
- pairIter++;
- }
- self->setParams(params);
- }
-*/
-
- std::string toString() {
- std::stringstream ss;
- ss << *self;
- return ss.str();
- }
-
+%extend uscxml::Event {
std::map<std::string, std::list<uscxml::Data> > getParamMap() {
std::map<std::string, std::list<uscxml::Data> > paramMap;
std::multimap<std::string, Data>::const_iterator paramPairIter = self->getParams().begin();
@@ -127,12 +103,6 @@
};
%extend uscxml::Data {
- std::string toString() {
- std::stringstream ss;
- ss << *self;
- return ss.str();
- }
-
std::vector<std::string> getCompoundKeys() {
std::vector<std::string> keys;
std::map<std::string, Data>::const_iterator iter = self->compound.begin();
@@ -143,19 +113,3 @@
return keys;
}
};
-
-%extend uscxml::SendRequest {
- std::string toString() {
- std::stringstream ss;
- ss << *self;
- return ss.str();
- }
-};
-
-%extend uscxml::InvokeRequest {
- std::string toString() {
- std::stringstream ss;
- ss << *self;
- return ss.str();
- }
-}; \ No newline at end of file
diff --git a/src/bindings/swig/wrapped/WrappedIOProcessor.h b/src/bindings/swig/wrapped/WrappedIOProcessor.h
index b4e4938..0b5cfe8 100644
--- a/src/bindings/swig/wrapped/WrappedIOProcessor.h
+++ b/src/bindings/swig/wrapped/WrappedIOProcessor.h
@@ -47,7 +47,7 @@ public:
_interpreter = interpreter->shared_from_this();
return boost::shared_ptr<IOProcessorImpl>(create(_interpreter));
}
-
+
virtual std::list<std::string> getNames() {
return std::list<std::string>();
};
diff --git a/src/uscxml/Factory.cpp b/src/uscxml/Factory.cpp
index 22482e6..0f3e8c9 100644
--- a/src/uscxml/Factory.cpp
+++ b/src/uscxml/Factory.cpp
@@ -672,7 +672,7 @@ void EventHandlerImpl::returnEvent(Event& event, bool external) {
event.origin = "#_" + _invokeId;
if (event.origintype.length() == 0)
event.origintype = _type;
-
+
if (external) {
_interpreter->receive(event);
} else {
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp
index 47a6182..5b0db2d 100644
--- a/src/uscxml/Interpreter.cpp
+++ b/src/uscxml/Interpreter.cpp
@@ -97,15 +97,15 @@
#define VALID_FROM_FINISHED(newState) ( \
newState == USCXML_DESTROYED || \
newState == USCXML_INSTANTIATED \
-)
+)
/// macro to catch exceptions in executeContent
#define CATCH_AND_DISTRIBUTE(msg) \
catch (Event e) {\
- LOG(ERROR) << msg << std::endl << e << std::endl;\
if (rethrow) {\
throw(e);\
} else {\
+ LOG(ERROR) << msg << std::endl << e << std::endl;\
e.name = "error.execution";\
e.data.compound["cause"] = uscxml::Data(msg, uscxml::Data::VERBATIM); \
e.eventType = Event::PLATFORM;\
@@ -116,10 +116,10 @@ catch (Event e) {\
#define CATCH_AND_DISTRIBUTE2(msg, node) \
catch (Event e) {\
std::string xpathPos = DOMUtils::xPathForNode(node); \
- LOG(ERROR) << msg << " " << xpathPos << ":" << std::endl << e << std::endl;\
if (rethrow) {\
throw(e);\
} else {\
+ LOG(ERROR) << msg << " " << xpathPos << ":" << std::endl << e << std::endl;\
e.name = "error.execution";\
e.data.compound["cause"] = uscxml::Data(msg, uscxml::Data::VERBATIM); \
e.data.compound["xpath"] = uscxml::Data(xpathPos, uscxml::Data::VERBATIM); \
@@ -684,7 +684,7 @@ void InterpreterImpl::reset() {
_topLevelFinalReached = false;
_isInitialized = false;
_stable = false;
-
+
setInterpreterState(USCXML_INSTANTIATED);
}
@@ -1162,15 +1162,16 @@ void InterpreterImpl::send(const Arabica::DOM::Node<std::string>& element) {
try {
// namelist
if (HAS_ATTR(element, "namelist")) {
- if (_dataModel) {
- std::list<std::string> names = tokenizeIdRefs(ATTR(element, "namelist"));
- for (std::list<std::string>::const_iterator nameIter = names.begin(); nameIter != names.end(); nameIter++) {
- Data namelistValue = _dataModel.getStringAsData(*nameIter);
- sendReq.namelist[*nameIter] = namelistValue;
- sendReq.data.compound[*nameIter] = namelistValue;
+ std::list<std::string> names = tokenizeIdRefs(ATTR(element, "namelist"));
+ for (std::list<std::string>::const_iterator nameIter = names.begin(); nameIter != names.end(); nameIter++) {
+ if (!_dataModel.isDeclared(*nameIter)) {
+ LOG(ERROR) << "Error in send element " << DOMUtils::xPathForNode(element) << " namelist:" << std::endl << "'" << *nameIter << "' is not declared" << std::endl;
+ ERROR_EXECUTION2(err, "Location expression '" + *nameIter + "' in namelist is invalid", element);
+ return;
}
- } else {
- LOG(ERROR) << "Namelist attribute at send requires datamodel to be defined";
+ Data namelistValue = _dataModel.getStringAsData(*nameIter);
+ sendReq.namelist[*nameIter] = namelistValue;
+ sendReq.data.compound[*nameIter] = namelistValue;
}
}
} catch (Event e) {
diff --git a/src/uscxml/Interpreter.h b/src/uscxml/Interpreter.h
index cf281b5..2ad1039 100644
--- a/src/uscxml/Interpreter.h
+++ b/src/uscxml/Interpreter.h
@@ -51,7 +51,7 @@
e.name = "error.platform"; \
e.data.compound["cause"] = Data(msg, Data::VERBATIM); \
throw e; \
-
+
#define USCXML_MONITOR_CATCH(callback) \
catch (Event e) { \
diff --git a/src/uscxml/interpreter/InterpreterDraft6.cpp b/src/uscxml/interpreter/InterpreterDraft6.cpp
index 048adf9..fdbd21b 100644
--- a/src/uscxml/interpreter/InterpreterDraft6.cpp
+++ b/src/uscxml/interpreter/InterpreterDraft6.cpp
@@ -151,7 +151,7 @@ InterpreterState InterpreterDraft6::step(int waitForMS = 0) {
}
_stable = true;
}
-
+
// test415
if (_topLevelFinalReached)
goto EXIT_INTERPRETER;
@@ -185,7 +185,7 @@ InterpreterState InterpreterDraft6::step(int waitForMS = 0) {
if (_state != USCXML_MACROSTEPPED && _state != USCXML_IDLE)
USCXML_MONITOR_CALLBACK(onStableConfiguration)
- setInterpreterState(USCXML_MACROSTEPPED);
+ setInterpreterState(USCXML_MACROSTEPPED);
if (_topLevelFinalReached)
goto EXIT_INTERPRETER;
@@ -232,7 +232,7 @@ InterpreterState InterpreterDraft6::step(int waitForMS = 0) {
_currEvent = _externalQueue.pop();
_currEvent.eventType = Event::EXTERNAL; // make sure it is set to external
_stable = false;
-
+
if (_topLevelFinalReached)
goto EXIT_INTERPRETER;
diff --git a/src/uscxml/messages/SendRequest.h b/src/uscxml/messages/SendRequest.h
index 6bc3d91..f43b856 100644
--- a/src/uscxml/messages/SendRequest.h
+++ b/src/uscxml/messages/SendRequest.h
@@ -26,7 +26,7 @@ namespace uscxml {
class USCXML_API SendRequest : public Event {
public:
- SendRequest() {}
+ SendRequest() : delayMs(0) {}
SendRequest(Event event) : Event(event) {}
std::string getTarget() {
diff --git a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp
index 5800f98..3b28547 100644
--- a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp
@@ -663,7 +663,7 @@ void XPathDataModel::assign(const NodeSet<std::string>& key,
// addattribute: Add an attribute with the name specified by 'attr'
// and value specified by 'expr' to the node specified by 'location'.
if (!HAS_ATTR(assignElem, "attr"))
- ERROR_EXECUTION_THROW("Assign element is missing 'attr'")
+ ERROR_EXECUTION_THROW("Assign element is missing 'attr'");
element.setAttribute(ATTR(assignElem, "attr"), value);
} else {
/// test 547
diff --git a/test/src/test-lifecycle.cpp b/test/src/test-lifecycle.cpp
index c0fb55c..7cbb68b 100644
--- a/test/src/test-lifecycle.cpp
+++ b/test/src/test-lifecycle.cpp
@@ -129,7 +129,7 @@ class SequenceCheckingMonitor : public InterpreterMonitor {
virtual void beforeMicroStep(Interpreter interpreter) {
CHECK_CALLBACK_TYPE(USCXML_BEFOREMICROSTEP);
}
-
+
virtual void beforeExitingState(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing) {
if (!moreComing)
CHECK_CALLBACK_TYPE(USCXML_BEFOREEXITINGSTATE);
@@ -138,21 +138,21 @@ class SequenceCheckingMonitor : public InterpreterMonitor {
if (!moreComing)
CHECK_CALLBACK_TYPE(USCXML_AFTEREXITINGSTATE);
}
-
+
virtual void beforeExecutingContent(Interpreter interpreter, const Arabica::DOM::Element<std::string>& element) {
CHECK_CALLBACK_TYPE(USCXML_BEFOREEXECUTINGCONTENT);
}
virtual void afterExecutingContent(Interpreter interpreter, const Arabica::DOM::Element<std::string>& element) {
CHECK_CALLBACK_TYPE(USCXML_AFTEREXECUTINGCONTENT);
}
-
+
virtual void beforeUninvoking(Interpreter interpreter, const Arabica::DOM::Element<std::string>& invokeElem, const std::string& invokeid) {
CHECK_CALLBACK_TYPE(USCXML_BEFOREUNINVOKING);
}
virtual void afterUninvoking(Interpreter interpreter, const Arabica::DOM::Element<std::string>& invokeElem, const std::string& invokeid) {
CHECK_CALLBACK_TYPE(USCXML_AFTERUNINVOKING);
}
-
+
virtual void beforeTakingTransition(Interpreter interpreter, const Arabica::DOM::Element<std::string>& transition, bool moreComing) {
if (!moreComing)
CHECK_CALLBACK_TYPE(USCXML_BEFORETAKINGTRANSITION);
@@ -161,7 +161,7 @@ class SequenceCheckingMonitor : public InterpreterMonitor {
if (!moreComing)
CHECK_CALLBACK_TYPE(USCXML_AFTERTAKINGTRANSITION);
}
-
+
virtual void beforeEnteringState(Interpreter interpreter, const Arabica::DOM::Element<std::string>& state, bool moreComing) {
if (!moreComing)
CHECK_CALLBACK_TYPE(USCXML_BEFOREENTERINGSTATE);
@@ -170,22 +170,22 @@ class SequenceCheckingMonitor : public InterpreterMonitor {
if (!moreComing)
CHECK_CALLBACK_TYPE(USCXML_AFTERENTERINGSTATE);
}
-
+
virtual void beforeInvoking(Interpreter interpreter, const Arabica::DOM::Element<std::string>& invokeElem, const std::string& invokeid) {
CHECK_CALLBACK_TYPE(USCXML_BEFOREINVOKING);
}
virtual void afterInvoking(Interpreter interpreter, const Arabica::DOM::Element<std::string>& invokeElem, const std::string& invokeid) {
CHECK_CALLBACK_TYPE(USCXML_AFTERINVOKING);
}
-
+
virtual void afterMicroStep(Interpreter interpreter) {
CHECK_CALLBACK_TYPE(USCXML_AFTERMICROSTEP);
}
-
+
virtual void onStableConfiguration(Interpreter interpreter) {
CHECK_CALLBACK_TYPE(USCXML_ONSTABLECONFIGURATION);
}
-
+
virtual void beforeCompletion(Interpreter interpreter) {
CHECK_CALLBACK_TYPE(USCXML_BEFORECOMPLETION);
}
@@ -208,7 +208,7 @@ int main(int argc, char** argv) {
google::LogToStderr();
SequenceCheckingMonitor* mon = new SequenceCheckingMonitor();
-
+
int iterations = 1;
while(iterations--) {
@@ -241,12 +241,12 @@ int main(int argc, char** argv) {
// request unknown datamodel
try {
const char* xml =
- "<scxml datamodel=\"invalid\">"
- " <state id=\"start\">"
- " <transition target=\"done\" />"
- " </state>"
- " <final id=\"done\" />"
- "</scxml>";
+ "<scxml datamodel=\"invalid\">"
+ " <state id=\"start\">"
+ " <transition target=\"done\" />"
+ " </state>"
+ " <final id=\"done\" />"
+ "</scxml>";
Interpreter interpreter = Interpreter::fromXML(xml);
interpreter.addMonitor(mon);
assert(interpreter.getState() == USCXML_INSTANTIATED);
@@ -260,22 +260,22 @@ int main(int argc, char** argv) {
if (1) {
// two microsteps
const char* xml =
- "<scxml>"
- " <state id=\"start\">"
- " <transition target=\"s2\" />"
- " </state>"
- " <state id=\"s2\">"
- " <transition target=\"done\" />"
- " </state>"
- " <final id=\"done\" />"
- "</scxml>";
-
+ "<scxml>"
+ " <state id=\"start\">"
+ " <transition target=\"s2\" />"
+ " </state>"
+ " <state id=\"s2\">"
+ " <transition target=\"done\" />"
+ " </state>"
+ " <final id=\"done\" />"
+ "</scxml>";
+
Interpreter interpreter = Interpreter::fromXML(xml);
interpreter.addMonitor(mon);
callBackSeq.push_back(USCXML_BEFOREENTERINGSTATE);
callBackSeq.push_back(USCXML_AFTERENTERINGSTATE);
-
+
callBackSeq.push_back(USCXML_BEFOREMICROSTEP);
callBackSeq.push_back(USCXML_BEFOREEXITINGSTATE);
callBackSeq.push_back(USCXML_AFTEREXITINGSTATE);
@@ -295,31 +295,31 @@ int main(int argc, char** argv) {
callBackSeq.push_back(USCXML_AFTERMICROSTEP);
callBackSeq.push_back(USCXML_BEFORECOMPLETION);
- callBackSeq.push_back(USCXML_AFTERCOMPLETION);
-
+ callBackSeq.push_back(USCXML_AFTERCOMPLETION);
+
assert(interpreter.getState() == USCXML_INSTANTIATED);
assert(interpreter.step() == USCXML_MICROSTEPPED);
assert(interpreter.step() == USCXML_MICROSTEPPED);
assert(interpreter.step() == USCXML_FINISHED);
assert(callBackSeq.empty());
}
-
+
if (1) {
// single macrostep, multiple runs
const char* xml =
- "<scxml>"
- " <state id=\"start\">"
- " <transition target=\"done\" />"
- " </state>"
- " <final id=\"done\" />"
- "</scxml>";
-
+ "<scxml>"
+ " <state id=\"start\">"
+ " <transition target=\"done\" />"
+ " </state>"
+ " <final id=\"done\" />"
+ "</scxml>";
+
Interpreter interpreter = Interpreter::fromXML(xml);
interpreter.addMonitor(mon);
callBackSeq.push_back(USCXML_BEFOREENTERINGSTATE);
callBackSeq.push_back(USCXML_AFTERENTERINGSTATE);
-
+
callBackSeq.push_back(USCXML_BEFOREMICROSTEP);
callBackSeq.push_back(USCXML_BEFOREEXITINGSTATE);
callBackSeq.push_back(USCXML_AFTEREXITINGSTATE);
@@ -328,10 +328,10 @@ int main(int argc, char** argv) {
callBackSeq.push_back(USCXML_BEFOREENTERINGSTATE);
callBackSeq.push_back(USCXML_AFTERENTERINGSTATE);
callBackSeq.push_back(USCXML_AFTERMICROSTEP);
-
+
callBackSeq.push_back(USCXML_BEFORECOMPLETION);
callBackSeq.push_back(USCXML_AFTERCOMPLETION);
-
+
assert(interpreter.getState() == USCXML_INSTANTIATED);
assert(interpreter.step() == USCXML_MICROSTEPPED);
assert(interpreter.step() == USCXML_FINISHED);
@@ -339,7 +339,7 @@ int main(int argc, char** argv) {
callBackSeq.push_back(USCXML_BEFOREENTERINGSTATE);
callBackSeq.push_back(USCXML_AFTERENTERINGSTATE);
-
+
callBackSeq.push_back(USCXML_BEFOREMICROSTEP);
callBackSeq.push_back(USCXML_BEFOREEXITINGSTATE);
callBackSeq.push_back(USCXML_AFTEREXITINGSTATE);
@@ -348,7 +348,7 @@ int main(int argc, char** argv) {
callBackSeq.push_back(USCXML_BEFOREENTERINGSTATE);
callBackSeq.push_back(USCXML_AFTERENTERINGSTATE);
callBackSeq.push_back(USCXML_AFTERMICROSTEP);
-
+
callBackSeq.push_back(USCXML_BEFORECOMPLETION);
callBackSeq.push_back(USCXML_AFTERCOMPLETION);
@@ -356,23 +356,23 @@ int main(int argc, char** argv) {
assert(interpreter.step() == USCXML_MICROSTEPPED);
assert(interpreter.step() == USCXML_FINISHED);
}
-
+
if (1) {
// macrostep in between
const char* xml =
- "<scxml>"
- " <state id=\"start\">"
- " <onentry>"
- " <send event=\"continue\" delay=\"2s\"/>"
- " </onentry>"
- " <transition target=\"s2\" event=\"continue\" />"
- " </state>"
- " <state id=\"s2\">"
- " <transition target=\"done\" />"
- " </state>"
- " <final id=\"done\" />"
- "</scxml>";
-
+ "<scxml>"
+ " <state id=\"start\">"
+ " <onentry>"
+ " <send event=\"continue\" delay=\"2s\"/>"
+ " </onentry>"
+ " <transition target=\"s2\" event=\"continue\" />"
+ " </state>"
+ " <state id=\"s2\">"
+ " <transition target=\"done\" />"
+ " </state>"
+ " <final id=\"done\" />"
+ "</scxml>";
+
Interpreter interpreter = Interpreter::fromXML(xml);
interpreter.addMonitor(mon);
@@ -410,7 +410,7 @@ int main(int argc, char** argv) {
assert(interpreter.step() == USCXML_MICROSTEPPED);
assert(interpreter.step() == USCXML_FINISHED);
}
-
+
#if 0
diff --git a/test/w3c/confEcma.xsl b/test/w3c/confEcma.xsl
index ffc922d..a77d552 100644
--- a/test/w3c/confEcma.xsl
+++ b/test/w3c/confEcma.xsl
@@ -165,7 +165,7 @@
<content xmlns="http://www.w3.org/2005/07/scxml">foo</content>
</xsl:template>
-
+<xsl:template match="//conf:someInlineVal">123</xsl:template>
<!-- this returns something that is guaranteed not to be the ID of the current session -->
<xsl:template match="//@conf:invalidSessionID">
@@ -273,6 +273,12 @@ events which cause the test to fail. The default value provided here is pretty
<xsl:attribute name="namelist">Var<xsl:value-of select="." /></xsl:attribute>
</xsl:template>
+<!-- this produces a reference to an invalid namelist, i.e. on that should cause an error -->
+<xsl:template match="//@conf:invalidNamelist">
+ <xsl:attribute name="namelist">"foo"</xsl:attribute>
+</xsl:template>
+
+
<!-- transition conditions -->
@@ -380,6 +386,10 @@ events which cause the test to fail. The default value provided here is pretty
</xsl:attribute>
</xsl:template>
+<!-- test that the specified var has the value specified by <conf:someInlineVal> -->
+<xsl:template match="//@conf:idSomeVal">
+ <xsl:attribute name="cond">Var<xsl:value-of select="." /> == 123</xsl:attribute>
+</xsl:template>
<!-- test that the event's name fieldhas the value specified -->
<xsl:template match="//@conf:eventNameVal">
@@ -428,6 +438,11 @@ is the second argument -->
<xsl:attribute name="cond">_event.data == <xsl:value-of select="."/></xsl:attribute>
</xsl:template>
+<!-- test that _event.data is set to the value specified by <conf:someInlineVal> -->
+<xsl:template match="//@conf:eventdataSomeVal">
+ <xsl:attribute name="cond">_event.data == 123</xsl:attribute>
+</xsl:template>
+
<xsl:template match="//@conf:emptyEventData">
<xsl:attribute name="cond">typeof _event.data === 'undefined'</xsl:attribute>
</xsl:template>
diff --git a/test/w3c/confXPath.xsl b/test/w3c/confXPath.xsl
index 71286ce..bb65375 100644
--- a/test/w3c/confXPath.xsl
+++ b/test/w3c/confXPath.xsl
@@ -204,7 +204,7 @@ is of the same type as array123 -->
<content xmlns="http://www.w3.org/2005/07/scxml">foo</content>
</xsl:template>
-
+<xsl:template match="//conf:someInlineVal">123</xsl:template>
<!-- this returns something that is guaranteed not to be the ID of the current session -->
@@ -270,6 +270,11 @@ events which cause the test to fail. The default value provided here is pretty
<xsl:attribute name="namelist">$Var<xsl:value-of select="." /></xsl:attribute>
</xsl:template>
+<!-- this produces a reference to an invalid namelist, i.e. on that should cause an error -->
+<xsl:template match="//@conf:invalidNamelist">
+ <xsl:attribute name="namelist">"foo"</xsl:attribute>
+</xsl:template>
+
<!-- exprs that return the value of the event fields -->
<xsl:template match="//@conf:eventName">
@@ -419,6 +424,11 @@ know if we can make this strong in XPath 1.0 -->
</xsl:attribute>
</xsl:template>
+<!-- test that the specified var has the value specified by <conf:someInlineVal> -->
+<xsl:template match="//@conf:idSomeVal">
+ <xsl:attribute name="cond">Var<xsl:value-of select="." /> = 123</xsl:attribute>
+</xsl:template>
+
<!-- test on the value of two vars -->
<xsl:template match="//@conf:compareIDVal">
<xsl:attribute name="cond">
@@ -513,6 +523,11 @@ is the second argument -->
<xsl:attribute name="cond">$_event/data = <xsl:value-of select="."/></xsl:attribute>
</xsl:template>
+<!-- test that _event.data is set to the value specified by <conf:someInlineVal> -->
+<xsl:template match="//@conf:eventdataSomeVal">
+ <xsl:attribute name="cond">_event.data = 123</xsl:attribute>
+</xsl:template>
+
<xsl:template match="//@conf:emptyEventData">
<xsl:attribute name="cond">not($_event/data/*)</xsl:attribute>
</xsl:template>
diff --git a/test/w3c/ecma/test252.scxml b/test/w3c/ecma/test252.scxml
index 14c6686..b33342b 100644
--- a/test/w3c/ecma/test252.scxml
+++ b/test/w3c/ecma/test252.scxml
@@ -5,7 +5,7 @@ timeout indicates success. --><scxml xmlns="http://www.w3.org/2005/07/scxml" x
<state id="s0" initial="s01">
<onentry>
- <send event="timeout" delay="2s"/>
+ <send event="timeout" delayexpr="'50ms'"/>
</onentry>
<transition event="timeout" target="pass"/>
@@ -22,7 +22,7 @@ timeout indicates success. --><scxml xmlns="http://www.w3.org/2005/07/scxml" x
<scxml initial="sub0" version="1.0" datamodel="ecmascript">
<state id="sub0">
<onentry>
- <send event="timeout" delay="2s"/>
+ <send event="timeout" delayexpr="'25ms'"/>
</onentry>
<transition event="timeout" target="subFinal"/>
<onexit>
diff --git a/test/w3c/ecma/test343.scxml b/test/w3c/ecma/test343.scxml
index 7f15cf0..a1455d9 100644
--- a/test/w3c/ecma/test343.scxml
+++ b/test/w3c/ecma/test343.scxml
@@ -14,7 +14,7 @@
</state>
<final id="s02">
<donedata>
- <param location="Varfoo" name="someParam"/>
+ <param location="foo.bar.baz " name="someParam"/>
</donedata>
</final>
</state>
diff --git a/test/w3c/ecma/test354.scxml b/test/w3c/ecma/test354.scxml
index ef55794..6c544a4 100644
--- a/test/w3c/ecma/test354.scxml
+++ b/test/w3c/ecma/test354.scxml
@@ -37,10 +37,10 @@ and that correct values are used --><scxml xmlns="http://www.w3.org/2005/07/scxm
<onentry>
<send delay="5s" event="timeout"/>
<send event="event2">
- <content>foo</content>
+ <content>123</content>
</send>
</onentry>
- <transition event="event2" cond="_event.data == 'foo'" target="pass"/>
+ <transition event="event2" cond="_event.data == 123" target="pass"/>
<transition event="*" target="fail"/>
</state>
diff --git a/test/w3c/ecma/test487.scxml b/test/w3c/ecma/test487.scxml
index 30a50eb..5baacbe 100644
--- a/test/w3c/ecma/test487.scxml
+++ b/test/w3c/ecma/test487.scxml
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?><!-- test illegal assignment. error.execution should be raised. --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="ecmascript" version="1.0">
<datamodel>
- <data id="Var1" expr="return"/>
+ <data id="Var1"/>
</datamodel>
<state id="s0">
<onentry>
+ <assign location="Var1" expr="return"/>
<raise event="event"/>
</onentry>
diff --git a/test/w3c/ecma/test553.scxml b/test/w3c/ecma/test553.scxml
index 0beddea..0df3c3e 100644
--- a/test/w3c/ecma/test553.scxml
+++ b/test/w3c/ecma/test553.scxml
@@ -6,8 +6,8 @@ of <send>'s args causes an error.. --><scxml xmlns="http://www.w3.org/2005/07/s
<onentry>
<!-- timeout event -->
<send event="timeout" delayexpr="'50ms'"/>
- <!-- include a non-existing var in the namelist -->
- <send event="event1" namelist="Var2"/>
+ <!-- generate an invalid namelist -->
+ <send event="event1" namelist="&#34;foo&#34;"/>
</onentry>
<!-- if we get the timeout before event1, we assume that event1 hasn't been sent
diff --git a/test/w3c/ecma/test554.scxml b/test/w3c/ecma/test554.scxml
index 960f5ac..764241e 100644
--- a/test/w3c/ecma/test554.scxml
+++ b/test/w3c/ecma/test554.scxml
@@ -8,8 +8,8 @@ before the timer goes off. --><scxml xmlns="http://www.w3.org/2005/07/scxml" xm
<send event="timer" delayexpr="'50ms'"/>
</onentry>
- <!-- namelist references an undeclared variable -->
- <invoke type="http://www.w3.org/TR/scxml/" namelist="Var2">
+ <!-- reference an invalid namelist -->
+ <invoke type="http://www.w3.org/TR/scxml/" namelist="&#34;foo&#34;">
<content>
<scxml initial="subFinal" version="1.0" datamodel="ecmascript">
<final id="subFinal"/>
diff --git a/test/w3c/txml/test252.txml b/test/w3c/txml/test252.txml
index 40c36cb..ba43543 100644
--- a/test/w3c/txml/test252.txml
+++ b/test/w3c/txml/test252.txml
@@ -9,7 +9,7 @@ timeout indicates success. -->
<state id="s0" initial="s01">
<onentry>
- <send event="timeout" delay="2s"/>
+ <send event="timeout" conf:delay="1"/>
</onentry>
<transition event="timeout" conf:targetpass=""/>
@@ -26,7 +26,7 @@ timeout indicates success. -->
<scxml initial="sub0" version="1.0" conf:datamodel="" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance">
<state id="sub0">
<onentry>
- <send event="timeout" delay="2s"/>
+ <send event="timeout" conf:delay=".5"/>
</onentry>
<transition event="timeout" target="subFinal"/>
<onexit>
diff --git a/test/w3c/txml/test343.txml b/test/w3c/txml/test343.txml
index 1d13da6..f0aba04 100644
--- a/test/w3c/txml/test343.txml
+++ b/test/w3c/txml/test343.txml
@@ -17,7 +17,7 @@
</state>
<final id="s02">
<donedata>
- <param conf:location="foo" name="someParam"/>
+ <param conf:invalidLocation="foo" name="someParam"/>
</donedata>
</final>
</state>
diff --git a/test/w3c/txml/test354.txml b/test/w3c/txml/test354.txml
index 0f1f6c5..890b6ef 100644
--- a/test/w3c/txml/test354.txml
+++ b/test/w3c/txml/test354.txml
@@ -41,10 +41,10 @@ and that correct values are used -->
<onentry>
<send delay="5s" event="timeout"/>
<send event="event2">
- <content>foo</content>
+ <content><conf:someInlineVal/></content>
</send>
</onentry>
- <transition event="event2" conf:eventdataVal="'foo'" conf:targetpass=""/>
+ <transition event="event2" conf:eventdataSomeVal="" conf:targetpass=""/>
<transition event="*" conf:targetfail=""/>
</state>
diff --git a/test/w3c/txml/test487.txml b/test/w3c/txml/test487.txml
index 7210c2b..fe7423c 100644
--- a/test/w3c/txml/test487.txml
+++ b/test/w3c/txml/test487.txml
@@ -4,11 +4,12 @@
<scxml initial="s0" conf:datamodel="" version="1.0" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance">
<datamodel>
- <data conf:id="1" conf:illegalExpr=""/>
+ <data conf:id="1"/>
</datamodel>
<state id="s0">
<onentry>
+ <assign conf:location="1" conf:illegalExpr=""/>
<raise event="event"/>
</onentry>
diff --git a/test/w3c/txml/test553.txml b/test/w3c/txml/test553.txml
index 0c6a622..b9dfece 100644
--- a/test/w3c/txml/test553.txml
+++ b/test/w3c/txml/test553.txml
@@ -10,8 +10,8 @@ of <send>'s args causes an error.. -->
<onentry>
<!-- timeout event -->
<send event="timeout" conf:delay="1"/>
- <!-- include a non-existing var in the namelist -->
- <send event="event1" conf:namelist="2"/>
+ <!-- generate an invalid namelist -->
+ <send event="event1" conf:invalidNamelist=""/>
</onentry>
<!-- if we get the timeout before event1, we assume that event1 hasn't been sent
diff --git a/test/w3c/txml/test554.txml b/test/w3c/txml/test554.txml
index 663424f..9e16cf8 100644
--- a/test/w3c/txml/test554.txml
+++ b/test/w3c/txml/test554.txml
@@ -12,8 +12,8 @@ before the timer goes off. -->
<send event="timer" conf:delay="1"/>
</onentry>
- <!-- namelist references an undeclared variable -->
- <invoke type="http://www.w3.org/TR/scxml/" conf:namelist="2">
+ <!-- reference an invalid namelist -->
+ <invoke type="http://www.w3.org/TR/scxml/" conf:invalidNamelist="">
<content>
<scxml initial="subFinal" version="1.0" conf:datamodel="" xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance">
<final id="subFinal"/>
diff --git a/test/w3c/xpath/test252.scxml b/test/w3c/xpath/test252.scxml
index 1f92127..f8d93a5 100644
--- a/test/w3c/xpath/test252.scxml
+++ b/test/w3c/xpath/test252.scxml
@@ -5,7 +5,7 @@ timeout indicates success. --><scxml xmlns="http://www.w3.org/2005/07/scxml" x
<state id="s0" initial="s01">
<onentry>
- <send event="timeout" delay="2s"/>
+ <send event="timeout" delayexpr="'1s'"/>
</onentry>
<transition event="timeout" target="pass"/>
@@ -22,7 +22,7 @@ timeout indicates success. --><scxml xmlns="http://www.w3.org/2005/07/scxml" x
<scxml initial="sub0" version="1.0" datamodel="xpath">
<state id="sub0">
<onentry>
- <send event="timeout" delay="2s"/>
+ <send event="timeout" delayexpr="'.5s'"/>
</onentry>
<transition event="timeout" target="subFinal"/>
<onexit>
diff --git a/test/w3c/xpath/test343.scxml b/test/w3c/xpath/test343.scxml
index bae14de..e3dbf53 100644
--- a/test/w3c/xpath/test343.scxml
+++ b/test/w3c/xpath/test343.scxml
@@ -14,7 +14,7 @@
</state>
<final id="s02">
<donedata>
- <param location="$Varfoo" name="someParam"/>
+ <param location="foo.bar.baz " name="someParam"/>
</donedata>
</final>
</state>
diff --git a/test/w3c/xpath/test354.scxml b/test/w3c/xpath/test354.scxml
index 499b568..e75d382 100644
--- a/test/w3c/xpath/test354.scxml
+++ b/test/w3c/xpath/test354.scxml
@@ -37,10 +37,10 @@ and that correct values are used --><scxml xmlns="http://www.w3.org/2005/07/scxm
<onentry>
<send delay="5s" event="timeout"/>
<send event="event2">
- <content>foo</content>
+ <content>123</content>
</send>
</onentry>
- <transition event="event2" cond="$_event/data = 'foo'" target="pass"/>
+ <transition event="event2" cond="_event.data = 123" target="pass"/>
<transition event="*" target="fail"/>
</state>
diff --git a/test/w3c/xpath/test487.scxml b/test/w3c/xpath/test487.scxml
index 9e6c441..cec2f64 100644
--- a/test/w3c/xpath/test487.scxml
+++ b/test/w3c/xpath/test487.scxml
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?><!-- test illegal assignment. error.execution should be raised. --><scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="xpath" version="1.0">
<datamodel>
- <data id="Var1" expr="!1"/>
+ <data id="Var1"/>
</datamodel>
<state id="s0">
<onentry>
+ <assign location="$Var1" expr="!1"/>
<raise event="event"/>
</onentry>
diff --git a/test/w3c/xpath/test553.scxml b/test/w3c/xpath/test553.scxml
index 00bd1e8..90cd97c 100644
--- a/test/w3c/xpath/test553.scxml
+++ b/test/w3c/xpath/test553.scxml
@@ -6,8 +6,8 @@ of <send>'s args causes an error.. --><scxml xmlns="http://www.w3.org/2005/07/s
<onentry>
<!-- timeout event -->
<send event="timeout" delayexpr="'1s'"/>
- <!-- include a non-existing var in the namelist -->
- <send event="event1" namelist="$Var2"/>
+ <!-- generate an invalid namelist -->
+ <send event="event1" namelist="&#34;foo&#34;"/>
</onentry>
<!-- if we get the timeout before event1, we assume that event1 hasn't been sent
diff --git a/test/w3c/xpath/test554.scxml b/test/w3c/xpath/test554.scxml
index 1a2b58a..74e25b3 100644
--- a/test/w3c/xpath/test554.scxml
+++ b/test/w3c/xpath/test554.scxml
@@ -8,8 +8,8 @@ before the timer goes off. --><scxml xmlns="http://www.w3.org/2005/07/scxml" xm
<send event="timer" delayexpr="'1s'"/>
</onentry>
- <!-- namelist references an undeclared variable -->
- <invoke type="http://www.w3.org/TR/scxml/" namelist="$Var2">
+ <!-- reference an invalid namelist -->
+ <invoke type="http://www.w3.org/TR/scxml/" namelist="&#34;foo&#34;">
<content>
<scxml initial="subFinal" version="1.0" datamodel="xpath">
<final id="subFinal"/>