comparison src/ov.cc @ 3205:549691faa638

[project @ 1998-10-31 04:20:15 by jwe]
author jwe
date Sat, 31 Oct 1998 04:20:18 +0000
parents 81738e630f57
children 30770ba4457a
comparison
equal deleted inserted replaced
3204:81738e630f57 3205:549691faa638
1227 else 1227 else
1228 gripe_unary_op (octave_value::unary_op_as_string (op), type_name ()); 1228 gripe_unary_op (octave_value::unary_op_as_string (op), type_name ());
1229 } 1229 }
1230 } 1230 }
1231 1231
1232 static void
1233 gripe_unary_op_failed_or_no_method (const string& on, const string& tn)
1234 {
1235 error ("operator %s: no method, or unable to evaluate for %s operand",
1236 on.c_str (), tn.c_str ());
1237 }
1238
1239 void
1240 octave_value::do_non_const_unary_op (octave_value::unary_op op,
1241 const octave_value_list& idx)
1242 {
1243 // XXX FIXME XXX -- only do the following stuff if we can't find a
1244 // specific function to call to handle the op= operation for the
1245 // types we have.
1246
1247 assign_op assop = unary_op_to_assign_op (op);
1248
1249 if (! error_state)
1250 assign (assop, idx, 1.0);
1251 else
1252 gripe_unary_op_failed_or_no_method (unary_op_as_string (op),
1253 type_name ());
1254 }
1255
1232 // Current indentation. 1256 // Current indentation.
1233 int octave_value::curr_print_indent_level = 0; 1257 int octave_value::curr_print_indent_level = 0;
1234 1258
1235 // TRUE means we are at the beginning of a line. 1259 // TRUE means we are at the beginning of a line.
1236 bool octave_value::beginning_of_line = true; 1260 bool octave_value::beginning_of_line = true;
1271 void 1295 void
1272 octave_value::reset (void) const 1296 octave_value::reset (void) const
1273 { 1297 {
1274 beginning_of_line = true; 1298 beginning_of_line = true;
1275 curr_print_indent_level = 0; 1299 curr_print_indent_level = 0;
1300 }
1301
1302 octave_value::assign_op
1303 octave_value::unary_op_to_assign_op (unary_op op)
1304 {
1305 assign_op binop = unknown_assign_op;
1306
1307 switch (op)
1308 {
1309 case incr:
1310 binop = add_eq;
1311 break;
1312
1313 case decr:
1314 binop = sub_eq;
1315 break;
1316
1317 default:
1318 {
1319 string on = unary_op_as_string (op);
1320 error ("operator %s: no assign operator found", on.c_str ());
1321 }
1322 }
1323
1324 return binop;
1276 } 1325 }
1277 1326
1278 octave_value::binary_op 1327 octave_value::binary_op
1279 octave_value::op_eq_to_binary_op (assign_op op) 1328 octave_value::op_eq_to_binary_op (assign_op op)
1280 { 1329 {