changeset 2466:1573640a9994

[project @ 1996-11-04 03:56:11 by jwe]
author jwe
date Mon, 04 Nov 1996 03:56:17 +0000
parents 7ee42ff6536a
children 760f56d484ca
files glob/configure.in kpathsea/ChangeLog kpathsea/c-std.h kpathsea/c-unistd.h libcruft/ChangeLog libcruft/misc/Makefile.in liboctave/ChangeLog liboctave/file-ops.cc liboctave/oct-math.h src/ChangeLog src/defaults.cc src/gripes.h src/ov-base.cc src/ov-base.h src/ov-ch-mat.cc src/ov-ch-mat.h src/ov-colon.cc src/ov-colon.h src/ov-complex.cc src/ov-complex.h src/ov-cx-mat.cc src/ov-cx-mat.h src/ov-range.cc src/ov-range.h src/ov-re-mat.cc src/ov-re-mat.h src/ov-scalar.cc src/ov-scalar.h src/ov-str-mat.cc src/ov-str-mat.h src/ov-struct.cc src/ov-struct.h src/ov-va-args.cc src/ov-va-args.h src/ov.cc src/ov.h src/pt-const.h src/pt-pr-code.cc
diffstat 38 files changed, 139 insertions(+), 106 deletions(-) [+]
line wrap: on
line diff
--- a/glob/configure.in
+++ b/glob/configure.in
@@ -13,6 +13,7 @@
 AC_HEADER_STDC
 AC_CHECK_HEADERS(memory.h unistd.h string.h)
 AC_HEADER_DIRENT
+AC_CHECK_FUNCS(bcopy bzero)
 AC_FUNC_CLOSEDIR_VOID
 AC_FUNC_ALLOCA
 AC_FUNC_STRCOLL
--- a/kpathsea/ChangeLog
+++ b/kpathsea/ChangeLog
@@ -1,3 +1,8 @@
+Sun Nov  3 15:35:46 1996  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* c-std.h: Use #ifdef, not #if to checm HAVE_STDLIB_H
+	* c-unistd.h: Likewise, for HAVE_UNISTD_H
+
 Tue Oct 29 17:27:06 1996  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* Makefile.in (SH_LIBS_TO_INSTALL): Use .$(SHLEXT), not .so.
--- a/kpathsea/c-std.h
+++ b/kpathsea/c-std.h
@@ -28,7 +28,7 @@
 /* Be sure we have constants from <unistd.h>.  */
 #include <kpathsea/c-unistd.h>
 
-#if HAVE_STDLIB_H
+#ifdef HAVE_STDLIB_H
 #include <stdlib.h>
 /* Include <stdlib.h> before <stddef.h>, to help avoid NULL
    redefinitions on some systems.  (We don't include <stddef.h>
--- a/kpathsea/c-unistd.h
+++ b/kpathsea/c-unistd.h
@@ -23,7 +23,7 @@
 /* <unistd.h> is allowed to depend on <sys/types.h>.  */
 #include <kpathsea/systypes.h>
 
-#if HAVE_UNISTD_H
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
--- a/libcruft/ChangeLog
+++ b/libcruft/ChangeLog
@@ -1,3 +1,8 @@
+Sun Nov  3 19:37:37 1996  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* misc/Makefile.in (distclean): Delete target, since there is
+	nothing special to do.
+
 Wed Oct 30 17:20:14 1996  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* Version 1.90.
--- a/libcruft/misc/Makefile.in
+++ b/libcruft/misc/Makefile.in
@@ -42,6 +42,3 @@
 
 pic/machar.o: $(srcdir)/machar.c
 	$(XCC) -c $(CPPFLAGS) $(XALL_CFLAGS) -DDP $< -o $@
