changeset 2862:95e85daad148

[project @ 1997-04-15 22:00:57 by jwe]
author jwe
date Tue, 15 Apr 1997 22:05:13 +0000
parents 6dcb8e1c9bb2
children c797308a1562
files ChangeLog Makeconf.in PROJECTS aclocal.m4 doc/interpreter/install.texi mkoctfile.in src/Makefile.in src/dynamic-ld.cc src/dynamic-ld.h src/input.cc src/octave.cc src/parse.y src/time.cc src/toplev.cc
diffstat 14 files changed, 109 insertions(+), 84 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Tue Apr  8 12:38:18 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* mkoctfile.in: Do substitute SH_LD and SH_LDFLAGS.  Don't
+	substitute or use LIBFLAGS, RLD_FLAG, OCTAVE_LIBS, FLIBS, LEXLIB,
+	TERMLIBS, LIBS, LDFLAGS, LIBPLPLOT, or LIBDLFCN.  Use $SH_LD and
+	$SH_LDFLAGS, not $CXX -shared.
+
+	* Makeconf.in (do-subst-config-vals): Also substitute SH_LD and
+	SH_LDFLAGS.
+
 Fri Mar 28 16:53:08 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* configure.in: Don't add -fpe1 to FFLAGS on Alpha OSF/1 systems
--- a/Makeconf.in
+++ b/Makeconf.in
@@ -294,41 +294,47 @@
 $(foreach d, $(SUBDIRS), $(do-subdir-for-command))
 endef
 
+# Yes, the second sed command near the end is needed, to avoid limits
+# in command lengths for some versions of sed.  UGLY_DEFS is often
+# quite large, so it makes sense to split this command there.
+
 define do-subst-config-vals
 echo "making $@ from $<"
 sed < $< \
-  -e "s;%VERSION%;\"${version}\";" \
-  -e "s;%config_opts%;\"${config_opts}\";" \
-  -e "s;%TARGET_HOST_TYPE%;\"${target_host_type}\";" \
-  -e "s;%F77%;\"${F77}\";" \
-  -e "s;%FFLAGS%;\"${FFLAGS}\";" \
-  -e "s;%FPICFLAG%;\"${FPICFLAG}\";" \
-  -e "s;%F2C%;\"${F2C}\";" \
-  -e "s;%F2CFLAGS%;\"${F2CFLAGS}\";" \
-  -e "s;%FLIBS%;\"${FLIBS}\";" \
-  -e "s;%CPPFLAGS%;\"${CPPFLAGS}\";" \
-  -e "s;%INCFLAGS%;\"-I${includedir} -I${octincludedir}\";" \
+  -e "s;%BUG_CXXFLAGS%;\"${BUG_CXXFLAGS}\";" \
   -e "s;%CC%;\"${CC}\";" \
   -e "s;%CC_VERSION%;\"${CC_VERSION}\";" \
   -e "s;%CFLAGS%;\"${BUG_CFLAGS}\";" \
   -e "s;%CPICFLAG%;\"${CPICFLAG}\";" \
+  -e "s;%CPPFLAGS%;\"${CPPFLAGS}\";" \
   -e "s;%CXX%;\"${CXX}\";" \
-  -e "s;%CXX_VERSION%;\"${CXX_VERSION}\";" \
   -e "s;%CXXFLAGS%;\"${CXXFLAGS}\";" \
   -e "s;%CXXPICFLAG%;\"${CXXPICFLAG}\";" \
-  -e "s;%BUG_CXXFLAGS%;\"${BUG_CXXFLAGS}\";" \
+  -e "s;%CXX_VERSION%;\"${CXX_VERSION}\";" \
+  -e "s;%F2C%;\"${F2C}\";" \
+  -e "s;%F2CFLAGS%;\"${F2CFLAGS}\";" \
+  -e "s;%F77%;\"${F77}\";" \
+  -e "s;%FFLAGS%;\"${FFLAGS}\";" \
+  -e "s;%FLIBS%;\"${FLIBS}\";" \
+  -e "s;%FPICFLAG%;\"${FPICFLAG}\";" \
+  -e "s;%GCC_IEEE_FP_FLAG%;\"${GCC_IEEE_FP_FLAG}\";" \
   -e "s;%HOST_CXXFLAGS%;\"${HOST_CXXFLAGS}\";" \
