Compile problem ov.cc of octave-3.1.51 on cygwin
Jaroslav Hajek
highegg at gmail.com
Tue Jul 29 15:24:26 CDT 2008
On Tue, Jul 29, 2008 at 10:10 AM, Tatsuro MATSUOKA
<tmacchant at yahoo.co.jp> wrote:
> Hello Jaroslav Hajek
>
> With your patch, ov.cc complie problem ov.cc is resolved for cygwin.
>
Good. John, can you apply this?
>
> -I/opt/octave/octave-3.1.51/include -I/usr/X11R6/include -I. -I.. -I../liboctave -I../src
> -I../libcruft/misc -DHAVE_CONFIG_H -mieee-fp -Wall -W -Wshadow -Wold-style-cast -g -O2 ov.cc -o ov.o
> ../liboctave/Array.h: In member function `T* Array<T>::coerce(const U*, int) [with U = octave_int32, T
> = octave_idx_type]':
> ../liboctave/Array.h:206: instantiated from `Array<T>::Array(const Array<U>&)
> [with U = octave_int32, T = octave_idx_type]'
> ov.cc:1361: instantiated from here
> ../liboctave/Array.h:179: error: conversion from `const octave_int<int32_t>' to
> `octave_idx_type' is ambiguous
> ../liboctave/oct-inttypes.h:324: note: candidates are: octave_int<T>::operator T() const [with T =
> int32_t]
> |
> V
> /opt/octave/gcc-3.4.4dw2/bin/g++ -c -I/opt/octave/gcc-3.4.4dw2/include -I/usr/include
> -I/opt/octave/octave-3.1.51/include -I. -I.. -I../liboctave -I../src -I../libcruft/misc
> -DHAVE_CONFIG_H -mieee-fp -Wall -W -Wshadow -Wold-style-cast -g -O2 ov.cc -o ov.o
> /opt/octave/gcc-3.4.4dw2/bin/g++ -c -I/opt/octave/gcc-3.4.4dw2/include -I/usr/include
> -I/opt/octave/octave-3.1.51/include -I. -I.. -I../liboctave -I../src -I../libcruft/misc
> -DHAVE_CONFIG_H -mieee-fp -Wall -W -Wshadow -Wold-style-cast -g -O2 ov-fcn.cc -o ov-fcn.o
>
>
> Regards
>
> Tatsuro
>
>
> ********************************************************************************************
> # HG changeset patch
> # User Jaroslav Hajek <highegg at gmail.com>
> # Date 1217229472 -7200
> # Node ID 00a8a3a41a3a11c0f90038549cab3eed79dee7cc
> # Parent dd5cc5016487f81a49b0f17a8127cdabc61a4c6c
> add explicit conversions from octave_int<T> to octave_idx_type and default int
>
> diff --git a/src/ChangeLog b/src/ChangeLog
> --- a/src/ChangeLog
> +++ b/src/ChangeLog
> @@ -1,3 +1,8 @@
> +2008-07-28 Jaroslav Hajek <highegg at gmail.com>
> +
> + * ov.cc (octave_value::int_vector_value): probe for every known integer type.
> + * ov.cc (convert_to_int_array): New static function.
> +
> 2008-07-24 John W. Eaton <jwe at octave.org>
>
> * load-path.h (load_path::dir_info::class_info): New struct.
> diff --git a/src/ov.cc b/src/ov.cc
> --- a/src/ov.cc
> +++ b/src/ov.cc
> @@ -1346,6 +1346,17 @@
> type_name (), "real vector"));
> }
>
> +template <class T>
> +static Array<int>
> +convert_to_int_array (const Array<octave_int<T> >& A)
> +{
> + Array<int> O (A.dims ());
> + octave_idx_type n = A.numel ();
> + for (octave_idx_type i = 0; i < n; i++)
> + O.xelem (i) = A.xelem (i).value ();
> + return O;
> +}
> +
> Array<int>
> octave_value::int_vector_value (bool force_string_conv, bool require_int,
> bool force_vector_conversion) const
> @@ -1354,14 +1365,24 @@
>
> if (is_integer_type ())
> {
> - // query for the first type that is wide enough
> -#if SIZEOF_INT == 2
> - retval = int16_array_value ();
> -#elif SIZEOF_INT == 4
> - retval = int32_array_value ();
> -#else
> - retval = int64_array_value ();
> -#endif
> + if (is_int32_type ())
> + retval = convert_to_int_array (int32_array_value ());
> + else if (is_int64_type ())
> + retval = convert_to_int_array (int64_array_value ());
> + else if (is_int16_type ())
> + retval = convert_to_int_array (int16_array_value ());
> + else if (is_int8_type ())
> + retval = convert_to_int_array (int8_array_value ());
> + else if (is_uint32_type ())
> + retval = convert_to_int_array (uint32_array_value ());
> + else if (is_uint64_type ())
> + retval = convert_to_int_array (uint64_array_value ());
> + else if (is_uint16_type ())
> + retval = convert_to_int_array (uint16_array_value ());
> + else if (is_uint8_type ())
> + retval = convert_to_int_array (uint8_array_value ());
> + else
> + retval = array_value (force_string_conv);
> }
> else
> {
>
> _____________________________________________
>> Bug-octave mailing list
>> Bug-octave at octave.org
>> https://www.cae.wisc.edu/mailman/listinfo/bug-octave
>>
>
>
> --------------------------------------
> Power up the Internet with Yahoo! Toolbar.
> http://pr.mail.yahoo.co.jp/toolbar/
>
--
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
More information about the Bug-octave
mailing list