source: trunk/include/uniconv.h@ 175

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

Added CVS tag to many files (comctl32 and headers) .

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