+  -e "s;%INCFLAGS%;\"-I${includedir} -I${octincludedir}\";" \
+  -e "s;%LDFLAGS%;\"${LDFLAGS}\";" \
+  -e "s;%LEXLIB%;\"${LEXLIB}\";" \
+  -e "s;%LIBDLFCN%;\"${LIBDLFCN}\";" \
+  -e "s;%LIBFLAGS%;\"-L${libdir}\";" \
+  -e "s;%LIBPLPLOT%;\"${LIBPLPLOT}\";" \
+  -e "s;%LIBS%;\"${LIBS}\";" \
   -e "s;%NO_IMPLICIT_TEMPLATES%;\"${NO_IMPLICIT_TEMPLATES}\";" \
-  -e "s;%GCC_IEEE_FP_FLAG%;\"${GCC_IEEE_FP_FLAG}\";" \
-  -e "s;%LDFLAGS%;\"${LDFLAGS}\";" \
-  -e "s;%LIBFLAGS%;\"-L${libdir}\";" \
   -e "s;%RLD_FLAG%;\"${RLD_FLAG}\";" \
+  -e "s;%SH_LD%;\"${SH_LD}\";" \
+  -e "s;%SH_LDFLAGS%;\"${SH_LDFLAGS}\";" \
+  -e "s;%TARGET_HOST_TYPE%;\"${target_host_type}\";" \
   -e "s;%TERMLIBS%;\"${TERMLIBS}\";" \
-  -e "s;%LIBS%;\"${LIBS}\";" \
-  -e "s;%LEXLIB%;\"${LEXLIB}\";" \
-  -e "s;%LIBPLPLOT%;\"${LIBPLPLOT}\";" \
-  -e "s;%LIBDLFCN%;\"${LIBDLFCN}\";" | sed \
-  -e "s;%DEFS%;\"${UGLY_DEFS}\";" > $@.tmp
+  -e "s;%VERSION%;\"${version}\";" \
+  -e "s;%config_opts%;\"${config_opts}\";" | \
+  sed  -e "s;%DEFS%;\"${UGLY_DEFS}\";" > $@.tmp
 $(top_srcdir)/move-if-change $@.tmp $@
 endef
 
@@ -336,22 +342,22 @@
 echo "making $@ from $<"
 sed < $< > $@.tmp \
   -e "s;%DEFAULT_PAGER%;\"${DEFAULT_PAGER}\";" \
-  -e "s;%OCTAVE_PREFIX%;\"${prefix}\";" \
-  -e "s;%OCTAVE_EXEC_PREFIX%;\"${exec_prefix}\";" \
+  -e "s;%OCTAVE_ARCHLIBDIR%;\"${archlibdir}\";" \
+  -e "s;%OCTAVE_BINDIR%;\"${bindir}\";" \
   -e "s;%OCTAVE_DATADIR%;\"${datadir}\";" \
-  -e "s;%OCTAVE_BINDIR%;\"${bindir}\";" \
-  -e "s;%OCTAVE_LIBDIR%;\"${libdir}\";" \
+  -e "s;%OCTAVE_EXEC_PREFIX%;\"${exec_prefix}\";" \
+  -e "s;%OCTAVE_FCNFILEDIR%;\"${fcnfiledir}\";" \
+  -e "s;%OCTAVE_FCNFILEPATH%;\"${fcnfilepath}\";" \
+  -e "s;%OCTAVE_IMAGEPATH%;\"${imagepath}\";" \
   -e "s;%OCTAVE_INFODIR%;\"${infodir}\";" \
   -e "s;%OCTAVE_INFOFILE%;\"${infofile}\";" \
