ACC SHELL
XX1111RR66 SSaammppllee IImmpplleemmeennttaattiioonn FFrraammee WWoorrkk
_K_a_t_s_u_h_i_s_a _Y_a_n_o
TOSHIBA Corporation
_Y_o_s_h_i_o _H_o_r_i_u_c_h_i
IBM Japan
Copyright © 1994 by TOSHIBA Corporation
Copyright © 1994 by IBM Corporation
Permission to use, copy, modify, and distribute this docu-
mentation for any purpose and without fee is hereby granted,
provided that the above copyright notice and this permission
notice appear in all copies. TOSHIBA Corporation and IBM
Corporation make no representations about the suitability
for any purpose of the information in this document. This
documentation is provided as is without express or implied
warranty.
Copyright © 1994 X Consortium
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documenta-
tion files (the ``Software''), to deal in the Software with-
out restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to
whom the Software is furnished to do so, subject to the fol-
lowing conditions:
The above copyright notice and this permission notice shall
be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PUR-
POSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSOR-
TIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the X Con-
sortium shall not be used in advertising or otherwise to
promote the sale, use or other dealings in this Software
without prior written authorization from the X Consortium.
_X _W_i_n_d_o_w _S_y_s_t_e_m is a trademark of The Open Group.
11.. PPrreeffaaccee
This document proposes to define the structures, methods and
their signatures that are expected to be common to all
locale dependent functions within the Xlib sample implemen-
tation. The following illustration (Fig.1) is proposed to
outline the separating of the components within the sample
implementation.
... 0.237 5.796 5.24 10.14 ... 0.000i 4.344i 5.003i
0.000i
|___________________________________|
|______________A_p_p_l_i_c_a_t_i_o_n___________|
││ ││ ││ ││
|│ |│ ||│ ||│
| | || ||
<< ANSI/MSE API ><>< XLib API >> << ANSI/MSE API >>
(X Contrib) (X Core) (X Contrib)
_______________ _______________ _______________
││Locale Library││ ││ Input ││Output││ ││C Library ││
│ non-AnSI im│pl│. Method│Method│ │ ANSI imp│l.
│_______________│ │_________│______│ │_______________│
││ │ <Locl. Serv. │API> ││
│ │ X Locale Obj│ect │
│ │_______________│ │
│ ││ │
│ ___________ │ ___________ │
│ ││ │ ││ │
___|_|_│______|_│___ ________|_│______ ___|_|_│______|_│___
││ || | ││ ││ | ││ ││ || | ││
│XLC_XLOCALE │ │ XLC_FONTSET │ │localedef DB │
│- MB_CUR_MAX │ │ - fonset info│ │- MB_CUR_MAX │
│- codeset info│ │ - charset info│ │- codeset info│
│o char/charset│ │ - font/charset│ │o char/charset│
│_o__c_o_n_v_/_c_h_a_r_s_e_t_│ │__-__X_L_F_D_,__G_L_/_G_R_│ │_o__c_o_n_v_/_c_h_a_r_s_e_t_│
______________________________ ____________
XLocale Source (X Core) System LOcale Source
Fig.1 : Frame Work of Locale Service API Proposal
Generally speaking, the internationalized portion of Xlib
(Locale Dependent X, LDX) consists of three objects; locale
(LC) , input method (IM) and output method (OM). The LC
provides a set of information that depends on user's lan-
guage environment. The IM manages text inputing, and the OM
manages text drawing. Both IM and OM highly depend on LC
data.
In X11R5, there are two sample implementations, Ximp and
Xsi, for Xlib internationalization. But in both implementa-
tions, IM and OM actually refer the private extension of LC.
11
SSaammppllee IImmpplleemmeennttaattiioonn FFrraammee WWoorrkk lliibbXX1111 11..33..22
It breaks coexistence of these two sample implementations.
For example, if a user creates a new OM for special purpose
as a part of Ximp, it will not work with Xsi.
As a solution of this problem, we propose to define the
standard APIs between these three objects, and define the
structure that are common to these objects.
22.. OObbjjeeccttiivvee
· Explain the current X11R6 sample implementation
· Document the common set of locale dependent interfaces
· Provide more flexible pluggable layer
33.. LLooccaallee OObbjjeecctt BBiinnddiinngg FFuunnccttiioonnss
This chapter describes functions related locale object bind-
ing for implementing the pluggable layer.
A locale loader is an entry point for locale object, which
instantiates XLCd object and binds locale methods with spec-
ified locale name. The behavior of loader is implementation
dependent. And, what kind of loaders are available is also
implementation dependent.
The loader is called in ___X_O_p_e_n_L_C_, but caller of ___X_O_p_e_n_L_C
does not need to care about its inside. For example, if the
loader is implemented with dynamic load functions, and the
dynamic module is expected to be unloaded when the corre-
sponding XLCd is freed, close methods of XLCdMethods should
handle unloading.
IInniittiiaalliizziinngg aa llooccaallee llooaaddeerr lliisstt
void _XlcInitLoader()
The ___X_l_c_I_n_i_t_L_o_a_d_e_r function initializes the locale loader
list with vendor specific manner. Each loader is registered
with calling ___X_l_c_A_d_d_L_o_a_d_e_r_. The number of loaders and their
order in the loader list is implementation dependent.
AAdddd aa llooaaddeerr
typedef XLCd (*XLCdLoadProc)(_n_a_m_e);
char _*_n_a_m_e;
22
SSaammppllee IImmpplleemmeennttaattiioonn FFrraammee WWoorrkk lliibbXX1111 11..33..22
typedef int XlcPosition;
#define XlcHead 0
#define XlcTail -1
Bool _XlcAddLoader(_p_r_o_c_, _p_o_s_i_t_i_o_n)
XLCdLoadProc _p_r_o_c;
XlcPosition _p_o_s_i_t_i_o_n;
The ___X_l_c_A_d_d_L_o_a_d_e_r function registers the specified locale
loader ``_p_r_o_c'' to the internal loader list. The position
specifies that the loader ``_p_r_o_c'' should be placed in the
top of the loader list(XlcHead) or last(XlcTail).
The object loader is called from the top of the loader list
in order, when calling time.
RReemmoovvee aa llooaaddeerr
void _XlcRemoveLoader(_p_r_o_c)
XLCdLoadProc _p_r_o_c;
The ___X_l_c_R_e_m_o_v_e_L_o_a_d_e_r function removes the locale loader
specified by ``_p_r_o_c'' from the loader list.
Current implementation provides following locale loaders;
___X_l_c_D_e_f_a_u_l_t_L_o_a_d_e_r
___X_l_c_G_e_n_e_r_i_c_L_o_a_d_e_r
___X_l_c_E_u_c_L_o_a_d_e_r
___X_l_c_S_j_i_s_L_o_a_d_e_r
___X_l_c_U_t_f_L_o_a_d_e_r
___X_a_i_x_O_s_D_y_n_a_m_i_c_L_o_a_d
44.. LLooccaallee MMeetthhoodd IInntteerrffaaccee
This chapter describes the locale method API, which is a set
of accessible functions from both IM and OM parts. The
locale method API provides the functionalities; obtaining
locale dependent information, handling charset, converting
text, etc.
As a result of using these APIs instead of accessing vender
private extension of the locale object, we can keep locale,
IM and OM independently each other.
33
SSaammppllee IImmpplleemmeennttaattiioonn FFrraammee WWoorrkk lliibbXX1111 11..33..22
55.. LLooccaallee MMeetthhoodd FFuunnccttiioonnss
OOppeenn aa LLooccaallee MMeetthhoodd
XLCd _XOpenLC(_n_a_m_e)
char _*_n_a_m_e;
The ___X_O_p_e_n_L_C function opens a locale method which corre-
sponds to the specified locale name. ___X_O_p_e_n_L_C calls a
locale object loader, which is registered via
___X_l_c_A_d_d_L_o_a_d_e_rinto is valid and successfully opens a locale,
___X_O_p_e_n_L_C returns the XLCd. If the loader is invalid or
failed to open a locale, ___X_O_p_e_n_L_C calls the next loader. If
all registered loaders cannot open a locale, ___X_O_p_e_n_L_C
returns NULL.
XLCd _XlcCurrentLC()
The ___X_l_c_C_u_r_r_e_n_t_L_C function returns an XLCd that are bound to
current locale.
CClloossee aa LLooccaallee MMeetthhoodd
void _XCloseLC(_l_c_d)
XLCd _l_c_d;
The ___X_C_l_o_s_e_L_C function close a locale method the specified
lcd.
OObbttaaiinn LLooccaallee MMeetthhoodd vvaalluueess
char * _XGetLCValues(_l_c_d, ...)
XLCd _l_c_d;
The ___X_G_e_t_L_C_V_a_l_u_e_s function returns NULL if no error
occurred; otherwise, it returns the name of the first argu-
ment that could not be obtained. The following values are
defined as standard arguments. Other values are implementa-
tion dependent.
44
SSaammppllee IImmpplleemmeennttaattiioonn FFrraammee WWoorrkk lliibbXX1111 11..33..22
------------------------------------------------------------------------
NNaammee TTyyppee DDeessccrriippttiioonn
------------------------------------------------------------------------
XlcNCodeset char* codeset part of locale name
XlcNDefaultString char* XDefaultString()
XlcNEncodingName char* encoding name
XlcNLanguage char* language part of locale name
XlcNMbCurMax int ANSI C MB_CUR_MAX
XlcNStateDependentEncoding Bool is state-dependent encoding or not
XlcNTerritory char* territory part of locale name
------------------------------------------------------------------------
66.. CChhaarrsseett ffuunnccttiioonnss
The XlcCharSet is an identifier which represents a subset of
characters (character set) in the locale object.
typedef enum {
XlcUnknown, XlcC0, XlcGL, XlcC1, XlcGR, XlcGLGR, XlcOther
} XlcSide;
typedef struct _XlcCharSetRec *XlcCharSet;
typedef struct {
char *name;
XPointer value;
} XlcArg, *XlcArgList;
typedef char* (*XlcGetCSValuesProc)(_c_h_a_r_s_e_t, _a_r_g_s, _n_u_m___a_r_g_s);
XlcCharSet _c_h_a_r_s_e_t;
XlcArgList _a_r_g_s;
int _n_u_m___a_r_g_s;
typedef struct _XlcCharSetRec {
char *name;
XrmQuark xrm_name;
char *encoding_name;
XrmQuark xrm_encoding_name;
XlcSide side;
int char_size;
int set_size;
char *ct_sequence;
XlcGetCSValuesProc get_values;
} XlcCharSetRec;
GGeett aann XXllccCChhaarrSSeett
55
SSaammppllee IImmpplleemmeennttaattiioonn FFrraammee WWoorrkk lliibbXX1111 11..33..22
XlcCharSet _XlcGetCharSet(_n_a_m_e)
char _*_n_a_m_e;
The ___X_l_c_G_e_t_C_h_a_r_S_e_t function gets an XlcCharSet which corre-
sponds to the charset name specified by ``_n_a_m_e''.
___X_l_c_G_e_t_C_h_a_r_S_e_t returns NULL, if no XlcCharSet bound to spec-
ified ``_n_a_m_e''.
The following character sets are pre-registered.
-----------------------------------------------------------------------
NNaammee DDeessccrriippttiioonn
-----------------------------------------------------------------------
ISO8859-1:GL 7-bit ASCII graphics (ANSI X3.4-1968),
Left half of ISO 8859 sets
JISX0201.1976-0:GL Left half of JIS X0201-1976 (reaffirmed 1984),
8-Bit Alphanumeric-Katakana Code
ISO8859-1:GR Right half of ISO 8859-1, Latin alphabet No. 1
ISO8859-2:GR Right half of ISO 8859-2, Latin alphabet No. 2
ISO8859-3:GR Right half of ISO 8859-3, Latin alphabet No. 3
ISO8859-4:GR Right half of ISO 8859-4, Latin alphabet No. 4
ISO8859-7:GR Right half of ISO 8859-7, Latin/Greek alphabet
ISO8859-6:GR Right half of ISO 8859-6, Latin/Arabic alphabet
ISO8859-8:GR Right half of ISO 8859-8, Latin/Hebrew alphabet
ISO8859-5:GR Right half of ISO 8859-5, Latin/Cyrillic alphabet
ISO8859-9:GR Right half of ISO 8859-9, Latin alphabet No. 5
JISX0201.1976-0:GR Right half of JIS X0201-1976 (reaffirmed 1984),
8-Bit Alphanumeric-Katakana Code
GB2312.1980-0:GL GB2312-1980, China (PRC) Hanzi defined as GL
GB2312.1980-0:GR GB2312-1980, China (PRC) Hanzi defined as GR
JISX0208.1983-0:GL JIS X0208-1983, Japanese Graphic Character Set
defined as GL
JISX0208.1983-0:GR JIS X0208-1983, Japanese Graphic Character Set
defined as GR
KSC5601.1987-0:GL KS C5601-1987, Korean Graphic Character Set
defined as GL
KSC5601.1987-0:GR KS C5601-1987, Korean Graphic Character Set
defined as GR
JISX0212.1990-0:GL JIS X0212-1990, Japanese Graphic Character Set
defined as GL
JISX0212.1990-0:GR JIS X0212-1990, Japanese Graphic Character Set
defined as GR
-----------------------------------------------------------------------
AAdddd aann XXllccCChhaarrSSeett
66
SSaammppllee IImmpplleemmeennttaattiioonn FFrraammee WWoorrkk lliibbXX1111 11..33..22
Bool _XlcAddCharSet(_c_h_a_r_s_e_t)
XlcCharSet _c_h_a_r_s_e_t;
The ___X_l_c_A_d_d_C_h_a_r_S_e_t function registers XlcCharSet specified
by ``_c_h_a_r_s_e_t''.
OObbttaaiinn CChhaarraacctteerr SSeett vvaalluueess
char * _XlcGetCSValues(_c_h_a_r_s_e_t, ...)
XlcCharSet _c_h_a_r_s_e_t;
The ___X_l_c_G_e_t_C_S_V_a_l_u_e_s function returns NULL if no error
occurred; otherwise, it returns the name of the first argu-
ment that could not be obtained. The following values are
defined as standard arguments. Other values are implementa-
tion dependent.
-------------------------------------------------------------------
NNaammee TTyyppee DDeessccrriippttiioonn
-------------------------------------------------------------------
XlcNName char* charset name
XlcNEncodingName char* XLFD CharSet Registry and Encoding
XlcNSide XlcSide charset side (GL, GR, ...)
XlcNCharSize int number of octets per character
XlcNSetSize int number of character sets
XlcNControlSequence char* control sequence of Compound Text
-------------------------------------------------------------------
77.. CCoonnvveerrtteerr FFuunnccttiioonnss
We provide a set of the common converter APIs, that are
independent from both of source and destination text type.
typedef struct _XlcConvRec *XlcConv;
typedef void (*XlcCloseConverterProc)(_c_o_n_v);
XlcConv _c_o_n_v;
typedef int (*XlcConvertProc)(_c_o_n_v, _f_r_o_m, _f_r_o_m___l_e_f_t, _t_o, _t_o___l_e_f_t, _a_r_g_s, _n_u_m___a_r_g_s);
XlcConv _c_o_n_v;
XPointer _*_f_r_o_m;
int _*_f_r_o_m___l_e_f_t;
XPointer _*_t_o;
int _*_t_o___l_e_f_t;
XPointer _*_a_r_g_s;
int _n_u_m___a_r_g_s;
77
SSaammppllee IImmpplleemmeennttaattiioonn FFrraammee WWoorrkk lliibbXX1111 11..33..22
typedef void (*XlcResetConverterProc)(_c_o_n_v);
XlcConv _c_o_n_v;
typedef struct _XlcConvMethodsRec {
XlcCloseConverterProc close;
XlcConvertProc convert;
XlcResetConverterProc reset;
} XlcConvMethodsRec, *XlcConvMethods;
typedef struct _XlcConvRec {
XlcConvMethods methods;
XPointer state;
} XlcConvRec;
OOppeenn aa ccoonnvveerrtteerr
XlcConv _XlcOpenConverter(_f_r_o_m___l_c_d, _f_r_o_m___t_y_p_e, _t_o___l_c_d, _t_o___t_y_p_e)
XLCd _f_r_o_m___l_c_d;
char _*_f_r_o_m___t_y_p_e;
XLCd _t_o___l_c_d;
char _*_t_o___t_y_p_e;
___X_l_c_O_p_e_n_C_o_n_v_e_r_t_e_r function opens the converter which con-
verts a text from specified ``_f_r_o_m___t_y_p_e'' to specified
``_t_o___t_y_p_e'' encoding. If the function cannot find proper
converter or cannot open a corresponding converter, it
returns NULL. Otherwise, it returns the conversion descrip-
tor.
The following types are pre-defined. Other types are imple-
mentation dependent.
-----------------------------------------------------------
NNaammee TTyyppee DDeessccrriippttiioonn AArrgguummeennttss
-----------------------------------------------------------
XlcNMultiByte char * multibyte -
XlcNWideChar wchar_t * wide character -
XlcNCompoundText char * COMPOUND_TEXT -
XlcNString char * STRING -
XlcNCharSet char * per charset XlcCharSet
XlcNChar char * per character XlcCharSet
-----------------------------------------------------------
CClloossee aa ccoonnvveerrtteerr
88
SSaammppllee IImmpplleemmeennttaattiioonn FFrraammee WWoorrkk lliibbXX1111 11..33..22
void _XlcCloseConverter(_c_o_n_v)
XlcConv _c_o_n_v;
The ___X_l_c_C_l_o_s_e_C_o_n_v_e_r_t_e_r function closes the specified con-
verter ``_c_o_n_v''.
CCooddee ccoonnvveerrssiioonn
int _XlcConvert(_c_o_n_v, _f_r_o_m, _f_r_o_m___l_e_f_t, _t_o, _t_o___l_e_f_t, _a_r_g_s, _n_u_m___a_r_g_s)
XlcConv _c_o_n_v;
XPointer _*_f_r_o_m;
int _*_f_r_o_m___l_e_f_t;
XPointer _*_t_o;
int _*_t_o___l_e_f_t;
XPointer _*_a_r_g_s;
int _n_u_m___a_r_g_s;
The ___X_l_c_C_o_n_v_e_r_t function converts a sequence of characters
from one type, in the array specified by ``_f_r_o_m'', into a
sequence of corresponding characters in another type, in the
array specified by ``_t_o''. The types are those specified in
the ___X_l_c_O_p_e_n_C_o_n_v_e_r_t_e_r_(_) call that returned the conversion
descriptor, ``_c_o_n_v''. The arguments ``_f_r_o_m'',
``_f_r_o_m___l_e_f_t'', ``_t_o'' and ``_t_o___l_e_f_t'' have the same specifi-
cation of XPG4 iconv function.
For state-dependent encodings, the conversion descriptor
``_c_o_n_v'' is placed into its initial shift state by a call
for which ``_f_r_o_m'' is a NULL pointer, or for which ``_f_r_o_m''
points to a null pointer.
The following 2 converters prepared by locale returns appro-
priate charset (XlcCharSet) in an area pointed by args[0].
---------------------------------------------------------
FFrroomm TToo DDeessccrriippttiioonn
---------------------------------------------------------
XlcNMultiByte XlcNCharSet Segmentation (Decomposing)
XlcNWideChar XlcNCharSet Segmentation (Decomposing)
---------------------------------------------------------
The conversion, from XlcNMultiByte/XlcNWideChar to XlcN-
CharSet, extracts a segment which has same charset encoding
characters. More than one segment cannot be converted in a
call.
RReesseett aa ccoonnvveerrtteerr
99
SSaammppllee IImmpplleemmeennttaattiioonn FFrraammee WWoorrkk lliibbXX1111 11..33..22
void _XlcResetConverter(_c_o_n_v)
XlcConv _c_o_n_v;
The ___X_l_c_R_e_s_e_t_C_o_n_v_e_r_t_e_r function reset the specified con-
verter ``_c_o_n_v''.
RReeggiisstteerr aa ccoonnvveerrtteerr
typedef XlcConv (*XlcOpenConverterProc)(_f_r_o_m___l_c_d, _f_r_o_m___t_y_p_e, _t_o___l_c_d, _t_o___t_y_p_e);
XLCd _f_r_o_m___l_c_d;
char _*_f_r_o_m___t_y_p_e;
XLCd _t_o___l_c_d;
char _*_t_o___t_y_p_e;
Bool _XlcSetConverter(_f_r_o_m___l_c_d, _f_r_o_m, _t_o___l_c_d, _t_o, _c_o_n_v_e_r_t_e_r)
XLCd _f_r_o_m___l_c_d;
char _*_f_r_o_m;
XLCd _t_o___l_c_d;
char _*_t_o;
XlcOpenConverterProc _c_o_n_v_e_r_t_e_r;
The XXllccSSeettCCoonnvveerrtteerr function registers a converter which
convert from ``_f_r_o_m___t_y_p_e'' to ``_t_o___t_y_p_e'' into the converter
list (in the specified XLCd).
88.. XX LLooccaallee DDaattaabbaassee ffuunnccttiioonnss
X Locale Database contains the subset of user's environment
that depends on language. The following APIs are provided
for accessing X Locale Database and other locale relative
files.
For more detail about X Locale Database, please refer X
Locale Database Definition document.
GGeett aa rreessoouurrccee ffrroomm ddaattaabbaassee
void _XlcGetResource(_l_c_d, _c_a_t_e_g_o_r_y, _c_l_a_s_s, _v_a_l_u_e, _c_o_u_n_t)
XLCd _l_c_d;
char _*_c_a_t_e_g_o_r_y;
char _*_c_l_a_s_s;
char _*_*_*_v_a_l_u_e;
int _*_c_o_u_n_t;
1100
SSaammppllee IImmpplleemmeennttaattiioonn FFrraammee WWoorrkk lliibbXX1111 11..33..22
The ___X_l_c_G_e_t_R_e_s_o_u_r_c_e function obtains a locale dependent data
which is associated with the locale of specified ``_l_c_d''.
The locale data is provided by system locale or by X Locale
Database file, and what kind of data is available is imple-
mentation dependent.
The specified ``_c_a_t_e_g_o_r_y'' and ``_c_l_a_s_s'' are used for find-
ing out the objective locale data.
The returned value is returned in value argument in string
list form, and the returned count shows the number of
strings in the value.
The returned value is owned by locale method, and should not
be modified or freed by caller.
GGeett aa llooccaallee rreellaattiivvee ffiillee nnaammee
char * _XlcFileName(_l_c_d, _c_a_t_e_g_o_r_y)
XLCd _l_c_d;
char _*_c_a_t_e_g_o_r_y;
The ___X_l_c_F_i_l_e_N_a_m_e functions returns a file name which is
bound to the specified ``_l_c_d'' and ``_c_a_t_e_g_o_r_y'', as a null-
terminated string. If no file name can be found, or there
is no readable file for the found file name, ___X_l_c_F_i_l_e_N_a_m_e
returns NULL. The returned file name should be freed by
caller.
The rule for searching a file name is implementation depen-
dent. In current implementation, ___X_l_c_F_i_l_e_N_a_m_e uses ``{cate-
gory}.dir'' file as mapping table, which has pairs of
strings, a full locale name and a corresponding file name.
99.. UUttiilliittyy FFuunnccttiioonnss
CCoommppaarree LLaattiinn--11 ssttrriinnggss
int _XlcCompareISOLatin1(_s_t_r_1, _s_t_r_2)
char _*_s_t_r_1, _*_s_t_r_2;
int _XlcNCompareISOLatin1(_s_t_r_1, _s_t_r_2, _l_e_n)
char _*_s_t_r_1, _*_s_t_r_2;
int _l_e_n;
The ___X_l_c_C_o_m_p_a_r_e_I_s_o_L_a_t_i_n_1 function to compares two ISO-8859-1
strings. Bytes representing ASCII lower case letters are
1111
SSaammppllee IImmpplleemmeennttaattiioonn FFrraammee WWoorrkk lliibbXX1111 11..33..22
converted to upper case before making the comparison. The
value returned is an integer less than, equal to, or greater
than zero, depending on whether ``_s_t_r_1'' is lexicographicly
less than, equal to, or greater than ``_s_t_r_2''.
The ___X_l_c_N_C_o_m_p_a_r_e_I_s_o_L_a_t_i_n_1 function is identical to ___X_l_c_C_o_m_-
_p_a_r_e_I_S_O_L_a_t_i_n_1_, except that at most ``_l_e_n'' bytes are com-
pared.
RReessoouurrccee UUttiilliittyy
int XlcNumber(_a_r_r_a_y)
ArrayType _a_r_r_a_y;
Similar to XtNumber.
void _XlcCopyFromArg(_s_r_c, _d_s_t, _s_i_z_e)
char _*_s_r_c;
char _*_d_s_t;
int _s_i_z_e;
void _XlcCopyToArg(_s_r_c, _d_s_t, _s_i_z_e)
char _*_s_r_c;
char _*_*_d_s_t;
int _s_i_z_e;
Similar to ___X_t_C_o_p_y_F_r_o_m_A_r_g and ___X_t_C_o_p_y_T_o_A_r_g_.
void _XlcCountVaList(_v_a_r, _c_o_u_n_t___r_e_t)
va_list _v_a_r;
int _*_c_o_u_n_t___r_e_t;
Similar to ___X_t_C_o_u_n_t_V_a_L_i_s_t_.
void _XlcVaToArgList(_v_a_r, _c_o_u_n_t, _a_r_g_s___r_e_t)
va_list _v_a_r;
int _c_o_u_n_t;
XlcArgList _*_a_r_g_s___r_e_t;
Similar to ___X_t_V_a_T_o_A_r_g_L_i_s_t_.
typedef struct _XlcResource {
char *name;
1122
SSaammppllee IImmpplleemmeennttaattiioonn FFrraammee WWoorrkk lliibbXX1111 11..33..22
XrmQuark xrm_name;
int size;
int offset;
unsigned long mask;
} XlcResource, *XlcResourceList;
#define XlcCreateMask (1L<<0)
#define XlcDefaultMask (1L<<1)
#define XlcGetMask (1L<<2)
#define XlcSetMask (1L<<3)
#define XlcIgnoreMask (1L<<4)
void _XlcCompileResourceList(_r_e_s_o_u_r_c_e_s, _n_u_m___r_e_s_o_u_r_c_e_s)
XlcResourceList _r_e_s_o_u_r_c_e_s;
int _n_u_m___r_e_s_o_u_r_c_e_s;
Similar to ___X_t_C_o_m_p_i_l_e_R_e_s_o_u_r_c_e_L_i_s_t_.
char * _XlcGetValues(_b_a_s_e, _r_e_s_o_u_r_c_e_s, _n_u_m___r_e_s_o_u_r_c_e_s, _a_r_g_s, _n_u_m___a_r_g_s, _m_a_s_k)
XPointer _b_a_s_e;
XlcResourceList _r_e_s_o_u_r_c_e_s;
int _n_u_m___r_e_s_o_u_r_c_e_s;
XlcArgList _a_r_g_s;
int _n_u_m___a_r_g_s;
unsigned long _m_a_s_k;
Similar to XtGetSubvalues.
char * _XlcSetValues(_b_a_s_e, _r_e_s_o_u_r_c_e_s, _n_u_m___r_e_s_o_u_r_c_e_s, _a_r_g_s, _n_u_m___a_r_g_s, _m_a_s_k)
XPointer _b_a_s_e;
XlcResourceList _r_e_s_o_u_r_c_e_s;
int _n_u_m___r_e_s_o_u_r_c_e_s;
XlcArgList _a_r_g_s;
int _n_u_m___a_r_g_s;
unsigned long _m_a_s_k;
Similar to XtSetSubvalues.
AANNSSII CC CCoommppaattiibbllee FFuunnccttiioonnss
The following are ANSI C/MSE Compatible Functions for non-
ANSI C environment.
1133
SSaammppllee IImmpplleemmeennttaattiioonn FFrraammee WWoorrkk lliibbXX1111 11..33..22
int _Xmblen(_s_t_r, _l_e_n)
char _*_s_t_r;
int _l_e_n;
The ___X_m_b_l_e_n function returns the number of characters
pointed to by ``_s_t_r''. Only ``_l_e_n'' bytes in ``_s_t_r'' are
used in determining the character count returned. ``_S_t_r''
may point at characters from any valid codeset in the cur-
rent locale.
The call ___X_m_b_l_e_n is equivalent to
_Xmbtowc(_Xmbtowc((_w_c_h_a_r___t_*)NULL, _s_t_r, _l_e_n))
int _Xmbtowc(_w_s_t_r, _s_t_r, _l_e_n)
wchar_t _*_w_s_t_r;
char _*_s_t_r;
int _l_e_n;
The ___X_m_b_t_o_w_c function converts the character(s) pointed to
by ``_s_t_r'' to their wide character representation(s) pointed
to by ``_w_s_t_r''. ``_L_e_n'' is the number of bytes in ``_s_t_r''
to be converted. The return value is the number of charac-
ters converted.
The call ___X_m_b_t_o_w_c is equivalent to
_Xlcmbtowc((XLCd)NULL, _w_s_t_r, _s_t_r, _l_e_n)
int _Xlcmbtowc(_l_c_d, _w_s_t_r, _s_t_r, _l_e_n)
XLCd _l_c_d;
wchar_t _*_w_s_t_r;
char _*_s_t_r;
int _l_e_n;
The ___X_l_c_m_b_t_o_w_c function is identical to ___X_m_b_t_o_w_c_, except
that it requires the ``_l_c_d'' argument. If ``_l_c_d'' is (XLCd)
NULL, ___X_l_c_m_b_t_o_w_c_, calls ___X_l_c_C_u_r_r_e_n_t_L_C to determine the cur-
rent locale.
int _Xwctomb(_s_t_r, _w_c)
char _*_s_t_r;
wchar_t _w_c;
The ___X_w_c_t_o_m_b function converts a single wide character
pointed to by ``_w_c'' to its multibyte representation pointed
to by ``_s_t_r''. On success, the return value is 1.
1144
SSaammppllee IImmpplleemmeennttaattiioonn FFrraammee WWoorrkk lliibbXX1111 11..33..22
The call ___X_w_c_t_o_m_b is equivalent to
_Xlcwctomb((XLCd)NULL, _s_t_r, _w_s_t_r)
int _Xlcwctomb(_l_c_d, _s_t_r, _w_c)
XLCd _l_c_d;
char _*_s_t_r;
wchar_t _w_c;
The ___X_l_c_w_c_t_o_m_b function is identical to _Xwctomb, except
that it requires the ``_l_c_d'' argument. If ``_l_c_d'' is (XLCd)
NULL, ___X_l_c_w_c_t_o_m_b_, calls ___X_l_c_C_u_r_r_e_n_t_L_C to determine the cur-
rent locale.
int _Xmbstowcs(_w_s_t_r, _s_t_r, _l_e_n)
wchar_t _*_w_s_t_r;
char _*_s_t_r;
int _l_e_n;
The ___X_m_b_s_t_o_w_c_s function converts the NULL-terminated string
pointed to by ``_s_t_r'' to its wide character string represen-
tation pointed to by ``_w_s_t_r''. ``_L_e_n'' is the number of
characters in ``_s_t_r'' to be converted.
The call ___X_m_b_s_t_o_w_c_s is equivalent to
_Xlcmbstowcs((XLCd)NULL, _w_s_t_r, _s_t_r, _l_e_n)
int _Xlcmbstowcs(_l_c_d, _w_s_t_r, _s_t_r, _l_e_n)
XLCd _l_c_d;
wchar_t _*_w_s_t_r;
char _*_s_t_r;
int _l_e_n;
The ___X_l_c_m_b_s_t_o_w_c_s function is identical to _Xmbstowcs, except
that it requires the ``_l_c_d'' argument. If ``_l_c_d'' is (XLCd)
NULL, ___X_l_c_m_b_s_t_o_w_c_s_, calls ___X_l_c_C_u_r_r_e_n_t_L_C to determine the
current locale.
int _Xwcstombs(_s_t_r, _w_s_t_r, _l_e_n)
char _*_s_t_r;
wchar_t _*_w_s_t_r;
int _l_e_n;
The ___X_w_c_s_t_o_m_b_s function converts the (wchar_t) NULL termi-
nated wide character string pointed to by ``_w_s_t_r'' to the
NULL terminated multibyte string pointed to by ``_s_t_r''.
1155
SSaammppllee IImmpplleemmeennttaattiioonn FFrraammee WWoorrkk lliibbXX1111 11..33..22
The call ___X_w_c_s_t_o_m_b_s is equivalent to
_Xlcwcstombs((XLCd)NULL, _s_t_r, _w_s_t_r, _l_e_n)
int _Xlcwcstombs(_l_c_d, _s_t_r, _w_s_t_r, _l_e_n)
XLCd _l_c_d;
char _*_s_t_r;
wchar_t _*_w_s_t_r;
int _l_e_n;
The ___X_l_c_w_c_s_t_o_m_b_s function is identical to _Xwcstombs, except
that it requires the ``_l_c_d'' argument. If ``_l_c_d'' is (XLCd)
NULL, ___X_l_c_w_c_s_t_o_m_b_s_, calls ___X_l_c_C_u_r_r_e_n_t_L_C to determine the
current locale.
int _Xwcslen(_w_s_t_r)
wchar_t _*_w_s_t_r;
The ___X_w_c_s_l_e_n function returns the count of wide characters
in the (wchar_t) NULL terminated wide character string
pointed to by ``_w_s_t_r''.
wchar_t * _Xwcscpy(_w_s_t_r_1, _w_s_t_r_2)
wchar_t _*_w_s_t_r_1, _*_w_s_t_r_2;
wchar_t * _Xwcsncpy(_w_s_t_r_1, _w_s_t_r_2, _l_e_n)
wchar_t _*_w_s_t_r_1, _*_w_s_t_r_2;
int _l_e_n;
The ___X_w_c_s_c_p_y function copies the (wchar_t) NULL terminated
wide character string pointed to by ``_w_s_t_r_2'' to the object
pointed at by ``_w_s_t_r_1''. ``_W_s_t_r_1'' is (wchar_t) NULL termi-
nated. The return value is a pointer to ``_w_s_t_r_1''.
The ___X_w_c_s_n_c_p_y function is identical to ___X_w_c_s_c_p_y_, except that
it copies ``_l_e_n'' wide characters from the object pointed to
by ``_w_s_t_r_2'' to the object pointed to ``_w_s_t_r_1''.
int _Xwcscmp(_w_s_t_r_1, _w_s_t_r_2)
wchar_t _*_w_s_t_r_1, _*_w_s_t_r_2;
int _Xwcsncmp(_w_s_t_r_1, _w_s_t_r_2, _l_e_n)
wchar_t _*_w_s_t_r_1, _*_w_s_t_r_2;
int _l_e_n;
1166
SSaammppllee IImmpplleemmeennttaattiioonn FFrraammee WWoorrkk lliibbXX1111 11..33..22
The ___X_w_c_s_c_m_p function compares two (wchar_t) NULL termi-
nated wide character strings. The value returned is an
integer less than, equal to, or greater than zero, depending
on whether ``_w_s_t_r_1'' is lexicographicly less then, equal to,
or greater than ``_s_t_r_2''.
The ___X_w_c_s_n_c_m_p function is identical to ___X_l_c_C_o_m_p_a_r_e_I_S_O_L_a_t_i_n_1_,
except that at most ``_l_e_n'' wide characters are compared.
1177
ACC SHELL 2018