Changeset 89 for trunk/include/uniconv.h
- Timestamp:
- Jun 10, 1999, 11:22:49 AM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/uniconv.h
r55 r89 10 10 #ifndef _ULS_UCONV 11 11 #define _ULS_UCONV 12 13 12 #ifdef __cplusplus 14 13 extern "C" { 15 14 #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 15 #include <stddef.h> 16 #include <time.h> 17 #define ULS_API_ERROR_BASE 0x00020400 18 #define ULS_API_ERROR(x) (ULS_API_ERROR_BASE | (x)) 23 19 typedef enum _uls_return_codes { 24 20 ULS_SUCCESS = 0x00000000, … … 46 42 ULS_VERSION = ULS_API_ERROR(22) 47 43 } uls_error_t; 48 49 50 44 #ifndef UNI_SUCCESS 51 45 #define UNI_SUCCESS ULS_SUCCESS 52 46 #endif 53 54 47 #ifndef NO_ERROR 55 48 #define NO_ERROR 0 56 49 #endif 57 58 50 #ifndef UNI_UNSUPPORTED 59 51 #define UNI_UNSUPPORTED ULS_UNSUPPORTED 60 52 #endif 61 62 53 #ifndef UNI_NOMEMORY 63 54 #define UNI_NOMEMORY ULS_NOMEMORY 64 55 #endif 65 66 56 #ifndef UNI_INVALID 67 57 #define UNI_INVALID ULS_INVALID 68 58 #endif 69 70 59 #ifndef UNI_BADOBJ 71 60 #define UNI_BADOBJ ULS_BADOBJECT 72 61 #endif 73 74 62 #ifndef UNI_NOTOKEN 75 63 #define UNI_NOTOKEN ULS_NOTOKEN 76 64 #endif 77 78 65 #ifndef UNI_NOMATCH 79 66 #define UNI_NOMATCH ULS_NOMATCH 80 67 #endif 81 82 68 #ifndef UNI_BUFFER_FULL 83 69 #define UNI_BUFFER_FULL ULS_BUFFERFULL 84 70 #endif 85 86 71 #ifndef UNI_RANGE 87 72 #define UNI_RANGE ULS_RANGE 88 73 #endif 89 90 74 #ifndef ERR_NOOP 91 75 #define ERR_NOOP ULS_NOOP 92 76 #endif 93 94 77 #ifndef ERR_TOO_MANY_KBD 95 78 #define ERR_TOO_MANY_KBD ULS_TOOMANYKBD 96 79 #endif 97 98 80 #ifndef ERR_KBD_NOT_FOUND 99 81 #define ERR_KBD_NOT_FOUND ULS_KBDNOTFOUND 100 82 #endif 101 102 83 #ifndef ERR_KBD_INVALID 103 84 #define ERR_KBD_INVALID ULS_INVALID 104 85 #endif 105 106 86 #ifndef ERR_BAD_HANDLE 107 87 #define ERR_BAD_HANDLE ULS_BADHANDLE 108 88 #endif 109 110 89 #ifndef ERR_NO_DEAD 111 90 #define ERR_NO_DEAD ULS_NODEAD 112 91 #endif 113 114 92 #ifndef ERR_NO_SCAN 115 93 #define ERR_NO_SCAN ULS_NOSCAN 116 94 #endif 117 118 95 #ifndef ERR_INVALID_SCAN 119 96 #define ERR_INVALID_SCAN ULS_INVALIDSCAN 120 97 #endif 121 122 98 #ifndef ERR_NOT_IMPLEMENTED 123 99 #define ERR_NOT_IMPLEMENTED ULS_NOTIMPLEMENTED 124 100 #endif 125 126 101 #ifdef ERR_NO_MEMORY 127 102 #undef ERR_NO_MEMORY 128 103 #endif 129 104 #define ERR_NO_MEMORY ULS_NOMEMORY 130 131 105 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 */ 106 #define D_T_FMT 1 107 #define D_FMT 2 108 #define T_FMT 3 109 #define AM_STR 4 110 #define PM_STR 5 111 #define ABDAY_1 6 112 #define ABDAY_2 7 113 #define ABDAY_3 8 114 #define ABDAY_4 9 115 #define ABDAY_5 10 116 #define ABDAY_6 11 117 #define ABDAY_7 12 118 #define DAY_1 13 119 #define DAY_2 14 120 #define DAY_3 15 121 #define DAY_4 16 122 #define DAY_5 17 123 #define DAY_6 18 124 #define DAY_7 19 125 #define ABMON_1 20 126 #define ABMON_2 21 127 #define ABMON_3 22 128 #define ABMON_4 23 129 #define ABMON_5 24 130 #define ABMON_6 25 131 #define ABMON_7 26 132 #define ABMON_8 27 133 #define ABMON_9 28 134 #define ABMON_10 29 135 #define ABMON_11 30 136 #define ABMON_12 31 137 #define MON_1 32 138 #define MON_2 33 139 #define MON_3 34 140 #define MON_4 35 141 #define MON_5 36 142 #define MON_6 37 143 #define MON_7 38 144 #define MON_8 39 145 #define MON_9 40 146 #define MON_10 41 147 #define MON_11 42 148 #define MON_12 43 149 #define RADIXCHAR 44 150 #define THOUSEP 45 151 #define YESSTR 46 152 #define NOSTR 47 153 #define CRNCYSTR 48 154 #define CODESET 49 155 #define T_FMT_AMPM 55 156 #define ERA 56 157 #define ERA_D_FMT 57 158 #define ERA_D_T_FMT 58 159 #define ERA_T_FMT 59 160 #define ALT_DIGITS 60 161 #define YESEXPR 61 162 #define NOEXPR 62 200 163 #define DATESEP 63 201 164 #define TIMESEP 64 202 165 #define LISTSEP 65 203 204 /*205 * nl_items to support implementation of NLgetenv206 */207 #ifdef _AIX31208 #define NLLDATE 50209 #define NLTMISC 51210 #define NLTSTRS 52211 #define NLTUNITS 53212 #define NLYEAR 54213 #endif214 215 /*216 ** if this number changes, it MUST be changed217 ** in sys/locdata.h218 */219 166 #ifndef _NL_NUM_ITEMS 220 167 #define _NL_NUM_ITEMS 66 221 168 #endif 222 223 224 169 #if defined(__IBMCPP__) || defined(__IBMC__) 225 170 #define CALLCONV _System … … 227 172 #define CALLCONV 228 173 #endif 229 230 231 /*232 * ulsBool Type233 */234 174 typedef int ulsBool; 235 236 237 /* LSA added TRUE/FALSE */238 175 #ifndef TRUE 239 176 #define TRUE 1 … … 242 179 #define FALSE 0 243 180 #endif 244 245 /*246 * UniChar Type247 */248 181 #ifndef _ULS_UNICHAR_DEFINED 249 182 typedef unsigned short UniChar ; 250 183 #define _ULS_UNICHAR_DEFINED 251 184 #endif 252 253 /*254 * LocaleObject Type255 */256 185 typedef void *LocaleObject; 257 258 /*259 * LocaleToken Type260 */261 186 typedef unsigned int LocaleToken; 262 263 /*264 * AttrObject Type265 */266 187 typedef void *AttrObject; 267 268 /*269 * XformObject type270 */271 188 typedef void *XformObject; 272 273 /*274 * LocaleSpecType Values275 */276 189 #define UNI_TOKEN_POINTER 1 277 190 #define UNI_MBS_STRING_POINTER 2 278 191 #define UNI_UCS_STRING_POINTER 3 279 280 281 /*282 * Categories283 */284 192 #undef LANG 285 193 #undef LC_ALL … … 290 198 #undef LC_TIME 291 199 #undef LC_MESSAGES 292 293 200 #define LANG (-2) 294 201 #define LC_ALL (-1) … … 299 206 #define LC_TIME 4 300 207 #define LC_MESSAGES 5 301 302 /*303 * UniLconv locale conventions structure304 */305 208 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 - ")" */209 UniChar *decimal_point; 210 UniChar *thousands_sep; 211 short *grouping; 212 UniChar *int_curr_symbol; 213 UniChar *currency_symbol; 214 UniChar *mon_decimal_point; 215 UniChar *mon_thousands_sep; 216 short *mon_grouping; 217 UniChar *positive_sign; 218 UniChar *negative_sign; 219 short int_frac_digits; 220 short frac_digits; 221 short p_cs_precedes; 222 short p_sep_by_space; 223 short n_cs_precedes; 224 short n_sep_by_space; 225 short p_sign_posn; 226 short n_sign_posn; 227 short os2_mondecpt; 228 UniChar *debit_sign; 229 UniChar *credit_sign; 230 UniChar *left_parenthesis; 231 UniChar *right_parenthesis; 329 232 }; 330 331 /*332 * Locale Management Function Prototypes333 */334 233 int CALLCONV UniCreateLocaleObject ( int locale_spec_type, const void *locale_spec, 335 234 LocaleObject *locale_object_ptr ); … … 342 241 int CALLCONV UniLocaleTokenToStr ( const LocaleToken locale_token, 343 242 int locale_string_type, void **locale_string_ptr ); 344 345 /*346 * Locale Information Function Prototypes347 */348 243 int CALLCONV UniQueryLocaleInfo ( const LocaleObject locale_object, 349 244 struct UniLconv **unilconv_addr_ptr ); … … 352 247 LocaleItem item, 353 248 UniChar **info_item_addr_ptr ); 354 355 /*356 * Date and Time Function Prototypes357 */358 249 size_t CALLCONV UniStrftime ( const LocaleObject locale_object, 359 250 UniChar *ucs, size_t maxsize, … … 362 253 const UniChar *buf, const UniChar *format, 363 254 struct tm *time_ptr ); 364 365 /*366 * Monetary Formatting Function Prototype367 */368 255 int CALLCONV UniStrfmon ( const LocaleObject locale_object, 369 256 UniChar *ucs, size_t maxsize, 370 257 const UniChar *format, ... ); 371 372 /*373 * String/Character Function Prototypes374 */375 258 UniChar * CALLCONV UniStrcat ( UniChar *ucs1, const UniChar *ucs2 ); 376 259 UniChar * CALLCONV UniStrchr ( const UniChar *ucs, UniChar uc ); … … 387 270 UniChar * CALLCONV UniStrstr ( const UniChar *ucs1, const UniChar *ucs2 ); 388 271 UniChar * CALLCONV UniStrtok ( UniChar *ucs1, const UniChar *ucs2 ); 389 390 391 /*392 * Character Attribute Function Prototypes393 */394 272 int CALLCONV UniCreateAttrObject ( const LocaleObject locale_object, 395 273 const UniChar *attr_name, … … 412 290 int CALLCONV UniQueryUpper ( const LocaleObject locale_object, UniChar uc ); 413 291 int CALLCONV UniQueryXdigit ( const LocaleObject locale_object, UniChar uc ); 414 415 /*416 * String Transformation Function Prototypes417 */418 292 int CALLCONV UniCreateTransformObject ( const LocaleObject locale_object, 419 293 const UniChar *xtype, … … 425 299 UniChar CALLCONV UniTransLower ( const LocaleObject locale_object, UniChar uc ); 426 300 UniChar CALLCONV UniTransUpper ( const LocaleObject locale_object, UniChar uc ); 427 428 /*429 * String Conversion Function Prototypes430 */431 301 int CALLCONV UniStrtod ( const LocaleObject locale_object, const UniChar *ucs, 432 302 UniChar **end_ptr, double *result_ptr ); … … 435 305 int CALLCONV UniStrtoul ( const LocaleObject locale_object, const UniChar *ucs, 436 306 UniChar **end_ptr, int base, unsigned long int *result_ptr ); 437 438 /*439 * String Comparison Function Prototypes440 */441 307 int CALLCONV UniStrcoll ( const LocaleObject locale_object, 442 308 const UniChar *ucs1, const UniChar *ucs2 ); … … 447 313 int CALLCONV UniStrncmpi ( const LocaleObject locale_object, 448 314 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 315 UniChar CALLCONV UniToupper (UniChar uc); 316 UniChar CALLCONV UniTolower (UniChar uc); 317 UniChar * CALLCONV UniStrupr (UniChar *ucs); 318 UniChar * CALLCONV UniStrlwr (UniChar *ucs); 319 int CALLCONV UniMapCtryToLocale(unsigned long Country, 320 UniChar *LocaleName, 321 size_t n); 464 322 #ifndef _ULS_UCONVP 465 323 #define _ULS_UCONVP 466 typedef void * UconvObject; /* uconv Type pointer */ 467 #endif 468 324 typedef void * UconvObject; 325 #endif 469 326 #ifndef _ULS_UNICHAR_DEFINED 470 327 #define _ULS_UNICHAR_DEFINED 471 328 typedef unsigned short UniChar ; 472 329 #endif 473 474 475 330 #ifndef ULS_ATTR 476 331 #define ULS_ATTR 477 /*478 * Substitution options479 */480 332 #define UCONV_OPTION_SUBSTITUTE_FROM_UNICODE 1 481 333 #define UCONV_OPTION_SUBSTITUTE_TO_UNICODE 2 482 334 #define UCONV_OPTION_SUBSTITUTE_BOTH 3 483 484 /*485 * Conversion options486 */487 335 #define CVTTYPE_PATH 0x00000004 /* Treat string as a path */ 488 336 #define CVTTYPE_CDRA 0x00000002 /* Use CDRA control mapping */ 489 337 #define CVTTYPE_CTRL7F 0x00000001 /* Treat 0x7F as a control */ 490 491 /*492 * Conversion mask. This is a bit mask. If the bit is on, the493 * corresponding character 0x00-0x1f is treated as a control.494 * Otherwise it is treated as a glyph.495 */496 338 #define DSPMASK_DATA 0xffffffff 497 339 #define DSPMASK_DISPLAY 0x00000000 … … 500 342 #define DSPMASK_CR 0x00002000 501 343 #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 */ 344 enum uconv_esid { 345 ESID_sbcs_data = 0x2100, 346 ESID_sbcs_pc = 0x3100, 347 ESID_sbcs_ebcdic = 0x1100, 348 ESID_sbcs_iso = 0x4100, 349 ESID_sbcs_windows = 0x4105, 350 ESID_sbcs_alt = 0xF100, 351 ESID_dbcs_data = 0x2200, 352 ESID_dbcs_pc = 0x3200, 353 ESID_dbcs_ebcdic = 0x1200, 354 ESID_mbcs_data = 0x2300, 355 ESID_mbcs_pc = 0x3300, 356 ESID_mbcs_ebcdic = 0x1301, 357 ESID_ucs_2 = 0x7200, 358 ESID_ugl = 0x72FF, 359 ESID_utf_8 = 0x7807, 360 ESID_upf_8 = 0x78FF 525 361 }; 526 527 362 #ifndef __conv_endian_t 528 363 #define __conv_endian_t … … 531 366 #define ENDIAN_LITTLE 0xfffe 532 367 typedef struct _conv_endian_rec { 533 unsigned short source; /* Used by FromUcs */534 unsigned short target; /* Used by ToUcs */368 unsigned short source; 369 unsigned short target; 535 370 } conv_endian_t; 536 371 #endif 537 538 372 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 */373 unsigned long version; 374 char mb_min_len; 375 char mb_max_len; 376 char usc_min_len; 377 char usc_max_len; 378 unsigned short esid; 379 char options; 380 char state; 381 conv_endian_t endian; 382 unsigned long displaymask; 383 unsigned long converttype; 384 unsigned short subchar_len; 385 unsigned short subuni_len; 386 char subchar[16]; 387 UniChar subuni[8]; 554 388 } 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 */ 389 typedef struct { 390 unsigned short first; 391 unsigned short last; 562 392 } udcrange_t; 563 #endif /* ULS_ATTR */393 #endif 564 394 #define uconv_error_t int 565 566 /*567 * UniCreateUconvObject: Create Unicode Conversion Object568 *569 * return code:570 * 0 - Conversion Object sucessfully initialized571 * UCONV_EMFILE - Maximum file descriptors are opened572 * UCONV_ENFILE - Too many files currently open in the system573 * UCONV_ENOMEM - Insuffcient memory574 * UCONV_EINVAL - The conversion specified by code_set or the575 * modifier supplied is not recognized by the576 * implementation.577 *578 */579 395 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 */ 396 UniChar * code_set, 397 UconvObject * uobj ); 590 398 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 */ 399 UconvObject uobj, 400 uconv_attribute_t * attr, 401 size_t size, 402 char first[256], 403 char other[256], 404 udcrange_t udcrange[32]); 607 405 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 */ 406 UconvObject uobj, 407 uconv_attribute_t * attr); 625 408 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 */ 409 UconvObject uobj, 410 void * * inbuf, 411 size_t * inbytes, 412 UniChar * * outbuf, 413 size_t * outchars, 414 size_t * subst ); 645 415 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 */ 416 UconvObject uobj, 417 UniChar * * inbuf, 418 size_t * inchars, 419 void * * outbuf, 420 size_t * outbytes, 421 size_t * subst ); 658 422 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 */ 423 UconvObject uobj ); 678 424 int CALLCONV UniMapCpToUcsCp( unsigned long ulCodePage, UniChar *ucsCodePage, size_t n ); 679 680 /*681 * for compatibility with old return codes for ULS682 */683 425 #define UCONV_EOTHER ULS_OTHER 684 426 #define UCONV_EILSEQ ULS_ILLEGALSEQUENCE … … 697 439 #define UCS_2 (UniChar *)L"IBM-1200" 698 440 #define ISO8859_1 (UniChar *)L"IBM-819" 699 700 441 #ifdef __cplusplus 701 442 } 702 443 #endif 703 704 #endif 444 #endif
Note:
See TracChangeset
for help on using the changeset viewer.