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: Philip Nienhuis
Subject: Re: How to check for availability of functions in core octave
Date: Fri, 29 Jul 2011 23:44:26 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.11) Gecko/20100701 SeaMonkey/2.0.6

John W. Eaton wrote:
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?

Such a parameter would be a good option.

An alternative is excluding all paths in .../share/octave/packages/ ? (as that is where most of the shadowing I'm after comes from) and then re-running __list_functions__

Trying something along these lines:

pkg unload all
__list_functions__

reveals that __list_functions__ appears to read from cached info. All octave-forge functions are still listed.

Can __list_functions__'s base info be reinitialized? If so I would be almost there.

Philip




reply via email to

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