msctf: Maintain context reference in ranges.
[wine.git] / dlls / msvcp60 / msvcp.h
blob2507d9123d920bc164e9bfc8bebeef7e661c20fd
1 /*
2 * Copyright 2010 Piotr Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "stdbool.h"
20 #include "stdlib.h"
21 #include "windef.h"
22 #include "cxx.h"
24 #define ALIGNED_SIZE(size, alignment) (((size)+((alignment)-1))/(alignment)*(alignment))
26 typedef SSIZE_T streamoff;
27 typedef SSIZE_T streamsize;
28 #define STREAMOFF_BITS 32
29 #define STREAMSIZE_BITS 32
31 void __cdecl _invalid_parameter(const wchar_t*, const wchar_t*,
32 const wchar_t*, unsigned int, uintptr_t);
33 BOOL __cdecl __uncaught_exception(void);
35 extern void* (__cdecl *MSVCRT_operator_new)(size_t);
36 extern void (__cdecl *MSVCRT_operator_delete)(void*);
38 /* basic_string<char, char_traits<char>, allocator<char>> */
39 typedef struct
41 void *allocator;
42 char *ptr;
43 size_t size;
44 size_t res;
45 } basic_string_char;
47 basic_string_char* __thiscall MSVCP_basic_string_char_ctor(basic_string_char*);
48 basic_string_char* __thiscall MSVCP_basic_string_char_ctor_cstr(basic_string_char*, const char*);
49 basic_string_char* __thiscall MSVCP_basic_string_char_ctor_cstr_len(basic_string_char*, const char*, size_t);
50 basic_string_char* __thiscall MSVCP_basic_string_char_copy_ctor(basic_string_char*, const basic_string_char*);
51 void __thiscall MSVCP_basic_string_char_dtor(basic_string_char*);
52 const char* __thiscall MSVCP_basic_string_char_c_str(const basic_string_char*);
53 void __thiscall MSVCP_basic_string_char_clear(basic_string_char*);
54 basic_string_char* __thiscall MSVCP_basic_string_char_append_ch(basic_string_char*, char);
55 size_t __thiscall MSVCP_basic_string_char_length(const basic_string_char*);
56 basic_string_char* __thiscall MSVCP_basic_string_char_append_len_ch(basic_string_char*, size_t, char);
57 basic_string_char* __thiscall MSVCP_basic_string_char_assign(basic_string_char*, const basic_string_char*);
59 typedef struct
61 void *allocator;
62 wchar_t *ptr;
63 size_t size;
64 size_t res;
65 } basic_string_wchar;
67 basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor(basic_string_wchar*);
68 basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor_cstr(basic_string_wchar*, const wchar_t*);
69 basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor_cstr_len(basic_string_wchar*, const wchar_t*, size_t);
70 void __thiscall MSVCP_basic_string_wchar_dtor(basic_string_wchar*);
71 const wchar_t* __thiscall MSVCP_basic_string_wchar_c_str(const basic_string_wchar*);
72 void __thiscall MSVCP_basic_string_wchar_clear(basic_string_wchar*);
73 basic_string_wchar* __thiscall MSVCP_basic_string_wchar_append_ch(basic_string_wchar*, wchar_t);
74 size_t __thiscall MSVCP_basic_string_wchar_length(const basic_string_wchar*);
76 char* __thiscall MSVCP_allocator_char_allocate(void*, size_t);
77 void __thiscall MSVCP_allocator_char_deallocate(void*, char*, size_t);
78 size_t __thiscall MSVCP_allocator_char_max_size(const void*);
79 wchar_t* __thiscall MSVCP_allocator_wchar_allocate(void*, size_t);
80 void __thiscall MSVCP_allocator_wchar_deallocate(void*, wchar_t*, size_t);
81 size_t __thiscall MSVCP_allocator_wchar_max_size(const void*);
83 /* class locale::facet */
84 typedef struct {
85 const vtable_ptr *vtable;
86 size_t refs;
87 } locale_facet;
89 typedef enum {
90 CODECVT_ok = 0,
91 CODECVT_partial = 1,
92 CODECVT_error = 2,
93 CODECVT_noconv = 3
94 } codecvt_base_result;
96 typedef struct {
97 LCID handle;
98 unsigned page;
99 const short *table;
100 int delfl;
101 } _Ctypevec;
103 /* class codecvt_base */
104 typedef struct {
105 locale_facet facet;
106 } codecvt_base;
108 /* class codecvt<char> */
109 typedef struct {
110 codecvt_base base;
111 } codecvt_char;
113 bool __thiscall codecvt_base_always_noconv(const codecvt_base*);
114 int __thiscall codecvt_char_unshift(const codecvt_char*, int*, char*, char*, char**);
115 int __thiscall codecvt_char_out(const codecvt_char*, int*, const char*,
116 const char*, const char**, char*, char*, char**);
117 int __thiscall codecvt_char_in(const codecvt_char*, int*, const char*,
118 const char*, const char**, char*, char*, char**);
119 int __thiscall codecvt_base_max_length(const codecvt_base*);
121 typedef struct {
122 LCID handle;
123 unsigned page;
124 } _Cvtvec;
126 /* class codecvt<wchar> */
127 typedef struct {
128 codecvt_base base;
129 _Cvtvec cvt;
130 } codecvt_wchar;
132 int __thiscall codecvt_wchar_unshift(const codecvt_wchar*, int*, char*, char*, char**);
133 int __thiscall codecvt_wchar_out(const codecvt_wchar*, int*, const wchar_t*,
134 const wchar_t*, const wchar_t**, char*, char*, char**);
135 int __thiscall codecvt_wchar_in(const codecvt_wchar*, int*, const char*,
136 const char*, const char**, wchar_t*, wchar_t*, wchar_t**);
138 /* class ctype_base */
139 typedef struct {
140 locale_facet facet;
141 } ctype_base;
143 /* class ctype<char> */
144 typedef struct {
145 ctype_base base;
146 _Ctypevec ctype;
147 } ctype_char;
149 bool __thiscall ctype_char_is_ch(const ctype_char*, short, char);
150 char __thiscall ctype_char_narrow_ch(const ctype_char*, char, char);
151 char __thiscall ctype_char_widen_ch(const ctype_char*, char);
153 /* class ctype<wchar> */
154 typedef struct {
155 ctype_base base;
156 _Ctypevec ctype;
157 _Cvtvec cvt;
158 } ctype_wchar;
160 bool __thiscall ctype_wchar_is_ch(const ctype_wchar*, short, wchar_t);
161 char __thiscall ctype_wchar_narrow_ch(const ctype_wchar*, wchar_t, char);
162 wchar_t __thiscall ctype_wchar_widen_ch(const ctype_wchar*, char);
164 /* class locale */
165 typedef struct
167 struct _locale__Locimp *ptr;
168 } locale;
170 locale* __thiscall locale_ctor(locale*);
171 locale* __thiscall locale_copy_ctor(locale*, const locale*);
172 locale* __thiscall locale_ctor_uninitialized(locale *, int);
173 locale* __thiscall locale_operator_assign(locale*, const locale*);
174 void __thiscall locale_dtor(locale*);
175 void free_locale(void);
176 locale* __thiscall locale__Addfac(locale*, locale_facet*, size_t, size_t);
177 codecvt_char* codecvt_char_use_facet(const locale*);
178 codecvt_wchar* codecvt_wchar_use_facet(const locale*);
179 codecvt_wchar* codecvt_short_use_facet(const locale*);
180 ctype_char* ctype_char_use_facet(const locale*);
181 ctype_wchar* ctype_wchar_use_facet(const locale*);
182 ctype_wchar* ctype_short_use_facet(const locale*);
184 typedef struct {
185 size_t id;
186 } locale_id;
187 extern locale_id codecvt_char_id;
188 extern locale_id codecvt_short_id;
190 /* class _Init_locks */
191 typedef struct {
192 char empty_struct;
193 } _Init_locks;
195 void __cdecl _Init_locks__Init_locks_ctor(_Init_locks*);
196 void __cdecl _Init_locks__Init_locks_dtor(_Init_locks*);
198 /* class _Lockit */
199 typedef struct {
200 char empty_struct;
201 } _Lockit;
203 #define _LOCK_LOCALE 0
204 #define _LOCK_MALLOC 1
205 #define _LOCK_STREAM 2
206 #define _LOCK_DEBUG 3
207 #define _MAX_LOCK 4
209 void init_lockit(void);
210 void free_lockit(void);
211 _Lockit* __thiscall _Lockit_ctor_locktype(_Lockit*, int);
212 void __thiscall _Lockit_dtor(_Lockit*);
214 typedef enum {
215 FMTFLAG_skipws = 0x0001,
216 FMTFLAG_unitbuf = 0x0002,
217 FMTFLAG_uppercase = 0x0004,
218 FMTFLAG_showbase = 0x0008,
219 FMTFLAG_showpoint = 0x0010,
220 FMTFLAG_showpos = 0x0020,
221 FMTFLAG_left = 0x0040,
222 FMTFLAG_right = 0x0080,
223 FMTFLAG_internal = 0x0100,
224 FMTFLAG_dec = 0x0200,
225 FMTFLAG_oct = 0x0400,
226 FMTFLAG_hex = 0x0800,
227 FMTFLAG_scientific = 0x1000,
228 FMTFLAG_fixed = 0x2000,
229 FMTFLAG_hexfloat = 0x3000,
230 FMTFLAG_boolalpha = 0x4000,
231 FMTFLAG_stdio = 0x8000,
232 FMTFLAG_adjustfield = FMTFLAG_left|FMTFLAG_right|FMTFLAG_internal,
233 FMTFLAG_basefield = FMTFLAG_dec|FMTFLAG_oct|FMTFLAG_hex,
234 FMTFLAG_floatfield = FMTFLAG_scientific|FMTFLAG_fixed,
235 FMTFLAG_mask = 0xffff
236 } IOSB_fmtflags;
238 typedef enum {
239 OPENMODE_in = 0x01,
240 OPENMODE_out = 0x02,
241 OPENMODE_ate = 0x04,
242 OPENMODE_app = 0x08,
243 OPENMODE_trunc = 0x10,
244 OPENMODE__Nocreate = 0x40,
245 OPENMODE__Noreplace = 0x80,
246 OPENMODE_binary = 0x20,
247 OPENMODE_mask = 0xff
248 } IOSB_openmode;
250 typedef enum {
251 SEEKDIR_beg = 0x0,
252 SEEKDIR_cur = 0x1,
253 SEEKDIR_end = 0x2,
254 SEEKDIR_mask = 0x3
255 } IOSB_seekdir;
257 typedef enum {
258 IOSTATE_goodbit = 0x00,
259 IOSTATE_eofbit = 0x01,
260 IOSTATE_failbit = 0x02,
261 IOSTATE_badbit = 0x04,
262 IOSTATE__Hardfail = 0x10,
263 IOSTATE_mask = 0x17
264 } IOSB_iostate;
266 typedef struct _iosarray {
267 struct _iosarray *next;
268 int index;
269 int long_val;
270 void *ptr_val;
271 } IOS_BASE_iosarray;
273 typedef enum {
274 EVENT_erase_event,
275 EVENT_imbue_event,
276 EVENT_copyfmt_event
277 } IOS_BASE_event;
279 struct _ios_base;
280 typedef void (CDECL *IOS_BASE_event_callback)(IOS_BASE_event, struct _ios_base*, int);
281 typedef struct _fnarray {
282 struct _fnarray *next;
283 int index;
284 IOS_BASE_event_callback event_handler;
285 } IOS_BASE_fnarray;
287 /* class ios_base */
288 typedef struct _ios_base {
289 const vtable_ptr *vtable;
290 IOSB_iostate state;
291 IOSB_iostate except;
292 IOSB_fmtflags fmtfl;
293 streamsize prec;
294 streamsize wide;
295 IOS_BASE_iosarray *arr;
296 IOS_BASE_fnarray *calls;
297 locale loc;
298 size_t stdstr;
299 } ios_base;
301 /* class basic_streambuf<char> */
302 typedef struct {
303 const vtable_ptr *vtable;
304 char *rbuf;
305 char *wbuf;
306 char **prbuf;
307 char **pwbuf;
308 char *rpos;
309 char *wpos;
310 char **prpos;
311 char **pwpos;
312 int rsize;
313 int wsize;
314 int *prsize;
315 int *pwsize;
316 locale loc;
317 } basic_streambuf_char;
319 typedef struct {
320 basic_streambuf_char *strbuf;
321 bool got;
322 char val;
323 } istreambuf_iterator_char;
325 typedef struct {
326 bool failed;
327 basic_streambuf_char *strbuf;
328 } ostreambuf_iterator_char;
330 int __thiscall basic_streambuf_char_sgetc(basic_streambuf_char*);
331 int __thiscall basic_streambuf_char_sbumpc(basic_streambuf_char*);
332 int __thiscall basic_streambuf_char_sputc(basic_streambuf_char*, char);
334 /* class basic_streambuf<wchar> */
335 typedef struct {
336 const vtable_ptr *vtable;
337 wchar_t *rbuf;
338 wchar_t *wbuf;
339 wchar_t **prbuf;
340 wchar_t **pwbuf;
341 wchar_t *rpos;
342 wchar_t *wpos;
343 wchar_t **prpos;
344 wchar_t **pwpos;
345 int rsize;
346 int wsize;
347 int *prsize;
348 int *pwsize;
349 locale loc;
350 } basic_streambuf_wchar;
352 typedef struct {
353 basic_streambuf_wchar *strbuf;
354 bool got;
355 wchar_t val;
356 } istreambuf_iterator_wchar;
358 typedef struct {
359 bool failed;
360 basic_streambuf_wchar *strbuf;
361 } ostreambuf_iterator_wchar;
363 unsigned short __thiscall basic_streambuf_wchar_sgetc(basic_streambuf_wchar*);
364 unsigned short __thiscall basic_streambuf_wchar_sbumpc(basic_streambuf_wchar*);
365 unsigned short __thiscall basic_streambuf_wchar_sputc(basic_streambuf_wchar*, wchar_t);
367 #define IOS_LOCALE(ios) (&(ios)->loc)
369 /* class num_get<char> */
370 typedef struct {
371 locale_facet facet;
372 _Cvtvec cvt;
373 } num_get;
375 num_get* num_get_char_use_facet(const locale*);
376 istreambuf_iterator_char* __thiscall num_get_char_get_long(const num_get*, istreambuf_iterator_char*,
377 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONG*);
378 istreambuf_iterator_char* __thiscall num_get_char_get_ushort(const num_get*, istreambuf_iterator_char*,
379 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned short*);
380 istreambuf_iterator_char* __thiscall num_get_char_get_uint(const num_get*, istreambuf_iterator_char*,
381 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned int*);
382 istreambuf_iterator_char* __thiscall num_get_char_get_ulong(const num_get*, istreambuf_iterator_char*,
383 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONG*);
384 istreambuf_iterator_char* __thiscall num_get_char_get_float(const num_get*, istreambuf_iterator_char*,
385 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, float*);
386 istreambuf_iterator_char *__thiscall num_get_char_get_double(const num_get*, istreambuf_iterator_char*,
387 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*);
388 istreambuf_iterator_char *__thiscall num_get_char_get_ldouble(const num_get*, istreambuf_iterator_char*,
389 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*);
390 istreambuf_iterator_char *__thiscall num_get_char_get_void(const num_get*, istreambuf_iterator_char*,
391 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, void**);
392 istreambuf_iterator_char *__thiscall num_get_char_get_int64(const num_get*, istreambuf_iterator_char*,
393 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONGLONG*);
394 istreambuf_iterator_char *__thiscall num_get_char_get_uint64(const num_get*, istreambuf_iterator_char*,
395 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONGLONG*);
396 istreambuf_iterator_char *__thiscall num_get_char_get_bool(const num_get*, istreambuf_iterator_char*,
397 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, bool*);
399 num_get* num_get_wchar_use_facet(const locale*);
400 num_get* num_get_short_use_facet(const locale*);
401 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_long(const num_get*, istreambuf_iterator_wchar*,
402 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONG*);
403 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_ushort(const num_get*, istreambuf_iterator_wchar*,
404 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned short*);
405 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_uint(const num_get*, istreambuf_iterator_wchar*,
406 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned int*);
407 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_ulong(const num_get*, istreambuf_iterator_wchar*,
408 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONG*);
409 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_float(const num_get*, istreambuf_iterator_wchar*,
410 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, float*);
411 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_double(const num_get*, istreambuf_iterator_wchar*,
412 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*);
413 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ldouble(const num_get*, istreambuf_iterator_wchar*,
414 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*);
415 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_void(const num_get*, istreambuf_iterator_wchar*,
416 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, void**);
417 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_int64(const num_get*, istreambuf_iterator_wchar*,
418 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONGLONG*);
419 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint64(const num_get*, istreambuf_iterator_wchar*,
420 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONGLONG*);
421 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_bool(const num_get*, istreambuf_iterator_wchar*,
422 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, bool*);
424 /* class num_put<char> */
425 /* class num_put<wchar> */
426 typedef struct {
427 locale_facet facet;
428 _Cvtvec cvt;
429 } num_put;
431 num_put* num_put_char_use_facet(const locale*);
432 ostreambuf_iterator_char* __thiscall num_put_char_put_long(const num_put*, ostreambuf_iterator_char*,
433 ostreambuf_iterator_char, ios_base*, char, LONG);
434 ostreambuf_iterator_char* __thiscall num_put_char_put_ulong(const num_put*, ostreambuf_iterator_char*,
435 ostreambuf_iterator_char, ios_base*, char, ULONG);
436 ostreambuf_iterator_char* __thiscall num_put_char_put_double(const num_put*, ostreambuf_iterator_char*,
437 ostreambuf_iterator_char, ios_base*, char, double);
438 ostreambuf_iterator_char* __thiscall num_put_char_put_ldouble(const num_put*, ostreambuf_iterator_char*,
439 ostreambuf_iterator_char, ios_base*, char, double);
440 ostreambuf_iterator_char* __thiscall num_put_char_put_ptr(const num_put*, ostreambuf_iterator_char*,
441 ostreambuf_iterator_char, ios_base*, char, const void*);
442 ostreambuf_iterator_char* __thiscall num_put_char_put_int64(const num_put*, ostreambuf_iterator_char*,
443 ostreambuf_iterator_char, ios_base*, char, __int64);
444 ostreambuf_iterator_char* __thiscall num_put_char_put_uint64(const num_put*, ostreambuf_iterator_char*,
445 ostreambuf_iterator_char, ios_base*, char, unsigned __int64);
446 ostreambuf_iterator_char* __thiscall num_put_char_put_bool(const num_put*, ostreambuf_iterator_char*,
447 ostreambuf_iterator_char, ios_base*, char, bool);
449 num_put* num_put_wchar_use_facet(const locale*);
450 num_put* num_put_short_use_facet(const locale*);
451 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_long(const num_put*, ostreambuf_iterator_wchar*,
452 ostreambuf_iterator_wchar, ios_base*, wchar_t, LONG);
453 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ulong(const num_put*, ostreambuf_iterator_wchar*,
454 ostreambuf_iterator_wchar, ios_base*, wchar_t, ULONG);
455 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_double(const num_put*, ostreambuf_iterator_wchar*,
456 ostreambuf_iterator_wchar, ios_base*, wchar_t, double);
457 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ldouble(const num_put*, ostreambuf_iterator_wchar*,
458 ostreambuf_iterator_wchar, ios_base*, wchar_t, double);
459 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ptr(const num_put*, ostreambuf_iterator_wchar*,
460 ostreambuf_iterator_wchar, ios_base*, wchar_t, const void*);
461 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_int64(const num_put*, ostreambuf_iterator_wchar*,
462 ostreambuf_iterator_wchar, ios_base*, wchar_t, __int64);
463 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_uint64(const num_put*, ostreambuf_iterator_wchar*,
464 ostreambuf_iterator_wchar, ios_base*, wchar_t, unsigned __int64);
465 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_bool(const num_put*, ostreambuf_iterator_wchar*,
466 ostreambuf_iterator_wchar, ios_base*, wchar_t, bool);
468 void init_exception(void*);
469 void init_locale(void*);
470 void init_io(void*);
471 void free_io(void);
472 void init_misc(void*);
474 /* class complex<float> */
475 typedef struct {
476 float real;
477 float imag;
478 } complex_float;
480 /* class complex<double> */
481 /* class complex<long double> */
482 typedef struct {
483 double real;
484 double imag;
485 } complex_double;