Mercurial > hg > octave-nkf
changeset 4323:0990c9b77109
[project @ 2003-02-14 07:36:26 by jwe]
author | jwe |
---|---|
date | Fri, 14 Feb 2003 07:36:27 +0000 |
parents | 0b24abe1ba0b |
children | dcdca99fe2f0 |
files | ChangeLog configure.in liboctave/Array2-idx.h liboctave/Array2.cc liboctave/Array3.cc liboctave/Array3.h liboctave/ArrayN.cc liboctave/ArrayN.h liboctave/ChangeLog liboctave/DiagArray2.cc liboctave/MDiagArray2.h src/ChangeLog src/lex.l src/ov-str-mat.h test/octave.test/number/ismatrix-5.m test/octave.test/number/ismatrix-6.m test/octave.test/number/ismatrix-7.m test/octave.test/number/isscalar-5.m test/octave.test/number/issquare-5.m test/octave.test/number/issquare-7.m test/octave.test/number/issymmetric-5.m test/octave.test/number/issymmetric-7.m test/octave.test/number/isvector-5.m test/octave.test/number/isvector-6.m |
diffstat | 24 files changed, 125 insertions(+), 78 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2003-02-13 Arno Klaassen <arno@scito.com> + + * configure.in: Fix SH_LD and SH_LDFLAGS for -*-*-freebsd*. + +2003-02-13 John W. Eaton <jwe@bevo.che.wisc.edu> + + * configure.in: Use '$(CXX)', '$(AR)', not "$CXX" and "$AR" when + setting variables for building shared libraries. + 2003-02-13 Paul Kienzle <pkienzle@users.sf.net> * examples/make_int.cc: Support for ISO standard compilers.
--- a/configure.in +++ b/configure.in @@ -22,7 +22,7 @@ ### 02111-1307, USA. AC_INIT -AC_REVISION($Revision: 1.409 $) +AC_REVISION($Revision: 1.410 $) AC_PREREQ(2.52) AC_CONFIG_SRCDIR([src/octave.cc]) AC_CONFIG_HEADER(config.h) @@ -630,21 +630,25 @@ SHLLIB_VER='$(SHLLIB).$(version)' SHLBIN_VER='$(SHLBIN).$(version)' SHLLINKEXT= -SH_LD="$CXX" +SH_LD='$(CXX)' SH_LDFLAGS=-shared MKOCTFILE_SH_LDFLAGS='$(SH_LDFLAGS)' SONAME_FLAGS= RLD_FLAG= NO_OCT_FILE_STRIP=false INCLUDE_LINK_DEPS=false -TEMPLATE_AR="$AR" +TEMPLATE_AR='$(AR)' TEMPLATE_ARFLAGS="$ARFLAGS" library_path_var=LD_LIBRARY_PATH case "$canonical_host_type" in - *-*-386bsd* | *-*-openbsd* | *-*-netbsd* | *-*-freebsd*) + *-*-386bsd* | *-*-openbsd* | *-*-netbsd*) SH_LD=ld SH_LDFLAGS=-Bshareable ;; + *-*-freebsd*) + SH_LD='$(CC)' + SH_LDFLAGS=-shared -Wl,-x + ;; alpha*-dec-osf*) CPICFLAG= CXXPICFLAG= @@ -738,7 +742,7 @@ if test "$GXX" = yes; then true else - TEMPLATE_AR="$CXX" + TEMPLATE_AR='$(CXX)' TEMPLATE_ARFLAGS="-xar -o" fi ;;
--- a/liboctave/Array2-idx.h +++ b/liboctave/Array2-idx.h @@ -43,7 +43,7 @@ } else if (n_idx == 1) { - return index (idx[0]); + return index (Array<T>::idx[0]); } else (*current_liboctave_error_handler) @@ -98,7 +98,14 @@ int len = tmp.length (); if (len == 0) - retval = Array2<T> (idx_orig_rows, idx_orig_columns); + { + if (idx_orig_rows == 0 || idx_orig_columns == 0) + retval = Array2<T> (idx_orig_rows, idx_orig_columns); + else if (nr == 1) + retval = Array2<T> (1, 0); + else + retval = Array2<T> (0, 1); + } else { if (idx_orig_rows == 1 || idx_orig_columns == 1) @@ -283,10 +290,10 @@ } } - if (--rep->count <= 0) - delete rep; + if (--(Array<T>::rep)->count <= 0) + delete Array<T>::rep; - rep = new typename Array<T>::ArrayRep (new_data, new_n); + Array<T>::rep = new typename Array<T>::ArrayRep (new_data, new_n); if (nr == 1) { @@ -397,10 +404,10 @@ } } - if (--rep->count <= 0) - delete rep; + if (--(Array<T>::rep)->count <= 0) + delete Array<T>::rep; - rep = new typename Array<T>::ArrayRep (new_data, nr * new_nc); + Array<T>::rep = new typename Array<T>::ArrayRep (new_data, nr * new_nc); d2 = new_nc; @@ -461,10 +468,10 @@ } } - if (--rep->count <= 0) - delete rep; + if (--(Array<T>::rep)->count <= 0) + delete Array<T>::rep; - rep = new typename Array<T>::ArrayRep (new_data, new_nr * nc); + Array<T>::rep = new typename Array<T>::ArrayRep (new_data, new_nr * nc); d1 = new_nr;
--- a/liboctave/Array2.cc +++ b/liboctave/Array2.cc @@ -124,14 +124,14 @@ if (r == dim1 () && c == dim2 ()) return; - typename Array<T>::ArrayRep *old_rep = rep; + typename Array<T>::ArrayRep *old_rep = Array<T>::rep; const T *old_data = data (); int old_d1 = dim1 (); int old_d2 = dim2 (); int old_len = length (); - rep = new typename Array<T>::ArrayRep (get_size (r, c)); + Array<T>::rep = new typename Array<T>::ArrayRep (get_size (r, c)); d1 = r; d2 = c; @@ -164,14 +164,14 @@ if (r == dim1 () && c == dim2 ()) return; - typename Array<T>::ArrayRep *old_rep = rep; + typename Array<T>::ArrayRep *old_rep = Array<T>::rep; const T *old_data = data (); int old_d1 = dim1 (); int old_d2 = dim2 (); int old_len = length (); - rep = new typename Array<T>::ArrayRep (get_size (r, c)); + Array<T>::rep = new typename Array<T>::ArrayRep (get_size (r, c)); d1 = r; d2 = c;
--- a/liboctave/Array3.cc +++ b/liboctave/Array3.cc @@ -58,7 +58,7 @@ if (r == dim1 () && c == dim2 () && p == dim3 ()) return; - typename Array<T>::ArrayRep *old_rep = rep; + typename Array<T>::ArrayRep *old_rep = Array<T>::rep; const T *old_data = data (); int old_d1 = dim1 (); @@ -68,10 +68,10 @@ int ts = get_size (get_size (r, c), p); - rep = new typename Array<T>::ArrayRep (ts); + Array<T>::rep = new typename Array<T>::ArrayRep (ts); - d1 = r; - d2 = c; + Array2<T>::d1 = r; + Array2<T>::d2 = c; d3 = p; if (old_data && old_len > 0) @@ -104,7 +104,7 @@ if (r == dim1 () && c == dim2 () && p == dim3 ()) return; - typename Array<T>::ArrayRep *old_rep = rep; + typename Array<T>::ArrayRep *old_rep = Array<T>::rep; const T *old_data = data (); int old_d1 = dim1 (); @@ -115,10 +115,10 @@ int ts = get_size (get_size (r, c), p); - rep = new typename Array<T>::ArrayRep (ts); + Array<T>::rep = new typename Array<T>::ArrayRep (ts); - d1 = r; - d2 = c; + Array2<T>::d1 = r; + Array2<T>::d2 = c; d3 = p; int min_r = old_d1 < r ? old_d1 : r;
--- a/liboctave/Array3.h +++ b/liboctave/Array3.h @@ -48,7 +48,7 @@ Array3 (T *d, int n, int m, int k) : Array2<T> (d, n, get_size (m, k)) { - d2 = m; + Array2<T>::d2 = m; d3 = k; set_max_indices (3); } @@ -57,28 +57,28 @@ Array3 (void) : Array2<T> () { - d2 = 0; + Array2<T>::d2 = 0; d3 = 0; set_max_indices (3); } Array3 (int n, int m, int k) : Array2<T> (n, get_size (m, k)) { - d2 = m; + Array2<T>::d2 = m; d3 = k; set_max_indices (3); } Array3 (int n, int m, int k, const T& val) : Array2<T> (n, m*k, val) { - d2 = m; + Array2<T>::d2 = m; d3 = k; set_max_indices (3); } Array3 (const Array3<T>& a) : Array2<T> (a) { - d2 = a.d2; + Array2<T>::d2 = a.d2; d3 = a.d3; set_max_indices (3); } @@ -87,11 +87,11 @@ Array3<T>& operator = (const Array3<T>& a) { - if (this != &a && rep != a.rep) + if (this != &a && Array<T>::rep != a.rep) { Array<T>::operator = (a); - d1 = a.d1; - d2 = a.d2; + Array2<T>::d1 = a.d1; + Array2<T>::d2 = a.d2; d3 = a.d3; } @@ -102,8 +102,8 @@ // No checking of any kind, ever. - T& xelem (int i, int j, int k) { return Array2<T>::xelem (i, d2*k+j); } - T xelem (int i, int j, int k) const { return Array2<T>::xelem (i, d2*k+j); } + T& xelem (int i, int j, int k) { return Array2<T>::xelem (i, Array2<T>::d2*k+j); } + T xelem (int i, int j, int k) const { return Array2<T>::xelem (i, Array2<T>::d2*k+j); } // Note that the following element selection methods don't use // xelem() because they need to make use of the code in @@ -111,16 +111,16 @@ T& checkelem (int i, int j, int k) { - if (i < 0 || j < 0 || k < 0 || i >= d1 || j >= d2 || k >= d3) + if (i < 0 || j < 0 || k < 0 || i >= Array2<T>::d1 || j >= Array2<T>::d2 || k >= d3) { (*current_liboctave_error_handler) ("range error in Array3"); static T foo; return foo; } - return Array2<T>::elem (i, d2*k+j); + return Array2<T>::elem (i, Array2<T>::d2*k+j); } - T& elem (int i, int j, int k) { return Array2<T>::elem (i, d2*k+j); } + T& elem (int i, int j, int k) { return Array2<T>::elem (i, Array2<T>::d2*k+j); } #if defined (BOUNDS_CHECKING) T& operator () (int i, int j, int k) { return checkelem (i, j, k); } @@ -130,15 +130,15 @@ T checkelem (int i, int j, int k) const { - if (i < 0 || j < 0 || k < 0 || i >= d1 || j >= d2 || k >= d3) + if (i < 0 || j < 0 || k < 0 || i >= Array2<T>::d1 || j >= Array2<T>::d2 || k >= d3) { (*current_liboctave_error_handler) ("range error in Array3"); return T (); } - return Array2<T>::elem (i, d1*k+j); + return Array2<T>::elem (i, Array2<T>::d1*k+j); } - T elem (int i, int j, int k) const { return Array2<T>::elem (i, d2*k+j); } + T elem (int i, int j, int k) const { return Array2<T>::elem (i, Array2<T>::d2*k+j); } #if defined (BOUNDS_CHECKING) T operator () (int i, int j, int k) const { return checkelem (i, j, k); }
--- a/liboctave/ArrayN.cc +++ b/liboctave/ArrayN.cc @@ -229,10 +229,10 @@ if (no_change) return; - typename Array<T>::ArrayRep *old_rep = rep; + typename Array<T>::ArrayRep *old_rep = Array<T>::rep; const T *old_data = data (); - rep = new typename Array<T>::ArrayRep (get_size (dims)); + Array<T>::rep = new typename Array<T>::ArrayRep (get_size (dims)); Array<int> old_dimensions = dimensions; @@ -284,12 +284,12 @@ if (no_change) return; - typename Array<T>::ArrayRep *old_rep = rep; + typename Array<T>::ArrayRep *old_rep = Array<T>::rep; const T *old_data = data (); int len = get_size (dims); - rep = new typename Array<T>::ArrayRep (len); + Array<T>::rep = new typename Array<T>::ArrayRep (len); Array<int> old_dimensions = dimensions; @@ -300,7 +300,7 @@ Array<int> ra_idx (dimensions.length (), 0); for (int i = 0; i < len; i++) - rep->elem (i) = val; + Array<T>::rep->elem (i) = val; for (int i = 0; i < old_len; i++) {
--- a/liboctave/ArrayN.h +++ b/liboctave/ArrayN.h @@ -48,6 +48,7 @@ { protected: + ArrayN (T *d, const Array<int>& dims) : Array<T> (d, get_size (dims)) { dimensions = dims; @@ -95,7 +96,7 @@ ArrayN<T>& operator = (const ArrayN<T>& a) { - if (this != &a && rep != a.rep) + if (this != &a && Array<T>::rep != a.rep) { Array<T>::operator = (a); dimensions = a.dimensions;
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,14 @@ +2003-02-14 John W. Eaton <jwe@bevo.che.wisc.edu> + + * Array2-idx.h (Array2<T>::index): Fix thinko. + Additional compatibility fix. + +2003-02-13 Arno Klaassen <arno@scito.com> + + * Array2-idx.h, Array2.cc, Array2.h, Array3.cc, Array3.h, + ArrayN.cc, ArrayN.h, DiagArray2.cc, DiagArray2.h, MDiagArray2.h: + Sprinkle with Array<T>:: as necessary for gcc 3.4. + 2003-02-13 John W. Eaton <jwe@bevo.che.wisc.edu> * Array2-idx.h (Array2<T>::index (idx_vector&, int, const T&)):
--- a/liboctave/DiagArray2.cc +++ b/liboctave/DiagArray2.cc @@ -134,13 +134,13 @@ if (r == dim1 () && c == dim2 ()) return; - typename Array<T>::ArrayRep *old_rep = rep; + typename Array<T>::ArrayRep *old_rep = Array<T>::rep; const T *old_data = data (); int old_len = length (); int new_len = r < c ? r : c; - rep = new typename Array<T>::ArrayRep (new_len); + Array<T>::rep = new typename Array<T>::ArrayRep (new_len); nr = r; nc = c; @@ -170,13 +170,13 @@ if (r == dim1 () && c == dim2 ()) return; - typename Array<T>::ArrayRep *old_rep = rep; + typename Array<T>::ArrayRep *old_rep = Array<T>::rep; const T *old_data = data (); int old_len = length (); int new_len = r < c ? r : c; - rep = new typename Array<T>::ArrayRep (new_len); + Array<T>::rep = new typename Array<T>::ArrayRep (new_len); nr = r; nc = c;
--- a/liboctave/MDiagArray2.h +++ b/liboctave/MDiagArray2.h @@ -71,9 +71,9 @@ operator MArray2<T> () const { - MArray2<T> retval (nr, nc, T (0)); + MArray2<T> retval (DiagArray2<T>::nr, DiagArray2<T>::nc, T (0)); - int len = nr < nc ? nr : nc; + int len = DiagArray2<T>::nr < DiagArray2<T>::nc ? DiagArray2<T>::nr : DiagArray2<T>::nc; for (int i = 0; i < len; i++) retval.xelem (i, i) = xelem (i, i);
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,15 @@ +2003-02-14 John W. Eaton <jwe@bevo.che.wisc.edu> + + * ov-str-mat.h (octave_char_matrix_str::is_real_type, + octave_char_matrix_str::is_matrix_type, + octave_char_matrix_str::is_numeric_type): Always return false. + +2003-02-13 John W. Eaton <jwe@bevo.che.wisc.edu> + + * lex.l (<CCHAR>): If we are parsing a command, reset start state. + Use BEGIN (INITIAL) instead of BEGIN 0. Use parens around start + state in BEGIN statements. + 2003-02-13 Paul Kienzle <pkienzle@users.sf.net> * variables.cc (Fmlock, Fmunlock, Fmislocked): New functions.
--- a/src/lex.l +++ b/src/lex.l @@ -245,13 +245,13 @@ %% <NESTED_FUNCTION_END>. { - BEGIN NESTED_FUNCTION_BEGIN; + BEGIN (NESTED_FUNCTION_BEGIN); unput (yytext[0]); return ';'; } <NESTED_FUNCTION_BEGIN>. { - BEGIN 0; + BEGIN (INITIAL); unput (yytext[0]); prep_for_nested_function (); return FCN; @@ -264,7 +264,7 @@ %} <COMMAND_START>{NL} { - BEGIN 0; + BEGIN (INITIAL); current_input_column = 1; lexer_flags.quote_is_transpose = false; lexer_flags.cant_be_identifier = false; @@ -279,7 +279,7 @@ } else { - BEGIN 0; + BEGIN (INITIAL); if (strcmp (yytext, ",") == 0) TOK_RETURN (','); else @@ -455,7 +455,7 @@ else { lexer_flags.bracketflag++; - BEGIN MATRIX_START; + BEGIN (MATRIX_START); return '['; } } @@ -655,6 +655,9 @@ maybe_gripe_matlab_incompatible_comment (yytext[0]); + if (YY_START == COMMAND_START) + BEGIN (INITIAL); + if (nesting_level.none ()) return '\n'; else if (nesting_level.is_bracket ()) @@ -841,7 +844,7 @@ reset_parser (void) { // Start off on the right foot. - BEGIN 0; + BEGIN (INITIAL); parser_end_of_input = false; end_tokens_expected = 0; @@ -1268,7 +1271,7 @@ { if (lexer_flags.parsing_nested_function) { - BEGIN NESTED_FUNCTION_END; + BEGIN (NESTED_FUNCTION_END); yylval.tok_val = new token (token::function_end, l, c); token_stack.push (yylval.tok_val); @@ -2256,7 +2259,7 @@ } if (lexer_flags.bracketflag == 0) - BEGIN 0; + BEGIN (INITIAL); if (next_token_is_assign_op () && ! lexer_flags.looking_at_return_list) { @@ -2489,7 +2492,7 @@ if (tok == "gset") lexer_flags.doing_set = true; - BEGIN COMMAND_START; + BEGIN (COMMAND_START); } }
--- a/src/ov-str-mat.h +++ b/src/ov-str-mat.h @@ -90,11 +90,11 @@ bool is_string (void) const { return true; } - bool is_real_type (void) const { return Vimplicit_str_to_num_ok; } + bool is_real_type (void) const { return false; } - bool is_matrix_type (void) const { return Vimplicit_str_to_num_ok; } + bool is_matrix_type (void) const { return false; } - bool is_numeric_type (void) const { return Vimplicit_str_to_num_ok; } + bool is_numeric_type (void) const { return false; } bool valid_as_scalar_index (void) const;
--- a/test/octave.test/number/ismatrix-5.m +++ b/test/octave.test/number/ismatrix-5.m @@ -1,5 +1,5 @@ implicit_str_to_num_ok = 0; t1 = ! ismatrix ("t"); implicit_str_to_num_ok = 1; -t2 = ismatrix ("t"); +t2 = ! ismatrix ("t"); t1 && t2
--- a/test/octave.test/number/ismatrix-6.m +++ b/test/octave.test/number/ismatrix-6.m @@ -1,5 +1,5 @@ implicit_str_to_num_ok = 0; t1 = ! ismatrix ("test"); implicit_str_to_num_ok = 1; -t2 = ismatrix ("test"); +t2 = ! ismatrix ("test"); t1 && t2
--- a/test/octave.test/number/ismatrix-7.m +++ b/test/octave.test/number/ismatrix-7.m @@ -1,5 +1,5 @@ implicit_str_to_num_ok = 0; t1 = ! ismatrix (["test"; "ing"]); implicit_str_to_num_ok = 1; -t2 = ismatrix (["test"; "ing"]); +t2 = ! ismatrix (["test"; "ing"]); t1 && t2
--- a/test/octave.test/number/isscalar-5.m +++ b/test/octave.test/number/isscalar-5.m @@ -1,5 +1,5 @@ implicit_str_to_num_ok = 0; t1 = ! isscalar ("t"); implicit_str_to_num_ok = 1; -t2 = isscalar ("t"); +t2 = ! isscalar ("t"); t1 && t2
--- a/test/octave.test/number/issquare-5.m +++ b/test/octave.test/number/issquare-5.m @@ -1,5 +1,5 @@ implicit_str_to_num_ok = 0; t1 = ! issquare ("t"); implicit_str_to_num_ok = 1; -t2 = (issquare ("t") == 1); +t2 = ! issquare ("t"); t1 && t2
--- a/test/octave.test/number/issquare-7.m +++ b/test/octave.test/number/issquare-7.m @@ -1,5 +1,5 @@ implicit_str_to_num_ok = 0; t1 = ! issquare (["test"; "ing"; "1"; "2"]); implicit_str_to_num_ok = 1; -t2 = (issquare (["test"; "ing"; "1"; "2"]) == 4); +t2 = ! issquare (["test"; "ing"; "1"; "2"]); t1 && t2
--- a/test/octave.test/number/issymmetric-5.m +++ b/test/octave.test/number/issymmetric-5.m @@ -1,5 +1,5 @@ implicit_str_to_num_ok = 0; t1 = ! issymmetric ("t"); implicit_str_to_num_ok = 1; -t2 = (issymmetric ("t") == 1); +t2 = ! issymmetric ("t"); t1 && t2
--- a/test/octave.test/number/issymmetric-7.m +++ b/test/octave.test/number/issymmetric-7.m @@ -1,5 +1,5 @@ implicit_str_to_num_ok = 0; t1 = ! issymmetric (["te"; "et"]); implicit_str_to_num_ok = 1; -t2 = (issymmetric (["te"; "et"]) == 2); +t2 = ! issymmetric (["te"; "et"]); t1 && t2