1 /* 2 * Copyright 1992, 1993 by TOSHIBA Corp. 3 * 4 * Permission to use, copy, modify, and distribute this software and its 5 * documentation for any purpose and without fee is hereby granted, provided 6 * that the above copyright notice appear in all copies and that both that 7 * copyright notice and this permission notice appear in supporting 8 * documentation, and that the name of TOSHIBA not be used in advertising 9 * or publicity pertaining to distribution of the software without specific, 10 * written prior permission. TOSHIBA make no representations about the 11 * suitability of this software for any purpose. It is provided "as is" 12 * without express or implied warranty. 13 * 14 * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 15 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 16 * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 17 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 18 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 19 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 20 * SOFTWARE. 21 * 22 * Author: Katsuhisa Yano TOSHIBA Corp. 23 * mopi (at) osa.ilab.toshiba.co.jp 24 */ 25 26 #ifndef _XLCPUBLICI_H_ 27 #define _XLCPUBLICI_H_ 28 29 #include "XlcPublic.h" 30 31 #define XLC_PUBLIC(lcd, x) (((XLCdPublic) lcd->core)->pub.x) 32 #define XLC_PUBLIC_PART(lcd) (&(((XLCdPublic) lcd->core)->pub)) 33 #define XLC_PUBLIC_METHODS(lcd) (&(((XLCdPublicMethods) lcd->methods)->pub)) 34 35 /* 36 * XLCd public methods 37 */ 38 39 typedef struct _XLCdPublicMethodsRec *XLCdPublicMethods; 40 41 typedef XLCd (*XlcPubCreateProc)( 42 const char* name, 43 XLCdMethods methods 44 ); 45 46 typedef Bool (*XlcPubInitializeProc)( 47 XLCd lcd 48 ); 49 50 typedef void (*XlcPubDestroyProc)( 51 XLCd lcd 52 ); 53 54 typedef char* (*XlcPubGetValuesProc)( 55 XLCd lcd, 56 XlcArgList args, 57 int num_args 58 ); 59 60 typedef void (*XlcPubGetResourceProc)( 61 XLCd lcd, 62 const char* category, 63 const char* _class, 64 char*** value, 65 int* count 66 ); 67 68 typedef struct _XLCdPublicMethodsPart { 69 XLCdPublicMethods superclass; 70 XlcPubCreateProc create; 71 XlcPubInitializeProc initialize; 72 XlcPubDestroyProc destroy; 73 XlcPubGetValuesProc get_values; 74 XlcPubGetResourceProc get_resource; 75 } XLCdPublicMethodsPart; 76 77 typedef struct _XLCdPublicMethodsRec { 78 XLCdMethodsRec core; 79 XLCdPublicMethodsPart pub; 80 } XLCdPublicMethodsRec; 81 82 /* 83 * XLCd public data 84 */ 85 86 typedef struct _XLCdPublicPart { 87 char *siname; /* for _XlcMapOSLocaleName() */ 88 char *language; /* language part of locale name */ 89 char *territory; /* territory part of locale name */ 90 char *codeset; /* codeset part of locale name */ 91 char *encoding_name; /* encoding name */ 92 int mb_cur_max; /* ANSI C MB_CUR_MAX */ 93 Bool is_state_depend; /* state-depend encoding */ 94 const char *default_string; /* for XDefaultString() */ 95 XPointer xlocale_db; 96 } XLCdPublicPart; 97 98 typedef struct _XLCdPublicRec { 99 XLCdCoreRec core; 100 XLCdPublicPart pub; 101 } XLCdPublicRec, *XLCdPublic; 102 103 extern XLCdMethods _XlcPublicMethods; 104 105 _XFUNCPROTOBEGIN 106 107 extern XLCd _XlcCreateLC( 108 const char* name, 109 XLCdMethods methods 110 ); 111 112 extern void _XlcDestroyLC( 113 XLCd lcd 114 ); 115 116 /* Fills into a freshly created XlcCharSet the fields that can be inferred 117 from the ESC sequence. These are side, char_size, set_size. */ 118 extern Bool _XlcParseCharSet( 119 XlcCharSet charset 120 ); 121 122 /* Creates a new XlcCharSet, given its name (including side suffix) and 123 Compound Text ESC sequence (normally at most 4 bytes). */ 124 extern XlcCharSet _XlcCreateDefaultCharSet( 125 const char* name, 126 const char* ct_sequence 127 ); 128 129 extern XlcCharSet _XlcAddCT( 130 const char* name, 131 const char* ct_sequence 132 ); 133 134 extern Bool _XlcInitCTInfo (void); 135 136 extern XrmMethods _XrmDefaultInitParseInfo( 137 XLCd lcd, 138 XPointer* state 139 ); 140 141 extern int _XmbTextPropertyToTextList( 142 XLCd lcd, 143 Display* dpy, 144 const XTextProperty* text_prop, 145 char*** list_ret, 146 int* count_ret 147 ); 148 149 extern int _XwcTextPropertyToTextList( 150 XLCd lcd, 151 Display* dpy, 152 const XTextProperty* text_prop, 153 wchar_t*** list_ret, 154 int* count_ret 155 ); 156 157 extern int _Xutf8TextPropertyToTextList( 158 XLCd lcd, 159 Display* dpy, 160 const XTextProperty* text_prop, 161 char*** list_ret, 162 int* count_ret 163 ); 164 165 extern int _XmbTextListToTextProperty( 166 XLCd /* lcd */, 167 Display* /* dpy */, 168 char** /* list */, 169 int /* count */, 170 XICCEncodingStyle /* style */, 171 XTextProperty* /* text_prop */ 172 ); 173 174 extern int _XwcTextListToTextProperty( 175 XLCd /* lcd */, 176 Display* /* dpy */, 177 wchar_t** /* list */, 178 int /* count */, 179 XICCEncodingStyle /* style */, 180 XTextProperty* /* text_prop */ 181 ); 182 183 extern int _Xutf8TextListToTextProperty( 184 XLCd /* lcd */, 185 Display* /* dpy */, 186 char** /* list */, 187 int /* count */, 188 XICCEncodingStyle /* style */, 189 XTextProperty* /* text_prop */ 190 ); 191 192 extern void _XwcFreeStringList( 193 XLCd /* lcd */, 194 wchar_t** /* list */ 195 ); 196 197 extern int _XlcResolveLocaleName( 198 const char* lc_name, 199 XLCdPublicPart* pub 200 ); 201 202 extern int _XlcResolveI18NPath( 203 char* buf, 204 int buf_len 205 ); 206 207 extern char *_XlcLocaleLibDirName( 208 char* /* dir_name */, 209 size_t, /* dir_len */ 210 const char* /* lc_name */ 211 ); 212 213 extern char *_XlcLocaleDirName( 214 char* /* dir_name */, 215 size_t, /* dir_len */ 216 const char* /* lc_name */ 217 ); 218 219 extern XPointer _XlcCreateLocaleDataBase( 220 XLCd lcd 221 ); 222 223 extern void _XlcDestroyLocaleDataBase( 224 XLCd lcd 225 ); 226 227 extern void _XlcGetLocaleDataBase( 228 XLCd /* lcd */, 229 const char* /* category */, 230 const char* /* name */, 231 char*** /* value */, 232 int* /* count */ 233 ); 234 235 #ifdef __APPLE__ 236 extern char * 237 _Xsetlocale( 238 int category, 239 _Xconst char *name); 240 #endif 241 extern char *_XlcMapOSLocaleName( 242 char *osname, 243 char *siname); 244 245 extern int 246 _Xmbstoutf8( 247 char *ustr, 248 const char *str, 249 int len); 250 extern int 251 _Xlcmbstoutf8( 252 XLCd lcd, 253 char *ustr, 254 const char *str, 255 int len); 256 extern int 257 _Xmbstowcs( 258 wchar_t *wstr, 259 char *str, 260 int len); 261 extern int 262 _Xlcwcstombs( 263 XLCd lcd, 264 char *str, 265 wchar_t *wstr, 266 int len); 267 extern int 268 _Xlcmbstowcs( 269 XLCd lcd, 270 wchar_t *wstr, 271 char *str, 272 int len); 273 extern int 274 _Xwcstombs( 275 char *str, 276 wchar_t *wstr, 277 int len); 278 extern int 279 _Xlcmbtowc( 280 XLCd lcd, 281 wchar_t *wstr, 282 char *str, 283 int len); 284 extern int 285 _Xlcwctomb( 286 XLCd lcd, 287 char *str, 288 wchar_t wc); 289 290 291 292 extern XPointer 293 _Utf8GetConvByName( 294 const char *name); 295 296 _XFUNCPROTOEND 297 298 #endif /* _XLCPUBLICI_H_ */ 299