-  -e "s;%OCTAVE_FCNFILEDIR%;\"${fcnfiledir}\";" \
+  -e "s;%OCTAVE_LIBDIR%;\"${libdir}\";" \
+  -e "s;%OCTAVE_LOCALARCHLIBDIR%;\"${localarchlibdir}\";" \
   -e "s;%OCTAVE_LOCALFCNFILEDIR%;\"${localfcnfiledir}\";" \
   -e "s;%OCTAVE_LOCALFCNFILEPATH%;\"${localfcnfilepath}\";" \
-  -e "s;%OCTAVE_ARCHLIBDIR%;\"${archlibdir}\";" \
-  -e "s;%OCTAVE_LOCALARCHLIBDIR%;\"${localarchlibdir}\";" \
+  -e "s;%OCTAVE_LOCALOCTFILEPATH%;\"${localoctfilepath}\";" \
   -e "s;%OCTAVE_OCTFILEDIR%;\"${octfiledir}\";" \
-  -e "s;%OCTAVE_LOCALOCTFILEPATH%;\"${localoctfilepath}\";" \
-  -e "s;%OCTAVE_FCNFILEPATH%;\"${fcnfilepath}\";" \
-  -e "s;%OCTAVE_IMAGEPATH%;\"${imagepath}\";" \
+  -e "s;%OCTAVE_PREFIX%;\"${prefix}\";" \
   -e "s;%TARGET_HOST_TYPE%;\"${target_host_type}\";"
 $(top_srcdir)/move-if-change $@.tmp $@
 endef
--- a/PROJECTS
+++ b/PROJECTS
@@ -440,7 +440,7 @@
   * Eliminate force_numeric and make_numeric functions.
 
   * Is Matrix::fortran_vec() really necessary?
-b
+
   * print_usage() should set error_state in most cases?
 
   * Make statements like this
@@ -476,6 +476,8 @@
   * On systems that support matherr(), make it possible for users to
     enable the printing of warning messages.
 
+  * Make it possible to mark variables and functions as read-only.
+
 -------
 History:
 -------
@@ -483,6 +485,11 @@
   * Add an option to allow saving input from script files in the
     history list.
 
+  * Add an option to include information about the Octave session in
+    the history list.  Possibly a time/date stamp and the current
+    Octave line number, appended as a comment (users should probably
+    be able to control the format).
+
   * Fix history problems -- core dump if multiple processes are
     writing to the same history file?
 
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -155,7 +155,7 @@
 	      exists=true
 	    fi
 	  done
-	  if $exists
+	  if $exists; then
 	    arg=
 	  else
 	    case "$arg" in
--- a/doc/interpreter/install.texi
+++ b/doc/interpreter/install.texi
@@ -56,18 +56,27 @@
 Create shared libraries.  If you are planning to use
 @code{--enable-lite-kernelel} or the dynamic loading features, you will
 probably want to use this option.  It will make your @file{.oct} files
