octave-maintainers
[Top][All Lists]
Advanced

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

Re: "whos -all" and "who -all" fail


From: John W. Eaton
Subject: Re: "whos -all" and "who -all" fail
Date: Mon, 05 May 2008 13:22:47 -0400

On  5-May-2008, John W. Eaton wrote:

| Now subfunctions are stored in the symbol table
| corresponding to the parent function, using just the name of the
| subfunction (i.e., there is an entry for "testf2" in the subfunctions
| map in the symbol table for "testf1").

Oops, I answered too quickly and got a (fairly major) detail wrong
here.  The subfunctions are stored using their simple name, but the
map is not separate for each scope.  Instead, there is a static map in
the symbol_table object for function names:

  static std::map<std::string, fcn_info> fcn_table;

This maps names to fcn_info objects.  The fcn_info object contains the
following:

      std::string name;

      // Scope id to function object.
      std::map<scope_id, octave_value> subfunctions;

      // Directory name to function object.
      std::map<std::string, octave_value> private_functions;

      // Class name to function object.
      std::map<std::string, octave_value> class_constructors;

      // Dispatch type to function object.
      std::map<std::string, octave_value> class_methods;

      // Legacy dispatch map (dispatch type name to function name).
      dispatch_map_type dispatch_map;

      octave_value cmdline_function;

      octave_value autoload_function;

      octave_value function_on_path;

      octave_value built_in_function;

This allows more than one function with the same name to be installed.
Then the fcn_info::find method may be used to find the correct one
given dispatch info and scope information.  It only looks in the
current scope for subfunctions (that's all that is needed by the
evaluator, I think) so to look in another scope you would need to
temporarily set the scope to some other value (that is already done
when in debugging mode).  If you want to set a breakoint in a
particular subfunction given a name like "f1:f2" then we should
probably define a find_subfunction method that takes a scope_id as an
argument.  Then you would find the scope id corresponding to f1 and
then look for the subfunction f2 using that scope id.

jwe


reply via email to

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