Compile problem ov.cc of octave-3.1.51 on cygwin
Tatsuro MATSUOKA
tmacchant at yahoo.co.jp
Wed Jul 30 02:49:09 CDT 2008
Hello
I am now going to build octave-3.1.51 on the cygwin with the new patch.
I cannot complete to build octave from the following the reason.
http://www.cae.wisc.edu/pipermail/bug-octave/2008-July/006413.html
Can anyone tell me solve the problem or temprary avoiding compiling them
I tried ./configure --without-fltk, but nothing ocurred.
Regards
Tatsuro
--- Jaroslav Hajek <highegg at gmail.com> wrote:
> On Tue, Jul 29, 2008 at 10:56 PM, John W. Eaton <jwe at bevo.che.wisc.edu> wrote:
> > On 29-Jul-2008, Jaroslav Hajek wrote:
> >
> > | 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?
> >
> > Did you see my earlier reply?
> >
> > https://www.cae.wisc.edu/pipermail/bug-octave/2008-July/006394.html
> >
> > I asked whether there should maybe be at least a warning for values
> > that are out of range.
> >
> > jwe
> >
>
> Sorry, I attributed the question to my suggestion that octave_int<T>
> should be convertible to default int. The attached patch adds a
> safe_conversion method to octave_int<T> and uses it in
> convert_to_int_array. Is this what you meant?
> However, caling, for instance, int8_array_value () on an octave_value
> object containing a 32-bit int array does not gripe either. Perhaps we
> could make the octave_int<T>:: octave_int(const octave_int<U>&)
> constructor gripe if data need to be truncated.
> In this way, the octave_int<> types would act as "conversion-safe
> integers" contrary to the normal, unsafe integers. I think, however,
> that a mechanism to avoid multiple gripes from loops would be needed
> in such case.
>
> --
> RNDr. Jaroslav Hajek
> computing expert
> Aeronautical Research and Test Institute (VZLU)
> Prague, Czech Republic
> url: www.highegg.matfyz.cz
> > # HG changeset patch
> # User Jaroslav Hajek <highegg at gmail.com>
> # Date 1217398327 -7200
> # Node ID 17373754168aca71345fbd9d14cc03efe626b773
> # Parent dd5cc5016487f81a49b0f17a8127cdabc61a4c6c
> make octave_value::int_vector_value avoid multiple conversions for integer values.
>
> diff --git a/liboctave/oct-inttypes.h b/liboctave/oct-inttypes.h
> --- a/liboctave/oct-inttypes.h
> +++ b/liboctave/oct-inttypes.h
> @@ -328,6 +328,13 @@
> operator double (void) const { return double_value (); }
>
> operator float (void) const { return float_value (); }
> +
> + template <class U>
> + bool safe_conversion (U& target)
> + {
> + target = OCTAVE_INT_FIT_TO_RANGE (value (), U);
> + return (value () == target);
> + }
>
> octave_int<T>& operator += (const octave_int<T>& x)
> {
> 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,26 @@
> 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 ();
> + bool warned = false;
> + for (octave_idx_type i = 0; i < n; i++)
> + {
> + if (! A.xelem (i).safe_conversion (O.xelem (i)) && warned)
> + {
> + warned = true;
> + warning ("int_vector_value: value truncated to fit to range");
> + }
> + }
> +
> +
> + return O;
> +}
> +
> Array<int>
> octave_value::int_vector_value (bool force_string_conv, bool require_int,
> bool force_vector_conversion) const
> @@ -1354,14 +1374,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
> {
>
--------------------------------------
Power up the Internet with Yahoo! Toolbar.
http://pr.mail.yahoo.co.jp/toolbar/
More information about the Bug-octave
mailing list