annotate libinterp/corefcn/error.h @ 27471:fd32c1a9b1bd

revamp error handling In "error" and similar functions that ultimately call it, simply throw an exception that contains information about the error (message, id, stack info) instead of printing an error message immediately and then throwing an exception. The new approach is more flexible and sllows for some simplification of the error message routines as they no longer need feedback from the interpreter to know when to display or buffer messages. It is now the responsibility of any code that catches an execution exception to determine whether and when to display error messages. * quit.h, quit.cc (class frame_info): New class. (execution_exception::m_err_type, execution_exception::m_id, execution_exception::m_message, execution_exception::m_stack_info): New data members. (class execution_exception): Store error type, message, id, and stack info. Provide methods setting and accessing data as needed and for generating stack trace message from stack info. (execution_exception::m_stack_trace): Delete data member. execution_exception::set_stack_trace): Delete method. (execution_exception::set_err_type, execution_exception::err_type, execution_exception::stack_trace, execution_exception::set_identifier, execution_exception::identifier, execution_exception::message, execution_exception::set_stack_info, execution_exception::display): New methods. * call-stack.cc, call-stack.h (call_stack::backtrace_info): New functions. * oct-parse.yy (maybe_print_last_error_message): Delete function and all uses. * pt-eval.h, pt-eval.cc (tree_evaluator::backtrace_info, tree_evaluator::backtrace_message): New functions. (tree_evaluator::backtrace): Now const. (tree_evaluator::visit_unwind_protect_command, tree_evaluator::do_unwind_protect_cleanup_code, tree_evaluator::visit_try_catch_command, tree_evaluator::evalin, tree_evaluator::eval, tree_evaluator::repl, debugger::repl): Save current exception info. * interpreter.h, interpreter.cc (interpreter::handle_exception): New function. Use it in place of direct calls to error_system::save_exception, error_system::display_exception (or execution_exception::display) and interpreter::recover_from_exception, so that we have uniform behavior when responding to an execution exception. * error.h, error.cc (error_system::m_buffer_error_messages, error_system::m_discard_error_messages, error_system::m_in_try_catch): Delete data members and associated functions. Remove all uses. Because the error system no longer displays messages immediately, it does not need to track whether to discard or buffer error messages or know whether error and warning functions are invoked inside of try-catch blocks. Everywhere that catches execution_exceptions must now handle saving the exception state (for lasterror) and displaying the error message and traceback as needed. (): Delete functions and all uses. (error_stack_frame): Delete struct definition. (verror, vpr_where, pr_where_internal, pr_where, maybe_enter_debugger, make_execution_exception, vmessage_with_id, message_with_id, error_system::maybe_enter_debugger, reset_error_handler, error_system::reset): Delete functions and all uses. (error_system::try_option): Delete enum and all uses. (vusage, error_1, error_system::vwarning, error_system::rethrow_error, error_system::interpreter_try): Simplify. (format_message, make_stack_map, error_system::throw_error, error_system::save_exception, error_system::display_exception): New functions. (Ferror): Update for error_system changes.
author John W. Eaton <jwe@octave.org>
date Fri, 04 Oct 2019 01:15:13 -0400
parents 7883e6e71b0a
children c0883bfc0f36
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
1 /*
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
2
26376
00f796120a6d maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents: 26164
diff changeset
3 Copyright (C) 1993-2019 John W. Eaton
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
4
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
5 This file is part of Octave.
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
6
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23615
diff changeset
7 Octave is free software: you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
8 under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23615
diff changeset
9 the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
10 (at your option) any later version.
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
11
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
12 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
13 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
15 GNU General Public License for more details.
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
16
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6355
diff changeset
18 along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23615
diff changeset
19 <https://www.gnu.org/licenses/>.
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
20
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
21 */
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
22
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 20785
diff changeset
23 #if ! defined (octave_error_h)
383
0b52c68ec81f [project @ 1994-03-09 21:19:44 by jwe]
jwe
parents: 240
diff changeset
24 #define octave_error_h 1
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
25
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21157
diff changeset
26 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21157
diff changeset
27
6355
7b124b265c34 [project @ 2007-02-25 16:25:52 by jwe]
jwe
parents: 6338
diff changeset
28 #include <cstdarg>
26164
7f6a50f73625 Silence compiler warnings about format identifier for octave_idx_type (bug #55046).
Markus Mützel <markus.muetzel@gmx.de>
parents: 26147
diff changeset
29 #include <cinttypes>
3935
1ea29376e43e [project @ 2002-05-16 05:30:51 by jwe]
jwe
parents: 3815
diff changeset
30 #include <string>
1489
3e705c864019 [project @ 1995-09-28 05:38:26 by jwe]
jwe
parents: 1428
diff changeset
31
21743
f4d7d0eb5b0c use namespace for unwind_protect class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
32 #include "unwind-prot.h"
f4d7d0eb5b0c use namespace for unwind_protect class
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
33
27160
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
34 #include "oct-map.h"
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
35
10605
1834132fb50b allow non-integer ranges as indices conditionally
John W. Eaton <jwe@octave.org>
parents: 10313
diff changeset
36 class octave_value_list;
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
37 namespace octave
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
38 {
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
39 class execution_exception;
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
40 }
10605
1834132fb50b allow non-integer ranges as indices conditionally
John W. Eaton <jwe@octave.org>
parents: 10313
diff changeset
41
27160
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
42 namespace octave
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
43 {
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
44 class error_system
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
45 {
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
46 public:
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
47
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
48 error_system (interpreter& interp);
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
49
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
50 error_system (const error_system&) = delete;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
51
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
52 error_system& operator = (const error_system&) = delete;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
53
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
54 ~error_system (void) = default;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
55
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
56 octave_value debug_on_error (const octave_value_list& args, int nargout);
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
57
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
58 void set_debug_on_error (bool flag) { m_debug_on_error = flag; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
59
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
60 bool debug_on_error (void) const { return m_debug_on_error; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
61
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
62 bool debug_on_error (bool flag)
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
63 {
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
64 bool val = m_debug_on_error;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
65 m_debug_on_error = flag;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
66 return val;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
67 }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
68
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
69 octave_value debug_on_caught (const octave_value_list& args, int nargout);
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
70
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
71 void set_debug_on_caught (bool flag) { m_debug_on_caught = flag; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
72
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
73 bool debug_on_caught (void) const { return m_debug_on_caught; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
74
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
75 bool debug_on_caught (bool flag)
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
76 {
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
77 bool val = m_debug_on_caught;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
78 m_debug_on_caught = flag;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
79 return val;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
80 }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
81
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
82 octave_value debug_on_warning (const octave_value_list& args, int nargout);
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
83
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
84 void set_debug_on_warning (bool flag) { m_debug_on_warning = flag; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
85
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
86 bool debug_on_warning (void) const { return m_debug_on_warning; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
87
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
88 bool debug_on_warning (bool flag)
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
89 {
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
90 bool val = m_debug_on_warning;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
91 m_debug_on_warning = flag;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
92 return val;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
93 }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
94
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
95 octave_value discard_warning_messages (const octave_value_list& args, int nargout);
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
96
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
97 void set_discard_warning_messages (bool flag) { m_discard_warning_messages = flag; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
98
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
99 bool discard_warning_messages (void) const { return m_discard_warning_messages; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
100
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
101 bool discard_warning_messages (bool flag)
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
102 {
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
103 bool val = m_discard_warning_messages;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
104 m_discard_warning_messages = flag;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
105 return val;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
106 }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
107
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
108 octave_value beep_on_error (const octave_value_list& args, int nargout);
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
109
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
110 void set_beep_on_error (bool flag) { m_beep_on_error = flag; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
111
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
112 bool beep_on_error (void) const { return m_beep_on_error; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
113
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
114 bool beep_on_error (bool flag)
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
115 {
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
116 bool val = m_beep_on_error;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
117 m_beep_on_error = flag;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
118 return val;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
119 }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
120
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
121 octave_value backtrace_on_warning (const octave_value_list& args, int nargout);
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
122
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
123 void set_backtrace_on_warning (bool flag) { m_backtrace_on_warning = flag; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
124
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
125 bool backtrace_on_warning (void) const { return m_backtrace_on_warning; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
126
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
127 bool backtrace_on_warning (bool flag)
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
128 {
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
129 bool val = m_backtrace_on_warning;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
130 m_backtrace_on_warning = flag;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
131 return val;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
132 }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
133
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
134 octave_value verbose_warning (const octave_value_list& args, int nargout);
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
135
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
136 void set_verbose_warning (bool flag) { m_verbose_warning = flag; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
137
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
138 bool verbose_warning (void) const { return m_verbose_warning; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
139
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
140 bool verbose_warning (bool flag)
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
141 {
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
142 bool val = m_verbose_warning;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
143 m_verbose_warning = flag;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
144 return val;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
145 }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
146
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
147 octave_value quiet_warning (const octave_value_list& args, int nargout);
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
148
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
149 void set_quiet_warning (bool flag) { m_quiet_warning = flag; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
150
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
151 bool quiet_warning (void) const { return m_quiet_warning; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
152
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
153 bool quiet_warning (bool flag)
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
154 {
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
155 bool val = m_quiet_warning;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
156 m_quiet_warning = flag;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
157 return val;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
158 }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
159
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
160 octave_map warning_options (void) const { return m_warning_options; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
161
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
162 void set_warning_options (const octave_map& val) { m_warning_options = val; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
163
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
164 octave_map warning_options (const octave_map& new_val)
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
165 {
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
166 octave_map val = m_warning_options;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
167 m_warning_options = new_val;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
168 return val;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
169 }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
170
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
171 octave_value last_error_message (const octave_value_list& args, int nargout);
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
172
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
173 void set_last_error_message (const std::string& val) { m_last_error_message = val; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
174
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
175 std::string last_error_message (void) const { return m_last_error_message; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
176
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
177 std::string last_error_message (const std::string& s)
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
178 {
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
179 std::string val = m_last_error_message;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
180 m_last_error_message = s;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
181 return val;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
182 }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
183
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
184 octave_value last_warning_message (const octave_value_list& args, int nargout);
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
185
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
186 void set_last_warning_message (const std::string& val) { m_last_warning_message = val; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
187
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
188 std::string last_warning_message (void) const { return m_last_warning_message; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
189
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
190 std::string last_warning_message (const std::string& s)
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
191 {
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
192 std::string val = m_last_warning_message;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
193 m_last_warning_message = s;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
194 return val;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
195 }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
196
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
197 octave_value last_warning_id (const octave_value_list& args, int nargout);
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
198
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
199 void set_last_warning_id (const std::string& val) { m_last_warning_id = val; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
200
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
201 std::string last_warning_id (void) const { return m_last_warning_id; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
202
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
203 std::string last_warning_id (const std::string& s)
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
204 {
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
205 std::string val = m_last_warning_id;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
206 m_last_warning_id = s;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
207 return val;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
208 }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
209
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
210 octave_value last_error_id (const octave_value_list& args, int nargout);
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
211
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
212 void set_last_error_id (const std::string& val) { m_last_error_id = val; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
213
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
214 std::string last_error_id (void) const { return m_last_error_id; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
215
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
216 std::string last_error_id (const std::string& s)
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
217 {
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
218 std::string val = m_last_error_id;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
219 m_last_error_id = s;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
220 return val;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
221 }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
222
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
223 void set_last_error_stack (const octave_map& val)
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
224 {
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
225 m_last_error_stack = val;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
226 }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
227
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
228 octave_map last_error_stack (void) const { return m_last_error_stack; }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
229
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
230 octave_map last_error_stack (const octave_map& new_val)
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
231 {
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
232 octave_map val = m_last_error_stack;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
233 m_last_error_stack = new_val;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
234 return val;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
235 }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
236
27161
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
237 //! For given warning ID, return 0 if warnings are disabled, 1 if
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
238 //! enabled, and 2 if the given ID should be an error instead of a
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
239 //! warning.
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
240
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
241 int warning_enabled (const std::string& id);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
242
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
243 void verror (bool save_last_error, std::ostream& os, const char *name,
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
244 const char *id, const char *fmt, va_list args,
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
245 bool with_cfn = false);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
246
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
247 void vwarning (const char *name, const char *id, const char *fmt,
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
248 va_list args);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
249
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
250 OCTAVE_NORETURN
27471
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
251 void error_1 (execution_exception& e, const char *id, const char *fmt,
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
252 va_list args);
27161
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
253
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
254 OCTAVE_NORETURN
27471
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
255 void error_1 (const char *id, const char *fmt, va_list args);
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
256
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
257 OCTAVE_NORETURN
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
258 void vusage (const char *id, const char *fmt, va_list args);
27161
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
259
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
260 void vwarning (const char *id, const char *fmt, va_list args);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
261
27471
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
262 OCTAVE_NORETURN
27161
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
263 void rethrow_error (const std::string& id, const std::string& msg,
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
264 const octave_map& stack);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
265
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
266 OCTAVE_NORETURN
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
267 void vpanic (const char *fmt, va_list args);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
268
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
269 OCTAVE_NORETURN
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
270 void panic (const char *fmt, ...);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
271
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
272 octave_scalar_map warning_query (const std::string& id_arg);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
273
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
274 std::string default_warning_state (void);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
275
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
276 void display_warning_options (std::ostream& os);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
277
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
278 void set_warning_option (const std::string& state, const std::string& id);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
279
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
280 void disable_warning (const std::string& id);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
281
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
282 void initialize_default_warning_state (void);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
283
27471
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
284 void interpreter_try (octave::unwind_protect& frame);
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
285
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
286 // Throw execution_exception or, if debug_on_error is TRUE, enter
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
287 // debugger. If stack_info is empty, use current call stack.
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
288
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
289 OCTAVE_NORETURN
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
290 void throw_error (const std::string& err_type,
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
291 const std::string& id,
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
292 const std::string& message,
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
293 const std::list<frame_info>& stack_info
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
294 = std::list<frame_info> ());
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
295
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
296 OCTAVE_NORETURN
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
297 void throw_error (execution_exception& e);
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
298
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
299 void save_exception (const execution_exception& e);
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
300
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
301 void display_exception (const execution_exception& e,
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
302 std::ostream& os) const;
27161
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
303
27160
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
304 private:
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
305
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
306 interpreter& m_interpreter;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
307
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
308 //! TRUE means that Octave will try to enter the debugger when an error
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
309 //! is encountered. This will also inhibit printing of the normal
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
310 //! traceback message (you will only see the top-level error message).
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
311
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
312 bool m_debug_on_error;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
313
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
314 //! TRUE means that Octave will try to enter the debugger when an error
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
315 //! is encountered within the 'try' section of a 'try' / 'catch' block.
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
316
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
317 bool m_debug_on_caught;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
318
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
319 //! TRUE means that Octave will try to enter the debugger when a warning
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
320 //! is encountered.
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
321
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
322 bool m_debug_on_warning;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
323
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
324 //! TRUE means warning messages are turned off.
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
325
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
326 bool m_discard_warning_messages;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
327
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
328 //! TRUE means that Octave will try to beep obnoxiously before
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
329 //! printing error messages.
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
330 bool m_beep_on_error;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
331
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
332 //! TRUE means that Octave will try to display a stack trace when a
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
333 //! warning is encountered.
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
334 bool m_backtrace_on_warning;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
335
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
336 //! TRUE means that Octave will print a verbose warning. Currently
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
337 //! unused.
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
338 bool m_verbose_warning;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
339
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
340 //! TRUE means that Octave will print no warnings, but lastwarn will
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
341 //! be updated
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
342 bool m_quiet_warning;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
343
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
344 //! A structure containing (most of) the current state of warnings.
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
345 octave_map m_warning_options;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
346
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
347 //! The text of the last error message.
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
348 std::string m_last_error_message;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
349
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
350 //! The text of the last warning message.
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
351 std::string m_last_warning_message;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
352
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
353 //! The last warning message id.
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
354 std::string m_last_warning_id;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
355
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
356 //! The last error message id.
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
357 std::string m_last_error_id;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
358
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
359 //! The last file in which an error occurred.
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
360 octave_map m_last_error_stack;
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
361 };
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
362 }
6b0c61a5a0f0 move global error configuration and status variables inside a class
John W. Eaton <jwe@octave.org>
parents: 27129
diff changeset
363
27161
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
364 // FIXME: should we move the following functions inside the octave
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
365 // namespace? If so, should the functions outside of the namespace be
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
366 // deprecated? Doing that might cause a lot of trouble... If they are
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
367 // not deprecated and eventually removed, does it make sense to also
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
368 // define them inside the octave namespace?
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
369
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
370 #define panic_impossible() \
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
371 panic ("impossible state reached in file '%s' at line %d", __FILE__, __LINE__)
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
372
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
373 extern OCTINTERP_API int warning_enabled (const std::string& id);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
374
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
375 extern OCTINTERP_API void
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
376 vmessage (const char *name, const char *fmt, va_list args);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
377
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
378 OCTAVE_FORMAT_PRINTF (2, 3)
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
379 extern OCTINTERP_API void message (const char *name, const char *fmt, ...);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
380
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
381 extern OCTINTERP_API void vwarning (const char *fmt, va_list args);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
382
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
383 OCTAVE_FORMAT_PRINTF (1, 2)
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
384 extern OCTINTERP_API void warning (const char *fmt, ...);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
385
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
386 OCTAVE_NORETURN
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
387 extern OCTINTERP_API void verror (const char *fmt, va_list args);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
388
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
389 OCTAVE_FORMAT_PRINTF (1, 2)
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
390 OCTAVE_NORETURN
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
391 extern OCTINTERP_API void error (const char *fmt, ...);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
392
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
393 OCTAVE_NORETURN
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
394 extern OCTINTERP_API void
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
395 verror (octave::execution_exception&, const char *fmt, va_list args);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
396
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
397 OCTAVE_FORMAT_PRINTF (2, 3)
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
398 OCTAVE_NORETURN
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
399 extern OCTINTERP_API void
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
400 error (octave::execution_exception&, const char *fmt, ...);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
401
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
402 OCTAVE_NORETURN
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
403 extern OCTINTERP_API void
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
404 verror_with_cfn (const char *fmt, va_list args);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
405
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
406 OCTAVE_FORMAT_PRINTF (1, 2)
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
407 OCTAVE_NORETURN
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
408 extern OCTINTERP_API void
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
409 error_with_cfn (const char *fmt, ...);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
410
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
411 OCTAVE_NORETURN
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
412 extern OCTINTERP_API void
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
413 vparse_error (const char *fmt, va_list args);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
414
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
415 OCTAVE_FORMAT_PRINTF (1, 2)
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
416 OCTAVE_NORETURN
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
417 extern OCTINTERP_API void
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
418 parse_error (const char *fmt, ...);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
419
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
420 OCTAVE_NORETURN
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
421 extern OCTINTERP_API void
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
422 vusage_with_id (const char *id, const char *fmt, va_list args);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
423
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
424 OCTAVE_FORMAT_PRINTF (2, 3)
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
425 OCTAVE_NORETURN
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
426 extern OCTINTERP_API void
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
427 usage_with_id (const char *id, const char *fmt, ...);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
428
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
429 extern OCTINTERP_API void
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
430 vwarning_with_id (const char *id, const char *fmt, va_list args);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
431
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
432 OCTAVE_FORMAT_PRINTF (2, 3)
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
433 extern OCTINTERP_API void
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
434 warning_with_id (const char *id, const char *fmt, ...);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
435
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
436 OCTAVE_NORETURN
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
437 extern OCTINTERP_API void
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
438 verror_with_id (const char *id, const char *fmt, va_list args);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
439
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
440 OCTAVE_FORMAT_PRINTF (2, 3)
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
441 OCTAVE_NORETURN
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
442 extern OCTINTERP_API void
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
443 error_with_id (const char *id, const char *fmt, ...);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
444
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
445 OCTAVE_NORETURN
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
446 extern OCTINTERP_API void
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
447 verror_with_id_cfn (const char *id, const char *fmt, va_list args);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
448
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
449 OCTAVE_FORMAT_PRINTF (2, 3)
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
450 OCTAVE_NORETURN
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
451 extern OCTINTERP_API void
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
452 error_with_id_cfn (const char *id, const char *fmt, ...);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
453
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
454 OCTAVE_NORETURN
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
455 extern OCTINTERP_API void
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
456 vparse_error_with_id (const char *id, const char *fmt, va_list args);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
457
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
458 OCTAVE_FORMAT_PRINTF (2, 3)
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
459 OCTAVE_NORETURN
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
460 extern OCTINTERP_API void
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
461 parse_error_with_id (const char *id, const char *fmt, ...);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
462
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
463 OCTAVE_NORETURN
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
464 extern OCTINTERP_API void vpanic (const char *fmt, va_list args);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
465
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
466 OCTAVE_FORMAT_PRINTF (1, 2)
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
467 OCTAVE_NORETURN
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
468 extern OCTINTERP_API void panic (const char *fmt, ...);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
469
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
470 //! Helper function for print_usage defined in defun.cc.
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
471
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
472 extern OCTINTERP_API void defun_usage_message (const std::string& msg);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
473
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
474 extern OCTINTERP_API octave_value_list
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
475 set_warning_state (const std::string& id, const std::string& state);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
476
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
477 extern OCTINTERP_API octave_value_list
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
478 set_warning_state (const octave_value_list& args);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
479
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
480 extern OCTINTERP_API void disable_warning (const std::string& id);
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
481
27471
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
482 extern OCTINTERP_API void interpreter_try (octave::unwind_protect&);
27161
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
483
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
484 OCTAVE_DEPRECATED (6, "this variable is obsolete and always has the value 0")
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
485 extern OCTINTERP_API int error_state;
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
486
27471
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
487 OCTAVE_DEPRECATED (6, "this function is obsolete and should not be needed")
fd32c1a9b1bd revamp error handling
John W. Eaton <jwe@octave.org>
parents: 27161
diff changeset
488 inline void reset_error_handler (void) { }
27161
7883e6e71b0a additional refactoring of error handling functions
John W. Eaton <jwe@octave.org>
parents: 27160
diff changeset
489
1
78fd87e624cb [project @ 1993-08-08 01:13:40 by jwe]
jwe
parents:
diff changeset
490 #endif