[55] | 1 | /*
|
---|
| 2 | * OS/2 Unicode API definitions
|
---|
| 3 | *
|
---|
| 4 | * Copyright 1999 Achim Hasenmueller
|
---|
| 5 | *
|
---|
| 6 | *
|
---|
| 7 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
| 8 | *
|
---|
| 9 | */
|
---|
| 10 | #ifndef _ULS_UCONV
|
---|
| 11 | #define _ULS_UCONV
|
---|
| 12 |
|
---|
| 13 | #ifdef __cplusplus
|
---|
| 14 | extern "C" {
|
---|
| 15 | #endif
|
---|
| 16 |
|
---|
| 17 | #include <stddef.h> /* define size_t and wchar_t types */
|
---|
| 18 | #include <time.h> /* define tm struct */
|
---|
| 19 |
|
---|
| 20 | #define ULS_API_ERROR_BASE 0x00020400
|
---|
| 21 | #define ULS_API_ERROR(x) (ULS_API_ERROR_BASE | (x))
|
---|
| 22 |
|
---|
| 23 | typedef enum _uls_return_codes {
|
---|
| 24 | ULS_SUCCESS = 0x00000000,
|
---|
| 25 | ULS_OTHER = ULS_API_ERROR(1),
|
---|
| 26 | ULS_ILLEGALSEQUENCE = ULS_API_ERROR(2),
|
---|
| 27 | ULS_MAXFILESPERPROC = ULS_API_ERROR(3),
|
---|
| 28 | ULS_MAXFILES = ULS_API_ERROR(4),
|
---|
| 29 | ULS_NOOP = ULS_API_ERROR(5),
|
---|
| 30 | ULS_TOOMANYKBD = ULS_API_ERROR(6),
|
---|
| 31 | ULS_KBDNOTFOUND = ULS_API_ERROR(7),
|
---|
| 32 | ULS_BADHANDLE = ULS_API_ERROR(8),
|
---|
| 33 | ULS_NODEAD = ULS_API_ERROR(9),
|
---|
| 34 | ULS_NOSCAN = ULS_API_ERROR(10),
|
---|
| 35 | ULS_INVALIDSCAN = ULS_API_ERROR(11),
|
---|
| 36 | ULS_NOTIMPLEMENTED = ULS_API_ERROR(12),
|
---|
| 37 | ULS_NOMEMORY = ULS_API_ERROR(13),
|
---|
| 38 | ULS_INVALID = ULS_API_ERROR(14),
|
---|
| 39 | ULS_BADOBJECT = ULS_API_ERROR(15),
|
---|
| 40 | ULS_NOTOKEN = ULS_API_ERROR(16),
|
---|
| 41 | ULS_NOMATCH = ULS_API_ERROR(17),
|
---|
| 42 | ULS_BUFFERFULL = ULS_API_ERROR(18),
|
---|
| 43 | ULS_RANGE = ULS_API_ERROR(19),
|
---|
| 44 | ULS_UNSUPPORTED = ULS_API_ERROR(20),
|
---|
| 45 | ULS_BADATTR = ULS_API_ERROR(21),
|
---|
| 46 | ULS_VERSION = ULS_API_ERROR(22)
|
---|
| 47 | } uls_error_t;
|
---|
| 48 |
|
---|
| 49 |
|
---|
| 50 | #ifndef UNI_SUCCESS
|
---|
| 51 | #define UNI_SUCCESS ULS_SUCCESS
|
---|
| 52 | #endif
|
---|
| 53 |
|
---|
| 54 | #ifndef NO_ERROR
|
---|
| 55 | #define NO_ERROR 0
|
---|
| 56 | #endif
|
---|
| 57 |
|
---|
| 58 | #ifndef UNI_UNSUPPORTED
|
---|
| 59 | #define UNI_UNSUPPORTED ULS_UNSUPPORTED
|
---|
| 60 | #endif
|
---|
| 61 |
|
---|
| 62 | #ifndef UNI_NOMEMORY
|
---|
| 63 | #define UNI_NOMEMORY ULS_NOMEMORY
|
---|
| 64 | #endif
|
---|
| 65 |
|
---|
| 66 | #ifndef UNI_INVALID
|
---|
| 67 | #define UNI_INVALID ULS_INVALID
|
---|
| 68 | #endif
|
---|
| 69 |
|
---|
| 70 | #ifndef UNI_BADOBJ
|
---|
| 71 | #define UNI_BADOBJ ULS_BADOBJECT
|
---|
| 72 | #endif
|
---|
| 73 |
|
---|
| 74 | #ifndef UNI_NOTOKEN
|
---|
| 75 | #define UNI_NOTOKEN ULS_NOTOKEN
|
---|
| 76 | #endif
|
---|
| 77 |
|
---|
| 78 | #ifndef UNI_NOMATCH
|
---|
| 79 | #define UNI_NOMATCH ULS_NOMATCH
|
---|
| 80 | #endif
|
---|
| 81 |
|
---|
| 82 | #ifndef UNI_BUFFER_FULL
|
---|
| 83 | #define UNI_BUFFER_FULL ULS_BUFFERFULL
|
---|
| 84 | #endif
|
---|
| 85 |
|
---|
| 86 | #ifndef UNI_RANGE
|
---|
| 87 | #define UNI_RANGE ULS_RANGE
|
---|
| 88 | #endif
|
---|
| 89 |
|
---|
| 90 | #ifndef ERR_NOOP
|
---|
| 91 | #define ERR_NOOP ULS_NOOP
|
---|
| 92 | #endif
|
---|
| 93 |
|
---|
| 94 | #ifndef ERR_TOO_MANY_KBD
|
---|
| 95 | #define ERR_TOO_MANY_KBD ULS_TOOMANYKBD
|
---|
| 96 | #endif
|
---|
| 97 |
|
---|
| 98 | #ifndef ERR_KBD_NOT_FOUND
|
---|
| 99 | #define ERR_KBD_NOT_FOUND ULS_KBDNOTFOUND
|
---|
| 100 | #endif
|
---|
| 101 |
|
---|
| 102 | #ifndef ERR_KBD_INVALID
|
---|
| 103 | #define ERR_KBD_INVALID ULS_INVALID
|
---|
| 104 | #endif
|
---|
| 105 |
|
---|
| 106 | #ifndef ERR_BAD_HANDLE
|
---|
| 107 | #define ERR_BAD_HANDLE ULS_BADHANDLE
|
---|
| 108 | #endif
|
---|
| 109 |
|
---|
| 110 | #ifndef ERR_NO_DEAD
|
---|
| 111 | #define ERR_NO_DEAD ULS_NODEAD
|
---|
| 112 | #endif
|
---|
| 113 |
|
---|
| 114 | #ifndef ERR_NO_SCAN
|
---|
| 115 | #define ERR_NO_SCAN ULS_NOSCAN
|
---|
| 116 | #endif
|
---|
| 117 |
|
---|
| 118 | #ifndef ERR_INVALID_SCAN
|
---|
| 119 | #define ERR_INVALID_SCAN ULS_INVALIDSCAN
|
---|
| 120 | #endif
|
---|
| 121 |
|
---|
| 122 | #ifndef ERR_NOT_IMPLEMENTED
|
---|
| 123 | #define ERR_NOT_IMPLEMENTED ULS_NOTIMPLEMENTED
|
---|
| 124 | #endif
|
---|
| 125 |
|
---|
| 126 | #ifdef ERR_NO_MEMORY
|
---|
| 127 | #undef ERR_NO_MEMORY
|
---|
| 128 | #endif
|
---|
| 129 | #define ERR_NO_MEMORY ULS_NOMEMORY
|
---|
| 130 |
|
---|
| 131 | typedef int LocaleItem;
|
---|
| 132 |
|
---|
| 133 | #define D_T_FMT 1 /* string for formatting date and time */
|
---|
| 134 | #define D_FMT 2 /* string for formatting date */
|
---|
| 135 | #define T_FMT 3 /* string for formatting time */
|
---|
| 136 | #define AM_STR 4 /* string for a.m. */
|
---|
| 137 | #define PM_STR 5 /* string for p.m. */
|
---|
| 138 |
|
---|
| 139 | #define ABDAY_1 6 /* abbreviated first day of the week (Sun) */
|
---|
| 140 | #define ABDAY_2 7 /* abbreviated second day of the week (Mon) */
|
---|
| 141 | #define ABDAY_3 8 /* abbreviated third day of the week (Tue) */
|
---|
| 142 | #define ABDAY_4 9 /* abbreviated fourth day of the week (Wed) */
|
---|
| 143 | #define ABDAY_5 10 /* abbreviated fifth day of the week (Thu) */
|
---|
| 144 | #define ABDAY_6 11 /* abbreviated sixth day of the week (Fri) */
|
---|
| 145 | #define ABDAY_7 12 /* abbreviated seventh day of the week (Sat) */
|
---|
| 146 |
|
---|
| 147 | #define DAY_1 13 /* name of the first day of the week (Sunday) */
|
---|
| 148 | #define DAY_2 14 /* name of the second day of the week (Monday) */
|
---|
| 149 | #define DAY_3 15 /* name of the third day of the week (Tuesday) */
|
---|
| 150 | #define DAY_4 16 /* name of the fourth day of the week (Wednesday) */
|
---|
| 151 | #define DAY_5 17 /* name of the fifth day of the week (Thursday) */
|
---|
| 152 | #define DAY_6 18 /* name of the sixth day of the week (Friday) */
|
---|
| 153 | #define DAY_7 19 /* name of the seventh day of the week (Saturday) */
|
---|
| 154 |
|
---|
| 155 | #define ABMON_1 20 /* abbreviated first month (Jan) */
|
---|
| 156 | #define ABMON_2 21 /* abbreviated second month (Feb) */
|
---|
| 157 | #define ABMON_3 22 /* abbreviated third month (Mar) */
|
---|
| 158 | #define ABMON_4 23 /* abbreviated fourth month (Apr) */
|
---|
| 159 | #define ABMON_5 24 /* abbreviated fifth month (May) */
|
---|
| 160 | #define ABMON_6 25 /* abbreviated sixth month (Jun) */
|
---|
| 161 | #define ABMON_7 26 /* abbreviated seventh month (Jul) */
|
---|
| 162 | #define ABMON_8 27 /* abbreviated eighth month (Aug) */
|
---|
| 163 | #define ABMON_9 28 /* abbreviated ninth month (Sep) */
|
---|
| 164 | #define ABMON_10 29 /* abbreviated tenth month (Oct) */
|
---|
| 165 | #define ABMON_11 30 /* abbreviated eleventh month (Nov) */
|
---|
| 166 | #define ABMON_12 31 /* abbreviated twelveth month (Dec) */
|
---|
| 167 |
|
---|
| 168 | #define MON_1 32 /* name of the first month (January) */
|
---|
| 169 | #define MON_2 33 /* name of the second month (February) */
|
---|
| 170 | #define MON_3 34 /* name of the third month (March) */
|
---|
| 171 | #define MON_4 35 /* name of the fourth month (April) */
|
---|
| 172 | #define MON_5 36 /* name of the fifth month (May) */
|
---|
| 173 | #define MON_6 37 /* name of the sixth month (June) */
|
---|
| 174 | #define MON_7 38 /* name of the seventh month (July) */
|
---|
| 175 | #define MON_8 39 /* name of the eighth month (August) */
|
---|
| 176 | #define MON_9 40 /* name of the ninth month (September) */
|
---|
| 177 | #define MON_10 41 /* name of the tenth month (October) */
|
---|
| 178 | #define MON_11 42 /* name of the eleventh month (November) */
|
---|
| 179 | #define MON_12 43 /* name of the twelveth month (December) */
|
---|
| 180 |
|
---|
| 181 | #define RADIXCHAR 44 /* radix character */
|
---|
| 182 | #define THOUSEP 45 /* separator for thousands */
|
---|
| 183 | #define YESSTR 46 /* affiramitive response for yes/no queries */
|
---|
| 184 | #define NOSTR 47 /* negative response for yes/no queries */
|
---|
| 185 | #define CRNCYSTR 48 /* currency symbol; - leading, + trailing */
|
---|
| 186 | #define CODESET 49 /* codeset name */
|
---|
| 187 |
|
---|
| 188 | /* Additional constants defined in XPG4 */
|
---|
| 189 |
|
---|
| 190 | #define T_FMT_AMPM 55 /* am/pm time formating string */
|
---|
| 191 | #define ERA 56 /* era description segments */
|
---|
| 192 | #define ERA_D_FMT 57 /* era date format string */
|
---|
| 193 | #define ERA_D_T_FMT 58 /* era date and time format string */
|
---|
| 194 | #define ERA_T_FMT 59 /* era time format string */
|
---|
| 195 | #define ALT_DIGITS 60 /* alternative symbols for digits */
|
---|
| 196 | #define YESEXPR 61 /* affirmative response expression */
|
---|
| 197 | #define NOEXPR 62 /* negative response expression */
|
---|
| 198 |
|
---|
| 199 | /* LSA feature */
|
---|
| 200 | #define DATESEP 63
|
---|
| 201 | #define TIMESEP 64
|
---|
| 202 | #define LISTSEP 65
|
---|
| 203 |
|
---|
| 204 | /*
|
---|
| 205 | * nl_items to support implementation of NLgetenv
|
---|
| 206 | */
|
---|
| 207 | #ifdef _AIX31
|
---|
| 208 | #define NLLDATE 50
|
---|
| 209 | #define NLTMISC 51
|
---|
| 210 | #define NLTSTRS 52
|
---|
| 211 | #define NLTUNITS 53
|
---|
| 212 | #define NLYEAR 54
|
---|
| 213 | #endif
|
---|
| 214 |
|
---|
| 215 | /*
|
---|
| 216 | ** if this number changes, it MUST be changed
|
---|
| 217 | ** in sys/locdata.h
|
---|
| 218 | */
|
---|
| 219 | #ifndef _NL_NUM_ITEMS
|
---|
| 220 | #define _NL_NUM_ITEMS 66
|
---|
| 221 | #endif
|
---|
| 222 |
|
---|
| 223 |
|
---|
| 224 | #if defined(__IBMCPP__) || defined(__IBMC__)
|
---|
| 225 | #define CALLCONV _System
|
---|
| 226 | #else
|
---|
| 227 | #define CALLCONV
|
---|
| 228 | #endif
|
---|
| 229 |
|
---|
| 230 |
|
---|
| 231 | /*
|
---|
| 232 | * ulsBool Type
|
---|
| 233 | */
|
---|
| 234 | typedef int ulsBool;
|
---|
| 235 |
|
---|
| 236 |
|
---|
| 237 | /* LSA added TRUE/FALSE */
|
---|
| 238 | #ifndef TRUE
|
---|
| 239 | #define TRUE 1
|
---|
| 240 | #endif
|
---|
| 241 | #ifndef FALSE
|
---|
| 242 | #define FALSE 0
|
---|
| 243 | #endif
|
---|
| 244 |
|
---|
| 245 | /*
|
---|
| 246 | * UniChar Type
|
---|
| 247 | */
|
---|
| 248 | #ifndef _ULS_UNICHAR_DEFINED
|
---|
| 249 | typedef unsigned short UniChar ;
|
---|
| 250 | #define _ULS_UNICHAR_DEFINED
|
---|
| 251 | #endif
|
---|
| 252 |
|
---|
| 253 | /*
|
---|
| 254 | * LocaleObject Type
|
---|
| 255 | */
|
---|
| 256 | typedef void *LocaleObject;
|
---|
| 257 |
|
---|
| 258 | /*
|
---|
| 259 | * LocaleToken Type
|
---|
| 260 | */
|
---|
| 261 | typedef unsigned int LocaleToken;
|
---|
| 262 |
|
---|
| 263 | /*
|
---|
| 264 | * AttrObject Type
|
---|
| 265 | */
|
---|
| 266 | typedef void *AttrObject;
|
---|
| 267 |
|
---|
| 268 | /*
|
---|
| 269 | * XformObject type
|
---|
| 270 | */
|
---|
| 271 | typedef void *XformObject;
|
---|
| 272 |
|
---|
| 273 | /*
|
---|
| 274 | * LocaleSpecType Values
|
---|
| 275 | */
|
---|
| 276 | #define UNI_TOKEN_POINTER 1
|
---|
| 277 | #define UNI_MBS_STRING_POINTER 2
|
---|
| 278 | #define UNI_UCS_STRING_POINTER 3
|
---|
| 279 |
|
---|
| 280 |
|
---|
| 281 | /*
|
---|
| 282 | * Categories
|
---|
| 283 | */
|
---|
| 284 | #undef LANG
|
---|
| 285 | #undef LC_ALL
|
---|
| 286 | #undef LC_COLLATE
|
---|
| 287 | #undef LC_CTYPE
|
---|
| 288 | #undef LC_NUMERIC
|
---|
| 289 | #undef LC_MONETARY
|
---|
| 290 | #undef LC_TIME
|
---|
| 291 | #undef LC_MESSAGES
|
---|
| 292 |
|
---|
| 293 | #define LANG (-2)
|
---|
| 294 | #define LC_ALL (-1)
|
---|
| 295 | #define LC_COLLATE 0
|
---|
| 296 | #define LC_CTYPE 1
|
---|
| 297 | #define LC_NUMERIC 2
|
---|
| 298 | #define LC_MONETARY 3
|
---|
| 299 | #define LC_TIME 4
|
---|
| 300 | #define LC_MESSAGES 5
|
---|
| 301 |
|
---|
| 302 | /*
|
---|
| 303 | * UniLconv locale conventions structure
|
---|
| 304 | */
|
---|
| 305 | struct UniLconv {
|
---|
| 306 | UniChar *decimal_point; /* non-monetary decimal point */
|
---|
| 307 | UniChar *thousands_sep; /* non-monetary thousands separator */
|
---|
| 308 | short *grouping; /* non-monetary size of grouping */
|
---|
| 309 | UniChar *int_curr_symbol; /* int'l currency symbol and separator */
|
---|
| 310 | UniChar *currency_symbol; /* local currency symbol */
|
---|
| 311 | UniChar *mon_decimal_point; /* monetary decimal point */
|
---|
| 312 | UniChar *mon_thousands_sep; /* monetary thousands separator */
|
---|
| 313 | short *mon_grouping; /* monetary size of grouping */
|
---|
| 314 | UniChar *positive_sign; /* non-negative values sign */
|
---|
| 315 | UniChar *negative_sign; /* negative values sign */
|
---|
| 316 | short int_frac_digits; /* no of fractional digits int currency */
|
---|
| 317 | short frac_digits; /* no of fractional digits loc currency */
|
---|
| 318 | short p_cs_precedes; /* nonneg curr sym 1-precedes,0-succeeds*/
|
---|
| 319 | short p_sep_by_space; /* nonneg curr sym 1-space,0-no space */
|
---|
| 320 | short n_cs_precedes; /* neg curr sym 1-precedes,0-succeeds */
|
---|
| 321 | short n_sep_by_space; /* neg curr sym 1-space 0-no space */
|
---|
| 322 | short p_sign_posn; /* positioning of nonneg monetary sign */
|
---|
| 323 | short n_sign_posn; /* positioning of negative monetary sign*/
|
---|
| 324 | short os2_mondecpt; /* os2 curr sym positioning */
|
---|
| 325 | UniChar *debit_sign; /* non-neg-valued monetary sym - "DB" */
|
---|
| 326 | UniChar *credit_sign; /* negative-valued monetary sym - "CR" */
|
---|
| 327 | UniChar *left_parenthesis; /* negative-valued monetary sym - "(" */
|
---|
| 328 | UniChar *right_parenthesis; /* negative-valued monetary sym - ")" */
|
---|
| 329 | };
|
---|
| 330 |
|
---|
| 331 | /*
|
---|
| 332 | * Locale Management Function Prototypes
|
---|
| 333 | */
|
---|
| 334 | int CALLCONV UniCreateLocaleObject ( int locale_spec_type, const void *locale_spec,
|
---|
| 335 | LocaleObject *locale_object_ptr );
|
---|
| 336 | int CALLCONV UniQueryLocaleObject ( const LocaleObject locale_object, int category,
|
---|
| 337 | int locale_spec_type, void **locale_spec_ptr );
|
---|
| 338 | int CALLCONV UniFreeLocaleObject ( LocaleObject locale_object );
|
---|
| 339 | int CALLCONV UniFreeMem ( void *memory_ptr );
|
---|
| 340 | int CALLCONV UniLocaleStrToToken ( int locale_string_type, const void *locale_string,
|
---|
| 341 | LocaleToken *locale_token_ptr );
|
---|
| 342 | int CALLCONV UniLocaleTokenToStr ( const LocaleToken locale_token,
|
---|
| 343 | int locale_string_type, void **locale_string_ptr );
|
---|
| 344 |
|
---|
| 345 | /*
|
---|
| 346 | * Locale Information Function Prototypes
|
---|
| 347 | */
|
---|
| 348 | int CALLCONV UniQueryLocaleInfo ( const LocaleObject locale_object,
|
---|
| 349 | struct UniLconv **unilconv_addr_ptr );
|
---|
| 350 | int CALLCONV UniFreeLocaleInfo ( struct UniLconv *unilconv_addr );
|
---|
| 351 | int CALLCONV UniQueryLocaleItem ( const LocaleObject locale_object,
|
---|
| 352 | LocaleItem item,
|
---|
| 353 | UniChar **info_item_addr_ptr );
|
---|
| 354 |
|
---|
| 355 | /*
|
---|
| 356 | * Date and Time Function Prototypes
|
---|
| 357 | */
|
---|
| 358 | size_t CALLCONV UniStrftime ( const LocaleObject locale_object,
|
---|
| 359 | UniChar *ucs, size_t maxsize,
|
---|
| 360 | const UniChar *format, const struct tm *time_ptr );
|
---|
| 361 | UniChar * CALLCONV UniStrptime ( const LocaleObject locale_object,
|
---|
| 362 | const UniChar *buf, const UniChar *format,
|
---|
| 363 | struct tm *time_ptr );
|
---|
| 364 |
|
---|
| 365 | /*
|
---|
| 366 | * Monetary Formatting Function Prototype
|
---|
| 367 | */
|
---|
| 368 | int CALLCONV UniStrfmon ( const LocaleObject locale_object,
|
---|
| 369 | UniChar *ucs, size_t maxsize,
|
---|
| 370 | const UniChar *format, ... );
|
---|
| 371 |
|
---|
| 372 | /*
|
---|
| 373 | * String/Character Function Prototypes
|
---|
| 374 | */
|
---|
| 375 | UniChar * CALLCONV UniStrcat ( UniChar *ucs1, const UniChar *ucs2 );
|
---|
| 376 | UniChar * CALLCONV UniStrchr ( const UniChar *ucs, UniChar uc );
|
---|
| 377 | int CALLCONV UniStrcmp ( const UniChar *ucs1, const UniChar *ucs2 );
|
---|
| 378 | UniChar * CALLCONV UniStrcpy ( UniChar *ucs1, const UniChar *ucs2 );
|
---|
| 379 | size_t CALLCONV UniStrcspn ( const UniChar *ucs1, const UniChar *ucs2 );
|
---|
| 380 | size_t CALLCONV UniStrlen ( const UniChar *ucs1 );
|
---|
| 381 | UniChar * CALLCONV UniStrncat ( UniChar *ucs1, const UniChar *ucs2, size_t n );
|
---|
| 382 | int CALLCONV UniStrncmp ( const UniChar *ucs1, const UniChar *ucs2, size_t n );
|
---|
| 383 | UniChar * CALLCONV UniStrncpy ( UniChar *ucs1, const UniChar *ucs2, size_t n );
|
---|
| 384 | UniChar * CALLCONV UniStrpbrk ( const UniChar *ucs1, const UniChar *ucs2 );
|
---|
| 385 | UniChar * CALLCONV UniStrrchr ( const UniChar *ucs, UniChar uc );
|
---|
| 386 | size_t CALLCONV UniStrspn ( const UniChar *ucs1, const UniChar *ucs2 );
|
---|
| 387 | UniChar * CALLCONV UniStrstr ( const UniChar *ucs1, const UniChar *ucs2 );
|
---|
| 388 | UniChar * CALLCONV UniStrtok ( UniChar *ucs1, const UniChar *ucs2 );
|
---|
| 389 |
|
---|
| 390 |
|
---|
| 391 | /*
|
---|
| 392 | * Character Attribute Function Prototypes
|
---|
| 393 | */
|
---|
| 394 | int CALLCONV UniCreateAttrObject ( const LocaleObject locale_object,
|
---|
| 395 | const UniChar *attr_name,
|
---|
| 396 | AttrObject *attr_object_ptr );
|
---|
| 397 | int CALLCONV UniQueryCharAttr ( AttrObject attr_object, UniChar uc );
|
---|
| 398 | int CALLCONV UniScanForAttr ( AttrObject attr_object, const UniChar *ucs,
|
---|
| 399 | size_t num_elems, ulsBool inverse_op,
|
---|
| 400 | size_t *offset_ptr );
|
---|
| 401 | int CALLCONV UniFreeAttrObject ( AttrObject attr_object );
|
---|
| 402 | int CALLCONV UniQueryAlnum ( const LocaleObject locale_object, UniChar uc );
|
---|
| 403 | int CALLCONV UniQueryAlpha ( const LocaleObject locale_object, UniChar uc );
|
---|
| 404 | int CALLCONV UniQueryBlank ( const LocaleObject locale_object, UniChar uc );
|
---|
| 405 | int CALLCONV UniQueryCntrl ( const LocaleObject locale_object, UniChar uc );
|
---|
| 406 | int CALLCONV UniQueryDigit ( const LocaleObject locale_object, UniChar uc );
|
---|
| 407 | int CALLCONV UniQueryGraph ( const LocaleObject locale_object, UniChar uc );
|
---|
| 408 | int CALLCONV UniQueryLower ( const LocaleObject locale_object, UniChar uc );
|
---|
| 409 | int CALLCONV UniQueryPrint ( const LocaleObject locale_object, UniChar uc );
|
---|
| 410 | int CALLCONV UniQueryPunct ( const LocaleObject locale_object, UniChar uc );
|
---|
| 411 | int CALLCONV UniQuerySpace ( const LocaleObject locale_object, UniChar uc );
|
---|
| 412 | int CALLCONV UniQueryUpper ( const LocaleObject locale_object, UniChar uc );
|
---|
| 413 | int CALLCONV UniQueryXdigit ( const LocaleObject locale_object, UniChar uc );
|
---|
| 414 |
|
---|
| 415 | /*
|
---|
| 416 | * String Transformation Function Prototypes
|
---|
| 417 | */
|
---|
| 418 | int CALLCONV UniCreateTransformObject ( const LocaleObject locale_object,
|
---|
| 419 | const UniChar *xtype,
|
---|
| 420 | XformObject *xform_object_ptr );
|
---|
| 421 | int CALLCONV UniTransformStr ( XformObject xform_object,
|
---|
| 422 | const UniChar *inp_buf, int *inp_size,
|
---|
| 423 | UniChar *out_buf, int *out_size );
|
---|
| 424 | int CALLCONV UniFreeTransformObject ( XformObject xform_object );
|
---|
| 425 | UniChar CALLCONV UniTransLower ( const LocaleObject locale_object, UniChar uc );
|
---|
| 426 | UniChar CALLCONV UniTransUpper ( const LocaleObject locale_object, UniChar uc );
|
---|
| 427 |
|
---|
| 428 | /*
|
---|
| 429 | * String Conversion Function Prototypes
|
---|
| 430 | */
|
---|
| 431 | int CALLCONV UniStrtod ( const LocaleObject locale_object, const UniChar *ucs,
|
---|
| 432 | UniChar **end_ptr, double *result_ptr );
|
---|
| 433 | int CALLCONV UniStrtol ( const LocaleObject locale_object, const UniChar *ucs,
|
---|
| 434 | UniChar **end_ptr, int base, long int *result_ptr );
|
---|
| 435 | int CALLCONV UniStrtoul ( const LocaleObject locale_object, const UniChar *ucs,
|
---|
| 436 | UniChar **end_ptr, int base, unsigned long int *result_ptr );
|
---|
| 437 |
|
---|
| 438 | /*
|
---|
| 439 | * String Comparison Function Prototypes
|
---|
| 440 | */
|
---|
| 441 | int CALLCONV UniStrcoll ( const LocaleObject locale_object,
|
---|
| 442 | const UniChar *ucs1, const UniChar *ucs2 );
|
---|
| 443 | size_t CALLCONV UniStrxfrm ( const LocaleObject locale_object,
|
---|
| 444 | UniChar *ucs1, const UniChar *ucs2, size_t n );
|
---|
| 445 | int CALLCONV UniStrcmpi ( const LocaleObject locale_object,
|
---|
| 446 | const UniChar *ucs1, const UniChar *ucs2 );
|
---|
| 447 | int CALLCONV UniStrncmpi ( const LocaleObject locale_object,
|
---|
| 448 | const UniChar *ucs1, const UniChar *ucs2, const size_t n );
|
---|
| 449 |
|
---|
| 450 | /*
|
---|
| 451 | * Unicode Case Mapping Function Prototypes
|
---|
| 452 | */
|
---|
| 453 | UniChar CALLCONV UniToupper ( UniChar uc );
|
---|
| 454 | UniChar CALLCONV UniTolower ( UniChar uc );
|
---|
| 455 | UniChar * CALLCONV UniStrupr ( UniChar * ucs );
|
---|
| 456 | UniChar * CALLCONV UniStrlwr ( UniChar * ucs );
|
---|
| 457 |
|
---|
| 458 |
|
---|
| 459 | int CALLCONV UniMapCtryToLocale( unsigned long Country,
|
---|
| 460 | UniChar *LocaleName,
|
---|
| 461 | size_t n
|
---|
| 462 | );
|
---|
| 463 |
|
---|
| 464 | #ifndef _ULS_UCONVP
|
---|
| 465 | #define _ULS_UCONVP
|
---|
| 466 | typedef void * UconvObject; /* uconv Type pointer */
|
---|
| 467 | #endif
|
---|
| 468 |
|
---|
| 469 | #ifndef _ULS_UNICHAR_DEFINED
|
---|
| 470 | #define _ULS_UNICHAR_DEFINED
|
---|
| 471 | typedef unsigned short UniChar ;
|
---|
| 472 | #endif
|
---|
| 473 |
|
---|
| 474 |
|
---|
| 475 | #ifndef ULS_ATTR
|
---|
| 476 | #define ULS_ATTR
|
---|
| 477 | /*
|
---|
| 478 | * Substitution options
|
---|
| 479 | */
|
---|
| 480 | #define UCONV_OPTION_SUBSTITUTE_FROM_UNICODE 1
|
---|
| 481 | #define UCONV_OPTION_SUBSTITUTE_TO_UNICODE 2
|
---|
| 482 | #define UCONV_OPTION_SUBSTITUTE_BOTH 3
|
---|
| 483 |
|
---|
| 484 | /*
|
---|
| 485 | * Conversion options
|
---|
| 486 | */
|
---|
| 487 | #define CVTTYPE_PATH 0x00000004 /* Treat string as a path */
|
---|
| 488 | #define CVTTYPE_CDRA 0x00000002 /* Use CDRA control mapping */
|
---|
| 489 | #define CVTTYPE_CTRL7F 0x00000001 /* Treat 0x7F as a control */
|
---|
| 490 |
|
---|
| 491 | /*
|
---|
| 492 | * Conversion mask. This is a bit mask. If the bit is on, the
|
---|
| 493 | * corresponding character 0x00-0x1f is treated as a control.
|
---|
| 494 | * Otherwise it is treated as a glyph.
|
---|
| 495 | */
|
---|
| 496 | #define DSPMASK_DATA 0xffffffff
|
---|
| 497 | #define DSPMASK_DISPLAY 0x00000000
|
---|
| 498 | #define DSPMASK_TAB 0x00000200
|
---|
| 499 | #define DSPMASK_LF 0x00000400
|
---|
| 500 | #define DSPMASK_CR 0x00002000
|
---|
| 501 | #define DSPMASK_CRLF 0x00002400
|
---|
| 502 |
|
---|
| 503 | /*
|
---|
| 504 | * Encoding schemes. This is the primary item used to check if a
|
---|
| 505 | * a codepage is valid for a particular purpose. A length check
|
---|
| 506 | * may also be made in some cases.
|
---|
| 507 | */
|
---|
| 508 | enum uconv_esid { /* Process Display VIO GPI */
|
---|
| 509 | ESID_sbcs_data = 0x2100, /* x x x x */
|
---|
| 510 | ESID_sbcs_pc = 0x3100, /* x x x x */
|
---|
| 511 | ESID_sbcs_ebcdic = 0x1100, /* x x x */
|
---|
| 512 | ESID_sbcs_iso = 0x4100, /* x x x x */
|
---|
| 513 | ESID_sbcs_windows = 0x4105, /* x x x x */
|
---|
| 514 | ESID_sbcs_alt = 0xF100, /* x x x */
|
---|
| 515 | ESID_dbcs_data = 0x2200, /* x x */
|
---|
| 516 | ESID_dbcs_pc = 0x3200, /* x x x x */
|
---|
| 517 | ESID_dbcs_ebcdic = 0x1200, /* x */
|
---|
| 518 | ESID_mbcs_data = 0x2300, /* x x x */
|
---|
| 519 | ESID_mbcs_pc = 0x3300, /* x x */
|
---|
| 520 | ESID_mbcs_ebcdic = 0x1301, /* */
|
---|
| 521 | ESID_ucs_2 = 0x7200, /* */
|
---|
| 522 | ESID_ugl = 0x72FF, /* */
|
---|
| 523 | ESID_utf_8 = 0x7807, /* x x x */
|
---|
| 524 | ESID_upf_8 = 0x78FF /* x x x x */
|
---|
| 525 | };
|
---|
| 526 |
|
---|
| 527 | #ifndef __conv_endian_t
|
---|
| 528 | #define __conv_endian_t
|
---|
| 529 | #define ENDIAN_SYSTEM 0x0000
|
---|
| 530 | #define ENDIAN_BIG 0xfeff
|
---|
| 531 | #define ENDIAN_LITTLE 0xfffe
|
---|
| 532 | typedef struct _conv_endian_rec {
|
---|
| 533 | unsigned short source; /* Used by FromUcs */
|
---|
| 534 | unsigned short target; /* Used by ToUcs */
|
---|
| 535 | } conv_endian_t;
|
---|
| 536 | #endif
|
---|
| 537 |
|
---|
| 538 | typedef struct _uconv_attribute_t {
|
---|
| 539 | unsigned long version; /* Q/S Version (must be zero) */
|
---|
| 540 | char mb_min_len; /* Q Minimum char size */
|
---|
| 541 | char mb_max_len; /* Q Maximum char size */
|
---|
| 542 | char usc_min_len; /* Q UCS min size */
|
---|
| 543 | char usc_max_len; /* Q UCS max size */
|
---|
| 544 | unsigned short esid; /* Q Encoding scheme ID */
|
---|
| 545 | char options; /* Q/S Substitution options */
|
---|
| 546 | char state; /* Q/S State for stateful convert */
|
---|
| 547 | conv_endian_t endian; /* Q/S Source and target endian */
|
---|
| 548 | unsigned long displaymask; /* Q/S Display/data mask */
|
---|
| 549 | unsigned long converttype; /* Q/S Conversion type */
|
---|
| 550 | unsigned short subchar_len; /* Q/S MBCS sub len 0=table */
|
---|
| 551 | unsigned short subuni_len; /* Q/S Unicode sub len 0=table */
|
---|
| 552 | char subchar[16]; /* Q/S MBCS sub characters */
|
---|
| 553 | UniChar subuni[8]; /* Q/S Unicode sub characters */
|
---|
| 554 | } uconv_attribute_t;
|
---|
| 555 |
|
---|
| 556 | /*
|
---|
| 557 | * User defined character range
|
---|
| 558 | */
|
---|
| 559 | typedef struct { /* User Defined character range */
|
---|
| 560 | unsigned short first; /* First codepoint */
|
---|
| 561 | unsigned short last; /* Last codepoint */
|
---|
| 562 | } udcrange_t;
|
---|
| 563 | #endif /* ULS_ATTR */
|
---|
| 564 | #define uconv_error_t int
|
---|
| 565 |
|
---|
| 566 | /*
|
---|
| 567 | * UniCreateUconvObject: Create Unicode Conversion Object
|
---|
| 568 | *
|
---|
| 569 | * return code:
|
---|
| 570 | * 0 - Conversion Object sucessfully initialized
|
---|
| 571 | * UCONV_EMFILE - Maximum file descriptors are opened
|
---|
| 572 | * UCONV_ENFILE - Too many files currently open in the system
|
---|
| 573 | * UCONV_ENOMEM - Insuffcient memory
|
---|
| 574 | * UCONV_EINVAL - The conversion specified by code_set or the
|
---|
| 575 | * modifier supplied is not recognized by the
|
---|
| 576 | * implementation.
|
---|
| 577 | *
|
---|
| 578 | */
|
---|
| 579 | int CALLCONV UniCreateUconvObject(
|
---|
| 580 | UniChar * code_set, /* I - Unicode name of uconv table */
|
---|
| 581 | UconvObject * uobj ); /* O - Uconv object handle */
|
---|
| 582 | /*
|
---|
| 583 | * UniQueryUconvObject: Query Unicode Coversion Object
|
---|
| 584 | *
|
---|
| 585 | * return code:
|
---|
| 586 | * 0 - Operation successful
|
---|
| 587 | * UCONV_EBADF - The conversion object specified is not
|
---|
| 588 | * recognized by the implementation.
|
---|
| 589 | */
|
---|
| 590 | int CALLCONV UniQueryUconvObject(
|
---|
| 591 | UconvObject uobj, /* I - Uconv object handle */
|
---|
| 592 | uconv_attribute_t * attr, /* O - Uconv attributes */
|
---|
| 593 | size_t size, /* I - Size of attribute structure */
|
---|
| 594 | char first[256], /* O - First byte of multibyte */
|
---|
| 595 | char other[256], /* O - Other byte of multibyte */
|
---|
| 596 | udcrange_t udcrange[32]); /* O - User defined char range */
|
---|
| 597 | /*
|
---|
| 598 | * UniSetUconvObject: Set Unicode Conversion Object
|
---|
| 599 | *
|
---|
| 600 | * return code:
|
---|
| 601 | * 0 - Operation successful
|
---|
| 602 | * UCONV_EBADF - The conversion object specified is not
|
---|
| 603 | * recognized by the implementation.
|
---|
| 604 | * UCONV_BADATTR - attribute supplied contains invalid attribute
|
---|
| 605 | * for the conversion object
|
---|
| 606 | */
|
---|
| 607 | int CALLCONV UniSetUconvObject(
|
---|
| 608 | UconvObject uobj, /* I - Uconv object handle */
|
---|
| 609 | uconv_attribute_t * attr); /* I - Uconv attributes */
|
---|
| 610 | /*
|
---|
| 611 | * UniUconvToUcs: Convert string to unicode
|
---|
| 612 | *
|
---|
| 613 | * return code:
|
---|
| 614 | * 0 - Operation successful
|
---|
| 615 | * UCONV_EBADF - The conversion object specified is not
|
---|
| 616 | * recognized by the implementation.
|
---|
| 617 | * UCONV_E2BIG - Input conversion stopped due to lack of space
|
---|
| 618 | * in the output buffer
|
---|
| 619 | * UCONV_EINVAL - Input conversion stopped due to incomplete
|
---|
| 620 | * character or shift sequence at the end of the
|
---|
| 621 | * input buffer.
|
---|
| 622 | * UCONV_EILSEQ - Input conversion stopped due to an input byte
|
---|
| 623 | * that does not belong to the input code set.
|
---|
| 624 | */
|
---|
| 625 | int CALLCONV UniUconvToUcs(
|
---|
| 626 | UconvObject uobj, /* I - Uconv object handle */
|
---|
| 627 | void * * inbuf, /* IO - Input buffer */
|
---|
| 628 | size_t * inbytes, /* IO - Input buffer size (bytes) */
|
---|
| 629 | UniChar * * outbuf, /* IO - Output buffer size */
|
---|
| 630 | size_t * outchars, /* IO - Output size (chars) */
|
---|
| 631 | size_t * subst ); /* IO - Substitution count */
|
---|
| 632 | /*
|
---|
| 633 | * UniUconvFromUcs: Convert string from unicode
|
---|
| 634 | * 0 - Operation successful
|
---|
| 635 | * UCONV_EBADF - The conversion object specified is not
|
---|
| 636 | * recognized by the implementation.
|
---|
| 637 | * UCONV_E2BIG - Input conversion stopped due to lack of space
|
---|
| 638 | * in the output buffer
|
---|
| 639 | * UCONV_EINVAL - Input conversion stopped due to incomplete
|
---|
| 640 | * character or shift sequence at the end of the
|
---|
| 641 | * input buffer.
|
---|
| 642 | * UCONV_EILSEQ - Input conversion stopped due to an input byte
|
---|
| 643 | * that does not belong to the input code set.
|
---|
| 644 | */
|
---|
| 645 | int CALLCONV UniUconvFromUcs(
|
---|
| 646 | UconvObject uobj, /* I - Uconv object handle */
|
---|
| 647 | UniChar * * inbuf, /* IO - Input buffer */
|
---|
| 648 | size_t * inchars, /* IO - Input buffer size (bytes) */
|
---|
| 649 | void * * outbuf, /* IO - Output buffer size */
|
---|
| 650 | size_t * outbytes, /* IO - Output size (chars) */
|
---|
| 651 | size_t * subst ); /* IO - Substitution count */
|
---|
| 652 | /*
|
---|
| 653 | * UniFreeUconvObject: Close Unicode Conversion Object
|
---|
| 654 | * 0 - Operation successful
|
---|
| 655 | * UCONV_EBADF - The conversion object specified is not
|
---|
| 656 | * recognized by the implementation.
|
---|
| 657 | */
|
---|
| 658 | int CALLCONV UniFreeUconvObject(
|
---|
| 659 | UconvObject uobj ); /* I - Uconv object handle */
|
---|
| 660 | /*
|
---|
| 661 | * Function: UniMapCpToUcsCp
|
---|
| 662 | *
|
---|
| 663 | * description:
|
---|
| 664 | * given a code page represented as an unsigned long, gives back the
|
---|
| 665 | * corresponding Unicode string representing the code page, suitable
|
---|
| 666 | * for input to UniCreateUconvObject().
|
---|
| 667 | * A buffer for ucsCodePage must be given as input. The ucsCodePage
|
---|
| 668 | * will contain a codepage string (Unicode string) upon successful exit.
|
---|
| 669 | * The size of the ucsCodePage buffer must be given as input.
|
---|
| 670 | *
|
---|
| 671 | * Returns 0 upon success. If there is an error, the contents
|
---|
| 672 | * of ucsCodePage are undefined.
|
---|
| 673 | * If an error occures, the contents of ucsCodePage are undefined and
|
---|
| 674 | * one of the following error codes is returned:
|
---|
| 675 | * UCONV_E2BIG - The buffer is not large enough to hold the codepage name
|
---|
| 676 | * Also see errors from UniUcsidToTag and UniUcsidFromTag
|
---|
| 677 | */
|
---|
| 678 | int CALLCONV UniMapCpToUcsCp( unsigned long ulCodePage, UniChar *ucsCodePage, size_t n );
|
---|
| 679 |
|
---|
| 680 | /*
|
---|
| 681 | * for compatibility with old return codes for ULS
|
---|
| 682 | */
|
---|
| 683 | #define UCONV_EOTHER ULS_OTHER
|
---|
| 684 | #define UCONV_EILSEQ ULS_ILLEGALSEQUENCE
|
---|
| 685 | #define UCONV_EINVAL ULS_INVALID
|
---|
| 686 | #define UCONV_E2BIG ULS_BUFFERFULL
|
---|
| 687 | #define UCONV_ENOMEM ULS_NOMEMORY
|
---|
| 688 | #define UCONV_EBADF ULS_BADOBJECT
|
---|
| 689 | #define UCONV_BADATTR ULS_BADATTR
|
---|
| 690 | #define UCONV_EMFILE ULS_MAXFILESPERPROC
|
---|
| 691 | #define UCONV_ENFILE ULS_MAXFILES
|
---|
| 692 | #define UCONV_NOTIMPLEMENTED ULS_NOTIMPLEMENTED
|
---|
| 693 | #define IBM_437 (UniChar *)L"IBM-437"
|
---|
| 694 | #define IBM_819 (UniChar *)L"IBM-819"
|
---|
| 695 | #define IBM_850 (UniChar *)L"IBM-850"
|
---|
| 696 | #define UTF_8 (UniChar *)L"IBM-1208"
|
---|
| 697 | #define UCS_2 (UniChar *)L"IBM-1200"
|
---|
| 698 | #define ISO8859_1 (UniChar *)L"IBM-819"
|
---|
| 699 |
|
---|
| 700 | #ifdef __cplusplus
|
---|
| 701 | }
|
---|
| 702 | #endif
|
---|
| 703 |
|
---|
| 704 | #endif
|
---|