changeset 3145:0d640dc625c7

[project @ 1998-02-05 08:44:59 by jwe]
author jwe
date Thu, 05 Feb 1998 08:45:07 +0000
parents fb9924282a3e
children 3d5aefef14e2
files liboctave/ChangeLog liboctave/byte-swap.h liboctave/cmd-edit.cc liboctave/dMatrix.cc liboctave/data-conv.cc liboctave/dir-ops.h liboctave/file-stat.h liboctave/idx-vector.h liboctave/oct-alloc.cc liboctave/oct-group.h liboctave/oct-passwd.h liboctave/prog-args.cc src/ChangeLog src/DLD-FUNCTIONS/minmax.cc src/Map.cc src/OPERATORS/op-s-cm.cc src/defun-int.h src/defun.cc src/dynamic-ld.cc src/load-save.cc src/oct-stream.cc src/oct-stream.h src/ov-base.h src/ov-bool-mat.cc src/ov-bool-mat.h src/ov-bool.h src/ov-ch-mat.h src/ov-complex.h src/ov-cx-mat.h src/ov-range.h src/ov-re-mat.h src/ov-scalar.h src/pt-mat.cc src/symtab.cc src/syscalls.cc src/unwind-prot.h
diffstat 36 files changed, 291 insertions(+), 191 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog	Wed Feb 04 22:53:59 1998 +0000
+++ b/liboctave/ChangeLog	Thu Feb 05 08:45:07 1998 +0000
@@ -1,3 +1,28 @@
+Thu Feb  5 02:12:38 1998  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* dir-ops.h (dir_entry::operator bool ()): Return bool, not void*.
+	* file-stat.h (file_stat::operator bool ()): Likewise.
+	* idx-vector.h (idx_vector::operator bool ()): Likewise.
+	* oct-group.h (octave_group::operator bool ()): Likewise.
+	* oct-passwd.h (octave_passwd::operator bool ()): Likewise.
+
+	* data-conv.cc (IEEE_little_double_to_IEEE_big_double):
+	Don't cast arg in call to swap_8_bytes.
+	(IEEE_big_double_to_IEEE_little_double): Ditto
+	(IEEE_big_float_to_IEEE_little_float): Don't cast arg in call to
+	swap_4_bytes.
+	(IEEE_little_float_to_IEEE_big_float): Ditto
+
+	* oct-alloc.cc (grow): Use X_CAST, not static_cast.
+	* prog-args.cc (prog_args::getopt): Likewise.
+	* dMatrix.cc (read_int, do_read, write_int, do_write): Likewise.
+	* cmd-edit.cc (gnu_readline::do_set_completion_function): Likewise.
+	* data-conv.cc (LS_DO_READ, LS_DO_WRITE, read_doubles, write_doubles):
+	Likewise.
+
+	* byte-swap.h (swap_bytes, swap_2_bytes, swap_4_bytes,
+	swap_8_bytes): Declare ptr arg as void*, then use cast.
+
 Mon Feb  2 01:42:56 1998  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* Makefile.in (install, uninstall): Use $(octlibdir), not $(libdir).
--- a/liboctave/byte-swap.h	Wed Feb 04 22:53:59 1998 +0000
+++ b/liboctave/byte-swap.h	Thu Feb 05 08:45:07 1998 +0000
@@ -24,29 +24,37 @@
 #define octave_byte_swap_h 1
 
 static inline void
-swap_bytes (char *t, unsigned int i, unsigned int j)
+swap_bytes (void *ptr, unsigned int i, unsigned int j)
 {
+  char *t = static_cast<char *> (ptr);
+
   char tmp = t[i];
   t[i] = t[j];
   t[j] = tmp;
 }
 
 static inline void
-swap_2_bytes (char *t)
+swap_2_bytes (void *ptr)
 {
+  char *t = static_cast<char *> (ptr);
+
   swap_bytes (t, 0, 1);
 }
 
 static inline void
-swap_4_bytes (char *t)
+swap_4_bytes (void *ptr)
 {
+  char *t = static_cast<char *> (ptr);
+
   swap_bytes (t, 0, 3);
   swap_bytes (t, 1, 2);
 }
 
 static inline void
-swap_8_bytes (char *t)
+swap_8_bytes (void *ptr)
 {
+  char *t = static_cast<char *> (ptr);
+
   swap_bytes (t, 0, 7);
   swap_bytes (t, 1, 6);
   swap_bytes (t, 2, 5);
@@ -54,35 +62,38 @@
 }
 
 static inline void
-swap_2_bytes (char *t, int len)
+swap_2_bytes (void *ptr, int len)
 {
-  char *ptr = t;
+  char *t = static_cast<char *> (ptr);
+
   for (int i = 0; i < len; i++)
     {
-      swap_2_bytes (ptr);
-      ptr += 2;
+      swap_2_bytes (t);
+      t += 2;
     }
 }
 
 static inline void
-swap_4_bytes (char *t, int len)
+swap_4_bytes (void *ptr, int len)
 {
-  char *ptr = t;
+  char *t = static_cast<char *> (ptr);
+
   for (int i = 0; i < len; i++)
     {
-      swap_4_bytes (ptr);
-      ptr += 4;
+      swap_4_bytes (t);
+      t += 4;
     }
 }
 
 static inline void
-swap_8_bytes (char *t, int len)
+swap_8_bytes (void *ptr, int len)
 {
-  char *ptr = t;
+  char *t = static_cast<char *> (ptr);
+
   for (int i = 0; i < len; i++)
     {
-      swap_8_bytes (ptr);
-      ptr += 8;
+      swap_8_bytes (t);
+      t += 8;
     }
 }
 
--- a/liboctave/cmd-edit.cc	Wed Feb 04 22:53:59 1998 +0000
+++ b/liboctave/cmd-edit.cc	Thu Feb 05 08:45:07 1998 +0000
@@ -277,7 +277,7 @@
 
   rl_attempted_completion_function
     = completion_function
