changeset 23335:c052a29c1f1f

improve display of ftp and audio objects (bug #50640) * @ftp/disp.m: New file. * scripts/module.mk: Update. * @ftp/display.m: Call disp to display object internals. * @audioplayer/disp.m, @audiorecorder/disp.m: New functions. * scripts/audio/module.mk: Update. * @audioplayer/display.m, @audiorecorder/display.m: Improve appearance of output. Call disp to display object internals.
author John W. Eaton <jwe@octave.org>
date Wed, 29 Mar 2017 15:39:37 -0400
parents 74db993b2ac4
children 9cd68be3dba8
files scripts/@ftp/disp.m scripts/@ftp/display.m scripts/audio/@audioplayer/display.m scripts/audio/@audiorecorder/display.m scripts/audio/module.mk scripts/module.mk
diffstat 6 files changed, 40 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/@ftp/disp.m	Wed Mar 29 15:39:37 2017 -0400
@@ -0,0 +1,31 @@
+## Copyright (C) 2017 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/>.
+
+function disp (obj)
+
+  if (nargin != 1)
+    print_usage ();
+  endif
+
+  printf ("  FTP Object\n");
+  printf ("    host: %s\n", obj.host);
+  printf ("    user: %s\n", obj.username);
+  printf ("     dir: %s\n", __ftp_pwd__ (obj.curlhandle));
+  printf ("    mode: %s\n\n", __ftp_mode__ (obj.curlhandle));
+
+endfunction
--- a/scripts/@ftp/display.m	Wed Mar 29 12:26:29 2017 -0700
+++ b/scripts/@ftp/display.m	Wed Mar 29 15:39:37 2017 -0400
@@ -22,12 +22,8 @@
     print_usage ();
   endif
 
-  printf ("%s = ", inputname (1));
-  printf ("FTP Object\n");
-  printf (" host: %s\n", obj.host);
-  printf (" user: %s\n", obj.username);
-  printf ("  dir: %s\n", __ftp_pwd__ (obj.curlhandle));
-  printf (" mode: %s\n", __ftp_mode__ (obj.curlhandle));
+  printf ("%s =\n\n", inputname (1));
+  disp (obj);
 
 endfunction
 
--- a/scripts/audio/@audioplayer/display.m	Wed Mar 29 12:26:29 2017 -0700
+++ b/scripts/audio/@audioplayer/display.m	Wed Mar 29 15:39:37 2017 -0400
@@ -27,7 +27,7 @@
     print_usage ();
   endif
 
-  printf ("%s = ", inputname (1));
-  disp (__get_properties__ (player));
+  printf ("%s =\n", inputname (1));
+  disp (player);
 
 endfunction
--- a/scripts/audio/@audiorecorder/display.m	Wed Mar 29 12:26:29 2017 -0700
+++ b/scripts/audio/@audiorecorder/display.m	Wed Mar 29 15:39:37 2017 -0400
@@ -27,7 +27,7 @@
     print_usage ();
   endif
 
-  printf ("%s = ", inputname (1));
-  disp (__get_properties__ (recorder));
+  printf ("%s =\n", inputname (1));
+  disp (recorder);
 
 endfunction
--- a/scripts/audio/module.mk	Wed Mar 29 12:26:29 2017 -0700
+++ b/scripts/audio/module.mk	Wed Mar 29 15:39:37 2017 -0400
@@ -13,6 +13,7 @@
 scripts_audio_@audioplayer_FCN_FILES = \
   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 \
@@ -28,6 +29,7 @@
 scripts_audio_@audiorecorder_FCN_FILES = \
   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 \
--- a/scripts/module.mk	Wed Mar 29 12:26:29 2017 -0700
+++ b/scripts/module.mk	Wed Mar 29 15:39:37 2017 -0400
@@ -55,6 +55,7 @@
   scripts/@ftp/close.m  \
   scripts/@ftp/delete.m  \
   scripts/@ftp/dir.m  \
+  scripts/@ftp/disp.m  \
   scripts/@ftp/display.m  \
   scripts/@ftp/ftp.m  \
   scripts/@ftp/loadobj.m  \