ntdll: Use a separate memory allocation for the kernel stack.
[wine.git] / dlls / msvcp60 / msvcp.h
blob09a94de6d1f6046d89f79cc9d81625c75c70d78a
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;
29 void __cdecl _invalid_parameter(const wchar_t*, const wchar_t*,
30 const wchar_t*, unsigned int, uintptr_t);
31 BOOL __cdecl __uncaught_exception(void);
33 void* __cdecl operator_new(size_t);
34 void __cdecl operator_delete(void*);
36 /* basic_string<char, char_traits<char>, allocator<char>> */
37 typedef struct
39 void *allocator;
40 char *ptr;
41 size_t size;
42 size_t res;
43 } basic_string_char;
45 basic_string_char* __thiscall MSVCP_basic_string_char_ctor(basic_string_char*);
46 basic_string_char* __thiscall MSVCP_basic_string_char_ctor_cstr(basic_string_char*, const char*);
47 basic_string_char* __thiscall MSVCP_basic_string_char_ctor_cstr_len(basic_string_char*, const char*, size_t);
48 basic_string_char* __thiscall MSVCP_basic_string_char_copy_ctor(basic_string_char*, const basic_string_char*);
49 void __thiscall MSVCP_basic_string_char_dtor(basic_string_char*);
50 const char* __thiscall MSVCP_basic_string_char_c_str(const basic_string_char*);
51 void __thiscall MSVCP_basic_string_char_clear(basic_string_char*);
52 basic_string_char* __thiscall MSVCP_basic_string_char_append_ch(basic_string_char*, char);
53 size_t __thiscall MSVCP_basic_string_char_length(const basic_string_char*);
54 basic_string_char* __thiscall MSVCP_basic_string_char_append_len_ch(basic_string_char*, size_t, char);
55 basic_string_char* __thiscall MSVCP_basic_string_char_assign(basic_string_char*, const basic_string_char*);
57 typedef struct
59 void *allocator;
60 wchar_t *ptr;
61 size_t size;
62 size_t res;
63 } basic_string_wchar;
65 basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor(basic_string_wchar*);
66 basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor_cstr(basic_string_wchar*, const wchar_t*);
67 basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor_cstr_len(basic_string_wchar*, const wchar_t*, size_t);
68 void __thiscall MSVCP_basic_string_wchar_dtor(basic_string_wchar*);
69 const wchar_t* __thiscall MSVCP_basic_string_wchar_c_str(const basic_string_wchar*);
70 void __thiscall MSVCP_basic_string_wchar_clear(basic_string_wchar*);
71 basic_string_wchar* __thiscall MSVCP_basic_string_wchar_append_ch(basic_string_wchar*, wchar_t);
72 size_t __thiscall MSVCP_basic_string_wchar_length(const basic_string_wchar*);
74 char* __thiscall MSVCP_allocator_char_allocate(void*, size_t);
75 void __thiscall MSVCP_allocator_char_deallocate(void*, char*, size_t);
76 size_t __thiscall MSVCP_allocator_char_max_size(const void*);
77 wchar_t* __thiscall MSVCP_allocator_wchar_allocate(void*, size_t);
78 void __thiscall MSVCP_allocator_wchar_deallocate(void*, wchar_t*, size_t);
79 size_t __thiscall MSVCP_allocator_wchar_max_size(const void*);
81 /* class locale::facet */
82 typedef struct {
83 const vtable_ptr *vtable;
84 size_t refs;
85 } locale_facet;
87 typedef enum {
88 CODECVT_ok = 0,
89 CODECVT_partial = 1,
90 CODECVT_error = 2,
91 CODECVT_noconv = 3
92 } codecvt_base_result;
94 typedef struct {
95 LCID handle;
96 unsigned page;
97 const short *table;
98 int delfl;
99 } _Ctypevec;
101 /* class codecvt_base */
102 typedef struct {
103 locale_facet facet;
104 } codecvt_base;
106 /* class codecvt<char> */
107 typedef struct {
108 codecvt_base base;
109 } codecvt_char;
111 bool __thiscall codecvt_base_always_noconv(const codecvt_base*);
112 int __thiscall codecvt_char_unshift(const codecvt_char*, int*, char*, char*, char**);
113 int __thiscall codecvt_char_out(const codecvt_char*, int*, const char*,
114 const char*, const char**, char*, char*, char**);
115 int __thiscall codecvt_char_in(const codecvt_char*, int*, const char*,
116 const char*, const char**, char*, char*, char**);
117 int __thiscall codecvt_base_max_length(const codecvt_base*);
119 typedef struct {
120 LCID handle;
121 unsigned page;
122 } _Cvtvec;
124 /* class codecvt<wchar> */
125 typedef struct {
126 codecvt_base base;
127 _Cvtvec cvt;
128 } codecvt_wchar;
130 int __thiscall codecvt_wchar_unshift(const codecvt_wchar*, int*, char*, char*, char**);
131 int __thiscall codecvt_wchar_out(const codecvt_wchar*, int*, const wchar_t*,
132 const wchar_t*, const wchar_t**, char*, char*, char**);
133 int __thiscall codecvt_wchar_in(const codecvt_wchar*, int*, const char*,
134 const char*, const char**, wchar_t*, wchar_t*, wchar_t**);
136 /* class ctype_base */
137 typedef struct {
138 locale_facet facet;
139 } ctype_base;
141 /* class ctype<char> */
142 typedef struct {
143 ctype_base base;
144 _Ctypevec ctype;
145 } ctype_char;
147 bool __thiscall ctype_char_is_ch(const ctype_char*, short, char);
148 char __thiscall ctype_char_narrow_ch(const ctype_char*, char, char);
149 char __thiscall ctype_char_widen_ch(const ctype_char*, char);
151 /* class ctype<wchar> */
152 typedef struct {
153 ctype_base base;
154 _Ctypevec ctype;
155 _Cvtvec cvt;
156 } ctype_wchar;
158 bool __thiscall ctype_wchar_is_ch(const ctype_wchar*, short, wchar_t);
159 char __thiscall ctype_wchar_narrow_ch(const ctype_wchar*, wchar_t, char);
160 wchar_t __thiscall ctype_wchar_widen_ch(const ctype_wchar*, char);
162 /* class locale */
163 typedef struct
165 struct _locale__Locimp *ptr;
166 } locale;
168 locale* __thiscall locale_ctor(locale*);
169 locale* __thiscall locale_copy_ctor(locale*, const locale*);
170 locale* __thiscall locale_ctor_uninitialized(locale *, int);
171 locale* __thiscall locale_operator_assign(locale*, const locale*);
172 void __thiscall locale_dtor(locale*);
173 void free_locale(void);
174 locale* __thiscall locale__Addfac(locale*, locale_facet*, size_t, size_t);
175 codecvt_char* codecvt_char_use_facet(const locale*);
176 codecvt_wchar* codecvt_wchar_use_facet(const locale*);
177 codecvt_wchar* codecvt_short_use_facet(const locale*);
178 ctype_char* ctype_char_use_facet(const locale*);
179 ctype_wchar* ctype_wchar_use_facet(const locale*);
180 ctype_wchar* ctype_short_use_facet(const locale*);
182 typedef struct {
183 size_t id;
184 } locale_id;
185 extern locale_id codecvt_char_id;
186 extern locale_id codecvt_short_id;
188 /* class _Init_locks */
189 typedef struct {
190 char empty_struct;
191 } _Init_locks;
193 void __cdecl _Init_locks__Init_locks_ctor(_Init_locks*);
194 void __cdecl _Init_locks__Init_locks_dtor(_Init_locks*);
196 /* class _Lockit */
197 typedef struct {
198 char empty_struct;
199 } _Lockit;
201 #define _LOCK_LOCALE 0
202 #define _LOCK_MALLOC 1
203 #define _LOCK_STREAM 2
204 #define _LOCK_DEBUG 3
205 #define _MAX_LOCK 4
207 void init_lockit(void);
208 void free_lockit(void);
209 _Lockit* __thiscall _Lockit_ctor_locktype(_Lockit*, int);
210 void __thiscall _Lockit_dtor(_Lockit*);
212 typedef enum {
213 FMTFLAG_skipws = 0x0001,
214 FMTFLAG_unitbuf = 0x0002,
215 FMTFLAG_uppercase = 0x0004,
216 FMTFLAG_showbase = 0x0008,
217 FMTFLAG_showpoint = 0x0010,
218 FMTFLAG_showpos = 0x0020,
219 FMTFLAG_left = 0x0040,
220 FMTFLAG_right = 0x0080,
221 FMTFLAG_internal = 0x0100,
222 FMTFLAG_dec = 0x0200,
223 FMTFLAG_oct = 0x0400,
224 FMTFLAG_hex = 0x0800,
225 FMTFLAG_scientific = 0x1000,
226 FMTFLAG_fixed = 0x2000,
227 FMTFLAG_hexfloat = 0x3000,
228 FMTFLAG_boolalpha = 0x4000,
229 FMTFLAG_stdio = 0x8000,
230 FMTFLAG_adjustfield = FMTFLAG_left|FMTFLAG_right|FMTFLAG_internal,
231 FMTFLAG_basefield = FMTFLAG_dec|FMTFLAG_oct|FMTFLAG_hex,
232 FMTFLAG_floatfield = FMTFLAG_scientific|FMTFLAG_fixed,
233 FMTFLAG_mask = 0xffff
234 } IOSB_fmtflags;
236 typedef enum {
237 OPENMODE_in = 0x01,
238 OPENMODE_out = 0x02,
239 OPENMODE_ate = 0x04,
240 OPENMODE_app = 0x08,
241 OPENMODE_trunc = 0x10,
242 OPENMODE__Nocreate = 0x40,
243 OPENMODE__Noreplace = 0x80,
244 OPENMODE_binary = 0x20,
245 OPENMODE_mask = 0xff
246 } IOSB_openmode;
248 typedef enum {
249 SEEKDIR_beg = 0x0,
250 SEEKDIR_cur = 0x1,
251 SEEKDIR_end = 0x2,
252 SEEKDIR_mask = 0x3
253 } IOSB_seekdir;
255 typedef enum {
256 IOSTATE_goodbit = 0x00,
257 IOSTATE_eofbit = 0x01,
258 IOSTATE_failbit = 0x02,
259 IOSTATE_badbit = 0x04,
260 IOSTATE__Hardfail = 0x10,
261 IOSTATE_mask = 0x17
262 } IOSB_iostate;
264 typedef struct _iosarray {
265 struct _iosarray *next;
266 int index;
267 LONG long_val;
268 void *ptr_val;
269 } IOS_BASE_iosarray;
271 typedef enum {
272 EVENT_erase_event,
273 EVENT_imbue_event,
274 EVENT_copyfmt_event
275 } IOS_BASE_event;
277 struct _ios_base;
278 typedef void (CDECL *IOS_BASE_event_callback)(IOS_BASE_event, struct _ios_base*, int);
279 typedef struct _fnarray {
280 struct _fnarray *next;
281 int index;
282 IOS_BASE_event_callback event_handler;
283 } IOS_BASE_fnarray;
285 /* class ios_base */
286 typedef struct _ios_base {
287 const vtable_ptr *vtable;
288 IOSB_iostate state;
289 IOSB_iostate except;
290 IOSB_fmtflags fmtfl;
291 streamsize prec;
292 streamsize wide;
293 IOS_BASE_iosarray *arr;
294 IOS_BASE_fnarray *calls;
295 locale loc;
296 size_t stdstr;
297 } ios_base;
299 /* class basic_streambuf<char> */
300 typedef struct {
301 const vtable_ptr *vtable;
302 char *rbuf;
303 char *wbuf;
304 char **prbuf;
305 char **pwbuf;
306 char *rpos;
307 char *wpos;
308 char **prpos;
309 char **pwpos;
310 int rsize;
311 int wsize;
312 int *prsize;
313 int *pwsize;
314 locale loc;
315 } basic_streambuf_char;
317 typedef struct {
318 basic_streambuf_char *strbuf;
319 bool got;
320 char val;
321 } istreambuf_iterator_char;
323 typedef struct {
324 bool failed;
325 basic_streambuf_char *strbuf;
326 } ostreambuf_iterator_char;
328 int __thiscall basic_streambuf_char_sgetc(basic_streambuf_char*);
329 int __thiscall basic_streambuf_char_sbumpc(basic_streambuf_char*);
330 int __thiscall basic_streambuf_char_sputc(basic_streambuf_char*, char);
332 /* class basic_streambuf<wchar> */
333 typedef struct {
334 const vtable_ptr *vtable;
335 wchar_t *rbuf;
336 wchar_t *wbuf;
337 wchar_t **prbuf;
338 wchar_t **pwbuf;
339 wchar_t *rpos;
340 wchar_t *wpos;
341 wchar_t **prpos;
342 wchar_t **pwpos;
343 int rsize;
344 int wsize;
345 int *prsize;
346 int *pwsize;
347 locale loc;
348 } basic_streambuf_wchar;
350 typedef struct {
351 basic_streambuf_wchar *strbuf;
352 bool got;
353 wchar_t val;
354 } istreambuf_iterator_wchar;
356 typedef struct {
357 bool failed;
358 basic_streambuf_wchar *strbuf;
359 } ostreambuf_iterator_wchar;
361 unsigned short __thiscall basic_streambuf_wchar_sgetc(basic_streambuf_wchar*);
362 unsigned short __thiscall basic_streambuf_wchar_sbumpc(basic_streambuf_wchar*);
363 unsigned short __thiscall basic_streambuf_wchar_sputc(basic_streambuf_wchar*, wchar_t);
365 #define IOS_LOCALE(ios) (&(ios)->loc)
367 /* class num_get<char> */
368 typedef struct {
369 locale_facet facet;
370 _Cvtvec cvt;
371 } num_get;
373 num_get* num_get_char_use_facet(const locale*);
374 istreambuf_iterator_char* __thiscall num_get_char_get_long(const num_get*, istreambuf_iterator_char*,
375 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONG*);
376 istreambuf_iterator_char* __thiscall num_get_char_get_ushort(const num_get*, istreambuf_iterator_char*,
377 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned short*);
378 istreambuf_iterator_char* __thiscall num_get_char_get_uint(const num_get*, istreambuf_iterator_char*,
379 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned int*);
380 istreambuf_iterator_char* __thiscall num_get_char_get_ulong(const num_get*, istreambuf_iterator_char*,
381 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONG*);
382 istreambuf_iterator_char* __thiscall num_get_char_get_float(const num_get*, istreambuf_iterator_char*,
383 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, float*);
384 istreambuf_iterator_char *__thiscall num_get_char_get_double(const num_get*, istreambuf_iterator_char*,
385 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*);
386 istreambuf_iterator_char *__thiscall num_get_char_get_ldouble(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_void(const num_get*, istreambuf_iterator_char*,
389 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, void**);
390 istreambuf_iterator_char *__thiscall num_get_char_get_int64(const num_get*, istreambuf_iterator_char*,
391 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONGLONG*);
392 istreambuf_iterator_char *__thiscall num_get_char_get_uint64(const num_get*, istreambuf_iterator_char*,
393 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONGLONG*);
394 istreambuf_iterator_char *__thiscall num_get_char_get_bool(const num_get*, istreambuf_iterator_char*,
395 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, bool*);
397 num_get* num_get_wchar_use_facet(const locale*);
398 num_get* num_get_short_use_facet(const locale*);
399 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_long(const num_get*, istreambuf_iterator_wchar*,
400 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONG*);
401 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_ushort(const num_get*, istreambuf_iterator_wchar*,
402 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned short*);
403 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_uint(const num_get*, istreambuf_iterator_wchar*,
404 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned int*);
405 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_ulong(const num_get*, istreambuf_iterator_wchar*,
406 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONG*);
407 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_float(const num_get*, istreambuf_iterator_wchar*,
408 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, float*);
409 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_double(const num_get*, istreambuf_iterator_wchar*,
410 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*);
411 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ldouble(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_void(const num_get*, istreambuf_iterator_wchar*,
414 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, void**);
415 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_int64(const num_get*, istreambuf_iterator_wchar*,
416 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONGLONG*);
417 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint64(const num_get*, istreambuf_iterator_wchar*,
418 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONGLONG*);
419 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_bool(const num_get*, istreambuf_iterator_wchar*,
420 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, bool*);
422 /* class num_put<char> */
423 /* class num_put<wchar> */
424 typedef struct {
425 locale_facet facet;
426 _Cvtvec cvt;
427 } num_put;
429 num_put* num_put_char_use_facet(const locale*);
430 ostreambuf_iterator_char* __thiscall num_put_char_put_long(const num_put*, ostreambuf_iterator_char*,
431 ostreambuf_iterator_char, ios_base*, char, LONG);
432 ostreambuf_iterator_char* __thiscall num_put_char_put_ulong(const num_put*, ostreambuf_iterator_char*,
433 ostreambuf_iterator_char, ios_base*, char, ULONG);
434 ostreambuf_iterator_char* __thiscall num_put_char_put_double(const num_put*, ostreambuf_iterator_char*,
435 ostreambuf_iterator_char, ios_base*, char, double);
436 ostreambuf_iterator_char* __thiscall num_put_char_put_ldouble(const num_put*, ostreambuf_iterator_char*,
437 ostreambuf_iterator_char, ios_base*, char, double);
438 ostreambuf_iterator_char* __thiscall num_put_char_put_ptr(const num_put*, ostreambuf_iterator_char*,
439 ostreambuf_iterator_char, ios_base*, char, const void*);
440 ostreambuf_iterator_char* __thiscall num_put_char_put_int64(const num_put*, ostreambuf_iterator_char*,
441 ostreambuf_iterator_char, ios_base*, char, __int64);
442 ostreambuf_iterator_char* __thiscall num_put_char_put_uint64(const num_put*, ostreambuf_iterator_char*,
443 ostreambuf_iterator_char, ios_base*, char, unsigned __int64);
444 ostreambuf_iterator_char* __thiscall num_put_char_put_bool(const num_put*, ostreambuf_iterator_char*,
445 ostreambuf_iterator_char, ios_base*, char, bool);
447 num_put* num_put_wchar_use_facet(const locale*);
448 num_put* num_put_short_use_facet(const locale*);
449 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_long(const num_put*, ostreambuf_iterator_wchar*,
450 ostreambuf_iterator_wchar, ios_base*, wchar_t, LONG);
451 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ulong(const num_put*, ostreambuf_iterator_wchar*,
452 ostreambuf_iterator_wchar, ios_base*, wchar_t, ULONG);
453 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_double(const num_put*, ostreambuf_iterator_wchar*,
454 ostreambuf_iterator_wchar, ios_base*, wchar_t, double);
455 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ldouble(const num_put*, ostreambuf_iterator_wchar*,
456 ostreambuf_iterator_wchar, ios_base*, wchar_t, double);
457 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ptr(const num_put*, ostreambuf_iterator_wchar*,
458 ostreambuf_iterator_wchar, ios_base*, wchar_t, const void*);
459 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_int64(const num_put*, ostreambuf_iterator_wchar*,
460 ostreambuf_iterator_wchar, ios_base*, wchar_t, __int64);
461 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_uint64(const num_put*, ostreambuf_iterator_wchar*,
462 ostreambuf_iterator_wchar, ios_base*, wchar_t, unsigned __int64);
463 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_bool(const num_put*, ostreambuf_iterator_wchar*,
464 ostreambuf_iterator_wchar, ios_base*, wchar_t, bool);
466 void init_exception(void*);
467 void init_locale(void*);
468 void init_io(void*);
469 void free_io(void);
470 void init_misc(void*);
472 /* class complex<float> */
473 typedef struct {
474 float real;
475 float imag;
476 } complex_float;
478 /* class complex<double> */
479 /* class complex<long double> */
480 typedef struct {
481 double real;
482 double imag;
483 } complex_double;
485 void WINAPI DECLSPEC_NORETURN _CxxThrowException(void*,const cxx_exception_type*);
486 void __cdecl DECLSPEC_NORETURN _Xlength_error(const char*);
487 void __cdecl DECLSPEC_NORETURN _Xmem(void);
488 void __cdecl DECLSPEC_NORETURN _Xout_of_range(const char*);
489 void DECLSPEC_NORETURN throw_failure(const char*);