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: CdeMills
Subject: Re: locale support patch for [fs]sscanf function
Date: Wed, 18 Jan 2012 13:23:44 -0800 (PST)

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.

Regards

Pascal

--
View this message in context: 
http://octave.1599824.n4.nabble.com/locale-support-patch-for-fs-sscanf-function-tp4303471p4308165.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.


reply via email to

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