GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
error.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1993-2013 John W. Eaton
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
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
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
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if !defined (octave_error_h)
24 #define octave_error_h 1
25 
26 #include <cstdarg>
27 #include <string>
28 
29 class octave_value_list;
30 class unwind_protect;
31 
32 #define panic_impossible() \
33  panic ("impossible state reached in file '%s' at line %d", \
34  __FILE__, __LINE__)
35 
36 extern OCTINTERP_API void reset_error_handler (void);
37 
38 extern OCTINTERP_API int warning_enabled (const std::string& id);
39 
40 extern OCTINTERP_API void
41 vmessage (const char *name, const char *fmt, va_list args);
42 
43 extern OCTINTERP_API void message (const char *name, const char *fmt, ...);
44 
45 extern OCTINTERP_API void vusage (const char *fmt, va_list args);
46 extern OCTINTERP_API void usage (const char *fmt, ...);
47 
48 extern OCTINTERP_API void vwarning (const char *fmt, va_list args);
49 extern OCTINTERP_API void warning (const char *fmt, ...);
50 
51 extern OCTINTERP_API void verror (const char *fmt, va_list args);
52 extern OCTINTERP_API void error (const char *fmt, ...);
53 
54 extern OCTINTERP_API void verror_with_cfn (const char *fmt, va_list args);
55 extern OCTINTERP_API void error_with_cfn (const char *fmt, ...);
56 
57 extern OCTINTERP_API void vparse_error (const char *fmt, va_list args);
58 extern OCTINTERP_API void parse_error (const char *fmt, ...);
59 
60 extern OCTINTERP_API void
61 vmessage_with_id (const char *id, const char *name,
62  const char *fmt, va_list args);
63 
64 extern OCTINTERP_API void
65 message_with_id (const char *id, const char *name, const char *fmt, ...);
66 
67 extern OCTINTERP_API void
68 vusage_with_id (const char *id, const char *fmt, va_list args);
69 
70 extern OCTINTERP_API void
71 usage_with_id (const char *id, const char *fmt, ...);
72 
73 extern OCTINTERP_API void
74 vwarning_with_id (const char *id, const char *fmt, va_list args);
75 
76 extern OCTINTERP_API void
77 warning_with_id (const char *id, const char *fmt, ...);
78 
79 extern OCTINTERP_API void
80 verror_with_id (const char *id, const char *fmt, va_list args);
81 
82 extern OCTINTERP_API void
83 error_with_id (const char *id, const char *fmt, ...);
84 
85 extern OCTINTERP_API void
86 verror_with_id_cfn (const char *id, const char *fmt, va_list args);
87 
88 extern OCTINTERP_API void
89 error_with_id_cfn (const char *id, const char *fmt, ...);
90 
91 extern OCTINTERP_API void
92 vparse_error_with_id (const char *id, const char *fmt, va_list args);
93 
94 extern OCTINTERP_API void
95 parse_error_with_id (const char *id, const char *fmt, ...);
96 
97 extern OCTINTERP_API void panic (const char *fmt, ...) GCC_ATTR_NORETURN;
98 
99 // Helper function for print_usage defined in defun.cc.
100 extern OCTINTERP_API void defun_usage_message (const std::string& msg);
101 
103 set_warning_state (const std::string& id, const std::string& state);
104 
107 
108 extern OCTINTERP_API void disable_warning (const std::string& id);
110 
111 // TRUE means that Octave will try to enter the debugger when an error
112 // is encountered. This will also inhibit printing of the normal
113 // traceback message (you will only see the top-level error message).
114 extern OCTINTERP_API bool Vdebug_on_error;
115 
116 // TRUE means that Octave will try to enter the debugger when a warning
117 // is encountered.
118 extern OCTINTERP_API bool Vdebug_on_warning;
119 
120 // Current error state.
121 extern OCTINTERP_API int error_state;
122 
123 // Current warning state.
124 extern OCTINTERP_API int warning_state;
125 
126 // Tell the error handler whether to print messages, or just store
127 // them for later. Used for handling errors in eval() and
128 // the 'unwind_protect' statement.
130 
131 // TRUE means error messages are turned off.
133 
134 // TRUE means warning messages are turned off.
136 
137 // Helper functions to pass last error and warning messages and ids
138 extern OCTINTERP_API std::string last_error_message (void);
139 extern OCTINTERP_API std::string last_error_id (void);
140 extern OCTINTERP_API std::string last_warning_message (void);
141 extern OCTINTERP_API std::string last_warning_id (void);
142 
144 
145 #endif