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

Last change on this file since 213 was 213, checked in by zap, 22 years ago

o Added OS/2 Unicode API headers and import file.
o Modified most standard functions in .s files to use the _std_ prefix.
o Fixed c_alias.a build rules so that it uses the correct c.a file (either

debug or optimized depending on build mode).

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 7.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 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
40#define UNI_TOKEN_POINTER 1
41#define UNI_MBS_STRING_POINTER 2
42#define UNI_UCS_STRING_POINTER 3
43
44/* Locale categories */
45#undef LANG
46#undef LC_ALL
47#undef LC_COLLATE
48#undef LC_CTYPE
49#undef LC_NUMERIC
50#undef LC_MONETARY
51#undef LC_TIME
52#undef LC_MESSAGES
53
54#define LANG (-2)
55#define LC_ALL (-1)
56#define LC_COLLATE 0
57#define LC_CTYPE 1
58#define LC_NUMERIC 2
59#define LC_MONETARY 3
60#define LC_TIME 4
61#define LC_MESSAGES 5
62
63/* Locale conventions structure */
64struct UniLconv
65{
66 UniChar *decimal_point; /* non-monetary decimal point */
67 UniChar *thousands_sep; /* non-monetary thousands separator */
68 short *grouping; /* non-monetary size of grouping */
69 UniChar *int_curr_symbol; /* int'l currency symbol and separator */
70 UniChar *currency_symbol; /* local currency symbol */
71 UniChar *mon_decimal_point; /* monetary decimal point */
72 UniChar *mon_thousands_sep; /* monetary thousands separator */
73 short *mon_grouping; /* monetary size of grouping */
74 UniChar *positive_sign; /* non-negative values sign */
75 UniChar *negative_sign; /* negative values sign */
76 short int_frac_digits; /* no of fractional digits int currency */
77 short frac_digits; /* no of fractional digits loc currency */
78 short p_cs_precedes; /* nonneg curr sym 1-precedes,0-succeeds */
79 short p_sep_by_space; /* nonneg curr sym 1-space,0-no space */
80 short n_cs_precedes; /* neg curr sym 1-precedes,0-succeeds */
81 short n_sep_by_space; /* neg curr sym 1-space 0-no space */
82 short p_sign_posn; /* positioning of nonneg monetary sign */
83 short n_sign_posn; /* positioning of negative monetary sign */
84 short os2_mondecpt; /* os2 curr sym positioning */
85 UniChar *debit_sign; /* non-neg-valued monetary sym - "DB" */
86 UniChar *credit_sign; /* negative-valued monetary sym - "CR" */
87 UniChar *left_parenthesis; /* negative-valued monetary sym - "(" */
88 UniChar *right_parenthesis; /* negative-valued monetary sym - ")" */
89};
90
91/* Locale Management Function Prototypes */
92
93int UniCreateLocaleObject (int locale_spec_type, const void *locale_spec,
94 LocaleObject *locale_object_ptr);
95int UniQueryLocaleObject (const LocaleObject locale_object, int category,
96 int locale_spec_type, void **locale_spec_ptr);
97int UniFreeLocaleObject (LocaleObject locale_object);
98int UniFreeMem (void *memory_ptr);
99int UniLocaleStrToToken (int locale_string_type, const void *locale_string,
100 LocaleToken *locale_token_ptr);
101int UniLocaleTokenToStr (const LocaleToken locale_token,
102 int locale_string_type, void **locale_string_ptr);
103
104/* Locale Information Function Prototypes */
105int UniQueryLocaleInfo (const LocaleObject locale_object,
106 struct UniLconv **unilconv_addr_ptr);
107int UniFreeLocaleInfo (struct UniLconv *unilconv_addr);
108int UniQueryLocaleItem (const LocaleObject locale_object, LocaleItem item,
109 UniChar **info_item_addr_ptr);
110
111/* Date and Time Function Prototypes */
112size_t UniStrftime (const LocaleObject locale_object, UniChar *ucs,
113 size_t maxsize, const UniChar *format, const struct tm *time_ptr);
114UniChar *UniStrptime (const LocaleObject locale_object, const UniChar *buf,
115 const UniChar *format, struct tm *time_ptr);
116
117/* Monetary Formatting Function Prototype */
118int UniStrfmon (const LocaleObject locale_object, UniChar *ucs, size_t maxsize,
119 const UniChar *format, ...);
120
121/* String/Character Function Prototypes */
122UniChar *UniStrcat (UniChar *ucs1, const UniChar *ucs2);
123UniChar *UniStrchr (const UniChar *ucs, UniChar uc);
124int UniStrcmp (const UniChar *ucs1, const UniChar *ucs2);
125UniChar *UniStrcpy (UniChar *ucs1, const UniChar *ucs2);
126size_t UniStrcspn (const UniChar *ucs1, const UniChar *ucs2);
127size_t UniStrlen (const UniChar *ucs1);
128UniChar *UniStrncat (UniChar *ucs1, const UniChar *ucs2, size_t n);
129int UniStrncmp (const UniChar *ucs1, const UniChar *ucs2, size_t n);
130UniChar *UniStrncpy (UniChar *ucs1, const UniChar *ucs2, size_t n);
131UniChar *UniStrpbrk (const UniChar *ucs1, const UniChar *ucs2);
132UniChar *UniStrrchr (const UniChar *ucs, UniChar uc);
133size_t UniStrspn (const UniChar *ucs1, const UniChar *ucs2);
134UniChar *UniStrstr (const UniChar *ucs1, const UniChar *ucs2);
135UniChar *UniStrtok (UniChar *ucs1, const UniChar *ucs2);
136
137/* Character Attribute Function Prototypes */
138int UniCreateAttrObject (const LocaleObject locale_object,
139 const UniChar *attr_name, AttrObject *attr_object_ptr);
140int UniQueryCharAttr (AttrObject attr_object, UniChar uc);
141int UniScanForAttr (AttrObject attr_object, const UniChar *ucs,
142 size_t num_elems, ulsBool inverse_op, size_t *offset_ptr);
143int UniFreeAttrObject (AttrObject attr_object);
144int UniQueryAlnum (const LocaleObject locale_object, UniChar uc);
145int UniQueryAlpha (const LocaleObject locale_object, UniChar uc);
146int UniQueryBlank (const LocaleObject locale_object, UniChar uc);
147int UniQueryCntrl (const LocaleObject locale_object, UniChar uc);
148int UniQueryDigit (const LocaleObject locale_object, UniChar uc);
149int UniQueryGraph (const LocaleObject locale_object, UniChar uc);
150int UniQueryLower (const LocaleObject locale_object, UniChar uc);
151int UniQueryPrint (const LocaleObject locale_object, UniChar uc);
152int UniQueryPunct (const LocaleObject locale_object, UniChar uc);
153int UniQuerySpace (const LocaleObject locale_object, UniChar uc);
154int UniQueryUpper (const LocaleObject locale_object, UniChar uc);
155int UniQueryXdigit (const LocaleObject locale_object, UniChar uc);
156
157/* String Transformation Function Prototypes */
158int UniCreateTransformObject (const LocaleObject locale_object,
159 const UniChar *xtype, XformObject *xform_object_ptr);
160int UniTransformStr (XformObject xform_object, const UniChar *inp_buf,
161 int *inp_size, UniChar *out_buf, int *out_size);
162int UniFreeTransformObject (XformObject xform_object);
163UniChar UniTransLower (const LocaleObject locale_object, UniChar uc);
164UniChar UniTransUpper (const LocaleObject locale_object, UniChar uc);
165
166/* String Conversion Function Prototypes */
167int UniStrtod (const LocaleObject locale_object, const UniChar *ucs,
168 UniChar **end_ptr, double *result_ptr);
169int UniStrtol (const LocaleObject locale_object, const UniChar *ucs,
170 UniChar **end_ptr, int base, long int *result_ptr);
171int UniStrtoul (const LocaleObject locale_object, const UniChar *ucs,
172 UniChar **end_ptr, int base, unsigned long int *result_ptr);
173
174/* String Comparison Function Prototypes */
175int UniStrcoll (const LocaleObject locale_object,
176 const UniChar *ucs1, const UniChar *ucs2);
177size_t UniStrxfrm (const LocaleObject locale_object, UniChar *ucs1,
178 const UniChar *ucs2, size_t n);
179int UniStrcmpi (const LocaleObject locale_object,
180 const UniChar *ucs1, const UniChar *ucs2);
181int UniStrncmpi (const LocaleObject locale_object,
182 const UniChar *ucs1, const UniChar *ucs2, const size_t n);
183
184/* Unicode Case Mapping Function Prototypes */
185UniChar UniToupper (UniChar uc);
186UniChar UniTolower (UniChar uc);
187UniChar *UniStrupr (UniChar *ucs);
188UniChar *UniStrlwr (UniChar *ucs);
189
190int UniMapCtryToLocale (unsigned long Country, UniChar *LocaleName, size_t n);
191
192#ifdef __cplusplus
193}
194#endif
195
196#endif /* __UNIDEF_H__ */
Note: See TracBrowser for help on using the repository browser.