[PPL-devel] [GIT] ppl/ppl(master): Added Ocaml interface function for frequency().
Patricia Hill
p.m.hill at leeds.ac.uk
Wed Mar 24 10:39:13 CET 2010
Module: ppl/ppl
Branch: master
Commit: 4b43b4bfd1d15e56cb5e3a4d271c5560ec260103
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=4b43b4bfd1d15e56cb5e3a4d271c5560ec260103
Author: Patricia Hill <p.m.hill at leeds.ac.uk>
Date: Wed Mar 24 09:12:41 2010 +0000
Added Ocaml interface function for frequency().
---
.../OCaml/ppl_interface_generator_ocaml_cc_code.m4 | 26 ++++++++++++++++++++
.../OCaml/ppl_interface_generator_ocaml_ml_code.m4 | 9 +++++++
.../ppl_interface_generator_ocaml_mli_code.m4 | 8 ++++++
...terface_generator_ocaml_procedure_generators.m4 | 1 +
4 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/interfaces/OCaml/ppl_interface_generator_ocaml_cc_code.m4 b/interfaces/OCaml/ppl_interface_generator_ocaml_cc_code.m4
index 1922588..9e521c5 100644
--- a/interfaces/OCaml/ppl_interface_generator_ocaml_cc_code.m4
+++ b/interfaces/OCaml/ppl_interface_generator_ocaml_cc_code.m4
@@ -729,6 +729,32 @@ CATCH_ALL
')
+m4_define(`ppl_ at CLASS@_frequency_code',
+`dnl
+extern "C"
+CAMLprim value
+ppl_ at CLASS@_frequency(value ph, value caml_le) try {
+ CAMLparam2(ph, caml_le);
+ CAMLlocal1(caml_return_value);
+ PPL_DIRTY_TEMP_COEFFICIENT(f_num);
+ PPL_DIRTY_TEMP_COEFFICIENT(f_den);
+ PPL_DIRTY_TEMP_COEFFICIENT(v_num);
+ PPL_DIRTY_TEMP_COEFFICIENT(v_den);
+ @CPP_CLASS@& pph = *p_ at CLASS@_val(ph);
+ bool ppl_return_value = pph.frequency(build_ppl_Linear_Expression(caml_le),
+ f_num, f_den, v_num, v_den);
+ caml_return_value = caml_alloc(5, 0);
+ Store_field(caml_return_value, 0, Val_bool(ppl_return_value));
+ Store_field(caml_return_value, 1, build_ocaml_coefficient(f_num));
+ Store_field(caml_return_value, 2, build_ocaml_coefficient(f_den));
+ Store_field(caml_return_value, 3, build_ocaml_coefficient(v_num));
+ Store_field(caml_return_value, 4, build_ocaml_coefficient(v_den));
+ CAMLreturn(caml_return_value);
+}
+CATCH_ALL
+
+')
+
m4_define(`ppl_ at CLASS@_OK_code',
`dnl
extern "C"
diff --git a/interfaces/OCaml/ppl_interface_generator_ocaml_ml_code.m4 b/interfaces/OCaml/ppl_interface_generator_ocaml_ml_code.m4
index aa3fd70..a454c72 100644
--- a/interfaces/OCaml/ppl_interface_generator_ocaml_ml_code.m4
+++ b/interfaces/OCaml/ppl_interface_generator_ocaml_ml_code.m4
@@ -360,6 +360,15 @@ external ppl_ at CLASS@_ at MAXMIN@_with_point:
')
+m4_define(`ppl_ at CLASS@_frequency_code',
+`dnl
+external ppl_ at CLASS@_frequency:
+ @!CLASS@ -> linear_expression
+ -> bool * Z.t * Z.t * Z.t * Z.t
+ = "ppl_ at CLASS@_frequency"
+
+')
+
m4_define(`ppl_ at CLASS@_OK_code',
`dnl
external ppl_ at CLASS@_OK:
diff --git a/interfaces/OCaml/ppl_interface_generator_ocaml_mli_code.m4 b/interfaces/OCaml/ppl_interface_generator_ocaml_mli_code.m4
index 6f6125a..27b398d 100644
--- a/interfaces/OCaml/ppl_interface_generator_ocaml_mli_code.m4
+++ b/interfaces/OCaml/ppl_interface_generator_ocaml_mli_code.m4
@@ -322,6 +322,14 @@ val ppl_ at CLASS@_ at MAXMIN@_with_point:
')
+m4_define(`ppl_ at CLASS@_frequency_code',
+`dnl
+val ppl_ at CLASS@_frequency:
+ @!CLASS@ -> linear_expression
+ -> bool * Z.t * Z.t * Z.t * Z.t
+
+')
+
m4_define(`ppl_ at CLASS@_OK_code',
`dnl
val ppl_ at CLASS@_OK:
diff --git a/interfaces/OCaml/ppl_interface_generator_ocaml_procedure_generators.m4 b/interfaces/OCaml/ppl_interface_generator_ocaml_procedure_generators.m4
index 8b8ff38..aec7ed4 100644
--- a/interfaces/OCaml/ppl_interface_generator_ocaml_procedure_generators.m4
+++ b/interfaces/OCaml/ppl_interface_generator_ocaml_procedure_generators.m4
@@ -43,6 +43,7 @@ dnl
m4_define(`m4_procedure_list',
`m4_echo_unquoted(ppl_new_ at CLASS@_iterator +pointset_powerset,
`m4_common_procedure_list',
+ppl_ at CLASS@_frequency/6 +simple,
ppl_termination_test_ at TERMINATION_ID@_ at TOPOLOGY@@CLASS@ +simple,
ppl_one_affine_ranking_function_ at TERMINATION_ID@_ at TOPOLOGY@@CLASS@ +simple,
ppl_all_affine_ranking_functions_ at TERMINATION_ID@_ at TOPOLOGY@@CLASS@ +simple,
More information about the PPL-devel
mailing list