[PPL-devel] [GIT] ppl/ppl(master): Added Box methods has_{upper, lower}_bound to C language interface.

Enea Zaffanella zaffanella at cs.unipr.it
Mon Mar 19 17:49:14 CET 2012


Module: ppl/ppl
Branch: master
Commit: 2ee57e6c104122a98ba0e3a2faeba0ec4b5b72a6
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=2ee57e6c104122a98ba0e3a2faeba0ec4b5b72a6

Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date:   Mon Mar 19 08:39:20 2012 +0100

Added Box methods has_{upper,lower}_bound to C language interface.

---

 interfaces/C/ppl_interface_generator_c_cc_code.m4  |   21 ++++++++++++++++++++
 interfaces/C/ppl_interface_generator_c_h_code.m4   |   12 +++++++++++
 interfaces/ppl_interface_generator_common_dat.m4   |    8 +++++++
 ...erface_generator_common_procedure_generators.m4 |    1 +
 4 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/interfaces/C/ppl_interface_generator_c_cc_code.m4 b/interfaces/C/ppl_interface_generator_c_cc_code.m4
index 387cf2c..42b0cba 100644
--- a/interfaces/C/ppl_interface_generator_c_cc_code.m4
+++ b/interfaces/C/ppl_interface_generator_c_cc_code.m4
@@ -260,6 +260,27 @@ CATCH_ALL
 
 ')
 
+m4_define(`ppl_ at CLASS@_has_ at UPPERLOWER@_bound_code',
+`int
+ppl_ at CLASS@_has_ at UPPERLOWER@_bound
+(ppl_ at CLASS@_t ps,
+ ppl_dimension_type dim,
+ int* pclosed,
+ ppl_Coefficient_t ext_n,
+ ppl_Coefficient_t ext_d) try {
+  const @CPP_CLASS@& pps = *to_const(ps);
+  Coefficient& eext_n = *to_nonconst(ext_n);
+  Coefficient& eext_d = *to_nonconst(ext_d);
+  bool closed;
+  bool bounded = pps.has_ at UPPERLOWER@_bound(dim, closed, eext_n, eext_d);
+  if (bounded)
+    *pclosed = closed ? 1 : 0;
+  return bounded ? 1 : 0;
+}
+CATCH_ALL
+
+')
+
 m4_define(`ppl_ at CLASS@_frequency_code',
 `int
 ppl_ at CLASS@_frequency
diff --git a/interfaces/C/ppl_interface_generator_c_h_code.m4 b/interfaces/C/ppl_interface_generator_c_h_code.m4
index c85fe29..5454df3 100644
--- a/interfaces/C/ppl_interface_generator_c_h_code.m4
+++ b/interfaces/C/ppl_interface_generator_c_h_code.m4
@@ -280,6 +280,18 @@ PPL_PROTO((ppl_const_ at CLASS@_t ph,
 
 ')
 
+m4_define(`ppl_ at CLASS@_get_ at UPPERLOWER@_bound_code',
+`/*! \relates ppl_ at CLASS@_tag */
+int
+ppl_ at CLASS@_get_ at UPPERLOWER@_bound
+PPL_PROTO((ppl_ at CLASS@_t ps,
+           ppl_dimension_type dim,
+           int* pclosed,
+           ppl_Coefficient_t ext_n,
+           ppl_Coefficient_t ext_d));
+
+')
+
 m4_define(`ppl_ at CLASS@_frequency_code',
 `/*! \relates ppl_ at CLASS@_tag */
 int
diff --git a/interfaces/ppl_interface_generator_common_dat.m4 b/interfaces/ppl_interface_generator_common_dat.m4
index 17b6a63..099795a 100644
--- a/interfaces/ppl_interface_generator_common_dat.m4
+++ b/interfaces/ppl_interface_generator_common_dat.m4
@@ -509,6 +509,7 @@ class_represent,
 has_property,
 simplify,
 abovebelow,
+upperlower,
 maxmin,
 comparison,
 refine_represent,
@@ -940,6 +941,13 @@ dnl ---------------------------------------------------------------------
 m4_define(`m4_abovebelow_replacements', `above, below')
 
 dnl ---------------------------------------------------------------------
+dnl pattern -- upper/lower
+dnl Used for has_upper_bound and has_lower_bound methods (Box domains).
+dnl ---------------------------------------------------------------------
+
+m4_define(`m4_upperlower_replacements', `upper, lower')
+
+dnl ---------------------------------------------------------------------
 dnl pattern == maxmin
 dnl Maximize or Minimize
 dnl ---------------------------------------------------------------------
diff --git a/interfaces/ppl_interface_generator_common_procedure_generators.m4 b/interfaces/ppl_interface_generator_common_procedure_generators.m4
index ead5e2c..2e89423 100644
--- a/interfaces/ppl_interface_generator_common_procedure_generators.m4
+++ b/interfaces/ppl_interface_generator_common_procedure_generators.m4
@@ -63,6 +63,7 @@ ppl_ at CLASS@_get_minimized_ at CLASS_REPRESENT@s/2 +simple,
 ppl_ at CLASS@_ at HAS_PROPERTY@/1 +all,
 ppl_ at CLASS@_ at SIMPLIFY@/1 *nofail +all,
 ppl_ at CLASS@_bounds_from_ at ABOVEBELOW@/2 +all,
+ppl_ at CLASS@_has_ at UPPERLOWER@_bound/5 +box,
 ppl_ at CLASS@_ at MAXMIN@/5 +all,
 ppl_ at CLASS@_ at MAXMIN@_with_point/6 +all,
 ppl_ at CLASS@_frequency/6 +simple,




More information about the PPL-devel mailing list