-    ? static_cast<foo> (gnu_readline::command_completer) : 0;
+    ? reinterpret_cast<foo> (gnu_readline::command_completer) : 0;
 }
 
 gnu_readline::completion_fcn
--- a/liboctave/dMatrix.cc	Wed Feb 04 22:53:59 1998 +0000
+++ b/liboctave/dMatrix.cc	Thu Feb 05 08:45:07 1998 +0000
@@ -2377,7 +2377,7 @@
 static void
 read_int (istream& is, bool swap_bytes, T& val)
 {
-  is.read (static_cast<char *> (&val), sizeof (T));
+  is.read (X_CAST (char *, &val), sizeof (T));
 
   if (swap_bytes)
     {
@@ -2387,15 +2387,15 @@
 	  break;
 
 	case 2:
-	  swap_2_bytes (static_cast<char *> (&val));
+	  swap_2_bytes (X_CAST (char *, &val));
 	  break;
 
 	case 4:
-	  swap_4_bytes (static_cast<char *> (&val));
+	  swap_4_bytes (X_CAST (char *, &val));
 	  break;
 
 	case 8:
-	  swap_8_bytes (static_cast<char *> (&val));
+	  swap_8_bytes (X_CAST (char *, &val));
 	  break;
 
 	default:
@@ -2500,7 +2500,7 @@
       {
 	float f;
 
-	is.read (static_cast<char *> (&f), sizeof (float));
+	is.read (X_CAST (char *, &f), sizeof (float));
 
 	if (do_float_conversion)
 	  do_float_format_conversion (&f, 1, flt_fmt);
@@ -2511,7 +2511,7 @@
 
     case oct_data_conv::dt_double:
       {
-	is.read (static_cast<char *> (&val), sizeof (double));
+	is.read (X_CAST (char *, &val), sizeof (double));
 
 	if (do_float_conversion)
 	  do_double_format_conversion (&val, 1, flt_fmt);
@@ -2691,15 +2691,15 @@
 	  break;
 
 	case 2:
-	  swap_2_bytes (static_cast<char *> (&val));
+	  swap_2_bytes (X_CAST (char *, &val));
 	  break;
 
 	case 4:
-	  swap_4_bytes (static_cast<char *> (&val));
+	  swap_4_bytes (X_CAST (char *, &val));
 	  break;
 
 	case 8:
-	  swap_8_bytes (static_cast<char *> (&val));
+	  swap_8_bytes (X_CAST (char *, &val));
 	  break;
 
 	default:
@@ -2708,7 +2708,7 @@
 	}
     }
 
-  os.write (static_cast<char *> (&val), sizeof (T));
+  os.write (X_CAST (char *, &val), sizeof (T));
 }
 
 template void write_int (ostream&, bool, char);
@@ -2731,39 +2731,39 @@
   switch (dt)
     {
     case oct_data_conv::dt_char:
-      write_int (os, swap_bytes, static_cast<char> (d));
+      write_int (os, swap_bytes, X_CAST (char, d));
       break;
 
     case oct_data_conv::dt_schar:
-      write_int (os, swap_bytes, static_cast<signed char> (d));
+      write_int (os, swap_bytes, X_CAST (signed char, d));
       break;
 
     case oct_data_conv::dt_uchar:
-      write_int (os, swap_bytes, static_cast<unsigned char> (d));
+      write_int (os, swap_bytes, X_CAST (unsigned char, d));
       break;
 
     case oct_data_conv::dt_short:
-      write_int (os, swap_bytes, static_cast<short> (d));
+      write_int (os, swap_bytes, X_CAST (short, d));
       break;
 
     case oct_data_conv::dt_ushort:
-      write_int (os, swap_bytes, static_cast<unsigned short> (d));
+      write_int (os, swap_bytes, X_CAST (unsigned short, d));
       break;
 
     case oct_data_conv::dt_int:
-      write_int (os, swap_bytes, static_cast<int> (d));
+      write_int (os, swap_bytes, X_CAST (int, d));
       break;
 
     case oct_data_conv::dt_uint:
-      write_int (os, swap_bytes, static_cast<unsigned int> (d));
+      write_int (os, swap_bytes, X_CAST (unsigned int, d));
       break;
 
     case oct_data_conv::dt_long:
-      write_int (os, swap_bytes, static_cast<long> (d));
+      write_int (os, swap_bytes, X_CAST (long, d));
       break;
 
     case oct_data_conv::dt_ulong:
-      write_int (os, swap_bytes, static_cast<unsigned long> (d));
+      write_int (os, swap_bytes, X_CAST (unsigned long, d));
       break;
 
     case oct_data_conv::dt_float:
@@ -2773,7 +2773,7 @@
 	if (do_float_conversion)
 	  do_float_format_conversion (&f, 1, flt_fmt);
 
-	os.write (static_cast<char *> (&f), sizeof (float));
+	os.write (X_CAST (char *, &f), sizeof (float));
       }
       break;
 
@@ -2782,7 +2782,7 @@
 	if (do_float_conversion)
 	  do_double_format_conversion (&d, 1, flt_fmt);
 
-	os.write (static_cast<char *> (&d), sizeof (double));
+	os.write (X_CAST (char *, &d), sizeof (double));
       }
       break;
 
