GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
lo-error.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1996-2025 The Octave Project Developers
4//
5// See the file COPYRIGHT.md in the top-level directory of this
6// distribution or <https://octave.org/copyright/>.
7//
8// This file is part of Octave.
9//
10// Octave is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// Octave is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Octave; see the file COPYING. If not, see
22// <https://www.gnu.org/licenses/>.
23//
24////////////////////////////////////////////////////////////////////////
25
26#if ! defined (octave_lo_error_h)
27#define octave_lo_error_h 1
28
29#include "octave-config.h"
30
31#if defined (__cplusplus)
32extern "C" {
33#endif
34
35OCTAVE_NORETURN extern OCTAVE_API void
36liboctave_fatal (const char *fmt, ...);
37
38OCTAVE_NORETURN extern OCTAVE_API void
39liboctave_fatal_with_id (const char *id, const char *fmt, ...);
40
41extern OCTAVE_API void
42liboctave_warning (const char *fmt, ...);
43
44extern OCTAVE_API void
45liboctave_warning_with_id (const char *id, const char *fmt, ...);
46
47typedef void (*liboctave_error_handler) (const char *, ...);
48
49typedef void (*liboctave_error_with_id_handler) (const char *, const char *, ...);
50
51typedef void (*liboctave_warning_handler) (const char *, ...);
52
53typedef void (*liboctave_warning_with_id_handler) (const char *, const char *, ...);
54
55/* Would be nice to make these pointers private, but we want to share
56 them among all the liboctave classes. */
57OCTAVE_FORMAT_PRINTF (1, 2)
58OCTAVE_NORETURN extern OCTAVE_API liboctave_error_handler
60
61OCTAVE_FORMAT_PRINTF (2, 3)
64
65OCTAVE_FORMAT_PRINTF (1, 2)
67
68OCTAVE_FORMAT_PRINTF (2, 3)
71
72extern OCTAVE_API void
74
75extern OCTAVE_API void
77
78extern OCTAVE_API void
80
81extern OCTAVE_API void
83
84// To allow the __FILE__ and __LINE__ macros to work as expected, the
85// liboctave_panic_impossible, liboctave_panic_if, and
86// liboctave_panic_unless symbols must be defined as macros.
87
88#if defined (NDEBUG)
89
90# define liboctave_panic_impossible() do { } while (0)
91
92# define liboctave_panic_if(cond) do { } while (0)
93
94# define liboctave_panic_unless(cond) do { } while (0)
95
96#else
97
98# define liboctave_panic_impossible() (*current_liboctave_error_handler) ("impossible state reached in file '%s' at line %d", __FILE__, __LINE__)
99
100# define liboctave_panic_if(cond) do { if (cond) liboctave_panic_impossible (); } while (0)
101
102# define liboctave_panic_unless(cond) liboctave_panic_if (! (cond))
103
104#endif
105
106#if defined (__cplusplus)
107}
108#endif
109
110#endif
void set_liboctave_error_handler(OCTAVE_NORETURN liboctave_error_handler f)
Definition lo-error.c:67
OCTAVE_NORETURN liboctave_error_with_id_handler current_liboctave_error_with_id_handler
Definition lo-error.c:45
OCTAVE_NORETURN void liboctave_fatal_with_id(const char *id, const char *fmt,...)
Definition lo-error.c:115
void liboctave_warning(const char *fmt,...)
Definition lo-error.c:128
void(* liboctave_error_with_id_handler)(const char *, const char *,...)
Definition lo-error.h:49
OCTAVE_NORETURN liboctave_error_handler current_liboctave_error_handler
Definition lo-error.c:41
void(* liboctave_error_handler)(const char *,...)
Definition lo-error.h:47
void set_liboctave_warning_handler(liboctave_warning_handler f)
Definition lo-error.c:86
void set_liboctave_error_with_id_handler(OCTAVE_NORETURN liboctave_error_with_id_handler f)
Definition lo-error.c:76
void set_liboctave_warning_with_id_handler(liboctave_warning_with_id_handler f)
Definition lo-error.c:95
void(* liboctave_warning_with_id_handler)(const char *, const char *,...)
Definition lo-error.h:53
OCTAVE_NORETURN void liboctave_fatal(const char *fmt,...)
Definition lo-error.c:104
liboctave_warning_handler current_liboctave_warning_handler
Definition lo-error.c:49
liboctave_warning_with_id_handler current_liboctave_warning_with_id_handler
Definition lo-error.c:53
void(* liboctave_warning_handler)(const char *,...)
Definition lo-error.h:51
void liboctave_warning_with_id(const char *id, const char *fmt,...)
Definition lo-error.c:137
F77_RET_T const F77_DBLE const F77_DBLE * f
#define OCTAVE_API
Definition main.in.cc:55