summaryrefslogtreecommitdiffstats
path: root/src/bindings
diff options
context:
space:
mode:
Diffstat (limited to 'src/bindings')
-rw-r--r--src/bindings/CMakeLists.txt19
-rw-r--r--src/bindings/swig/csharp/CMakeLists.txt85
-rw-r--r--src/bindings/swig/csharp/stl_list.i (renamed from src/bindings/swig/java/stl_list.i)0
-rw-r--r--src/bindings/swig/csharp/stl_set.i (renamed from src/bindings/swig/java/stl_set.i)0
-rw-r--r--src/bindings/swig/csharp/uscxml.i185
-rw-r--r--src/bindings/swig/java/JavaDataModel.cpp8
-rw-r--r--src/bindings/swig/java/JavaInvoker.cpp8
-rw-r--r--src/bindings/swig/java/org/uscxml/Data.java2
-rw-r--r--src/bindings/swig/java/uscxml.i43
-rw-r--r--src/bindings/swig/msvc/inttypes.h304
-rw-r--r--src/bindings/swig/stl_list.i49
-rw-r--r--src/bindings/swig/stl_set.i73
-rw-r--r--src/bindings/swig/wrapped/WrappedDataModel.cpp8
-rw-r--r--src/bindings/swig/wrapped/WrappedDataModel.h (renamed from src/bindings/swig/java/JavaDataModel.h)19
-rw-r--r--src/bindings/swig/wrapped/WrappedInvoker.cpp8
-rw-r--r--src/bindings/swig/wrapped/WrappedInvoker.h (renamed from src/bindings/swig/java/JavaInvoker.h)16
16 files changed, 766 insertions, 61 deletions
diff --git a/src/bindings/CMakeLists.txt b/src/bindings/CMakeLists.txt
index b1f2429..667bfb9 100644
--- a/src/bindings/CMakeLists.txt
+++ b/src/bindings/CMakeLists.txt
@@ -1,9 +1,28 @@
+# if you build swig from sources on windows, this is where it will end up
+# see also: http://www.swig.org/Doc2.0/Windows.html#Windows_mingw_msys
+if (CMAKE_CROSSCOMPILING)
+ return()
+endif()
+
+if (WIN32)
+ if(EXISTS "${PROJECT_BINARY_DIR}/../swig/")
+ LIST(APPEND CMAKE_PROGRAM_PATH "${PROJECT_BINARY_DIR}/../swig/")
+ elseif(EXISTS "${PROJECT_BINARY_DIR}/../../swig/")
+ LIST(APPEND CMAKE_PROGRAM_PATH "${PROJECT_BINARY_DIR}/../../swig/")
+ endif()
+
+ LIST(APPEND CMAKE_PROGRAM_PATH "C:/Program Files/swig") # swig.exe
+endif()
+LIST(APPEND CMAKE_PROGRAM_PATH $ENV{SWIG_DIR})
+
find_package(SWIG)
+
if (SWIG_FOUND)
if(SWIG_VERSION VERSION_GREATER 2.0.4)
MARK_AS_ADVANCED(SWIG_DIR SWIG_EXECUTABLE SWIG_VERSION)
INCLUDE(${SWIG_USE_FILE})
add_subdirectory(swig/java)
+ add_subdirectory(swig/csharp)
add_subdirectory(swig/php)
else()
message(STATUS "SWIG version 2.0.5 is required, found ${SWIG_VERSION} - skipping java wrapper generation")
diff --git a/src/bindings/swig/csharp/CMakeLists.txt b/src/bindings/swig/csharp/CMakeLists.txt
new file mode 100644
index 0000000..6310778
--- /dev/null
+++ b/src/bindings/swig/csharp/CMakeLists.txt
@@ -0,0 +1,85 @@
+# generate JNI library and create a jar
+# Make from within Eclipse fails miserably with the whole thing
+
+if (WIN32)
+ LIST(APPEND CMAKE_PROGRAM_PATH "C:/Program Files (x86)/swig") # swig.exe
+ #LIST(APPEND CMAKE_PROGRAM_PATH "C:/Windows/Microsoft.NET/Framework/v4.0.30319") # CSharp compiler
+ LIST(APPEND CMAKE_PROGRAM_PATH "C:/Windows/Microsoft.NET/Framework/v3.5") # CSharp compiler
+endif()
+
+FIND_PROGRAM(DMCS_EXECUTABLE dmcs PATHS $ENV{DMCS_HOME} ENV PATH ) # Mono compiler
+FIND_PROGRAM(CSC_EXECUTABLE csc PATHS $ENV{CSC_HOME} ENV PATH ) # CSharp compiler
+
+if (DMCS_EXECUTABLE OR CSC_EXECUTABLE)
+
+ # unset all library suffixes as swig will hardcode a library without
+ SET(LIB_POSTFIX ${CMAKE_LIBRARY_POSTFIX})
+
+ SET(CMAKE_DEBUG_POSTFIX "")
+ SET(CMAKE_RELEASE_POSTFIX "")
+ SET(CMAKE_RELWITHDEBINFO_POSTFIX "")
+ SET(CMAKE_MINSIZEREL_POSTFIX "")
+ SET(CMAKE_LIBRARY_POSTFIX "")
+
+ if (MSVC)
+ # MSVC does not include inttypes.h but SWIG needs it
+ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../msvc)
+ endif()
+
+ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+
+ SET(CMAKE_SWIG_FLAGS "")
+ SET(USCXML_CSHARP_NAMESPACE "org.uscxml")
+ SET(USCXML_CSHARP_DIR "org/uscxml")
+
+ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
+ list(APPEND CMAKE_SWIG_FLAGS "-DDEBUG")
+ endif()
+
+
+ # we need ; to produce a space with the package .. weird
+ SET_SOURCE_FILES_PROPERTIES(uscxml.i PROPERTIES SWIG_FLAGS "-w401;-namespace;${USCXML_CSHARP_NAMESPACE}")
+ SET_SOURCE_FILES_PROPERTIES(uscxml.i PROPERTIES CPLUSPLUS ON)
+ SET(CMAKE_SWIG_OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/${USCXML_CSHARP_DIR}")
+
+ set(USCXML_LANGUAGE_BINDINGS "csharp ${USCXML_LANGUAGE_BINDINGS}")
+
+ SWIG_ADD_MODULE(uscxmlNativeCSharp csharp uscxml.i)
+ set_target_properties(uscxmlNativeCSharp PROPERTIES FOLDER "Bindings")
+ set_target_properties(uscxmlNativeCSharp
+ PROPERTIES
+ ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/csharp${LIB_POSTFIX}"
+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/csharp${LIB_POSTFIX}"
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/csharp${LIB_POSTFIX}"
+ )
+
+ set_target_properties(uscxmlNativeCSharp PROPERTIES COMPILE_FLAGS "-DSWIG")
+ swig_link_libraries(uscxmlNativeCSharp uscxml)
+
+ # build managed code part
+ if (CSC_EXECUTABLE)
+ ADD_CUSTOM_TARGET(csharp
+ COMMAND ${CSC_EXECUTABLE}
+ /target:library
+ /out:${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/uscxmlCSharp.dll
+ *.cs
+ WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/src/bindings/swig/csharp/org/uscxml
+ COMMENT "Creating umundoCSharp.dll for C# ...")
+ else()
+ ADD_CUSTOM_TARGET(csharp
+ COMMAND ${DMCS_EXECUTABLE}
+ -target:library
+ /out:${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/uscxmlCSharp.dll
+ *.cs
+ WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/src/bindings/swig/csharp/org/uscxml
+ COMMENT "Creating umundoCSharp.dll for Mono ...")
+ endif()
+
+ add_dependencies(csharp umundoNativeCSharp)
+ if (BUILD_TESTS)
+ add_dependencies(ALL_TESTS csharp)
+ endif()
+ set_target_properties(csharp PROPERTIES FOLDER "Bindings")
+
+ set(USCXML_LANGUAGE_BINDINGS ${USCXML_LANGUAGE_BINDINGS} PARENT_SCOPE)
+endif() \ No newline at end of file
diff --git a/src/bindings/swig/java/stl_list.i b/src/bindings/swig/csharp/stl_list.i
index aabd448..aabd448 100644
--- a/src/bindings/swig/java/stl_list.i
+++ b/src/bindings/swig/csharp/stl_list.i
diff --git a/src/bindings/swig/java/stl_set.i b/src/bindings/swig/csharp/stl_set.i
index d009a7b..d009a7b 100644
--- a/src/bindings/swig/java/stl_set.i
+++ b/src/bindings/swig/csharp/stl_set.i
diff --git a/src/bindings/swig/csharp/uscxml.i b/src/bindings/swig/csharp/uscxml.i
new file mode 100644
index 0000000..07604c4
--- /dev/null
+++ b/src/bindings/swig/csharp/uscxml.i
@@ -0,0 +1,185 @@
+%module(directors="1", allprotected="1") uscxmlNativeCSharp
+
+// provide a macro for the header files
+#define SWIGIMPORTED 1
+
+// import swig typemaps
+//%include <inttypes.i>
+
+%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>
+
+typedef uscxml::Data Data;
+typedef uscxml::Event Event;
+typedef uscxml::InvokeRequest InvokeRequest;
+typedef uscxml::SendRequest SendRequest;
+
+// disable warning related to unknown base class
+#pragma SWIG nowarn=401
+//%ignore boost::enable_shared_from_this;
+
+%csconst(1);
+
+# %shared_ptr(uscxml::dom::Element);
+# %shared_ptr(uscxml::dom::Executable);
+
+%rename(equals) operator==;
+%rename(isValid) operator bool;
+%ignore operator!=;
+%ignore operator<;
+%ignore operator=;
+%ignore operator[];
+%ignore operator std::list<Data>;
+%ignore operator std::string;
+%ignore operator std::map<std::string,Data>;
+%ignore operator<<;
+
+
+//**************************************************
+// This ends up in the generated wrapper code
+//**************************************************
+
+%{
+
+#include "../../../uscxml/Message.h"
+#include "../../../uscxml/Factory.h"
+#include "../../../uscxml/Interpreter.h"
+
+//#include <DOM/Document.hpp>
+//#include <DOM/Node.hpp>
+//#include <DOM/Element.hpp>
+//#include <DOM/Attr.hpp>
+//#include <DOM/Text.hpp>
+
+#include "../wrapped/WrappedInvoker.h"
+#include "../wrapped/WrappedDataModel.h"
+
+using namespace uscxml;
+using namespace Arabica::DOM;
+
+#include "../wrapped/WrappedInvoker.cpp"
+#include "../wrapped/WrappedDataModel.cpp"
+
+%}
+
+%ignore uscxml::NumAttr;
+%ignore uscxml::SCXMLParser;
+%ignore uscxml::InterpreterImpl;
+
+%ignore create();
+
+%ignore uscxml::Interpreter::getDelayQueue();
+
+%ignore uscxml::WrappedInvoker::create(InterpreterImpl*);
+
+%ignore uscxml::WrappedDataModel::create(InterpreterImpl*);
+%ignore uscxml::WrappedDataModel::init(const Arabica::DOM::Element<std::string>&, const Arabica::DOM::Document<std::string>&, const std::string&);
+%ignore uscxml::WrappedDataModel::init(const std::string&, const Data&);
+%ignore uscxml::WrappedDataModel::assign(const Arabica::DOM::Element<std::string>&, const Arabica::DOM::Document<std::string>&, const std::string&);
+%ignore uscxml::WrappedDataModel::assign(const std::string&, const Data&);
+%ignore uscxml::WrappedDataModel::eval(const Arabica::DOM::Element<std::string>&, const std::string&);
+
+%ignore uscxml::Event::Event(const Arabica::DOM::Node<std::string>&);
+%ignore uscxml::Event::getStrippedDOM;
+%ignore uscxml::Event::getFirstDOMElement;
+%ignore uscxml::Event::getDOM();
+%ignore uscxml::Event::setDOM(const Arabica::DOM::Document<std::string>&);
+%ignore uscxml::Event::toDocument();
+
+%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(ParamPair) std::pair<std::string, uscxml::Data>;
+%template(ParamPairVector) std::vector<std::pair<std::string, uscxml::Data> >;
+%template(IOProcMap) std::map<std::string, uscxml::IOProcessor>;
+%template(InvokerMap) std::map<std::string, uscxml::Invoker>;
+
+%rename Data DataNative;
+
+%feature("director") uscxml::WrappedInvoker;
+%feature("director") uscxml::WrappedDataModel;
+
+// translate param multimap to Map<String, List<Data> >
+%rename(getParamsNative) uscxml::Event::getParams();
+%csmethodmodifiers uscxml::Event::getParams() "private";
+
+%extend uscxml::Event {
+ std::vector<std::pair<std::string, Data> > getParamPairs() {
+ std::vector<std::pair<std::string, Data> > pairs;
+ std::multimap<std::string, Data>::iterator paramPairIter = self->getParams().begin();
+ while(paramPairIter != self->getParams().end()) {
+ pairs.push_back(*paramPairIter);
+ paramPairIter++;
+ }
+ return pairs;
+ }
+};
+
+%extend uscxml::Interpreter {
+ std::vector<std::string> getIOProcessorKeys() {
+ std::vector<std::string> keys;
+ std::map<std::string, IOProcessor>::const_iterator iter = self->getIOProcessors().begin();
+ while(iter != self->getIOProcessors().end()) {
+ keys.push_back(iter->first);
+ iter++;
+ }
+ return keys;
+ }
+
+ std::vector<std::string> getInvokerKeys() {
+ std::vector<std::string> keys;
+ std::map<std::string, Invoker>::const_iterator iter = self->getInvokers().begin();
+ while(iter != self->getInvokers().end()) {
+ keys.push_back(iter->first);
+ iter++;
+ }
+ return keys;
+ }
+
+};
+
+%extend uscxml::Data {
+ std::vector<std::string> getCompundKeys() {
+ std::vector<std::string> keys;
+ std::map<std::string, Data>::const_iterator iter = self->compound.begin();
+ while(iter != self->compound.end()) {
+ keys.push_back(iter->first);
+ iter++;
+ }
+ return keys;
+ }
+};
+
+
+
+//***********************************************
+// 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/DOMUtils.h"
+
+# %include <DOM/Document.hpp>
+# %include <DOM/Node.hpp>
+# %include <DOM/Element.hpp>
+# %include <DOM/Attr.hpp>
+# %include <DOM/Text.hpp>
+
+%include "../wrapped/WrappedInvoker.h"
+%include "../wrapped/WrappedDataModel.h"
+
+# %template(XMLDocument) Arabica::DOM::Document<std::string>;
+# %template(XMLNode) Arabica::DOM::Node<std::string>;
+# %template(XMLElement) Arabica::DOM::Element<std::string>;
+# %template(XMLAttr) Arabica::DOM::Attr<std::string>;
+# %template(XMLText) Arabica::DOM::Text<std::string>;
diff --git a/src/bindings/swig/java/JavaDataModel.cpp b/src/bindings/swig/java/JavaDataModel.cpp
deleted file mode 100644
index 896794b..0000000
--- a/src/bindings/swig/java/JavaDataModel.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "JavaDataModel.h"
-
-namespace uscxml {
-
-JavaDataModel::JavaDataModel() {}
-JavaDataModel::~JavaDataModel() {}
-
-} \ No newline at end of file
diff --git a/src/bindings/swig/java/JavaInvoker.cpp b/src/bindings/swig/java/JavaInvoker.cpp
deleted file mode 100644
index e1c6a31..0000000
--- a/src/bindings/swig/java/JavaInvoker.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "JavaInvoker.h"
-
-namespace uscxml {
-
-JavaInvoker::JavaInvoker() {}
-JavaInvoker::~JavaInvoker() {}
-
-} \ No newline at end of file
diff --git a/src/bindings/swig/java/org/uscxml/Data.java b/src/bindings/swig/java/org/uscxml/Data.java
index fdd7448..7781f47 100644
--- a/src/bindings/swig/java/org/uscxml/Data.java
+++ b/src/bindings/swig/java/org/uscxml/Data.java
@@ -80,7 +80,7 @@ public class Data {
if (data.type == Type.INTERPRETED) {
nativeData.setType(DataNative.Type.INTERPRETED);
} else {
- nativeData.setType(DataNative.Type.VERBATIM);
+ nativeData.setType(DataNative.Type.VERBATIM);
}
}
return nativeData;
diff --git a/src/bindings/swig/java/uscxml.i b/src/bindings/swig/java/uscxml.i
index 5dac9d2..f72084e 100644
--- a/src/bindings/swig/java/uscxml.i
+++ b/src/bindings/swig/java/uscxml.i
@@ -9,10 +9,10 @@
%include <stl.i>
%include <std_map.i>
-%include "std_string.i"
+%include <std_string.i>
%include <inttypes.i>
-%include "stl_set.i"
-%include "stl_list.i"
+%include "../stl_set.i"
+%include "../stl_list.i"
%include <boost_shared_ptr.i>
@@ -59,14 +59,14 @@ typedef uscxml::SendRequest SendRequest;
//#include <DOM/Attr.hpp>
//#include <DOM/Text.hpp>
-#include "JavaInvoker.h"
-#include "JavaDataModel.h"
+#include "../wrapped/WrappedInvoker.h"
+#include "../wrapped/WrappedDataModel.h"
using namespace uscxml;
using namespace Arabica::DOM;
-#include "JavaInvoker.cpp"
-#include "JavaDataModel.cpp"
+#include "../wrapped/WrappedInvoker.cpp"
+#include "../wrapped/WrappedDataModel.cpp"
%}
@@ -78,14 +78,14 @@ using namespace Arabica::DOM;
%ignore uscxml::Interpreter::getDelayQueue();
-%ignore uscxml::JavaInvoker::create(InterpreterImpl*);
+%ignore uscxml::WrappedInvoker::create(InterpreterImpl*);
-%ignore uscxml::JavaDataModel::create(InterpreterImpl*);
-%ignore uscxml::JavaDataModel::init(const Arabica::DOM::Element<std::string>&, const Arabica::DOM::Document<std::string>&, const std::string&);
-%ignore uscxml::JavaDataModel::init(const std::string&, const Data&);
-%ignore uscxml::JavaDataModel::assign(const Arabica::DOM::Element<std::string>&, const Arabica::DOM::Document<std::string>&, const std::string&);
-%ignore uscxml::JavaDataModel::assign(const std::string&, const Data&);
-%ignore uscxml::JavaDataModel::eval(const Arabica::DOM::Element<std::string>&, const std::string&);
+%ignore uscxml::WrappedDataModel::create(InterpreterImpl*);
+%ignore uscxml::WrappedDataModel::init(const Arabica::DOM::Element<std::string>&, const Arabica::DOM::Document<std::string>&, const std::string&);
+%ignore uscxml::WrappedDataModel::init(const std::string&, const Data&);
+%ignore uscxml::WrappedDataModel::assign(const Arabica::DOM::Element<std::string>&, const Arabica::DOM::Document<std::string>&, const std::string&);
+%ignore uscxml::WrappedDataModel::assign(const std::string&, const Data&);
+%ignore uscxml::WrappedDataModel::eval(const Arabica::DOM::Element<std::string>&, const std::string&);
%ignore uscxml::Event::Event(const Arabica::DOM::Node<std::string>&);
%ignore uscxml::Event::getStrippedDOM;
@@ -104,16 +104,9 @@ using namespace Arabica::DOM;
%template(InvokerMap) std::map<std::string, uscxml::Invoker>;
%rename Data DataNative;
-# %typemap(jstype) uscxml::Data "Data"
-# %typemap(javaout) uscxml::Data {
-# return new Data(new DataNative($jnicall, $owner));
-# }
-# %typemap(javadirectorin) uscxml::Data "new Data($jniinput)"
-# %typemap(javadirectorout) uscxml::Data "new Data($jniinput)"
-
-%feature("director") uscxml::JavaInvoker;
-%feature("director") uscxml::JavaDataModel;
+%feature("director") uscxml::WrappedInvoker;
+%feature("director") uscxml::WrappedDataModel;
// translate param multimap to Map<String, List<Data> >
%rename(getParamsNative) uscxml::Event::getParams();
@@ -184,8 +177,8 @@ using namespace Arabica::DOM;
# %include <DOM/Attr.hpp>
# %include <DOM/Text.hpp>
-%include "JavaInvoker.h"
-%include "JavaDataModel.h"
+%include "../wrapped/WrappedInvoker.h"
+%include "../wrapped/WrappedDataModel.h"
# %template(XMLDocument) Arabica::DOM::Document<std::string>;
# %template(XMLNode) Arabica::DOM::Node<std::string>;
diff --git a/src/bindings/swig/msvc/inttypes.h b/src/bindings/swig/msvc/inttypes.h
new file mode 100644
index 0000000..eac641e
--- /dev/null
+++ b/src/bindings/swig/msvc/inttypes.h
@@ -0,0 +1,304 @@
+// ISO C9x compliant inttypes.h for Microsoft Visual Studio
+// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
+//
+// Copyright (c) 2006 Alexander Chemeris
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+//
+// 3. The name of the author may be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _MSC_VER // [
+#error "Use this header only with Microsoft Visual C++ compilers!"
+#endif // _MSC_VER ]
+
+#ifndef _MSC_INTTYPES_H_ // [
+#define _MSC_INTTYPES_H_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif
+
+#include "stdint.h"
+
+// 7.8 Format conversion of integer types
+
+typedef struct {
+ intmax_t quot;
+ intmax_t rem;
+} imaxdiv_t;
+
+// 7.8.1 Macros for format specifiers
+
+#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198
+
+// The fprintf macros for signed integers are:
+#define PRId8 "d"
+#define PRIi8 "i"
+#define PRIdLEAST8 "d"
+#define PRIiLEAST8 "i"
+#define PRIdFAST8 "d"
+#define PRIiFAST8 "i"
+
+#define PRId16 "hd"
+#define PRIi16 "hi"
+#define PRIdLEAST16 "hd"
+#define PRIiLEAST16 "hi"
+#define PRIdFAST16 "hd"
+#define PRIiFAST16 "hi"
+
+#define PRId32 "I32d"
+#define PRIi32 "I32i"
+#define PRIdLEAST32 "I32d"
+#define PRIiLEAST32 "I32i"
+#define PRIdFAST32 "I32d"
+#define PRIiFAST32 "I32i"
+
+#define PRId64 "I64d"
+#define PRIi64 "I64i"
+#define PRIdLEAST64 "I64d"
+#define PRIiLEAST64 "I64i"
+#define PRIdFAST64 "I64d"
+#define PRIiFAST64 "I64i"
+
+#define PRIdMAX "I64d"
+#define PRIiMAX "I64i"
+
+#define PRIdPTR "Id"
+#define PRIiPTR "Ii"
+
+// The fprintf macros for unsigned integers are:
+#define PRIo8 "o"
+#define PRIu8 "u"
+#define PRIx8 "x"
+#define PRIX8 "X"
+#define PRIoLEAST8 "o"
+#define PRIuLEAST8 "u"
+#define PRIxLEAST8 "x"
+#define PRIXLEAST8 "X"
+#define PRIoFAST8 "o"
+#define PRIuFAST8 "u"
+#define PRIxFAST8 "x"
+#define PRIXFAST8 "X"
+
+#define PRIo16 "ho"
+#define PRIu16 "hu"
+#define PRIx16 "hx"
+#define PRIX16 "hX"
+#define PRIoLEAST16 "ho"
+#define PRIuLEAST16 "hu"
+#define PRIxLEAST16 "hx"
+#define PRIXLEAST16 "hX"
+#define PRIoFAST16 "ho"
+#define PRIuFAST16 "hu"
+#define PRIxFAST16 "hx"
+#define PRIXFAST16 "hX"
+
+#define PRIo32 "I32o"
+#define PRIu32 "I32u"
+#define PRIx32 "I32x"
+#define PRIX32 "I32X"
+#define PRIoLEAST32 "I32o"
+#define PRIuLEAST32 "I32u"
+#define PRIxLEAST32 "I32x"
+#define PRIXLEAST32 "I32X"
+#define PRIoFAST32 "I32o"
+#define PRIuFAST32 "I32u"
+#define PRIxFAST32 "I32x"
+#define PRIXFAST32 "I32X"
+
+#define PRIo64 "I64o"
+#define PRIu64 "I64u"
+#define PRIx64 "I64x"
+#define PRIX64 "I64X"
+#define PRIoLEAST64 "I64o"
+#define PRIuLEAST64 "I64u"
+#define PRIxLEAST64 "I64x"
+#define PRIXLEAST64 "I64X"
+#define PRIoFAST64 "I64o"
+#define PRIuFAST64 "I64u"
+#define PRIxFAST64 "I64x"
+#define PRIXFAST64 "I64X"
+
+#define PRIoMAX "I64o"
+#define PRIuMAX "I64u"
+#define PRIxMAX "I64x"
+#define PRIXMAX "I64X"
+
+#define PRIoPTR "Io"
+#define PRIuPTR "Iu"
+#define PRIxPTR "Ix"
+#define PRIXPTR "IX"
+
+// The fscanf macros for signed integers are:
+#define SCNd8 "d"
+#define SCNi8 "i"
+#define SCNdLEAST8 "d"
+#define SCNiLEAST8 "i"
+#define SCNdFAST8 "d"
+#define SCNiFAST8 "i"
+
+#define SCNd16 "hd"
+#define SCNi16 "hi"
+#define SCNdLEAST16 "hd"
+#define SCNiLEAST16 "hi"
+#define SCNdFAST16 "hd"
+#define SCNiFAST16 "hi"
+
+#define SCNd32 "ld"
+#define SCNi32 "li"
+#define SCNdLEAST32 "ld"
+#define SCNiLEAST32 "li"
+#define SCNdFAST32 "ld"
+#define SCNiFAST32 "li"
+
+#define SCNd64 "I64d"
+#define SCNi64 "I64i"
+#define SCNdLEAST64 "I64d"
+#define SCNiLEAST64 "I64i"
+#define SCNdFAST64 "I64d"
+#define SCNiFAST64 "I64i"
+
+#define SCNdMAX "I64d"
+#define SCNiMAX "I64i"
+
+#ifdef _WIN64 // [
+# define SCNdPTR "I64d"
+# define SCNiPTR "I64i"
+#else // _WIN64 ][
+# define SCNdPTR "ld"
+# define SCNiPTR "li"
+#endif // _WIN64 ]
+
+// The fscanf macros for unsigned integers are:
+#define SCNo8 "o"
+#define SCNu8 "u"
+#define SCNx8 "x"
+#define SCNX8 "X"
+#define SCNoLEAST8 "o"
+#define SCNuLEAST8 "u"
+#define SCNxLEAST8 "x"
+#define SCNXLEAST8 "X"
+#define SCNoFAST8 "o"
+#define SCNuFAST8 "u"
+#define SCNxFAST8 "x"
+#define SCNXFAST8 "X"
+
+#define SCNo16 "ho"
+#define SCNu16 "hu"
+#define SCNx16 "hx"
+#define SCNX16 "hX"
+#define SCNoLEAST16 "ho"
+#define SCNuLEAST16 "hu"
+#define SCNxLEAST16 "hx"
+#define SCNXLEAST16 "hX"
+#define SCNoFAST16 "ho"
+#define SCNuFAST16 "hu"
+#define SCNxFAST16 "hx"
+#define SCNXFAST16 "hX"
+
+#define SCNo32 "lo"
+#define SCNu32 "lu"
+#define SCNx32 "lx"
+#define SCNX32 "lX"
+#define SCNoLEAST32 "lo"
+#define SCNuLEAST32 "lu"
+#define SCNxLEAST32 "lx"
+#define SCNXLEAST32 "lX"
+#define SCNoFAST32 "lo"
+#define SCNuFAST32 "lu"
+#define SCNxFAST32 "lx"
+#define SCNXFAST32 "lX"
+
+#define SCNo64 "I64o"
+#define SCNu64 "I64u"
+#define SCNx64 "I64x"
+#define SCNX64 "I64X"
+#define SCNoLEAST64 "I64o"
+#define SCNuLEAST64 "I64u"
+#define SCNxLEAST64 "I64x"
+#define SCNXLEAST64 "I64X"
+#define SCNoFAST64 "I64o"
+#define SCNuFAST64 "I64u"
+#define SCNxFAST64 "I64x"
+#define SCNXFAST64 "I64X"
+
+#define SCNoMAX "I64o"
+#define SCNuMAX "I64u"
+#define SCNxMAX "I64x"
+#define SCNXMAX "I64X"
+
+#ifdef _WIN64 // [
+# define SCNoPTR "I64o"
+# define SCNuPTR "I64u"
+# define SCNxPTR "I64x"
+# define SCNXPTR "I64X"
+#else // _WIN64 ][
+# define SCNoPTR "lo"
+# define SCNuPTR "lu"
+# define SCNxPTR "lx"
+# define SCNXPTR "lX"
+#endif // _WIN64 ]
+
+#endif // __STDC_FORMAT_MACROS ]
+
+// 7.8.2 Functions for greatest-width integer types
+
+// 7.8.2.1 The imaxabs function
+#define imaxabs _abs64
+
+// 7.8.2.2 The imaxdiv function
+
+// This is modified version of div() function from Microsoft's div.c found
+// in %MSVC.NET%\crt\src\div.c
+#ifdef STATIC_IMAXDIV // [
+static
+#else // STATIC_IMAXDIV ][
+_inline
+#endif // STATIC_IMAXDIV ]
+imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom) {
+ imaxdiv_t result;
+
+ result.quot = numer / denom;
+ result.rem = numer % denom;
+
+ if (numer < 0 && result.rem > 0) {
+ // did division wrong; must fix up
+ ++result.quot;
+ result.rem -= denom;
+ }
+
+ return result;
+}
+
+// 7.8.2.3 The strtoimax and strtoumax functions
+#define strtoimax _strtoi64
+#define strtoumax _strtoui64
+
+// 7.8.2.4 The wcstoimax and wcstoumax functions
+#define wcstoimax _wcstoi64
+#define wcstoumax _wcstoui64
+
+
+#endif // _MSC_INTTYPES_H_ ] \ No newline at end of file
diff --git a/src/bindings/swig/stl_list.i b/src/bindings/swig/stl_list.i
new file mode 100644
index 0000000..aabd448
--- /dev/null
+++ b/src/bindings/swig/stl_list.i
@@ -0,0 +1,49 @@
+/* -----------------------------------------------------------------------------
+ * See the LICENSE file for information on copyright, usage and redistribution
+ * of SWIG, and the README file for authors - http://www.swig.org/release.html.
+ *
+ * std_list.i
+ * ----------------------------------------------------------------------------- */
+
+%include <std_common.i>
+
+%{
+#include <list>
+#include <stdexcept>
+%}
+
+namespace std {
+
+ template<class T> class list {
+ public:
+ typedef size_t size_type;
+ typedef T value_type;
+ typedef const value_type& const_reference;
+ list();
+ size_type size() const;
+ %rename(isEmpty) empty;
+ bool empty() const;
+ void clear();
+ %rename(add) push_back;
+ void push_back(const value_type& x);
+ %extend {
+ const_reference get(int i) throw (std::out_of_range) {
+ int size = int(self->size());
+ int j;
+ if (i>=0 && i<size) {
+ std::list<T>::const_iterator p;
+ p=self->begin();
+ for (j=0; j<i; j++) {p++;}
+ return (*p);
+ }
+ else
+ throw std::out_of_range("list index out of range");
+ }
+ }
+ };
+}
+
+%define specialize_std_list(T)
+#warning "specialize_std_list - specialization for type T no longer needed"
+%enddef
+
diff --git a/src/bindings/swig/stl_set.i b/src/bindings/swig/stl_set.i
new file mode 100644
index 0000000..d009a7b
--- /dev/null
+++ b/src/bindings/swig/stl_set.i
@@ -0,0 +1,73 @@
+/*=========================================================================
+
+ Program: GDCM (Grassroots DICOM). A DICOM library
+
+ Copyright (c) 2006-2011 Mathieu Malaterre
+ All rights reserved.
+ See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notice for more information.
+
+=========================================================================*/
+/* -----------------------------------------------------------------------------
+ * std_set.i
+ *
+ * SWIG typemaps for std::set
+ * ----------------------------------------------------------------------------- */
+
+%include <std_common.i>
+
+// ------------------------------------------------------------------------
+// std::set
+// ------------------------------------------------------------------------
+
+%{
+#include <set>
+#include <algorithm>
+#include <stdexcept>
+%}
+
+// exported class
+
+namespace std {
+
+ template<class V> class set {
+ // add typemaps here
+ public:
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef V value_type;
+ set();
+ set(const set<V> &);
+
+ unsigned int size() const;
+ bool empty() const;
+ void clear();
+ %extend {
+ const V& get(const V& key) throw (std::out_of_range) {
+ std::set<V>::iterator i = self->find(key);
+ if (i != self->end())
+ return *i;
+ else
+ throw std::out_of_range("key not found");
+ }
+ void insert(const V& key) { // Do NOT call this function 'set' !
+ self->insert(key);
+ }
+ void del(const V& key) throw (std::out_of_range) {
+ std::set<V>::iterator i = self->find(key);
+ if (i != self->end())
+ self->erase(i);
+ else
+ throw std::out_of_range("key not found");
+ }
+ bool has_key(const V& key) {
+ std::set<V>::iterator i = self->find(key);
+ return i != self->end();
+ }
+ }
+ };
+
+} \ No newline at end of file
diff --git a/src/bindings/swig/wrapped/WrappedDataModel.cpp b/src/bindings/swig/wrapped/WrappedDataModel.cpp
new file mode 100644
index 0000000..901d246
--- /dev/null
+++ b/src/bindings/swig/wrapped/WrappedDataModel.cpp
@@ -0,0 +1,8 @@
+#include "WrappedDataModel.h"
+
+namespace uscxml {
+
+WrappedDataModel::WrappedDataModel() {}
+WrappedDataModel::~WrappedDataModel() {}
+
+} \ No newline at end of file
diff --git a/src/bindings/swig/java/JavaDataModel.h b/src/bindings/swig/wrapped/WrappedDataModel.h
index 5da0cda..285b40a 100644
--- a/src/bindings/swig/java/JavaDataModel.h
+++ b/src/bindings/swig/wrapped/WrappedDataModel.h
@@ -1,5 +1,5 @@
-#ifndef JAVADataModel_H_7U446XJQ
-#define JAVADataModel_H_7U446XJQ
+#ifndef WRAPPEDDATAMODEL_H_DBAAD6AF
+#define WRAPPEDDATAMODEL_H_DBAAD6AF
#include "../../../uscxml/Message.h"
#include "../../../uscxml/Factory.h"
@@ -7,13 +7,13 @@
namespace uscxml {
-class JavaDataModel : public DataModelImpl {
+class WrappedDataModel : public DataModelImpl {
public:
- JavaDataModel();
- virtual ~JavaDataModel();
+ WrappedDataModel();
+ virtual ~WrappedDataModel();
- virtual JavaDataModel* create(const Interpreter& interpreter) {
- return new JavaDataModel();
+ virtual WrappedDataModel* create(const Interpreter& interpreter) {
+ return new WrappedDataModel();
}
virtual boost::shared_ptr<DataModelImpl> create(InterpreterImpl* interpreter) {
@@ -96,8 +96,6 @@ public:
init("", location, Data::toJSON(data));
}
- // this is assign the function exposed to java
-
virtual void init(const Arabica::DOM::Element<std::string>& dataElem,
const Arabica::DOM::Node<std::string>& node,
const std::string& content) {
@@ -126,7 +124,6 @@ public:
init("", location, Data::toJSON(data));
}
- // these functions are exposed to java
virtual bool evalAsBool(const std::string& elem, const std::string& content) { return false; }
virtual void init(const std::string& dataElem, const std::string& location, const std::string& content) {}
virtual void assign(const std::string& assignElem, const std::string& location, const std::string& content) {}
@@ -138,4 +135,4 @@ private:
}
-#endif /* end of include guard: JAVADataModel_H_7U446XJQ */
+#endif /* end of include guard: WRAPPEDDATAMODEL_H_DBAAD6AF */
diff --git a/src/bindings/swig/wrapped/WrappedInvoker.cpp b/src/bindings/swig/wrapped/WrappedInvoker.cpp
new file mode 100644
index 0000000..b775878
--- /dev/null
+++ b/src/bindings/swig/wrapped/WrappedInvoker.cpp
@@ -0,0 +1,8 @@
+#include "WrappedInvoker.h"
+
+namespace uscxml {
+
+WrappedInvoker::WrappedInvoker() {}
+WrappedInvoker::~WrappedInvoker() {}
+
+} \ No newline at end of file
diff --git a/src/bindings/swig/java/JavaInvoker.h b/src/bindings/swig/wrapped/WrappedInvoker.h
index 8994ab5..61eedac 100644
--- a/src/bindings/swig/java/JavaInvoker.h
+++ b/src/bindings/swig/wrapped/WrappedInvoker.h
@@ -1,5 +1,5 @@
-#ifndef JAVAINVOKER_H_WDV9B5F6
-#define JAVAINVOKER_H_WDV9B5F6
+#ifndef WRAPPEDINVOKER_H_F9725D47
+#define WRAPPEDINVOKER_H_F9725D47
#include "../../../uscxml/Message.h"
#include "../../../uscxml/Factory.h"
@@ -7,10 +7,10 @@
namespace uscxml {
-class JavaInvoker : public InvokerImpl {
+class WrappedInvoker : public InvokerImpl {
public:
- JavaInvoker();
- virtual ~JavaInvoker();
+ WrappedInvoker();
+ virtual ~WrappedInvoker();
virtual std::list<std::string> getNames() {
return std::list<std::string>();
@@ -24,8 +24,8 @@ public:
virtual void send(const SendRequest& req) {}
virtual void invoke(const InvokeRequest& req) {}
- virtual JavaInvoker* create(Interpreter interpreter) {
- return new JavaInvoker();
+ virtual WrappedInvoker* create(Interpreter interpreter) {
+ return new WrappedInvoker();
}
virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter) {
@@ -36,4 +36,4 @@ public:
}
-#endif /* end of include guard: JAVAINVOKER_H_WDV9B5F6 */
+#endif /* end of include guard: WRAPPEDINVOKER_H_F9725D47 */