-much smaller.  You may also want to build a shared version of
-@code{libg++}, if your system doesn't already have one.
+much smaller.
+
+You may also want to build a shared version of @code{libg++}, if your
+system doesn't already have one.  Note that a patch is needed to build
+shared versions of version 2.7.2 of @code{libg++} and @code{libstdc++}
+on the HP-PA architecture.  You can find the patch at
+@url{ftp://ftp.cygnus.com/pub/g++/libg++-2.7.2-hppa-gcc-fix}.
 
 @item --enable-dl
 Use @code{dlopen} and friends to make Octave capable of dynamically
 linking externally compiled functions.  This only works on systems that
-actually have these functions.
+actually have these functions.  If you plan on using this feature, you
+should probably also use @code{--enable-shared} to reduce the size of
+your @file{.oct} files.
 
 @item --enable-shl
 Use @code{shl_load} and friends to make Octave capable of dynamically
 linking externally compiled functions.  This only works on systems that
-actually have these functions (only HP-UX systems).
+actually have these functions (only HP-UX systems).  If you plan on
+using this feature, you should probably also use @code{--enable-shared}
+to reduce the size of your @file{.oct} files.
 
 @item --enable-lite-kernel
 Compile smaller kernel.  This currently requires the dynamic linking
@@ -231,6 +240,14 @@
 @code{ldso} package.
 
 @item
+Building @file{.oct} files doesn't work.
+
+You should probably have a shared version of @code{libg++}.  A patch is
+needed to build shared versions of version 2.7.2 of @code{libg++} and
+@code{libstdc++} on the HP-PA architecture.  You can find the patch at
+@url{ftp://ftp.cygnus.com/pub/g++/libg++-2.7.2-hppa-gcc-fix}.
+
+@item
 If you encounter errors like
 
 @smallexample
--- a/mkoctfile.in
+++ b/mkoctfile.in
@@ -27,21 +27,8 @@
 NO_IMPLICIT_TEMPLATES=%NO_IMPLICIT_TEMPLATES%
 GCC_IEEE_FP_FLAG=%GCC_IEEE_FP_FLAG%
 
-LDFLAGS=%LDFLAGS%
-LIBFLAGS=%LIBFLAGS%
-RLD_FLAG=%RLD_FLAG%
-FLIBS=%FLIBS%
-LIBS=%LIBS%
-LEXLIB=%LEXLIB%
-TERMLIBS=%TERMLIBS%
-LIBPLPLOT=%LIBPLPLOT%
-LIBDLFCN=%LIBDLFCN%
-
-# For now, leave -lglob out (glob/Makefile.in needs to be fixed to
-# install it.
-
-OCTAVE_LIBS="-loctinterp -loctave -ltinst -lcruft \
-  $LIBPLPLOT -lreadline -lkpathsea $LIBDLFCN"
+SH_LD=%SH_LD%
+SH_LDFLAGS=%SH_LDFLAGS%
 
 ALL_CXXFLAGS="$INCFLAGS $HOST_CXXFLAGS $NO_IMPLICIT_TEMPLATES \
   $GCC_IEEE_FP_FLAG $CXXFLAGS"
@@ -52,4 +39,4 @@
 
 echo "making $octfile from $objfile"
 
-$CXX -shared -o $octfile $objfile $LIBFLAGS $RLD_FLAG $OCTAVE_LIBS $FLIBS $LEXLIB $TERMLIBS $LIBS
+$SH_LD $SH_LDFLAGS -o $octfile $objfile
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -32,10 +32,10 @@
 ifeq ($(OCTAVE_LITE), true)
   ifdef CXXPICFLAG
     %.oct : pic/%.o
-	  $(CXX) $(SH_LDFLAGS) -o $@ $<
+	  $(SH_LD) $(SH_LDFLAGS) -o $@ $<
   else
     %.oct : %.o
-	  $(CXX) $(SH_LDFLAGS) -o $@ $<
+	  $(SH_LD) $(SH_LDFLAGS) -o $@ $<
   endif
 endif
 
--- a/src/dynamic-ld.cc
+++ b/src/dynamic-ld.cc
@@ -49,6 +49,7 @@
 #include "error.h"
 #include "toplev.h"
 #include "pathsearch.h"
+#include "oct-obj.h"
 #include "ov.h"
 #include "utils.h"
 #include "variables.h"
@@ -57,12 +58,6 @@
 
 #if defined (WITH_DYNAMIC_LINKING)
 
-// XXX FIXME XXX -- need to provide some way to ensure that functions
-// that we are going to use will use the same naming convention as
-// Octave's internal functions.  It needs to be simpler than the
-// current DEFUN_DLD() macro, which assumes you know how to name the
-// function, the struct, and the helper function.
-
 static string
 mangle_octave_oct_file_name (const string& name)
 {
@@ -200,12 +195,6 @@
   return retval;
 }
 
-void
-init_dynamic_linker (void)
-{
-  // Nothing to do anymore...
-}
-
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***
--- a/src/dynamic-ld.h
+++ b/src/dynamic-ld.h
@@ -23,14 +23,14 @@
 #if !defined (octave_dynamic_ld_h)
 #define octave_dynamic_ld_h 1
 
-#include "oct-obj.h"
+#include <string>
+
+class octave_value_list;
 
 typedef octave_value_list (*Octave_builtin_fcn)(const octave_value_list&, int);
 
 extern int load_octave_oct_file (const string& name);
 
-extern void init_dynamic_linker (void);
-
 #endif
 
 /*
--- a/src/input.cc
+++ b/src/input.cc
@@ -444,12 +444,13 @@
 
       char *buf = static_cast<char *> (malloc (max_size));
       char *bufptr = buf;
+      int len = 0;
 
       do
 	{
 	  if (fgets (bufptr, grow_size, curr_stream))
 	    {
-	      int len = strlen (bufptr);
+	      len = strlen (bufptr);
 
 	      if (len == grow_size - 1)
 		{
@@ -475,7 +476,12 @@
 		retval = buf;
 	    }
 	  else
-	    break;
+	    {
+	      if (len == 0)
+		free (buf);
+
+	      break;
+	    }
 	}
       while (! retval);
     }
@@ -607,7 +613,15 @@
 	}
     }
   else if (chars_left == 0)
-    status = 0;
+    {
+      if (input_buf)
+	{
+	  free (input_buf);
+	  input_buf = 0;
+	}
+
+      status = 0;
+    }
   else    
     status = -1;
 
--- a/src/octave.cc
+++ b/src/octave.cc
@@ -522,8 +522,6 @@
 
   initialize_readline ();
 
-  init_dynamic_linker ();
-
   if (! inhibit_startup_message)
     cout << OCTAVE_STARTUP_MESSAGE "\n" << endl;
 
--- a/src/parse.y
+++ b/src/parse.y
@@ -381,10 +381,6 @@
 %left UNARY PLUS_PLUS MINUS_MINUS EXPR_NOT
 %right POW EPOW
 
-// There are 18 shift/reduce conflicts, ok?  But this only works with
-// bison...
-// %expect 18
-
 // Where to start.
 %start input
 
--- a/src/time.cc
+++ b/src/time.cc
@@ -54,13 +54,12 @@
   m ["wday"] = static_cast<double> (tm->tm_wday);
   m ["yday"] = static_cast<double> (tm->tm_yday);
   m ["isdst"] = static_cast<double> (tm->tm_isdst);
+
 #if defined (HAVE_TM_ZONE)
   m ["zone"]  = tm->tm_zone;
 #elif defined (HAVE_TZNAME)
   if (tm->tm_isdst == 0 || tm->tm_isdst == 1)
     m ["zone"] = tzname[tm->tm_isdst];
-#else
-  m ["zone"] = zone_name (tm);
 #endif
 
   return m;
@@ -81,7 +80,8 @@
   tm.tm_wday = static_cast<int> (m ["wday"] . double_value ());
   tm.tm_yday = static_cast<int> (m ["yday"] . double_value ());
   tm.tm_isdst = static_cast<int> (m ["isdst"] . double_value ());
-#ifdef HAVE_TMZONE
+
+#if defined (HAVE_TM_ZONE)
   string tstr = m ["zone"] . string_value ();
   tm.tm_zone = tstr.c_str ();
 #endif
@@ -98,11 +98,11 @@
   time_t now;
   double fraction = 0.0;
 
-#ifdef HAVE_GETTIMEOFDAY
+#if defined (HAVE_GETTIMEOFDAY)
 
   struct timeval tp;
 
-#ifdef GETTIMEOFDAY_NO_TZ
+#if defined  (GETTIMEOFDAY_NO_TZ)
   gettimeofday (&tp);
 #else
   gettimeofday (&tp, 0);
--- a/src/toplev.cc
+++ b/src/toplev.cc
@@ -60,6 +60,7 @@
 #include <oct-conf.h>
 #include "oct-hist.h"
 #include "oct-map.h"
+#include "oct-obj.h"
 #include "pager.h"
 #include "parse.h"
 #include "pathsearch.h"