This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

Re: revised proposal for GCC and non-Ascii source files


   Date: Tue, 29 Dec 1998 10:45:38 +0100
   From: Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de>

   >  3. For non-GNUC charsets, GCC uses the compilation host's iconv
   >     function to determine character boundaries.

   How do you do that?

Ooops.  I thought I could ask iconv to translate one byte, and if that
reports an incomplete character then two bytes, and so forth.  But I
just tried to write code to do this and you're correct, it doesn't
work (at least on Solaris 2.6) since e.g. for ISO-2022 iconv reports a
complete ESC character when given the single ESC byte at the start of
a shift sequence, which is not what is wanted here.

Hence we can't use iconv to find character boundaries; we must use
mbrlen.  Unfortunately, there is no way to go from the charset name to
the locale (which mbrlen needs).  Therefore, GCC must be given the
locale name rather than the charset name.  E.g. on Solaris 2.6 the
user will specify an option like `-ctype ja' instead of `-charset eucJP'.

Among other things, this means that the `GNUC charset' in my proposal
will have to become the `GNUC locale'.

   Also, how do you detect that you are in ASCII mode in a MBCS
   encoding?

I think we can use mbsinit for that.  However, to avoid further
embarrassment, I will write some code to test this idea before putting
out the next revision of my proposal.

If the host does not support mbrlen, mbsinit, and iconv, then GCC will
support only the GNUC locale.  For cross-compilation, we can provide a
way to substitute glibc mbrlen, mbsinit, and iconv if the host doesn't
have those functions but we need them to compile for the target.


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