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
23 #define ALIGNED_SIZE(size, alignment) (((size)+((alignment)-1))/(alignment)*(alignment))
25 typedef unsigned char MSVCP_bool;
26 typedef SIZE_T MSVCP_size_t;
27 typedef __int64 DECLSPEC_ALIGN(8) streamoff;
28 typedef __int64 DECLSPEC_ALIGN(8) streamsize;
30 void __cdecl _invalid_parameter(const wchar_t*, const wchar_t*,
31 const wchar_t*, unsigned int, uintptr_t);
32 BOOL __cdecl __uncaught_exception(void);
34 extern void* (__cdecl *MSVCRT_operator_new)(MSVCP_size_t);
35 extern void (__cdecl *MSVCRT_operator_delete)(void*);
36 extern void* (__cdecl *MSVCRT_set_new_handler)(void*);
38 /* basic_string<char, char_traits<char>, allocator<char>> */
39 #define BUF_SIZE_CHAR 16
44 char buf[BUF_SIZE_CHAR];
51 basic_string_char* MSVCP_basic_string_char_ctor(basic_string_char*);
52 basic_string_char* MSVCP_basic_string_char_ctor_cstr(basic_string_char*, const char*);
53 basic_string_char* MSVCP_basic_string_char_copy_ctor(basic_string_char*, const basic_string_char*);
54 void MSVCP_basic_string_char_dtor(basic_string_char*);
55 const char* MSVCP_basic_string_char_c_str(const basic_string_char*);
56 basic_string_char* MSVCP_basic_string_char_append_ch(basic_string_char*, char);
57 MSVCP_size_t MSVCP_basic_string_char_length(const basic_string_char*);
59 #define BUF_SIZE_WCHAR 8
64 wchar_t buf[BUF_SIZE_WCHAR];
71 basic_string_wchar* MSVCP_basic_string_wchar_ctor_cstr(basic_string_wchar*, const wchar_t*);
72 void MSVCP_basic_string_wchar_dtor(basic_string_wchar*);
73 const wchar_t* MSVCP_basic_string_wchar_c_str(const basic_string_wchar*);
74 MSVCP_size_t MSVCP_basic_string_wchar_length(const basic_string_wchar*);
76 char* MSVCP_allocator_char_allocate(void*, MSVCP_size_t);
77 void MSVCP_allocator_char_deallocate(void*, char*, MSVCP_size_t);
78 wchar_t* MSVCP_allocator_wchar_allocate(void*, MSVCP_size_t);
79 void MSVCP_allocator_wchar_deallocate(void*, wchar_t*, MSVCP_size_t);
87 _Yarn_char* __thiscall _Yarn_char_ctor_cstr(_Yarn_char*, const char*);
88 _Yarn_char* __thiscall _Yarn_char_copy_ctor(_Yarn_char*, const _Yarn_char*);
89 const char* __thiscall _Yarn_char_c_str(const _Yarn_char*);
90 void __thiscall _Yarn_char_dtor(_Yarn_char*);
92 /* class locale::facet */
94 const vtable_ptr *vtable;
103 } codecvt_base_result;
112 /* class codecvt_base */
117 /* class codecvt<char> */
122 MSVCP_bool __thiscall codecvt_base_always_noconv(const codecvt_base*);
123 int __thiscall codecvt_char_unshift(const codecvt_char*, int*, char*, char*, char**);
124 int __thiscall codecvt_char_out(const codecvt_char*, int*, const char*,
125 const char*, const char**, char*, char*, char**);
126 int __thiscall codecvt_char_in(const codecvt_char*, int*, const char*,
127 const char*, const char**, char*, char*, char**);
128 int __thiscall codecvt_base_max_length(const codecvt_base*);
135 /* class codecvt<wchar> */
141 int __thiscall codecvt_wchar_unshift(const codecvt_wchar*, int*, char*, char*, char**);
142 int __thiscall codecvt_wchar_out(const codecvt_wchar*, int*, const wchar_t*,
143 const wchar_t*, const wchar_t**, char*, char*, char**);
144 int __thiscall codecvt_wchar_in(const codecvt_wchar*, int*, const char*,
145 const char*, const char**, wchar_t*, wchar_t*, wchar_t**);
147 /* class ctype_base */
152 /* class ctype<char> */
158 MSVCP_bool __thiscall ctype_char_is_ch(const ctype_char*, short, char);
159 char __thiscall ctype_char_narrow_ch(const ctype_char*, char, char);
160 char __thiscall ctype_char_widen_ch(const ctype_char*, char);
162 /* class ctype<wchar> */
169 MSVCP_bool __thiscall ctype_wchar_is_ch(const ctype_wchar*, short, wchar_t);
170 char __thiscall ctype_wchar_narrow_ch(const ctype_wchar*, wchar_t, char);
171 wchar_t __thiscall ctype_wchar_widen_ch(const ctype_wchar*, char);
176 struct _locale__Locimp *ptr;
179 locale* locale_ctor(locale*);
180 locale* locale_copy_ctor(locale*, const locale*);
181 locale* locale_operator_assign(locale*, const locale*);
182 void locale_dtor(locale*);
183 void free_locale(void);
184 codecvt_char* codecvt_char_use_facet(const locale*);
185 codecvt_wchar* codecvt_wchar_use_facet(const locale*);
186 codecvt_wchar* codecvt_short_use_facet(const locale*);
187 ctype_char* ctype_char_use_facet(const locale*);
188 ctype_wchar* ctype_wchar_use_facet(const locale*);
195 #define _LOCK_LOCALE 0
196 #define _LOCK_MALLOC 1
197 #define _LOCK_STREAM 2
198 #define _LOCK_DEBUG 3
201 void init_lockit(void);
202 void free_lockit(void);
203 _Lockit* __thiscall _Lockit_ctor_locktype(_Lockit*, int);
204 void __thiscall _Lockit_dtor(_Lockit*);
211 mutex* __thiscall mutex_ctor(mutex*);
212 void __thiscall mutex_dtor(mutex*);
213 void __thiscall mutex_lock(mutex*);
214 void __thiscall mutex_unlock(mutex*);
217 FMTFLAG_skipws = 0x0001,
218 FMTFLAG_unitbuf = 0x0002,
219 FMTFLAG_uppercase = 0x0004,
220 FMTFLAG_showbase = 0x0008,
221 FMTFLAG_showpoint = 0x0010,
222 FMTFLAG_showpos = 0x0020,
223 FMTFLAG_left = 0x0040,
224 FMTFLAG_right = 0x0080,
225 FMTFLAG_internal = 0x0100,
226 FMTFLAG_dec = 0x0200,
227 FMTFLAG_oct = 0x0400,
228 FMTFLAG_hex = 0x0800,
229 FMTFLAG_scientific = 0x1000,
230 FMTFLAG_fixed = 0x2000,
231 FMTFLAG_hexfloat = 0x3000,
232 FMTFLAG_boolalpha = 0x4000,
233 FMTFLAG_stdio = 0x8000,
234 FMTFLAG_adjustfield = FMTFLAG_left|FMTFLAG_right|FMTFLAG_internal,
235 FMTFLAG_basefield = FMTFLAG_dec|FMTFLAG_oct|FMTFLAG_hex,
236 FMTFLAG_floatfield = FMTFLAG_scientific|FMTFLAG_fixed,
237 FMTFLAG_mask = 0xffff
245 OPENMODE_trunc = 0x10,
246 OPENMODE__Nocreate = 0x40,
247 OPENMODE__Noreplace = 0x80,
248 OPENMODE_binary = 0x20,
260 IOSTATE_goodbit = 0x00,
261 IOSTATE_eofbit = 0x01,
262 IOSTATE_failbit = 0x02,
263 IOSTATE_badbit = 0x04,
264 IOSTATE__Hardfail = 0x10,
268 typedef struct _iosarray {
269 struct _iosarray *next;
282 typedef void (CDECL *IOS_BASE_event_callback)(IOS_BASE_event, struct _ios_base*, int);
283 typedef struct _fnarray {
284 struct _fnarray *next;
286 IOS_BASE_event_callback event_handler;
290 typedef struct _ios_base {
291 const vtable_ptr *vtable;
292 MSVCP_size_t DECLSPEC_ALIGN(8) stdstr;
298 IOS_BASE_iosarray *arr;
299 IOS_BASE_fnarray *calls;
303 /* class basic_streambuf<char> */
305 const vtable_ptr *vtable;
320 } basic_streambuf_char;
323 basic_streambuf_char *strbuf;
326 } istreambuf_iterator_char;
330 basic_streambuf_char *strbuf;
331 } ostreambuf_iterator_char;
333 int __thiscall basic_streambuf_char_sgetc(basic_streambuf_char*);
334 int __thiscall basic_streambuf_char_sbumpc(basic_streambuf_char*);
335 int __thiscall basic_streambuf_char_sputc(basic_streambuf_char*, char);
337 /* class basic_streambuf<wchar> */
339 const vtable_ptr *vtable;
354 } basic_streambuf_wchar;
357 basic_streambuf_wchar *strbuf;
360 } istreambuf_iterator_wchar;
364 basic_streambuf_wchar *strbuf;
365 } ostreambuf_iterator_wchar;
367 unsigned short __thiscall basic_streambuf_wchar_sgetc(basic_streambuf_wchar*);
368 unsigned short __thiscall basic_streambuf_wchar_sbumpc(basic_streambuf_wchar*);
369 unsigned short __thiscall basic_streambuf_wchar_sputc(basic_streambuf_wchar*, wchar_t);
371 /* class num_get<char> */
377 num_get* num_get_char_use_facet(const locale*);
378 istreambuf_iterator_char* __thiscall num_get_char_get_long(const num_get*, istreambuf_iterator_char*,
379 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONG*);
380 istreambuf_iterator_char* __thiscall num_get_char_get_ushort(const num_get*, istreambuf_iterator_char*,
381 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned short*);
382 istreambuf_iterator_char* __thiscall num_get_char_get_uint(const num_get*, istreambuf_iterator_char*,
383 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned int*);
384 istreambuf_iterator_char* __thiscall num_get_char_get_ulong(const num_get*, istreambuf_iterator_char*,
385 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONG*);
386 istreambuf_iterator_char* __thiscall num_get_char_get_float(const num_get*, istreambuf_iterator_char*,
387 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, float*);
388 istreambuf_iterator_char *__thiscall num_get_char_get_double(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_ldouble(const num_get*, istreambuf_iterator_char*,
391 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*);
392 istreambuf_iterator_char *__thiscall num_get_char_get_void(const num_get*, istreambuf_iterator_char*,
393 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, void**);
394 istreambuf_iterator_char *__thiscall num_get_char_get_int64(const num_get*, istreambuf_iterator_char*,
395 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONGLONG*);
396 istreambuf_iterator_char *__thiscall num_get_char_get_uint64(const num_get*, istreambuf_iterator_char*,
397 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONGLONG*);
398 istreambuf_iterator_char *__thiscall num_get_char_get_bool(const num_get*, istreambuf_iterator_char*,
399 istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, MSVCP_bool*);
401 num_get* num_get_wchar_use_facet(const locale*);
402 num_get* num_get_short_use_facet(const locale*);
403 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_long(const num_get*, istreambuf_iterator_wchar*,
404 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONG*);
405 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_ushort(const num_get*, istreambuf_iterator_wchar*,
406 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned short*);
407 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_uint(const num_get*, istreambuf_iterator_wchar*,
408 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned int*);
409 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_ulong(const num_get*, istreambuf_iterator_wchar*,
410 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONG*);
411 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_float(const num_get*, istreambuf_iterator_wchar*,
412 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, float*);
413 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_double(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_ldouble(const num_get*, istreambuf_iterator_wchar*,
416 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*);
417 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_void(const num_get*, istreambuf_iterator_wchar*,
418 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, void**);
419 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_int64(const num_get*, istreambuf_iterator_wchar*,
420 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONGLONG*);
421 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint64(const num_get*, istreambuf_iterator_wchar*,
422 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONGLONG*);
423 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_bool(const num_get*, istreambuf_iterator_wchar*,
424 istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, MSVCP_bool*);
426 /* class num_put<char> */
427 /* class num_put<wchar> */
433 num_put* num_put_char_use_facet(const locale*);
434 ostreambuf_iterator_char* __thiscall num_put_char_put_long(const num_put*, ostreambuf_iterator_char*,
435 ostreambuf_iterator_char, ios_base*, char, LONG);
436 ostreambuf_iterator_char* __thiscall num_put_char_put_ulong(const num_put*, ostreambuf_iterator_char*,
437 ostreambuf_iterator_char, ios_base*, char, ULONG);
438 ostreambuf_iterator_char* __thiscall num_put_char_put_double(const num_put*, ostreambuf_iterator_char*,
439 ostreambuf_iterator_char, ios_base*, char, double);
440 ostreambuf_iterator_char* __thiscall num_put_char_put_ldouble(const num_put*, ostreambuf_iterator_char*,
441 ostreambuf_iterator_char, ios_base*, char, double);
442 ostreambuf_iterator_char* __thiscall num_put_char_put_ptr(const num_put*, ostreambuf_iterator_char*,
443 ostreambuf_iterator_char, ios_base*, char, const void*);
444 ostreambuf_iterator_char* __thiscall num_put_char_put_int64(const num_put*, ostreambuf_iterator_char*,
445 ostreambuf_iterator_char, ios_base*, char, __int64);
446 ostreambuf_iterator_char* __thiscall num_put_char_put_uint64(const num_put*, ostreambuf_iterator_char*,
447 ostreambuf_iterator_char, ios_base*, char, unsigned __int64);
448 ostreambuf_iterator_char* __thiscall num_put_char_put_bool(const num_put*, ostreambuf_iterator_char*,
449 ostreambuf_iterator_char, ios_base*, char, MSVCP_bool);
451 num_put* num_put_wchar_use_facet(const locale*);
452 num_put* num_put_short_use_facet(const locale*);
453 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_long(const num_put*, ostreambuf_iterator_wchar*,
454 ostreambuf_iterator_wchar, ios_base*, wchar_t, LONG);
455 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ulong(const num_put*, ostreambuf_iterator_wchar*,
456 ostreambuf_iterator_wchar, ios_base*, wchar_t, ULONG);
457 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_double(const num_put*, ostreambuf_iterator_wchar*,
458 ostreambuf_iterator_wchar, ios_base*, wchar_t, double);
459 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ldouble(const num_put*, ostreambuf_iterator_wchar*,
460 ostreambuf_iterator_wchar, ios_base*, wchar_t, double);
461 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ptr(const num_put*, ostreambuf_iterator_wchar*,
462 ostreambuf_iterator_wchar, ios_base*, wchar_t, const void*);
463 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_int64(const num_put*, ostreambuf_iterator_wchar*,
464 ostreambuf_iterator_wchar, ios_base*, wchar_t, __int64);
465 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_uint64(const num_put*, ostreambuf_iterator_wchar*,
466 ostreambuf_iterator_wchar, ios_base*, wchar_t, unsigned __int64);
467 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_bool(const num_put*, ostreambuf_iterator_wchar*,
468 ostreambuf_iterator_wchar, ios_base*, wchar_t, MSVCP_bool);
470 void init_exception(void*);
471 void init_locale(void*);