Mercurial > hg > octave-lyh
annotate scripts/miscellaneous/desktop.m @ 17530:ef8315ecc0d0
Fully uint32 type support
author | LYH <lyh.kernel@gmail.com> |
---|---|
date | Fri, 27 Sep 2013 06:50:59 +0800 |
parents | d858e02f2a62 |
children |
rev | line source |
---|---|
17302
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
1 ## Copyright (C) 2013 John W. Eaton |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
2 ## |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
3 ## This file is part of Octave. |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
4 ## |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
5 ## Octave is free software; you can redistribute it and/or modify it |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
6 ## under the terms of the GNU General Public License as published by |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
8 ## your option) any later version. |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
9 ## |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
10 ## Octave is distributed in the hope that it will be useful, but |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
13 ## General Public License for more details. |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
14 ## |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
15 ## You should have received a copy of the GNU General Public License |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
16 ## along with Octave; see the file COPYING. If not, see |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
17 ## <http://www.gnu.org/licenses/>. |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
18 |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
19 ## -*- texinfo -*- |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
20 ## @deftypefn {Function File} {} @var{used} = desktop ("-inuse") |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
21 ## Return true if the desktop (GUI) is currently in use. |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
22 ## @seealso{isguirunning} |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
23 ## @end deftypefn |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
24 |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
25 function retval = desktop (arg) |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
26 |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
27 if (nargin == 0) |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
28 if (isguirunning ()) |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
29 return; # desktop() is a NOP when GUI running |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
30 else |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
31 print_usage (); |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
32 endif |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
33 elseif (nargin > 1) |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
34 error ('desktop: only one argument, "-inuse", is allowed'); |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
35 endif |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
36 |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
37 switch (tolower (arg)) |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
38 case "-inuse" |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
39 retval = isguirunning (); |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
40 otherwise |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
41 print_usage (); |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
42 endswitch |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
43 |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
44 endfunction |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
45 |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
46 |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
47 ## Test input validation |
17308
d858e02f2a62
desktop.m: Fix failing %!error test.
Rik <rik@octave.org>
parents:
17302
diff
changeset
|
48 %!error <only one argument, "-inuse", is allowed> desktop (1,2) |
17302
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
49 %!error desktop ("-invalid_option") |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
50 |