octave-maintainers
[Top][All Lists]
Advanced

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

Re: How to check for availability of functions in core octave


From: John W. Eaton
Subject: Re: How to check for availability of functions in core octave
Date: Fri, 29 Jul 2011 16:53:32 -0400

On 29-Jul-2011, PhilipNienhuis wrote:

| Almost, Ben, a good first try, thanks.
| 
| But... your example also picks up functions in octave-forge:
| 
| octave.exe:4> isimplemented = @(fun) exist (strcat(fun,".m")) == 2 || exist
| (fun) > 2
| isimplemented =
| 
| @(fun) exist (strcat (fun, ".m")) == 2 || exist (fun) > 2
| 
| octave.exe:5> isimplemented ("residue")
| ans =  1
| octave.exe:6> isimplemented ("xls2oct")
| ans =  1
| 
| (xls2oct.m is in the OF io package)
| 
| Even worse, it picks up OF functions shadowing core functions:
| 
| GNU Octave, version 3.4.2
| Copyright (C) 2011 John W. Eaton and others.
| This is free software; see the source code for copying conditions.
| There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
| FITNESS FOR A PARTICULAR PURPOSE.  For details, type `warranty'.
| <snip>
| warning: function
| C:\Programs\Octave\3.4.2\share\octave\packages\specfun-1.0.9\erfcx.m sha
| dows a built-in function
| :
| <further down>
| :
| octave.exe:7> isimplemented ("erfcx")
| ans =  1
| octave.exe:8>
| 
| 
| My question is really aimed at detecting stuff in core Octave, regardless of
| whether it is shadowed or not (yes an extra requirement coming out of the
| blue, now that there's something I could try).

The shadow warning comes from a function in load-path.cc, when the
contents of a directory are being added to the internal map that
allows for function lookups.

You could use the results of __builtins__, __keywords__, and
__list_functions__, but you would need to be sure that the load path
contains only the default set of directories.  Maybe
__list_functions__ could be modified to accept a parameter telling it
to list only the "system" functions?

jwe


reply via email to

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