GB18030 (was: Re: charset changes)

Corinna Vinschen
Tue Mar 30 09:54:00 GMT 2010

On Mar 29 19:19, Andy Koppe wrote:
> Corinna Vinschen:
> > Anyway, feel free to send a patch to change the charset name parameter
> > to an array index parameter.
> Attached is a newlib patch for that. The core of it is the removal of
> the calls to __cp_index and __iso_8859_index from the singlebyte
> charset conversion functions and adding a __charset_index global
> variable, but quite a lot of function definitions and calls needed to
> be changed accordingly to take an index argument instead of a string.

Two problems:

- The __monetary_load_locale function and friends, as well as the
  subsequently calld Cygwin functions should still get the charset
  name.  In a later incarnation(*) they will store the charset names
  in the locale information.

- The usage of the __charset_index variable should be changed to a call
  to a function __locale_charset_idx (), analog to the __locale_charset ()
  function.  The reason is that, in the long run, we will implement
  the _l family of functions plus the newlocale/uselocale stuff from
  POSIX-1.2008.  The global information will be replaced by locale_t
  structures, basically.  For that we need access wrapper functions which
  allow to use the right locale_t for the current thread.

> Also attached is a description of the corresponding winsup changes
> that are needed. I'll write a ChangeLog entry for the newlib bit if we
> decide to go ahead with this.

Please go ahead and send the tweaked patch to the newlib list, plus
a ChangeLog.  The change should really be discussed there.

> >> As this will impact
> >> code that's ifdeffed out for Cygwin, can you recommend a
> >> multibyte-enabled platform to compile (and test?) that on?
> >
> > In how far?  The parameter is entirely unused outside of the CP and ISO
> > stuff, and CP and ISO are used on Cygwin as well.
> I was concerned I might forget to change a prototype or call
> somewhere, but actually Cygwin does use all the functions in question,
> I think.

Yes, except for __jis_mbtowc/__jis_wctomb.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

More information about the Cygwin-developers mailing list