changeset 24729:22e60ef42640

deprecate some function installing functions * defun-int.h (install_builtin_function, alias_builtin, install_builtin_dispatch): Deprecate. * __init_qt__.h, __init_qt__.cc (install___init_qt___functions): New argument, symtab. Call symtab::install_built_in_function instead of deprecated install_builtin_function. Change all uses.
author John W. Eaton <jwe@octave.org>
date Sat, 10 Feb 2018 18:21:46 -0500
parents af11cc7cd336
children 05c9f42512cb
files libgui/graphics/__init_qt__.cc libgui/graphics/__init_qt__.h libgui/src/main-window.cc libinterp/corefcn/defun-int.h libinterp/corefcn/symtab.h
diffstat 5 files changed, 42 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/graphics/__init_qt__.cc	Sat Feb 10 16:06:16 2018 -0500
+++ b/libgui/graphics/__init_qt__.cc	Sat Feb 10 18:21:46 2018 -0500
@@ -31,10 +31,11 @@
 #include <QPalette>
 #include <QRegExp>
 
+#include "defun.h"
 #include "graphics.h"
 #include "gtk-manager.h"
 #include "interpreter.h"
-#include "defun.h"
+#include "symtab.h"
 
 #include "Backend.h"
 #include "QtHandlesUtils.h"
@@ -141,13 +142,17 @@
 }
 
 void
-install___init_qt___functions (void)
+install___init_qt___functions (octave::symbol_table& symtab)
 {
-  install_builtin_function (F__init_qt__, "__init_qt__",
-                            "__init_qt__.cc", "");
+  symtab.install_built_in_function
+    ("__init_qt__", octave_value (new octave_builtin
+                                  (F__init_qt__, "__init_qt__",
+                                   "__init_qt__.cc", "")));
 
-  install_builtin_function (F__shutdown_qt__, "__shutdown_qt__",
-                            "__init_qt__.cc", "");
+  symtab.install_built_in_function
+    ("__shutdown_qt__", octave_value (new octave_builtin
+                                      (F__shutdown_qt__, "__shutdown_qt__",
+                                       "__init_qt__.cc", "")));
 }
 
 #if 0
--- a/libgui/graphics/__init_qt__.h	Sat Feb 10 16:06:16 2018 -0500
+++ b/libgui/graphics/__init_qt__.h	Sat Feb 10 18:21:46 2018 -0500
@@ -30,6 +30,11 @@
 
 }
 
-extern void install___init_qt___functions (void);
+namespace octave
+{
+  class symbol_table;
+}
+
+extern void install___init_qt___functions (octave::symbol_table&);
 
 #endif
--- a/libgui/src/main-window.cc	Sat Feb 10 16:06:16 2018 -0500
+++ b/libgui/src/main-window.cc	Sat Feb 10 18:21:46 2018 -0500
@@ -119,7 +119,9 @@
             // The qt graphics toolkit must be initialized before startup
             // files are executed.
 
-            install___init_qt___functions ();
+            symbol_table& symtab = interp.get_symbol_table ();
+
+            install___init_qt___functions (symtab);
 
             Fregister_graphics_toolkit (interp, ovl ("qt"));
 #endif
--- a/libinterp/corefcn/defun-int.h	Sat Feb 10 16:06:16 2018 -0500
+++ b/libinterp/corefcn/defun-int.h	Sat Feb 10 18:21:46 2018 -0500
@@ -45,16 +45,6 @@
                                          const std::string& fcn);
 
 extern OCTINTERP_API void
-install_builtin_function (octave_builtin::fcn f, const std::string& name,
-                          const std::string& file, const std::string& doc,
-                          bool can_hide_function = true);
-
-extern OCTINTERP_API void
-install_builtin_function (octave_builtin::meth m, const std::string& name,
-                          const std::string& file, const std::string& doc,
-                          bool can_hide_function = true);
-
-extern OCTINTERP_API void
 install_dld_function (octave_dld_function::fcn f, const std::string& name,
                       const octave::dynamic_library& shl, const std::string& doc,
                       bool relative = false);
@@ -67,13 +57,6 @@
 extern OCTINTERP_API void
 install_mex_function (void *fptr, bool fmex, const std::string& name,
                       const octave::dynamic_library& shl, bool relative = false);
-
-extern OCTINTERP_API void
-alias_builtin (const std::string& alias, const std::string& name);
-
-extern OCTINTERP_API void
-install_builtin_dispatch (const std::string& name, const std::string& klass);
-
 // Gets the shlib of the currently executing DLD function, if any.
 extern OCTINTERP_API octave::dynamic_library
 get_current_shlib (void);
@@ -110,6 +93,26 @@
 extern OCTINTERP_API void
 defun_isargout (int, int, bool *);
 
+OCTAVE_DEPRECATED (4.4, "use 'octave::symbol_table::install_built_in_function' instead")
+extern OCTINTERP_API void
+install_builtin_function (octave_builtin::fcn f, const std::string& name,
+                          const std::string& file, const std::string& doc,
+                          bool can_hide_function = true);
+
+OCTAVE_DEPRECATED (4.4, "use 'octave::symbol_table::install_built_in_function' instead")
+extern OCTINTERP_API void
+install_builtin_function (octave_builtin::meth m, const std::string& name,
+                          const std::string& file, const std::string& doc,
+                          bool can_hide_function = true);
+
+OCTAVE_DEPRECATED (4.4, "use 'octave::symbol_table::alias_built_in_function' instead")
+extern OCTINTERP_API void
+alias_builtin (const std::string& alias, const std::string& name);
+
+OCTAVE_DEPRECATED (4.4, "use 'octave::symbol_table::install_built_in_dispatch' instead")
+extern OCTINTERP_API void
+install_builtin_dispatch (const std::string& name, const std::string& klass);
+
 #endif
 
 #define FORWARD_DECLARE_FUNX(name)              \
--- a/libinterp/corefcn/symtab.h	Sat Feb 10 16:06:16 2018 -0500
+++ b/libinterp/corefcn/symtab.h	Sat Feb 10 18:21:46 2018 -0500
@@ -342,6 +342,8 @@
         }
     }
 
+    // FIXME: should we ensure that FCN really is a built-in function
+    // object?
     void install_built_in_function (const std::string& name,
                                     const octave_value& fcn)
     {