changeset 2374:67a18ae969d4

[project @ 1996-10-12 00:27:01 by jwe]
author jwe
date Sat, 12 Oct 1996 00:29:28 +0000
parents d423dcc0ac32
children 7ef24992e290
files src/defun.h src/gripes.cc src/gripes.h
diffstat 3 files changed, 31 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/defun.h	Sat Oct 12 00:22:22 1996 +0000
+++ b/src/defun.h	Sat Oct 12 00:29:28 1996 +0000
@@ -77,9 +77,8 @@
 #define DEFVAR_INT(name, sname, defn, inst_as_fcn, protect, sv_fcn, doc) \
   do \
     { \
-      builtin_variable sname (name, new octave_value (defn), \
-			      inst_as_fcn, protect, (sv_fcn ? 1 : 0), \
-			      sv_fcn, doc); \
+      builtin_variable sname (name, octave_value (defn), inst_as_fcn, \
+			      protect, (sv_fcn ? 1 : 0), sv_fcn, doc); \
       install_builtin_variable (sname); \
     } \
   while (0)
@@ -153,7 +152,8 @@
 // must be used in the same file where name is defined, after the
 // definition for name.
 
-#define DEFALIAS(name, alias) DEFALIAS_INTERNAL (name, alias)
+#define DEFALIAS(name, alias) \
+  DEFALIAS_INTERNAL (name, alias)
 
 #endif
 
--- a/src/gripes.cc	Sat Oct 12 00:22:22 1996 +0000
+++ b/src/gripes.cc	Sat Oct 12 00:29:28 1996 +0000
@@ -26,7 +26,7 @@
 
 #include "error.h"
 #include "gripes.h"
-#include "pt-const.h"
+#include "ov.h"
 
 void
 gripe_not_supported (const char *fcn)
@@ -87,9 +87,9 @@
 }
 
 void
-gripe_invalid_conversion (const char *from, const char *to)
+gripe_invalid_conversion (const string& from, const string& to)
 {
-  error ("invalid conversion from %s to %s", from, to);
+  error ("invalid conversion from %s to %s", from.c_str (), to.c_str ());
 }
 
 void
@@ -125,19 +125,35 @@
 void
 gripe_wrong_type_arg (const char *name, const octave_value& tc)
 {
-  error ("%s: wrong type argument `%s'", name, tc.type_as_string ());
+  string type = tc.type_name ();
+  error ("%s: wrong type argument `%s'", name, type.c_str ());
 }
 
 void
 gripe_wrong_type_arg_for_unary_op (const octave_value& op)
 {
-  error ("invalid operand `%s' for unary operator", op.type_as_string ());
+  string type = op.type_name ();
+  error ("invalid operand `%s' for unary operator", type.c_str ());
 }
 
 void
 gripe_wrong_type_arg_for_binary_op (const octave_value& op)
 {
-  error ("invalid operand `%s' for binary operator", op.type_as_string ());
+  string type = op.type_name ();
+  error ("invalid operand `%s' for binary operator", type.c_str ());
+}
+
+void
+gripe_implicit_conversion (const char *from, const char *to)
+{
+  warning ("implicit conversion from %s to %s", from, to);
+}
+
+void
+gripe_divide_by_zero (void)
+{
+  if (Vwarn_divide_by_zero)
+    warning ("division by zero");
 }
 
 /*
--- a/src/gripes.h	Sat Oct 12 00:22:22 1996 +0000
+++ b/src/gripes.h	Sat Oct 12 00:29:28 1996 +0000
@@ -23,6 +23,8 @@
 #if !defined (octave_gripes_h)
 #define octave_gripes_h 1
 
+#include <string>
+
 class octave_value;
 
 extern void gripe_not_supported (void);
@@ -34,7 +36,7 @@
 extern void gripe_square_matrix_required (const char *name);
 extern void gripe_user_supplied_eval (const char *name);
 extern void gripe_user_returned_invalid (const char *name);
-extern void gripe_invalid_conversion (const char *from, const char *to);
+extern void gripe_invalid_conversion (const string& from, const string& to);
 extern void gripe_invalid_value_specified (const char *name);
 extern void gripe_2_or_3_dim_plot (void);
 extern void gripe_unrecognized_float_fmt (void);
@@ -43,6 +45,8 @@
 extern void gripe_wrong_type_arg (const char *name, const octave_value& tc);
 extern void gripe_wrong_type_arg_for_unary_op (const octave_value& op);
 extern void gripe_wrong_type_arg_for_binary_op (const octave_value& op);
+extern void gripe_implicit_conversion (const char *from, const char *to);
+extern void gripe_divide_by_zero (void);
 
 #endif