GNU Octave  4.0.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-2015 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_map;
30 class octave_value_list;
31 class unwind_protect;
32 
33 #define panic_impossible() \
34  panic ("impossible state reached in file '%s' at line %d", __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);
141 extern OCTINTERP_API std::string last_warning_message (void);
142 extern OCTINTERP_API std::string last_warning_id (void);
143 
145 
146 #endif
OCTINTERP_API void vusage_with_id(const char *id, const char *fmt, va_list args)
Definition: error.cc:427
OCTINTERP_API void vmessage_with_id(const char *id, const char *name, const char *fmt, va_list args)
Definition: error.cc:389
OCTINTERP_API void verror_with_id_cfn(const char *id, const char *fmt, va_list args)
Definition: error.cc:515
OCTINTERP_API void vusage(const char *fmt, va_list args)
Definition: error.cc:412
static uint32_t state[624]
Definition: randmtzig.c:188
OCTINTERP_API void initialize_default_warning_state(void)
Definition: error.cc:1743
OCTINTERP_API void panic(const char *fmt,...) GCC_ATTR_NORETURN
Definition: error.cc:744
CRUFT_API int long GCC_ATTR_NORETURN
Definition: f77-fcn.h:289
OCTINTERP_API void reset_error_handler(void)
Definition: error.cc:124
OCTINTERP_API void warning_with_id(const char *id, const char *fmt,...)
Definition: error.cc:696
OCTINTERP_API octave_value_list set_warning_state(const std::string &id, const std::string &state)
Definition: error.cc:1720
STL namespace.
OCTINTERP_API void message(const char *name, const char *fmt,...)
Definition: error.cc:380
OCTINTERP_API void vparse_error_with_id(const char *id, const char *fmt, va_list args)
Definition: error.cc:720
OCTINTERP_API void vmessage(const char *name, const char *fmt, va_list args)
Definition: error.cc:374
OCTINTERP_API void message_with_id(const char *id, const char *name, const char *fmt,...)
Definition: error.cc:396
OCTINTERP_API void error(const char *fmt,...)
Definition: error.cc:476
OCTINTERP_API void usage_with_id(const char *id, const char *fmt,...)
Definition: error.cc:433
OCTINTERP_API void verror(const char *fmt, va_list args)
Definition: error.cc:470
OCTINTERP_API void error_with_id(const char *id, const char *fmt,...)
Definition: error.cc:506
OCTINTERP_API void usage(const char *fmt,...)
Definition: error.cc:418
OCTINTERP_API void disable_warning(const std::string &id)
Definition: error.cc:1737
OCTINTERP_API bool discard_error_messages
Definition: error.cc:118
#define OCTINTERP_API
Definition: mexproto.h:66
OCTINTERP_API std::string last_warning_id(void)
Definition: error.cc:2155
OCTINTERP_API std::string last_error_id(void)
Definition: error.cc:2137
OCTINTERP_API bool Vdebug_on_warning
Definition: error.cc:62
OCTINTERP_API void verror_with_id(const char *id, const char *fmt, va_list args)
Definition: error.cc:500
OCTINTERP_API int warning_enabled(const std::string &id)
Definition: error.cc:552
OCTINTERP_API bool discard_warning_messages
Definition: error.cc:121
OCTINTERP_API std::string last_error_message(void)
Definition: error.cc:2131
OCTINTERP_API int error_state
Definition: error.cc:101
OCTINTERP_API void error_with_id_cfn(const char *id, const char *fmt,...)
Definition: error.cc:521
OCTINTERP_API bool Vdebug_on_error
Definition: error.cc:58
OCTINTERP_API octave_map last_error_stack(void)
Definition: error.cc:2143
OCTINTERP_API void parse_error(const char *fmt,...)
Definition: error.cc:711
OCTINTERP_API int warning_state
Definition: error.cc:110
OCTINTERP_API void vparse_error(const char *fmt, va_list args)
Definition: error.cc:705
OCTINTERP_API int buffer_error_messages
Definition: error.cc:115
OCTINTERP_API void verror_with_cfn(const char *fmt, va_list args)
Definition: error.cc:485
OCTINTERP_API void interpreter_try(unwind_protect &)
Definition: error.cc:2161
OCTINTERP_API std::string last_warning_message(void)
Definition: error.cc:2149
OCTINTERP_API void vwarning_with_id(const char *id, const char *fmt, va_list args)
Definition: error.cc:690
OCTINTERP_API void error_with_cfn(const char *fmt,...)
Definition: error.cc:491
OCTINTERP_API void defun_usage_message(const std::string &msg)
Definition: error.cc:765
OCTINTERP_API void warning(const char *fmt,...)
Definition: error.cc:681
OCTINTERP_API void parse_error_with_id(const char *id, const char *fmt,...)
Definition: error.cc:726
OCTINTERP_API void vwarning(const char *fmt, va_list args)
Definition: error.cc:675