Mercurial > octave-nkf
annotate libinterp/corefcn/error.h @ 18221:6ef8b920a7d6 gui-release
include stack in exception variable (bug #41117)
* error.h, error.cc (last_error_stack): New function.
* pt-eval.cc (tree_evaluator::visit_try_catch_command): Include stack
information in err variable.
author | Stefan Mahr <dac922@gmx.de> |
---|---|
date | Tue, 20 Aug 2013 18:57:48 +0200 |
parents | 175b392e91fe |
children | 4197fc428c7d |
rev | line source |
---|---|
1 | 1 /* |
2 | |
17744
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
16892
diff
changeset
|
3 Copyright (C) 1993-2013 John W. Eaton |
1 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
1 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
1 | 20 |
21 */ | |
22 | |
383 | 23 #if !defined (octave_error_h) |
24 #define octave_error_h 1 | |
1 | 25 |
6355 | 26 #include <cstdarg> |
3935 | 27 #include <string> |
1489 | 28 |
18221
6ef8b920a7d6
include stack in exception variable (bug #41117)
Stefan Mahr <dac922@gmx.de>
parents:
17787
diff
changeset
|
29 class octave_map; |
10605
1834132fb50b
allow non-integer ranges as indices conditionally
John W. Eaton <jwe@octave.org>
parents:
10313
diff
changeset
|
30 class octave_value_list; |
11029
4ab04ea74b08
make an internal function for try simulation
Jaroslav Hajek <highegg@gmail.com>
parents:
10605
diff
changeset
|
31 class unwind_protect; |
10605
1834132fb50b
allow non-integer ranges as indices conditionally
John W. Eaton <jwe@octave.org>
parents:
10313
diff
changeset
|
32 |
1 | 33 #define panic_impossible() \ |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
34 panic ("impossible state reached in file '%s' at line %d", \ |
10313 | 35 __FILE__, __LINE__) |
1 | 36 |
6109 | 37 extern OCTINTERP_API void reset_error_handler (void); |
4318 | 38 |
6109 | 39 extern OCTINTERP_API int warning_enabled (const std::string& id); |
5781 | 40 |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
41 extern OCTINTERP_API void |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
42 vmessage (const char *name, const char *fmt, va_list args); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
43 |
6109 | 44 extern OCTINTERP_API void message (const char *name, const char *fmt, ...); |
6338 | 45 |
46 extern OCTINTERP_API void vusage (const char *fmt, va_list args); | |
6109 | 47 extern OCTINTERP_API void usage (const char *fmt, ...); |
6338 | 48 |
49 extern OCTINTERP_API void vwarning (const char *fmt, va_list args); | |
6109 | 50 extern OCTINTERP_API void warning (const char *fmt, ...); |
6338 | 51 |
52 extern OCTINTERP_API void verror (const char *fmt, va_list args); | |
6109 | 53 extern OCTINTERP_API void error (const char *fmt, ...); |
6338 | 54 |
9753
892e2aa7bc75
improve error messages by auto-prepending current function name
Jaroslav Hajek <highegg@gmail.com>
parents:
7977
diff
changeset
|
55 extern OCTINTERP_API void verror_with_cfn (const char *fmt, va_list args); |
892e2aa7bc75
improve error messages by auto-prepending current function name
Jaroslav Hajek <highegg@gmail.com>
parents:
7977
diff
changeset
|
56 extern OCTINTERP_API void error_with_cfn (const char *fmt, ...); |
892e2aa7bc75
improve error messages by auto-prepending current function name
Jaroslav Hajek <highegg@gmail.com>
parents:
7977
diff
changeset
|
57 |
6338 | 58 extern OCTINTERP_API void vparse_error (const char *fmt, va_list args); |
6109 | 59 extern OCTINTERP_API void parse_error (const char *fmt, ...); |
5567 | 60 |
6109 | 61 extern OCTINTERP_API void |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
62 vmessage_with_id (const char *id, const char *name, |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
63 const char *fmt, va_list args); |
6338 | 64 |
65 extern OCTINTERP_API void | |
5567 | 66 message_with_id (const char *id, const char *name, const char *fmt, ...); |
67 | |
6109 | 68 extern OCTINTERP_API void |
6338 | 69 vusage_with_id (const char *id, const char *fmt, va_list args); |
70 | |
71 extern OCTINTERP_API void | |
5567 | 72 usage_with_id (const char *id, const char *fmt, ...); |
73 | |
6109 | 74 extern OCTINTERP_API void |
6338 | 75 vwarning_with_id (const char *id, const char *fmt, va_list args); |
76 | |
77 extern OCTINTERP_API void | |
5567 | 78 warning_with_id (const char *id, const char *fmt, ...); |
79 | |
6109 | 80 extern OCTINTERP_API void |
6338 | 81 verror_with_id (const char *id, const char *fmt, va_list args); |
82 | |
83 extern OCTINTERP_API void | |
5567 | 84 error_with_id (const char *id, const char *fmt, ...); |
85 | |
6109 | 86 extern OCTINTERP_API void |
9753
892e2aa7bc75
improve error messages by auto-prepending current function name
Jaroslav Hajek <highegg@gmail.com>
parents:
7977
diff
changeset
|
87 verror_with_id_cfn (const char *id, const char *fmt, va_list args); |
892e2aa7bc75
improve error messages by auto-prepending current function name
Jaroslav Hajek <highegg@gmail.com>
parents:
7977
diff
changeset
|
88 |
892e2aa7bc75
improve error messages by auto-prepending current function name
Jaroslav Hajek <highegg@gmail.com>
parents:
7977
diff
changeset
|
89 extern OCTINTERP_API void |
892e2aa7bc75
improve error messages by auto-prepending current function name
Jaroslav Hajek <highegg@gmail.com>
parents:
7977
diff
changeset
|
90 error_with_id_cfn (const char *id, const char *fmt, ...); |
892e2aa7bc75
improve error messages by auto-prepending current function name
Jaroslav Hajek <highegg@gmail.com>
parents:
7977
diff
changeset
|
91 |
892e2aa7bc75
improve error messages by auto-prepending current function name
Jaroslav Hajek <highegg@gmail.com>
parents:
7977
diff
changeset
|
92 extern OCTINTERP_API void |
6338 | 93 vparse_error_with_id (const char *id, const char *fmt, va_list args); |
94 | |
95 extern OCTINTERP_API void | |
5567 | 96 parse_error_with_id (const char *id, const char *fmt, ...); |
97 | |
6109 | 98 extern OCTINTERP_API void panic (const char *fmt, ...) GCC_ATTR_NORETURN; |
1 | 99 |
4732 | 100 // Helper function for print_usage defined in defun.cc. |
6109 | 101 extern OCTINTERP_API void defun_usage_message (const std::string& msg); |
4732 | 102 |
10605
1834132fb50b
allow non-integer ranges as indices conditionally
John W. Eaton <jwe@octave.org>
parents:
10313
diff
changeset
|
103 extern OCTINTERP_API octave_value_list |
1834132fb50b
allow non-integer ranges as indices conditionally
John W. Eaton <jwe@octave.org>
parents:
10313
diff
changeset
|
104 set_warning_state (const std::string& id, const std::string& state); |
1834132fb50b
allow non-integer ranges as indices conditionally
John W. Eaton <jwe@octave.org>
parents:
10313
diff
changeset
|
105 |
1834132fb50b
allow non-integer ranges as indices conditionally
John W. Eaton <jwe@octave.org>
parents:
10313
diff
changeset
|
106 extern OCTINTERP_API octave_value_list |
1834132fb50b
allow non-integer ranges as indices conditionally
John W. Eaton <jwe@octave.org>
parents:
10313
diff
changeset
|
107 set_warning_state (const octave_value_list& args); |
1834132fb50b
allow non-integer ranges as indices conditionally
John W. Eaton <jwe@octave.org>
parents:
10313
diff
changeset
|
108 |
6109 | 109 extern OCTINTERP_API void disable_warning (const std::string& id); |
110 extern OCTINTERP_API void initialize_default_warning_state (void); | |
5794 | 111 |
7353 | 112 // TRUE means that Octave will try to enter the debugger when an error |
113 // is encountered. This will also inhibit printing of the normal | |
114 // traceback message (you will only see the top-level error message). | |
115 extern OCTINTERP_API bool Vdebug_on_error; | |
116 | |
117 // TRUE means that Octave will try to enter the debugger when a warning | |
118 // is encountered. | |
119 extern OCTINTERP_API bool Vdebug_on_warning; | |
120 | |
143 | 121 // Current error state. |
6109 | 122 extern OCTINTERP_API int error_state; |
143 | 123 |
3489 | 124 // Current warning state. |
6109 | 125 extern OCTINTERP_API int warning_state; |
3489 | 126 |
1489 | 127 // Tell the error handler whether to print messages, or just store |
128 // them for later. Used for handling errors in eval() and | |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
129 // the 'unwind_protect' statement. |
6109 | 130 extern OCTINTERP_API int buffer_error_messages; |
1489 | 131 |
3815 | 132 // TRUE means error messages are turned off. |
6109 | 133 extern OCTINTERP_API bool discard_error_messages; |
3815 | 134 |
4452 | 135 // TRUE means warning messages are turned off. |
6109 | 136 extern OCTINTERP_API bool discard_warning_messages; |
4452 | 137 |
7977
065c28e1c368
Modify Fcellfun to directly access the error message/id rather than use a call to Flasterr
David Bateman <dbateman@free.fr>
parents:
7353
diff
changeset
|
138 // Helper functions to pass last error and warning messages and ids |
065c28e1c368
Modify Fcellfun to directly access the error message/id rather than use a call to Flasterr
David Bateman <dbateman@free.fr>
parents:
7353
diff
changeset
|
139 extern OCTINTERP_API std::string last_error_message (void); |
065c28e1c368
Modify Fcellfun to directly access the error message/id rather than use a call to Flasterr
David Bateman <dbateman@free.fr>
parents:
7353
diff
changeset
|
140 extern OCTINTERP_API std::string last_error_id (void); |
18221
6ef8b920a7d6
include stack in exception variable (bug #41117)
Stefan Mahr <dac922@gmx.de>
parents:
17787
diff
changeset
|
141 extern OCTINTERP_API octave_map last_error_stack (void); |
7977
065c28e1c368
Modify Fcellfun to directly access the error message/id rather than use a call to Flasterr
David Bateman <dbateman@free.fr>
parents:
7353
diff
changeset
|
142 extern OCTINTERP_API std::string last_warning_message (void); |
065c28e1c368
Modify Fcellfun to directly access the error message/id rather than use a call to Flasterr
David Bateman <dbateman@free.fr>
parents:
7353
diff
changeset
|
143 extern OCTINTERP_API std::string last_warning_id (void); |
065c28e1c368
Modify Fcellfun to directly access the error message/id rather than use a call to Flasterr
David Bateman <dbateman@free.fr>
parents:
7353
diff
changeset
|
144 |
11029
4ab04ea74b08
make an internal function for try simulation
Jaroslav Hajek <highegg@gmail.com>
parents:
10605
diff
changeset
|
145 extern OCTINTERP_API void interpreter_try (unwind_protect&); |
4ab04ea74b08
make an internal function for try simulation
Jaroslav Hajek <highegg@gmail.com>
parents:
10605
diff
changeset
|
146 |
1 | 147 #endif |