changeset 23337:f04f32f08590

Override disp rather than display for class objects (bug #50640). * scripts/@ftp/disp.m: print lowercase "object". * scripts/audio/@audioplayer/disp.m: Add header describing object rather than pretending object is a structure. * scripts/audio/@audiorecorder/disp.m: Add header describing object rather than pretending object is a structure. * scripts/general/inputParser.m: Switch to overloading disp, not display. * scripts/@ftp/display.m: Deleted. * scripts/audio/@audioplayer/display.m: Deleted. * scripts/audio/@audiorecorder/display.m: Deleted. * scripts/module.mk: Remove @ftp/display.m from build system. * scripts/audio/module.mk: Remove @audioplayer/display.m, @audiorecorder/display.m from build system.
author Rik <rik@octave.org>
date Wed, 29 Mar 2017 17:02:26 -0700
parents 9cd68be3dba8
children f7460c045841
files scripts/@ftp/disp.m scripts/@ftp/display.m scripts/audio/@audioplayer/disp.m scripts/audio/@audioplayer/display.m scripts/audio/@audiorecorder/disp.m scripts/audio/@audiorecorder/display.m scripts/audio/module.mk scripts/general/inputParser.m scripts/module.mk
diffstat 9 files changed, 14 insertions(+), 107 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/@ftp/disp.m	Wed Mar 29 17:37:31 2017 -0400
+++ b/scripts/@ftp/disp.m	Wed Mar 29 17:02:26 2017 -0700
@@ -22,7 +22,7 @@
     print_usage ();
   endif
 
-  printf ("  FTP Object\n");
+  printf ("  FTP object\n");
   printf ("    host: %s\n", obj.host);
   printf ("    user: %s\n", obj.username);
   printf ("     dir: %s\n", __ftp_pwd__ (obj.curlhandle));
--- a/scripts/@ftp/display.m	Wed Mar 29 17:37:31 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-## Copyright (C) 2009-2017 David Bateman
-##
-## 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/>.
-
-function display (obj)
-
-  if (nargin != 1)
-    print_usage ();
-  endif
-
-  printf ("%s =\n\n", inputname (1));
-  disp (obj);
-
-endfunction
-
-
-## No test possible for interactive function.
-%!assert (1)
--- a/scripts/audio/@audioplayer/disp.m	Wed Mar 29 17:37:31 2017 -0400
+++ b/scripts/audio/@audioplayer/disp.m	Wed Mar 29 17:02:26 2017 -0700
@@ -27,7 +27,11 @@
     print_usage ();
   endif
 
-  disp (__get_properties__ (player));
+  printf ("audioplayer object with properties:\n\n");
+  for [val, prop] = __get_properties__ (player)
+    printf ("  %s = ", prop), disp (val);
+  endfor
+  ## FIXME: display in pr-output.cc should add "\n", not this function. 
   printf ("\n");
 
 endfunction
--- a/scripts/audio/@audioplayer/display.m	Wed Mar 29 17:37:31 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-## Copyright (C) 2013-2017 Vytautas JanĨauskas
-##
-## 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 {} {} display (@var{player})
-## Display the properties of the audioplayer object @var{player}.
-## @end deftypefn
-
-function display (player)
-
-  if (nargin != 1)
-    print_usage ();
-  endif
-
-  printf ("%s =\n", inputname (1));
-  disp (player);
-
-endfunction
--- a/scripts/audio/@audiorecorder/disp.m	Wed Mar 29 17:37:31 2017 -0400
+++ b/scripts/audio/@audiorecorder/disp.m	Wed Mar 29 17:02:26 2017 -0700
@@ -27,7 +27,11 @@
     print_usage ();
   endif
 
-  disp (__get_properties__ (recorder));
+  printf ("audiorecorder object with properties:\n\n");
+  for [val, prop] = __get_properties__ (recorder)
+    printf ("  %s = ", prop), disp (val);
+  endfor
+  ## FIXME: display in pr-output.cc should add "\n", not this function. 
   printf ("\n");
 
 endfunction
--- a/scripts/audio/@audiorecorder/display.m	Wed Mar 29 17:37:31 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-## Copyright (C) 2013-2017 Vytautas JanĨauskas
-##
-## 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 {} {} display (@var{recorder})
-## Display the properties of the audiorecorder object @var{recorder}.
-## @end deftypefn
-
-function display (recorder)
-
-  if (nargin != 1)
-    print_usage ();
-  endif
-
-  printf ("%s =\n", inputname (1));
-  disp (recorder);
-
-endfunction
--- a/scripts/audio/module.mk	Wed Mar 29 17:37:31 2017 -0400
+++ b/scripts/audio/module.mk	Wed Mar 29 17:02:26 2017 -0700
@@ -14,7 +14,6 @@
   scripts/audio/@audioplayer/__get_properties__.m \
   scripts/audio/@audioplayer/audioplayer.m \
   scripts/audio/@audioplayer/disp.m \
-  scripts/audio/@audioplayer/display.m \
   scripts/audio/@audioplayer/get.m \
   scripts/audio/@audioplayer/isplaying.m \
   scripts/audio/@audioplayer/pause.m  \
@@ -30,7 +29,6 @@
   scripts/audio/@audiorecorder/__get_properties__.m \
   scripts/audio/@audiorecorder/audiorecorder.m \
   scripts/audio/@audiorecorder/disp.m \
-  scripts/audio/@audiorecorder/display.m \
   scripts/audio/@audiorecorder/get.m \
   scripts/audio/@audiorecorder/getaudiodata.m \
   scripts/audio/@audiorecorder/getplayer.m \
--- a/scripts/general/inputParser.m	Wed Mar 29 17:37:31 2017 -0400
+++ b/scripts/general/inputParser.m	Wed Mar 29 17:02:26 2017 -0700
@@ -466,17 +466,17 @@
           endif
         endif
       endwhile
-      ## Add them to the UsingDeafults list
+      ## Add them to the UsingDefaults list
       this.add_missing ("Parameter");
       this.add_missing ("Switch");
 
     endfunction
 
-    function display (this)
+    function disp (this)
       if (nargin != 1)
         print_usage ();
       endif
-      printf ("%s = inputParser object with properties:\n\n", inputname ());
+      printf ("inputParser object with properties:\n\n");
       b2s = @(x) ifelse (any (x), "true", "false");
       printf (["   CaseSensitive   : %s\n   FunctionName    : %s\n" ...
                "   KeepUnmatched   : %s\n   PartialMatching : %s\n" ...
--- a/scripts/module.mk	Wed Mar 29 17:37:31 2017 -0400
+++ b/scripts/module.mk	Wed Mar 29 17:02:26 2017 -0700
@@ -56,7 +56,6 @@
   scripts/@ftp/delete.m  \
   scripts/@ftp/dir.m  \
   scripts/@ftp/disp.m  \
-  scripts/@ftp/display.m  \
   scripts/@ftp/ftp.m  \
   scripts/@ftp/loadobj.m  \
   scripts/@ftp/mget.m  \