changeset 24279:a26a8714db26

delete filemarker function and corresponding internal variable This variable stored the character used to separate function, subfunction, and nested function names. I see no reason to keep it. The name 'filemarker' does not clearly indicate what this variable is about. Changing the value from the default '>' would likely create a great deal of confusion, so I doubt that it was ever set to anything different. We don't have a similar way to change the '@' or '+' characters used to prefix class or package names. So rather than deprecate, I'm simply removing it. * input.h, input.cc (Vfilemarker, Ffilemarker): Delete internal variable and function. Change all uses of Vfilemarker to be '>' instead.
author John W. Eaton <jwe@octave.org>
date Sun, 19 Nov 2017 09:51:19 -0500
parents 508d27e82ad1
children a01c210e4287
files libinterp/corefcn/call-stack.cc libinterp/corefcn/debug.cc libinterp/corefcn/input.cc libinterp/corefcn/input.h libinterp/corefcn/symtab.cc libinterp/corefcn/utils.cc libinterp/parse-tree/bp-table.cc
diffstat 7 files changed, 7 insertions(+), 65 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/call-stack.cc	Sun Nov 19 10:31:14 2017 +0100
+++ b/libinterp/corefcn/call-stack.cc	Sun Nov 19 09:51:19 2017 -0500
@@ -25,7 +25,6 @@
 #endif
 
 #include "call-stack.h"
-#include "input.h"
 #include "interpreter.h"
 #include "oct-map.h"
 #include "ov.h"
@@ -58,7 +57,7 @@
         std::string parent_fcn_name = m_fcn->parent_fcn_name ();
 
         if (print_subfn && ! parent_fcn_name.empty ())
-          retval = parent_fcn_name + Vfilemarker;
+          retval = parent_fcn_name + '>';
 
         if (m_fcn->is_anonymous_function ())
           retval += octave_fcn_handle::anonymous;
--- a/libinterp/corefcn/debug.cc	Sun Nov 19 10:31:14 2017 +0100
+++ b/libinterp/corefcn/debug.cc	Sun Nov 19 09:51:19 2017 -0500
@@ -467,7 +467,7 @@
       for (const auto& fnm_bp_p : bp_list)
         {
           std::string filename = fnm_bp_p.first;
-          const char *sub_fun = strchr (filename.c_str (), Vfilemarker);
+          const char *sub_fun = strchr (filename.c_str (), '>');
           if (sub_fun)
             filename = filename.substr(0, sub_fun - filename.c_str ());
           octave_value path_name;
--- a/libinterp/corefcn/input.cc	Sun Nov 19 10:31:14 2017 +0100
+++ b/libinterp/corefcn/input.cc	Sun Nov 19 09:51:19 2017 -0500
@@ -109,9 +109,6 @@
 // TRUE if we are running in the Emacs GUD mode.
 static bool Vgud_mode = false;
 
-// The filemarker used to separate filenames from subfunction names
-char Vfilemarker = '>';
-
 static hook_function_list input_event_hook_functions;
 
 // For octave_quit.
@@ -1326,52 +1323,3 @@
 
   return retval;
 }
