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