# HG changeset patch # User jwe # Date 973022601 0 # Node ID c06bae7229cf1c5f0f9d12d6b5cf817a134cf277 # Parent 3c6989370d00e0b602c90e8a8f1634b299452e55 [project @ 2000-10-31 20:03:19 by jwe] diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2000-10-31 John W. Eaton + * 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): diff --git a/Makefile.in b/Makefile.in --- 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." diff --git a/aclocal.m4 b/aclocal.m4 --- 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. diff --git a/liboctave/Array2.cc b/liboctave/Array2.cc --- a/liboctave/Array2.cc +++ b/liboctave/Array2.cc @@ -220,14 +220,21 @@ Array2 Array2::transpose (void) const { - Array2 result (d2, d1); + if (d1 > 1 && d2 > 1) + { + Array2 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 (*this, d2, d1); + } } /* diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2000-10-31 Paul Kienzle + + * Array2.cc (Array2::transpose): Avoid copy for empty matrices + and vectors. + 2000-10-18 John W. Eaton * CMatrix.cc (ComplexMatrix::cumsum, ComplexMatrix::cumprod): diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2000-10-31 John W. Eaton + + * 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 * load-save.cc (do_load): Allow result to be returned instead of diff --git a/src/Makefile.in b/src/Makefile.in --- a/src/Makefile.in +++ b/src/Makefile.in @@ -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 $@ diff --git a/src/load-save.cc b/src/load-save.cc --- a/src/load-save.cc +++ b/src/load-save.cc @@ -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))