-
-DEFUN (filemarker, args, nargout,
-       doc: /* -*- texinfo -*-
-@deftypefn  {} {@var{val} =} filemarker ()
-@deftypefnx {} {@var{old_val} =} filemarker (@var{new_val})
-@deftypefnx {} {} filemarker (@var{new_val}, "local")
-Query or set the character used to separate the filename from the
-subfunction names contained within the file.
-
-By default this is the character @samp{>}.
-This can be used in a generic manner to interact with subfunctions.
-For example,
-
-@example
-help (["myfunc", filemarker, "mysubfunc"])
-@end example
-
-@noindent
-returns the help string associated with the subfunction @code{mysubfunc}
-located in the file @file{myfunc.m}.
-
-@code{filemarker} is also useful during debugging for placing breakpoints
-within subfunctions or nested functions.
-For example,
-
-@example
-dbstop (["myfunc", filemarker, "mysubfunc"])
-@end example
-
-@noindent
-will set a breakpoint at the first line of the subfunction @code{mysubfunc}.
-
-When called from inside a function with the @qcode{"local"} option, the
-variable is changed locally for the function and any subroutines it calls.
-The original variable value is restored when exiting the function.
-@end deftypefn */)
-{
-  char tmp = Vfilemarker;
-  octave_value retval = SET_INTERNAL_VARIABLE (filemarker);
-
-  // The character passed must not be a legal character for a function name
-  if (::isalnum (Vfilemarker) || Vfilemarker == '_')
-    {
-      Vfilemarker = tmp;
-      error ("filemarker: character can not be a valid character for a function name");
-    }
-
-  return retval;
-}
--- a/libinterp/corefcn/input.h	Sun Nov 19 10:31:14 2017 +0100
+++ b/libinterp/corefcn/input.h	Sun Nov 19 09:51:19 2017 -0500
@@ -70,8 +70,6 @@
 
 extern void set_default_prompts (void);
 
-extern char Vfilemarker;
-
 extern octave::sys::time Vlast_prompt_time;
 
 namespace octave
--- a/libinterp/corefcn/symtab.cc	Sun Nov 19 10:31:14 2017 +0100
+++ b/libinterp/corefcn/symtab.cc	Sun Nov 19 09:51:19 2017 -0500
@@ -36,7 +36,6 @@
 #include "defun.h"
 #include "dirfns.h"
 #include "fcn-info.h"
-#include "input.h"
 #include "interpreter-private.h"
 #include "interpreter.h"
 #include "load-path.h"
@@ -436,7 +435,7 @@
       }
     else
       {
-        size_t pos = name.find_first_of (Vfilemarker);
+        size_t pos = name.find_first_of ('>');
 
         if (pos == std::string::npos)
           retval = find (name, args, true, local_funcs);
@@ -477,7 +476,7 @@
 
     std::string full_name = '@' + dispatch_type +
       sys::file_ops::dir_sep_str () + name;
-    size_t pos = full_name.find_first_of (Vfilemarker);
+    size_t pos = full_name.find_first_of ('>');
 
     if (pos != std::string::npos)
       {
--- a/libinterp/corefcn/utils.cc	Sun Nov 19 10:31:14 2017 +0100
+++ b/libinterp/corefcn/utils.cc	Sun Nov 19 09:51:19 2017 -0500
@@ -53,7 +53,6 @@
 #include "dirfns.h"
 #include "error.h"
 #include "errwarn.h"
-#include "input.h"
 #include "interpreter-private.h"
 #include "interpreter.h"
 #include "lex.h"
@@ -502,7 +501,7 @@
       else
         {
           std::string fname = name;
-          size_t pos = name.find_first_of (Vfilemarker);
+          size_t pos = name.find_first_of ('>');
           if (pos != std::string::npos)
             fname = name.substr (0, pos);
 
--- a/libinterp/parse-tree/bp-table.cc	Sun Nov 19 10:31:14 2017 +0100
+++ b/libinterp/parse-tree/bp-table.cc	Sun Nov 19 09:51:19 2017 -0500
@@ -42,7 +42,6 @@
 #include "defun-int.h"
 #include "call-stack.h"
 #include "error.h"
-#include "input.h"
 #include "interpreter-private.h"
 #include "oct-map.h"
 #include "octave-link.h"
@@ -257,7 +256,7 @@
               // Normalize to store only the file name.
               // Otherwise, there can be an entry for both file>subfunction and
               // file, which causes a crash on dbclear all
-              const char *s = strchr (fname.c_str (), Vfilemarker);
+              const char *s = strchr (fname.c_str (), '>');
               if (s)
                 bp_set.insert (fname.substr (0, s - fname.c_str ()));
               else
@@ -870,7 +869,7 @@
                             = cmds->breakpoints_and_conds ();
 
                           if (! bkpts.empty ())
-                            retval[bp_fname + Vfilemarker + ff->name ()] = bkpts;
+                            retval[bp_fname + '>' + ff->name ()] = bkpts;
                         }
                     }
                 }