octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Changeset] Add symvar function


From: David Bateman
Subject: [Changeset] Add symvar function
Date: Mon, 05 May 2008 18:14:32 +0200
User-agent: Thunderbird 2.0.0.12 (X11/20080306)

Here's another low hanging fruit from the missing matlab core functions.
The Finline changes I sent are needed to make this work correctly for
the constants Inf, etc, as this function is just "argnames (inline (s))"
since that can do all the work rather than reimplementing the function
as a regexp.

D.

-- 
David Bateman                                address@hidden
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary

# HG changeset patch
# User David Bateman <address@hidden>
# Date 1210004052 -7200
# Node ID d3675d97ca9bb5e84d09a39b04b8df58940ced85
# Parent  68bd7a6cc3d305c7042eefc687c2d44c868fc3c8
Add symvar function

diff --git a/scripts/ChangeLog b/scripts/ChangeLog
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,8 @@ 2008-05-04  John W. Eaton  <address@hidden
+2008-05-05  David Bateman  <address@hidden>
+
+       * miscellaneous/symvar.m: New function.
+       * miscellaneous/Makefile.in (SOURCES): Add it to the list.
+
 2008-05-04  John W. Eaton  <address@hidden>
 
        * miscellaneous/dbstack.m: Delete.
diff --git a/scripts/miscellaneous/symvar.m b/scripts/miscellaneous/symvar.m
new file mode 100644
--- /dev/null
+++ b/scripts/miscellaneous/symvar.m
@@ -0,0 +1,30 @@
+## Copyright (C) 2008  David Bateman
+##
+## 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 3 of the License, 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, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn {Function File} {} symvar (@var{s})
+## Identifies the argument names in the function defined by a string.
+## Common constant names such as @code{pi}, @code{NaN}, @code{Inf},
+## @code{eps}, @code{i} or @code{j} are ignored. The arguments that are
+## found are returned in a cell array of strings. If no variables are
+## found then the returned cell array is empty.
+## @end deftypefn
+
+function args = symvar (s)
+  args = argnames (inline (s));
+endfunction

reply via email to

[Prev in Thread] Current Thread [Next in Thread]