1 <?xml version=
"1.0" encoding=
"ISO-8859-1"?>
3 PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
4 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en" lang=
"en">
8 <meta http-equiv=
"Content-Type" content=
"text/html; charset=iso-8859-1" />
9 <meta name=
"AUTHOR" content=
"bkoz@redhat.com (Benjamin Kosnik)" />
10 <meta name=
"KEYWORDS" content=
"HOWTO, libstdc++, GCC, g++, libg++, STL" />
11 <meta name=
"DESCRIPTION" content=
"Notes on the ctype implementation." />
12 <title>Notes on the ctype implementation.
</title>
13 <link rel=
"StyleSheet" href=
"../lib3styles.css" />
17 Notes on the ctype implementation.
20 prepared by Benjamin Kosnik (bkoz@redhat.com) on August
30,
2000
31 2. What the standard says
36 3. Problems with
"C
" ctype : global locales, termination.
40 For the required specialization codecvt
<wchar_t, char, mbstate_t
> ,
41 conversions are made between the internal character set (always UCS4
42 on GNU/Linux) and whatever the currently selected locale for the
43 LC_CTYPE category implements.
49 The two required specializations are implemented as follows:
57 This is simple specialization. Implementing this was a piece of cake.
66 This specialization, by specifying all the template parameters, pretty
67 much ties the hands of implementors. As such, the implementation is
68 straightforward, involving mcsrtombs for the conversions between char
69 to wchar_t and wcsrtombs for conversions between wchar_t and char.
73 Neither of these two required specializations deals with Unicode
74 characters. As such, libstdc++-v3 implements
82 typedef ctype
<char
> cctype;
85 More information can be found in the following testcases:
87 <li> testsuite/
22_locale/ctype_char_members.cc
</li>
88 <li> testsuite/
22_locale/ctype_wchar_t_members.cc
</li>
96 <li> how to deal with the global locale issue?
</li>
98 <li> how to deal with different types than char, wchar_t?
</li>
100 <li> codecvt/ctype overlap: narrow/widen
</li>
102 <li> mask typedef in codecvt_base, argument types in codecvt.
103 what is know about this type?
</li>
105 <li> why mask* argument in codecvt?
</li>
107 <li> can this be made (more) generic? is there a simple way to
108 straighten out the configure-time mess that is a by-product of
111 <li> get the ctype
<wchar_t
>::mask stuff under control. Need to
112 make some kind of static table, and not do lookup evertime
113 somebody hits the do_is... functions. Too bad we can't just
114 redefine mask for ctype
<wchar_t
> </li>
116 <li> rename abstract base class. See if just smash-overriding
117 is a better approach. Clarify, add sanity to naming.
</li>
125 Ulrich Drepper for patient answering of late-night questions, skeletal
126 examples, and C language expertise.
129 8. Bibliography / Referenced Documents
132 Drepper, Ulrich, GNU libc (glibc)
2.2 manual. In particular, Chapters
"6. Character Set Handling
" and
"7 Locales and Internationalization
"
135 Drepper, Ulrich, Numerous, late-night email correspondence
139 ISO/IEC
14882:
1998 Programming languages - C++
143 ISO/IEC
9899:
1999 Programming languages - C
147 Langer, Angelika and Klaus Kreft, Standard C++ IOStreams and Locales, Advanced Programmer's Guide and Reference, Addison Wesley Longman, Inc.
2000
151 Stroustrup, Bjarne, Appendix D, The C++ Programming Language, Special Edition, Addison Wesley, Inc.
2000
155 System Interface Definitions, Issue
6 (IEEE Std.
1003.1-
200x)
156 The Open Group/The Institute of Electrical and Electronics Engineers, Inc.
157 http://www.opennc.org/austin/docreg.html