# HG changeset patch # User jwe # Date 981424626 0 # Node ID 13905c3a24af43e50c5dc5d4a7dc8ab49d1613e0 # Parent de61a7ba91f2c9442549a44c87b5904bd92fcd7f [project @ 2001-02-06 01:56:59 by jwe] diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2001-02-05 Mumit Khan + + * configure.in (TEMPLATE_AR, TEMPLATE_ARFLAGS): New variables. + * Makeconf.in (TEMPLATE_AR, TEMPLATE_ARFLAGS): Likewise. + + * configure.in (XTRA_CXXFLAGS): Use -fno-implicit templates for + pre-gcc3 compilers. Remove -fno-rtti and -fno-exceptions. + (DEPEND_FLAGS, DEPEND_EXTRA_SED_PATTERN): New macros. + (BLAS_LIBS): Fix test for sunperf library on Sun Solaris. + (CPICFLAG, CXXPICFLAG, FPICFLAG, SH_LDFLAGS, RLD_FLAG): Add Sun + compiler support. + * Makefile.in (DEPEND_FLAGS, DEPEND_EXTRA_SED_PATTERN): New + variables. + (%.d : %.cc): Use. + (%.d : %.c): Likewise. + * acconfig.h (CXX_ISO_COMPLIANT_LIBRARY): Add #undef. + 2001-01-31 Mumit Khan * Makeconf.in (%.d : %.cc): Strip the directory portion of the diff --git a/Makeconf.in b/Makeconf.in --- a/Makeconf.in +++ b/Makeconf.in @@ -33,6 +33,9 @@ AR = @AR@ ARFLAGS = @ARFLAGS@ +TEMPLATE_AR = @TEMPLATE_AR@ +TEMPLATE_ARFLAGS = @TEMPLATE_ARFLAGS@ + RANLIB = @RANLIB@ LN_S = @LN_S@ @@ -109,6 +112,9 @@ ALL_CFLAGS = $(INCFLAGS) $(DEFS) $(XTRA_CFLAGS) $(CFLAGS) BUG_CFLAGS = $(DEFS) $(XTRA_CFLAGS) $(CFLAGS) +DEPEND_FLAGS = @DEPEND_FLAGS@ +DEPEND_EXTRA_SED_PATTERN = @DEPEND_EXTRA_SED_PATTERN@ + CXX = @CXX@ CXX_VERSION = @CXX_VERSION@ CXXCPP = @CXXCPP@ @@ -300,8 +306,10 @@ %.d : %.cc @echo making $@ from $< @rm -f $@ - @$(CXX) -M $(CPPFLAGS) $(ALL_CXXFLAGS) $< | \ - sed -e 's,^[^:]*/\(.*\.o\):,\1:,' \ + @$(CXX) $(DEPEND_FLAGS) $(CPPFLAGS) $(ALL_CXXFLAGS) $< | \ + sed \ + $(DEPEND_EXTRA_SED_PATTERN) \ + -e 's,^[^:]*/\(.*\.o\):,\1:,' \ -e 's,$*\.o,pic/& & $@,g' > $@.tmp @mv $@.tmp $@ @@ -310,8 +318,10 @@ %.d : %.c @echo making $@ from $< @rm -f $@ - @$(CC) -M $(CPPFLAGS) $(ALL_CFLAGS) $< | \ - sed -e 's,^[^:]*/\(.*\.o\):,\1:,' \ + @$(CC) $(DEPEND_FLAGS) $(CPPFLAGS) $(ALL_CFLAGS) $< | \ + sed \ + $(DEPEND_EXTRA_SED_PATTERN) \ + -e 's,^[^:]*/\(.*\.o\):,\1:,' \ -e 's,$*\.o,pic/& & $@,g' > $@.tmp @mv $@.tmp $@ diff --git a/acconfig.h b/acconfig.h --- a/acconfig.h +++ b/acconfig.h @@ -14,6 +14,9 @@ internal array and matrix classes. */ #undef BOUNDS_CHECKING +/* Define if your C++ runtime library is ISO compliant. */ +#undef CXX_ISO_COMPLIANT_LIBRARY + /* Define if your compiler supports `<>' stuff for template friends. */ #undef CXX_NEW_FRIEND_TEMPLATE_DECL diff --git a/configure.in b/configure.in --- a/configure.in +++ b/configure.in @@ -21,7 +21,7 @@ ### Software Foundation, 59 Temple Place - Suite 330, Boston, MA ### 02111-1307, USA. -AC_REVISION($Revision: 1.338 $) +AC_REVISION($Revision: 1.339 $) AC_PREREQ(2.9) AC_INIT(src/octave.cc) AC_CONFIG_HEADER(config.h) @@ -184,12 +184,24 @@ gxx_version=`$CXX -v 2>&1 | grep "^.*g.. version" | \ sed -e 's/^.*g.. version *//' -e 's/cygnus-//' -e 's/egcs-//'` +# +# Auto instantiate all templates, other than those that are explicitly +# instantiated in Octave. Octave currently instantiates all needed +# templates for GCC-2.8.x and EGCS-1.1.x, but not for newer GNU releases +# nor for other supported compilers. +# +cxx_auto_instantiate_templates=yes case "$gxx_version" in changequote(,)dnl 1.* | 2.[0123456].* | 2.7.[01]*) changequote([,])dnl AC_MSG_ERROR([g++ version $gxx_version will not work to compile Octave]) ;; +changequote(,)dnl + 2.8* | 2.9[1-6]*) +changequote([,])dnl + cxx_auto_instantiate_templates=no + ;; esac CXX_VERSION= @@ -232,6 +244,24 @@ fi AC_SUBST(CC_VERSION) +### The flag to create dependency varies depending on the compier. + +# Assume GCC. +DEPEND_FLAGS="-M" +DEPEND_EXTRA_SED_PATTERN="" +case "$canonical_host_type" in + sparc-sun-solaris2* | i386-pc-solaris2*) + if test "$GCC" = "yes"; then + true + else + DEPEND_FLAGS="-xM1" + DEPEND_EXTRA_SED_PATTERN="-e '/\/opt\/SUNWspro/d'" + fi + ;; +esac +AC_SUBST(DEPEND_FLAGS) +AC_SUBST(DEPEND_EXTRA_SED_PATTERN) + ### On Intel systems with gcc, we may need to compile with -mieee-fp to ### get full support for IEEE floating point. ### @@ -272,22 +302,13 @@ ;; esac -### Octave doesn't use run-time type identification or exceptions yet, -### so disable them for somewhat faster and smaller code. - -OCTAVE_CXX_FLAG(-fno-rtti, [ - XTRA_CXXFLAGS="$XTRA_CXXFLAGS -fno-rtti" - AC_MSG_RESULT([adding -fno-rtti to XTRA_CXXFLAGS])]) +### We do our own template instantiation for specific compilers. -OCTAVE_CXX_FLAG(-fno-exceptions, [ - XTRA_CXXFLAGS="$XTRA_CXXFLAGS -fno-exceptions" - AC_MSG_RESULT([adding -fno-exceptions to XTRA_CXXFLAGS])]) - -### We do our own template instantiation. - -OCTAVE_CXX_FLAG(-fno-implicit-templates, [ - XTRA_CXXFLAGS="$XTRA_CXXFLAGS -fno-implicit-templates" - AC_MSG_RESULT([adding -fno-implicit-templates to XTRA_CXXFLAGS])]) +if test "$cxx_auto_instantiate_templates" = "no"; then + OCTAVE_CXX_FLAG(-fno-implicit-templates, [ + XTRA_CXXFLAGS="$XTRA_CXXFLAGS -fno-implicit-templates" + AC_MSG_RESULT([adding -fno-implicit-templates to XTRA_CXXFLAGS])]) +fi AC_SUBST(XTRA_CFLAGS) AC_SUBST(XTRA_CXXFLAGS) @@ -571,8 +592,11 @@ if test "x$BLAS_LIBS" = x; then # Check for BLAS in Sun Performance library: AC_CHECK_LIB(sunmath, acosp, BLAS_LIBS="-lsunmath") - AC_CHECK_LIB(sunperf, $dgemm_func, BLAS_LIBS="-xlic_lib=sunperf $BLAS_LIBS", - , $BLAS_LIBS) + # Don't use AC_CHECK_LIB here. + saved_LIBS="$LIBS" + LIBS="$LIBS $BLAS_LIBS -xlic_lib=sunperf" + AC_CHECK_FUNC($dgemm_func, BLAS_LIBS="-xlic_lib=sunperf $BLAS_LIBS",) + LIBS="$saved_LIBS" fi if test "x$BLAS_LIBS" = x; then @@ -692,6 +716,8 @@ SH_LDFLAGS=-shared SONAME_FLAGS= RLD_FLAG= +TEMPLATE_AR="$AR" +TEMPLATE_ARFLAGS="$ARFLAGS" case "$canonical_host_type" in *-*-386bsd* | *-*-openbsd* | *-*-netbsd* | *-*-freebsd*) SH_LD=ld @@ -752,9 +778,28 @@ if test "$octave_cv_f77_is_g77" = yes; then FPICFLAG=-fPIC else - FPICFLAG=-PIC + FPICFLAG=-KPIC + fi + if test "$GCC" = yes; then + CPICFLAG=-fPIC + else + CPICFLAG=-KPIC fi - RLD_FLAG='-Xlinker -R -Xlinker $(octlibdir)' + if test "$GXX" = yes; then + CXXPICFLAG=-fPIC + SH_LDFLAGS=-shared + else + CXXPICFLAG=-KPIC + SH_LDFLAGS=-G + fi + RLD_FLAG='-R $(octlibdir)' + # Template closures in archive libraries need a different mechanism. + if test "$GXX" = "yes"; then + true + else + TEMPLATE_AR="$CXX" + TEMPLATE_ARFLAGS="-xar -o" + fi ;; esac @@ -773,6 +818,8 @@ AC_MSG_RESULT([defining SH_LDFLAGS to be $SH_LDFLAGS]) AC_MSG_RESULT([defining SONAME_FLAGS to be $SONAME_FLAGS]) AC_MSG_RESULT([defining RLD_FLAG to be $RLD_FLAG]) +AC_MSG_RESULT([defining TEMPLATE_AR to be $TEMPLATE_AR]) +AC_MSG_RESULT([defining TEMPLATE_ARFLAGS to be $TEMPLATE_ARFLAGS]) AC_SUBST(FPICFLAG) AC_SUBST(CPICFLAG) AC_SUBST(CXXPICFLAG) @@ -782,6 +829,8 @@ AC_SUBST(SH_LDFLAGS) AC_SUBST(SONAME_FLAGS) AC_SUBST(RLD_FLAG) +AC_SUBST(TEMPLATE_AR) +AC_SUBST(TEMPLATE_ARFLAGS) ### Allow compilation of smaller kernel. This only works if some form ### of dynamic linking is also supported and used. diff --git a/liboctave/ArrayN-idx.h b/liboctave/ArrayN-idx.h --- a/liboctave/ArrayN-idx.h +++ b/liboctave/ArrayN-idx.h @@ -77,7 +77,7 @@ return retval; } -static Array +static inline Array freeze (Array& idx, const Array& dimensions) { Array retval; @@ -94,7 +94,7 @@ return retval; } -static bool +static inline bool all_ok (const Array& idx) { bool retval = true; @@ -113,7 +113,7 @@ return retval; } -static bool +static inline bool any_orig_empty (const Array& idx) { bool retval = false; @@ -132,7 +132,7 @@ return retval; } -static bool +static inline bool any_zero_len (const Array& frozen_lengths) { bool retval = false; @@ -151,7 +151,7 @@ return retval; } -static Array +static inline Array get_zero_len_size (const Array& frozen_lengths, const Array& dimensions) { @@ -160,7 +160,7 @@ return retval; } -static bool +static inline bool all_colon_equiv (const Array& idx, const Array& frozen_lengths) { @@ -199,19 +199,19 @@ template ArrayN -ArrayN::index (Array& idx) const +ArrayN::index (Array& arr_idx) const { ArrayN retval; int n_dims = dimensions.length (); - Array frozen_lengths = freeze (idx, dimensions); + Array frozen_lengths = freeze (arr_idx, dimensions); if (frozen_lengths.length () == n_dims) { - if (all_ok (idx)) + if (all_ok (arr_idx)) { - if (any_orig_empty (idx)) + if (any_orig_empty (arr_idx)) { retval.resize (frozen_lengths); } @@ -222,7 +222,7 @@ retval.resize (new_size); } - else if (all_colon_equiv (idx, frozen_lengths)) + else if (all_colon_equiv (arr_idx, frozen_lengths)) { retval = *this; } diff --git a/liboctave/ArrayN.cc b/liboctave/ArrayN.cc --- a/liboctave/ArrayN.cc +++ b/liboctave/ArrayN.cc @@ -46,32 +46,32 @@ template int -ArrayN::compute_index (const Array& idx) const +ArrayN::compute_index (const Array& arr_idx) const { int retval = -1; int n = dimensions.length (); - if (n > 0 && n == idx.length ()) + if (n > 0 && n == arr_idx.length ()) { - retval = idx(--n); + retval = arr_idx(--n); while (--n >= 0) { retval *= dimensions(n); - retval += idx(n); + retval += arr_idx(n); } } else (*current_liboctave_error_handler) - ("ArrayN::compute_index: invalid indexing operation"); + ("ArrayN::compute_index: invalid arr_idxing operation"); return retval; } template int -ArrayN::get_size (const Array& idx) +ArrayN::get_size (const Array& arr_idx) { // XXX KLUGE XXX @@ -97,18 +97,18 @@ int retval = max_items; - int n = idx.length (); + int n = arr_idx.length (); int nt = 0; double dt = 1; for (int i = 0; i < n; i++) { - int nidx; - double didx = frexp (static_cast (idx(i)), &nidx); + int narr_idx; + double darr_idx = frexp (static_cast (arr_idx(i)), &narr_idx); - nt += nidx; - dt *= didx; + nt += narr_idx; + dt *= darr_idx; } if (dt <= 0.5) @@ -125,7 +125,7 @@ retval = 1; for (int i = 0; i < n; i++) - retval *= idx(i); + retval *= arr_idx(i); } return retval; @@ -133,7 +133,7 @@ template T -ArrayN::range_error (const char *fcn, const Array& idx) const +ArrayN::range_error (const char *fcn, const Array& arr_idx) const { // XXX FIXME XXX -- report index values too! @@ -144,7 +144,7 @@ template T& -ArrayN::range_error (const char *fcn, const Array& idx) +ArrayN::range_error (const char *fcn, const Array& arr_idx) { // XXX FIXME XXX -- report index values too! @@ -155,17 +155,17 @@ } static inline bool -index_in_bounds (const Array& idx, const Array& dimensions) +index_in_bounds (const Array& arr_idx, const Array& dimensions) { bool retval = true; - int n = idx.length (); + int n = arr_idx.length (); if (n == dimensions.length ()) { for (int i = 0; i < n; i++) { - if (idx(i) < 0 || idx(i) >= dimensions (i)) + if (arr_idx(i) < 0 || arr_idx(i) >= dimensions (i)) { retval = false; break; @@ -179,20 +179,20 @@ } static inline void -increment_index (Array& idx, const Array& dimensions) +increment_index (Array& arr_idx, const Array& dimensions) { - idx(0)++; + arr_idx(0)++; - int n = idx.length () - 1; + int n = arr_idx.length () - 1; for (int i = 0; i < n; i++) { - if (idx(i) < dimensions(i)) + if (arr_idx(i) < dimensions(i)) break; else { - idx(i) = 0; - idx(i+1)++; + arr_idx(i) = 0; + arr_idx(i+1)++; } } } @@ -238,14 +238,14 @@ dimensions = dims; - Array idx (dimensions.length (), 0); + Array arr_idx (dimensions.length (), 0); for (int i = 0; i < old_len; i++) { - if (index_in_bounds (idx, dimensions)) - xelem (idx) = old_data[i]; + if (index_in_bounds (arr_idx, dimensions)) + xelem (arr_idx) = old_data[i]; - increment_index (idx, dimensions); + increment_index (arr_idx, dimensions); } if (--old_rep->count <= 0) @@ -295,17 +295,17 @@ dimensions = dims; - Array idx (dimensions.length (), 0); + Array arr_idx (dimensions.length (), 0); for (int i = 0; i < len; i++) rep->elem (i) = val; for (int i = 0; i < old_len; i++) { - if (index_in_bounds (idx, dimensions)) - xelem (idx) = old_data[i]; + if (index_in_bounds (arr_idx, dimensions)) + xelem (arr_idx) = old_data[i]; - increment_index (idx, dimensions); + increment_index (arr_idx, dimensions); } if (--old_rep->count <= 0) @@ -314,9 +314,9 @@ template ArrayN& -ArrayN::insert (const ArrayN& a, const Array& idx) +ArrayN::insert (const ArrayN& a, const Array& arr_idx) { - int n = idx.length (); + int n = arr_idx.length (); if (n == dimensions.length ()) { @@ -324,7 +324,7 @@ for (int i = 0; i < n; i++) { - if (idx(i) < 0 || idx(i) + a_dims(i) > dimensions(i)) + if (arr_idx(i) < 0 || arr_idx(i) + a_dims(i) > dimensions(i)) { (*current_liboctave_error_handler) ("ArrayN::insert: range error for insert"); diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,24 @@ +2001-02-05 Mumit Khan + + * Makefile.in (TEMPLATE_AR, TEMPLATE_ARFLAGS): Use to create + archive libraries containing templates. + + * ArrayN-idx.h (freeze, all_ok, any_orig_empty, any_zero_len, + get_zero_len_size, all_colon_equiv): Inline. + (ArrayN::index): Rename idx to arr_idx. + * ArrayN.cc (ArrayN::index, ArrayN::compute_index, + ArrayN::get_size, ArrayN::range_error, ArrayN::range_error, + increment_index, ArrayN::resize, ArrayN::insert): Likewise. + +2001-02-05 John W. Eaton + + * lo-mappers.h, lo-mappers.cc (tan (const Complex&), + log10 (const Complex&)): Delete. + + * oct-cmplx.h: Define forwarding functions for real, imag, abs, + arg, norm, conj, polar, cos, cosh, exp, log, log10, pow, sin, + sinh, sqrt, tan, and tanh. + 2001-01-31 John W. Eaton * file-ops.cc, help.cc, load-save.cc, pr-output.cc, utils.cc: diff --git a/liboctave/Makefile.in b/liboctave/Makefile.in --- a/liboctave/Makefile.in +++ b/liboctave/Makefile.in @@ -163,7 +163,7 @@ liboctave.$(LIBEXT): $(OBJECTS) rm -f $@ - $(AR) $(ARFLAGS) $@ $^ + $(TEMPLATE_AR) $(TEMPLATE_ARFLAGS) $@ $^ $(RANLIB) $@ liboctave.$(SHLEXT): liboctave.$(SHLEXT_VER) diff --git a/liboctave/lo-mappers.cc b/liboctave/lo-mappers.cc --- a/liboctave/lo-mappers.cc +++ b/liboctave/lo-mappers.cc @@ -257,12 +257,6 @@ } Complex -log10 (const Complex& x) -{ - return M_LOG10E * log (x); -} - -Complex round (const Complex& x) { return Complex (D_NINT (real (x)), D_NINT (imag (x))); @@ -275,12 +269,6 @@ } Complex -tan (const Complex& x) -{ - return sin (x) / cos (x); -} - -Complex tanh (const Complex& x) { return sinh (x) / cosh (x); diff --git a/liboctave/lo-mappers.h b/liboctave/lo-mappers.h --- a/liboctave/lo-mappers.h +++ b/liboctave/lo-mappers.h @@ -51,10 +51,8 @@ extern Complex ceil (const Complex& x); extern Complex fix (const Complex& x); extern Complex floor (const Complex& x); -extern Complex log10 (const Complex& x); extern Complex round (const Complex& x); extern Complex signum (const Complex& x); -extern Complex tan (const Complex& x); extern Complex tanh (const Complex& x); extern bool xisnan (const Complex& x); diff --git a/liboctave/oct-cmplx.h b/liboctave/oct-cmplx.h --- a/liboctave/oct-cmplx.h +++ b/liboctave/oct-cmplx.h @@ -23,10 +23,142 @@ #if !defined (octave_oct_cmplx_h) #define octave_oct_cmplx_h 1 +// By using this file instead of , we can easily avoid buggy +// implementations of the standard complex data type (if needed). + #include typedef std::complex Complex; +#if defined (CXX_ISO_COMPLIANT_LIBRARY) + +// If namespaces don't work, we will end up with some infinite looping. + +inline double +real (const Complex& z) +{ + return std::real (z); +} + +inline double +imag (const Complex& z) +{ + return std::imag (z); +} + +inline double +abs (const Complex& z) +{ + return std::abs (z); +} + +inline double +arg (const Complex& z) +{ + return std::arg (z); +} + +inline double +norm (const Complex& z) +{ + return std::norm (z); +} + +inline Complex +conj (const Complex& z) +{ + return std::conj (z); +} + +inline Complex +polar (const double& x, const double& y); + +inline Complex +cos (const Complex& z) +{ + return std::cos (z); +} + +inline Complex +cosh (const Complex& z) +{ + return std::cosh (z); +} + +inline Complex +exp (const Complex& z) +{ + return std::exp (z); +} + +inline Complex +log (const Complex& z) +{ + return std::log (z); +} + +inline Complex +log10 (const Complex& z) +{ + return std::log10 (z); +} + +inline Complex +pow (const Complex& z, int n) +{ + return std::pow (z, n); +} + +inline Complex +pow (const Complex& z, const double& x) +{ + return std::pow (z, x); +} + +inline Complex +pow (const Complex& z1, const Complex& z2) +{ + return std::pow (z1, z2); +} + +inline Complex +pow (const double& x, const Complex& z) +{ + return std::pow (x, z); +} + +inline Complex +sin (const Complex& z) +{ + return std::sin (z); +} + +inline Complex +sinh (const Complex& z) +{ + return std::sinh (z); +} + +inline Complex +sqrt (const Complex& z) +{ + return std::sqrt (z); +} + +inline Complex +tan (const Complex& z) +{ + return std::tan (z); +} + +inline Complex +tanh (const Complex& z) +{ + return std::tanh (z); +} + +#endif + #endif /* diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2001-02-05 Ondrej Popp + + * control/system/c2d.m: Add missing endif. + 2000-12-15 Teemu Ikonen * strings/index.m: Return 0 if either string is empty. diff --git a/scripts/control/system/c2d.m b/scripts/control/system/c2d.m --- a/scripts/control/system/c2d.m +++ b/scripts/control/system/c2d.m @@ -176,6 +176,7 @@ D = d + (c*iab); stnamed = strappend(stname,"_d"); dsys = ss2sys(A,B,C,D,T,0,rows(A),stnamed,inname,outname); + endif elseif(strcmp(opt,"matched")) if(is_digital(sys)) error("c2d: system is already digital"); diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,61 @@ +2001-02-05 Mumit Khan + + * oct-stream.cc (octave_scan): Implement, and specialize for + char*. Delete the old template instantiations. + (BEGIN_S_CONVERSION): Use strings instead of ostrstreambuf. + (octave_base_stream::do_scanf): Pass correct parameter to + do_scan_conv. + + * Makefile.in (TEMPLATE_AR, TEMPLATE_ARFLAGS): Use to create + archive libraries containing templates. + + * c-file-ptr-stream.h: Include . Use instead of + + (c_file_ptr_buf::int_type): Compat typedef for non-ISO libstdc++. + (c_file_ptr_buf::{overflow, underflow, uflow, pbackfail): Use. + (c_file_ptr_buf::c_file_ptr_buf): Handle various compilers. + (c_file_ptr_buf::file_number): New member function. + (c_file_ptr_buf::fd): New private data. + (i_c_file_ptr_stream::i_c_file_ptr_stream): Initialize stream + correctly. + (o_c_file_ptr_stream::o_c_file_ptr_stream): Likewise. + * c-file-ptr-stream.cc + (c_file_ptr_buf::{overflow, underflow, uflow, pbackfail): Add + ISO-compliant EOF handling. + * oct-stream.cc (octave_base_stream::file_number): Use + c_file_ptr_buf::file_number to get underlying file descriptor. + + * comment-list.cc: Add missing class qualifier. + + * file-io.cc, load-save.cc, mappers.cc, oct-fstrm.cc, oct-fstrm.h, + oct-iostrm.cc, oct-iostrm.h, oct-stdstrm.cc, oct-stdstrm.h, + oct-stream.cc, oct-stream.h, oct-strstrm.cc, oct-strstrm.h, + ov-base-nd-array.cc, ov-base-scalar.h, ov-complex.cc, ov-cx-mat.cc, + pager.cc, pr-output.cc, procstream.h, pt-bp.h, utils.cc: + Add std:: namespace qualifier as needed, and replace + deprecated or invalid libstdc++-v2 names with standard ones + where appropriate. + + * DLD-FUNCTIONS/minmax.cc: Fix docstring. + + * oct-fstrm.cc (octave_fstream::octave_fstream): Maintain fix for + libstdc++-v2. + + * oct-stdstrm.cc (octave_ostdiostream::create): Remove default + parameter value in definition. + + * oct-stream.cc (octave_stream::mode_as_string): Don't assume + std::iso::openmode is an integral quantity. + + * pager.cc, procstream.h: Initialize streams correctly. + + * utils.cc: Use CXX_ISO_COMPLIANT_LIBRARY guard. + + * ov-base-nd-array.cc (idx_list_to_idx_array): Inline. + + * ov-base-scalar.h (octave_base_scalar::octave_base_scalar): Use + ``const ST& s'' instead of ST to workaround gcc3 complex bug. + 2001-02-05 John W. Eaton * lex.l (next_token_is_bin_op): Remove Checks for spacing except diff --git a/src/DLD-FUNCTIONS/minmax.cc b/src/DLD-FUNCTIONS/minmax.cc --- a/src/DLD-FUNCTIONS/minmax.cc +++ b/src/DLD-FUNCTIONS/minmax.cc @@ -556,7 +556,7 @@ \n\ If called with two output arguments, also returns the index of the\n\ minimum value(s). Thus,\n\ -@example\n +@example\n\ [x, ix] = min ([1, 3, 0, 2, 5])\n\ @end example\n\ \n\ @@ -580,11 +580,11 @@ returns the largest element of @var{x}.\n\ \n\ For complex arguments, the magnitude of the elements are used for\n\ -comparison. +comparison.\n\ \n\ If called with two output arguments, also returns the index of the\n\ maximum value(s). Thus,\n\ -@example\n +@example\n\ [x, ix] = max([1, 3, 5, 2, 5])\n\ @end example\n\ \n\ diff --git a/src/Makefile.in b/src/Makefile.in --- a/src/Makefile.in +++ b/src/Makefile.in @@ -232,7 +232,7 @@ liboctinterp.$(LIBEXT): $(OBJECTS) rm -f $@ - $(AR) $(ARFLAGS) $@ $^ + $(TEMPLATE_AR) $(TEMPLATE_ARFLAGS) $@ $^ $(RANLIB) $@ liboctinterp.$(SHLEXT): liboctinterp.$(SHLEXT_VER) diff --git a/src/c-file-ptr-stream.cc b/src/c-file-ptr-stream.cc --- a/src/c-file-ptr-stream.cc +++ b/src/c-file-ptr-stream.cc @@ -49,34 +49,50 @@ // XXX FIXME XXX -- I'm sure there is room for improvement here... -int -c_file_ptr_buf::overflow (int c) +c_file_ptr_buf::int_type +c_file_ptr_buf::overflow (int_type c) { +#if defined (CXX_ISO_COMPLIANT_LIBRARY) + if (f) + return (c != traits_type::eof ()) ? fputc (c, f) : flush (); + else + return traits_type::not_eof (c); +#else if (f) return (c != EOF) ? fputc (c, f) : flush (); else return EOF; +#endif } -int +c_file_ptr_buf::int_type c_file_ptr_buf::underflow (void) { if (f) return fgetc (f); else +#if defined (CXX_ISO_COMPLIANT_LIBRARY) + return traits_type::eof (); +#else return EOF; +#endif } -int +c_file_ptr_buf::int_type c_file_ptr_buf::uflow (void) { return underflow (); } -int -c_file_ptr_buf::pbackfail (int c) +c_file_ptr_buf::int_type +c_file_ptr_buf::pbackfail (int_type c) { +#if defined (CXX_ISO_COMPLIANT_LIBRARY) + return (c != traits_type::eof () && f) ? ungetc (c, f) : + traits_type::not_eof (c); +#else return (c != EOF && f) ? ungetc (c, f) : EOF; +#endif } std::streamsize diff --git a/src/c-file-ptr-stream.h b/src/c-file-ptr-stream.h --- a/src/c-file-ptr-stream.h +++ b/src/c-file-ptr-stream.h @@ -28,29 +28,43 @@ #endif #include -#include +#include +#include class c_file_ptr_buf : public std::filebuf { public: +#if !defined (CXX_ISO_COMPLIANT_LIBRARY) + typedef int int_type; +#endif + typedef int (*close_fcn) (FILE *); FILE* stdiofile (void) const { return f; } c_file_ptr_buf (FILE *f_arg, close_fcn cf_arg = ::fclose) - : std::filebuf (f_arg ? fileno (f_arg) : -1), f (f_arg), cf (cf_arg) { } + : +#ifdef __SUNPRO_CC + std::filebuf (f_arg ? fileno (f_arg) : -1), +#else + std::filebuf (f_arg ? fileno (f_arg) : -1, + 0, std::ios::in | std::ios::out), +#endif + f (f_arg), cf (cf_arg), + fd (f_arg ? fileno (f_arg) : -1) + { } ~c_file_ptr_buf (void); - int overflow (int); + int_type overflow (int_type); - int underflow (void); + int_type underflow (void); - int uflow (void); + int_type uflow (void); - int pbackfail (int); + int_type pbackfail (int_type); std::streamsize xsputn (const char*, std::streamsize); @@ -68,11 +82,17 @@ int close (void); + int file_number () const { return fd; } + protected: FILE *f; close_fcn cf; + +private: + + int fd; }; class @@ -81,7 +101,7 @@ public: i_c_file_ptr_stream (FILE* f, c_file_ptr_buf::close_fcn cf = ::fclose) - : std::istream (), buf (new c_file_ptr_buf (f, cf)) { init (buf); } + : std::istream (0), buf (new c_file_ptr_buf (f, cf)) { init (buf); } ~i_c_file_ptr_stream (void) { delete buf; buf = 0; } @@ -100,7 +120,7 @@ public: o_c_file_ptr_stream (FILE* f, c_file_ptr_buf::close_fcn cf = ::fclose) - : std::ostream (), buf (new c_file_ptr_buf (f, cf)) { init (buf); } + : std::ostream (0), buf (new c_file_ptr_buf (f, cf)) { init (buf); } ~o_c_file_ptr_stream (void) { delete buf; buf = 0; } diff --git a/src/comment-list.cc b/src/comment-list.cc --- a/src/comment-list.cc +++ b/src/comment-list.cc @@ -36,7 +36,7 @@ #include "SLList.h" #include "SLList.cc" -template SLList; +template class SLList; octave_comment_buffer *octave_comment_buffer::instance = 0; diff --git a/src/file-io.cc b/src/file-io.cc --- a/src/file-io.cc +++ b/src/file-io.cc @@ -318,7 +318,9 @@ oct_mach_info::string_to_float_format (arch); if (! error_state) - retval = octave_fstream::create (name, md, flt_fmt); + retval = octave_fstream::create (name, + static_cast (md), + flt_fmt); } return retval; diff --git a/src/load-save.cc b/src/load-save.cc --- a/src/load-save.cc +++ b/src/load-save.cc @@ -3287,7 +3287,7 @@ { i++; - unsigned mode = std::ios::in; + std::ios::openmode mode = std::ios::in; if (format == LS_BINARY || format == LS_MAT_BINARY || format == LS_MAT5_BINARY) @@ -4749,7 +4749,7 @@ case LS_MAT5_BINARY: { - char *versionmagic; + char const * versionmagic; TWO_BYTE_INT number = *(TWO_BYTE_INT *)"\x00\x01"; struct tm bdt; time_t now; @@ -4846,7 +4846,7 @@ load_save_format format = get_default_save_format (); - unsigned mode = std::ios::out|std::ios::trunc; + std::ios::openmode mode = std::ios::out|std::ios::trunc; if (format == LS_BINARY || format == LS_MAT_BINARY || format == LS_MAT5_BINARY) @@ -5088,7 +5088,7 @@ i++; - unsigned mode = std::ios::out; + std::ios::openmode mode = std::ios::out; if (format == LS_BINARY || format == LS_MAT_BINARY || format == LS_MAT5_BINARY) @@ -5123,7 +5123,7 @@ if (file) { bool write_header_info - = ((file.rdbuf ())->seekoff (0, std::ios::cur) + = ((file.rdbuf ())->pubseekoff (0, std::ios::cur) == static_cast (0)); save_vars (argv, i, argc, file, save_builtins, format, diff --git a/src/mappers.cc b/src/mappers.cc --- a/src/mappers.cc +++ b/src/mappers.cc @@ -155,7 +155,7 @@ void install_mapper_functions (void) { - DEFUN_MAPPER (abs, 0, 0, 0, fabs, abs, 0, 0.0, 0.0, 0, + DEFUN_MAPPER (abs, 0, 0, 0, std::fabs, abs, 0, 0.0, 0.0, 0, "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} abs (@var{z})\n\ Compute the magnitude of @var{z}, defined as\n\ @@ -178,7 +178,7 @@ @end example\n\ @end deftypefn"); - DEFUN_MAPPER (acos, 0, 0, 0, acos, 0, acos, -1.0, 1.0, 1, + DEFUN_MAPPER (acos, 0, 0, 0, std::acos, 0, acos, -1.0, 1.0, 1, "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} acos (@var{x})\n\ Compute the inverse cosine of each element of @var{x}.\n\ @@ -223,7 +223,7 @@ @end example\n\ @end deftypefn"); - DEFUN_MAPPER (asin, 0, 0, 0, asin, 0, asin, -1.0, 1.0, 1, + DEFUN_MAPPER (asin, 0, 0, 0, std::asin, 0, asin, -1.0, 1.0, 1, "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} asin (@var{x})\n\ Compute the inverse sine of each element of @var{x}.\n\ @@ -235,7 +235,7 @@ Ompute the inverse hyperbolic sine of each element of @var{x}.\n\ @end deftypefn"); - DEFUN_MAPPER (atan, 0, 0, 0, atan, 0, atan, 0.0, 0.0, 0, + DEFUN_MAPPER (atan, 0, 0, 0, std::atan, 0, atan, 0.0, 0.0, 0, "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} atan (@var{x})\n\ Compute the inverse tangent of each element of @var{x}.\n\ @@ -247,7 +247,7 @@ Compute the inverse hyperbolic tanget of each element of @var{x}.\n\ @end deftypefn"); - DEFUN_MAPPER (ceil, 0, 0, 0, ceil, 0, ceil, 0.0, 0.0, 0, + DEFUN_MAPPER (ceil, 0, 0, 0, std::ceil, 0, ceil, 0.0, 0.0, 0, "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} ceil (@var{x})\n\ Return the smallest integer not less than @var{x}. If @var{x} is\n\ @@ -269,13 +269,13 @@ @end deftypefn\n\ @seealso{real and imag}"); - DEFUN_MAPPER (cos, 0, 0, 0, cos, 0, cos, 0.0, 0.0, 0, + DEFUN_MAPPER (cos, 0, 0, 0, std::cos, 0, cos, 0.0, 0.0, 0, "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} cos (@var{x})\n\ Compute the cosine of each element of @var{x}.\n\ @end deftypefn"); - DEFUN_MAPPER (cosh, 0, 0, 0, cosh, 0, cosh, 0.0, 0.0, 0, + DEFUN_MAPPER (cosh, 0, 0, 0, std::cosh, 0, cosh, 0.0, 0.0, 0, "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} cosh (@var{x})\n\ Compute the hyperbolic cosine of each element of @var{x}.\n\ @@ -321,7 +321,7 @@ \n\ @seealso{erf and erfinv}"); - DEFUN_MAPPER (exp, 0, 0, 0, exp, 0, exp, 0.0, 0.0, 0, + DEFUN_MAPPER (exp, 0, 0, 0, std::exp, 0, exp, 0.0, 0.0, 0, "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} exp (@var{x})\n\ Compute the exponential of @var{x}. To compute the matrix exponential,\n\ @@ -349,7 +349,7 @@ @code{fix (real (@var{x})) + fix (imag (@var{x})) * I}.\n\ @end deftypefn"); - DEFUN_MAPPER (floor, 0, 0, 0, floor, 0, floor, 0.0, 0.0, 0, + DEFUN_MAPPER (floor, 0, 0, 0, std::floor, 0, floor, 0.0, 0.0, 0, "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} floor (@var{x})\n\ Return the largest integer not greater than @var{x}. If @var{x} is\n\ @@ -500,7 +500,7 @@ @end deftypefn\n\ @seealso{gamma and gammai}"); - DEFUN_MAPPER (log, 0, 0, 0, log, 0, log, 0.0, DBL_MAX, 1, + DEFUN_MAPPER (log, 0, 0, 0, std::log, 0, log, 0.0, DBL_MAX, 1, "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} log (@var{x})\n\ Compute the natural logarithm for each element of @var{x}. To compute the\n\ @@ -508,7 +508,7 @@ @end deftypefn\n\ @seealso{log2, log10, logspace, and exp}"); - DEFUN_MAPPER (log10, 0, 0, 0, log10, 0, log10, 0.0, DBL_MAX, 1, + DEFUN_MAPPER (log10, 0, 0, 0, std::log10, 0, log10, 0.0, DBL_MAX, 1, "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} log10 (@var{x})\n\ Compute the base-10 logarithm for each element of @var{x}.\n\ @@ -553,19 +553,19 @@ For complex arguments, @code{sign} returns @code{x ./ abs (@var{x})}.\n\ @end deftypefn"); - DEFUN_MAPPER (sin, 0, 0, 0, sin, 0, sin, 0.0, 0.0, 0, + DEFUN_MAPPER (sin, 0, 0, 0, std::sin, 0, sin, 0.0, 0.0, 0, "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} sin (@var{x})\n\ Compute the sin of each element of @var{x}.\n\ @end deftypefn"); - DEFUN_MAPPER (sinh, 0, 0, 0, sinh, 0, sinh, 0.0, 0.0, 0, + DEFUN_MAPPER (sinh, 0, 0, 0, std::sinh, 0, sinh, 0.0, 0.0, 0, "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} sinh (@var{x})\n\ Compute the inverse hyperbolic sin of each element of @var{x}.\n\ @end deftypefn"); - DEFUN_MAPPER (sqrt, 0, 0, 0, sqrt, 0, sqrt, 0.0, DBL_MAX, 1, + DEFUN_MAPPER (sqrt, 0, 0, 0, std::sqrt, 0, sqrt, 0.0, DBL_MAX, 1, "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} sqrt (@var{x})\n\ Compute the square root of @var{x}. If @var{x} is negative, a complex\n\ @@ -573,13 +573,13 @@ @ref{Linear Algebra}.\n\ @end deftypefn"); - DEFUN_MAPPER (tan, 0, 0, 0, tan, 0, tan, 0.0, 0.0, 0, + DEFUN_MAPPER (tan, 0, 0, 0, std::tan, 0, tan, 0.0, 0.0, 0, "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} tan (@var{z})\n\ Compute tanget of each element of @var{x}.\n\ @end deftypefn"); - DEFUN_MAPPER (tanh, 0, 0, 0, tanh, 0, tanh, 0.0, 0.0, 0, + DEFUN_MAPPER (tanh, 0, 0, 0, std::tanh, 0, tanh, 0.0, 0.0, 0, "-*- texinfo -*-\n\ @deftypefn {Mapping Function} {} tanh (@var{x})\n\ Compute hyperbolic tangent of each element of @var{x}.\n\ diff --git a/src/oct-fstrm.cc b/src/oct-fstrm.cc --- a/src/oct-fstrm.cc +++ b/src/oct-fstrm.cc @@ -42,11 +42,19 @@ oct_mach_info::float_format flt_fmt) : octave_base_stream (arg_md, flt_fmt), nm (nm_arg) { + +#if CXX_ISO_COMPLIANT_LIBRARY + + fs.open (nm.c_str (), arg_md); + +#else // Override default protection of 0664 so that umask will appear to // do the right thing. fs.open (nm.c_str (), arg_md, 0666); +#endif + if (! fs) { using namespace std; @@ -58,7 +66,7 @@ // Position a stream at OFFSET relative to ORIGIN. int -octave_fstream::seek (std::streamoff offset, std::ios::seek_dir origin) +octave_fstream::seek (std::streamoff offset, std::ios::seekdir origin) { int retval = -1; diff --git a/src/oct-fstrm.h b/src/oct-fstrm.h --- a/src/oct-fstrm.h +++ b/src/oct-fstrm.h @@ -24,6 +24,7 @@ #define octave_octave_fstream_h 1 #include +#include #include "oct-stream.h" @@ -44,7 +45,7 @@ // Position a stream at OFFSET relative to ORIGIN. - int seek (std::streamoff offset, std::ios::seek_dir origin); + int seek (std::streamoff offset, std::ios::seekdir origin); // Return current stream position. diff --git a/src/oct-iostrm.cc b/src/oct-iostrm.cc --- a/src/oct-iostrm.cc +++ b/src/oct-iostrm.cc @@ -30,7 +30,7 @@ // Position a stream at OFFSET relative to ORIGIN. int -octave_base_iostream::seek (std::streamoff, std::ios::seek_dir) +octave_base_iostream::seek (std::streamoff, std::ios::seekdir) { invalid_operation (); return -1; diff --git a/src/oct-iostrm.h b/src/oct-iostrm.h --- a/src/oct-iostrm.h +++ b/src/oct-iostrm.h @@ -40,7 +40,7 @@ // Position a stream at OFFSET relative to ORIGIN. - int seek (std::streamoff offset, std::ios::seek_dir origin); + int seek (std::streamoff offset, std::ios::seekdir origin); // Return current stream position. diff --git a/src/oct-stdstrm.cc b/src/oct-stdstrm.cc --- a/src/oct-stdstrm.cc +++ b/src/oct-stdstrm.cc @@ -31,7 +31,7 @@ // Position a stream at OFFSET relative to ORIGIN. int -octave_base_stdiostream::seek (std::streamoff offset, std::ios::seek_dir origin) +octave_base_stdiostream::seek (std::streamoff offset, std::ios::seekdir origin) { int retval = -1; @@ -107,7 +107,7 @@ octave_stream octave_ostdiostream::create (const std::string& n, FILE *f, - c_file_ptr_buf::close_fcn cf = ::fclose, + c_file_ptr_buf::close_fcn cf, std::ios::openmode arg_md, oct_mach_info::float_format flt_fmt) { diff --git a/src/oct-stdstrm.h b/src/oct-stdstrm.h --- a/src/oct-stdstrm.h +++ b/src/oct-stdstrm.h @@ -39,7 +39,7 @@ // Position a stream at OFFSET relative to ORIGIN. - int seek (std::streamoff offset, std::ios::seek_dir origin); + int seek (std::streamoff offset, std::ios::seekdir origin); // Return current stream position. diff --git a/src/oct-stream.cc b/src/oct-stream.cc --- a/src/oct-stream.cc +++ b/src/oct-stream.cc @@ -39,6 +39,7 @@ #include "error.h" #include "input.h" +#include "oct-stdstrm.h" #include "oct-stream.h" #include "oct-obj.h" #include "utils.h" @@ -894,9 +895,17 @@ std::istream *is = input_stream (); std::ostream *os = output_stream (); - // XXX FIXME XXX -- there must be a better way... - int i_fid = is ? ((std::filebuf *) (is->rdbuf ()))->fd () : -1; - int o_fid = os ? ((std::filebuf *) (os->rdbuf ()))->fd () : -1; + // There is no standard way to get the underlying file descriptor from + // std::filebuf (nor in the GNU libstdc++-v3 implementation). We cache + // the descriptor in c_file_ptr_buf, and then extract it here. + + c_file_ptr_buf *ibuf = is ? + dynamic_cast (is->rdbuf ()) : 0; + c_file_ptr_buf *obuf = os ? + dynamic_cast (os->rdbuf ()) : 0; + + int i_fid = ibuf ? ibuf->file_number () : -1; + int o_fid = obuf ? obuf->file_number () : -1; if (i_fid >= 0) { @@ -1055,7 +1064,7 @@ return retval; } -#if defined (__GNUG__) +#if defined (__GNUG__) && !CXX_ISO_COMPLIANT_LIBRARY #define OCTAVE_SCAN(is, fmt, arg) is.scan ((fmt).text, arg) @@ -2513,7 +2522,7 @@ } int -octave_stream::seek (std::streamoff offset, std::ios::seek_dir origin) +octave_stream::seek (std::streamoff offset, std::ios::seekdir origin) { int retval = -1; @@ -2535,7 +2544,7 @@ if (! conv_err) { - std::ios::seek_dir origin = std::ios::beg; + std::ios::seekdir origin = std::ios::beg; if (tc_origin.is_string ()) { @@ -2765,62 +2774,36 @@ octave_stream::mode_as_string (int mode) { std::string retval = "???"; - - switch (mode) - { - case std::ios::in: - retval = "r"; - break; - - case std::ios::out: - case std::ios::out | std::ios::trunc: - retval = "w"; - break; - - case std::ios::out | std::ios::app: - retval = "a"; - break; - - case std::ios::in | std::ios::out: - retval = "r+"; - break; - - case std::ios::in | std::ios::out | std::ios::trunc: - retval = "w+"; - break; - - case std::ios::in | std::ios::out | std::ios::app: - retval = "a+"; - break; - - case std::ios::in | std::ios::binary: - retval = "rb"; - break; - - case std::ios::out | std::ios::binary: - case std::ios::out | std::ios::trunc | std::ios::binary: - retval = "wb"; - break; - - case std::ios::out | std::ios::app | std::ios::binary: - retval = "ab"; - break; - - case std::ios::in | std::ios::out | std::ios::binary: - retval = "r+b"; - break; - - case std::ios::in | std::ios::out | std::ios::trunc | std::ios::binary: - retval = "w+b"; - break; - - case std::ios::in | std::ios::out | std::ios::app | std::ios::binary: - retval = "a+b"; - break; - - default: - break; - } + std::ios::openmode in_mode = static_cast (mode); + + if (in_mode == std::ios::in) + retval = "r"; + else if (in_mode == std::ios::out + || in_mode == std::ios::out | std::ios::trunc) + retval = "w"; + else if (in_mode == std::ios::out | std::ios::app) + retval = "a"; + else if (in_mode == std::ios::in | std::ios::out) + retval = "r+"; + else if (in_mode == std::ios::in | std::ios::out | std::ios::trunc) + retval = "w+"; + else if (in_mode == std::ios::in | std::ios::out | std::ios::app) + retval = "a+"; + else if (in_mode == std::ios::in | std::ios::binary) + retval = "rb"; + else if (in_mode == std::ios::out | std::ios::binary + || in_mode == std::ios::out | std::ios::trunc | std::ios::binary) + retval = "wb"; + else if (in_mode == std::ios::out | std::ios::app | std::ios::binary) + retval = "ab"; + else if (in_mode == std::ios::in | std::ios::out | std::ios::binary) + retval = "r+b"; + else if (in_mode == std::ios::in | std::ios::out | std::ios::trunc + | std::ios::binary) + retval = "w+b"; + else if (in_mode == std::ios::in | std::ios::out | std::ios::app + | std::ios::binary) + retval = "a+b"; return retval; } diff --git a/src/oct-stream.h b/src/oct-stream.h --- a/src/oct-stream.h +++ b/src/oct-stream.h @@ -334,7 +334,7 @@ // Position a stream at OFFSET relative to ORIGIN. - virtual int seek (std::streamoff offset, std::ios::seek_dir origin) = 0; + virtual int seek (std::streamoff offset, std::ios::seekdir origin) = 0; // Return current stream position. @@ -502,7 +502,7 @@ std::string gets (int max_len, bool& err); std::string gets (const octave_value& max_len, bool& err); - int seek (std::streamoff offset, std::ios::seek_dir origin); + int seek (std::streamoff offset, std::ios::seekdir origin); int seek (const octave_value& offset, const octave_value& origin); long tell (void) const; diff --git a/src/oct-strstrm.cc b/src/oct-strstrm.cc --- a/src/oct-strstrm.cc +++ b/src/oct-strstrm.cc @@ -29,7 +29,7 @@ // Position a stream at OFFSET relative to ORIGIN. int -octave_base_strstream::seek (std::streamoff offset, std::ios::seek_dir origin) +octave_base_strstream::seek (std::streamoff offset, std::ios::seekdir origin) { int retval = -1; diff --git a/src/oct-strstrm.h b/src/oct-strstrm.h --- a/src/oct-strstrm.h +++ b/src/oct-strstrm.h @@ -40,7 +40,7 @@ // Position a stream at OFFSET relative to ORIGIN. - int seek (std::streamoff offset, std::ios::seek_dir origin); + int seek (std::streamoff offset, std::ios::seekdir origin); // Return current stream position. diff --git a/src/ov-base-nd-array.cc b/src/ov-base-nd-array.cc --- a/src/ov-base-nd-array.cc +++ b/src/ov-base-nd-array.cc @@ -35,7 +35,7 @@ #include "ov-base-nd-array.h" #include "pr-output.h" -static Array +static inline Array idx_list_to_idx_array (const octave_value_list& idx) { int n = idx.length (); diff --git a/src/ov-base-scalar.h b/src/ov-base-scalar.h --- a/src/ov-base-scalar.h +++ b/src/ov-base-scalar.h @@ -51,7 +51,7 @@ octave_base_scalar (void) : octave_base_value () { } - octave_base_scalar (ST s) + octave_base_scalar (const ST& s) : octave_base_value (), scalar (s) { } octave_base_scalar (const octave_base_scalar& s) diff --git a/src/ov-complex.cc b/src/ov-complex.cc --- a/src/ov-complex.cc +++ b/src/ov-complex.cc @@ -55,7 +55,7 @@ octave_value *retval = 0; if (imag (scalar) == 0.0) - retval = new octave_scalar (::real (scalar)); + retval = new octave_scalar (real (scalar)); return retval; } @@ -113,7 +113,7 @@ gripe_implicit_conversion ("complex scalar", "real scalar"); if (flag) - retval = ::real (scalar); + retval = std::real (scalar); else gripe_invalid_conversion ("complex scalar", "real scalar"); @@ -134,7 +134,7 @@ gripe_implicit_conversion ("complex scalar", "real matrix"); if (flag) - retval = Matrix (1, 1, ::real (scalar)); + retval = Matrix (1, 1, std::real (scalar)); else gripe_invalid_conversion ("complex scalar", "real matrix"); diff --git a/src/ov-cx-mat.cc b/src/ov-cx-mat.cc --- a/src/ov-cx-mat.cc +++ b/src/ov-cx-mat.cc @@ -64,7 +64,7 @@ Complex c = matrix (0, 0); if (imag (c) == 0.0) - retval = new octave_scalar (::real (c)); + retval = new octave_scalar (std::real (c)); else retval = new octave_complex (c); } @@ -182,7 +182,7 @@ { if ((rows () == 1 && columns () == 1) || (Vdo_fortran_indexing && rows () > 0 && columns () > 0)) - retval = ::real (matrix (0, 0)); + retval = std::real (matrix (0, 0)); else gripe_invalid_conversion ("complex matrix", "real scalar"); } diff --git a/src/pager.cc b/src/pager.cc --- a/src/pager.cc +++ b/src/pager.cc @@ -284,7 +284,7 @@ octave_pager_stream *octave_pager_stream::instance = 0; -octave_pager_stream::octave_pager_stream (void) : std::ostream (), pb (0) +octave_pager_stream::octave_pager_stream (void) : std::ostream (0), pb (0) { pb = new octave_pager_buf; rdbuf (pb); @@ -322,7 +322,7 @@ octave_diary_stream *octave_diary_stream::instance = 0; -octave_diary_stream::octave_diary_stream (void) : std::ostream (), db (0) +octave_diary_stream::octave_diary_stream (void) : std::ostream (0), db (0) { db = new octave_diary_buf; rdbuf (db); diff --git a/src/pr-output.cc b/src/pr-output.cc --- a/src/pr-output.cc +++ b/src/pr-output.cc @@ -184,7 +184,9 @@ if (pff.f.prec >= 0) os << std::setprecision (pff.f.prec); - std::ios::fmtflags oflags = os.flags (pff.f.fmt | pff.f.up | pff.f.sp); + std::ios::fmtflags oflags = + os.flags (static_cast + (pff.f.fmt | pff.f.up | pff.f.sp)); os << pff.val; diff --git a/src/procstream.h b/src/procstream.h --- a/src/procstream.h +++ b/src/procstream.h @@ -66,14 +66,15 @@ }; class -iprocstream : public procstreambase, public std::istream +iprocstream : public std::istream, public procstreambase +// iprocstream : public procstreambase, public std::istream { public: - iprocstream (void) : procstreambase () { } + iprocstream (void) : std::istream (0), procstreambase () { } iprocstream (const char *name, int mode = std::ios::in) - : procstreambase (name, mode) { } + : std::istream (0), procstreambase (name, mode) { } ~iprocstream (void) { } @@ -88,14 +89,15 @@ }; class -oprocstream : public procstreambase, public std::ostream +oprocstream : public std::ostream, public procstreambase +// oprocstream : public procstreambase, public std::ostream { public: - oprocstream (void) : procstreambase () { } + oprocstream (void) : std::ostream (0), procstreambase () { } oprocstream (const char *name, int mode = std::ios::out) - : procstreambase(name, mode) { } + : std::ostream (0), procstreambase(name, mode) { } ~oprocstream (void) { } @@ -110,14 +112,15 @@ }; class -procstream : public procstreambase, public std::iostream +procstream : public std::iostream, public procstreambase +// procstream : public procstreambase, public std::iostream { public: - procstream (void) : procstreambase () { } + procstream (void) : std::iostream (0), procstreambase () { } procstream (const char *name, int mode) - : procstreambase (name, mode) { } + : std::iostream (0), procstreambase (name, mode) { } ~procstream (void) { } diff --git a/src/pt-bp.h b/src/pt-bp.h --- a/src/pt-bp.h +++ b/src/pt-bp.h @@ -169,7 +169,7 @@ if (tree::break_next || is_breakpoint ()) \ { \ tree::break_next = false; \ - octave_stdout << "line: " << line () << endl; \ + octave_stdout << "line: " << line () << std::endl; \ do_keyboard (); \ } \ } \ diff --git a/src/utils.cc b/src/utils.cc --- a/src/utils.cc +++ b/src/utils.cc @@ -718,7 +718,7 @@ { int retval = -1; -#if defined (__GNUG__) +#if defined (__GNUG__) && !CXX_ISO_COMPLIANT_LIBRARY std::ostrstream buf;