Mercurial > hg > octave-lojdl
annotate src/gripes.cc @ 10315:57a59eae83cc
untabify src C++ source files
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 11 Feb 2010 12:41:46 -0500 |
parents | cd96d29c5efa |
children | cc69a17ec801 |
rev | line source |
---|---|
1 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1993, 1994, 1995, 1996, 1997, 2000, 2002, 2003, 2005, |
8920 | 4 2006, 2007, 2008, 2009 John W. Eaton |
1 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
1 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
1 | 21 |
22 */ | |
23 | |
240 | 24 #ifdef HAVE_CONFIG_H |
1192 | 25 #include <config.h> |
1 | 26 #endif |
27 | |
5755 | 28 #include "defun.h" |
1352 | 29 #include "error.h" |
1 | 30 #include "gripes.h" |
4055 | 31 #include "oct-obj.h" |
5755 | 32 #include "utils.h" |
33 | |
1 | 34 void |
2078 | 35 gripe_not_supported (const char *fcn) |
36 { | |
37 error ("%s: not supported on this system", fcn); | |
38 } | |
39 | |
40 void | |
6890 | 41 gripe_not_implemented (const char *fcn) |
42 { | |
43 error ("%s: not implemented", fcn); | |
44 } | |
45 | |
46 void | |
1 | 47 gripe_string_invalid (void) |
48 { | |
3523 | 49 error ("std::string constant used in invalid context"); |
1 | 50 } |
51 | |
52 void | |
53 gripe_range_invalid (void) | |
54 { | |
55 error ("range constant used in invalid context"); | |
56 } | |
57 | |
58 void | |
59 gripe_nonconformant (void) | |
60 { | |
61 error ("nonconformant matrices"); | |
62 } | |
63 | |
64 void | |
5275 | 65 gripe_nonconformant (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) |
143 | 66 { |
67 error ("nonconformant matrices (op1 is %dx%d, op2 is %dx%d)", | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
68 r1, c1, r2, c2); |
143 | 69 } |
70 | |
71 void | |
2799 | 72 gripe_empty_arg (const char *name, bool is_error) |
1 | 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 | |
628 | 98 void |
3523 | 99 gripe_invalid_conversion (const std::string& from, const std::string& to) |
628 | 100 { |
2374 | 101 error ("invalid conversion from %s to %s", from.c_str (), to.c_str ()); |
628 | 102 } |
103 | |
777 | 104 void |
1416 | 105 gripe_invalid_value_specified (const char *name) |
106 { | |
107 warning ("invalid value specified for `%s'", name); | |
108 } | |
109 | |
110 void | |
777 | 111 gripe_2_or_3_dim_plot (void) |
112 { | |
113 error ("plot: can only plot in 2 or 3 dimensions"); | |
114 } | |
115 | |
116 void | |
117 gripe_unrecognized_float_fmt (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 | |
5602 | 135 gripe_wrong_type_arg (const char *name, const char *s, bool is_error) |
2668 | 136 { |
2799 | 137 if (is_error) |
5602 | 138 error ("%s: wrong type argument `%s'", name, s); |
2799 | 139 else |
5602 | 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); | |
2668 | 147 } |
148 | |
149 void | |
2799 | 150 gripe_wrong_type_arg (const char *name, const octave_value& tc, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
151 bool is_error) |
777 | 152 { |
3523 | 153 std::string type = tc.type_name (); |
2799 | 154 |
5602 | 155 gripe_wrong_type_arg (name, type, is_error); |
777 | 156 } |
157 | |
158 void | |
7352 | 159 gripe_wrong_type_arg (const std::string& name, const octave_value& tc, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
160 bool is_error) |
7352 | 161 { |
162 gripe_wrong_type_arg (name.c_str (), tc, is_error); | |
163 } | |
164 | |
165 void | |
2086 | 166 gripe_wrong_type_arg_for_unary_op (const octave_value& op) |
777 | 167 { |
3523 | 168 std::string type = op.type_name (); |
2374 | 169 error ("invalid operand `%s' for unary operator", type.c_str ()); |
777 | 170 } |
171 | |
172 void | |
2086 | 173 gripe_wrong_type_arg_for_binary_op (const octave_value& op) |
777 | 174 { |
3523 | 175 std::string type = op.type_name (); |
2374 | 176 error ("invalid operand `%s' for binary operator", type.c_str ()); |
177 } | |
178 | |
179 void | |
5781 | 180 gripe_implicit_conversion (const char *id, const char *from, const char *to) |
2374 | 181 { |
5781 | 182 warning_with_id (id, "implicit conversion from %s to %s", from, to); |
2374 | 183 } |
184 | |
185 void | |
5781 | 186 gripe_implicit_conversion (const std::string& id, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
187 const std::string& from, const std::string& to) |
4452 | 188 { |
5781 | 189 warning_with_id (id.c_str (), |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
190 "implicit conversion from %s to %s", |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
191 from.c_str (), to.c_str ()); |
4452 | 192 } |
193 | |
194 void | |
2374 | 195 gripe_divide_by_zero (void) |
196 { | |
5781 | 197 warning_with_id ("Octave:divide-by-zero", "division by zero"); |
5755 | 198 } |
199 | |
8012
63dbb85452cc
fix extern decls in .cc files
John W. Eaton <jwe@octave.org>
parents:
8011
diff
changeset
|
200 void |
5943 | 201 gripe_logical_conversion (void) |
202 { | |
203 warning_with_id ("Octave:logical-conversion", | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
204 "value not equal to 1 or 0 converted to logical 1"); |
5943 | 205 } |
206 | |
8012
63dbb85452cc
fix extern decls in .cc files
John W. Eaton <jwe@octave.org>
parents:
8011
diff
changeset
|
207 void |
7997
2b8952e133c9
implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents:
7352
diff
changeset
|
208 gripe_truncated_conversion (const char *srctype, const char *desttype) |
2b8952e133c9
implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents:
7352
diff
changeset
|
209 { |
7998
a4acda9fc3e7
gripe_truncated_conversion: change warning id for potential compatibility
John W. Eaton <jwe@octave.org>
parents:
7997
diff
changeset
|
210 warning_with_id ("Octave:int-convert-overflow", |
7997
2b8952e133c9
implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents:
7352
diff
changeset
|
211 "data truncated converting from %s to %s", |
2b8952e133c9
implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents:
7352
diff
changeset
|
212 srctype, desttype); |
2b8952e133c9
implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents:
7352
diff
changeset
|
213 } |
2b8952e133c9
implement checked conversions between integers
Jaroslav Hajek <highegg@gmail.com>
parents:
7352
diff
changeset
|
214 |
8011
3100283874d7
improve backtrace error messages
John W. Eaton <jwe@octave.org>
parents:
7998
diff
changeset
|
215 void |
8039
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
216 gripe_binop_integer_math_truncated (const char *op, const char *type1, const char *type2) |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
217 { |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
218 warning_with_id ("Octave:int-math-overflow", |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
219 "data truncated for %s by %s binary operator %s", |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
220 type1, type2, op); |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
221 } |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
222 |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
223 void |
8780
ea76466605ba
support native cumsum, gripe on overflow in sum/cumsum
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
224 gripe_native_integer_math_truncated (const char *fcn, const char *type) |
ea76466605ba
support native cumsum, gripe on overflow in sum/cumsum
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
225 { |
ea76466605ba
support native cumsum, gripe on overflow in sum/cumsum
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
226 warning_with_id ("Octave:int-math-overflow", |
ea76466605ba
support native cumsum, gripe on overflow in sum/cumsum
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
227 "data truncated for %s native %s operation", |
ea76466605ba
support native cumsum, gripe on overflow in sum/cumsum
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
228 type, fcn); |
ea76466605ba
support native cumsum, gripe on overflow in sum/cumsum
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
229 } |
ea76466605ba
support native cumsum, gripe on overflow in sum/cumsum
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
230 |
ea76466605ba
support native cumsum, gripe on overflow in sum/cumsum
Jaroslav Hajek <highegg@gmail.com>
parents:
8579
diff
changeset
|
231 void |
8039
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
232 gripe_unop_integer_math_truncated (const char* op, const char *type) |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
233 { |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
234 warning_with_id ("Octave:int-math-overflow", |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
235 "data truncated for the %s unary operator %s", type, op); |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
236 } |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
237 |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
238 void |
8011
3100283874d7
improve backtrace error messages
John W. Eaton <jwe@octave.org>
parents:
7998
diff
changeset
|
239 gripe_library_execution_error (void) |
3100283874d7
improve backtrace error messages
John W. Eaton <jwe@octave.org>
parents:
7998
diff
changeset
|
240 { |
3100283874d7
improve backtrace error messages
John W. Eaton <jwe@octave.org>
parents:
7998
diff
changeset
|
241 octave_exception_state = octave_no_exception; |
3100283874d7
improve backtrace error messages
John W. Eaton <jwe@octave.org>
parents:
7998
diff
changeset
|
242 |
3100283874d7
improve backtrace error messages
John W. Eaton <jwe@octave.org>
parents:
7998
diff
changeset
|
243 if (! error_state) |
3100283874d7
improve backtrace error messages
John W. Eaton <jwe@octave.org>
parents:
7998
diff
changeset
|
244 error ("caught execution error in library function"); |
3100283874d7
improve backtrace error messages
John W. Eaton <jwe@octave.org>
parents:
7998
diff
changeset
|
245 } |
3100283874d7
improve backtrace error messages
John W. Eaton <jwe@octave.org>
parents:
7998
diff
changeset
|
246 |
8039
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
247 void |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
248 gripe_non_integer_conversion (const char *srctype, const char *desttype) |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
249 { |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
250 warning_with_id ("Octave:int-convert-non-int-val", |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
251 "Conversion of non-integer value from %s to %s", |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
252 srctype, desttype); |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
253 } |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
254 void |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
255 gripe_nan_conversion (const char *srctype, const char *desttype) |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
256 { |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
257 warning_with_id ("Octave:int-convert-nan", |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
258 "Conversion of NaN from %s to %s", |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
259 srctype, desttype); |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
260 } |
cd90e2842080
Add additional integer math and conversion warnings, set their default state to be off and add the intwarning function
David Bateman <dbateman@free.fr>
parents:
8012
diff
changeset
|
261 |
8579
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8039
diff
changeset
|
262 void |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8039
diff
changeset
|
263 gripe_invalid_inquiry_subscript (void) |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8039
diff
changeset
|
264 { |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8039
diff
changeset
|
265 error ("invalid dimension inquiry of a non-existent value"); |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8039
diff
changeset
|
266 } |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8039
diff
changeset
|
267 |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8039
diff
changeset
|
268 void |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8039
diff
changeset
|
269 gripe_indexed_cs_list (void) |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8039
diff
changeset
|
270 { |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8039
diff
changeset
|
271 error ("a cs-list cannot be further indexed"); |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8039
diff
changeset
|
272 } |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8039
diff
changeset
|
273 |
9588
319e2ab9b8ae
warn about the complex comparison ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
274 void |
10030
83bb2a78c07d
improve simple assignments error checks and messages
Jaroslav Hajek <highegg@gmail.com>
parents:
9588
diff
changeset
|
275 gripe_nonbraced_cs_list_assignment (void) |
83bb2a78c07d
improve simple assignments error checks and messages
Jaroslav Hajek <highegg@gmail.com>
parents:
9588
diff
changeset
|
276 { |
83bb2a78c07d
improve simple assignments error checks and messages
Jaroslav Hajek <highegg@gmail.com>
parents:
9588
diff
changeset
|
277 error ("invalid assignment to cs-list outside multiple assignment."); |
83bb2a78c07d
improve simple assignments error checks and messages
Jaroslav Hajek <highegg@gmail.com>
parents:
9588
diff
changeset
|
278 } |
83bb2a78c07d
improve simple assignments error checks and messages
Jaroslav Hajek <highegg@gmail.com>
parents:
9588
diff
changeset
|
279 |
83bb2a78c07d
improve simple assignments error checks and messages
Jaroslav Hajek <highegg@gmail.com>
parents:
9588
diff
changeset
|
280 void |
9588
319e2ab9b8ae
warn about the complex comparison ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
281 gripe_warn_complex_cmp (void) |
319e2ab9b8ae
warn about the complex comparison ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
282 { |
319e2ab9b8ae
warn about the complex comparison ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
283 warning_with_id ("Octave:matlab-incompatible", |
319e2ab9b8ae
warn about the complex comparison ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
284 "potential Matlab compatibility problem: comparing complex numbers"); |
319e2ab9b8ae
warn about the complex comparison ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
285 } |