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
gripes.cc
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 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26 
27 #include "defun.h"
28 #include "error.h"
29 #include "gripes.h"
30 #include "oct-obj.h"
31 #include "utils.h"
32 
33 void
34 gripe_not_supported (const char *fcn)
35 {
36  error ("%s: not supported on this system", fcn);
37 }
38 
39 void
40 gripe_not_implemented (const char *fcn)
41 {
42  error ("%s: not implemented", fcn);
43 }
44 
45 void
47 {
48  error ("std::string constant used in invalid context");
49 }
50 
51 void
53 {
54  error ("range constant used in invalid context");
55 }
56 
57 void
59 {
60  error ("nonconformant matrices");
61 }
62 
63 void
66 {
67  error ("nonconformant matrices (op1 is %dx%d, op2 is %dx%d)",
68  r1, c1, r2, c2);
69 }
70 
71 void
72 gripe_empty_arg (const char *name, bool is_error)
73 {
74  if (is_error)
75  error ("%s: empty matrix is invalid as an argument", name);
76  else
77  warning ("%s: argument is empty matrix", name);
78 }
79 
80 void
81 gripe_square_matrix_required (const char *name)
82 {
83  error ("%s: argument must be a square matrix", name);
84 }
85 
86 void
87 gripe_user_supplied_eval (const char *name)
88 {
89  error ("%s: evaluation of user-supplied function failed", name);
90 }
91 
92 void
93 gripe_user_returned_invalid (const char *name)
94 {
95  error ("%s: user-supplied function returned invalid value", name);
96 }
97 
98 void
99 gripe_invalid_conversion (const std::string& from, const std::string& to)
100 {
101  error ("invalid conversion from %s to %s", from.c_str (), to.c_str ());
102 }
103 
104 void
106 {
107  warning ("invalid value specified for '%s'", name);
108 }
109 
110 void
112 {
113  error ("plot: can only plot in 2 or 3 dimensions");
114 }
115 
116 void
118 {
119  error ("unrecognized floating point format requested");
120 }
121 
122 void
123 gripe_unrecognized_data_fmt (const char *warn_for)
124 {
125  error ("%s: unrecognized data format requested", warn_for);
126 }
127 
128 void
129 gripe_data_conversion (const char *from, const char *to)
130 {
131  error ("unable to convert from %s to %s format", from, to);
132 }
133 
134 void
135 gripe_wrong_type_arg (const char *name, const char *s, bool is_error)
136 {
137  if (is_error)
138  error ("%s: wrong type argument '%s'", name, s);
139  else
140  warning ("%s: wrong type argument '%s'", name, s);
141 }
142 
143 void
144 gripe_wrong_type_arg (const char *name, const std::string& s, bool is_error)
145 {
146  gripe_wrong_type_arg (name, s.c_str (), is_error);
147 }
148 
149 void
150 gripe_wrong_type_arg (const char *name, const octave_value& tc,
151  bool is_error)
152 {
153  std::string type = tc.type_name ();
154 
155  gripe_wrong_type_arg (name, type, is_error);
156 }
157 
158 void
159 gripe_wrong_type_arg (const std::string& name, const octave_value& tc,
160  bool is_error)
161 {
162  gripe_wrong_type_arg (name.c_str (), tc, is_error);
163 }
164 
165 void
167 {
168  std::string type = op.type_name ();
169  error ("invalid operand '%s' for unary operator", type.c_str ());
170 }
171 
172 void
174 {
175  std::string type = op.type_name ();
176  error ("invalid operand '%s' for binary operator", type.c_str ());
177 }
178 
179 void
180 gripe_implicit_conversion (const char *id, const char *from, const char *to)
181 {
182  warning_with_id (id, "implicit conversion from %s to %s", from, to);
183 }
184 
185 void
186 gripe_implicit_conversion (const std::string& id,
187  const std::string& from, const std::string& to)
188 {
189  warning_with_id (id.c_str (),
190  "implicit conversion from %s to %s",
191  from.c_str (), to.c_str ());
192 }
193 
194 void
196 {
197  warning_with_id ("Octave:divide-by-zero", "division by zero");
198 }
199 
200 void
202 {
203  warning_with_id ("Octave:logical-conversion",
204  "value not equal to 1 or 0 converted to logical 1");
205 }
206 
207 void
209 {
211 
212  if (! error_state)
213  error ("caught execution error in library function");
214 }
215 
216 void
218 {
219  error ("invalid dimension inquiry of a non-existent value");
220 }
221 
222 void
224 {
225  error ("a cs-list cannot be further indexed");
226 }
227 
228 void
230 {
231  error ("invalid assignment to cs-list outside multiple assignment");
232 }
233 
234 void
236 {
237  warning_with_id ("Octave:language-extension",
238  "comparing complex numbers is not supported in Matlab");
239 }
240 
241 void
242 gripe_disabled_feature (const std::string& func, const std::string& feature,
243  const std::string& pkg /*="Octave"*/)
244 {
245  error ("%s: support for %s was disabled when %s was built",
246  func.c_str (), feature.c_str (), pkg.c_str ());
247 }
248 
249 void
250 gripe_data_file_in_path (const std::string& fcn, const std::string& file)
251 {
252  warning_with_id ("Octave:data-file-in-path",
253  "%s: '%s' found by searching load path",
254  fcn.c_str (), file.c_str ());
255 }
void gripe_implicit_conversion(const char *id, const char *from, const char *to)
Definition: gripes.cc:180
void warning_with_id(const char *id, const char *fmt,...)
Definition: error.cc:696
void gripe_wrong_type_arg(const char *name, const char *s, bool is_error)
Definition: gripes.cc:135
void gripe_wrong_type_arg_for_unary_op(const octave_value &op)
Definition: gripes.cc:166
void gripe_wrong_type_arg_for_binary_op(const octave_value &op)
Definition: gripes.cc:173
void gripe_nonconformant(void)
Definition: gripes.cc:58
void error(const char *fmt,...)
Definition: error.cc:476
void gripe_library_execution_error(void)
Definition: gripes.cc:208
void gripe_square_matrix_required(const char *name)
Definition: gripes.cc:81
void gripe_invalid_inquiry_subscript(void)
Definition: gripes.cc:217
void gripe_range_invalid(void)
Definition: gripes.cc:52
void gripe_not_supported(const char *fcn)
Definition: gripes.cc:34
void gripe_user_returned_invalid(const char *name)
Definition: gripes.cc:93
void gripe_indexed_cs_list(void)
Definition: gripes.cc:223
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type octave_idx_type r2
void gripe_data_file_in_path(const std::string &fcn, const std::string &file)
Definition: gripes.cc:250
void gripe_nonbraced_cs_list_assignment(void)
Definition: gripes.cc:229
void gripe_disabled_feature(const std::string &func, const std::string &feature, const std::string &pkg)
Definition: gripes.cc:242
void gripe_not_implemented(const char *fcn)
Definition: gripes.cc:40
sig_atomic_t octave_exception_state
Definition: cquit.c:82
int error_state
Definition: error.cc:101
void gripe_string_invalid(void)
Definition: gripes.cc:46
void gripe_unrecognized_data_fmt(const char *warn_for)
Definition: gripes.cc:123
void gripe_empty_arg(const char *name, bool is_error)
Definition: gripes.cc:72
void gripe_data_conversion(const char *from, const char *to)
Definition: gripes.cc:129
void warning(const char *fmt,...)
Definition: error.cc:681
std::string type_name(void) const
Definition: ov.h:1047
void gripe_logical_conversion(void)
Definition: gripes.cc:201
void gripe_warn_complex_cmp(void)
Definition: gripes.cc:235
void gripe_invalid_conversion(const std::string &from, const std::string &to)
Definition: gripes.cc:99
void gripe_unrecognized_float_fmt(void)
Definition: gripes.cc:117
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type octave_idx_type octave_idx_type c1
static MArray< double > const octave_idx_type const octave_idx_type octave_idx_type r1
void gripe_invalid_value_specified(const char *name)
Definition: gripes.cc:105
void gripe_2_or_3_dim_plot(void)
Definition: gripes.cc:111
void gripe_divide_by_zero(void)
Definition: gripes.cc:195
void gripe_user_supplied_eval(const char *name)
Definition: gripes.cc:87