-
-distclean::
-	rm -f d1mach.f gen-d1mach
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,3 +1,14 @@
+Sun Nov  3 15:45:37 1996  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* file-ops.cc (file_stat::is_blk, file_stat::is_chr,
+	file_stat::is_dir, file_stat::is_fifo, file_stat::is_lnk,
+	file_stat::is_reg, file_stat::is_sock): Just return false if the
+	underlying macro is not defined.	
+
+	* oct-math.h (lgamma, gamma): Delete declarations.
+	(asinh, acosh, atanh, erf, erfc): Declare arg types too.
+	Protect declarations with #ifdef HAVE_*.
+
 Wed Oct 30 11:42:58 1996  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* Version 1.90.
--- a/liboctave/file-ops.cc
+++ b/liboctave/file-ops.cc
@@ -53,43 +53,71 @@
 bool
 file_stat::is_blk (void) const
 {
+#ifdef S_ISBLK
   return S_ISBLK (fs_mode);
+#else
+  return false;
+#endif
 }
 
 bool
 file_stat::is_chr (void) const
 {
+#ifdef S_ISCHR
   return S_ISCHR (fs_mode);
+#else
+  return false;
+#endif
 }
 
 bool
 file_stat::is_dir (void) const
 { 
+#ifdef S_ISDIR
   return S_ISDIR (fs_mode);
+#else
+  return false;
+#endif
 }
 
 bool
 file_stat::is_fifo (void) const
 { 
+#ifdef S_ISFIFO
   return S_ISFIFO (fs_mode);
+#else
+  return false;
+#endif
 }
 
 bool
 file_stat::is_lnk (void) const
 { 
+#ifdef S_ISLNK
   return S_ISLNK (fs_mode);
+#else
+  return false;
+#endif
 }
 
 bool
 file_stat::is_reg (void) const
 { 
+#ifdef S_ISREG
   return S_ISREG (fs_mode);
+#else
+  return false;
+#endif
 }
 
 bool
 file_stat::is_sock (void) const
 { 
+#ifdef S_ISSOCK
   return S_ISSOCK (fs_mode);
+#else
+  return false;
+#endif
 }
 
 extern "C" void mode_string ();
--- a/liboctave/oct-math.h
+++ b/liboctave/oct-math.h
@@ -33,13 +33,25 @@
 // not, because they are not part of the standard math.h, and the
 // g++/libg++ installation no longer provides declarations for them.
 
-extern double acosh ();
-extern double asinh ();
-extern double atanh ();
-extern double erf ();
-extern double erfc ();
-extern double lgamma ();
-extern double gamma ();
+#ifndef HAVE_ACOSH
+extern double acosh (double);
+#endif
+
+#ifndef HAVE_ASINH
+extern double asinh (double);
+#endif
+
+#ifndef HAVE_ATANH
+extern double atanh (double);
+#endif
+
+#ifndef HAVE_ERF
+extern double erf (double);
+#endif
+
+#ifndef HAVE_ERFC
+extern double erfc (double);
+#endif
 
 #ifdef __cplusplus
 }
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,17 @@
 Sun Nov  3 00:45:30 1996  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* pt-const.cc (tree_constant::print): Just call val.print().
+	* ov-base.cc, ov-ch-mat.cc, ov-colon.cc, ov-complex.cc,
+	ov-cx-mat.cc, ov-range.cc, ov-re-mat.cc, ov-scalar.cc,
+	ov-str-mat.cc, ov-struct.cc ov-va-args.cc, ov.cc (print):
+	Handle pr_as_read_syntax arg.
+
+	* defaults.cc (subst_octave_home): Search for prefix repeatedly in
+	retval, not s.
+
+	* gripes.h: Make declaration of gripes_not_supported match
+	definition.
+
 	* mk-oct-links.in: In sed command, match "DEFUN_DLD *( *", not
 	"DEFUN_DLD_BUILTIN *( *".
 
