[GIT] ppl/ppl(termination): Finished adding code for the java interface to the termination methods.

Module: ppl/ppl Branch: termination Commit: e8da5d7cae86912ab7c15708324f2d0b01338d82 URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=e8da5d7cae869...
Author: Patricia Hill p.m.hill@leeds.ac.uk Date: Mon Mar 22 16:47:17 2010 +0000
Finished adding code for the java interface to the termination methods.
---
...ppl_interface_generator_java_classes_cc_code.m4 | 138 ++++++++++++++++++++ .../Java/parma_polyhedra_library/Makefile.am | 10 +- ...l_interface_generator_java_classes_java_code.m4 | 42 ++++++- 3 files changed, 187 insertions(+), 3 deletions(-)
diff --git a/interfaces/Java/jni/ppl_interface_generator_java_classes_cc_code.m4 b/interfaces/Java/jni/ppl_interface_generator_java_classes_cc_code.m4 index dcc850b..8714619 100644 --- a/interfaces/Java/jni/ppl_interface_generator_java_classes_cc_code.m4 +++ b/interfaces/Java/jni/ppl_interface_generator_java_classes_cc_code.m4 @@ -1303,3 +1303,141 @@ Java_parma_1polyhedra_1library_termination_1test_1MS_1@TOPOLOGY@1@CLASS@ return 0; } ') + +m4_define(`ppl_termination_test_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_code', +`dnl +___END_OF_FILE___ +___BEGIN_OF_FILE___ Termination.cc << ___END_OF_FILE___ + +JNIEXPORT jboolean JNICALL +Java_parma_1polyhedra_1library_termination_1test_1@TERMINATION_ID@_1@TOPOLOGY@1@CLASS@ +(JNIEnv* env, jclass, jobject j_p) { + try { + @TOPOLOGY@@CLASS@* p_ptr + = reinterpret_cast<@TOPOLOGY@@CLASS@*>(get_ptr(env, j_p)); + return termination_test_@TERMINATION_ID@(*p_ptr); + } + CATCH_ALL; + return 0; +} + +') + +m4_define(`ppl_termination_test_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2_code', +`dnl +___END_OF_FILE___ +___BEGIN_OF_FILE___ Termination.cc << ___END_OF_FILE___ + +JNIEXPORT jboolean JNICALL +Java_parma_1polyhedra_1library_termination_1test_1@TERMINATION_ID@_1@TOPOLOGY@1@CLASS@_12 +(JNIEnv* env, jclass, jobject j_p_before, jobject j_p_after) { + try { + @TOPOLOGY@@CLASS@* p_ptr_before + = reinterpret_cast<@TOPOLOGY@@CLASS@*>(get_ptr(env, j_p_before)); + @TOPOLOGY@@CLASS@* p_ptr_after + = reinterpret_cast<@TOPOLOGY@@CLASS@*>(get_ptr(env, j_p_after)); + return termination_test_@TERMINATION_ID@_2(*p_ptr_before, *p_ptr_after); + } + CATCH_ALL; + return 0; +} + +') + +m4_define(`ppl_one_affine_ranking_function_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_code', +`dnl +___END_OF_FILE___ +___BEGIN_OF_FILE___ Termination.cc << ___END_OF_FILE___ + +JNIEXPORT jboolean JNICALL +Java_parma_1polyhedra_1library_one_1affine_1ranking_1function_1@TERMINATION_ID@_1@TOPOLOGY@1@CLASS@ +(JNIEnv* env, jclass, jobject j_p, jobject j_g) { + try { + @TOPOLOGY@@CLASS@* p_ptr + = reinterpret_cast<@TOPOLOGY@@CLASS@*>(get_ptr(env, j_p)); + Generator g(point()); + if (one_affine_ranking_function_@TERMINATION_ID@(*p_ptr, g)) { + jobject j_g_result = build_java_generator(env, g);; + set_generator(env, j_g, j_g_result); + return true; + } + return false; + } + CATCH_ALL; + return 0; +} + +') + +m4_define(`ppl_one_affine_ranking_function_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2_code', +`dnl +___END_OF_FILE___ +___BEGIN_OF_FILE___ Termination.cc << ___END_OF_FILE___ + +JNIEXPORT jboolean JNICALL +Java_parma_1polyhedra_1library_one_1affine_1ranking_1function_1@TERMINATION_ID@_1@TOPOLOGY@1@CLASS@_12 +(JNIEnv* env, jclass, jobject j_p_before, jobject j_g_after) { + try { + @TOPOLOGY@@CLASS@* p_ptr_before + = reinterpret_cast<@TOPOLOGY@@CLASS@*>(get_ptr(env, j_p_before)); + @TOPOLOGY@@CLASS@* p_ptr_after + = reinterpret_cast<@TOPOLOGY@@CLASS@*>(get_ptr(env, j_p_after)); + Generator g(point()); + if (one_affine_ranking_function_@TERMINATION_ID@_2(*p_ptr_before, *p_ptr_after, g)) { + jobject j_g_result = build_java_generator(env, g);; + set_generator(env, j_g, j_g_result); + return true; + } + return false; + } + CATCH_ALL; + return 0; +} + +') + +m4_define(`ppl_all_affine_ranking_functions_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_code', +`dnl +___END_OF_FILE___ +___BEGIN_OF_FILE___ Termination.cc << ___END_OF_FILE___ + +JNIEXPORT jboolean JNICALL +Java_parma_1polyhedra_1library_all_1affine_1ranking_1functions_1@TERMINATION_ID@_1@TOPOLOGY@1@CLASS@ +(JNIEnv* env, jclass, jobject j_p, jobject j_ph) { + try { + @TOPOLOGY@@CLASS@* p_ptr + = reinterpret_cast<@TOPOLOGY@@CLASS@*>(get_ptr(env, j_p)); + @A_TERMINATION_ID@Polyhedron* ph = new @A_TERMINATION_ID@Polyhedron(); + all_affine_ranking_functions_@TERMINATION_ID@(*p_ptr, *ph) { + set_ptr(env, j_p, *ph); + return true; + } + CATCH_ALL; + return 0; +} + +') + +m4_define(`ppl_all_affine_ranking_functions_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2_code', +`dnl +___END_OF_FILE___ +___BEGIN_OF_FILE___ Termination.cc << ___END_OF_FILE___ + +JNIEXPORT jboolean JNICALL +Java_parma_1polyhedra_1library_all_1affine_1ranking_1functions_1@TERMINATION_ID@_1@TOPOLOGY@1@CLASS@_12 +(JNIEnv* env, jclass, jobject j_p_before, jobject j_p_after, jobject j_ph) { + try { + @TOPOLOGY@@CLASS@* p_ptr_before + = reinterpret_cast<@TOPOLOGY@@CLASS@*>(get_ptr(env, j_p_before)); + @TOPOLOGY@@CLASS@* p_ptr_after + = reinterpret_cast<@TOPOLOGY@@CLASS@*>(get_ptr(env, j_p_after)); + @A_TERMINATION_ID@Polyhedron* ph = new @A_TERMINATION_ID@Polyhedron(); + all_affine_ranking_functions_@TERMINATION_ID@_2(*p_ptr_before, *p_ptr_after, *ph) { + set_ptr(env, j_p, *ph); + return true; + } + CATCH_ALL; + return 0; +} + +') diff --git a/interfaces/Java/parma_polyhedra_library/Makefile.am b/interfaces/Java/parma_polyhedra_library/Makefile.am index 20f8389..942ac77 100644 --- a/interfaces/Java/parma_polyhedra_library/Makefile.am +++ b/interfaces/Java/parma_polyhedra_library/Makefile.am @@ -67,6 +67,7 @@ parma_polyhedra_library.Poly_Con_Relation \ parma_polyhedra_library.Poly_Gen_Relation \ parma_polyhedra_library.PPL_Object \ parma_polyhedra_library.Relation_Symbol \ +parma_polyhedra_library.Termination \ parma_polyhedra_library.Variable \ parma_polyhedra_library.Variables_Set
@@ -105,6 +106,7 @@ parma_polyhedra_library_Poly_Con_Relation.h \ parma_polyhedra_library_Poly_Gen_Relation.h \ parma_polyhedra_library_PPL_Object.h \ parma_polyhedra_library_Relation_Symbol.h \ +parma_polyhedra_library_Termination.h \ parma_polyhedra_library_Variable.h \ parma_polyhedra_library_Variables_Set.h
@@ -153,14 +155,18 @@ $(srcdir)/Poly_Gen_Relation.java \ $(srcdir)/PPL_Object.java \ $(srcdir)/Relation_Symbol.java \ $(srcdir)/Timeout_Exception.java \ +$(builddir)/Termination.java \ $(srcdir)/Variable.java \ $(srcdir)/Variables_Set.java
# NOTE: do _NOT_ add Fake_Class_for_Doxygen.java to this list. all_java_sources = \ $(fixed_java_sources) \ -$(required_instantiations_java_sources) \ -Termination.java +$(required_instantiations_java_sources) + +all_java_cxx_headers = \ +$(fixed_java_cxx_headers) \ +$(required_instantiations_java_cxx_headers)
# NOTE: Fake_Class_for_Doxygen.java should be added here. EXTRA_DIST = \ diff --git a/interfaces/Java/parma_polyhedra_library/ppl_interface_generator_java_classes_java_code.m4 b/interfaces/Java/parma_polyhedra_library/ppl_interface_generator_java_classes_java_code.m4 index 295ed7f..e83cada 100644 --- a/interfaces/Java/parma_polyhedra_library/ppl_interface_generator_java_classes_java_code.m4 +++ b/interfaces/Java/parma_polyhedra_library/ppl_interface_generator_java_classes_java_code.m4 @@ -657,5 +657,45 @@ m4_define(`ppl_termination_test_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_code', ___END_OF_FILE___ ___BEGIN_OF_FILE___ Termination.java << ___END_OF_FILE___ public static native boolean - ppl_termination_test_MS_@TOPOLOGY@@CLASS@(@TOPOLOGY@@CLASS@ p); + ppl_termination_test_@TERMINATION_ID@_@TOPOLOGY@@CLASS@(@TOPOLOGY@@CLASS@ p); +') + +m4_define(`ppl_termination_test_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2_code', +`dnl +___END_OF_FILE___ +___BEGIN_OF_FILE___ Termination.java << ___END_OF_FILE___ + public static native boolean + ppl_termination_test_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2(@TOPOLOGY@@CLASS@ p_before, @TOPOLOGY@@CLASS@ p_after); +') + +m4_define(`ppl_one_affine_ranking_function_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_code', +`dnl +___END_OF_FILE___ +___BEGIN_OF_FILE___ Termination.java << ___END_OF_FILE___ + public static native boolean + ppl_one_affine_ranking_function_@TERMINATION_ID@_@TOPOLOGY@@CLASS@(@TOPOLOGY@@CLASS@ p, Generator g); +') + +m4_define(`ppl_one_affine_ranking_function_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2_code', +`dnl +___END_OF_FILE___ +___BEGIN_OF_FILE___ Termination.java << ___END_OF_FILE___ + public static native boolean + ppl_one_affine_ranking_function_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2(@TOPOLOGY@@CLASS@ p_before, @TOPOLOGY@@CLASS@ p_after, Generator g); +') + +m4_define(`ppl_all_affine_ranking_functions_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_code', +`dnl +___END_OF_FILE___ +___BEGIN_OF_FILE___ Termination.java << ___END_OF_FILE___ + public static native boolean + ppl_all_affine_ranking_functions_@TERMINATION_ID@_@TOPOLOGY@@CLASS@(@TOPOLOGY@@CLASS@ p, Polyhedron ph); +') + +m4_define(`ppl_all_affine_ranking_functions_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2_code', +`dnl +___END_OF_FILE___ +___BEGIN_OF_FILE___ Termination.java << ___END_OF_FILE___ + public static native boolean + ppl_all_affine_ranking_functions_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2(@TOPOLOGY@@CLASS@ p_before, @TOPOLOGY@@CLASS@ p_after, Polyhedron ph); ')
participants (1)
-
Patricia Hill