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