framework.xml revision eb411b4b
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>_XlcEucLoader</function> 252<function>_XlcSjisLoader</function> 253<function>_XlcUtfLoader</function> 254<function>_XaixOsDynamicLoad</function> 255</literallayout> 256 257</sect1> 258 259<sect1 id="Locale_Method_Interface"> 260<title>Locale Method Interface</title> 261 262<para> 263This chapter describes the locale method API, which is a set of 264accessible functions from both IM and OM parts. 265The locale method API provides the functionalities; obtaining locale 266dependent information, handling charset, converting text, etc. 267</para> 268 269<para> 270As a result of using these APIs instead of accessing vender private 271extension of the locale object, we can keep locale, IM and OM 272independently each other. 273</para> 274 275</sect1> 276 277<sect1 id="Locale_Method_Functions"> 278<title>Locale Method Functions</title> 279<para> 280<function>Open a Locale Method</function> 281</para> 282 283<funcsynopsis id='_XOpenLC'> 284<funcprototype> 285 <funcdef>XLCd <function> _XOpenLC</function></funcdef> 286 <paramdef>char<parameter> *name</parameter></paramdef> 287</funcprototype> 288</funcsynopsis> 289 290<para> 291The 292<xref linkend='_XOpenLC' xrefstyle='select: title'/> 293function opens a locale method which corresponds to the 294specified locale name. 295<xref linkend='_XOpenLC' xrefstyle='select: title'/> 296calls a locale object loader, which is registered via 297<function>_XlcAddLoader into the internal loader list. If the called loader </function> 298is valid and successfully opens a locale, 299<xref linkend='_XOpenLC' xrefstyle='select: title'/> 300returns the XLCd. If the loader is invalid or failed to open a locale, 301<xref linkend='_XOpenLC' xrefstyle='select: title'/> 302calls the next loader. If all registered loaders cannot open a locale, 303<xref linkend='_XOpenLC' xrefstyle='select: title'/> 304returns NULL. 305</para> 306 307<para>XLCd _XlcCurrentLC</para> 308 309<para> 310The 311<function>_XlcCurrentLC</function> 312function returns an XLCd that are bound to current locale. 313</para> 314 315<para> 316<emphasis role="bold">Close a Locale Method</emphasis> 317</para> 318 319<funcsynopsis id='_XCloseLC'> 320<funcprototype> 321 <funcdef>void <function> _XCloseLC</function></funcdef> 322 <paramdef>XLCd<parameter> lcd</parameter></paramdef> 323</funcprototype> 324</funcsynopsis> 325 326<para> 327<!-- .LP --> 328The 329<xref linkend='_XCloseLC' xrefstyle='select: title'/> 330function close a locale method the specified lcd. 331</para> 332 333<para> 334<emphasis role="bold">Obtain Locale Method values</emphasis> 335</para> 336 337<funcsynopsis id='_XGetLCValues'> 338<funcprototype> 339 <funcdef>char *<function>_XGetLCValues</function></funcdef> 340 <paramdef>XLCd<parameter> lcd</parameter></paramdef> 341</funcprototype> 342</funcsynopsis> 343 344<para> 345The 346<xref linkend='_XGetLCValues' xrefstyle='select: title'/> 347function returns NULL if no error occurred; otherwise, it returns the 348name of the first argument that could not be obtained. 349The following values are defined as standard arguments. Other values 350are implementation dependent. 351</para> 352 353<informaltable frame="topbot"> 354 <?dbfo keep-together="always" ?> 355 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 356 <colspec colname='c1' colwidth="3.0*"/> 357 <colspec colname='c2' colwidth="1.0*"/> 358 <colspec colname='c3' colwidth="3.0*"/> 359 <thead> 360 <row rowsep='1'> 361 <entry>Name</entry> 362 <entry>Type</entry> 363 <entry>Description</entry> 364 </row> 365 </thead> 366 <tbody> 367 <row> 368 <entry>XlcNCodeset</entry> 369 <entry>char*</entry> 370 <entry>codeset part of locale name</entry> 371 </row> 372 <row> 373 <entry>XlcNDefaultString</entry> 374 <entry>char*</entry> 375 <entry>XDefaultString()</entry> 376 </row> 377 <row> 378 <entry>XlcNEncodingName</entry> 379 <entry>char*</entry> 380 <entry>encoding name</entry> 381 </row> 382 <row> 383 <entry>XlcNLanguage</entry> 384 <entry>char*</entry> 385 <entry>language part of locale name</entry> 386 </row> 387 <row> 388 <entry>XlcNMbCurMax</entry> 389 <entry>int</entry> 390 <entry>ANSI C MB_CUR_MAX</entry> 391 </row> 392 <row> 393 <entry>XlcNStateDependentEncoding</entry> 394 <entry>Bool</entry> 395 <entry>is state-dependent encoding or not</entry> 396 </row> 397 <row> 398 <entry>XlcNTerritory</entry> 399 <entry>char*</entry> 400 <entry>territory part of locale name</entry> 401 </row> 402 </tbody> 403 </tgroup> 404</informaltable> 405 406</sect1> 407 408<sect1 id="Charset_functions"> 409<title>Charset functions</title> 410<para> 411The XlcCharSet is an identifier which represents a subset of characters 412(character set) in the locale object. 413</para> 414 415<literallayout class="monospaced"> 416typedef enum { 417 XlcUnknown, XlcC0, XlcGL, XlcC1, XlcGR, XlcGLGR, XlcOther 418} XlcSide; 419 420typedef struct _XlcCharSetRec *XlcCharSet; 421 422typedef struct { 423 char *name; 424 XPointer value; 425} XlcArg, *XlcArgList; 426 427typedef char* (*XlcGetCSValuesProc)(<emphasis remap='I'>charset</emphasis>, <emphasis remap='I'>args</emphasis>, <emphasis remap='I'>num_args</emphasis>); 428 XlcCharSet <emphasis remap='I'>charset</emphasis>; 429 XlcArgList <emphasis remap='I'>args</emphasis>; 430 int <emphasis remap='I'>num_args</emphasis>; 431 432typedef struct _XlcCharSetRec { 433 char *name; 434 XrmQuark xrm_name; 435 char *encoding_name; 436 XrmQuark xrm_encoding_name; 437 XlcSide side; 438 int char_size; 439 int set_size; 440 char *ct_sequence; 441 XlcGetCSValuesProc get_values; 442} XlcCharSetRec; 443</literallayout> 444 445<para> 446<emphasis role="bold">Get an XlcCharSet</emphasis> 447</para> 448 449<funcsynopsis id='_XlcGetCharSet'> 450<funcprototype> 451 <funcdef>XlcCharSet <function> _XlcGetCharSet</function></funcdef> 452 <paramdef>char<parameter> *name</parameter></paramdef> 453</funcprototype> 454</funcsynopsis> 455 456<para> 457The 458<xref linkend='_XlcGetCharSet' xrefstyle='select: title'/> 459function gets an XlcCharSet which corresponds to the charset name 460specified by "<emphasis remap='I'>name</emphasis>". 461<xref linkend='_XlcGetCharSet' xrefstyle='select: title'/> 462returns NULL, if no XlcCharSet bound to specified "<emphasis remap='I'>name</emphasis>". 463</para> 464 465<para> 466The following character sets are pre-registered. 467</para> 468 469<informaltable frame="topbot"> 470 <?dbfo keep-together="auto" ?> 471 <tgroup cols='2' align='left' colsep='0' rowsep='0'> 472 <colspec colname='c1' colwidth="1.0*"/> 473 <colspec colname='c2' colwidth="2.0*"/> 474 <thead> 475 <row rowsep='1'> 476 <entry>Name</entry> 477 <entry>Description</entry> 478 </row> 479 </thead> 480 <tbody> 481 <row> 482 <entry>ISO8859-1:GL</entry> 483 <entry>7-bit ASCII graphics (ANSI X3.4-1968),</entry> 484 </row> 485 <row> 486 <entry></entry> 487 <entry>Left half of ISO 8859 sets</entry> 488 </row> 489 <row> 490 <entry>JISX0201.1976-0:GL</entry> 491 <entry>Left half of JIS X0201-1976 (reaffirmed 1984),</entry> 492 </row> 493 <row> 494 <entry></entry> 495 <entry>8-Bit Alphanumeric-Katakana Code</entry> 496 </row> 497 <row> 498 <entry>ISO8859-1:GR</entry> 499 <entry>Right half of ISO 8859-1, Latin alphabet No. 1</entry> 500 </row> 501 <row> 502 <entry>ISO8859-2:GR</entry> 503 <entry>Right half of ISO 8859-2, Latin alphabet No. 2</entry> 504 </row> 505 <row> 506 <entry>ISO8859-3:GR</entry> 507 <entry>Right half of ISO 8859-3, Latin alphabet No. 3</entry> 508 </row> 509 <row> 510 <entry>ISO8859-4:GR</entry> 511 <entry>Right half of ISO 8859-4, Latin alphabet No. 4</entry> 512 </row> 513 <row> 514 <entry>ISO8859-7:GR</entry> 515 <entry>Right half of ISO 8859-7, Latin/Greek alphabet</entry> 516 </row> 517 <row> 518 <entry>ISO8859-6:GR</entry> 519 <entry>Right half of ISO 8859-6, Latin/Arabic alphabet</entry> 520 </row> 521 <row> 522 <entry>ISO8859-8:GR</entry> 523 <entry>Right half of ISO 8859-8, Latin/Hebrew alphabet</entry> 524 </row> 525 <row> 526 <entry>ISO8859-5:GR</entry> 527 <entry>Right half of ISO 8859-5, Latin/Cyrillic alphabet</entry> 528 </row> 529 <row> 530 <entry>ISO8859-9:GR</entry> 531 <entry>Right half of ISO 8859-9, Latin alphabet No. 5</entry> 532 </row> 533 <row> 534 <entry>JISX0201.1976-0:GR</entry> 535 <entry>Right half of JIS X0201-1976 (reaffirmed 1984),</entry> 536 </row> 537 <row> 538 <entry></entry> 539 <entry>8-Bit Alphanumeric-Katakana Code</entry> 540 </row> 541 <row> 542 <entry>GB2312.1980-0:GL</entry> 543 <entry>GB2312-1980, China (PRC) Hanzi defined as GL</entry> 544 </row> 545 <row> 546 <entry>GB2312.1980-0:GR</entry> 547 <entry>GB2312-1980, China (PRC) Hanzi defined as GR</entry> 548 </row> 549 <row> 550 <entry>JISX0208.1983-0:GL</entry> 551 <entry>JIS X0208-1983, Japanese Graphic Character Set</entry> 552 </row> 553 <row> 554 <entry></entry> 555 <entry>defined as GL</entry> 556 </row> 557 <row> 558 <entry>JISX0208.1983-0:GR</entry> 559 <entry>JIS X0208-1983, Japanese Graphic Character Set</entry> 560 </row> 561 <row> 562 <entry></entry> 563 <entry>defined as GR</entry> 564 </row> 565 <row> 566 <entry>KSC5601.1987-0:GL</entry> 567 <entry>KS C5601-1987, Korean Graphic Character Set</entry> 568 </row> 569 <row> 570 <entry></entry> 571 <entry>defined as GL</entry> 572 </row> 573 <row> 574 <entry>KSC5601.1987-0:GR</entry> 575 <entry>KS C5601-1987, Korean Graphic Character Set</entry> 576 </row> 577 <row> 578 <entry></entry> 579 <entry>defined as GR</entry> 580 </row> 581 <row> 582 <entry>JISX0212.1990-0:GL</entry> 583 <entry>JIS X0212-1990, Japanese Graphic Character Set</entry> 584 </row> 585 <row> 586 <entry></entry> 587 <entry>defined as GL</entry> 588 </row> 589 <row> 590 <entry>JISX0212.1990-0:GR</entry> 591 <entry>JIS X0212-1990, Japanese Graphic Character Set</entry> 592 </row> 593 <row> 594 <entry></entry> 595 <entry>defined as GR</entry> 596 </row> 597 </tbody> 598 </tgroup> 599</informaltable> 600 601<para> 602<emphasis role="bold">Add an XlcCharSet</emphasis> 603</para> 604 605<funcsynopsis id='_XlcAddCharSet'> 606<funcprototype> 607 <funcdef>Bool <function> _XlcAddCharSet</function></funcdef> 608 <paramdef>XlcCharSet<parameter> charset</parameter></paramdef> 609</funcprototype> 610</funcsynopsis> 611 612<para> 613The 614<xref linkend='_XlcAddCharSet' xrefstyle='select: title'/> 615function registers XlcCharSet specified by "<emphasis remap='I'>charset</emphasis>". 616</para> 617 618<para> 619<!-- .LP --> 620<!-- .sp --> 621<function>Obtain Character Set values</function> 622</para> 623 624<funcsynopsis id='_XlcGetCSValues'> 625<funcprototype> 626 <funcdef>char * <function> _XlcGetCSValues</function></funcdef> 627 <paramdef>XlcCharSet<parameter> charset</parameter></paramdef> 628 <paramdef><parameter> ...</parameter></paramdef> 629</funcprototype> 630</funcsynopsis> 631 632<para> 633The 634<xref linkend='_XlcGetCSValues' xrefstyle='select: title'/> 635function returns NULL if no error occurred; 636otherwise, it returns the name of the first argument that could not 637be obtained. The following values are defined as standard arguments. 638Other values are implementation dependent. 639</para> 640 641<informaltable frame="topbot"> 642 <?dbfo keep-together="always" ?> 643 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 644 <colspec colname='c1' colwidth="2.0*"/> 645 <colspec colname='c2' colwidth="1.0*"/> 646 <colspec colname='c3' colwidth="3.0*"/> 647 <thead> 648 <row rowsep='1'> 649 <entry>Name</entry> 650 <entry>Type</entry> 651 <entry>Description</entry> 652 </row> 653 </thead> 654 <tbody> 655 <row> 656 <entry>XlcNName</entry> 657 <entry>char*</entry> 658 <entry>charset name</entry> 659 </row> 660 <row> 661 <entry>XlcNEncodingName</entry> 662 <entry>char*</entry> 663 <entry>XLFD CharSet Registry and Encoding</entry> 664 </row> 665 <row> 666 <entry>XlcNSide</entry> 667 <entry>XlcSide</entry> 668 <entry>charset side (GL, GR, ...)</entry> 669 </row> 670 <row> 671 <entry>XlcNCharSize</entry> 672 <entry>int</entry> 673 <entry>number of octets per character</entry> 674 </row> 675 <row> 676 <entry>XlcNSetSize</entry> 677 <entry>int</entry> 678 <entry>number of character sets</entry> 679 </row> 680 <row> 681 <entry>XlcNControlSequence</entry> 682 <entry>char*</entry> 683 <entry>control sequence of Compound Text</entry> 684 </row> 685 </tbody> 686 </tgroup> 687</informaltable> 688 689</sect1> 690 691<sect1 id="Converter_Functions"> 692<title>Converter Functions</title> 693<para> 694We provide a set of the common converter APIs, that are independent 695from both of source and destination text type. 696</para> 697 698<literallayout class="monospaced"> 699typedef struct _XlcConvRec *XlcConv; 700 701typedef void (*XlcCloseConverterProc)(<emphasis remap='I'>conv</emphasis>); 702 XlcConv <emphasis remap='I'>conv</emphasis>; 703 704typedef 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>); 705 XlcConv <emphasis remap='I'>conv</emphasis>; 706 XPointer <emphasis remap='I'>*from</emphasis>; 707 int <emphasis remap='I'>*from_left</emphasis>; 708 XPointer <emphasis remap='I'>*to</emphasis>; 709 int <emphasis remap='I'>*to_left</emphasis>; 710 XPointer <emphasis remap='I'>*args</emphasis>; 711 int <emphasis remap='I'>num_args</emphasis>; 712 713typedef void (*XlcResetConverterProc)(<emphasis remap='I'>conv</emphasis>); 714 XlcConv <emphasis remap='I'>conv</emphasis>; 715 716typedef struct _XlcConvMethodsRec { 717 XlcCloseConverterProc close; 718 XlcConvertProc convert; 719 XlcResetConverterProc reset; 720} XlcConvMethodsRec, *XlcConvMethods; 721 722typedef struct _XlcConvRec { 723 XlcConvMethods methods; 724 XPointer state; 725} XlcConvRec; 726</literallayout> 727 728<para> 729<function>Open a converter</function> 730</para> 731 732<funcsynopsis id='_XlcOpenConverter'> 733<funcprototype> 734 <funcdef>XlcConv <function> _XlcOpenConverter</function></funcdef> 735 <paramdef>XLCd<parameter> from_lcd</parameter></paramdef> 736 <paramdef>char<parameter> *from_type</parameter></paramdef> 737 <paramdef>XLCd<parameter> to_lcd</parameter></paramdef> 738 <paramdef>char<parameter> *to_type</parameter></paramdef> 739</funcprototype> 740</funcsynopsis> 741 742<para> 743<xref linkend='_XlcOpenConverter' xrefstyle='select: title'/> 744function opens the converter which converts a text from specified 745"<emphasis remap='I'>from_type</emphasis>" to specified "<emphasis remap='I'>to_type</emphasis>" encoding. If the 746function cannot find proper converter or cannot open a corresponding 747converter, it returns NULL. Otherwise, it returns the conversion 748descriptor. 749</para> 750 751<para> 752The following types are pre-defined. Other types are implementation 753dependent. 754</para> 755 756<informaltable frame="topbot"> 757 <?dbfo keep-together="always" ?> 758 <tgroup cols='4' align='left' colsep='0' rowsep='0'> 759 <colspec colname='c1' colwidth="2.0*"/> 760 <colspec colname='c2' colwidth="1.0*"/> 761 <colspec colname='c3' colwidth="2.0*"/> 762 <colspec colname='c4' colwidth="3.0*"/> 763 <thead> 764 <row rowsep='1'> 765 <entry>Name</entry> 766 <entry>Type</entry> 767 <entry>Description</entry> 768 <entry>Arguments</entry> 769 </row> 770 </thead> 771 <tbody> 772 <row> 773 <entry>XlcNMultiByte</entry> 774 <entry>char *</entry> 775 <entry>multibyte</entry> 776 <entry>-</entry> 777 </row> 778 <row> 779 <entry>XlcNWideChar</entry> 780 <entry>wchar_t *</entry> 781 <entry>wide character</entry> 782 <entry>-</entry> 783 </row> 784 <row> 785 <entry>XlcNCompoundText</entry> 786 <entry>char *</entry> 787 <entry>COMPOUND_TEXT</entry> 788 <entry>-</entry> 789 </row> 790 <row> 791 <entry>XlcNString</entry> 792 <entry>char *</entry> 793 <entry>STRING</entry> 794 <entry>-</entry> 795 </row> 796 <row> 797 <entry>XlcNCharSet</entry> 798 <entry>char *</entry> 799 <entry>per charset</entry> 800 <entry>XlcCharSet</entry> 801 </row> 802 <row> 803 <entry>XlcNChar</entry> 804 <entry>char *</entry> 805 <entry>per character</entry> 806 <entry>XlcCharSet</entry> 807 </row> 808 </tbody> 809 </tgroup> 810</informaltable> 811 812<para> 813<emphasis role="bold">Close a converter</emphasis> 814</para> 815 816<funcsynopsis id='_XlcCloseConverter'> 817<funcprototype> 818 <funcdef>void <function> _XlcCloseConverter</function></funcdef> 819 <paramdef>XlcConv<parameter> conv</parameter></paramdef> 820</funcprototype> 821</funcsynopsis> 822 823<para> 824The 825<xref linkend='_XlcCloseConverter' xrefstyle='select: title'/> 826function closes the specified converter "<emphasis remap='I'>conv</emphasis>". 827</para> 828 829<para> 830<emphasis role="bold">Code conversion</emphasis> 831</para> 832 833<funcsynopsis id='_XlcConvert'> 834<funcprototype> 835 <funcdef>int <function> _XlcConvert</function></funcdef> 836 <paramdef>XlcConv<parameter> conv</parameter></paramdef> 837 <paramdef>XPointer<parameter> *from</parameter></paramdef> 838 <paramdef>int<parameter> *from_left</parameter></paramdef> 839 <paramdef>XPointer<parameter> *to</parameter></paramdef> 840 <paramdef>int<parameter> *to_left</parameter></paramdef> 841 <paramdef>XPointer<parameter> *args</parameter></paramdef> 842 <paramdef>int<parameter> num_args</parameter></paramdef> 843</funcprototype> 844</funcsynopsis> 845 846<para> 847The 848<xref linkend='_XlcConvert' xrefstyle='select: title'/> 849function converts a sequence of characters from one type, in the array 850specified by "<emphasis remap='I'>from</emphasis>", into a sequence of corresponding characters 851in another type, in the array specified by "<emphasis remap='I'>to</emphasis>". The types are 852those specified in the 853<function>_XlcOpenConverter() </function> 854call that returned the conversion descriptor, "<emphasis remap='I'>conv</emphasis>". 855The arguments "<emphasis remap='I'>from</emphasis>", "<emphasis remap='I'>from_left</emphasis>", "<emphasis remap='I'>to</emphasis>" and 856"<emphasis remap='I'>to_left</emphasis>" have the same specification of XPG4 iconv function. 857</para> 858 859<para> 860For state-dependent encodings, the conversion descriptor "<emphasis remap='I'>conv</emphasis>" 861is placed into its initial shift state by a call for which "<emphasis remap='I'>from</emphasis>" 862is a NULL pointer, or for which "<emphasis remap='I'>from</emphasis>" points to a null pointer. 863</para> 864 865<para> 866The following 2 converters prepared by locale returns appropriate 867charset (XlcCharSet) in an area pointed by args[0]. 868</para> 869 870<informaltable frame="topbot"> 871 <?dbfo keep-together="always" ?> 872 <tgroup cols='3' align='left' colsep='0' rowsep='0'> 873 <colspec colname='c1' colwidth="1.0*"/> 874 <colspec colname='c2' colwidth="1.0*"/> 875 <colspec colname='c3' colwidth="2.0*"/> 876 <thead> 877 <row rowsep='1'> 878 <entry>From</entry> 879 <entry>To</entry> 880 <entry>Description</entry> 881 </row> 882 </thead> 883 <tbody> 884 <row> 885 <entry>XlcNMultiByte</entry> 886 <entry>XlcNCharSet</entry> 887 <entry>Segmentation (Decomposing)</entry> 888 </row> 889 <row> 890 <entry>XlcNWideChar</entry> 891 <entry>XlcNCharSet</entry> 892 <entry>Segmentation (Decomposing)</entry> 893 </row> 894 </tbody> 895 </tgroup> 896</informaltable> 897 898<para> 899The conversion, from XlcNMultiByte/XlcNWideChar to XlcNCharSet, 900extracts a segment which has same charset encoding characters. 901More than one segment cannot be converted in a call. 902</para> 903 904<para> 905<emphasis role="bold">Reset a converter</emphasis> 906</para> 907 908<funcsynopsis id='_XlcResetConverter'> 909<funcprototype> 910 <funcdef>void <function> _XlcResetConverter</function></funcdef> 911 <paramdef>XlcConv<parameter> conv</parameter></paramdef> 912</funcprototype> 913</funcsynopsis> 914 915<para> 916The 917<xref linkend='_XlcResetConverter' xrefstyle='select: title'/> 918function reset the specified converter "<emphasis remap='I'>conv</emphasis>". 919</para> 920 921<para> 922<emphasis role="bold">Register a converter</emphasis> 923</para> 924 925<literallayout class="monospaced"> 926typedef 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>); 927 XLCd <emphasis remap='I'>from_lcd</emphasis>; 928 char <emphasis remap='I'>*from_type</emphasis>; 929 XLCd <emphasis remap='I'>to_lcd</emphasis>; 930 char <emphasis remap='I'>*to_type</emphasis>; 931</literallayout> 932 933<funcsynopsis id='_XlcSetConverter'> 934<funcprototype> 935 <funcdef>Bool <function> _XlcSetConverter</function></funcdef> 936 <paramdef>XLCd<parameter> from_lcd</parameter></paramdef> 937 <paramdef>char<parameter> *from</parameter></paramdef> 938 <paramdef>XLCd<parameter> to_lcd</parameter></paramdef> 939 <paramdef>char<parameter> *to</parameter></paramdef> 940 <paramdef>XlcOpenConverterProc<parameter> converter</parameter></paramdef> 941</funcprototype> 942</funcsynopsis> 943 944<para> 945The <function>XlcSetConverter</function> function registers a converter which convert 946from "<emphasis remap='I'>from_type</emphasis>" to "<emphasis remap='I'>to_type</emphasis>" into the converter list 947(in the specified XLCd). 948</para> 949</sect1> 950 951<sect1 id="X_Locale_Database_functions"> 952<title>X Locale Database functions</title> 953<para> 954X Locale Database contains the subset of user's environment that 955depends on language. The following APIs are provided for accessing 956X Locale Database and other locale relative files. 957</para> 958 959<para> 960For more detail about X Locale Database, please refer 961X Locale Database Definition document. 962</para> 963 964<para> 965<emphasis role="bold">Get a resource from database</emphasis> 966</para> 967 968<funcsynopsis id='_XlcGetResource'> 969<funcprototype> 970 <funcdef>void <function> _XlcGetResource</function></funcdef> 971 <paramdef>XLCd<parameter> lcd</parameter></paramdef> 972 <paramdef>char<parameter> *category</parameter></paramdef> 973 <paramdef>char<parameter> *class</parameter></paramdef> 974 <paramdef>char<parameter> ***value</parameter></paramdef> 975 <paramdef>int<parameter> *count</parameter></paramdef> 976</funcprototype> 977</funcsynopsis> 978 979<para> 980The 981<xref linkend='_XlcGetResource' xrefstyle='select: title'/> 982function obtains a locale dependent data which is associated with the 983locale of specified "<emphasis remap='I'>lcd</emphasis>". 984The locale data is provided by system locale or by X Locale Database 985file, and what kind of data is available is implementation dependent. 986</para> 987 988<para> 989The specified "<emphasis remap='I'>category</emphasis>" and "<emphasis remap='I'>class</emphasis>" are used for 990finding out the objective locale data. 991</para> 992 993<para> 994The returned value is returned in value argument in string list form, 995and the returned count shows the number of strings in the value. 996</para> 997 998<para> 999The returned value is owned by locale method, and should not be modified 1000or freed by caller. 1001</para> 1002 1003<para> 1004<emphasis role="bold">Get a locale relative file name</emphasis> 1005</para> 1006 1007<funcsynopsis id='_XlcFileName'> 1008<funcprototype> 1009 <funcdef>char *<function>_XlcFileName</function></funcdef> 1010 <paramdef>XLCd<parameter> lcd</parameter></paramdef> 1011 <paramdef>char<parameter> *category</parameter></paramdef> 1012</funcprototype> 1013</funcsynopsis> 1014 1015<para> 1016The 1017<xref linkend='_XlcFileName' xrefstyle='select: title'/> 1018functions returns a file name which is bound to the specified "<emphasis remap='I'>lcd</emphasis>" 1019and "<emphasis remap='I'>category</emphasis>", as a null-terminated string. If no file name can 1020be found, or there is no readable file for the found file name, 1021<xref linkend='_XlcFileName' xrefstyle='select: title'/> 1022returns NULL. The returned file name should be freed by caller. 1023</para> 1024 1025<para> 1026The rule for searching a file name is implementation dependent. 1027In current implementation, 1028<xref linkend='_XlcFileName' xrefstyle='select: title'/> 1029uses "{category}.dir" file as mapping table, which has pairs of 1030strings, a full locale name and a corresponding file name. 1031</para> 1032 1033</sect1> 1034 1035<sect1 id="Utility_Functions"> 1036<title>Utility Functions</title> 1037 1038<para> 1039<emphasis role="bold">Compare Latin-1 strings</emphasis> 1040</para> 1041 1042<funcsynopsis id='_XlcCompareISOLatin1'> 1043<funcprototype> 1044 <funcdef>int <function> _XlcCompareISOLatin1</function></funcdef> 1045 <paramdef>char*str1,<parameter> *str2</parameter></paramdef> 1046</funcprototype> 1047</funcsynopsis> 1048 1049<funcsynopsis id='_XlcNCompareISOLatin1'> 1050<funcprototype> 1051 <funcdef>int <function> _XlcNCompareISOLatin1</function></funcdef> 1052 <paramdef>char*str1,<parameter> *str2</parameter></paramdef> 1053 <paramdef>int<parameter> len</parameter></paramdef> 1054</funcprototype> 1055</funcsynopsis> 1056 1057<para> 1058The 1059<function>_XlcCompareIsoLatin1 </function> 1060function to compares two ISO-8859-1 strings. Bytes representing ASCII lower 1061case letters are converted to upper case before making the comparison. 1062The value returned is an integer less than, equal to, or greater than 1063zero, depending on whether "<emphasis remap='I'>str1</emphasis>" is lexicographicly less than, 1064equal to, or greater than "<emphasis remap='I'>str2</emphasis>". 1065</para> 1066 1067<para> 1068The 1069<function>_XlcNCompareIsoLatin1</function> 1070function is identical to 1071<function>_XlcCompareISOLatin1,</function> 1072except that at most "<emphasis remap='I'>len</emphasis>" bytes are compared. 1073</para> 1074 1075<para> 1076<emphasis role="bold">Resource Utility</emphasis> 1077</para> 1078 1079<funcsynopsis id='XlcNumber'> 1080<funcprototype> 1081 <funcdef>int <function> XlcNumber</function></funcdef> 1082 <paramdef>ArrayType<parameter> array</parameter></paramdef> 1083</funcprototype> 1084</funcsynopsis> 1085 1086<para> 1087Similar to XtNumber. 1088</para> 1089 1090<funcsynopsis id='_XlcCopyFromArg'> 1091<funcprototype> 1092 <funcdef>void <function> _XlcCopyFromArg</function></funcdef> 1093 <paramdef>char<parameter> *src</parameter></paramdef> 1094 <paramdef>char<parameter> *dst</parameter></paramdef> 1095 <paramdef>int<parameter> size</parameter></paramdef> 1096</funcprototype> 1097</funcsynopsis> 1098 1099<funcsynopsis id='_XlcCopyToArg'> 1100<funcprototype> 1101 <funcdef>void <function> _XlcCopyToArg</function></funcdef> 1102 <paramdef>char<parameter> *src</parameter></paramdef> 1103 <paramdef>char<parameter> **dst</parameter></paramdef> 1104 <paramdef>int<parameter> size</parameter></paramdef> 1105</funcprototype> 1106</funcsynopsis> 1107 1108<para> 1109Similar to 1110<function>_XtCopyFromArg </function> 1111and 1112<function>_XtCopyToArg.</function> 1113</para> 1114 1115<funcsynopsis id='_XlcCountVaList'> 1116<funcprototype> 1117 <funcdef>void <function> _XlcCountVaList</function></funcdef> 1118 <paramdef>va_list<parameter> var</parameter></paramdef> 1119 <paramdef>int<parameter> *count_ret</parameter></paramdef> 1120</funcprototype> 1121</funcsynopsis> 1122 1123<para> 1124Similar to 1125<function>_XtCountVaList.</function> 1126</para> 1127 1128<funcsynopsis id='_XlcVaToArgList'> 1129<funcprototype> 1130 <funcdef>void <function> _XlcVaToArgList</function></funcdef> 1131 <paramdef>va_list<parameter> var</parameter></paramdef> 1132 <paramdef>int<parameter> count</parameter></paramdef> 1133 <paramdef>XlcArgList<parameter> *args_ret</parameter></paramdef> 1134</funcprototype> 1135</funcsynopsis> 1136 1137<para> 1138Similar to 1139<function>_XtVaToArgList.</function> 1140</para> 1141 1142<literallayout class="monospaced"> 1143typedef struct _XlcResource { 1144 char *name; 1145 XrmQuark xrm_name; 1146 int size; 1147 int offset; 1148 unsigned long mask; 1149} XlcResource, *XlcResourceList; 1150</literallayout> 1151 1152<literallayout class="monospaced"> 1153#define XlcCreateMask (1L<<0) 1154#define XlcDefaultMask (1L<<1) 1155#define XlcGetMask (1L<<2) 1156#define XlcSetMask (1L<<3) 1157#define XlcIgnoreMask (1L<<4) 1158</literallayout> 1159 1160<funcsynopsis id='_XlcCompileResourceList'> 1161<funcprototype> 1162 <funcdef>void <function> _XlcCompileResourceList</function></funcdef> 1163 <paramdef>XlcResourceList<parameter> resources</parameter></paramdef> 1164 <paramdef>int<parameter> num_resources</parameter></paramdef> 1165</funcprototype> 1166</funcsynopsis> 1167 1168<para> 1169Similar to 1170<function>_XtCompileResourceList.</function> 1171</para> 1172 1173<funcsynopsis id='_XlcGetValues'> 1174<funcprototype> 1175 <funcdef>char * <function> _XlcGetValues</function></funcdef> 1176 <paramdef>XPointer<parameter> base</parameter></paramdef> 1177 <paramdef>XlcResourceList<parameter> resources</parameter></paramdef> 1178 <paramdef>int<parameter> num_resources</parameter></paramdef> 1179 <paramdef>XlcArgList<parameter> args</parameter></paramdef> 1180 <paramdef>int<parameter> num_args</parameter></paramdef> 1181 <paramdef>unsignedlong<parameter> mask</parameter></paramdef> 1182</funcprototype> 1183</funcsynopsis> 1184 1185<para> 1186Similar to XtGetSubvalues. 1187</para> 1188 1189<funcsynopsis id='_XlcSetValues'> 1190<funcprototype> 1191 <funcdef>char * <function> _XlcSetValues</function></funcdef> 1192 <paramdef>XPointer<parameter> base</parameter></paramdef> 1193 <paramdef>XlcResourceList<parameter> resources</parameter></paramdef> 1194 <paramdef>int<parameter> num_resources</parameter></paramdef> 1195 <paramdef>XlcArgList<parameter> args</parameter></paramdef> 1196 <paramdef>int<parameter> num_args</parameter></paramdef> 1197 <paramdef>unsignedlong<parameter> mask</parameter></paramdef> 1198</funcprototype> 1199</funcsynopsis> 1200 1201<para> 1202Similar to XtSetSubvalues. 1203</para> 1204 1205<para> 1206<emphasis role="bold">ANSI C Compatible Functions</emphasis> 1207</para> 1208 1209<para> 1210The following are ANSI C/MSE Compatible Functions for non-ANSI C environment. 1211</para> 1212 1213<funcsynopsis id='_Xmblen'> 1214<funcprototype> 1215 <funcdef>int <function> _Xmblen</function></funcdef> 1216 <paramdef>char<parameter> *str</parameter></paramdef> 1217 <paramdef>int<parameter> len</parameter></paramdef> 1218</funcprototype> 1219</funcsynopsis> 1220 1221<para> 1222The 1223<xref linkend='_Xmblen' xrefstyle='select: title'/> 1224function returns the number of characters pointed to by "<emphasis remap='I'>str</emphasis>". 1225Only "<emphasis remap='I'>len</emphasis>" bytes in "<emphasis remap='I'>str</emphasis>" are used in determining the 1226character count returned. "<emphasis remap='I'>Str</emphasis>" may point at characters from 1227any valid codeset in the current locale. 1228</para> 1229 1230<para> 1231The call 1232<xref linkend='_Xmblen' xrefstyle='select: title'/> 1233is equivalent to 1234_Xmbtowc(_Xmbtowc((<emphasis remap='I'>wchar_t*</emphasis>)NULL, <emphasis remap='I'>str</emphasis>, <emphasis remap='I'>len</emphasis>)) 1235</para> 1236 1237<funcsynopsis id='_Xmbtowc'> 1238<funcprototype> 1239 <funcdef>int <function> _Xmbtowc</function></funcdef> 1240 <paramdef>wchar_t<parameter> *wstr</parameter></paramdef> 1241 <paramdef>char<parameter> *str</parameter></paramdef> 1242 <paramdef>int<parameter> len</parameter></paramdef> 1243</funcprototype> 1244</funcsynopsis> 1245 1246<para> 1247The 1248<xref linkend='_Xmbtowc' xrefstyle='select: title'/> 1249function converts the character(s) pointed to by "<emphasis remap='I'>str</emphasis>" 1250to their wide character representation(s) pointed to by "<emphasis remap='I'>wstr</emphasis>". 1251"<emphasis remap='I'>Len</emphasis>" is the number of bytes in "<emphasis remap='I'>str</emphasis>" to be converted. 1252The return value is the number of characters converted. 1253</para> 1254 1255<para> 1256The call 1257<xref linkend='_Xmbtowc' xrefstyle='select: title'/> 1258is equivalent to 1259_Xlcmbtowc((XLCd)NULL, <emphasis remap='I'>wstr</emphasis>, <emphasis remap='I'>str</emphasis>, <emphasis remap='I'>len</emphasis>) 1260</para> 1261 1262<funcsynopsis id='_Xlcmbtowc'> 1263<funcprototype> 1264 <funcdef>int <function> _Xlcmbtowc</function></funcdef> 1265 <paramdef>XLCd<parameter> lcd</parameter></paramdef> 1266 <paramdef>wchar_t<parameter> *wstr</parameter></paramdef> 1267 <paramdef>char<parameter> *str</parameter></paramdef> 1268 <paramdef>int<parameter> len</parameter></paramdef> 1269</funcprototype> 1270</funcsynopsis> 1271 1272<para> 1273The 1274<xref linkend='_Xlcmbtowc' xrefstyle='select: title'/> 1275function is identical to 1276<function>_Xmbtowc, </function> 1277except that it requires the "<emphasis remap='I'>lcd</emphasis>" argument. If "<emphasis remap='I'>lcd</emphasis>" 1278is (XLCd) NULL, 1279<function>_Xlcmbtowc, </function> 1280calls 1281<function>_XlcCurrentLC </function> 1282to determine the current locale. 1283</para> 1284 1285<funcsynopsis id='_Xwctomb'> 1286<funcprototype> 1287 <funcdef>int <function> _Xwctomb</function></funcdef> 1288 <paramdef>char<parameter> *str</parameter></paramdef> 1289 <paramdef>wchar_t<parameter> wc</parameter></paramdef> 1290</funcprototype> 1291</funcsynopsis> 1292 1293<para> 1294The 1295<xref linkend='_Xwctomb' xrefstyle='select: title'/> 1296function converts a single wide character pointed to by "<emphasis remap='I'>wc</emphasis>" to 1297its multibyte representation pointed to by "<emphasis remap='I'>str</emphasis>". 1298On success, the return value is 1. 1299</para> 1300 1301<para> 1302The call 1303<xref linkend='_Xwctomb' xrefstyle='select: title'/> 1304is equivalent to 1305_Xlcwctomb((XLCd)NULL, <emphasis remap='I'>str</emphasis>, <emphasis remap='I'>wstr</emphasis>) 1306</para> 1307 1308<funcsynopsis id='_Xlcwctomb'> 1309<funcprototype> 1310 <funcdef>int <function> _Xlcwctomb</function></funcdef> 1311 <paramdef>XLCd<parameter> lcd</parameter></paramdef> 1312 <paramdef>char<parameter> *str</parameter></paramdef> 1313 <paramdef>wchar_t<parameter> wc</parameter></paramdef> 1314</funcprototype> 1315</funcsynopsis> 1316 1317<para> 1318The 1319<xref linkend='_Xlcwctomb' xrefstyle='select: title'/> 1320function is identical to _Xwctomb, except that it requires the 1321"<emphasis remap='I'>lcd</emphasis>" argument. If "<emphasis remap='I'>lcd</emphasis>" is (XLCd) NULL, 1322<function>_Xlcwctomb, </function> 1323calls 1324<function>_XlcCurrentLC </function> 1325to determine the current locale. 1326</para> 1327 1328<funcsynopsis id='_Xmbstowcs'> 1329<funcprototype> 1330 <funcdef>int <function> _Xmbstowcs</function></funcdef> 1331 <paramdef>wchar_t<parameter> *wstr</parameter></paramdef> 1332 <paramdef>char<parameter> *str</parameter></paramdef> 1333 <paramdef>int<parameter> len</parameter></paramdef> 1334</funcprototype> 1335</funcsynopsis> 1336 1337<para> 1338The 1339<xref linkend='_Xmbstowcs' xrefstyle='select: title'/> 1340function converts the NULL-terminated string pointed to by "<emphasis remap='I'>str</emphasis>" 1341to its wide character string representation pointed to by "<emphasis remap='I'>wstr</emphasis>". 1342"<emphasis remap='I'>Len</emphasis>" is the number of characters in "<emphasis remap='I'>str</emphasis>" to be converted. 1343</para> 1344 1345<para> 1346The call 1347<xref linkend='_Xmbstowcs' xrefstyle='select: title'/> 1348is equivalent to 1349_Xlcmbstowcs((XLCd)NULL, <emphasis remap='I'>wstr</emphasis>, <emphasis remap='I'>str</emphasis>, <emphasis remap='I'>len</emphasis>) 1350</para> 1351 1352<funcsynopsis id='_Xlcmbstowcs'> 1353<funcprototype> 1354 <funcdef>int <function> _Xlcmbstowcs</function></funcdef> 1355 <paramdef>XLCd<parameter> lcd</parameter></paramdef> 1356 <paramdef>wchar_t<parameter> *wstr</parameter></paramdef> 1357 <paramdef>char<parameter> *str</parameter></paramdef> 1358 <paramdef>int<parameter> len</parameter></paramdef> 1359</funcprototype> 1360</funcsynopsis> 1361 1362<para> 1363The 1364<xref linkend='_Xlcmbstowcs' xrefstyle='select: title'/> 1365function is identical to _Xmbstowcs, except that it requires the 1366"<emphasis remap='I'>lcd</emphasis>" argument. If "<emphasis remap='I'>lcd</emphasis>" is (XLCd) NULL, 1367<function>_Xlcmbstowcs, </function> 1368calls 1369<function>_XlcCurrentLC</function> 1370to determine the current locale. 1371</para> 1372 1373<funcsynopsis id='_Xwcstombs'> 1374<funcprototype> 1375 <funcdef>int <function> _Xwcstombs</function></funcdef> 1376 <paramdef>char<parameter> *str</parameter></paramdef> 1377 <paramdef>wchar_t<parameter> *wstr</parameter></paramdef> 1378 <paramdef>int<parameter> len</parameter></paramdef> 1379</funcprototype> 1380</funcsynopsis> 1381 1382<para> 1383The 1384<xref linkend='_Xwcstombs' xrefstyle='select: title'/> 1385function converts the (wchar_t) NULL terminated wide character string 1386pointed to by "<emphasis remap='I'>wstr</emphasis>" to the NULL terminated multibyte string 1387pointed to by "<emphasis remap='I'>str</emphasis>". 1388</para> 1389 1390<para> 1391The call 1392<xref linkend='_Xwcstombs' xrefstyle='select: title'/> 1393is equivalent to 1394_Xlcwcstombs((XLCd)NULL, <emphasis remap='I'>str</emphasis>, <emphasis remap='I'>wstr</emphasis>, <emphasis remap='I'>len</emphasis>) 1395</para> 1396 1397<funcsynopsis id='_Xlcwcstombs'> 1398<funcprototype> 1399 <funcdef>int <function> _Xlcwcstombs</function></funcdef> 1400 <paramdef>XLCd<parameter> lcd</parameter></paramdef> 1401 <paramdef>char<parameter> *str</parameter></paramdef> 1402 <paramdef>wchar_t<parameter> *wstr</parameter></paramdef> 1403 <paramdef>int<parameter> len</parameter></paramdef> 1404</funcprototype> 1405</funcsynopsis> 1406 1407<para> 1408The 1409<xref linkend='_Xlcwcstombs' xrefstyle='select: title'/> 1410function is identical to _Xwcstombs, except that it requires the 1411"<emphasis remap='I'>lcd</emphasis>" argument. If "<emphasis remap='I'>lcd</emphasis>" is (XLCd) NULL, 1412<function>_Xlcwcstombs, </function> 1413calls 1414<function>_XlcCurrentLC </function> 1415to determine the current locale. 1416</para> 1417 1418<funcsynopsis id='_Xwcslen'> 1419<funcprototype> 1420 <funcdef>int <function> _Xwcslen</function></funcdef> 1421 <paramdef>wchar_t<parameter> *wstr</parameter></paramdef> 1422</funcprototype> 1423</funcsynopsis> 1424 1425<para> 1426The 1427<xref linkend='_Xwcslen' xrefstyle='select: title'/> 1428function returns the count of wide characters in the (wchar_t) NULL 1429terminated wide character string pointed to by "<emphasis remap='I'>wstr</emphasis>". 1430</para> 1431 1432<funcsynopsis id='_Xwcscpy'> 1433<funcprototype> 1434 <funcdef>wchar_t *<function> _Xwcscpy</function></funcdef> 1435 <paramdef>wchar_t<parameter> *wstr1</parameter></paramdef> 1436 <paramdef>wchar_t<parameter> *wstr2</parameter></paramdef> 1437</funcprototype> 1438</funcsynopsis> 1439 1440<funcsynopsis id='_Xwcsncpy'> 1441<funcprototype> 1442 <funcdef>wchar_t * <function> _Xwcsncpy</function></funcdef> 1443 <paramdef>wchar_t<parameter> *wstr1</parameter></paramdef> 1444 <paramdef>wchar_t<parameter> *wstr2</parameter></paramdef> 1445 <paramdef>int<parameter> len</parameter></paramdef> 1446</funcprototype> 1447</funcsynopsis> 1448 1449<para> 1450The 1451<xref linkend='_Xwcscpy' xrefstyle='select: title'/> 1452function copies the (wchar_t) NULL terminated wide character string 1453pointed to by "<emphasis remap='I'>wstr2</emphasis>" to the object pointed at by "<emphasis remap='I'>wstr1</emphasis>". 1454"<emphasis remap='I'>Wstr1</emphasis>" is (wchar_t) NULL terminated. The return value is a 1455pointer to "<emphasis remap='I'>wstr1</emphasis>". 1456</para> 1457 1458<para> 1459The 1460<xref linkend='_Xwcsncpy' xrefstyle='select: title'/> 1461function is identical to 1462<function>_Xwcscpy, </function> 1463except that it copies "<emphasis remap='I'>len</emphasis>" wide characters from the object 1464pointed to by "<emphasis remap='I'>wstr2</emphasis>" to the object pointed to "<emphasis remap='I'>wstr1</emphasis>". 1465</para> 1466 1467<funcsynopsis id='_Xwcscmp'> 1468<funcprototype> 1469 <funcdef>int <function> _Xwcscmp</function></funcdef> 1470 <paramdef>wchar_t*wstr1,<parameter> *wstr2</parameter></paramdef> 1471</funcprototype> 1472</funcsynopsis> 1473 1474<funcsynopsis id='_Xwcsncmp'> 1475<funcprototype> 1476 <funcdef>int <function> _Xwcsncmp</function></funcdef> 1477 <paramdef>wchar_t*wstr1,<parameter> *wstr2</parameter></paramdef> 1478 <paramdef>int<parameter> len</parameter></paramdef> 1479</funcprototype> 1480</funcsynopsis> 1481 1482<para> 1483The 1484<xref linkend='_Xwcscmp' xrefstyle='select: title'/> 1485function compares two (wchar_t) NULL terminated wide character strings. 1486The value returned is an integer less than, equal to, or greater than zero, 1487depending on whether "<emphasis remap='I'>wstr1</emphasis>" is lexicographicly less then, equal to, 1488or greater than "<emphasis remap='I'>str2</emphasis>". 1489</para> 1490 1491<para> 1492The 1493<xref linkend='_Xwcsncmp' xrefstyle='select: title'/> 1494function is identical to 1495<function>_XlcCompareISOLatin1, </function> 1496except that at most "<emphasis remap='I'>len</emphasis>" wide characters are compared. 1497</para> 1498 1499 1500<!-- .sp --> 1501<!-- .\" .LP --> 1502<!-- .\" <function>Locale Method Internal Functions</function> --> 1503<!-- .\" .LP --> 1504<!-- .\" .FD 0 --> 1505<!-- .\" XlcCharSet _XlcCreateDefaultCharSet(<emphasis remap='I'>name</emphasis>, <emphasis remap='I'>ct_sequence</emphasis>) --> 1506<!-- .\" .br --> 1507<!-- .\" char <emphasis remap='I'>*name</emphasis>; --> 1508<!-- .\" .br --> 1509<!-- .\" char <emphasis remap='I'>*ct_sequence</emphasis>; --> 1510<!-- .\" .FN --> 1511<!-- .\" .FD 0 --> 1512<!-- .\" Bool _XlcParseCharSet(<emphasis remap='I'>charset</emphasis>) --> 1513<!-- .\" .br --> 1514<!-- .\" XlcCharSet <emphasis remap='I'>charset</emphasis>; --> 1515<!-- .\" .FN --> 1516<!-- .\" .FD 0 --> 1517<!-- .\" 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>) --> 1518<!-- .\" .br --> 1519<!-- .\" XLCd <emphasis remap='I'>lcd</emphasis>; --> 1520<!-- .\" .br --> 1521<!-- .\" char <emphasis remap='I'>*category</emphasis>; --> 1522<!-- .\" .br --> 1523<!-- .\" char <emphasis remap='I'>*name</emphasis>; --> 1524<!-- .\" .br --> 1525<!-- .\" char <emphasis remap='I'>***value</emphasis>; --> 1526<!-- .\" .br --> 1527<!-- .\" int <emphasis remap='I'>*count</emphasis>; --> 1528<!-- .\" .FN --> 1529<!-- .\" .FD 0 --> 1530<!-- .\" void _XlcDestroyLocaleDataBase(<emphasis remap='I'>lcd</emphasis>) --> 1531<!-- .\" .br --> 1532<!-- .\" XLCd <emphasis remap='I'>lcd</emphasis>; --> 1533<!-- .\" .FN --> 1534<!-- .\" .FD 0 --> 1535<!-- .\" XPointer _XlcCreateLocaleDataBase(<emphasis remap='I'>lcd</emphasis>) --> 1536<!-- .\" .br --> 1537<!-- .\" XLCd <emphasis remap='I'>lcd</emphasis>; --> 1538<!-- .\" .FN --> 1539<!-- .\" .LP --> 1540<!-- .\" .sp --> 1541<!-- .\" <function>Obtain an locale database path</function> --> 1542<!-- .\" .LP --> 1543<!-- .\" .FD 0 --> 1544<!-- .\" int _XlcResolveI18NPath(<emphasis remap='I'>dir</emphasis>) --> 1545<!-- .\" .br --> 1546<!-- .\" char <emphasis remap='I'>*dir</emphasis>; --> 1547<!-- .\" .FN --> 1548<!-- .\" .LP --> 1549<!-- .\" The --> 1550<!-- .\" .PN _XlcResolveI18NPath --> 1551<!-- .\" function returns path name list that is related to X Locale Database. --> 1552<!-- .\" The obtained path is stored into the array which is pointed by --> 1553<!-- .\" specified "<emphasis remap='I'>dir</emphasis>". The path consists of directory paths which --> 1554<!-- .\" are separated with colon. --> 1555<!-- .\" If the environment variable XLOCALEDIR is specified, the path --> 1556<!-- .\" contains its contents. --> 1557<!-- .\" .LP --> 1558<!-- .\" The default path of X Locale Database is implementation dependent. --> 1559<!-- .\" In current implementation, it's determined in build time. --> 1560<!-- .\" .LP --> 1561<!-- .\" .PN _XlcResolveI18NPath --> 1562<!-- .\" does not check overflow of the array to which the "<emphasis remap='I'>dir</emphasis>" --> 1563<!-- .\" parameter points. Caller should provide enough buffer to store this --> 1564<!-- .\" string. --> 1565<!-- .\" .LP --> 1566<!-- .\" .sp --> 1567<!-- .\" <function>Obtain a full locale name</function> --> 1568<!-- .\" .LP --> 1569<!-- .\" .FD 0 --> 1570<!-- .\" 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>) --> 1571<!-- .\" .br --> 1572<!-- .\" char <emphasis remap='I'>*lc_name</emphasis>; --> 1573<!-- .\" .br --> 1574<!-- .\" char <emphasis remap='I'>*full_name</emphasis>; --> 1575<!-- .\" .br --> 1576<!-- .\" char <emphasis remap='I'>*language</emphasis>; --> 1577<!-- .\" .br --> 1578<!-- .\" char <emphasis remap='I'>*territory</emphasis>; --> 1579<!-- .\" .br --> 1580<!-- .\" char <emphasis remap='I'>*codeset</emphasis>; --> 1581<!-- .\" .FN --> 1582<!-- .\" .LP --> 1583<!-- .\" The --> 1584<!-- .\" .PN _XlcResolveLocaleName --> 1585<!-- .\" function returns a full locale name. --> 1586<!-- .\" The obtained full locale name is stored into the array which is --> 1587<!-- .\" pointed by specified "<emphasis remap='I'>full_name</emphasis>". --> 1588<!-- .\" The language, territory and codeset part of the full locale name --> 1589<!-- .\" are copied to the return arguments, "<emphasis remap='I'>language</emphasis>", --> 1590<!-- .\" "<emphasis remap='I'>territory</emphasis>" and "<emphasis remap='I'>codeset</emphasis>", respectively. --> 1591<!-- .\" NULL can be specified for these arguments. --> 1592<!-- .\" .LP --> 1593<!-- .\" The rule for mapping from locale name to full locale name is --> 1594<!-- .\" implementation dependent. --> 1595<!-- .\" .LP --> 1596<!-- .\" .PN _XlcResolveLocaleName --> 1597<!-- .\" does not check overflow of the array to which --> 1598<!-- .\" "<emphasis remap='I'>full_name</emphasis>", "<emphasis remap='I'>language</emphasis>", "<emphasis remap='I'>territory</emphasis>" and --> 1599<!-- .\" "<emphasis remap='I'>codeset</emphasis>" parameter point. --> 1600<!-- .\" Caller should provide enough buffer to store those string. --> 1601<!-- .\" .LP --> 1602<!-- .\" In current implementation, --> 1603<!-- .\" .PN _XlcResolveLocaleName --> 1604<!-- .\" uses locale.alias file as mapping table, which has pairs of strings, --> 1605<!-- .\" a locale name and a full locale name. --> 1606<!-- .\" .LP --> 1607<!-- .\" .FD 0 --> 1608<!-- .\" int _XlcResolveDBName(<emphasis remap='I'>lc_name</emphasis>, <emphasis remap='I'>file_name</emphasis>) --> 1609<!-- .\" .br --> 1610<!-- .\" char <emphasis remap='I'>*lc_name</emphasis>; --> 1611<!-- .\" .br --> 1612<!-- .\" char <emphasis remap='I'>*file_name</emphasis>; --> 1613<!-- .\" .FN --> 1614<!-- .\" .FD 0 --> 1615<!-- .\" XLCd _XlcCreateLC(<emphasis remap='I'>name</emphasis>, <emphasis remap='I'>methods</emphasis>) --> 1616<!-- .\" .br --> 1617<!-- .\" char <emphasis remap='I'>*name</emphasis>; --> 1618<!-- .\" .br --> 1619<!-- .\" XLCdMethods <emphasis remap='I'>methods</emphasis>; --> 1620<!-- .\" .FN --> 1621<!-- .\" .FD 0 --> 1622<!-- .\" void _XlcDestroyLC(<emphasis remap='I'>lcd</emphasis>) --> 1623<!-- .\" .br --> 1624<!-- .\" XLCd <emphasis remap='I'>lcd</emphasis>; --> 1625<!-- .\" .FN --> 1626<!-- .\" .LP --> 1627<!-- .\" --> 1628 1629</sect1> 1630</chapter> 1631</book> 1632