changeset 21434:1da428cbf401

deprecate octave_config_info * toplev.cc (F__octave_config_info__): Rename from Foctave_config_info. Change all uses. * doc/interpreter/system.texi: Remove entry for octave_config_info. * scripts/deprecated/octave_config_info.m: New file. * scripts/deprecated/module.mk (scripts_deprecated_FCN_FILES): Add it to the list.
author John W. Eaton <jwe@octave.org>
date Thu, 10 Mar 2016 19:00:37 -0500
parents c5f319d0b7f5
children 10c32f940636
files NEWS doc/interpreter/system.txi doc/interpreter/testfun.txi examples/code/mex_demo.c examples/code/oct_demo.cc libinterp/corefcn/ls-mat5.cc libinterp/corefcn/toplev.cc libinterp/octave-value/ov-fcn-handle.cc scripts/deprecated/dump_prefs.m scripts/deprecated/module.mk scripts/deprecated/octave_config_info.m scripts/help/doc.m scripts/miscellaneous/computer.m scripts/miscellaneous/ismac.m scripts/miscellaneous/ispc.m scripts/miscellaneous/isunix.m scripts/miscellaneous/mkoctfile.m scripts/miscellaneous/private/display_info_file.m scripts/miscellaneous/ver.m scripts/path/pathdef.m scripts/pkg/pkg.m scripts/pkg/private/configure_make.m scripts/pkg/private/default_prefix.m scripts/pkg/private/getarch.m scripts/startup/version-rcfile scripts/testfun/__have_feature__.m scripts/testfun/__run_test_suite__.m test/system.tst
diffstat 28 files changed, 134 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Thu Mar 10 16:29:38 2016 -0500
+++ b/NEWS	Thu Mar 10 19:00:37 2016 -0500
@@ -92,6 +92,7 @@
       bitmax               | flintmax
       mahalanobis          | mahal in Octave-Forge statistics pkg
       md5sum               | hash
+      octve_config_info    | __octave_config_info__
       sleep                | pause
       usleep               | pause
       wavread              | audioread
--- a/doc/interpreter/system.txi	Thu Mar 10 16:29:38 2016 -0500
+++ b/doc/interpreter/system.txi	Thu Mar 10 19:00:37 2016 -0500
@@ -530,8 +530,6 @@
 
 @DOCSTRING(license)
 
-@DOCSTRING(octave_config_info)
-
 @DOCSTRING(getrusage)
 
 @node Hashing Functions
--- a/doc/interpreter/testfun.txi	Thu Mar 10 16:29:38 2016 -0500
+++ b/doc/interpreter/testfun.txi	Thu Mar 10 19:00:37 2016 -0500
@@ -141,7 +141,7 @@
 @end example
 
 @noindent
-Review @file{config.h} or @code{octave_config_info ("build_features")}
+Review @file{config.h} or @code{__octave_config_info__ ("build_features")}
 to see some of the possible values to check.
 
 Sometimes during development there is a test that should work but is
--- a/examples/code/mex_demo.c	Thu Mar 10 16:29:38 2016 -0500
+++ b/examples/code/mex_demo.c	Thu Mar 10 19:00:37 2016 -0500
@@ -3,7 +3,7 @@
 // To use this file, your version of Octave must support dynamic
 // linking.  To find out if it does, type the command
 //
-//   octave_config_info ("ENABLE_DYNAMIC_LINKING")
+//   __octave_config_info__ ("ENABLE_DYNAMIC_LINKING")
 //
 // at the Octave prompt.  Support for dynamic linking is included if
 // this expression is true.
--- a/examples/code/oct_demo.cc	Thu Mar 10 16:29:38 2016 -0500
+++ b/examples/code/oct_demo.cc	Thu Mar 10 19:00:37 2016 -0500
@@ -3,7 +3,7 @@
 // To use this file, your version of Octave must support dynamic
 // linking.  To find out if it does, type the command
 //
