Mercurial > hg > octave-terminal
changeset 4264:4e2d2516da22
[project @ 2003-01-03 05:30:34 by jwe]
author | jwe |
---|---|
date | Fri, 03 Jan 2003 05:30:34 +0000 |
parents | 34b8cd8e6ef5 |
children | 48897c78c52b |
files | ChangeLog configure.in scripts/ChangeLog scripts/miscellaneous/fileparts.m scripts/plot/grid.m src/ChangeLog src/defaults.cc src/dirfns.cc src/lex.l src/utils.cc |
diffstat | 10 files changed, 151 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-01-02 John W. Eaton <jwe@bevo.che.wisc.edu> + + * configure.in: Fail on all gcc 1.x and 2.x versions. + 2002-12-30 John W. Eaton <jwe@bevo.che.wisc.edu> * configure.in (OCTAVE_LOCAL_BUFFER): New macro.
--- a/configure.in +++ b/configure.in @@ -22,7 +22,7 @@ ### 02111-1307, USA. AC_INIT -AC_REVISION($Revision: 1.401 $) +AC_REVISION($Revision: 1.402 $) AC_PREREQ(2.52) AC_CONFIG_SRCDIR([src/octave.cc]) AC_CONFIG_HEADER(config.h) @@ -180,11 +180,8 @@ cxx_auto_instantiate_templates=yes case "$gxx_version" in - 1.* | 2.[[0123456]].* | 2.7.[01]*) - AC_MSG_ERROR([g++ version $gxx_version will not work to compile Octave]) - ;; - 2.8* | 2.9[[1-6]]*) - cxx_auto_instantiate_templates=no + 1.* | 2.[[0123456789]].*) + AC_MSG_ERROR([g++ version $gxx_version will probably fail to compile Octave]) ;; esac
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,5 +1,9 @@ 2003-01-02 John W. Eaton <jwe@bevo.che.wisc.edu> + * miscellaneous/fileparts.m: New file. + + * io/beep.m: New file. + * plot/__pltopt1__.m: Call undo_string_escapes for title part of format only.
new file mode 100644 --- /dev/null +++ b/scripts/miscellaneous/fileparts.m @@ -0,0 +1,43 @@ +## Copyright (C) 2003 John W. Eaton +## +## This file is part of Octave. +## +## Octave 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, or (at your option) +## any later version. +## +## Octave 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 Octave; see the file COPYING. If not, write to the Free +## Software Foundation, 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. + +## -*- texinfo -*- +## @deftypefn {Built-in Function} {[@var{dir}, @var{name}, @var{ext}, @var{ver}]} fnmatch (@var{filename}) +## Return the directory, name, extension, and version components of +## @var{filename}. +## @end deftypefn + +function [directory, name, extension, version] = fileparts (filename) + + if (nargin == 1) + if (isstr (filename)) + ds = rindex (filename, filesep); + es = rindex (filename, "."); + directory = filename(1:ds-1); + name = filename(ds+1:es-1); + extension = filename(es+1:length (filename)); + version = ""; + else + error ("filesep: expecting filename argument to be a string"); + endif + else + usage ("filesep (filename)"); + endif + +endfunction
--- a/scripts/plot/grid.m +++ b/scripts/plot/grid.m @@ -28,6 +28,8 @@ ## Author: jwe +## PKG_ADD: mark_as_command grid + function grid (x) usage_msg = "grid (\"on\" | \"off\")";
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,13 @@ 2003-01-02 John W. Eaton <jwe@bevo.che.wisc.edu> + * dirfns.cc (symbols_of_dirfns): New function. + Install new built-in constant filesep. + + * utils.cc (Fisvaranme): New function. + (valid_identifier): Identifiers can't start with digits! Doh! + + * lex.l (Fiskeyword): New function. + * Makefile.in (INCLUDES): Don't forget base-list.h. * symtab.cc (symbol_record::define): If definition already exists,
--- a/src/defaults.cc +++ b/src/defaults.cc @@ -391,6 +391,19 @@ set_site_defaults_file (); } +DEFUN (rehash, , , + "-*- texinfo -*-\n\ +@deftypefn {Built-in Function} {} rehash ()\n\ +Reinitialize Octave's @code{LOADPATH} directory cache.\n\ +@end deftypefn") +{ + octave_value_list retval; + + Vload_path_dir_path.rehash (); + + return retval; +} + static int editor (void) { @@ -629,19 +642,6 @@ } -DEFUN (rehash, , , - "-*- texinfo -*-\n\ -@deftypefn {Built-in Function} {} rehash ()\n\ -Reinitialize Octave's @code{LOADPATH} directory cache.\n\ -@end deftypefn") -{ - octave_value_list retval; - - Vload_path_dir_path.rehash (); - - return retval; -} - /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/src/dirfns.cc +++ b/src/dirfns.cc @@ -638,6 +638,18 @@ return retval; } +void +symbols_of_dirfns (void) +{ + DEFCONST (filesep, file_ops::dir_sep_str, + "-*- texinfo -*-\n\ +@defvr {Built-in Variable} filesep\n\ +The character used to separate directory names. The value\n\ +of this variable is system dependent.\n\ +@end defvr"); + +} + /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/src/lex.l +++ b/src/lex.l @@ -54,6 +54,7 @@ // because it may not be protected to allow it to be included multiple // times. +#include "Cell.h" #include "comment-list.h" #include "defun.h" #include "error.h" @@ -2574,6 +2575,44 @@ quote_is_transpose = false; } +DEFCMD (iskeyword, args, , + "-*- texinfo -*-\n\ +@deftypefn {Built-in Function} {} iskeyword (@var{name})\n\ +Return true if @var{name} is an Octave keyword. If @var{name}\n\ +is omitted, return a list of keywords.\n\ +@end deftypefn") +{ + octave_value retval; + + int argc = args.length () + 1; + + string_vector argv = args.make_argv ("help"); + + if (error_state) + return retval; + + if (argc == 1) + { + string_vector lst (TOTAL_KEYWORDS); + + for (int i = 0; i < TOTAL_KEYWORDS; i++) + lst[i] = wordlist[i].name; + + retval = Cell (lst.qsort ()); + } + else if (argc == 2) + { + std::string s = argv[1]; + + retval = (octave_kw_lookup (s.c_str (), s.length ()) != 0); + } + else + print_usage ("iskeyword"); + + return retval; +} + + static void maybe_warn_separator_insert (char sep) {
--- a/src/utils.cc +++ b/src/utils.cc @@ -80,7 +80,7 @@ bool valid_identifier (const char *s) { - if (! s || ! (isalnum (*s) || *s == '_')) + if (! s || ! (isalpha (*s) || *s == '_')) return false; while (*++s != '\0') @@ -96,6 +96,28 @@ return valid_identifier (s.c_str ()); } +DEFCMD (isvarname, args, , + "@deftypefn {Built-in Function} {} isvarname (@var{name})\n\ +Return true if @var{name} is a valid variable name\n\ +@end deftypefn") +{ + octave_value retval; + + int argc = args.length () + 1; + + string_vector argv = args.make_argv ("help"); + + if (error_state) + return retval; + + if (argc == 2) + retval = valid_identifier (argv[1]); + else + print_usage ("isvarname"); + + return retval; +} + int almost_match (const std::string& std, const std::string& s, int min_match_len, int case_sens)