changeset 3944:818f5aec1db5

[project @ 2002-05-18 00:05:08 by jwe]
author jwe
date Sat, 18 May 2002 00:05:08 +0000
parents a10df4059532
children b050da7f9994
files liboctave/Array.h liboctave/ChangeLog src/ChangeLog src/c-file-ptr-stream.h src/pt-idx.cc src/symtab.cc
diffstat 6 files changed, 50 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/Array.h
+++ b/liboctave/Array.h
@@ -254,7 +254,7 @@
 
 #endif
 
-  static T resize_fill_value (void) { return static_cast<T> (0); }
+  static T resize_fill_value (void) { return T (); }
 
   void print_info (std::ostream& os, const std::string& prefix) const;
 };
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,3 +1,8 @@
+2002-05-17  Mumit Khan <khan@nanotech.wisc.edu>
+
+	* Array.h (Array<T>::resize_fill_value): Return default initialized
+	object.
+
 2002-05-14  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* oct-rl-edit.c (OCTAVE_RL_SAVE_STRING): New macro.
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
+2002-05-17  Mumit Khan <khan@nanotech.wisc.edu>
+
+	* c-file-ptr-stream.h (OCTAVE_STD_FILEBUF): New macro to handle
+	various forms of extensions to std::filebuf.
+	(c_file_ptr_buf::c_file_ptr_buf): Use.
+	* pt-idx.cc (tree_index_expression::tree_index_expression): Remove
+	default arguments are from definition.
+	* symtab.cc (SYMBOL_DEF::print_info): Add std::.
+	(symbol_record::print_info): Likewise.
+	(symbol_table::print_info): Likewise.
+
 2002-05-16  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* oct-map.cc (Octave_map::assign): Resize RHS if it is shorter
--- a/src/c-file-ptr-stream.h
+++ b/src/c-file-ptr-stream.h
@@ -31,13 +31,37 @@
 #include <fstream>
 #include <cstdio>
 
+//
+// The c_file_ptr_buf requires a std::filebuf that accepts an open
+// file descriptor. This feature, while not part of the ISO C++
+// standard, is supported by a variety of C++ compiler runtimes,
+// albeit in slightly different ways.
+//
+// The C++ runtime libraries shipped with GCC versions < 3.0, Sun Pro,
+// Sun Workshop/Forte 5/6, Compaq C++ all support a non-standard filebuf
+// constructor that takes an open file descriptor. The almost ISO compliant
+// GNU C++ runtime shipped with GCC 3.0.x supports a different non-standard
+// filebuf constructor that takes a FILE* instead; starting from GCC 3.1,
+// the GNU C++ runtime removes all non-standard std::filebuf constructors
+// and provides an extension template class __gnu_cxx::stdio_filebuf
+// that supports the the 3.0.x behavior.
+//
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
+# include <ext/stdio_filebuf.h>
+# define OCTAVE_STD_FILEBUF __gnu_cxx::stdio_filebuf<char>
+#else
+# define OCTAVE_STD_FILEBUF std::filebuf
+#endif
+
 class
-c_file_ptr_buf : public std::filebuf
+c_file_ptr_buf : public OCTAVE_STD_FILEBUF
 {
 public:
 
 #if !defined (CXX_ISO_COMPLIANT_LIBRARY)
   typedef int int_type;
+#else
+  typedef std::filebuf::int_type int_type;
 #endif
 
   typedef int (*close_fcn) (FILE *);
@@ -47,9 +71,9 @@
   c_file_ptr_buf (FILE *f_arg, close_fcn cf_arg = ::fclose)
     : 
 #if defined __GNUC__ && __GNUC__ >= 3
-    std::filebuf (f_arg, std::ios::in | std::ios::out),
+    OCTAVE_STD_FILEBUF (f_arg, std::ios::in | std::ios::out),
 #else
-    std::filebuf (f_arg ? fileno (f_arg) : -1),
+    OCTAVE_STD_FILEBUF (f_arg ? fileno (f_arg) : -1),
 #endif
     f (f_arg), cf (cf_arg),
     fd (f_arg ? fileno (f_arg) : -1)
@@ -94,6 +118,8 @@
   int fd;
 };
 
+#undef OCTAVE_STD_FILEBUF
+
 class
 i_c_file_ptr_stream : public std::istream
 {
--- a/src/pt-idx.cc
+++ b/src/pt-idx.cc
@@ -59,7 +59,7 @@
 
 tree_index_expression::tree_index_expression (tree_expression *e,
 					      const std::string& n,
-					      int l = -1, int c = -1)
+					      int l, int c)
   : tree_expression (l, c), expr (e), args (), type (), arg_nm ()
 {
   append (n);
--- a/src/symtab.cc
+++ b/src/symtab.cc
@@ -178,7 +178,7 @@
 }
 
 void
-SYMBOL_DEF::print_info (ostream& os, const std::string& prefix) const
+SYMBOL_DEF::print_info (std::ostream& os, const std::string& prefix) const
 {
   os << prefix << "symbol_def::count: " << count << "\n";
 
@@ -476,7 +476,7 @@
 }
 
 void
-symbol_record::print_info (ostream& os, const std::string& prefix) const
+symbol_record::print_info (std::ostream& os, const std::string& prefix) const
 {
   if (definition)
     definition->print_info (os, prefix);
@@ -874,7 +874,7 @@
 }
 
 void
-symbol_table::print_info (ostream& os) const
+symbol_table::print_info (std::ostream& os) const
 {
   int count = 0;
   int empty_chains = 0;