source: trunk/src/emx/include/unidef.h@ 1506

Last change on this file since 1506 was 1506, checked in by bird, 21 years ago

@unixroot. header reviews. ++

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