GNU Octave  4.2.1
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-2017 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 "octave-config.h"
27 
28 #include <cstdarg>
29 #include <string>
30 
31 #include "unwind-prot.h"
32 
33 class octave_map;
34 class octave_value_list;
35 namespace octave
36 {
37  class execution_exception;
38 }
39 
40 #define panic_impossible() \
41  panic ("impossible state reached in file '%s' at line %d", __FILE__, __LINE__)
42 
43 extern OCTINTERP_API void reset_error_handler (void);
44 
45 extern OCTINTERP_API int warning_enabled (const std::string& id);
46 
47 extern OCTINTERP_API void
48 vmessage (const char *name, const char *fmt, va_list args);
49 
50 extern OCTINTERP_API void message (const char *name, const char *fmt, ...);
51 
52 OCTAVE_DEPRECATED ("use 'print_usage' or 'verror' instead")
53 OCTAVE_NORETURN OCTINTERP_API extern
54 void vusage (const char *fmt, va_list args);
55 
56 OCTAVE_DEPRECATED ("use 'print_usage' or 'error' instead")
57 OCTAVE_NORETURN OCTINTERP_API extern
58 void usage (const char *fmt, ...);
59 
60 extern OCTINTERP_API void vwarning (const char *fmt, va_list args);
61 extern OCTINTERP_API void warning (const char *fmt, ...);
62 
63 OCTAVE_NORETURN OCTINTERP_API extern
64 void verror (const char *fmt, va_list args);
65 
66 OCTAVE_NORETURN OCTINTERP_API extern
67 void error (const char *fmt, ...);
68 
69 OCTAVE_NORETURN OCTINTERP_API extern
70 void verror (octave::execution_exception&, const char *fmt, va_list args);
71 OCTAVE_NORETURN OCTINTERP_API extern
72 void error (octave::execution_exception&, const char *fmt, ...);
73 
74 OCTAVE_NORETURN OCTINTERP_API extern
75 void verror_with_cfn (const char *fmt, va_list args);
76 OCTAVE_NORETURN OCTINTERP_API extern
77 void error_with_cfn (const char *fmt, ...);
78 
79 OCTAVE_NORETURN OCTINTERP_API extern
80 void vparse_error (const char *fmt, va_list args);
81 OCTAVE_NORETURN OCTINTERP_API extern
82 void parse_error (const char *fmt, ...);
83 
84 extern OCTINTERP_API void
85 vmessage_with_id (const char *id, const char *name,
86  const char *fmt, va_list args);
87 
88 extern OCTINTERP_API void
89 message_with_id (const char *id, const char *name, const char *fmt, ...);
90 
91 OCTAVE_NORETURN OCTINTERP_API extern
92 void vusage_with_id (const char *id, const char *fmt, va_list args);
93 
94 OCTAVE_NORETURN OCTINTERP_API extern
95 void usage_with_id (const char *id, const char *fmt, ...);
96 
97 extern OCTINTERP_API void
98 vwarning_with_id (const char *id, const char *fmt, va_list args);
99 
100 extern OCTINTERP_API void
101 warning_with_id (const char *id, const char *fmt, ...);
102 
103 OCTAVE_NORETURN OCTINTERP_API extern
104 void verror_with_id (const char *id, const char *fmt, va_list args);
105 
106 OCTAVE_NORETURN OCTINTERP_API extern
107 void error_with_id (const char *id, const char *fmt, ...);
108 
109 OCTAVE_NORETURN OCTINTERP_API extern
110 void verror_with_id_cfn (const char *id, const char *fmt, va_list args);
111 
112 OCTAVE_NORETURN OCTINTERP_API extern
113 void error_with_id_cfn (const char *id, const char *fmt, ...);
114 
115 OCTAVE_NORETURN OCTINTERP_API extern
116 void vparse_error_with_id (const char *id, const char *fmt, va_list args);
117 
118 OCTAVE_NORETURN OCTINTERP_API extern
119 void parse_error_with_id (const char *id, const char *fmt, ...);
120 
121 OCTAVE_NORETURN OCTINTERP_API extern
122 void panic (const char *fmt, ...);
123 
124 // Helper function for print_usage defined in defun.cc.
125 extern OCTINTERP_API void defun_usage_message (const std::string& msg);
126 
128 set_warning_state (const std::string& id, const std::string& state);
129 
132 
133 extern OCTINTERP_API void disable_warning (const std::string& id);
135 
136 // TRUE means that Octave will try to enter the debugger when an error
137 // is encountered. This will also inhibit printing of the normal
138 // traceback message (you will only see the top-level error message).
139 extern OCTINTERP_API bool Vdebug_on_error;
140 
141 // TRUE means that Octave will try to enter the debugger when an error
142 // is encountered within the 'try' section of a 'try' / 'catch' block.
143 extern OCTINTERP_API bool Vdebug_on_caught;
144 
145 // TRUE means that Octave will try to enter the debugger when a warning
146 // is encountered.
147 extern OCTINTERP_API bool Vdebug_on_warning;
148 
149 // Current error state.
150 extern OCTINTERP_API int error_state;
151 
152 // Current warning state.
153 extern OCTINTERP_API int warning_state;
154 
155 // Tell the error handler whether to print messages, or just store
156 // them for later. Used for handling errors in eval() and
157 // the 'unwind_protect' statement.
159 
160 // The number of layers of try / catch blocks we're in. Used to print
161 // "caught error" instead of "error" when "dbstop if caught error" is on.
162 extern OCTINTERP_API int in_try_catch;
163 
164 // TRUE means error messages are turned off.
166 
167 // TRUE means warning messages are turned off.
169 
170 // Helper functions to pass last error and warning messages and ids
171 extern OCTINTERP_API std::string last_error_message (void);
172 extern OCTINTERP_API std::string last_error_id (void);
174 extern OCTINTERP_API std::string last_warning_message (void);
175 extern OCTINTERP_API std::string last_warning_id (void);
176 
177 extern OCTINTERP_API void interpreter_try (octave::unwind_protect&);
178 
179 #endif
OCTINTERP_API void vmessage_with_id(const char *id, const char *name, const char *fmt, va_list args)
Definition: error.cc:439
Octave interface to the compression and uncompression libraries.
Definition: aepbalance.cc:47
OCTINTERP_API bool Vdebug_on_caught
Definition: error.cc:65
OCTAVE_EXPORT octave_value_list or class The return code an ordinary file in Octave s or(after appending @samp{.m}) a function file in Octave's ode
Definition: variables.cc:582
OCTINTERP_API void initialize_default_warning_state(void)
OCTINTERP_API void print_usage(void)
Definition: defun.cc:52
OCTAVE_NORETURN OCTINTERP_API void error_with_id_cfn(const char *id, const char *fmt,...)
Definition: error.cc:630
OCTAVE_NORETURN OCTINTERP_API void vparse_error(const char *fmt, va_list args)
Definition: error.cc:812
OCTINTERP_API void reset_error_handler(void)
Definition: error.cc:124
OCTAVE_NORETURN OCTINTERP_API void panic(const char *fmt,...)
Definition: error.cc:931
OCTINTERP_API void warning_with_id(const char *id, const char *fmt,...)
Definition: error.cc:803
OCTINTERP_API int in_try_catch
Definition: error.cc:115
OCTINTERP_API octave_value_list set_warning_state(const std::string &id, const std::string &state)
STL namespace.
OCTINTERP_API void message(const char *name, const char *fmt,...)
Definition: error.cc:430
OCTAVE_NORETURN OCTINTERP_API void error_with_id(const char *id, const char *fmt,...)
Definition: error.cc:615
OCTINTERP_API void vmessage(const char *name, const char *fmt, va_list args)
Definition: error.cc:424
OCTINTERP_API void message_with_id(const char *id, const char *name, const char *fmt,...)
Definition: error.cc:446
OCTAVE_NORETURN OCTINTERP_API void parse_error(const char *fmt,...)
Definition: error.cc:818
JNIEnv void * args
Definition: ov-java.cc:67
OCTAVE_NORETURN OCTINTERP_API void vparse_error_with_id(const char *id, const char *fmt, va_list args)
Definition: error.cc:827
OCTAVE_EXPORT octave_value_list any number nd example oindent prints the prompt xample Pick a any number!nd example oindent and waits for the user to enter a value The string entered by the user is evaluated as an so it may be a literal a variable name
Definition: input.cc:871
OCTINTERP_API void disable_warning(const std::string &id)
OCTINTERP_API bool discard_error_messages
Definition: error.cc:118
#define OCTINTERP_API
Definition: mexproto.h:69
OCTINTERP_API std::string last_warning_id(void)
OCTAVE_NORETURN OCTINTERP_API void verror_with_id_cfn(const char *id, const char *fmt, va_list args)
Definition: error.cc:624
OCTAVE_NORETURN OCTINTERP_API void verror_with_id(const char *id, const char *fmt, va_list args)
Definition: error.cc:609
OCTAVE_NORETURN OCTINTERP_API void verror(const char *fmt, va_list args)
Definition: error.cc:564
OCTINTERP_API std::string last_error_id(void)
OCTINTERP_API bool Vdebug_on_warning
Definition: error.cc:69
OCTAVE_NORETURN OCTINTERP_API void usage_with_id(const char *id, const char *fmt,...)
Definition: error.cc:497
OCTINTERP_API int warning_enabled(const std::string &id)
Definition: error.cc:661
static uint32_t state[624]
Definition: randmtzig.cc:184
OCTINTERP_API bool discard_warning_messages
Definition: error.cc:121
OCTINTERP_API std::string last_error_message(void)
OCTINTERP_API int error_state
Definition: error.cc:106
OCTINTERP_API bool Vdebug_on_error
Definition: error.cc:61
OCTINTERP_API octave_map last_error_stack(void)
OCTAVE_NORETURN OCTINTERP_API void vusage(const char *fmt, va_list args)
Definition: error.cc:476
OCTINTERP_API int warning_state
OCTAVE_NORETURN OCTINTERP_API void vusage_with_id(const char *id, const char *fmt, va_list args)
Definition: error.cc:491
OCTAVE_NORETURN OCTINTERP_API void error(const char *fmt,...)
Definition: error.cc:570
OCTINTERP_API int buffer_error_messages
Definition: error.cc:111
OCTAVE_NORETURN OCTINTERP_API void verror_with_cfn(const char *fmt, va_list args)
Definition: error.cc:594
OCTINTERP_API std::string last_warning_message(void)
OCTINTERP_API void vwarning_with_id(const char *id, const char *fmt, va_list args)
Definition: error.cc:797
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:854
OCTINTERP_API void defun_usage_message(const std::string &msg)
Definition: error.cc:952
OCTAVE_NORETURN OCTINTERP_API void error_with_cfn(const char *fmt,...)
Definition: error.cc:600
OCTAVE_NORETURN OCTINTERP_API void usage(const char *fmt,...)
Definition: error.cc:482
OCTINTERP_API void warning(const char *fmt,...)
Definition: error.cc:788
OCTINTERP_API void interpreter_try(octave::unwind_protect &)
OCTAVE_NORETURN OCTINTERP_API void parse_error_with_id(const char *id, const char *fmt,...)
Definition: error.cc:833
OCTINTERP_API void vwarning(const char *fmt, va_list args)
Definition: error.cc:782