Mercurial > hg > octave-lyh
changeset 8319:c374691576f6
Fix for MSVC compilation
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Wed, 12 Nov 2008 21:36:39 +0000 |
parents | cc29ef9a2d84 |
children | 9a05d76e5291 |
files | liboctave/ChangeLog liboctave/MArray-C.cc liboctave/MArray-d.cc liboctave/MArray-f.cc liboctave/MArray-fC.cc liboctave/idx-vector.cc liboctave/idx-vector.h liboctave/oct-inttypes.cc liboctave/oct-inttypes.h liboctave/oct-norm.cc liboctave/oct-norm.h src/ChangeLog src/DLD-FUNCTIONS/getrusage.cc src/TEMPLATE-INST/Array-os.cc |
diffstat | 14 files changed, 58 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,22 @@ +2008-11-12 Michael Goffioul <michael.goffioul@gmail.com> + + * MArray-C.cc, MArray-d.cc, MArray-f.cc, MArray-fC.cc: Declare + MArray<T>::norm specialization before implicit MArray<T> implicit + instantiation. + * idx-vector.h (class idx_vector::idx_base_rep, class + idx_vector::idx_range_rep, class idx_vector::idx_colon_rep, class + idx_vector::idx_scalar_rep, class idx_vector::idx_vector_rep): Add + OCTAVE_API tag. + * idx-vector.cc (idx_vector::idx_scalar_rep::idx_scalar_rep(T), + idx_vector::idx_vector_rep::idx_vector_rep(const Array<T>&)): Ditto. + * oct-inttypes.cc (octave_int<T>::type_name): Ditto. + * oct-inttypes.cc (powf(const octave_int<T>&,const float&)): Cast 'b' + to double. + * oct-inttypes.h: Undefine min/max. + * oct-norm.h (xnorm, xfrobnorm, xcolnorms, xrownorms): Add OCTAVE_API + tag. + * oct-norm.cc (xnorm, xfrobnorm, xcolnorms, xrownorms): Ditto. + 2008-11-12 Jaroslav Hajek <highegg@gmail.com> * DiagArray2.h (DiagArray2<T>::maybe_delete_elements): Remove
--- a/liboctave/MArray-C.cc +++ b/liboctave/MArray-C.cc @@ -31,6 +31,7 @@ #include "MArray.h" #include "MArray.cc" +template <> OCTAVE_API double MArray<Complex>::norm (double p) const; #include "CColVector.h" #include "oct-norm.h"
--- a/liboctave/MArray-d.cc +++ b/liboctave/MArray-d.cc @@ -28,6 +28,7 @@ #include "MArray.h" #include "MArray.cc" +template <> OCTAVE_API double MArray<double>::norm (double p) const; #include "dColVector.h" #include "oct-norm.h"
--- a/liboctave/MArray-f.cc +++ b/liboctave/MArray-f.cc @@ -28,6 +28,7 @@ #include "MArray.h" #include "MArray.cc" +template <> OCTAVE_API float MArray<float>::norm (float p) const; #include "fColVector.h" #include "oct-norm.h"
--- a/liboctave/MArray-fC.cc +++ b/liboctave/MArray-fC.cc @@ -31,6 +31,7 @@ #include "MArray.h" #include "MArray.cc" +template <> OCTAVE_API float MArray<FloatComplex>::norm (float p) const; #include "fCColVector.h" #include "oct-norm.h"
--- a/liboctave/idx-vector.cc +++ b/liboctave/idx-vector.cc @@ -551,8 +551,8 @@ // Instantiate the octave_int constructors we want. #define INSTANTIATE_SCALAR_VECTOR_REP_CONST(T) \ - template idx_vector::idx_scalar_rep::idx_scalar_rep (T); \ - template idx_vector::idx_vector_rep::idx_vector_rep (const Array<T>&); + template OCTAVE_API idx_vector::idx_scalar_rep::idx_scalar_rep (T); \ + template OCTAVE_API idx_vector::idx_vector_rep::idx_vector_rep (const Array<T>&); INSTANTIATE_SCALAR_VECTOR_REP_CONST (float) INSTANTIATE_SCALAR_VECTOR_REP_CONST (double)
--- a/liboctave/idx-vector.h +++ b/liboctave/idx-vector.h @@ -59,7 +59,7 @@ private: - class idx_base_rep + class OCTAVE_API idx_base_rep { public: idx_base_rep (void) : count (1), err (false) { } @@ -106,7 +106,7 @@ }; // The magic colon index. - class idx_colon_rep : public idx_base_rep + class OCTAVE_API idx_colon_rep : public idx_base_rep { public: idx_colon_rep (void) { } @@ -144,7 +144,7 @@ enum direct { DIRECT }; // The integer range index. - class idx_range_rep : public idx_base_rep + class OCTAVE_API idx_range_rep : public idx_base_rep { public: idx_range_rep (octave_idx_type _start, octave_idx_type _len, @@ -197,7 +197,7 @@ }; // The integer scalar index. - class idx_scalar_rep : public idx_base_rep + class OCTAVE_API idx_scalar_rep : public idx_base_rep { public: idx_scalar_rep (octave_idx_type i, direct) @@ -248,7 +248,7 @@ }; // The integer vector index. - class idx_vector_rep : public idx_base_rep + class OCTAVE_API idx_vector_rep : public idx_base_rep { public: // Direct constructor.
--- a/liboctave/oct-inttypes.cc +++ b/liboctave/oct-inttypes.cc @@ -38,7 +38,7 @@ // define type names. #define DECLARE_OCTAVE_INT_TYPENAME(TYPE, TYPENAME) \ template <> \ - const char * \ + OCTAVE_API const char * \ octave_int<TYPE>::type_name () { return TYPENAME; } DECLARE_OCTAVE_INT_TYPENAME (int8_t, "int8") @@ -592,7 +592,7 @@ { return ((b >= 0 && b < std::numeric_limits<T>::digits && b == xround (b)) ? pow (a, octave_int<T> (static_cast<T> (b))) - : octave_int<T> (pow (a.double_value (), b))); + : octave_int<T> (pow (a.double_value (), static_cast<double> (b)))); } #define INSTANTIATE_INTTYPE(T) \
--- a/liboctave/oct-inttypes.h +++ b/liboctave/oct-inttypes.h @@ -39,6 +39,12 @@ inline long double xround (long double x) { return roundl (x); } #endif +// Undefine min/max if needed (this may happen under Windows) +#ifdef min +#undef min +#undef max +#endif + // FIXME: we define this by our own because some compilers, such as MSVC, // do not provide std::abs (int64_t) and std::abs (uint64_t). In the future, // it should go away in favor of std::abs.
--- a/liboctave/oct-norm.cc +++ b/liboctave/oct-norm.cc @@ -508,13 +508,13 @@ // and finally, here's what we've promised in the header file #define DEFINE_XNORM_FUNCS(PREFIX, RTYPE) \ - RTYPE xnorm (const PREFIX##ColumnVector& x, RTYPE p) \ + OCTAVE_API RTYPE xnorm (const PREFIX##ColumnVector& x, RTYPE p) \ { return vector_norm (x, p); } \ - RTYPE xnorm (const PREFIX##RowVector& x, RTYPE p) \ + OCTAVE_API RTYPE xnorm (const PREFIX##RowVector& x, RTYPE p) \ { return vector_norm (x, p); } \ - RTYPE xnorm (const PREFIX##Matrix& x, RTYPE p) \ + OCTAVE_API RTYPE xnorm (const PREFIX##Matrix& x, RTYPE p) \ { return matrix_norm (x, p, PREFIX##Matrix (), PREFIX##SVD ()); } \ - RTYPE xfrobnorm (const PREFIX##Matrix& x) \ + OCTAVE_API RTYPE xfrobnorm (const PREFIX##Matrix& x) \ { return vector_norm (x, static_cast<RTYPE> (2)); } DEFINE_XNORM_FUNCS(, double) @@ -534,9 +534,9 @@ } #define DEFINE_XNORM_SPARSE_FUNCS(PREFIX, RTYPE) \ - RTYPE xnorm (const Sparse##PREFIX##Matrix& x, RTYPE p) \ + OCTAVE_API RTYPE xnorm (const Sparse##PREFIX##Matrix& x, RTYPE p) \ { return matrix_norm (x, p, PREFIX##Matrix ()); } \ - RTYPE xfrobnorm (const Sparse##PREFIX##Matrix& x) \ + OCTAVE_API RTYPE xfrobnorm (const Sparse##PREFIX##Matrix& x) \ { \ RTYPE res; \ array_norm_2 (x.data (), x.nnz (), res); \ @@ -547,9 +547,9 @@ DEFINE_XNORM_SPARSE_FUNCS(Complex, double) #define DEFINE_COLROW_NORM_FUNCS(PREFIX, RPREFIX, RTYPE) \ - extern RPREFIX##RowVector xcolnorms (const PREFIX##Matrix& m, RTYPE p) \ + extern OCTAVE_API RPREFIX##RowVector xcolnorms (const PREFIX##Matrix& m, RTYPE p) \ { return column_norms (m, p); } \ - extern RPREFIX##ColumnVector xrownorms (const PREFIX##Matrix& m, RTYPE p) \ + extern OCTAVE_API RPREFIX##ColumnVector xrownorms (const PREFIX##Matrix& m, RTYPE p) \ { return row_norms (m, p); } \ DEFINE_COLROW_NORM_FUNCS(, , double)
--- a/liboctave/oct-norm.h +++ b/liboctave/oct-norm.h @@ -32,10 +32,10 @@ class PREFIX##ColumnVector; \ class PREFIX##RowVector; \ \ - extern RTYPE xnorm (const PREFIX##ColumnVector&, RTYPE p = 2); \ - extern RTYPE xnorm (const PREFIX##RowVector&, RTYPE p = 2); \ - extern RTYPE xnorm (const PREFIX##Matrix&, RTYPE p = 2); \ - extern RTYPE xfrobnorm (const PREFIX##Matrix&); + extern OCTAVE_API RTYPE xnorm (const PREFIX##ColumnVector&, RTYPE p = 2); \ + extern OCTAVE_API RTYPE xnorm (const PREFIX##RowVector&, RTYPE p = 2); \ + extern OCTAVE_API RTYPE xnorm (const PREFIX##Matrix&, RTYPE p = 2); \ + extern OCTAVE_API RTYPE xfrobnorm (const PREFIX##Matrix&); DECLARE_XNORM_FUNCS(, double) DECLARE_XNORM_FUNCS(Complex, double) @@ -46,8 +46,8 @@ DECLARE_XNORM_FUNCS(SparseComplex, double) #define DECLARE_COLROW_NORM_FUNCS(PREFIX, RPREFIX, RTYPE) \ - extern RPREFIX##RowVector xcolnorms (const PREFIX##Matrix&, RTYPE p = 2); \ - extern RPREFIX##ColumnVector xrownorms (const PREFIX##Matrix&, RTYPE p = 2); \ + extern OCTAVE_API RPREFIX##RowVector xcolnorms (const PREFIX##Matrix&, RTYPE p = 2); \ + extern OCTAVE_API RPREFIX##ColumnVector xrownorms (const PREFIX##Matrix&, RTYPE p = 2); \ DECLARE_COLROW_NORM_FUNCS(, , double) DECLARE_COLROW_NORM_FUNCS(Complex, , double)
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -3,6 +3,9 @@ * dirfcn.cc (Ffilesep): Make it return all file separators when 'all' is given as argument. + * DLD-FUNCTIONS/getrusage.cc: Undefine min/max. + * TEMPLATE-INST/Array-os.cc: Declare Array<bool> as extern template. + 2008-11-12 David Bateman <dbateman@free.fr> * OPERATORS/op-cell.cc (op_catop_matrix_cell): Cast args in the correct