try_bindings=$(echo "$try_bindings" | sed 's/,/ /g')
fi
AC_MSG_RESULT([$try_bindings])
- JAVA_INCLUDES=
for binding in $try_bindings; do
binding_error=no
AC_MSG_CHECKING([for availability of $binding binding])
case "$binding" in
c++) AC_MSG_RESULT([C++ is built by default]);;
java)
- JAVA_INCLUDES="-I/usr/lib/jvm/java-6-sun-1.6.0.26/include -I/usr/lib/jvm/java-6-sun-1.6.0.26/include/linux"
cvc4_build_java_bindings=yes
AC_MSG_RESULT([Java support will be built]);;
csharp)
])dnl
AC_SUBST(SWIG)
-AC_SUBST(JAVA_INCLUDES)
AC_SUBST(CVC4_LANGUAGE_BINDINGS)
])# CVC4_CHECK_BINDINGS
AC_ARG_VAR(JAVA, [Java interpreter (used when testing Java interface)])
AC_ARG_VAR(JAVAC, [Java compiler (used when building and testing Java interface)])
AC_ARG_VAR(JAR, [Jar archiver (used when building Java interface)])
+AC_ARG_VAR(JAVA_INCLUDES, [flags to pass to C compiler when building JNI libraries])
if test "$cvc4_build_java_bindings"; then
dnl AM_PROG_GCJ
if test -z "$JAVA"; then
}
}
-%include "std_string.i" // map std::string to java.lang.String
+// This is unfortunate, but seems to be necessary; if we leave NULL
+// defined, swig will expand it to "(void*) 0", and some of swig's
+// helper functions won't compile properly.
+#undef NULL
+
+%include "java/typemaps.i" // primitive pointers and references
+%include "java/std_string.i" // map std::string to java.lang.String
+%include "java/arrays_java.i" // C arrays to Java arrays
+%include "java/various.i" // map char** to java.lang.String[]
%include "util/integer.i"
%include "util/rational.i"
%_tags.h: %_tags
$(AM_V_GEN)( \
- echo 'static char const *const $^[] = {'; \
- first=1; \
- for tag in `cat $^`; \
- do \
- if [ $$first -eq 1 ]; then first=0; else echo ','; fi; \
- echo -n "\"$$tag\""; \
- done; \
- echo; \
- echo '};' \
+ echo 'static char const* const $^[] = {'; \
+ for tag in `cat $^`; do \
+ echo "\"$$tag\","; \
+ done; \
+ echo 'NULL'; \
+ echo '};' \
) >"$@"
# This .tmp business is to keep from having to re-compile options.cpp
#if CVC4_DEBUG
return Debug_tags;
#else /* CVC4_DEBUG */
- return NULL;
+ static char const* no_tags[] = { NULL };
+ return no_tags;
#endif /* CVC4_DEBUG */
}
#if CVC4_TRACING
return Trace_tags;
#else /* CVC4_TRACING */
- return NULL;
+ static char const* no_tags[] = { NULL };
+ return no_tags;
#endif /* CVC4_TRACING */
}
#include "util/configuration.h"
%}
+%apply char **STRING_ARRAY { char const* const* }
%include "util/configuration.h"
+%clear char const* const*;
%ignore CVC4::operator<<(std::ostream&, Options::SimplificationMode);
%ignore CVC4::operator<<(std::ostream&, Options::ArithPivotRule);
+%apply char** STRING_ARRAY { char* argv[] }
%include "util/options.h"
+%clear char* argv[];
import edu.nyu.acsys.CVC4.Type;
import edu.nyu.acsys.CVC4.BoolExpr;
import edu.nyu.acsys.CVC4.Kind;
+import edu.nyu.acsys.CVC4.Result;
import edu.nyu.acsys.CVC4.Configuration;
//import edu.nyu.acsys.CVC4.Exception;
try {
System.loadLibrary("cvc4bindings_java");
- CVC4.getDebugChannel().on("current");
+ //CVC4.getDebugChannel().on("current");
-System.out.println(Configuration.about());
-System.out.println("constructing");
+ System.out.println(Configuration.about());
+
+ String[] tags = Configuration.getDebugTags();
+ System.out.print("available debug tags:");
+ for(int i = 0; i < tags.length; ++i) {
+ System.out.print(" " + tags[i]);
+ }
+ System.out.println();
ExprManager em = new ExprManager();
SmtEngine smt = new SmtEngine(em);
-System.out.println("getting type");
Type t = em.booleanType();
-System.out.println("making vars");
Expr a = em.mkVar("a", em.booleanType());
Expr b = em.mkVar("b", em.booleanType());
-System.out.println("making sausage");
- BoolExpr e = new BoolExpr(em.mkExpr(Kind.AND, a, b));
-
-System.out.println("about to check");
+ BoolExpr e = new BoolExpr(em.mkExpr(Kind.AND, a, b, new BoolExpr(a).notExpr()));
+ System.out.println("==> " + e);
- System.out.println(smt.checkSat(e));
+ Result r = smt.checkSat(e);
+ boolean correct = r.isSat() == Result.Sat.UNSAT;
System.out.println(smt.getStatisticsRegistry());
- System.exit(1);
+ System.exit(correct ? 0 : 1);
} catch(Exception e) {
System.err.println(e);
System.exit(1);