~ubuntu-branches/ubuntu/oneiric/octave-missing-functions/oneiric

« back to all changes in this revision

Viewing changes to inst/__functionstatus__.m

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere
  • Date: 2008-05-21 09:08:52 UTC
  • Revision ID: james.westby@ubuntu.com-20080521090852-kmab4xonk38otmr1
Tags: upstream-1.0.0
ImportĀ upstreamĀ versionĀ 1.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
## Copyright (C) 2008 Bill Denney
 
2
##
 
3
## This software is free software; you can redistribute it and/or modify it
 
4
## under the terms of the GNU General Public License as published by
 
5
## the Free Software Foundation; either version 3 of the License, or (at
 
6
## your option) any later version.
 
7
##
 
8
## This software is distributed in the hope that it will be useful, but
 
9
## WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
11
## General Public License for more details.
 
12
##
 
13
## You should have received a copy of the GNU General Public License
 
14
## along with this software; see the file COPYING.  If not, see
 
15
## <http://www.gnu.org/licenses/>.
 
16
 
 
17
## -*- texinfo -*-
 
18
## @deftypefn {Function File} {@var{status} =} __functionstatus__ (@var{funname})
 
19
## Return if a function is present in octave: -1 = not checked, 0 =
 
20
## missing, 1 = present
 
21
## @end deftypefn
 
22
 
 
23
function status = __functionstatus__ (funname)
 
24
 
 
25
  if ischar (funname)
 
26
    funname = {funname};
 
27
  elseif ~ iscellstr (funname)
 
28
    print_usage ();
 
29
  endif
 
30
 
 
31
  status = zeros (size (funname));
 
32
  for i = 1:numel (funname)
 
33
    if any (! (isalpha (funname{i}) | isdigit (funname{i})))
 
34
      ## not checked
 
35
      status(i) = -1;
 
36
    elseif iskeyword (funname{i}) || which (funname{i})
 
37
      ## present
 
38
      status(i) = 1;
 
39
    else
 
40
      ## missing
 
41
      status(i) = 0;
 
42
    endif
 
43
  endfor
 
44
 
 
45
endfunction