home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 August - Disc 2 / chip_20018102_hu.iso / linux / X-4.1.0 / doc / i18nFramework.TXT < prev    next >
Text File  |  2001-06-27  |  27KB  |  1,321 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.        X11R6 Sample Implementation Frame Work
  12.  
  13.  
  14.  
  15.                Katsuhisa Yano
  16.             TOSHIBA Corporation
  17.  
  18.               Yoshio Horiuchi
  19.              IBM Japan
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90. Copyright (C) 1994 by TOSHIBA Corporation
  91. Copyright (C) 1994 by IBM Corporation
  92.  
  93. Permission to use, copy, modify, and distribute this docu-
  94. mentation for any purpose and without fee is hereby granted,
  95. provided that the above copyright notice and this permission
  96. notice appear in all copies.  TOSHIBA Corporation and IBM
  97. Corporation make no representations about the suitability
  98. for any purpose of the information in this document.  This
  99. documentation is provided as is without express or implied
  100. warranty.
  101.  
  102.  
  103.  
  104.  
  105.  
  106. Copyright (C) 1994 X Consortium
  107.  
  108. Permission is hereby granted, free of charge, to any person
  109. obtaining a copy of this software and associated documenta-
  110. tion files (the ``Software''), to deal in the Software with-
  111. out restriction, including without limitation the rights to
  112. use, copy, modify, merge, publish, distribute, sublicense,
  113. and/or sell copies of the Software, and to permit persons to
  114. whom the Software is furnished to do so, subject to the fol-
  115. lowing conditions:
  116.  
  117. The above copyright notice and this permission notice shall
  118. be included in all copies or substantial portions of the
  119. Software.
  120.  
  121. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY
  122. KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  123. WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PUR-
  124. POSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE X CONSOR-
  125. TIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  126. WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139. FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
  140. OR OTHER DEALINGS IN THE SOFTWARE.
  141.  
  142. Except as contained in this notice, the name of the X Con-
  143. sortium shall not be used in advertising or otherwise to
  144. promote the sale, use or other dealings in this Software
  145. without prior written authorization from the X Consortium.
  146.  
  147.  
  148.  
  149. X Window System is a trademark of X Consortium, Inc.
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205. 1.  Preface
  206.  
  207. This document proposes to define the structures, methods and
  208. their signatures that are expected to be common to all
  209. locale dependent functions within the Xlib sample implemen-
  210. tation.  The following illustration (Fig.1) is proposed to
  211. outline the separating of the components within the sample
  212. implementation.
  213.  
  214.     ... 0.237 5.796 5.24 10.14 ... 0.000i 4.344i 5.003i
  215.     0.000i
  216.  
  217.           ___________________________________|
  218.           _____________Application___________|
  219.           |        |        |          |
  220.           |        |       ||         ||
  221.           |        |       ||         ||
  222.        <<  ANSI/MSE API <<  XLib API  >>  <<  ANSI/MSE API >>
  223.      (X Contrib)        (X Core)        (X Contrib)
  224.        _______________    _______________   _______________
  225.        |Locale Library| | Input |Output|  |C Library     |
  226.        |   non-AnSI impl. Method|Method|  |     ANSI impl.
  227.        _______________| ________|______|  _______________|
  228.        |        | <Locl. Serv. API>         |
  229.        |        |  X Locale Object         |
  230.        |        _______________|         |
  231.        |            |             |
  232.        |      ___________    | ___________         |
  233.        |      |        |          |      |
  234.        ____|______|___    ________|______   ____|______|___
  235.        |  ||      |   | |    |      |  |  ||      |     |
  236.        |XLC_XLOCALE   | | XLC_FONTSET  |  |localedef DB  |
  237.        |- MB_CUR_MAX  | | - fonset info|  |- MB_CUR_MAX  |
  238.        |- codeset info| | - charset inf|  |- codeset info|
  239.        |o char/charset| | - font/charse|  |o char/charset|
  240.        _______________| _______________|  _______________|
  241.  
  242.     ______________________________       ____________
  243.         XLocale Source (X Core)    System LOcale Source
  244.  
  245.  
  246.      Fig.1 : Frame Work of Locale Service API Proposal
  247.  
  248. Generally speaking, the internationalized portion of Xlib
  249. (Locale Dependent X, LDX) consists of three objects; locale
  250. (LC) , input method (IM) and output method (OM).  The LC
  251. provides a set of information that depends on user's lan-
  252. guage environment.  The IM manages text inputing, and the OM
  253. manages text drawing.  Both IM and OM highly depend on LC
  254. data.
  255.  
  256. In X11R5, there are two sample implementations, Ximp and
  257. Xsi, for Xlib internationalization.  But in both implementa-
  258. tions, IM and OM actually refer the private extension of LC.
  259.  
  260.  
  261.  
  262.                   1
  263.  
  264.  
  265.  
  266.  
  267.  
  268. Sample Implementation Frame Work        X11, Release 6.4
  269.  
  270.  
  271. It breaks coexistence of these two sample implementations.
  272. For example, if a user creates a new OM for special purpose
  273. as a part of Ximp, it will not work with Xsi.
  274.  
  275. As a solution of this problem, we propose to define the
  276. standard APIs between these three objects, and define the
  277. structure that are common to these objects.
  278.  
  279.  
  280. 2.  Objective
  281.  
  282.  
  283. o    Explain the current X11R6 sample implementation
  284.  
  285. o    Document the common set of locale dependent interfaces
  286.  
  287. o    Provide more flexible pluggable layer
  288.  
  289.  
  290. 3.  Locale Object Binding Functions
  291.  
  292. This chapter describes functions related locale object bind-
  293. ing for implementing the pluggable layer.
  294.  
  295. A locale loader is an entry point for locale object, which
  296. instantiates XLCd object and binds locale methods with spec-
  297. ified locale name. The behavior of loader is implementation
  298. dependent.  And, what kind of loaders are available is also
  299. implementation dependent.
  300.  
  301. The loader is called in _XOpenLC, but caller of _XOpenLC
  302. does not need to care about its inside.  For example, if the
  303. loader is implemented with dynamic load functions, and the
  304. dynamic module is expected to be unloaded when the corre-
  305. sponding XLCd is freed, close methods of XLCdMethods should
  306. handle unloading.
  307.  
  308.  
  309. Initializing a locale loader list
  310.  
  311.  
  312. void _XlcInitLoader()
  313.  
  314. The _XlcInitLoader function initializes the locale loader
  315. list with vendor specific manner.  Each loader is registered
  316. with calling _XlcAddLoader. The number of loaders and their
  317. order in the loader list is implementation dependent.
  318.  
  319.  
  320. Add a loader
  321.  
  322.  
  323. typedef XLCd (*XLCdLoadProc)(name);
  324.       char *name;
  325.  
  326.  
  327.  
  328.                   2
  329.  
  330.  
  331.  
  332.  
  333.  
  334. Sample Implementation Frame Work        X11, Release 6.4
  335.  
  336.  
  337. typedef int XlcPosition;
  338.  
  339.  
  340. #define   XlcHead          0
  341. #define   XlcTail         -1
  342.  
  343.  
  344.  
  345. Bool _XlcAddLoader(proc, position)
  346.       XLCdLoadProc proc;
  347.       XlcPosition position;
  348.  
  349.  
  350. The _XlcAddLoader function registers the specified locale
  351. loader ``proc'' to the internal loader list.  The position
  352. specifies that the loader ``proc'' should be placed in the
  353. top of the loader list(XlcHead) or last(XlcTail).
  354.  
  355. The object loader is called from the top of the loader list
  356. in order, when calling time.
  357.  
  358.  
  359. Remove a loader
  360.  
  361.  
  362. void _XlcRemoveLoader(proc)
  363.       XLCdLoadProc proc;
  364.  
  365.  
  366. The _XlcRemoveLoader function removes the locale loader
  367. specified by ``proc'' from the loader list.
  368.  
  369. Current implementation provides following locale loaders;
  370.  
  371.      _XlcDefaultLoader
  372.      _XlcGenericLoader
  373.      _XlcEucLoader
  374.      _XlcSjisLoader
  375.      _XlcUtfLoader
  376.      _XaixOsDynamicLoad
  377.  
  378.  
  379.  
  380. 4.  Locale Method Interface
  381.  
  382. This chapter describes the locale method API, which is a set
  383. of accessible functions from both IM and OM parts.  The
  384. locale method API provides the functionalities;  obtaining
  385. locale dependent information, handling charset, converting
  386. text, etc.
  387.  
  388. As a result of using these APIs instead of accessing vender
  389. private extension of the locale object, we can keep locale,
  390. IM and OM independently each other.
  391.  
  392.  
  393.  
  394.                   3
  395.  
  396.  
  397.  
  398.  
  399.  
  400. Sample Implementation Frame Work        X11, Release 6.4
  401.  
  402.  
  403. 5.  Locale Method Functions
  404.  
  405. Open a Locale Method
  406.  
  407.  
  408. XLCd _XOpenLC(name)
  409.       char *name;
  410.  
  411.  
  412. The _XOpenLC function opens a locale method which corre-
  413. sponds to the specified locale name.  _XOpenLC calls a
  414. locale object loader, which is registered via
  415. _XlcAddLoaderinto is valid and successfully opens a locale,
  416. _XOpenLC returns the XLCd.  If the loader is invalid or
  417. failed to open a locale, _XOpenLC calls the next loader.  If
  418. all registered loaders cannot open a locale, _XOpenLC
  419. returns NULL.
  420.  
  421.  
  422. XLCd _XlcCurrentLC()
  423.  
  424.  
  425. The _XlcCurrentLC function returns an XLCd that are bound to
  426. current locale.
  427.  
  428.  
  429. Close a Locale Method
  430.  
  431.  
  432. void _XCloseLC(lcd)
  433.       XLCd lcd;
  434.  
  435.  
  436. The _XCloseLC function close a locale method the specified
  437. lcd.
  438.  
  439.  
  440. Obtain Locale Method values
  441.  
  442.  
  443. char * _XGetLCValues(lcd, ...)
  444.       XLCd lcd;
  445.  
  446.  
  447. The _XGetLCValues function returns NULL if no error
  448. occurred; otherwise, it returns the name of the first argu-
  449. ment that could not be obtained.  The following values are
  450. defined as standard arguments. Other values are implementa-
  451. tion dependent.
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.                   4
  461.  
  462.  
  463.  
  464.  
  465.  
  466. Sample Implementation Frame Work        X11, Release 6.4
  467.  
  468.  
  469. ------------------------------------------------------------------------
  470. Name                 Type    Description
  471. ------------------------------------------------------------------------
  472. XlcNCodeset             char*   codeset part of locale name
  473. XlcNDefaultString         char*   XDefaultString()
  474. XlcNEncodingName         char*   encoding name
  475. XlcNLanguage             char*   language part of locale name
  476. XlcNMbCurMax             int     ANSI C MB_CUR_MAX
  477. XlcNStateDependentEncoding   Bool    is state-dependent encoding or not
  478. XlcNTerritory             char*   territory part of locale name
  479. ------------------------------------------------------------------------
  480.  
  481.  
  482.  
  483. 6.  Charset functions
  484.  
  485. The XlcCharSet is an identifier which represents a subset of
  486. characters (character set) in the locale object.
  487.  
  488.  
  489. typedef enum {
  490.       XlcUnknown, XlcC0, XlcGL, XlcC1, XlcGR, XlcGLGR, XlcOther
  491. } XlcSide;
  492.  
  493. typedef struct _XlcCharSetRec *XlcCharSet;
  494.  
  495. typedef struct {
  496.       char *name;
  497.       XPointer value;
  498. } XlcArg, *XlcArgList;
  499.  
  500. typedef char* (*XlcGetCSValuesProc)(charset, args, num_args);
  501.       XlcCharSet charset;
  502.       XlcArgList args;
  503.       int num_args;
  504.  
  505. typedef struct _XlcCharSetRec {
  506.       char *name;
  507.       XrmQuark xrm_name;
  508.       char *encoding_name;
  509.       XrmQuark xrm_encoding_name;
  510.       XlcSide side;
  511.       int char_size;
  512.       int set_size;
  513.       char *ct_sequence;
  514.       XlcGetCSValuesProc get_values;
  515. } XlcCharSetRec;
  516.  
  517.  
  518.  
  519. Get an XlcCharSet
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.                   5
  527.  
  528.  
  529.  
  530.  
  531.  
  532. Sample Implementation Frame Work        X11, Release 6.4
  533.  
  534.  
  535. XlcCharSet _XlcGetCharSet(name)
  536.       char *name;
  537.  
  538.  
  539. The _XlcGetCharSet function gets an XlcCharSet which corre-
  540. sponds to the charset name specified by ``name''.
  541. _XlcGetCharSet returns NULL, if no XlcCharSet bound to spec-
  542. ified ``name''.
  543.  
  544. The following character sets are pre-registered.
  545.  
  546.  
  547. -----------------------------------------------------------------------
  548. Name             Description
  549. -----------------------------------------------------------------------
  550. ISO8859-1:GL         7-bit ASCII graphics (ANSI X3.4-1968),
  551.              Left half of ISO 8859 sets
  552. JISX0201.1976-0:GL   Left half of JIS X0201-1976 (reaffirmed 1984),
  553.              8-Bit Alphanumeric-Katakana Code
  554.  
  555. ISO8859-1:GR         Right half of ISO 8859-1, Latin alphabet No. 1
  556. ISO8859-2:GR         Right half of ISO 8859-2, Latin alphabet No. 2
  557. ISO8859-3:GR         Right half of ISO 8859-3, Latin alphabet No. 3
  558. ISO8859-4:GR         Right half of ISO 8859-4, Latin alphabet No. 4
  559. ISO8859-7:GR         Right half of ISO 8859-7, Latin/Greek alphabet
  560. ISO8859-6:GR         Right half of ISO 8859-6, Latin/Arabic alphabet
  561. ISO8859-8:GR         Right half of ISO 8859-8, Latin/Hebrew alphabet
  562. ISO8859-5:GR         Right half of ISO 8859-5, Latin/Cyrillic alphabet
  563. ISO8859-9:GR         Right half of ISO 8859-9, Latin alphabet No. 5
  564. JISX0201.1976-0:GR   Right half of JIS X0201-1976 (reaffirmed 1984),
  565.              8-Bit Alphanumeric-Katakana Code
  566.  
  567. GB2312.1980-0:GL     GB2312-1980, China (PRC) Hanzi defined as GL
  568. GB2312.1980-0:GR     GB2312-1980, China (PRC) Hanzi defined as GR
  569. JISX0208.1983-0:GL   JIS X0208-1983, Japanese Graphic Character Set
  570.              defined as GL
  571. JISX0208.1983-0:GR   JIS X0208-1983, Japanese Graphic Character Set
  572.              defined as GR
  573. KSC5601.1987-0:GL    KS C5601-1987, Korean Graphic Character Set
  574.              defined as GL
  575. KSC5601.1987-0:GR    KS C5601-1987, Korean Graphic Character Set
  576.              defined as GR
  577. JISX0212.1990-0:GL   JIS X0212-1990, Japanese Graphic Character Set
  578.              defined as GL
  579. JISX0212.1990-0:GR   JIS X0212-1990, Japanese Graphic Character Set
  580.              defined as GR
  581. -----------------------------------------------------------------------
  582.  
  583.  
  584.  
  585. Add an XlcCharSet
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.                   6
  593.  
  594.  
  595.  
  596.  
  597.  
  598. Sample Implementation Frame Work        X11, Release 6.4
  599.  
  600.  
  601. Bool _XlcAddCharSet(charset)
  602.       XlcCharSet charset;
  603.  
  604.  
  605. The _XlcAddCharSet function registers XlcCharSet specified
  606. by ``charset''.
  607.  
  608.  
  609. Obtain Character Set values
  610.  
  611.  
  612. char * _XlcGetCSValues(charset, ...)
  613.       XlcCharSet charset;
  614.  
  615.  
  616. The _XlcGetCSValues function returns NULL if no error
  617. occurred; otherwise, it returns the name of the first argu-
  618. ment that could not be obtained.  The following values are
  619. defined as standard arguments.    Other values are implementa-
  620. tion dependent.
  621.  
  622.  
  623. -------------------------------------------------------------------
  624. Name              Type    Description
  625. -------------------------------------------------------------------
  626. XlcNName          char*    charset name
  627. XlcNEncodingName      char*    XLFD CharSet Registry and Encoding
  628. XlcNSide          XlcSide    charset side (GL, GR, ...)
  629. XlcNCharSize          int    number of octets per character
  630. XlcNSetSize          int    number of character sets
  631. XlcNControlSequence   char*    control sequence of Compound Text
  632. -------------------------------------------------------------------
  633.  
  634.  
  635.  
  636. 7.  Converter Functions
  637.  
  638. We provide a set of the common converter APIs, that are
  639. independent from both of source and destination text type.
  640.  
  641.  
  642. typedef struct _XlcConvRec *XlcConv;
  643.  
  644. typedef void (*XlcCloseConverterProc)(conv);
  645.       XlcConv conv;
  646.  
  647. typedef int (*XlcConvertProc)(conv, from, from_left, to, to_left, args, num_args);
  648.       XlcConv conv;
  649.       XPointer *from;
  650.       int *from_left;
  651.       XPointer *to;
  652.       int *to_left;
  653.       XPointer *args;
  654.       int num_args;
  655.  
  656.  
  657.  
  658.                   7
  659.  
  660.  
  661.  
  662.  
  663.  
  664. Sample Implementation Frame Work        X11, Release 6.4
  665.  
  666.  
  667. typedef void (*XlcResetConverterProc)(conv);
  668.       XlcConv conv;
  669.  
  670. typedef struct _XlcConvMethodsRec {
  671.       XlcCloseConverterProc close;
  672.       XlcConvertProc convert;
  673.       XlcResetConverterProc reset;
  674. } XlcConvMethodsRec, *XlcConvMethods;
  675.  
  676. typedef struct _XlcConvRec {
  677.     XlcConvMethods methods;
  678.     XPointer state;
  679. } XlcConvRec;
  680.  
  681.  
  682.  
  683. Open a converter
  684.  
  685.  
  686. XlcConv _XlcOpenConverter(from_lcd, from_type, to_lcd, to_type)
  687.       XLCd from_lcd;
  688.       char *from_type;
  689.       XLCd to_lcd;
  690.       char *to_type;
  691.  
  692.  
  693. _XlcOpenConverter function opens the converter which con-
  694. verts a text from specified ``from_type'' to specified
  695. ``to_type'' encoding.  If the function cannot find proper
  696. converter or cannot open a corresponding converter, it
  697. returns NULL.  Otherwise, it returns the conversion descrip-
  698. tor.
  699.  
  700. The following types are pre-defined. Other types are imple-
  701. mentation dependent.
  702.  
  703.  
  704. -----------------------------------------------------------
  705. Name           Type        Description    Arguments
  706. -----------------------------------------------------------
  707. XlcNMultiByte       char *      multibyte    -
  708. XlcNWideChar       wchar_t *   wide character    -
  709. XlcNCompoundText   char *      COMPOUND_TEXT    -
  710. XlcNString       char *      STRING        -
  711. XlcNCharSet       char *      per charset    XlcCharSet
  712. XlcNChar       char *      per character    XlcCharSet
  713. -----------------------------------------------------------
  714.  
  715.  
  716.  
  717. Close a converter
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.                   8
  725.  
  726.  
  727.  
  728.  
  729.  
  730. Sample Implementation Frame Work        X11, Release 6.4
  731.  
  732.  
  733. void _XlcCloseConverter(conv)
  734.       XlcConv conv;
  735.  
  736.  
  737. The _XlcCloseConverter function closes the specified con-
  738. verter ``conv''.
  739.  
  740.  
  741. Code conversion
  742.  
  743.  
  744. int _XlcConvert(conv, from, from_left, to, to_left, args, num_args)
  745.       XlcConv conv;
  746.       XPointer *from;
  747.       int *from_left;
  748.       XPointer *to;
  749.       int *to_left;
  750.       XPointer *args;
  751.       int num_args;
  752.  
  753.  
  754. The _XlcConvert function converts a sequence of characters
  755. from one type, in the array specified by ``from'', into a
  756. sequence of corresponding characters in another type, in the
  757. array specified by ``to''.  The types are those specified in
  758. the _XlcOpenConverter() call that returned the conversion
  759. descriptor, ``conv''.  The arguments ``from'',
  760. ``from_left'', ``to'' and ``to_left'' have the same specifi-
  761. cation of XPG4 iconv function.
  762.  
  763. For state-dependent encodings, the conversion descriptor
  764. ``conv'' is placed into its initial shift state by a call
  765. for which ``from'' is a NULL pointer, or for which ``from''
  766. points to a null pointer.
  767.  
  768. The following 2 converters prepared by locale returns appro-
  769. priate charset (XlcCharSet) in an area pointed by args[0].
  770.  
  771.  
  772. ---------------------------------------------------------
  773. From        To          Description
  774. ---------------------------------------------------------
  775. XlcNMultiByte    XlcNCharSet   Segmentation (Decomposing)
  776. XlcNWideChar    XlcNCharSet   Segmentation (Decomposing)
  777. ---------------------------------------------------------
  778.  
  779.  
  780. The conversion, from XlcNMultiByte/XlcNWideChar to XlcN-
  781. CharSet, extracts a segment which has same charset encoding
  782. characters.  More than one segment cannot be converted in a
  783. call.
  784.  
  785.  
  786. Reset a converter
  787.  
  788.  
  789.  
  790.                   9
  791.  
  792.  
  793.  
  794.  
  795.  
  796. Sample Implementation Frame Work        X11, Release 6.4
  797.  
  798.  
  799. void _XlcResetConverter(conv)
  800.       XlcConv conv;
  801.  
  802.  
  803. The _XlcResetConverter function reset the specified con-
  804. verter ``conv''.
  805.  
  806.  
  807. Register a converter
  808.  
  809.  
  810. typedef XlcConv (*XlcOpenConverterProc)(from_lcd, from_type, to_lcd, to_type);
  811.       XLCd from_lcd;
  812.       char *from_type;
  813.       XLCd to_lcd;
  814.       char *to_type;
  815.  
  816.  
  817.  
  818. Bool _XlcSetConverter(from_lcd, from, to_lcd, to, converter)
  819.       XLCd from_lcd;
  820.       char *from;
  821.       XLCd to_lcd;
  822.       char *to;
  823.       XlcOpenConverterProc converter;
  824.  
  825.  
  826. The XlcSetConverter function registers a converter which
  827. convert from ``from_type'' to ``to_type'' into the converter
  828. list (in the specified XLCd).
  829.  
  830.  
  831. 8.  X Locale Database functions
  832.  
  833. X Locale Database contains the subset of user's environment
  834. that depends on language.  The following APIs are provided
  835. for accessing X Locale Database and other locale relative
  836. files.
  837.  
  838. For more detail about  X Locale Database, please refer X
  839. Locale Database Definition document.
  840.  
  841.  
  842. Get a resource from database
  843.  
  844.  
  845. void _XlcGetResource(lcd, category, class, value, count)
  846.       XLCd lcd;
  847.       char *category;
  848.       char *class;
  849.       char ***value;
  850.       int *count;
  851.  
  852.  
  853.  
  854.  
  855.  
  856.                  10
  857.  
  858.  
  859.  
  860.  
  861.  
  862. Sample Implementation Frame Work        X11, Release 6.4
  863.  
  864.  
  865. The _XlcGetResource function obtains a locale dependent data
  866. which is associated with the locale of specified ``lcd''.
  867. The locale data is provided by system locale or by X Locale
  868. Database file, and what kind of data is available is imple-
  869. mentation dependent.
  870.  
  871. The specified ``category'' and ``class'' are used for find-
  872. ing out the objective locale data.
  873.  
  874. The returned  value is returned in value argument in string
  875. list form, and the returned count shows the number of
  876. strings in the value.
  877.  
  878. The returned value is owned by locale method, and should not
  879. be modified or freed by caller.
  880.  
  881.  
  882. Get a locale relative file name
  883.  
  884.  
  885. char * _XlcFileName(lcd, category)
  886.       XLCd lcd;
  887.       char *category;
  888.  
  889.  
  890. The _XlcFileName functions returns a file name which is
  891. bound to the specified ``lcd'' and ``category'', as a null-
  892. terminated string.  If no file name can be found, or there
  893. is no readable file for the found file name, _XlcFileName
  894. returns NULL.  The returned file name should be freed by
  895. caller.
  896.  
  897. The rule for searching a file name is implementation depen-
  898. dent.  In current implementation, _XlcFileName uses ``{cate-
  899. gory}.dir'' file as mapping table, which has pairs of
  900. strings, a full locale name and a corresponding file name.
  901.  
  902.  
  903. 9.  Utility Functions
  904.  
  905. Compare Latin-1 strings
  906.  
  907.  
  908. int _XlcCompareISOLatin1(str1, str2)
  909.       char *str1, *str2;
  910.  
  911.  
  912. int _XlcNCompareISOLatin1(str1, str2, len)
  913.       char *str1, *str2;
  914.       int len;
  915.  
  916.  
  917. The _XlcCompareIsoLatin1 function to compares two ISO-8859-1
  918. strings.  Bytes representing ASCII lower case letters are
  919.  
  920.  
  921.  
  922.                  11
  923.  
  924.  
  925.  
  926.  
  927.  
  928. Sample Implementation Frame Work        X11, Release 6.4
  929.  
  930.  
  931. converted to upper case before making the comparison.  The
  932. value returned is an integer less than, equal to, or greater
  933. than zero, depending on whether ``str1'' is lexicographicly
  934. less than, equal to, or greater than ``str2''.
  935.  
  936. The _XlcNCompareIsoLatin1 function is identical to _XlcCom-
  937. pareISOLatin1, except that at most ``len'' bytes are com-
  938. pared.
  939.  
  940.  
  941. Resource Utility
  942.  
  943.  
  944. int XlcNumber(array)
  945.       ArrayType array;
  946.  
  947.  
  948. Similar to XtNumber.
  949.  
  950.  
  951. void _XlcCopyFromArg(src, dst, size)
  952.       char *src;
  953.       char *dst;
  954.       int size;
  955.  
  956.  
  957. void _XlcCopyToArg(src, dst, size)
  958.       char *src;
  959.       char **dst;
  960.       int size;
  961.  
  962.  
  963. Similar to _XtCopyFromArg and _XtCopyToArg.
  964.  
  965.  
  966. void _XlcCountVaList(var, count_ret)
  967.       va_list var;
  968.       int *count_ret;
  969.  
  970.  
  971. Similar to _XtCountVaList.
  972.  
  973.  
  974. void _XlcVaToArgList(var, count, args_ret)
  975.       va_list var;
  976.       int count;
  977.       XlcArgList *args_ret;
  978.  
  979.  
  980. Similar to _XtVaToArgList.
  981.  
  982.  
  983. typedef struct _XlcResource {
  984.       char *name;
  985.  
  986.  
  987.  
  988.                  12
  989.  
  990.  
  991.  
  992.  
  993.  
  994. Sample Implementation Frame Work        X11, Release 6.4
  995.  
  996.  
  997.       XrmQuark xrm_name;
  998.       int size;
  999.       int offset;
  1000.       unsigned long mask;
  1001. } XlcResource, *XlcResourceList;
  1002.  
  1003.  
  1004.  
  1005. #define   XlcCreateMask      (1L<<0)
  1006. #define   XlcDefaultMask     (1L<<1)
  1007. #define   XlcGetMask         (1L<<2)
  1008. #define   XlcSetMask         (1L<<3)
  1009. #define   XlcIgnoreMask      (1L<<4)
  1010.  
  1011.  
  1012.  
  1013. void _XlcCompileResourceList(resources, num_resources)
  1014.       XlcResourceList resources;
  1015.       int num_resources;
  1016.  
  1017.  
  1018. Similar to _XtCompileResourceList.
  1019.  
  1020.  
  1021. char * _XlcGetValues(base, resources, num_resources, args, num_args, mask)
  1022.       XPointer base;
  1023.       XlcResourceList resources;
  1024.       int num_resources;
  1025.       XlcArgList args;
  1026.       int num_args;
  1027.       unsigned long mask;
  1028.  
  1029.  
  1030. Similar to XtGetSubvalues.
  1031.  
  1032.  
  1033. char * _XlcSetValues(base, resources, num_resources, args, num_args, mask)
  1034.       XPointer base;
  1035.       XlcResourceList resources;
  1036.       int num_resources;
  1037.       XlcArgList args;
  1038.       int num_args;
  1039.       unsigned long mask;
  1040.  
  1041.  
  1042. Similar to XtSetSubvalues.
  1043.  
  1044.  
  1045. ANSI C Compatible Functions
  1046.  
  1047. The following are ANSI C/MSE Compatible Functions for non-
  1048. ANSI C environment.
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.                  13
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060. Sample Implementation Frame Work        X11, Release 6.4
  1061.  
  1062.  
  1063. int _Xmblen(str, len)
  1064.       char *str;
  1065.       int len;
  1066.  
  1067.  
  1068. The _Xmblen function returns the number of characters
  1069. pointed to by ``str''.    Only ``len'' bytes in ``str'' are
  1070. used in determining the character count returned.  ``Str''
  1071. may point at characters from any valid codeset in the cur-
  1072. rent locale.
  1073.  
  1074. The call _Xmblen is equivalent to
  1075.      _Xmbtowc(_Xmbtowc((wchar_t*)NULL, str, len))
  1076.  
  1077.  
  1078. int _Xmbtowc(wstr, str, len)
  1079.       wchar_t *wstr;
  1080.       char *str;
  1081.       int len;
  1082.  
  1083.  
  1084. The _Xmbtowc function converts the character(s) pointed to
  1085. by ``str'' to their wide character representation(s) pointed
  1086. to by ``wstr''.  ``Len'' is the number of bytes in ``str''
  1087. to be converted.  The return value is the number of charac-
  1088. ters converted.
  1089.  
  1090. The call _Xmbtowc is equivalent to
  1091.      _Xlcmbtowc((XLCd)NULL, wstr, str, len)
  1092.  
  1093.  
  1094. int _Xlcmbtowc(lcd, wstr, str, len)
  1095.       XLCd lcd;
  1096.       wchar_t *wstr;
  1097.       char *str;
  1098.       int len;
  1099.  
  1100.  
  1101. The _Xlcmbtowc function is identical to _Xmbtowc, except
  1102. that it requires the ``lcd'' argument.    If ``lcd'' is (XLCd)
  1103. NULL, _Xlcmbtowc, calls _XlcCurrentLC to determine the cur-
  1104. rent locale.
  1105.  
  1106.  
  1107. int _Xwctomb(str, wc)
  1108.       char *str;
  1109.       wchar_t wc;
  1110.  
  1111.  
  1112. The _Xwctomb function converts a single wide character
  1113. pointed to by ``wc'' to its multibyte representation pointed
  1114. to by ``str''.    On success, the return value is 1.
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.                  14
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126. Sample Implementation Frame Work        X11, Release 6.4
  1127.  
  1128.  
  1129. The call _Xwctomb is equivalent to
  1130.      _Xlcwctomb((XLCd)NULL, str, wstr)
  1131.  
  1132.  
  1133. int _Xlcwctomb(lcd, str, wc)
  1134.       XLCd lcd;
  1135.       char *str;
  1136.       wchar_t wc;
  1137.  
  1138.  
  1139. The _Xlcwctomb function is identical to _Xwctomb, except
  1140. that it requires the ``lcd'' argument.    If ``lcd'' is (XLCd)
  1141. NULL, _Xlcwctomb, calls _XlcCurrentLC to determine the cur-
  1142. rent locale.
  1143.  
  1144.  
  1145. int _Xmbstowcs(wstr, str, len)
  1146.       wchar_t *wstr;
  1147.       char *str;
  1148.       int len;
  1149.  
  1150.  
  1151. The _Xmbstowcs function converts the NULL-terminated string
  1152. pointed to by ``str'' to its wide character string represen-
  1153. tation pointed to by ``wstr''.    ``Len'' is the number of
  1154. characters in ``str'' to be converted.
  1155.  
  1156. The call _Xmbstowcs is equivalent to
  1157.      _Xlcmbstowcs((XLCd)NULL, wstr, str, len)
  1158.  
  1159.  
  1160. int _Xlcmbstowcs(lcd, wstr, str, len)
  1161.       XLCd lcd;
  1162.       wchar_t *wstr;
  1163.       char *str;
  1164.       int len;
  1165.  
  1166.  
  1167. The _Xlcmbstowcs function is identical to _Xmbstowcs, except
  1168. that it requires the ``lcd'' argument.    If ``lcd'' is (XLCd)
  1169. NULL, _Xlcmbstowcs, calls _XlcCurrentLC to determine the
  1170. current locale.
  1171.  
  1172.  
  1173. int _Xwcstombs(str, wstr, len)
  1174.       char *str;
  1175.       wchar_t *wstr;
  1176.       int len;
  1177.  
  1178.  
  1179. The _Xwcstombs function converts the (wchar_t) NULL termi-
  1180. nated wide character string pointed to by ``wstr'' to the
  1181. NULL terminated multibyte string pointed to by ``str''.
  1182.  
  1183.  
  1184.  
  1185.  
  1186.                  15
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192. Sample Implementation Frame Work        X11, Release 6.4
  1193.  
  1194.  
  1195. The call _Xwcstombs is equivalent to
  1196.      _Xlcwcstombs((XLCd)NULL, str, wstr, len)
  1197.  
  1198.  
  1199. int _Xlcwcstombs(lcd, str, wstr, len)
  1200.       XLCd lcd;
  1201.       char *str;
  1202.       wchar_t *wstr;
  1203.       int len;
  1204.  
  1205.  
  1206. The _Xlcwcstombs function is identical to _Xwcstombs, except
  1207. that it requires the ``lcd'' argument.    If ``lcd'' is (XLCd)
  1208. NULL, _Xlcwcstombs, calls _XlcCurrentLC to determine the
  1209. current locale.
  1210.  
  1211.  
  1212. int _Xwcslen(wstr)
  1213.       wchar_t *wstr;
  1214.  
  1215.  
  1216. The _Xwcslen function returns the count of wide characters
  1217. in the (wchar_t) NULL terminated wide character string
  1218. pointed to by ``wstr''.
  1219.  
  1220.  
  1221. wchar_t * _Xwcscpy(wstr1, wstr2)
  1222.       wchar_t *wstr1, *wstr2;
  1223.  
  1224.  
  1225. wchar_t * _Xwcsncpy(wstr1, wstr2, len)
  1226.       wchar_t *wstr1, *wstr2;
  1227.       int len;
  1228.  
  1229.  
  1230. The _Xwcscpy function copies the (wchar_t) NULL terminated
  1231. wide character string pointed to by ``wstr2'' to the object
  1232. pointed at by ``wstr1''.  ``Wstr1'' is (wchar_t) NULL termi-
  1233. nated.    The return value is a pointer to ``wstr1''.
  1234.  
  1235. The _Xwcsncpy function is identical to _Xwcscpy, except that
  1236. it copies ``len'' wide characters from the object pointed to
  1237. by ``wstr2'' to the object pointed to ``wstr1''.
  1238.  
  1239.  
  1240. int _Xwcscmp(wstr1, wstr2)
  1241.       wchar_t *wstr1, *wstr2;
  1242.  
  1243.  
  1244. int _Xwcsncmp(wstr1, wstr2, len)
  1245.       wchar_t *wstr1, *wstr2;
  1246.       int len;
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.                  16
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258. Sample Implementation Frame Work        X11, Release 6.4
  1259.  
  1260.  
  1261. The _Xwcscmp function  compares two (wchar_t) NULL termi-
  1262. nated wide character strings.  The value returned is an
  1263. integer less than, equal to, or greater than zero, depending
  1264. on whether ``wstr1'' is lexicographicly less then, equal to,
  1265. or greater than ``str2''.
  1266.  
  1267. The _Xwcsncmp function is identical to _XlcCompareISOLatin1,
  1268. except that at most ``len'' wide characters are compared.
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.                  17
  1319.  
  1320.  
  1321.