diff -ur gcc-4.1-20070416.orig/gcc/common.opt gcc-4.1-20070416/gcc/common.opt --- gcc-4.1-20070416.orig/gcc/common.opt 2006-05-17 20:38:58.000000000 +0200 +++ gcc-4.1-20070416/gcc/common.opt 2007-04-18 20:54:04.000000000 +0200 @@ -1081,6 +1081,10 @@ Common JoinedOrMissing Generate debug information in extended XCOFF format +html +Common Report Var(html_flag,1) Init(0) +Along with -fdump-, its pretty printer outputs in XHTML-1.0 + o Common Joined Separate -o Place output into diff -ur gcc-4.1-20070416.orig/gcc/configure gcc-4.1-20070416/gcc/configure --- gcc-4.1-20070416.orig/gcc/configure 2006-11-13 23:09:55.000000000 +0100 +++ gcc-4.1-20070416/gcc/configure 2007-04-18 20:54:59.000000000 +0200 @@ -901,6 +901,10 @@ --enable-win32-registry=KEY use KEY instead of GCC version as the last portion of the registry key + --disable-pretty_printer_html + don't provide -html option for pretty printer + as used by -fdump-. + IT'S EXPERIMENTAL. Written by y J.C. Pizarro --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer @@ -7492,7 +7496,7 @@ else ac_prog_version=`$MAKEINFO --version 2>&1 | sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'` - echo "configure:7495: version of makeinfo is $ac_prog_version" >&5 + echo "configure:7499: version of makeinfo is $ac_prog_version" >&5 case $ac_prog_version in '') gcc_cv_prog_makeinfo_modern=no;; 4.[2-9]*) @@ -16256,6 +16260,23 @@ +# Disable the experimental patch of the -html option for pretty printer +# Check whether --enable-with_pretty_printer_html_option or --disable-with_pretty_printer_html_option was given. +if test "${enable_with_pretty_printer_html_option+set}" = set; then + enableval="$enable_with_pretty_printer_html_option" + enable_with_pretty_printer_html_option=no +else + enable_with_pretty_printer_html_option=yes +fi; + +if test x$enable_with_pretty_printer_html_option == xyes ; then + +cat >>confdefs.h <<\_ACEOF +#define WITH_PRETTY_PRINTER_HTML_OPTION 1 +_ACEOF + +fi + echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 diff -ur gcc-4.1-20070416.orig/gcc/configure.ac gcc-4.1-20070416/gcc/configure.ac --- gcc-4.1-20070416.orig/gcc/configure.ac 2006-11-13 23:09:55.000000000 +0100 +++ gcc-4.1-20070416/gcc/configure.ac 2007-04-18 20:54:05.000000000 +0200 @@ -3161,6 +3161,21 @@ AC_SUBST(zlibdir) AC_SUBST(zlibinc) +# Disable the experimental patch of the -html option for pretty printer +AC_ARG_ENABLE(with_pretty_printer_html_option, +[ --disable-pretty_printer_html + don't provide -html option for pretty printer + as used by -fdump-. + IT'S EXPERIMENTAL. Written by y J.C. Pizarro], +[enable_with_pretty_printer_html_option=no], +[enable_with_pretty_printer_html_option=yes]) + +if test x$enable_with_pretty_printer_html_option == xyes ; then + AC_DEFINE(WITH_PRETTY_PRINTER_HTML_OPTION, 1, +[Define if you want to use the -html option for pretty printer + as used by -fdump-. IT'S EXPERIMENTAL. Written by y J.C. Pizarro]) +fi + dnl Very limited version of automake's enable-maintainer-mode AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) diff -ur gcc-4.1-20070416.orig/gcc/pretty-print.c gcc-4.1-20070416/gcc/pretty-print.c --- gcc-4.1-20070416.orig/gcc/pretty-print.c 2005-09-28 08:53:12.000000000 +0200 +++ gcc-4.1-20070416/gcc/pretty-print.c 2007-04-18 20:54:06.000000000 +0200 @@ -815,3 +815,110 @@ pp_base (pp)->padding = pp_none; } } + +#ifdef WITH_PRETTY_PRINTER_HTML_OPTION +// ToDo: add extra suffix .html to the filename. +// ToDo: subscripted numbers +static FILE *pphtml_previous_stream = NULL; +int +pphtml_filtered_fputs + (__const char *__restrict __s, FILE *__restrict __stream) +{ + char c,*p,buf[80]; + + if (html_flag) + { // enabled -html option + if (pphtml_previous_stream != __stream) + { + pphtml_previous_stream = __stream; + // initialization of the code for this stream (quick & dirty, possiblely insecure) + fputs ("\n", __stream); + fputs ("\n", __stream); + fputs ("\n", __stream); + fputs ("\n", __stream); + fputs ("GCC dump\n", __stream); + fputs ("\n", __stream); + fputs ("\n", __stream); + } + // ToDo: when close XHTML if here can't close the stream? This is in other place ... + + for (p=__s;(c=*p++)!=0;) + { + switch (c) + { + case '\t': + //strcpy(buf," "); + strcpy(buf," "); // 8 spaces + break; + case '\n': + //strcpy(buf," \n"); + strcpy(buf,"
\n"); + break; + case '\r': + //strcpy(buf," "); + // Omit, does nothing + return 0; + break; + case ' ': + // each white space substituted by is ugly! + //strcpy(buf," "); + strcpy(buf," "); // ToDo: + break; + case '"': + strcpy(buf,"""); + break; + case '&': + strcpy(buf,"&"); + break; + case '<': + strcpy(buf,"<"); + break; + case '>': + strcpy(buf,">"); + break; + case 'P': + if (strncmp(p,"PHI ",4)==0) + { + // gucharmap: U+03A6 GREEK CAPITAL LETTER PHI + // i don't want to encode directly it to utf-8 + strcpy(buf,"Φ "); + p += (4 - 1); + } + else + { + buf[0] = c; buf[1] = 0; + } + break; + case 'P': + if (strncmp(p,"PHI ",4)==0) + { + // gucharmap: U+03A6 GREEK CAPITAL LETTER PHI + // i don't want to encode directly it to utf-8 + strcpy(buf,"Φ "); + p += (4 - 1); + } + else + { + buf[0] = c; buf[1] = 0; + } + break; + default: + if ((((unsigned char)c) > '~') || (((unsigned char)c) < ' ')) + { + sprintf("�%02X;",((unsigned char)c)); + } + else + { + buf[0] = c; buf[1] = 0; + } + } + fputs (buf, __stream); + } + } + else + { // no -html option, so fputs directly + fputs (__s, __stream); + } + return 0; +} +#endif //WITH_PRETTY_PRINTER_HTML_OPTION diff -ur gcc-4.1-20070416.orig/gcc/pretty-print.h gcc-4.1-20070416/gcc/pretty-print.h --- gcc-4.1-20070416.orig/gcc/pretty-print.h 2005-07-31 22:55:41.000000000 +0200 +++ gcc-4.1-20070416/gcc/pretty-print.h 2007-04-18 20:54:05.000000000 +0200 @@ -334,4 +334,9 @@ } #define pp_set_verbatim_wrapping(PP) pp_set_verbatim_wrapping_ (pp_base (PP)) +#ifdef WITH_PRETTY_PRINTER_HTML_OPTION +extern int pphtml_filtered_fputs + (__const char *__restrict __s, FILE *__restrict __stream); +#endif //WITH_PRETTY_PRINTER_HTML_OPTION + #endif /* GCC_PRETTY_PRINT_H */