[GIT] ppl/ppl(master): Get rid of pretty_printing stuff. A string wrapping function is made

Module: ppl/ppl Branch: master Commit: 4bbd3ca34d382cab896a3ea43bd9fdb1d1df2df2 URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=4bbd3ca34d382...
Author: Abramo Bagnara abramo.bagnara@gmail.com Date: Fri Mar 27 17:22:08 2009 +0100
Get rid of pretty_printing stuff. A string wrapping function is made available.
---
interfaces/C/Makefile.am | 6 +- interfaces/C/ppl_c_header.h | 34 ++- interfaces/C/ppl_c_implementation_common.cc | 12 +- interfaces/C/ppl_c_implementation_common.defs.hh | 12 - interfaces/C/ppl_c_stream.cc | 109 -------- interfaces/C/ppl_c_stream.defs.hh | 39 --- interfaces/C/ppl_c_stream.h | 70 ----- interfaces/C/ppl_c_stream.inlines.hh | 42 --- interfaces/C/ppl_interface_generator_c_cc_code.m4 | 1 - interfaces/C/ppl_interface_generator_c_h_code.m4 | 1 - interfaces/C/tests/formatted_output.c | 2 + interfaces/C/tests/print_to_buffer.c | 68 +---- ...ppl_interface_generator_java_classes_cc_code.m4 | 31 -- interfaces/Java/jni/ppl_java_globals.cc | 251 ----------------- .../Java/parma_polyhedra_library/Congruence.java | 16 - .../parma_polyhedra_library/Congruence_System.java | 16 - .../Java/parma_polyhedra_library/Constraint.java | 16 - .../parma_polyhedra_library/Constraint_System.java | 16 - .../Java/parma_polyhedra_library/Generator.java | 16 - .../parma_polyhedra_library/Generator_System.java | 16 - .../parma_polyhedra_library/Grid_Generator.java | 16 - .../Grid_Generator_System.java | 16 - .../parma_polyhedra_library/Linear_Expression.java | 16 - .../Java/parma_polyhedra_library/MIP_Problem.java | 16 - ...l_interface_generator_java_classes_java_code.m4 | 20 -- interfaces/OCaml/OCaml_interface.dox | 20 -- .../OCaml/ppl_interface_generator_ocaml_cc_code.m4 | 27 -- .../OCaml/ppl_interface_generator_ocaml_ml_code.m4 | 8 - .../ppl_interface_generator_ocaml_mli_code.m4 | 8 - interfaces/OCaml/ppl_ocaml_common.cc | 24 -- interfaces/OCaml/ppl_ocaml_globals.ml | 4 - interfaces/OCaml/ppl_ocaml_globals.mli | 3 - .../ppl_interface_generator_prolog_cc_code.m4 | 31 -- .../ppl_interface_generator_prolog_hh_code.m4 | 11 - ...erface_generator_prolog_procedure_generators.m4 | 3 +- interfaces/Prolog/ppl_prolog_common.cc | 30 -- interfaces/Prolog/ppl_prolog_common.defs.hh | 8 - ...erface_generator_common_procedure_generators.m4 | 1 - src/Makefile.am | 10 +- src/c_streambuf_format.cc | 294 -------------------- src/c_streambuf_format.defs.hh | 62 ---- src/c_streambuf_format.types.hh | 21 -- src/c_streambuf_format_settings.h | 88 ------ src/pretty_print.cc | 245 ---------------- src/pretty_print.hh | 172 ------------ src/pretty_print.inlines.hh | 92 ------ src/wrap.cc | 92 ++++++ src/{c_streambuf_format.inlines.hh => wrap.hh} | 44 +++- 48 files changed, 178 insertions(+), 1978 deletions(-)
Diff: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commitdiff;h=4bbd3ca34...

