1
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 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 |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 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, write to the Free |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
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 |
1
|
41 gripe_string_invalid (void) |
|
42 { |
3523
|
43 error ("std::string constant used in invalid context"); |
1
|
44 } |
|
45 |
|
46 void |
|
47 gripe_range_invalid (void) |
|
48 { |
|
49 error ("range constant used in invalid context"); |
|
50 } |
|
51 |
|
52 void |
|
53 gripe_nonconformant (void) |
|
54 { |
|
55 error ("nonconformant matrices"); |
|
56 } |
|
57 |
|
58 void |
5275
|
59 gripe_nonconformant (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) |
143
|
60 { |
|
61 error ("nonconformant matrices (op1 is %dx%d, op2 is %dx%d)", |
|
62 r1, c1, r2, c2); |
|
63 } |
|
64 |
|
65 void |
2799
|
66 gripe_empty_arg (const char *name, bool is_error) |
1
|
67 { |
|
68 if (is_error) |
|
69 error ("%s: empty matrix is invalid as an argument", name); |
|
70 else |
|
71 warning ("%s: argument is empty matrix", name); |
|
72 } |
|
73 |
|
74 void |
|
75 gripe_square_matrix_required (const char *name) |
|
76 { |
|
77 error ("%s: argument must be a square matrix", name); |
|
78 } |
|
79 |
|
80 void |
|
81 gripe_user_supplied_eval (const char *name) |
|
82 { |
|
83 error ("%s: evaluation of user-supplied function failed", name); |
|
84 } |
|
85 |
|
86 void |
|
87 gripe_user_returned_invalid (const char *name) |
|
88 { |
|
89 error ("%s: user-supplied function returned invalid value", name); |
|
90 } |
|
91 |
628
|
92 void |
3523
|
93 gripe_invalid_conversion (const std::string& from, const std::string& to) |
628
|
94 { |
2374
|
95 error ("invalid conversion from %s to %s", from.c_str (), to.c_str ()); |
628
|
96 } |
|
97 |
777
|
98 void |
1416
|
99 gripe_invalid_value_specified (const char *name) |
|
100 { |
|
101 warning ("invalid value specified for `%s'", name); |
|
102 } |
|
103 |
|
104 void |
777
|
105 gripe_2_or_3_dim_plot (void) |
|
106 { |
|
107 error ("plot: can only plot in 2 or 3 dimensions"); |
|
108 } |
|
109 |
|
110 void |
|
111 gripe_unrecognized_float_fmt (void) |
|
112 { |
|
113 error ("unrecognized floating point format requested"); |
|
114 } |
|
115 |
|
116 void |
|
117 gripe_unrecognized_data_fmt (const char *warn_for) |
|
118 { |
|
119 error ("%s: unrecognized data format requested", warn_for); |
|
120 } |
|
121 |
|
122 void |
|
123 gripe_data_conversion (const char *from, const char *to) |
|
124 { |
|
125 error ("unable to convert from %s to %s format", from, to); |
|
126 } |
|
127 |
|
128 void |
5602
|
129 gripe_wrong_type_arg (const char *name, const char *s, bool is_error) |
2668
|
130 { |
2799
|
131 if (is_error) |
5602
|
132 error ("%s: wrong type argument `%s'", name, s); |
2799
|
133 else |
5602
|
134 warning ("%s: wrong type argument `%s'", name, s); |
|
135 } |
|
136 |
|
137 void |
|
138 gripe_wrong_type_arg (const char *name, const std::string& s, bool is_error) |
|
139 { |
|
140 gripe_wrong_type_arg (name, s.c_str (), is_error); |
2668
|
141 } |
|
142 |
|
143 void |
2799
|
144 gripe_wrong_type_arg (const char *name, const octave_value& tc, |
|
145 bool is_error) |
777
|
146 { |
3523
|
147 std::string type = tc.type_name (); |
2799
|
148 |
5602
|
149 gripe_wrong_type_arg (name, type, is_error); |
777
|
150 } |
|
151 |
|
152 void |
2086
|
153 gripe_wrong_type_arg_for_unary_op (const octave_value& op) |
777
|
154 { |
3523
|
155 std::string type = op.type_name (); |
2374
|
156 error ("invalid operand `%s' for unary operator", type.c_str ()); |
777
|
157 } |
|
158 |
|
159 void |
2086
|
160 gripe_wrong_type_arg_for_binary_op (const octave_value& op) |
777
|
161 { |
3523
|
162 std::string type = op.type_name (); |
2374
|
163 error ("invalid operand `%s' for binary operator", type.c_str ()); |
|
164 } |
|
165 |
|
166 void |
5781
|
167 gripe_implicit_conversion (const char *id, const char *from, const char *to) |
2374
|
168 { |
5781
|
169 warning_with_id (id, "implicit conversion from %s to %s", from, to); |
2374
|
170 } |
|
171 |
|
172 void |
5781
|
173 gripe_implicit_conversion (const std::string& id, |
|
174 const std::string& from, const std::string& to) |
4452
|
175 { |
5781
|
176 warning_with_id (id.c_str (), |
|
177 "implicit conversion from %s to %s", |
|
178 from.c_str (), to.c_str ()); |
4452
|
179 } |
|
180 |
|
181 void |
2374
|
182 gripe_divide_by_zero (void) |
|
183 { |
5781
|
184 warning_with_id ("Octave:divide-by-zero", "division by zero"); |
5755
|
185 } |
|
186 |
5943
|
187 extern void |
|
188 gripe_logical_conversion (void) |
|
189 { |
|
190 warning_with_id ("Octave:logical-conversion", |
|
191 "value not equal to 1 or 0 converted to logical 1"); |
|
192 } |
|
193 |
1
|
194 /* |
|
195 ;;; Local Variables: *** |
|
196 ;;; mode: C++ *** |
|
197 ;;; End: *** |
|
198 */ |