--- a/src/defaults.cc
+++ b/src/defaults.cc
@@ -93,7 +93,7 @@
     {
       int len = prefix.length ();
       size_t start = 0;
-      while ((start = s.find (prefix)) != NPOS)
+      while ((start = retval.find (prefix)) != NPOS)
 	{
 	  retval.replace (start, len, Voctave_home);
 	  start++;
--- a/src/gripes.h
+++ b/src/gripes.h
@@ -27,7 +27,7 @@
 
 class octave_value;
 
-extern void gripe_not_supported (void);
+extern void gripe_not_supported (const char *);
 extern void gripe_string_invalid (void);
 extern void gripe_range_invalid (void);
 extern void gripe_nonconformant (void);
--- a/src/ov-base.cc
+++ b/src/ov-base.cc
@@ -98,7 +98,7 @@
 }
 
 void
-octave_base_value::print (ostream&)
+octave_base_value::print (ostream&, bool)
 {
   gripe_wrong_type_arg ("octave_base_value::print()", type_name ());
 }
--- a/src/ov-base.h
+++ b/src/ov-base.h
@@ -169,7 +169,7 @@
 
   void convert_to_row_or_column_vector (void);
 
-  void print (ostream& os);
+  void print (ostream& os, bool pr_as_read_syntax = false);
 
   int type_id (void) const { return t_id; }
 
--- a/src/ov-ch-mat.cc
+++ b/src/ov-ch-mat.cc
@@ -89,9 +89,9 @@
 }
 
 void
