(cd java && \
rm -fr classes && \
mkdir -p classes && \
- $(JAVAC) -source 1.5 -target 1.5 -classpath . -d classes `find . -name '*.java'` && \
+ $(JAVAC) -source 1.6 -target 1.6 -classpath . -d classes `find . -name '*.java'` && \
cd classes) && \
$(JAR) cf $@ -C java/classes .
#java.cpp:;
$(AM_V_at)mkdir -p $(patsubst %.cpp,%,$@)
$(AM_V_GEN)$(SWIG) -Wall -I@builddir@/.. -I@srcdir@/../include -I@srcdir@/.. -c++ -$(patsubst %.cpp,%,$@) -outdir $(patsubst %.cpp,%,$@) $($(subst .,_,$@)_SWIGFLAGS) -o $@ $<
+# Automake 1.16 is executing this target at configuration time. Because some
+# generated source files do not exist at that time, we use the -ignoremissing
+# option to not have SWIG complain about those missing files.
$(patsubst %,%.d,$(filter-out c c++,$(CVC4_LANGUAGE_BINDINGS))): %.d: @srcdir@/../cvc4.i
- $(AM_V_GEN)$(SWIG) -I@builddir@/.. -I@srcdir@/../include -I@srcdir@/.. -c++ -$(patsubst %.d,%,$@) -MM -o $(patsubst %.d,%.cpp,$@) $<
+ $(AM_V_GEN)$(SWIG) -I@builddir@/.. -I@srcdir@/../include -I@srcdir@/.. -c++ -$(patsubst %.d,%,$@) -ignoremissing -MM -o $(patsubst %.d,%.cpp,$@) $<
# .PHONY so they get rebuilt each time
.PHONY: .swig_deps $(patsubst %,%.d,$(filter-out c c++,$(CVC4_LANGUAGE_BINDINGS)))
.swig_deps: $(patsubst %,%.d,$(filter-out c c++,$(CVC4_LANGUAGE_BINDINGS)))
# returns the jni type corresponding to the pseudo type signature
-def arg_type_to_java((arg_qual, arg_type, arg_name)):
+def arg_type_to_java(arg):
+ arg_qual, arg_type, arg_name = arg
check_arg_qual(arg_qual);
if arg_type == "jobject":
if (not is_native(arg_qual)) or is_vector(arg_qual):
else:
return "jobject"
-def print_unembed_arg(cpp_file, (arg_qual, arg_type, arg_name)):
+def print_unembed_arg(cpp_file, arg):
+ arg_qual, arg_type, arg_name = arg
check_arg_qual(arg_qual);
if arg_type == "jobject":
()
print_unembed_arg(cpp_file, arg)
-# check hat declaration and definition signatures match
-def match_signatures((decl_result, decl_args), (def_result, def_args, _)):
+# check that declaration and definition signatures match
+def match_signatures(decl, defn):
+ decl_result, decl_args = decl
+ def_result, def_args, _ = defn
if decl_result != def_result or len(decl_args) != len(def_args):
return False
- for i in xrange(0, len(decl_args)):
+ for i in range(0, len(decl_args)):
java_type = arg_type_to_java(def_args[i])
#print java_type
if decl_args[i] != java_type:
def print_signature(cpp_file, name, result, args):
arg_strings = ["JNIEnv* env", "jclass"]
arg_strings.extend( \
- map(lambda (argQual, argType, argName): \
- arg_type_to_java((argQual, argType, argName)) \
- + " j" + argName, args))
+ map(lambda arg: \
+ arg_type_to_java(arg) \
+ + " j" + arg[2], args))
cpp_file.writelines([
"JNIEXPORT " + result + " JNICALL " + name + "\n",
"(" + ", ".join(arg_strings) + ")\n"])
-def print_definition(cpp_file, name, (result, args, body)):
+def print_definition(cpp_file, name, defn):
+ result, args, body = defn
cpp_file.writelines(["extern \"C\"\n"])
print_signature(cpp_file, name, result, args)
cpp_file.writelines([
cpp_file.writelines([" return false;\n"])
elif result == "jint":
cpp_file.writelines([" return -1;\n"])
- elif result <> "void":
+ elif result != "void":
print("BUG: return type " + result + " is not handled in print_definition")
sys.exit(1)
cpp_file.writelines([" };\n",
#names = declarations.keys()
#names.sort()
for name in declarations[0]:
- if not definitions.has_key(name):
+ if name not in definitions:
#continue
print("Error: " + name + " is declared in header" \
+ " but not defined in implementation.")
if not match_signatures(declaration, definition):
print("Error: signature for " + name \
+ " in definition and implementation do not match:")
- print declaration
+ print(declaration)
print (definition[0], definition[1])
sys.exit(1)
if not len(definitions) == 0:
print("Error: found definitions in implementation" \
" without declaration in header file:")
- print definitions
+ print(definitions)
sys.exit(1)
- except IOError, (error_nr, error_string):
+ except IOError as err:
+ error_nr, error_string = err
print ("Couldn't open " + cpp_name + ": " + error_string)
- sys.exit(0)
+ sys.exit(1)
### header file function declarations
# - result: result type
# - args: list of argument types, except for the first two (JNIEnv*, jclass)
def register_declaration(declarations, name, result, args):
- assert(not declarations[1].has_key(name));
+ assert(name not in declarations[1]);
declarations[0].append(name)
declarations[1][name] = (result, args)
header_file.close()
- except IOError, (error_nr, error_string):
+ except IOError as err:
+ error_nr, error_string = err
print ("Couldn't open " + header_name + ": " + error_string)
- sys.exit(0)
+ sys.exit(1)
return declarations
# - args: list of pairs of argument types and argument names,
# except for the first two (JNIEnv*, jclass)
def register_definition(definitions, name, result, args, body):
- if definitions.has_key(name):
+ if name in definitions:
print("Error: redefinition of " + name + " in implementation.")
sys.exit(1)
impl_file.close()
- except IOError, (error_nr, error_string):
+ except IOError as err:
+ error_nr, error_string = err
print ("Couldn't open " + impl_name + ": " + error_string)
- sys.exit(0)
+ sys.exit(1)
return definitions, includes