summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorgan Deters <mdeters@cs.nyu.edu>2013-03-27 23:42:13 -0400
committerMorgan Deters <mdeters@cs.nyu.edu>2013-03-27 23:42:13 -0400
commitc90564313e268e403ca9a6c13a80432bd7a6fa79 (patch)
tree8d49eafcda3174042cce3cb364d61b0d53c3bd01
parent2108ce5dfab34583f9abd07c077cd0b4f1f92499 (diff)
some Java bindings fixes (fixes Debian build problems)
-rw-r--r--src/cvc4.i2
-rw-r--r--src/expr/command.i6
-rw-r--r--src/expr/expr.i6
-rw-r--r--src/util/record.i13
4 files changed, 25 insertions, 2 deletions
diff --git a/src/cvc4.i b/src/cvc4.i
index ebb8cbd63..965452b84 100644
--- a/src/cvc4.i
+++ b/src/cvc4.i
@@ -66,6 +66,8 @@ std::set<JavaInputStreamAdapter*> CVC4::JavaInputStreamAdapter::s_adapters;
%template(vectorDatatypeType) std::vector< CVC4::DatatypeType >;
%template(vectorSExpr) std::vector< CVC4::SExpr >;
%template(vectorString) std::vector< std::string >;
+%template(vectorPairStringType) std::vector< std::pair< std::string, CVC4::Type > >;
+%template(pairStringType) std::pair< std::string, CVC4::Type >;
%template(setType) std::set< CVC4::Type >;
%template(hashmapExpr) std::hash_map< CVC4::Expr, CVC4::Expr, CVC4::ExprHashFunction >;
diff --git a/src/expr/command.i b/src/expr/command.i
index 6085a444f..76c8fa674 100644
--- a/src/expr/command.i
+++ b/src/expr/command.i
@@ -54,6 +54,12 @@
// getNext() just allows C++ iterator access from Java-side next(), make it private
%javamethodmodifiers CVC4::JavaIteratorAdapter<CVC4::CommandSequence>::getNext() "private";
+// map the types appropriately
+%typemap(jni) CVC4::CommandSequence::const_iterator::value_type "jobject";
+%typemap(jtype) CVC4::CommandSequence::const_iterator::value_type "edu.nyu.acsys.CVC4.Command";
+%typemap(jstype) CVC4::CommandSequence::const_iterator::value_type "edu.nyu.acsys.CVC4.Command";
+%typemap(javaout) CVC4::CommandSequence::const_iterator::value_type { return $jnicall; }
+
#endif /* SWIGJAVA */
%include "expr/command.h"
diff --git a/src/expr/expr.i b/src/expr/expr.i
index 92ab517b1..977345a63 100644
--- a/src/expr/expr.i
+++ b/src/expr/expr.i
@@ -72,6 +72,12 @@ namespace CVC4 {
// getNext() just allows C++ iterator access from Java-side next(), make it private
%javamethodmodifiers CVC4::JavaIteratorAdapter<CVC4::Expr>::getNext() "private";
+// map the types appropriately
+%typemap(jni) CVC4::Expr::const_iterator::value_type "jobject";
+%typemap(jtype) CVC4::Expr::const_iterator::value_type "edu.nyu.acsys.CVC4.Expr";
+%typemap(jstype) CVC4::Expr::const_iterator::value_type "edu.nyu.acsys.CVC4.Expr";
+%typemap(javaout) CVC4::Expr::const_iterator::value_type { return $jnicall; }
+
#endif /* SWIGJAVA */
%include "expr/expr.h"
diff --git a/src/util/record.i b/src/util/record.i
index 2805d2fdf..368519f5b 100644
--- a/src/util/record.i
+++ b/src/util/record.i
@@ -19,6 +19,8 @@
%ignore CVC4::Record::operator!=(const Record&) const;
%rename(getField) CVC4::Record::operator[](size_t) const;
+#ifdef SWIGJAVA
+
// These Object arrays are always of two elements, the first is a String and the second a
// Type. (On the C++ side, it is a std::pair<std::string, Type>.)
%typemap(jni) std::pair<std::string, CVC4::Type> "jobjectArray";
@@ -33,8 +35,6 @@
jenv->SetObjectArrayElement($result, 1, jenv->NewObject(clazz, methodid, reinterpret_cast<long>(new CVC4::Type($1.second)), true));
};
-#ifdef SWIGJAVA
-
// Instead of Record::begin() and end(), create an
// iterator() method on the Java side that returns a Java-style
// Iterator.
@@ -79,6 +79,15 @@
// getNext() just allows C++ iterator access from Java-side next(), make it private
%javamethodmodifiers CVC4::JavaIteratorAdapter<CVC4::Record>::getNext() "private";
+// map the types appropriately. for records, the "payload" of the iterator is an Object[].
+// These Object arrays are always of two elements, the first is a String and the second a
+// Type. (On the C++ side, it is a std::pair<std::string, SExpr>.)
+%typemap(jni) CVC4::Record::const_iterator::value_type = std::pair<std::string, CVC4::Type>;
+%typemap(jtype) CVC4::Record::const_iterator::value_type = std::pair<std::string, CVC4::Type>;
+%typemap(jstype) CVC4::Record::const_iterator::value_type = std::pair<std::string, CVC4::Type>;
+%typemap(javaout) CVC4::Record::const_iterator::value_type = std::pair<std::string, CVC4::Type>;
+%typemap(out) CVC4::Record::const_iterator::value_type = std::pair<std::string, CVC4::Type>;
+
#endif /* SWIGJAVA */
%include "util/record.h"
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback