changeset 3731:c06bae7229cf

[project @ 2000-10-31 20:03:19 by jwe]
author jwe
date Tue, 31 Oct 2000 20:03:21 +0000
parents 3c6989370d00
children 82f9f48d1147
files ChangeLog Makefile.in aclocal.m4 liboctave/Array2.cc liboctave/ChangeLog src/ChangeLog src/Makefile.in src/load-save.cc
diffstat 8 files changed, 62 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Oct 31 18:53:26 2000 +0000
+++ b/ChangeLog	Tue Oct 31 20:03:21 2000 +0000
@@ -1,5 +1,8 @@
 2000-10-31  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* aclocal.m4 (OCTAVE_PROG_GPERF): Check that gperf supports flags
+	we use.
+
 	* missing: New file, modified from the missing script provided by
 	automake (never create files, just exit with failure status).
 	* aclocal.m4 (OCTAVE_PROG_BISON, OCTAVE_PROG_FLEX, OCTAVE_PROG_GPERF): 
--- a/Makefile.in	Tue Oct 31 18:53:26 2000 +0000
+++ b/Makefile.in	Tue Oct 31 20:03:21 2000 +0000
@@ -46,14 +46,14 @@
 	@echo "*"
 	@echo "*    g++ (2.95.x or a more recent version)"
 	@echo "*"
-	@echo "*    flex (2.5.4 or later) -- required if you need to"
-	@echo "*    recreate lex.cc from lex.l"
+	@echo "*    flex (2.5.4 or a more recent version) -- required if"
+	@echo "*    you need to recreate lex.cc from lex.l"
 	@echo "*"
-	@echo "*    bison (1.28 or later) -- required if you need to"
-	@echo "*    recreate parse.cc from parse.y"
+	@echo "*    bison (1.28 or a more recent version) -- required if"
+	@echo "*    you need to recreate parse.cc from parse.y"
 	@echo "*"
-	@echo "*    gperf (2.7.1 or later) -- required if you need to"
-	@echo "*    recreate oct-gperf.h from octave.gperf"
+	@echo "*    gperf (2.7.1 or a more recent version) -- required if"
+	@echo "*    you need to recreate oct-gperf.h from octave.gperf"
 	@echo "*"
 	@echo "*  Now would be a good time to read INSTALL.OCTAVE if"
 	@echo "*  you have not done so already."
--- a/aclocal.m4	Tue Oct 31 18:53:26 2000 +0000
+++ b/aclocal.m4	Tue Oct 31 20:03:21 2000 +0000
@@ -869,14 +869,25 @@
 dnl Is gperf installed?
 dnl
 dnl OCTAVE_PROG_GPERF
