Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Mar 2003 13:29:29 +1100
From:      Tim Robbins <tjr@FreeBSD.ORG>
To:        Jordan Hubbard <jkh@apple.com>
Cc:        freebsd-i18n@FreeBSD.ORG, Landon Fuller <landonf@apple.com>
Subject:   Re: Status of Citrus project merge work?
Message-ID:  <20030309132929.A92620@dilbert.robbins.dropbear.id.au>
In-Reply-To: <B3B106C8-51CD-11D7-B1FB-000393BB9222@apple.com>; from jkh@apple.com on Sat, Mar 08, 2003 at 05:23:15PM -0800
References:  <B3B106C8-51CD-11D7-B1FB-000393BB9222@apple.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Mar 08, 2003 at 05:23:15PM -0800, Jordan Hubbard wrote:

> Hi guys, 
> 
> I'm currently looking at the NetBSD libc support for wchar_t and 
> noticing that the support seems to be considerably more fully-fleshed 
> out there.

Please list the features that we are missing and that you would like to
see implemented -- FreeBSD 5.0 implements ISO C90 Amd 1 and ISO C99
wide character support with few exceptions (WCHAR_MIN/WCHAR_MAX macros,
wcstof(), wcstold()).

I was limited in what I could change in libc by ABI/API issues; I have
cleaned up the wide char. support significantly since the 5.x ABI
became slushy and will commit these changes when the RELENG_5 branch
is created. I recently put these changes into the Perforce repo so that
people could browse them, comment on them, etc.

The root of the tree is here:
http://perforce.freebsd.org/dtb.cgi?FSPC=depot/user/tjr/wchar&HIDEDEL=NO

The interesting bits are here:
http://perforce.freebsd.org/dtb.cgi?FSPC=depot/user/tjr/wchar/src/lib/libc/locale&HIDEDEL=NO

A brief list of what's been changed, and what changes I have in mind for
FreeBSD 6 is here:
http://perforce.freebsd.org/fv.cgi?FSPC=//depot/user/tjr/wchar/README&REV=2

FWIW, here is a list of missing features or bugs in the current NetBSD
implementation to make my arguments about the completeness and correctness
of the FreeBSD implementation credible:
 - wcstod() does not handle Infinity or NaN, wcstof() and wcstold() are
   missing.
 - wcstoll(), wcstoull(), wcstoimax(), wcstoumax() are not implemented.
 - wcsftime() is not implemented.
 - wcswidth() does not handle non-printing characters correctly.
 - wcschr() does not handle searching for a null character correctly.
 - wcsrchr() makes two passes over the string
 - wcsncpy() contains an off-by-one buffer overflow and does not pad
   the destination string with null wide characters.
 - wprintf(), vwprintf(), fwprintf(), vfwprintf(), swprintf(), vswprintf()
   are not implemented.
 - wscanf(), vwscanf(), fwscanf(), vfwscanf(), swscanf(), vswscanf()
   are not implemented.

The following functions were added to NetBSD in the past week, but
have been in FreeBSD 5 for 6 months:
 - wctype(), iswctype(), wctrans(), towctrans(), wcscoll(), wcsxfrm(),
   wcstok(), fgetws(), fputws().

> There is a citrus/ subdirectory in src/lib/libc which 
> FreeBSD does not have and it also appears that there are quite a few 
> more of the standard ISO/IEC 9899:1999 functions defined there.

Please list them. I believe that all the ISO/IEC 9899:1999 functions
have been implemented in FreeBSD 5.0 except wcstof() and wcstold(), which
will appear in FreeBSD 5.1.

> Is there work ongoing to sync up FreeBSD's libc with NetBSD's libc in this 
> respect (or from the original Citrus sources, for that matter)?

No. Many people tried to do it, gave up or got sick of it, and haven't
been heard from since. I stepped in and implemented the missing functions
in August and September 2002. I grabbed some pieces from NetBSD that were
easy to merge in, but rewrote the bulk of it from scratch because it turned
out easier that way.

> I've looked at http://citrus.bsdclub.org/ and it certainly appears like 
> there's some sort of effort underway to do this work for all the BSDs, 
> but I haven't been following the matter closely enough to know how 
> active the FreeBSD branch of this work has been. 

It looks to me like they stopped working on FreeBSD and decided to
concentrate their efforts on NetBSD.

> I have a reason for asking, of course, and that's because Apple is 
> currently reviewing what it would take to bring this work into our own 
> libc for Mac OS X, a libc which is substantially based on FreeBSD's at 
> this point and something I would rather not have gratuitous divergence 
> from.  If there's no work currently underway to bring this support in 
> from NetBSD, it's conceivable that I could have some Apple engineers 
> work on the merge and bring FreeBSD's up to date before bringing that, 
> in turn, into Mac OS X but I don't want to step on any toes, either. 

I believe that FreeBSD 5.0 implements the C99 wide character functionality
as well as any other implementation does for encodings that are not
state-dependent: Big5, SJIS, UTF8, and EUC are not state-dependent;
ISO2022, UTF-7, HZ, ZW are, and will have to wait until FreeBSD 6.0 to be
implemented. (UTF-16 and UTF-32 are partly state-dependent because of the
Unicode byte-order marker (BOM) that is at the start of the file, and
I haven't decided how to implement these yet).

I'm happy to work with Apple to implement any missing functionality etc.
Let me know what you think is wrong with the implementation in 5.0 and
I will fix it for 5.1 if it doesn't break the 5.x API, or I will fix it
in my Perforce tree then merge it into 6.0-current when RELENG_5 branches.


Tim

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-i18n" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030309132929.A92620>