[GIT] ppl/ppl(termination): Added OCaml interface code for the 6 new termination methods.

Module: ppl/ppl Branch: termination Commit: c8799e410088e03c76f449184780d572822cb177 URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=c8799e410088e...
Author: Patricia Hill p.m.hill@leeds.ac.uk Date: Mon Mar 22 14:54:42 2010 +0000
Added OCaml interface code for the 6 new termination methods.
---
.../OCaml/ppl_interface_generator_ocaml_cc_code.m4 | 121 ++++++++++++++++++++ .../OCaml/ppl_interface_generator_ocaml_ml_code.m4 | 47 ++++++++ .../ppl_interface_generator_ocaml_mli_code.m4 | 35 ++++++ ...terface_generator_ocaml_procedure_generators.m4 | 13 ++- 4 files changed, 215 insertions(+), 1 deletions(-)
diff --git a/interfaces/OCaml/ppl_interface_generator_ocaml_cc_code.m4 b/interfaces/OCaml/ppl_interface_generator_ocaml_cc_code.m4 index 356b65a..3900367 100644 --- a/interfaces/OCaml/ppl_interface_generator_ocaml_cc_code.m4 +++ b/interfaces/OCaml/ppl_interface_generator_ocaml_cc_code.m4 @@ -1204,3 +1204,124 @@ ppl_@CLASS@_approximate_@PARTITION@(value ph1, value ph2) try { CATCH_ALL
') + +m4_define(`ppl_termination_test_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_code', +`dnl +extern "C" +CAMLprim value +ppl_termination_test_@TERMINATION_ID@_@TOPOLOGY@@CLASS@(value pset) try { + CAMLparam1(pset); + const @TOPOLOGY@@CPP_CLASS@& ppset + = *(reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(p_@CLASS@_val(pset))); + CAMLreturn(Val_bool(termination_test_@TERMINATION_ID@(ppset))); +} +CATCH_ALL + +') + +m4_define(`ppl_termination_test_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2_code', +`dnl +extern "C" +CAMLprim value + ppl_termination_test_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2(value pset_before, + value pset_after) + try { + CAMLparam2(pset_before, pset_after); + const @TOPOLOGY@@CPP_CLASS@& ppset_before + = *(reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(p_@CLASS@_val(pset_before))); + const @TOPOLOGY@@CPP_CLASS@& ppset_after + = *(reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(p_@CLASS@_val(pset_after))); + CAMLreturn(Val_bool(termination_test_@TERMINATION_ID@_2(ppset_before, + ppset_after))); +} +CATCH_ALL + +') + +m4_define(`ppl_one_affine_ranking_function_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_code', +`dnl +extern "C" +CAMLprim value + ppl_one_affine_ranking_function_@TERMINATION_ID@_@TOPOLOGY@@CLASS@ + (value pset) + try { + CAMLparam1(pset); + CAMLlocal1(caml_return_value); + const @TOPOLOGY@@CPP_CLASS@& ppset + = *(reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(p_@CLASS@_val(pset))); + Generator g(point()); + bool ppl_return_value = one_affine_ranking_function_@TERMINATION_ID@ + (ppset, g); + caml_return_value = caml_alloc(2, 0); + Store_field(caml_return_value, 0, Val_bool(ppl_return_value)); + Store_field(caml_return_value, 1, build_ocaml_generator(g)); + CAMLreturn(caml_return_value); +} +CATCH_ALL + +') + +m4_define(`ppl_one_affine_ranking_function_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2_code', +`dnl +extern "C" +CAMLprim value + ppl_one_affine_ranking_function_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2 + (value pset_before, value pset_after) + try { + CAMLparam2(pset_before, pset_after); + CAMLlocal1(caml_return_value); + const @TOPOLOGY@@CPP_CLASS@& ppset_before + = *(reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(p_@CLASS@_val(pset_before))); + const @TOPOLOGY@@CPP_CLASS@& ppset_after + = *(reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(p_@CLASS@_val(pset_after))); + Generator g(point()); + bool ppl_return_value = one_affine_ranking_function_@TERMINATION_ID@_2 + (ppset_before, ppset_after, g); + caml_return_value = caml_alloc(2, 0); + Store_field(caml_return_value, 0, Val_bool(ppl_return_value)); + Store_field(caml_return_value, 1, build_ocaml_generator(g)); + CAMLreturn(caml_return_value); +} +CATCH_ALL + +') + +m4_define(`ppl_all_affine_ranking_functions_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_code', +`dnl +extern "C" +CAMLprim value + ppl_all_affine_ranking_functions_@TERMINATION_ID@_@TOPOLOGY@@CLASS@ + (value pset) + try { + CAMLparam1(pset); + CAMLlocal1(caml_return_value); + const @TOPOLOGY@@CPP_CLASS@& ppset + = *(reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(p_@CLASS@_val(pset))); + @A_TERMINATION_ID@Polyhedron* ph = new @A_TERMINATION_ID@Polyhedron(); + all_affine_ranking_functions_@TERMINATION_ID@(ppset, *ph); + CAMLreturn(unregistered_value_p_Polyhedron(*ph)); +} +CATCH_ALL + +') + +m4_define(`ppl_all_affine_ranking_functions_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2_code', +`dnl +extern "C" +CAMLprim value + ppl_all_affine_ranking_functions_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2 + (value pset_before, value pset_after) + try { + CAMLparam2(pset_before, pset_after); + CAMLlocal1(caml_return_value); + const @TOPOLOGY@@CPP_CLASS@& ppset_before + = *(reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(p_@CLASS@_val(pset_before))); + const @TOPOLOGY@@CPP_CLASS@& ppset_after + = *(reinterpret_cast<@TOPOLOGY@@CPP_CLASS@*>(p_@CLASS@_val(pset_after))); + @A_TERMINATION_ID@Polyhedron* ph = new @A_TERMINATION_ID@Polyhedron(); + all_affine_ranking_functions_@TERMINATION_ID@_2(ppset_before, ppset_after, *ph); + CAMLreturn(unregistered_value_p_Polyhedron(*ph)); +} +CATCH_ALL + +') diff --git a/interfaces/OCaml/ppl_interface_generator_ocaml_ml_code.m4 b/interfaces/OCaml/ppl_interface_generator_ocaml_ml_code.m4 index 0617f89..0642842 100644 --- a/interfaces/OCaml/ppl_interface_generator_ocaml_ml_code.m4 +++ b/interfaces/OCaml/ppl_interface_generator_ocaml_ml_code.m4 @@ -546,3 +546,50 @@ external ppl_@CLASS@_@MAXMIN@: = "ppl_@CLASS@_@MAXMIN@"
') + +m4_define(`ppl_termination_test_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_code', +`dnl +external ppl_termination_test_@TERMINATION_ID@_@TOPOLOGY@@CLASS@: + @!CLASS@ -> bool = "ppl_termination_test_@TERMINATION_ID@_@TOPOLOGY@@CLASS@" + +') + +m4_define(`ppl_termination_test_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2_code', +`dnl +external ppl_termination_test_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2: + @!CLASS@ -> @!CLASS@ -> bool + = "ppl_termination_test_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2" + +') + +m4_define(`ppl_one_affine_ranking_function_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_code', +`dnl +external ppl_one_affine_ranking_function_@TERMINATION_ID@_@TOPOLOGY@@CLASS@: + @!CLASS@ -> bool * linear_generator + = "ppl_one_affine_ranking_function_@TERMINATION_ID@_@TOPOLOGY@@CLASS@" + +') + +m4_define(`ppl_one_affine_ranking_function_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2_code', +`dnl +external ppl_one_affine_ranking_function_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2: + @!CLASS@ -> @!CLASS@ -> bool * linear_generator + = "ppl_one_affine_ranking_function_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2" + +') + +m4_define(`ppl_all_affine_ranking_functions_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_code', +`dnl +external ppl_all_affine_ranking_functions_@TERMINATION_ID@_@TOPOLOGY@@CLASS@: + @!CLASS@ -> polyhedron + = "ppl_all_affine_ranking_functions_@TERMINATION_ID@_@TOPOLOGY@@CLASS@" + +') + +m4_define(`ppl_all_affine_ranking_functions_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2_code', +`dnl +external ppl_all_affine_ranking_functions_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2: + @!CLASS@ -> @!CLASS@ -> polyhedron + = "ppl_all_affine_ranking_functions_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2" + +') diff --git a/interfaces/OCaml/ppl_interface_generator_ocaml_mli_code.m4 b/interfaces/OCaml/ppl_interface_generator_ocaml_mli_code.m4 index 014d876..acb05a4 100644 --- a/interfaces/OCaml/ppl_interface_generator_ocaml_mli_code.m4 +++ b/interfaces/OCaml/ppl_interface_generator_ocaml_mli_code.m4 @@ -480,3 +480,38 @@ val ppl_@CLASS@_approximate_@PARTITION@: @!CLASS@ * pointset_powerset_grid * bool
') + +m4_define(`ppl_termination_test_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2_code', +`dnl +val ppl_termination_test_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2: + @!CLASS@ -> @!CLASS@ -> bool + +') + +m4_define(`ppl_one_affine_ranking_function_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_code', +`dnl +val ppl_one_affine_ranking_function_@TERMINATION_ID@_@TOPOLOGY@@CLASS@: + @!CLASS@ -> bool * linear_generator + +') + +m4_define(`ppl_one_affine_ranking_function_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2_code', +`dnl +val ppl_one_affine_ranking_function_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2: + @!CLASS@ -> @!CLASS@ -> bool * linear_generator + +') + +m4_define(`ppl_all_affine_ranking_functions_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_code', +`dnl +val ppl_all_affine_ranking_functions_@TERMINATION_ID@_@TOPOLOGY@@CLASS@: + @!CLASS@ -> polyhedron + +') + +m4_define(`ppl_all_affine_ranking_functions_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2_code', +`dnl +val ppl_all_affine_ranking_functions_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2: + @!CLASS@ -> @!CLASS@ -> polyhedron + +') diff --git a/interfaces/OCaml/ppl_interface_generator_ocaml_procedure_generators.m4 b/interfaces/OCaml/ppl_interface_generator_ocaml_procedure_generators.m4 index 0e39dcb..8b8ff38 100644 --- a/interfaces/OCaml/ppl_interface_generator_ocaml_procedure_generators.m4 +++ b/interfaces/OCaml/ppl_interface_generator_ocaml_procedure_generators.m4 @@ -40,4 +40,15 @@ dnl in the ppl_interface_generator_*_code.m4 file. dnl The <name> must be exactly as written here. dnl
-m4_define(`m4_procedure_list', `m4_common_procedure_list') +m4_define(`m4_procedure_list', + `m4_echo_unquoted(ppl_new_@CLASS@_iterator +pointset_powerset, +`m4_common_procedure_list', +ppl_termination_test_@TERMINATION_ID@_@TOPOLOGY@@CLASS@ +simple, +ppl_one_affine_ranking_function_@TERMINATION_ID@_@TOPOLOGY@@CLASS@ +simple, +ppl_all_affine_ranking_functions_@TERMINATION_ID@_@TOPOLOGY@@CLASS@ +simple, +ppl_termination_test_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2 +simple, +ppl_one_affine_ranking_function_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2 +simple, +ppl_all_affine_ranking_functions_@TERMINATION_ID@_@TOPOLOGY@@CLASS@_2 +simple, +) +') +
participants (1)
-
Patricia Hill