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
+++ b/ChangeLog
@@ -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
+++ b/Makefile.in
@@ -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
+++ b/aclocal.m4
@@ -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
+++ b/liboctave/Array2.cc
@@ -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;