changeset 11236:6ccf1130f23c

kpse cleanups
author John W. Eaton <jwe@octave.org>
date Wed, 10 Nov 2010 22:39:27 -0500
parents 9900d375e585
children 110e570e5f8d
files liboctave/ChangeLog liboctave/Makefile.am liboctave/kpse-xfns.c liboctave/kpse-xfns.h liboctave/kpse.cc
diffstat 5 files changed, 39 insertions(+), 77 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog	Wed Nov 10 22:09:25 2010 -0500
+++ b/liboctave/ChangeLog	Wed Nov 10 22:39:27 2010 -0500
@@ -1,3 +1,12 @@
+2010-11-10  John W. Eaton  <jwe@octave.org>
+
+	* kpse-xfns.c: Delete.
+	* kpse-xfns.h: Delete.  Move defintions to kpse.cc.
+	* Makefile.am (INCS): Remove kpse-xfns.h from the list.
+	(LIBOCT_PATHSEARCH_SOURCES): Define to pathsearch.cc.
+	(LIBOCT_PATHSEARCH_CXX_SOURCES,	LIBOCT_PATHSEARCH_C_SOURCES):
+	Delete variables.
+
 2010-11-10  John W. Eaton  <jwe@octave.org>
 
 	* lo-cieee.c Eliminate special cases for SCO.
--- a/liboctave/Makefile.am	Wed Nov 10 22:09:25 2010 -0500
+++ b/liboctave/Makefile.am	Wed Nov 10 22:39:27 2010 -0500
@@ -201,7 +201,6 @@
   functor.h \
   glob-match.h \
   idx-vector.h \
-  kpse-xfns.h \
   lo-array-gripes.h \
   lo-ieee.h \
   lo-macros.h \
@@ -498,8 +497,7 @@
 
 LIBOCT_PATHSEARCH_C_SOURCES = kpse-xfns.c
 
-LIBOCT_PATHSEARCH_SOURCES = \
-	$(LIBOCT_PATHSEARCH_C_SOURCES) $(LIBOCT_PATHSEARCH_CXX_SOURCES)
+LIBOCT_PATHSEARCH_SOURCES = pathsearch.cc
 
 LINK_DEPS = \
   $(RLD_FLAG) \
--- a/liboctave/kpse-xfns.c	Wed Nov 10 22:09:25 2010 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
-
-Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
-Copyright (C) 1993, 94, 95, 96, 97, 98 Karl Berry.
-Copyright (C) 1994, 95, 96, 97 Karl Berry & Olaf Weber.
-
-This library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version. 
-
-This library 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with this library; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA.  */
-
-#if defined (HAVE_CONFIG_H)
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include "kpse-xfns.h"
-
-/* Return the last element in a path.  */
-
-#ifndef HAVE_BASENAME
-
-/* Return NAME with any leading path stripped off.  This returns a
-   pointer into NAME.  For example, `basename ("/foo/bar.baz")'
-   returns "bar.baz".  */
-
-static const char *
-basename (const char *name)
-{
-  const char *base = NULL;
-  unsigned len = strlen (name);
-  
-  for (len = strlen (name); len > 0; len--) {
-    if (IS_DIR_SEP (name[len - 1]) || IS_DEVICE_SEP (name[len - 1])) {
-      base = name + len;
-      break;
-    }
-  }
-
-  if (!base)
-    base = name;
-  
-  return base;
-}
-
-#endif
-
-const char *
-octave_basename (const char *name)
-{
-  return (const char *) basename (name);
-}
--- a/liboctave/kpse-xfns.h	Wed Nov 10 22:09:25 2010 -0500
+++ b/liboctave/kpse-xfns.h	Wed Nov 10 22:39:27 2010 -0500
@@ -52,14 +52,4 @@
 #define NAME_BEGINS_WITH_DEVICE(name) 0 
 #endif
 
-#ifdef __cplusplus
-extern "C" {
 #endif
-
-extern const char *octave_basename (const char *name);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
--- a/liboctave/kpse.cc	Wed Nov 10 22:09:25 2010 -0500
+++ b/liboctave/kpse.cc	Wed Nov 10 22:39:27 2010 -0500
@@ -88,7 +88,35 @@
 #define stat ln_stat
 #endif /* OS2 */
 
-#include "kpse-xfns.h"
+/* Define the characters which separate components of
+   filenames and environment variable paths.  */
+
+/* What separates filename components?  */
+#ifndef DIR_SEP
+#ifdef DOSISH
+/* Either \'s or 's work.  Wayne Sullivan's web2pc prefers /, so we'll
+   go with that.  */
+#define DIR_SEP '/'
+#define DIR_SEP_STRING "/"
+#define IS_DEVICE_SEP(ch) ((ch) == ':')
+#define NAME_BEGINS_WITH_DEVICE(name) ((name.length()>0) && IS_DEVICE_SEP((name)[1]))
+/* On DOS, it's good to allow both \ and / between directories.  */
+#define IS_DIR_SEP(ch) ((ch) == '/' || (ch) == '\\')
+#else
+#define DIR_SEP '/'
+#define DIR_SEP_STRING "/"
+#endif /* not DOSISH */
+#endif /* not DIR_SEP */
+
+#ifndef IS_DIR_SEP
+#define IS_DIR_SEP(ch) ((ch) == DIR_SEP)
+#endif
+#ifndef IS_DEVICE_SEP /* No `devices' on, e.g., Unix.  */
+#define IS_DEVICE_SEP(ch) 0 
+#endif
+#ifndef NAME_BEGINS_WITH_DEVICE
+#define NAME_BEGINS_WITH_DEVICE(name) 0 
+#endif
 
 #include "lo-error.h"
 #include "oct-env.h"