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

Last change on this file since 512 was 419, checked in by bird, 22 years ago

#562: Added missing C*_* defines.

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