Mercurial > hg > octave-jordi
annotate libinterp/interp-core/gripes.cc @ 15467:049e8bbff782
maint: periodic merge of stable to default
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 01 Oct 2012 18:30:44 -0400 |
parents | src/gripes.cc@d174210ce1ec src/gripes.cc@2fc554ffbc28 |
children |
rev | line source |
---|---|
1 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
11590
diff
changeset
|
3 Copyright (C) 1993-2012 John W. Eaton |
1 | 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 | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
1 | 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 | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
1 | 20 |
21 */ | |
22 | |
240 | 23 #ifdef HAVE_CONFIG_H |
1192 | 24 #include <config.h> |
1 | 25 #endif |
26 | |
5755 | 27 #include "defun.h" |
1352 | 28 #include "error.h" |
1 | 29 #include "gripes.h" |
4055 | 30 #include "oct-obj.h" |
5755 | 31 #include "utils.h" |
32 | |
1 | 33 void |
2078 | 34 gripe_not_supported (const char *fcn) |
35 { | |
36 error ("%s: not supported on this system", fcn); | |
37 } | |
38 | |
39 void | |
6890 | 40 gripe_not_implemented (const char *fcn) |
41 { | |
42 error ("%s: not implemented", fcn); | |
43 } | |
44 | |
45 void | |
1 | 46 gripe_string_invalid (void) |
47 { | |
3523 | 48 error ("std::string constant used in invalid context"); |
1 | 49 } |
50 | |
51 void | |
52 gripe_range_invalid (void) | |
53 { | |
54 error ("range constant used in invalid context"); | |
55 } | |
56 | |
57 void | |
58 gripe_nonconformant (void) | |
59 { | |
60 error ("nonconformant matrices"); | |
61 } | |
62 | |
63 void | |
5275 | 64 gripe_nonconformant (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) |
143 | 65 { |
66 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
|
67 r1, c1, r2, c2); |
143 | 68 } |
69 | |
70 void | |
2799 | 71 gripe_empty_arg (const char *name, bool is_error) |
1 | 72 { |
73 if (is_error) | |
74 error ("%s: empty matrix is invalid as an argument", name); | |
75 else | |
76 warning ("%s: argument is empty matrix", name); | |
77 } | |
78 | |
79 void | |
80 gripe_square_matrix_required (const char *name) | |
81 { | |
82 error ("%s: argument must be a square matrix", name); | |
83 } | |
84 | |
85 void | |
86 gripe_user_supplied_eval (const char *name) | |
87 { | |
88 error ("%s: evaluation of user-supplied function failed", name); | |
89 } | |
90 | |
91 void | |
92 gripe_user_returned_invalid (const char *name) | |
93 { | |
94 error ("%s: user-supplied function returned invalid value", name); | |
95 } | |
96 | |
628 | 97 void |
3523 | 98 gripe_invalid_conversion (const std::string& from, const std::string& to) |
628 | 99 { |
2374 | 100 error ("invalid conversion from %s to %s", from.c_str (), to.c_str ()); |
628 | 101 } |
102 | |
777 | 103 void |
1416 | 104 gripe_invalid_value_specified (const char *name) |
105 { | |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
106 warning ("invalid value specified for '%s'", name); |
1416 | 107 } |
108 | |
109 void | |
777 | 110 gripe_2_or_3_dim_plot (void) |
111 { | |
112 error ("plot: can only plot in 2 or 3 dimensions"); | |
113 } | |
114 | |
115 void | |
116 gripe_unrecognized_float_fmt (void) | |
117 { | |
118 error ("unrecognized floating point format requested"); | |
119 } | |
120 | |
121 void | |
122 gripe_unrecognized_data_fmt (const char *warn_for) | |
123 { | |
124 error ("%s: unrecognized data format requested", warn_for); | |
125 } | |
126 | |
127 void | |
128 gripe_data_conversion (const char *from, const char *to) | |
129 { | |
130 error ("unable to convert from %s to %s format", from, to); | |
131 } | |
132 | |
133 void | |
5602 | 134 gripe_wrong_type_arg (const char *name, const char *s, bool is_error) |
2668 | 135 { |
2799 | 136 if (is_error) |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
137 error ("%s: wrong type argument '%s'", name, s); |
2799 | 138 else |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
139 warning ("%s: wrong type argument '%s'", name, s); |
5602 | 140 } |
141 | |
142 void | |
143 gripe_wrong_type_arg (const char *name, const std::string& s, bool is_error) | |
144 { | |
145 gripe_wrong_type_arg (name, s.c_str (), is_error); | |
2668 | 146 } |
147 | |
148 void | |
2799 | 149 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
|
150 bool is_error) |
777 | 151 { |
3523 | 152 std::string type = tc.type_name (); |
2799 | 153 |
5602 | 154 gripe_wrong_type_arg (name, type, is_error); |
777 | 155 } |
156 | |
157 void | |
7352 | 158 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
|
159 bool is_error) |
7352 | 160 { |
161 gripe_wrong_type_arg (name.c_str (), tc, is_error); | |
162 } | |
163 | |
164 void | |
2086 | 165 gripe_wrong_type_arg_for_unary_op (const octave_value& op) |
777 | 166 { |
3523 | 167 std::string type = op.type_name (); |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
168 error ("invalid operand '%s' for unary operator", type.c_str ()); |
777 | 169 } |
170 | |
171 void | |
2086 | 172 gripe_wrong_type_arg_for_binary_op (const octave_value& op) |
777 | 173 { |
3523 | 174 std::string type = op.type_name (); |
15466
d174210ce1ec
use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents:
14138
diff
changeset
|
175 error ("invalid operand '%s' for binary operator", type.c_str ()); |
2374 | 176 } |
177 | |
178 void | |
5781 | 179 gripe_implicit_conversion (const char *id, const char *from, const char *to) |
2374 | 180 { |
5781 | 181 warning_with_id (id, "implicit conversion from %s to %s", from, to); |
2374 | 182 } |
183 | |
184 void | |
5781 | 185 gripe_implicit_conversion (const std::string& id, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
186 const std::string& from, const std::string& to) |
4452 | 187 { |
5781 | 188 warning_with_id (id.c_str (), |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
189 "implicit conversion from %s to %s", |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
190 from.c_str (), to.c_str ()); |
4452 | 191 } |
192 | |
193 void | |
2374 | 194 gripe_divide_by_zero (void) |
195 { | |
5781 | 196 warning_with_id ("Octave:divide-by-zero", "division by zero"); |
5755 | 197 } |
198 | |
8012
63dbb85452cc
fix extern decls in .cc files
John W. Eaton <jwe@octave.org>
parents:
8011
diff
changeset
|
199 void |
5943 | 200 gripe_logical_conversion (void) |
201 { | |
202 warning_with_id ("Octave:logical-conversion", | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10160
diff
changeset
|
203 "value not equal to 1 or 0 converted to logical 1"); |
5943 | 204 } |
205 | |
8012
63dbb85452cc
fix extern decls in .cc files
John W. Eaton <jwe@octave.org>
parents:
8011
diff
changeset
|
206 void |
8011
3100283874d7
improve backtrace error messages
John W. Eaton <jwe@octave.org>
parents:
7998
diff
changeset
|
207 gripe_library_execution_error (void) |
3100283874d7
improve backtrace error messages
John W. Eaton <jwe@octave.org>
parents:
7998
diff
changeset
|
208 { |
3100283874d7
improve backtrace error messages
John W. Eaton <jwe@octave.org>
parents:
7998
diff
changeset
|
209 octave_exception_state = octave_no_exception; |
3100283874d7
improve backtrace error messages
John W. Eaton <jwe@octave.org>
parents:
7998
diff
changeset
|
210 |
3100283874d7
improve backtrace error messages
John W. Eaton <jwe@octave.org>
parents:
7998
diff
changeset
|
211 if (! error_state) |
3100283874d7
improve backtrace error messages
John W. Eaton <jwe@octave.org>
parents:
7998
diff
changeset
|
212 error ("caught execution error in library function"); |
3100283874d7
improve backtrace error messages
John W. Eaton <jwe@octave.org>
parents:
7998
diff
changeset
|
213 } |
3100283874d7
improve backtrace error messages
John W. Eaton <jwe@octave.org>
parents:
7998
diff
changeset
|
214 |
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
|
215 void |
8579
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8039
diff
changeset
|
216 gripe_invalid_inquiry_subscript (void) |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8039
diff
changeset
|
217 { |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8039
diff
changeset
|
218 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
|
219 } |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8039
diff
changeset
|
220 |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8039
diff
changeset
|
221 void |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8039
diff
changeset
|
222 gripe_indexed_cs_list (void) |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8039
diff
changeset
|
223 { |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8039
diff
changeset
|
224 error ("a cs-list cannot be further indexed"); |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8039
diff
changeset
|
225 } |
7e0f36dfefbe
implement octave_value_list using Array
Jaroslav Hajek <highegg@gmail.com>
parents:
8039
diff
changeset
|
226 |
9588
319e2ab9b8ae
warn about the complex comparison ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
227 void |
10030
83bb2a78c07d
improve simple assignments error checks and messages
Jaroslav Hajek <highegg@gmail.com>
parents:
9588
diff
changeset
|
228 gripe_nonbraced_cs_list_assignment (void) |
83bb2a78c07d
improve simple assignments error checks and messages
Jaroslav Hajek <highegg@gmail.com>
parents:
9588
diff
changeset
|
229 { |
11590
4ced6b90fffb
style fixes for warning and error messages in source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
230 error ("invalid assignment to cs-list outside multiple assignment"); |
10030
83bb2a78c07d
improve simple assignments error checks and messages
Jaroslav Hajek <highegg@gmail.com>
parents:
9588
diff
changeset
|
231 } |
83bb2a78c07d
improve simple assignments error checks and messages
Jaroslav Hajek <highegg@gmail.com>
parents:
9588
diff
changeset
|
232 |
83bb2a78c07d
improve simple assignments error checks and messages
Jaroslav Hajek <highegg@gmail.com>
parents:
9588
diff
changeset
|
233 void |
9588
319e2ab9b8ae
warn about the complex comparison ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
234 gripe_warn_complex_cmp (void) |
319e2ab9b8ae
warn about the complex comparison ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
235 { |
319e2ab9b8ae
warn about the complex comparison ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
236 warning_with_id ("Octave:matlab-incompatible", |
319e2ab9b8ae
warn about the complex comparison ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
237 "potential Matlab compatibility problem: comparing complex numbers"); |
319e2ab9b8ae
warn about the complex comparison ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
238 } |