Mercurial > hg > octave-avbm
changeset 679:93c63deed7aa
[project @ 1994-09-09 13:50:40 by jwe]
author | jwe |
---|---|
date | Fri, 09 Sep 1994 13:50:48 +0000 |
parents | d13c89674a0a |
children | 080131574b28 |
files | configure.in src/help.cc src/utils.cc src/utils.h |
diffstat | 4 files changed, 86 insertions(+), 63 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.in +++ b/configure.in @@ -21,10 +21,10 @@ dnl along with Octave; see the file COPYING. If not, write to the Free dnl Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. dnl -AC_REVISION($Revision: 1.41 $)dnl +AC_REVISION($Revision: 1.42 $)dnl AC_PREREQ(1.8)dnl AC_INIT(src/octave.cc) -AC_CONFIG_HEADER(config.h) +AC_CONFIG_HEADER(config.h kpathsea/c-auto.h) dnl AC_DEFINE(OCTAVE_SOURCE, 1)dnl dnl @@ -82,7 +82,7 @@ includedir='$(prefix)/include' mandir='$(prefix)/man/man1' infodir='$(prefix)/info' -fcnfiledir='$(datadir)/octave/$(version)/m' +fcnfiledir='$(datadir)/octave/$(version)/m//' localfcnfilepath='$(datadir)/octave/site-m' archlibdir='$(libdir)/octave/$(version)/$(target_host_type)/exec' octfiledir='$(archlibdir)/oct' @@ -97,7 +97,7 @@ if test "$enableval" = "yes"; then builddir="." else - builddir=enableval + builddir=$enableval fi ], run_in_place=false)dnl dnl @@ -124,7 +124,7 @@ absolute_builddir=$absolute_builddir prefix=$absolute_srcdir infodir=$absolute_srcdir/info - fcnfiledir=$absolute_srcdir/scripts + fcnfiledir=$absolute_srcdir/scripts// archlibdir=$absolute_builddir fcnfilepath='.:$(fcnfiledir)' fi @@ -329,6 +329,15 @@ dnl Does the C compiler handle alloca() and const correctly? dnl AC_ALLOCA +dnl +dnl It would be nicer to test for the requisite putenv features directly, +dnl but can't figure out how to do that. +dnl +if test "`(uname) 2>/dev/null`" = NetBSD \ + || test "`(uname) 2>/dev/null`" = FreeBSD; then + AC_DEFINE(SMART_PUTENV) +fi +dnl AC_CONST dnl dnl If we haven't been forced to use f2c, try to find a Fortran compiler @@ -428,6 +437,7 @@ dnl Checks for header files. dnl AC_STDC_HEADERS +AC_HAVE_HEADERS(assert.h float.h limits.h memory.h pwd.h stdlib.h)dnl AC_HAVE_HEADERS(string.h varargs.h unistd.h floatingpoint.h)dnl AC_HAVE_HEADERS(sys/utsname.h sys/time.h sys/fcntl.h)dnl AC_HAVE_HEADERS(sys/ttold.h sys/ptem.h sys/select.h)dnl @@ -463,7 +473,7 @@ dnl AC_HAVE_FUNCS(setvbuf getcwd gethostname bzero rindex vfprintf vsprintf)dnl AC_HAVE_FUNCS(stricmp strnicmp strcasecmp strncasecmp strerror)dnl -AC_HAVE_FUNCS(atexit on_exit tempnam)dnl +AC_HAVE_FUNCS(atexit on_exit tempnam memmove putenv)dnl dnl dnl Check to see if we have IEEE math functions, and if so, which ones. dnl @@ -713,6 +723,6 @@ define([tmpB], [liboctave/Makefile src/Makefile dld/Makefile])dnl define([tmpC], [info/Makefile readline/Makefile readline/doc/Makefile])dnl define([tmpD], [readline/examples/Makefile doc/Makefile])dnl -define([tmpE], [scripts/Makefile test/Makefile])dnl +define([tmpE], [scripts/Makefile test/Makefile kpathsea/Makefile])dnl define([srcdirs], [tmpA tmpB tmpC tmpD tmpE])dnl AC_OUTPUT([srcdirs cruftdirs])dnl
--- a/src/help.cc +++ b/src/help.cc @@ -61,6 +61,11 @@ // XXX FIXME XXX #undef __FUNCTION_DEF #include <readline/tilde.h> + +#define boolean kpathsea_boolean +#define false kpathsea_false +#define true kpathsea_true +#include <kpathsea/pathsearch.h> } static help_list operators[] = @@ -388,23 +393,33 @@ // Also need to search octave_path for script files. - char **path = pathstring_to_vector (user_pref.loadpath); + char *path_elt = kpse_path_element (user_pref.loadpath); - char **ptr = path; - if (ptr) + while (path_elt) { - while (*ptr) + str_llist_type *elt_dirs = kpse_element_dirs (path_elt); + + str_llist_elt_type *dir; + for (dir = *elt_dirs; dir; dir = STR_LLIST_NEXT (*dir)) { - int count; - char **names = get_fcn_file_names (count, *ptr, 0); - output_buf << "\n*** function files in " - << make_absolute (*ptr, the_current_working_directory) - << ":\n\n"; - if (names && count > 0) - list_in_columns (output_buf, names); - delete [] names; - ptr++; + char *elt_dir = STR_LLIST (*dir); + + if (elt_dir) + { + int count; + char **names = get_fcn_file_names (count, elt_dir, 0); + + output_buf << "\n*** function files in " + << make_absolute (elt_dir, the_current_working_directory) + << ":\n\n"; + + if (names && count > 0) + list_in_columns (output_buf, names); + + delete [] names; + } } + path_elt = kpse_path_element (0); } additional_help_message (output_buf);
--- a/src/utils.cc +++ b/src/utils.cc @@ -45,10 +45,12 @@ #ifndef HAVE_STRNCASECMP extern int strncasecmp (const char*, const char*, size_t); #endif -} -extern "C" -{ +#define boolean kpathsea_boolean +#define false kpathsea_false +#define true kpathsea_true +#include <kpathsea/pathsearch.h> + #if defined (HAVE_TERMIOS_H) #include <termios.h> #elif defined (HAVE_TERMIO_H) @@ -202,6 +204,7 @@ return retval; } +#if 0 char ** pathstring_to_vector (char *pathstring) { @@ -250,6 +253,7 @@ return path; } +#endif // Return to the main command loop in octave.cc. @@ -421,38 +425,45 @@ char **retval = new char * [num_max]; int i = 0; - char **path = pathstring_to_vector (user_pref.loadpath); + char *path_elt = kpse_path_element (user_pref.loadpath); - char **ptr = path; - if (ptr) + while (path_elt) { - while (*ptr) + str_llist_type *elt_dirs = kpse_element_dirs (path_elt); + + str_llist_elt_type *dir; + for (dir = *elt_dirs; dir; dir = STR_LLIST_NEXT (*dir)) { - int tmp_num; - char **names = get_fcn_file_names (tmp_num, *ptr, no_suffix); + char *elt_dir = STR_LLIST (*dir); - if (i + tmp_num >= num_max - 1) + if (elt_dir) { + int tmp_num; + char **names = get_fcn_file_names (tmp_num, elt_dir, no_suffix); + + if (i + tmp_num >= num_max - 1) + { // Reallocate the array. Only copy pointers, not the strings they // point to, then only delete the original array of pointers, and not // the strings they point to. - num_max += 1024; - char **tmp = new char * [num_max]; - for (int j = 0; j < i; j++) - tmp[j] = retval[j]; + num_max += 1024; + char **tmp = new char * [num_max]; + for (int j = 0; j < i; j++) + tmp[j] = retval[j]; - delete [] retval; + delete [] retval; - retval = tmp; - } + retval = tmp; + } - int k = 0; - while (k < tmp_num) - retval[i++] = names[k++]; + int k = 0; + while (k < tmp_num) + retval[i++] = names[k++]; + } + } - ptr++; - } + path_elt = kpse_path_element (0); } retval[i] = 0; @@ -609,7 +620,7 @@ { char *retval = 0; - char *nm = strconcat ("/", name); + char *nm = strsave (name); if (suffix) { char *tmp = nm; @@ -620,30 +631,15 @@ if (! the_current_working_directory) get_working_directory ("file_in_path"); - char **path = pathstring_to_vector (user_pref.loadpath); + char *tmp = kpse_path_search (user_pref.loadpath, nm, kpathsea_true); - char **ptr = path; - if (ptr) + if (tmp) { - while (*ptr) - { - char *tmp = strconcat (*ptr, nm); - char *p = make_absolute (tmp, the_current_working_directory); - delete [] tmp; - ifstream in_file (p); - if (in_file) - { - in_file.close (); - retval = p; - goto done; - } - delete [] p; - ptr++; - } + retval = make_absolute (tmp, the_current_working_directory); + free (tmp); + delete [] nm; } - done: - delete [] nm; return retval; }