On 2017/10/11 5:04, Manuel López-Ibáñez wrote:
Ops! You're obviously right. What was I thinking?

I still believe that pretty-printer.c is not the right place for all this color-handling code (diagnostic-color.c or libiberty/ may be better places).
No and yes. The colors emerge only when those messages are sent to a terminal. Plain arrays of characters don't have colors. So it is _the_ printer that does colorization.

Indeed I hope this host-specific code could go elsewhere. My initial attempt to move it to a separated .c file failed, as I mentioned in the very first mail.

Also, your code handles a lot more ANSI codes than those needed for color output. The code in grep seems much simpler. Could your fputs replacement split the string as you suggest above, then if the chunk is an ANSI code, use grep's conversion function to transform the codes, otherwise use fputs to print text.

At the moment I implemented it, I knew GCC was making of coloring and erase-line codes, while still had no idea whether more codes should be needed in the future. Hence almost all codes viable have been implemented.

I hope one day GREP people will be copying my code from GCC. Don't tell them. XD

Cheers,

Manuel.




--
Best regards,
LH_Mouse

Reply via email to