[PPL-devel] [Fwd: PPL questions (GGCC related)]

Roberto Bagnara bagnara at cs.unipr.it
Wed Oct 1 12:12:32 CEST 2008


Roberto Bagnara wrote:
> We had an interesting exchange about debugprinting into a string in PPL.
>   From my point of view, debugprinting into a string means putting (or
> appending) into a string (not a FILE*) a textual representation of PPL
> data, for debugging purposes... Ideally, I would dream of being able to
> transmit to the debugprinting routines an indentation (so that any
> newline is followed by some given number of spaces), but I could manage
> without.
> 
> What is the quickest way to achieve that? I would prefer avoiding
> fmemopen or open_memstream if possible (it is too GNUlibc specific).

[CC to the GGCC mailing list since this work has been done in our
quality of GlobalGCC partners.]

Dear Basile,

one possibility is now available in the PPL 0.10 snapshot available at

   ftp://ftp.cs.unipr.it/pub/ppl/snapshots/

In the interfaces/C/tests directory, you will find a prototype of what
you are looking for.  The interface is in print_to_buffer.h (with
a comment that, I see only now, has not been updated... see below for
the correct one), the implementation is in print_to_buffer.cc,
and an example of use is in cxxoutput.c.

In PPL 0.11 we may make a variation of this feature available directly
from the C and the other interfaces.  Some design is required though.
If you believe it is really important to have such a feature in the C
interface starting from PPL 0.10, we can perhaps refine the design
for the C interface only and try to stick it in this release.
But, first, please try it and let us know how it goes and if you believe
this is adequate for the debugging purposes you have in mind.

If there are any other features that could help the GlobalGCC project
to succeed, please let us know.
All the best,

    Roberto

/*
   Returns a buffer allocated with malloc() containing a printable
   representation of the PPL object referenced by `p', where each
   newline is followed by `indent_depth' blank spaces and the preferred
   maximum length of the first and the following lines are given by
   `preferred_first_line_length' and `preferred_line_length',
   respectively.
*/
#define DECLARE_PRINT_TO_BUFFER(Type)                                   \
char* print_ppl_##Type##_t_to_buffer(ppl_##Type##_t p,                  \
                                      unsigned indent_depth,             \
                                      unsigned preferred_first_line_length, \
                                      unsigned preferred_line_length);


-- 
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it



More information about the PPL-devel mailing list