-AC_DEFUN(OCTAVE_PROG_GPERF,
-[AC_CHECK_PROG(GPERF, gperf, gperf, [])
-if test -z "$GPERF"; then
-  GPERF='$(top_srcdir)/missing gperf'
-  warn_gperf="I didn't find gperf, but it's only a problem if you need to reconstruct oct-gperf.h"
-  AC_MSG_WARN($warn_gperf)
-fi
-AC_SUBST(GPERF)
+AC_DEFUN(OCTAVE_PROG_GPERF, [
+  AC_CHECK_PROG(GPERF, gperf, gperf, [])
+  if test -n "$GPERF"; then
+    if echo "%{
+%}
+%%
+" | $GPERF -t -C -D -E -G -L ANSI-C -H octave_kw_hash -N octave_kw_lookup > /dev/null 2>&1; then
+      true
+    else
+      GPERF=""
+      warn_gperf="I found gperf, but it does not support all of the following options: -t -C -D -E -G -L ANSI-C -H -N; you need gperf 2.7 or a more recent version"
+      AC_MSG_WARN($warn_gperf)
+    fi
+  else
+    GPERF='$(top_srcdir)/missing gperf'
+    warn_gperf="I didn't find gperf, but it's only a problem if you need to reconstruct oct-gperf.h"
+    AC_MSG_WARN($warn_gperf)
+  fi
+  AC_SUBST(GPERF)
 ])
 dnl
 dnl Find nm.
--- a/liboctave/Array2.cc	Tue Oct 31 18:53:26 2000 +0000
+++ b/liboctave/Array2.cc	Tue Oct 31 20:03:21 2000 +0000
@@ -220,14 +220,21 @@
 Array2<T>
 Array2<T>::transpose (void) const
 {
-  Array2<T> result (d2, d1);
+  if (d1 > 1 && d2 > 1)
+    {
+      Array2<T> result (d2, d1);
+
+      for (int j = 0; j < d2; j++)
+	for (int i = 0; i < d1; i++)
+	  result.xelem (j, i) = xelem (i, j);
 
-  if (d1 > 0 && d2 > 0)
-    for (int j = 0; j < d2; j++)
-      for (int i = 0; i < d1; i++)
-	result.elem (j, i) = elem (i, j);
-
-  return result;
+      return result;
+    }
+  else
+    {
+      // Fast transpose for vectors and empty matrices
+      return Array2<T> (*this, d2, d1);
+    }
 }
 
 /*
--- a/liboctave/ChangeLog	Tue Oct 31 18:53:26 2000 +0000
+++ b/liboctave/ChangeLog	Tue Oct 31 20:03:21 2000 +0000
@@ -1,3 +1,8 @@
+2000-10-31  Paul Kienzle  <pkienzle@kienzle.powernet.co.uk>
+
+	* Array2.cc (Array2<T>::transpose): Avoid copy for empty matrices
+	and vectors.
+
 2000-10-18  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* CMatrix.cc (ComplexMatrix::cumsum, ComplexMatrix::cumprod):
--- a/src/ChangeLog	Tue Oct 31 18:53:26 2000 +0000
+++ b/src/ChangeLog	Tue Oct 31 20:03:21 2000 +0000
@@ -1,3 +1,10 @@
+2000-10-31  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* load-save.cc (skip_comments): Allow % as comment character too.
+	(extract_keyword): Likewise.
+
+	* Makefile.in (oct-gperf.h): Remove -a, -g, and -p flags for gperf.
+
 2000-10-30  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* load-save.cc (do_load): Allow result to be returned instead of
--- a/src/Makefile.in	Tue Oct 31 18:53:26 2000 +0000
+++ b/src/Makefile.in	Tue Oct 31 20:03:21 2000 +0000
@@ -466,7 +466,7 @@
 
 oct-gperf.h: octave.gperf
 	@echo "making $@ from $<"
-	@$(GPERF) -a -g -p -t -C -D -E -G -L ANSI-C \
+	@$(GPERF) -t -C -D -E -G -L ANSI-C \
                -H octave_kw_hash -N octave_kw_lookup \
 	  $< | sed 's,lookup\[,gperf_lookup[,' > $@.t
 	@$(top_srcdir)/move-if-change $@.t $@
--- a/src/load-save.cc	Tue Oct 31 18:53:26 2000 +0000
+++ b/src/load-save.cc	Tue Oct 31 20:03:21 2000 +0000
@@ -333,7 +333,7 @@
 
   for (;;)
     {
-      if (is && c == '#')
+      if (is && (c == '%' || c == '#'))
 	while (is.get (c) && c != '\n')
 	  ; // Skip to beginning of next line, ignoring everything.
       else
@@ -346,7 +346,7 @@
 //
 // Input should look something like:
 //
-//  #[ \t]*keyword[ \t]*:[ \t]*string-value[ \t]*\n
+//  [%#][ \t]*keyword[ \t]*:[ \t]*string-value[ \t]*\n
 
 static char *
 extract_keyword (std::istream& is, const char *keyword)
@@ -356,11 +356,11 @@
   char c;
   while (is.get (c))
     {
-      if (c == '#')
+      if (c == '%' || c == '#')
 	{
 	  std::ostrstream buf;
 	
-	  while (is.get (c) && (c == ' ' || c == '\t' || c == '#'))
+	  while (is.get (c) && (c == ' ' || c == '\t' || c == '%' || c == '#'))
 	    ; // Skip whitespace and comment characters.
 
 	  if (isalpha (c))
@@ -413,7 +413,7 @@
 //
 // Input should look something like:
 //
-//  [ \t]*keyword[ \t]*int-value.*\n
+//  [%#][ \t]*keyword[ \t]*int-value.*\n
 
 static bool
 extract_keyword (std::istream& is, const char *keyword, int& value)
@@ -424,11 +424,11 @@
   char c;
   while (is.get (c))
     {
-      if (c == '#')
+      if (c == '%' || c == '#')
 	{
 	  std::ostrstream buf;
 
-	  while (is.get (c) && (c == ' ' || c == '\t' || c == '#'))
+	  while (is.get (c) && (c == ' ' || c == '\t' || c == '%' || c == '#'))
 	    ; // Skip whitespace and comment characters.
 
 	  if (isalpha (c))