diff src/symtab.cc @ 8819:96d87674b818

also stash directory name for subfunctions
author John W. Eaton <jwe@octave.org>
date Fri, 20 Feb 2009 01:00:25 -0500
parents 70f5a0375afd
children eb63fbe60fab
line wrap: on
line diff
--- a/src/symtab.cc	Thu Feb 19 16:26:27 2009 -0500
+++ b/src/symtab.cc	Fri Feb 20 01:00:25 2009 -0500
@@ -36,6 +36,7 @@
 #include "load-path.h"
 #include "symtab.h"
 #include "ov-fcn.h"
+#include "ov-usr-fcn.h"
 #include "pager.h"
 #include "parse.h"
 #include "pt-arg-list.h"
@@ -1078,6 +1079,34 @@
     }
 }
 
+void
+symbol_table::stash_dir_name_for_subfunctions (scope_id scope,
+					       const std::string& dir_name)
+{
+  // FIXME -- is this the best way to do this?  Maybe it would be
+  // better if we had a map from scope to list of subfunctions
+  // stored with the function.  Do we?
+
+  for (fcn_table_const_iterator p = fcn_table.begin ();
+       p != fcn_table.end (); p++)
+    {
+      std::pair<std::string, octave_value> tmp
+	= p->second.subfunction_defined_in_scope (scope);
+
+      std::string nm = tmp.first;
+
+      if (! nm.empty ())
+	{
+	  octave_value& fcn = tmp.second;
+
+	  octave_user_function *f = fcn.user_function_value ();
+
+	  if (f)
+	    f->stash_dir_name (dir_name);
+	}
+    }
+}
+
 octave_value
 symbol_table::do_find (const std::string& name, tree_argument_list *args,
 		       const string_vector& arg_names,