Mercurial > octave-nkf
annotate scripts/miscellaneous/ver.m @ 19631:db92e7e28e1f
strip trailing whitespace from most source files
* NEWS, doc/interpreter/contributors.in, doc/interpreter/func.txi,
doc/interpreter/genpropdoc.m, doc/interpreter/octave_logo.eps,
doc/interpreter/plot.txi, doc/interpreter/stmt.txi,
examples/data/Makefile.am, libinterp/corefcn/data.cc,
libinterp/corefcn/debug.cc, libinterp/corefcn/error.cc,
libinterp/corefcn/file-io.cc, libinterp/corefcn/gl-render.cc,
libinterp/corefcn/graphics.cc, libinterp/corefcn/graphics.in.h,
libinterp/corefcn/load-path.cc, libinterp/corefcn/pr-output.cc,
libinterp/corefcn/pt-jit.cc, libinterp/corefcn/strfind.cc,
libinterp/corefcn/toplev.cc, libinterp/corefcn/toplev.h,
libinterp/corefcn/urlwrite.cc, libinterp/corefcn/variables.cc,
libinterp/octave-value/ov-classdef.cc,
libinterp/octave-value/ov-classdef.h, libinterp/octave.cc,
libinterp/parse-tree/lex.h, libinterp/parse-tree/oct-parse.in.yy,
libinterp/parse-tree/pt-classdef.h, liboctave/system/file-ops.cc,
liboctave/system/oct-env.cc, m4/acinclude.m4,
scripts/deprecated/finite.m, scripts/deprecated/fmod.m,
scripts/deprecated/fnmatch.m, scripts/deprecated/luinc.m,
scripts/deprecated/octave_tmp_file_name.m, scripts/deprecated/syl.m,
scripts/deprecated/usage.m, scripts/general/inputParser.m,
scripts/general/interp1.m, scripts/general/interp2.m,
scripts/general/interp3.m, scripts/general/isequal.m,
scripts/general/private/__isequal__.m, scripts/geometry/voronoi.m,
scripts/image/image.m, scripts/image/imshow.m,
scripts/image/ind2rgb.m, scripts/linear-algebra/bandwidth.m,
scripts/linear-algebra/isbanded.m, scripts/miscellaneous/bzip2.m,
scripts/miscellaneous/cast.m, scripts/miscellaneous/copyfile.m,
scripts/miscellaneous/delete.m, scripts/miscellaneous/fullfile.m,
scripts/miscellaneous/getappdata.m, scripts/miscellaneous/gunzip.m,
scripts/miscellaneous/isappdata.m, scripts/miscellaneous/ls.m,
scripts/miscellaneous/mex.m, scripts/miscellaneous/movefile.m,
scripts/miscellaneous/orderfields.m, scripts/miscellaneous/recycle.m,
scripts/miscellaneous/rmappdata.m, scripts/miscellaneous/setfield.m,
scripts/miscellaneous/symvar.m, scripts/miscellaneous/tar.m,
scripts/miscellaneous/tmpnam.m, scripts/miscellaneous/unpack.m,
scripts/miscellaneous/ver.m, scripts/miscellaneous/what.m,
scripts/miscellaneous/xor.m, scripts/miscellaneous/zip.m,
scripts/optimization/fminbnd.m, scripts/optimization/sqp.m,
scripts/path/private/getsavepath.m, scripts/path/savepath.m,
scripts/pkg/pkg.m, scripts/pkg/private/installed_packages.m,
scripts/plot/draw/plotyy.m, scripts/plot/draw/polar.m,
scripts/plot/draw/private/__quiver__.m,
scripts/plot/draw/private/__scatter__.m,
scripts/plot/draw/private/__stem__.m, scripts/plot/draw/surface.m,
scripts/plot/draw/surfnorm.m, scripts/plot/util/copyobj.m,
scripts/plot/util/hgload.m, scripts/plot/util/hgsave.m,
scripts/plot/util/isprop.m, scripts/plot/util/linkprop.m,
scripts/plot/util/private/__go_draw_axes__.m, scripts/set/setdiff.m,
scripts/set/union.m, scripts/signal/periodogram.m,
scripts/sparse/eigs.m, scripts/sparse/ilu.m, scripts/sparse/qmr.m,
scripts/sparse/sprand.m, scripts/sparse/sprandn.m,
scripts/specfun/beta.m, scripts/specfun/ellipke.m,
scripts/specfun/isprime.m, scripts/statistics/base/lscov.m,
scripts/testfun/__run_test_suite__.m, scripts/testfun/test.m:
Strip trailing whitespace.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 20 Jan 2015 10:29:54 -0500 |
parents | 0e1f5a750d00 |
children | 4197fc428c7d |
rev | line source |
---|---|
17744
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
16491
diff
changeset
|
1 ## Copyright (C) 2005-2013 William Poetra Yoga Hadisoeseno |
5546 | 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. | |
5546 | 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/>. | |
5546 | 18 |
19 ## -*- texinfo -*- | |
19221 | 20 ## @deftypefn {Function File} {} ver |
21 ## @deftypefnx {Function File} {} ver Octave | |
22 ## @deftypefnx {Function File} {} ver @var{package} | |
23 ## @deftypefnx {Function File} {v =} ver (@dots{}) | |
19627
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
24 ## |
12208
9611014e7cf1
Add function compare_versions to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
25 ## Display a header containing the current Octave version number, license |
19221 | 26 ## string, and operating system. The header is followed by a list of installed |
27 ## packages, versions, and installation directories. | |
12208
9611014e7cf1
Add function compare_versions to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
28 ## |
19221 | 29 ## Use the package name @var{package} or Octave to limit the listing to a |
30 ## desired component. | |
16491
b10a23fe80bb
doc: Tweak docstrings of functions changed for Texinfo 5.0 compatibility.
Rik <rik@octave.org>
parents:
16489
diff
changeset
|
31 ## |
19221 | 32 ## When called with an output argument, return a vector of structures |
33 ## describing Octave and each installed package. The structure includes the | |
34 ## following fields. | |
7499
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
35 ## |
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
36 ## @table @code |
12208
9611014e7cf1
Add function compare_versions to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
37 ## @item Name |
9611014e7cf1
Add function compare_versions to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
38 ## Package name. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
8920
diff
changeset
|
39 ## |
12208
9611014e7cf1
Add function compare_versions to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
40 ## @item Version |
9611014e7cf1
Add function compare_versions to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
41 ## Version of the package. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
8920
diff
changeset
|
42 ## |
12208
9611014e7cf1
Add function compare_versions to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
43 ## @item Revision |
9611014e7cf1
Add function compare_versions to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
44 ## Revision of the package. |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
8920
diff
changeset
|
45 ## |
12208
9611014e7cf1
Add function compare_versions to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
46 ## @item Date |
16491
b10a23fe80bb
doc: Tweak docstrings of functions changed for Texinfo 5.0 compatibility.
Rik <rik@octave.org>
parents:
16489
diff
changeset
|
47 ## Date of the version/revision. |
7499
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
48 ## @end table |
12208
9611014e7cf1
Add function compare_versions to documentation.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
49 ## |
19226
8a8a7bc2a09d
Improve docstrings and mark documentation m-files as tested in miscellaneous/ dir.
Rik <rik@octave.org>
parents:
19221
diff
changeset
|
50 ## @seealso{version, octave_config_info, usejava, pkg} |
5546 | 51 ## @end deftypefn |
52 | |
53 ## Author: William Poetra Yoga Hadisoeseno <williampoetra@gmail.com> | |
54 | |
19221 | 55 function retval = ver (package = "") |
7499
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
56 |
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
57 if (nargin > 1) |
6046 | 58 print_usage (); |
5546 | 59 endif |
60 | |
19221 | 61 if (nargout == 0) |
62 [unm, err] = uname (); | |
7499
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
63 |
19221 | 64 if (err) |
7499
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
65 os_string = "unknown"; |
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
66 else |
19221 | 67 os_string = sprintf ("%s %s %s %s", |
68 unm.sysname, unm.release, unm.version, unm.machine); | |
7499
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
69 endif |
5546 | 70 |
7499
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
71 hbar(1:70) = "-"; |
19221 | 72 desc = {hbar |
73 ["GNU Octave Version: " OCTAVE_VERSION] | |
74 ["GNU Octave License: " license] | |
75 ["Operating System: " os_string] | |
76 hbar}; | |
77 | |
78 printf ("%s\n", desc{:}); | |
7499
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
79 |
19221 | 80 if (isempty (package)) |
81 pkg ("list"); | |
82 elseif (strcmpi (package, "Octave")) | |
83 ## Nothing to do, Octave version was already reported | |
84 else | |
85 pkg ("list", package); | |
86 endif | |
5546 | 87 else |
19221 | 88 ## Get the installed packages |
89 if (isempty (package)) | |
90 lst = pkg ("list"); | |
91 ## Start with the version info for Octave | |
92 retval = struct ("Name", "Octave", "Version", version, | |
93 "Release", [], "Date", []); | |
94 for i = 1:numel (lst) | |
95 retval(end+1) = struct ("Name", lst{i}.name, "Version", lst{i}.version, | |
96 "Release", [], "Date", lst{i}.date); | |
7499
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
97 endfor |
19221 | 98 elseif (strcmpi (package, "Octave")) |
99 retval = struct ("Name", "Octave", "Version", version, | |
100 "Release", [], "Date", []); | |
19631
db92e7e28e1f
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
19630
diff
changeset
|
101 else |
19221 | 102 lst = pkg ("list", package); |
103 if (isempty (lst)) | |
104 retval = struct ("Name", "", "Version", [], | |
105 "Release", [], "Date", []); | |
106 else | |
107 retval = struct ("Name", lst{1}.name, "Version", lst{1}.version, | |
108 "Release", [], "Date", lst{1}.date); | |
109 endif | |
7499
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
110 endif |
5546 | 111 endif |
112 | |
7499
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
113 endfunction |
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
114 |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
115 |
7499
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
116 %!test |
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
117 %! result = ver; |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
118 %! assert (result(1).Name, "Octave"); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
119 %! assert (result(1).Version, version); |
7499
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
120 %! result = ver ("octave"); |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
121 %! assert (result(1).Name, "Octave"); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
122 %! assert (result(1).Version, version); |
5546 | 123 |
7499
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
124 %!test |
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
125 %! lst = pkg ("list"); |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
126 %! for n = 1:numel (lst) |
7499
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
127 %! expected = lst{n}.name; |
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
128 %! result = ver (expected); |
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
129 %! assert (result.Name, expected); |
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
130 %! assert (isfield (result, "Version"), true); |
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
131 %! assert (isfield (result, "Release"), true); |
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
132 %! assert (isfield (result, "Date"), true); |
94d0cdd60dda
Added pkg version info and matlab compatibility.
Ben Abbott <bpabbott@mac.com>
parents:
7017
diff
changeset
|
133 %! endfor |
5546 | 134 |