Mercurial > hg > octave-lyh
comparison scripts/miscellaneous/computer.m @ 5427:a92afe70fb8d
[project @ 2005-08-16 19:49:23 by jwe]
author | jwe |
---|---|
date | Tue, 16 Aug 2005 19:49:32 +0000 |
parents | 4c8a2e4e0717 |
children | 93c65f2a5668 |
comparison
equal
deleted
inserted
replaced
5426:ee16a0a46351 | 5427:a92afe70fb8d |
---|---|
16 ## along with Octave; see the file COPYING. If not, write to the Free | 16 ## along with Octave; see the file COPYING. If not, write to the Free |
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
18 ## 02110-1301, USA. | 18 ## 02110-1301, USA. |
19 | 19 |
20 ## -*- texinfo -*- | 20 ## -*- texinfo -*- |
21 ## @deftypefn {Function File} {} computer () | 21 ## @deftypefn {Function File} {[@var{c}, @var{maxsize}, @var{endian}] =} computer () |
22 ## Print or return a string of the form @var{cpu}-@var{vendor}-@var{os} | 22 ## Print or return a string of the form @var{cpu}-@var{vendor}-@var{os} |
23 ## that identifies the kind of computer Octave is running on. If invoked | 23 ## that identifies the kind of computer Octave is running on. If invoked |
24 ## with an output argument, the value is returned instead of printed. For | 24 ## with an output argument, the value is returned instead of printed. For |
25 ## example, | 25 ## example, |
26 ## | 26 ## |
31 ## | 31 ## |
32 ## x = computer () | 32 ## x = computer () |
33 ## @result{} x = "i586-pc-linux-gnu" | 33 ## @result{} x = "i586-pc-linux-gnu" |
34 ## @end group | 34 ## @end group |
35 ## @end example | 35 ## @end example |
36 ## | |
37 ## If two output arguments are requested, also return the maximum number | |
38 ## of elements for an array. | |
39 ## | |
40 ## If three output arguments are requested, also return the byte order | |
41 ## of the current system as a character (@code{"B"} for big-endian or | |
42 ## @code{"L"} for little-endian). | |
36 ## @end deftypefn | 43 ## @end deftypefn |
37 | 44 |
38 function retval = computer () | 45 function [c, maxsize, endian] = computer () |
39 | 46 |
40 if (nargin != 0) | 47 if (nargin != 0) |
41 warning ("computer: ignoring extra arguments"); | 48 warning ("computer: ignoring extra arguments"); |
42 endif | 49 endif |
43 | 50 |
48 endif | 55 endif |
49 | 56 |
50 if (nargout == 0) | 57 if (nargout == 0) |
51 printf ("%s\n", msg); | 58 printf ("%s\n", msg); |
52 else | 59 else |
53 retval = msg; | 60 c = msg; |
61 if (strcmp (octave_config_info ("USE_64_BIT_IDX_T"), "true")) | |
62 maxsize = 2^63-1; | |
63 else | |
64 maxsize = 2^31-1; | |
65 endif | |
66 if (octave_config_info ("words_big_endian")) | |
67 endian = "B"; | |
68 elseif (octave_config_info ("words_little_endian")) | |
69 endian = "L"; | |
70 else | |
71 endian = "?"; | |
72 endif | |
54 endif | 73 endif |
55 | 74 |
56 endfunction | 75 endfunction |