--- a/liboctave/data-conv.cc	Wed Feb 04 22:53:59 1998 +0000
+++ b/liboctave/data-conv.cc	Thu Feb 05 08:45:07 1998 +0000
@@ -106,10 +106,10 @@
 #define LS_DO_READ(TYPE,swap,data,size,len,stream) \
   do \
     { \
-      volatile TYPE *ptr = (TYPE *) data; \
-      stream.read ((TYPE *) ptr, size * len); \
+      volatile TYPE *ptr = X_CAST (volatile TYPE *, data); \
+      stream.read (X_CAST (TYPE *, ptr), size * len); \
       if (swap) \
-        swap_ ## size ## _bytes (static_cast<char *> (ptr), len); \
+        swap_ ## size ## _bytes (ptr, len); \
       TYPE tmp = ptr[0]; \
       for (int i = len - 1; i > 0; i--) \
         data[i] = ptr[i]; \
@@ -127,8 +127,8 @@
       stream.write (&tmp_type, 1); \
       TYPE *ptr = new TYPE [len]; \
       for (int i = 0; i < len; i++) \
-        ptr[i] = (TYPE) data[i]; \
-      stream.write ((TYPE *) ptr, size * len); \
+        ptr[i] = X_CAST (TYPE, data[i]); \
+      stream.write (ptr, size * len); \
       delete [] ptr ; \
     } \
   while (0)
@@ -161,7 +161,7 @@
 static void
 IEEE_big_double_to_IEEE_little_double (double *d, int len)
 {
-  swap_8_bytes (static_cast<char *> (d), len);
+  swap_8_bytes (d, len);
 }
 
 static void
@@ -185,7 +185,7 @@
 static void
 IEEE_big_float_to_IEEE_little_float (float *d, int len)
 {
-  swap_4_bytes (static_cast<char *> (d), len);
+  swap_4_bytes (d, len);
 }
 
 static void
@@ -209,7 +209,7 @@
 static void
 IEEE_little_double_to_IEEE_big_double (double *d, int len)
 {
-  swap_8_bytes (static_cast<char *> (d), len);
+  swap_8_bytes (d, len);
 }
 
 static void
@@ -233,7 +233,7 @@
 static void
 IEEE_little_float_to_IEEE_big_float (float *d, int len)
 {
-  swap_4_bytes (static_cast<char *> (d), len);
+  swap_4_bytes (d, len);
 }
 
 static void
@@ -634,9 +634,9 @@
 
     case LS_FLOAT:
       {
-	volatile float *ptr = static_cast<float *> (data);
+	volatile float *ptr = X_CAST (float *, data);
 	is.read (data, 4 * len);
-	do_float_format_conversion (static_cast<float *> (data), len, fmt);
+	do_float_format_conversion (X_CAST (float *, data), len, fmt);
 	float tmp = ptr[0];
 	for (int i = len - 1; i > 0; i--)
 	  data[i] = ptr[i];
@@ -690,7 +690,7 @@
 
     case LS_DOUBLE:
       {
-	char tmp_type = static_cast<char> (type);
+	char tmp_type = X_CAST (char, type);
 	os.write (&tmp_type, 1);
 	os.write (data, 8 * len);
       }
--- a/liboctave/dir-ops.h	Wed Feb 04 22:53:59 1998 +0000
+++ b/liboctave/dir-ops.h	Thu Feb 05 08:45:07 1998 +0000
@@ -58,7 +58,7 @@
 
   bool ok (void) const { return dir && ! fail; }
 
-  operator void* () const { return ok () ? (void *) -1 : (void *) 0; }
+  operator bool () const { return ok (); }
 
   string error (void) const { return ok () ? string () : errmsg; }
 
--- a/liboctave/file-stat.h	Wed Feb 04 22:53:59 1998 +0000
+++ b/liboctave/file-stat.h	Thu Feb 05 08:45:07 1998 +0000
@@ -112,9 +112,7 @@
 
   bool ok (void) const { return initialized && ! fail; }
 
-  operator void* () const
-    { return ok ()
-	? static_cast<void *> (-1) : static_cast<void *> (0); }
+  operator bool () const { return ok (); }
 
   bool exists (void) const { return ok (); }
 
--- a/liboctave/idx-vector.h	Wed Feb 04 22:53:59 1998 +0000
+++ b/liboctave/idx-vector.h	Thu Feb 05 08:45:07 1998 +0000
@@ -212,8 +212,7 @@
       return *this;
     }
 
-  operator void * () const
-    { return static_cast<void *> (rep->ok ()); }
+  operator bool () const { return rep->ok (); }
 
   int capacity (void) const { return rep->capacity (); }
   int length (int cl) const { return rep->length (cl); }
--- a/liboctave/oct-alloc.cc	Wed Feb 04 22:53:59 1998 +0000
+++ b/liboctave/oct-alloc.cc	Thu Feb 05 08:45:07 1998 +0000
@@ -79,13 +79,13 @@
       while (p < last)
 	{
 	  char *next = p + item_size;
-	  (static_cast<link *> (p)) -> next = static_cast<link *> (next);
+	  (X_CAST (link *, p)) -> next = X_CAST (link *, next);
 	  p = next;
 	}
 
-      (static_cast<link *> (last)) -> next = 0;
+      (X_CAST (link *, last)) -> next = 0;
 
-      head = static_cast<link *> (start);
+      head = X_CAST (link *, start);
     }
   else
     {
--- a/liboctave/oct-group.h	Wed Feb 04 22:53:59 1998 +0000
+++ b/liboctave/oct-group.h	Thu Feb 05 08:45:07 1998 +0000
@@ -69,9 +69,7 @@
 
   bool ok (void) const { return valid; }
 
-  operator void* () const
-    { return ok ()
-	? static_cast<void *> (-1) : static_cast<void *> (0); }
+  operator bool () const { return ok (); }
 
   static octave_group getgrent (void);
   static octave_group getgrent (string& msg);
--- a/liboctave/oct-passwd.h	Wed Feb 04 22:53:59 1998 +0000
+++ b/liboctave/oct-passwd.h	Thu Feb 05 08:45:07 1998 +0000
@@ -80,9 +80,7 @@
 
   bool ok (void) const { return valid; }
 
-  operator void* () const
-    { return ok ()
-	? static_cast<void *> (-1) : static_cast<void *> (0); }
+  operator bool () const { return ok (); }
 
   static octave_passwd getpwent (void);
   static octave_passwd getpwent (string& msg);
--- a/liboctave/prog-args.cc	Wed Feb 04 22:53:59 1998 +0000
+++ b/liboctave/prog-args.cc	Thu Feb 05 08:45:07 1998 +0000
@@ -33,7 +33,7 @@
 {
   if (long_opts)
     return ::getopt_long (xargc, xargv, short_opts,
-			  static_cast<const struct option *> (long_opts), 0);
+			  X_CAST (const struct option *, long_opts), 0);
   else
     return ::getopt (xargc, xargv, short_opts);
 }
