bison-patches
[Top][All Lists]
Advanced

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

Re: [tim-3] Improved DJGPP support in src/files.c


From: Tim Van Holder
Subject: Re: [tim-3] Improved DJGPP support in src/files.c
Date: 16 Jan 2002 08:13:19 +0100

On Wed, 2002-01-16 at 01:53, Paul Eggert wrote:
> > From: "Tim Van Holder" <address@hidden>
> > Date: Tue, 15 Jan 2002 21:31:28 +0100
> 
> > > #ifndef ISSLASH
> > > # define ISSLASH(C) ((C) == '/')
> > > #endif
> > 
> > Good enough for me.  One small point though: would those macros be meant
> > for the user as well, or just for internal use by dirname.c?
> 
> My guess is that some poor benighted users will want it.  :-)

Drat.

> Why not something like this?  Ugly, but it'll work.  (Or if you want
> something more elegant and smaller you can replace the string with an
> external table.)
> 
> #define ISSLASH(x) (! 
> "...............................................\0............................................\0..................................................................................................................................................................."[(unsigned
>  char) (x)])

Isn't that charset-specific?
And the table approach would then have platform conditionals again
(unless you're suggesting another macro that would define the table).

> > I'm afraid that in order to get a working solution you'd need platform
> > conditionals for that one.
> 
> That's why it belongs in config.h, right?
 
Yes and no.  Yes if it's a macro, no if it's a function; I think it'll
need to be a function for DOS/Windows.  There are three cases there:

1) No filesys prefix (\FOO\BAR) -> 0
2) Drivespec (C:\FOO\BAR) -> 2
3) UNC (\\NETWORKSHARE\FOO\BAR) -> len(sharename)

(note that the '\' in these examples should be read as 'a character for
which IS_SLASH returns true).
The third case especially makes it hard to put this in a macro. IIRC the
fact that compound statements can be used as expressions is a gnu
extension; otherwise it would be easier (though ugly).





reply via email to

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