annotate scripts/miscellaneous/getappdata.m @ 19658:17e6c770e6ac gui-release

check existence of uncompressed or compressed info files for doc viewer * parser.cc (set_info_path): return type changed to bool, checking existence of info file uncompressed and with all known compressed file extensions, returns false if no file was found and true after parsing the found file; * parser.h: return type of set_info_path changed to bool * webinfo.cc (ctor): do not check existence of info file since this is done via set_info_path; (set_info_path): return type changed to bool, load Top-node if parser::set_info_path returns true and return the related return value * webinfo.h: return type of set_info_path changed to bool
author Torsten <ttl@justmail.de>
date Fri, 02 Jan 2015 18:47:29 +0100
parents 0a8c35ae5ce1
children 7bbe3658c5ef 446c46af4b42
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17744
d63878346099 maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents: 17122
diff changeset
1 ## Copyright (C) 2010-2013 Ben Abbott
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
2 ##
17795
0a8c35ae5ce1 maint: Fix various problems with GPL copyright statements.
Rik <rik@octave.org>
parents: 17744
diff changeset
3 ## This file is part of Octave.
0a8c35ae5ce1 maint: Fix various problems with GPL copyright statements.
Rik <rik@octave.org>
parents: 17744
diff changeset
4 ##
0a8c35ae5ce1 maint: Fix various problems with GPL copyright statements.
Rik <rik@octave.org>
parents: 17744
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
0a8c35ae5ce1 maint: Fix various problems with GPL copyright statements.
Rik <rik@octave.org>
parents: 17744
diff changeset
6 ## under the terms of the GNU General Public License as published by
0a8c35ae5ce1 maint: Fix various problems with GPL copyright statements.
Rik <rik@octave.org>
parents: 17744
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or
11180
1a26199cb212 Add new appdata functions.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
8 ## (at your option) any later version.
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
9 ##
17795
0a8c35ae5ce1 maint: Fix various problems with GPL copyright statements.
Rik <rik@octave.org>
parents: 17744
diff changeset
10 ## Octave is distributed in the hope that it will be useful,
11180
1a26199cb212 Add new appdata functions.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
1a26199cb212 Add new appdata functions.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1a26199cb212 Add new appdata functions.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
13 ## GNU General Public License for more details.
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
14 ##
11180
1a26199cb212 Add new appdata functions.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
1a26199cb212 Add new appdata functions.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
1a26199cb212 Add new appdata functions.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
1a26199cb212 Add new appdata functions.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
18
1a26199cb212 Add new appdata functions.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
19 ## -*- texinfo -*-
16491
b10a23fe80bb doc: Tweak docstrings of functions changed for Texinfo 5.0 compatibility.
Rik <rik@octave.org>
parents: 16489
diff changeset
20 ## @deftypefn {Function File} {@var{value} =} getappdata (@var{h}, @var{name})
16489
36dba9be680b doc: Make documentation compatible with Texinfo 5.0 (bug #38392)
Amod Mulay <amodmulay1@gmail.com>
parents: 14868
diff changeset
21 ## @deftypefnx {Function File} {@var{appdata} =} getappdata (@var{h})
36dba9be680b doc: Make documentation compatible with Texinfo 5.0 (bug #38392)
Amod Mulay <amodmulay1@gmail.com>
parents: 14868
diff changeset
22 ##
12575
d0b799dafede Grammarcheck files for 3.4.1 release.
Rik <octave@nomad.inbox5.com>
parents: 11589
diff changeset
23 ## Return the @var{value} for named application data for the object(s) with
11180
1a26199cb212 Add new appdata functions.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
24 ## handle(s) @var{h}.
16489
36dba9be680b doc: Make documentation compatible with Texinfo 5.0 (bug #38392)
Amod Mulay <amodmulay1@gmail.com>
parents: 14868
diff changeset
25 ##
16491
b10a23fe80bb doc: Tweak docstrings of functions changed for Texinfo 5.0 compatibility.
Rik <rik@octave.org>
parents: 16489
diff changeset
26 ## @code{getappdata(@var{h})} returns a structure, @var{appdata}, whose fields
b10a23fe80bb doc: Tweak docstrings of functions changed for Texinfo 5.0 compatibility.
Rik <rik@octave.org>
parents: 16489
diff changeset
27 ## correspond to the appdata properties.
17122
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16491
diff changeset
28 ##
eaab03308c0b doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents: 16491
diff changeset
29 ## @seealso{setappdata, guidata, get, set, getpref, setpref}
11180
1a26199cb212 Add new appdata functions.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
30 ## @end deftypefn
1a26199cb212 Add new appdata functions.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
31
1a26199cb212 Add new appdata functions.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
32 ## Author: Ben Abbott <bpabbott@mac.com>
1a26199cb212 Add new appdata functions.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
33 ## Created: 2010-07-15
1a26199cb212 Add new appdata functions.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
34
1a26199cb212 Add new appdata functions.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
35 function val = getappdata (h, name)
1a26199cb212 Add new appdata functions.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
36
12597
e12a7c0a1fc5 getappdata.m: If no property name is provided, return a structure representing the appdata.
Ben Abbott <bpabbott@mac.com>
parents: 12590
diff changeset
37 if (all (ishandle (h)) && nargin == 2 && ischar (name))
e12a7c0a1fc5 getappdata.m: If no property name is provided, return a structure representing the appdata.
Ben Abbott <bpabbott@mac.com>
parents: 12590
diff changeset
38 ## FIXME - Is there a better way to handle non-existent appdata
e12a7c0a1fc5 getappdata.m: If no property name is provided, return a structure representing the appdata.
Ben Abbott <bpabbott@mac.com>
parents: 12590
diff changeset
39 ## and missing fields?
e12a7c0a1fc5 getappdata.m: If no property name is provided, return a structure representing the appdata.
Ben Abbott <bpabbott@mac.com>
parents: 12590
diff changeset
40 val = cell (numel (h), 1);
14846
460a3c6d8bf1 maint: Use Octave coding convention for cuddled parenthis in function calls with empty argument lists.
Rik <octave@nomad.inbox5.com>
parents: 14138
diff changeset
41 appdata = struct ();
14868
5d3a684236b0 maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents: 14846
diff changeset
42 for nh = 1:numel (h)
12597
e12a7c0a1fc5 getappdata.m: If no property name is provided, return a structure representing the appdata.
Ben Abbott <bpabbott@mac.com>
parents: 12590
diff changeset
43 try
e12a7c0a1fc5 getappdata.m: If no property name is provided, return a structure representing the appdata.
Ben Abbott <bpabbott@mac.com>
parents: 12590
diff changeset
44 appdata = get (h(nh), "__appdata__");
13243
f9aec0bcf826 getappdata: return empty matrix for nonexistent property names
John W. Eaton <jwe@octave.org>
parents: 13174
diff changeset
45 end_try_catch
f9aec0bcf826 getappdata: return empty matrix for nonexistent property names
John W. Eaton <jwe@octave.org>
parents: 13174
diff changeset
46 if (! isfield (appdata, name))
12597
e12a7c0a1fc5 getappdata.m: If no property name is provided, return a structure representing the appdata.
Ben Abbott <bpabbott@mac.com>
parents: 12590
diff changeset
47 appdata.(name) = [];
13243
f9aec0bcf826 getappdata: return empty matrix for nonexistent property names
John W. Eaton <jwe@octave.org>
parents: 13174
diff changeset
48 endif
12597
e12a7c0a1fc5 getappdata.m: If no property name is provided, return a structure representing the appdata.
Ben Abbott <bpabbott@mac.com>
parents: 12590
diff changeset
49 val(nh) = {appdata.(name)};
13174
bd2cd4fd3edf maint: use specific endif, endfor tokens instead of simple end
John W. Eaton <jwe@octave.org>
parents: 12642
diff changeset
50 endfor
12597
e12a7c0a1fc5 getappdata.m: If no property name is provided, return a structure representing the appdata.
Ben Abbott <bpabbott@mac.com>
parents: 12590
diff changeset
51 if (nh == 1)
e12a7c0a1fc5 getappdata.m: If no property name is provided, return a structure representing the appdata.
Ben Abbott <bpabbott@mac.com>
parents: 12590
diff changeset
52 val = val{1};
e12a7c0a1fc5 getappdata.m: If no property name is provided, return a structure representing the appdata.
Ben Abbott <bpabbott@mac.com>
parents: 12590
diff changeset
53 endif
e12a7c0a1fc5 getappdata.m: If no property name is provided, return a structure representing the appdata.
Ben Abbott <bpabbott@mac.com>
parents: 12590
diff changeset
54 elseif (ishandle (h) && numel (h) == 1 && nargin == 1)
e12a7c0a1fc5 getappdata.m: If no property name is provided, return a structure representing the appdata.
Ben Abbott <bpabbott@mac.com>
parents: 12590
diff changeset
55 try
e12a7c0a1fc5 getappdata.m: If no property name is provided, return a structure representing the appdata.
Ben Abbott <bpabbott@mac.com>
parents: 12590
diff changeset
56 val = get (h, "__appdata__");
e12a7c0a1fc5 getappdata.m: If no property name is provided, return a structure representing the appdata.
Ben Abbott <bpabbott@mac.com>
parents: 12590
diff changeset
57 catch
e12a7c0a1fc5 getappdata.m: If no property name is provided, return a structure representing the appdata.
Ben Abbott <bpabbott@mac.com>
parents: 12590
diff changeset
58 val = struct ();
e12a7c0a1fc5 getappdata.m: If no property name is provided, return a structure representing the appdata.
Ben Abbott <bpabbott@mac.com>
parents: 12590
diff changeset
59 end_try_catch
e12a7c0a1fc5 getappdata.m: If no property name is provided, return a structure representing the appdata.
Ben Abbott <bpabbott@mac.com>
parents: 12590
diff changeset
60 else
11589
b0084095098e missing semicolons in script files
John W. Eaton <jwe@octave.org>
parents: 11588
diff changeset
61 error ("getappdata: invalid input");
11180
1a26199cb212 Add new appdata functions.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
62 endif
1a26199cb212 Add new appdata functions.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
63
1a26199cb212 Add new appdata functions.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
64 endfunction
1a26199cb212 Add new appdata functions.
Ben Abbott <bpabbott@mac.com>
parents:
diff changeset
65