cc712abf04
config: * acinclude.m4: Fix spelling error of "separate" as "seperate". gcc: * ChangeLog.2, c-decl.c, config/i386/i386.md, doc/gcc.texi, gcc.c, genmultilib, toplev.c: Fix spelling errors of "separate" as "seperate", and corresponding spelling errors of related words. gcc/ada: * 5oosinte.adb: Fix spelling error of "separate" as "seperate". gcc/testsuite: * gcc.c-torture/unsorted/unsorted.exp, lib/file-format.exp: Fix spelling errors of "separate" as "seperate". libffi: * src/x86/ffi.c: Fix spelling error of "separate" as "seperate". libjava: * defineclass.cc, java/awt/image/ColorModel.java, java/awt/image/SampleModel.java, java/lang/Package.java, java/security/cert/X509Extension.java: Fix spelling errors of "separate" as "seperate", and corresponding spelling errors of related words. libstdc++-v3: * docs/html/22_locale/locale.html, docs/html/faq/index.html: Fix spelling errors of "separate" as "seperate", and corresponding spelling errors of related words. * docs/html/faq/index.txt: Regenerate. From-SVN: r46063
145 lines
3.4 KiB
HTML
145 lines
3.4 KiB
HTML
<html>
|
|
<head>
|
|
<h1>
|
|
Notes on the locale implementation.
|
|
</h1>
|
|
</head>
|
|
<I>
|
|
prepared by Benjamin Kosnik (bkoz@redhat.com) on August 8, 2001
|
|
</I>
|
|
|
|
<p>
|
|
<h2>
|
|
1. Abstract Describes the basic locale object, including nested
|
|
classes id, facet, and the reference-counted implementation object,
|
|
class _Impl.
|
|
</h2>
|
|
<p>
|
|
</p>
|
|
|
|
<p>
|
|
<h2>
|
|
2. What the standard says
|
|
See Chapter 22 of the standard.
|
|
</h2>
|
|
|
|
|
|
<p>
|
|
<h2>
|
|
3. Problems with "C" locales : global locales, termination.
|
|
</h2>
|
|
|
|
<p>
|
|
The major problem is fitting an object-orientated and non-global locale
|
|
design ontop of POSIX and other relevant stanards, which include the
|
|
Single Unix (nee X/Open.)
|
|
|
|
Because POSIX falls down so completely, portibility is an issue.
|
|
<p>
|
|
|
|
<h2>
|
|
4. Design
|
|
</h2>
|
|
Class locale in non-templatized and has three distinct types nested
|
|
inside of it:
|
|
|
|
class facet
|
|
22.1.1.1.2 Class locale::facet
|
|
|
|
Facets actually implement locale functionality. For instance, a facet
|
|
called numpunct is the data objects that can be used to query for the
|
|
thousands separator is in the German locale.
|
|
|
|
Literally, a facet is strictly defined:
|
|
- containing
|
|
public:
|
|
static locale::id id;
|
|
|
|
- or derived from another facet
|
|
|
|
The only other thing of interest in this class is the memory
|
|
management of facets. Each constructor of a facet class takes a
|
|
std::size_t __refs argument: if __refs == 0, the facet is deleted when
|
|
no longer used. if __refs == 1, the facet is not destroyed, even when
|
|
it is no longer reference.
|
|
|
|
|
|
class id
|
|
Provides an index for looking up specific facets.
|
|
|
|
class _Impl
|
|
|
|
<p>
|
|
<h2>
|
|
5. Examples
|
|
</h2>
|
|
|
|
<pre>
|
|
typedef __locale_t locale;
|
|
</pre>
|
|
|
|
More information can be found in the following testcases:
|
|
<ul>
|
|
<li> testsuite/22_locale/ctype_char_members.cc
|
|
<li> testsuite/22_locale/ctype_wchar_t_members.cc
|
|
</ul>
|
|
|
|
<p>
|
|
<h2>
|
|
6. Unresolved Issues
|
|
</h2>
|
|
|
|
<ul>
|
|
<li> locale -a displays available locales on linux
|
|
|
|
<li> locale initialization: at what point does _S_classic,
|
|
_S_global get initialized? Can named locales assume this
|
|
initialization has already taken place?
|
|
|
|
<li> document how named locales error check when filling data
|
|
members. Ie, a fr_FR locale that doesn't have
|
|
numpunct::truename(): does it use "true"? Or is it a blank
|
|
string? What's the convention?
|
|
|
|
<li> explain how locale aliasing happens. When does "de_DE"
|
|
use "de" information? What is the rule for locales composed of
|
|
just an ISO language code (say, "de") and locales with both an
|
|
ISO language code and ISO country code (say, "de_DE").
|
|
|
|
<li> what should non-required facet instantiations do? If the
|
|
generic implemenation is provided, then how to end-users
|
|
provide specializations?
|
|
</ul>
|
|
|
|
<p>
|
|
<h2>
|
|
7. Acknowledgments
|
|
</h2>
|
|
|
|
<p>
|
|
<h2>
|
|
8. Bibliography / Referenced Documents
|
|
</h2>
|
|
|
|
Drepper, Ulrich, GNU libc (glibc) 2.2 manual. In particular, Chapters "6. Character Set Handling" and "7 Locales and Internationalization"
|
|
|
|
<p>
|
|
Drepper, Ulrich, Numerous, late-night email correspondence
|
|
|
|
<p>
|
|
ISO/IEC 14882:1998 Programming languages - C++
|
|
|
|
<p>
|
|
ISO/IEC 9899:1999 Programming languages - C
|
|
|
|
<p>
|
|
Langer, Angelika and Klaus Kreft, Standard C++ IOStreams and Locales, Advanced Programmer's Guide and Reference, Addison Wesley Longman, Inc. 2000
|
|
|
|
<p>
|
|
Stroustrup, Bjarne, Appendix D, The C++ Programming Language, Special Edition, Addison Wesley, Inc. 2000
|
|
|
|
<p>
|
|
System Interface Definitions, Issue 6 (IEEE Std. 1003.1-200x)
|
|
The Open Group/The Institute of Electrical and Electronics Engineers, Inc.
|
|
http://www.opennc.org/austin/docreg.html
|