# HG changeset patch # User jwe # Date 1124221772 0 # Node ID a92afe70fb8d3267f6e71e18cc3e270aa17fb0fa # Parent ee16a0a4635103fc41a05a3877b0c3fd9f981849 [project @ 2005-08-16 19:49:23 by jwe] diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2005-08-16 John W. Eaton + + * miscellaneous/computer.m: Handle optional maxsize and endian + outputs. + 2005-08-15 John W. Eaton * strings/strcat.m: Allow single argument. diff --git a/scripts/miscellaneous/computer.m b/scripts/miscellaneous/computer.m --- a/scripts/miscellaneous/computer.m +++ b/scripts/miscellaneous/computer.m @@ -18,7 +18,7 @@ ## 02110-1301, USA. ## -*- texinfo -*- -## @deftypefn {Function File} {} computer () +## @deftypefn {Function File} {[@var{c}, @var{maxsize}, @var{endian}] =} computer () ## Print or return a string of the form @var{cpu}-@var{vendor}-@var{os} ## that identifies the kind of computer Octave is running on. If invoked ## with an output argument, the value is returned instead of printed. For @@ -33,9 +33,16 @@ ## @result{} x = "i586-pc-linux-gnu" ## @end group ## @end example +## +## If two output arguments are requested, also return the maximum number +## of elements for an array. +## +## If three output arguments are requested, also return the byte order +## of the current system as a character (@code{"B"} for big-endian or +## @code{"L"} for little-endian). ## @end deftypefn -function retval = computer () +function [c, maxsize, endian] = computer () if (nargin != 0) warning ("computer: ignoring extra arguments"); @@ -50,7 +57,19 @@ if (nargout == 0) printf ("%s\n", msg); else - retval = msg; + c = msg; + if (strcmp (octave_config_info ("USE_64_BIT_IDX_T"), "true")) + maxsize = 2^63-1; + else + maxsize = 2^31-1; + endif + if (octave_config_info ("words_big_endian")) + endian = "B"; + elseif (octave_config_info ("words_little_endian")) + endian = "L"; + else + endian = "?"; + endif endif endfunction