Mercurial > hg > octave-nkf
annotate src/error.h @ 12385:c468c5b902b3 release-3-4-x ss-3-3-92
version is now 3.3.92
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 06 Feb 2011 06:27:19 -0500 |
parents | fd0a3ac60b0e |
children | 72c96de7a403 |
rev | line source |
---|---|
1 | 1 /* |
2 | |
11523 | 3 Copyright (C) 1993-2011 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 |
10605
1834132fb50b
allow non-integer ranges as indices conditionally
John W. Eaton <jwe@octave.org>
parents:
10313
diff
changeset
|
29 class octave_value_list; |
11029
4ab04ea74b08
make an internal function for try simulation
Jaroslav Hajek <highegg@gmail.com>
parents:
10605
diff
changeset
|
30 class unwind_protect; |
10605
1834132fb50b
allow non-integer ranges as indices conditionally
John W. Eaton <jwe@octave.org>
parents:
10313
diff
changeset
|
31 |
1 | 32 #define panic_impossible() \ |
33 panic ("impossible state reached in file `%s' at line %d", \ | |
10313 | 34 __FILE__, __LINE__) |
1 | 35 |
6109 | 36 extern OCTINTERP_API void reset_error_handler (void); |
4318 | 37 |
6109 | 38 extern OCTINTERP_API int warning_enabled (const std::string& id); |
5781 | 39 |
6338 | 40 extern OCTINTERP_API void vmessage (const char *name, const char *fmt, va_list args); |
6109 | 41 extern OCTINTERP_API void message (const char *name, const char *fmt, ...); |
6338 | 42 |
43 extern OCTINTERP_API void vusage (const char *fmt, va_list args); | |
6109 | 44 extern OCTINTERP_API void usage (const char *fmt, ...); |
6338 | 45 |
46 extern OCTINTERP_API void vwarning (const char *fmt, va_list args); | |
6109 | 47 extern OCTINTERP_API void warning (const char *fmt, ...); |
6338 | 48 |
49 extern OCTINTERP_API void verror (const char *fmt, va_list args); | |
6109 | 50 extern OCTINTERP_API void error (const char *fmt, ...); |
6338 | 51 |
9753
892e2aa7bc75
improve error messages by auto-prepending current function name
Jaroslav Hajek <highegg@gmail.com>
parents:
7977
diff
changeset
|
52 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
|
53 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
|
54 |
6338 | 55 extern OCTINTERP_API void vparse_error (const char *fmt, va_list args); |
6109 | 56 extern OCTINTERP_API void parse_error (const char *fmt, ...); |
5567 | 57 |
6109 | 58 extern OCTINTERP_API void |
6338 | 59 vmessage_with_id (const char *id, const char *name, const char *fmt, va_list args); |
60 | |
61 extern OCTINTERP_API void | |
5567 | 62 message_with_id (const char *id, const char *name, const char *fmt, ...); |
63 | |
6109 | 64 extern OCTINTERP_API void |
6338 | 65 vusage_with_id (const char *id, const char *fmt, va_list args); |
66 | |
67 extern OCTINTERP_API void | |
5567 | 68 usage_with_id (const char *id, const char *fmt, ...); |
69 | |
6109 | 70 extern OCTINTERP_API void |
6338 | 71 vwarning_with_id (const char *id, const char *fmt, va_list args); |
72 | |
73 extern OCTINTERP_API void | |
5567 | 74 warning_with_id (const char *id, const char *fmt, ...); |
75 | |
6109 | 76 extern OCTINTERP_API void |
6338 | 77 verror_with_id (const char *id, const char *fmt, va_list args); |
78 | |
79 extern OCTINTERP_API void | |
5567 | 80 error_with_id (const char *id, const char *fmt, ...); |
81 | |
6109 | 82 extern OCTINTERP_API void |
9753
892e2aa7bc75
improve error messages by auto-prepending current function name
Jaroslav Hajek <highegg@gmail.com>
parents:
7977
diff
changeset
|
83 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
|
84 |
892e2aa7bc75
improve error messages by auto-prepending current function name
Jaroslav Hajek <highegg@gmail.com>
parents:
7977
diff
changeset
|
85 extern OCTINTERP_API void |
892e2aa7bc75
improve error messages by auto-prepending current function name
Jaroslav Hajek <highegg@gmail.com>
parents:
7977
diff
changeset
|
86 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
|
87 |
892e2aa7bc75
improve error messages by auto-prepending current function name
Jaroslav Hajek <highegg@gmail.com>
parents:
7977
diff
changeset
|
88 extern OCTINTERP_API void |
6338 | 89 vparse_error_with_id (const char *id, const char *fmt, va_list args); |
90 | |
91 extern OCTINTERP_API void | |
5567 | 92 parse_error_with_id (const char *id, const char *fmt, ...); |
93 | |
6109 | 94 extern OCTINTERP_API void panic (const char *fmt, ...) GCC_ATTR_NORETURN; |
1 | 95 |
4732 | 96 // Helper function for print_usage defined in defun.cc. |
6109 | 97 extern OCTINTERP_API void defun_usage_message (const std::string& msg); |
4732 | 98 |
10605
1834132fb50b
allow non-integer ranges as indices conditionally
John W. Eaton <jwe@octave.org>
parents:
10313
diff
changeset
|
99 extern OCTINTERP_API octave_value_list |
1834132fb50b
allow non-integer ranges as indices conditionally
John W. Eaton <jwe@octave.org>
parents:
10313
diff
changeset
|
100 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
|
101 |
1834132fb50b
allow non-integer ranges as indices conditionally
John W. Eaton <jwe@octave.org>
parents:
10313
diff
changeset
|
102 extern OCTINTERP_API octave_value_list |
1834132fb50b
allow non-integer ranges as indices conditionally
John W. Eaton <jwe@octave.org>
parents:
10313
diff
changeset
|
103 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
|
104 |
6109 | 105 extern OCTINTERP_API void disable_warning (const std::string& id); |
106 extern OCTINTERP_API void initialize_default_warning_state (void); | |
5794 | 107 |
7353 | 108 // TRUE means that Octave will try to enter the debugger when an error |
109 // is encountered. This will also inhibit printing of the normal | |
110 // traceback message (you will only see the top-level error message). | |
111 extern OCTINTERP_API bool Vdebug_on_error; | |
112 | |
113 // TRUE means that Octave will try to enter the debugger when a warning | |
114 // is encountered. | |
115 extern OCTINTERP_API bool Vdebug_on_warning; | |
116 | |
143 | 117 // Current error state. |
6109 | 118 extern OCTINTERP_API int error_state; |
143 | 119 |
3489 | 120 // Current warning state. |
6109 | 121 extern OCTINTERP_API int warning_state; |
3489 | 122 |
1489 | 123 // Tell the error handler whether to print messages, or just store |
124 // them for later. Used for handling errors in eval() and | |
125 // the `unwind_protect' statement. | |
6109 | 126 extern OCTINTERP_API int buffer_error_messages; |
1489 | 127 |
3815 | 128 // TRUE means error messages are turned off. |
6109 | 129 extern OCTINTERP_API bool discard_error_messages; |
3815 | 130 |
4452 | 131 // TRUE means warning messages are turned off. |
6109 | 132 extern OCTINTERP_API bool discard_warning_messages; |
4452 | 133 |
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
|
134 // 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
|
135 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
|
136 extern OCTINTERP_API std::string last_error_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
|
137 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
|
138 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
|
139 |
11029
4ab04ea74b08
make an internal function for try simulation
Jaroslav Hajek <highegg@gmail.com>
parents:
10605
diff
changeset
|
140 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
|
141 |
1 | 142 #endif |