


XLocale(3X11)							XLocale(3X11)
X11R5									X11R5



NAME
  XLocale - all	functions to access locale database

SYNOPSIS
  ##iinncclluuddee "_X_l_o_c_a_l_e_i_n_t._h"

  iinntt
  __XXmmbbttyyppee(_x_l_o_c_a_l_e)
  XXLLooccaallee _x_l_o_c_a_l_e;;

  The _Xmbtype() returns the codeset type of the locale. Two types will	be
  returned:

       CDS_STATELESS --	state-independent codeset
       CDS_STATEFUL  --	state-dependent	codeset

  If application never calls the setting locale, the function returns -1, no
  locale has been set.	With the _Xmbtype you can check	if there is locale.

  iinntt
  __XXmmbbccssnnuumm(_x_l_o_c_a_l_e)
  XXLLooccaallee _x_l_o_c_a_l_e;;

  The _Xmbcsnum	returns	the number of charsets of the locale.

  __CCSSIIDD
  __XXmmbbccssiidd(_x_l_o_c_a_l_e, _m_b_s_t_r)
  XXllooccaallee _x_l_o_c_a_l_e;;
  uunnssiiggnneedd cchhaarr	**_m_b_s_t_r;;

  The function returns the charset id "CSi" of the multibyte character
  encoded in the current locale.  The multibyte	character is stored in the
  null-terminated string "mbstr".  The charset id is ordered from positive
  number 0.  The CSi is	defined	to a constant "i", e.g,	CS1 is constant	1.

  The _Xmbcsid returns constant	ND for any error of the	multibyte character
  which	maybe wrong code, or maybe terminated unexpectly.

  For state-dependent codeset, _Xmbcsid	keeps the track	of the current lock-
  ing shift-state. In other word only this function _Xmbcsid would change the
  current state.   When	the mbstr is passed as a NULL pointer, the _Xmbcsid
  sets the initial state.

       _Xmbcsid(xlocale, NULL)

  iinntt
  __XXmmbblleenn(_x_l_o_c_a_l_e)
  XXLLooccaallee _x_l_o_c_a_l_e;;

  The _Xmblen returns the number of bytes of the current charset in the	xlo-
  cale.	 The returned value is zero for	wrong charset id.

  cchhaarr **
  __XXmmbbddssgg(_x_l_o_c_a_l_e)
  XXLLooccaallee _x_l_o_c_a_l_e;;

  This function	is for state-dependent codeset only.  The _Xmbdsg returns the
  designation of this charset. The NULL	returned is for	wrong csid. The
  returned string is owned by the locale, do not change	or free	it.

  iinntt
  __XXmmbbddlleenn(_x_l_o_c_a_l_e, _m_b_s_t_r)
  XXllooccaallee _x_l_o_c_a_l_e;;
  unsigned char	*_m_b_s_t_r;;

  This function	is for state-dependent codeset only.  If the mbstr contains a
  complete designation sequence, the _Xmbdsg returns the length	of the
  sequence; otherwise returns zero.  The mbstr is null-terminated string.

  iinntt
  __XXmmbbffssnnuumm(_x_l_o_c_a_l_e)
  XXLLooccaallee _x_l_o_c_a_l_e;;

  The _Xmbfsnum	returns	the number of font charsets of the current locale.
  This number is different from	_Xmbcsnum().

  cchhaarr **
  __XXmmbbffssnnaammee(_x_l_o_c_a_l_e)
  XXLLooccaallee _x_l_o_c_a_l_e;;

  The _Xmbfsname returns the charset name with the current charset. The	name
  is form of CharsetRegistry-CharsetEncoding registered	by X in	the defini-
  tion of XLFD.	 The NULL returned is for the wrong charset.  The returned
  string is owned by the current locale, so do not change and free this	data.

  iinntt
  __XXmmbbffsslleenn(_x_l_o_c_a_l_e)
  XXLLooccaallee _x_l_o_c_a_l_e;;

  The _Xmbfslen	returns	the number of bytes of the current charset of font
  encoding. The	zero returned is for wrong charset.

  wwcchhaarr
  __XXmmbbffsswwff(_x_l_o_c_a_l_e, _c_s_i_d) XXLLooccaallee _x_l_o_c_a_l_e;;
  iinntt _c_s_i_d;;

  The _Xmbfswf returns the woffset of the font charset id.  This woffset is
  for the 4-byte wchar encoding. The negative value -1 returned	is for wrong
  csid.

  cchhaarr **
  __XXmmbbffssddssgg(_x_l_o_c_a_l_e)
  XXLLooccaallee _x_l_o_c_a_l_e;;

  The _Xmbfsdsg	returns	the designation	sequence, i.e.,	escape sequence	of
  font charset which is	registered by X	in the "Compound Text Encoding,	Ver-
  sion 1.1".  The returned value is owned by the locale, do not	free or
  change it.  The NULL returned	is for wrong charset.

  iinntt
  __XXmmbbccttooccsscc(_x_l_o_c_a_l_e, _m_b_s_t_r, _c_s_c_o_d_e)
  XXLLooccaallee _x_l_o_c_a_l_e;;
  uunnssiiggnneedd cchhaarr	**_m_b_s_t_r;;
  uunnssiiggnneedd iinntt **_c_s_c_o_d_e;;

  The _Xmbctocsc converts codepoint of multibyte character to codepoint	of
  charset. The csid is it's charset id.	 The converted code is stored in the
  cscode.  If wrong codepoint, use the first codepoint of csid as default,
  and return negative value. if	correct, return	0 meaning Success.  The
  _Xmbctocsc always supposes that the mbstr points to a	codepoint, not
  shift-state sequence if codeset is state-dependent. The caller should	note
  this,	otherwise the _Xmbctocsc treats	it as wrong codepoint.


  iinntt
  __XXccssccttoommbbcc(_x_l_o_c_a_l_e, _c_s_c_o_d_e, _c_o_d_e)
  XXLLooccaallee _x_l_o_c_a_l_e;;
  uunnssiiggnneedd iinntt _c_s_c_o_d_e;;
  uunnssiiggnneedd iinntt **_c_o_d_e;;

  The _Xcsctombc does the reverse conversion of	_Xmbctocsc.

  cchhaarr **
  __XXsseettllooccaallee(_l_o_c_a_l_e__c_a_t_e_g_o_r_y, _l_o_c_a_l_e__n_a_m_e)
  iinntt _l_o_c_a_l_e__c_a_t_e_g_o_r_y;;
  cchhaarr **_l_o_c_a_l_e__n_a_m_e;;

  The _Xsetlocale sets the current locale for the specified category.  If the
  operation was	successful, _Xsetlocale	returns	a pointer to the current
  locale name for the category If the category is invalid or the locale	is
  not supported	in the system, _Xsetlocale returns a NULL pointer.  The
  returned locale name is owned	by the system locale, do not change or free
  it.

  The category is defined to one of the	following:

       LC_CTYPE
       LC_ALL

  The locale name is allowed to	the form:

       NULL
       ""
       string

  The value NULL means to query	the current locale name, and _Xsetlocale
  returns the locale name string.

  The empty string sets	the implementation-dependent locale. It	examines the
  environment $LANG.  If ${LANG} is set	and contains the name of a valid
  locale, that value is	used to	set category. If the value is still not
  obtained, _Xsetlocale	sets the category to C-language	"C" and	return the
  locale name. The C locale is ASCII codeset.

  The locale name is accepted to the following form:

       language[_territory[.codeset]]

  The language and territory are country codes defined in ISO 639 and ISO
  3166.

SEE ALSO
  X/Open Portability Guide, Volume 3, XSI Internationalization.
  IS0 639, ISO 3166.
