--- a/src/ChangeLog	Wed Feb 04 22:53:59 1998 +0000
+++ b/src/ChangeLog	Thu Feb 05 08:45:07 1998 +0000
@@ -1,3 +1,47 @@
+Thu Feb  5 02:27:18 1998  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* ov-bool-mat.cc: Only declare assign function if
+	CXX_NEW_FRIEND_TEMPLATE_DECL is not defined.
+
+	* ov-base.h, ov-bool-mat.h, ov-bool.h, ov-ch-mat.h, ov-complex.h,
+	ov-cx-mat.h, ov-range.h, ov-re-mat.h, ov-scalar.h: Handle default
+	args for *_value functions consistently.
+
+	* symtab.cc (maybe_list_cmp_fcn): Declare args as void*, not
+	void**, then use X_CAST.
+
+	* OPERATORS/op-s-cm.cc: Include mx-cm-s.h.
+
+	* defun-int.h: Include ov-builtin.h, ov-mapper.h, and symtab.h.
+	(install_builtin_mapper, install_builtin_function,
+	install_builtin_variable) Use specific types rather than void * in
+	declaration.
+	* defun.cc (install_builtin_mapper, install_builtin_function,
+	install_builtin_variable): Likewise.  Eliminate casts.
+
+	* load-save.cc (read_binary_data, read_mat_file_header,
+	save_binary_data): Use X_CAST, not static_cast.
+	* unwind-prot.h (unwind_protect::save_ptr): Likewise.
+	* Map.cc (goodCHptr, index_to_CHptr, CHptr_to_index): Likewise.
+	* dynamic-ld.cc (octave_dlopen_dynamic_loder::resolve_reference):
+	Likewise.
+
+	* pt-mat.cc (tm_const::operator bool ()): 
+	(tm_row_const::operator bool ()): Likewise.
+	* oct-stream.cc (printf_value_cache::operator bool ()): Likewise.
+	(scanf_format_list::operator bool ()): Likewise.
+	(printf_format_list::operator bool ()): Likewise.
+	(octave_stream::operator bool ()): Likewise.
+
+Wed Feb  4 13:08:29 1998  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* DLD-FUNCTIONS/minmax.cc: Include cmath, not oct-math.h.
+
+	* syscalls.cc (Fdup2): Convert stream to actual system file id.
+
+	* oct-stream.cc (octave_base_stream::fileno, octave_stream::fileno): 
+	New functions.
+
 Tue Feb  3 00:24:44 1998  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* defaults.cc (exec_path): Append Vbin_dir to std_path.
--- a/src/DLD-FUNCTIONS/minmax.cc	Wed Feb 04 22:53:59 1998 +0000
+++ b/src/DLD-FUNCTIONS/minmax.cc	Thu Feb 05 08:45:07 1998 +0000
@@ -24,8 +24,9 @@
 #include <config.h>
 #endif
 
+#include <cmath>
+
 #include "lo-ieee.h"
-#include "oct-math.h"
 
 #include "defun-dld.h"
 #include "error.h"
--- a/src/Map.cc	Wed Feb 04 22:53:59 1998 +0000
+++ b/src/Map.cc	Thu Feb 05 08:45:07 1998 +0000
@@ -116,22 +116,20 @@
 static int
 goodCHptr (CHNode<C> *t)
 {
-  return (((static_cast<unsigned> (t)) & 1) == 0);
+  return (((X_CAST (unsigned, t)) & 1) == 0);
 }
 
-// This sucks, but avoids g++ 2.6.0 `type unification failed' errors.
-
 static void *
 index_to_CHptr (int i)
 {
-  return static_cast<void *> ((i << 1) + 1);
+  return X_CAST (void *, (i << 1) + 1);
 }
 
 template <class C>
 static unsigned int
 CHptr_to_index (CHNode<C> *t)
 {
-  return (static_cast<unsigned> (t)) >> 1;
+  return (X_CAST (unsigned, t)) >> 1;
 }
 
 template <class C>
--- a/src/OPERATORS/op-s-cm.cc	Wed Feb 04 22:53:59 1998 +0000
+++ b/src/OPERATORS/op-s-cm.cc	Thu Feb 05 08:45:07 1998 +0000
@@ -29,6 +29,7 @@
 #endif
 
 #include "mx-s-cm.h"
+#include "mx-cm-s.h"
 
 #include "gripes.h"
 #include "ov.h"
--- a/src/defun-int.h	Wed Feb 04 22:53:59 1998 +0000
+++ b/src/defun-int.h	Thu Feb 05 08:45:07 1998 +0000
@@ -25,6 +25,9 @@
 
 #include <string>
 
+#include "ov-builtin.h"
+#include "ov-mapper.h"
+#include "symtab.h"
 #include "version.h"
 
 class octave_value;
@@ -33,19 +36,17 @@
 
 extern void check_version (const string& version, const string& fcn);
 
-// XXX FIXME XXX -- change to use actual pointer types instead of void*
-// when things are not changing as rapidly.
+extern void
+install_builtin_mapper (octave_mapper *mf);
 
 extern void
-install_builtin_mapper (void *mf);
-
-extern void
-install_builtin_function (void *f, const string& name, const string& doc,
-			  bool is_text_fcn = false);
+install_builtin_function (octave_builtin::fcn f, const string& name,
+			  const string& doc, bool is_text_fcn = false);
 
 extern void
 install_builtin_variable (const string& n, const octave_value& v,
-			  bool iaf, bool p, bool e, void *svf,
+			  bool iaf, bool p, bool e,
+			  symbol_record::change_function chg_fcn,
 			  const string& h);
 
 extern void
