Back to index

im-sdk  12.3.91
XlcPublic.h
Go to the documentation of this file.
00001 /* $Xorg: XlcPublic.h,v 1.3 2000/08/17 19:45:06 cpqbld Exp $ */
00002 /*
00003  * Copyright 1992, 1993 by TOSHIBA Corp.
00004  *
00005  * Permission to use, copy, modify, and distribute this software and its
00006  * documentation for any purpose and without fee is hereby granted, provided
00007  * that the above copyright notice appear in all copies and that both that
00008  * copyright notice and this permission notice appear in supporting
00009  * documentation, and that the name of TOSHIBA not be used in advertising
00010  * or publicity pertaining to distribution of the software without specific,
00011  * written prior permission. TOSHIBA make no representations about the
00012  * suitability of this software for any purpose.  It is provided "as is"
00013  * without express or implied warranty.
00014  *
00015  * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
00016  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
00017  * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
00018  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
00019  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
00020  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
00021  * SOFTWARE.
00022  *
00023  * Author: Katsuhisa Yano   TOSHIBA Corp.
00024  *                          mopi@osa.ilab.toshiba.co.jp
00025  */
00026 /*
00027  * Copyright 1995 by FUJITSU LIMITED
00028  * This is source code modified by FUJITSU LIMITED under the Joint
00029  * Development Agreement for the CDE/Motif PST.
00030  *
00031  * Modifier: Takanori Tateno   FUJITSU LIMITED
00032  *
00033  */
00034 /* $XFree86: xc/lib/X11/XlcPublic.h,v 1.9 2001/01/17 19:41:49 dawes Exp $ */
00035 /*
00036  * Most of this API is documented in i18n/Framework.PS
00037  */
00038 
00039 #ifndef _XLCPUBLIC_H_
00040 #define _XLCPUBLIC_H_
00041 
00042 #include "Xlcint.h"
00043 
00044 
00045 /*
00046  * Character sets.
00047  */
00048 
00049 /* Every character set has a "side". It denotes the range of byte values for
00050    which the character set is responsible. This means that the character
00051    set's encoded characters will only assumes bytes within the range, and
00052    that the character set can be used simultaneously with another character
00053    set responsible for a disjoint range. */
00054 typedef enum {
00055     XlcUnknown,
00056     XlcC0,           /* responsible for values 0x00..0x1F */
00057     XlcGL,           /* responsible for values 0x00..0x7F or 0x20..0x7F */
00058     XlcC1,           /* responsible for values 0x80..0x9F */
00059     XlcGR,           /* responsible for values 0x80..0xFF or 0xA0..0xFF */
00060     XlcGLGR,         /* responsible for values 0x00..0xFF */
00061     XlcOther,        /* unused */
00062     XlcNONE
00063 } XlcSide;
00064 
00065 /* Data read from XLC_LOCALE files.
00066    XXX Apparently superseded by _XUDCGlyphRegion. */
00067 typedef struct _UDCArea {
00068     unsigned long    start;
00069     unsigned long    end;
00070 } UDCAreaRec, *UDCArea;
00071 
00072 /* Where the character set comes from. */
00073 typedef enum {
00074     CSsrcUndef,             /* unused */
00075     CSsrcStd,        /* defined in libX11 */
00076     CSsrcXLC         /* defined in an XLC_LOCALE file */
00077 } CSSrc;
00078 
00079 /* These are the supported properties of XlcCharSet. */
00080 #define XlcNCharSize               "charSize"
00081 #define XlcNControlSequence        "controlSequence"
00082 #define XlcNEncodingName    "encodingName"
00083 #define XlcNName            "name"
00084 #define XlcNSetSize         "setSize"
00085 #define XlcNSide            "side"
00086 
00087 /* This is the structure of an XlcCharSet.
00088    Once allocated, they are never freed. */
00089 typedef struct _XlcCharSetRec {
00090     /* Character set name, including side suffix */
00091     const char              *name;
00092     XrmQuark         xrm_name;
00093 
00094     /* XLFD encoding name, no side suffix */
00095     const char              *encoding_name;
00096     XrmQuark         xrm_encoding_name;
00097 
00098     /* Range for which the charset is responsible: XlcGL, XlcGR or XlcGLGR */
00099     XlcSide          side;
00100 
00101     /* Number of bytes per character. 0 means a varying number (e.g. UTF-8) */
00102     int              char_size;
00103     /* Classification of the character set according to ISO-2022 */
00104     int              set_size;     /* e.g. 94 or 96 */
00105     const char              *ct_sequence; /* control sequence of CT */
00106                                    /* (normally at most 4 bytes) */
00107 
00108     /* for UDC */
00109     Bool             string_encoding;
00110     UDCArea          udc_area;
00111     int              udc_area_num;
00112 
00113     /* Description source */
00114     CSSrc            source;
00115 } XlcCharSetRec, *XlcCharSet;
00116 
00117 _XFUNCPROTOBEGIN
00118 
00119 /* Returns the charset with the given name (including side suffix).
00120    Returns NULL if not found. */
00121 extern XlcCharSet _XlcGetCharSet(
00122     const char*             name
00123 );
00124 
00125 /* Returns the charset with the given encoding (no side suffix) and
00126    responsible for at least the given side (XlcGL or XlcGR).
00127    Returns NULL if not found. */
00128 extern XlcCharSet _XlcGetCharSetWithSide(
00129     const char*             encoding_name,
00130     XlcSide          side
00131 );
00132 
00133 /* Registers an XlcCharSet in the list of character sets.
00134    Returns True if successful. */
00135 extern Bool _XlcAddCharSet(
00136     XlcCharSet              charset
00137 );
00138 
00139 /* Retrieves a number of attributes of an XlcCharSet.
00140    Return NULL if successful, otherwise the name of the first argument
00141    specifiying a nonexistent attribute. */
00142 extern char *_XlcGetCSValues(
00143 #if NeedVarargsPrototypes
00144     XlcCharSet              charset,
00145     ...
00146 #endif
00147 );
00148 
00149 _XFUNCPROTOEND
00150 
00151 
00152 #define XlcNCodeset         "codeset"
00153 #define XlcNDefaultString   "defaultString"
00154 #define XlcNLanguage               "language"
00155 #define XlcNMbCurMax               "mbCurMax"
00156 #define XlcNStateDependentEncoding "stateDependentEncoding"
00157 #define XlcNTerritory              "territory"
00158 
00159 typedef struct _FontScope {
00160         unsigned long   start;
00161         unsigned long   end;
00162         unsigned long   shift;
00163         unsigned long   shift_direction;
00164 } FontScopeRec, *FontScope;
00165 
00166 /*
00167  * conversion methods
00168  */
00169 
00170 typedef struct _XlcConvRec *XlcConv;
00171 
00172 typedef XlcConv (*XlcOpenConverterProc)(
00173     XLCd             from_lcd,
00174     const char*             from_type,
00175     XLCd             to_lcd,
00176     const char*             to_type
00177 );
00178 
00179 typedef void (*XlcCloseConverterProc)(
00180 #if NeedFunctionPrototypes
00181     XlcConv          /* conv */
00182 #endif
00183 );
00184 
00185 typedef int (*XlcConvertProc)(
00186 #if NeedFunctionPrototypes
00187     XlcConv          /* conv */,
00188     XPointer*        /* from */,
00189     int*             /* from_left */,
00190     XPointer*        /* to */,
00191     int*             /* to_left */,
00192     XPointer*        /* args */,
00193     int                     /* num_args */
00194 #endif
00195 );
00196 
00197 typedef void (*XlcResetConverterProc)(
00198 #if NeedFunctionPrototypes
00199     XlcConv          /* conv */
00200 #endif
00201 );
00202 
00203 typedef struct _XlcConvMethodsRec{
00204     XlcCloseConverterProc   close;
00205     XlcConvertProc          convert;
00206     XlcResetConverterProc   reset;
00207 } XlcConvMethodsRec, *XlcConvMethods;
00208 
00209 /*
00210  * conversion data
00211  */
00212 
00213 #define XlcNMultiByte              "multiByte"
00214 #define XlcNWideChar               "wideChar"
00215 #define XlcNCompoundText    "compoundText"
00216 #define XlcNString          "string"
00217 #define XlcNUtf8String             "utf8String"
00218 #define XlcNCharSet         "charSet"
00219 #define XlcNCTCharSet              "CTcharSet"
00220 #define XlcNFontCharSet            "FontCharSet"
00221 #define XlcNChar            "char"
00222 #define XlcNUcsChar         "UCSchar"
00223 
00224 typedef struct _XlcConvRec {
00225     XlcConvMethods          methods;
00226     XPointer                state;
00227 } XlcConvRec;
00228 
00229 
00230 _XFUNCPROTOBEGIN
00231 
00232 extern Bool _XInitOM(
00233 #if NeedFunctionPrototypes
00234     XLCd             /* lcd */
00235 #endif
00236 );
00237 
00238 extern Bool _XInitIM(
00239 #if NeedFunctionPrototypes
00240     XLCd             /* lcd */
00241 #endif
00242 );
00243 
00244 #ifdef USE_DYNAMIC_LOADER
00245 extern Bool _XInitDefaultOM(
00246 #if NeedFunctionPrototypes
00247     XLCd             /* lcd */
00248 #endif
00249 );
00250 
00251 extern Bool _XInitDefaultIM(
00252 #if NeedFunctionPrototypes
00253     XLCd             /* lcd */
00254 #endif
00255 );
00256 #endif
00257 
00258 extern char *_XGetLCValues(
00259 #if NeedVarargsPrototypes
00260     XLCd             /* lcd */,
00261     ...
00262 #endif
00263 );
00264 
00265 extern XlcConv _XlcOpenConverter(
00266     XLCd             from_lcd,
00267     const char*             from_type,
00268     XLCd             to_lcd,
00269     const char*             to_type
00270 );
00271 
00272 extern void _XlcCloseConverter(
00273     XlcConv          conv
00274 );
00275 
00276 extern int _XlcConvert(
00277     XlcConv          conv,
00278     XPointer*        from,
00279     int*             from_left,
00280     XPointer*        to,
00281     int*             to_left,
00282     XPointer*        args,
00283     int                     num_args
00284 );
00285 
00286 extern void _XlcResetConverter(
00287     XlcConv          conv
00288 );
00289 
00290 extern Bool _XlcSetConverter(
00291     XLCd                    from_lcd,
00292     const char*                    from_type,
00293     XLCd                    to_lcd,
00294     const char*                    to_type,
00295     XlcOpenConverterProc    open_converter
00296 );
00297 
00298 extern void _XlcGetResource(
00299     XLCd             lcd,
00300     const char*             category,
00301     const char*             _class,
00302     char***          value,
00303     int*             count
00304 );
00305 
00306 extern char *_XlcFileName(
00307     XLCd             lcd,
00308     const char*             category
00309 );
00310 
00311 extern int _Xwcslen(
00312 #if NeedFunctionPrototypes
00313     wchar_t*         /* wstr */
00314 #endif
00315 );
00316 
00317 extern wchar_t *_Xwcscpy(
00318 #if NeedFunctionPrototypes
00319     wchar_t*         /* wstr1 */,
00320     wchar_t*         /* wstr2 */
00321 #endif
00322 );
00323 
00324 /* Compares two ISO 8859-1 strings, ignoring case of ASCII letters.
00325    Like strcasecmp in an ASCII locale. */
00326 extern int _XlcCompareISOLatin1(
00327     const char*             str1,
00328     const char*             str2
00329 );
00330 
00331 /* Compares two ISO 8859-1 strings, at most len bytes of each, ignoring
00332    case of ASCII letters. Like strncasecmp in an ASCII locale. */
00333 extern int _XlcNCompareISOLatin1(
00334     const char*             str1,
00335     const char*             str2,
00336     int                     len
00337 );
00338 
00339 _XFUNCPROTOEND
00340 
00341 #endif  /* _XLCPUBLIC_H_ */