summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2015-04-02 11:44:48 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2015-04-02 11:44:48 (GMT)
commit81aa1c79dd158aa7bc76876552e4b1d05ecea656 (patch)
tree4b590410d4042c156cfd3d4e874f3a329390a72b /src
parentff86d690dc02d7dd495000331d378e7d8eb688ac (diff)
downloaduscxml-81aa1c79dd158aa7bc76876552e4b1d05ecea656.zip
uscxml-81aa1c79dd158aa7bc76876552e4b1d05ecea656.tar.gz
uscxml-81aa1c79dd158aa7bc76876552e4b1d05ecea656.tar.bz2
Reactivated PHP bindings and some work on PROMELA
Diffstat (limited to 'src')
-rw-r--r--src/bindings/CMakeLists.txt1
-rw-r--r--src/bindings/swig/java/uscxml.i2
-rw-r--r--src/bindings/swig/php/CMakeLists.txt100
-rw-r--r--src/bindings/swig/php/test.php85
-rw-r--r--src/bindings/swig/php/uscxml.i406
-rw-r--r--src/bindings/swig/php/uscxmlNativePHP.php3110
-rw-r--r--src/uscxml/DOMUtils.cpp6
-rw-r--r--src/uscxml/DOMUtils.h1
-rw-r--r--src/uscxml/Interpreter.cpp10
-rw-r--r--src/uscxml/Interpreter.h4
-rw-r--r--src/uscxml/messages/Data.h4
-rw-r--r--src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp6
-rw-r--r--src/uscxml/plugins/invoker/umundo/UmundoInvoker.h2
-rw-r--r--src/uscxml/transform/ChartToPromela.cpp816
-rw-r--r--src/uscxml/transform/ChartToPromela.h130
15 files changed, 4140 insertions, 543 deletions
diff --git a/src/bindings/CMakeLists.txt b/src/bindings/CMakeLists.txt
index edddc31..0a258b8 100644
--- a/src/bindings/CMakeLists.txt
+++ b/src/bindings/CMakeLists.txt
@@ -26,6 +26,7 @@ if (SWIG_FOUND)
INCLUDE(${SWIG_USE_FILE})
add_subdirectory(swig/java)
add_subdirectory(swig/csharp)
+ add_subdirectory(swig/php)
if(SWIG_VERSION VERSION_LESS 3.0.0)
message(STATUS "SWIG version > 3.0 is recommended, found ${SWIG_VERSION}")
endif()
diff --git a/src/bindings/swig/java/uscxml.i b/src/bindings/swig/java/uscxml.i
index e9b6bf0..031b9c0 100644
--- a/src/bindings/swig/java/uscxml.i
+++ b/src/bindings/swig/java/uscxml.i
@@ -335,7 +335,7 @@ import java.util.LinkedList;
%}
%rename(getNameListNative) uscxml::Event::getNameList();
-%rename(getParamstNative) uscxml::Event::getParams();
+%rename(getParamsNative) uscxml::Event::getParams();
%rename(setNameListNative) uscxml::Event::setNameList(const std::map<std::string, Data>&);
%rename(setParamsNative) uscxml::Event::setParams(const std::multimap<std::string, Data>&);
%javamethodmodifiers uscxml::Event::getNameList() "private";
diff --git a/src/bindings/swig/php/CMakeLists.txt b/src/bindings/swig/php/CMakeLists.txt
new file mode 100644
index 0000000..802f3a2
--- /dev/null
+++ b/src/bindings/swig/php/CMakeLists.txt
@@ -0,0 +1,100 @@
+# generate PHP module
+
+find_package(PHP5)
+if(PHP5_FOUND)
+ include_directories(${PHP5_INCLUDE_PATH})
+else()
+ message(STATUS "No PHP5 libraries found - not building php module")
+ return()
+endif()
+
+# copied from cmake's FindPHP4.cmake and adapted
+if(APPLE)
+ # this is a hack for now
+ set(PHP_MODULE_CXX_FLAGS "${CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS} -Wl")
+ foreach(symbol
+ __efree
+ __emalloc
+ __estrdup
+ __estrndup
+ __object_init
+ __object_init_ex
+ __zend_get_parameters_array_ex
+ __zend_list_find
+ __zval_copy_ctor
+ __zval_copy_ctor_func
+ _add_property_zval_ex
+ _alloc_globals
+ _compiler_globals
+ _convert_to_double
+ _convert_to_long
+ _convert_to_boolean
+ __convert_to_string
+ _gc_remove_zval_from_buffer
+ _call_user_function
+ _php_sprintf
+ _executor_globals
+ _zend_get_constant
+ _zend_lookup_class
+ _zend_register_long_constant
+ _zval_is_true
+ _zend_error
+ _zend_hash_find
+ __zend_hash_add_or_update
+ _zend_register_internal_class_ex
+ _zend_register_list_destructors_ex
+ _zend_register_resource
+ _zend_rsrc_list_get_rsrc_type
+ _zend_wrong_param_count
+ _zend_throw_exception
+ _zval_used_for_init
+ )
+ set(PHP_MODULE_CXX_FLAGS
+ "${PHP_MODULE_CXX_FLAGS},-U,${symbol}")
+ endforeach()
+endif()
+
+#message(FATAL_ERROR "PHP_LDFLAGS: ${PHP_LDFLAGS}")
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+include_directories(${PHP_INCLUDE_DIRS})
+
+SET(CMAKE_SWIG_FLAGS "")
+
+# we need ; to produce a space with the package .. weird
+SET_SOURCE_FILES_PROPERTIES(uscxml.i PROPERTIES CPLUSPLUS ON)
+
+SWIG_ADD_MODULE(uscxmlNativePHP php5 uscxml.i)
+foreach(PHP_LIBRARY ${PHP_LIBRARIES})
+# SWIG_LINK_LIBRARIES(uscxmlNativePHP ${PHP_LIBRARY})
+endforeach()
+SWIG_LINK_LIBRARIES(uscxmlNativePHP uscxml)
+
+if (APPLE)
+ set_target_properties(uscxmlNativePHP PROPERTIES LINK_FLAGS ${PHP_MODULE_CXX_FLAGS})
+endif()
+
+set(PHP_COMPILE_FLAGS "-DSWIG")
+
+if (PHP_ZTS_ENABLED)
+ # we are only building php bindings for unices anyhow
+ set(PHP_COMPILE_FLAGS "${PHP_COMPILE_FLAGS} -DZTS")
+ set(PHP_COMPILE_FLAGS "${PHP_COMPILE_FLAGS} -DPTHREADS")
+endif()
+if (PHP_DEBUG_ENABLED)
+ set(PHP_COMPILE_FLAGS "${PHP_COMPILE_FLAGS} -DZEND_DEBUG")
+endif()
+
+ADD_CUSTOM_COMMAND(
+ TARGET uscxmlNativePHP
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy
+ ${CMAKE_CURRENT_BINARY_DIR}/uscxmlNativePHP.php
+ ${PROJECT_SOURCE_DIR}/src/bindings/swig/php/uscxmlNativePHP.php
+)
+
+set_target_properties(uscxmlNativePHP PROPERTIES COMPILE_FLAGS ${PHP_COMPILE_FLAGS})
+set_target_properties(uscxmlNativePHP PROPERTIES FOLDER "Bindings")
+
+set(USCXML_LANGUAGE_BINDINGS "php ${USCXML_LANGUAGE_BINDINGS}")
+set(USCXML_LANGUAGE_BINDINGS ${USCXML_LANGUAGE_BINDINGS} PARENT_SCOPE)
diff --git a/src/bindings/swig/php/test.php b/src/bindings/swig/php/test.php
new file mode 100644
index 0000000..739c6a1
--- /dev/null
+++ b/src/bindings/swig/php/test.php
@@ -0,0 +1,85 @@
+<?php
+
+require_once('uscxmlNativePHP.php');
+
+// $exts = get_loaded_extensions();
+// foreach ($exts as $e)
+// {
+// echo "Name: ".$e." --";
+// print_r(get_extension_funcs($e));
+// }
+
+class MyMonitor extends InterpreterMonitor {
+ function beforeExitingStates($interpreter,$statesToExit) {
+ print "MyMonitor.beforeExitingStates()\n";
+ }
+ function afterExitingStates($interpreter) {
+ print "MyMonitor.afterExitingStates()\n";
+ }
+ function beforeEnteringStates($interpreter,$statesToEnter) {
+ print "MyMonitor.beforeEnteringStates()\n";
+ }
+ function afterEnteringStates($interpreter) {
+ print "MyMonitor.afterEnteringStates()\n";
+ }
+ function onStableConfiguration($interpreter) {
+ print "MyMonitor.onStableConfiguration()\n";
+ }
+ function beforeCompletion($interpreter) {
+ print "MyMonitor.beforeCompletion()\n";
+ }
+ function afterCompletion($interpreter) {
+ print "MyMonitor.afterCompletion()\n";
+ }
+ function beforeMicroStep($interpreter) {
+ print "MyMonitor.beforeMicroStep()\n";
+ }
+ function afterMicroStep($interpreter) {
+ print "MyMonitor.afterMicroStep()\n";
+ }
+ function beforeTakingTransitions($interpreter,$transitions) {
+ print "MyMonitor.beforeTakingTransitions()\n";
+ }
+}
+
+$monitor = new MyMonitor();
+
+// run interpreter in blocking mode
+$interpreter = Interpreter::fromURL('https://raw.githubusercontent.com/tklab-tud/uscxml/master/test/uscxml/test-invoked.scxml');
+$interpreter->addMonitor($monitor);
+$interpreter->interpret();
+
+// interleave interpreter execution with this thread
+$interpreter = Interpreter::fromURL('https://raw.githubusercontent.com/tklab-tud/uscxml/master/test/uscxml/test-invoked.scxml');
+$parentQueue = new ParentQueue();
+$interpreter->setParentQueue($parentQueue);
+
+while($interpreter->step() > 0) {
+ $event = $parentQueue->pop();
+ print("Name: " . $event->getName() . "\n");
+ print("Type: " . $event->getType() . "\n");
+ print("Origin: " . $event->getOrigin() . "\n");
+ print("OriginType: " . $event->getOriginType() . "\n");
+ print("Content " . strlen($event->getContent()) . " bytes: \n'" . $event->getContent() . "'\n");
+
+ $namelist = $event->getNameList();
+ print("Namelist ".$namelist->size()." elements: \n");
+ $keys = $event->getNameListKeys();
+ for ($i = 0; $i < $keys->size(); $i++) {
+ print($keys->get($i) . "\t" . Data::toJSON($namelist->get($keys->get($i))) . "\n");
+ }
+
+ $params = $event->getParamMap();
+ print("Params ". $params->size() ." elements: \n");
+ $keys = $event->getParamMapKeys();
+ for ($i = 0; $i < $keys->size(); $i++) {
+ print($keys->get($i)."\n");
+ $paramList = $params->get($keys->get($i));
+ for ($j = 0; $j < $paramList->size(); $j++) {
+ print("\t" . Data::toJSON($paramList->get($i)) . "\n");
+ }
+ }
+
+}
+
+?> \ No newline at end of file
diff --git a/src/bindings/swig/php/uscxml.i b/src/bindings/swig/php/uscxml.i
new file mode 100644
index 0000000..d737f96
--- /dev/null
+++ b/src/bindings/swig/php/uscxml.i
@@ -0,0 +1,406 @@
+%module(directors="1", allprotected="1") uscxmlNativePHP
+
+// provide a macro for the header files
+#define SWIGIMPORTED 1
+
+%include <stl.i>
+%include <std_map.i>
+%include <std_string.i>
+%include <inttypes.i>
+%include "../stl_set.i"
+%include "../stl_list.i"
+
+//%include <boost_shared_ptr.i>
+
+// these are needed at least for the templates to work
+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;
+typedef uscxml::DataModelExtension DataModelExtension;
+typedef uscxml::ExecutableContent ExecutableContent;
+typedef uscxml::InvokerImpl InvokerImpl;
+typedef uscxml::IOProcessorImpl IOProcessorImpl;
+typedef uscxml::DataModelImpl DataModelImpl;
+typedef uscxml::ExecutableContentImpl ExecutableContentImpl;
+typedef uscxml::InterpreterIssue InterpreterIssue;
+
+%feature("director") uscxml::WrappedInvoker;
+%feature("director") uscxml::WrappedDataModel;
+%feature("director") uscxml::WrappedDataModelExtension;
+%feature("director") uscxml::WrappedIOProcessor;
+%feature("director") uscxml::WrappedExecutableContent;
+%feature("director") uscxml::WrappedInterpreterMonitor;
+
+// disable warning related to unknown base class
+#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);
+
+%rename(equals) operator==; // signature is wrong, still useful
+%rename(isValid) operator bool;
+
+//**************************************************
+// This ends up in the generated wrapper code
+//**************************************************
+
+%{
+
+#include "../../../uscxml/Message.h"
+#include "../../../uscxml/Factory.h"
+#include "../../../uscxml/Interpreter.h"
+#include "../../../uscxml/concurrency/BlockingQueue.h"
+#include "../../../uscxml/server/HTTPServer.h"
+//#include "../../../uscxml/debug/DebuggerServlet.h"
+
+#include "../wrapped/WrappedInvoker.h"
+#include "../wrapped/WrappedDataModel.h"
+#include "../wrapped/WrappedExecutableContent.h"
+#include "../wrapped/WrappedIOProcessor.h"
+#include "../wrapped/WrappedInterpreterMonitor.h"
+
+using namespace uscxml;
+using namespace Arabica::DOM;
+
+// 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/WrappedExecutableContent.cpp"
+#include "../wrapped/WrappedIOProcessor.cpp"
+#include "../wrapped/WrappedInterpreterMonitor.cpp"
+
+%}
+
+%insert("begin") %{
+void*** tsrm_ls;
+%}
+
+#if 0
+%define WRAP_THROW_EXCEPTION( MATCH )
+%javaexception("org.uscxml.InterpreterException") MATCH {
+ try {
+ $action
+ }
+ catch ( uscxml::Event& e ) {
+ jclass eclass = jenv->FindClass("org/uscxml/InterpreterException");
+ if ( eclass ) {
+ std::stringstream ss;
+ ss << std::endl << e;
+ jenv->ThrowNew( eclass, ss.str().c_str() );
+ }
+ }
+}
+%enddef
+
+WRAP_THROW_EXCEPTION(uscxml::Interpreter::fromXML);
+WRAP_THROW_EXCEPTION(uscxml::Interpreter::fromURL);
+WRAP_THROW_EXCEPTION(uscxml::Interpreter::step);
+WRAP_THROW_EXCEPTION(uscxml::Interpreter::interpret);
+#endif
+
+%define WRAP_HASHCODE( CLASSNAME )
+%extend CLASSNAME {
+ virtual int hashCode() {
+/* std::cout << "Calc hashcode as " << (int)(size_t)self->getImpl().get() << std::endl << std::flush;*/
+ return (int)(size_t)self->getImpl().get();
+ }
+};
+%enddef
+
+%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);
+WRAP_TO_STRING(uscxml::InterpreterIssue);
+
+WRAP_HASHCODE(uscxml::Interpreter);
+
+%include "../uscxml_ignores.i"
+
+// bytearray for Blob::data
+// see: http://stackoverflow.com/questions/9934059/swig-technique-to-wrap-unsigned-binary-data
+
+%apply (char *STRING, size_t LENGTH) { (const char* data, size_t size) };
+
+#if 0
+%typemap(jni) char* getData "jbyteArray"
+%typemap(jtype) char* getData "byte[]"
+%typemap(jstype) char* getData "byte[]"
+%typemap(javaout) char* getData {
+ return $jnicall;
+}
+
+%typemap(out) char* getData {
+ $result = JCALL1(NewByteArray, jenv, ((uscxml::Blob const *)arg1)->getSize());
+ JCALL4(SetByteArrayRegion, jenv, $result, 0, ((uscxml::Blob const *)arg1)->getSize(), (jbyte *)$1);
+}
+#endif
+
+//***********************************************
+// Beautify important classes
+//***********************************************
+
+#if 0
+%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";
+
+%javamethodmodifiers uscxml::Blob::setData(const char* data, size_t length) "private";
+%javamethodmodifiers uscxml::Blob::setMimeType(const std::string& mimeType) "private";
+#endif
+
+%include "../uscxml_beautify.i"
+
+
+%typemap(javaimports) uscxml::Interpreter %{
+import java.util.Map;
+import java.util.HashMap;
+import java.util.List;
+import java.util.LinkedList;
+import java.net.URL;
+%}
+
+%typemap(javacode) uscxml::Interpreter %{
+ public static Interpreter fromURL(URL uri) throws org.uscxml.InterpreterException {
+ return Interpreter.fromURL(uri.toString());
+ }
+
+ 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;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other instanceof Interpreter) {
+ return equals((Interpreter)other);
+ }
+ return hashCode() == other.hashCode();
+ }
+%}
+
+#if 0
+%rename(getCompoundNative) uscxml::Data::getCompound();
+%rename(getArrayNative) uscxml::Data::getArray();
+%rename(setCompoundNative) uscxml::Data::setCompound(const std::map<std::string, Data>&);
+%rename(setArrayNative) uscxml::Data::setArray(const std::list<Data>&);
+%javamethodmodifiers uscxml::Data::getCompound() "private";
+%javamethodmodifiers uscxml::Data::getArray() "private";
+%javamethodmodifiers uscxml::Data::setCompound(const std::map<std::string, Data>&) "private";
+%javamethodmodifiers uscxml::Data::setArray(const std::list<Data>&) "private";
+%javamethodmodifiers uscxml::Data::getCompoundKeys() "private";
+#endif
+
+%typemap(javaimports) uscxml::Data %{
+import java.util.Map;
+import java.util.HashMap;
+import java.util.List;
+import java.util.LinkedList;
+%}
+
+%typemap(javacode) uscxml::Data %{
+ public Data(byte[] data, String mimeType) {
+ this(uscxmlNativeJavaJNI.new_Data__SWIG_0(), true);
+ setBinary(new Blob(data, mimeType));
+ }
+
+ public Data(Map<String, Data> compound) {
+ this(uscxmlNativeJavaJNI.new_Data__SWIG_0(), true);
+ setCompound(compound);
+ }
+
+ public Data(List<Data> array) {
+ this(uscxmlNativeJavaJNI.new_Data__SWIG_0(), true);
+ setArray(array);
+ }
+
+ public Map<String, Data> getCompound() {
+ Map<String, Data> compound = new HashMap<String, Data>();
+ DataMap dataMap = getCompoundNative();
+ StringVector dataMapKeys = getCompoundKeys();
+ for (int i = 0; i < dataMapKeys.size(); i++) {
+ compound.put(dataMapKeys.get(i), dataMap.get(dataMapKeys.get(i)));
+ }
+ return compound;
+ }
+
+ public void setCompound(Map<String, Data> compound) {
+ DataMap dataMap = new DataMap();
+ for (String key : compound.keySet()) {
+ dataMap.set(key, compound.get(key));
+ }
+ setCompoundNative(dataMap);
+ }
+
+ public List<Data> getArray() {
+ List<Data> array = new LinkedList<Data>();
+ DataList dataList = getArrayNative();
+ for (int i = 0; i < dataList.size(); i++) {
+ array.add(dataList.get(i));
+ }
+ return array;
+ }
+
+ public void setArray(List<Data> array) {
+ DataList dataList = new DataList();
+ for (Data data : array) {
+ dataList.add(data);
+ }
+ setArrayNative(dataList);
+ }
+
+%}
+
+#if 0
+%rename(getNameListNative) uscxml::Event::getNameList();
+%rename(getParamsNative) uscxml::Event::getParams();
+%rename(setNameListNative) uscxml::Event::setNameList(const std::map<std::string, Data>&);
+%rename(setParamsNative) uscxml::Event::setParams(const std::multimap<std::string, Data>&);
+%javamethodmodifiers uscxml::Event::getNameList() "private";
+%javamethodmodifiers uscxml::Event::getNameListKeys() "private";
+%javamethodmodifiers uscxml::Event::getParams() "private";
+%javamethodmodifiers uscxml::Event::setNameList(const std::map<std::string, Data>&) "private";
+%javamethodmodifiers uscxml::Event::setParams(const std::multimap<std::string, Data>&) "private";
+#endif
+
+%typemap(javaimports) uscxml::Event %{
+import java.util.Map;
+import java.util.HashMap;
+import java.util.List;
+import java.util.LinkedList;
+%}
+
+%typemap(javacode) uscxml::Event %{
+ public Map<String, List<Data>> getParams() {
+ Map<String, List<Data>> params = new HashMap<String, List<Data>>();
+ ParamMap paramMap = getParamMap();
+ StringVector paramMapKeys = getParamMapKeys();
+
+ for (int i = 0; i < paramMapKeys.size(); i++) {
+ String key = paramMapKeys.get(i);
+ DataList dataList = paramMap.get(key);
+
+ for (int j = 0; j < dataList.size(); j++) {
+ Data data = dataList.get(j);
+ if (!params.containsKey(key))
+ params.put(key, new LinkedList<Data>());
+ params.get(key).add(data);
+ }
+ }
+ return params;
+ }
+
+ public void setParams(Map<String, List<Data>> params) {
+ ParamMap paramMap = new ParamMap();
+ for (String key : params.keySet()) {
+ DataList datalist = new DataList();
+ for (Data data : params.get(key)) {
+ datalist.add(data);
+ }
+ paramMap.set(key, datalist);
+ }
+ setParamMap(paramMap);
+ }
+
+ public Map<String, Data> getNameList() {
+ Map<String, Data> namelist = new HashMap<String, Data>();
+ StringVector nameMapKeys = getNameListKeys();
+ DataMap nameMap = getNameListNative();
+
+ for (int i = 0; i < nameMapKeys.size(); i++) {
+ namelist.put(nameMapKeys.get(i), nameMap.get(nameMapKeys.get(i)));
+ }
+ return namelist;
+ }
+
+ public void setNameList(Map<String, Data> namelist) {
+ DataMap nameListMap = new DataMap();
+ for (String key : namelist.keySet()) {
+ nameListMap.set(key, namelist.get(key));
+ }
+ setNameListNative(nameListMap);
+ }
+%}
+
+
+//***********************************************
+// Parse the header file to generate wrappers
+//***********************************************
+
+%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/EventHandler.h"
+%include "../../../uscxml/plugins/ExecutableContent.h"
+%include "../../../uscxml/plugins/Invoker.h"
+%include "../../../uscxml/plugins/IOProcessor.h"
+
+%include "../wrapped/WrappedInvoker.h"
+%include "../wrapped/WrappedDataModel.h"
+%include "../wrapped/WrappedExecutableContent.h"
+%include "../wrapped/WrappedIOProcessor.h"
+%include "../wrapped/WrappedInterpreterMonitor.h"
+
+
+%template(IssueList) std::list<uscxml::InterpreterIssue>;
+%template(DataList) std::list<uscxml::Data>;
+%template(DataMap) std::map<std::string, uscxml::Data>;
+%template(StringSet) std::set<std::string>;
+%template(StringVector) std::vector<std::string>;
+%template(StringList) std::list<std::string>;
+%template(ParamMap) std::map<std::string, std::list<uscxml::Data> >;
+%template(IOProcMap) std::map<std::string, IOProcessor>;
+%template(InvokerMap) std::map<std::string, Invoker>;
+%template(ParentQueue) uscxml::concurrency::BlockingQueue<uscxml::SendRequest>;
diff --git a/src/bindings/swig/php/uscxmlNativePHP.php b/src/bindings/swig/php/uscxmlNativePHP.php
new file mode 100644
index 0000000..12757d3
--- /dev/null
+++ b/src/bindings/swig/php/uscxmlNativePHP.php
@@ -0,0 +1,3110 @@
+<?php
+
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 3.0.5
+ *
+ * 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
+ * changes to this file unless you know what you are doing--modify the SWIG
+ * interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+// Try to load our extension if it's not already loaded.
+if (!extension_loaded('uscxmlNativePHP')) {
+ if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
+ if (!dl('php_uscxmlNativePHP.dll')) return;
+ } else {
+ // PHP_SHLIB_SUFFIX gives 'dylib' on MacOS X but modules are 'so'.
+ if (PHP_SHLIB_SUFFIX === 'dylib') {
+ if (!dl('uscxmlNativePHP.so')) return;
+ } else {
+ if (!dl('uscxmlNativePHP.'.PHP_SHLIB_SUFFIX)) return;
+ }
+ }
+}
+
+
+
+abstract class uscxmlNativePHP {
+ const SWIGIMPORTED = SWIGIMPORTED;
+
+ static function imaxabs($n) {
+ return imaxabs($n);
+ }
+
+ static function imaxdiv($numer,$denom) {
+ $r=imaxdiv($numer,$denom);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new imaxdiv_t($r);
+ }
+ return $r;
+ }
+
+ static function strtoimax($nptr,$endptr,$base) {
+ return strtoimax($nptr,$endptr,$base);
+ }
+
+ static function strtoumax($nptr,$endptr,$base) {
+ return strtoumax($nptr,$endptr,$base);
+ }
+
+ const CAN_NOTHING = 0;
+
+ const CAN_BASIC_HTTP = 1;
+
+ const CAN_GENERIC_HTTP = 2;
+
+ const USCXML_DESTROYED = -2;
+
+ const USCXML_FINISHED = -1;
+
+ const USCXML_IDLE = 0;
+
+ const USCXML_INSTANTIATED = 1;
+
+ const USCXML_MICROSTEPPED = 2;
+
+ const USCXML_MACROSTEPPED = 4;
+
+ static function _dataIndentation_set($_dataIndentation) {
+ _dataIndentation_set($_dataIndentation);
+ }
+
+ static function _dataIndentation_get() {
+ return _dataIndentation_get();
+ }
+}
+
+/* PHP Proxy Classes */
+class imaxdiv_t {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'quot') return imaxdiv_t_quot_set($this->_cPtr,$value);
+ if ($var === 'rem') return imaxdiv_t_rem_set($this->_cPtr,$value);
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'quot') return imaxdiv_t_quot_get($this->_cPtr);
+ if ($var === 'rem') return imaxdiv_t_rem_get($this->_cPtr);
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if (function_exists('imaxdiv_t_'.$var.'_get')) return true;
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_imaxdiv_t') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_imaxdiv_t();
+ }
+}
+
+class Factory {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function __construct($parentFactory_or_pluginPath,$parentFactory=null) {
+ if (is_resource($parentFactory_or_pluginPath) && get_resource_type($parentFactory_or_pluginPath) === '_p_uscxml__Factory') {
+ $this->_cPtr=$parentFactory_or_pluginPath;
+ return;
+ }
+ switch (func_num_args()) {
+ case 1: $this->_cPtr=new_Factory($parentFactory_or_pluginPath); break;
+ default: $this->_cPtr=new_Factory($parentFactory_or_pluginPath,$parentFactory);
+ }
+ }
+
+ function registerIOProcessor($ioProcessor) {
+ Factory_registerIOProcessor($this->_cPtr,$ioProcessor);
+ }
+
+ function registerDataModel($dataModel) {
+ Factory_registerDataModel($this->_cPtr,$dataModel);
+ }
+
+ function registerInvoker($invoker) {
+ Factory_registerInvoker($this->_cPtr,$invoker);
+ }
+
+ function registerExecutableContent($executableContent) {
+ Factory_registerExecutableContent($this->_cPtr,$executableContent);
+ }
+
+ function hasDataModel($type) {
+ return Factory_hasDataModel($this->_cPtr,$type);
+ }
+
+ function hasIOProcessor($type) {
+ return Factory_hasIOProcessor($this->_cPtr,$type);
+ }
+
+ function hasInvoker($type) {
+ return Factory_hasInvoker($this->_cPtr,$type);
+ }
+
+ function hasExecutableContent($localName,$nameSpace) {
+ return Factory_hasExecutableContent($this->_cPtr,$localName,$nameSpace);
+ }
+
+ function listComponents() {
+ Factory_listComponents($this->_cPtr);
+ }
+
+ static function getInstance() {
+ $r=Factory_getInstance();
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Factory($r);
+ }
+ return $r;
+ }
+
+ static function setDefaultPluginPath($path) {
+ Factory_setDefaultPluginPath($path);
+ }
+
+ static function getDefaultPluginPath() {
+ return Factory_getDefaultPluginPath();
+ }
+}
+
+class InterpreterOptions {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ $func = 'InterpreterOptions_'.$var.'_set';
+ if (function_exists($func)) return call_user_func($func,$this->_cPtr,$value);
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ $func = 'InterpreterOptions_'.$var.'_get';
+ if (function_exists($func)) return call_user_func($func,$this->_cPtr);
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if (function_exists('InterpreterOptions_'.$var.'_get')) return true;
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_uscxml__InterpreterOptions') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_InterpreterOptions();
+ }
+
+ function isValid() {
+ return InterpreterOptions_isValid($this->_cPtr);
+ }
+
+ static function printUsageAndExit($progName) {
+ InterpreterOptions_printUsageAndExit($progName);
+ }
+
+ function getCapabilities() {
+ return InterpreterOptions_getCapabilities($this->_cPtr);
+ }
+}
+
+class NameSpaceInfo {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_uscxml__NameSpaceInfo') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_NameSpaceInfo();
+ }
+
+ function getXMLPrefixForNS($ns) {
+ return NameSpaceInfo_getXMLPrefixForNS($this->_cPtr,$ns);
+ }
+}
+
+class Interpreter {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ static function fromXML($xml,$sourceURL) {
+ $r=Interpreter_fromXML($xml,$sourceURL);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Interpreter($r);
+ }
+ return $r;
+ }
+
+ static function fromURL($URL) {
+ $r=Interpreter_fromURL($URL);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Interpreter($r);
+ }
+ return $r;
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_uscxml__Interpreter') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_Interpreter();
+ }
+
+ function isValid() {
+ return Interpreter_isValid($this->_cPtr);
+ }
+
+ function equals($other) {
+ return Interpreter_equals($this->_cPtr,$other);
+ }
+
+ function writeTo($stream) {
+ Interpreter_writeTo($this->_cPtr,$stream);
+ }
+
+ function reset() {
+ Interpreter_reset($this->_cPtr);
+ }
+
+ function interpret() {
+ Interpreter_interpret($this->_cPtr);
+ }
+
+ function step($waitForMS_or_blocking=null) {
+ switch (func_num_args()) {
+ case 0: $r=Interpreter_step($this->_cPtr); break;
+ default: $r=Interpreter_step($this->_cPtr,$waitForMS_or_blocking);
+ }
+ return $r;
+ }
+
+ function validate() {
+ $r=Interpreter_validate($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new IssueList($r);
+ }
+ return $r;
+ }
+
+ function getState() {
+ return Interpreter_getState($this->_cPtr);
+ }
+
+ function addMonitor($monitor) {
+ Interpreter_addMonitor($this->_cPtr,$monitor);
+ }
+
+ function removeMonitor($monitor) {
+ Interpreter_removeMonitor($this->_cPtr,$monitor);
+ }
+
+ function setSourceURL($sourceURL) {
+ Interpreter_setSourceURL($this->_cPtr,$sourceURL);
+ }
+
+ function getSourceURL() {
+ return Interpreter_getSourceURL($this->_cPtr);
+ }
+
+ function getBaseURL($xpathExpr=null) {
+ switch (func_num_args()) {
+ case 0: $r=Interpreter_getBaseURL($this->_cPtr); break;
+ default: $r=Interpreter_getBaseURL($this->_cPtr,$xpathExpr);
+ }
+ return $r;
+ }
+
+ function setNameSpaceInfo($nsInfo) {
+ Interpreter_setNameSpaceInfo($this->_cPtr,$nsInfo);
+ }
+
+ function getNameSpaceInfo() {
+ $r=Interpreter_getNameSpaceInfo($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new NameSpaceInfo($r);
+ }
+ return $r;
+ }
+
+ function getCmdLineOptions() {
+ $r=Interpreter_getCmdLineOptions($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Data($r);
+ }
+ return $r;
+ }
+
+ function getDataModel() {
+ $r=Interpreter_getDataModel($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new NativeDataModel($r);
+ }
+ return $r;
+ }
+
+ function getIOProcessorsNative() {
+ $r=Interpreter_getIOProcessorsNative($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new IOProcMap($r);
+ }
+ return $r;
+ }
+
+ function getInvokersNative() {
+ $r=Interpreter_getInvokersNative($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new InvokerMap($r);
+ }
+ return $r;
+ }
+
+ function addDataModelExtension($ext) {
+ Interpreter_addDataModelExtension($this->_cPtr,$ext);
+ }
+
+ function setParentQueue($parentQueue) {
+ Interpreter_setParentQueue($this->_cPtr,$parentQueue);
+ }
+
+ function setFactory($factory) {
+ Interpreter_setFactory($this->_cPtr,$factory);
+ }
+
+ function getFactory() {
+ $r=Interpreter_getFactory($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Factory($r);
+ }
+ return $r;
+ }
+
+ function receiveInternal($event) {
+ Interpreter_receiveInternal($this->_cPtr,$event);
+ }
+
+ function receive($event,$toFront=false) {
+ Interpreter_receive($this->_cPtr,$event,$toFront);
+ }
+
+ function getCurrentEvent() {
+ $r=Interpreter_getCurrentEvent($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Event($r);
+ }
+ return $r;
+ }
+
+ function isInState($stateId) {
+ return Interpreter_isInState($this->_cPtr,$stateId);
+ }
+
+ function setInitalConfiguration($states) {
+ Interpreter_setInitalConfiguration($this->_cPtr,$states);
+ }
+
+ function setCapabilities($capabilities) {
+ Interpreter_setCapabilities($this->_cPtr,$capabilities);
+ }
+
+ function setName($name) {
+ Interpreter_setName($this->_cPtr,$name);
+ }
+
+ function getName() {
+ return Interpreter_getName($this->_cPtr);
+ }
+
+ function getSessionId() {
+ return Interpreter_getSessionId($this->_cPtr);
+ }
+
+ function hasLegalConfiguration() {
+ return Interpreter_hasLegalConfiguration($this->_cPtr);
+ }
+
+ function isLegalConfiguration($config) {
+ return Interpreter_isLegalConfiguration($this->_cPtr,$config);
+ }
+
+ function hashCode() {
+ return Interpreter_hashCode($this->_cPtr);
+ }
+
+ function addIOProcessor($ioProc) {
+ Interpreter_addIOProcessor($this->_cPtr,$ioProc);
+ }
+
+ function setDataModel($dataModel) {
+ Interpreter_setDataModel($this->_cPtr,$dataModel);
+ }
+
+ function setInvoker($invokeId,$invoker) {
+ Interpreter_setInvoker($this->_cPtr,$invokeId,$invoker);
+ }
+
+ function getBasicConfiguration() {
+ $r=Interpreter_getBasicConfiguration($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new StringVector($r);
+ }
+ return $r;
+ }
+
+ function getConfiguration() {
+ $r=Interpreter_getConfiguration($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new StringVector($r);
+ }
+ return $r;
+ }
+
+ function getIOProcessorKeys() {
+ $r=Interpreter_getIOProcessorKeys($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new StringVector($r);
+ }
+ return $r;
+ }
+
+ function getInvokerKeys() {
+ $r=Interpreter_getInvokerKeys($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new StringVector($r);
+ }
+ return $r;
+ }
+}
+
+class NativeInterpreterMonitor {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function beforeProcessingEvent($interpreter,$event) {
+ NativeInterpreterMonitor_beforeProcessingEvent($this->_cPtr,$interpreter,$event);
+ }
+
+ function beforeMicroStep($interpreter) {
+ NativeInterpreterMonitor_beforeMicroStep($this->_cPtr,$interpreter);
+ }
+
+ function afterMicroStep($interpreter) {
+ NativeInterpreterMonitor_afterMicroStep($this->_cPtr,$interpreter);
+ }
+
+ function onStableConfiguration($interpreter) {
+ NativeInterpreterMonitor_onStableConfiguration($this->_cPtr,$interpreter);
+ }
+
+ function beforeCompletion($interpreter) {
+ NativeInterpreterMonitor_beforeCompletion($this->_cPtr,$interpreter);
+ }
+
+ function afterCompletion($interpreter) {
+ NativeInterpreterMonitor_afterCompletion($this->_cPtr,$interpreter);
+ }
+
+ function reportIssue($interpreter,$issue) {
+ NativeInterpreterMonitor_reportIssue($this->_cPtr,$interpreter,$issue);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_uscxml__InterpreterMonitor') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_NativeInterpreterMonitor();
+ }
+}
+
+class StateTransitionMonitor extends NativeInterpreterMonitor {
+ public $_cPtr=null;
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ NativeInterpreterMonitor::__set($var,$value);
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return NativeInterpreterMonitor::__get($var);
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return NativeInterpreterMonitor::__isset($var);
+ }
+
+ function beforeTakingTransition($interpreter,$transition,$moreComing) {
+ StateTransitionMonitor_beforeTakingTransition($this->_cPtr,$interpreter,$transition,$moreComing);
+ }
+
+ function onStableConfiguration($interpreter) {
+ StateTransitionMonitor_onStableConfiguration($this->_cPtr,$interpreter);
+ }
+
+ function beforeProcessingEvent($interpreter,$event) {
+ StateTransitionMonitor_beforeProcessingEvent($this->_cPtr,$interpreter,$event);
+ }
+
+ function beforeExitingState($interpreter,$state,$moreComing) {
+ StateTransitionMonitor_beforeExitingState($this->_cPtr,$interpreter,$state,$moreComing);
+ }
+
+ function beforeEnteringState($interpreter,$state,$moreComing) {
+ StateTransitionMonitor_beforeEnteringState($this->_cPtr,$interpreter,$state,$moreComing);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_uscxml__StateTransitionMonitor') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_StateTransitionMonitor();
+ }
+}
+
+class HTTPServer {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+ function __construct($h) {
+ $this->_cPtr=$h;
+ }
+
+ const HTTPS = 0;
+
+ const HTTP = HTTPServer_HTTP;
+
+ const WebSockets = HTTPServer_WebSockets;
+
+ static function getInstance($port=null,$wsPort=null,$sslConf=null) {
+ switch (func_num_args()) {
+ case 0: $r=HTTPServer_getInstance(); break;
+ case 1: $r=HTTPServer_getInstance($port); break;
+ default: $r=HTTPServer_getInstance($port,$wsPort,$sslConf);
+ }
+ if (!is_resource($r)) return $r;
+ return new HTTPServer($r);
+ }
+
+ static function getBaseURL($type=null) {
+ switch (func_num_args()) {
+ case 0: $r=HTTPServer_getBaseURL(); break;
+ default: $r=HTTPServer_getBaseURL($type);
+ }
+ return $r;
+ }
+
+ static function registerServlet($path,$servlet) {
+ return HTTPServer_registerServlet($path,$servlet);
+ }
+
+ static function unregisterServlet($servlet) {
+ HTTPServer_unregisterServlet($servlet);
+ }
+}
+
+abstract class HTTPServlet {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+ function __construct($h) {
+ $this->_cPtr=$h;
+ }
+
+ function httpRecvRequest($request) {
+ return HTTPServlet_httpRecvRequest($this->_cPtr,$request);
+ }
+
+ function setURL($url) {
+ HTTPServlet_setURL($this->_cPtr,$url);
+ }
+
+ function canAdaptPath() {
+ return HTTPServlet_canAdaptPath($this->_cPtr);
+ }
+}
+
+abstract class WebSocketServlet {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+ function __construct($h) {
+ $this->_cPtr=$h;
+ }
+
+ function wsRecvRequest($conn,$frame) {
+ return WebSocketServlet_wsRecvRequest($this->_cPtr,$conn,$frame);
+ }
+
+ function setURL($url) {
+ WebSocketServlet_setURL($this->_cPtr,$url);
+ }
+
+ function canAdaptPath() {
+ return WebSocketServlet_canAdaptPath($this->_cPtr);
+ }
+}
+
+class InterpreterIssue {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ $func = 'InterpreterIssue_'.$var.'_set';
+ if (function_exists($func)) return call_user_func($func,$this->_cPtr,$value);
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ $func = 'InterpreterIssue_'.$var.'_get';
+ if (function_exists($func)) return call_user_func($func,$this->_cPtr);
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if (function_exists('InterpreterIssue_'.$var.'_get')) return true;
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ const USCXML_ISSUE_FATAL = 0;
+
+ const USCXML_ISSUE_WARNING = InterpreterIssue_USCXML_ISSUE_WARNING;
+
+ const USCXML_ISSUE_INFO = InterpreterIssue_USCXML_ISSUE_INFO;
+
+ function __construct($msg,$node,$severity) {
+ if (is_resource($msg) && get_resource_type($msg) === '_p_uscxml__InterpreterIssue') {
+ $this->_cPtr=$msg;
+ return;
+ }
+ $this->_cPtr=new_InterpreterIssue($msg,$node,$severity);
+ }
+
+ function toString() {
+ return InterpreterIssue_toString($this->_cPtr);
+ }
+}
+
+class Blob {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function __construct($other_or_data=null,$mimeType=null) {
+ if (is_resource($other_or_data) && get_resource_type($other_or_data) === '_p_uscxml__Blob') {
+ $this->_cPtr=$other_or_data;
+ return;
+ }
+ switch (func_num_args()) {
+ case 0: $this->_cPtr=new_Blob(); break;
+ case 1: $this->_cPtr=new_Blob($other_or_data); break;
+ default: $this->_cPtr=new_Blob($other_or_data,$mimeType);
+ }
+ }
+
+ function isValid() {
+ return Blob_isValid($this->_cPtr);
+ }
+
+ function equals($other) {
+ return Blob_equals($this->_cPtr,$other);
+ }
+
+ static function fromBase64($base64,$mimeType=null) {
+ switch (func_num_args()) {
+ case 1: $r=Blob_fromBase64($base64); break;
+ default: $r=Blob_fromBase64($base64,$mimeType);
+ }
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Blob($r);
+ }
+ return $r;
+ }
+
+ function base64() {
+ return Blob_base64($this->_cPtr);
+ }
+
+ function md5() {
+ return Blob_md5($this->_cPtr);
+ }
+
+ function getData() {
+ return Blob_getData($this->_cPtr);
+ }
+
+ function getSize() {
+ return Blob_getSize($this->_cPtr);
+ }
+
+ function getMimeType() {
+ return Blob_getMimeType($this->_cPtr);
+ }
+
+ function setMimeType($mimeType) {
+ Blob_setMimeType($this->_cPtr,$mimeType);
+ }
+}
+
+class Data {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ const VERBATIM = 0;
+
+ const INTERPRETED = Data_INTERPRETED;
+
+ function __construct($atom=null,$type=null) {
+ if (is_resource($atom) && get_resource_type($atom) === '_p_uscxml__Data') {
+ $this->_cPtr=$atom;
+ return;
+ }
+ switch (func_num_args()) {
+ case 0: $this->_cPtr=new_Data(); break;
+ case 1: $this->_cPtr=new_Data($atom); break;
+ default: $this->_cPtr=new_Data($atom,$type);
+ }
+ }
+
+ function c_empty() {
+ return Data_c_empty($this->_cPtr);
+ }
+
+ function merge($other) {
+ Data_merge($this->_cPtr,$other);
+ }
+
+ function hasKey($key) {
+ return Data_hasKey($this->_cPtr,$key);
+ }
+
+ function at($key) {
+ $r=Data_at($this->_cPtr,$key);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Data($r);
+ }
+ return $r;
+ }
+
+ function item($index) {
+ $r=Data_item($this->_cPtr,$index);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Data($r);
+ }
+ return $r;
+ }
+
+ function put($key_or_index,$data) {
+ Data_put($this->_cPtr,$key_or_index,$data);
+ }
+
+ function equals($other) {
+ return Data_equals($this->_cPtr,$other);
+ }
+
+ static function fromJSON($jsonString) {
+ $r=Data_fromJSON($jsonString);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Data($r);
+ }
+ return $r;
+ }
+
+ static function toJSON($data) {
+ return Data_toJSON($data);
+ }
+
+ static function fromXML($xmlString) {
+ $r=Data_fromXML($xmlString);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Data($r);
+ }
+ return $r;
+ }
+
+ function toXMLString() {
+ return Data_toXMLString($this->_cPtr);
+ }
+
+ function getCompound() {
+ $r=Data_getCompound($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new DataMap($r);
+ }
+ return $r;
+ }
+
+ function setCompound($compound) {
+ Data_setCompound($this->_cPtr,$compound);
+ }
+
+ function getArray() {
+ $r=Data_getArray($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new DataList($r);
+ }
+ return $r;
+ }
+
+ function setArray($array) {
+ Data_setArray($this->_cPtr,$array);
+ }
+
+ function getAtom() {
+ return Data_getAtom($this->_cPtr);
+ }
+
+ function setAtom($atom) {
+ Data_setAtom($this->_cPtr,$atom);
+ }
+
+ function getBinary() {
+ $r=Data_getBinary($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Blob($r);
+ }
+ return $r;
+ }
+
+ function setBinary($binary) {
+ Data_setBinary($this->_cPtr,$binary);
+ }
+
+ function getType() {
+ return Data_getType($this->_cPtr);
+ }
+
+ function setType($type) {
+ Data_setType($this->_cPtr,$type);
+ }
+
+ function toString() {
+ return Data_toString($this->_cPtr);
+ }
+
+ function getCompoundKeys() {
+ $r=Data_getCompoundKeys($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new StringVector($r);
+ }
+ return $r;
+ }
+
+ function getXML() {
+ return Data_getXML($this->_cPtr);
+ }
+
+ function setXML($xml) {
+ Data_setXML($this->_cPtr,$xml);
+ }
+}
+
+class Event {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ const INTERNAL = 1;
+
+ const EXTERNAL = 2;
+
+ const PLATFORM = 3;
+
+ function __construct($name=null,$type=null) {
+ if (is_resource($name) && get_resource_type($name) === '_p_uscxml__Event') {
+ $this->_cPtr=$name;
+ return;
+ }
+ switch (func_num_args()) {
+ case 0: $this->_cPtr=new_Event(); break;
+ case 1: $this->_cPtr=new_Event($name); break;
+ default: $this->_cPtr=new_Event($name,$type);
+ }
+ }
+
+ function equals($other) {
+ return Event_equals($this->_cPtr,$other);
+ }
+
+ function getName() {
+ return Event_getName($this->_cPtr);
+ }
+
+ function setName($name) {
+ Event_setName($this->_cPtr,$name);
+ }
+
+ function getEventType() {
+ return Event_getEventType($this->_cPtr);
+ }
+
+ function setEventType($type) {
+ Event_setEventType($this->_cPtr,$type);
+ }
+
+ function getOrigin() {
+ return Event_getOrigin($this->_cPtr);
+ }
+
+ function setOrigin($origin) {
+ Event_setOrigin($this->_cPtr,$origin);
+ }
+
+ function getOriginType() {
+ return Event_getOriginType($this->_cPtr);
+ }
+
+ function setOriginType($originType) {
+ Event_setOriginType($this->_cPtr,$originType);
+ }
+
+ function getDOM() {
+ return Event_getDOM($this->_cPtr);
+ }
+
+ function getRaw() {
+ return Event_getRaw($this->_cPtr);
+ }
+
+ function setRaw($raw) {
+ Event_setRaw($this->_cPtr,$raw);
+ }
+
+ function getContent() {
+ return Event_getContent($this->_cPtr);
+ }
+
+ function setContent($content) {
+ Event_setContent($this->_cPtr,$content);
+ }
+
+ function getXML() {
+ return Event_getXML($this->_cPtr);
+ }
+
+ function setXML($xml) {
+ Event_setXML($this->_cPtr,$xml);
+ }
+
+ function getSendId() {
+ return Event_getSendId($this->_cPtr);
+ }
+
+ function setSendId($sendId) {
+ Event_setSendId($this->_cPtr,$sendId);
+ }
+
+ function getInvokeId() {
+ return Event_getInvokeId($this->_cPtr);
+ }
+
+ function setInvokeId($invokeId) {
+ Event_setInvokeId($this->_cPtr,$invokeId);
+ }
+
+ function getData() {
+ $r=Event_getData($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Data($r);
+ }
+ return $r;
+ }
+
+ function setData($data) {
+ Event_setData($this->_cPtr,$data);
+ }
+
+ static function fromXML($xmlString) {
+ $r=Event_fromXML($xmlString);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Event($r);
+ }
+ return $r;
+ }
+
+ function toXMLString() {
+ return Event_toXMLString($this->_cPtr);
+ }
+
+ function getNameList() {
+ $r=Event_getNameList($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new DataMap($r);
+ }
+ return $r;
+ }
+
+ function setNameList($nameList) {
+ Event_setNameList($this->_cPtr,$nameList);
+ }
+
+ function toString() {
+ return Event_toString($this->_cPtr);
+ }
+
+ function getParamMap() {
+ $r=Event_getParamMap($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new ParamMap($r);
+ }
+ return $r;
+ }
+
+ function getParamMapKeys() {
+ $r=Event_getParamMapKeys($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new StringVector($r);
+ }
+ return $r;
+ }
+
+ function setParamMap($paramMap) {
+ Event_setParamMap($this->_cPtr,$paramMap);
+ }
+
+ function getNameListKeys() {
+ $r=Event_getNameListKeys($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new StringVector($r);
+ }
+ return $r;
+ }
+}
+
+class InvokeRequest extends Event {
+ public $_cPtr=null;
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ Event::__set($var,$value);
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return Event::__get($var);
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return Event::__isset($var);
+ }
+
+ function __construct($event=null) {
+ if (is_resource($event) && get_resource_type($event) === '_p_uscxml__InvokeRequest') {
+ $this->_cPtr=$event;
+ return;
+ }
+ switch (func_num_args()) {
+ case 0: $this->_cPtr=new_InvokeRequest(); break;
+ default: $this->_cPtr=new_InvokeRequest($event);
+ }
+ }
+
+ function getType() {
+ return InvokeRequest_getType($this->_cPtr);
+ }
+
+ function setType($type) {
+ InvokeRequest_setType($this->_cPtr,$type);
+ }
+
+ function getSource() {
+ return InvokeRequest_getSource($this->_cPtr);
+ }
+
+ function setSource($src) {
+ InvokeRequest_setSource($this->_cPtr,$src);
+ }
+
+ function isAutoForwarded() {
+ return InvokeRequest_isAutoForwarded($this->_cPtr);
+ }
+
+ function setAutoForwarded($autoForward) {
+ InvokeRequest_setAutoForwarded($this->_cPtr,$autoForward);
+ }
+
+ function toXMLString() {
+ return InvokeRequest_toXMLString($this->_cPtr);
+ }
+
+ function toString() {
+ return InvokeRequest_toString($this->_cPtr);
+ }
+}
+
+class SendRequest extends Event {
+ public $_cPtr=null;
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ Event::__set($var,$value);
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return Event::__get($var);
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return Event::__isset($var);
+ }
+
+ function __construct($event=null) {
+ if (is_resource($event) && get_resource_type($event) === '_p_uscxml__SendRequest') {
+ $this->_cPtr=$event;
+ return;
+ }
+ switch (func_num_args()) {
+ case 0: $this->_cPtr=new_SendRequest(); break;
+ default: $this->_cPtr=new_SendRequest($event);
+ }
+ }
+
+ function getTarget() {
+ return SendRequest_getTarget($this->_cPtr);
+ }
+
+ function setTarget($target) {
+ SendRequest_setTarget($this->_cPtr,$target);
+ }
+
+ function getType() {
+ return SendRequest_getType($this->_cPtr);
+ }
+
+ function setType($type) {
+ SendRequest_setType($this->_cPtr,$type);
+ }
+
+ function getDelayMs() {
+ return SendRequest_getDelayMs($this->_cPtr);
+ }
+
+ function setDelayMs($delayMs) {
+ SendRequest_setDelayMs($this->_cPtr,$delayMs);
+ }
+
+ function toXMLString() {
+ return SendRequest_toXMLString($this->_cPtr);
+ }
+
+ function toString() {
+ return SendRequest_toString($this->_cPtr);
+ }
+}
+
+abstract class NativeDataModelExtension {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+ function __construct($h) {
+ $this->_cPtr=$h;
+ }
+
+ function provides() {
+ return NativeDataModelExtension_provides($this->_cPtr);
+ }
+
+ function getValueOf($member) {
+ $r=NativeDataModelExtension_getValueOf($this->_cPtr,$member);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Data($r);
+ }
+ return $r;
+ }
+
+ function setValueOf($member,$data) {
+ NativeDataModelExtension_setValueOf($this->_cPtr,$member,$data);
+ }
+}
+
+abstract class DataModelImpl {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+ function __construct($h) {
+ $this->_cPtr=$h;
+ }
+
+ function getNames() {
+ $r=DataModelImpl_getNames($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new StringList($r);
+ }
+ return $r;
+ }
+
+ function validate($location,$schema) {
+ return DataModelImpl_validate($this->_cPtr,$location,$schema);
+ }
+
+ function isLocation($expr) {
+ return DataModelImpl_isLocation($this->_cPtr,$expr);
+ }
+
+ function isValidSyntax($expr) {
+ return DataModelImpl_isValidSyntax($this->_cPtr,$expr);
+ }
+
+ function setEvent($event) {
+ DataModelImpl_setEvent($this->_cPtr,$event);
+ }
+
+ function getStringAsData($content) {
+ $r=DataModelImpl_getStringAsData($this->_cPtr,$content);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Data($r);
+ }
+ return $r;
+ }
+
+ function getLength($expr) {
+ return DataModelImpl_getLength($this->_cPtr,$expr);
+ }
+
+ function setForeach($item,$array,$index,$iteration) {
+ DataModelImpl_setForeach($this->_cPtr,$item,$array,$index,$iteration);
+ }
+
+ function pushContext() {
+ DataModelImpl_pushContext($this->_cPtr);
+ }
+
+ function popContext() {
+ DataModelImpl_popContext($this->_cPtr);
+ }
+
+ function evalAsString($expr) {
+ return DataModelImpl_evalAsString($this->_cPtr,$expr);
+ }
+
+ function evalAsBool($scriptNode_or_expr,$expr=null) {
+ switch (func_num_args()) {
+ case 1: $r=DataModelImpl_evalAsBool($this->_cPtr,$scriptNode_or_expr); break;
+ default: $r=DataModelImpl_evalAsBool($this->_cPtr,$scriptNode_or_expr,$expr);
+ }
+ return $r;
+ }
+
+ function isDeclared($expr) {
+ return DataModelImpl_isDeclared($this->_cPtr,$expr);
+ }
+
+ function addExtension($ext) {
+ DataModelImpl_addExtension($this->_cPtr,$ext);
+ }
+
+ function andExpressions($arg1) {
+ return DataModelImpl_andExpressions($this->_cPtr,$arg1);
+ }
+}
+
+class NativeDataModel {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_uscxml__DataModel') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_NativeDataModel();
+ }
+
+ function isValid() {
+ return NativeDataModel_isValid($this->_cPtr);
+ }
+
+ function equals($other) {
+ return NativeDataModel_equals($this->_cPtr,$other);
+ }
+
+ function getNames() {
+ $r=NativeDataModel_getNames($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new StringList($r);
+ }
+ return $r;
+ }
+
+ function validate($location,$schema) {
+ return NativeDataModel_validate($this->_cPtr,$location,$schema);
+ }
+
+ function isLocation($expr) {
+ return NativeDataModel_isLocation($this->_cPtr,$expr);
+ }
+
+ function isValidSyntax($expr) {
+ return NativeDataModel_isValidSyntax($this->_cPtr,$expr);
+ }
+
+ function setEvent($event) {
+ NativeDataModel_setEvent($this->_cPtr,$event);
+ }
+
+ function getStringAsData($content) {
+ $r=NativeDataModel_getStringAsData($this->_cPtr,$content);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Data($r);
+ }
+ return $r;
+ }
+
+ function pushContext() {
+ NativeDataModel_pushContext($this->_cPtr);
+ }
+
+ function popContext() {
+ NativeDataModel_popContext($this->_cPtr);
+ }
+
+ function evalAsString($expr) {
+ return NativeDataModel_evalAsString($this->_cPtr,$expr);
+ }
+
+ function evalAsBool($scriptNode,$expr) {
+ return NativeDataModel_evalAsBool($this->_cPtr,$scriptNode,$expr);
+ }
+
+ function getLength($expr) {
+ return NativeDataModel_getLength($this->_cPtr,$expr);
+ }
+
+ function setForeach($item,$array,$index,$iteration) {
+ NativeDataModel_setForeach($this->_cPtr,$item,$array,$index,$iteration);
+ }
+
+ function assign($location,$data) {
+ NativeDataModel_assign($this->_cPtr,$location,$data);
+ }
+
+ function init($location,$data) {
+ NativeDataModel_init($this->_cPtr,$location,$data);
+ }
+
+ function isDeclared($expr) {
+ return NativeDataModel_isDeclared($this->_cPtr,$expr);
+ }
+
+ function andExpressions($expressions) {
+ return NativeDataModel_andExpressions($this->_cPtr,$expressions);
+ }
+
+ function addExtension($ext) {
+ NativeDataModel_addExtension($this->_cPtr,$ext);
+ }
+}
+
+abstract class EventHandlerImpl {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+ function __construct($h) {
+ $this->_cPtr=$h;
+ }
+
+ function getNames() {
+ $r=EventHandlerImpl_getNames($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new StringList($r);
+ }
+ return $r;
+ }
+
+ function setInvokeId($invokeId) {
+ EventHandlerImpl_setInvokeId($this->_cPtr,$invokeId);
+ }
+
+ function setType($type) {
+ EventHandlerImpl_setType($this->_cPtr,$type);
+ }
+
+ function getType() {
+ return EventHandlerImpl_getType($this->_cPtr);
+ }
+
+ function getDataModelVariables() {
+ $r=EventHandlerImpl_getDataModelVariables($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Data($r);
+ }
+ return $r;
+ }
+
+ function send($req) {
+ EventHandlerImpl_send($this->_cPtr,$req);
+ }
+
+ function returnErrorExecution($arg1) {
+ EventHandlerImpl_returnErrorExecution($this->_cPtr,$arg1);
+ }
+
+ function returnErrorCommunication($arg1) {
+ EventHandlerImpl_returnErrorCommunication($this->_cPtr,$arg1);
+ }
+
+ function returnEvent($event,$internal=false) {
+ EventHandlerImpl_returnEvent($this->_cPtr,$event,$internal);
+ }
+}
+
+class EventHandler {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function __construct($other=null) {
+ if (is_resource($other) && get_resource_type($other) === '_p_uscxml__EventHandler') {
+ $this->_cPtr=$other;
+ return;
+ }
+ switch (func_num_args()) {
+ case 0: $this->_cPtr=new_EventHandler(); break;
+ default: $this->_cPtr=new_EventHandler($other);
+ }
+ }
+
+ function getNames() {
+ $r=EventHandler_getNames($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new StringList($r);
+ }
+ return $r;
+ }
+
+ function getDataModelVariables() {
+ $r=EventHandler_getDataModelVariables($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Data($r);
+ }
+ return $r;
+ }
+
+ function send($req) {
+ EventHandler_send($this->_cPtr,$req);
+ }
+
+ function setInvokeId($invokeId) {
+ EventHandler_setInvokeId($this->_cPtr,$invokeId);
+ }
+
+ function setType($type) {
+ EventHandler_setType($this->_cPtr,$type);
+ }
+
+ function getType() {
+ return EventHandler_getType($this->_cPtr);
+ }
+}
+
+abstract class ExecutableContentImpl {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+ function __construct($h) {
+ $this->_cPtr=$h;
+ }
+
+ function getLocalName() {
+ return ExecutableContentImpl_getLocalName($this->_cPtr);
+ }
+
+ function getNamespace() {
+ return ExecutableContentImpl_getNamespace($this->_cPtr);
+ }
+
+ function enterElement($node) {
+ ExecutableContentImpl_enterElement($this->_cPtr,$node);
+ }
+
+ function exitElement($node) {
+ ExecutableContentImpl_exitElement($this->_cPtr,$node);
+ }
+
+ function processChildren() {
+ return ExecutableContentImpl_processChildren($this->_cPtr);
+ }
+}
+
+class NativeExecutableContent {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_uscxml__ExecutableContent') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_NativeExecutableContent();
+ }
+
+ function isValid() {
+ return NativeExecutableContent_isValid($this->_cPtr);
+ }
+
+ function equals($other) {
+ return NativeExecutableContent_equals($this->_cPtr,$other);
+ }
+
+ function getLocalName() {
+ return NativeExecutableContent_getLocalName($this->_cPtr);
+ }
+
+ function getNamespace() {
+ return NativeExecutableContent_getNamespace($this->_cPtr);
+ }
+
+ function enterElement($node) {
+ NativeExecutableContent_enterElement($this->_cPtr,$node);
+ }
+
+ function exitElement($node) {
+ NativeExecutableContent_exitElement($this->_cPtr,$node);
+ }
+
+ function processChildren() {
+ return NativeExecutableContent_processChildren($this->_cPtr);
+ }
+}
+
+abstract class InvokerImpl extends EventHandlerImpl {
+ public $_cPtr=null;
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ EventHandlerImpl::__set($var,$value);
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return EventHandlerImpl::__get($var);
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return EventHandlerImpl::__isset($var);
+ }
+ function __construct($h) {
+ $this->_cPtr=$h;
+ }
+
+ function invoke($req) {
+ InvokerImpl_invoke($this->_cPtr,$req);
+ }
+
+ function uninvoke() {
+ InvokerImpl_uninvoke($this->_cPtr);
+ }
+
+ function deleteOnUninvoke() {
+ return InvokerImpl_deleteOnUninvoke($this->_cPtr);
+ }
+}
+
+class NativeInvoker extends EventHandler {
+ public $_cPtr=null;
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ EventHandler::__set($var,$value);
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return EventHandler::__get($var);
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return EventHandler::__isset($var);
+ }
+
+ function __construct($other=null) {
+ if (is_resource($other) && get_resource_type($other) === '_p_uscxml__Invoker') {
+ $this->_cPtr=$other;
+ return;
+ }
+ switch (func_num_args()) {
+ case 0: $this->_cPtr=new_NativeInvoker(); break;
+ default: $this->_cPtr=new_NativeInvoker($other);
+ }
+ }
+
+ function isValid() {
+ return NativeInvoker_isValid($this->_cPtr);
+ }
+
+ function equals($other) {
+ return NativeInvoker_equals($this->_cPtr,$other);
+ }
+
+ function invoke($req) {
+ NativeInvoker_invoke($this->_cPtr,$req);
+ }
+
+ function uninvoke() {
+ NativeInvoker_uninvoke($this->_cPtr);
+ }
+
+ function deleteOnUninvoke() {
+ return NativeInvoker_deleteOnUninvoke($this->_cPtr);
+ }
+}
+
+abstract class IOProcessorImpl extends EventHandlerImpl {
+ public $_cPtr=null;
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ EventHandlerImpl::__set($var,$value);
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return EventHandlerImpl::__get($var);
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return EventHandlerImpl::__isset($var);
+ }
+ function __construct($h) {
+ $this->_cPtr=$h;
+ }
+}
+
+class NativeIOProcessor extends EventHandler {
+ public $_cPtr=null;
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ EventHandler::__set($var,$value);
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return EventHandler::__get($var);
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return EventHandler::__isset($var);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_uscxml__IOProcessor') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_NativeIOProcessor();
+ }
+
+ function isValid() {
+ return NativeIOProcessor_isValid($this->_cPtr);
+ }
+
+ function equals($other) {
+ return NativeIOProcessor_equals($this->_cPtr,$other);
+ }
+}
+
+class Invoker extends InvokerImpl {
+ public $_cPtr=null;
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ InvokerImpl::__set($var,$value);
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return InvokerImpl::__get($var);
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return InvokerImpl::__isset($var);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_uscxml__WrappedInvoker') {
+ $this->_cPtr=$res;
+ return;
+ }
+ if (get_class($this) === 'Invoker') {
+ $_this = null;
+ } else {
+ $_this = $this;
+ }
+ $this->_cPtr=new_Invoker($_this);
+ }
+
+ function getNames() {
+ $r=Invoker_getNames($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new StringList($r);
+ }
+ return $r;
+ }
+
+ function getDataModelVariables() {
+ $r=Invoker_getDataModelVariables($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Data($r);
+ }
+ return $r;
+ }
+
+ function send($req) {
+ Invoker_send($this->_cPtr,$req);
+ }
+
+ function invoke($req) {
+ Invoker_invoke($this->_cPtr,$req);
+ }
+
+ function uninvoke() {
+ Invoker_uninvoke($this->_cPtr);
+ }
+
+ function deleteOnUninvoke() {
+ return Invoker_deleteOnUninvoke($this->_cPtr);
+ }
+
+ function create($interpreter) {
+ $r=Invoker_create($this->_cPtr,$interpreter);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Invoker($r);
+ }
+ return $r;
+ }
+}
+
+class DataModelExtension extends NativeDataModelExtension {
+ public $_cPtr=null;
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ NativeDataModelExtension::__set($var,$value);
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return NativeDataModelExtension::__get($var);
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return NativeDataModelExtension::__isset($var);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_uscxml__WrappedDataModelExtension') {
+ $this->_cPtr=$res;
+ return;
+ }
+ if (get_class($this) === 'DataModelExtension') {
+ $_this = null;
+ } else {
+ $_this = $this;
+ }
+ $this->_cPtr=new_DataModelExtension($_this);
+ }
+
+ function provides() {
+ return DataModelExtension_provides($this->_cPtr);
+ }
+
+ function getValueOf($member) {
+ $r=DataModelExtension_getValueOf($this->_cPtr,$member);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Data($r);
+ }
+ return $r;
+ }
+
+ function setValueOf($member,$data) {
+ DataModelExtension_setValueOf($this->_cPtr,$member,$data);
+ }
+}
+
+class DataModel extends DataModelImpl {
+ public $_cPtr=null;
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ DataModelImpl::__set($var,$value);
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return DataModelImpl::__get($var);
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return DataModelImpl::__isset($var);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_uscxml__WrappedDataModel') {
+ $this->_cPtr=$res;
+ return;
+ }
+ if (get_class($this) === 'DataModel') {
+ $_this = null;
+ } else {
+ $_this = $this;
+ }
+ $this->_cPtr=new_DataModel($_this);
+ }
+
+ function create($interpreter) {
+ $r=DataModel_create($this->_cPtr,$interpreter);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new DataModel($r);
+ }
+ return $r;
+ }
+
+ function getNames() {
+ $r=DataModel_getNames($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new StringList($r);
+ }
+ return $r;
+ }
+
+ function andExpressions($arg0) {
+ return DataModel_andExpressions($this->_cPtr,$arg0);
+ }
+
+ function validate($location,$schema) {
+ return DataModel_validate($this->_cPtr,$location,$schema);
+ }
+
+ function setEvent($event) {
+ DataModel_setEvent($this->_cPtr,$event);
+ }
+
+ function getStringAsData($content) {
+ $r=DataModel_getStringAsData($this->_cPtr,$content);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Data($r);
+ }
+ return $r;
+ }
+
+ function getLength($expr) {
+ return DataModel_getLength($this->_cPtr,$expr);
+ }
+
+ function setForeach($item,$array,$index,$iteration) {
+ DataModel_setForeach($this->_cPtr,$item,$array,$index,$iteration);
+ }
+
+ function pushContext() {
+ DataModel_pushContext($this->_cPtr);
+ }
+
+ function popContext() {
+ DataModel_popContext($this->_cPtr);
+ }
+
+ function evalAsString($expr) {
+ return DataModel_evalAsString($this->_cPtr,$expr);
+ }
+
+ function isDeclared($expr) {
+ return DataModel_isDeclared($this->_cPtr,$expr);
+ }
+
+ function isLocation($expr) {
+ return DataModel_isLocation($this->_cPtr,$expr);
+ }
+
+ function evalAsBool($expr_or_node_or_elem,$expr_or_content=null) {
+ switch (func_num_args()) {
+ case 1: $this->_cPtr=DataModel_evalAsBool($this->_cPtr,$expr_or_node_or_elem); break;
+ default: $this->_cPtr=DataModel_evalAsBool($this->_cPtr,$expr_or_node_or_elem,$expr_or_content);
+ }
+ return $r;
+ }
+
+ function init($dataElem,$location,$content) {
+ DataModel_init($this->_cPtr,$dataElem,$location,$content);
+ }
+
+ function assign($assignElem,$location,$content) {
+ DataModel_assign($this->_cPtr,$assignElem,$location,$content);
+ }
+
+ function c_eval($scriptElem,$expr) {
+ DataModel_c_eval($this->_cPtr,$scriptElem,$expr);
+ }
+}
+
+class ExecutableContent extends ExecutableContentImpl {
+ public $_cPtr=null;
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ ExecutableContentImpl::__set($var,$value);
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return ExecutableContentImpl::__get($var);
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return ExecutableContentImpl::__isset($var);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_uscxml__WrappedExecutableContent') {
+ $this->_cPtr=$res;
+ return;
+ }
+ if (get_class($this) === 'ExecutableContent') {
+ $_this = null;
+ } else {
+ $_this = $this;
+ }
+ $this->_cPtr=new_ExecutableContent($_this);
+ }
+
+ function create($interpreter) {
+ $r=ExecutableContent_create($this->_cPtr,$interpreter);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new ExecutableContent($r);
+ }
+ return $r;
+ }
+
+ function getLocalName() {
+ return ExecutableContent_getLocalName($this->_cPtr);
+ }
+
+ function getNamespace() {
+ return ExecutableContent_getNamespace($this->_cPtr);
+ }
+
+ function processChildren() {
+ return ExecutableContent_processChildren($this->_cPtr);
+ }
+
+ function enterElement($node) {
+ ExecutableContent_enterElement($this->_cPtr,$node);
+ }
+
+ function exitElement($node) {
+ ExecutableContent_exitElement($this->_cPtr,$node);
+ }
+}
+
+class IOProcessor extends IOProcessorImpl {
+ public $_cPtr=null;
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ IOProcessorImpl::__set($var,$value);
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return IOProcessorImpl::__get($var);
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return IOProcessorImpl::__isset($var);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_uscxml__WrappedIOProcessor') {
+ $this->_cPtr=$res;
+ return;
+ }
+ if (get_class($this) === 'IOProcessor') {
+ $_this = null;
+ } else {
+ $_this = $this;
+ }
+ $this->_cPtr=new_IOProcessor($_this);
+ }
+
+ function create($interpreter) {
+ $r=IOProcessor_create($this->_cPtr,$interpreter);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new IOProcessor($r);
+ }
+ return $r;
+ }
+
+ function getNames() {
+ $r=IOProcessor_getNames($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new StringList($r);
+ }
+ return $r;
+ }
+
+ function getDataModelVariables() {
+ $r=IOProcessor_getDataModelVariables($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Data($r);
+ }
+ return $r;
+ }
+
+ function send($req) {
+ IOProcessor_send($this->_cPtr,$req);
+ }
+}
+
+class InterpreterMonitor extends NativeInterpreterMonitor {
+ public $_cPtr=null;
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ NativeInterpreterMonitor::__set($var,$value);
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return NativeInterpreterMonitor::__get($var);
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return NativeInterpreterMonitor::__isset($var);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_uscxml__WrappedInterpreterMonitor') {
+ $this->_cPtr=$res;
+ return;
+ }
+ if (get_class($this) === 'InterpreterMonitor') {
+ $_this = null;
+ } else {
+ $_this = $this;
+ }
+ $this->_cPtr=new_InterpreterMonitor($_this);
+ }
+
+ function beforeExitingState($interpreter,$stateId,$xpath,$state,$moreComing) {
+ InterpreterMonitor_beforeExitingState($this->_cPtr,$interpreter,$stateId,$xpath,$state,$moreComing);
+ }
+
+ function afterExitingState($interpreter,$stateId,$xpath,$state,$moreComing) {
+ InterpreterMonitor_afterExitingState($this->_cPtr,$interpreter,$stateId,$xpath,$state,$moreComing);
+ }
+
+ function beforeExecutingContent($interpreter,$tagName,$xpath,$element) {
+ InterpreterMonitor_beforeExecutingContent($this->_cPtr,$interpreter,$tagName,$xpath,$element);
+ }
+
+ function afterExecutingContent($interpreter,$tagName,$xpath,$element) {
+ InterpreterMonitor_afterExecutingContent($this->_cPtr,$interpreter,$tagName,$xpath,$element);
+ }
+
+ function beforeUninvoking($interpreter,$xpath,$invokeid,$element) {
+ InterpreterMonitor_beforeUninvoking($this->_cPtr,$interpreter,$xpath,$invokeid,$element);
+ }
+
+ function afterUninvoking($interpreter,$xpath,$invokeid,$element) {
+ InterpreterMonitor_afterUninvoking($this->_cPtr,$interpreter,$xpath,$invokeid,$element);
+ }
+
+ function beforeTakingTransition($interpreter,$xpath,$source,$targets,$element,$moreComing) {
+ InterpreterMonitor_beforeTakingTransition($this->_cPtr,$interpreter,$xpath,$source,$targets,$element,$moreComing);
+ }
+
+ function afterTakingTransition($interpreter,$xpath,$source,$targets,$element,$moreComing) {
+ InterpreterMonitor_afterTakingTransition($this->_cPtr,$interpreter,$xpath,$source,$targets,$element,$moreComing);
+ }
+
+ function beforeEnteringState($interpreter,$stateId,$xpath,$state,$moreComing) {
+ InterpreterMonitor_beforeEnteringState($this->_cPtr,$interpreter,$stateId,$xpath,$state,$moreComing);
+ }
+
+ function afterEnteringState($interpreter,$stateId,$xpath,$state,$moreComing) {
+ InterpreterMonitor_afterEnteringState($this->_cPtr,$interpreter,$stateId,$xpath,$state,$moreComing);
+ }
+
+ function beforeInvoking($interpreter,$xpath,$invokeid,$element) {
+ InterpreterMonitor_beforeInvoking($this->_cPtr,$interpreter,$xpath,$invokeid,$element);
+ }
+
+ function afterInvoking($interpreter,$xpath,$invokeid,$element) {
+ InterpreterMonitor_afterInvoking($this->_cPtr,$interpreter,$xpath,$invokeid,$element);
+ }
+
+ function reportIssue($interpreter,$issue) {
+ InterpreterMonitor_reportIssue($this->_cPtr,$interpreter,$issue);
+ }
+}
+
+class IssueList {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function c_list($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_std__listT_uscxml__InterpreterIssue_t') {
+ $this->_cPtr=$res;
+ return;
+ }
+ return new IssueList(new_c_list());
+ }
+
+ function size() {
+ return IssueList_size($this->_cPtr);
+ }
+
+ function c_empty() {
+ return IssueList_c_empty($this->_cPtr);
+ }
+
+ function clear() {
+ IssueList_clear($this->_cPtr);
+ }
+
+ function add($x) {
+ IssueList_add($this->_cPtr,$x);
+ }
+
+ function get($i) {
+ $r=IssueList_get($this->_cPtr,$i);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new InterpreterIssue($r);
+ }
+ return $r;
+ }
+}
+
+class DataList {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+ function __construct($h) {
+ $this->_cPtr=$h;
+ }
+
+ function size() {
+ return DataList_size($this->_cPtr);
+ }
+
+ function c_empty() {
+ return DataList_c_empty($this->_cPtr);
+ }
+
+ function clear() {
+ DataList_clear($this->_cPtr);
+ }
+
+ function add($x) {
+ DataList_add($this->_cPtr,$x);
+ }
+
+ function get($i) {
+ $r=DataList_get($this->_cPtr,$i);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Data($r);
+ }
+ return $r;
+ }
+}
+
+class DataMap {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function __construct($arg1=null) {
+ if (is_resource($arg1) && get_resource_type($arg1) === '_p_std__mapT_std__string_uscxml__Data_t') {
+ $this->_cPtr=$arg1;
+ return;
+ }
+ switch (func_num_args()) {
+ case 0: $this->_cPtr=new_DataMap(); break;
+ default: $this->_cPtr=new_DataMap($arg1);
+ }
+ }
+
+ function size() {
+ return DataMap_size($this->_cPtr);
+ }
+
+ function clear() {
+ DataMap_clear($this->_cPtr);
+ }
+
+ function get($key) {
+ $r=DataMap_get($this->_cPtr,$key);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new Data($r);
+ }
+ return $r;
+ }
+
+ function set($key,$x) {
+ DataMap_set($this->_cPtr,$key,$x);
+ }
+
+ function del($key) {
+ DataMap_del($this->_cPtr,$key);
+ }
+
+ function has_key($key) {
+ return DataMap_has_key($this->_cPtr,$key);
+ }
+
+ function is_empty() {
+ return DataMap_is_empty($this->_cPtr);
+ }
+}
+
+class StringSet {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function __construct($arg1=null) {
+ if (is_resource($arg1) && get_resource_type($arg1) === '_p_std__setT_std__string_t') {
+ $this->_cPtr=$arg1;
+ return;
+ }
+ switch (func_num_args()) {
+ case 0: $this->_cPtr=new_StringSet(); break;
+ default: $this->_cPtr=new_StringSet($arg1);
+ }
+ }
+
+ function size() {
+ return StringSet_size($this->_cPtr);
+ }
+
+ function c_empty() {
+ return StringSet_c_empty($this->_cPtr);
+ }
+
+ function clear() {
+ StringSet_clear($this->_cPtr);
+ }
+
+ function get($key) {
+ return StringSet_get($this->_cPtr,$key);
+ }
+
+ function insert($key) {
+ StringSet_insert($this->_cPtr,$key);
+ }
+
+ function del($key) {
+ StringSet_del($this->_cPtr,$key);
+ }
+
+ function has_key($key) {
+ return StringSet_has_key($this->_cPtr,$key);
+ }
+}
+
+class StringVector {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function __construct($n=null) {
+ if (is_resource($n) && get_resource_type($n) === '_p_std__vectorT_std__string_t') {
+ $this->_cPtr=$n;
+ return;
+ }
+ switch (func_num_args()) {
+ case 0: $this->_cPtr=new_StringVector(); break;
+ default: $this->_cPtr=new_StringVector($n);
+ }
+ }
+
+ function size() {
+ return StringVector_size($this->_cPtr);
+ }
+
+ function capacity() {
+ return StringVector_capacity($this->_cPtr);
+ }
+
+ function reserve($n) {
+ StringVector_reserve($this->_cPtr,$n);
+ }
+
+ function clear() {
+ StringVector_clear($this->_cPtr);
+ }
+
+ function push($x) {
+ StringVector_push($this->_cPtr,$x);
+ }
+
+ function is_empty() {
+ return StringVector_is_empty($this->_cPtr);
+ }
+
+ function pop() {
+ return StringVector_pop($this->_cPtr);
+ }
+
+ function get($i) {
+ return StringVector_get($this->_cPtr,$i);
+ }
+
+ function set($i,$val) {
+ StringVector_set($this->_cPtr,$i,$val);
+ }
+}
+
+class StringList {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+ function __construct($h) {
+ $this->_cPtr=$h;
+ }
+
+ function size() {
+ return StringList_size($this->_cPtr);
+ }
+
+ function c_empty() {
+ return StringList_c_empty($this->_cPtr);
+ }
+
+ function clear() {
+ StringList_clear($this->_cPtr);
+ }
+
+ function add($x) {
+ StringList_add($this->_cPtr,$x);
+ }
+
+ function get($i) {
+ return StringList_get($this->_cPtr,$i);
+ }
+}
+
+class ParamMap {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function __construct($arg1=null) {
+ if (is_resource($arg1) && get_resource_type($arg1) === '_p_std__mapT_std__string_std__listT_uscxml__Data_t_t') {
+ $this->_cPtr=$arg1;
+ return;
+ }
+ switch (func_num_args()) {
+ case 0: $this->_cPtr=new_ParamMap(); break;
+ default: $this->_cPtr=new_ParamMap($arg1);
+ }
+ }
+
+ function size() {
+ return ParamMap_size($this->_cPtr);
+ }
+
+ function clear() {
+ ParamMap_clear($this->_cPtr);
+ }
+
+ function get($key) {
+ $r=ParamMap_get($this->_cPtr,$key);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new DataList($r);
+ }
+ return $r;
+ }
+
+ function set($key,$x) {
+ ParamMap_set($this->_cPtr,$key,$x);
+ }
+
+ function del($key) {
+ ParamMap_del($this->_cPtr,$key);
+ }
+
+ function has_key($key) {
+ return ParamMap_has_key($this->_cPtr,$key);
+ }
+
+ function is_empty() {
+ return ParamMap_is_empty($this->_cPtr);
+ }
+}
+
+class IOProcMap {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function __construct($arg1=null) {
+ if (is_resource($arg1) && get_resource_type($arg1) === '_p_std__mapT_std__string_uscxml__IOProcessor_t') {
+ $this->_cPtr=$arg1;
+ return;
+ }
+ switch (func_num_args()) {
+ case 0: $this->_cPtr=new_IOProcMap(); break;
+ default: $this->_cPtr=new_IOProcMap($arg1);
+ }
+ }
+
+ function size() {
+ return IOProcMap_size($this->_cPtr);
+ }
+
+ function clear() {
+ IOProcMap_clear($this->_cPtr);
+ }
+
+ function get($key) {
+ $r=IOProcMap_get($this->_cPtr,$key);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new NativeIOProcessor($r);
+ }
+ return $r;
+ }
+
+ function set($key,$x) {
+ IOProcMap_set($this->_cPtr,$key,$x);
+ }
+
+ function del($key) {
+ IOProcMap_del($this->_cPtr,$key);
+ }
+
+ function has_key($key) {
+ return IOProcMap_has_key($this->_cPtr,$key);
+ }
+
+ function is_empty() {
+ return IOProcMap_is_empty($this->_cPtr);
+ }
+}
+
+class InvokerMap {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function __construct($arg1=null) {
+ if (is_resource($arg1) && get_resource_type($arg1) === '_p_std__mapT_std__string_uscxml__Invoker_t') {
+ $this->_cPtr=$arg1;
+ return;
+ }
+ switch (func_num_args()) {
+ case 0: $this->_cPtr=new_InvokerMap(); break;
+ default: $this->_cPtr=new_InvokerMap($arg1);
+ }
+ }
+
+ function size() {
+ return InvokerMap_size($this->_cPtr);
+ }
+
+ function clear() {
+ InvokerMap_clear($this->_cPtr);
+ }
+
+ function get($key) {
+ $r=InvokerMap_get($this->_cPtr,$key);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new NativeInvoker($r);
+ }
+ return $r;
+ }
+
+ function set($key,$x) {
+ InvokerMap_set($this->_cPtr,$key,$x);
+ }
+
+ function del($key) {
+ InvokerMap_del($this->_cPtr,$key);
+ }
+
+ function has_key($key) {
+ return InvokerMap_has_key($this->_cPtr,$key);
+ }
+
+ function is_empty() {
+ return InvokerMap_is_empty($this->_cPtr);
+ }
+}
+
+class ParentQueue {
+ public $_cPtr=null;
+ protected $_pData=array();
+
+ function __set($var,$value) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_alter_newobject($this->_cPtr,$value);
+ $this->_pData[$var] = $value;
+ }
+
+ function __get($var) {
+ if ($var === 'thisown') return swig_uscxmlNativePHP_get_newobject($this->_cPtr);
+ return $this->_pData[$var];
+ }
+
+ function __isset($var) {
+ if ($var === 'thisown') return true;
+ return array_key_exists($var, $this->_pData);
+ }
+
+ function __construct($res=null) {
+ if (is_resource($res) && get_resource_type($res) === '_p_uscxml__concurrency__BlockingQueueT_uscxml__SendRequest_t') {
+ $this->_cPtr=$res;
+ return;
+ }
+ $this->_cPtr=new_ParentQueue();
+ }
+
+ function push($elem) {
+ ParentQueue_push($this->_cPtr,$elem);
+ }
+
+ function push_front($elem) {
+ ParentQueue_push_front($this->_cPtr,$elem);
+ }
+
+ function pop() {
+ $r=ParentQueue_pop($this->_cPtr);
+ if (is_resource($r)) {
+ $c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
+ if (class_exists($c)) return new $c($r);
+ return new SendRequest($r);
+ }
+ return $r;
+ }
+
+ function clear() {
+ ParentQueue_clear($this->_cPtr);
+ }
+
+ function isEmpty() {
+ return ParentQueue_isEmpty($this->_cPtr);
+ }
+}
+
+
+?>
diff --git a/src/uscxml/DOMUtils.cpp b/src/uscxml/DOMUtils.cpp
index 2d3c3ea..5d72d5f 100644
--- a/src/uscxml/DOMUtils.cpp
+++ b/src/uscxml/DOMUtils.cpp
@@ -122,6 +122,12 @@ std::list<Arabica::DOM::Node<std::string> > DOMUtils::getElementsByType(const Ar
return result;
}
+NameSpacingParser NameSpacingParser::fromFile(const std::string& file) {
+ Arabica::SAX::InputSource<std::string> inputSource;
+ inputSource.setSystemId(file);
+ return fromInputSource(inputSource);
+}
+
NameSpacingParser NameSpacingParser::fromXML(const std::string& xml) {
std::stringstream* ss = new std::stringstream();
(*ss) << xml;
diff --git a/src/uscxml/DOMUtils.h b/src/uscxml/DOMUtils.h
index 2264e64..0691952 100644
--- a/src/uscxml/DOMUtils.h
+++ b/src/uscxml/DOMUtils.h
@@ -84,6 +84,7 @@ class USCXML_API NameSpacingParser : public Arabica::SAX2DOM::Parser<std::string
public:
NameSpacingParser();
NameSpacingParser(const NameSpacingParser& other) {}
+ static NameSpacingParser fromFile(const std::string& file);
static NameSpacingParser fromXML(const std::string& xml);
static NameSpacingParser fromInputSource(Arabica::SAX::InputSource<std::string>& source);
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp
index 060a397..1b2ca15 100644
--- a/src/uscxml/Interpreter.cpp
+++ b/src/uscxml/Interpreter.cpp
@@ -2260,7 +2260,7 @@ bool InterpreterImpl::nameMatch(const std::string& eventDescs, const std::string
return true;
// eventDesc has to be a real prefix of event now and therefore shorter
- if (eventDesc.size() >= eventName.size())
+ if (eventDesc.size() > eventName.size())
goto NEXT_DESC;
// are they already equal?
@@ -2910,17 +2910,19 @@ NodeSet<std::string> InterpreterImpl::getTargetStates(const Arabica::XPath::Node
return targets;
}
-std::list<std::string> InterpreterImpl::tokenize(const std::string& line, const char sep) {
+#define ISWHITESPACE(char) (isspace(char))
+
+std::list<std::string> InterpreterImpl::tokenize(const std::string& line, const char sep, bool trimWhiteSpace) {
std::list<std::string> tokens;
// appr. 3x faster than stringstream
size_t start = 0;
for (int i = 0; i < line.size(); i++) {
- if (line[i] == sep) {
+ if (line[i] == sep || (trimWhiteSpace && ISWHITESPACE(line[i]))) {
if (i > 0 && start < i) {
tokens.push_back(line.substr(start, i - start));
}
- while(line[++i] == sep); // skip multiple occurences of seperator
+ while(line[i] == sep || (trimWhiteSpace && ISWHITESPACE(line[i]))) { i++; } // skip multiple occurences of seperator and whitespaces
start = i;
} else if (i + 1 == line.size()) {
tokens.push_back(line.substr(start, i + 1 - start));
diff --git a/src/uscxml/Interpreter.h b/src/uscxml/Interpreter.h
index 7019eb9..bef4c88 100644
--- a/src/uscxml/Interpreter.h
+++ b/src/uscxml/Interpreter.h
@@ -448,9 +448,9 @@ public:
static Arabica::XPath::NodeSet<std::string> filterChildType(const Arabica::DOM::Node_base::Type type, const Arabica::XPath::NodeSet<std::string>& nodeSet, bool recurse = false);
static std::list<std::string> tokenizeIdRefs(const std::string& idRefs) {
- return tokenize(idRefs);
+ return tokenize(idRefs, ' ', true);
}
- static std::list<std::string> tokenize(const std::string& line, const char seperator = ' ');
+ static std::list<std::string> tokenize(const std::string& line, const char seperator = ' ', bool trimWhiteSpace = false);
static std::string spaceNormalize(const std::string& text);
static bool nameMatch(const std::string& eventDescs, const std::string& event);
diff --git a/src/uscxml/messages/Data.h b/src/uscxml/messages/Data.h
index 818b26e..f4d220f 100644
--- a/src/uscxml/messages/Data.h
+++ b/src/uscxml/messages/Data.h
@@ -132,8 +132,8 @@ public:
}
const Data item(const size_t index) const {
- if (array.size() < index) {
- std::list<Data>::const_iterator arrayIter;
+ if (array.size() > index) {
+ std::list<Data>::const_iterator arrayIter = array.begin();
for (int i = 0; i < index; i++, arrayIter++) {}
return *arrayIter;
}
diff --git a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp
index 5fd325d..0302d87 100644
--- a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp
+++ b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp
@@ -176,8 +176,8 @@ void UmundoInvoker::invoke(const InvokeRequest& req) {
}
_node = new umundo::Node();
- umundo::MDNSDiscoveryOptions discOpts;
- _discovery = new umundo::Discovery(umundo::Discovery::MDNS, &discOpts);
+ umundo::DiscoveryConfigMDNS discOpts;
+ _discovery = new umundo::Discovery(&discOpts);
_discovery->add(*_node);
@@ -335,7 +335,7 @@ void UmundoInvoker::removed(umundo::ServiceDescription desc) {
returnEvent(addedEvent);
}
-void UmundoInvoker::changed(umundo::ServiceDescription desc) {
+void UmundoInvoker::changed(umundo::ServiceDescription desc, uint64_t what) {
}
bool UmundoInvoker::jsonbufToData(Data& data, const JSONProto& json) {
diff --git a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h
index 1c5c9a3..4c0e988 100644
--- a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h
+++ b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h
@@ -60,7 +60,7 @@ public:
virtual void added(umundo::ServiceDescription);
virtual void removed(umundo::ServiceDescription);
- virtual void changed(umundo::ServiceDescription);
+ virtual void changed(umundo::ServiceDescription, uint64_t what);
virtual void welcome(umundo::TypedPublisher atPub, const umundo::SubscriberStub& sub);
virtual void farewell(umundo::TypedPublisher fromPub, const umundo::SubscriberStub& sub);
diff --git a/src/uscxml/transform/ChartToPromela.cpp b/src/uscxml/transform/ChartToPromela.cpp
index b750409..59f1d75 100644
--- a/src/uscxml/transform/ChartToPromela.cpp
+++ b/src/uscxml/transform/ChartToPromela.cpp
@@ -130,200 +130,6 @@ void ChartToPromela::writeTo(std::ostream& stream) {
writeProgram(stream);
}
-void PromelaEventSource::writeStart(std::ostream& stream, int indent) {
- std::string padding;
- for (int i = 0; i < indent; i++) {
- padding += " ";
- }
- stream << padding << "run " << name << "EventSource() priority 10;" << std::endl;
-}
-
-void PromelaEventSource::writeStop(std::ostream& stream, int indent) {
- std::string padding;
- for (int i = 0; i < indent; i++) {
- padding += " ";
- }
-
- stream << padding << name << "EventSourceDone = 1;" << std::endl;
-}
-
-void PromelaEventSource::writeDeclarations(std::ostream& stream, int indent) {
- std::string padding;
- for (int i = 0; i < indent; i++) {
- padding += " ";
- }
- stream << "bool " << name << "EventSourceDone = 0;" << std::endl;
-
-}
-
-void PromelaEventSource::writeBody(std::ostream& stream) {
-
- stream << "proctype " << name << "EventSource() {" << std::endl;
- stream << " " << name << "EventSourceDone = 0;" << std::endl;
- if (analyzer->usesComplexEventStruct()) {
- stream << " _event_t tmpE;" << std::endl;
- }
- stream << " " << name << "NewEvent:" << std::endl;
- stream << " " << "if" << std::endl;
- stream << " " << ":: " << name << "EventSourceDone -> goto " << name << "Done;" << std::endl;
- stream << " " << ":: " << "len(eQ) >= " << externalQueueLength - longestSequence << " -> skip;" << std::endl;
- stream << " " << ":: else { " << std::endl;
-
- Trie& trie = analyzer->getTrie();
- if (source.type == PromelaInline::PROMELA_EVENT_SOURCE_CUSTOM) {
- // custom event source
- std::string content = source.content;
-
- boost::replace_all(content, "#REDO#", name + "NewEvent");
- boost::replace_all(content, "#DONE#", name + "Done");
-
- std::list<TrieNode*> eventNames = trie.getChildsWithWords(trie.getNodeWithPrefix(""));
- std::list<TrieNode*>::iterator eventNameIter = eventNames.begin();
- while(eventNameIter != eventNames.end()) {
- boost::replace_all(content, "#" + (*eventNameIter)->value + "#", (*eventNameIter)->identifier);
- eventNameIter++;
- }
-
- stream << ChartToPromela::beautifyIndentation(content, 2) << std::endl;
- } else {
- // standard event source
- stream << " " << " if" << std::endl;
-// stream << " " << " :: 1 -> " << "goto " << sourceName << "NewEvent;" << std::endl;
-
- std::list<std::list<std::string> >::const_iterator seqIter = sequences.begin();
- while(seqIter != sequences.end()) {
- stream << " " << ":: skip -> { ";
- std::list<std::string>::const_iterator evIter = seqIter->begin();
- while(evIter != seqIter->end()) {
- TrieNode* node = trie.getNodeWithPrefix(*evIter);
- if (!node) {
- std::cerr << "Event " << *evIter << " defined in event source but never used in transitions" << std::endl;
- evIter++;
- continue;
- }
- if (analyzer->usesComplexEventStruct()) {
- stream << "tmpE.name = " << analyzer->macroForLiteral(node->value) << "; eQ!tmpE; ";
- } else {
- stream << "eQ!" << analyzer->macroForLiteral(node->value) << "; ";
- }
- evIter++;
- }
- stream << "goto " << name << "NewEvent;";
- stream << " }" << std::endl;
- seqIter++;
- }
-
- stream << " " << " fi;" << std::endl;
- }
-
- stream << " " << "}" << std::endl;
- stream << " " << "fi;" << std::endl;
- stream << name << "Done:" << " skip;" << std::endl;
- stream << "}" << std::endl;
-
-
-// std::list<PromelaInline>::iterator sourceIter = eventSources.inlines.begin();
-// int i = 0;
-// while(sourceIter != eventSources.inlines.end()) {
-// if (sourceIter->type != PromelaInline::PROMELA_EVENT_SOURCE_CUSTOM && sourceIter->type != PromelaInline::PROMELA_EVENT_SOURCE) {
-// sourceIter++;
-// continue;
-// }
-//
-// std::string sourceName = name + "_"+ toStr(i);
-//
-// stream << "proctype " << sourceName << "EventSource() {" << std::endl;
-// stream << " " << sourceName << "EventSourceDone = 0;" << std::endl;
-// stream << " " << sourceName << "NewEvent:" << std::endl;
-// stream << " " << "if" << std::endl;
-// stream << " " << ":: " << sourceName << "EventSourceDone -> skip;" << std::endl;
-// stream << " " << ":: else { " << std::endl;
-//
-// Trie& trie = analyzer->getTrie();
-//
-// if (sourceIter->type == PromelaInline::PROMELA_EVENT_SOURCE_CUSTOM) {
-// std::string content = sourceIter->content;
-//
-// boost::replace_all(content, "#REDO#", sourceName + "NewEvent");
-// boost::replace_all(content, "#DONE#", sourceName + "Done");
-//
-// std::list<TrieNode*> eventNames = trie.getChildsWithWords(trie.getNodeWithPrefix(""));
-// std::list<TrieNode*>::iterator eventNameIter = eventNames.begin();
-// while(eventNameIter != eventNames.end()) {
-// boost::replace_all(content, "#" + (*eventNameIter)->value + "#", (*eventNameIter)->identifier);
-// eventNameIter++;
-// }
-//
-// stream << ChartToPromela::beautifyIndentation(content, 2) << std::endl;
-//
-// } else {
-// stream << " " << " if" << std::endl;
-//// stream << " " << " :: 1 -> " << "goto " << sourceName << "NewEvent;" << std::endl;
-//
-// std::list<std::list<std::string> >::const_iterator seqIter = sourceIter->sequences.begin();
-// while(seqIter != sourceIter->sequences.end()) {
-// stream << " " << ":: ";
-// std::list<std::string>::const_iterator evIter = seqIter->begin();
-// while(evIter != seqIter->end()) {
-// TrieNode* node = trie.getNodeWithPrefix(*evIter);
-// stream << "eQ!" << node->identifier << "; ";
-// evIter++;
-// }
-// stream << "goto " << sourceName << "NewEvent;" << std::endl;
-// seqIter++;
-// }
-//
-// stream << " " << " fi;" << std::endl;
-// }
-//
-// stream << " " << "}" << std::endl;
-// stream << " " << "fi;" << std::endl;
-// stream << sourceName << "Done:" << " skip;" << std::endl;
-// stream << "}" << std::endl;
-//
-// i++;
-// sourceIter++;
-// }
-}
-
-PromelaEventSource::PromelaEventSource() {
- type = PROMELA_EVENT_SOURCE_INVALID;
- analyzer = NULL;
-}
-
-PromelaEventSource::PromelaEventSource(const PromelaInline& source, PromelaCodeAnalyzer* analyzer, uint32_t eQueueLength) {
- type = PROMELA_EVENT_SOURCE_INVALID;
- this->analyzer = analyzer;
- externalQueueLength = eQueueLength;
-
- this->source = source;
-
- if (source.type == PromelaInline::PROMELA_EVENT_SOURCE) {
- std::stringstream ssLines(source.content);
- std::string line;
- while(std::getline(ssLines, line)) {
- boost::trim(line);
- if (line.length() == 0)
- continue;
- if (boost::starts_with(line, "//"))
- continue;
-
- std::list<std::string> seq;
- std::stringstream ssToken(line);
- std::string token;
- while(std::getline(ssToken, token, ' ')) {
- if (token.length() == 0)
- continue;
- seq.push_back(token);
- if (analyzer != NULL)
- analyzer->addEvent(token);
- }
- sequences.push_back(seq);
- if (seq.size() > longestSequence)
- longestSequence = seq.size();
- }
- }
-}
void PromelaCodeAnalyzer::addCode(const std::string& code, ChartToPromela* interpreter) {
PromelaParser parser(code);
@@ -570,7 +376,7 @@ std::string PromelaCodeAnalyzer::macroForLiteral(const std::string& literal) {
throw std::runtime_error("Literal " + literal + " passed with quotes");
if (_strMacroNames.find(literal) == _strMacroNames.end())
- throw std::runtime_error("No macro for literal " + literal + " known");
+ throw std::runtime_error("No macro for literal '" + literal + "' known");
return _strMacroNames[literal];
}
@@ -1051,16 +857,6 @@ void ChartToPromela::writeTransition(std::ostream& stream, GlobalTransition* tra
}
// std::cout << "###" << std::endl;
for (std::list<GlobalTransition::Action>::iterator actionIter = transition->actions.begin(); actionIter != transition->actions.end(); actionIter++) {
-#if 0
- if (actionIter->onEntry) {
- std::cout << "onEntry: " << actionIter->onEntry << std::endl;
- } else if (actionIter->raiseDone) {
- std::cout << "raiseDone: " << actionIter->raiseDone << std::endl;
- } else {
- std::cout << "#" << std::endl;
- }
- foo.insert(*actionIter);
-#endif
actionsInTransition[transition].insert(*actionIter);
}
// std::copy(transition->actions.begin(), transition->actions.end(), std::inserter(actionsInTransition[transition], actionsInTransition[transition].begin()));
@@ -1163,6 +959,7 @@ void ChartToPromela::writeTransition(std::ostream& stream, GlobalTransition* tra
isConditionalized = true;
}
+#if 0
switch (ecIter->type) {
case ExecContentSeqItem::EXEC_CONTENT_ALL_BUT:
std::cout << "ALL_BUT" << std::endl;
@@ -1177,6 +974,7 @@ void ChartToPromela::writeTransition(std::ostream& stream, GlobalTransition* tra
default:
break;
}
+#endif
if (action.exited) {
// we left a state
@@ -1226,86 +1024,31 @@ void ChartToPromela::writeTransition(std::ostream& stream, GlobalTransition* tra
// an invoke element
if (_machines.find(action.invoke) != _machines.end()) {
-#if 1
stream << padding << _prefix << "start!" << _analyzer->macroForLiteral(_machines[action.invoke]->_invokerid) << ";" << std::endl;
-#else
-
- // nested SCXML document
-
- // set from namelist
- if (HAS_ATTR_CAST(action.invoke, "namelist")) {
- std::list<std::string> namelist = tokenize(ATTR_CAST(action.invoke, "namelist"));
- for (std::list<std::string>::iterator nlIter = namelist.begin(); nlIter != namelist.end(); nlIter++) {
- if (_machines[action.invoke]->_dataModelVars.find(*nlIter) != _machines[action.invoke]->_dataModelVars.end()) {
- stream << padding << _machines[action.invoke]->_prefix << *nlIter << " = " << _prefix << *nlIter << std::endl;
- }
- }
- }
-
- // set from params
- NodeSet<std::string> invokeParams = filterChildElements(_nsInfo.xmlNSPrefix + "param", action.invoke);
- for (int i = 0; i < invokeParams.size(); i++) {
- std::string identifier = ATTR_CAST(invokeParams[i], "name");
- std::string expression = ATTR_CAST(invokeParams[i], "expr");
- if (_machines[action.invoke]->_dataModelVars.find(identifier) != _machines[action.invoke]->_dataModelVars.end()) {
- stream << padding << _machines[action.invoke]->_prefix << identifier << " = " << ADAPT_SRC(expression) << ";" << std::endl;
- }
- }
-
-// stream << padding << " /* assign local variables from invoke request */" << std::endl;
-//
-// if (_analyzer->usesComplexEventStruct() && _analyzer->usesEventField("data")) {
-// for (std::set<std::string>::iterator dmIter = _dataModelVars.begin(); dmIter != _dataModelVars.end(); dmIter++) {
-// if (_analyzer->usesEventDataField(*dmIter)) {
-// stream << " if" << std::endl;
-// stream << " :: " << _prefix << "_event.data." << *dmIter << " -> " << _prefix << *dmIter << " = " << "_event.data." << *dmIter << ";" << std::endl;
-// stream << " :: else -> skip;" << std::endl;
-// stream << " fi" << std::endl;
-// }
-// }
-// }
-// stream << std::endl;
-
- stream << padding << "run " << _machines[action.invoke]->_prefix << "run() priority 20;" << std::endl;
- if (HAS_ATTR_CAST(action.invoke, "idlocation")) {
- stream << padding << ADAPT_SRC(ATTR_CAST(action.invoke, "idlocation")) << " = " << _analyzer->macroForLiteral(_machines[_machinesPerId[ATTR_CAST(action.invoke, "id")]]->_invokerid) << ";" << std::endl;
- }
-#endif
} else {
- if (HAS_ATTR_CAST(action.invoke, "invokeid") && _invokers.find(ATTR_CAST(action.invoke, "invokeid")) != _invokers.end())
- _invokers[ATTR_CAST(action.invoke, "invokeid")].writeStart(stream, indent);
+ if (HAS_ATTR_CAST(action.invoke, "id")) {
+ stream << padding << _prefix << ATTR_CAST(action.invoke, "id") << "Running = true;" << std::endl;
+ }
}
}
if (action.uninvoke) {
- assert(_machines.find(action.uninvoke) != _machines.end());
- stream << padding << "do" << std::endl;
- stream << padding << ":: " << _prefix << "start??" << _analyzer->macroForLiteral(_machines[action.uninvoke]->_invokerid) << " -> skip" << std::endl;
- stream << padding << ":: else -> break;" << std::endl;
- stream << padding << "od" << std::endl;
-
-// std::cout << action.uninvoke << std::endl;
- // an invoke element to uninvoke
if (_machines.find(action.uninvoke) != _machines.end()) {
- // nested SCXML document
- stream << padding << _machines[action.uninvoke]->_prefix << "canceled = true;" << std::endl;
- if (_analyzer->usesEventField("delay"))
- stream << padding << "removePendingEventsForInvoker(" << _analyzer->macroForLiteral(_machines[action.uninvoke]->_invokerid) << ");" << std::endl;
-// writeRemovePendingEventsFromInvoker(stream, _machines[action.uninvoke], indent, false);
-#if 0
stream << padding << "do" << std::endl;
- if (_allowEventInterleaving)
- stream << padding << ":: len(" << _machines[action.uninvoke]->_prefix << "tmpQ) > 0 -> " << _machines[action.uninvoke]->_prefix << "tmpQ?_;" << std::endl;
- stream << padding << ":: len(" << _machines[action.uninvoke]->_prefix << "eQ) > 0 -> " << _machines[action.uninvoke]->_prefix << "eQ?_;" << std::endl;
+ stream << padding << ":: " << _prefix << "start??" << _analyzer->macroForLiteral(_machines[action.uninvoke]->_invokerid) << " -> skip" << std::endl;
stream << padding << ":: else -> break;" << std::endl;
stream << padding << "od" << std::endl;
-#endif
+
+ stream << padding << _machines[action.uninvoke]->_prefix << "canceled = true;" << std::endl;
+ if (_analyzer->usesEventField("delay")) {
+ stream << padding << "removePendingEventsForInvoker(" << _analyzer->macroForLiteral(_machines[action.uninvoke]->_invokerid) << ");" << std::endl;
+ }
} else {
- if (HAS_ATTR_CAST(action.uninvoke, "invokeid") && _invokers.find(ATTR_CAST(action.invoke, "invokeid")) != _invokers.end())
- stream << padding << ATTR_CAST(action.uninvoke, "invokeid") << "EventSourceDone" << "= 1;" << std::endl;
+ if (HAS_ATTR_CAST(action.uninvoke, "id")) {
+ stream << padding << _prefix << ATTR_CAST(action.uninvoke, "id") << "Running = false;" << std::endl;
+ }
}
-// continue;
}
if (isConditionalized) {
@@ -1682,17 +1425,7 @@ void ChartToPromela::writeExecutableContent(std::ostream& stream, const Arabica:
for (int i = 0; i < indent; i++) {
padding += " ";
}
-
- if (node.getNodeType() == Node_base::COMMENT_NODE) {
- // we cannot have labels in an atomic block, just process inline promela
- PromelaInlines promInls = PromelaInlines::fromNode(node);
- // TODO!
- // if (promInls) {
- // stream << padding << "skip;" << std::endl;
- // stream << beautifyIndentation(inlinePromela.str(), indent) << std::endl;
- // }
- }
-
+
if (node.getNodeType() == Node_base::TEXT_NODE) {
if (boost::trim_copy(node.getNodeValue()).length() > 0)
stream << beautifyIndentation(ADAPT_SRC(node.getNodeValue()), indent) << std::endl;
@@ -1894,94 +1627,168 @@ void ChartToPromela::writeExecutableContent(std::ostream& stream, const Arabica:
}
}
-
-PromelaInlines PromelaInlines::fromNodeSet(const NodeSet<std::string>& node, bool recurse) {
- PromelaInlines allPromInls;
- Arabica::XPath::NodeSet<std::string> comments = InterpreterImpl::filterChildType(Node_base::COMMENT_NODE, node, recurse);
- for (int i = 0; i < comments.size(); i++) {
- allPromInls.merge(PromelaInlines::fromNode(comments[i]));
- }
- return allPromInls;
-
+PromelaInlines::~PromelaInlines() {
+ return;
}
-PromelaInlines PromelaInlines::fromNode(const Arabica::DOM::Node<std::string>& node) {
- if (node.getNodeType() != Node_base::COMMENT_NODE && node.getNodeType() != Node_base::TEXT_NODE)
- return PromelaInlines();
- return PromelaInlines(node.getNodeValue(), node);
-}
+std::list<PromelaInline*> PromelaInlines::getRelatedTo(const Arabica::DOM::Node<std::string>& node, PromelaInline::PromelaInlineType type) {
+ std::list<PromelaInline*> related;
+
+ std::map<Arabica::DOM::Node<std::string>, std::list<PromelaInline*> >::iterator inlIter = inlines.begin();
+ while (inlIter != inlines.end()) {
+ std::list<PromelaInline*>::iterator pmlIter = inlIter->second.begin();
+ while (pmlIter != inlIter->second.end()) {
+ if ((type != PromelaInline::PROMELA_NIL || (*pmlIter)->type == type) && (*pmlIter)->relatesTo(node)) {
+ related.push_back(*pmlIter);
+ }
+ pmlIter++;
+ }
+ inlIter++;
+ }
+ return related;
- PromelaInlines PromelaInlines::fromString(const std::string& text) {
- return PromelaInlines(text, Arabica::DOM::Node<std::string>());
+ return related;
}
-PromelaInlines::PromelaInlines() : nrProgressLabels(0), nrAcceptLabels(0), nrEndLabels(0), nrEventSources(0), nrCodes(0) {
+std::list<PromelaInline*> PromelaInlines::getAllOfType(uint32_t type) {
+ std::list<PromelaInline*> related;
+
+ std::map<Arabica::DOM::Node<std::string>, std::list<PromelaInline*> >::iterator inlIter = inlines.begin();
+ while (inlIter != inlines.end()) {
+ std::list<PromelaInline*>::iterator pmlIter = inlIter->second.begin();
+ while (pmlIter != inlIter->second.end()) {
+ if ((*pmlIter)->type & type) {
+ related.push_back(*pmlIter);
+ }
+ pmlIter++;
+ }
+ inlIter++;
+ }
+ return related;
}
-PromelaInlines::PromelaInlines(const std::string& content, const Arabica::DOM::Node<std::string>& node)
- : nrProgressLabels(0), nrAcceptLabels(0), nrEndLabels(0), nrEventSources(0), nrCodes(0) {
+PromelaInline::PromelaInline(const Arabica::DOM::Node<std::string>& node) : prevSibling(NULL), nextSibling(NULL), type(PROMELA_NIL) {
+ if (node.getNodeType() != Node_base::COMMENT_NODE && node.getNodeType() != Node_base::TEXT_NODE)
+ return; // nothing to do
- std::stringstream ssLine(content);
+ std::stringstream ssLine(node.getNodeValue());
std::string line;
+
+ while(std::getline(ssLine, line)) {
+ // skip to first promela line
+ boost::trim(line);
+ if (boost::starts_with(line, "promela"))
+ break;
+ }
- bool isInPromelaCode = false;
- PromelaInline promInl;
+ if (!boost::starts_with(line, "promela"))
+ return;
+ if (false) {
+ } else if (boost::starts_with(line, "promela-code")) {
+ type = PROMELA_CODE;
+ } else if (boost::starts_with(line, "promela-ltl")) {
+ type = PROMELA_LTL;
+ } else if (boost::starts_with(line, "promela-event-all")) {
+ type = PROMELA_EVENT_ALL_BUT;
+ } else if (boost::starts_with(line, "promela-event")) {
+ type = PROMELA_EVENT_ONLY;
+ } else if (boost::starts_with(line, "promela-progress")) {
+ type = PROMELA_PROGRESS_LABEL;
+ } else if (boost::starts_with(line, "promela-accept")) {
+ type = PROMELA_ACCEPT_LABEL;
+ } else if (boost::starts_with(line, "promela-end")) {
+ type = PROMELA_END_LABEL;
+ }
+
+ std::stringstream contentSS;
+ size_t endType = line.find_first_of(": \n");
+
+ std::string seperator;
+ if (endType != std::string::npos && endType + 1 < line.size()) {
+ contentSS << line.substr(endType + 1, line.size() - endType + 1);
+ seperator = "\n";
+ }
+
while(std::getline(ssLine, line)) {
- std::string trimLine = boost::trim_copy(line);
- if (trimLine.length() == 0)
- continue;
- if (boost::starts_with(trimLine, "#promela")) {
- if (isInPromelaCode) {
- code.push_back(promInl);
- isInPromelaCode = false;
- }
- promInl = PromelaInline();
- }
-
- if (false) {
- } else if (boost::starts_with(trimLine, "#promela-progress")) {
- nrProgressLabels++;
- promInl.type = PromelaInline::PROMELA_PROGRESS_LABEL;
- promInl.content = line;
- code.push_back(promInl);
- } else if (boost::starts_with(trimLine, "#promela-accept")) {
- nrAcceptLabels++;
- promInl.type = PromelaInline::PROMELA_ACCEPT_LABEL;
- promInl.content = line;
- code.push_back(promInl);
- } else if (boost::starts_with(trimLine, "#promela-end")) {
- nrEndLabels++;
- promInl.type = PromelaInline::PROMELA_END_LABEL;
- promInl.content = line;
- code.push_back(promInl);
- } else if (boost::starts_with(trimLine, "#promela-inline")) {
- nrCodes++;
- isInPromelaCode = true;
- promInl.type = PromelaInline::PROMELA_CODE;
- } else if (boost::starts_with(trimLine, "#promela-event-source-custom")) {
- nrEventSources++;
- isInPromelaCode = true;
- promInl.type = PromelaInline::PROMELA_EVENT_SOURCE_CUSTOM;
- } else if (boost::starts_with(trimLine, "#promela-event-source")) {
- nrEventSources++;
- isInPromelaCode = true;
- promInl.type = PromelaInline::PROMELA_EVENT_SOURCE;
- } else if (isInPromelaCode) {
- promInl.content += line;
- promInl.content += "\n";
- }
- }
- // inline code ends with comment
- if (isInPromelaCode) {
- code.push_back(promInl);
+ boost::trim(line);
+ if (boost::starts_with(line, "promela")) {
+ std::cerr << "Split multiple #promela pragmas into multiple comments!" << std::endl;
+ break;
+ }
+ contentSS << seperator << line;
+ seperator = "\n";
}
+ content = contentSS.str();
+}
+
+
+PromelaInlines::PromelaInlines(const Arabica::DOM::Node<std::string>& node) {
+ NodeSet<std::string> levelNodes;
+ levelNodes.push_back(node);
+
+ size_t level = 0;
+ while(levelNodes.size() > 0) {
+ PromelaInline* predecessor = NULL;
+
+ // iterate all nodes at given level
+ for (int i = 0; i < levelNodes.size(); i++) {
- // iterate inlinesFound and classify
-// PromelaEventSource promES; // TODO! use this
+ // get all comments
+ NodeSet<std::string> comments = InterpreterImpl::filterChildType(Node_base::COMMENT_NODE, levelNodes[i]);
+ for (int j = 0; j < comments.size(); j++) {
+ PromelaInline* tmp = new PromelaInline(comments[j]);
+ if (tmp->type == PromelaInline::PROMELA_NIL) {
+ delete tmp;
+ continue;
+ }
+ if (predecessor != NULL) {
+ tmp->prevSibling = predecessor;
+ predecessor->nextSibling = tmp;
+ }
+ tmp->level = level;
+ tmp->container = Element<std::string>(levelNodes[i]);
+ predecessor = tmp;
+ inlines[levelNodes[i]].push_back(tmp);
+ allInlines.push_back(tmp);
+ }
+ }
+
+ levelNodes = InterpreterImpl::filterChildType(Node_base::ELEMENT_NODE, levelNodes);
+ level++;
+ }
}
+void PromelaInline::dump() {
+#if 0
+ switch(type) {
+ case PROMELA_NIL:
+ std::cerr << "PROMELA_NIL" << std::endl;
+ break;
+ case PROMELA_CODE:
+ std::cerr << "PROMELA_CODE" << std::endl;
+ break;
+ case PROMELA_EVENT_SOURCE_ALL:
+ std::cerr << "PROMELA_EVENT_SOURCE" << std::endl;
+ break;
+ case PROMELA_INVOKER:
+ std::cerr << "PROMELA_INVOKER" << std::endl;
+ break;
+ case PROMELA_PROGRESS_LABEL:
+ std::cerr << "PROMELA_PROGRESS_LABEL" << std::endl;
+ break;
+ case PROMELA_ACCEPT_LABEL:
+ std::cerr << "PROMELA_ACCEPT_LABEL" << std::endl;
+ break;
+ case PROMELA_END_LABEL:
+ std::cerr << "PROMELA_END_LABEL" << std::endl;
+ break;
+ }
+#endif
+}
+
+
void ChartToPromela::writeIfBlock(std::ostream& stream, const Arabica::XPath::NodeSet<std::string>& condChain, int indent) {
if (condChain.size() == 0)
return;
@@ -2157,6 +1964,13 @@ void ChartToPromela::writeDeclarations(std::ostream& stream) {
stream << "_x_t " << _prefix << "_x;" << std::endl;
}
+ std::list<PromelaInline*> pmls = pmlInlines.getAllOfType(PromelaInline::PROMELA_EVENT_ALL_BUT | PromelaInline::PROMELA_EVENT_ONLY);
+ for (std::list<PromelaInline*>::iterator pmlIter = pmls.begin(); pmlIter != pmls.end(); pmlIter++) {
+ if ((*pmlIter)->container && LOCALNAME((*pmlIter)->container) == "invoke") {
+ stream << "bool " << _prefix << ATTR_CAST((*pmlIter)->container, "id") << "Running;" << std::endl;
+ }
+ }
+
stream << std::endl << std::endl;
// get all data elements
@@ -2206,41 +2020,6 @@ void ChartToPromela::writeDeclarations(std::ostream& stream) {
std::string decl = type + " " + _prefix + identifier + arrSize;
stream << decl << ";" << std::endl;
-#if 0
-
- NodeSet<std::string> dataText = filterChildType(Node_base::TEXT_NODE, data, true);
- std::string value;
- if (dataText.size() > 0) {
- value = dataText[0].getNodeValue();
- boost::trim(value);
- }
-
- if (identifier.length() > 0) {
-
- size_t bracketPos = type.find("[");
- if (bracketPos != std::string::npos) {
- arrSize = type.substr(bracketPos, type.length() - bracketPos);
- type = type.substr(0, bracketPos);
- }
- std::string decl = type + " " + _prefix + identifier + arrSize;
- stream << decl << ";" << std::endl;
-
- if (arrSize.length() > 0) {
- _varInitializers.push_back(value);
- } else {
- if (expression.length() > 0) {
- // id and expr given
- _varInitializers.push_back(identifier + " = " + boost::trim_copy(expression) + ";");
- } else if (value.length() > 0) {
- // id and text content given
- _varInitializers.push_back(identifier + " = " + value + ";");
- }
- }
- } else if (value.length() > 0) {
- // no id but text content given
- stream << beautifyIndentation(value) << std::endl;
- }
-#endif
}
@@ -2277,33 +2056,10 @@ void ChartToPromela::writeDeclarations(std::ostream& stream) {
}
stream << std::endl;
- if (_globalEventSource || _invokers.size() > 0)
- stream << "/* event sources */" << std::endl;
-
- if (_globalEventSource) {
- _globalEventSource.writeDeclarations(stream);
- }
-
- std::map<std::string, PromelaEventSource>::iterator invIter = _invokers.begin();
- while(invIter != _invokers.end()) {
- invIter->second.writeDeclarations(stream);
- invIter++;
- }
-
+
}
void ChartToPromela::writeEventSources(std::ostream& stream) {
- std::list<PromelaInline>::iterator inlineIter;
-
- if (_globalEventSource) {
- _globalEventSource.writeBody(stream);
- }
-
- std::map<std::string, PromelaEventSource>::iterator invIter = _invokers.begin();
- while(invIter != _invokers.end()) {
- invIter->second.writeBody(stream);
- invIter++;
- }
}
void ChartToPromela::writeStartInvoker(std::ostream& stream, const Arabica::DOM::Node<std::string>& node, ChartToPromela* invoker, int indent) {
@@ -2427,27 +2183,96 @@ void ChartToPromela::writeFSM(std::ostream& stream) {
stream << " scheduleMachines();" << std::endl << std::endl;
}
+ std::list<PromelaInline*> eventSources = pmlInlines.getAllOfType(PromelaInline::PROMELA_EVENT_ALL_BUT |
+ PromelaInline::PROMELA_EVENT_ONLY);
+
stream << " atomic {" << std::endl;
stream << " /* pop an event */" << std::endl;
stream << " if" << std::endl;
stream << " :: len(" << _prefix << "iQ) != 0 -> " << _prefix << "iQ ? " << _prefix << "_event /* from internal queue */" << std::endl;
- stream << " :: else -> " << _prefix << "eQ ? " << _prefix << "_event /* from external queue */" << std::endl;
- stream << " fi;" << std::endl << std::endl;
+ if (eventSources.size() > 0) {
+ stream << " :: len(" << _prefix << "eQ) != 0 -> " << _prefix << "eQ ? " << _prefix << "_event /* from external queue */" << std::endl;
+ stream << " :: else -> {" << std::endl;
+ stream << " /* external queue is empty -> automatically enqueue external event */" << std::endl;
+ stream << " if" << std::endl;
-#if 0
- if (!_analyzer->usesComplexEventStruct()) {
- stream << " printf(\"======= Process %d dequeued %d\\n\", _pid, " << _prefix << "_event);" << std::endl;
+ for (std::list<PromelaInline*>::iterator esIter = eventSources.begin(); esIter != eventSources.end(); esIter++) {
+ PromelaEventSource es(**esIter);
+
+ std::string condition = "true";
+
+ if (LOCALNAME(es.container) == "invoke") {
+ if (HAS_ATTR_CAST(es.container, "id")) {
+ condition = _prefix + ATTR_CAST(es.container, "id") + "Running";
+ } else {
+ LOG(ERROR) << "Invoker has no id";
+ }
+ } else if (HAS_ATTR(es.container, "id")) {
+ condition = _prefix + "_x.states[" + _analyzer->macroForLiteral(ATTR(es.container, "id")) + "]";
+ }
+ stream << " :: " << condition << " -> {" << std::endl;
+
+ if (es.type == PromelaInline::PROMELA_EVENT_ALL_BUT) {
+ std::string excludeEventDescs;
+ for (std::list<Data>::iterator evIter = es.events.array.begin(); evIter != es.events.array.end(); evIter++) {
+ excludeEventDescs += " " + evIter->atom;
+ }
+
+ NodeSet<std::string> transitions = filterChildElements("transition", es.container, true);
+ std::set<std::string> eventNames;
+ for (int i = 0; i < transitions.size(); i++) {
+ if (!HAS_ATTR_CAST(transitions[i], "event"))
+ continue;
+ if (HAS_ATTR_CAST(transitions[i], "cond") && ATTR_CAST(transitions[i], "cond").find("_event.") != std::string::npos)
+ continue;
+ std::list<std::string> events = InterpreterImpl::tokenizeIdRefs(ATTR_CAST(transitions[i], "event"));
+ for (std::list<std::string>::iterator evIter = events.begin(); evIter != events.end(); evIter++) {
+ std::string eventName = *evIter;
+ if (boost::ends_with(eventName, "*"))
+ eventName = eventName.substr(0, eventName.size() - 1);
+ if (boost::ends_with(eventName, "."))
+ eventName = eventName.substr(0, eventName.size() - 1);
+
+ // is this event excluded?
+ if (!InterpreterImpl::nameMatch(excludeEventDescs, eventName)) {
+ eventNames.insert(eventName);
+ }
+ }
+ }
+
+ if (eventNames.size() > 0) {
+ stream << " if " << std::endl;
+ for (std::set<std::string>::iterator evIter = eventNames.begin(); evIter != eventNames.end(); evIter++) {
+ stream << " :: true -> { " << _prefix << "_event.name = " << _analyzer->macroForLiteral(*evIter) << " }" << std::endl;
+ }
+ stream << " fi " << std::endl;
+ }
+
+ } else if (es.type == PromelaInline::PROMELA_EVENT_ONLY) {
+ if (es.events.array.size() > 0) {
+ stream << " if " << std::endl;
+ for (std::list<Data>::iterator evIter = es.events.array.begin(); evIter != es.events.array.end(); evIter++) {
+ stream << " :: true -> { " << std::endl;
+ stream << dataToAssignments(" _event", *evIter);
+ stream << " } " << std::endl;
+ }
+ stream << " fi " << std::endl;
+ } else {
+ stream << dataToAssignments(" _event", es.events);
+ }
+ } else {
+ assert(false);
+ }
+ stream << " }" << std::endl;
+ }
+
+ stream << " fi" << std::endl;
+ stream << " }" << std::endl;
} else {
- stream << " printf(\"======= Process %d dequeued %d\\n\", _pid, " << _prefix << "_event.name);" << std::endl;
- if (_analyzer->usesEventField("sendid"))
- stream << " printf(\" sendid: %d\\n\", " << _prefix << "_event.sendid);" << std::endl;
- if (_analyzer->usesEventField("invokeid"))
- stream << " printf(\" invokeid: %d\\n\", " << _prefix << "_event.invokeid);" << std::endl;
- if (_analyzer->usesEventField("delay"))
- stream << " printf(\" delay: %d\\n\", " << _prefix << "_event.delay);" << std::endl;
+ stream << " :: else -> " << _prefix << "eQ ? " << _prefix << "_event /* from external queue */" << std::endl;
}
- stream << std::endl;
-#endif
+ stream << " fi;" << std::endl << std::endl;
+
stream << " /* terminate if we are stopped */" << std::endl;
stream << " if" << std::endl;
@@ -2532,16 +2357,6 @@ void ChartToPromela::writeFSM(std::ostream& stream) {
stream << " removePendingEventsForInvoker(" << _analyzer->macroForLiteral(this->_invokerid) << ")" << std::endl;
}
- // stop all event sources
- if (_globalEventSource)
- _globalEventSource.writeStop(stream, 2);
-
- std::map<std::string, PromelaEventSource>::iterator invIter = _invokers.begin();
- while(invIter != _invokers.end()) {
- invIter->second.writeStop(stream, 2);
- invIter++;
- }
-
stream << " }" << std::endl;
stream << "}" << std::endl;
}
@@ -2907,8 +2722,7 @@ void ChartToPromela::writeMain(std::ostream& stream) {
}
stream << std::endl;
}
- if (_globalEventSource)
- _globalEventSource.writeStart(stream, 1);
+
stream << " run " << (_prefix.size() == 0 ? "machine_" : _prefix) << "run() priority 10;" << std::endl;
stream << "}" << std::endl;
@@ -3175,44 +2989,44 @@ void ChartToPromela::initNodes() {
}
}
}
- // external event names from comments and event sources
- NodeSet<std::string> promelaEventSourceComments;
- NodeSet<std::string> invokers = _xpath.evaluate("//" + _nsInfo.xpathPrefix + "invoke", _scxml).asNodeSet();
- promelaEventSourceComments.push_back(filterChildType(Node_base::COMMENT_NODE, invokers, false)); // comments in invoke elements
- promelaEventSourceComments.push_back(filterChildType(Node_base::COMMENT_NODE, _scxml, false)); // comments in scxml element
-
- for (int i = 0; i < promelaEventSourceComments.size(); i++) {
- PromelaInlines promInls = PromelaInlines::fromNode(promelaEventSourceComments[i]);
+
+ {
+ // gather all inline promela comments
+ pmlInlines = PromelaInlines(_scxml);
+ if (pmlInlines.getAllOfType(PromelaInline::PROMELA_EVENT_ONLY).size() > 0)
+ _analyzer->addCode("_x.states", this);
- for ( std::list<PromelaInline>::iterator promIter = promInls.code.begin(); promIter != promInls.code.end(); promIter++) {
- if (promIter->type == PromelaInline::PROMELA_EVENT_SOURCE || promIter->type == PromelaInline::PROMELA_EVENT_SOURCE_CUSTOM) {
- PromelaEventSource promES(*promIter, _analyzer, _externalQueueLength);
- if (TAGNAME_CAST(promelaEventSourceComments[i].getParentNode()) == "scxml") {
- promES.type = PromelaEventSource::PROMELA_EVENT_SOURCE_GLOBAL;
- promES.name = "global";
- _globalEventSource = promES;
- } else {
- Element<std::string> invoker = Element<std::string>(promelaEventSourceComments[i].getParentNode());
- if (!HAS_ATTR_CAST(promelaEventSourceComments[i].getParentNode(), "id")) {
- invoker.setAttribute("invokeid", "invoker" + toStr(_invokers.size())); // if there is no invokeid, enumerate
- } else {
- invoker.setAttribute("invokeid", ATTR_CAST(promelaEventSourceComments[i].getParentNode(), "id"));
+ // register events and string literals
+ for (std::list<PromelaInline*>::iterator inlIter = pmlInlines.allInlines.begin(); inlIter != pmlInlines.allInlines.end(); inlIter++) {
+ if ((*inlIter)->type != (PromelaInline::PROMELA_EVENT_ONLY))
+ continue;
+
+ Data json = Data::fromJSON((*inlIter)->content);
+ if (!json.empty()) {
+ std::list<std::string> eventNames = PromelaInlines::getEventNames(json);
+ for (std::list<std::string>::iterator evIter = eventNames.begin(); evIter != eventNames.end(); evIter++) {
+ _analyzer->addEvent(*evIter);
+ }
+
+ std::list<std::string> stringLiterals = PromelaInlines::getStringLiterals(json);
+ for (std::list<std::string>::iterator strIter = stringLiterals.begin(); strIter != stringLiterals.end(); strIter++) {
+ _analyzer->addLiteral(*strIter);
+ }
+
+ if (json.array.size() > 0) {
+ for (int i = 0; i < json.array.size(); i++) {
+ std::string expr = dataToAssignments("_event", json.item(i));
+ _analyzer->addCode(expr, this);
}
- std::string invokeId = ATTR_CAST(promelaEventSourceComments[i].getParentNode(), "invokeid");
-
- promES.type = PromelaEventSource::PROMELA_EVENT_SOURCE_INVOKER;
- promES.name = invokeId;
- _invokers[invokeId] = promES;
+ } else {
+ std::string expr = dataToAssignments("_event", json);
+ _analyzer->addCode(expr, this);
+
}
+
}
}
}
-
- if (_globalEventSource || _invokers.size() > 0) {
- _allowEventInterleaving = true;
- } else {
- _allowEventInterleaving = false;
- }
// add platform variables as string literals
_analyzer->addLiteral(_prefix + "_sessionid");
@@ -3331,11 +3145,55 @@ void ChartToPromela::initNodes() {
}
}
-
+std::list<std::string> PromelaInlines::getStringLiterals(const Data& data) {
+ std::list<std::string> literals;
+ if (data.atom.size() > 0 && data.type == Data::VERBATIM) {
+ literals.push_back(data.atom);
+ }
+ if (data.array.size() > 0) {
+ for (std::list<Data>::const_iterator arrIter = data.array.begin(); arrIter != data.array.end(); arrIter++) {
+ std::list<std::string> nested = getStringLiterals(*arrIter);
+ literals.insert(literals.end(), nested.begin(), nested.end());
+ }
+ }
+ if (data.compound.size() > 0) {
+ for (std::map<std::string, Data>::const_iterator compIter = data.compound.begin(); compIter != data.compound.end(); compIter++) {
+ std::list<std::string> nested = getStringLiterals(compIter->second);
+ literals.insert(literals.end(), nested.begin(), nested.end());
+ }
+ }
+ return literals;
+}
+
+std::list<std::string> PromelaInlines::getEventNames(const Data& data) {
+ std::list<std::string> eventNames;
+ if (data.compound.size() > 0 && data.hasKey("name")) {
+ eventNames.push_back(data.at("name"));
+ }
+ if (data.array.size() > 0) {
+ for (std::list<Data>::const_iterator arrIter = data.array.begin(); arrIter != data.array.end(); arrIter++) {
+ std::list<std::string> nested = getEventNames(*arrIter);
+ eventNames.insert(eventNames.end(), nested.begin(), nested.end());
+ }
+ }
+ if (data.compound.size() > 0) {
+ for (std::map<std::string, Data>::const_iterator compIter = data.compound.begin(); compIter != data.compound.end(); compIter++) {
+ std::list<std::string> nested = getEventNames(compIter->second);
+ eventNames.insert(eventNames.end(), nested.begin(), nested.end());
+ }
+ }
+
+ return eventNames;
+}
+
std::string ChartToPromela::dataToAssignments(const std::string& prefix, const Data& data) {
std::stringstream retVal;
if (data.atom.size() > 0) {
- retVal << prefix << " = " << data.atom << ";" << std::endl;
+ if (data.type == Data::VERBATIM) {
+ retVal << prefix << " = " << _analyzer->macroForLiteral(data.atom) << ";" << std::endl;
+ } else {
+ retVal << prefix << " = " << data.atom << ";" << std::endl;
+ }
} else if (data.compound.size() > 0) {
for (std::map<std::string, Data>::const_iterator cIter = data.compound.begin(); cIter != data.compound.end(); cIter++) {
retVal << dataToAssignments(prefix + "." + cIter->first, cIter->second);
@@ -3358,18 +3216,6 @@ std::string ChartToPromela::sanitizeCode(const std::string& code) {
return replaced;
}
-void PromelaInline::dump() {
-// std::list<std::list<std::string> >::iterator outerIter = sequences.begin();
-// while(outerIter != sequences.end()) {
-// std::list<std::string>::iterator innerIter = outerIter->begin();
-// while(innerIter != outerIter->end()) {
-// std::cout << *innerIter << " ";
-// innerIter++;
-// }
-// std::cout << std::endl;
-// outerIter++;
-// }
-}
void ChartToPromela::writeProgram(std::ostream& stream) {
diff --git a/src/uscxml/transform/ChartToPromela.h b/src/uscxml/transform/ChartToPromela.h
index 9a8b0a3..1b0b16d 100644
--- a/src/uscxml/transform/ChartToPromela.h
+++ b/src/uscxml/transform/ChartToPromela.h
@@ -36,31 +36,96 @@ namespace uscxml {
class PromelaCodeAnalyzer;
class ChartToPromela;
class PromelaParserNode;
-
+
class USCXML_API PromelaInline {
public:
- PromelaInline() : type(PROMELA_NIL) {}
+ enum PromelaInlineType {
+ PROMELA_NIL = 0x0000,
+ PROMELA_LTL = 0x0001,
+ PROMELA_CODE = 0x0002,
+ PROMELA_EVENT_ALL_BUT = 0x0004,
+ PROMELA_EVENT_ONLY = 0x0008,
+ PROMELA_PROGRESS_LABEL = 0x0010,
+ PROMELA_ACCEPT_LABEL = 0x0020,
+ PROMELA_END_LABEL = 0x0040
+ };
+ PromelaInline(const Arabica::DOM::Node<std::string>& node);
+ virtual ~PromelaInline() {}
+
operator bool() {
return (type != PROMELA_NIL);
}
- void dump();
-
- enum PromelaInlineType {
- PROMELA_NIL,
- PROMELA_CODE,
- PROMELA_EVENT_SOURCE,
- PROMELA_EVENT_SOURCE_CUSTOM,
- PROMELA_PROGRESS_LABEL,
- PROMELA_ACCEPT_LABEL,
- PROMELA_END_LABEL
- };
+ std::list<PromelaInline*> children;
+ PromelaInline* prevSibling;
+ PromelaInline* nextSibling;
+
+ virtual void dump();
+ virtual bool relatesTo(const Arabica::DOM::Node<std::string>& node) {
+ return container == node;
+ }
+
+ size_t level;
std::string content;
+ Arabica::DOM::Element<std::string> container;
PromelaInlineType type;
+
+protected:
+ PromelaInline() : prevSibling(NULL), nextSibling(NULL), type(PROMELA_NIL) {};
+};
+
+class USCXML_API PromelaInlines {
+public:
+
+ PromelaInlines(const Arabica::DOM::Node<std::string>& node);
+ PromelaInlines() {}
+
+ virtual ~PromelaInlines();
+
+ std::list<PromelaInline*> getRelatedTo(const Arabica::DOM::Node<std::string>& node, PromelaInline::PromelaInlineType type);
+ std::list<PromelaInline*> getAllOfType(uint32_t type);
+
+ std::map<Arabica::DOM::Node<std::string>, std::list<PromelaInline*> > inlines;
+ std::list<PromelaInline*> allInlines;
+
+ static std::list<std::string> getStringLiterals(const Data& data);
+ static std::list<std::string> getEventNames(const Data& data);
+
+
+};
+
+class USCXML_API PromelaEventSource : public PromelaInline {
+public:
+ PromelaEventSource(const PromelaInline& pmlInline) {
+ type = pmlInline.type;
+ container = pmlInline.container;
+ content = pmlInline.content;
+ events = Data::fromJSON(pmlInline.content);
+ }
+
+ virtual bool relatesTo(const Arabica::DOM::Node<std::string>& node) {
+ return container == node || InterpreterImpl::isDescendant(node, container);
+ }
+
+ Data events;
};
+#if 0
+
+
+class USCXML_API PromelaInlinesAutoEvents : public PromelaInline {
+public:
+ virtual ~PromelaInlinesAutoEvents() {}
+ virtual bool relatesTo(const Arabica::DOM::Node<std::string>&);
+ virtual void setContent(const std::string& content);
+ virtual void dump();
+
+ std::map<std::string, Data> states;
+};
+
+
class USCXML_API PromelaEventSource {
public:
@@ -93,37 +158,8 @@ public:
PromelaCodeAnalyzer* analyzer;
};
-class USCXML_API PromelaInlines {
-public:
-
- static PromelaInlines fromNodeSet(const Arabica::XPath::NodeSet<std::string>& node, bool recurse = false);
- static PromelaInlines fromNode(const Arabica::DOM::Node<std::string>& node);
- static PromelaInlines fromString(const std::string& text);
+#endif
- PromelaInlines(const std::string& text, const Arabica::DOM::Node<std::string>& node);
- PromelaInlines();
-
- void merge(const PromelaInlines& other) {
- code.insert(code.end(), other.code.begin(), other.code.end());
- nrProgressLabels += other.nrProgressLabels;
- nrAcceptLabels += other.nrAcceptLabels;
- nrEndLabels += other.nrEndLabels;
- nrEventSources += other.nrEventSources;
- nrCodes += other.nrCodes;
- }
-
- operator bool() {
- return code.size() > 0;
- }
-
- std::list<PromelaInline> code;
- int nrProgressLabels;
- int nrAcceptLabels;
- int nrEndLabels;
- int nrEventSources;
- int nrCodes;
-};
-
class USCXML_API PromelaCodeAnalyzer {
public:
class PromelaTypedef {
@@ -172,6 +208,9 @@ public:
bool usesInPredicate() {
return _usesInPredicate;
}
+ void usesInPredicate(bool value) {
+ _usesInPredicate = value;
+ }
bool usesPlatformVars() {
return _usesPlatformVars;
}
@@ -366,8 +405,9 @@ protected:
uint32_t _externalQueueLength;
uint32_t _internalQueueLength;
- std::map<std::string, PromelaEventSource> _invokers;
- PromelaEventSource _globalEventSource;
+ PromelaInlines pmlInlines;
+// std::map<std::string, PromelaEventSource> _invokers;
+// PromelaEventSource _globalEventSource;
std::map<std::string, std::map<std::string, size_t> > _historyMembers; // ids of all history states
std::set<std::string> _dataModelVars;