annotate scripts/help/__gripe_missing_component__.m @ 20595:c1a6c31ac29a

eliminate more simple uses of error_state * ov-classdef.cc: Eliminate simple uses of error_state.
author John W. Eaton <jwe@octave.org>
date Tue, 06 Oct 2015 00:20:02 -0400
parents 4197fc428c7d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19731
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19204
diff changeset
1 ## Copyright (C) 2013-2015 Mike Miller
17516
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
2 ##
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
3 ## This file is part of Octave.
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
4 ##
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
8 ## your option) any later version.
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
9 ##
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
13 ## General Public License for more details.
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
14 ##
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
18
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
19 ## -*- texinfo -*-
19186
0f9c5a15c8fa doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents: 17516
diff changeset
20 ## @deftypefn {Function File} {} __gripe_missing_component__ (@var{caller}, @var{component})
17516
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
21 ## Undocumented internal function.
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
22 ## @end deftypefn
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
23
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
24 function __gripe_missing_component__ (caller, component)
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
25
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
26 if (nargin != 2)
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
27 print_usage ();
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
28 endif
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
29
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
30 msg = "";
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
31 fcn = missing_component_hook ();
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
32
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
33 ftype = exist (fcn);
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
34 if (ftype == 2 || ftype == 3 || ftype == 5 || ftype == 103)
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
35 msg = feval (fcn, component);
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
36 endif
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
37
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
38 if (isempty (msg))
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
39 switch (component)
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
40 case "info-file"
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
41 msg = "unable to find the Octave info manual, Octave installation is incomplete";
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
42 case "mkoctfile"
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
43 msg = "unable to find the mkoctfile command, Octave installation is incomplete";
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
44 case "octave"
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
45 msg = "unable to find the octave executable, Octave installation is incomplete";
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
46 case "octave-config"
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
47 msg = "unable to find the octave-config command, Octave installation is incomplete";
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
48 otherwise
19204
a6d44158bc6d __gripe_missing_component__.m: Add BIST tests.
Rik <rik@octave.org>
parents: 19186
diff changeset
49 msg = ['unable to find required Octave component "' component '"'];
17516
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
50 endswitch
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
51 endif
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
52
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
53 error ("%s: %s\n", caller, msg);
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
54
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
55 endfunction
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
diff changeset
56
19204
a6d44158bc6d __gripe_missing_component__.m: Add BIST tests.
Rik <rik@octave.org>
parents: 19186
diff changeset
57
a6d44158bc6d __gripe_missing_component__.m: Add BIST tests.
Rik <rik@octave.org>
parents: 19186
diff changeset
58 ## Some trivial testing
a6d44158bc6d __gripe_missing_component__.m: Add BIST tests.
Rik <rik@octave.org>
parents: 19186
diff changeset
59 %!error <abc: unable to find the Octave info manual> __gripe_missing_component__ ("abc", "info-file")
a6d44158bc6d __gripe_missing_component__.m: Add BIST tests.
Rik <rik@octave.org>
parents: 19186
diff changeset
60 %!error <abc: unable to find the octave executable> __gripe_missing_component__ ("abc", "octave")
a6d44158bc6d __gripe_missing_component__.m: Add BIST tests.
Rik <rik@octave.org>
parents: 19186
diff changeset
61 %!error <abc: unable to find the octave-config command> __gripe_missing_component__ ("abc", "octave-config")
a6d44158bc6d __gripe_missing_component__.m: Add BIST tests.
Rik <rik@octave.org>
parents: 19186
diff changeset
62 %!error <abc: unable to find required Octave component "xyz"> __gripe_missing_component__ ("abc", "xyz")
a6d44158bc6d __gripe_missing_component__.m: Add BIST tests.
Rik <rik@octave.org>
parents: 19186
diff changeset
63
a6d44158bc6d __gripe_missing_component__.m: Add BIST tests.
Rik <rik@octave.org>
parents: 19186
diff changeset
64 %!error __gripe_missing_component__ ()
a6d44158bc6d __gripe_missing_component__.m: Add BIST tests.
Rik <rik@octave.org>
parents: 19186
diff changeset
65 %!error __gripe_missing_component__ ("fcn")
a6d44158bc6d __gripe_missing_component__.m: Add BIST tests.
Rik <rik@octave.org>
parents: 19186
diff changeset
66 %!error __gripe_missing_component__ ("fcn", 1 , 2)
a6d44158bc6d __gripe_missing_component__.m: Add BIST tests.
Rik <rik@octave.org>
parents: 19186
diff changeset
67