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 |
1352
|
28 #include "error.h" |
1
|
29 #include "gripes.h" |
4055
|
30 #include "oct-obj.h" |
1
|
31 |
|
32 void |
2078
|
33 gripe_not_supported (const char *fcn) |
|
34 { |
|
35 error ("%s: not supported on this system", fcn); |
|
36 } |
|
37 |
|
38 void |
1
|
39 gripe_string_invalid (void) |
|
40 { |
3523
|
41 error ("std::string constant used in invalid context"); |
1
|
42 } |
|
43 |
|
44 void |
|
45 gripe_range_invalid (void) |
|
46 { |
|
47 error ("range constant used in invalid context"); |
|
48 } |
|
49 |
|
50 void |
|
51 gripe_nonconformant (void) |
|
52 { |
|
53 error ("nonconformant matrices"); |
|
54 } |
|
55 |
|
56 void |
5275
|
57 gripe_nonconformant (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) |
143
|
58 { |
|
59 error ("nonconformant matrices (op1 is %dx%d, op2 is %dx%d)", |
|
60 r1, c1, r2, c2); |
|
61 } |
|
62 |
|
63 void |
2799
|
64 gripe_empty_arg (const char *name, bool is_error) |
1
|
65 { |
|
66 if (is_error) |
|
67 error ("%s: empty matrix is invalid as an argument", name); |
|
68 else |
|
69 warning ("%s: argument is empty matrix", name); |
|
70 } |
|
71 |
|
72 void |
|
73 gripe_square_matrix_required (const char *name) |
|
74 { |
|
75 error ("%s: argument must be a square matrix", name); |
|
76 } |
|
77 |
|
78 void |
|
79 gripe_user_supplied_eval (const char *name) |
|
80 { |
|
81 error ("%s: evaluation of user-supplied function failed", name); |
|
82 } |
|
83 |
|
84 void |
|
85 gripe_user_returned_invalid (const char *name) |
|
86 { |
|
87 error ("%s: user-supplied function returned invalid value", name); |
|
88 } |
|
89 |
628
|
90 void |
3523
|
91 gripe_invalid_conversion (const std::string& from, const std::string& to) |
628
|
92 { |
2374
|
93 error ("invalid conversion from %s to %s", from.c_str (), to.c_str ()); |
628
|
94 } |
|
95 |
777
|
96 void |
1416
|
97 gripe_invalid_value_specified (const char *name) |
|
98 { |
|
99 warning ("invalid value specified for `%s'", name); |
|
100 } |
|
101 |
|
102 void |
777
|
103 gripe_2_or_3_dim_plot (void) |
|
104 { |
|
105 error ("plot: can only plot in 2 or 3 dimensions"); |
|
106 } |
|
107 |
|
108 void |
|
109 gripe_unrecognized_float_fmt (void) |
|
110 { |
|
111 error ("unrecognized floating point format requested"); |
|
112 } |
|
113 |
|
114 void |
|
115 gripe_unrecognized_data_fmt (const char *warn_for) |
|
116 { |
|
117 error ("%s: unrecognized data format requested", warn_for); |
|
118 } |
|
119 |
|
120 void |
|
121 gripe_data_conversion (const char *from, const char *to) |
|
122 { |
|
123 error ("unable to convert from %s to %s format", from, to); |
|
124 } |
|
125 |
|
126 void |
3523
|
127 gripe_wrong_type_arg (const char *name, const std::string& s, bool is_error) |
2668
|
128 { |
2799
|
129 if (is_error) |
|
130 error ("%s: wrong type argument `%s'", name, s.c_str ()); |
|
131 else |
|
132 warning ("%s: wrong type argument `%s'", name, s.c_str ()); |
2668
|
133 } |
|
134 |
|
135 void |
2799
|
136 gripe_wrong_type_arg (const char *name, const octave_value& tc, |
|
137 bool is_error) |
777
|
138 { |
3523
|
139 std::string type = tc.type_name (); |
2799
|
140 |
|
141 if (is_error) |
|
142 error ("%s: wrong type argument `%s'", name, type.c_str ()); |
|
143 else |
|
144 warning ("%s: wrong type argument `%s'", name, type.c_str ()); |
777
|
145 } |
|
146 |
|
147 void |
2086
|
148 gripe_wrong_type_arg_for_unary_op (const octave_value& op) |
777
|
149 { |
3523
|
150 std::string type = op.type_name (); |
2374
|
151 error ("invalid operand `%s' for unary operator", type.c_str ()); |
777
|
152 } |
|
153 |
|
154 void |
2086
|
155 gripe_wrong_type_arg_for_binary_op (const octave_value& op) |
777
|
156 { |
3523
|
157 std::string type = op.type_name (); |
2374
|
158 error ("invalid operand `%s' for binary operator", type.c_str ()); |
|
159 } |
|
160 |
|
161 void |
|
162 gripe_implicit_conversion (const char *from, const char *to) |
|
163 { |
|
164 warning ("implicit conversion from %s to %s", from, to); |
|
165 } |
|
166 |
|
167 void |
4452
|
168 gripe_implicit_conversion (const std::string& from, const std::string& to) |
|
169 { |
|
170 warning ("implicit conversion from %s to %s", from.c_str (), to.c_str ()); |
|
171 } |
|
172 |
|
173 void |
2374
|
174 gripe_divide_by_zero (void) |
|
175 { |
|
176 if (Vwarn_divide_by_zero) |
|
177 warning ("division by zero"); |
777
|
178 } |
|
179 |
1
|
180 /* |
|
181 ;;; Local Variables: *** |
|
182 ;;; mode: C++ *** |
|
183 ;;; End: *** |
|
184 */ |