[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Changeset] make symbol_table:; find_function also find class specific f
From: |
John W. Eaton |
Subject: |
[Changeset] make symbol_table:; find_function also find class specific functions |
Date: |
Mon, 29 Sep 2008 18:17:18 -0400 |
On 28-Sep-2008, David Bateman wrote:
| Matlab allows thing like
|
| help @myclass/myfunc
| type @myclass/myfunc
| dbstop @myclas/myfunc
|
| to work and give the help, text and set the breakpoints in the class
| specific version of a function. The obvious change to allow this is tho
| change the symbol_table::find_function methods such that if the first
| character of the function name being looked for is "@" then it is
| assumed to be a class specific method that is requested and return that
| regardless of the arguments passed to the function.
|
| This works for the help, type etc command and sets the breakpoints
| correctly, as dbstatus returns the positions of the newly set
| breakpoints. However the code doesn't break correctly yet in the class
| specific method, and I'm not sure why. Any ideas?
I applied the changeset.
Setting breakpoints in class methods worked for me, but not class
constructors. I think the following change should fix that problem.
Thanks,
jwe
# HG changeset patch
# User John W. Eaton <address@hidden>
# Date 1222726617 14400
# Node ID 293c4b5fe33d6c442cefb066e632e635f43e5b35
# Parent 64f1cd525656e12fbb82b239f5673006119096d5
symtab.cc (symbol_table::fcn_info::fcn_info_rep::load_class_method): Call
load_class_constructor if name and dispatch_type are the same.
diff --git a/src/ChangeLog b/src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2008-09-29 John W. Eaton <address@hidden>
+
+ * symtab.cc (symbol_table::fcn_info::fcn_info_rep::load_class_method):
+ Call load_class_constructor if name and dispatch_type are the same.
+
2008-09-29 David Bateman <address@hidden>
* symtab.cc (octave_value symbol_table::find_function
diff --git a/src/symtab.cc b/src/symtab.cc
--- a/src/symtab.cc
+++ b/src/symtab.cc
@@ -339,20 +339,26 @@
{
octave_value retval;
- std::string dir_name;
+ if (name == dispatch_type)
+ retval = load_class_constructor ();
+ else
+ {
+ std::string dir_name;
- std::string file_name = load_path::find_method (dispatch_type, name,
dir_name);
+ std::string file_name = load_path::find_method (dispatch_type, name,
+ dir_name);
- if (! file_name.empty ())
- {
- octave_function *fcn = load_fcn_from_file (file_name, dir_name,
- dispatch_type);
+ if (! file_name.empty ())
+ {
+ octave_function *fcn = load_fcn_from_file (file_name, dir_name,
+ dispatch_type);
- if (fcn)
- {
- retval = octave_value (fcn);
+ if (fcn)
+ {
+ retval = octave_value (fcn);
- class_methods[dispatch_type] = retval;
+ class_methods[dispatch_type] = retval;
+ }
}
}