Mercurial > hg > octave-nkf
changeset 2495:29cd3862a9dc
[project @ 1996-11-11 02:39:49 by jwe]
author | jwe |
---|---|
date | Mon, 11 Nov 1996 02:42:44 +0000 |
parents | 902f330e9584 |
children | 9823f8bfd1a5 |
files | doc/interpreter/install.texi doc/interpreter/system.texi src/ChangeLog src/dirfns.cc src/octave.cc src/pt-mat.cc |
diffstat | 6 files changed, 77 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,27 @@ +Sun Nov 10 16:58:07 1996 John W. Eaton <jwe@bevo.che.wisc.edu> + + * 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 <jwe@bevo.che.wisc.edu> * defaults.cc, dynamic-ld.cc, fn-cache.cc, help.cc, oct-hist.cc,
--- a/src/dirfns.cc +++ b/src/dirfns.cc @@ -54,6 +54,7 @@ #include <unistd.h> #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) {
--- 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);