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
gripes.cc
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 // FIXME: All gripe_XXX functions deprecated in 4.2. Remove file in 4.6
24 
25 #if defined (HAVE_CONFIG_H)
26 # include "config.h"
27 #endif
28 
29 #include "defun.h"
30 #include "error.h"
31 #include "gripes.h"
32 #include "ovl.h"
33 #include "utils.h"
34 
35 ////////////////////////////////////////////////////////////////////////////////
36 // Alphabetized list of gripes.
37 ////////////////////////////////////////////////////////////////////////////////
38 
39 void
41 {
42  error ("plot: can only plot in 2 or 3 dimensions");
43 }
44 
45 void
46 gripe_data_conversion (const char *from, const char *to)
47 {
48  error ("unable to convert from %s to %s format", from, to);
49 }
50 
51 void
53 {
54  warning_with_id ("Octave:data-file-in-path",
55  "%s: '%s' found by searching load path",
56  fcn.c_str (), file.c_str ());
57 }
58 
59 void
61  const std::string& pkg /*="Octave"*/)
62 {
63  error ("%s: support for %s was unavailable or disabled when %s was built",
64  fcn.c_str (), feature.c_str (), pkg.c_str ());
65 }
66 
67 void
69 {
70  warning_with_id ("Octave:divide-by-zero", "division by zero");
71 }
72 
73 void
74 gripe_empty_arg (const char *name, bool is_error)
75 {
76  if (is_error)
77  error ("%s: empty matrix is invalid as an argument", name);
78  else
79  warning ("%s: argument is empty matrix", name);
80 }
81 
82 void
83 gripe_implicit_conversion (const char *id, const char *from, const char *to)
84 {
85  warning_with_id (id, "implicit conversion from %s to %s", from, to);
86 }
87 
88 void
90  const std::string& from, const std::string& to)
91 {
92  warning_with_id (id.c_str (),
93  "implicit conversion from %s to %s",
94  from.c_str (), to.c_str ());
95 }
96 
97 void
99 {
100  error ("a cs-list cannot be further indexed");
101 }
102 
103 void
105 {
106  error ("invalid conversion from %s to %s", from.c_str (), to.c_str ());
107 }
108 
109 void
111 {
112  error ("invalid dimension inquiry of a non-existent value");
113 }
114 
115 void
117 {
118  warning ("invalid value specified for '%s'", name);
119 }
120 
121 void
123 {
124  warning_with_id ("Octave:logical-conversion",
125  "value not equal to 1 or 0 converted to logical 1");
126 }
127 
128 void
130 {
131  error ("invalid assignment to cs-list outside multiple assignment");
132 }
133 
134 void
136 {
137  error ("nonconformant matrices");
138 }
139 
140 void
143 {
144  error ("nonconformant matrices (op1 is %dx%d, op2 is %dx%d)",
145  r1, c1, r2, c2);
146 }
147 
148 void
150 {
151  error ("%s: not implemented", fcn);
152 }
153 
154 // FIXME: Deprecated in 4.2, remove in 4.6
155 void
157 {
158  error ("%s: not supported on this system", fcn);
159 }
160 
161 void
163 {
164  error ("range constant used in invalid context");
165 }
166 
167 void
169 {
170  error ("%s: argument must be a square matrix", name);
171 }
172 
173 void
175 {
176  error ("std::string constant used in invalid context");
177 }
178 
179 void
180 gripe_unrecognized_data_fmt (const char *warn_for)
181 {
182  error ("%s: unrecognized data format requested", warn_for);
183 }
184 
185 void
187 {
188  error ("unrecognized floating point format requested");
189 }
190 
191 void
193 {
194  error ("%s: user-supplied function returned invalid value", name);
195 }
196 
197 void
199 {
200  octave::execution_exception e;
201 
202 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
203 # pragma GCC diagnostic push
204 # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
205 #endif
206 
207  gripe_user_supplied_eval (e, name);
208 
209 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
210 # pragma GCC diagnostic pop
211 #endif
212 }
213 
214 void
215 gripe_user_supplied_eval (octave::execution_exception& e,
216  const char *name)
217 {
218  error (e, "%s: evaluation of user-supplied function failed", name);
219 }
220 
221 void
223 {
224  warning_with_id ("Octave:language-extension",
225  "comparing complex numbers is not supported in Matlab");
226 }
227 
228 void
229 gripe_wrong_type_arg (const char *name, const char *s, bool is_error)
230 {
231  octave::execution_exception e;
232 
233 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
234 # pragma GCC diagnostic push
235 # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
236 #endif
237 
238  gripe_wrong_type_arg (e, name, s, is_error);
239 
240 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
241 # pragma GCC diagnostic pop
242 #endif
243 }
244 
245 void
246 gripe_wrong_type_arg (octave::execution_exception& e,
247  const char *name, const char *s, bool is_error)
248 {
249  if (is_error)
250  error (e, "%s: wrong type argument '%s'", name, s);
251  else
252  warning ("%s: wrong type argument '%s'", name, s);
253 }
254 
255 void
256 gripe_wrong_type_arg (const char *name, const std::string& s, bool is_error)
257 {
258  octave::execution_exception e;
259 
260 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
261 # pragma GCC diagnostic push
262 # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
263 #endif
264 
265  gripe_wrong_type_arg (e, name, s.c_str (), is_error);
266 
267 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
268 # pragma GCC diagnostic pop
269 #endif
270 }
271 
272 void
273 gripe_wrong_type_arg (octave::execution_exception& e,
274  const char *name, const std::string& s, bool is_error)
275 {
276 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
277 # pragma GCC diagnostic push
278 # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
279 #endif
280 
281  gripe_wrong_type_arg (e, name, s.c_str (), is_error);
282 
283 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
284 # pragma GCC diagnostic pop
285 #endif
286 }
287 
288 void
289 gripe_wrong_type_arg (const char *name, const octave_value& tc,
290  bool is_error)
291 {
292  octave::execution_exception e;
293 
294 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
295 # pragma GCC diagnostic push
296 # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
297 #endif
298 
299  gripe_wrong_type_arg (e, name, tc, is_error);
300 
301 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
302 # pragma GCC diagnostic pop
303 #endif
304 }
305 
306 void
307 gripe_wrong_type_arg (octave::execution_exception& e,
308  const char *name, const octave_value& tc,
309  bool is_error)
310 {
311  std::string type = tc.type_name ();
312 
313 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
314 # pragma GCC diagnostic push
315 # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
316 #endif
317 
318  gripe_wrong_type_arg (e, name, type, is_error);
319 
320 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
321 # pragma GCC diagnostic pop
322 #endif
323 }
324 
325 void
327  bool is_error)
328 {
329  octave::execution_exception e;
330 
331 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
332 # pragma GCC diagnostic push
333 # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
334 #endif
335 
336  gripe_wrong_type_arg (e, name, tc, is_error);
337 
338 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
339 # pragma GCC diagnostic pop
340 #endif
341 }
342 
343 void
344 gripe_wrong_type_arg (octave::execution_exception& e,
345  const std::string& name, const octave_value& tc,
346  bool is_error)
347 {
348 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
349 # pragma GCC diagnostic push
350 # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
351 #endif
352 
353  gripe_wrong_type_arg (e, name.c_str (), tc, is_error);
354 
355 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
356 # pragma GCC diagnostic pop
357 #endif
358 }
359 
360 void
361 gripe_wrong_type_arg (const char *s, bool is_error)
362 {
363  octave::execution_exception e;
364 
365 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
366 # pragma GCC diagnostic push
367 # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
368 #endif
369 
370  gripe_wrong_type_arg (e, s, is_error);
371 
372 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
373 # pragma GCC diagnostic pop
374 #endif
375 }
376 
377 void
378 gripe_wrong_type_arg (octave::execution_exception& e,
379  const char *s, bool is_error)
380 {
381  if (is_error)
382  error (e, "wrong type argument '%s'", s);
383  else
384  warning ("wrong type argument '%s'", s);
385 }
386 
387 void
388 gripe_wrong_type_arg (const std::string& s, bool is_error)
389 {
390  octave::execution_exception e;
391 
392 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
393 # pragma GCC diagnostic push
394 # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
395 #endif
396 
397  gripe_wrong_type_arg (e, s, is_error);
398 
399 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
400 # pragma GCC diagnostic pop
401 #endif
402 }
403 
404 void
405 gripe_wrong_type_arg (octave::execution_exception& e,
406  const std::string& s, bool is_error)
407 {
408 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
409 # pragma GCC diagnostic push
410 # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
411 #endif
412 
413  gripe_wrong_type_arg (e, s.c_str (), is_error);
414 
415 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
416 # pragma GCC diagnostic pop
417 #endif
418 }
419 
420 void
421 gripe_wrong_type_arg (const octave_value& tc, bool is_error)
422 {
423  octave::execution_exception e;
424 
425 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
426 # pragma GCC diagnostic push
427 # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
428 #endif
429 
430  gripe_wrong_type_arg (e, tc, is_error);
431 
432 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
433 # pragma GCC diagnostic pop
434 #endif
435 }
436 
437 void
438 gripe_wrong_type_arg (octave::execution_exception& e,
439  const octave_value& tc, bool is_error)
440 {
441  std::string type = tc.type_name ();
442 
443 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
444 # pragma GCC diagnostic push
445 # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
446 #endif
447 
448  gripe_wrong_type_arg (e, type, is_error);
449 
450 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
451 # pragma GCC diagnostic pop
452 #endif
453 }
454 
455 void
457 {
458  std::string type = op.type_name ();
459  error ("invalid operand '%s' for binary operator", type.c_str ());
460 }
461 
462 void
464 {
465  std::string type = op.type_name ();
466  error ("invalid operand '%s' for unary operator", type.c_str ());
467 }
void gripe_implicit_conversion(const char *id, const char *from, const char *to)
Definition: gripes.cc:83
void warning_with_id(const char *id, const char *fmt,...)
Definition: error.cc:803
For example cd octave end example noindent changes the current working directory to file
Definition: dirfns.cc:120
void gripe_wrong_type_arg(const char *name, const char *s, bool is_error)
Definition: gripes.cc:229
void gripe_wrong_type_arg_for_unary_op(const octave_value &op)
Definition: gripes.cc:463
void gripe_wrong_type_arg_for_binary_op(const octave_value &op)
Definition: gripes.cc:456
void gripe_nonconformant(void)
Definition: gripes.cc:135
void error(const char *fmt,...)
Definition: error.cc:570
s
Definition: file-io.cc:2682
void gripe_square_matrix_required(const char *name)
Definition: gripes.cc:168
i e
Definition: data.cc:2724
void gripe_invalid_inquiry_subscript(void)
Definition: gripes.cc:110
void gripe_range_invalid(void)
Definition: gripes.cc:162
octave_function * fcn
Definition: ov-class.cc:1743
void gripe_not_supported(const char *fcn)
Definition: gripes.cc:156
void gripe_user_returned_invalid(const char *name)
Definition: gripes.cc:192
void gripe_indexed_cs_list(void)
Definition: gripes.cc:98
void gripe_data_file_in_path(const std::string &fcn, const std::string &file)
Definition: gripes.cc:52
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 gripe_nonbraced_cs_list_assignment(void)
Definition: gripes.cc:129
void gripe_not_implemented(const char *fcn)
Definition: gripes.cc:149
void gripe_string_invalid(void)
Definition: gripes.cc:174
void gripe_unrecognized_data_fmt(const char *warn_for)
Definition: gripes.cc:180
idx type
Definition: ov.cc:3129
void gripe_empty_arg(const char *name, bool is_error)
Definition: gripes.cc:74
may be zero for pure relative error test tem the relative tolerance must be greater than or equal to
Definition: Quad-opts.cc:233
void gripe_data_conversion(const char *from, const char *to)
Definition: gripes.cc:46
void warning(const char *fmt,...)
Definition: error.cc:788
std::string type_name(void) const
Definition: ov.h:1232
void gripe_logical_conversion(void)
Definition: gripes.cc:122
void gripe_warn_complex_cmp(void)
Definition: gripes.cc:222
void gripe_invalid_conversion(const std::string &from, const std::string &to)
Definition: gripes.cc:104
void gripe_unrecognized_float_fmt(void)
Definition: gripes.cc:186
void gripe_disabled_feature(const std::string &fcn, const std::string &feature, const std::string &pkg)
Definition: gripes.cc:60
void gripe_invalid_value_specified(const char *name)
Definition: gripes.cc:116
void gripe_2_or_3_dim_plot(void)
Definition: gripes.cc:40
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
void gripe_divide_by_zero(void)
Definition: gripes.cc:68
void gripe_user_supplied_eval(const char *name)
Definition: gripes.cc:198