[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 0/3] Various clean up in preparation for libtextstyle

From: Akim Demaille
Subject: Re: [PATCH 0/3] Various clean up in preparation for libtextstyle
Date: Sun, 17 Mar 2019 19:54:57 +0100

Hi Bruno!

> Le 17 mars 2019 à 15:17, Bruno Haible <address@hidden> 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

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.


Attachment: textstyle-fallback.h
Description: Binary data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]