1## Copyright (C) 2004, 2005, 2007, 2008 John W. Eaton
3## This file is part of Octave.
5## Octave is free software; you can redistribute it and/or modify it
6## under the terms of the GNU General Public License as published by
7## the Free Software Foundation; either version 3 of the License, or (at
8## your option) any later version.
10## Octave is distributed in the hope that it will be useful, but
11## WITHOUT ANY WARRANTY; without even the implied warranty of
12## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13## General Public License for more details.
15## You should have received a copy of the GNU General Public License
16## along with Octave; see the file COPYING. If not, see
17## <http://www.gnu.org/licenses/>.
20## @deftypefn {Function File} {[@var{c}, @var{maxsize}, @var{endian}] =} computer ()
21## Print or return a string of the form @var{cpu}-@var{vendor}-@var{os}
22## that identifies the kind of computer Octave is running on. If invoked
23## with an output argument, the value is returned instead of printed. For
29## @print{} i586-pc-linux-gnu
32## @result{} x = "i586-pc-linux-gnu"
36## If two output arguments are requested, also return the maximum number
37## of elements for an array.
39## If three output arguments are requested, also return the byte order
40## of the current system as a character (@code{"B"} for big-endian or
41## @code{"L"} for little-endian).
44function [c, maxsize, endian] = computer ()
47 warning ("computer: ignoring extra arguments");
50 msg = octave_config_info ("canonical_host_type");
52 if (strcmp (msg, "unknown"))
53 msg = "Hi Dave, I'm a HAL-9000";
60 if (strcmp (octave_config_info ("USE_64_BIT_IDX_T"), "true"))
65 if (octave_config_info ("words_big_endian"))
67 elseif (octave_config_info ("words_little_endian"))
76%!assert((ischar (computer ())
77%! && computer () == octave_config_info ("canonical_host_type")));
79%!warning a =computer(2);