--- a/src/defun.cc	Wed Feb 04 22:53:59 1998 +0000
+++ b/src/defun.cc	Thu Feb 05 08:45:07 1998 +0000
@@ -69,10 +69,8 @@
 // Install variables and functions in the symbol tables.
 
 void
-install_builtin_mapper (void *mf_arg)
+install_builtin_mapper (octave_mapper *mf)
 {
-  octave_mapper *mf = static_cast<octave_mapper *> (mf_arg);
-
   symbol_record *sym_rec = global_sym_tab->lookup (mf->name (), true);
 
   unsigned int t
@@ -86,11 +84,9 @@
 }
 
 void
-install_builtin_function (void *f_arg, const string& name,
+install_builtin_function (octave_builtin::fcn f, const string& name,
 			  const string& doc, bool is_text_fcn)
 {
-  octave_builtin::fcn f = static_cast<octave_builtin::fcn> (f_arg);
-
   symbol_record *sym_rec = global_sym_tab->lookup (name, true);
 
   unsigned int t = symbol_record::BUILTIN_FUNCTION;
@@ -129,13 +125,11 @@
 
 void
 install_builtin_variable (const string& name, const octave_value& value,
-			  bool install_as_function, bool protect,
-			  bool eternal, void *chg_fcn_arg,
+			  bool install_as_function,
+			  bool protect, bool eternal,
+			  symbol_record::change_function chg_fcn,
 			  const string& help_string)
 {
-  symbol_record::change_function chg_fcn
-    = static_cast<symbol_record::change_function> (chg_fcn_arg);
-
   if (install_as_function)
     install_builtin_variable_as_function (name, value, protect,
 					  eternal, help_string);
--- a/src/dynamic-ld.cc	Wed Feb 04 22:53:59 1998 +0000
+++ b/src/dynamic-ld.cc	Thu Feb 05 08:45:07 1998 +0000
@@ -98,7 +98,7 @@
     {
       void *tmp = dlsym (handle, nm);
 
-      retval = static_cast<octave_dynamic_loader::builtin_fcn_installer> (tmp);
+      retval = X_CAST (octave_dynamic_loader::builtin_fcn_installer, tmp);
 
       if (! retval)
 	{
--- a/src/load-save.cc	Wed Feb 04 22:53:59 1998 +0000
+++ b/src/load-save.cc	Thu Feb 05 08:45:07 1998 +0000
@@ -754,7 +754,7 @@
   if (! is)
     return 0;
   if (swap)
-    swap_4_bytes (static_cast<char *> (&name_len));
+    swap_4_bytes (X_CAST (char *, &name_len));
 
   name = new char [name_len+1];
   name[name_len] = '\0';
@@ -765,7 +765,7 @@
   if (! is)
     goto data_read_error;
   if (swap)
-    swap_4_bytes (static_cast<char *> (&doc_len));
+    swap_4_bytes (X_CAST (char *, &doc_len));
 
   doc = new char [doc_len+1];
   doc[doc_len] = '\0';
@@ -787,7 +787,7 @@
 	if (! is.read (&tmp, 1))
 	  goto data_read_error;
 	double dtmp;
-	read_doubles (is, &dtmp, static_cast<save_type> (tmp), 1, swap, fmt);
+	read_doubles (is, &dtmp, X_CAST (save_type, tmp), 1, swap, fmt);
 	if (error_state || ! is)
 	  goto data_read_error;
 	tc = dtmp;
@@ -800,17 +800,17 @@
 	if (! is.read (&nr, 4))
 	  goto data_read_error;
 	if (swap)
-	  swap_4_bytes (static_cast<char *> (&nr));
+	  swap_4_bytes (X_CAST (char *, &nr));
 	if (! is.read (&nc, 4))
 	  goto data_read_error;
 	if (swap)
-	  swap_4_bytes (static_cast<char *> (&nc));
+	  swap_4_bytes (X_CAST (char *, &nc));
 	if (! is.read (&tmp, 1))
 	  goto data_read_error;
 	Matrix m (nr, nc);
 	double *re = m.fortran_vec ();
 	int len = nr * nc;
-	read_doubles (is, re, static_cast<save_type> (tmp), len, swap, fmt);
+	read_doubles (is, re, X_CAST (save_type, tmp), len, swap, fmt);
 	if (error_state || ! is)
 	  goto data_read_error;
 	tc = m;
@@ -822,8 +822,8 @@
 	if (! is.read (&tmp, 1))
 	  goto data_read_error;
 	Complex ctmp;
-	read_doubles (is, static_cast<double *> (&ctmp),
-		      static_cast<save_type> (tmp), 2, swap, fmt);
+	read_doubles (is, X_CAST (double *, &ctmp),
+		      X_CAST (save_type, tmp), 2, swap, fmt);
 	if (error_state || ! is)
 	  goto data_read_error;
 	tc = ctmp;
@@ -836,18 +836,18 @@
 	if (! is.read (&nr, 4))
 	  goto data_read_error;
 	if (swap)
-	  swap_4_bytes (static_cast<char *> (&nr));
+	  swap_4_bytes (X_CAST (char *, &nr));
 	if (! is.read (&nc, 4))
 	  goto data_read_error;
 	if (swap)
-	  swap_4_bytes (static_cast<char *> (&nc));
+	  swap_4_bytes (X_CAST (char *, &nc));
 	if (! is.read (&tmp, 1))
 	  goto data_read_error;
 	ComplexMatrix m (nr, nc);
 	Complex *im = m.fortran_vec ();
 	int len = nr * nc;
-	read_doubles (is, static_cast<double *> (im),
-		      static_cast<save_type> (tmp), 2*len, swap, fmt);
+	read_doubles (is, X_CAST (double *, im),
+		      X_CAST (save_type, tmp), 2*len, swap, fmt);
 	if (error_state || ! is)
 	  goto data_read_error;
 	tc = m;
@@ -860,7 +860,7 @@
 	if (! is.read (&len, 4))
 	  goto data_read_error;
 	if (swap)
-	  swap_4_bytes (static_cast<char *> (&len));
+	  swap_4_bytes (X_CAST (char *, &len));
 	char *s = new char [len+1];
 	if (! is.read (s, len))
 	  {
@@ -880,15 +880,15 @@
 	if (! is.read (&bas, 8))
 	  goto data_read_error;
 	if (swap)
-	  swap_8_bytes (static_cast<char *> (&bas));
+	  swap_8_bytes (X_CAST (char *, &bas));
 	if (! is.read (&lim, 8))
 	  goto data_read_error;
 	if (swap)
-	  swap_8_bytes (static_cast<char *> (&lim));
+	  swap_8_bytes (X_CAST (char *, &lim));
 	if (! is.read (&inc, 8))
 	  goto data_read_error;
 	if (swap)
-	  swap_8_bytes (static_cast<char *> (&inc));
+	  swap_8_bytes (X_CAST (char *, &inc));
 	Range r (bas, lim, inc);
 	tc = r;
       }
@@ -900,7 +900,7 @@
 	if (! is.read (&elements, 4))
 	  goto data_read_error;
 	if (swap)
-	  swap_4_bytes (static_cast<char *> (&elements));
+	  swap_4_bytes (X_CAST (char *, &elements));
 	charMatrix chm (elements, 0);
 	int max_len = 0;
 	for (int i = 0; i < elements; i++)
@@ -909,7 +909,7 @@
 	    if (! is.read (&len, 4))
 	      goto data_read_error;
 	    if (swap)
-	      swap_4_bytes (static_cast<char *> (&len));
+	      swap_4_bytes (X_CAST (char *, &len));
 	    char *tmp = new char [len+1];
 	    if (! is.read (tmp, len))
 	      {
@@ -1152,11 +1152,11 @@
 
   if (swap)
     {
-      swap_4_bytes (static_cast<char *> (&mopt));
-      swap_4_bytes (static_cast<char *> (&nr));
-      swap_4_bytes (static_cast<char *> (&nc));
-      swap_4_bytes (static_cast<char *> (&imag));
-      swap_4_bytes (static_cast<char *> (&len));
+      swap_4_bytes (X_CAST (char *, &mopt));
+      swap_4_bytes (X_CAST (char *, &nr));
+      swap_4_bytes (X_CAST (char *, &nc));
+      swap_4_bytes (X_CAST (char *, &imag));
+      swap_4_bytes (X_CAST (char *, &len));
     }
 
   if (mopt > 9999 || mopt < 0 || imag > 1 || imag < 0)
@@ -1918,7 +1918,7 @@
 	    st = get_save_type (max_val, min_val);
 	}
       const Complex *mtmp = m.data ();
-      write_doubles (os, static_cast<const double *> (mtmp), st, 2*len);
+      write_doubles (os, X_CAST (const double *, mtmp), st, 2*len);
     }
   else if (tc.is_string ())
     {
--- a/src/oct-stream.cc	Wed Feb 04 22:53:59 1998 +0000
+++ b/src/oct-stream.cc	Thu Feb 05 08:45:07 1998 +0000
@@ -720,6 +720,41 @@
     }
 }
 
+int
+octave_base_stream::fileno (void)
+{
+  // Kluge alert!
+
+  if (name () == "stdin")
+    return 0;
+
+  if (name () == "stdout")
+    return 1;
+
+  if (name () == "stderr")
+    return 2;
+
+  int retval = -1;
+
+  istream *is = input_stream ();
+  ostream *os = output_stream ();
+
+  int i_fid = is ? ((filebuf *) (is->rdbuf ()))->fd () : -1;
+  int o_fid = os ? ((filebuf *) (os->rdbuf ()))->fd () : -1;
+
+  if (i_fid >= 0)
+    {
+      if (o_fid >= 0)
+	retval = (i_fid == o_fid) ? i_fid : -1;
+      else
+	retval = i_fid;
+    }
+  else if (o_fid >= 0)
+    retval = o_fid;
+
+  return retval;
+}
+
 void
 octave_base_stream::error (const string& msg)
 {
@@ -1541,11 +1576,7 @@
   // Get the current value as a string and advance the internal pointer.
   string string_value (void);
 
-  operator void* () const
-    {
-      return (curr_state == ok)
-	? static_cast<void *> (-1) : static_cast<void *> (0);
-    }
+  operator bool () const { return (curr_state == ok); }
 
   bool no_more_values (void) { return curr_state == list_exhausted; }
 
--- a/src/oct-stream.h	Wed Feb 04 22:53:59 1998 +0000
+++ b/src/oct-stream.h	Thu Feb 05 08:45:07 1998 +0000
@@ -93,11 +93,7 @@
 
   bool ok (void) const { return (nconv >= 0); }
 
-  operator void* () const
-    {
-      return ok ()
-	? static_cast<void *> (-1) : static_cast<void *> (0);
-    }
+  operator bool () const { return ok (); }
 
   bool all_character_conversions (void);
 
@@ -182,11 +178,7 @@
 
   bool ok (void) const { return (nconv >= 0); }
 
-  operator void* () const
-    {
-      return ok ()
-	? static_cast<void *> (-1) : static_cast<void *> (0);
-    }
+  operator bool () const { return ok (); }
 
 private:
 
@@ -265,6 +257,8 @@
 
   virtual ostream *output_stream (void) { return 0; }
 
+  int fileno (void);
+
   bool ok (void) const { return ! fail; }
 
   // Return current error message for this stream.
@@ -418,13 +412,11 @@
       return error (clear, err_num);
     }
 
+  int fileno (void) { return rep ? rep->fileno () : -1; }
+
   bool ok (void) const { return rep && rep->ok (); }
 
-  operator void* () const
-    {
-      return ok ()
-	? static_cast<void *> (-1) : static_cast<void *> (0);
-    }
+  operator bool () const { return ok (); }
 
   string name (void);
 
--- a/src/ov-base.h	Wed Feb 04 22:53:59 1998 +0000
+++ b/src/ov-base.h	Thu Feb 05 08:45:07 1998 +0000
@@ -146,17 +146,18 @@
 
   bool is_function (void) const { return false; }
 
-  double double_value (bool) const;
+  double double_value (bool = false) const;
 
-  double scalar_value (bool) const { return double_value (); }
-
-  Matrix matrix_value (bool frc_str_conv = false) const;
+  double scalar_value (bool frc_str_conv = false) const
+    { return double_value (frc_str_conv); }
 
-  Complex complex_value (bool frc_str_conv = false) const;
+  Matrix matrix_value (bool = false) const;
+
+  Complex complex_value (bool = false) const;
 
-  ComplexMatrix complex_matrix_value (bool frc_str_conv = false) const;
+  ComplexMatrix complex_matrix_value (bool = false) const;
 
-  charMatrix char_matrix_value (bool frc_str_conv = false) const;
+  charMatrix char_matrix_value (bool = false) const;
 
   string_vector all_strings (void) const;
 
--- a/src/ov-bool-mat.cc	Wed Feb 04 22:53:59 1998 +0000
+++ b/src/ov-bool-mat.cc	Thu Feb 05 08:45:07 1998 +0000
@@ -112,7 +112,9 @@
   return retval;
 }
 
+#if !defined (CXX_NEW_FRIEND_TEMPLATE_DECL)
 extern void assign (Array2<bool>&, const Array2<bool>&);
+#endif
 
 void
 octave_bool_matrix::assign (const octave_value_list& idx,
--- a/src/ov-bool-mat.h	Wed Feb 04 22:53:59 1998 +0000
+++ b/src/ov-bool-mat.h	Thu Feb 05 08:45:07 1998 +0000
@@ -107,15 +107,18 @@
 
   double double_value (bool = false) const;
 
-  double scalar_value (bool = false) const { return double_value (); }
+  double scalar_value (bool frc_str_conv = false) const
+    { return double_value (frc_str_conv); }
 
   Matrix matrix_value (bool = false) const { return matrix; }
 
   Complex complex_value (bool = false) const;
 
-  ComplexMatrix complex_matrix_value (bool = false) const { return matrix; }
+  ComplexMatrix complex_matrix_value (bool = false) const
+    { return matrix; }
 
-  boolMatrix bool_matrix_value (bool = false) const { return matrix; }
+  boolMatrix bool_matrix_value (bool = false) const
+    { return matrix; }
 
   octave_value convert_to_str (void) const
     { return octave_value (matrix); }
--- a/src/ov-bool.h	Wed Feb 04 22:53:59 1998 +0000
+++ b/src/ov-bool.h	Thu Feb 05 08:45:07 1998 +0000
@@ -104,7 +104,8 @@
 
   double scalar_value (bool = false) const { return scalar; }
 
-  Matrix matrix_value (bool = false) const { return Matrix (1, 1, scalar); }
+  Matrix matrix_value (bool = false) const
+    { return Matrix (1, 1, scalar); }
 
   Complex complex_value (bool = false) const { return scalar; }
 
--- a/src/ov-ch-mat.h	Wed Feb 04 22:53:59 1998 +0000
+++ b/src/ov-ch-mat.h	Thu Feb 05 08:45:07 1998 +0000
@@ -106,15 +106,18 @@
 
   double double_value (bool = false) const;
 
-  double scalar_value (bool = false) const { return double_value (); }
+  double scalar_value (bool frc_str_conv = false) const
+    { return double_value (frc_str_conv); }
 
   Matrix matrix_value (bool = false) const { return matrix; }
 
   Complex complex_value (bool = false) const;
 
-  ComplexMatrix complex_matrix_value (bool = false) const { return matrix; }
+  ComplexMatrix complex_matrix_value (bool = false) const
+    { return matrix; }
 
-  charMatrix char_matrix_value (bool = false) const { return matrix; }
+  charMatrix char_matrix_value (bool = false) const
+    { return matrix; }
 
   octave_value convert_to_str (void) const
     { return octave_value (matrix, true); }
--- a/src/ov-complex.h	Wed Feb 04 22:53:59 1998 +0000
+++ b/src/ov-complex.h	Thu Feb 05 08:45:07 1998 +0000
@@ -104,7 +104,8 @@
 
   double double_value (bool = false) const;
 
-  double scalar_value (bool = false) const { return double_value (); }
+  double scalar_value (bool frc_str_conv = false) const
+    { return double_value (frc_str_conv); }
 
   Matrix matrix_value (bool = false) const;
 
--- a/src/ov-cx-mat.h	Wed Feb 04 22:53:59 1998 +0000
+++ b/src/ov-cx-mat.h	Thu Feb 05 08:45:07 1998 +0000
@@ -112,9 +112,10 @@
 
   bool is_empty (void) const { return (rows () == 0 && columns () == 0); }
 
-  double double_value (bool) const;
+  double double_value (bool = false) const;
 
-  double scalar_value (bool) const { return double_value (); }
+  double scalar_value (bool frc_str_conv = false) const
+    { return double_value (frc_str_conv); }
 
   Matrix matrix_value (bool = false) const;
 
--- a/src/ov-range.h	Wed Feb 04 22:53:59 1998 +0000
+++ b/src/ov-range.h	Thu Feb 05 08:45:07 1998 +0000
@@ -127,16 +127,17 @@
   // XXX DO ME XXX
   bool is_true (void) const;
 
-  double double_value (bool) const;
+  double double_value (bool = false) const;
 
-  double scalar_value (bool) const { return double_value (); }
+  double scalar_value (bool frc_str_conv = false) const
+    { return double_value (frc_str_conv); }
 
-  Matrix matrix_value (bool) const
+  Matrix matrix_value (bool = false) const
     { return range.matrix_value (); }
 
-  Complex complex_value (bool) const;
+  Complex complex_value (bool = false) const;
 
-  ComplexMatrix complex_matrix_value (bool) const
+  ComplexMatrix complex_matrix_value (bool = false) const
     { return range.matrix_value (); }
 
   Range range_value (void) const { return range; }
--- a/src/ov-re-mat.h	Wed Feb 04 22:53:59 1998 +0000
+++ b/src/ov-re-mat.h	Thu Feb 05 08:45:07 1998 +0000
@@ -128,13 +128,15 @@
 
   double double_value (bool = false) const;
 
-  double scalar_value (bool = false) const { return double_value (); }
+  double scalar_value (bool frc_str_conv = false) const
+    { return double_value (frc_str_conv); }
 
   Matrix matrix_value (bool = false) const { return matrix; }
 
   Complex complex_value (bool = false) const;
 
-  ComplexMatrix complex_matrix_value (bool = false) const { return matrix; }
+  ComplexMatrix complex_matrix_value (bool = false) const
+    { return matrix; }
 
   octave_value not (void) const { return octave_value (! matrix); }
 
--- a/src/ov-scalar.h	Wed Feb 04 22:53:59 1998 +0000
+++ b/src/ov-scalar.h	Thu Feb 05 08:45:07 1998 +0000
@@ -105,7 +105,8 @@
 
   double scalar_value (bool = false) const { return scalar; }
 
-  Matrix matrix_value (bool = false) const { return Matrix (1, 1, scalar); }
+  Matrix matrix_value (bool = false) const
+    { return Matrix (1, 1, scalar); }
 
   Complex complex_value (bool = false) const { return scalar; }
 
--- a/src/pt-mat.cc	Wed Feb 04 22:53:59 1998 +0000
+++ b/src/pt-mat.cc	Thu Feb 05 08:45:07 1998 +0000
@@ -161,11 +161,7 @@
   Pix first (void) const { return rep->first (); }
   void next (Pix& p) const { rep->next (p); }
   
-  operator void* () const
-  {
-    return (rep && rep->ok)
-      ? static_cast<void *> (-1) : static_cast<void *> (0);
-  }
+  operator bool () const { return (rep && rep->ok); }
 
 private:
 
@@ -287,8 +283,7 @@
   bool complex_p (void) const { return is_cmplx; }
   bool all_empty_p (void) const { return all_mt; }
 
-  operator void* () const
-    { return ok ? static_cast<void *> (-1) : static_cast<void *> (0); }
+  operator bool () const { return ok; }
 
 private:
 
--- a/src/symtab.cc	Wed Feb 04 22:53:59 1998 +0000
+++ b/src/symtab.cc	Thu Feb 05 08:45:07 1998 +0000
@@ -562,12 +562,15 @@
 }
 
 static int
-maybe_list_cmp_fcn (symbol_record **a_arg, symbol_record **b_arg)
+maybe_list_cmp_fcn (const void *a_arg, const void *b_arg)
 {
-  string a = (*a_arg)->name ();
-  string b = (*b_arg)->name ();
+  const symbol_record *a = *(X_CAST (const symbol_record **, a_arg));
+  const symbol_record *b = *(X_CAST (const symbol_record **, b_arg));
 
-  return a.compare (b);
+  string a_nm = a->name ();
+  string b_nm = b->name ();
+
+  return a_nm.compare (b_nm);
 }
 
 int
--- a/src/syscalls.cc	Wed Feb 04 22:53:59 1998 +0000
+++ b/src/syscalls.cc	Thu Feb 05 08:45:07 1998 +0000
@@ -106,32 +106,28 @@
 
   if (nargin == 2)
     {
-      double d_old = args(0).double_value ();
-      double d_new = args(1).double_value ();
+      octave_stream *old_stream = octave_stream_list::lookup (args(0));
+      octave_stream *new_stream = octave_stream_list::lookup (args(1));
 
       if (! error_state)
 	{
-	  if (D_NINT (d_old) == d_old && D_NINT (d_new) == d_new)
-	    {
-	      int i_old = NINT (d_old);
-	      int i_new = NINT (d_new);
+	  int i_old = old_stream->fileno ();
+	  int i_new = new_stream->fileno ();
 
-	      // XXX FIXME XXX -- are these checks sufficient?
-	      if (i_old >= 0 && i_new >= 0)
-		{
-		  string msg;
+	  if (i_old >= 0 && i_new >= 0)
+	    {
+	      string msg;
 
-		  int status = octave_syscalls::dup2 (i_old, i_new, msg);
+	      int status = octave_syscalls::dup2 (i_old, i_new, msg);
 
-		  retval(0) = static_cast<double> (status);
-		  retval(1) = msg;
-		}
-	      else
-		error ("dup2: invalid file id");
+	      retval(0) = static_cast<double> (status);
+	      retval(1) = msg;
 	    }
 	  else
-	    error ("dup2: arguments must be integer values");
+	    error ("dup2: invalid file id");
 	}
+      else
+	error ("dup2: invalid stream");
     }
   else
     print_usage ("dup2");
--- a/src/unwind-prot.h	Wed Feb 04 22:53:59 1998 +0000
+++ b/src/unwind-prot.h	Thu Feb 05 08:45:07 1998 +0000
@@ -126,8 +126,7 @@
   unwind_protect::save_str (&(s), (s))
 
 #define unwind_protect_ptr(p) \
-  unwind_protect::save_ptr (static_cast<void **> (&(p)), \
-			    static_cast<void *> (p))
+  unwind_protect::save_ptr (X_CAST (void **, &(p)), X_CAST (void *, (p)))
 
 #endif