octave-maintainers
[Top][All Lists]
Advanced

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

Re: recent changes to help functions


From: John W. Eaton
Subject: Re: recent changes to help functions
Date: Mon, 26 Jan 2009 22:36:12 -0500

On 25-Jan-2009, Ben Abbott wrote:

| Regarding exist ("@polynomial/set"), the commercial implementation  
| gives me the result below
| 
|  >> mkdir @polynomial
|  >> cd @polynomial/
|  >> !echo '% empty help string' > set.m
|  >> cd ..
|  >> exist('@polynomial/set')
| ans = 2

I think the following change will fix this problem.

Thanks,

jwe

# HG changeset patch
# User John W. Eaton <address@hidden>
# Date 1233027320 18000
# Node ID 4e39b00218d305b6ecbb18703b696430095c1f78
# Parent  dacfd030633a4b6359c93418159fa80f8d381da2
load-path.cc (load_path::do_find_fcn): handle @foo/bar

diff --git a/src/ChangeLog b/src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2009-01-26  John W. Eaton  <address@hidden>
+
+       * load-path.cc (load_path::do_find_fcn): Handle @foo/bar.
+
 2009-01-24  Jaroslav Hajek  <address@hidden>
 
        * pt-cell.cc (tree_cell::rvalue): Optimize the single row case.
diff --git a/src/load-path.cc b/src/load-path.cc
--- a/src/load-path.cc
+++ b/src/load-path.cc
@@ -903,30 +903,47 @@
   
   //  update ();
 
-  dir_name = std::string ();
+  if (fcn.length () > 0 && fcn[0] == '@')
+    {
+      size_t pos = fcn.find ('/');
 
-  const_fcn_map_iterator p = fcn_map.find (fcn);
+      if (pos != std::string::npos)
+       {
+         std::string class_name = fcn.substr (1, pos-1);
+         std::string meth = fcn.substr (pos+1);
 
-  if (p != fcn_map.end ())
+         retval = do_find_method (class_name, meth, dir_name);
+       }
+      else
+       retval = std::string ();
+    }
+  else
     {
-      const file_info_list_type& file_info_list = p->second;
+      dir_name = std::string ();
 
-      for (const_file_info_list_iterator i = file_info_list.begin ();
-          i != file_info_list.end ();
-          i++)
+      const_fcn_map_iterator p = fcn_map.find (fcn);
+
+      if (p != fcn_map.end ())
        {
-         const file_info& fi = *i;
+         const file_info_list_type& file_info_list = p->second;
 
-         retval = file_ops::concat (fi.dir_name, fcn);
+         for (const_file_info_list_iterator i = file_info_list.begin ();
+              i != file_info_list.end ();
+              i++)
+           {
+             const file_info& fi = *i;
 
-         if (check_file_type (retval, type, fi.types,
-                              fcn, "load_path::do_find_fcn"))
-           {
-             dir_name = fi.dir_name;
-             break;
+             retval = file_ops::concat (fi.dir_name, fcn);
+
+             if (check_file_type (retval, type, fi.types,
+                                  fcn, "load_path::do_find_fcn"))
+               {
+                 dir_name = fi.dir_name;
+                 break;
+               }
+             else
+               retval = std::string ();
            }
-         else
-           retval = std::string ();
        }
     }
 

reply via email to

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