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
lo-error.c
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-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 (HAVE_CONFIG_H)
24 # include "config.h"
25 #endif
26 
27 #include <stdarg.h>
28 #include <stdio.h>
29 #include <stdlib.h>
30 
31 #include "lo-error.h"
32 
33 /* Having this file in this directory is a kluge to avoid unresolved
34  symbol errors when creating shared versions of libcruft. */
35 
36 /* Pointer to the current error handling function. */
37 OCTAVE_NORETURN liboctave_error_handler
39 
40 /* Pointer to the current error_with_id handling function. */
41 OCTAVE_NORETURN liboctave_error_with_id_handler
43 
44 /* Pointer to the current warning handler. */
47 
48 /* Pointer to the current warning_with_id handler. */
51 
52 static void
53 verror (const char *name, const char *fmt, va_list args)
54 {
55  if (name)
56  fprintf (stderr, "%s: ", name);
57 
58  vfprintf (stderr, fmt, args);
59  fprintf (stderr, "\n");
60  fflush (stderr);
61 }
62 
63 void
65 {
66  if (f)
68  else
70 }
71 
72 void
75 {
76  if (f)
78  else
80 }
81 
82 void
84 {
85  if (f)
87  else
89 }
90 
91 void
93 {
94  if (f)
96  else
98 }
99 
100 void
101 liboctave_fatal (const char *fmt, ...)
102 {
103  va_list args;
104  va_start (args, fmt);
105  verror ("fatal", fmt, args);
106  va_end (args);
107 
108  exit (1);
109 }
110 
111 void
112 liboctave_fatal_with_id (const char *id, const char *fmt, ...)
113 {
114  octave_unused_parameter (id);
115 
116  va_list args;
117  va_start (args, fmt);
118  verror ("fatal", fmt, args);
119  va_end (args);
120 
121  exit (1);
122 }
123 
124 void
125 liboctave_warning (const char *fmt, ...)
126 {
127  va_list args;
128  va_start (args, fmt);
129  verror ("warning", fmt, args);
130  va_end (args);
131 }
132 
133 void
134 liboctave_warning_with_id (const char *id, const char *fmt, ...)
135 {
136  octave_unused_parameter (id);
137 
138  va_list args;
139  va_start (args, fmt);
140  verror ("warning", fmt, args);
141  va_end (args);
142 }
void liboctave_warning_with_id(const char *id, const char *fmt,...)
Definition: lo-error.c:134
void liboctave_warning(const char *fmt,...)
Definition: lo-error.c:125
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE const F77_DBLE * f
OCTAVE_NORETURN liboctave_error_handler current_liboctave_error_handler
Definition: lo-error.c:38
static void verror(const char *name, const char *fmt, va_list args)
Definition: lo-error.c:53
void liboctave_fatal_with_id(const char *id, const char *fmt,...)
Definition: lo-error.c:112
OCTAVE_NORETURN liboctave_error_with_id_handler current_liboctave_error_with_id_handler
Definition: lo-error.c:42
liboctave_warning_with_id_handler current_liboctave_warning_with_id_handler
Definition: lo-error.c:50
void set_liboctave_warning_with_id_handler(liboctave_warning_with_id_handler f)
Definition: lo-error.c:92
JNIEnv void * args
Definition: ov-java.cc:67
void set_liboctave_error_with_id_handler(OCTAVE_NORETURN liboctave_error_with_id_handler f)
Definition: lo-error.c:73
void liboctave_fatal(const char *fmt,...)
Definition: lo-error.c:101
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
void(* liboctave_warning_with_id_handler)(const char *, const char *,...)
Definition: lo-error.h:51
liboctave_warning_handler current_liboctave_warning_handler
Definition: lo-error.c:46
void set_liboctave_warning_handler(liboctave_warning_handler f)
Definition: lo-error.c:83
void set_liboctave_error_handler(OCTAVE_NORETURN liboctave_error_handler f)
Definition: lo-error.c:64
void(* liboctave_error_with_id_handler)(const char *, const char *,...)
Definition: lo-error.h:46
void(* liboctave_warning_handler)(const char *,...)
Definition: lo-error.h:49
void(* liboctave_error_handler)(const char *,...)
Definition: lo-error.h:44
enum echo_state fflush