Mercurial > octave-nkf
comparison scripts/general/display.m @ 13835:fc9f34e17486
display.m: Extend display to work on builtin classes (Bug #34637)
* display.m: Extend display to work on builtin classes.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Thu, 27 Oct 2011 09:59:26 -0700 |
parents | fd0a3ac60b0e |
children | 72c96de7a403 |
comparison
equal
deleted
inserted
replaced
13834:227130df89eb | 13835:fc9f34e17486 |
---|---|
31 ## | 31 ## |
32 ## @seealso{class, subsref, subsasgn} | 32 ## @seealso{class, subsref, subsasgn} |
33 ## @end deftypefn | 33 ## @end deftypefn |
34 | 34 |
35 function idx = display (a) | 35 function idx = display (a) |
36 if (nargin == 1) | 36 |
37 error ("display: not defined for class \"%s\"", class(a)); | 37 if (nargin != 1) |
38 else | |
39 print_usage (); | 38 print_usage (); |
40 endif | 39 endif |
40 | |
41 ## Only reason we got here is that there was no overloaded display() | |
42 ## function for object a. This may mean it is a built-in. | |
43 str = disp (a); | |
44 if (isempty (strfind (str, "<class "))) | |
45 disp (str); | |
46 else | |
47 error ('display: not defined for class "%s"', class (a)); | |
48 endif | |
49 | |
41 endfunction | 50 endfunction |