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

Roberto Bagnara bagnara at cs.unipr.it
Fri Mar 27 20:52:11 CET 2009


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

-- 
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