This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH/RFA] Revamp wctomb/mbtowc conversion, add more charset support


On Mar 23 13:51, Jeff Johnston wrote:
> Corinna Vinschen wrote:
>> Would it generally be an appreciated idea to add correctly working
>> support for all supported singlebyte charsets to the singlebyte ctype
>> functions, like isalpha, ispunct, etc?  I'm willing to do that.  In
>> theory I would just add new ctype arrays and resetting the __ctype_ptr
>> to the new array in setlocale().
>>
>>   
> As long as the embedded platforms are protected from dragging in stuff  
> they aren't using,
> certainly.

I''m still wondering about how to do that, though.

The simplest method is to have the 32 or 33 ctype tables and just change
__ctype_ptr to point to the right one.  This has an advantage, speed,
and a disadvantage, size.  This method also doesn't work for Cygwin.

As I explained in another mail, I created a Cygwin-specific method which
works like this:

I have 32 or 33 tables, but they are not full tables, rather they only
consist of the upper 128 bytes of the charset, char values 0x80-0xff.
When the charset gets switched, the __set_ctype function copies these
tables over into the exising ctype_b array.  This has one disadvantage,
speed, and two advantages.  First, size.  The tables have only 128 bytes
instead of 384 bytes each.  Second, it's backward compatible with
applications built earlier.  Since the isdigit/isprint/isXXX macros in
ctype.h always refer to _ctype_, they would never see a change.

So, what method would you prefer, having big arrays and just changing
__ctype_ptr, or having smaller arrays and copying over the data?



Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]