octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: locale support patch for [fs]sscanf function


From: Carnë Draug
Subject: Re: locale support patch for [fs]sscanf function
Date: Tue, 31 Jan 2012 18:50:41 +0000

On 18 January 2012 22:51, Jordi Gutiérrez Hermoso <address@hidden> wrote:
> On 18 January 2012 16:23, CdeMills <address@hidden> wrote:
>>
>> Jordi Gutiérrez Hermoso-2 wrote
>>>
>>>
>>> Thanks.
>>>
>>> Would it be too troublesome to generate a commit message?
>>>
>>> Something like what Ben wrote here, for example:
>>>
>>>     http://hg.savannah.gnu.org/hgweb/octave/rev/df695e37d404
>>>
>>> - Jordi G. H.
>>>
>> Here you are:
>>
>> Locale support implementation in [fs]scanf functions, i.e. the ability to
>> scan "1,2" and get 1.2 as results under french locale, where the decimal
>> separator is ','. This uses the C++ standard library locale approach: the
>> interpretation of some stream locale is modified using the "imbue" function.
>> In case of fscanf, the previous locale is restored after each call. The
>> functions interface is not modified. When the last argument is a string, its
>> value is used as the new locale setting.
>>
>> *src/oct-stream.h: Class octave_base_stream: add a virtual imbue function,
>> which merely ignore its argument. Class octave_stream: add a real
>> implementation, which is a proxy to std::[io]stream.imbue ().
>> *src/file_io.cc: Function fscanf: when the last argument is a string, save
>> the actual locale value and set a new value from this string. Generate a
>> warning in case the requested locale is not supported. Revert to previous
>> locale if OK, or to standard locale in case of problem. Function scanf:
>> Likewise, except the stream is generated on-the-fly, there is no need to
>> restore its locale value. Added a test case. Updated the doc for both
>> functions.
>
> Thanks again. I've pushed your patch:
>
>    http://hg.savannah.gnu.org/hgweb/octave/rev/238e499c5fea
>
> Note that your test on my system fails because I don't have a fr_FR
> locale generated. I don't know how to test this function in a
> system-independent way. I'm thinking just getting rid of that test.
> What do you propose?

I believe this changeset is causing several warnings when compiling
octave. They are all of the kind

In file included from ../../development/octave/src/ov-base-int.cc:42,
                 from ../../development/octave/src/ov-int16.cc:48:
../../development/octave/src/oct-stream.h:377: warning: unused parameter ‘loc’

In file included from ../../development/octave/src/ov-re-sparse.h:37,
                 from ../../development/octave/src/DLD-FUNCTIONS/luinc.cc:37:
../../development/octave/src/oct-stream.h:377: warning: unused parameter ‘loc’

In file included from ../../development/octave/src/ov-cx-mat.h:37,
                 from ../../development/octave/src/DLD-FUNCTIONS/max.cc:40:
../../development/octave/src/oct-stream.h:377: warning: unused parameter ‘loc’

Carnë


reply via email to

[Prev in Thread] Current Thread [Next in Thread]