[PPL-devel] [GIT] ppl/ppl(master): Added some more infrastructure. Variables renamed.
Roberto Bagnara
bagnara at cs.unipr.it
Tue Mar 24 07:19:48 CET 2009
Module: ppl/ppl
Branch: master
Commit: 62138fd38306b0a68475b4a440bafaf41d5df525
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=62138fd38306b0a68475b4a440bafaf41d5df525
Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date: Tue Mar 24 07:19:25 2009 +0100
Added some more infrastructure. Variables renamed.
---
interfaces/C/ppl_c_header.h | 12 ++++++
interfaces/C/tests/formatted_output.c | 2 +-
interfaces/C/tests/print_to_buffer.c | 62 ++++++++++++++++----------------
interfaces/C/tests/print_to_buffer.h | 6 ++--
src/c_stream.h | 7 +++-
5 files changed, 52 insertions(+), 37 deletions(-)
diff --git a/interfaces/C/ppl_c_header.h b/interfaces/C/ppl_c_header.h
index 6f96cab..fa0bc9d 100644
--- a/interfaces/C/ppl_c_header.h
+++ b/interfaces/C/ppl_c_header.h
@@ -2465,4 +2465,16 @@ PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(MIP_Problem)
#include "c_stream.h"
+DECLARE_WRITE_VAL(Coefficient, ppl_const_Coefficient_t);
+DECLARE_WRITE_VAL(Linear_Expression, ppl_const_Linear_Expression_t);
+DECLARE_WRITE_VAL(Constraint, ppl_const_Constraint_t);
+DECLARE_WRITE_VAL(Constraint_System, ppl_const_Constraint_System_t);
+DECLARE_WRITE_VAL(Generator, ppl_const_Generator_t);
+DECLARE_WRITE_VAL(Generator_System, ppl_const_Generator_System_t);
+DECLARE_WRITE_VAL(Congruence, ppl_const_Congruence_t);
+DECLARE_WRITE_VAL(Congruence_System, ppl_const_Congruence_System_t);
+DECLARE_WRITE_VAL(Grid_Generator, ppl_const_Grid_Generator_t);
+DECLARE_WRITE_VAL(Grid_Generator_System, ppl_const_Grid_Generator_System_t);
+DECLARE_WRITE_VAL(MIP_Problem, ppl_const_MIP_Problem_t);
+
#endif /* !defined(PPL_ppl_c_h) */
diff --git a/interfaces/C/tests/formatted_output.c b/interfaces/C/tests/formatted_output.c
index 2f47073..e1c6311 100644
--- a/interfaces/C/tests/formatted_output.c
+++ b/interfaces/C/tests/formatted_output.c
@@ -53,7 +53,7 @@ main() {
p = print_ppl_Constraint_System_t_to_buffer(cs, 4, 64, 64);
if (check_noisy()) {
if (p == 0)
- printf("print_ppl_Constraint_System_t_to_buffer() returned NULL!\n");
+ printf("print_ppl_Constraint_System_to_buffer() returned NULL!\n");
else
printf(" %s\n", p);
}
diff --git a/interfaces/C/tests/print_to_buffer.c b/interfaces/C/tests/print_to_buffer.c
index b9c5519..5b80649 100644
--- a/interfaces/C/tests/print_to_buffer.c
+++ b/interfaces/C/tests/print_to_buffer.c
@@ -1,4 +1,4 @@
-/* Declarations of print_ppl_*_t_to_buffer() functions.
+/* Declarations of print_ppl_*_to_buffer() functions.
Copyright (C) 2001-2009 Roberto Bagnara <bagnara at cs.unipr.it>
This file is part of the Parma Polyhedra Library (PPL).
@@ -25,13 +25,13 @@ site: http://www.cs.unipr.it/ppl/ . */
#include <malloc.h>
#include <string.h>
-#define DEFINE_PRINT_TO_BUFFER(Name) \
+#define DEFINE_PRINT_TO_BUFFER(Type) \
char* \
-print_ppl_##Name##_t_to_buffer(ppl_const_##Name##_t p, \
+print_ppl_##Type##_to_buffer(ppl_const_##Type##_t p, \
unsigned indent_depth, \
unsigned pfll, \
unsigned pll) { \
- struct ppl_io_format_settings settings = { \
+ struct ppl_io_format_settings settings = { \
0, /* tr_in */ \
0, /* tr_out */ \
"\n", /* paragraph_end */ \
@@ -52,36 +52,36 @@ print_ppl_##Name##_t_to_buffer(ppl_const_##Name##_t p, \
{ 0, 0, ' ', 0, 0, ' ', "\n", PPL_IO_FORMAT_ALIGN_LEFT, 0 }, /* CHOPPED_NEXT */ \
{ 0, 0, ' ', 0, 0, ' ', "\n", PPL_IO_FORMAT_ALIGN_LEFT, 0 }, /* LONGER_FIRST */ \
{ 0, 0, ' ', 0, 0, ' ', "\n", PPL_IO_FORMAT_ALIGN_LEFT, 0 }, /* LONGER_FIRSTLAST */ \
- { 0, 0, ' ', 0, 0, ' ', "\n", PPL_IO_FORMAT_ALIGN_LEFT, 0 }, /* LONGER_NEXT */ \
- { 0, 0, ' ', 0, 0, ' ', "\n", PPL_IO_FORMAT_ALIGN_LEFT, 0 }, /* LONGER_LAST */ \
+ { 0, 0, ' ', 0, 0, ' ', "\n", PPL_IO_FORMAT_ALIGN_LEFT, 0 }, /* LONGER_NEXT */ \
+ { 0, 0, ' ', 0, 0, ' ', "\n", PPL_IO_FORMAT_ALIGN_LEFT, 0 }, /* LONGER_LAST */ \
{ 0, 0, ' ', 0, 0, ' ', "", PPL_IO_FORMAT_ALIGN_LEFT, 0 }, /* UNTERMINATED_FIRST */ \
{ 0, 0, ' ', 0, 0, ' ', "", PPL_IO_FORMAT_ALIGN_LEFT, 0 } /* UNTERMINATED_NEXT */ \
- } \
- }; \
- struct ppl_io_ostream *target, *stream; \
- char *buf; \
- settings.lines[PPL_IO_FORMAT_LINE_FIRST].length = pfll; \
- settings.lines[PPL_IO_FORMAT_LINE_FIRSTLAST].length = pfll; \
- settings.lines[PPL_IO_FORMAT_LINE_LONGER_FIRST].length = pfll; \
- settings.lines[PPL_IO_FORMAT_LINE_LONGER_FIRSTLAST].length = pfll; \
- settings.lines[PPL_IO_FORMAT_LINE_UNTERMINATED_FIRST].length = pfll; \
- settings.lines[PPL_IO_FORMAT_LINE_NEXT].length = pll; \
- settings.lines[PPL_IO_FORMAT_LINE_LAST].length = pll; \
- settings.lines[PPL_IO_FORMAT_LINE_LONGER_NEXT].length = pll; \
- settings.lines[PPL_IO_FORMAT_LINE_LONGER_LAST].length = pll; \
- settings.lines[PPL_IO_FORMAT_LINE_UNTERMINATED_NEXT].length = pll; \
- settings.lines[PPL_IO_FORMAT_LINE_NEXT].left_n = indent_depth; \
- settings.lines[PPL_IO_FORMAT_LINE_LAST].left_n = indent_depth; \
- settings.lines[PPL_IO_FORMAT_LINE_LONGER_NEXT].left_n = indent_depth; \
- settings.lines[PPL_IO_FORMAT_LINE_LONGER_LAST].left_n = indent_depth; \
+ } \
+ }; \
+ struct ppl_io_ostream *target, *stream; \
+ char *buf; \
+ settings.lines[PPL_IO_FORMAT_LINE_FIRST].length = pfll; \
+ settings.lines[PPL_IO_FORMAT_LINE_FIRSTLAST].length = pfll; \
+ settings.lines[PPL_IO_FORMAT_LINE_LONGER_FIRST].length = pfll; \
+ settings.lines[PPL_IO_FORMAT_LINE_LONGER_FIRSTLAST].length = pfll; \
+ settings.lines[PPL_IO_FORMAT_LINE_UNTERMINATED_FIRST].length = pfll; \
+ settings.lines[PPL_IO_FORMAT_LINE_NEXT].length = pll; \
+ settings.lines[PPL_IO_FORMAT_LINE_LAST].length = pll; \
+ settings.lines[PPL_IO_FORMAT_LINE_LONGER_NEXT].length = pll; \
+ settings.lines[PPL_IO_FORMAT_LINE_LONGER_LAST].length = pll; \
+ settings.lines[PPL_IO_FORMAT_LINE_UNTERMINATED_NEXT].length = pll; \
+ settings.lines[PPL_IO_FORMAT_LINE_NEXT].left_n = indent_depth; \
+ settings.lines[PPL_IO_FORMAT_LINE_LAST].left_n = indent_depth; \
+ settings.lines[PPL_IO_FORMAT_LINE_LONGER_NEXT].left_n = indent_depth; \
+ settings.lines[PPL_IO_FORMAT_LINE_LONGER_LAST].left_n = indent_depth; \
settings.lines[PPL_IO_FORMAT_LINE_UNTERMINATED_NEXT].left_n = indent_depth; \
- target = ppl_io_ostream_buffer_new(); \
- stream = ppl_io_ostream_format_new(target, &settings); \
- ppl_io_write_##Name(stream, p); \
- ppl_io_ostream_delete(stream); \
- ppl_io_ostream_buffer_get(target, &buf); \
- ppl_io_ostream_delete(target); \
- return buf; \
+ target = ppl_io_ostream_buffer_new(); \
+ stream = ppl_io_ostream_format_new(target, &settings); \
+ ppl_io_write_##Type(stream, p); \
+ ppl_io_ostream_delete(stream); \
+ ppl_io_ostream_buffer_get(target, &buf); \
+ ppl_io_ostream_delete(target); \
+ return buf; \
}
#if 0
diff --git a/interfaces/C/tests/print_to_buffer.h b/interfaces/C/tests/print_to_buffer.h
index f565f94..b4c47a7 100644
--- a/interfaces/C/tests/print_to_buffer.h
+++ b/interfaces/C/tests/print_to_buffer.h
@@ -1,4 +1,4 @@
-/* Declarations of print_ppl_*_t_to_buffer() functions.
+/* Declarations of print_ppl_*_to_buffer() functions.
Copyright (C) 2001-2009 Roberto Bagnara <bagnara at cs.unipr.it>
This file is part of the Parma Polyhedra Library (PPL).
@@ -33,9 +33,9 @@ site: http://www.cs.unipr.it/ppl/ . */
`preferred_first_line_length' and `preferred_line_length',
respectively.
*/
-#define DECLARE_PRINT_TO_BUFFER(Name) \
+#define DECLARE_PRINT_TO_BUFFER(Type) \
char* \
-print_ppl_##Name##_t_to_buffer(ppl_const_##Name##_t p, \
+print_ppl_##Type##_t_to_buffer(ppl_const_##Type##_t p, \
unsigned indent_depth, \
unsigned preferred_first_line_length, \
unsigned preferred_line_length);
diff --git a/src/c_stream.h b/src/c_stream.h
index 3c8454d..f39009d 100644
--- a/src/c_stream.h
+++ b/src/c_stream.h
@@ -101,8 +101,11 @@ int ppl_io_write_endl(struct ppl_io_ostream* s);
/* FIXME: */
/* Add ios_base methods: flags, setf, unsetf, width, precision (others?) */
-#define DECLARE_WRITE_VAL(name, type) int ppl_io_write_##name(struct ppl_io_ostream* s, const type o)
-#define DECLARE_WRITE_REF(name, type) int ppl_io_write_##name(struct ppl_io_ostream* s, const type* o)
+#define DECLARE_WRITE_VAL(name, type) \
+ int ppl_io_write_##name(struct ppl_io_ostream* s, const type o)
+
+#define DECLARE_WRITE_REF(name, type) \
+ int ppl_io_write_##name(struct ppl_io_ostream* s, const type* o)
DECLARE_WRITE_VAL(char, char);
DECLARE_WRITE_VAL(signed_char, signed char);
More information about the PPL-devel
mailing list