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: Sun, 13 Jan 2002 23:39:16 +0100

> >>>>> "Tim" == Tim Van Holder <address@hidden> writes:
> 
> Tim> On Fri, 2002-01-11 at 15:59, Akim Demaille wrote:
> >> Tim, as a first step towards improvement for DJGPP, I'd suggest
> >> that you look at lib/{dirname,basename}.[ch], and have configure.in
> >> define the IS_SLASH you need.
> 
> Tim> IIRC, DJGPP's libc has dirname and basename, so the versions in
> Tim> lib/ won't be used.
> 
> I guarantee they will be :)  The functions are dir_name and base_name,
> precisely to avoid the problems of native functions.

OK - below is a draft of a new header in lib/ (slash.h) that defines the
necessary things.  I'd also like to place the PARAMS macro in its own
little header file; it's currently duplicated in several places...

BTW: Do I need approval to commit updates to nl.po (HEAD & branch)?

/*  Copyright (C) 2002 Free Software Foundation, Inc.

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2, or (at your option)
    any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
Foundation,
    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */

#ifndef SLASH_H_
# define SLASH_H_ 1

/* ISSLASH(c) determines if c is a directory separator */

#if !defined(ISSLASH)
# if defined(WIN32) || defined(__DJGPP__)
#  if defined(__GNUC__)
#   define ISSLASH(C) ({typeof(C) __c = C; (__c == '/' || __c == '\\');
})
#  else
    /* FIXME: This evaluates C twice! */
#   define ISSLASH(C) ((C) == '/' || (C) == '\\')
#  endif
# elif defined(MSDOS)
#  define ISSLASH(C) ((C) == '\\')
# else
#  define ISSLASH(C) ((C) == '/')
# endif
#endif

#define BACKSLASH_IS_PATH_SEPARATOR ISSLASH ('\\')

#if !defined(FILESYSTEM_PREFIX_LEN)
# if defined(WIN32) || defined(__DJGPP__)
   /* FIXME: This needs to be more robust (handle UNCs etc.).
      Should probably be a function call. */
#  define FILESYSTEM_PREFIX_LEN(Filename) (((Filename)[1] == ':') ? 2 :
0)
# else
#  define FILESYSTEM_PREFIX_LEN(Filename) 0
# endif
#endif

#endif /* not SLASH_H_ */




reply via email to

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