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: Akim Demaille
Subject: Re: [tim-3] Improved DJGPP support in src/files.c
Date: 15 Jan 2002 18:41:42 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp)

| > >>>>> "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...
| 
| /*  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_ */

Hm, that's not what I had in mind.  My idea was introducing an
Autoconf macro that would ac_define IS_SLASH and the others.  It
seemed like the right idea to me (you know we are somewhat against
#ifdef _MY_SYSTEM_TAG :).

Nevertheless, it might be the right thing to do.  This is the kind of
things that involves Jim and Paul too.  As a matter of fact, it should
probably end in Autoconf some day.

Paul, Jim, any opinion?



reply via email to

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