Mercurial > hg > octave-lyh
annotate scripts/miscellaneous/computer.m @ 12642:f96b9b9f141b stable
doc: Periodic grammarcheck and spellcheck of documentation.
* func.txi: Correct two misspellings
* cumtrapz.m, dblquad.m, quadgk.m, quadl.m, quadv.m, trapz.m, triplequad.m,
cond.m, gmres.m, bzip2.m, compare_versions.m, getappdata.m, unpack.m, ver.m,
glpk.m, pkg.m, axis.m, uigetdir.m, uigetfile.m, view.m, prctile.m, quantile.m,
unidcdf.m, unidinv.m, isstrprop.m, balance.cc, besselj.cc, cellfun.cc,
colamd.cc, dot.cc, eigs.cc, fftw.cc, matrix_type.cc, pinv.cc, qr.cc, quad.cc,
quadcc.cc, qz.cc, regexp.cc, schur.cc, time.cc (gmtime), typecast.cc
urlwrite.cc bitfcns.cc (bitshift), data.cc (rem, norm, merge) debug.cc
(dbstatus), dirfns.cc (glob), file-io.cc (freport), load-path.cc (genpath),
load-save.cc (save), mappers.cc (islower, isupper, tolower, toupper)
oct-hist.cc (edit_history), ov-fcn-inline.cc (vectorize), ov.cc (subsref),
syscalls.cc (stat), variables.cc (whos, clear): Improve docstrings.
Removed trailing whitespace characters on line.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 01 May 2011 11:39:50 -0700 |
parents | c792872f8942 |
children | 9bebb2322c4e |
rev | line source |
---|---|
11523 | 1 ## Copyright (C) 2004-2011 John W. Eaton |
4691 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
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 | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
4691 | 9 ## |
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. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
4691 | 18 |
19 ## -*- texinfo -*- | |
5427 | 20 ## @deftypefn {Function File} {[@var{c}, @var{maxsize}, @var{endian}] =} computer () |
4691 | 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 | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
8920
diff
changeset
|
24 ## example: |
4691 | 25 ## |
26 ## @example | |
27 ## @group | |
28 ## computer () | |
29 ## @print{} i586-pc-linux-gnu | |
30 ## | |
31 ## x = computer () | |
32 ## @result{} x = "i586-pc-linux-gnu" | |
33 ## @end group | |
34 ## @end example | |
5427 | 35 ## |
36 ## If two output arguments are requested, also return the maximum number | |
37 ## of elements for an array. | |
38 ## | |
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). | |
4691 | 42 ## @end deftypefn |
43 | |
5427 | 44 function [c, maxsize, endian] = computer () |
4691 | 45 |
46 if (nargin != 0) | |
47 warning ("computer: ignoring extra arguments"); | |
48 endif | |
49 | |
50 msg = octave_config_info ("canonical_host_type"); | |
51 | |
52 if (strcmp (msg, "unknown")) | |
53 msg = "Hi Dave, I'm a HAL-9000"; | |
54 endif | |
55 | |
56 if (nargout == 0) | |
57 printf ("%s\n", msg); | |
58 else | |
5427 | 59 c = msg; |
60 if (strcmp (octave_config_info ("USE_64_BIT_IDX_T"), "true")) | |
61 maxsize = 2^63-1; | |
62 else | |
63 maxsize = 2^31-1; | |
64 endif | |
65 if (octave_config_info ("words_big_endian")) | |
66 endian = "B"; | |
67 elseif (octave_config_info ("words_little_endian")) | |
68 endian = "L"; | |
69 else | |
70 endian = "?"; | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
71 endif |
4691 | 72 endif |
73 | |
74 endfunction | |
7411 | 75 |
7768
a2d9f325b65a
Use isschar instead of deprecated isstr
Rafael Laboissiere <rafael@debian.org>
parents:
7411
diff
changeset
|
76 %!assert((ischar (computer ()) |
7411 | 77 %! && computer () == octave_config_info ("canonical_host_type"))); |
78 | |
79 %!warning a =computer(2); | |
80 |