source: trunk/include/uniconv.h@ 4384

Last change on this file since 4384 was 3457, checked in by achimha, 25 years ago

workaround for wrc bug

File size: 17.0 KB
Line 
1/* $Id: uniconv.h,v 1.6 2000-04-28 15:15:18 achimha Exp $ */
2/*
3 * OS/2 Unicode API definitions
4 *
5 * Copyright 1999 Achim Hasenmueller
6 * 1999 Przemyslaw Dobrowolski
7 *
8 * Project Odin Software License can be found in LICENSE.TXT
9 *
10 */
11#ifndef _ULS_UCONV
12#define _ULS_UCONV
13#ifdef __cplusplus
14extern "C" {
15#endif
16//@@@AH workaround for wrc bug
17#ifndef RC_INVOKED
18#include <stddef.h>
19#include <time.h>
20#endif
21#define ULS_API_ERROR_BASE 0x00020400
22#define ULS_API_ERROR(x) (ULS_API_ERROR_BASE | (x))
23typedef 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#ifndef UNI_SUCCESS
49 #define UNI_SUCCESS ULS_SUCCESS
50#endif
51#ifndef NO_ERROR
52 #define NO_ERROR 0
53#endif
54#ifndef UNI_UNSUPPORTED
55 #define UNI_UNSUPPORTED ULS_UNSUPPORTED
56#endif
57#ifndef UNI_NOMEMORY
58 #define UNI_NOMEMORY ULS_NOMEMORY
59#endif
60#ifndef UNI_INVALID
61 #define UNI_INVALID ULS_INVALID
62#endif
63#ifndef UNI_BADOBJ
64 #define UNI_BADOBJ ULS_BADOBJECT
65#endif
66#ifndef UNI_NOTOKEN
67 #define UNI_NOTOKEN ULS_NOTOKEN
68#endif
69#ifndef UNI_NOMATCH
70 #define UNI_NOMATCH ULS_NOMATCH
71#endif
72#ifndef UNI_BUFFER_FULL
73 #define UNI_BUFFER_FULL ULS_BUFFERFULL
74#endif
75#ifndef UNI_RANGE
76 #define UNI_RANGE ULS_RANGE
77#endif
78#ifndef ERR_NOOP
79 #define ERR_NOOP ULS_NOOP
80#endif
81#ifndef ERR_TOO_MANY_KBD
82 #define ERR_TOO_MANY_KBD ULS_TOOMANYKBD
83#endif
84#ifndef ERR_KBD_NOT_FOUND
85 #define ERR_KBD_NOT_FOUND ULS_KBDNOTFOUND
86#endif
87#ifndef ERR_KBD_INVALID
88 #define ERR_KBD_INVALID ULS_INVALID
89#endif
90#ifndef ERR_BAD_HANDLE
91 #define ERR_BAD_HANDLE ULS_BADHANDLE
92#endif
93#ifndef ERR_NO_DEAD
94 #define ERR_NO_DEAD ULS_NODEAD
95#endif
96#ifndef ERR_NO_SCAN
97 #define ERR_NO_SCAN ULS_NOSCAN
98#endif
99#ifndef ERR_INVALID_SCAN
100 #define ERR_INVALID_SCAN ULS_INVALIDSCAN
101#endif
102#ifndef ERR_NOT_IMPLEMENTED
103 #define ERR_NOT_IMPLEMENTED ULS_NOTIMPLEMENTED
104#endif
105#ifdef ERR_NO_MEMORY
106#undef ERR_NO_MEMORY
107#endif
108#define ERR_NO_MEMORY ULS_NOMEMORY
109typedef int LocaleItem;
110#define D_T_FMT 1
111#define D_FMT 2
112#define T_FMT 3
113#define AM_STR 4
114#define PM_STR 5
115#define ABDAY_1 6
116#define ABDAY_2 7
117#define ABDAY_3 8
118#define ABDAY_4 9
119#define ABDAY_5 10
120#define ABDAY_6 11
121#define ABDAY_7 12
122#define DAY_1 13
123#define DAY_2 14
124#define DAY_3 15
125#define DAY_4 16
126#define DAY_5 17
127#define DAY_6 18
128#define DAY_7 19
129#define ABMON_1 20
130#define ABMON_2 21
131#define ABMON_3 22
132#define ABMON_4 23
133#define ABMON_5 24
134#define ABMON_6 25
135#define ABMON_7 26
136#define ABMON_8 27
137#define ABMON_9 28
138#define ABMON_10 29
139#define ABMON_11 30
140#define ABMON_12 31
141#define MON_1 32
142#define MON_2 33
143#define MON_3 34
144#define MON_4 35
145#define MON_5 36
146#define MON_6 37
147#define MON_7 38
148#define MON_8 39
149#define MON_9 40
150#define MON_10 41
151#define MON_11 42
152#define MON_12 43
153#define RADIXCHAR 44
154#define THOUSEP 45
155#define YESSTR 46
156#define NOSTR 47
157#define CRNCYSTR 48
158#define CODESET 49
159#define T_FMT_AMPM 55
160#define ERA 56
161#define ERA_D_FMT 57
162#define ERA_D_T_FMT 58
163#define ERA_T_FMT 59
164#define ALT_DIGITS 60
165#define YESEXPR 61
166#define NOEXPR 62
167#define DATESEP 63
168#define TIMESEP 64
169#define LISTSEP 65
170#ifndef _NL_NUM_ITEMS
171#define _NL_NUM_ITEMS 66
172#endif
173// Evil UNI Items hackeckeur ;-)
174// PD 21-07-99: Undefined Uni items!!!! Thanx IBM for undocumented items :-P
175// Names like regedit2 uses:
176#define XLOCALETOKEN 50
177#define XWINLOCALE 51
178#define ICURRENCY 75
179#define INEGCURR 83
180#define SINTLSYMBOL 87
181#define SABBREVLANGNAME 88
182#define SLANGUAGE 104
183#define WTIMEFORMAT 123
184#define WSHORTDATE 124
185#define WLONGDATE 125
186#define SENGCOUNTRYNAME 105
187#define SENGLANGUAGE 103
188#define SCOUNTRY 106 // Fixme or 107?
189#define IANSICODEPAGE 110
190#define ICODEPAGE 111
191#define IALTCODEPAGE 112
192#define IMACCODEPAGE 113
193#define ICOUNTRY 108
194#define SISO639LANGNAME 101
195#define SISO3166CTRYNAME 102
196#define SABBREVCTRYNAME 102
197#define SNATIVEDIGITS 53
198
199
200#if defined(__IBMCPP__) || defined(__IBMC__)
201 #define CALLCONV _System
202#else
203 #define CALLCONV
204#endif
205typedef int ulsBool;
206#ifndef TRUE
207 #define TRUE 1
208#endif
209#ifndef FALSE
210 #define FALSE 0
211#endif
212#ifndef _ULS_UNICHAR_DEFINED
213 typedef unsigned short UniChar ;
214 #define _ULS_UNICHAR_DEFINED
215#endif
216typedef void *LocaleObject;
217typedef unsigned int LocaleToken;
218typedef void *AttrObject;
219typedef void *XformObject;
220#define UNI_TOKEN_POINTER 1
221#define UNI_MBS_STRING_POINTER 2
222#define UNI_UCS_STRING_POINTER 3
223#undef LANG
224#undef LC_ALL
225#undef LC_COLLATE
226#undef LC_CTYPE
227#undef LC_NUMERIC
228#undef LC_MONETARY
229#undef LC_TIME
230#undef LC_MESSAGES
231#define LANG (-2)
232#define LC_ALL (-1)
233#define LC_COLLATE 0
234#define LC_CTYPE 1
235#define LC_NUMERIC 2
236#define LC_MONETARY 3
237#define LC_TIME 4
238#define LC_MESSAGES 5
239struct UniLconv {
240 UniChar *decimal_point;
241 UniChar *thousands_sep;
242 short *grouping;
243 UniChar *int_curr_symbol;
244 UniChar *currency_symbol;
245 UniChar *mon_decimal_point;
246 UniChar *mon_thousands_sep;
247 short *mon_grouping;
248 UniChar *positive_sign;
249 UniChar *negative_sign;
250 short int_frac_digits;
251 short frac_digits;
252 short p_cs_precedes;
253 short p_sep_by_space;
254 short n_cs_precedes;
255 short n_sep_by_space;
256 short p_sign_posn;
257 short n_sign_posn;
258 short os2_mondecpt;
259 UniChar *debit_sign;
260 UniChar *credit_sign;
261 UniChar *left_parenthesis;
262 UniChar *right_parenthesis;
263};
264int CALLCONV UniCreateLocaleObject ( int locale_spec_type, const void *locale_spec,
265 LocaleObject *locale_object_ptr );
266int CALLCONV UniQueryLocaleObject ( const LocaleObject locale_object, int category,
267 int locale_spec_type, void **locale_spec_ptr );
268int CALLCONV UniFreeLocaleObject ( LocaleObject locale_object );
269int CALLCONV UniFreeMem ( void *memory_ptr );
270int CALLCONV UniLocaleStrToToken ( int locale_string_type, const void *locale_string,
271 LocaleToken *locale_token_ptr );
272int CALLCONV UniLocaleTokenToStr ( const LocaleToken locale_token,
273 int locale_string_type, void **locale_string_ptr );
274int CALLCONV UniQueryLocaleInfo ( const LocaleObject locale_object,
275 struct UniLconv **unilconv_addr_ptr );
276int CALLCONV UniFreeLocaleInfo ( struct UniLconv *unilconv_addr );
277int CALLCONV UniQueryLocaleItem ( const LocaleObject locale_object,
278 LocaleItem item,
279 UniChar **info_item_addr_ptr );
280size_t CALLCONV UniStrftime ( const LocaleObject locale_object,
281 UniChar *ucs, size_t maxsize,
282 const UniChar *format, const struct tm *time_ptr );
283UniChar * CALLCONV UniStrptime ( const LocaleObject locale_object,
284 const UniChar *buf, const UniChar *format,
285 struct tm *time_ptr );
286int CALLCONV UniStrfmon ( const LocaleObject locale_object,
287 UniChar *ucs, size_t maxsize,
288 const UniChar *format, ... );
289UniChar * CALLCONV UniStrcat ( UniChar *ucs1, const UniChar *ucs2 );
290UniChar * CALLCONV UniStrchr ( const UniChar *ucs, UniChar uc );
291int CALLCONV UniStrcmp ( const UniChar *ucs1, const UniChar *ucs2 );
292UniChar * CALLCONV UniStrcpy ( UniChar *ucs1, const UniChar *ucs2 );
293size_t CALLCONV UniStrcspn ( const UniChar *ucs1, const UniChar *ucs2 );
294size_t CALLCONV UniStrlen ( const UniChar *ucs1 );
295UniChar * CALLCONV UniStrncat ( UniChar *ucs1, const UniChar *ucs2, size_t n );
296int CALLCONV UniStrncmp ( const UniChar *ucs1, const UniChar *ucs2, size_t n );
297UniChar * CALLCONV UniStrncpy ( UniChar *ucs1, const UniChar *ucs2, size_t n );
298UniChar * CALLCONV UniStrpbrk ( const UniChar *ucs1, const UniChar *ucs2 );
299UniChar * CALLCONV UniStrrchr ( const UniChar *ucs, UniChar uc );
300size_t CALLCONV UniStrspn ( const UniChar *ucs1, const UniChar *ucs2 );
301UniChar * CALLCONV UniStrstr ( const UniChar *ucs1, const UniChar *ucs2 );
302UniChar * CALLCONV UniStrtok ( UniChar *ucs1, const UniChar *ucs2 );
303int CALLCONV UniCreateAttrObject ( const LocaleObject locale_object,
304 const UniChar *attr_name,
305 AttrObject *attr_object_ptr );
306int CALLCONV UniQueryCharAttr ( AttrObject attr_object, UniChar uc );
307int CALLCONV UniScanForAttr ( AttrObject attr_object, const UniChar *ucs,
308 size_t num_elems, ulsBool inverse_op,
309 size_t *offset_ptr );
310int CALLCONV UniFreeAttrObject ( AttrObject attr_object );
311int CALLCONV UniQueryAlnum ( const LocaleObject locale_object, UniChar uc );
312int CALLCONV UniQueryAlpha ( const LocaleObject locale_object, UniChar uc );
313int CALLCONV UniQueryBlank ( const LocaleObject locale_object, UniChar uc );
314int CALLCONV UniQueryCntrl ( const LocaleObject locale_object, UniChar uc );
315int CALLCONV UniQueryDigit ( const LocaleObject locale_object, UniChar uc );
316int CALLCONV UniQueryGraph ( const LocaleObject locale_object, UniChar uc );
317int CALLCONV UniQueryLower ( const LocaleObject locale_object, UniChar uc );
318int CALLCONV UniQueryPrint ( const LocaleObject locale_object, UniChar uc );
319int CALLCONV UniQueryPunct ( const LocaleObject locale_object, UniChar uc );
320int CALLCONV UniQuerySpace ( const LocaleObject locale_object, UniChar uc );
321int CALLCONV UniQueryUpper ( const LocaleObject locale_object, UniChar uc );
322int CALLCONV UniQueryXdigit ( const LocaleObject locale_object, UniChar uc );
323int CALLCONV UniCreateTransformObject ( const LocaleObject locale_object,
324 const UniChar *xtype,
325 XformObject *xform_object_ptr );
326int CALLCONV UniTransformStr ( XformObject xform_object,
327 const UniChar *inp_buf, int *inp_size,
328 UniChar *out_buf, int *out_size );
329int CALLCONV UniFreeTransformObject ( XformObject xform_object );
330UniChar CALLCONV UniTransLower ( const LocaleObject locale_object, UniChar uc );
331UniChar CALLCONV UniTransUpper ( const LocaleObject locale_object, UniChar uc );
332int CALLCONV UniStrtod ( const LocaleObject locale_object, const UniChar *ucs,
333 UniChar **end_ptr, double *result_ptr );
334int CALLCONV UniStrtol ( const LocaleObject locale_object, const UniChar *ucs,
335 UniChar **end_ptr, int base, long int *result_ptr );
336int CALLCONV UniStrtoul ( const LocaleObject locale_object, const UniChar *ucs,
337 UniChar **end_ptr, int base, unsigned long int *result_ptr );
338int CALLCONV UniStrcoll ( const LocaleObject locale_object,
339 const UniChar *ucs1, const UniChar *ucs2 );
340size_t CALLCONV UniStrxfrm ( const LocaleObject locale_object,
341 UniChar *ucs1, const UniChar *ucs2, size_t n );
342int CALLCONV UniStrcmpi ( const LocaleObject locale_object,
343 const UniChar *ucs1, const UniChar *ucs2 );
344int CALLCONV UniStrncmpi ( const LocaleObject locale_object,
345 const UniChar *ucs1, const UniChar *ucs2, const size_t n );
346UniChar CALLCONV UniToupper (UniChar uc);
347UniChar CALLCONV UniTolower (UniChar uc);
348UniChar * CALLCONV UniStrupr (UniChar *ucs);
349UniChar * CALLCONV UniStrlwr (UniChar *ucs);
350int CALLCONV UniMapCtryToLocale(unsigned long Country,
351 UniChar *LocaleName,
352 size_t n);
353#ifndef _ULS_UCONVP
354#define _ULS_UCONVP
355typedef void * UconvObject;
356#endif
357#ifndef _ULS_UNICHAR_DEFINED
358#define _ULS_UNICHAR_DEFINED
359typedef unsigned short UniChar ;
360#endif
361#ifndef ULS_ATTR
362#define ULS_ATTR
363#define UCONV_OPTION_SUBSTITUTE_FROM_UNICODE 1
364#define UCONV_OPTION_SUBSTITUTE_TO_UNICODE 2
365#define UCONV_OPTION_SUBSTITUTE_BOTH 3
366#define CVTTYPE_PATH 0x00000004 /* Treat string as a path */
367#define CVTTYPE_CDRA 0x00000002 /* Use CDRA control mapping */
368#define CVTTYPE_CTRL7F 0x00000001 /* Treat 0x7F as a control */
369#define DSPMASK_DATA 0xffffffff
370#define DSPMASK_DISPLAY 0x00000000
371#define DSPMASK_TAB 0x00000200
372#define DSPMASK_LF 0x00000400
373#define DSPMASK_CR 0x00002000
374#define DSPMASK_CRLF 0x00002400
375enum uconv_esid {
376 ESID_sbcs_data = 0x2100,
377 ESID_sbcs_pc = 0x3100,
378 ESID_sbcs_ebcdic = 0x1100,
379 ESID_sbcs_iso = 0x4100,
380 ESID_sbcs_windows = 0x4105,
381 ESID_sbcs_alt = 0xF100,
382 ESID_dbcs_data = 0x2200,
383 ESID_dbcs_pc = 0x3200,
384 ESID_dbcs_ebcdic = 0x1200,
385 ESID_mbcs_data = 0x2300,
386 ESID_mbcs_pc = 0x3300,
387 ESID_mbcs_ebcdic = 0x1301,
388 ESID_ucs_2 = 0x7200,
389 ESID_ugl = 0x72FF,
390 ESID_utf_8 = 0x7807,
391 ESID_upf_8 = 0x78FF
392};
393#ifndef __conv_endian_t
394#define __conv_endian_t
395#define ENDIAN_SYSTEM 0x0000
396#define ENDIAN_BIG 0xfeff
397#define ENDIAN_LITTLE 0xfffe
398typedef struct _conv_endian_rec {
399 unsigned short source;
400 unsigned short target;
401} conv_endian_t;
402#endif
403typedef struct _uconv_attribute_t {
404 unsigned long version;
405 char mb_min_len;
406 char mb_max_len;
407 char usc_min_len;
408 char usc_max_len;
409 unsigned short esid;
410 char options;
411 char state;
412 conv_endian_t endian;
413 unsigned long displaymask;
414 unsigned long converttype;
415 unsigned short subchar_len;
416 unsigned short subuni_len;
417 char subchar[16];
418 UniChar subuni[8];
419} uconv_attribute_t;
420typedef struct {
421 unsigned short first;
422 unsigned short last;
423} udcrange_t;
424#endif
425#define uconv_error_t int
426int CALLCONV UniCreateUconvObject(
427 UniChar * code_set,
428 UconvObject * uobj );
429int CALLCONV UniQueryUconvObject(
430 UconvObject uobj,
431 uconv_attribute_t * attr,
432 size_t size,
433 char first[256],
434 char other[256],
435 udcrange_t udcrange[32]);
436int CALLCONV UniSetUconvObject(
437 UconvObject uobj,
438 uconv_attribute_t * attr);
439int CALLCONV UniUconvToUcs(
440 UconvObject uobj,
441 void * * inbuf,
442 size_t * inbytes,
443 UniChar * * outbuf,
444 size_t * outchars,
445 size_t * subst );
446int CALLCONV UniUconvFromUcs(
447 UconvObject uobj,
448 UniChar * * inbuf,
449 size_t * inchars,
450 void * * outbuf,
451 size_t * outbytes,
452 size_t * subst );
453int CALLCONV UniFreeUconvObject(
454 UconvObject uobj );
455int CALLCONV UniMapCpToUcsCp( unsigned long ulCodePage, UniChar *ucsCodePage, size_t n );
456#define UCONV_EOTHER ULS_OTHER
457#define UCONV_EILSEQ ULS_ILLEGALSEQUENCE
458#define UCONV_EINVAL ULS_INVALID
459#define UCONV_E2BIG ULS_BUFFERFULL
460#define UCONV_ENOMEM ULS_NOMEMORY
461#define UCONV_EBADF ULS_BADOBJECT
462#define UCONV_BADATTR ULS_BADATTR
463#define UCONV_EMFILE ULS_MAXFILESPERPROC
464#define UCONV_ENFILE ULS_MAXFILES
465#define UCONV_NOTIMPLEMENTED ULS_NOTIMPLEMENTED
466#define IBM_437 (UniChar *)L"IBM-437"
467#define IBM_819 (UniChar *)L"IBM-819"
468#define IBM_850 (UniChar *)L"IBM-850"
469#define UTF_8 (UniChar *)L"IBM-1208"
470#define UCS_2 (UniChar *)L"IBM-1200"
471#define ISO8859_1 (UniChar *)L"IBM-819"
472#ifdef __cplusplus
473}
474#endif
475#endif
Note: See TracBrowser for help on using the repository browser.