Hi Bruno! > Le 17 mars 2019 à 15:17, Bruno Haible <[email protected]> a écrit : > > Hi Akim, > > In your patch, I see a number of occurrences of '#if HAVE_LIBTEXTSTYLE'. > > Would it help, if there was (for example in gnulib) a file that serves > as replacement for <textstyle.h>, for when libtextstyle was not found? > Roughly like the attached one.
Oh yes! That would be most helpful!
I have checked that the file you sent was sufficient to cover
Bison's needs, and it's almost perfect:
- there are many unused arguments, use _GL_UNUSED liberally
- fdopen needs its second argument. I've put "w", but you'll know
better.
There remains one issue: I have:
> if (color_mode == color_yes
> || (color_mode == color_tty && isatty (STDERR_FILENO)))
> {
> style_file_prepare ("BISON_DIAGNOSTICS_STYLE", NULL,
> pkgdatadir (),
> "diagnostics.css");
> /* As a fallback, use the default in the current directory. */
> struct stat statbuf;
> if ((style_file_name == NULL || stat (style_file_name, &statbuf) < 0)
> && stat ("diagnostics.css", &statbuf) == 0)
> style_file_name = "diagnostics.css";
> }
> else
> /* No styling. */
> style_file_name = NULL;
which requires style_file_name to really exist, the #define won't do.
Maybe a set_style_file_name would be better?
BTW: did you really want the user to specify the .css part? In the
command line I prefer --style=foo to --style=foo.css, but we should
definitely have a single convention (which could be to support both:
add .css if the name has no extension).
Updated file attached.
Thanks!
textstyle-fallback.h
Description: Binary data
