msvcp90: Add initial basic_stringbuf<char> implementation.
[wine] / dlls / msvcp90 / msvcp90.h
1 /*
2  * Copyright 2010 Piotr Caban for CodeWeavers
3  *
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.
8  *
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.
13  *
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
17  */
18
19 #include "stdlib.h"
20 #include "windef.h"
21
22 typedef unsigned char MSVCP_bool;
23 typedef SIZE_T MSVCP_size_t;
24 typedef SSIZE_T streamoff;
25 typedef SSIZE_T streamsize;
26
27 void __cdecl _invalid_parameter(const wchar_t*, const wchar_t*,
28         const wchar_t*, unsigned int, uintptr_t);
29 BOOL __cdecl __uncaught_exception(void);
30
31 extern void* (__cdecl *MSVCRT_operator_new)(MSVCP_size_t);
32 extern void (__cdecl *MSVCRT_operator_delete)(void*);
33 extern void* (__cdecl *MSVCRT_set_new_handler)(void*);
34
35 /* Copied from dlls/msvcrt/cpp.c */
36 #ifdef __i386__  /* thiscall functions are i386-specific */
37
38 #define THISCALL(func) __thiscall_ ## func
39 #define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func)
40 #define __thiscall __stdcall
41 #define DEFINE_THISCALL_WRAPPER(func,args) \
42     extern void THISCALL(func)(void); \
43     __ASM_GLOBAL_FUNC(__thiscall_ ## func, \
44                       "popl %eax\n\t" \
45                       "pushl %ecx\n\t" \
46                       "pushl %eax\n\t" \
47                       "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
48 #else /* __i386__ */
49
50 #define THISCALL(func) func
51 #define THISCALL_NAME(func) __ASM_NAME(#func)
52 #define __thiscall __cdecl
53 #define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */
54
55 #endif /* __i386__ */
56
57 #ifdef _WIN64
58
59 #define VTABLE_ADD_FUNC(name) "\t.quad " THISCALL_NAME(name) "\n"
60
61 #define __ASM_VTABLE(name,funcs) \
62     __asm__(".data\n" \
63             "\t.align 8\n" \
64             "\t.quad " __ASM_NAME(#name "_rtti") "\n" \
65             "\t.globl " __ASM_NAME("MSVCP_" #name "_vtable") "\n" \
66             __ASM_NAME("MSVCP_" #name "_vtable") ":\n" \
67             "\t.quad " THISCALL_NAME(MSVCP_ ## name ## _vector_dtor) "\n" \
68             funcs "\n\t.text")
69
70 #else
71
72 #define VTABLE_ADD_FUNC(name) "\t.long " THISCALL_NAME(name) "\n"
73
74 #define __ASM_VTABLE(name,funcs) \
75     __asm__(".data\n" \
76             "\t.align 4\n" \
77             "\t.long " __ASM_NAME(#name "_rtti") "\n" \
78             "\t.globl " __ASM_NAME("MSVCP_" #name "_vtable") "\n" \
79             __ASM_NAME("MSVCP_" #name "_vtable") ":\n" \
80             "\t.long " THISCALL_NAME(MSVCP_ ## name ## _vector_dtor) "\n" \
81             funcs "\n\t.text")
82
83 #endif /* _WIN64 */
84
85 #define DEFINE_RTTI_DATA(name, off, base_classes, cl1, cl2, cl3, cl4, cl5, cl6, cl7, cl8, cl9, mangled_name) \
86 static const type_info name ## _type_info = { \
87     &MSVCP_type_info_vtable, \
88     NULL, \
89     mangled_name \
90 }; \
91 \
92 static const rtti_base_descriptor name ## _rtti_base_descriptor = { \
93     &name ##_type_info, \
94     base_classes, \
95     { 0, -1, 0}, \
96     64 \
97 }; \
98 \
99 static const rtti_base_array name ## _rtti_base_array = { \
100     { \
101         &name ## _rtti_base_descriptor, \
102         cl1, \
103         cl2, \
104         cl3, \
105         cl4, \
106         cl5, \
107         cl6, \
108         cl7, \
109         cl8, \
110         cl9, \
111     } \
112 }; \
113 \
114 static const rtti_object_hierarchy name ## _hierarchy = { \
115     0, \
116     0, \
117     base_classes+1, \
118     &name ## _rtti_base_array \
119 }; \
120 \
121 const rtti_object_locator name ## _rtti = { \
122     0, \
123     off, \
124     0, \
125     &name ## _type_info, \
126     &name ## _hierarchy \
127 }
128
129 #define DEFINE_RTTI_DATA0(name, off, mangled_name) \
130     DEFINE_RTTI_DATA(name, off, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, mangled_name)
131 #define DEFINE_RTTI_DATA1(name, off, cl1, mangled_name) \
132     DEFINE_RTTI_DATA(name, off, 1, cl1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, mangled_name)
133 #define DEFINE_RTTI_DATA2(name, off, cl1, cl2, mangled_name) \
134     DEFINE_RTTI_DATA(name, off, 2, cl1, cl2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, mangled_name)
135 #define DEFINE_RTTI_DATA3(name, off, cl1, cl2, cl3, mangled_name) \
136     DEFINE_RTTI_DATA(name, off, 3, cl1, cl2, cl3, NULL, NULL, NULL, NULL, NULL, NULL, mangled_name)
137 #define DEFINE_RTTI_DATA4(name, off, cl1, cl2, cl3, cl4, mangled_name) \
138     DEFINE_RTTI_DATA(name, off, 4, cl1, cl2, cl3, cl4, NULL, NULL, NULL, NULL, NULL, mangled_name)
139 #define DEFINE_RTTI_DATA8(name, off, cl1, cl2, cl3, cl4, cl5, cl6, cl7, cl8, mangled_name) \
140     DEFINE_RTTI_DATA(name, off, 8, cl1, cl2, cl3, cl4, cl5, cl6, cl7, cl8, NULL, mangled_name)
141 #define DEFINE_RTTI_DATA9(name, off, cl1, cl2, cl3, cl4, cl5, cl6, cl7, cl8, cl9, mangled_name) \
142     DEFINE_RTTI_DATA(name, off, 9, cl1, cl2, cl3, cl4, cl5, cl6, cl7, cl8, cl9, mangled_name)
143
144 #ifdef __i386__
145
146 #define CALL_VTBL_FUNC(this, off, ret, type, args) ((ret (WINAPI*)type)&vtbl_wrapper_##off)args
147
148 extern void *vtbl_wrapper_0;
149 extern void *vtbl_wrapper_4;
150 extern void *vtbl_wrapper_8;
151 extern void *vtbl_wrapper_12;
152 extern void *vtbl_wrapper_16;
153 extern void *vtbl_wrapper_20;
154 extern void *vtbl_wrapper_24;
155 extern void *vtbl_wrapper_28;
156 extern void *vtbl_wrapper_32;
157 extern void *vtbl_wrapper_36;
158 extern void *vtbl_wrapper_40;
159 extern void *vtbl_wrapper_44;
160 extern void *vtbl_wrapper_48;
161 extern void *vtbl_wrapper_52;
162 extern void *vtbl_wrapper_56;
163 extern void *vtbl_wrapper_60;
164
165 #else
166
167 #define CALL_VTBL_FUNC(this, off, ret, type, args) ((ret (__cdecl***)type)this)[0][off/4]args
168
169 #endif
170
171 /* exception object */
172 typedef void (*vtable_ptr)(void);
173 typedef struct __exception
174 {
175     const vtable_ptr *vtable;
176     char             *name;    /* Name of this exception, always a new copy for each object */
177     int               do_free; /* Whether to free 'name' in our dtor */
178 } exception;
179
180 /* Internal: throws selected exception */
181 typedef enum __exception_type {
182     EXCEPTION_RERAISE,
183     EXCEPTION,
184     EXCEPTION_BAD_ALLOC,
185     EXCEPTION_LOGIC_ERROR,
186     EXCEPTION_LENGTH_ERROR,
187     EXCEPTION_OUT_OF_RANGE,
188     EXCEPTION_INVALID_ARGUMENT,
189     EXCEPTION_RUNTIME_ERROR,
190     EXCEPTION_FAILURE,
191 } exception_type;
192 void throw_exception(exception_type, const char *);
193
194 /* rtti */
195 typedef struct __type_info
196 {
197     const vtable_ptr *vtable;
198     char              *name;         /* Unmangled name, allocated lazily */
199     char               mangled[128]; /* Variable length, but we declare it large enough for static RTTI */
200 } type_info;
201
202 extern const vtable_ptr MSVCP_type_info_vtable;
203
204 /* offsets for computing the this pointer */
205 typedef struct
206 {
207     int         this_offset;   /* offset of base class this pointer from start of object */
208     int         vbase_descr;   /* offset of virtual base class descriptor */
209     int         vbase_offset;  /* offset of this pointer offset in virtual base class descriptor */
210 } this_ptr_offsets;
211
212 typedef struct _rtti_base_descriptor
213 {
214     const type_info *type_descriptor;
215     int num_base_classes;
216     this_ptr_offsets offsets;    /* offsets for computing the this pointer */
217     unsigned int attributes;
218 } rtti_base_descriptor;
219
220 typedef struct _rtti_base_array
221 {
222     const rtti_base_descriptor *bases[10]; /* First element is the class itself */
223 } rtti_base_array;
224
225 typedef struct _rtti_object_hierarchy
226 {
227     unsigned int signature;
228     unsigned int attributes;
229     int array_len; /* Size of the array pointed to by 'base_classes' */
230     const rtti_base_array *base_classes;
231 } rtti_object_hierarchy;
232
233 typedef struct _rtti_object_locator
234 {
235     unsigned int signature;
236     int base_class_offset;
237     unsigned int flags;
238     const type_info *type_descriptor;
239     const rtti_object_hierarchy *type_hierarchy;
240 } rtti_object_locator;
241
242 /* basic_string<char, char_traits<char>, allocator<char>> */
243 #define BUF_SIZE_CHAR 16
244 typedef struct _basic_string_char
245 {
246     void *allocator;
247     union {
248         char buf[BUF_SIZE_CHAR];
249         char *ptr;
250     } data;
251     MSVCP_size_t size;
252     MSVCP_size_t res;
253 } basic_string_char;
254
255 basic_string_char* __thiscall MSVCP_basic_string_char_ctor(basic_string_char*);
256 basic_string_char* __stdcall MSVCP_basic_string_char_ctor_cstr(basic_string_char*, const char*);
257 basic_string_char* __thiscall MSVCP_basic_string_char_ctor_cstr_len(basic_string_char*, const char*, MSVCP_size_t);
258 basic_string_char* __stdcall MSVCP_basic_string_char_copy_ctor(basic_string_char*, const basic_string_char*);
259 void __stdcall MSVCP_basic_string_char_dtor(basic_string_char*);
260 const char* __stdcall MSVCP_basic_string_char_c_str(const basic_string_char*);
261 void __thiscall MSVCP_basic_string_char_clear(basic_string_char*);
262 basic_string_char* __thiscall MSVCP_basic_string_char_append_ch(basic_string_char*, char);
263 MSVCP_size_t __thiscall MSVCP_basic_string_char_length(const basic_string_char*);
264
265 #define BUF_SIZE_WCHAR 8
266 typedef struct _basic_string_wchar
267 {
268     void *allocator;
269     union {
270         wchar_t buf[BUF_SIZE_WCHAR];
271         wchar_t *ptr;
272     } data;
273     MSVCP_size_t size;
274     MSVCP_size_t res;
275 } basic_string_wchar;
276
277 basic_string_wchar* __thiscall MSVCP_basic_string_wchar_ctor_cstr(basic_string_wchar*, const wchar_t*);
278 void __thiscall MSVCP_basic_string_wchar_dtor(basic_string_wchar*);
279 const wchar_t* __thiscall MSVCP_basic_string_wchar_c_str(const basic_string_wchar*);
280 void __thiscall MSVCP_basic_string_wchar_clear(basic_string_wchar*);
281 basic_string_wchar* __thiscall MSVCP_basic_string_wchar_append_ch(basic_string_wchar*, wchar_t);
282 MSVCP_size_t __thiscall MSVCP_basic_string_wchar_length(const basic_string_wchar*);
283
284 char* __stdcall MSVCP_allocator_char_allocate(void*, MSVCP_size_t);
285 void __stdcall MSVCP_allocator_char_deallocate(void*, char*, MSVCP_size_t);
286 MSVCP_size_t __stdcall MSVCP_allocator_char_max_size(void*);
287 wchar_t* __stdcall MSVCP_allocator_wchar_allocate(void*, MSVCP_size_t);
288 void __stdcall MSVCP_allocator_wchar_deallocate(void*, wchar_t*, MSVCP_size_t);
289 MSVCP_size_t __stdcall MSVCP_allocator_wchar_max_size(void*);
290
291 /* class locale::facet */
292 typedef struct {
293     const vtable_ptr *vtable;
294     MSVCP_size_t refs;
295 } locale_facet;
296
297 typedef enum {
298     CODECVT_ok      = 0,
299     CODECVT_partial = 1,
300     CODECVT_error   = 2,
301     CODECVT_noconv  = 3
302 } codecvt_base_result;
303
304 typedef struct {
305     LCID handle;
306     unsigned page;
307     const short *table;
308     int delfl;
309 } _Ctypevec;
310
311 /* class codecvt_base */
312 typedef struct {
313     locale_facet facet;
314 } codecvt_base;
315
316 /* class codecvt<char> */
317 typedef struct {
318     codecvt_base base;
319 } codecvt_char;
320
321 MSVCP_bool __thiscall codecvt_base_always_noconv(const codecvt_base*);
322 int __thiscall codecvt_char_unshift(const codecvt_char*, int*, char*, char*, char**);
323 int __thiscall codecvt_char_out(const codecvt_char*, int*, const char*,
324         const char*, const char**, char*, char*, char**);
325 int __thiscall codecvt_char_in(const codecvt_char*, int*, const char*,
326         const char*, const char**, char*, char*, char**);
327 int __thiscall codecvt_base_max_length(const codecvt_base*);
328
329 typedef struct {
330     LCID handle;
331     unsigned page;
332 } _Cvtvec;
333
334 /* class codecvt<wchar> */
335 typedef struct {
336     codecvt_base base;
337     _Cvtvec cvt;
338 } codecvt_wchar;
339
340 /* class ctype_base */
341 typedef struct {
342     locale_facet facet;
343 } ctype_base;
344
345 /* class ctype<char> */
346 typedef struct {
347     ctype_base base;
348     _Ctypevec ctype;
349 } ctype_char;
350
351 MSVCP_bool __thiscall ctype_char_is_ch(const ctype_char*, short, char);
352 char __thiscall ctype_char_narrow_ch(const ctype_char*, char, char);
353 char __thiscall ctype_char_widen_ch(const ctype_char*, char);
354
355 /* class ctype<wchar> */
356 typedef struct {
357     ctype_base base;
358     _Ctypevec ctype;
359     _Cvtvec cvt;
360 } ctype_wchar;
361
362 MSVCP_bool __thiscall ctype_wchar_is_ch(const ctype_wchar*, short, wchar_t);
363 char __thiscall ctype_wchar_narrow_ch(const ctype_wchar*, wchar_t, char);
364 wchar_t __thiscall ctype_wchar_widen_ch(const ctype_wchar*, char);
365
366 /* class locale */
367 typedef struct
368 {
369     struct _locale__Locimp *ptr;
370 } locale;
371
372 locale* __thiscall locale_ctor(locale*);
373 locale* __thiscall locale_copy_ctor(locale*, const locale*);
374 locale* __thiscall locale_operator_assign(locale*, const locale*);
375 void __thiscall locale_dtor(locale*);
376 void free_locale(void);
377 codecvt_char* codecvt_char_use_facet(const locale*);
378 codecvt_char* codecvt_char_use_facet(const locale*);
379 ctype_char* ctype_char_use_facet(const locale*);
380 ctype_wchar* ctype_wchar_use_facet(const locale*);
381
382 /* class _Lockit */
383 typedef struct {
384     int locktype;
385 } _Lockit;
386
387 #define _LOCK_LOCALE 0
388 #define _LOCK_MALLOC 1
389 #define _LOCK_STREAM 2
390 #define _LOCK_DEBUG 3
391 #define _MAX_LOCK 4
392
393 void init_lockit(void);
394 void free_lockit(void);
395 _Lockit* __thiscall _Lockit_ctor_locktype(_Lockit*, int);
396 void __thiscall _Lockit_dtor(_Lockit*);
397
398 /* class mutex */
399 typedef struct {
400         void *mutex;
401 } mutex;
402
403 mutex* __thiscall mutex_ctor(mutex*);
404 void __thiscall mutex_dtor(mutex*);
405 void __thiscall mutex_lock(mutex*);
406 void __thiscall mutex_unlock(mutex*);
407
408 typedef enum {
409     FMTFLAG_skipws      = 0x0001,
410     FMTFLAG_unitbuf     = 0x0002,
411     FMTFLAG_uppercase   = 0x0004,
412     FMTFLAG_showbase    = 0x0008,
413     FMTFLAG_showpoint   = 0x0010,
414     FMTFLAG_showpos     = 0x0020,
415     FMTFLAG_left        = 0x0040,
416     FMTFLAG_right       = 0x0080,
417     FMTFLAG_internal    = 0x0100,
418     FMTFLAG_dec         = 0x0200,
419     FMTFLAG_oct         = 0x0400,
420     FMTFLAG_hex         = 0x0800,
421     FMTFLAG_scientific  = 0x1000,
422     FMTFLAG_fixed       = 0x2000,
423     FMTFLAG_hexfloat    = 0x3000,
424     FMTFLAG_boolalpha   = 0x4000,
425     FMTFLAG_stdio       = 0x8000,
426     FMTFLAG_adjustfield = FMTFLAG_left|FMTFLAG_right|FMTFLAG_internal,
427     FMTFLAG_basefield   = FMTFLAG_dec|FMTFLAG_oct|FMTFLAG_hex,
428     FMTFLAG_floatfield  = FMTFLAG_scientific|FMTFLAG_fixed,
429     FMTFLAG_mask        = 0xffff
430 } IOSB_fmtflags;
431
432 typedef enum {
433     OPENMODE_in         = 0x01,
434     OPENMODE_out        = 0x02,
435     OPENMODE_ate        = 0x04,
436     OPENMODE_app        = 0x08,
437     OPENMODE_trunc      = 0x10,
438     OPENMODE__Nocreate  = 0x40,
439     OPENMODE__Noreplace = 0x80,
440     OPENMODE_binary     = 0x20,
441     OPENMODE_mask       = 0xff
442 } IOSB_openmode;
443
444 typedef enum {
445     SEEKDIR_beg  = 0x1,
446     SEEKDIR_cur  = 0x2,
447     SEEKDIR_end  = 0x3,
448     SEEKDIR_mask = 0x3
449 } IOSB_seekdir;
450
451 typedef enum {
452     IOSTATE_goodbit   = 0x00,
453     IOSTATE_eofbit    = 0x01,
454     IOSTATE_failbit   = 0x02,
455     IOSTATE_badbit    = 0x04,
456     IOSTATE__Hardfail = 0x10,
457     IOSTATE_mask      = 0x17
458 } IOSB_iostate;
459
460 typedef struct _iosarray {
461     struct _iosarray *next;
462     int index;
463     int long_val;
464     void *ptr_val;
465 } IOS_BASE_iosarray;
466
467 typedef enum {
468     EVENT_erase_event,
469     EVENT_imbue_event,
470     EVENT_copyfmt_event
471 } IOS_BASE_event;
472
473 struct _ios_base;
474 typedef void (CDECL *IOS_BASE_event_callback)(IOS_BASE_event, struct _ios_base*, int);
475 typedef struct _fnarray {
476     struct _fnarray *next;
477     int index;
478     IOS_BASE_event_callback event_handler;
479 } IOS_BASE_fnarray;
480
481 /* class ios_base */
482 typedef struct _ios_base {
483     const vtable_ptr *vtable;
484     MSVCP_size_t stdstr;
485     IOSB_iostate state;
486     IOSB_iostate except;
487     IOSB_fmtflags fmtfl;
488     streamsize prec;
489     streamsize wide;
490     IOS_BASE_iosarray *arr;
491     IOS_BASE_fnarray *calls;
492     locale *loc;
493 } ios_base;
494
495 /* class basic_streambuf<char> */
496 typedef struct {
497     const vtable_ptr *vtable;
498     mutex lock;
499     char *rbuf;
500     char *wbuf;
501     char **prbuf;
502     char **pwbuf;
503     char *rpos;
504     char *wpos;
505     char **prpos;
506     char **pwpos;
507     int rsize;
508     int wsize;
509     int *prsize;
510     int *pwsize;
511     locale *loc;
512 } basic_streambuf_char;
513
514 typedef struct {
515     basic_streambuf_char *strbuf;
516     MSVCP_bool      got;
517     char            val;
518 } istreambuf_iterator_char;
519
520 typedef struct {
521     MSVCP_bool failed;
522     basic_streambuf_char *strbuf;
523 } ostreambuf_iterator_char;
524
525 int __thiscall basic_streambuf_char_sgetc(basic_streambuf_char*);
526 int __thiscall basic_streambuf_char_sbumpc(basic_streambuf_char*);
527 int __thiscall basic_streambuf_char_sputc(basic_streambuf_char*, char);
528
529 /* class basic_streambuf<wchar> */
530 typedef struct {
531     const vtable_ptr *vtable;
532     mutex lock;
533     wchar_t *rbuf;
534     wchar_t *wbuf;
535     wchar_t **prbuf;
536     wchar_t **pwbuf;
537     wchar_t *rpos;
538     wchar_t *wpos;
539     wchar_t **prpos;
540     wchar_t **pwpos;
541     int rsize;
542     int wsize;
543     int *prsize;
544     int *pwsize;
545     locale *loc;
546 } basic_streambuf_wchar;
547
548 typedef struct {
549     basic_streambuf_wchar *strbuf;
550     MSVCP_bool got;
551     wchar_t val;
552 } istreambuf_iterator_wchar;
553
554 typedef struct {
555     MSVCP_bool failed;
556     basic_streambuf_wchar *strbuf;
557 } ostreambuf_iterator_wchar;
558
559 unsigned short __thiscall basic_streambuf_wchar_sgetc(basic_streambuf_wchar*);
560 unsigned short __thiscall basic_streambuf_wchar_sbumpc(basic_streambuf_wchar*);
561 unsigned short __thiscall basic_streambuf_wchar_sputc(basic_streambuf_wchar*, wchar_t);
562
563 /* class num_get<char> */
564 typedef struct {
565     locale_facet facet;
566     _Cvtvec cvt;
567 } num_get;
568
569 num_get* num_get_char_use_facet(const locale*);
570 istreambuf_iterator_char* __thiscall num_get_char_get_long(const num_get*, istreambuf_iterator_char*,
571         istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONG*);
572 istreambuf_iterator_char* __thiscall num_get_char_get_ushort(const num_get*, istreambuf_iterator_char*,
573         istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned short*);
574 istreambuf_iterator_char* __thiscall num_get_char_get_uint(const num_get*, istreambuf_iterator_char*,
575         istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, unsigned int*);
576 istreambuf_iterator_char* __thiscall num_get_char_get_ulong(const num_get*, istreambuf_iterator_char*,
577         istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONG*);
578 istreambuf_iterator_char* __thiscall num_get_char_get_float(const num_get*, istreambuf_iterator_char*,
579         istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, float*);
580 istreambuf_iterator_char *__thiscall num_get_char_get_double(const num_get*, istreambuf_iterator_char*,
581         istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*);
582 istreambuf_iterator_char *__thiscall num_get_char_get_ldouble(const num_get*, istreambuf_iterator_char*,
583         istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, double*);
584 istreambuf_iterator_char *__thiscall num_get_char_get_void(const num_get*, istreambuf_iterator_char*,
585         istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, void**);
586 istreambuf_iterator_char *__thiscall num_get_char_get_int64(const num_get*, istreambuf_iterator_char*,
587         istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, LONGLONG*);
588 istreambuf_iterator_char *__thiscall num_get_char_get_uint64(const num_get*, istreambuf_iterator_char*,
589         istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, ULONGLONG*);
590 istreambuf_iterator_char *__thiscall num_get_char_get_bool(const num_get*, istreambuf_iterator_char*,
591         istreambuf_iterator_char, istreambuf_iterator_char, ios_base*, int*, MSVCP_bool*);
592
593 num_get* num_get_wchar_use_facet(const locale*);
594 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_long(const num_get*, istreambuf_iterator_wchar*,
595         istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONG*);
596 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_ushort(const num_get*, istreambuf_iterator_wchar*,
597         istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned short*);
598 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_uint(const num_get*, istreambuf_iterator_wchar*,
599         istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, unsigned int*);
600 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_ulong(const num_get*, istreambuf_iterator_wchar*,
601         istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONG*);
602 istreambuf_iterator_wchar* __thiscall num_get_wchar_get_float(const num_get*, istreambuf_iterator_wchar*,
603         istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, float*);
604 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_double(const num_get*, istreambuf_iterator_wchar*,
605         istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*);
606 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_ldouble(const num_get*, istreambuf_iterator_wchar*,
607         istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, double*);
608 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_void(const num_get*, istreambuf_iterator_wchar*,
609         istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, void**);
610 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_int64(const num_get*, istreambuf_iterator_wchar*,
611         istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, LONGLONG*);
612 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_uint64(const num_get*, istreambuf_iterator_wchar*,
613         istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, ULONGLONG*);
614 istreambuf_iterator_wchar *__thiscall num_get_wchar_get_bool(const num_get*, istreambuf_iterator_wchar*,
615         istreambuf_iterator_wchar, istreambuf_iterator_wchar, ios_base*, int*, MSVCP_bool*);
616
617 /* class num_put<char> */
618 /* class num_put<wchar> */
619 typedef struct {
620     locale_facet facet;
621     _Cvtvec cvt;
622 } num_put;
623
624 num_put* num_put_char_use_facet(const locale*);
625 ostreambuf_iterator_char* __thiscall num_put_char_put_long(const num_put*, ostreambuf_iterator_char*,
626         ostreambuf_iterator_char, ios_base*, char, LONG);
627 ostreambuf_iterator_char* __thiscall num_put_char_put_ulong(const num_put*, ostreambuf_iterator_char*,
628         ostreambuf_iterator_char, ios_base*, char, ULONG);
629 ostreambuf_iterator_char* __thiscall num_put_char_put_double(const num_put*, ostreambuf_iterator_char*,
630         ostreambuf_iterator_char, ios_base*, char, double);
631 ostreambuf_iterator_char* __thiscall num_put_char_put_ldouble(const num_put*, ostreambuf_iterator_char*,
632         ostreambuf_iterator_char, ios_base*, char, double);
633 ostreambuf_iterator_char* __thiscall num_put_char_put_ptr(const num_put*, ostreambuf_iterator_char*,
634         ostreambuf_iterator_char, ios_base*, char, const void*);
635 ostreambuf_iterator_char* __thiscall num_put_char_put_int64(const num_put*, ostreambuf_iterator_char*,
636         ostreambuf_iterator_char, ios_base*, char, __int64);
637 ostreambuf_iterator_char* __thiscall num_put_char_put_uint64(const num_put*, ostreambuf_iterator_char*,
638         ostreambuf_iterator_char, ios_base*, char, unsigned __int64);
639 ostreambuf_iterator_char* __thiscall num_put_char_put_bool(const num_put*, ostreambuf_iterator_char*,
640         ostreambuf_iterator_char, ios_base*, char, MSVCP_bool);
641
642 num_put* num_put_wchar_use_facet(const locale*);
643 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_long(const num_put*, ostreambuf_iterator_wchar*,
644         ostreambuf_iterator_wchar, ios_base*, wchar_t, LONG);
645 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ulong(const num_put*, ostreambuf_iterator_wchar*,
646         ostreambuf_iterator_wchar, ios_base*, wchar_t, ULONG);
647 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_double(const num_put*, ostreambuf_iterator_wchar*,
648         ostreambuf_iterator_wchar, ios_base*, wchar_t, double);
649 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ldouble(const num_put*, ostreambuf_iterator_wchar*,
650         ostreambuf_iterator_wchar, ios_base*, wchar_t, double);
651 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_ptr(const num_put*, ostreambuf_iterator_wchar*,
652         ostreambuf_iterator_wchar, ios_base*, wchar_t, const void*);
653 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_int64(const num_put*, ostreambuf_iterator_wchar*,
654         ostreambuf_iterator_wchar, ios_base*, wchar_t, __int64);
655 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_uint64(const num_put*, ostreambuf_iterator_wchar*,
656         ostreambuf_iterator_wchar, ios_base*, wchar_t, unsigned __int64);
657 ostreambuf_iterator_wchar* __thiscall num_put_wchar_put_bool(const num_put*, ostreambuf_iterator_wchar*,
658         ostreambuf_iterator_wchar, ios_base*, wchar_t, MSVCP_bool);
659
660 void init_io(void);
661 void free_io(void);