-//   octave_config_info ("ENABLE_DYNAMIC_LINKING")
+//   __octave_config_info__ ("ENABLE_DYNAMIC_LINKING")
 //
 // at the Octave prompt.  Support for dynamic linking is included if
 // this expression is true.
--- a/libinterp/corefcn/ls-mat5.cc	Thu Mar 10 16:29:38 2016 -0500
+++ b/libinterp/corefcn/ls-mat5.cc	Thu Mar 10 19:00:37 2016 -0500
@@ -866,7 +866,7 @@
                     && OCTAVE_EXEC_PREFIX != mroot)
                   {
                     // If fpath starts with matlabroot, and matlabroot
-                    // doesn't equal octave_config_info ("exec_prefix")
+                    // doesn't equal __octave_config_info__ ("exec_prefix")
                     // then the function points to a version of Octave
                     // or Matlab other than the running version. In that
                     // case we replace with the same function in the
--- a/libinterp/corefcn/toplev.cc	Thu Mar 10 16:29:38 2016 -0500
+++ b/libinterp/corefcn/toplev.cc	Thu Mar 10 19:00:37 2016 -0500
@@ -1340,10 +1340,10 @@
   return octave_value ();
 }
 
-DEFUN (octave_config_info, args, ,
+DEFUN (__octave_config_info__, args, ,
        "-*- texinfo -*-\n\
-@deftypefn  {} {} octave_config_info ()\n\
-@deftypefnx {} {} octave_config_info (@var{option})\n\
+@deftypefn  {} {} __octave_config_info__ ()\n\
+@deftypefnx {} {} __octave_config_info__ (@var{option})\n\
 Return a structure containing configuration and installation information for\n\
 Octave.\n\
 \n\
@@ -1686,7 +1686,7 @@
 
   if (nargin == 1)
     {
-      std::string arg = args(0).xstring_value ("octave_config_info: OPTION argument must be a string");
+      std::string arg = args(0).xstring_value ("__octave_config_info__: OPTION argument must be a string");
 
       octave_value info = find_config_info (config, arg);
 
@@ -1697,7 +1697,7 @@
         info = find_config_info (build_features, arg);
 
       if (info.is_undefined ())
-        error ("octave_config_info: no info for '%s'", arg.c_str ());
+        error ("__octave_config_info__: no info for '%s'", arg.c_str ());
 
       return info;
     }
@@ -1708,13 +1708,13 @@
 }
 
 /*
-%!assert (ischar (octave_config_info ("version")))
+%!assert (ischar (__octave_config_info__ ("version")))
 %!test
-%! x = octave_config_info ();
+%! x = __octave_config_info__ ();
 %! assert (isstruct (x));
 %! assert (! isempty (x));
 
-%!error octave_config_info (1, 2)
+%!error __octave_config_info__ (1, 2)
 */
 
 #if defined (__GNUG__) && defined (DEBUG_NEW_DELETE)
--- a/libinterp/octave-value/ov-fcn-handle.cc	Thu Mar 10 16:29:38 2016 -0500
+++ b/libinterp/octave-value/ov-fcn-handle.cc	Thu Mar 10 19:00:37 2016 -0500
@@ -1285,8 +1285,8 @@
 %! hdld2 = hdld;
 %! hbi2 = hbi;
 %! modes = {"-text", "-binary"};
-%! if (isfield (octave_config_info, "HAVE_HDF5")
-%!     && octave_config_info ("HAVE_HDF5"))
+%! if (isfield (__octave_config_info__, "HAVE_HDF5")
+%!     && __octave_config_info__ ("HAVE_HDF5"))
 %!   modes(end+1) = "-hdf5";
 %! endif
 %! for i = 1:numel (modes)
@@ -1338,8 +1338,8 @@
 %! hdld2 = hdld;
 %! hbi2 = hbi;
 %! modes = {"-text", "-binary"};
-%! if (isfield (octave_config_info, "HAVE_HDF5")
-%!     && octave_config_info ("HAVE_HDF5"))
+%! if (isfield (__octave_config_info__, "HAVE_HDF5")
+%!     && __octave_config_info__ ("HAVE_HDF5"))
 %!   modes(end+1) = "-hdf5";
 %! endif
 %! for i = 1:numel (modes)
--- a/scripts/deprecated/dump_prefs.m	Thu Mar 10 16:29:38 2016 -0500
+++ b/scripts/deprecated/dump_prefs.m	Thu Mar 10 19:00:37 2016 -0500
@@ -28,7 +28,6 @@
 ##
 ## If the optional argument @var{fid} is given then the results are written to
 ## the file specified by file descriptor @var{fid}.
-## @seealso{octave_config_info}
 ## @end deftypefn
 
 ## Author: jwe
--- a/scripts/deprecated/module.mk	Thu Mar 10 16:29:38 2016 -0500
+++ b/scripts/deprecated/module.mk	Thu Mar 10 19:00:37 2016 -0500
@@ -17,6 +17,7 @@
   scripts/deprecated/md5sum.m \
   scripts/deprecated/mouse_wheel_zoom.m \
   scripts/deprecated/nfields.m \
+  scripts/deprecated/octave_config_info.m \
   scripts/deprecated/octave_tmp_file_name.m \
   scripts/deprecated/playaudio.m \
   scripts/deprecated/saveaudio.m \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/deprecated/octave_config_info.m	Thu Mar 10 19:00:37 2016 -0500
@@ -0,0 +1,88 @@
+## Copyright (C) 2016 John W. Eaton
+##
+## This file is part of Octave.
+##
+## Octave is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 3 of the License, or (at
+## your option) any later version.
+##
+## Octave is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with Octave; see the file COPYING.  If not, see
+## <http://www.gnu.org/licenses/>.
+
+## -*- texinfo -*-
+## @deftypefn  {Built-in Function} {} octave_config_info ()
+## @deftypefnx {Built-in Function} {} octave_config_info (@var{option})
+##
+## @code{octave_config_info{} is deprecated and will be removed in
+## Octave version 4.6.
+##
+## Return a structure containing configuration and installation
+## information for Octave. 
+##
+## If @var{option} is a string, return the configuration information for
+## the specified option.
+##
+## @seealso{computer}
+## @end deftypefn
+
+## Deprecated in version 4.2
+
+function [retval, build_env_cell] = octave_config_info (option)
+
+  persistent warned = false;
+  if (! warned)
+    warned = true;
+    warning ("Octave:deprecated-function",
+             "octave_config_info is obsolete and will be removed from a future version of Octave, please use __octave_config_info__ instead.");
+  endif
+
+  if (nargin > 1)
+    print_usage ();
+  endif
+
+  if (nargin == 0)
+    info = __octave_config_info__ ();
+    ## Structure layout has changed.
+
+    dld = info.dld;
+    float_format = info.float_format;
+    words_big_endian = info.words_big_endian;
+    words_little_endian = info.words_little_endian;
+
+    features = info.build_features;
+
+    env = info.build_environment;
+    env_fields = fieldnames (env);
+    env_vals = struct2cell (env);
+    env_cell = [env_fields, env_vals]';
+
+    info = rmfield (info, {"dld", "float_format", "words_big_endian", ...
+                           "words_little_endian", "build_features", ...
+                           "build_environment"});
+
+    other_fields = fieldnames (info);
+    other_vals = struct2cell (info);
+    other_cell = [other_fields, other_vals]';
+
+    retval = struct ("dld", dld,
+                     "float_format", float_format,
+                     "words_big_endian", words_big_endian,
+                     "words_little_endian", words_little_endian,
+                     "features", features,
+                     env_cell{:}, other_cell{:});
+  else
+    if (strcmp (option, "features"))
+      option = "build_features";
+    endif
+    retval = __octave_config_info__ (option);
+  endif
+
+endfunction
+
--- a/scripts/help/doc.m	Thu Mar 10 16:29:38 2016 -0500
+++ b/scripts/help/doc.m	Thu Mar 10 19:00:37 2016 -0500
@@ -66,7 +66,7 @@
       endif
 
       if (isempty (ffile))
-        info_dir = octave_config_info ("infodir");
+        info_dir = __octave_config_info__ ("infodir");
       else
         info_dir = fileparts (ffile);
       endif
--- a/scripts/miscellaneous/computer.m	Thu Mar 10 16:29:38 2016 -0500
+++ b/scripts/miscellaneous/computer.m	Thu Mar 10 19:00:37 2016 -0500
@@ -60,7 +60,7 @@
   endif
 
   if (nargin == 0)
-    msg = octave_config_info ("canonical_host_type");
+    msg = __octave_config_info__ ("canonical_host_type");
 
     if (strcmp (msg, "unknown"))
       msg = "Hi Dave, I'm a HAL-9000";
@@ -71,16 +71,16 @@
     else
       c = msg;
       if (isargout (2))
-        if (octave_config_info ("ENABLE_64"))
+        if (__octave_config_info__ ("ENABLE_64"))
           maxsize = 2^63-1;
         else
           maxsize = 2^31-1;
         endif
       endif
       if (isargout (3))
-        if (octave_config_info ("words_big_endian"))
+        if (__octave_config_info__ ("words_big_endian"))
           endian = "B";
-        elseif (octave_config_info ("words_little_endian"))
+        elseif (__octave_config_info__ ("words_little_endian"))
           endian = "L";
         else
           endian = "?";
@@ -89,7 +89,7 @@
     endif
   else
     ## "arch" argument asked for
-    tmp = ostrsplit (octave_config_info ("canonical_host_type"), "-");
+    tmp = ostrsplit (__octave_config_info__ ("canonical_host_type"), "-");
     if (numel (tmp) == 4)
       c = sprintf ("%s-%s-%s", tmp{4}, tmp{3}, tmp{1});
     else
@@ -102,7 +102,7 @@
 
 
 %!assert (ischar (computer ()))
-%!assert (computer (), octave_config_info ("canonical_host_type"))
+%!assert (computer (), __octave_config_info__ ("canonical_host_type"))
 %!assert (ischar (computer ("arch")))
 
 %!error computer (1,2)
--- a/scripts/miscellaneous/ismac.m	Thu Mar 10 16:29:38 2016 -0500
+++ b/scripts/miscellaneous/ismac.m	Thu Mar 10 19:00:37 2016 -0500
@@ -25,7 +25,7 @@
 function retval = ismac ()
 
   if (nargin == 0)
-    retval = octave_config_info ("mac");
+    retval = __octave_config_info__ ("mac");
   else
     print_usage ();
   endif
--- a/scripts/miscellaneous/ispc.m	Thu Mar 10 16:29:38 2016 -0500
+++ b/scripts/miscellaneous/ispc.m	Thu Mar 10 19:00:37 2016 -0500
@@ -25,7 +25,7 @@
 function retval = ispc ()
 
   if (nargin == 0)
-    retval = octave_config_info ("windows");
+    retval = __octave_config_info__ ("windows");
   else
     print_usage ();
   endif
--- a/scripts/miscellaneous/isunix.m	Thu Mar 10 16:29:38 2016 -0500
+++ b/scripts/miscellaneous/isunix.m	Thu Mar 10 19:00:37 2016 -0500
@@ -25,7 +25,7 @@
 function retval = isunix ()
 
   if (nargin == 0)
-    retval = octave_config_info ("unix");
+    retval = __octave_config_info__ ("unix");
   else
     print_usage ();
   endif
--- a/scripts/miscellaneous/mkoctfile.m	Thu Mar 10 16:29:38 2016 -0500
+++ b/scripts/miscellaneous/mkoctfile.m	Thu Mar 10 19:00:37 2016 -0500
@@ -144,8 +144,8 @@
 
 function [output, status] = mkoctfile (varargin)
 
-  bindir = octave_config_info ("bindir");
-  ext = octave_config_info ("EXEEXT");
+  bindir = __octave_config_info__ ("bindir");
+  ext = __octave_config_info__ ("EXEEXT");
 
   shell_script = fullfile (bindir,
                            sprintf ("mkoctfile-%s%s", OCTAVE_VERSION, ext));
--- a/scripts/miscellaneous/private/display_info_file.m	Thu Mar 10 16:29:38 2016 -0500
+++ b/scripts/miscellaneous/private/display_info_file.m	Thu Mar 10 19:00:37 2016 -0500
@@ -26,7 +26,7 @@
   endif
 
   if (strcmpi (package, "octave"))
-    octetcdir = octave_config_info ("octetcdir");
+    octetcdir = __octave_config_info__ ("octetcdir");
     filepath  = fullfile (octetcdir, file);
   else
     installed = pkg ("list");
--- a/scripts/miscellaneous/ver.m	Thu Mar 10 16:29:38 2016 -0500
+++ b/scripts/miscellaneous/ver.m	Thu Mar 10 19:00:37 2016 -0500
@@ -47,7 +47,7 @@
 ## Date of the version/revision.
 ## @end table
 ##
-## @seealso{version, octave_config_info, usejava, pkg}
+## @seealso{version, usejava, pkg}
 ## @end deftypefn
 
 ## Author: William Poetra Yoga Hadisoeseno <williampoetra@gmail.com>
--- a/scripts/path/pathdef.m	Thu Mar 10 16:29:38 2016 -0500
+++ b/scripts/path/pathdef.m	Thu Mar 10 19:00:37 2016 -0500
@@ -63,7 +63,7 @@
   endif
 
   ## No user octaverc file, locate the site octaverc file.
-  pathdir = octave_config_info ("localstartupfiledir");
+  pathdir = __octave_config_info__ ("localstartupfiledir");
   site_octaverc = fullfile (pathdir, "octaverc");
   site_path = __extractpath__ (site_octaverc);
   if (! isempty (site_path))
--- a/scripts/pkg/pkg.m	Thu Mar 10 16:29:38 2016 -0500
+++ b/scripts/pkg/pkg.m	Thu Mar 10 19:00:37 2016 -0500
@@ -336,7 +336,7 @@
         ## Send verbose output to pager immediately.  Change setting locally.
         page_output_immediately (true, "local");
       case "-forge"
-        if (! octave_config_info ("CURL_LIBS"))
+        if (! __octave_config_info__ ("CURL_LIBS"))
           error ("pkg: can't download from forge without the cURL library");
         endif
         octave_forge = true;
--- a/scripts/pkg/private/configure_make.m	Thu Mar 10 16:29:38 2016 -0500
+++ b/scripts/pkg/private/configure_make.m	Thu Mar 10 19:00:37 2016 -0500
@@ -26,9 +26,9 @@
   ## Perform ./configure, make, make install in "src".
   if (exist (fullfile (packdir, "src"), "dir"))
     src = fullfile (packdir, "src");
-    octave_bindir = octave_config_info ("bindir");
+    octave_bindir = __octave_config_info__ ("bindir");
     ver = version ();
-    ext = octave_config_info ("EXEEXT");
+    ext = __octave_config_info__ ("EXEEXT");
     mkoctfile_program = fullfile (octave_bindir, ...
                                   sprintf ("mkoctfile-%s%s", ver, ext));
     octave_config_program = fullfile (octave_bindir, ...
--- a/scripts/pkg/private/default_prefix.m	Thu Mar 10 16:29:38 2016 -0500
+++ b/scripts/pkg/private/default_prefix.m	Thu Mar 10 19:00:37 2016 -0500
@@ -25,10 +25,10 @@
   if (global_install)
     prefix = fullfile (OCTAVE_HOME (), "share", "octave", "packages");
     if (nargin == 2)
-      archprefix = fullfile (octave_config_info ("libdir"), "octave",
+      archprefix = fullfile (__octave_config_info__ ("libdir"), "octave",
                              "packages", [desc.name "-" desc.version]);
     else
-      archprefix = fullfile (octave_config_info ("libdir"), "octave",
+      archprefix = fullfile (__octave_config_info__ ("libdir"), "octave",
                              "packages");
     endif
   else
--- a/scripts/pkg/private/getarch.m	Thu Mar 10 16:29:38 2016 -0500
+++ b/scripts/pkg/private/getarch.m	Thu Mar 10 19:00:37 2016 -0500
@@ -23,8 +23,8 @@
 ## @end deftypefn
 
 function arch = getarch ()
-  persistent _arch = [octave_config_info("canonical_host_type"), "-", ...
-                      octave_config_info("api_version")];
+  persistent _arch = [__octave_config_info__("canonical_host_type"), "-", ...
+                      __octave_config_info__("api_version")];
   arch = _arch;
 endfunction
 
--- a/scripts/startup/version-rcfile	Thu Mar 10 16:29:38 2016 -0500
+++ b/scripts/startup/version-rcfile	Thu Mar 10 19:00:37 2016 -0500
@@ -8,7 +8,7 @@
 
 ## Configure readline using the file inputrc in the Octave startup directory.
 readline_read_init_file (sprintf ("%s%s%s",
-                                  octave_config_info ("startupfiledir"),
+                                  __octave_config_info__ ("startupfiledir"),
                                   filesep, "inputrc"));
 
 ## Configure LESS pager if present
--- a/scripts/testfun/__have_feature__.m	Thu Mar 10 16:29:38 2016 -0500
+++ b/scripts/testfun/__have_feature__.m	Thu Mar 10 19:00:37 2016 -0500
@@ -23,9 +23,9 @@
 
 function retval = __have_feature__ (feature)
   if (strncmp (feature, "ENABLE_", 7))
-    features = octave_config_info ();
+    features = __octave_config_info__ ();
   else
-    features = octave_config_info ("build_features");
+    features = __octave_config_info__ ("build_features");
   endif
   if (iscellstr (feature))
     retval = (all (isfield (features, feature))
--- a/scripts/testfun/__run_test_suite__.m	Thu Mar 10 16:29:38 2016 -0500
+++ b/scripts/testfun/__run_test_suite__.m	Thu Mar 10 19:00:37 2016 -0500
@@ -23,11 +23,11 @@
 
 function [pass, fail, xfail, skip] = __run_test_suite__ (fcndirs, fixedtestdirs)
 
-  testsdir = octave_config_info ("octtestsdir");
+  testsdir = __octave_config_info__ ("octtestsdir");
   libinterptestdir = fullfile (testsdir, "libinterp");
   liboctavetestdir = fullfile (testsdir, "liboctave");
   fixedtestdir = fullfile (testsdir, "fixed");
-  fcnfiledir = octave_config_info ("fcnfiledir");
+  fcnfiledir = __octave_config_info__ ("fcnfiledir");
   if (nargin == 0)
     fcndirs = { liboctavetestdir, libinterptestdir, fcnfiledir };
     fixedtestdirs = { fixedtestdir };
--- a/test/system.tst	Thu Mar 10 16:29:38 2016 -0500
+++ b/test/system.tst	Thu Mar 10 19:00:37 2016 -0500
@@ -390,6 +390,6 @@
 
 %!assert (isieee () == 1 || isieee () == 0)
 
-%!assert (isstruct (octave_config_info ()))
+%!assert (isstruct (__octave_config_info__ ()))
 
 %!assert (isstruct (getrusage ()))