error.h

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 1993-2012 John W. Eaton
00004 
00005 This file is part of Octave.
00006 
00007 Octave is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 3 of the License, or (at your
00010 option) any later version.
00011 
00012 Octave is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Octave; see the file COPYING.  If not, see
00019 <http://www.gnu.org/licenses/>.
00020 
00021 */
00022 
00023 #if !defined (octave_error_h)
00024 #define octave_error_h 1
00025 
00026 #include <cstdarg>
00027 #include <string>
00028 
00029 class octave_value_list;
00030 class unwind_protect;
00031 
00032 #define panic_impossible() \
00033   panic ("impossible state reached in file '%s' at line %d", \
00034          __FILE__, __LINE__)
00035 
00036 extern OCTINTERP_API void reset_error_handler (void);
00037 
00038 extern OCTINTERP_API int warning_enabled (const std::string& id);
00039 
00040 extern OCTINTERP_API void vmessage (const char *name, const char *fmt, va_list args);
00041 extern OCTINTERP_API void message (const char *name, const char *fmt, ...);
00042 
00043 extern OCTINTERP_API void vusage (const char *fmt, va_list args);
00044 extern OCTINTERP_API void usage (const char *fmt, ...);
00045 
00046 extern OCTINTERP_API void vwarning (const char *fmt, va_list args);
00047 extern OCTINTERP_API void warning (const char *fmt, ...);
00048 
00049 extern OCTINTERP_API void verror (const char *fmt, va_list args);
00050 extern OCTINTERP_API void error (const char *fmt, ...);
00051 
00052 extern OCTINTERP_API void verror_with_cfn (const char *fmt, va_list args);
00053 extern OCTINTERP_API void error_with_cfn (const char *fmt, ...);
00054 
00055 extern OCTINTERP_API void vparse_error (const char *fmt, va_list args);
00056 extern OCTINTERP_API void parse_error (const char *fmt, ...);
00057 
00058 extern OCTINTERP_API void
00059 vmessage_with_id (const char *id, const char *name, const char *fmt, va_list args);
00060 
00061 extern OCTINTERP_API void
00062 message_with_id (const char *id, const char *name, const char *fmt, ...);
00063 
00064 extern OCTINTERP_API void
00065 vusage_with_id (const char *id, const char *fmt, va_list args);
00066 
00067 extern OCTINTERP_API void
00068 usage_with_id (const char *id, const char *fmt, ...);
00069 
00070 extern OCTINTERP_API void
00071 vwarning_with_id (const char *id, const char *fmt, va_list args);
00072 
00073 extern OCTINTERP_API void
00074 warning_with_id (const char *id, const char *fmt, ...);
00075 
00076 extern OCTINTERP_API void
00077 verror_with_id (const char *id, const char *fmt, va_list args);
00078 
00079 extern OCTINTERP_API void
00080 error_with_id (const char *id, const char *fmt, ...);
00081 
00082 extern OCTINTERP_API void
00083 verror_with_id_cfn (const char *id, const char *fmt, va_list args);
00084 
00085 extern OCTINTERP_API void
00086 error_with_id_cfn (const char *id, const char *fmt, ...);
00087 
00088 extern OCTINTERP_API void
00089 vparse_error_with_id (const char *id, const char *fmt, va_list args);
00090 
00091 extern OCTINTERP_API void
00092 parse_error_with_id (const char *id, const char *fmt, ...);
00093 
00094 extern OCTINTERP_API void panic (const char *fmt, ...) GCC_ATTR_NORETURN;
00095 
00096 // Helper function for print_usage defined in defun.cc.
00097 extern OCTINTERP_API void defun_usage_message (const std::string& msg);
00098 
00099 extern OCTINTERP_API octave_value_list
00100 set_warning_state (const std::string& id, const std::string& state);
00101 
00102 extern OCTINTERP_API octave_value_list
00103 set_warning_state (const octave_value_list& args);
00104 
00105 extern OCTINTERP_API void disable_warning (const std::string& id);
00106 extern OCTINTERP_API void initialize_default_warning_state (void);
00107 
00108 // TRUE means that Octave will try to enter the debugger when an error
00109 // is encountered.  This will also inhibit printing of the normal
00110 // traceback message (you will only see the top-level error message).
00111 extern OCTINTERP_API bool Vdebug_on_error;
00112 
00113 // TRUE means that Octave will try to enter the debugger when a warning
00114 // is encountered.
00115 extern OCTINTERP_API bool Vdebug_on_warning;
00116 
00117 // Current error state.
00118 extern OCTINTERP_API int error_state;
00119 
00120 // Current warning state.
00121 extern OCTINTERP_API int warning_state;
00122 
00123 // Tell the error handler whether to print messages, or just store
00124 // them for later.  Used for handling errors in eval() and
00125 // the 'unwind_protect' statement.
00126 extern OCTINTERP_API int buffer_error_messages;
00127 
00128 // TRUE means error messages are turned off.
00129 extern OCTINTERP_API bool discard_error_messages;
00130 
00131 // TRUE means warning messages are turned off.
00132 extern OCTINTERP_API bool discard_warning_messages;
00133 
00134 // Helper functions to pass last error and warning messages and ids
00135 extern OCTINTERP_API std::string last_error_message (void);
00136 extern OCTINTERP_API std::string last_error_id (void);
00137 extern OCTINTERP_API std::string last_warning_message (void);
00138 extern OCTINTERP_API std::string last_warning_id (void);
00139 
00140 extern OCTINTERP_API void interpreter_try (unwind_protect&);
00141 
00142 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines