octave-maintainers
[Top][All Lists]
Advanced

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

Path search [ was Re: How to implement IPT strel.m ? ]


From: Josep Monés i Teixidor
Subject: Path search [ was Re: How to implement IPT strel.m ? ]
Date: Mon, 16 Aug 2004 20:19:34 +0200

Hi

Note: my insight on Octave code is below 0, so please just ignore if I
say something silly :)

On dc, 2004-08-04 at 09:40, David Bateman wrote:
> According to John W. Eaton <address@hidden> (on 08/03/04):
> > 
> > The @class directory hack is similar to the private function
> > subdirectory hack.  It will require some changes to the file lookup
> > code (in liboctave/pathsearch.cc).  Some time ago, I pared down the
> > kpathsearch code and converted it C++ (use C++ strings, new/delete,
> > etc.) in anticipation of having to modify it to handle these new
> > features that are specific to Octave.  Also, I never liked the fact
> > that there was no clean separation between the basic file lookup code
> > and the TeX-specific features of the kpathsearch code.  Now the code
> > for file lookup that is actually used in Octave is much smaller than
> > before.  It is only about 3200 lines long in the file kpse.cc and the
> > file in CVS has about 600 lines that are not currently used, so it
> > could be even smaller.  We should be able to adapt this code and the
> > symbol lookup code in Octave's symbol table to do the right thing when
> > looking for functions once we define the proper search order.
> 
> Exactly. Any ideas what the right search order is. Do private functions
> take precedence? What about those in a class? And what about structures
> like @class1/@class2 that Matlab permits? Do they make any sense without
> Simulink? Should we support them?


overloaded functions are also similar.

From matlab docs:
*Variable
*Subfunction
*Private function
*Class constructor
*Overloaded method
*M-file in the current directory
*M-file on the path, or MATLAB built-in function

So path search has to take in account:
 * First argument (to handle classes and overloaded functions)
 * Other arguments too (if I understand correctly inferiorto and
superiorto make necessary take into account other arguments)
 * Directory of current function being executed (which is cwd if running
from the cmd line)

Where should all this checks go?

1.- As arguments in a function in dir_path ? 
2.- Being handled inside load_fcn_from_file which would call find_all?
3.- Being handled inside load_fcn_from_file which would call
find_first_of using search strings like @datatype/hello.m ?

I like the last one, because dir_path don't gets to tied on this things
and it hasn't the overhead of the 2d one, but I haven't got much
knowledge about Octave internals. 

A problem with 3 is if we are inside a class directory, for instance...
how to match if we use relative paths? 

Regards,
-- 
Josep Monés i Teixidor
Clau GnuPG: gpg --recv-keys 80E85CC4

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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