GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
gripes.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1993-2018 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
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License 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 <https://www.gnu.org/licenses/>.
20 
21 */
22 
23 // FIXME: All gripe_XXX functions deprecated in 4.2. Remove file in
24 // version 5.
25 
26 #if defined (HAVE_CONFIG_H)
27 # include "config.h"
28 #endif
29 
30 #include "defun.h"
31 #include "error.h"
32 #include "gripes.h"
33 #include "ovl.h"
34 #include "utils.h"
35 
36 ////////////////////////////////////////////////////////////////////////////////
37 // Alphabetized list of gripes.
38 ////////////////////////////////////////////////////////////////////////////////
39 
40 void
42 {
43  error ("plot: can only plot in 2 or 3 dimensions");
44 }
45 
46 void
47 gripe_data_conversion (const char *from, const char *to)
48 {
49  error ("unable to convert from %s to %s format", from, to);
50 }
51 
52 void
54 {
55  warning_with_id ("Octave:data-file-in-path",
56  "%s: '%s' found by searching load path",
57  fcn.c_str (), file.c_str ());
58 }
59 
60 void
62  const std::string& pkg /*="Octave"*/)
63 {
64  error ("%s: support for %s was unavailable or disabled when %s was built",
65  fcn.c_str (), feature.c_str (), pkg.c_str ());
66 }
67 
68 void
70 {
71  warning_with_id ("Octave:divide-by-zero", "division by zero");
72 }
73 
74 void
75 gripe_empty_arg (const char *name, bool is_error)
76 {
77  if (is_error)
78  error ("%s: empty matrix is invalid as an argument", name);
79  else
80  warning ("%s: argument is empty matrix", name);
81 }
82 
83 void
84 gripe_implicit_conversion (const char *id, const char *from, const char *to)
85 {
86  warning_with_id (id, "implicit conversion from %s to %s", from, to);
87 }
88 
89 void
91  const std::string& from, const std::string& to)
92 {
93  warning_with_id (id.c_str (),
94  "implicit conversion from %s to %s",
95  from.c_str (), to.c_str ());
96 }
97 
98 void
100 {
101  error ("a cs-list cannot be further indexed");
102 }
103 
104 void
106 {
107  error ("invalid conversion from %s to %s", from.c_str (), to.c_str ());
108 }
109 
110 void
112 {
113  error ("invalid dimension inquiry of a non-existent value");
114 }
115 
116 void
118 {
119  warning ("invalid value specified for '%s'", name);
120 }
121 
122 void
124 {
125  warning_with_id ("Octave:logical-conversion",
126  "value not equal to 1 or 0 converted to logical 1");
127 }
128 
129 void
131 {
132  error ("invalid assignment to cs-list outside multiple assignment");
133 }
134 
135 void
137 {
138  error ("nonconformant matrices");
139 }
140 
141 void
144 {
145  error ("nonconformant matrices (op1 is %dx%d, op2 is %dx%d)",
146  r1, c1, r2, c2);
147 }
148 
149 void
151 {
152  error ("%s: not implemented", fcn);
153 }
154 
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 
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:84
void warning_with_id(const char *id, const char *fmt,...)
Definition: error.cc:816
For example cd octave end example noindent changes the current working directory to file
Definition: dirfns.cc:124
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:136
void error(const char *fmt,...)
Definition: error.cc:578
s
Definition: file-io.cc:2729
void gripe_square_matrix_required(const char *name)
Definition: gripes.cc:168
i e
Definition: data.cc:2591
void gripe_invalid_inquiry_subscript(void)
Definition: gripes.cc:111
void gripe_range_invalid(void)
Definition: gripes.cc:162
octave_function * fcn
Definition: ov-class.cc:1754
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:99
void gripe_data_file_in_path(const std::string &fcn, const std::string &file)
Definition: gripes.cc:53
nd deftypefn *std::string name
Definition: sysdep.cc:647
void gripe_nonbraced_cs_list_assignment(void)
Definition: gripes.cc:130
void gripe_not_implemented(const char *fcn)
Definition: gripes.cc:150
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:3114
void gripe_empty_arg(const char *name, bool is_error)
Definition: gripes.cc:75
void gripe_data_conversion(const char *from, const char *to)
Definition: gripes.cc:47
void warning(const char *fmt,...)
Definition: error.cc:801
void gripe_logical_conversion(void)
Definition: gripes.cc:123
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:105
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:61
void gripe_invalid_value_specified(const char *name)
Definition: gripes.cc:117
void gripe_2_or_3_dim_plot(void)
Definition: gripes.cc:41
std::string type_name(void) const
Definition: ov.h:1289
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:888
void gripe_divide_by_zero(void)
Definition: gripes.cc:69
void gripe_user_supplied_eval(const char *name)
Definition: gripes.cc:198