DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T X

⟦4a7684485⟧ TextFile

    Length: 6742 (0x1a56)
    Types: TextFile
    Names: »XOSLocale.3«

Derivation

└─⟦276d19d6e⟧ Bits:30007243 EUUGD5_I: X11R5
    └─⟦4856bf7e7⟧ »./mit-4/mit-4.00« 
        └─⟦635ff9e7e⟧ 
            └─⟦this⟧ »mit/doc/I18N/Xsi/Xlc/XOSLocale.3« 

TextFile

.\" $Header: XOSLocale.3,v 1.3 91/02/04 09:41:16 morisaki Exp $
.\" $Date: 91/02/04 09:41:16 $
.\" Copyright 1990, 1991 by OMRON Corporation.
.\" Copyright 1991 by the Massachusetts Institute of Technology.
.TH XLocale 3X "" "December, 1990"
.(l           
                  Specification of X Locale


   This spec defines all functions to access locale database.
.)l
.sp 3
.PP
int
.br
_Xmbtype()
.PP
The _Xmbtype() returns the codeset type of the current locale. Two
types will be returned:
.IP "" "    "
CDS_STATELESS -- state-independent codeset
.br
CDS_STATEFUL  -- state-dependent codeset
.PP
If application never calls the setting locale, the function returns -1,
no locale has been set.  With the _Xmbtype you can check if there is
locale.
.PP
int
.br
_Xmbcsnum()
.PP
The _Xmbcsnum returns the number of charsets of the current locale.
.PP
int
.br
_Xmbcsid(mbstr)
.br
unsigned char *mbstr;
.PP
The function returns the charset id "CSi" of the multibyte character
encoded in the current locale.  The multibyte character is stored in
the null-terminated string "mbstr".  The charset id is ordered from
positive number 0.  The CSi is defined to a constant "i", e.g, CS1
is constant 1.
.PP
The _Xmbcsid returns constant ND 
for any error of the multibyte character which maybe wrong code, or
maybe terminated unexpectly.
.PP
For state-dependent codeset, _Xmbcsid keeps the track of the current
locking shift-state. In other word only this function _Xmbcsid would 
change the current state.   When the mbstr is passed as a NULL pointer,
the _Xmbcsid sets the initial state.
.IP "" "    "
_Xmbcsid(NULL)
.PP
int
.br
_Xmblen(csid)
.br
int csid;
.PP
The _Xmblen returns the number of bytes of this charset "csid" encoding. 
The returned value is zero for wrong charset id.
.PP
char *
.br
_Xmbdsg(csid)
.br
int  csid;
.PP
This function is for state-dependent codeset only.
The _Xmbdsg returns the designation of this charset. The NULL
returned is for wrong csid. The returned string is owned by
the locale, do not change or free it.
.PP
int 
.br
_Xmbdlen(mbstr, csid)
.br
unsigned char *mbstr;
.br
int            csid;
.PP
This function is for state-dependent codeset only.  If the mbstr
contains a complete designation sequence, the _Xmbdsg returns
the length of the sequence; otherwise returns zero.  The mbstr
is null-terminated string.
.PP
int
.br
_Xmbfsnum()
.PP
The _Xmbfsnum returns the number of font charsets of the current locale.
This number is different from _Xmbcsnum().
.PP
char *
.br
_Xmbfsname(csid)
.br
int csid;
.PP
The _Xmbfsname returns the charset name with this charse id "csid".
The name is form of CharsetRegistry-CharsetEncoding registered by X
in the definition of XLFD.  The NULL returned is for wrong csid.
The returned string is owned by the current locale, so do not
change and free this data.
.PP
int
.br
_Xmbfslen(csid)
.br
int csid;
.PP
The _Xmbfslen returns the number of bytes of this charset "csid" of
font encoding. The zero returned is for wrong csid.
.PP
wchar 
.br
_Xmbfswf(csid)
.br
int  csid;
.PP
The _Xmbfswf returns the woffset of the font charset id.
This woffset is for the 4-byte wchar encoding. Refer to CTAndWC(3)
for WC definition.  The negative value -1 returned is for wrong csid.
.PP
char *
.br
_Xmbfsdsg(csid)
.br
int  csid;
.PP
The _Xmbfsdsg returns the designation sequence, i.e., escape sequence
of font charset which is registered by X in the "Compound Text Encoding,
Version 1.1".  The returned value is owned by the locale, do not free
or change it.  The NULL returned is for wrong csid.
.PP
int
.br
_Xmbctocsc(mbstr, csid, cscode)
.br
unsigned char *mbstr;
.br
int            csid;
.br
unsigned int  *cscode;
.PP
The _Xmbctocsc converts codepoint of multibyte character
to codepoing of charset. 
The csid is it's charset id.  The converted code
is stored in the cscode.
If wrong codepoint, use the first codepoint of csid as default,
and return negative value. if correct, return 0 meaning Success.
The _Xmbctocsc always supposes that the mbstr points to a codepoint,
not shift-state sequence if codeset is state-dependent. The caller
should note this, otherwise the _Xmbctocsc treats it as wrong codepoint.
.PP
int
.br
_Xcsctombc(cscode, csid, code)
.br
unsigned int  cscode;
.br
int           csid;
.br
unsigned int *code;
.PP
The _Xcsctombc does the reverse conversion of _Xmbctocsc.
.PP
char *
.br
_Xsetlocale(locale_category, locale_name)
.br
int   locale_category;
.br
char *locale_name;
.PP
.PP
The _Xsetlocale sets the current locale for the specified category.
If the operation was successful, _Xsetlocale returns a
pointer to the current locale name for the category
If the category is invalid or the locale is not
supported in the system, _Xsetlocale returns a NULL
pointer.
The returned locale name is owned by the system locale, do not change
or free it.
.PP
The category is defined to one of the following:
.IP "" "        "
XLC_CODESET
.br
XLC_FONTSET
.br
XLC_INPUTMETHOD
.br
XLC_ALL
.PP
The XLC_ALL lets _Xsetlocale to set all categories to the locale_name.
.PP
The locale name is allowed to the form:
.IP "" "        "
NULL
.br
""
.br
string
.PP
The value NULL means to query the current locale name, and _Xsetlocale
returns the locale name string.
.PP
The empty string sets the implementation-depedent locale. It
examines the enviroment $LANG.  If ${LANG} is set and con-
tains the name of a valid locale, that value is used to set
category. If the value is still not  obtained, _Xsetlocale 
sets the category to C-language "C" and return the locale
name. The C locale is ASCII codeset.
.PP
The locale name is accepted to the following form:
.IP "" "   "
language[_territory[.codeset]]
.PP
The language and territory are country codes defined in ISO standard.
.PP
The string of locale name is allowed to a colon-separated list of locale
name:
.IP "" "   "
locale1:locale2:...:localeN
.PP
or one locale name
.IP "" "   "
locale
.PP
This form is equal to locale:locale:...:localeN
.PP
which is ordered to the following sequence of categories:
.IP "" "    "
XLC_CODESET:XLC_FONTSET:XLC_INPUTMETHOD
.PP
Correspondently, the setting XLC_ALL accepts this string
form. If the number N  is less than the actual total number
of categories, _Xsetlocale() sets the remaining categories to
the last one localeN, so one locale name for XLC_ALL  is
just  a  case of this form.  This colon-separated string
can help to restore an original locale for all categories.
.PP
For example:
.IP "" "   "
oldlocale = strdup(_Xsetlocale(XLC_ALL, NULL));
.br
/* do something that might change locale for all
.br
.br
* or some categories.
.br
*/
.br
_Xsetlocale(XLC_ALL, oldlocale);
.PP
The function returns the locale name to have been set.  If
the locale name is not correct, return NULL.