source: trunk/include/uniconv.h@ 89

Last change on this file since 89 was 89, checked in by achimha, 26 years ago

header cleanup

File size: 16.1 KB
Line 
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#ifdef __cplusplus
13extern "C" {
14#endif
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))
19typedef enum _uls_return_codes {
20 ULS_SUCCESS = 0x00000000,
21 ULS_OTHER = ULS_API_ERROR(1),
22 ULS_ILLEGALSEQUENCE = ULS_API_ERROR(2),
23 ULS_MAXFILESPERPROC = ULS_API_ERROR(3),
24 ULS_MAXFILES = ULS_API_ERROR(4),
25 ULS_NOOP = ULS_API_ERROR(5),
26 ULS_TOOMANYKBD = ULS_API_ERROR(6),
27 ULS_KBDNOTFOUND = ULS_API_ERROR(7),
28 ULS_BADHANDLE = ULS_API_ERROR(8),
29 ULS_NODEAD = ULS_API_ERROR(9),
30 ULS_NOSCAN = ULS_API_ERROR(10),
31 ULS_INVALIDSCAN = ULS_API_ERROR(11),
32 ULS_NOTIMPLEMENTED = ULS_API_ERROR(12),
33 ULS_NOMEMORY = ULS_API_ERROR(13),
34 ULS_INVALID = ULS_API_ERROR(14),
35 ULS_BADOBJECT = ULS_API_ERROR(15),
36 ULS_NOTOKEN = ULS_API_ERROR(16),
37 ULS_NOMATCH = ULS_API_ERROR(17),
38 ULS_BUFFERFULL = ULS_API_ERROR(18),
39 ULS_RANGE = ULS_API_ERROR(19),
40 ULS_UNSUPPORTED = ULS_API_ERROR(20),
41 ULS_BADATTR = ULS_API_ERROR(21),
42 ULS_VERSION = ULS_API_ERROR(22)
43} uls_error_t;
44#ifndef UNI_SUCCESS
45 #define UNI_SUCCESS ULS_SUCCESS
46#endif
47#ifndef NO_ERROR
48 #define NO_ERROR 0
49#endif
50#ifndef UNI_UNSUPPORTED
51 #define UNI_UNSUPPORTED ULS_UNSUPPORTED
52#endif
53#ifndef UNI_NOMEMORY
54 #define UNI_NOMEMORY ULS_NOMEMORY
55#endif
56#ifndef UNI_INVALID
57 #define UNI_INVALID ULS_INVALID
58#endif
59#ifndef UNI_BADOBJ
60 #define UNI_BADOBJ ULS_BADOBJECT
61#endif
62#ifndef UNI_NOTOKEN
63 #define UNI_NOTOKEN ULS_NOTOKEN
64#endif
65#ifndef UNI_NOMATCH
66 #define UNI_NOMATCH ULS_NOMATCH
67#endif
68#ifndef UNI_BUFFER_FULL
69 #define UNI_BUFFER_FULL ULS_BUFFERFULL
70#endif
71#ifndef UNI_RANGE
72 #define UNI_RANGE ULS_RANGE
73#endif
74#ifndef ERR_NOOP
75 #define ERR_NOOP ULS_NOOP
76#endif
77#ifndef ERR_TOO_MANY_KBD
78 #define ERR_TOO_MANY_KBD ULS_TOOMANYKBD
79#endif
80#ifndef ERR_KBD_NOT_FOUND
81 #define ERR_KBD_NOT_FOUND ULS_KBDNOTFOUND
82#endif
83#ifndef ERR_KBD_INVALID
84 #define ERR_KBD_INVALID ULS_INVALID
85#endif
86#ifndef ERR_BAD_HANDLE
87 #define ERR_BAD_HANDLE ULS_BADHANDLE
88#endif
89#ifndef ERR_NO_DEAD
90 #define ERR_NO_DEAD ULS_NODEAD
91#endif
92#ifndef ERR_NO_SCAN
93 #define ERR_NO_SCAN ULS_NOSCAN
94#endif
95#ifndef ERR_INVALID_SCAN
96 #define ERR_INVALID_SCAN ULS_INVALIDSCAN
97#endif
98#ifndef ERR_NOT_IMPLEMENTED
99 #define ERR_NOT_IMPLEMENTED ULS_NOTIMPLEMENTED
100#endif
101#ifdef ERR_NO_MEMORY
102#undef ERR_NO_MEMORY
103#endif
104#define ERR_NO_MEMORY ULS_NOMEMORY
105typedef int LocaleItem;
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
163#define DATESEP 63
164#define TIMESEP 64
165#define LISTSEP 65
166#ifndef _NL_NUM_ITEMS
167#define _NL_NUM_ITEMS 66
168#endif
169#if defined(__IBMCPP__) || defined(__IBMC__)
170 #define CALLCONV _System
171#else
172 #define CALLCONV
173#endif
174typedef int ulsBool;
175#ifndef TRUE
176 #define TRUE 1
177#endif
178#ifndef FALSE
179 #define FALSE 0
180#endif
181#ifndef _ULS_UNICHAR_DEFINED
182 typedef unsigned short UniChar ;
183 #define _ULS_UNICHAR_DEFINED
184#endif
185typedef void *LocaleObject;
186typedef unsigned int LocaleToken;
187typedef void *AttrObject;
188typedef void *XformObject;
189#define UNI_TOKEN_POINTER 1
190#define UNI_MBS_STRING_POINTER 2
191#define UNI_UCS_STRING_POINTER 3
192#undef LANG
193#undef LC_ALL
194#undef LC_COLLATE
195#undef LC_CTYPE
196#undef LC_NUMERIC
197#undef LC_MONETARY
198#undef LC_TIME
199#undef LC_MESSAGES
200#define LANG (-2)
201#define LC_ALL (-1)
202#define LC_COLLATE 0
203#define LC_CTYPE 1
204#define LC_NUMERIC 2
205#define LC_MONETARY 3
206#define LC_TIME 4
207#define LC_MESSAGES 5
208struct UniLconv {
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;
232};
233int CALLCONV UniCreateLocaleObject ( int locale_spec_type, const void *locale_spec,
234 LocaleObject *locale_object_ptr );
235int CALLCONV UniQueryLocaleObject ( const LocaleObject locale_object, int category,
236 int locale_spec_type, void **locale_spec_ptr );
237int CALLCONV UniFreeLocaleObject ( LocaleObject locale_object );
238int CALLCONV UniFreeMem ( void *memory_ptr );
239int CALLCONV UniLocaleStrToToken ( int locale_string_type, const void *locale_string,
240 LocaleToken *locale_token_ptr );
241int CALLCONV UniLocaleTokenToStr ( const LocaleToken locale_token,
242 int locale_string_type, void **locale_string_ptr );
243int CALLCONV UniQueryLocaleInfo ( const LocaleObject locale_object,
244 struct UniLconv **unilconv_addr_ptr );
245int CALLCONV UniFreeLocaleInfo ( struct UniLconv *unilconv_addr );
246int CALLCONV UniQueryLocaleItem ( const LocaleObject locale_object,
247 LocaleItem item,
248 UniChar **info_item_addr_ptr );
249size_t CALLCONV UniStrftime ( const LocaleObject locale_object,
250 UniChar *ucs, size_t maxsize,
251 const UniChar *format, const struct tm *time_ptr );
252UniChar * CALLCONV UniStrptime ( const LocaleObject locale_object,
253 const UniChar *buf, const UniChar *format,
254 struct tm *time_ptr );
255int CALLCONV UniStrfmon ( const LocaleObject locale_object,
256 UniChar *ucs, size_t maxsize,
257 const UniChar *format, ... );
258UniChar * CALLCONV UniStrcat ( UniChar *ucs1, const UniChar *ucs2 );
259UniChar * CALLCONV UniStrchr ( const UniChar *ucs, UniChar uc );
260int CALLCONV UniStrcmp ( const UniChar *ucs1, const UniChar *ucs2 );
261UniChar * CALLCONV UniStrcpy ( UniChar *ucs1, const UniChar *ucs2 );
262size_t CALLCONV UniStrcspn ( const UniChar *ucs1, const UniChar *ucs2 );
263size_t CALLCONV UniStrlen ( const UniChar *ucs1 );
264UniChar * CALLCONV UniStrncat ( UniChar *ucs1, const UniChar *ucs2, size_t n );
265int CALLCONV UniStrncmp ( const UniChar *ucs1, const UniChar *ucs2, size_t n );
266UniChar * CALLCONV UniStrncpy ( UniChar *ucs1, const UniChar *ucs2, size_t n );
267UniChar * CALLCONV UniStrpbrk ( const UniChar *ucs1, const UniChar *ucs2 );
268UniChar * CALLCONV UniStrrchr ( const UniChar *ucs, UniChar uc );
269size_t CALLCONV UniStrspn ( const UniChar *ucs1, const UniChar *ucs2 );
270UniChar * CALLCONV UniStrstr ( const UniChar *ucs1, const UniChar *ucs2 );
271UniChar * CALLCONV UniStrtok ( UniChar *ucs1, const UniChar *ucs2 );
272int CALLCONV UniCreateAttrObject ( const LocaleObject locale_object,
273 const UniChar *attr_name,
274 AttrObject *attr_object_ptr );
275int CALLCONV UniQueryCharAttr ( AttrObject attr_object, UniChar uc );
276int CALLCONV UniScanForAttr ( AttrObject attr_object, const UniChar *ucs,
277 size_t num_elems, ulsBool inverse_op,
278 size_t *offset_ptr );
279int CALLCONV UniFreeAttrObject ( AttrObject attr_object );
280int CALLCONV UniQueryAlnum ( const LocaleObject locale_object, UniChar uc );
281int CALLCONV UniQueryAlpha ( const LocaleObject locale_object, UniChar uc );
282int CALLCONV UniQueryBlank ( const LocaleObject locale_object, UniChar uc );
283int CALLCONV UniQueryCntrl ( const LocaleObject locale_object, UniChar uc );
284int CALLCONV UniQueryDigit ( const LocaleObject locale_object, UniChar uc );
285int CALLCONV UniQueryGraph ( const LocaleObject locale_object, UniChar uc );
286int CALLCONV UniQueryLower ( const LocaleObject locale_object, UniChar uc );
287int CALLCONV UniQueryPrint ( const LocaleObject locale_object, UniChar uc );
288int CALLCONV UniQueryPunct ( const LocaleObject locale_object, UniChar uc );
289int CALLCONV UniQuerySpace ( const LocaleObject locale_object, UniChar uc );
290int CALLCONV UniQueryUpper ( const LocaleObject locale_object, UniChar uc );
291int CALLCONV UniQueryXdigit ( const LocaleObject locale_object, UniChar uc );
292int CALLCONV UniCreateTransformObject ( const LocaleObject locale_object,
293 const UniChar *xtype,
294 XformObject *xform_object_ptr );
295int CALLCONV UniTransformStr ( XformObject xform_object,
296 const UniChar *inp_buf, int *inp_size,
297 UniChar *out_buf, int *out_size );
298int CALLCONV UniFreeTransformObject ( XformObject xform_object );
299UniChar CALLCONV UniTransLower ( const LocaleObject locale_object, UniChar uc );
300UniChar CALLCONV UniTransUpper ( const LocaleObject locale_object, UniChar uc );
301int CALLCONV UniStrtod ( const LocaleObject locale_object, const UniChar *ucs,
302 UniChar **end_ptr, double *result_ptr );
303int CALLCONV UniStrtol ( const LocaleObject locale_object, const UniChar *ucs,
304 UniChar **end_ptr, int base, long int *result_ptr );
305int CALLCONV UniStrtoul ( const LocaleObject locale_object, const UniChar *ucs,
306 UniChar **end_ptr, int base, unsigned long int *result_ptr );
307int CALLCONV UniStrcoll ( const LocaleObject locale_object,
308 const UniChar *ucs1, const UniChar *ucs2 );
309size_t CALLCONV UniStrxfrm ( const LocaleObject locale_object,
310 UniChar *ucs1, const UniChar *ucs2, size_t n );
311int CALLCONV UniStrcmpi ( const LocaleObject locale_object,
312 const UniChar *ucs1, const UniChar *ucs2 );
313int CALLCONV UniStrncmpi ( const LocaleObject locale_object,
314 const UniChar *ucs1, const UniChar *ucs2, const size_t n );
315UniChar CALLCONV UniToupper (UniChar uc);
316UniChar CALLCONV UniTolower (UniChar uc);
317UniChar * CALLCONV UniStrupr (UniChar *ucs);
318UniChar * CALLCONV UniStrlwr (UniChar *ucs);
319int CALLCONV UniMapCtryToLocale(unsigned long Country,
320 UniChar *LocaleName,
321 size_t n);
322#ifndef _ULS_UCONVP
323#define _ULS_UCONVP
324typedef void * UconvObject;
325#endif
326#ifndef _ULS_UNICHAR_DEFINED
327#define _ULS_UNICHAR_DEFINED
328typedef unsigned short UniChar ;
329#endif
330#ifndef ULS_ATTR
331#define ULS_ATTR
332#define UCONV_OPTION_SUBSTITUTE_FROM_UNICODE 1
333#define UCONV_OPTION_SUBSTITUTE_TO_UNICODE 2
334#define UCONV_OPTION_SUBSTITUTE_BOTH 3
335#define CVTTYPE_PATH 0x00000004 /* Treat string as a path */
336#define CVTTYPE_CDRA 0x00000002 /* Use CDRA control mapping */
337#define CVTTYPE_CTRL7F 0x00000001 /* Treat 0x7F as a control */
338#define DSPMASK_DATA 0xffffffff
339#define DSPMASK_DISPLAY 0x00000000
340#define DSPMASK_TAB 0x00000200
341#define DSPMASK_LF 0x00000400
342#define DSPMASK_CR 0x00002000
343#define DSPMASK_CRLF 0x00002400
344enum 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
361};
362#ifndef __conv_endian_t
363#define __conv_endian_t
364#define ENDIAN_SYSTEM 0x0000
365#define ENDIAN_BIG 0xfeff
366#define ENDIAN_LITTLE 0xfffe
367typedef struct _conv_endian_rec {
368 unsigned short source;
369 unsigned short target;
370} conv_endian_t;
371#endif
372typedef struct _uconv_attribute_t {
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];
388} uconv_attribute_t;
389typedef struct {
390 unsigned short first;
391 unsigned short last;
392} udcrange_t;
393#endif
394#define uconv_error_t int
395int CALLCONV UniCreateUconvObject(
396 UniChar * code_set,
397 UconvObject * uobj );
398int CALLCONV UniQueryUconvObject(
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]);
405int CALLCONV UniSetUconvObject(
406 UconvObject uobj,
407 uconv_attribute_t * attr);
408int CALLCONV UniUconvToUcs(
409 UconvObject uobj,
410 void * * inbuf,
411 size_t * inbytes,
412 UniChar * * outbuf,
413 size_t * outchars,
414 size_t * subst );
415int CALLCONV UniUconvFromUcs(
416 UconvObject uobj,
417 UniChar * * inbuf,
418 size_t * inchars,
419 void * * outbuf,
420 size_t * outbytes,
421 size_t * subst );
422int CALLCONV UniFreeUconvObject(
423 UconvObject uobj );
424int CALLCONV UniMapCpToUcsCp( unsigned long ulCodePage, UniChar *ucsCodePage, size_t n );
425#define UCONV_EOTHER ULS_OTHER
426#define UCONV_EILSEQ ULS_ILLEGALSEQUENCE
427#define UCONV_EINVAL ULS_INVALID
428#define UCONV_E2BIG ULS_BUFFERFULL
429#define UCONV_ENOMEM ULS_NOMEMORY
430#define UCONV_EBADF ULS_BADOBJECT
431#define UCONV_BADATTR ULS_BADATTR
432#define UCONV_EMFILE ULS_MAXFILESPERPROC
433#define UCONV_ENFILE ULS_MAXFILES
434#define UCONV_NOTIMPLEMENTED ULS_NOTIMPLEMENTED
435#define IBM_437 (UniChar *)L"IBM-437"
436#define IBM_819 (UniChar *)L"IBM-819"
437#define IBM_850 (UniChar *)L"IBM-850"
438#define UTF_8 (UniChar *)L"IBM-1208"
439#define UCS_2 (UniChar *)L"IBM-1200"
440#define ISO8859_1 (UniChar *)L"IBM-819"
441#ifdef __cplusplus
442}
443#endif
444#endif
Note: See TracBrowser for help on using the repository browser.