00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifdef HAVE_CONFIG_H
00024 #include <config.h>
00025 #endif
00026
00027 #include "defun.h"
00028 #include "error.h"
00029 #include "gripes.h"
00030 #include "oct-obj.h"
00031 #include "utils.h"
00032
00033 void
00034 gripe_not_supported (const char *fcn)
00035 {
00036 error ("%s: not supported on this system", fcn);
00037 }
00038
00039 void
00040 gripe_not_implemented (const char *fcn)
00041 {
00042 error ("%s: not implemented", fcn);
00043 }
00044
00045 void
00046 gripe_string_invalid (void)
00047 {
00048 error ("std::string constant used in invalid context");
00049 }
00050
00051 void
00052 gripe_range_invalid (void)
00053 {
00054 error ("range constant used in invalid context");
00055 }
00056
00057 void
00058 gripe_nonconformant (void)
00059 {
00060 error ("nonconformant matrices");
00061 }
00062
00063 void
00064 gripe_nonconformant (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2)
00065 {
00066 error ("nonconformant matrices (op1 is %dx%d, op2 is %dx%d)",
00067 r1, c1, r2, c2);
00068 }
00069
00070 void
00071 gripe_empty_arg (const char *name, bool is_error)
00072 {
00073 if (is_error)
00074 error ("%s: empty matrix is invalid as an argument", name);
00075 else
00076 warning ("%s: argument is empty matrix", name);
00077 }
00078
00079 void
00080 gripe_square_matrix_required (const char *name)
00081 {
00082 error ("%s: argument must be a square matrix", name);
00083 }
00084
00085 void
00086 gripe_user_supplied_eval (const char *name)
00087 {
00088 error ("%s: evaluation of user-supplied function failed", name);
00089 }
00090
00091 void
00092 gripe_user_returned_invalid (const char *name)
00093 {
00094 error ("%s: user-supplied function returned invalid value", name);
00095 }
00096
00097 void
00098 gripe_invalid_conversion (const std::string& from, const std::string& to)
00099 {
00100 error ("invalid conversion from %s to %s", from.c_str (), to.c_str ());
00101 }
00102
00103 void
00104 gripe_invalid_value_specified (const char *name)
00105 {
00106 warning ("invalid value specified for '%s'", name);
00107 }
00108
00109 void
00110 gripe_2_or_3_dim_plot (void)
00111 {
00112 error ("plot: can only plot in 2 or 3 dimensions");
00113 }
00114
00115 void
00116 gripe_unrecognized_float_fmt (void)
00117 {
00118 error ("unrecognized floating point format requested");
00119 }
00120
00121 void
00122 gripe_unrecognized_data_fmt (const char *warn_for)
00123 {
00124 error ("%s: unrecognized data format requested", warn_for);
00125 }
00126
00127 void
00128 gripe_data_conversion (const char *from, const char *to)
00129 {
00130 error ("unable to convert from %s to %s format", from, to);
00131 }
00132
00133 void
00134 gripe_wrong_type_arg (const char *name, const char *s, bool is_error)
00135 {
00136 if (is_error)
00137 error ("%s: wrong type argument '%s'", name, s);
00138 else
00139 warning ("%s: wrong type argument '%s'", name, s);
00140 }
00141
00142 void
00143 gripe_wrong_type_arg (const char *name, const std::string& s, bool is_error)
00144 {
00145 gripe_wrong_type_arg (name, s.c_str (), is_error);
00146 }
00147
00148 void
00149 gripe_wrong_type_arg (const char *name, const octave_value& tc,
00150 bool is_error)
00151 {
00152 std::string type = tc.type_name ();
00153
00154 gripe_wrong_type_arg (name, type, is_error);
00155 }
00156
00157 void
00158 gripe_wrong_type_arg (const std::string& name, const octave_value& tc,
00159 bool is_error)
00160 {
00161 gripe_wrong_type_arg (name.c_str (), tc, is_error);
00162 }
00163
00164 void
00165 gripe_wrong_type_arg_for_unary_op (const octave_value& op)
00166 {
00167 std::string type = op.type_name ();
00168 error ("invalid operand '%s' for unary operator", type.c_str ());
00169 }
00170
00171 void
00172 gripe_wrong_type_arg_for_binary_op (const octave_value& op)
00173 {
00174 std::string type = op.type_name ();
00175 error ("invalid operand '%s' for binary operator", type.c_str ());
00176 }
00177
00178 void
00179 gripe_implicit_conversion (const char *id, const char *from, const char *to)
00180 {
00181 warning_with_id (id, "implicit conversion from %s to %s", from, to);
00182 }
00183
00184 void
00185 gripe_implicit_conversion (const std::string& id,
00186 const std::string& from, const std::string& to)
00187 {
00188 warning_with_id (id.c_str (),
00189 "implicit conversion from %s to %s",
00190 from.c_str (), to.c_str ());
00191 }
00192
00193 void
00194 gripe_divide_by_zero (void)
00195 {
00196 warning_with_id ("Octave:divide-by-zero", "division by zero");
00197 }
00198
00199 void
00200 gripe_logical_conversion (void)
00201 {
00202 warning_with_id ("Octave:logical-conversion",
00203 "value not equal to 1 or 0 converted to logical 1");
00204 }
00205
00206 void
00207 gripe_library_execution_error (void)
00208 {
00209 octave_exception_state = octave_no_exception;
00210
00211 if (! error_state)
00212 error ("caught execution error in library function");
00213 }
00214
00215 void
00216 gripe_invalid_inquiry_subscript (void)
00217 {
00218 error ("invalid dimension inquiry of a non-existent value");
00219 }
00220
00221 void
00222 gripe_indexed_cs_list (void)
00223 {
00224 error ("a cs-list cannot be further indexed");
00225 }
00226
00227 void
00228 gripe_nonbraced_cs_list_assignment (void)
00229 {
00230 error ("invalid assignment to cs-list outside multiple assignment");
00231 }
00232
00233 void
00234 gripe_warn_complex_cmp (void)
00235 {
00236 warning_with_id ("Octave:matlab-incompatible",
00237 "potential Matlab compatibility problem: comparing complex numbers");
00238 }