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
|
---|
17 | extern "C" {
|
---|
18 | #endif
|
---|
19 |
|
---|
20 | #include <stddef.h>
|
---|
21 | #include <time.h>
|
---|
22 |
|
---|
23 | #include <ulserrno.h>
|
---|
24 | #include <ulsitem.h>
|
---|
25 |
|
---|
26 | typedef wchar_t UniChar;
|
---|
27 | typedef void *LocaleObject;
|
---|
28 | typedef unsigned int LocaleToken;
|
---|
29 | typedef void *AttrObject;
|
---|
30 | typedef void *XformObject;
|
---|
31 | typedef 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 | /* Locale conventions structure */
|
---|
67 | struct UniLconv
|
---|
68 | {
|
---|
69 | UniChar *decimal_point; /* non-monetary decimal point */
|
---|
70 | UniChar *thousands_sep; /* non-monetary thousands separator */
|
---|
71 | short *grouping; /* non-monetary size of grouping */
|
---|
72 | UniChar *int_curr_symbol; /* int'l currency symbol and separator */
|
---|
73 | UniChar *currency_symbol; /* local currency symbol */
|
---|
74 | UniChar *mon_decimal_point; /* monetary decimal point */
|
---|
75 | UniChar *mon_thousands_sep; /* monetary thousands separator */
|
---|
76 | short *mon_grouping; /* monetary size of grouping */
|
---|
77 | UniChar *positive_sign; /* non-negative values sign */
|
---|
78 | UniChar *negative_sign; /* negative values sign */
|
---|
79 | short int_frac_digits; /* no of fractional digits int currency */
|
---|
80 | short frac_digits; /* no of fractional digits loc currency */
|
---|
81 | short p_cs_precedes; /* nonneg curr sym 1-precedes,0-succeeds */
|
---|
82 | short p_sep_by_space; /* nonneg curr sym 1-space,0-no space */
|
---|
83 | short n_cs_precedes; /* neg curr sym 1-precedes,0-succeeds */
|
---|
84 | short n_sep_by_space; /* neg curr sym 1-space 0-no space */
|
---|
85 | short p_sign_posn; /* positioning of nonneg monetary sign */
|
---|
86 | short n_sign_posn; /* positioning of negative monetary sign */
|
---|
87 | short os2_mondecpt; /* os2 curr sym positioning */
|
---|
88 | UniChar *debit_sign; /* non-neg-valued monetary sym - "DB" */
|
---|
89 | UniChar *credit_sign; /* negative-valued monetary sym - "CR" */
|
---|
90 | UniChar *left_parenthesis; /* negative-valued monetary sym - "(" */
|
---|
91 | UniChar *right_parenthesis; /* negative-valued monetary sym - ")" */
|
---|
92 | };
|
---|
93 |
|
---|
94 | /* Locale Management Function Prototypes */
|
---|
95 |
|
---|
96 | int APIENTRY UniCreateLocaleObject (int locale_spec_type, const void *locale_spec,
|
---|
97 | LocaleObject *locale_object_ptr);
|
---|
98 | int APIENTRY UniQueryLocaleObject (const LocaleObject locale_object, int category,
|
---|
99 | int locale_spec_type, void **locale_spec_ptr);
|
---|
100 | int APIENTRY UniFreeLocaleObject (LocaleObject locale_object);
|
---|
101 | int APIENTRY UniFreeMem (void *memory_ptr);
|
---|
102 | int APIENTRY UniLocaleStrToToken (int locale_string_type, const void *locale_string,
|
---|
103 | LocaleToken *locale_token_ptr);
|
---|
104 | int APIENTRY UniLocaleTokenToStr (const LocaleToken locale_token,
|
---|
105 | int locale_string_type, void **locale_string_ptr);
|
---|
106 |
|
---|
107 | /* Locale Information Function Prototypes */
|
---|
108 | int APIENTRY UniQueryLocaleInfo (const LocaleObject locale_object,
|
---|
109 | struct UniLconv **unilconv_addr_ptr);
|
---|
110 | int APIENTRY UniFreeLocaleInfo (struct UniLconv *unilconv_addr);
|
---|
111 | int APIENTRY UniQueryLocaleItem (const LocaleObject locale_object, LocaleItem item,
|
---|
112 | UniChar **info_item_addr_ptr);
|
---|
113 |
|
---|
114 | /* Date and Time Function Prototypes */
|
---|
115 | size_t APIENTRY UniStrftime (const LocaleObject locale_object, UniChar *ucs,
|
---|
116 | size_t maxsize, const UniChar *format, const struct tm *time_ptr);
|
---|
117 | UniChar *APIENTRY UniStrptime (const LocaleObject locale_object, const UniChar *buf,
|
---|
118 | const UniChar *format, struct tm *time_ptr);
|
---|
119 |
|
---|
120 | /* Monetary Formatting Function Prototype */
|
---|
121 | int APIENTRY UniStrfmon (const LocaleObject locale_object, UniChar *ucs, size_t maxsize,
|
---|
122 | const UniChar *format, ...);
|
---|
123 |
|
---|
124 | /* String/Character Function Prototypes */
|
---|
125 | UniChar *APIENTRY UniStrcat (UniChar *ucs1, const UniChar *ucs2);
|
---|
126 | UniChar *APIENTRY UniStrchr (const UniChar *ucs, UniChar uc);
|
---|
127 | int APIENTRY UniStrcmp (const UniChar *ucs1, const UniChar *ucs2);
|
---|
128 | UniChar *APIENTRY UniStrcpy (UniChar *ucs1, const UniChar *ucs2);
|
---|
129 | size_t APIENTRY UniStrcspn (const UniChar *ucs1, const UniChar *ucs2);
|
---|
130 | size_t APIENTRY UniStrlen (const UniChar *ucs1);
|
---|
131 | UniChar *APIENTRY UniStrncat (UniChar *ucs1, const UniChar *ucs2, size_t n);
|
---|
132 | int APIENTRY UniStrncmp (const UniChar *ucs1, const UniChar *ucs2, size_t n);
|
---|
133 | UniChar *APIENTRY UniStrncpy (UniChar *ucs1, const UniChar *ucs2, size_t n);
|
---|
134 | UniChar *APIENTRY UniStrpbrk (const UniChar *ucs1, const UniChar *ucs2);
|
---|
135 | UniChar *APIENTRY UniStrrchr (const UniChar *ucs, UniChar uc);
|
---|
136 | size_t APIENTRY UniStrspn (const UniChar *ucs1, const UniChar *ucs2);
|
---|
137 | UniChar *APIENTRY UniStrstr (const UniChar *ucs1, const UniChar *ucs2);
|
---|
138 | UniChar *APIENTRY UniStrtok (UniChar *ucs1, const UniChar *ucs2);
|
---|
139 |
|
---|
140 | /* Character Attribute Function Prototypes */
|
---|
141 | int APIENTRY UniCreateAttrObject (const LocaleObject locale_object,
|
---|
142 | const UniChar *attr_name, AttrObject *attr_object_ptr);
|
---|
143 | int APIENTRY UniQueryCharAttr (AttrObject attr_object, UniChar uc);
|
---|
144 | int APIENTRY UniScanForAttr (AttrObject attr_object, const UniChar *ucs,
|
---|
145 | size_t num_elems, ulsBool inverse_op, size_t *offset_ptr);
|
---|
146 | int APIENTRY UniFreeAttrObject (AttrObject attr_object);
|
---|
147 | int APIENTRY UniQueryAlnum (const LocaleObject locale_object, UniChar uc);
|
---|
148 | int APIENTRY UniQueryAlpha (const LocaleObject locale_object, UniChar uc);
|
---|
149 | int APIENTRY UniQueryBlank (const LocaleObject locale_object, UniChar uc);
|
---|
150 | int APIENTRY UniQueryCntrl (const LocaleObject locale_object, UniChar uc);
|
---|
151 | int APIENTRY UniQueryDigit (const LocaleObject locale_object, UniChar uc);
|
---|
152 | int APIENTRY UniQueryGraph (const LocaleObject locale_object, UniChar uc);
|
---|
153 | int APIENTRY UniQueryLower (const LocaleObject locale_object, UniChar uc);
|
---|
154 | int APIENTRY UniQueryPrint (const LocaleObject locale_object, UniChar uc);
|
---|
155 | int APIENTRY UniQueryPunct (const LocaleObject locale_object, UniChar uc);
|
---|
156 | int APIENTRY UniQuerySpace (const LocaleObject locale_object, UniChar uc);
|
---|
157 | int APIENTRY UniQueryUpper (const LocaleObject locale_object, UniChar uc);
|
---|
158 | int APIENTRY UniQueryXdigit (const LocaleObject locale_object, UniChar uc);
|
---|
159 |
|
---|
160 | /* String Transformation Function Prototypes */
|
---|
161 | int APIENTRY UniCreateTransformObject (const LocaleObject locale_object,
|
---|
162 | const UniChar *xtype, XformObject *xform_object_ptr);
|
---|
163 | int APIENTRY UniTransformStr (XformObject xform_object, const UniChar *inp_buf,
|
---|
164 | int *inp_size, UniChar *out_buf, int *out_size);
|
---|
165 | int APIENTRY UniFreeTransformObject (XformObject xform_object);
|
---|
166 | UniChar APIENTRY UniTransLower (const LocaleObject locale_object, UniChar uc);
|
---|
167 | UniChar APIENTRY UniTransUpper (const LocaleObject locale_object, UniChar uc);
|
---|
168 |
|
---|
169 | /* String Conversion Function Prototypes */
|
---|
170 | int APIENTRY UniStrtod (const LocaleObject locale_object, const UniChar *ucs,
|
---|
171 | UniChar **end_ptr, double *result_ptr);
|
---|
172 | int APIENTRY UniStrtol (const LocaleObject locale_object, const UniChar *ucs,
|
---|
173 | UniChar **end_ptr, int base, long int *result_ptr);
|
---|
174 | int APIENTRY UniStrtoul (const LocaleObject locale_object, const UniChar *ucs,
|
---|
175 | UniChar **end_ptr, int base, unsigned long int *result_ptr);
|
---|
176 |
|
---|
177 | /* String Comparison Function Prototypes */
|
---|
178 | int APIENTRY UniStrcoll (const LocaleObject locale_object,
|
---|
179 | const UniChar *ucs1, const UniChar *ucs2);
|
---|
180 | size_t APIENTRY UniStrxfrm (const LocaleObject locale_object, UniChar *ucs1,
|
---|
181 | const UniChar *ucs2, size_t n);
|
---|
182 | int APIENTRY UniStrcmpi (const LocaleObject locale_object,
|
---|
183 | const UniChar *ucs1, const UniChar *ucs2);
|
---|
184 | int APIENTRY UniStrncmpi (const LocaleObject locale_object,
|
---|
185 | const UniChar *ucs1, const UniChar *ucs2, const size_t n);
|
---|
186 |
|
---|
187 | /* Unicode Case Mapping Function Prototypes */
|
---|
188 | UniChar APIENTRY UniToupper (UniChar uc);
|
---|
189 | UniChar APIENTRY UniTolower (UniChar uc);
|
---|
190 | UniChar *APIENTRY UniStrupr (UniChar *ucs);
|
---|
191 | UniChar *APIENTRY UniStrlwr (UniChar *ucs);
|
---|
192 |
|
---|
193 | int APIENTRY UniMapCtryToLocale (unsigned long Country, UniChar *LocaleName, size_t n);
|
---|
194 |
|
---|
195 | #ifdef __cplusplus
|
---|
196 | }
|
---|
197 | #endif
|
---|
198 |
|
---|
199 | #endif /* __UNIDEF_H__ */
|
---|