mshtml: Wine Gecko 2.34-beta2 release.
[wine/wine-gecko.git] / dlls / msvcp60 / msvcp.h
blob0a8c57cddfd7e6d08b6ce56e3ab287e25ff4d972
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 "stdlib.h"
20 #include "windef.h"
21 #include "cxx.h"
23 typedef unsigned char MSVCP_bool;
24 typedef SIZE_T MSVCP_size_t;
25 typedef SSIZE_T streamoff;
26 typedef SSIZE_T streamsize;
28 void __cdecl _invalid_parameter(const wchar_t*, const wchar_t*,
29 const wchar_t*, unsigned int, uintptr_t);
30 BOOL __cdecl __uncaught_exception(void);
32 extern void* (__cdecl *MSVCRT_operator_new)(MSVCP_size_t);
33 extern void (__cdecl *MSVCRT_operator_delete)(void*);
35 /* basic_string<char, char_traits<char>, allocator<char>> */
36 typedef struct
38 void *allocator;
39 char *ptr;
40 MSVCP_size_t size;
41 MSVCP_size_t res;
42 } basic_string_char;
44 basic_string_char* __thiscall basic_string_char_ctor(basic_string_char*);
45 basic_string_char* basic_string_char_ctor_cstr(basic_string_char*, const char*);
46 basic_string_char* basic_string_char_ctor_cstr_len(basic_string_char*, const char*, MSVCP_size_t);
47 basic_string_char* __thiscall basic_string_char_copy_ctor(basic_string_char*, const basic_string_char*);
48 void __thiscall basic_string_char_dtor(basic_string_char*);
49 const char* __thiscall basic_string_char_c_str(const basic_string_char*);
50 void basic_string_char_clear(basic_string_char*);
51 basic_string_char* __thiscall basic_string_char_append_ch(basic_string_char*, char);
52 MSVCP_size_t __thiscall basic_string_char_length(const basic_string_char*);
53 basic_string_char* __thiscall basic_string_char_append_len_ch(basic_string_char*, MSVCP_size_t, char);
54 basic_string_char* __thiscall basic_string_char_assign(basic_string_char*, const basic_string_char*);
56 typedef struct
58 void *allocator;
59 wchar_t *ptr;
60 MSVCP_size_t size;
61 MSVCP_size_t res;
62 } basic_string_wchar;
64 basic_string_wchar* __thiscall basic_string_wchar_ctor(basic_string_wchar*);
65 basic_string_wchar* basic_string_wchar_ctor_cstr(basic_string_wchar*, const wchar_t*);
66 basic_string_wchar* basic_string_wchar_ctor_cstr_len(basic_string_wchar*, const wchar_t*, MSVCP_size_t);
67 void __thiscall basic_string_wchar_dtor(basic_string_wchar*);
68 const wchar_t* __thiscall basic_string_wchar_c_str(const basic_string_wchar*);
69 void basic_string_wchar_clear(basic_string_wchar*);
70 basic_string_wchar* __thiscall basic_string_wchar_append_ch(basic_string_wchar*, wchar_t);
71 MSVCP_size_t __thiscall basic_string_wchar_length(const basic_string_wchar*);
73 char* MSVCP_allocator_char_allocate(void*, MSVCP_size_t);
74 void MSVCP_allocator_char_deallocate(void*, char*, MSVCP_size_t);
75 MSVCP_size_t MSVCP_allocator_char_max_size(void*);
76 wchar_t* MSVCP_allocator_wchar_allocate(void*, MSVCP_size_t);
77 void MSVCP_allocator_wchar_deallocate(void*, wchar_t*, MSVCP_size_t);
78 MSVCP_size_t MSVCP_allocator_wchar_max_size(void*);
80 /* class locale::facet */
81 typedef struct {
82 const vtable_ptr *vtable;
83 MSVCP_size_t refs;
84 } locale_facet;
86 typedef enum {
87 CODECVT_ok = 0,
88 CODECVT_partial = 1,
89 CODECVT_error = 2,
90 CODECVT_noconv = 3
91 } codecvt_base_result;
93 typedef struct {
94 LCID handle;
95 unsigned page;
96 const short *table;
97 int delfl;
98 } _Ctypevec;
100 /* class codecvt_base */
101 typedef struct {
102 locale_facet facet;
103 } codecvt_base;
105 /* class codecvt<char> */
106 typedef struct {
107 codecvt_base base;
108 } codecvt_char;
110 MSVCP_bool __thiscall codecvt_base_always_noconv(const codecvt_base*);
111 int __thiscall codecvt_char_out(const codecvt_char*, int*, const char*,
112 const char*, const char**, char*, char*, char**);
113 int __thiscall codecvt_char_in(const codecvt_char*, int*, const char*,
114 const char*, const char**, char*, char*, char**);
115 int __thiscall codecvt_base_max_length(const codecvt_base*);
117 typedef struct {
118 LCID handle;
119 unsigned page;
120 } _Cvtvec;
122 /* class codecvt<wchar> */
123 typedef struct {
124 codecvt_base base;
125 _Cvtvec cvt;
126 } codecvt_wchar;
128 int __thiscall codecvt_wchar_out(const codecvt_wchar*, int*, const wchar_t*,
129 const wchar_t*, const wchar_t**, char*, char*, char**);
130 int __thiscall codecvt_wchar_in(const codecvt_wchar*, int*, const char*,
131 const char*, const char**, wchar_t*, wchar_t*, wchar_t**);
133 /* class ctype_base */
134 typedef struct {
135 locale_facet facet;
136 } ctype_base;
138 /* class ctype<char> */
139 typedef struct {
140 ctype_base base;
141 _Ctypevec ctype;
142 } ctype_char;
144 MSVCP_bool __thiscall ctype_char_is_ch(const ctype_char*, short, char);
145 char __thiscall ctype_char_narrow_ch(const ctype_char*, char, char);
146 char __thiscall ctype_char_widen_ch(const ctype_char*, char);
148 /* class ctype<wchar> */
149 typedef struct {
150 ctype_base base;
151 _Ctypevec ctype;
152 _Cvtvec cvt;
153 } ctype_wchar;
155 MSVCP_bool __thiscall ctype_wchar_is_ch(const ctype_wchar*, short, wchar_t);
156 char __thiscall ctype_wchar_narrow_ch(const ctype_wchar*, wchar_t, char);
157 wchar_t __thiscall ctype_wchar_widen_ch(const ctype_wchar*, char);
159 /* class locale */
160 typedef struct
162 struct _locale__Locimp *ptr;
163 } locale;
165 locale* __thiscall locale_ctor(locale*);
166 locale* __thiscall locale_copy_ctor(locale*, const locale*);
167 locale* __thiscall locale_ctor_uninitialized(locale *, int);
168 locale* __thiscall locale_operator_assign(locale*, const locale*);
169 void __thiscall locale_dtor(locale*);
170 void free_locale(void);
171 locale* __thiscall locale__Addfac(locale*, locale_facet*, MSVCP_size_t, MSVCP_size_t);
172 codecvt_char* codecvt_char_use_facet(const locale*);
173 codecvt_wchar* codecvt_short_use_facet(const locale*);
174 ctype_char* ctype_char_use_facet(const locale*);
175 ctype_wchar* ctype_wchar_use_facet(const locale*);
176 ctype_wchar* ctype_short_use_facet(const locale*);
178 typedef struct {
179 MSVCP_size_t id;
180 } locale_id;
181 extern locale_id codecvt_char_id;
182 extern locale_id codecvt_short_id;
184 /* class _Lockit */
185 typedef struct {
186 char empty_struct;
187 } _Lockit;
189 #define _LOCK_LOCALE 0
190 #define _LOCK_MALLOC 1
191 #define _LOCK_STREAM 2
192 #define _LOCK_DEBUG 3
193 #define _MAX_LOCK 4
195 void init_lockit(void);
196 void free_lockit(void);
197 _Lockit* __thiscall _Lockit_ctor_locktype(_Lockit*, int);
198 void __thiscall _Lockit_dtor(_Lockit*);
200 typedef enum {
201 FMTFLAG_skipws = 0x0001,
202 FMTFLAG_unitbuf = 0x0002,
203 FMTFLAG_uppercase = 0x0004,
204 FMTFLAG_showbase = 0x0008,
205 FMTFLAG_showpoint = 0x0010,
206 FMTFLAG_showpos = 0x0020,
207 FMTFLAG_left = 0x0040,
208 FMTFLAG_right = 0x0080,
209 FMTFLAG_internal = 0x0100,
210 FMTFLAG_dec = 0x0200,
211 FMTFLAG_oct = 0x0400,
212 FMTFLAG_hex = 0x0800,
213 FMTFLAG_scientific = 0x1000,
214 FMTFLAG_fixed = 0x2000,
215 FMTFLAG_hexfloat = 0x3000,
216 FMTFLAG_boolalpha = 0x4000,
217 FMTFLAG_stdio = 0x8000,
218 FMTFLAG_adjustfield = FMTFLAG_left|FMTFLAG_right|FMTFLAG_internal,
219 FMTFLAG_basefield = FMTFLAG_dec|FMTFLAG_oct|FMTFLAG_hex,
220 FMTFLAG_floatfield = FMTFLAG_scientific|FMTFLAG_fixed,
221 FMTFLAG_mask = 0xffff
222 } IOSB_fmtflags;
224 typedef enum {
225 OPENMODE_in = 0x01,
226 OPENMODE_out = 0x02,
227 OPENMODE_ate = 0x04,
228 OPENMODE_app = 0x08,
229 OPENMODE_trunc = 0x10,
230 OPENMODE__Nocreate = 0x40,
231 OPENMODE__Noreplace = 0x80,
232 OPENMODE_binary = 0x20,
233 OPENMODE_mask = 0xff
234 } IOSB_openmode;
236 typedef enum {
237 SEEKDIR_beg = 0x0,
238 SEEKDIR_cur = 0x1,
239 SEEKDIR_end = 0x2,
240 SEEKDIR_mask = 0x3
241 } IOSB_seekdir;
243 typedef enum {
244 IOSTATE_goodbit = 0x00,
245 IOSTATE_eofbit = 0x01,
246 IOSTATE_failbit = 0x02,
247 IOSTATE_badbit = 0x04,
248 IOSTATE__Hardfail = 0x10,
249 IOSTATE_mask = 0x17
250 } IOSB_iostate;
252 typedef struct _iosarray {
253 struct _iosarray *next;
254 int index;
255 int long_val;
256 void *ptr_val;
257 } IOS_BASE_iosarray;
259 typedef enum {
260 EVENT_erase_event,
261 EVENT_imbue_event,
262 EVENT_copyfmt_event
263 } IOS_BASE_event;
265 struct _ios_base;
266 typedef void (CDECL *IOS_BASE_event_callback)(IOS_BASE_event, struct _ios_base*, int);
267 typedef struct _fnarray {
268 struct _fnarray *next;
269 int index;
270 IOS_BASE_event_callback event_handler;
271 } IOS_BASE_fnarray;
273 /* class ios_base */
274 typedef struct _ios_base {
275 const vtable_ptr *vtable;
276 IOSB_iostate state;
277 IOSB_iostate except;
278 IOSB_fmtflags fmtfl;
279 streamsize prec;
280 streamsize wide;
281 IOS_BASE_iosarray *arr;
282 IOS_BASE_fnarray *calls;
283 locale loc;
284 MSVCP_size_t stdstr;
285 } ios_base;
287 /* class basic_streambuf<char> */
288 typedef struct {
289 const vtable_ptr *vtable;
290 char *rbuf;
291 char *wbuf;
292 char **prbuf;
293 char **pwbuf;
294 char *rpos;
295 char *wpos;
296 char **prpos;
297 char **pwpos;
298 int rsize;
299 int wsize;
300 int *prsize;
301 int *pwsize;
302 locale loc;
303 } basic_streambuf_char;
305 typedef struct {
306 basic_streambuf_char *strbuf;
307 MSVCP_bool got;
308 char val;
309 } istreambuf_iterator_char;
311 typedef struct {
312 MSVCP_bool failed;
313 basic_streambuf_char *strbuf;
314 } ostreambuf_iterator_char;
316 int __thiscall basic_streambuf_char_sgetc(basic_streambuf_char*);
317 int __thiscall basic_streambuf_char_sbumpc(basic_streambuf_char*);
318 int __thiscall basic_streambuf_char_sputc(basic_streambuf_char*, char);
320 /* class basic_streambuf<wchar> */
321 typedef struct {
322 const vtable_ptr *vtable;
323 wchar_t *rbuf;
324 wchar_t *wbuf;
325 wchar_t **prbuf;
326 wchar_t **pwbuf;
327 wchar_t *rpos;
328 wchar_t *wpos;
329 wchar_t **prpos;
330 wchar_t **pwpos;
331 int rsize;
332 int wsize;
333 int *prsize;
334 int *pwsize;
335 locale loc;
336 } basic_streambuf_wchar;
338 typedef struct {
339 basic_streambuf_wchar *strbuf;
340 MSVCP_bool got;
341 wchar_t val;
342 } istreambuf_iterator_wchar;
344 typedef struct {
345 MSVCP_bool failed;
346 basic_streambuf_wchar *strbuf;
347 } ostreambuf_iterator_wchar;
349 unsigned short __thiscall basic_streambuf_wchar_sgetc(basic_streambuf_wchar*);
350 unsigned short __thiscall basic_streambuf_wchar_sbumpc(basic_streambuf_wchar*);
351 unsigned short __thiscall basic_streambuf_wchar_sputc(basic_streambuf_wchar*, wchar_t);
353 /* class num_get<char> */
354 typedef struct {
355 locale_facet facet;
356 _Cvtvec cvt;
357 } num_get;
359 num_get* num_get_char_use_facet(const locale*);
360 istreambuf_iterator_char* __thiscall num_get_char_get_long(const num_get*, istreambuf_iterator_char*,
361 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONG*);
362 istreambuf_iterator_char* __thiscall num_get_char_get_ushort(const num_get*, istreambuf_iterator_char*,
363 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned short*);
364 istreambuf_iterator_char* __thiscall num_get_char_get_uint(const num_get*, istreambuf_iterator_char*,
365 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned int*);
366 istreambuf_iterator_char* __thiscall num_get_char_get_ulong(const num_get*, istreambuf_iterator_char*,
367 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONG*);
368 istreambuf_iterator_char* __thiscall num_get_char_get_float(const num_get*, istreambuf_iterator_char*,
369 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, float*);
370 istreambuf_iterator_char *__thiscall num_get_char_get_double(const num_get*, istreambuf_iterator_char*,
371 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*);
372 istreambuf_iterator_char *__thiscall num_get_char_get_ldouble(const num_get*, istreambuf_iterator_char*,
373 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*);
374 istreambuf_iterator_char *__thiscall num_get_char_get_void(const num_get*, istreambuf_iterator_char*,
375 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, void**);
376 istreambuf_iterator_char *__thiscall num_get_char_get_int64(const num_get*, istreambuf_iterator_char*,
377 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONGLONG*);
378 istreambuf_iterator_char *__thiscall num_get_char_get_uint64(const num_get*, istreambuf_iterator_char*,
379 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONGLONG*);
380 istreambuf_iterator_char *__thiscall num_get_char_get_bool(const num_get*, istreambuf_iterator_char*,
381 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, MSVCP_bool*);
383 num_get* num_get_short_use_facet(const locale*);
384 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_long(const num_get*, istreambuf_iterator_wchar*,
385 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONG*);
386 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_ushort(const num_get*, istreambuf_iterator_wchar*,
387 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned short*);
388 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_uint(const num_get*, istreambuf_iterator_wchar*,
389 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned int*);
390 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_ulong(const num_get*, istreambuf_iterator_wchar*,
391 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONG*);
392 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_float(const num_get*, istreambuf_iterator_wchar*,
393 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, float*);
394 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_double(const num_get*, istreambuf_iterator_wchar*,
395 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*);
396 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ldouble(const num_get*, istreambuf_iterator_wchar*,
397 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*);
398 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_void(const num_get*, istreambuf_iterator_wchar*,
399 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, void**);
400 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_int64(const num_get*, istreambuf_iterator_wchar*,
401 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONGLONG*);
402 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint64(const num_get*, istreambuf_iterator_wchar*,
403 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONGLONG*);
404 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_bool(const num_get*, istreambuf_iterator_wchar*,
405 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, MSVCP_bool*);
407 /* class num_put<char> */
408 /* class num_put<wchar> */
409 typedef struct {
410 locale_facet facet;
411 _Cvtvec cvt;
412 } num_put;
414 num_put* num_put_char_use_facet(const locale*);
415 ostreambuf_iterator_char* __thiscall num_put_char_put_long(const num_put*, ostreambuf_iterator_char*,
416 ostreambuf_iterator_char, ios_base*, char, LONG);
417 ostreambuf_iterator_char* __thiscall num_put_char_put_ulong(const num_put*, ostreambuf_iterator_char*,
418 ostreambuf_iterator_char, ios_base*, char, ULONG);
419 ostreambuf_iterator_char* __thiscall num_put_char_put_double(const num_put*, ostreambuf_iterator_char*,
420 ostreambuf_iterator_char, ios_base*, char, double);
421 ostreambuf_iterator_char* __thiscall num_put_char_put_ldouble(const num_put*, ostreambuf_iterator_char*,
422 ostreambuf_iterator_char, ios_base*, char, double);
423 ostreambuf_iterator_char* __thiscall num_put_char_put_ptr(const num_put*, ostreambuf_iterator_char*,
424 ostreambuf_iterator_char, ios_base*, char, const void*);
425 ostreambuf_iterator_char* __thiscall num_put_char_put_int64(const num_put*, ostreambuf_iterator_char*,
426 ostreambuf_iterator_char, ios_base*, char, __int64);
427 ostreambuf_iterator_char* __thiscall num_put_char_put_uint64(const num_put*, ostreambuf_iterator_char*,
428 ostreambuf_iterator_char, ios_base*, char, unsigned __int64);
429 ostreambuf_iterator_char* __thiscall num_put_char_put_bool(const num_put*, ostreambuf_iterator_char*,
430 ostreambuf_iterator_char, ios_base*, char, MSVCP_bool);
432 num_put* num_put_short_use_facet(const locale*);
433 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_long(const num_put*, ostreambuf_iterator_wchar*,
434 ostreambuf_iterator_wchar, ios_base*, wchar_t, LONG);
435 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ulong(const num_put*, ostreambuf_iterator_wchar*,
436 ostreambuf_iterator_wchar, ios_base*, wchar_t, ULONG);
437 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_double(const num_put*, ostreambuf_iterator_wchar*,
438 ostreambuf_iterator_wchar, ios_base*, wchar_t, double);
439 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ldouble(const num_put*, ostreambuf_iterator_wchar*,
440 ostreambuf_iterator_wchar, ios_base*, wchar_t, double);
441 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ptr(const num_put*, ostreambuf_iterator_wchar*,
442 ostreambuf_iterator_wchar, ios_base*, wchar_t, const void*);
443 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_int64(const num_put*, ostreambuf_iterator_wchar*,
444 ostreambuf_iterator_wchar, ios_base*, wchar_t, __int64);
445 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_uint64(const num_put*, ostreambuf_iterator_wchar*,
446 ostreambuf_iterator_wchar, ios_base*, wchar_t, unsigned __int64);
447 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_bool(const num_put*, ostreambuf_iterator_wchar*,
448 ostreambuf_iterator_wchar, ios_base*, wchar_t, MSVCP_bool);
450 void init_exception(void*);
451 void init_locale(void*);
452 void init_io(void*);
453 void free_io(void);