-octave_char_matrix::print (ostream& os)
+octave_char_matrix::print (ostream& os, bool pr_as_read_syntax)
 {
-  octave_print_internal (os, matrix, false, false, struct_indent);
+  octave_print_internal (os, matrix, pr_as_read_syntax, false, struct_indent);
 }
 
 /*
--- a/src/ov-ch-mat.h
+++ b/src/ov-ch-mat.h
@@ -114,7 +114,7 @@
   octave_value convert_to_str (void) const
     { return octave_value (matrix); }
 
-  void print (ostream& os);
+  void print (ostream& os, bool pr_as_read_syntax = false);
 
   int type_id (void) const { return t_id; }
 
--- a/src/ov-colon.cc
+++ b/src/ov-colon.cc
@@ -28,6 +28,8 @@
 #include <config.h>
 #endif
 
+#include <iostream.h>
+
 #include "error.h"
 #include "pr-output.h"
 #include "ov-colon.h"
@@ -36,6 +38,12 @@
 
 const string octave_magic_colon::t_name ("magic-colon");
 
+void
+octave_magic_colon::print (ostream& os, bool)
+{
+  os << ":";
+}
+
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***
--- a/src/ov-colon.h
+++ b/src/ov-colon.h
@@ -73,6 +73,8 @@
 
   bool valid_as_zero_index (void) const { return false; }
 
+  void print (ostream& os, bool pr_as_read_syntax = false);
+
   int type_id (void) const { return t_id; }
 
   string type_name (void) const { return t_name; }
--- a/src/ov-complex.cc
+++ b/src/ov-complex.cc
@@ -148,9 +148,9 @@
 }
 
 void
-octave_complex::print (ostream& os)
+octave_complex::print (ostream& os, bool pr_as_read_syntax)
 {
-  octave_print_internal (os, scalar, false);
+  octave_print_internal (os, scalar, pr_as_read_syntax);
 }
 
 /*
--- a/src/ov-complex.h
+++ b/src/ov-complex.h
@@ -118,7 +118,7 @@
 
   void decrement (void) { scalar -= 1.0; }
 
-  void print (ostream& os);
+  void print (ostream& os, bool pr_as_read_syntax = false);
 
   int type_id (void) const { return t_id; }
 
--- a/src/ov-cx-mat.cc
+++ b/src/ov-cx-mat.cc
@@ -300,9 +300,9 @@
 }
 
 void
-octave_complex_matrix::print (ostream& os)
+octave_complex_matrix::print (ostream& os, bool pr_as_read_syntax)
 {
-  octave_print_internal (os, matrix, false, struct_indent);
+  octave_print_internal (os, matrix, pr_as_read_syntax, struct_indent);
 }
 
 /*
--- a/src/ov-cx-mat.h
+++ b/src/ov-cx-mat.h
@@ -130,7 +130,7 @@
 
   void decrement (void) { matrix -= 1.0; }
 
-  void print (ostream& os);
+  void print (ostream& os, bool pr_as_read_syntax = false);
 
   int type_id (void) const { return t_id; }
 
--- a/src/ov-range.cc
+++ b/src/ov-range.cc
@@ -190,9 +190,9 @@
 }
 
 void
-octave_range::print (ostream& os)
+octave_range::print (ostream& os, bool pr_as_read_syntax)
 {
-  octave_print_internal (os, range, false, struct_indent);
+  octave_print_internal (os, range, pr_as_read_syntax, struct_indent);
 }
 
 /*
--- a/src/ov-range.h
+++ b/src/ov-range.h
@@ -141,7 +141,7 @@
 
   octave_value convert_to_str (void) const;
 
-  void print (ostream& os);
+  void print (ostream& os, bool pr_as_read_syntax = false);
 
   int type_id (void) const { return t_id; }
 
--- a/src/ov-re-mat.cc
+++ b/src/ov-re-mat.cc
@@ -256,9 +256,9 @@
 }
 
 void
-octave_matrix::print (ostream& os)
+octave_matrix::print (ostream& os, bool pr_as_read_syntax)
 {
-  octave_print_internal (os, matrix, false, struct_indent);
+  octave_print_internal (os, matrix, pr_as_read_syntax, struct_indent);
 }
 
 /*
--- a/src/ov-re-mat.h
+++ b/src/ov-re-mat.h
@@ -131,7 +131,7 @@
 
   octave_value convert_to_str (void) const;
 
-  void print (ostream& os);
+  void print (ostream& os, bool pr_as_read_syntax = false);
 
   int type_id (void) const { return t_id; }
 
--- a/src/ov-scalar.cc
+++ b/src/ov-scalar.cc
@@ -103,9 +103,9 @@
 }
 
 void
-octave_scalar::print (ostream& os)
+octave_scalar::print (ostream& os, bool pr_as_read_syntax)
 {
-  octave_print_internal (os, scalar, false);
+  octave_print_internal (os, scalar, pr_as_read_syntax);
 }
 
 /*
--- a/src/ov-scalar.h
+++ b/src/ov-scalar.h
@@ -119,7 +119,7 @@
 
   octave_value convert_to_str (void) const;
 
-  void print (ostream& os);
+  void print (ostream& os, bool pr_as_read_syntax = false);
 
   int type_id (void) const { return t_id; }
 
--- a/src/ov-str-mat.cc
+++ b/src/ov-str-mat.cc
@@ -202,9 +202,10 @@
 }
 
 void
-octave_char_matrix_str::print (ostream& os)
+octave_char_matrix_str::print (ostream& os, bool pr_as_read_syntax)
 {
-  octave_print_internal (os, matrix, false, true, struct_indent);
+  octave_print_internal (os, matrix, pr_as_read_syntax, true,
+			 struct_indent);
 }
 
 /*
--- a/src/ov-str-mat.h
+++ b/src/ov-str-mat.h
@@ -106,7 +106,7 @@
 
   string string_value (void) const;
 
-  void print (ostream& os);
+  void print (ostream& os, bool pr_as_read_syntax = false);
 
   int type_id (void) const { return t_id; }
 
--- a/src/ov-struct.cc
+++ b/src/ov-struct.cc
@@ -61,7 +61,7 @@
 }
 
 void
-octave_struct::print (ostream& os)
+octave_struct::print (ostream& os, bool)
 {
   // XXX FIXME XXX -- would be nice to print the output in some
   // standard order.  Maybe all substructures first, maybe
--- a/src/ov-struct.h
+++ b/src/ov-struct.h
@@ -81,7 +81,7 @@
 
   Octave_map map_value (void) const { return map; }
 
-  void print (ostream& os);
+  void print (ostream& os, bool pr_as_read_syntax = false);
 
   int type_id (void) const { return t_id; }
 
--- a/src/ov-va-args.cc
+++ b/src/ov-va-args.cc
@@ -28,6 +28,8 @@
 #include <config.h>
 #endif
 
+#include <iostream.h>
+
 #include "error.h"
 #include "pr-output.h"
 #include "ov-va-args.h"
@@ -36,6 +38,12 @@
 
 const string octave_all_va_args::t_name ("va-arg");
 
+void
+octave_all_va_args::print (ostream& os, bool)
+{
+  os << "all_va_args";
+}
+
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***
--- a/src/ov-va-args.h
+++ b/src/ov-va-args.h
@@ -67,6 +67,8 @@
 
   bool is_all_va_args (void) const { return true; }
 
+  void print (ostream& os, bool pr_as_read_syntax = false);
+
   int type_id (void) const { return t_id; }
 
   string type_name (void) const { return t_name; }
--- a/src/ov.cc
+++ b/src/ov.cc
@@ -495,9 +495,9 @@
 }
 
 void
-octave_value::print (void)
+octave_value::print (bool pr_as_read_syntax)
 {
-  print (octave_stdout);
+  print (octave_stdout, pr_as_read_syntax);
 }
 
 void
--- a/src/ov.h
+++ b/src/ov.h
@@ -363,9 +363,10 @@
   virtual void convert_to_row_or_column_vector (void)
     { rep->convert_to_row_or_column_vector (); }
 
-  void print (void);
+  void print (bool pr_as_read_syntax = false);
 
-  virtual void print (ostream& os) { rep->print (os); }
+  virtual void print (ostream& os, bool pr_as_read_syntax)
+    { rep->print (os, pr_as_read_syntax); }
 
   void print_with_name (const string& name, bool print_padding = true);
 
--- a/src/pt-const.h
+++ b/src/pt-const.h
@@ -323,7 +323,8 @@
   void decrement (void) { val.decrement (); }
 
   void print (void);
-  void print (ostream& os) { val.print (os); }
+  void print (ostream& os, bool pr_as_read_syntax)
+    { val.print (os, pr_as_read_syntax); }
 
   void print_with_name (const string& name, bool print_padding = true);
   void print_with_name (ostream& os, const string& name,
--- a/src/pt-pr-code.cc
+++ b/src/pt-pr-code.cc
@@ -559,9 +559,6 @@
   ::error ("visit_oct_obj: internal error");
 }
 
-// XXX FIXME XXX -- this should just call val.print_internal () or
-// something.  Checking the types here is a big no-no.
-
 void
 tree_print_code::visit_constant (tree_constant& val)
 {
@@ -572,65 +569,7 @@
   if (in_parens)
     os << "(";
 
-  if (val.is_real_scalar ())
-    {
-      string orig_text = val.original_text ();
-
-      if (orig_text.empty ())
-	octave_print_internal (os, val.double_value (), 1);
-      else
-	os << orig_text;
-    }
-  else if (val.is_real_matrix ())
-    {
-      octave_print_internal (os, val.matrix_value (), 1);
-    }
-  else if (val.is_complex_scalar ())
-    {
-      Complex cs = val.complex_value ();
-
-      double re = cs.real ();
-      double im = cs.imag ();
-
-      // If we have the original text and a pure imaginary, just
-      // print the original text, because this must be a constant
-      // that was parsed as part of a function.
-
-      string orig_text = val.original_text ();
-
-      if (! orig_text.empty () && re == 0.0 && im > 0.0)
-	os << orig_text;
-      else
-	octave_print_internal (os, cs, 1);
-    }
-  else if (val.is_complex_matrix ())
-    {
-      octave_print_internal (os, val.complex_matrix_value (), 1);
-    }
-  else if (val.is_string ())
-    {
-      octave_print_internal (os, val.all_strings (), 1, 1);
-    }
-  else if (val.is_char_matrix ())
-    {
-      octave_print_internal (os, val.char_matrix_value (), 1);
-    }
-  else if (val.is_range ())
-    {
-      octave_print_internal (os, val.range_value (), 1);
-    }
-  else if (val.is_magic_colon ())
-    {
-      os << ":";
-    }
-  else if (val.is_all_va_args ())
-    {
-      os << "all_va_args";
-    }
-  else
-    {
-      panic_impossible ();
-    }
+  val.print (os, true);
 
   if (in_parens)
     os << ")";