framework.xml revision 9c019ec5
1<?xml version="1.0" encoding="UTF-8" ?> 2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" 3 "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" 4[ 5<!ENTITY % defs SYSTEM "defs.ent"> %defs; 6]> 7 8<book id="framework"> 9 10<bookinfo> 11 <title>X11R6 Sample Implementation Frame Work</title> 12 <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo> 13 <authorgroup> 14 <othercredit> 15 <firstname>Katsuhisa</firstname><surname>Yano</surname> 16 <affiliation><orgname>TOSHIBA Corporation</orgname></affiliation> 17 </othercredit> 18 <othercredit> 19 <firstname>Yoshio</firstname><surname>Horiuchi</surname> 20 <affiliation><orgname>IBM Japan</orgname></affiliation> 21 </othercredit> 22 </authorgroup> 23 <copyright><year>1994</year> 24 <holder>TOSHIBA Corporation</holder> 25 <holder>IBM Corporation</holder> 26 </copyright> 27 28<legalnotice> 29 30<para> 31Permission to use, copy, modify, and distribute this documentation for any purpose and without fee is hereby granted, 32provided that the above copyright notice and this permission notice appear in all copies. TOSHIBA Corporation and 33IBM Corporation make no representations about the suitability for any purpose of the information in this document. 34This documentation is provided as is without express or implied warranty. 35</para> 36 37<para role="multiLicensing">Copyright © 1994 X Consortium</para> 38<para> 39Permission is hereby granted, free of charge, to any person obtaining a copy 40of this software and associated documentation files 41(the "Software"), to deal in the Software without restriction, 42including without limitation the rights to use, copy, modify, merge, publish, 43distribute, sublicense, and/or sell copies of the Software, and to permit 44persons to whom the Software is furnished to do so, subject to the following 45conditions: 46</para> 47 48<para> 49The above copyright notice and this permission notice shall be included in all 50copies or substantial portions of the Software. 51</para> 52 53<para> 54THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 55EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 56MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 57NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 58LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 59OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 60THE SOFTWARE. 61</para> 62 63<para> 64Except as contained in this notice, the name of X Consortium shall not 65be used in advertising or otherwise to promote the sale, use or other dealings 66in this Software without prior written authorization from X Consortium. 67</para> 68 69<para>X Window System is a trademark of The Open Group.</para> 70 71</legalnotice> 72</bookinfo> 73 74<chapter id='Framework'> 75<title>Framework</title> 76<sect1 id='Preface'> 77<title>Preface</title> 78<para> 79This document proposes to define the structures, methods and their 80signatures that are expected to be common to all locale dependent 81functions within the Xlib sample implementation. The following 82illustration (Fig.1) <!-- xref --> is proposed to outline the separating of 83the components within the sample implementation. 84</para> 85 86<para> 87Preface drawing. 88</para> 89 90<mediaobject id="framework_locale_service_api_proposal"> 91 <imageobject> 92 <imagedata width="540px" depth="530px" contentwidth="560px" contentdepth="550px" format="SVG" fileref="framework.svg"/> 93 </imageobject> 94 <caption>Frame work of Locale Service API Proposal</caption> 95</mediaobject> 96 97<para> 98Generally speaking, the internationalized portion of Xlib (Locale 99Dependent X, LDX) consists of three objects; 100locale (LC) , input method (IM) and output method (OM). 101The LC provides a set of information that depends on user's language 102environment. The IM manages text inputing, and the OM manages text 103drawing. Both IM and OM highly depend on LC data. 104</para> 105 106<para> 107In X11R5, there are two sample implementations, Ximp and Xsi, for 108Xlib internationalization. But in both implementations, IM and OM 109actually refer the private extension of LC. It breaks coexistence 110of these two sample implementations. For example, if a user creates 111a new OM for special purpose as a part of Ximp, it will not work with 112Xsi. 113</para> 114 115<para> 116As a solution of this problem, we propose to define the standard 117APIs between these three objects, and define the structure that are 118common to these objects. 119</para> 120</sect1> 121 122<sect1 id="Objective"> 123<title>Objective</title> 124 125<itemizedlist> 126 <listitem> 127 <para> 128Explain the current X11R6 sample implementation 129 </para> 130 </listitem> 131 <listitem> 132 <para> 133Document the common set of locale dependent interfaces 134 </para> 135 </listitem> 136 <listitem> 137 <para> 138Provide more flexible pluggable layer 139 </para> 140 </listitem> 141</itemizedlist> 142</sect1> 143 144<sect1 id="Locale_Object_Binding_Functions"> 145<title>Locale Object Binding Functions</title> 146<!-- .XS (SN Locale Object Binding Functions --> 147<!-- .XE --> 148<para> 149This chapter describes functions related locale object binding for 150implementing the pluggable layer. 151</para> 152 153<para> 154A locale loader is an entry point for locale object, which 155instantiates XLCd object and binds locale methods with specified 156locale name. The behavior of loader is implementation dependent. 157And, what kind of loaders are available is also implementation 158dependent. 159</para> 160 161<para> 162<!-- .LP --> 163The loader is called in 164<function>_XOpenLC, </function> 165but caller of 166<xref linkend='_XOpenLC' xrefstyle='select: title'/> 167does not need to care about its inside. For example, if the loader is 168implemented with dynamic load functions, and the dynamic module is 169expected to be unloaded when the corresponding XLCd is freed, 170close methods of XLCdMethods should handle unloading. 171</para> 172 173<para> 174<emphasis role="bold">Initializing a locale loader list</emphasis> 175</para> 176 177<para>void _XlcInitLoader</para> 178 179 180<para> 181The 182<function>_XlcInitLoader</function> 183function initializes the locale loader list with vendor specific 184manner. Each loader is registered with calling 185<function>_XlcAddLoader.</function> 186The number of loaders and their order in the loader list is 187implementation dependent. 188</para> 189 190<para> 191<emphasis role="bold">Add a loader</emphasis> 192</para> 193 194<literallayout> 195typedef XLCd (*XLCdLoadProc)(<emphasis remap='I'>name</emphasis>); 196 char <emphasis remap='I'>*name</emphasis>; 197 198typedef int XlcPosition; 199 200#define XlcHead 201#define XlcTail 202</literallayout> 203 204<funcsynopsis id='_XlcAddLoader'> 205<funcprototype> 206 <funcdef>Bool <function> _XlcAddLoader</function></funcdef> 207 <paramdef>XLCdLoadProc<parameter> proc</parameter></paramdef> 208 <paramdef>XlcPosition<parameter> position</parameter></paramdef> 209</funcprototype> 210</funcsynopsis> 211 212<para> 213The 214<xref linkend='_XlcAddLoader' xrefstyle='select: title'/> 215function registers the specified locale loader "<emphasis remap='I'>proc</emphasis>" to the 216internal loader list. The position specifies that the loader 217"<emphasis remap='I'>proc</emphasis>" should be placed in the top of the loader list(XlcHead) 218or last(XlcTail). 219</para> 220 221<para> 222The object loader is called from the top of the loader list in order, 223when calling time. 224</para> 225 226<para> 227<function>Remove a loader</function> 228</para> 229 230<funcsynopsis id='_XlcRemoveLoader'> 231<funcprototype> 232 <funcdef>void <function> _XlcRemoveLoader</function></funcdef> 233 <paramdef>XLCdLoadProc<parameter> proc</parameter></paramdef> 234</funcprototype> 235</funcsynopsis> 236 237<para> 238The 239<xref linkend='_XlcRemoveLoader' xrefstyle='select: title'/> 240function removes the locale loader specified by "<emphasis remap='I'>proc</emphasis>" from the 241loader list. 242</para> 243 244<para> 245Current implementation provides following locale loaders; 246</para> 247 248<literallayout> 249<function>_XlcDefaultLoader</function> 250<function>_XlcGenericLoader</function> 251<function>_XlcUtfLoader</function> 252<function>_XaixOsDynamicLoad</function> 253</literallayout> 254 255</sect1> 256 257<sect1 id="Locale_Method_Interface"> 258<title>Locale Method Interface</title> 259 260<para> 261This chapter describes the locale method API, which is a set of 262accessible functions from both IM and OM parts. 263The locale method API provides the functionalities; obtaining locale 264dependent information, handling charset, converting text, etc. 265</para> 266 267<para> 268As a result of using these APIs instead of accessing vendor private 269extension of the locale object, we can keep locale, IM and OM 270independently each other. 271</para> 272 273</sect1> 274 275<sect1 id="Locale_Method_Functions"> 276<title>Locale Method Functions</title> 277<para> 278<function>Open a Locale Method</function> 279</para> 280 281<funcsynopsis id='_XOpenLC'> 282<funcprototype> 283 <funcdef>XLCd <function> _XOpenLC</function></funcdef> 284 <paramdef>char<parameter> *name</parameter></paramdef> 285</funcprototype> 286</funcsynopsis> 287 288<para> 289The 290<xref linkend='_XOpenLC' xrefstyle='select: title'/> 291function opens a locale method which corresponds to the 292specified locale name. 293<xref linkend='_XOpenLC' xrefstyle='select: title'/> 294calls a locale object loader, which is registered via 295<function>_XlcAddLoader into the internal loader list. If the called loader </function> 296is valid and successfully opens a locale, 297<xref linkend='_XOpenLC' xrefstyle='select: title'/> 298returns the XLCd. If the loader is invalid or failed to open a locale, 299<xref linkend='_XOpenLC' xrefstyle='select: title'/> 300calls the next loader. If all registered loaders cannot open a locale, 301<xref linkend='_XOpenLC' xrefstyle='select: title'/> 302returns NULL. 303</para> 304 305<para>XLCd _XlcCurrentLC</para> 306 307<para> 308The 309<function>_XlcCurrentLC</function> 310function returns an XLCd that are bound to current locale. 311</para> 312 313<para> 314<emphasis role="bold">Close a Locale Method</emphasis> 315</para> 316 317<funcsynopsis id='_XCloseLC'> 318<funcprototype> 319 <funcdef>void <function> _XCloseLC</function></funcdef> 320 <paramdef>XLCd<parameter> lcd</parameter></paramdef> 321</funcprototype> 322</funcsynopsis> 323 324<para> 325<!-- .LP --> 326The 327<xref linkend='_XCloseLC' xrefstyle='select: title'/> 328function close a locale method the specified lcd. 329</para> 330 331<para> 332<emphasis role="bold">Obtain Locale Method values</emphasis> 333</para> 334 335<funcsynopsis id='_XGetLCValues'> 336<funcprototype> 337 <funcdef>char *<function>_XGetLCValues</function></funcdef> 338 <paramdef>XLCd<parameter> lcd</parameter></paramdef> 339</funcprototype> 340</funcsynopsis> 341 342<para> 343The 344<xref linkend='_XGetLCValues' xrefstyle='select: title'/> 345function returns NULL if no error occurred; otherwise, it returns the 346name of the first argument that could not be obtained. 347The following values are defined as standard arguments. Other values 348are implementation dependent. 349</para> 350 351<informaltable frame="topbot"> 352 <?dbfo keep-together="always" ?> 353 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 354 <colspec colname='c1' colwidth="3.0*"/> 355 <colspec colname='c2' colwidth="1.0*"/> 356 <colspec colname='c3' colwidth="3.0*"/> 357 <thead> 358 <row rowsep='1'> 359 <entry>Name</entry> 360 <entry>Type</entry> 361 <entry>Description</entry> 362 </row> 363 </thead> 364 <tbody> 365 <row> 366 <entry>XlcNCodeset</entry> 367 <entry>char*</entry> 368 <entry>codeset part of locale name</entry> 369 </row> 370 <row> 371 <entry>XlcNDefaultString</entry> 372 <entry>char*</entry> 373 <entry>XDefaultString()</entry> 374 </row> 375 <row> 376 <entry>XlcNEncodingName</entry> 377 <entry>char*</entry> 378 <entry>encoding name</entry> 379 </row> 380 <row> 381 <entry>XlcNLanguage</entry> 382 <entry>char*</entry> 383 <entry>language part of locale name</entry> 384 </row> 385 <row> 386 <entry>XlcNMbCurMax</entry> 387 <entry>int</entry> 388 <entry>ANSI C MB_CUR_MAX</entry> 389 </row> 390 <row> 391 <entry>XlcNStateDependentEncoding</entry> 392 <entry>Bool</entry> 393 <entry>is state-dependent encoding or not</entry> 394 </row> 395 <row> 396 <entry>XlcNTerritory</entry> 397 <entry>char*</entry> 398 <entry>territory part of locale name</entry> 399 </row> 400 </tbody> 401 </tgroup> 402</informaltable> 403 404</sect1> 405 406<sect1 id="Charset_functions"> 407<title>Charset functions</title> 408<para> 409The XlcCharSet is an identifier which represents a subset of characters 410(character set) in the locale object. 411</para> 412 413<literallayout class="monospaced"> 414typedef enum { 415 XlcUnknown, XlcC0, XlcGL, XlcC1, XlcGR, XlcGLGR, XlcOther 416} XlcSide; 417 418typedef struct _XlcCharSetRec *XlcCharSet; 419 420typedef struct { 421 char *name; 422 XPointer value; 423} XlcArg, *XlcArgList; 424 425typedef char* (*XlcGetCSValuesProc)(<emphasis remap='I'>charset</emphasis>, <emphasis remap='I'>args</emphasis>, <emphasis remap='I'>num_args</emphasis>); 426 XlcCharSet <emphasis remap='I'>charset</emphasis>; 427 XlcArgList <emphasis remap='I'>args</emphasis>; 428 int <emphasis remap='I'>num_args</emphasis>; 429 430typedef struct _XlcCharSetRec { 431 char *name; 432 XrmQuark xrm_name; 433 char *encoding_name; 434 XrmQuark xrm_encoding_name; 435 XlcSide side; 436 int char_size; 437 int set_size; 438 char *ct_sequence; 439 XlcGetCSValuesProc get_values; 440} XlcCharSetRec; 441</literallayout> 442 443<para> 444<emphasis role="bold">Get an XlcCharSet</emphasis> 445</para> 446 447<funcsynopsis id='_XlcGetCharSet'> 448<funcprototype> 449 <funcdef>XlcCharSet <function> _XlcGetCharSet</function></funcdef> 450 <paramdef>char<parameter> *name</parameter></paramdef> 451</funcprototype> 452</funcsynopsis> 453 454<para> 455The 456<xref linkend='_XlcGetCharSet' xrefstyle='select: title'/> 457function gets an XlcCharSet which corresponds to the charset name 458specified by "<emphasis remap='I'>name</emphasis>". 459<xref linkend='_XlcGetCharSet' xrefstyle='select: title'/> 460returns NULL, if no XlcCharSet bound to specified "<emphasis remap='I'>name</emphasis>". 461</para> 462 463<para> 464The following character sets are pre-registered. 465</para> 466 467<informaltable frame="topbot"> 468 <?dbfo keep-together="auto" ?> 469 <tgroup cols='2' align='left' colsep='0' rowsep='0'> 470 <colspec colname='c1' colwidth="1.0*"/> 471 <colspec colname='c2' colwidth="2.0*"/> 472 <thead> 473 <row rowsep='1'> 474 <entry>Name</entry> 475 <entry>Description</entry> 476 </row> 477 </thead> 478 <tbody> 479 <row> 480 <entry>ISO8859-1:GL</entry> 481 <entry>7-bit ASCII graphics (ANSI X3.4-1968),</entry> 482 </row> 483 <row> 484 <entry></entry> 485 <entry>Left half of ISO 8859 sets</entry> 486 </row> 487 <row> 488 <entry>JISX0201.1976-0:GL</entry> 489 <entry>Left half of JIS X0201-1976 (reaffirmed 1984),</entry> 490 </row> 491 <row> 492 <entry></entry> 493 <entry>8-Bit Alphanumeric-Katakana Code</entry> 494 </row> 495 <row> 496 <entry>ISO8859-1:GR</entry> 497 <entry>Right half of ISO 8859-1, Latin alphabet No. 1</entry> 498 </row> 499 <row> 500 <entry>ISO8859-2:GR</entry> 501 <entry>Right half of ISO 8859-2, Latin alphabet No. 2</entry> 502 </row> 503 <row> 504 <entry>ISO8859-3:GR</entry> 505 <entry>Right half of ISO 8859-3, Latin alphabet No. 3</entry> 506 </row> 507 <row> 508 <entry>ISO8859-4:GR</entry> 509 <entry>Right half of ISO 8859-4, Latin alphabet No. 4</entry> 510 </row> 511 <row> 512 <entry>ISO8859-7:GR</entry> 513 <entry>Right half of ISO 8859-7, Latin/Greek alphabet</entry> 514 </row> 515 <row> 516 <entry>ISO8859-6:GR</entry> 517 <entry>Right half of ISO 8859-6, Latin/Arabic alphabet</entry> 518 </row> 519 <row> 520 <entry>ISO8859-8:GR</entry> 521 <entry>Right half of ISO 8859-8, Latin/Hebrew alphabet</entry> 522 </row> 523 <row> 524 <entry>ISO8859-5:GR</entry> 525 <entry>Right half of ISO 8859-5, Latin/Cyrillic alphabet</entry> 526 </row> 527 <row> 528 <entry>ISO8859-9:GR</entry> 529 <entry>Right half of ISO 8859-9, Latin alphabet No. 5</entry> 530 </row> 531 <row> 532 <entry>JISX0201.1976-0:GR</entry> 533 <entry>Right half of JIS X0201-1976 (reaffirmed 1984),</entry> 534 </row> 535 <row> 536 <entry></entry> 537 <entry>8-Bit Alphanumeric-Katakana Code</entry> 538 </row> 539 <row> 540 <entry>GB2312.1980-0:GL</entry> 541 <entry>GB2312-1980, China (PRC) Hanzi defined as GL</entry> 542 </row> 543 <row> 544 <entry>GB2312.1980-0:GR</entry> 545 <entry>GB2312-1980, China (PRC) Hanzi defined as GR</entry> 546 </row> 547 <row> 548 <entry>JISX0208.1983-0:GL</entry> 549 <entry>JIS X0208-1983, Japanese Graphic Character Set</entry> 550 </row> 551 <row> 552 <entry></entry> 553 <entry>defined as GL</entry> 554 </row> 555 <row> 556 <entry>JISX0208.1983-0:GR</entry> 557 <entry>JIS X0208-1983, Japanese Graphic Character Set</entry> 558 </row> 559 <row> 560 <entry></entry> 561 <entry>defined as GR</entry> 562 </row> 563 <row> 564 <entry>KSC5601.1987-0:GL</entry> 565 <entry>KS C5601-1987, Korean Graphic Character Set</entry> 566 </row> 567 <row> 568 <entry></entry> 569 <entry>defined as GL</entry> 570 </row> 571 <row> 572 <entry>KSC5601.1987-0:GR</entry> 573 <entry>KS C5601-1987, Korean Graphic Character Set</entry> 574 </row> 575 <row> 576 <entry></entry> 577 <entry>defined as GR</entry> 578 </row> 579 <row> 580 <entry>JISX0212.1990-0:GL</entry> 581 <entry>JIS X0212-1990, Japanese Graphic Character Set</entry> 582 </row> 583 <row> 584 <entry></entry> 585 <entry>defined as GL</entry> 586 </row> 587 <row> 588 <entry>JISX0212.1990-0:GR</entry> 589 <entry>JIS X0212-1990, Japanese Graphic Character Set</entry> 590 </row> 591 <row> 592 <entry></entry> 593 <entry>defined as GR</entry> 594 </row> 595 </tbody> 596 </tgroup> 597</informaltable> 598 599<para> 600<emphasis role="bold">Add an XlcCharSet</emphasis> 601</para> 602 603<funcsynopsis id='_XlcAddCharSet'> 604<funcprototype> 605 <funcdef>Bool <function> _XlcAddCharSet</function></funcdef> 606 <paramdef>XlcCharSet<parameter> charset</parameter></paramdef> 607</funcprototype> 608</funcsynopsis> 609 610<para> 611The 612<xref linkend='_XlcAddCharSet' xrefstyle='select: title'/> 613function registers XlcCharSet specified by "<emphasis remap='I'>charset</emphasis>". 614</para> 615 616<para> 617<!-- .LP --> 618<!-- .sp --> 619<function>Obtain Character Set values</function> 620</para> 621 622<funcsynopsis id='_XlcGetCSValues'> 623<funcprototype> 624 <funcdef>char * <function> _XlcGetCSValues</function></funcdef> 625 <paramdef>XlcCharSet<parameter> charset</parameter></paramdef> 626 <paramdef><parameter> ...</parameter></paramdef> 627</funcprototype> 628</funcsynopsis> 629 630<para> 631The 632<xref linkend='_XlcGetCSValues' xrefstyle='select: title'/> 633function returns NULL if no error occurred; 634otherwise, it returns the name of the first argument that could not 635be obtained. The following values are defined as standard arguments. 636Other values are implementation dependent. 637</para> 638 639<informaltable frame="topbot"> 640 <?dbfo keep-together="always" ?> 641 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 642 <colspec colname='c1' colwidth="2.0*"/> 643 <colspec colname='c2' colwidth="1.0*"/> 644 <colspec colname='c3' colwidth="3.0*"/> 645 <thead> 646 <row rowsep='1'> 647 <entry>Name</entry> 648 <entry>Type</entry> 649 <entry>Description</entry> 650 </row> 651 </thead> 652 <tbody> 653 <row> 654 <entry>XlcNName</entry> 655 <entry>char*</entry> 656 <entry>charset name</entry> 657 </row> 658 <row> 659 <entry>XlcNEncodingName</entry> 660 <entry>char*</entry> 661 <entry>XLFD CharSet Registry and Encoding</entry> 662 </row> 663 <row> 664 <entry>XlcNSide</entry> 665 <entry>XlcSide</entry> 666 <entry>charset side (GL, GR, ...)</entry> 667 </row> 668 <row> 669 <entry>XlcNCharSize</entry> 670 <entry>int</entry> 671 <entry>number of octets per character</entry> 672 </row> 673 <row> 674 <entry>XlcNSetSize</entry> 675 <entry>int</entry> 676 <entry>number of character sets</entry> 677 </row> 678 <row> 679 <entry>XlcNControlSequence</entry> 680 <entry>char*</entry> 681 <entry>control sequence of Compound Text</entry> 682 </row> 683 </tbody> 684 </tgroup> 685</informaltable> 686 687</sect1> 688 689<sect1 id="Converter_Functions"> 690<title>Converter Functions</title> 691<para> 692We provide a set of the common converter APIs, that are independent 693from both of source and destination text type. 694</para> 695 696<literallayout class="monospaced"> 697typedef struct _XlcConvRec *XlcConv; 698 699typedef void (*XlcCloseConverterProc)(<emphasis remap='I'>conv</emphasis>); 700 XlcConv <emphasis remap='I'>conv</emphasis>; 701 702typedef int (*XlcConvertProc)(<emphasis remap='I'>conv</emphasis>, <emphasis remap='I'>from</emphasis>, <emphasis remap='I'>from_left</emphasis>, <emphasis remap='I'>to</emphasis>, <emphasis remap='I'>to_left</emphasis>, <emphasis remap='I'>args</emphasis>, <emphasis remap='I'>num_args</emphasis>); 703 XlcConv <emphasis remap='I'>conv</emphasis>; 704 XPointer <emphasis remap='I'>*from</emphasis>; 705 int <emphasis remap='I'>*from_left</emphasis>; 706 XPointer <emphasis remap='I'>*to</emphasis>; 707 int <emphasis remap='I'>*to_left</emphasis>; 708 XPointer <emphasis remap='I'>*args</emphasis>; 709 int <emphasis remap='I'>num_args</emphasis>; 710 711typedef void (*XlcResetConverterProc)(<emphasis remap='I'>conv</emphasis>); 712 XlcConv <emphasis remap='I'>conv</emphasis>; 713 714typedef struct _XlcConvMethodsRec { 715 XlcCloseConverterProc close; 716 XlcConvertProc convert; 717 XlcResetConverterProc reset; 718} XlcConvMethodsRec, *XlcConvMethods; 719 720typedef struct _XlcConvRec { 721 XlcConvMethods methods; 722 XPointer state; 723} XlcConvRec; 724</literallayout> 725 726<para> 727<function>Open a converter</function> 728</para> 729 730<funcsynopsis id='_XlcOpenConverter'> 731<funcprototype> 732 <funcdef>XlcConv <function> _XlcOpenConverter</function></funcdef> 733 <paramdef>XLCd<parameter> from_lcd</parameter></paramdef> 734 <paramdef>char<parameter> *from_type</parameter></paramdef> 735 <paramdef>XLCd<parameter> to_lcd</parameter></paramdef> 736 <paramdef>char<parameter> *to_type</parameter></paramdef> 737</funcprototype> 738</funcsynopsis> 739 740<para> 741<xref linkend='_XlcOpenConverter' xrefstyle='select: title'/> 742function opens the converter which converts a text from specified 743"<emphasis remap='I'>from_type</emphasis>" to specified "<emphasis remap='I'>to_type</emphasis>" encoding. If the 744function cannot find proper converter or cannot open a corresponding 745converter, it returns NULL. Otherwise, it returns the conversion 746descriptor. 747</para> 748 749<para> 750The following types are pre-defined. Other types are implementation 751dependent. 752</para> 753 754<informaltable frame="topbot"> 755 <?dbfo keep-together="always" ?> 756 <tgroup cols='4' align='left' colsep='0' rowsep='0'> 757 <colspec colname='c1' colwidth="2.0*"/> 758 <colspec colname='c2' colwidth="1.0*"/> 759 <colspec colname='c3' colwidth="2.0*"/> 760 <colspec colname='c4' colwidth="3.0*"/> 761 <thead> 762 <row rowsep='1'> 763 <entry>Name</entry> 764 <entry>Type</entry> 765 <entry>Description</entry> 766 <entry>Arguments</entry> 767 </row> 768 </thead> 769 <tbody> 770 <row> 771 <entry>XlcNMultiByte</entry> 772 <entry>char *</entry> 773 <entry>multibyte</entry> 774 <entry>-</entry> 775 </row> 776 <row> 777 <entry>XlcNWideChar</entry> 778 <entry>wchar_t *</entry> 779 <entry>wide character</entry> 780 <entry>-</entry> 781 </row> 782 <row> 783 <entry>XlcNCompoundText</entry> 784 <entry>char *</entry> 785 <entry>COMPOUND_TEXT</entry> 786 <entry>-</entry> 787 </row> 788 <row> 789 <entry>XlcNString</entry> 790 <entry>char *</entry> 791 <entry>STRING</entry> 792 <entry>-</entry> 793 </row> 794 <row> 795 <entry>XlcNCharSet</entry> 796 <entry>char *</entry> 797 <entry>per charset</entry> 798 <entry>XlcCharSet</entry> 799 </row> 800 <row> 801 <entry>XlcNChar</entry> 802 <entry>char *</entry> 803 <entry>per character</entry> 804 <entry>XlcCharSet</entry> 805 </row> 806 </tbody> 807 </tgroup> 808</informaltable> 809 810<para> 811<emphasis role="bold">Close a converter</emphasis> 812</para> 813 814<funcsynopsis id='_XlcCloseConverter'> 815<funcprototype> 816 <funcdef>void <function> _XlcCloseConverter</function></funcdef> 817 <paramdef>XlcConv<parameter> conv</parameter></paramdef> 818</funcprototype> 819</funcsynopsis> 820 821<para> 822The 823<xref linkend='_XlcCloseConverter' xrefstyle='select: title'/> 824function closes the specified converter "<emphasis remap='I'>conv</emphasis>". 825</para> 826 827<para> 828<emphasis role="bold">Code conversion</emphasis> 829</para> 830 831<funcsynopsis id='_XlcConvert'> 832<funcprototype> 833 <funcdef>int <function> _XlcConvert</function></funcdef> 834 <paramdef>XlcConv<parameter> conv</parameter></paramdef> 835 <paramdef>XPointer<parameter> *from</parameter></paramdef> 836 <paramdef>int<parameter> *from_left</parameter></paramdef> 837 <paramdef>XPointer<parameter> *to</parameter></paramdef> 838 <paramdef>int<parameter> *to_left</parameter></paramdef> 839 <paramdef>XPointer<parameter> *args</parameter></paramdef> 840 <paramdef>int<parameter> num_args</parameter></paramdef> 841</funcprototype> 842</funcsynopsis> 843 844<para> 845The 846<xref linkend='_XlcConvert' xrefstyle='select: title'/> 847function converts a sequence of characters from one type, in the array 848specified by "<emphasis remap='I'>from</emphasis>", into a sequence of corresponding characters 849in another type, in the array specified by "<emphasis remap='I'>to</emphasis>". The types are 850those specified in the 851<function>_XlcOpenConverter() </function> 852call that returned the conversion descriptor, "<emphasis remap='I'>conv</emphasis>". 853The arguments "<emphasis remap='I'>from</emphasis>", "<emphasis remap='I'>from_left</emphasis>", "<emphasis remap='I'>to</emphasis>" and 854"<emphasis remap='I'>to_left</emphasis>" have the same specification of XPG4 iconv function. 855</para> 856 857<para> 858For state-dependent encodings, the conversion descriptor "<emphasis remap='I'>conv</emphasis>" 859is placed into its initial shift state by a call for which "<emphasis remap='I'>from</emphasis>" 860is a NULL pointer, or for which "<emphasis remap='I'>from</emphasis>" points to a null pointer. 861</para> 862 863<para> 864The following 2 converters prepared by locale returns appropriate 865charset (XlcCharSet) in an area pointed by args[0]. 866</para> 867 868<informaltable frame="topbot"> 869 <?dbfo keep-together="always" ?> 870 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 871 <colspec colname='c1' colwidth="1.0*"/> 872 <colspec colname='c2' colwidth="1.0*"/> 873 <colspec colname='c3' colwidth="2.0*"/> 874 <thead> 875 <row rowsep='1'> 876 <entry>From</entry> 877 <entry>To</entry> 878 <entry>Description</entry> 879 </row> 880 </thead> 881 <tbody> 882 <row> 883 <entry>XlcNMultiByte</entry> 884 <entry>XlcNCharSet</entry> 885 <entry>Segmentation (Decomposing)</entry> 886 </row> 887 <row> 888 <entry>XlcNWideChar</entry> 889 <entry>XlcNCharSet</entry> 890 <entry>Segmentation (Decomposing)</entry> 891 </row> 892 </tbody> 893 </tgroup> 894</informaltable> 895 896<para> 897The conversion, from XlcNMultiByte/XlcNWideChar to XlcNCharSet, 898extracts a segment which has same charset encoding characters. 899More than one segment cannot be converted in a call. 900</para> 901 902<para> 903<emphasis role="bold">Reset a converter</emphasis> 904</para> 905 906<funcsynopsis id='_XlcResetConverter'> 907<funcprototype> 908 <funcdef>void <function> _XlcResetConverter</function></funcdef> 909 <paramdef>XlcConv<parameter> conv</parameter></paramdef> 910</funcprototype> 911</funcsynopsis> 912 913<para> 914The 915<xref linkend='_XlcResetConverter' xrefstyle='select: title'/> 916function reset the specified converter "<emphasis remap='I'>conv</emphasis>". 917</para> 918 919<para> 920<emphasis role="bold">Register a converter</emphasis> 921</para> 922 923<literallayout class="monospaced"> 924typedef XlcConv (*XlcOpenConverterProc)(<emphasis remap='I'>from_lcd</emphasis>, <emphasis remap='I'>from_type</emphasis>, <emphasis remap='I'>to_lcd</emphasis>, <emphasis remap='I'>to_type</emphasis>); 925 XLCd <emphasis remap='I'>from_lcd</emphasis>; 926 char <emphasis remap='I'>*from_type</emphasis>; 927 XLCd <emphasis remap='I'>to_lcd</emphasis>; 928 char <emphasis remap='I'>*to_type</emphasis>; 929</literallayout> 930 931<funcsynopsis id='_XlcSetConverter'> 932<funcprototype> 933 <funcdef>Bool <function> _XlcSetConverter</function></funcdef> 934 <paramdef>XLCd<parameter> from_lcd</parameter></paramdef> 935 <paramdef>char<parameter> *from</parameter></paramdef> 936 <paramdef>XLCd<parameter> to_lcd</parameter></paramdef> 937 <paramdef>char<parameter> *to</parameter></paramdef> 938 <paramdef>XlcOpenConverterProc<parameter> converter</parameter></paramdef> 939</funcprototype> 940</funcsynopsis> 941 942<para> 943The <function>XlcSetConverter</function> function registers a converter which convert 944from "<emphasis remap='I'>from_type</emphasis>" to "<emphasis remap='I'>to_type</emphasis>" into the converter list 945(in the specified XLCd). 946</para> 947</sect1> 948 949<sect1 id="X_Locale_Database_functions"> 950<title>X Locale Database functions</title> 951<para> 952X Locale Database contains the subset of user's environment that 953depends on language. The following APIs are provided for accessing 954X Locale Database and other locale relative files. 955</para> 956 957<para> 958For more detail about X Locale Database, please refer 959X Locale Database Definition document. 960</para> 961 962<para> 963<emphasis role="bold">Get a resource from database</emphasis> 964</para> 965 966<funcsynopsis id='_XlcGetResource'> 967<funcprototype> 968 <funcdef>void <function> _XlcGetResource</function></funcdef> 969 <paramdef>XLCd<parameter> lcd</parameter></paramdef> 970 <paramdef>char<parameter> *category</parameter></paramdef> 971 <paramdef>char<parameter> *class</parameter></paramdef> 972 <paramdef>char<parameter> ***value</parameter></paramdef> 973 <paramdef>int<parameter> *count</parameter></paramdef> 974</funcprototype> 975</funcsynopsis> 976 977<para> 978The 979<xref linkend='_XlcGetResource' xrefstyle='select: title'/> 980function obtains a locale dependent data which is associated with the 981locale of specified "<emphasis remap='I'>lcd</emphasis>". 982The locale data is provided by system locale or by X Locale Database 983file, and what kind of data is available is implementation dependent. 984</para> 985 986<para> 987The specified "<emphasis remap='I'>category</emphasis>" and "<emphasis remap='I'>class</emphasis>" are used for 988finding out the objective locale data. 989</para> 990 991<para> 992The returned value is returned in value argument in string list form, 993and the returned count shows the number of strings in the value. 994</para> 995 996<para> 997The returned value is owned by locale method, and should not be modified 998or freed by caller. 999</para> 1000 1001<para> 1002<emphasis role="bold">Get a locale relative file name</emphasis> 1003</para> 1004 1005<funcsynopsis id='_XlcFileName'> 1006<funcprototype> 1007 <funcdef>char *<function>_XlcFileName</function></funcdef> 1008 <paramdef>XLCd<parameter> lcd</parameter></paramdef> 1009 <paramdef>char<parameter> *category</parameter></paramdef> 1010</funcprototype> 1011</funcsynopsis> 1012 1013<para> 1014The 1015<xref linkend='_XlcFileName' xrefstyle='select: title'/> 1016functions returns a file name which is bound to the specified "<emphasis remap='I'>lcd</emphasis>" 1017and "<emphasis remap='I'>category</emphasis>", as a null-terminated string. If no file name can 1018be found, or there is no readable file for the found file name, 1019<xref linkend='_XlcFileName' xrefstyle='select: title'/> 1020returns NULL. The returned file name should be freed by caller. 1021</para> 1022 1023<para> 1024The rule for searching a file name is implementation dependent. 1025In current implementation, 1026<xref linkend='_XlcFileName' xrefstyle='select: title'/> 1027uses "{category}.dir" file as mapping table, which has pairs of 1028strings, a full locale name and a corresponding file name. 1029</para> 1030 1031</sect1> 1032 1033<sect1 id="Utility_Functions"> 1034<title>Utility Functions</title> 1035 1036<para> 1037<emphasis role="bold">Compare Latin-1 strings</emphasis> 1038</para> 1039 1040<funcsynopsis id='_XlcCompareISOLatin1'> 1041<funcprototype> 1042 <funcdef>int <function> _XlcCompareISOLatin1</function></funcdef> 1043 <paramdef>char*str1,<parameter> *str2</parameter></paramdef> 1044</funcprototype> 1045</funcsynopsis> 1046 1047<funcsynopsis id='_XlcNCompareISOLatin1'> 1048<funcprototype> 1049 <funcdef>int <function> _XlcNCompareISOLatin1</function></funcdef> 1050 <paramdef>char*str1,<parameter> *str2</parameter></paramdef> 1051 <paramdef>int<parameter> len</parameter></paramdef> 1052</funcprototype> 1053</funcsynopsis> 1054 1055<para> 1056The 1057<function>_XlcCompareIsoLatin1 </function> 1058function to compares two ISO-8859-1 strings. Bytes representing ASCII lower 1059case letters are converted to upper case before making the comparison. 1060The value returned is an integer less than, equal to, or greater than 1061zero, depending on whether "<emphasis remap='I'>str1</emphasis>" is lexicographicly less than, 1062equal to, or greater than "<emphasis remap='I'>str2</emphasis>". 1063</para> 1064 1065<para> 1066The 1067<function>_XlcNCompareIsoLatin1</function> 1068function is identical to 1069<function>_XlcCompareISOLatin1,</function> 1070except that at most "<emphasis remap='I'>len</emphasis>" bytes are compared. 1071</para> 1072 1073<para> 1074<emphasis role="bold">Resource Utility</emphasis> 1075</para> 1076 1077<funcsynopsis id='XlcNumber'> 1078<funcprototype> 1079 <funcdef>int <function> XlcNumber</function></funcdef> 1080 <paramdef>ArrayType<parameter> array</parameter></paramdef> 1081</funcprototype> 1082</funcsynopsis> 1083 1084<para> 1085Similar to XtNumber. 1086</para> 1087 1088<funcsynopsis id='_XlcCopyFromArg'> 1089<funcprototype> 1090 <funcdef>void <function> _XlcCopyFromArg</function></funcdef> 1091 <paramdef>char<parameter> *src</parameter></paramdef> 1092 <paramdef>char<parameter> *dst</parameter></paramdef> 1093 <paramdef>int<parameter> size</parameter></paramdef> 1094</funcprototype> 1095</funcsynopsis> 1096 1097<funcsynopsis id='_XlcCopyToArg'> 1098<funcprototype> 1099 <funcdef>void <function> _XlcCopyToArg</function></funcdef> 1100 <paramdef>char<parameter> *src</parameter></paramdef> 1101 <paramdef>char<parameter> **dst</parameter></paramdef> 1102 <paramdef>int<parameter> size</parameter></paramdef> 1103</funcprototype> 1104</funcsynopsis> 1105 1106<para> 1107Similar to 1108<function>_XtCopyFromArg </function> 1109and 1110<function>_XtCopyToArg.</function> 1111</para> 1112 1113<funcsynopsis id='_XlcCountVaList'> 1114<funcprototype> 1115 <funcdef>void <function> _XlcCountVaList</function></funcdef> 1116 <paramdef>va_list<parameter> var</parameter></paramdef> 1117 <paramdef>int<parameter> *count_ret</parameter></paramdef> 1118</funcprototype> 1119</funcsynopsis> 1120 1121<para> 1122Similar to 1123<function>_XtCountVaList.</function> 1124</para> 1125 1126<funcsynopsis id='_XlcVaToArgList'> 1127<funcprototype> 1128 <funcdef>void <function> _XlcVaToArgList</function></funcdef> 1129 <paramdef>va_list<parameter> var</parameter></paramdef> 1130 <paramdef>int<parameter> count</parameter></paramdef> 1131 <paramdef>XlcArgList<parameter> *args_ret</parameter></paramdef> 1132</funcprototype> 1133</funcsynopsis> 1134 1135<para> 1136Similar to 1137<function>_XtVaToArgList.</function> 1138</para> 1139 1140<literallayout class="monospaced"> 1141typedef struct _XlcResource { 1142 char *name; 1143 XrmQuark xrm_name; 1144 int size; 1145 int offset; 1146 unsigned long mask; 1147} XlcResource, *XlcResourceList; 1148</literallayout> 1149 1150<literallayout class="monospaced"> 1151#define XlcCreateMask (1L<<0) 1152#define XlcDefaultMask (1L<<1) 1153#define XlcGetMask (1L<<2) 1154#define XlcSetMask (1L<<3) 1155#define XlcIgnoreMask (1L<<4) 1156</literallayout> 1157 1158<funcsynopsis id='_XlcCompileResourceList'> 1159<funcprototype> 1160 <funcdef>void <function> _XlcCompileResourceList</function></funcdef> 1161 <paramdef>XlcResourceList<parameter> resources</parameter></paramdef> 1162 <paramdef>int<parameter> num_resources</parameter></paramdef> 1163</funcprototype> 1164</funcsynopsis> 1165 1166<para> 1167Similar to 1168<function>_XtCompileResourceList.</function> 1169</para> 1170 1171<funcsynopsis id='_XlcGetValues'> 1172<funcprototype> 1173 <funcdef>char * <function> _XlcGetValues</function></funcdef> 1174 <paramdef>XPointer<parameter> base</parameter></paramdef> 1175 <paramdef>XlcResourceList<parameter> resources</parameter></paramdef> 1176 <paramdef>int<parameter> num_resources</parameter></paramdef> 1177 <paramdef>XlcArgList<parameter> args</parameter></paramdef> 1178 <paramdef>int<parameter> num_args</parameter></paramdef> 1179 <paramdef>unsignedlong<parameter> mask</parameter></paramdef> 1180</funcprototype> 1181</funcsynopsis> 1182 1183<para> 1184Similar to XtGetSubvalues. 1185</para> 1186 1187<funcsynopsis id='_XlcSetValues'> 1188<funcprototype> 1189 <funcdef>char * <function> _XlcSetValues</function></funcdef> 1190 <paramdef>XPointer<parameter> base</parameter></paramdef> 1191 <paramdef>XlcResourceList<parameter> resources</parameter></paramdef> 1192 <paramdef>int<parameter> num_resources</parameter></paramdef> 1193 <paramdef>XlcArgList<parameter> args</parameter></paramdef> 1194 <paramdef>int<parameter> num_args</parameter></paramdef> 1195 <paramdef>unsignedlong<parameter> mask</parameter></paramdef> 1196</funcprototype> 1197</funcsynopsis> 1198 1199<para> 1200Similar to XtSetSubvalues. 1201</para> 1202 1203<para> 1204<emphasis role="bold">ANSI C Compatible Functions</emphasis> 1205</para> 1206 1207<para> 1208The following are ANSI C/MSE Compatible Functions for non-ANSI C environment. 1209</para> 1210 1211<funcsynopsis id='_Xmblen'> 1212<funcprototype> 1213 <funcdef>int <function> _Xmblen</function></funcdef> 1214 <paramdef>char<parameter> *str</parameter></paramdef> 1215 <paramdef>int<parameter> len</parameter></paramdef> 1216</funcprototype> 1217</funcsynopsis> 1218 1219<para> 1220The 1221<xref linkend='_Xmblen' xrefstyle='select: title'/> 1222function returns the number of characters pointed to by "<emphasis remap='I'>str</emphasis>". 1223Only "<emphasis remap='I'>len</emphasis>" bytes in "<emphasis remap='I'>str</emphasis>" are used in determining the 1224character count returned. "<emphasis remap='I'>Str</emphasis>" may point at characters from 1225any valid codeset in the current locale. 1226</para> 1227 1228<para> 1229The call 1230<xref linkend='_Xmblen' xrefstyle='select: title'/> 1231is equivalent to 1232_Xmbtowc(_Xmbtowc((<emphasis remap='I'>wchar_t*</emphasis>)NULL, <emphasis remap='I'>str</emphasis>, <emphasis remap='I'>len</emphasis>)) 1233</para> 1234 1235<funcsynopsis id='_Xmbtowc'> 1236<funcprototype> 1237 <funcdef>int <function> _Xmbtowc</function></funcdef> 1238 <paramdef>wchar_t<parameter> *wstr</parameter></paramdef> 1239 <paramdef>char<parameter> *str</parameter></paramdef> 1240 <paramdef>int<parameter> len</parameter></paramdef> 1241</funcprototype> 1242</funcsynopsis> 1243 1244<para> 1245The 1246<xref linkend='_Xmbtowc' xrefstyle='select: title'/> 1247function converts the character(s) pointed to by "<emphasis remap='I'>str</emphasis>" 1248to their wide character representation(s) pointed to by "<emphasis remap='I'>wstr</emphasis>". 1249"<emphasis remap='I'>Len</emphasis>" is the number of bytes in "<emphasis remap='I'>str</emphasis>" to be converted. 1250The return value is the number of characters converted. 1251</para> 1252 1253<para> 1254The call 1255<xref linkend='_Xmbtowc' xrefstyle='select: title'/> 1256is equivalent to 1257_Xlcmbtowc((XLCd)NULL, <emphasis remap='I'>wstr</emphasis>, <emphasis remap='I'>str</emphasis>, <emphasis remap='I'>len</emphasis>) 1258</para> 1259 1260<funcsynopsis id='_Xlcmbtowc'> 1261<funcprototype> 1262 <funcdef>int <function> _Xlcmbtowc</function></funcdef> 1263 <paramdef>XLCd<parameter> lcd</parameter></paramdef> 1264 <paramdef>wchar_t<parameter> *wstr</parameter></paramdef> 1265 <paramdef>char<parameter> *str</parameter></paramdef> 1266 <paramdef>int<parameter> len</parameter></paramdef> 1267</funcprototype> 1268</funcsynopsis> 1269 1270<para> 1271The 1272<xref linkend='_Xlcmbtowc' xrefstyle='select: title'/> 1273function is identical to 1274<function>_Xmbtowc, </function> 1275except that it requires the "<emphasis remap='I'>lcd</emphasis>" argument. If "<emphasis remap='I'>lcd</emphasis>" 1276is (XLCd) NULL, 1277<function>_Xlcmbtowc, </function> 1278calls 1279<function>_XlcCurrentLC </function> 1280to determine the current locale. 1281</para> 1282 1283<funcsynopsis id='_Xwctomb'> 1284<funcprototype> 1285 <funcdef>int <function> _Xwctomb</function></funcdef> 1286 <paramdef>char<parameter> *str</parameter></paramdef> 1287 <paramdef>wchar_t<parameter> wc</parameter></paramdef> 1288</funcprototype> 1289</funcsynopsis> 1290 1291<para> 1292The 1293<xref linkend='_Xwctomb' xrefstyle='select: title'/> 1294function converts a single wide character pointed to by "<emphasis remap='I'>wc</emphasis>" to 1295its multibyte representation pointed to by "<emphasis remap='I'>str</emphasis>". 1296On success, the return value is 1. 1297</para> 1298 1299<para> 1300The call 1301<xref linkend='_Xwctomb' xrefstyle='select: title'/> 1302is equivalent to 1303_Xlcwctomb((XLCd)NULL, <emphasis remap='I'>str</emphasis>, <emphasis remap='I'>wstr</emphasis>) 1304</para> 1305 1306<funcsynopsis id='_Xlcwctomb'> 1307<funcprototype> 1308 <funcdef>int <function> _Xlcwctomb</function></funcdef> 1309 <paramdef>XLCd<parameter> lcd</parameter></paramdef> 1310 <paramdef>char<parameter> *str</parameter></paramdef> 1311 <paramdef>wchar_t<parameter> wc</parameter></paramdef> 1312</funcprototype> 1313</funcsynopsis> 1314 1315<para> 1316The 1317<xref linkend='_Xlcwctomb' xrefstyle='select: title'/> 1318function is identical to _Xwctomb, except that it requires the 1319"<emphasis remap='I'>lcd</emphasis>" argument. If "<emphasis remap='I'>lcd</emphasis>" is (XLCd) NULL, 1320<function>_Xlcwctomb, </function> 1321calls 1322<function>_XlcCurrentLC </function> 1323to determine the current locale. 1324</para> 1325 1326<funcsynopsis id='_Xmbstowcs'> 1327<funcprototype> 1328 <funcdef>int <function> _Xmbstowcs</function></funcdef> 1329 <paramdef>wchar_t<parameter> *wstr</parameter></paramdef> 1330 <paramdef>char<parameter> *str</parameter></paramdef> 1331 <paramdef>int<parameter> len</parameter></paramdef> 1332</funcprototype> 1333</funcsynopsis> 1334 1335<para> 1336The 1337<xref linkend='_Xmbstowcs' xrefstyle='select: title'/> 1338function converts the NULL-terminated string pointed to by "<emphasis remap='I'>str</emphasis>" 1339to its wide character string representation pointed to by "<emphasis remap='I'>wstr</emphasis>". 1340"<emphasis remap='I'>Len</emphasis>" is the number of characters in "<emphasis remap='I'>str</emphasis>" to be converted. 1341</para> 1342 1343<para> 1344The call 1345<xref linkend='_Xmbstowcs' xrefstyle='select: title'/> 1346is equivalent to 1347_Xlcmbstowcs((XLCd)NULL, <emphasis remap='I'>wstr</emphasis>, <emphasis remap='I'>str</emphasis>, <emphasis remap='I'>len</emphasis>) 1348</para> 1349 1350<funcsynopsis id='_Xlcmbstowcs'> 1351<funcprototype> 1352 <funcdef>int <function> _Xlcmbstowcs</function></funcdef> 1353 <paramdef>XLCd<parameter> lcd</parameter></paramdef> 1354 <paramdef>wchar_t<parameter> *wstr</parameter></paramdef> 1355 <paramdef>char<parameter> *str</parameter></paramdef> 1356 <paramdef>int<parameter> len</parameter></paramdef> 1357</funcprototype> 1358</funcsynopsis> 1359 1360<para> 1361The 1362<xref linkend='_Xlcmbstowcs' xrefstyle='select: title'/> 1363function is identical to _Xmbstowcs, except that it requires the 1364"<emphasis remap='I'>lcd</emphasis>" argument. If "<emphasis remap='I'>lcd</emphasis>" is (XLCd) NULL, 1365<function>_Xlcmbstowcs, </function> 1366calls 1367<function>_XlcCurrentLC</function> 1368to determine the current locale. 1369</para> 1370 1371<funcsynopsis id='_Xwcstombs'> 1372<funcprototype> 1373 <funcdef>int <function> _Xwcstombs</function></funcdef> 1374 <paramdef>char<parameter> *str</parameter></paramdef> 1375 <paramdef>wchar_t<parameter> *wstr</parameter></paramdef> 1376 <paramdef>int<parameter> len</parameter></paramdef> 1377</funcprototype> 1378</funcsynopsis> 1379 1380<para> 1381The 1382<xref linkend='_Xwcstombs' xrefstyle='select: title'/> 1383function converts the (wchar_t) NULL terminated wide character string 1384pointed to by "<emphasis remap='I'>wstr</emphasis>" to the NULL terminated multibyte string 1385pointed to by "<emphasis remap='I'>str</emphasis>". 1386</para> 1387 1388<para> 1389The call 1390<xref linkend='_Xwcstombs' xrefstyle='select: title'/> 1391is equivalent to 1392_Xlcwcstombs((XLCd)NULL, <emphasis remap='I'>str</emphasis>, <emphasis remap='I'>wstr</emphasis>, <emphasis remap='I'>len</emphasis>) 1393</para> 1394 1395<funcsynopsis id='_Xlcwcstombs'> 1396<funcprototype> 1397 <funcdef>int <function> _Xlcwcstombs</function></funcdef> 1398 <paramdef>XLCd<parameter> lcd</parameter></paramdef> 1399 <paramdef>char<parameter> *str</parameter></paramdef> 1400 <paramdef>wchar_t<parameter> *wstr</parameter></paramdef> 1401 <paramdef>int<parameter> len</parameter></paramdef> 1402</funcprototype> 1403</funcsynopsis> 1404 1405<para> 1406The 1407<xref linkend='_Xlcwcstombs' xrefstyle='select: title'/> 1408function is identical to _Xwcstombs, except that it requires the 1409"<emphasis remap='I'>lcd</emphasis>" argument. If "<emphasis remap='I'>lcd</emphasis>" is (XLCd) NULL, 1410<function>_Xlcwcstombs, </function> 1411calls 1412<function>_XlcCurrentLC </function> 1413to determine the current locale. 1414</para> 1415 1416<funcsynopsis id='_Xwcslen'> 1417<funcprototype> 1418 <funcdef>int <function> _Xwcslen</function></funcdef> 1419 <paramdef>wchar_t<parameter> *wstr</parameter></paramdef> 1420</funcprototype> 1421</funcsynopsis> 1422 1423<para> 1424The 1425<xref linkend='_Xwcslen' xrefstyle='select: title'/> 1426function returns the count of wide characters in the (wchar_t) NULL 1427terminated wide character string pointed to by "<emphasis remap='I'>wstr</emphasis>". 1428</para> 1429 1430<funcsynopsis id='_Xwcscpy'> 1431<funcprototype> 1432 <funcdef>wchar_t *<function> _Xwcscpy</function></funcdef> 1433 <paramdef>wchar_t<parameter> *wstr1</parameter></paramdef> 1434 <paramdef>wchar_t<parameter> *wstr2</parameter></paramdef> 1435</funcprototype> 1436</funcsynopsis> 1437 1438<funcsynopsis id='_Xwcsncpy'> 1439<funcprototype> 1440 <funcdef>wchar_t * <function> _Xwcsncpy</function></funcdef> 1441 <paramdef>wchar_t<parameter> *wstr1</parameter></paramdef> 1442 <paramdef>wchar_t<parameter> *wstr2</parameter></paramdef> 1443 <paramdef>int<parameter> len</parameter></paramdef> 1444</funcprototype> 1445</funcsynopsis> 1446 1447<para> 1448The 1449<xref linkend='_Xwcscpy' xrefstyle='select: title'/> 1450function copies the (wchar_t) NULL terminated wide character string 1451pointed to by "<emphasis remap='I'>wstr2</emphasis>" to the object pointed at by "<emphasis remap='I'>wstr1</emphasis>". 1452"<emphasis remap='I'>Wstr1</emphasis>" is (wchar_t) NULL terminated. The return value is a 1453pointer to "<emphasis remap='I'>wstr1</emphasis>". 1454</para> 1455 1456<para> 1457The 1458<xref linkend='_Xwcsncpy' xrefstyle='select: title'/> 1459function is identical to 1460<function>_Xwcscpy, </function> 1461except that it copies "<emphasis remap='I'>len</emphasis>" wide characters from the object 1462pointed to by "<emphasis remap='I'>wstr2</emphasis>" to the object pointed to "<emphasis remap='I'>wstr1</emphasis>". 1463</para> 1464 1465<funcsynopsis id='_Xwcscmp'> 1466<funcprototype> 1467 <funcdef>int <function> _Xwcscmp</function></funcdef> 1468 <paramdef>wchar_t*wstr1,<parameter> *wstr2</parameter></paramdef> 1469</funcprototype> 1470</funcsynopsis> 1471 1472<funcsynopsis id='_Xwcsncmp'> 1473<funcprototype> 1474 <funcdef>int <function> _Xwcsncmp</function></funcdef> 1475 <paramdef>wchar_t*wstr1,<parameter> *wstr2</parameter></paramdef> 1476 <paramdef>int<parameter> len</parameter></paramdef> 1477</funcprototype> 1478</funcsynopsis> 1479 1480<para> 1481The 1482<xref linkend='_Xwcscmp' xrefstyle='select: title'/> 1483function compares two (wchar_t) NULL terminated wide character strings. 1484The value returned is an integer less than, equal to, or greater than zero, 1485depending on whether "<emphasis remap='I'>wstr1</emphasis>" is lexicographicly less then, equal to, 1486or greater than "<emphasis remap='I'>str2</emphasis>". 1487</para> 1488 1489<para> 1490The 1491<xref linkend='_Xwcsncmp' xrefstyle='select: title'/> 1492function is identical to 1493<function>_XlcCompareISOLatin1, </function> 1494except that at most "<emphasis remap='I'>len</emphasis>" wide characters are compared. 1495</para> 1496 1497 1498<!-- .sp --> 1499<!-- .\" .LP --> 1500<!-- .\" <function>Locale Method Internal Functions</function> --> 1501<!-- .\" .LP --> 1502<!-- .\" .FD 0 --> 1503<!-- .\" XlcCharSet _XlcCreateDefaultCharSet(<emphasis remap='I'>name</emphasis>, <emphasis remap='I'>ct_sequence</emphasis>) --> 1504<!-- .\" .br --> 1505<!-- .\" char <emphasis remap='I'>*name</emphasis>; --> 1506<!-- .\" .br --> 1507<!-- .\" char <emphasis remap='I'>*ct_sequence</emphasis>; --> 1508<!-- .\" .FN --> 1509<!-- .\" .FD 0 --> 1510<!-- .\" Bool _XlcParseCharSet(<emphasis remap='I'>charset</emphasis>) --> 1511<!-- .\" .br --> 1512<!-- .\" XlcCharSet <emphasis remap='I'>charset</emphasis>; --> 1513<!-- .\" .FN --> 1514<!-- .\" .FD 0 --> 1515<!-- .\" void _XlcGetLocaleDataBase(<emphasis remap='I'>lcd</emphasis>, <emphasis remap='I'>category</emphasis>, <emphasis remap='I'>name</emphasis>, <emphasis remap='I'>value</emphasis>, <emphasis remap='I'>count</emphasis>) --> 1516<!-- .\" .br --> 1517<!-- .\" XLCd <emphasis remap='I'>lcd</emphasis>; --> 1518<!-- .\" .br --> 1519<!-- .\" char <emphasis remap='I'>*category</emphasis>; --> 1520<!-- .\" .br --> 1521<!-- .\" char <emphasis remap='I'>*name</emphasis>; --> 1522<!-- .\" .br --> 1523<!-- .\" char <emphasis remap='I'>***value</emphasis>; --> 1524<!-- .\" .br --> 1525<!-- .\" int <emphasis remap='I'>*count</emphasis>; --> 1526<!-- .\" .FN --> 1527<!-- .\" .FD 0 --> 1528<!-- .\" void _XlcDestroyLocaleDataBase(<emphasis remap='I'>lcd</emphasis>) --> 1529<!-- .\" .br --> 1530<!-- .\" XLCd <emphasis remap='I'>lcd</emphasis>; --> 1531<!-- .\" .FN --> 1532<!-- .\" .FD 0 --> 1533<!-- .\" XPointer _XlcCreateLocaleDataBase(<emphasis remap='I'>lcd</emphasis>) --> 1534<!-- .\" .br --> 1535<!-- .\" XLCd <emphasis remap='I'>lcd</emphasis>; --> 1536<!-- .\" .FN --> 1537<!-- .\" .LP --> 1538<!-- .\" .sp --> 1539<!-- .\" <function>Obtain an locale database path</function> --> 1540<!-- .\" .LP --> 1541<!-- .\" .FD 0 --> 1542<!-- .\" int _XlcResolveI18NPath(<emphasis remap='I'>dir</emphasis>) --> 1543<!-- .\" .br --> 1544<!-- .\" char <emphasis remap='I'>*dir</emphasis>; --> 1545<!-- .\" .FN --> 1546<!-- .\" .LP --> 1547<!-- .\" The --> 1548<!-- .\" .PN _XlcResolveI18NPath --> 1549<!-- .\" function returns path name list that is related to X Locale Database. --> 1550<!-- .\" The obtained path is stored into the array which is pointed by --> 1551<!-- .\" specified "<emphasis remap='I'>dir</emphasis>". The path consists of directory paths which --> 1552<!-- .\" are separated with colon. --> 1553<!-- .\" If the environment variable XLOCALEDIR is specified, the path --> 1554<!-- .\" contains its contents. --> 1555<!-- .\" .LP --> 1556<!-- .\" The default path of X Locale Database is implementation dependent. --> 1557<!-- .\" In current implementation, it's determined in build time. --> 1558<!-- .\" .LP --> 1559<!-- .\" .PN _XlcResolveI18NPath --> 1560<!-- .\" does not check overflow of the array to which the "<emphasis remap='I'>dir</emphasis>" --> 1561<!-- .\" parameter points. Caller should provide enough buffer to store this --> 1562<!-- .\" string. --> 1563<!-- .\" .LP --> 1564<!-- .\" .sp --> 1565<!-- .\" <function>Obtain a full locale name</function> --> 1566<!-- .\" .LP --> 1567<!-- .\" .FD 0 --> 1568<!-- .\" int _XlcResolveLocaleName(<emphasis remap='I'>lc_name</emphasis>, <emphasis remap='I'>full_name</emphasis>, <emphasis remap='I'>language</emphasis>, <emphasis remap='I'>territory</emphasis>, <emphasis remap='I'>codeset</emphasis>) --> 1569<!-- .\" .br --> 1570<!-- .\" char <emphasis remap='I'>*lc_name</emphasis>; --> 1571<!-- .\" .br --> 1572<!-- .\" char <emphasis remap='I'>*full_name</emphasis>; --> 1573<!-- .\" .br --> 1574<!-- .\" char <emphasis remap='I'>*language</emphasis>; --> 1575<!-- .\" .br --> 1576<!-- .\" char <emphasis remap='I'>*territory</emphasis>; --> 1577<!-- .\" .br --> 1578<!-- .\" char <emphasis remap='I'>*codeset</emphasis>; --> 1579<!-- .\" .FN --> 1580<!-- .\" .LP --> 1581<!-- .\" The --> 1582<!-- .\" .PN _XlcResolveLocaleName --> 1583<!-- .\" function returns a full locale name. --> 1584<!-- .\" The obtained full locale name is stored into the array which is --> 1585<!-- .\" pointed by specified "<emphasis remap='I'>full_name</emphasis>". --> 1586<!-- .\" The language, territory and codeset part of the full locale name --> 1587<!-- .\" are copied to the return arguments, "<emphasis remap='I'>language</emphasis>", --> 1588<!-- .\" "<emphasis remap='I'>territory</emphasis>" and "<emphasis remap='I'>codeset</emphasis>", respectively. --> 1589<!-- .\" NULL can be specified for these arguments. --> 1590<!-- .\" .LP --> 1591<!-- .\" The rule for mapping from locale name to full locale name is --> 1592<!-- .\" implementation dependent. --> 1593<!-- .\" .LP --> 1594<!-- .\" .PN _XlcResolveLocaleName --> 1595<!-- .\" does not check overflow of the array to which --> 1596<!-- .\" "<emphasis remap='I'>full_name</emphasis>", "<emphasis remap='I'>language</emphasis>", "<emphasis remap='I'>territory</emphasis>" and --> 1597<!-- .\" "<emphasis remap='I'>codeset</emphasis>" parameter point. --> 1598<!-- .\" Caller should provide enough buffer to store those string. --> 1599<!-- .\" .LP --> 1600<!-- .\" In current implementation, --> 1601<!-- .\" .PN _XlcResolveLocaleName --> 1602<!-- .\" uses locale.alias file as mapping table, which has pairs of strings, --> 1603<!-- .\" a locale name and a full locale name. --> 1604<!-- .\" .LP --> 1605<!-- .\" .FD 0 --> 1606<!-- .\" int _XlcResolveDBName(<emphasis remap='I'>lc_name</emphasis>, <emphasis remap='I'>file_name</emphasis>) --> 1607<!-- .\" .br --> 1608<!-- .\" char <emphasis remap='I'>*lc_name</emphasis>; --> 1609<!-- .\" .br --> 1610<!-- .\" char <emphasis remap='I'>*file_name</emphasis>; --> 1611<!-- .\" .FN --> 1612<!-- .\" .FD 0 --> 1613<!-- .\" XLCd _XlcCreateLC(<emphasis remap='I'>name</emphasis>, <emphasis remap='I'>methods</emphasis>) --> 1614<!-- .\" .br --> 1615<!-- .\" char <emphasis remap='I'>*name</emphasis>; --> 1616<!-- .\" .br --> 1617<!-- .\" XLCdMethods <emphasis remap='I'>methods</emphasis>; --> 1618<!-- .\" .FN --> 1619<!-- .\" .FD 0 --> 1620<!-- .\" void _XlcDestroyLC(<emphasis remap='I'>lcd</emphasis>) --> 1621<!-- .\" .br --> 1622<!-- .\" XLCd <emphasis remap='I'>lcd</emphasis>; --> 1623<!-- .\" .FN --> 1624<!-- .\" .LP --> 1625<!-- .\" --> 1626 1627</sect1> 1628</chapter> 1629</book> 1630