Abramo Bagnara wrote:
Module: ppl/ppl Branch: master Commit: 4bbd3ca34d382cab896a3ea43bd9fdb1d1df2df2 URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=4bbd3ca34d382...
Author: Abramo Bagnara abramo.bagnara@gmail.com Date: Fri Mar 27 17:22:08 2009 +0100
Get rid of pretty_printing stuff. A string wrapping function is made available.
What is the correct way of debugprinting now? Roberto mentioned in http://www.cs.unipr.it/pipermail/ppl-devel/2009-March/014162.html that
/ppl_io_asprint_Polyhedron is obsolete. I would be glad of having a C function for printing inside a string buffer like the old to_buffer functions, with an indentation.
I think there are lots of interesting stuff in PPL git. What do you suggest me to use?
For what it is worth, the gcc/basilys.c file of MELT branch rev145113 still has
#warning using unstable PPL asprint functions "http://www.cs.unipr.it/pipermail/ppl-devel/2009-March/014162.html" void basilysgc_ppstrbuf_ppl_varnamvect (basilys_ptr_t sbuf_p, int indentsp, basilys_ptr_t ppl_p, basilys_ptr_t varnamvect_p) { int mag = 0; char *ppstr = NULL; BASILYS_ENTERFRAME(4, NULL); #define sbufv curfram__.varptr[0] #define pplv curfram__.varptr[1] #define varvectv curfram__.varptr[2] #define spec_pplv ((struct basilysspecial_st*)(pplv)) sbufv = sbuf_p; pplv = ppl_p; varvectv = varnamvect_p; if (!pplv) goto end; ppl_io_set_variable_output_function (ppl_basilys_variable_output_function); mag = basilys_magic_discr((basilys_ptr_t) pplv); if (varvectv) basilys_pplcoefvectp = (basilys_ptr_t*)&varvectv; else basilys_pplcoefvectp = NULL; switch (mag) { case OBMAG_SPECPPL_COEFFICIENT: if (ppl_io_asprint_Coefficient(&ppstr, spec_pplv->val.sp_coefficient)) fatal_error("failed to ppl_io_asprint_Coefficient"); break; case OBMAG_SPECPPL_LINEAR_EXPRESSION: if (ppl_io_asprint_Linear_Expression(&ppstr, spec_pplv->val.sp_linear_expression)) fatal_error("failed to ppl_io_asprint_Linear_Expression"); break; case OBMAG_SPECPPL_CONSTRAINT: if (ppl_io_asprint_Constraint(&ppstr, spec_pplv->val.sp_constraint)) fatal_error("failed to ppl_io_asprint_Constraint"); break; case OBMAG_SPECPPL_CONSTRAINT_SYSTEM: if (ppl_io_asprint_Constraint_System(&ppstr, spec_pplv->val.sp_constraint_system)) fatal_error("failed to ppl_io_asprint_Constraint_System"); break; case OBMAG_SPECPPL_GENERATOR: if (ppl_io_asprint_Generator(&ppstr, spec_pplv->val.sp_generator)) fatal_error("failed to ppl_io_asprint_Generator"); break; case OBMAG_SPECPPL_GENERATOR_SYSTEM: if (ppl_io_asprint_Generator_System(&ppstr, spec_pplv->val.sp_generator_system)) fatal_error("failed to ppl_io_asprint_Generator_System"); break; default: { char errmsg[64]; memset(errmsg, 0, sizeof(errmsg)); snprintf(errmsg, sizeof(errmsg)-1, "{{unknown PPL magic %d}}", mag); ppstr = xstrdup(errmsg); } break; } if (!ppstr) fatal_error("ppl_io_asprint_* gives a null string pointer"); /* in the resulting ppstr, replace each newline with appropriate indentation */ { char*bl = NULL; /* current begin of line */ char*nl = NULL; /* current newline = end of line */ for (bl = ppstr; (nl = bl?strchr(bl, '\n'):NULL), bl; bl = nl?(nl+1):NULL) { if (nl) *nl = (char)0; basilysgc_add_strbuf_raw((basilys_ptr_t) sbufv, bl); if (nl) basilysgc_strbuf_add_indent((basilys_ptr_t) sbufv, indentsp, 0); } } free(ppstr); end: basilys_pplcoefvectp = (basilys_ptr_t*)0; BASILYS_EXITFRAME(); #undef sbufv #undef pplv #undef varvectv #undef spec_pplv }
But of course I can replace it with new code. But what are the blessed way of debugprinting into a malloc-ed string or whatever using the C API?
Of course I am using the latest git snapshot and I am git pulling several times a day.
Regards. /

Basile STARYNKEVITCH wrote:
[...]
Please, do not worry: I have promised I will mail you when we are ready and I usually keep promises. Cheers,
Roberto

Basile STARYNKEVITCH wrote:
But of course I can replace it with new code. But what are the blessed way of debugprinting into a malloc-ed string or whatever using the C API?
Hi Basile,
if you use the latest git snapshot, you can do something similar to what is done in
interfaces/C/print_to_buffer.*
Differently from the previous version, this only uses services provided by the C interface, that is
ppl_io_asprint_*(), (yes, un-deprecated); ppl_io_wrap_string().
The latter is documented as follows:
/*! \brief Utility function for the wrapping of C strings.
\param src The source string holding the text to wrap.
\param indent_depth The indentation depth.
\param preferred_first_line_length The preferred length for the first line of text.
\param preferred_line_length The preferred length for all the lines but the first one.
\return The wrapped string in a malloc-allocated buffer. */ char* ppl_io_wrap_string(const char* src, unsigned indent_depth, unsigned preferred_first_line_length, unsigned preferred_line_length);
Please let us know how it goes. Cheers,
Roberto
participants (3)
-
Abramo Bagnara
-
Basile STARYNKEVITCH
-
Roberto Bagnara