Mercurial > hg > octave-avbm
changeset 3875:09323fcea5ab
[project @ 2002-03-06 17:59:40 by jwe]
author | jwe |
---|---|
date | Wed, 06 Mar 2002 17:59:40 +0000 |
parents | 24bf1bcbba8a |
children | a134e5cfdc01 |
files | src/Makefile.in src/ov-usr-fcn.cc src/ov-usr-fcn.h |
diffstat | 3 files changed, 24 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/Makefile.in +++ b/src/Makefile.in @@ -90,7 +90,7 @@ TI_XSRC := Array-oc.cc Array-os.cc Array-sym.cc Array-tc.cc Map-fnc.cc \ Map-tc.cc SLList-expr.cc SLList-misc.cc SLList-plot.cc \ - SLList-tc.cc SLList-tm.cc SLStack-i.cc SLStack-pc.cc \ + SLList-tc.cc SLList-tm.cc SLStack-i.cc SLStack-ovl.cc SLStack-pc.cc \ SLStack-str.cc SLStack-sym.cc SLStack-tok.cc \ SLStack-ue.cc SLStack-ui.cc
--- a/src/ov-usr-fcn.cc +++ b/src/ov-usr-fcn.cc @@ -241,12 +241,12 @@ } static void -clear_args_passed (void *fcn) +restore_args_passed (void *fcn) { octave_user_function *tmp = static_cast<octave_user_function *> (fcn); if (tmp) - tmp->clear_args_passed (); + tmp->restore_args_passed (); } static void @@ -323,16 +323,11 @@ unwind_protect_ptr (curr_function); curr_function = this; - // XXX FIXME XXX -- ??? - // unwind_protect_ptr (args_passed); - - args_passed = args; + // Save and restore args passed for recursive calls. - // Force cache of arguments to be undefined when this function exits. - // Doing so decrements the reference counts on the values of local - // variables that are also named function parameters. + save_args_passed (args); - unwind_protect::add (::clear_args_passed, this); + unwind_protect::add (::restore_args_passed, this); string_vector arg_names = args.name_tags ();
--- a/src/ov-usr-fcn.h +++ b/src/ov-usr-fcn.h @@ -36,6 +36,8 @@ #include "ov-fcn.h" #include "ov-typeinfo.h" +#include "SLStack.h" + class string_vector; class octave_value; @@ -115,8 +117,19 @@ std::string function_name (void) { return fcn_name; } - void clear_args_passed (void) - { args_passed = octave_value_list (); } + void save_args_passed (const octave_value_list& args) + { + if (call_depth > 1) + saved_args.push (args_passed); + + args_passed = args; + } + + void restore_args_passed (void) + { + if (! saved_args.empty ()) + args_passed = saved_args.pop (); + } octave_value_list do_multi_index_op (int nargout, const octave_value_list& args); @@ -187,6 +200,9 @@ // The values that were passed as arguments. octave_value_list args_passed; + // A place to store the passed args for recursive calls. + SLStack<octave_value_list> saved_args; + // The number of arguments passed in. int num_args_passed;