source: branches/libc-0.6/src/emx/include/unidef.h

Last change on this file was 2822, checked in by bird, 19 years ago

#128: UNI_SYSTEM_LOCALES, UNI_USER_LOCALES, ULS_LNAMEMAX, and N_LC_CATEGORIES are missing from unidef.h.

  • Property cvs2svn:cvs-rev set to 1.9
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 15.8 KB
Line 
1/*
2 * Legalesy-free Unicode API interface for OS/2
3 * Interface definitions for basic Unicode API functions
4 *
5 * Written by Andrew Zabolotny <bit@eltech.ru>
6 *
7 * This file is put into public domain. You are free to do
8 * literally anything you wish with it: modify, print, sell,
9 * rent, eat, throw out of window: in all (esp. in later)
10 * cases I am not responsible for any damage it causes.
11 */
12
13#ifndef __UNIDEF_H__
14#define __UNIDEF_H__
15
16#include <sys/cdefs.h>
17#include <stddef.h>
18#include <time.h>
19
20#include <ulserrno.h>
21#include <ulsitem.h>
22
23typedef unsigned short UniChar;
24typedef void *LocaleObject;
25typedef unsigned int LocaleToken;
26typedef void *AttrObject;
27typedef void *XformObject;
28typedef int ulsBool;
29
30#ifndef TRUE
31# define TRUE 1
32#endif
33#ifndef FALSE
34# define FALSE 0
35#endif
36#ifndef APIENTRY
37# ifdef _System
38# define APIENTRY _System
39# else
40# define APIENTRY
41# endif
42#endif
43
44#define UNI_TOKEN_POINTER 1
45#define UNI_MBS_STRING_POINTER 2
46#define UNI_UCS_STRING_POINTER 3
47
48/* Locale types */
49#define UNI_SYSTEM_LOCALES 1
50#define UNI_USER_LOCALES 2
51
52/* Max length of a locale name null included. */
53#define ULS_LNAMEMAX 32
54
55/* Locale categories */
56#undef LANG
57#undef LC_ALL
58#undef LC_COLLATE
59#undef LC_CTYPE
60#undef LC_NUMERIC
61#undef LC_MONETARY
62#undef LC_TIME
63#undef LC_MESSAGES
64
65#define LANG (-2)
66#define LC_ALL (-1)
67#define LC_COLLATE 0
68#define LC_CTYPE 1
69#define LC_NUMERIC 2
70#define LC_MONETARY 3
71#define LC_TIME 4
72#define LC_MESSAGES 5
73/* Number of locale categories. */
74#define N_LC_CATEGORIES 6
75
76
77/** @group Character Type Consts (itype)
78 * @{ */
79#define CT_UPPER 0x0001 /** Upper case. */
80#define CT_LOWER 0x0002 /** Lower case. */
81#define CT_DIGIT 0x0004 /** Digits (0-9). */
82#define CT_SPACE 0x0008 /** White space and line ends. */
83#define CT_PUNCT 0x0010 /** Punctuation marks. */
84#define CT_CNTRL 0x0020 /** Control and format characters. */
85#define CT_BLANK 0x0040 /** Space and tab. */
86#define CT_XDIGIT 0x0080 /** Hex digits. */
87#define CT_ALPHA 0x0100 /** Any linguistic character. */
88#define CT_ALNUM 0x0200 /** Alphanumeric. */
89#define CT_GRAPH 0x0400 /** All except controls and space. */
90#define CT_PRINT 0x0800 /** Everything except controls. */
91#define CT_NUMBER 0x1000 /** Integral number. */
92#define CT_SYMBOL 0x2000 /** Symbol. */
93#define CT_ASCII 0x8000 /** In standard ASCII set. */
94/** @} */
95
96
97/** @group CType 1 Flag Bits.
98 * @{ */
99#define C1_ALPHA CT_ALPHA /** Any linguistic character. */
100#define C1_BLANK CT_BLANK /** Blank characters. */
101#define C1_CNTRL CT_CNTRL /** Control characters. */
102#define C1_DIGIT CT_DIGIT /** Decimal digits. */
103#define C1_LOWER CT_LOWER /** Lower case. */
104#define C1_PUNCT CT_PUNCT /** Punctuation characters. */
105#define C1_SPACE CT_SPACE /** Spacing characters. */
106#define C1_UPPER CT_UPPER /** Upper case. */
107#define C1_XDIGIT CT_XDIGIT /** Hex digits. */
108/** @} */
109
110
111/** @group CType 2 Flag Bits. (bidi)
112 * @{ */
113#define C2_NOTAPPLICABLE 0x00 /** NA - Not a character. */
114#define C2_LEFTTORIGHT 0x01 /** L - Left to Right. */
115#define C2_RIGHTTOLEFT 0x02 /** R - Right to Left. */
116#define C2_EUROPENUMBER 0x03 /** EN - European number. */
117#define C2_EUROPESEPARATOR 0x04 /** ES - European separator. */
118#define C2_EUROPETERMINATOR 0x05 /** ET - European terminator. */
119#define C2_ARABICNUMBER 0x06 /** AN - Arabic number. */
120#define C2_COMMONSEPARATOR 0x07 /** CS - Common separator. */
121#define C2_BLOCKSEPARATOR 0x08 /** B - Block separator. */
122#define C2_WHITESPACE 0x0a /** WS - Whitespace. */
123#define C2_OTHERNEUTRAL 0x0b /** ON - Other neutral. */
124#define C2_MIRRORED 0x0c /** M - Symetrical (not Win32). */
125/** @} */
126
127
128/** @group CType 3 Flag Bits.
129 * @{ */
130#define C3_NONSPACING 0x0001 /** Nonspacing mark. */
131#define C3_DIACRITIC 0x0002 /** Diacritic mark. */
132#define C3_NSDIACRITIC 0x0003
133#define C3_VOWELMARK 0x0004 /** Vowel mark. */
134#define C3_NSVOWEL 0x0005
135#define C3_SYMBOL 0x0008 /** Symbol (see CT_SYMBOL). */
136#define C3_KATAKANA 0x0010 /** Katakana character (jap). */
137#define C3_HIRAGANA 0x0020 /** Hiragana character (jap). */
138#define C3_HALFWIDTH 0x0040 /** Half-width varient. */
139#define C3_FULLWIDTH 0x0080 /** Full-width varient. */
140#define C3_IDEOGRAPH 0x0100 /** Kanji/Han character (asian). */
141#define C3_KASHIDA 0x0200 /** Arabic enlonger. */
142#define C3_ALPHA 0x8000 /** Alphabetic. */
143#define C3_MASK 0x83FF /** Mask for Win32 bits. */
144/** @} */
145
146
147/** @group Character Set Values. (charset)
148 * Linguistic groups and subtypes.
149 * @{ */
150#define CHS_NONCHAR 0x00000000
151#define CHS_OTHER 0x00000001
152#define CHS_LATIN 0x00000002
153#define CHS_CYRILLIC 0x00000003
154#define CHS_ARABIC 0x00000004
155#define CHS_GREEK 0x00000005
156#define CHS_HEBREW 0x00000006
157#define CHS_THAI 0x00000007
158#define CHS_KATAKANA 0x00000008
159#define CHS_HIRAGANA 0x00000009
160#define CHS_HANGUEL 0x0000000a
161#define CHS_BOPOMOFO 0x0000000b
162#define CHS_DEVANAGARI 0x0000000c
163#define CHS_TELUGU 0x0000000d
164#define CHS_BENGALI 0x0000000e
165#define CHS_GUJARATI 0x0000000f
166#define CHS_GURMUKHI 0x00000010
167#define CHS_TAMIL 0x00000011
168#define CHS_LAO 0x00000012
169/* .. */
170#define CHS_PUNCTSTART 0x00000020
171#define CHS_PUNCTEND 0x00000021
172#define CHS_DINGBAT 0x00000022
173#define CHS_MATH 0x00000023
174#define CHS_APL 0x00000024
175#define CHS_ARROW 0x00000025
176#define CHS_BOX 0x00000026
177#define CHS_DASH 0x00000027
178#define CHS_CURRENCY 0x00000028
179#define CHS_FRACTION 0x00000029
180#define CHS_LINESEP 0x0000002a
181#define CHS_USERDEF 0x0000002b
182/** @} */
183
184
185/** @group UGL Codepage Consts. (codepage)
186 * @{ */
187#define CCP_437 0x01 /** US PC. */
188#define CCP_850 0x02 /** Multilingual PC. */
189#define CCP_SYMB 0x04 /** PostScript Symbol. */
190#define CCP_1252 0x08 /** Windows Latin 1. */
191#define CCP_1250 0x10 /** Windows Latin 2. */
192#define CCP_1251 0x20 /** Windows Cyrillic. */
193#define CCP_1254 0x40 /** Windows Turkish. */
194#define CCP_1257 0x80 /** Windows Baltic. */
195/** @} */
196
197
198/** @group Character Type (kind/UniQueryStringType)
199 * @{ */
200#define CT_ITYPE 0x0001
201#define CT_BIDI 0x0002
202#define CT_CHARSET 0x0003
203#define CT_EXTENDED 0x0004
204#define CT_CODEPAGE 0x0005
205#define CT_INDEX 0x0006
206#define CT_CTYPE1 0x0007 /** C1_* - Win32 compat xpg4. */
207#define CT_CTYPE2 0x0008 /** C2_* - Win32 compat bidi. */
208#define CT_CTYPE3 0x0009 /** C3_* - Win32 compat extended. */
209/** @} */
210
211
212/** Locale conventions structure */
213typedef struct UniLconv
214{
215 UniChar *decimal_point; /* non-monetary decimal point */
216 UniChar *thousands_sep; /* non-monetary thousands separator */
217 short *grouping; /* non-monetary size of grouping */
218 UniChar *int_curr_symbol; /* int'l currency symbol and separator */
219 UniChar *currency_symbol; /* local currency symbol */
220 UniChar *mon_decimal_point; /* monetary decimal point */
221 UniChar *mon_thousands_sep; /* monetary thousands separator */
222 short *mon_grouping; /* monetary size of grouping */
223 UniChar *positive_sign; /* non-negative values sign */
224 UniChar *negative_sign; /* negative values sign */
225 short int_frac_digits; /* no of fractional digits int currency */
226 short frac_digits; /* no of fractional digits loc currency */
227 short p_cs_precedes; /* nonneg curr sym 1-precedes,0-succeeds */
228 short p_sep_by_space; /* nonneg curr sym 1-space,0-no space */
229 short n_cs_precedes; /* neg curr sym 1-precedes,0-succeeds */
230 short n_sep_by_space; /* neg curr sym 1-space 0-no space */
231 short p_sign_posn; /* positioning of nonneg monetary sign */
232 short n_sign_posn; /* positioning of negative monetary sign */
233 short os2_mondecpt; /* os2 curr sym positioning */
234 UniChar *debit_sign; /* non-neg-valued monetary sym - "DB" */
235 UniChar *credit_sign; /* negative-valued monetary sym - "CR" */
236 UniChar *left_parenthesis; /* negative-valued monetary sym - "(" */
237 UniChar *right_parenthesis; /* negative-valued monetary sym - ")" */
238} UNILCONV;
239
240
241/** Char/String Type (QueryCharType and UniQueryStringType). */
242typedef struct UniCType {
243 unsigned short itype; /** XPG/4 type attributes (C1_*). */
244 unsigned char bidi; /** BiDi type attributes (C2_*). */
245 unsigned char charset; /** Character set (CHS_*). */
246 unsigned short extend; /** Win32 Extended attributes (C3_*). */
247 unsigned short codepage; /** Codepage bits. (CCP_*) */
248} UNICTYPE;
249
250
251__BEGIN_DECLS
252/* Locale Management Function Prototypes */
253int APIENTRY UniCreateLocaleObject (int locale_spec_type, const void *locale_spec,
254 LocaleObject *locale_object_ptr);
255int APIENTRY UniQueryLocaleObject (const LocaleObject locale_object, int category,
256 int locale_spec_type, void **locale_spec_ptr);
257int APIENTRY UniFreeLocaleObject (LocaleObject locale_object);
258int APIENTRY UniFreeMem (void *memory_ptr);
259int APIENTRY UniLocaleStrToToken (int locale_string_type, const void *locale_string,
260 LocaleToken *locale_token_ptr);
261int APIENTRY UniLocaleTokenToStr (const LocaleToken locale_token,
262 int locale_string_type, void **locale_string_ptr);
263
264/* Locale Information Function Prototypes */
265int APIENTRY UniQueryLocaleInfo (const LocaleObject locale_object,
266 struct UniLconv **unilconv_addr_ptr);
267int APIENTRY UniFreeLocaleInfo (struct UniLconv *unilconv_addr);
268int APIENTRY UniQueryLocaleItem (const LocaleObject locale_object, LocaleItem item,
269 UniChar **info_item_addr_ptr);
270int APIENTRY UniQueryLocaleValue (const LocaleObject locale_object, LocaleItem item, int *info_item);
271
272/* Date and Time Function Prototypes */
273size_t APIENTRY UniStrftime (const LocaleObject locale_object, UniChar *ucs,
274 size_t maxsize, const UniChar *format, const struct tm *time_ptr);
275UniChar *APIENTRY UniStrptime (const LocaleObject locale_object, const UniChar *buf,
276 const UniChar *format, struct tm *time_ptr);
277
278/* Monetary Formatting Function Prototype */
279int APIENTRY UniStrfmon (const LocaleObject locale_object, UniChar *ucs, size_t maxsize,
280 const UniChar *format, ...);
281
282/* String/Character Function Prototypes */
283UniChar *APIENTRY UniStrcat (UniChar *ucs1, const UniChar *ucs2);
284UniChar *APIENTRY UniStrchr (const UniChar *ucs, UniChar uc);
285int APIENTRY UniStrcmp (const UniChar *ucs1, const UniChar *ucs2);
286UniChar *APIENTRY UniStrcpy (UniChar *ucs1, const UniChar *ucs2);
287size_t APIENTRY UniStrcspn (const UniChar *ucs1, const UniChar *ucs2);
288size_t APIENTRY UniStrlen (const UniChar *ucs1);
289UniChar *APIENTRY UniStrncat (UniChar *ucs1, const UniChar *ucs2, size_t n);
290int APIENTRY UniStrncmp (const UniChar *ucs1, const UniChar *ucs2, size_t n);
291UniChar *APIENTRY UniStrncpy (UniChar *ucs1, const UniChar *ucs2, size_t n);
292UniChar *APIENTRY UniStrpbrk (const UniChar *ucs1, const UniChar *ucs2);
293UniChar *APIENTRY UniStrrchr (const UniChar *ucs, UniChar uc);
294size_t APIENTRY UniStrspn (const UniChar *ucs1, const UniChar *ucs2);
295UniChar *APIENTRY UniStrstr (const UniChar *ucs1, const UniChar *ucs2);
296UniChar *APIENTRY UniStrtok (UniChar *ucs1, const UniChar *ucs2);
297
298/* Character Attribute Function Prototypes */
299int APIENTRY UniCreateAttrObject (const LocaleObject locale_object,
300 const UniChar *attr_name, AttrObject *attr_object_ptr);
301int APIENTRY UniQueryCharAttr (AttrObject attr_object, UniChar uc);
302int APIENTRY UniScanForAttr (AttrObject attr_object, const UniChar *ucs,
303 size_t num_elems, ulsBool inverse_op, size_t *offset_ptr);
304int APIENTRY UniFreeAttrObject (AttrObject attr_object);
305int APIENTRY UniQueryAlnum (const LocaleObject locale_object, UniChar uc);
306int APIENTRY UniQueryAlpha (const LocaleObject locale_object, UniChar uc);
307int APIENTRY UniQueryBlank (const LocaleObject locale_object, UniChar uc);
308int APIENTRY UniQueryCntrl (const LocaleObject locale_object, UniChar uc);
309int APIENTRY UniQueryDigit (const LocaleObject locale_object, UniChar uc);
310int APIENTRY UniQueryGraph (const LocaleObject locale_object, UniChar uc);
311int APIENTRY UniQueryLower (const LocaleObject locale_object, UniChar uc);
312int APIENTRY UniQueryPrint (const LocaleObject locale_object, UniChar uc);
313int APIENTRY UniQueryPunct (const LocaleObject locale_object, UniChar uc);
314int APIENTRY UniQuerySpace (const LocaleObject locale_object, UniChar uc);
315int APIENTRY UniQueryUpper (const LocaleObject locale_object, UniChar uc);
316int APIENTRY UniQueryXdigit (const LocaleObject locale_object, UniChar uc);
317
318/* String Transformation Function Prototypes */
319int APIENTRY UniCreateTransformObject (const LocaleObject locale_object,
320 const UniChar *xtype, XformObject *xform_object_ptr);
321int APIENTRY UniTransformStr (XformObject xform_object, const UniChar *inp_buf,
322 int *inp_size, UniChar *out_buf, int *out_size);
323int APIENTRY UniFreeTransformObject (XformObject xform_object);
324UniChar APIENTRY UniTransLower (const LocaleObject locale_object, UniChar uc);
325UniChar APIENTRY UniTransUpper (const LocaleObject locale_object, UniChar uc);
326
327/* String Conversion Function Prototypes */
328int APIENTRY UniStrtod (const LocaleObject locale_object, const UniChar *ucs,
329 UniChar **end_ptr, double *result_ptr);
330int APIENTRY UniStrtol (const LocaleObject locale_object, const UniChar *ucs,
331 UniChar **end_ptr, int base, long int *result_ptr);
332int APIENTRY UniStrtoul (const LocaleObject locale_object, const UniChar *ucs,
333 UniChar **end_ptr, int base, unsigned long int *result_ptr);
334
335/* String Comparison Function Prototypes */
336int APIENTRY UniStrcoll (const LocaleObject locale_object,
337 const UniChar *ucs1, const UniChar *ucs2);
338size_t APIENTRY UniStrxfrm (const LocaleObject locale_object, UniChar *ucs1,
339 const UniChar *ucs2, size_t n);
340int APIENTRY UniStrcmpi (const LocaleObject locale_object,
341 const UniChar *ucs1, const UniChar *ucs2);
342int APIENTRY UniStrncmpi (const LocaleObject locale_object,
343 const UniChar *ucs1, const UniChar *ucs2, const size_t n);
344
345/* Unicode Case Mapping Function Prototypes */
346UniChar APIENTRY UniToupper (UniChar uc);
347UniChar APIENTRY UniTolower (UniChar uc);
348UniChar *APIENTRY UniStrupr (UniChar *ucs);
349UniChar *APIENTRY UniStrlwr (UniChar *ucs);
350
351int APIENTRY UniMapCtryToLocale (unsigned long Country, UniChar *LocaleName, size_t n);
352
353/* Locale independent character classification. */
354int APIENTRY UniQueryChar (UniChar uc, unsigned long attr);
355unsigned long APIENTRY UniQueryAttr (UniChar * name);
356unsigned long APIENTRY UniQueryStringType (UniChar * ustr, int size, unsigned short *outstr, int kind);
357struct UniCType*APIENTRY UniQueryCharType (UniChar uchr);
358unsigned long APIENTRY UniQueryCharTypeTable (unsigned long * count, struct UniCType **unictype);
359int APIENTRY UniQueryNumericValue (UniChar uc);
360
361/* Functions for user locals designed to be used by WPShell (local object). */
362int APIENTRY UniSetUserLocaleItem (UniChar * locale, int item, int type, void * value);
363int APIENTRY UniMakeUserLocale (UniChar * name, UniChar * basename);
364int APIENTRY UniDeleteUserLocale (UniChar * locale);
365int APIENTRY UniCompleteUserLocale (void);
366int APIENTRY UniQueryLocaleList (int, UniChar *, int);
367int APIENTRY UniQueryLanguageName (UniChar *lang, UniChar *isolang, UniChar **infoitem);
368int APIENTRY UniQueryCountryName (UniChar *country, UniChar *isolang, UniChar **infoitem);
369
370__END_DECLS
371
372#endif /* __UNIDEF_H__ */
Note: See TracBrowser for help on using the repository browser.