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

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

UniQueryLocaleValue().

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