# HG changeset patch # User jwe # Date 847680164 0 # Node ID 29cd3862a9dc06aade1200eca8108f1e55d87ace # Parent 902f330e9584e381583b0995843a30e9774850d0 [project @ 1996-11-11 02:39:49 by jwe] diff --git a/doc/interpreter/install.texi b/doc/interpreter/install.texi --- a/doc/interpreter/install.texi +++ b/doc/interpreter/install.texi @@ -174,6 +174,14 @@ system. Using GNU @code{sed} avoids the problem. @item +If @code{configure} finds @code{dlopen}, @code{dlsym}, @code{dlclose}, +and @code{dlerror}, but not the header file @file{dlfcn.h}, you need to +find the source for the header file and install it in the directory +@file{usr/include}. This is reportedly a problem with Slackware 3.1. +For Linux/GNU systems, the source for @file{dlfcn.h} is in the +@samp{ldso} package. + +@item You may need to edit some files in the gcc include subdirectory to add prototypes for functions there. For example, Ultrix 4.2 needs proper declarations for the @code{signal()} and the @code{SIG_IGN} macro in the diff --git a/doc/interpreter/system.texi b/doc/interpreter/system.texi --- a/doc/interpreter/system.texi +++ b/doc/interpreter/system.texi @@ -352,6 +352,13 @@ link, @code{lstat} is equivalent to @code{stat}. @end deftypefn +@deftypefn {Built-in Function} {} glob (@var{pattern}) +Given an array of strings in @var{pattern}, return the list of file +names that any of them, or an empty string if no patterns match. Tilde +expansion is performed on each of the patterns before looking for +matching file names. +@end deftypefn + @node Interacting with the OS, Password Database Functions, Filesystem Utilities, System Utilities @section Interacting with the OS diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,27 @@ +Sun Nov 10 16:58:07 1996 John W. Eaton + + * octave.cc (intern_argv): Use new string_vector constructor. + + * ov-str-mat.cc (octave_char_matrix_str::all_strings): Have + charMatrix::row_as_string() strip trailing whitespace. + + * dirfns.cc (Fglob): new function. + + * sysdep.cc (oct_tilde_expand): Provide version that works on + string vectors too. + (Ftilde_expand): Work on string vector args. + + * load-save.cc (save_binary_data): Call char_matrix_value() to + extract charMatrix from octave_value object, not all_strings(). + (save_ascii_data): Likewise. + * pt-mat.cc (tree_matrix::eval): Likewise. + + * ov.h (octave_value::all_strings): Return string_vector, not + charMatrix. + * ov-base.cc (octave_base_value::all_strings): Likewise. + * ov-str-mat.h, ov-str-mat.cc (octave_char_matrix_str::all_strings): + Likewise. + Fri Nov 8 09:54:59 1996 John W. Eaton * defaults.cc, dynamic-ld.cc, fn-cache.cc, help.cc, oct-hist.cc, diff --git a/src/dirfns.cc b/src/dirfns.cc --- a/src/dirfns.cc +++ b/src/dirfns.cc @@ -54,6 +54,7 @@ #include #endif +#include "oct-glob.h" #include "str-vec.h" #include "defun.h" @@ -584,6 +585,40 @@ return retval; } +DEFUN (glob, args, , + "glob (PATTERN)\n\ +\n\ +Given an array of strings in PATTERN, return the list of file names +that any of them, or an empty string if no patterns match. Tilde +expansion is performed on each of the patterns before looking for +matching file names.") +{ + octave_value retval; + + if (args.length () == 1) + { + string_vector pat = args(0).all_strings (); + + if (error_state) + gripe_wrong_type_arg ("glob", args(0)); + else + { + glob_match pattern (oct_tilde_expand (pat)); + + string_vector list = pattern.glob (); + + if (list.empty ()) + retval = ""; + else + retval = list; + } + } + else + print_usage ("glob"); + + return retval; +} + static int pwd (void) { diff --git a/src/octave.cc b/src/octave.cc --- a/src/octave.cc +++ b/src/octave.cc @@ -171,18 +171,9 @@ { if (argc > 1) { - int max_len = 0; - for (int i = 1; i < argc; i++) - { - int tmp_len = strlen (argv[i]); - if (tmp_len > max_len) - max_len = tmp_len; - } + // Skip program name in argv. - octave_argv.resize (argc-1); - - for (int i = 1; i < argc; i++) - octave_argv[i-1] = argv[i]; + octave_argv = string_vector (argv+1, argc-1); bind_builtin_variable ("argv", octave_argv, 1, 1, 0); bind_builtin_variable ("__argv__", octave_argv, 1, 1, 0); diff --git a/src/pt-mat.cc b/src/pt-mat.cc --- a/src/pt-mat.cc +++ b/src/pt-mat.cc @@ -517,7 +517,7 @@ m (put_row, put_col) = elt.double_value (); else if (elt.is_string () && all_strings) { - charMatrix chm_elt = elt.all_strings (); + charMatrix chm_elt = elt.char_matrix_value (); if (error_state) goto done;