This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RFD: filesys.h for libiberty


Hi all,
Below is my preliminary patch for include/filesys.h for libiberty. I'm not 
sure if I
handled Cygwin and Uwin correctly. I'm also not sure if I formatted everthing
to correctly. The standard doesn't say much about preprocessor macros, so
I followed the example set by the other .h files as best I could.

--- /dev/null	Fri Mar  3 15:09:53 2000
+++ include/filesys.h	Fri Mar  3 15:09:36 2000
@@ -0,0 +1,58 @@
+/* File system utilities
+
+   Copyright (C) 2000 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 of the License, 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 FILE_SYS_H
+#define FILE_SYS_H
+
+#ifndef IN_GCC
+
+#define DIR_SEPARATOR '/'
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+  defined (__OS2__)
+#define HAVE_DOS_BASED_FILE_SYSTEM
+#define DIR_SEPARATOR_2 '\\'
+#endif
+
+/* Define IS_DIR_SEPARATOR.  */
+#ifndef DIR_SEPARATOR_2
+/* Should it be # define ? */
+#define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+#define IS_DIR_SEPARATOR(ch) \
+         (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+/* Define PATH_SEPARATOR.  */
+#if defined (__MSDOS__) || defined (__OS2__) \
+	|| (defined (_WIN32) && !defined (__CYGWIN__) && !defined (__UWIN__))
+#define PATH_SEPARATOR ';'
+#else
+#define PATH_SEPARATOR ':'
+#endif
+
+/* Define IS_ABSOLUTE_DIR.  */
+#if !defined (HAVE_DOS_BASED_FILE_SYSTEM)
+#define IS_ABSOLUTE_DIR(x) (IS_DIR_SEPARATOR(*x))
+#else /* HAVE_DOS_BASED_FILE_SYSTEM */
+#define IS_ABSOLUTE_DIR(x) \
+  ((IS_DIR_SEPARATOR(*x)) || ((x)[0] && (x)[1] == ':' && 
(IS_DIR_SEPARATOR((x)[2]))))
+#endif /* HAVE_DOS_BASED_FILE_SYSTEM */
+
+#endif /* ! IN_GCC */
+#endif /* FILE_SYS_H */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]