msvcp90: Added ios_base flags manipulators implementation.
[wine] / dlls / msvcp90 / ios.c
1 /*
2  * Copyright 2011 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 "config.h"
20
21 #include <stdarg.h>
22 #include <stdio.h>
23 #include <limits.h>
24 #include <share.h>
25
26 #include "msvcp90.h"
27 #include "windef.h"
28 #include "winbase.h"
29 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(msvcp);
31
32 /* ?_Index@ios_base@std@@0HA */
33 int ios_base_Index = 0;
34 /* ?_Sync@ios_base@std@@0_NA */
35 MSVCP_bool ios_base_Sync = FALSE;
36
37 typedef struct {
38     streamoff off;
39     __int64 DECLSPEC_ALIGN(8) pos;
40     int state;
41 } fpos_int;
42
43 static inline const char* debugstr_fpos_int(fpos_int *fpos)
44 {
45     return wine_dbg_sprintf("fpos(%ld %s %d)", fpos->off, wine_dbgstr_longlong(fpos->pos), fpos->state);
46 }
47
48 typedef struct {
49     void (__cdecl *pfunc)(ios_base*, streamsize);
50     streamsize arg;
51 } manip_streamsize;
52
53 typedef struct {
54     void (__cdecl *pfunc)(ios_base*, int);
55     int arg;
56 } manip_int;
57
58 typedef enum {
59     INITFL_new   = 0,
60     INITFL_open  = 1,
61     INITFL_close = 2
62 } basic_filebuf__Initfl;
63
64 typedef struct {
65     basic_streambuf_char base;
66     codecvt_char *cvt;
67     char putback;
68     MSVCP_bool wrotesome;
69     int state;
70     MSVCP_bool close;
71     FILE *file;
72 } basic_filebuf_char;
73
74 typedef struct {
75     basic_streambuf_wchar base;
76     codecvt_wchar *cvt;
77     wchar_t putback;
78     MSVCP_bool wrotesome;
79     int state;
80     MSVCP_bool close;
81     FILE *file;
82 } basic_filebuf_wchar;
83
84 typedef enum {
85     STRINGBUF_allocated = 1,
86     STRINGBUF_no_write = 2,
87     STRINGBUF_no_read = 4,
88     STRINGBUF_append = 8,
89     STRINGBUF_at_end = 16
90 } basic_stringbuf_state;
91
92 typedef struct {
93     basic_streambuf_char base;
94     char *seekhigh;
95     int state;
96     char allocator; /* empty struct */
97 } basic_stringbuf_char;
98
99 typedef struct {
100     basic_streambuf_wchar base;
101     wchar_t *seekhigh;
102     int state;
103     char allocator; /* empty struct */
104 } basic_stringbuf_wchar;
105
106 typedef struct {
107     ios_base base;
108     basic_streambuf_char *strbuf;
109     struct _basic_ostream_char *stream;
110     char fillch;
111 } basic_ios_char;
112
113 typedef struct {
114     ios_base base;
115     basic_streambuf_wchar *strbuf;
116     struct _basic_ostream_wchar *stream;
117     wchar_t fillch;
118 } basic_ios_wchar;
119
120 typedef struct _basic_ostream_char {
121     const int *vbtable;
122     /* virtual inheritance
123      * basic_ios_char basic_ios;
124      */
125 } basic_ostream_char;
126
127 typedef struct _basic_ostream_wchar {
128     const int *vbtable;
129     /* virtual inheritance
130      * basic_ios_wchar basic_ios;
131      */
132 } basic_ostream_wchar;
133
134 typedef struct {
135     const int *vbtable;
136     streamsize count;
137     /* virtual inheritance
138      * basic_ios_char basic_ios;
139      */
140 } basic_istream_char;
141
142 typedef struct {
143     const int *vbtable;
144     streamsize count;
145     /* virtual inheritance
146      * basic_ios_wchar basic_ios;
147      */
148 } basic_istream_wchar;
149
150 typedef struct {
151     basic_istream_char base1;
152     basic_ostream_char base2;
153     /* virtual inheritance
154      * basic_ios_char basic_ios;
155      */
156 } basic_iostream_char;
157
158 typedef struct {
159     basic_istream_wchar base1;
160     basic_ostream_wchar base2;
161     /* virtual inheritance
162      * basic_ios_wchar basic_ios;
163      */
164 } basic_iostream_wchar;
165
166 typedef struct {
167     basic_ostream_char base;
168     basic_filebuf_char filebuf;
169     /* virtual inheritance
170      * basic_ios_char basic_ios;
171      */
172 } basic_ofstream_char;
173
174 typedef struct {
175     basic_ostream_wchar base;
176     basic_filebuf_wchar filebuf;
177     /* virtual inheritance
178      * basic_ios_wchar basic_ios;
179      */
180 } basic_ofstream_wchar;
181
182 typedef struct {
183     basic_istream_char base;
184     basic_filebuf_char filebuf;
185     /* virtual inheritance
186      * basic_ios_char basic_ios;
187      */
188 } basic_ifstream_char;
189
190 typedef struct {
191     basic_istream_wchar base;
192     basic_filebuf_wchar filebuf;
193     /* virtual inheritance
194      * basic_ios_wchar basic_ios;
195      */
196 } basic_ifstream_wchar;
197
198 typedef struct {
199     basic_iostream_char base;
200     basic_filebuf_char filebuf;
201     /* virtual inheritance
202      * basic_ios_char basic_ios;
203      */
204 } basic_fstream_char;
205
206 typedef struct {
207     basic_iostream_wchar base;
208     basic_filebuf_wchar filebuf;
209     /* virtual inheritance
210      * basic_ios_char basic_ios;
211      */
212 } basic_fstream_wchar;
213
214 typedef struct {
215     basic_ostream_char base;
216     basic_stringbuf_char strbuf;
217     /* virtual inheritance
218      * basic_ios_char basic_ios;
219      */
220 } basic_ostringstream_char;
221
222 typedef struct {
223     basic_ostream_wchar base;
224     basic_stringbuf_wchar strbuf;
225     /* virtual inheritance
226      * basic_ios_wchar basic_ios;
227      */
228 } basic_ostringstream_wchar;
229
230 typedef struct {
231     basic_istream_char base;
232     basic_stringbuf_char strbuf;
233     /* virtual inheritance
234      * basic_ios_char basic_ios;
235      */
236 } basic_istringstream_char;
237
238 typedef struct {
239     basic_istream_wchar base;
240     basic_stringbuf_wchar strbuf;
241     /* virtual inheritance
242      * basic_ios_wchar basic_ios;
243      */
244 } basic_istringstream_wchar;
245
246 typedef struct {
247     basic_iostream_char base;
248     basic_stringbuf_char strbuf;
249     /* virtual inheritance
250      * basic_ios_char basic_ios;
251      */
252 } basic_stringstream_char;
253
254 typedef struct {
255     basic_iostream_wchar base;
256     basic_stringbuf_wchar strbuf;
257     /* virtual inheritance
258      * basic_ios_wchar basic_ios;
259      */
260 } basic_stringstream_wchar;
261
262 typedef enum {
263     STRSTATE_Allocated = 1,
264     STRSTATE_Constant = 2,
265     STRSTATE_Dynamic = 4,
266     STRSTATE_Frozen = 8
267 } strstreambuf__Strstate;
268
269 typedef struct {
270     basic_streambuf_char base;
271     streamsize minsize;
272     char *endsave;
273     char *seekhigh;
274     int strmode;
275     void* (__cdecl *palloc)(MSVCP_size_t);
276     void (__cdecl *pfree)(void*);
277 } strstreambuf;
278
279 extern const vtable_ptr MSVCP_iosb_vtable;
280
281 /* ??_7ios_base@std@@6B@ */
282 extern const vtable_ptr MSVCP_ios_base_vtable;
283
284 /* ??_7?$basic_ios@DU?$char_traits@D@std@@@std@@6B@ */
285 extern const vtable_ptr MSVCP_basic_ios_char_vtable;
286
287 /* ??_7?$basic_ios@_WU?$char_traits@_W@std@@@std@@6B@ */
288 extern const vtable_ptr MSVCP_basic_ios_wchar_vtable;
289
290 /* ??_7?$basic_ios@GU?$char_traits@G@std@@@std@@6B@ */
291 extern const vtable_ptr MSVCP_basic_ios_short_vtable;
292
293 /* ??_7?$basic_streambuf@DU?$char_traits@D@std@@@std@@6B@ */
294 extern const vtable_ptr MSVCP_basic_streambuf_char_vtable;
295
296 /* ??_7?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@6B@ */
297 extern const vtable_ptr MSVCP_basic_streambuf_wchar_vtable;
298
299 /* ??_7?$basic_streambuf@GU?$char_traits@G@std@@@std@@6B@ */
300 extern const vtable_ptr MSVCP_basic_streambuf_short_vtable;
301
302 /* ??_7?$basic_filebuf@DU?$char_traits@D@std@@@std@@6B@ */
303 extern const vtable_ptr MSVCP_basic_filebuf_char_vtable;
304
305 /* ??_7?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@6B@ */
306 extern const vtable_ptr MSVCP_basic_filebuf_wchar_vtable;
307
308 /* ??_7?$basic_filebuf@GU?$char_traits@G@std@@@std@@6B@ */
309 extern const vtable_ptr MSVCP_basic_filebuf_short_vtable;
310
311 /* ??_7?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@6B@ */
312 extern const vtable_ptr MSVCP_basic_stringbuf_char_vtable;
313
314 /* ??_7?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@6B@ */
315 extern const vtable_ptr MSVCP_basic_stringbuf_wchar_vtable;
316
317 /* ??_7?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@6B@ */
318 extern const vtable_ptr MSVCP_basic_stringbuf_short_vtable;
319
320 /* ??_8?$basic_ostream@DU?$char_traits@D@std@@@std@@7B@ */
321 const int basic_ostream_char_vbtable[] = {0, sizeof(basic_ostream_char)};
322 /* ??_7?$basic_ostream@DU?$char_traits@D@std@@@std@@6B@ */
323 extern const vtable_ptr MSVCP_basic_ostream_char_vtable;
324
325 /* ??_8?$basic_ostream@_WU?$char_traits@_W@std@@@std@@7B@ */
326 const int basic_ostream_wchar_vbtable[] = {0, sizeof(basic_ostream_wchar)};
327 /* ??_7?$basic_ostream@_WU?$char_traits@_W@std@@@std@@6B@ */
328 extern const vtable_ptr MSVCP_basic_ostream_wchar_vtable;
329
330 /* ??_8?$basic_ostream@GU?$char_traits@G@std@@@std@@7B@ */
331 const int basic_ostream_short_vbtable[] = {0, sizeof(basic_ostream_wchar)};
332 /* ??_7?$basic_ostream@GU?$char_traits@G@std@@@std@@6B@ */
333 extern const vtable_ptr MSVCP_basic_ostream_short_vtable;
334
335 /* ??_8?$basic_istream@DU?$char_traits@D@std@@@std@@7B@ */
336 const int basic_istream_char_vbtable[] = {0, sizeof(basic_istream_char)};
337 /* ??_7?$basic_istream@DU?$char_traits@D@std@@@std@@6B@ */
338 extern const vtable_ptr MSVCP_basic_istream_char_vtable;
339
340 /* ??_8?$basic_istream@_WU?$char_traits@_W@std@@@std@@7B@ */
341 const int basic_istream_wchar_vbtable[] = {0, sizeof(basic_istream_wchar)};
342 /* ??_7?$basic_istream@_WU?$char_traits@_W@std@@@std@@6B@ */
343 extern const vtable_ptr MSVCP_basic_istream_wchar_vtable;
344
345 /* ??_8?$basic_istream@GU?$char_traits@G@std@@@std@@7B@ */
346 const int basic_istream_short_vbtable[] = {0, sizeof(basic_istream_wchar)};
347 /* ??_7?$basic_istream@GU?$char_traits@G@std@@@std@@6B@ */
348 extern const vtable_ptr MSVCP_basic_istream_short_vtable;
349
350 /* ??_8?$basic_iostream@DU?$char_traits@D@std@@@std@@7B?$basic_istream@DU?$char_traits@D@std@@@1@@ */
351 const int basic_iostream_char_vbtable1[] = {0, sizeof(basic_iostream_char)};
352 /* ??_8?$basic_iostream@DU?$char_traits@D@std@@@std@@7B?$basic_ostream@DU?$char_traits@D@std@@@1@@ */
353 const int basic_iostream_char_vbtable2[] = {0, sizeof(basic_iostream_char)-FIELD_OFFSET(basic_iostream_char, base2)};
354 /* ??_7?$basic_iostream@DU?$char_traits@D@std@@@std@@6B@ */
355 extern const vtable_ptr MSVCP_basic_iostream_char_vtable;
356
357 /* ??_8?$basic_iostream@_WU?$char_traits@_W@std@@@std@@7B?$basic_istream@_WU?$char_traits@_W@std@@@1@@ */
358 /* ??_8?$basic_iostream@GU?$char_traits@G@std@@@std@@7B?$basic_istream@GU?$char_traits@G@std@@@1@@ */
359 const int basic_iostream_wchar_vbtable1[] = {0, sizeof(basic_iostream_wchar)};
360 /* ??_8?$basic_iostream@_WU?$char_traits@_W@std@@@std@@7B?$basic_ostream@_WU?$char_traits@_W@std@@@1@@ */
361 /* ??_8?$basic_iostream@GU?$char_traits@G@std@@@std@@7B?$basic_ostream@GU?$char_traits@G@std@@@1@@ */
362 const int basic_iostream_wchar_vbtable2[] = {0, sizeof(basic_iostream_wchar)-FIELD_OFFSET(basic_iostream_wchar, base2)};
363 /* ??_7?$basic_iostream@_WU?$char_traits@_W@std@@@std@@6B@ */
364 extern const vtable_ptr MSVCP_basic_iostream_wchar_vtable;
365 /* ??_7?$basic_iostream@GU?$char_traits@G@std@@@std@@6B@ */
366 extern const vtable_ptr MSVCP_basic_iostream_short_vtable;
367
368 /* ??_8?$basic_ofstream@DU?$char_traits@D@std@@@std@@7B@ */
369 const int basic_ofstream_char_vbtable[] = {0, sizeof(basic_ofstream_char)};
370 /* ??_7?$basic_ofstream@DU?$char_traits@D@std@@@std@@6B@ */
371 extern const vtable_ptr MSVCP_basic_ofstream_char_vtable;
372
373 /* ??_8?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@7B@ */
374 const int basic_ofstream_wchar_vbtable[] = {0, sizeof(basic_ofstream_wchar)};
375 /* ??_7?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@6B@ */
376 extern const vtable_ptr MSVCP_basic_ofstream_wchar_vtable;
377
378 /* ??_8?$basic_ofstream@GU?$char_traits@G@std@@@std@@7B@ */
379 const int basic_ofstream_short_vbtable[] = {0, sizeof(basic_ofstream_wchar)};
380 /* ??_7?$basic_ofstream@GU?$char_traits@G@std@@@std@@6B@ */
381 extern const vtable_ptr MSVCP_basic_ofstream_short_vtable;
382
383 /* ??_8?$basic_ifstream@DU?$char_traits@D@std@@@std@@7B@ */
384 const int basic_ifstream_char_vbtable[] = {0, sizeof(basic_ifstream_char)};
385 /* ??_7?$basic_ifstream@DU?$char_traits@D@std@@@std@@6B@ */
386 extern const vtable_ptr MSVCP_basic_ifstream_char_vtable;
387
388 /* ??_8?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@7B@ */
389 const int basic_ifstream_wchar_vbtable[] = {0, sizeof(basic_ifstream_wchar)};
390 /* ??_7?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@6B@ */
391 extern const vtable_ptr MSVCP_basic_ifstream_wchar_vtable;
392
393 /* ??_8?$basic_ifstream@GU?$char_traits@G@std@@@std@@7B@ */
394 const int basic_ifstream_short_vbtable[] = {0, sizeof(basic_ifstream_wchar)};
395 /* ??_7?$basic_ifstream@GU?$char_traits@G@std@@@std@@6B@ */
396 extern const vtable_ptr MSVCP_basic_ifstream_short_vtable;
397
398 /* ??_8?$basic_fstream@DU?$char_traits@D@std@@@std@@7B?$basic_istream@DU?$char_traits@D@std@@@1@@ */
399 const int basic_fstream_char_vbtable1[] = {0, sizeof(basic_fstream_char)};
400 /* ??_8?$basic_fstream@DU?$char_traits@D@std@@@std@@7B?$basic_ostream@DU?$char_traits@D@std@@@1@@ */
401 const int basic_fstream_char_vbtable2[] = {0, sizeof(basic_fstream_char)-FIELD_OFFSET(basic_fstream_char, base.base2)};
402 /* ??_7?$basic_fstream@DU?$char_traits@D@std@@@std@@6B@ */
403 extern const vtable_ptr MSVCP_basic_fstream_char_vtable;
404
405 /* ??_8?$basic_fstream@_WU?$char_traits@_W@std@@@std@@7B?$basic_istream@_WU?$char_traits@_W@std@@@1@@ */
406 /* ??_8?$basic_fstream@GU?$char_traits@G@std@@@std@@7B?$basic_istream@GU?$char_traits@G@std@@@1@@ */
407 const int basic_fstream_wchar_vbtable1[] = {0, sizeof(basic_fstream_wchar)};
408 /* ??_8?$basic_fstream@_WU?$char_traits@_W@std@@@std@@7B?$basic_ostream@_WU?$char_traits@_W@std@@@1@@ */
409 /* ??_8?$basic_fstream@GU?$char_traits@G@std@@@std@@7B?$basic_ostream@GU?$char_traits@G@std@@@1@@ */
410 const int basic_fstream_wchar_vbtable2[] = {0, sizeof(basic_fstream_wchar)-FIELD_OFFSET(basic_fstream_wchar, base.base2)};
411 /* ??_7?$basic_fstream@_WU?$char_traits@_W@std@@@std@@6B@ */
412 extern const vtable_ptr MSVCP_basic_fstream_wchar_vtable;
413 /* ??_7?$basic_fstream@GU?$char_traits@G@std@@@std@@6B@ */
414 extern const vtable_ptr MSVCP_basic_fstream_short_vtable;
415
416 /* ??_8?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@7B@ */
417 const int basic_ostringstream_char_vbtable[] = {0, sizeof(basic_ostringstream_char)};
418 /* ??_7?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@6B@ */
419 extern const vtable_ptr MSVCP_basic_ostringstream_char_vtable;
420
421 /* ??_8?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@7B@ */
422 const int basic_ostringstream_wchar_vbtable[] = {0, sizeof(basic_ostringstream_wchar)};
423 /* ??_7?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@6B@ */
424 extern const vtable_ptr MSVCP_basic_ostringstream_wchar_vtable;
425
426 /* ??_8?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@7B@ */
427 const int basic_ostringstream_short_vbtable[] = {0, sizeof(basic_ostringstream_wchar)};
428 /* ??_7?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@6B@ */
429 extern const vtable_ptr MSVCP_basic_ostringstream_short_vtable;
430
431 /* ??_8?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@7B@ */
432 const int basic_istringstream_char_vbtable[] = {0, sizeof(basic_istringstream_char)};
433 /* ??_7?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@6B@ */
434 extern const vtable_ptr MSVCP_basic_istringstream_char_vtable;
435
436 /* ??_8?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@7B@ */
437 const int basic_istringstream_wchar_vbtable[] = {0, sizeof(basic_istringstream_wchar)};
438 /* ??_7?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@6B@ */
439 extern const vtable_ptr MSVCP_basic_istringstream_wchar_vtable;
440
441 /* ??_8?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@7B@ */
442 const int basic_istringstream_short_vbtable[] = {0, sizeof(basic_istringstream_wchar)};
443 /* ??_7?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@6B@ */
444 extern const vtable_ptr MSVCP_basic_istringstream_short_vtable;
445
446 /* ??_8?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@7B?$basic_istream@DU?$char_traits@D@std@@@1@@ */
447 const int basic_stringstream_char_vbtable1[] = {0, sizeof(basic_stringstream_char)};
448 /* ??_8?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@7B?$basic_ostream@DU?$char_traits@D@std@@@1@@ */
449 const int basic_stringstream_char_vbtable2[] = {0, sizeof(basic_stringstream_char)-FIELD_OFFSET(basic_stringstream_char, base.base2)};
450 /* ??_7?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@6B@ */
451 extern const vtable_ptr MSVCP_basic_stringstream_char_vtable;
452
453 /* ??_8?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@7B?$basic_istream@_WU?$char_traits@_W@std@@@1@@ */
454 const int basic_stringstream_wchar_vbtable1[] = {0, sizeof(basic_stringstream_wchar)};
455 /* ??_8?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@7B?$basic_ostream@_WU?$char_traits@_W@std@@@1@@ */
456 const int basic_stringstream_wchar_vbtable2[] = {0, sizeof(basic_stringstream_wchar)-FIELD_OFFSET(basic_stringstream_wchar, base.base2)};
457 /* ??_7?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@6B@ */
458 extern const vtable_ptr MSVCP_basic_stringstream_wchar_vtable;
459
460 /* ??_8?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@7B?$basic_istream@GU?$char_traits@G@std@@@1@@ */
461 const int basic_stringstream_short_vbtable1[] = {0, sizeof(basic_stringstream_wchar)};
462 /* ??_8?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@7B?$basic_ostream@GU?$char_traits@G@std@@@1@@ */
463 const int basic_stringstream_short_vbtable2[] = {0, sizeof(basic_stringstream_wchar)-FIELD_OFFSET(basic_stringstream_wchar, base.base2)};
464 /* ??_7?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@6B@ */
465 extern const vtable_ptr MSVCP_basic_stringstream_short_vtable;
466
467 /* ??_7strstreambuf@std@@6B */
468 extern const vtable_ptr MSVCP_strstreambuf_vtable;
469
470 DEFINE_RTTI_DATA0(iosb, 0, ".?AV?$_Iosb@H@std@@");
471 DEFINE_RTTI_DATA1(ios_base, 0, &iosb_rtti_base_descriptor, ".?AV?$_Iosb@H@std@@");
472 DEFINE_RTTI_DATA2(basic_ios_char, 0, &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
473         ".?AV?$basic_ios@DU?$char_traits@D@std@@@std@@");
474 DEFINE_RTTI_DATA2(basic_ios_wchar, 0, &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
475         ".?AV?$basic_ios@_WU?$char_traits@_W@std@@@std@@");
476 DEFINE_RTTI_DATA2(basic_ios_short, 0, &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
477         ".?AV?$basic_ios@GU?$char_traits@G@std@@@std@@");
478 DEFINE_RTTI_DATA0(basic_streambuf_char, 0,
479         ".?AV?$basic_streambuf@DU?$char_traits@D@std@@@std@@");
480 DEFINE_RTTI_DATA0(basic_streambuf_wchar, 0,
481         ".?AV?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@");
482 DEFINE_RTTI_DATA0(basic_streambuf_short, 0,
483         ".?AV?$basic_streambuf@GU?$char_traits@G@std@@@std@@");
484 DEFINE_RTTI_DATA1(basic_filebuf_char, 0, &basic_streambuf_char_rtti_base_descriptor,
485         ".?AV?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@");
486 DEFINE_RTTI_DATA1(basic_filebuf_wchar, 0, &basic_streambuf_wchar_rtti_base_descriptor,
487         ".?AV?$basic_filebuf@GU?$char_traits@G@std@@@std@@");
488 DEFINE_RTTI_DATA1(basic_filebuf_short, 0, &basic_streambuf_short_rtti_base_descriptor,
489         ".?AV?$basic_filebuf@DU?$char_traits@D@std@@@std@@");
490 DEFINE_RTTI_DATA1(basic_stringbuf_char, 0, &basic_streambuf_char_rtti_base_descriptor,
491         ".?AV?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@");
492 DEFINE_RTTI_DATA1(basic_stringbuf_wchar, 0, &basic_streambuf_wchar_rtti_base_descriptor,
493         ".?AV?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@");
494 DEFINE_RTTI_DATA1(basic_stringbuf_short, 0, &basic_streambuf_short_rtti_base_descriptor,
495         ".?AV?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@");
496 DEFINE_RTTI_DATA3(basic_ostream_char, sizeof(basic_ostream_char), &basic_ios_char_rtti_base_descriptor,
497         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
498         ".?AV?$basic_ostream@DU?$char_traits@D@std@@@std@@");
499 DEFINE_RTTI_DATA3(basic_ostream_wchar, sizeof(basic_ostream_wchar), &basic_ios_wchar_rtti_base_descriptor,
500         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
501         ".?AV?$basic_ostream@_WU?$char_traits@_W@std@@@std@@");
502 DEFINE_RTTI_DATA3(basic_ostream_short, sizeof(basic_ostream_wchar), &basic_ios_short_rtti_base_descriptor,
503         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
504         ".?AV?$basic_ostream@GU?$char_traits@G@std@@@std@@");
505 DEFINE_RTTI_DATA3(basic_istream_char, sizeof(basic_istream_char), &basic_ios_char_rtti_base_descriptor,
506         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
507         ".?AV?$basic_istream@DU?$char_traits@D@std@@@std@@");
508 DEFINE_RTTI_DATA3(basic_istream_wchar, sizeof(basic_istream_wchar), &basic_ios_wchar_rtti_base_descriptor,
509         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
510         ".?AV?$basic_istream@_WU?$char_traits@_W@std@@@std@@");
511 DEFINE_RTTI_DATA3(basic_istream_short, sizeof(basic_istream_wchar), &basic_ios_short_rtti_base_descriptor,
512         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
513         ".?AV?$basic_istream@GU?$char_traits@G@std@@@std@@");
514 DEFINE_RTTI_DATA8(basic_iostream_char, sizeof(basic_iostream_char),
515         &basic_istream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
516         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
517         &basic_ostream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
518         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
519         ".?AV?$basic_iostream@DU?$char_traits@D@std@@@std@@");
520 DEFINE_RTTI_DATA8(basic_iostream_wchar, sizeof(basic_iostream_wchar),
521         &basic_istream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
522         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
523         &basic_ostream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
524         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
525         ".?AV?$basic_iostream@_WU?$char_traits@_W@std@@@std@@");
526 DEFINE_RTTI_DATA8(basic_iostream_short, sizeof(basic_iostream_wchar),
527         &basic_istream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
528         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
529         &basic_ostream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
530         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
531         ".?AV?$basic_iostream@GU?$char_traits@G@std@@@std@@");
532 DEFINE_RTTI_DATA4(basic_ofstream_char, sizeof(basic_ofstream_char),
533         &basic_ostream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
534         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
535         ".?AV?$basic_ofstream@DU?$char_traits@D@std@@@std@@");
536 DEFINE_RTTI_DATA4(basic_ofstream_wchar, sizeof(basic_ofstream_wchar),
537         &basic_ostream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
538         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
539         ".?AV?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@");
540 DEFINE_RTTI_DATA4(basic_ofstream_short, sizeof(basic_ofstream_wchar),
541         &basic_ostream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
542         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
543         ".?AV?$basic_ofstream@GU?$char_traits@G@std@@@std@@");
544 DEFINE_RTTI_DATA4(basic_ifstream_char, sizeof(basic_ifstream_char),
545         &basic_istream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
546         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
547         ".?AV?$basic_ifstream@DU?$char_traits@D@std@@@std@@");
548 DEFINE_RTTI_DATA4(basic_ifstream_wchar, sizeof(basic_ifstream_wchar),
549         &basic_istream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
550         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
551         ".?AV?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@");
552 DEFINE_RTTI_DATA4(basic_ifstream_short, sizeof(basic_ifstream_wchar),
553         &basic_istream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
554         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
555         ".?AV?$basic_ifstream@GU?$char_traits@G@std@@@std@@");
556 DEFINE_RTTI_DATA8(basic_fstream_char, sizeof(basic_fstream_char),
557         &basic_istream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
558         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
559         &basic_ostream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
560         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
561         ".?AV?$basic_fstream@DU?$char_traits@D@std@@@std@@");
562 DEFINE_RTTI_DATA8(basic_fstream_wchar, sizeof(basic_fstream_wchar),
563         &basic_istream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
564         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
565         &basic_ostream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
566         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
567         ".?AV?$basic_fstream@_WU?$char_traits@_W@std@@@std@@");
568 DEFINE_RTTI_DATA8(basic_fstream_short, sizeof(basic_fstream_wchar),
569         &basic_istream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
570         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
571         &basic_ostream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
572         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
573         ".?AV?$basic_fstream@GU?$char_traits@G@std@@@std@@");
574 DEFINE_RTTI_DATA4(basic_ostringstream_char, sizeof(basic_ostringstream_char),
575         &basic_ostream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
576         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
577         ".?AV?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@");
578 DEFINE_RTTI_DATA4(basic_ostringstream_wchar, sizeof(basic_ostringstream_wchar),
579         &basic_ostream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
580         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
581         ".?AV?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@");
582 DEFINE_RTTI_DATA4(basic_ostringstream_short, sizeof(basic_ostringstream_wchar),
583         &basic_ostream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
584         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
585         ".?AV?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@");
586 DEFINE_RTTI_DATA4(basic_istringstream_char, sizeof(basic_istringstream_char),
587         &basic_ostream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
588         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
589         ".?AV?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@");
590 DEFINE_RTTI_DATA4(basic_istringstream_wchar, sizeof(basic_istringstream_wchar),
591         &basic_ostream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
592         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
593         ".?AV?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@");
594 DEFINE_RTTI_DATA4(basic_istringstream_short, sizeof(basic_istringstream_wchar),
595         &basic_ostream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
596         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
597         ".?AV?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@");
598 DEFINE_RTTI_DATA8(basic_stringstream_char, sizeof(basic_stringstream_char),
599         &basic_istream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
600         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
601         &basic_ostream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
602         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
603         ".?AV?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@");
604 DEFINE_RTTI_DATA8(basic_stringstream_wchar, sizeof(basic_stringstream_wchar),
605         &basic_istream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
606         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
607         &basic_ostream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
608         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
609         ".?AV?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@");
610 DEFINE_RTTI_DATA8(basic_stringstream_short, sizeof(basic_stringstream_wchar),
611         &basic_istream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
612         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
613         &basic_ostream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
614         &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
615         ".?AV?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@");
616 DEFINE_RTTI_DATA1(strstreambuf, sizeof(strstreambuf),
617         &basic_streambuf_char_rtti_base_descriptor, ".?AVstrstreambuf@std@@");
618
619 #ifndef __GNUC__
620 void __asm_dummy_vtables(void) {
621 #endif
622     __ASM_VTABLE(iosb,
623             VTABLE_ADD_FUNC(iosb_vector_dtor));
624     __ASM_VTABLE(ios_base,
625             VTABLE_ADD_FUNC(ios_base_vector_dtor));
626     __ASM_VTABLE(basic_ios_char,
627             VTABLE_ADD_FUNC(basic_ios_char_vector_dtor));
628     __ASM_VTABLE(basic_ios_wchar,
629             VTABLE_ADD_FUNC(basic_ios_wchar_vector_dtor));
630     __ASM_VTABLE(basic_ios_short,
631             VTABLE_ADD_FUNC(basic_ios_wchar_vector_dtor));
632     __ASM_VTABLE(basic_streambuf_char,
633             VTABLE_ADD_FUNC(basic_streambuf_char_vector_dtor)
634             VTABLE_ADD_FUNC(basic_streambuf_char_overflow)
635             VTABLE_ADD_FUNC(basic_streambuf_char_pbackfail)
636             VTABLE_ADD_FUNC(basic_streambuf_char_showmanyc)
637             VTABLE_ADD_FUNC(basic_streambuf_char_underflow)
638             VTABLE_ADD_FUNC(basic_streambuf_char_uflow)
639             VTABLE_ADD_FUNC(basic_streambuf_char_xsgetn)
640             VTABLE_ADD_FUNC(basic_streambuf_char__Xsgetn_s)
641             VTABLE_ADD_FUNC(basic_streambuf_char_xsputn)
642             VTABLE_ADD_FUNC(basic_streambuf_char_seekoff)
643             VTABLE_ADD_FUNC(basic_streambuf_char_seekpos)
644             VTABLE_ADD_FUNC(basic_streambuf_char_setbuf)
645             VTABLE_ADD_FUNC(basic_streambuf_char_sync)
646             VTABLE_ADD_FUNC(basic_streambuf_char_imbue));
647     __ASM_VTABLE(basic_streambuf_wchar,
648             VTABLE_ADD_FUNC(basic_streambuf_wchar_vector_dtor)
649             VTABLE_ADD_FUNC(basic_streambuf_wchar_overflow)
650             VTABLE_ADD_FUNC(basic_streambuf_wchar_pbackfail)
651             VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
652             VTABLE_ADD_FUNC(basic_streambuf_wchar_underflow)
653             VTABLE_ADD_FUNC(basic_streambuf_wchar_uflow)
654             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
655             VTABLE_ADD_FUNC(basic_streambuf_wchar__Xsgetn_s)
656             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
657             VTABLE_ADD_FUNC(basic_streambuf_wchar_seekoff)
658             VTABLE_ADD_FUNC(basic_streambuf_wchar_seekpos)
659             VTABLE_ADD_FUNC(basic_streambuf_wchar_setbuf)
660             VTABLE_ADD_FUNC(basic_streambuf_wchar_sync)
661             VTABLE_ADD_FUNC(basic_streambuf_wchar_imbue));
662     __ASM_VTABLE(basic_streambuf_short,
663             VTABLE_ADD_FUNC(basic_streambuf_wchar_vector_dtor)
664             VTABLE_ADD_FUNC(basic_streambuf_wchar_overflow)
665             VTABLE_ADD_FUNC(basic_streambuf_wchar_pbackfail)
666             VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
667             VTABLE_ADD_FUNC(basic_streambuf_wchar_underflow)
668             VTABLE_ADD_FUNC(basic_streambuf_wchar_uflow)
669             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
670             VTABLE_ADD_FUNC(basic_streambuf_wchar__Xsgetn_s)
671             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
672             VTABLE_ADD_FUNC(basic_streambuf_wchar_seekoff)
673             VTABLE_ADD_FUNC(basic_streambuf_wchar_seekpos)
674             VTABLE_ADD_FUNC(basic_streambuf_wchar_setbuf)
675             VTABLE_ADD_FUNC(basic_streambuf_wchar_sync)
676             VTABLE_ADD_FUNC(basic_streambuf_wchar_imbue));
677     __ASM_VTABLE(basic_filebuf_char,
678             VTABLE_ADD_FUNC(basic_filebuf_char_vector_dtor)
679             VTABLE_ADD_FUNC(basic_filebuf_char_overflow)
680             VTABLE_ADD_FUNC(basic_filebuf_char_pbackfail)
681             VTABLE_ADD_FUNC(basic_streambuf_char_showmanyc)
682             VTABLE_ADD_FUNC(basic_filebuf_char_underflow)
683             VTABLE_ADD_FUNC(basic_filebuf_char_uflow)
684             VTABLE_ADD_FUNC(basic_streambuf_char_xsgetn)
685             VTABLE_ADD_FUNC(basic_streambuf_char__Xsgetn_s)
686             VTABLE_ADD_FUNC(basic_streambuf_char_xsputn)
687             VTABLE_ADD_FUNC(basic_filebuf_char_seekoff)
688             VTABLE_ADD_FUNC(basic_filebuf_char_seekpos)
689             VTABLE_ADD_FUNC(basic_filebuf_char_setbuf)
690             VTABLE_ADD_FUNC(basic_filebuf_char_sync)
691             VTABLE_ADD_FUNC(basic_filebuf_char_imbue));
692     __ASM_VTABLE(basic_filebuf_wchar,
693             VTABLE_ADD_FUNC(basic_filebuf_wchar_vector_dtor)
694             VTABLE_ADD_FUNC(basic_filebuf_wchar_overflow)
695             VTABLE_ADD_FUNC(basic_filebuf_wchar_pbackfail)
696             VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
697             VTABLE_ADD_FUNC(basic_filebuf_wchar_underflow)
698             VTABLE_ADD_FUNC(basic_filebuf_wchar_uflow)
699             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
700             VTABLE_ADD_FUNC(basic_streambuf_wchar__Xsgetn_s)
701             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
702             VTABLE_ADD_FUNC(basic_filebuf_wchar_seekoff)
703             VTABLE_ADD_FUNC(basic_filebuf_wchar_seekpos)
704             VTABLE_ADD_FUNC(basic_filebuf_wchar_setbuf)
705             VTABLE_ADD_FUNC(basic_filebuf_wchar_sync)
706             VTABLE_ADD_FUNC(basic_filebuf_wchar_imbue));
707     __ASM_VTABLE(basic_filebuf_short,
708             VTABLE_ADD_FUNC(basic_filebuf_wchar_vector_dtor)
709             VTABLE_ADD_FUNC(basic_filebuf_wchar_overflow)
710             VTABLE_ADD_FUNC(basic_filebuf_wchar_pbackfail)
711             VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
712             VTABLE_ADD_FUNC(basic_filebuf_wchar_underflow)
713             VTABLE_ADD_FUNC(basic_filebuf_wchar_uflow)
714             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
715             VTABLE_ADD_FUNC(basic_streambuf_wchar__Xsgetn_s)
716             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
717             VTABLE_ADD_FUNC(basic_filebuf_wchar_seekoff)
718             VTABLE_ADD_FUNC(basic_filebuf_wchar_seekpos)
719             VTABLE_ADD_FUNC(basic_filebuf_short_setbuf)
720             VTABLE_ADD_FUNC(basic_filebuf_wchar_sync)
721             VTABLE_ADD_FUNC(basic_filebuf_short_imbue));
722     __ASM_VTABLE(basic_stringbuf_char,
723             VTABLE_ADD_FUNC(basic_stringbuf_char_vector_dtor)
724             VTABLE_ADD_FUNC(basic_stringbuf_char_overflow)
725             VTABLE_ADD_FUNC(basic_stringbuf_char_pbackfail)
726             VTABLE_ADD_FUNC(basic_streambuf_char_showmanyc)
727             VTABLE_ADD_FUNC(basic_stringbuf_char_underflow)
728             VTABLE_ADD_FUNC(basic_streambuf_char_uflow)
729             VTABLE_ADD_FUNC(basic_streambuf_char_xsgetn)
730             VTABLE_ADD_FUNC(basic_streambuf_char__Xsgetn_s)
731             VTABLE_ADD_FUNC(basic_streambuf_char_xsputn)
732             VTABLE_ADD_FUNC(basic_stringbuf_char_seekoff)
733             VTABLE_ADD_FUNC(basic_stringbuf_char_seekpos)
734             VTABLE_ADD_FUNC(basic_streambuf_char_setbuf)
735             VTABLE_ADD_FUNC(basic_streambuf_char_sync)
736             VTABLE_ADD_FUNC(basic_streambuf_char_imbue));
737     __ASM_VTABLE(basic_stringbuf_wchar,
738             VTABLE_ADD_FUNC(basic_stringbuf_wchar_vector_dtor)
739             VTABLE_ADD_FUNC(basic_stringbuf_wchar_overflow)
740             VTABLE_ADD_FUNC(basic_stringbuf_wchar_pbackfail)
741             VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
742             VTABLE_ADD_FUNC(basic_stringbuf_wchar_underflow)
743             VTABLE_ADD_FUNC(basic_streambuf_wchar_uflow)
744             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
745             VTABLE_ADD_FUNC(basic_streambuf_wchar__Xsgetn_s)
746             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
747             VTABLE_ADD_FUNC(basic_stringbuf_wchar_seekoff)
748             VTABLE_ADD_FUNC(basic_stringbuf_wchar_seekpos)
749             VTABLE_ADD_FUNC(basic_streambuf_wchar_setbuf)
750             VTABLE_ADD_FUNC(basic_streambuf_wchar_sync)
751             VTABLE_ADD_FUNC(basic_streambuf_wchar_imbue));
752     __ASM_VTABLE(basic_stringbuf_short,
753             VTABLE_ADD_FUNC(basic_stringbuf_wchar_vector_dtor)
754             VTABLE_ADD_FUNC(basic_stringbuf_wchar_overflow)
755             VTABLE_ADD_FUNC(basic_stringbuf_wchar_pbackfail)
756             VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
757             VTABLE_ADD_FUNC(basic_stringbuf_wchar_underflow)
758             VTABLE_ADD_FUNC(basic_streambuf_wchar_uflow)
759             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
760             VTABLE_ADD_FUNC(basic_streambuf_wchar__Xsgetn_s)
761             VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
762             VTABLE_ADD_FUNC(basic_stringbuf_wchar_seekoff)
763             VTABLE_ADD_FUNC(basic_stringbuf_wchar_seekpos)
764             VTABLE_ADD_FUNC(basic_streambuf_wchar_setbuf)
765             VTABLE_ADD_FUNC(basic_streambuf_wchar_sync)
766             VTABLE_ADD_FUNC(basic_streambuf_wchar_imbue));
767     __ASM_VTABLE(basic_ostream_char,
768             VTABLE_ADD_FUNC(basic_ostream_char_vector_dtor));
769     __ASM_VTABLE(basic_ostream_wchar,
770             VTABLE_ADD_FUNC(basic_ostream_wchar_vector_dtor));
771     __ASM_VTABLE(basic_ostream_short,
772             VTABLE_ADD_FUNC(basic_ostream_wchar_vector_dtor));
773     __ASM_VTABLE(basic_istream_char,
774             VTABLE_ADD_FUNC(basic_istream_char_vector_dtor));
775     __ASM_VTABLE(basic_istream_wchar,
776             VTABLE_ADD_FUNC(basic_istream_wchar_vector_dtor));
777     __ASM_VTABLE(basic_istream_short,
778             VTABLE_ADD_FUNC(basic_istream_wchar_vector_dtor));
779     __ASM_VTABLE(basic_iostream_char,
780             VTABLE_ADD_FUNC(basic_iostream_char_vector_dtor));
781     __ASM_VTABLE(basic_iostream_wchar,
782             VTABLE_ADD_FUNC(basic_iostream_wchar_vector_dtor));
783     __ASM_VTABLE(basic_iostream_short,
784             VTABLE_ADD_FUNC(basic_iostream_wchar_vector_dtor));
785     __ASM_VTABLE(basic_ofstream_char,
786             VTABLE_ADD_FUNC(basic_ofstream_char_vector_dtor));
787     __ASM_VTABLE(basic_ofstream_wchar,
788             VTABLE_ADD_FUNC(basic_ofstream_wchar_vector_dtor));
789     __ASM_VTABLE(basic_ofstream_short,
790             VTABLE_ADD_FUNC(basic_ofstream_wchar_vector_dtor));
791     __ASM_VTABLE(basic_ifstream_char,
792             VTABLE_ADD_FUNC(basic_ifstream_char_vector_dtor));
793     __ASM_VTABLE(basic_ifstream_wchar,
794             VTABLE_ADD_FUNC(basic_ifstream_wchar_vector_dtor));
795     __ASM_VTABLE(basic_ifstream_short,
796             VTABLE_ADD_FUNC(basic_ifstream_wchar_vector_dtor));
797     __ASM_VTABLE(basic_fstream_char,
798             VTABLE_ADD_FUNC(basic_fstream_char_vector_dtor));
799     __ASM_VTABLE(basic_fstream_wchar,
800             VTABLE_ADD_FUNC(basic_fstream_wchar_vector_dtor));
801     __ASM_VTABLE(basic_fstream_short,
802             VTABLE_ADD_FUNC(basic_fstream_wchar_vector_dtor));
803     __ASM_VTABLE(basic_ostringstream_char,
804             VTABLE_ADD_FUNC(basic_ostringstream_char_vector_dtor));
805     __ASM_VTABLE(basic_ostringstream_wchar,
806             VTABLE_ADD_FUNC(basic_ostringstream_wchar_vector_dtor));
807     __ASM_VTABLE(basic_ostringstream_short,
808             VTABLE_ADD_FUNC(basic_ostringstream_wchar_vector_dtor));
809     __ASM_VTABLE(basic_istringstream_char,
810             VTABLE_ADD_FUNC(basic_istringstream_char_vector_dtor));
811     __ASM_VTABLE(basic_istringstream_wchar,
812             VTABLE_ADD_FUNC(basic_istringstream_wchar_vector_dtor));
813     __ASM_VTABLE(basic_istringstream_short,
814             VTABLE_ADD_FUNC(basic_istringstream_wchar_vector_dtor));
815     __ASM_VTABLE(basic_stringstream_char,
816             VTABLE_ADD_FUNC(basic_stringstream_char_vector_dtor));
817     __ASM_VTABLE(basic_stringstream_wchar,
818             VTABLE_ADD_FUNC(basic_stringstream_wchar_vector_dtor));
819     __ASM_VTABLE(basic_stringstream_short,
820             VTABLE_ADD_FUNC(basic_stringstream_wchar_vector_dtor));
821     __ASM_VTABLE(strstreambuf,
822             VTABLE_ADD_FUNC(strstreambuf_vector_dtor)
823             VTABLE_ADD_FUNC(strstreambuf_overflow)
824             VTABLE_ADD_FUNC(strstreambuf_pbackfail)
825             VTABLE_ADD_FUNC(basic_streambuf_char_showmanyc)
826             VTABLE_ADD_FUNC(strstreambuf_underflow)
827             VTABLE_ADD_FUNC(basic_streambuf_char_uflow)
828             VTABLE_ADD_FUNC(basic_streambuf_char_xsgetn)
829             VTABLE_ADD_FUNC(basic_streambuf_char__Xsgetn_s)
830             VTABLE_ADD_FUNC(basic_streambuf_char_xsputn)
831             VTABLE_ADD_FUNC(strstreambuf_seekoff)
832             VTABLE_ADD_FUNC(strstreambuf_seekpos)
833             VTABLE_ADD_FUNC(basic_streambuf_char_setbuf)
834             VTABLE_ADD_FUNC(basic_streambuf_char_sync)
835             VTABLE_ADD_FUNC(basic_streambuf_char_imbue));
836 #ifndef __GNUC__
837 }
838 #endif
839
840 /* ?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD00@Z */
841 /* ?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXPEAD00@Z */
842 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_setp_next, 16)
843 void __thiscall basic_streambuf_char_setp_next(basic_streambuf_char *this, char *first, char *next, char *last)
844 {
845     TRACE("(%p %p %p %p)\n", this, first, next, last);
846
847     this->wbuf = first;
848     this->wpos = next;
849     this->wsize = last-next;
850 }
851
852 /* ?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD0@Z */
853 /* ?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXPEAD0@Z */
854 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_setp, 12)
855 void __thiscall basic_streambuf_char_setp(basic_streambuf_char *this, char *first, char *last)
856 {
857     basic_streambuf_char_setp_next(this, first, first, last);
858 }
859
860 /* ?setg@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD00@Z */
861 /* ?setg@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXPEAD00@Z */
862 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_setg, 16)
863 void __thiscall basic_streambuf_char_setg(basic_streambuf_char *this, char *first, char *next, char *last)
864 {
865     TRACE("(%p %p %p %p)\n", this, first, next, last);
866
867     this->rbuf = first;
868     this->rpos = next;
869     this->rsize = last-next;
870 }
871
872 /* ?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXXZ */
873 /* ?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXXZ */
874 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Init_empty, 4)
875 void __thiscall basic_streambuf_char__Init_empty(basic_streambuf_char *this)
876 {
877     TRACE("(%p)\n", this);
878
879     this->prbuf = &this->rbuf;
880     this->pwbuf = &this->wbuf;
881     this->prpos = &this->rpos;
882     this->pwpos = &this->wpos;
883     this->prsize = &this->rsize;
884     this->pwsize = &this->wsize;
885
886     basic_streambuf_char_setp(this, NULL, NULL);
887     basic_streambuf_char_setg(this, NULL, NULL, NULL);
888 }
889
890 /* ??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAE@W4_Uninitialized@1@@Z */
891 /* ??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAA@W4_Uninitialized@1@@Z */
892 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_ctor_uninitialized, 8)
893 basic_streambuf_char* __thiscall basic_streambuf_char_ctor_uninitialized(basic_streambuf_char *this, int uninitialized)
894 {
895     TRACE("(%p %d)\n", this, uninitialized);
896     this->vtable = &MSVCP_basic_streambuf_char_vtable;
897     mutex_ctor(&this->lock);
898     return this;
899 }
900
901 /* ??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAE@XZ */
902 /* ??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAA@XZ */
903 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_ctor, 4)
904 basic_streambuf_char* __thiscall basic_streambuf_char_ctor(basic_streambuf_char *this)
905 {
906     TRACE("(%p)\n", this);
907
908     this->vtable = &MSVCP_basic_streambuf_char_vtable;
909     mutex_ctor(&this->lock);
910     this->loc = MSVCRT_operator_new(sizeof(locale));
911     locale_ctor(this->loc);
912     basic_streambuf_char__Init_empty(this);
913
914     return this;
915 }
916
917 /* ??1?$basic_streambuf@DU?$char_traits@D@std@@@std@@UAE@XZ */
918 /* ??1?$basic_streambuf@DU?$char_traits@D@std@@@std@@UEAA@XZ */
919 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_dtor, 4)
920 void __thiscall basic_streambuf_char_dtor(basic_streambuf_char *this)
921 {
922     TRACE("(%p)\n", this);
923
924     mutex_dtor(&this->lock);
925     locale_dtor(this->loc);
926     MSVCRT_operator_delete(this->loc);
927 }
928
929 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_vector_dtor, 8)
930 basic_streambuf_char* __thiscall basic_streambuf_char_vector_dtor(basic_streambuf_char *this, unsigned int flags)
931 {
932     TRACE("(%p %x)\n", this, flags);
933     if(flags & 2) {
934         /* we have an array, with the number of elements stored before the first object */
935         INT_PTR i, *ptr = (INT_PTR *)this-1;
936
937         for(i=*ptr-1; i>=0; i--)
938             basic_streambuf_char_dtor(this+i);
939         MSVCRT_operator_delete(ptr);
940     } else {
941         basic_streambuf_char_dtor(this);
942         if(flags & 1)
943             MSVCRT_operator_delete(this);
944     }
945
946     return this;
947 }
948
949 /* ?_Gnavail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEHXZ */
950 /* ?_Gnavail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBA_JXZ */
951 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Gnavail, 4)
952 streamsize __thiscall basic_streambuf_char__Gnavail(const basic_streambuf_char *this)
953 {
954     TRACE("(%p)\n", this);
955     return *this->prpos ? *this->prsize : 0;
956 }
957
958 /* ?_Gndec@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ */
959 /* ?_Gndec@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAPEADXZ */
960 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Gndec, 4)
961 char* __thiscall basic_streambuf_char__Gndec(basic_streambuf_char *this)
962 {
963     TRACE("(%p)\n", this);
964     (*this->prsize)++;
965     (*this->prpos)--;
966     return *this->prpos;
967 }
968
969 /* ?_Gninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ */
970 /* ?_Gninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAPEADXZ */
971 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Gninc, 4)
972 char* __thiscall basic_streambuf_char__Gninc(basic_streambuf_char *this)
973 {
974     TRACE("(%p)\n", this);
975     (*this->prsize)--;
976     return (*this->prpos)++;
977 }
978
979 /* ?_Gnpreinc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ */
980 /* ?_Gnpreinc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAPEADXZ */
981 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Gnpreinc, 4)
982 char* __thiscall basic_streambuf_char__Gnpreinc(basic_streambuf_char *this)
983 {
984     TRACE("(%p)\n", this);
985     (*this->prsize)--;
986     (*this->prpos)++;
987     return *this->prpos;
988 }
989
990 /* ?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAPAD0PAH001@Z */
991 /* ?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXPEAPEAD0PEAH001@Z */
992 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Init, 28)
993 void __thiscall basic_streambuf_char__Init(basic_streambuf_char *this, char **gf, char **gn, int *gc, char **pf, char **pn, int *pc)
994 {
995     TRACE("(%p %p %p %p %p %p %p)\n", this, gf, gn, gc, pf, pn, pc);
996
997     this->prbuf = gf;
998     this->pwbuf = pf;
999     this->prpos = gn;
1000     this->pwpos = pn;
1001     this->prsize = gc;
1002     this->pwsize = pc;
1003 }
1004
1005 /* ?_Lock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ */
1006 /* ?_Lock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAXXZ */
1007 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Lock, 4)
1008 void __thiscall basic_streambuf_char__Lock(basic_streambuf_char *this)
1009 {
1010     TRACE("(%p)\n", this);
1011     mutex_lock(&this->lock);
1012 }
1013
1014 /* ?_Pnavail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEHXZ */
1015 /* ?_Pnavail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBA_JXZ */
1016 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Pnavail, 4)
1017 streamsize __thiscall basic_streambuf_char__Pnavail(const basic_streambuf_char *this)
1018 {
1019     TRACE("(%p)\n", this);
1020     return *this->pwpos ? *this->pwsize : 0;
1021 }
1022
1023 /* ?_Pninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ */
1024 /* ?_Pninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAPEADXZ */
1025 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Pninc, 4)
1026 char* __thiscall basic_streambuf_char__Pninc(basic_streambuf_char *this)
1027 {
1028     TRACE("(%p)\n", this);
1029     (*this->pwsize)--;
1030     return (*this->pwpos)++;
1031 }
1032
1033 /* ?underflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
1034 /* ?underflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
1035 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_underflow, 4)
1036 #define call_basic_streambuf_char_underflow(this) CALL_VTBL_FUNC(this, 16, \
1037         int, (basic_streambuf_char*), (this))
1038 int __thiscall basic_streambuf_char_underflow(basic_streambuf_char *this)
1039 {
1040     TRACE("(%p)\n", this);
1041     return EOF;
1042 }
1043
1044 /* ?uflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
1045 /* ?uflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
1046 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_uflow, 4)
1047 #define call_basic_streambuf_char_uflow(this) CALL_VTBL_FUNC(this, 20, \
1048         int, (basic_streambuf_char*), (this))
1049 int __thiscall basic_streambuf_char_uflow(basic_streambuf_char *this)
1050 {
1051     int ret;
1052
1053     TRACE("(%p)\n", this);
1054
1055     if(call_basic_streambuf_char_underflow(this)==EOF)
1056         return EOF;
1057
1058     ret = **this->prpos;
1059     (*this->prsize)--;
1060     (*this->prpos)++;
1061     return ret;
1062 }
1063
1064 /* ?_Xsgetn_s@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHPADIH@Z */
1065 /* ?_Xsgetn_s@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JPEAD_K_J@Z */
1066 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Xsgetn_s, 16)
1067 #define call_basic_streambuf_char__Xsgetn_s(this, ptr, size, count) CALL_VTBL_FUNC(this, 28, \
1068         streamsize, (basic_streambuf_char*, char*, MSVCP_size_t, streamsize), (this, ptr, size, count))
1069 streamsize __thiscall basic_streambuf_char__Xsgetn_s(basic_streambuf_char *this, char *ptr, MSVCP_size_t size, streamsize count)
1070 {
1071     streamsize copied, chunk;
1072     int c;
1073
1074     TRACE("(%p %p %lu %ld)\n", this, ptr, size, count);
1075
1076     for(copied=0; copied<count && size;) {
1077         chunk = basic_streambuf_char__Gnavail(this);
1078         if(chunk > count-copied)
1079             chunk = count-copied;
1080
1081         if(chunk > 0) {
1082             memcpy_s(ptr+copied, size, *this->prpos, chunk);
1083             *this->prpos += chunk;
1084             *this->prsize -= chunk;
1085             copied += chunk;
1086             size -= chunk;
1087         }else if((c = call_basic_streambuf_char_uflow(this)) != EOF) {
1088             ptr[copied] = c;
1089             copied++;
1090             size--;
1091         }else {
1092             break;
1093         }
1094     }
1095
1096     return copied;
1097 }
1098
1099 /* ?_Sgetn_s@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPADIH@Z */
1100 /* ?_Sgetn_s@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA_JPEAD_K_J@Z */
1101 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Sgetn_s, 16)
1102 streamsize __thiscall basic_streambuf_char__Sgetn_s(basic_streambuf_char *this, char *ptr, MSVCP_size_t size, streamsize count)
1103 {
1104     TRACE("(%p %p %lu %ld)\n", this, ptr, size, count);
1105     return call_basic_streambuf_char__Xsgetn_s(this, ptr, size, count);
1106 }
1107
1108 /* ?_Unlock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ */
1109 /* ?_Unlock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAXXZ */
1110 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Unlock, 4)
1111 void __thiscall basic_streambuf_char__Unlock(basic_streambuf_char *this)
1112 {
1113     TRACE("(%p)\n", this);
1114     mutex_unlock(&this->lock);
1115 }
1116
1117 /* ?eback@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
1118 /* ?eback@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
1119 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_eback, 4)
1120 char* __thiscall basic_streambuf_char_eback(const basic_streambuf_char *this)
1121 {
1122     TRACE("(%p)\n", this);
1123     return *this->prbuf;
1124 }
1125
1126 /* ?gptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
1127 /* ?gptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
1128 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_gptr, 4)
1129 char* __thiscall basic_streambuf_char_gptr(const basic_streambuf_char *this)
1130 {
1131     TRACE("(%p)\n", this);
1132     return *this->prpos;
1133 }
1134
1135 /* ?egptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
1136 /* ?egptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
1137 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_egptr, 4)
1138 char* __thiscall basic_streambuf_char_egptr(const basic_streambuf_char *this)
1139 {
1140     TRACE("(%p)\n", this);
1141     return *this->prpos+*this->prsize;
1142 }
1143
1144 /* ?epptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
1145 /* ?epptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
1146 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_epptr, 4)
1147 char* __thiscall basic_streambuf_char_epptr(const basic_streambuf_char *this)
1148 {
1149     TRACE("(%p)\n", this);
1150     return *this->pwpos+*this->pwsize;
1151 }
1152
1153 /* ?gbump@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXH@Z */
1154 /* ?gbump@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXH@Z */
1155 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_gbump, 8)
1156 void __thiscall basic_streambuf_char_gbump(basic_streambuf_char *this, int off)
1157 {
1158     TRACE("(%p %d)\n", this, off);
1159     *this->prpos += off;
1160     *this->prsize -= off;
1161 }
1162
1163 /* ?getloc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QBE?AVlocale@2@XZ */
1164 /* ?getloc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEBA?AVlocale@2@XZ */
1165 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_getloc, 8)
1166 locale* __thiscall basic_streambuf_char_getloc(const basic_streambuf_char *this, locale *ret)
1167 {
1168     TRACE("(%p)\n", this);
1169     return locale_copy_ctor(ret, this->loc);
1170 }
1171
1172 /* ?imbue@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEXABVlocale@2@@Z */
1173 /* ?imbue@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAXAEBVlocale@2@@Z */
1174 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_imbue, 8)
1175 #define call_basic_streambuf_char_imbue(this, loc) CALL_VTBL_FUNC(this, 52, \
1176         void, (basic_streambuf_char*, const locale*), (this, loc))
1177 void __thiscall basic_streambuf_char_imbue(basic_streambuf_char *this, const locale *loc)
1178 {
1179     TRACE("(%p %p)\n", this, loc);
1180 }
1181
1182 /* ?overflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHH@Z */
1183 /* ?overflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHH@Z */
1184 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_overflow, 8)
1185 #define call_basic_streambuf_char_overflow(this, ch) CALL_VTBL_FUNC(this, 4, \
1186         int, (basic_streambuf_char*, int), (this, ch))
1187 int __thiscall basic_streambuf_char_overflow(basic_streambuf_char *this, int ch)
1188 {
1189     TRACE("(%p %d)\n", this, ch);
1190     return EOF;
1191 }
1192
1193 /* ?pbackfail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHH@Z */
1194 /* ?pbackfail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHH@Z */
1195 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pbackfail, 8)
1196 #define call_basic_streambuf_char_pbackfail(this, ch) CALL_VTBL_FUNC(this, 8, \
1197         int, (basic_streambuf_char*, int), (this, ch))
1198 int __thiscall basic_streambuf_char_pbackfail(basic_streambuf_char *this, int ch)
1199 {
1200     TRACE("(%p %d)\n", this, ch);
1201     return EOF;
1202 }
1203
1204 /* ?pbase@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
1205 /* ?pbase@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
1206 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pbase, 4)
1207 char* __thiscall basic_streambuf_char_pbase(const basic_streambuf_char *this)
1208 {
1209     TRACE("(%p)\n", this);
1210     return *this->pwbuf;
1211 }
1212
1213 /* ?pbump@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXH@Z */
1214 /* ?pbump@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXH@Z */
1215 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pbump, 8)
1216 void __thiscall basic_streambuf_char_pbump(basic_streambuf_char *this, int off)
1217 {
1218     TRACE("(%p %d)\n", this, off);
1219     *this->pwpos += off;
1220     *this->pwsize -= off;
1221 }
1222
1223 /* ?pptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
1224 /* ?pptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
1225 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pptr, 4)
1226 char* __thiscall basic_streambuf_char_pptr(const basic_streambuf_char *this)
1227 {
1228     TRACE("(%p)\n", this);
1229     return *this->pwpos;
1230 }
1231
1232 /* ?pubimbue@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
1233 /* ?pubimbue@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
1234 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubimbue, 12)
1235 locale* __thiscall basic_streambuf_char_pubimbue(basic_streambuf_char *this, locale *ret, const locale *loc)
1236 {
1237     TRACE("(%p %p)\n", this, loc);
1238     memcpy(ret, this->loc, sizeof(locale));
1239     call_basic_streambuf_char_imbue(this, loc);
1240     locale_copy_ctor(this->loc, loc);
1241     return ret;
1242 }
1243
1244 /* ?seekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
1245 /* ?seekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
1246 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_seekoff, 20)
1247 #define call_basic_streambuf_char_seekoff(this, ret, off, way, mode) CALL_VTBL_FUNC(this, 36, \
1248         fpos_int*, (basic_streambuf_char*, fpos_int*, streamoff, int, int), (this, ret, off, way, mode))
1249 fpos_int* __thiscall basic_streambuf_char_seekoff(basic_streambuf_char *this,
1250         fpos_int *ret, streamoff off, int way, int mode)
1251 {
1252     TRACE("(%p %ld %d %d)\n", this, off, way, mode);
1253     ret->off = 0;
1254     ret->pos = -1;
1255     ret->state = 0;
1256     return ret;
1257 }
1258
1259 /* ?pubseekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@JHH@Z */
1260 /* ?pubseekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@_JHH@Z */
1261 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubseekoff, 20)
1262 fpos_int* __thiscall basic_streambuf_char_pubseekoff(basic_streambuf_char *this,
1263         fpos_int *ret, streamoff off, int way, int mode)
1264 {
1265     TRACE("(%p %ld %d %d)\n", this, off, way, mode);
1266     return call_basic_streambuf_char_seekoff(this, ret, off, way, mode);
1267 }
1268
1269 /* ?pubseekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@JII@Z */
1270 /* ?pubseekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@_JII@Z */
1271 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubseekoff_old, 20)
1272 fpos_int* __thiscall basic_streambuf_char_pubseekoff_old(basic_streambuf_char *this,
1273         fpos_int *ret, streamoff off, unsigned int way, unsigned int mode)
1274 {
1275     TRACE("(%p %ld %d %d)\n", this, off, way, mode);
1276     return basic_streambuf_char_pubseekoff(this, ret, off, way, mode);
1277 }
1278
1279 /* ?seekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
1280 /* ?seekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
1281 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_seekpos, 36)
1282 #define call_basic_streambuf_char_seekpos(this, ret, pos, mode) CALL_VTBL_FUNC(this, 40, \
1283         fpos_int*, (basic_streambuf_char*, fpos_int*, fpos_int, int), (this, ret, pos, mode))
1284 fpos_int* __thiscall basic_streambuf_char_seekpos(basic_streambuf_char *this,
1285         fpos_int *ret, fpos_int pos, int mode)
1286 {
1287     TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
1288     ret->off = 0;
1289     ret->pos = -1;
1290     ret->state = 0;
1291     return ret;
1292 }
1293
1294 /* ?pubseekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@V32@H@Z */
1295 /* ?pubseekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@V32@H@Z */
1296 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubseekpos, 36)
1297 fpos_int* __thiscall basic_streambuf_char_pubseekpos(basic_streambuf_char *this,
1298         fpos_int *ret, fpos_int pos, int mode)
1299 {
1300     TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
1301     return call_basic_streambuf_char_seekpos(this, ret, pos, mode);
1302 }
1303
1304 /* ?pubseekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@V32@I@Z */
1305 /* ?pubseekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@V32@I@Z */
1306 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubseekpos_old, 36)
1307 fpos_int* __thiscall basic_streambuf_char_pubseekpos_old(basic_streambuf_char *this,
1308         fpos_int *ret, fpos_int pos, unsigned int mode)
1309 {
1310     TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
1311     return basic_streambuf_char_pubseekpos(this, ret, pos, mode);
1312 }
1313
1314 /* ?setbuf@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEPAV12@PADH@Z */
1315 /* ?setbuf@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAPEAV12@PEAD_J@Z */
1316 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_setbuf, 12)
1317 #define call_basic_streambuf_char_setbuf(this, buf, count) CALL_VTBL_FUNC(this, 44, \
1318         basic_streambuf_char*, (basic_streambuf_char*, char*, streamsize), (this, buf, count))
1319 basic_streambuf_char* __thiscall basic_streambuf_char_setbuf(basic_streambuf_char *this, char *buf, streamsize count)
1320 {
1321     TRACE("(%p %p %ld)\n", this, buf, count);
1322     return this;
1323 }
1324
1325 /* ?pubsetbuf@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PADH@Z */
1326 /* ?pubsetbuf@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEAD_J@Z */
1327 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubsetbuf, 12)
1328 basic_streambuf_char* __thiscall basic_streambuf_char_pubsetbuf(basic_streambuf_char *this, char *buf, streamsize count)
1329 {
1330     TRACE("(%p %p %ld)\n", this, buf, count);
1331     return call_basic_streambuf_char_setbuf(this, buf, count);
1332 }
1333
1334 /* ?sync@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
1335 /* ?sync@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
1336 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sync, 4)
1337 #define call_basic_streambuf_char_sync(this) CALL_VTBL_FUNC(this, 48, \
1338         int, (basic_streambuf_char*), (this))
1339 int __thiscall basic_streambuf_char_sync(basic_streambuf_char *this)
1340 {
1341     TRACE("(%p)\n", this);
1342     return 0;
1343 }
1344
1345 /* ?pubsync@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1346 /* ?pubsync@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ */
1347 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubsync, 4)
1348 int __thiscall basic_streambuf_char_pubsync(basic_streambuf_char *this)
1349 {
1350     TRACE("(%p)\n", this);
1351     return call_basic_streambuf_char_sync(this);
1352 }
1353
1354 /* ?sgetn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPADH@Z */
1355 /* ?sgetn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA_JPEAD_J@Z */
1356 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sgetn, 12)
1357 streamsize __thiscall basic_streambuf_char_sgetn(basic_streambuf_char *this, char *ptr, streamsize count)
1358 {
1359     TRACE("(%p %p %ld)\n", this, ptr, count);
1360     return call_basic_streambuf_char__Xsgetn_s(this, ptr, -1, count);
1361 }
1362
1363 /* ?showmanyc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
1364 /* ?showmanyc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JXZ */
1365 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_showmanyc, 4)
1366 #define call_basic_streambuf_char_showmanyc(this) CALL_VTBL_FUNC(this, 12, \
1367         streamsize, (basic_streambuf_char*), (this))
1368 streamsize __thiscall basic_streambuf_char_showmanyc(basic_streambuf_char *this)
1369 {
1370     TRACE("(%p)\n", this);
1371     return 0;
1372 }
1373
1374 /* ?in_avail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1375 /* ?in_avail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA_JXZ */
1376 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_in_avail, 4)
1377 streamsize __thiscall basic_streambuf_char_in_avail(basic_streambuf_char *this)
1378 {
1379     streamsize ret;
1380
1381     TRACE("(%p)\n", this);
1382
1383     ret = basic_streambuf_char__Gnavail(this);
1384     return ret ? ret : call_basic_streambuf_char_showmanyc(this);
1385 }
1386
1387 /* ?sputbackc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHD@Z */
1388 /* ?sputbackc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHD@Z */
1389 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sputbackc, 8)
1390 int __thiscall basic_streambuf_char_sputbackc(basic_streambuf_char *this, char ch)
1391 {
1392     TRACE("(%p %d)\n", this, ch);
1393     if(*this->prpos && *this->prpos>*this->prbuf && (*this->prpos)[-1]==ch) {
1394         (*this->prsize)++;
1395         (*this->prpos)--;
1396         return ch;
1397     }
1398
1399     return call_basic_streambuf_char_pbackfail(this, ch);
1400 }
1401
1402 /* ?sputc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHD@Z */
1403 /* ?sputc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHD@Z */
1404 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sputc, 8)
1405 int __thiscall basic_streambuf_char_sputc(basic_streambuf_char *this, char ch)
1406 {
1407     TRACE("(%p %d)\n", this, ch);
1408     return basic_streambuf_char__Pnavail(this) ?
1409         (*basic_streambuf_char__Pninc(this) = ch) :
1410         call_basic_streambuf_char_overflow(this, ch);
1411 }
1412
1413 /* ?sungetc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1414 /* ?sungetc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ */
1415 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sungetc, 4)
1416 int __thiscall basic_streambuf_char_sungetc(basic_streambuf_char *this)
1417 {
1418     TRACE("(%p)\n", this);
1419     if(*this->prpos && *this->prpos>*this->prbuf) {
1420         (*this->prsize)++;
1421         (*this->prpos)--;
1422         return **this->prpos;
1423     }
1424
1425     return call_basic_streambuf_char_pbackfail(this, EOF);
1426 }
1427
1428 /* ?stossc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ */
1429 /* ?stossc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAXXZ */
1430 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_stossc, 4)
1431 void __thiscall basic_streambuf_char_stossc(basic_streambuf_char *this)
1432 {
1433     TRACE("(%p)\n", this);
1434     if(basic_streambuf_char__Gnavail(this))
1435         basic_streambuf_char__Gninc(this);
1436     else
1437         call_basic_streambuf_char_uflow(this);
1438 }
1439
1440 /* ?sbumpc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1441 /* ?sbumpc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ */
1442 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sbumpc, 4)
1443 int __thiscall basic_streambuf_char_sbumpc(basic_streambuf_char *this)
1444 {
1445     TRACE("(%p)\n", this);
1446     return basic_streambuf_char__Gnavail(this) ?
1447         *basic_streambuf_char__Gninc(this) : call_basic_streambuf_char_uflow(this);
1448 }
1449
1450 /* ?sgetc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1451 /* ?sgetc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ */
1452 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sgetc, 4)
1453 int __thiscall basic_streambuf_char_sgetc(basic_streambuf_char *this)
1454 {
1455     TRACE("(%p)\n", this);
1456     return basic_streambuf_char__Gnavail(this) ?
1457         *basic_streambuf_char_gptr(this) : call_basic_streambuf_char_underflow(this);
1458 }
1459
1460 /* ?snextc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1461 /* ?snextc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ */
1462 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_snextc, 4)
1463 int __thiscall basic_streambuf_char_snextc(basic_streambuf_char *this)
1464 {
1465     TRACE("(%p)\n", this);
1466
1467     if(basic_streambuf_char__Gnavail(this) > 1)
1468         return *basic_streambuf_char__Gnpreinc(this);
1469     return basic_streambuf_char_sbumpc(this)==EOF ?
1470         EOF : basic_streambuf_char_sgetc(this);
1471 }
1472
1473 /* ?xsgetn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHPADH@Z */
1474 /* ?xsgetn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JPEAD_J@Z */
1475 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_xsgetn, 12)
1476 #define call_basic_streambuf_char_xsgetn(this, ptr, count) CALL_VTBL_FUNC(this, 24, \
1477         streamsize, (basic_streambuf_char*, char*, streamsize), (this, ptr, count))
1478 streamsize __thiscall basic_streambuf_char_xsgetn(basic_streambuf_char *this, char *ptr, streamsize count)
1479 {
1480     TRACE("(%p %p %ld)\n", this, ptr, count);
1481     return call_basic_streambuf_char__Xsgetn_s(this, ptr, -1, count);
1482 }
1483
1484 /* ?xsputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHPBDH@Z */
1485 /* ?xsputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JPEBD_J@Z */
1486 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_xsputn, 12)
1487 #define call_basic_streambuf_char_xsputn(this, ptr, count) CALL_VTBL_FUNC(this, 32, \
1488         streamsize, (basic_streambuf_char*, const char*, streamsize), (this, ptr, count))
1489 streamsize __thiscall basic_streambuf_char_xsputn(basic_streambuf_char *this, const char *ptr, streamsize count)
1490 {
1491     streamsize copied, chunk;
1492
1493     TRACE("(%p %p %ld)\n", this, ptr, count);
1494
1495     for(copied=0; copied<count;) {
1496         chunk = basic_streambuf_char__Pnavail(this);
1497         if(chunk > count-copied)
1498             chunk = count-copied;
1499
1500         if(chunk > 0) {
1501             memcpy(*this->pwpos, ptr+copied, chunk);
1502             *this->pwpos += chunk;
1503             *this->pwsize -= chunk;
1504             copied += chunk;
1505         }else if(call_basic_streambuf_char_overflow(this, ptr[copied]) != EOF) {
1506             copied++;
1507         }else {
1508             break;
1509         }
1510     }
1511
1512     return copied;
1513 }
1514
1515 /* ?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPBDH@Z */
1516 /* ?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA_JPEBD_J@Z */
1517 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sputn, 12)
1518 streamsize __thiscall basic_streambuf_char_sputn(basic_streambuf_char *this, const char *ptr, streamsize count)
1519 {
1520     TRACE("(%p %p %ld)\n", this, ptr, count);
1521     return call_basic_streambuf_char_xsputn(this, ptr, count);
1522 }
1523
1524 /* ?setp@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXPA_W00@Z */
1525 /* ?setp@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEA_W00@Z */
1526 /* ?setp@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXPAG00@Z */
1527 /* ?setp@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXPEAG00@Z */
1528 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_setp_next, 16)
1529 void __thiscall basic_streambuf_wchar_setp_next(basic_streambuf_wchar *this, wchar_t *first, wchar_t *next, wchar_t *last)
1530 {
1531     TRACE("(%p %p %p %p)\n", this, first, next, last);
1532
1533     this->wbuf = first;
1534     this->wpos = next;
1535     this->wsize = last-next;
1536 }
1537
1538 /* ?setp@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXPA_W0@Z */
1539 /* ?setp@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEA_W0@Z */
1540 /* ?setp@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXPAG0@Z */
1541 /* ?setp@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXPEAG0@Z */
1542 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_setp, 12)
1543 void __thiscall basic_streambuf_wchar_setp(basic_streambuf_wchar *this, wchar_t *first, wchar_t *last)
1544 {
1545     basic_streambuf_wchar_setp_next(this, first, first, last);
1546 }
1547
1548 /* ?setg@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXPA_W00@Z */
1549 /* ?setg@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEA_W00@Z */
1550 /* ?setg@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXPAG00@Z */
1551 /* ?setg@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXPEAG00@Z */
1552 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_setg, 16)
1553 void __thiscall basic_streambuf_wchar_setg(basic_streambuf_wchar *this, wchar_t *first, wchar_t *next, wchar_t *last)
1554 {
1555     TRACE("(%p %p %p %p)\n", this, first, next, last);
1556
1557     this->rbuf = first;
1558     this->rpos = next;
1559     this->rsize = last-next;
1560 }
1561
1562 /* ?_Init@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXXZ */
1563 /* ?_Init@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXXZ */
1564 /* ?_Init@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXXZ */
1565 /* ?_Init@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXXZ */
1566 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Init_empty, 4)
1567 void __thiscall basic_streambuf_wchar__Init_empty(basic_streambuf_wchar *this)
1568 {
1569     TRACE("(%p)\n", this);
1570
1571     this->prbuf = &this->rbuf;
1572     this->pwbuf = &this->wbuf;
1573     this->prpos = &this->rpos;
1574     this->pwpos = &this->wpos;
1575     this->prsize = &this->rsize;
1576     this->pwsize = &this->wsize;
1577
1578     basic_streambuf_wchar_setp(this, NULL, NULL);
1579     basic_streambuf_wchar_setg(this, NULL, NULL, NULL);
1580 }
1581
1582 /* ??0?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAE@W4_Uninitialized@1@@Z */
1583 /* ??0?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAA@W4_Uninitialized@1@@Z */
1584 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_ctor_uninitialized, 8)
1585 basic_streambuf_wchar* __thiscall basic_streambuf_wchar_ctor_uninitialized(basic_streambuf_wchar *this, int uninitialized)
1586 {
1587     TRACE("(%p %d)\n", this, uninitialized);
1588     this->vtable = &MSVCP_basic_streambuf_wchar_vtable;
1589     mutex_ctor(&this->lock);
1590     return this;
1591 }
1592
1593 /* ??0?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAE@W4_Uninitialized@1@@Z */
1594 /* ??0?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAA@W4_Uninitialized@1@@Z */
1595 DEFINE_THISCALL_WRAPPER(basic_streambuf_short_ctor_uninitialized, 8)
1596 basic_streambuf_wchar* __thiscall basic_streambuf_short_ctor_uninitialized(basic_streambuf_wchar *this, int uninitialized)
1597 {
1598     TRACE("(%p %d)\n", this, uninitialized);
1599     basic_streambuf_wchar_ctor_uninitialized(this, uninitialized);
1600     this->vtable = &MSVCP_basic_streambuf_short_vtable;
1601     return this;
1602 }
1603
1604 /* ??0?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAE@XZ */
1605 /* ??0?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAA@XZ */
1606 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_ctor, 4)
1607 basic_streambuf_wchar* __thiscall basic_streambuf_wchar_ctor(basic_streambuf_wchar *this)
1608 {
1609     TRACE("(%p)\n", this);
1610
1611     this->vtable = &MSVCP_basic_streambuf_wchar_vtable;
1612     mutex_ctor(&this->lock);
1613     this->loc = MSVCRT_operator_new(sizeof(locale));
1614     locale_ctor(this->loc);
1615     basic_streambuf_wchar__Init_empty(this);
1616
1617     return this;
1618 }
1619
1620 /* ??0?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAE@XZ */
1621 /* ??0?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAA@XZ */
1622 DEFINE_THISCALL_WRAPPER(basic_streambuf_short_ctor, 4)
1623 basic_streambuf_wchar* __thiscall basic_streambuf_short_ctor(basic_streambuf_wchar *this)
1624 {
1625     TRACE("(%p)\n", this);
1626     basic_streambuf_wchar_ctor(this);
1627     this->vtable = &MSVCP_basic_streambuf_short_vtable;
1628     return this;
1629 }
1630
1631 /* ??1?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
1632 /* ??1?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
1633 /* ??1?$basic_streambuf@GU?$char_traits@G@std@@@std@@UAE@XZ */
1634 /* ??1?$basic_streambuf@GU?$char_traits@G@std@@@std@@UEAA@XZ */
1635 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_dtor, 4)
1636 void __thiscall basic_streambuf_wchar_dtor(basic_streambuf_wchar *this)
1637 {
1638     TRACE("(%p)\n", this);
1639
1640     mutex_dtor(&this->lock);
1641     locale_dtor(this->loc);
1642     MSVCRT_operator_delete(this->loc);
1643 }
1644
1645 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_vector_dtor, 8)
1646 basic_streambuf_wchar* __thiscall basic_streambuf_wchar_vector_dtor(basic_streambuf_wchar *this, unsigned int flags)
1647 {
1648     TRACE("(%p %x)\n", this, flags);
1649     if(flags & 2) {
1650         /* we have an array, with the number of elements stored before the first object */
1651         INT_PTR i, *ptr = (INT_PTR *)this-1;
1652
1653         for(i=*ptr-1; i>=0; i--)
1654             basic_streambuf_wchar_dtor(this+i);
1655         MSVCRT_operator_delete(ptr);
1656     } else {
1657         basic_streambuf_wchar_dtor(this);
1658         if(flags & 1)
1659             MSVCRT_operator_delete(this);
1660     }
1661
1662     return this;
1663 }
1664
1665 /* ?_Gnavail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEHXZ */
1666 /* ?_Gnavail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBA_JXZ */
1667 /* ?_Gnavail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEHXZ */
1668 /* ?_Gnavail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBA_JXZ */
1669 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Gnavail, 4)
1670 streamsize __thiscall basic_streambuf_wchar__Gnavail(const basic_streambuf_wchar *this)
1671 {
1672     TRACE("(%p)\n", this);
1673     return *this->prpos ? *this->prsize : 0;
1674 }
1675
1676 /* ?_Gndec@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEPA_WXZ */
1677 /* ?_Gndec@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAPEA_WXZ */
1678 /* ?_Gndec@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEPAGXZ */
1679 /* ?_Gndec@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAPEAGXZ */
1680 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Gndec, 4)
1681 wchar_t* __thiscall basic_streambuf_wchar__Gndec(basic_streambuf_wchar *this)
1682 {
1683     TRACE("(%p)\n", this);
1684     (*this->prsize)++;
1685     (*this->prpos)--;
1686     return *this->prpos;
1687 }
1688
1689 /* ?_Gninc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEPA_WXZ */
1690 /* ?_Gninc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAPEA_WXZ */
1691 /* ?_Gninc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEPAGXZ */
1692 /* ?_Gninc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAPEAGXZ */
1693 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Gninc, 4)
1694 wchar_t* __thiscall basic_streambuf_wchar__Gninc(basic_streambuf_wchar *this)
1695 {
1696     TRACE("(%p)\n", this);
1697     (*this->prsize)--;
1698     return (*this->prpos)++;
1699 }
1700
1701 /* ?_Gnpreinc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEPA_WXZ */
1702 /* ?_Gnpreinc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAPEA_WXZ */
1703 /* ?_Gnpreinc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEPAGXZ */
1704 /* ?_Gnpreinc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAPEAGXZ */
1705 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Gnpreinc, 4)
1706 wchar_t* __thiscall basic_streambuf_wchar__Gnpreinc(basic_streambuf_wchar *this)
1707 {
1708     TRACE("(%p)\n", this);
1709     (*this->prsize)--;
1710     (*this->prpos)++;
1711     return *this->prpos;
1712 }
1713
1714 /* ?_Init@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXPAPA_W0PAH001@Z */
1715 /* ?_Init@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEAPEA_W0PEAH001@Z */
1716 /* ?_Init@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXPAPAG0PAH001@Z */
1717 /* ?_Init@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXPEAPEAG0PEAH001@Z */
1718 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Init, 28)
1719 void __thiscall basic_streambuf_wchar__Init(basic_streambuf_wchar *this, wchar_t **gf, wchar_t **gn, int *gc, wchar_t **pf, wchar_t **pn, int *pc)
1720 {
1721     TRACE("(%p %p %p %p %p %p %p)\n", this, gf, gn, gc, pf, pn, pc);
1722
1723     this->prbuf = gf;
1724     this->pwbuf = pf;
1725     this->prpos = gn;
1726     this->pwpos = pn;
1727     this->prsize = gc;
1728     this->pwsize = pc;
1729 }
1730
1731 /* ?_Lock@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
1732 /* ?_Lock@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
1733 /* ?_Lock@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEXXZ */
1734 /* ?_Lock@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAXXZ */
1735 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Lock, 4)
1736 void __thiscall basic_streambuf_wchar__Lock(basic_streambuf_wchar *this)
1737 {
1738     TRACE("(%p)\n", this);
1739     mutex_lock(&this->lock);
1740 }
1741
1742 /* ?_Pnavail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEHXZ */
1743 /* ?_Pnavail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBA_JXZ */
1744 /* ?_Pnavail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEHXZ */
1745 /* ?_Pnavail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBA_JXZ */
1746 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Pnavail, 4)
1747 streamsize __thiscall basic_streambuf_wchar__Pnavail(const basic_streambuf_wchar *this)
1748 {
1749     TRACE("(%p)\n", this);
1750     return *this->pwpos ? *this->pwsize : 0;
1751 }
1752
1753 /* ?_Pninc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEPA_WXZ */
1754 /* ?_Pninc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAPEA_WXZ */
1755 /* ?_Pninc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEPAGXZ */
1756 /* ?_Pninc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAPEAGXZ */
1757 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Pninc, 4)
1758 wchar_t* __thiscall basic_streambuf_wchar__Pninc(basic_streambuf_wchar *this)
1759 {
1760     TRACE("(%p)\n", this);
1761     (*this->pwsize)--;
1762     return (*this->pwpos)++;
1763 }
1764
1765 /* ?underflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEGXZ */
1766 /* ?underflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAGXZ */
1767 /* ?underflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEGXZ */
1768 /* ?underflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAGXZ */
1769 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_underflow, 4)
1770 #define call_basic_streambuf_wchar_underflow(this) CALL_VTBL_FUNC(this, 16, \
1771         unsigned short, (basic_streambuf_wchar*), (this))
1772 unsigned short __thiscall basic_streambuf_wchar_underflow(basic_streambuf_wchar *this)
1773 {
1774     TRACE("(%p)\n", this);
1775     return WEOF;
1776 }
1777
1778 /* ?uflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEGXZ */
1779 /* ?uflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAGXZ */
1780 /* ?uflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEGXZ */
1781 /* ?uflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAGXZ */
1782 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_uflow, 4)
1783 #define call_basic_streambuf_wchar_uflow(this) CALL_VTBL_FUNC(this, 20, \
1784         unsigned short, (basic_streambuf_wchar*), (this))
1785 unsigned short __thiscall basic_streambuf_wchar_uflow(basic_streambuf_wchar *this)
1786 {
1787     int ret;
1788
1789     TRACE("(%p)\n", this);
1790
1791     if(call_basic_streambuf_wchar_underflow(this)==WEOF)
1792         return WEOF;
1793
1794     ret = **this->prpos;
1795     (*this->prsize)--;
1796     (*this->prpos)++;
1797     return ret;
1798 }
1799
1800 /* ?_Xsgetn_s@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHPA_WIH@Z */
1801 /* ?_Xsgetn_s@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA_JPEA_W_K_J@Z */
1802 /* ?_Xsgetn_s@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHPAGIH@Z */
1803 /* ?_Xsgetn_s@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA_JPEAG_K_J@Z */
1804 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Xsgetn_s, 16)
1805 #define call_basic_streambuf_wchar__Xsgetn_s(this, ptr, size, count) CALL_VTBL_FUNC(this, 28, \
1806         streamsize, (basic_streambuf_wchar*, wchar_t*, MSVCP_size_t, streamsize), (this, ptr, size, count))
1807 streamsize __thiscall basic_streambuf_wchar__Xsgetn_s(basic_streambuf_wchar *this, wchar_t *ptr, MSVCP_size_t size, streamsize count)
1808 {
1809     streamsize copied, chunk;
1810     unsigned short c;
1811
1812     TRACE("(%p %p %lu %ld)\n", this, ptr, size, count);
1813
1814     for(copied=0; copied<count && size;) {
1815         chunk = basic_streambuf_wchar__Gnavail(this);
1816         if(chunk > count-copied)
1817             chunk = count-copied;
1818
1819         if(chunk > 0) {
1820             memcpy_s(ptr+copied, size, *this->prpos, chunk*sizeof(wchar_t));
1821             *this->prpos += chunk;
1822             *this->prsize -= chunk;
1823             copied += chunk;
1824             size -= chunk*sizeof(wchar_t);
1825         }else if((c = call_basic_streambuf_wchar_uflow(this)) != WEOF) {
1826             ptr[copied] = c;
1827             copied++;
1828             size--;
1829         }else {
1830             break;
1831         }
1832     }
1833
1834     return copied;
1835 }
1836
1837 /* ?_Sgetn_s@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEHPA_WIH@Z */
1838 /* ?_Sgetn_s@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA_JPEA_W_K_J@Z */
1839 /* ?_Sgetn_s@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEHPAGIH@Z */
1840 /* ?_Sgetn_s@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA_JPEAG_K_J@Z */
1841 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Sgetn_s, 16)
1842 streamsize __thiscall basic_streambuf_wchar__Sgetn_s(basic_streambuf_wchar *this, wchar_t *ptr, MSVCP_size_t size, streamsize count)
1843 {
1844     TRACE("(%p %p %lu %ld)\n", this, ptr, size, count);
1845     return call_basic_streambuf_wchar__Xsgetn_s(this, ptr, size, count);
1846 }
1847
1848 /* ?_Unlock@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
1849 /* ?_Unlock@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
1850 /* ?_Unlock@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEXXZ */
1851 /* ?_Unlock@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAXXZ */
1852 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Unlock, 4)
1853 void __thiscall basic_streambuf_wchar__Unlock(basic_streambuf_wchar *this)
1854 {
1855     TRACE("(%p)\n", this);
1856     mutex_unlock(&this->lock);
1857 }
1858
1859 /* ?eback@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1860 /* ?eback@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1861 /* ?eback@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1862 /* ?eback@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1863 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_eback, 4)
1864 wchar_t* __thiscall basic_streambuf_wchar_eback(const basic_streambuf_wchar *this)
1865 {
1866     TRACE("(%p)\n", this);
1867     return *this->prbuf;
1868 }
1869
1870 /* ?gptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1871 /* ?gptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1872 /* ?gptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1873 /* ?gptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1874 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_gptr, 4)
1875 wchar_t* __thiscall basic_streambuf_wchar_gptr(const basic_streambuf_wchar *this)
1876 {
1877     TRACE("(%p)\n", this);
1878     return *this->prpos;
1879 }
1880
1881 /* ?egptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1882 /* ?egptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1883 /* ?egptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1884 /* ?egptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1885 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_egptr, 4)
1886 wchar_t* __thiscall basic_streambuf_wchar_egptr(const basic_streambuf_wchar *this)
1887 {
1888     TRACE("(%p)\n", this);
1889     return *this->prpos+*this->prsize;
1890 }
1891
1892 /* ?epptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1893 /* ?epptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1894 /* ?epptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1895 /* ?epptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1896 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_epptr, 4)
1897 wchar_t* __thiscall basic_streambuf_wchar_epptr(const basic_streambuf_wchar *this)
1898 {
1899     TRACE("(%p)\n", this);
1900     return *this->pwpos+*this->pwsize;
1901 }
1902
1903 /* ?gbump@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXH@Z */
1904 /* ?gbump@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXH@Z */
1905 /* ?gbump@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXH@Z */
1906 /* ?gbump@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXH@Z */
1907 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_gbump, 8)
1908 void __thiscall basic_streambuf_wchar_gbump(basic_streambuf_wchar *this, int off)
1909 {
1910     TRACE("(%p %d)\n", this, off);
1911     *this->prpos += off;
1912     *this->prsize -= off;
1913 }
1914
1915 /* ?getloc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QBE?AVlocale@2@XZ */
1916 /* ?getloc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEBA?AVlocale@2@XZ */
1917 /* ?getloc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QBE?AVlocale@2@XZ */
1918 /* ?getloc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEBA?AVlocale@2@XZ */
1919 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_getloc, 8)
1920 locale* __thiscall basic_streambuf_wchar_getloc(const basic_streambuf_wchar *this, locale *ret)
1921 {
1922     TRACE("(%p)\n", this);
1923     return locale_copy_ctor(ret, this->loc);
1924 }
1925
1926 /* ?imbue@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEXABVlocale@2@@Z */
1927 /* ?imbue@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAXAEBVlocale@2@@Z */
1928 /* ?imbue@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEXABVlocale@2@@Z */
1929 /* ?imbue@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAXAEBVlocale@2@@Z */
1930 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_imbue, 8)
1931 #define call_basic_streambuf_wchar_imbue(this, loc) CALL_VTBL_FUNC(this, 52, \
1932         void, (basic_streambuf_wchar*, const locale*), (this, loc))
1933 void __thiscall basic_streambuf_wchar_imbue(basic_streambuf_wchar *this, const locale *loc)
1934 {
1935     TRACE("(%p %p)\n", this, loc);
1936 }
1937
1938 /* ?overflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEGG@Z */
1939 /* ?overflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAGG@Z */
1940 /* ?overflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEGG@Z */
1941 /* ?overflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAGG@Z */
1942 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_overflow, 8)
1943 #define call_basic_streambuf_wchar_overflow(this, ch) CALL_VTBL_FUNC(this, 4, \
1944         unsigned short, (basic_streambuf_wchar*, unsigned short), (this, ch))
1945 unsigned short __thiscall basic_streambuf_wchar_overflow(basic_streambuf_wchar *this, unsigned short ch)
1946 {
1947     TRACE("(%p %d)\n", this, ch);
1948     return WEOF;
1949 }
1950
1951 /* ?pbackfail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEGG@Z */
1952 /* ?pbackfail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAGG@Z */
1953 /* ?pbackfail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEGG@Z */
1954 /* ?pbackfail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAGG@Z */
1955 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pbackfail, 8)
1956 #define call_basic_streambuf_wchar_pbackfail(this, ch) CALL_VTBL_FUNC(this, 8, \
1957         unsigned short, (basic_streambuf_wchar*, unsigned short), (this, ch))
1958 unsigned short __thiscall basic_streambuf_wchar_pbackfail(basic_streambuf_wchar *this, unsigned short ch)
1959 {
1960     TRACE("(%p %d)\n", this, ch);
1961     return WEOF;
1962 }
1963
1964 /* ?pbase@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1965 /* ?pbase@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1966 /* ?pbase@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1967 /* ?pbase@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1968 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pbase, 4)
1969 wchar_t* __thiscall basic_streambuf_wchar_pbase(const basic_streambuf_wchar *this)
1970 {
1971     TRACE("(%p)\n", this);
1972     return *this->pwbuf;
1973 }
1974
1975 /* ?pbump@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXH@Z */
1976 /* ?pbump@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXH@Z */
1977 /* ?pbump@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXH@Z */
1978 /* ?pbump@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXH@Z */
1979 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pbump, 8)
1980 void __thiscall basic_streambuf_wchar_pbump(basic_streambuf_wchar *this, int off)
1981 {
1982     TRACE("(%p %d)\n", this, off);
1983     *this->pwpos += off;
1984     *this->pwsize -= off;
1985 }
1986
1987 /* ?pptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1988 /* ?pptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1989 /* ?pptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1990 /* ?pptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1991 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pptr, 4)
1992 wchar_t* __thiscall basic_streambuf_wchar_pptr(const basic_streambuf_wchar *this)
1993 {
1994     TRACE("(%p)\n", this);
1995     return *this->pwpos;
1996 }
1997
1998 /* ?pubimbue@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
1999 /* ?pubimbue@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
2000 /* ?pubimbue@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
2001 /* ?pubimbue@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
2002 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubimbue, 12)
2003 locale* __thiscall basic_streambuf_wchar_pubimbue(basic_streambuf_wchar *this, locale *ret, const locale *loc)
2004 {
2005     TRACE("(%p %p)\n", this, loc);
2006     memcpy(ret, this->loc, sizeof(locale));
2007     call_basic_streambuf_wchar_imbue(this, loc);
2008     locale_copy_ctor(this->loc, loc);
2009     return ret;
2010 }
2011
2012 /* ?seekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
2013 /* ?seekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
2014 /* ?seekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
2015 /* ?seekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
2016 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_seekoff, 20)
2017 #define call_basic_streambuf_wchar_seekoff(this, ret, off, way, mode) CALL_VTBL_FUNC(this, 36, \
2018         fpos_int*, (basic_streambuf_wchar*, fpos_int*, streamoff, int, int), (this, ret, off, way, mode))
2019 fpos_int* __thiscall basic_streambuf_wchar_seekoff(basic_streambuf_wchar *this,
2020         fpos_int *ret, streamoff off, int way, int mode)
2021 {
2022     TRACE("(%p %ld %d %d)\n", this, off, way, mode);
2023     ret->off = 0;
2024     ret->pos = -1;
2025     ret->state = 0;
2026     return ret;
2027 }
2028
2029 /* ?pubseekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@JHH@Z */
2030 /* ?pubseekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@_JHH@Z */
2031 /* ?pubseekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@JHH@Z */
2032 /* ?pubseekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@_JHH@Z */
2033 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubseekoff, 20)
2034 fpos_int* __thiscall basic_streambuf_wchar_pubseekoff(basic_streambuf_wchar *this,
2035         fpos_int *ret, streamoff off, int way, int mode)
2036 {
2037     TRACE("(%p %ld %d %d)\n", this, off, way, mode);
2038     return call_basic_streambuf_wchar_seekoff(this, ret, off, way, mode);
2039 }
2040
2041 /* ?pubseekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@JII@Z */
2042 /* ?pubseekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@_JII@Z */
2043 /* ?pubseekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@JII@Z */
2044 /* ?pubseekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@_JII@Z */
2045 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubseekoff_old, 20)
2046 fpos_int* __thiscall basic_streambuf_wchar_pubseekoff_old(basic_streambuf_wchar *this,
2047         fpos_int *ret, streamoff off, unsigned int way, unsigned int mode)
2048 {
2049     TRACE("(%p %ld %d %d)\n", this, off, way, mode);
2050     return basic_streambuf_wchar_pubseekoff(this, ret, off, way, mode);
2051 }
2052
2053 /* ?seekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
2054 /* ?seekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
2055 /* ?seekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
2056 /* ?seekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
2057 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_seekpos, 36)
2058 #define call_basic_streambuf_wchar_seekpos(this, ret, pos, mode) CALL_VTBL_FUNC(this, 40, \
2059         fpos_int*, (basic_streambuf_wchar*, fpos_int*, fpos_int, int), (this, ret, pos, mode))
2060 fpos_int* __thiscall basic_streambuf_wchar_seekpos(basic_streambuf_wchar *this,
2061         fpos_int *ret, fpos_int pos, int mode)
2062 {
2063     TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
2064     ret->off = 0;
2065     ret->pos = -1;
2066     ret->state = 0;
2067     return ret;
2068 }
2069
2070 /* ?pubseekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@V32@H@Z */
2071 /* ?pubseekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@V32@H@Z */
2072 /* ?pubseekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@V32@H@Z */
2073 /* ?pubseekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@V32@H@Z */
2074 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubseekpos, 36)
2075 fpos_int* __thiscall basic_streambuf_wchar_pubseekpos(basic_streambuf_wchar *this,
2076         fpos_int *ret, fpos_int pos, int mode)
2077 {
2078     TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
2079     return call_basic_streambuf_wchar_seekpos(this, ret, pos, mode);
2080 }
2081
2082 /* ?pubseekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@V32@I@Z */
2083 /* ?pubseekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@V32@I@Z */
2084 /* ?pubseekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@V32@I@Z */
2085 /* ?pubseekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@V32@I@Z */
2086 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubseekpos_old, 36)
2087 fpos_int* __thiscall basic_streambuf_wchar_pubseekpos_old(basic_streambuf_wchar *this,
2088         fpos_int *ret, fpos_int pos, unsigned int mode)
2089 {
2090     TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
2091     return basic_streambuf_wchar_pubseekpos(this, ret, pos, mode);
2092 }
2093
2094 /* ?setbuf@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEPAV12@PA_WH@Z */
2095 /* ?setbuf@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAPEAV12@PEA_W_J@Z */
2096 /* ?setbuf@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEPAV12@PAGH@Z */
2097 /* ?setbuf@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAPEAV12@PEAG_J@Z */
2098 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_setbuf, 12)
2099 #define call_basic_streambuf_wchar_setbuf(this, buf, count) CALL_VTBL_FUNC(this, 44, \
2100         basic_streambuf_wchar*, (basic_streambuf_wchar*, wchar_t*, streamsize), (this, buf, count))
2101 basic_streambuf_wchar* __thiscall basic_streambuf_wchar_setbuf(basic_streambuf_wchar *this, wchar_t *buf, streamsize count)
2102 {
2103     TRACE("(%p %p %ld)\n", this, buf, count);
2104     return this;
2105 }
2106
2107 /* ?pubsetbuf@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PA_WH@Z */
2108 /* ?pubsetbuf@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEA_W_J@Z */
2109 /* ?pubsetbuf@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PAGH@Z */
2110 /* ?pubsetbuf@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEAG_J@Z */
2111 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubsetbuf, 12)
2112 basic_streambuf_wchar* __thiscall basic_streambuf_wchar_pubsetbuf(basic_streambuf_wchar *this, wchar_t *buf, streamsize count)
2113 {
2114     TRACE("(%p %p %ld)\n", this, buf, count);
2115     return call_basic_streambuf_wchar_setbuf(this, buf, count);
2116 }
2117
2118 /* ?sync@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHXZ */
2119 /* ?sync@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAHXZ */
2120 /* ?sync@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHXZ */
2121 /* ?sync@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAHXZ */
2122 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sync, 4)
2123 #define call_basic_streambuf_wchar_sync(this) CALL_VTBL_FUNC(this, 48, \
2124         int, (basic_streambuf_wchar*), (this))
2125 int __thiscall basic_streambuf_wchar_sync(basic_streambuf_wchar *this)
2126 {
2127     TRACE("(%p)\n", this);
2128     return 0;
2129 }
2130
2131 /* ?pubsync@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEHXZ */
2132 /* ?pubsync@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAHXZ */
2133 /* ?pubsync@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEHXZ */
2134 /* ?pubsync@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAHXZ */
2135 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubsync, 4)
2136 int __thiscall basic_streambuf_wchar_pubsync(basic_streambuf_wchar *this)
2137 {
2138     TRACE("(%p)\n", this);
2139     return call_basic_streambuf_wchar_sync(this);
2140 }
2141
2142 /* ?sgetn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEHPA_WH@Z */
2143 /* ?sgetn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA_JPEA_W_J@Z */
2144 /* ?sgetn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEHPAGH@Z */
2145 /* ?sgetn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA_JPEAG_J@Z */
2146 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sgetn, 12)
2147 streamsize __thiscall basic_streambuf_wchar_sgetn(basic_streambuf_wchar *this, wchar_t *ptr, streamsize count)
2148 {
2149     TRACE("(%p %p %ld)\n", this, ptr, count);
2150     return call_basic_streambuf_wchar__Xsgetn_s(this, ptr, -1, count);
2151 }
2152
2153 /* ?showmanyc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHXZ */
2154 /* ?showmanyc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA_JXZ */
2155 /* ?showmanyc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHXZ */
2156 /* ?showmanyc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA_JXZ */
2157 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_showmanyc, 4)
2158 #define call_basic_streambuf_wchar_showmanyc(this) CALL_VTBL_FUNC(this, 12, \
2159         streamsize, (basic_streambuf_wchar*), (this))
2160 streamsize __thiscall basic_streambuf_wchar_showmanyc(basic_streambuf_wchar *this)
2161 {
2162     TRACE("(%p)\n", this);
2163     return 0;
2164 }
2165
2166 /* ?in_avail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEHXZ */
2167 /* ?in_avail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA_JXZ */
2168 /* ?in_avail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEHXZ */
2169 /* ?in_avail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA_JXZ */
2170 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_in_avail, 4)
2171 streamsize __thiscall basic_streambuf_wchar_in_avail(basic_streambuf_wchar *this)
2172 {
2173     streamsize ret;
2174
2175     TRACE("(%p)\n", this);
2176
2177     ret = basic_streambuf_wchar__Gnavail(this);
2178     return ret ? ret : call_basic_streambuf_wchar_showmanyc(this);
2179 }
2180
2181 /* ?sputbackc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEG_W@Z */
2182 /* ?sputbackc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAG_W@Z */
2183 /* ?sputbackc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGG@Z */
2184 /* ?sputbackc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAGG@Z */
2185 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sputbackc, 8)
2186 unsigned short __thiscall basic_streambuf_wchar_sputbackc(basic_streambuf_wchar *this, wchar_t ch)
2187 {
2188     TRACE("(%p %d)\n", this, ch);
2189     if(*this->prpos && *this->prpos>*this->prbuf && (*this->prpos)[-1]==ch) {
2190         (*this->prsize)++;
2191         (*this->prpos)--;
2192         return ch;
2193     }
2194
2195     return call_basic_streambuf_wchar_pbackfail(this, ch);
2196 }
2197
2198 /* ?sputc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEG_W@Z */
2199 /* ?sputc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAG_W@Z */
2200 /* ?sputc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGG@Z */
2201 /* ?sputc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAHG@Z */
2202 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sputc, 8)
2203 unsigned short __thiscall basic_streambuf_wchar_sputc(basic_streambuf_wchar *this, wchar_t ch)
2204 {
2205     TRACE("(%p %d)\n", this, ch);
2206     return basic_streambuf_wchar__Pnavail(this) ?
2207         (*basic_streambuf_wchar__Pninc(this) = ch) :
2208         call_basic_streambuf_wchar_overflow(this, ch);
2209 }
2210
2211 /* ?sungetc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
2212 /* ?sungetc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
2213 /* ?sungetc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGXZ */
2214 /* ?sungetc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAGXZ */
2215 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sungetc, 4)
2216 unsigned short __thiscall basic_streambuf_wchar_sungetc(basic_streambuf_wchar *this)
2217 {
2218     TRACE("(%p)\n", this);
2219     if(*this->prpos && *this->prpos>*this->prbuf) {
2220         (*this->prsize)++;
2221         (*this->prpos)--;
2222         return **this->prpos;
2223     }
2224
2225     return call_basic_streambuf_wchar_pbackfail(this, WEOF);
2226 }
2227
2228 /* ?stossc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
2229 /* ?stossc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
2230 /* ?stossc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEXXZ */
2231 /* ?stossc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAXXZ */
2232 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_stossc, 4)
2233 void __thiscall basic_streambuf_wchar_stossc(basic_streambuf_wchar *this)
2234 {
2235     TRACE("(%p)\n", this);
2236     if(basic_streambuf_wchar__Gnavail(this))
2237         basic_streambuf_wchar__Gninc(this);
2238     else
2239         call_basic_streambuf_wchar_uflow(this);
2240 }
2241
2242 /* ?sbumpc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
2243 /* ?sbumpc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
2244 /* ?sbumpc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGXZ */
2245 /* ?sbumpc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAGXZ */
2246 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sbumpc, 4)
2247 unsigned short __thiscall basic_streambuf_wchar_sbumpc(basic_streambuf_wchar *this)
2248 {
2249     TRACE("(%p)\n", this);
2250     return basic_streambuf_wchar__Gnavail(this) ?
2251         *basic_streambuf_wchar__Gninc(this) : call_basic_streambuf_wchar_uflow(this);
2252 }
2253
2254 /* ?sgetc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
2255 /* ?sgetc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
2256 /* ?sgetc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGXZ */
2257 /* ?sgetc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAGXZ */
2258 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sgetc, 4)
2259 unsigned short __thiscall basic_streambuf_wchar_sgetc(basic_streambuf_wchar *this)
2260 {
2261     TRACE("(%p)\n", this);
2262     return basic_streambuf_wchar__Gnavail(this) ?
2263         *basic_streambuf_wchar_gptr(this) : call_basic_streambuf_wchar_underflow(this);
2264 }
2265
2266 /* ?snextc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
2267 /* ?snextc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
2268 /* ?snextc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGXZ */
2269 /* ?snextc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAGXZ */
2270 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_snextc, 4)
2271 unsigned short __thiscall basic_streambuf_wchar_snextc(basic_streambuf_wchar *this)
2272 {
2273     TRACE("(%p)\n", this);
2274
2275     if(basic_streambuf_wchar__Gnavail(this) > 1)
2276         return *basic_streambuf_wchar__Gnpreinc(this);
2277     return basic_streambuf_wchar_sbumpc(this)==WEOF ?
2278         WEOF : basic_streambuf_wchar_sgetc(this);
2279 }
2280
2281 /* ?xsgetn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHPA_WH@Z */
2282 /* ?xsgetn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA_JPEA_W_J@Z */
2283 /* ?xsgetn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHPAGH@Z */
2284 /* ?xsgetn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA_JPEAG_J@Z */
2285 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_xsgetn, 12)
2286 #define call_basic_streambuf_wchar_xsgetn(this, ptr, count) CALL_VTBL_FUNC(this, 24, \
2287         streamsize, (basic_streambuf_wchar*, wchar_t*, streamsize), (this, ptr, count))
2288 streamsize __thiscall basic_streambuf_wchar_xsgetn(basic_streambuf_wchar *this, wchar_t *ptr, streamsize count)
2289 {
2290     TRACE("(%p %p %ld)\n", this, ptr, count);
2291     return call_basic_streambuf_wchar__Xsgetn_s(this, ptr, -1, count);
2292 }
2293
2294 /* ?xsputn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHPB_WH@Z */
2295 /* ?xsputn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA_JPEB_W_J@Z */
2296 /* ?xsputn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHPBGH@Z */
2297 /* ?xsputn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA_JPEBG_J@Z */
2298 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_xsputn, 12)
2299 #define call_basic_streambuf_wchar_xsputn(this, ptr, count) CALL_VTBL_FUNC(this, 32, \
2300         streamsize, (basic_streambuf_wchar*, const wchar_t*, streamsize), (this, ptr, count))
2301 streamsize __thiscall basic_streambuf_wchar_xsputn(basic_streambuf_wchar *this, const wchar_t *ptr, streamsize count)
2302 {
2303     streamsize copied, chunk;
2304
2305     TRACE("(%p %p %ld)\n", this, ptr, count);
2306
2307     for(copied=0; copied<count;) {
2308         chunk = basic_streambuf_wchar__Pnavail(this);
2309         if(chunk > count-copied)
2310             chunk = count-copied;
2311
2312         if(chunk > 0) {
2313             memcpy(*this->pwpos, ptr+copied, chunk*sizeof(wchar_t));
2314             *this->pwpos += chunk;
2315             *this->pwsize -= chunk;
2316             copied += chunk;
2317         }else if(call_basic_streambuf_wchar_overflow(this, ptr[copied]) != WEOF) {
2318             copied++;
2319         }else {
2320             break;
2321         }
2322     }
2323
2324     return copied;
2325 }
2326
2327 /* ?sputn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEHPB_WH@Z */
2328 /* ?sputn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA_JPEB_W_J@Z */
2329 /* ?sputn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEHPBGH@Z */
2330 /* ?sputn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA_JPEBG_J@Z */
2331 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sputn, 12)
2332 streamsize __thiscall basic_streambuf_wchar_sputn(basic_streambuf_wchar *this, const wchar_t *ptr, streamsize count)
2333 {
2334     TRACE("(%p %p %ld)\n", this, ptr, count);
2335     return call_basic_streambuf_wchar_xsputn(this, ptr, count);
2336 }
2337
2338 /* ?_Stinit@?1??_Init@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@23@@Z@4HA */
2339 /* ?_Stinit@?1??_Init@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@23@@Z@4HA */
2340 int basic_filebuf_char__Init__Stinit = 0;
2341
2342 /* ?_Init@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@12@@Z */
2343 /* ?_Init@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@12@@Z */
2344 DEFINE_THISCALL_WRAPPER(basic_filebuf_char__Init, 12)
2345 void __thiscall basic_filebuf_char__Init(basic_filebuf_char *this, FILE *file, basic_filebuf__Initfl which)
2346 {
2347     TRACE("(%p %p %d)\n", this, file, which);
2348
2349     this->cvt = NULL;
2350     this->wrotesome = FALSE;
2351     this->state = basic_filebuf_char__Init__Stinit;
2352     this->close = (which == INITFL_open);
2353     this->file = file;
2354
2355     basic_streambuf_char__Init_empty(&this->base);
2356     if(file)
2357         basic_streambuf_char__Init(&this->base, &file->_base, &file->_ptr,
2358                 &file->_cnt, &file->_base, &file->_ptr, &file->_cnt);
2359 }
2360
2361 /* ?_Initcvt@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IAEXPAV?$codecvt@DDH@2@@Z */
2362 /* ?_Initcvt@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IEAAXPEAV?$codecvt@DDH@2@@Z */
2363 DEFINE_THISCALL_WRAPPER(basic_filebuf_char__Initcvt, 8)
2364 void __thiscall basic_filebuf_char__Initcvt(basic_filebuf_char *this, codecvt_char *cvt)
2365 {
2366     TRACE("(%p %p)\n", this, cvt);
2367
2368     if(codecvt_base_always_noconv(&cvt->base)) {
2369         this->cvt = NULL;
2370     }else {
2371         basic_streambuf_char__Init_empty(&this->base);
2372         this->cvt = cvt;
2373     }
2374 }
2375
2376 /* ?_Endwrite@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IAE_NXZ */
2377 /* ?_Endwrite@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IEAA_NXZ */
2378 DEFINE_THISCALL_WRAPPER(basic_filebuf_char__Endwrite, 4)
2379 MSVCP_bool __thiscall basic_filebuf_char__Endwrite(basic_filebuf_char *this)
2380 {
2381     TRACE("(%p)\n", this);
2382
2383     if(!this->wrotesome || !this->cvt)
2384         return TRUE;
2385
2386
2387     if(call_basic_streambuf_char_overflow(&this->base, EOF) == EOF)
2388         return FALSE;
2389
2390     while(1) {
2391         /* TODO: check if we need a dynamic buffer here */
2392         char buf[128];
2393         char *next;
2394         int ret;
2395
2396         ret = codecvt_char_unshift(this->cvt, &this->state, buf, buf+sizeof(buf), &next);
2397         switch(ret) {
2398         case CODECVT_ok:
2399             this->wrotesome = FALSE;
2400             /* fall through */
2401         case CODECVT_partial:
2402             if(!fwrite(buf, next-buf, 1, this->file))
2403                 return FALSE;
2404             if(this->wrotesome)
2405                 break;
2406             /* fall through */
2407         case CODECVT_noconv:
2408             if(call_basic_streambuf_char_overflow(&this->base, EOF) == EOF)
2409                 return FALSE;
2410             return TRUE;
2411         default:
2412             return FALSE;
2413         }
2414     }
2415 }
2416
2417 /* ?close@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@XZ */
2418 /* ?close@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@XZ */
2419 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_close, 4)
2420 basic_filebuf_char* __thiscall basic_filebuf_char_close(basic_filebuf_char *this)
2421 {
2422     basic_filebuf_char *ret = this;
2423
2424     TRACE("(%p)\n", this);
2425
2426     if(!this->file)
2427         return NULL;
2428
2429     /* TODO: handle exceptions */
2430     if(!basic_filebuf_char__Endwrite(this))
2431         ret = NULL;
2432     if(!fclose(this->file))
2433         ret  = NULL;
2434
2435     basic_filebuf_char__Init(this, NULL, INITFL_close);
2436     return ret;
2437 }
2438
2439 /* ??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@PAU_iobuf@@@Z */
2440 /* ??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAA@PEAU_iobuf@@@Z */
2441 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_ctor_file, 8)
2442 basic_filebuf_char* __thiscall basic_filebuf_char_ctor_file(basic_filebuf_char *this, FILE *file)
2443 {
2444     TRACE("(%p %p)\n", this, file);
2445
2446     basic_streambuf_char_ctor(&this->base);
2447     this->base.vtable = &MSVCP_basic_filebuf_char_vtable;
2448
2449     basic_filebuf_char__Init(this, file, INITFL_new);
2450     return this;
2451 }
2452
2453 /* ??_F?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEXXZ */
2454 /* ??_F?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAXXZ */
2455 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_ctor, 4)
2456 basic_filebuf_char* __thiscall basic_filebuf_char_ctor(basic_filebuf_char *this)
2457 {
2458     return basic_filebuf_char_ctor_file(this, NULL);
2459 }
2460
2461 /* ??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@W4_Uninitialized@1@@Z */
2462 /* ??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
2463 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_ctor_uninitialized, 8)
2464 basic_filebuf_char* __thiscall basic_filebuf_char_ctor_uninitialized(basic_filebuf_char *this, int uninitialized)
2465 {
2466     TRACE("(%p %d)\n", this, uninitialized);
2467
2468     basic_streambuf_char_ctor(&this->base);
2469     this->base.vtable = &MSVCP_basic_filebuf_char_vtable;
2470     return this;
2471 }
2472
2473 /* ??1?$basic_filebuf@DU?$char_traits@D@std@@@std@@UAE@XZ */
2474 /* ??1?$basic_filebuf@DU?$char_traits@D@std@@@std@@UEAA@XZ */
2475 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_dtor, 4)
2476 void __thiscall basic_filebuf_char_dtor(basic_filebuf_char *this)
2477 {
2478     TRACE("(%p)\n", this);
2479
2480     if(this->close)
2481         basic_filebuf_char_close(this);
2482     basic_streambuf_char_dtor(&this->base);
2483 }
2484
2485 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_vector_dtor, 8)
2486 basic_filebuf_char* __thiscall basic_filebuf_char_vector_dtor(basic_filebuf_char *this, unsigned int flags)
2487 {
2488     TRACE("(%p %x)\n", this, flags);
2489     if(flags & 2) {
2490         /* we have an array, with the number of elements stored before the first object */
2491         INT_PTR i, *ptr = (INT_PTR *)this-1;
2492
2493         for(i=*ptr-1; i>=0; i--)
2494             basic_filebuf_char_dtor(this+i);
2495         MSVCRT_operator_delete(ptr);
2496     } else {
2497         basic_filebuf_char_dtor(this);
2498         if(flags & 1)
2499             MSVCRT_operator_delete(this);
2500     }
2501
2502     return this;
2503 }
2504
2505 /* ?is_open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QBE_NXZ */
2506 /* ?is_open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEBA_NXZ */
2507 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_is_open, 4)
2508 MSVCP_bool __thiscall basic_filebuf_char_is_open(const basic_filebuf_char *this)
2509 {
2510     TRACE("(%p)\n", this);
2511     return this->file != NULL;
2512 }
2513
2514 /* ?_Fiopen@std@@YAPAU_iobuf@@PB_WHH@Z */
2515 /* ?_Fiopen@std@@YAPEAU_iobuf@@PEB_WHH@Z */
2516 FILE* __cdecl _Fiopen_wchar(const wchar_t *name, int mode, int prot)
2517 {
2518     static const wchar_t rW[] = {'r',0};
2519     static const struct {
2520         int mode;
2521         const wchar_t str[4];
2522         const wchar_t str_bin[4];
2523     } str_mode[] = {
2524         {OPENMODE_out,                            {'w',0},     {'w','b',0}},
2525         {OPENMODE_out|OPENMODE_app,               {'a',0},     {'a','b',0}},
2526         {OPENMODE_app,                            {'a',0},     {'a','b',0}},
2527         {OPENMODE_out|OPENMODE_trunc,             {'w',0},     {'w','b',0}},
2528         {OPENMODE_in,                             {'r',0},     {'r','b',0}},
2529         {OPENMODE_in|OPENMODE_out,                {'r','+',0}, {'r','+','b',0}},
2530         {OPENMODE_in|OPENMODE_out|OPENMODE_trunc, {'w','+',0}, {'w','+','b',0}},
2531         {OPENMODE_in|OPENMODE_out|OPENMODE_app,   {'a','+',0}, {'a','+','b',0}},
2532         {OPENMODE_in|OPENMODE_app,                {'a','+',0}, {'a','+','b',0}}
2533     };
2534
2535     int real_mode = mode & ~(OPENMODE_ate|OPENMODE__Nocreate|OPENMODE__Noreplace|OPENMODE_binary);
2536     int mode_idx;
2537     FILE *f = NULL;
2538
2539     TRACE("(%s %d %d)\n", debugstr_w(name), mode, prot);
2540
2541     for(mode_idx=0; mode_idx<sizeof(str_mode)/sizeof(str_mode[0]); mode_idx++)
2542         if(str_mode[mode_idx].mode == real_mode)
2543             break;
2544     if(mode_idx == sizeof(str_mode)/sizeof(str_mode[0]))
2545         return NULL;
2546
2547     if((mode & OPENMODE__Nocreate) && !(f = _wfopen(name, rW)))
2548         return NULL;
2549     else if(f)
2550         fclose(f);
2551
2552     if((mode & OPENMODE__Noreplace) && (mode & (OPENMODE_out|OPENMODE_app))
2553             && (f = _wfopen(name, rW))) {
2554         fclose(f);
2555         return NULL;
2556     }
2557
2558     f = _wfsopen(name, (mode & OPENMODE_binary) ? str_mode[mode_idx].str_bin
2559             : str_mode[mode_idx].str, prot);
2560     if(!f)
2561         return NULL;
2562
2563     if((mode & OPENMODE_ate) && fseek(f, 0, SEEK_END)) {
2564         fclose(f);
2565         return NULL;
2566     }
2567
2568     return f;
2569 }
2570
2571 /* ?_Fiopen@std@@YAPAU_iobuf@@PBDHH@Z */
2572 /* ?_Fiopen@std@@YAPEAU_iobuf@@PEBDHH@Z */
2573 FILE* __cdecl _Fiopen(const char *name, int mode, int prot)
2574 {
2575     wchar_t nameW[FILENAME_MAX];
2576
2577     TRACE("(%s %d %d)\n", name, mode, prot);
2578
2579     if(mbstowcs_s(NULL, nameW, FILENAME_MAX, name, FILENAME_MAX-1) != 0)
2580         return NULL;
2581     return _Fiopen_wchar(nameW, mode, prot);
2582 }
2583
2584 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PB_WHH@Z */
2585 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEB_WHH@Z */
2586 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PBGHH@Z */
2587 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEBGHH@Z */
2588 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_open_wchar, 16)
2589 basic_filebuf_char* __thiscall basic_filebuf_char_open_wchar(basic_filebuf_char *this, const wchar_t *name, int mode, int prot)
2590 {
2591     FILE *f = NULL;
2592
2593     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
2594
2595     if(basic_filebuf_char_is_open(this))
2596         return NULL;
2597
2598     if(!(f = _Fiopen_wchar(name, mode, prot)))
2599         return NULL;
2600
2601     basic_filebuf_char__Init(this, f, INITFL_open);
2602     basic_filebuf_char__Initcvt(this, codecvt_char_use_facet(this->base.loc));
2603     return this;
2604 }
2605
2606 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PB_WI@Z */
2607 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEB_WI@Z */
2608 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PBGI@Z */
2609 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEBGI@Z */
2610 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_open_wchar_mode, 12)
2611 basic_filebuf_char* __thiscall basic_filebuf_char_open_wchar_mode(basic_filebuf_char *this, const wchar_t *name, unsigned int mode)
2612 {
2613     return basic_filebuf_char_open_wchar(this, name, mode, SH_DENYNO);
2614 }
2615
2616 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PBDHH@Z */
2617 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEBDHH@Z */
2618 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_open, 16)
2619 basic_filebuf_char* __thiscall basic_filebuf_char_open(basic_filebuf_char *this, const char *name, int mode, int prot)
2620 {
2621     wchar_t nameW[FILENAME_MAX];
2622
2623     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
2624
2625     if(mbstowcs_s(NULL, nameW, FILENAME_MAX, name, FILENAME_MAX-1) != 0)
2626         return NULL;
2627     return basic_filebuf_char_open_wchar(this, nameW, mode, prot);
2628 }
2629
2630 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PBDI@Z */
2631 /* ?open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEBDI@Z */
2632 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_open_mode, 12)
2633 basic_filebuf_char* __thiscall basic_filebuf_char_open_mode(basic_filebuf_char *this, const char *name, unsigned int mode)
2634 {
2635     return basic_filebuf_char_open(this, name, mode, SH_DENYNO);
2636 }
2637
2638 /* ?overflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHH@Z */
2639 /* ?overflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHH@Z */
2640 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_overflow, 8)
2641 int __thiscall basic_filebuf_char_overflow(basic_filebuf_char *this, int c)
2642 {
2643     char buf[8], *dyn_buf;
2644     char ch = c, *to_next;
2645     const char *from_next;
2646     int ret, max_size;
2647
2648
2649     TRACE("(%p %d)\n", this, c);
2650
2651     if(!basic_filebuf_char_is_open(this))
2652         return EOF;
2653     if(c == EOF)
2654         return !c;
2655
2656     if(!this->cvt)
2657         return fwrite(&ch, sizeof(char), 1, this->file) ? c : EOF;
2658
2659     from_next = &ch;
2660     do {
2661         ret = codecvt_char_out(this->cvt, &this->state, from_next, &ch+1,
2662                 &from_next, buf, buf+sizeof(buf), &to_next);
2663
2664         switch(ret) {
2665         case CODECVT_partial:
2666             if(to_next == buf)
2667                 break;
2668             /* fall through */
2669         case CODECVT_ok:
2670             if(!fwrite(buf, to_next-buf, 1, this->file))
2671                 return EOF;
2672             if(ret == CODECVT_partial)
2673                 continue;
2674             return c;
2675         case CODECVT_noconv:
2676             return fwrite(&ch, sizeof(char), 1, this->file) ? c : EOF;
2677         default:
2678             return EOF;
2679         }
2680
2681         break;
2682     } while(1);
2683
2684     max_size = codecvt_base_max_length(&this->cvt->base);
2685     dyn_buf = malloc(max_size);
2686     if(!dyn_buf)
2687         return EOF;
2688
2689     ret = codecvt_char_out(this->cvt, &this->state, from_next, &ch+1,
2690             &from_next, dyn_buf, dyn_buf+max_size, &to_next);
2691
2692     switch(ret) {
2693     case CODECVT_ok:
2694         ret = fwrite(dyn_buf, to_next-dyn_buf, 1, this->file);
2695         free(dyn_buf);
2696         return ret ? c : EOF;
2697     case CODECVT_partial:
2698         ERR("buffer should be big enough to store all output\n");
2699         /* fall through */
2700     default:
2701         free(dyn_buf);
2702         return EOF;
2703     }
2704 }
2705
2706 /* ?pbackfail@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHH@Z */
2707 /* ?pbackfail@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHH@Z */
2708 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_pbackfail, 8)
2709 int __thiscall basic_filebuf_char_pbackfail(basic_filebuf_char *this, int c)
2710 {
2711     TRACE("(%p %d)\n", this, c);
2712
2713     if(!basic_filebuf_char_is_open(this))
2714         return EOF;
2715
2716     if(basic_streambuf_char_gptr(&this->base)>basic_streambuf_char_eback(&this->base)
2717             && (c==EOF || basic_streambuf_char_gptr(&this->base)[-1]==(char)c)) {
2718         basic_streambuf_char__Gndec(&this->base);
2719         return c==EOF ? !c : c;
2720     }else if(c!=EOF && !this->cvt) {
2721         return ungetc(c, this->file);
2722     }
2723
2724     return EOF;
2725 }
2726
2727 /* ?uflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
2728 /* ?uflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
2729 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_uflow, 4)
2730 int __thiscall basic_filebuf_char_uflow(basic_filebuf_char *this)
2731 {
2732     char ch, buf[128], *to_next;
2733     const char *buf_next;
2734     int c, i;
2735
2736     TRACE("(%p)\n", this);
2737
2738     if(!basic_filebuf_char_is_open(this))
2739         return EOF;
2740
2741     if(basic_streambuf_char_gptr(&this->base) < basic_streambuf_char_egptr(&this->base))
2742         return *basic_streambuf_char__Gninc(&this->base);
2743
2744     c = fgetc(this->file);
2745     if(!this->cvt || c==EOF)
2746         return c;
2747
2748     buf_next = buf;
2749     for(i=0; i < sizeof(buf)/sizeof(buf[0]); i++) {
2750         buf[i] = c;
2751
2752         switch(codecvt_char_in(this->cvt, &this->state, buf_next,
2753                     buf+i+1, &buf_next, &ch, &ch+1, &to_next)) {
2754         case CODECVT_partial:
2755         case CODECVT_ok:
2756             if(to_next == &ch) {
2757                 c = fgetc(this->file);
2758                 if(c == EOF)
2759                     return EOF;
2760                 continue;
2761             }
2762
2763             for(i--; i>=buf_next-buf; i--)
2764                 ungetc(buf[i], this->file);
2765             return ch;
2766         case CODECVT_noconv:
2767             return buf[0];
2768         default:
2769             return EOF;
2770         }
2771     }
2772
2773     FIXME("buffer is too small\n");
2774     return EOF;
2775 }
2776
2777 /* ?underflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
2778 /* ?underflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
2779 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_underflow, 4)
2780 int __thiscall basic_filebuf_char_underflow(basic_filebuf_char *this)
2781 {
2782     int ret;
2783
2784     TRACE("(%p)\n", this);
2785
2786     if(basic_streambuf_char_gptr(&this->base) < basic_streambuf_char_egptr(&this->base))
2787         return *basic_streambuf_char_gptr(&this->base);
2788
2789     ret = call_basic_streambuf_char_uflow(&this->base);
2790     if(ret != EOF)
2791         ret = call_basic_streambuf_char_pbackfail(&this->base, ret);
2792     return ret;
2793 }
2794
2795 /* ?seekoff@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
2796 /* ?seekoff@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
2797 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_seekoff, 20)
2798 fpos_int* __thiscall basic_filebuf_char_seekoff(basic_filebuf_char *this,
2799         fpos_int *ret, streamoff off, int way, int mode)
2800 {
2801     fpos_t pos;
2802
2803     TRACE("(%p %p %ld %d %d)\n", this, ret, off, way, mode);
2804
2805     if(!basic_filebuf_char_is_open(this) || !basic_filebuf_char__Endwrite(this)
2806             || fseek(this->file, off, way)) {
2807         ret->off = 0;
2808         ret->pos = -1;
2809         ret->state = 0;
2810         return ret;
2811     }
2812
2813     fgetpos(this->file, &pos);
2814     ret->off = 0;
2815     ret->pos = pos;
2816     ret->state = this->state;
2817     return ret;
2818 }
2819
2820 /* ?seekpos@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
2821 /* ?seekpos@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
2822 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_seekpos, 36)
2823 fpos_int* __thiscall basic_filebuf_char_seekpos(basic_filebuf_char *this,
2824         fpos_int *ret, fpos_int pos, int mode)
2825 {
2826     fpos_t fpos;
2827
2828     TRACE("(%p %p %s %d)\n", this, ret, debugstr_fpos_int(&pos), mode);
2829
2830     if(!basic_filebuf_char_is_open(this) || !basic_filebuf_char__Endwrite(this)
2831             || fseek(this->file, (LONG)pos.pos, SEEK_SET)
2832             || (pos.off && fseek(this->file, pos.off, SEEK_CUR))) {
2833         ret->off = 0;
2834         ret->pos = -1;
2835         ret->state = 0;
2836         return ret;
2837     }
2838
2839     fgetpos(this->file, &fpos);
2840     ret->off = 0;
2841     ret->pos = fpos;
2842     ret->state = this->state;
2843     return ret;
2844 }
2845
2846 /* ?setbuf@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PADH@Z */
2847 /* ?setbuf@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAPEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PEAD_J@Z */
2848 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_setbuf, 12)
2849 basic_streambuf_char* __thiscall basic_filebuf_char_setbuf(basic_filebuf_char *this, char *buf, streamsize count)
2850 {
2851     TRACE("(%p %p %ld)\n", this, buf, count);
2852
2853     if(!basic_filebuf_char_is_open(this))
2854         return NULL;
2855
2856     if(setvbuf(this->file, buf, (buf==NULL && count==0) ? _IONBF : _IOFBF, count))
2857         return NULL;
2858
2859     basic_filebuf_char__Init(this, this->file, INITFL_open);
2860     return &this->base;
2861 }
2862
2863 /* ?sync@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
2864 /* ?sync@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
2865 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_sync, 4)
2866 int __thiscall basic_filebuf_char_sync(basic_filebuf_char *this)
2867 {
2868     TRACE("(%p)\n", this);
2869
2870     if(!basic_filebuf_char_is_open(this))
2871         return 0;
2872
2873     if(call_basic_streambuf_char_overflow(&this->base, EOF) == EOF)
2874         return 0;
2875     return fflush(this->file);
2876 }
2877
2878 /* ?imbue@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEXABVlocale@2@@Z */
2879 /* ?imbue@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAXAEBVlocale@2@@Z */
2880 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_imbue, 8)
2881 void __thiscall basic_filebuf_char_imbue(basic_filebuf_char *this, const locale *loc)
2882 {
2883     TRACE("(%p %p)\n", this, loc);
2884     basic_filebuf_char__Initcvt(this, codecvt_char_use_facet(loc));
2885 }
2886
2887 /* ?_Stinit@?1??_Init@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@23@@Z@4HA */
2888 /* ?_Stinit@?1??_Init@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@23@@Z@4HA */
2889 int basic_filebuf_wchar__Init__Stinit = 0;
2890
2891 /* ?_Stinit@?1??_Init@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@23@@Z@4HA */
2892 /* ?_Stinit@?1??_Init@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@23@@Z@4HA */
2893 int basic_filebuf_short__Init__Stinit = 0;
2894
2895 /* ?_Init@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@12@@Z */
2896 /* ?_Init@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@12@@Z */
2897 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar__Init, 12)
2898 void __thiscall basic_filebuf_wchar__Init(basic_filebuf_wchar *this, FILE *file, basic_filebuf__Initfl which)
2899 {
2900     TRACE("(%p %p %d)\n", this, file, which);
2901
2902     this->cvt = NULL;
2903     this->wrotesome = FALSE;
2904     this->state = basic_filebuf_wchar__Init__Stinit;
2905     this->close = (which == INITFL_open);
2906     this->file = file;
2907
2908     basic_streambuf_wchar__Init_empty(&this->base);
2909 }
2910
2911 /* ?_Init@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@12@@Z */
2912 /* ?_Init@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@12@@Z */
2913 DEFINE_THISCALL_WRAPPER(basic_filebuf_short__Init, 12)
2914 void __thiscall basic_filebuf_short__Init(basic_filebuf_wchar *this, FILE *file, basic_filebuf__Initfl which)
2915 {
2916     TRACE("(%p %p %d)\n", this, file, which);
2917
2918     this->cvt = NULL;
2919     this->wrotesome = FALSE;
2920     this->state = basic_filebuf_short__Init__Stinit;
2921     this->close = (which == INITFL_open);
2922     this->file = file;
2923
2924     basic_streambuf_wchar__Init_empty(&this->base);
2925 }
2926
2927 /* ?_Initcvt@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IAEXPAV?$codecvt@_WDH@2@@Z */
2928 /* ?_Initcvt@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEAV?$codecvt@_WDH@2@@Z */
2929 /* ?_Initcvt@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IAEXPAV?$codecvt@GDH@2@@Z */
2930 /* ?_Initcvt@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IEAAXPEAV?$codecvt@GDH@2@@Z */
2931 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar__Initcvt, 8)
2932 void __thiscall basic_filebuf_wchar__Initcvt(basic_filebuf_wchar *this, codecvt_wchar *cvt)
2933 {
2934     TRACE("(%p %p)\n", this, cvt);
2935
2936     if(codecvt_base_always_noconv(&cvt->base)) {
2937         this->cvt = NULL;
2938     }else {
2939         basic_streambuf_wchar__Init_empty(&this->base);
2940         this->cvt = cvt;
2941     }
2942 }
2943
2944 /* ?_Endwrite@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IAE_NXZ */
2945 /* ?_Endwrite@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IEAA_NXZ */
2946 /* ?_Endwrite@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IAE_NXZ */
2947 /* ?_Endwrite@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IEAA_NXZ */
2948 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar__Endwrite, 4)
2949 MSVCP_bool __thiscall basic_filebuf_wchar__Endwrite(basic_filebuf_wchar *this)
2950 {
2951     TRACE("(%p)\n", this);
2952
2953     if(!this->wrotesome || !this->cvt)
2954         return TRUE;
2955
2956     if(call_basic_streambuf_wchar_overflow(&this->base, WEOF) == WEOF)
2957         return FALSE;
2958
2959     while(1) {
2960         /* TODO: check if we need a dynamic buffer here */
2961         char buf[128];
2962         char *next;
2963         int ret;
2964
2965         ret = codecvt_wchar_unshift(this->cvt, &this->state, buf, buf+sizeof(buf), &next);
2966         switch(ret) {
2967         case CODECVT_ok:
2968             this->wrotesome = FALSE;
2969             /* fall through */
2970         case CODECVT_partial:
2971             if(!fwrite(buf, next-buf, 1, this->file))
2972                 return FALSE;
2973             if(this->wrotesome)
2974                 break;
2975             /* fall through */
2976         case CODECVT_noconv:
2977             if(call_basic_streambuf_wchar_overflow(&this->base, WEOF) == WEOF)
2978                 return FALSE;
2979             return TRUE;
2980         default:
2981             return FALSE;
2982         }
2983     }
2984 }
2985
2986 /* ?close@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@XZ */
2987 /* ?close@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@XZ */
2988 /* ?close@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@XZ */
2989 /* ?close@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@XZ */
2990 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_close, 4)
2991 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_close(basic_filebuf_wchar *this)
2992 {
2993     basic_filebuf_wchar *ret = this;
2994
2995     TRACE("(%p)\n", this);
2996
2997     if(!this->file)
2998         return NULL;
2999
3000     /* TODO: handle exceptions */
3001     if(!basic_filebuf_wchar__Endwrite(this))
3002         ret = NULL;
3003     if(!fclose(this->file))
3004         ret  = NULL;
3005
3006     basic_filebuf_wchar__Init(this, NULL, INITFL_close);
3007     return ret;
3008 }
3009
3010 /* ??0?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAE@PAU_iobuf@@@Z */
3011 /* ??0?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAA@PEAU_iobuf@@@Z */
3012 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_ctor_file, 8)
3013 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_ctor_file(basic_filebuf_wchar *this, FILE *file)
3014 {
3015     TRACE("(%p %p)\n", this, file);
3016
3017     basic_streambuf_wchar_ctor(&this->base);
3018     this->base.vtable = &MSVCP_basic_filebuf_wchar_vtable;
3019
3020     basic_filebuf_wchar__Init(this, file, INITFL_new);
3021     return this;
3022 }
3023
3024 /* ??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@PAU_iobuf@@@Z */
3025 /* ??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAA@PEAU_iobuf@@@Z */
3026 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_ctor_file, 8)
3027 basic_filebuf_wchar* __thiscall basic_filebuf_short_ctor_file(basic_filebuf_wchar *this, FILE *file)
3028 {
3029     TRACE("(%p %p)\n", this, file);
3030
3031     basic_streambuf_short_ctor(&this->base);
3032     this->base.vtable = &MSVCP_basic_filebuf_short_vtable;
3033
3034     basic_filebuf_short__Init(this, file, INITFL_new);
3035     return this;
3036 }
3037
3038 /* ??_F?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
3039 /* ??_F?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
3040 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_ctor, 4)
3041 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_ctor(basic_filebuf_wchar *this)
3042 {
3043     return basic_filebuf_wchar_ctor_file(this, NULL);
3044 }
3045
3046 /* ??_F?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEXXZ */
3047 /* ??_F?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAXXZ */
3048 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_ctor, 4)
3049 basic_filebuf_wchar* __thiscall basic_filebuf_short_ctor(basic_filebuf_wchar *this)
3050 {
3051     return basic_filebuf_short_ctor_file(this, NULL);
3052 }
3053
3054 /* ??0?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAE@W4_Uninitialized@1@@Z */
3055 /* ??0?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
3056 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_ctor_uninitialized, 8)
3057 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_ctor_uninitialized(basic_filebuf_wchar *this, int uninitialized)
3058 {
3059     TRACE("(%p %d)\n", this, uninitialized);
3060
3061     basic_streambuf_wchar_ctor(&this->base);
3062     this->base.vtable = &MSVCP_basic_filebuf_wchar_vtable;
3063     return this;
3064 }
3065
3066 /* ??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@W4_Uninitialized@1@@Z */
3067 /* ??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
3068 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_ctor_uninitialized, 8)
3069 basic_filebuf_wchar* __thiscall basic_filebuf_short_ctor_uninitialized(basic_filebuf_wchar *this, int uninitialized)
3070 {
3071     TRACE("(%p %d)\n", this, uninitialized);
3072
3073     basic_streambuf_short_ctor(&this->base);
3074     this->base.vtable = &MSVCP_basic_filebuf_short_vtable;
3075     return this;
3076 }
3077
3078 /* ??1?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
3079 /* ??1?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
3080 /* ??1?$basic_filebuf@GU?$char_traits@G@std@@@std@@UAE@XZ */
3081 /* ??1?$basic_filebuf@GU?$char_traits@G@std@@@std@@UEAA@XZ */
3082 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_dtor, 4)
3083 void __thiscall basic_filebuf_wchar_dtor(basic_filebuf_wchar *this)
3084 {
3085     TRACE("(%p)\n", this);
3086
3087     if(this->close)
3088         basic_filebuf_wchar_close(this);
3089     basic_streambuf_wchar_dtor(&this->base);
3090 }
3091
3092 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_vector_dtor, 8)
3093 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_vector_dtor(basic_filebuf_wchar *this, unsigned int flags)
3094 {
3095     TRACE("(%p %x)\n", this, flags);
3096     if(flags & 2) {
3097         /* we have an array, with the number of elements stored before the first object */
3098         INT_PTR i, *ptr = (INT_PTR *)this-1;
3099
3100         for(i=*ptr-1; i>=0; i--)
3101             basic_filebuf_wchar_dtor(this+i);
3102         MSVCRT_operator_delete(ptr);
3103     } else {
3104         basic_filebuf_wchar_dtor(this);
3105         if(flags & 1)
3106             MSVCRT_operator_delete(this);
3107     }
3108
3109     return this;
3110 }
3111
3112 /* ?is_open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QBE_NXZ */
3113 /* ?is_open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEBA_NXZ */
3114 /* ?is_open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QBE_NXZ */
3115 /* ?is_open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEBA_NXZ */
3116 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_is_open, 4)
3117 MSVCP_bool __thiscall basic_filebuf_wchar_is_open(const basic_filebuf_wchar *this)
3118 {
3119     TRACE("(%p)\n", this);
3120     return this->file != NULL;
3121 }
3122
3123 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PB_WHH@Z */
3124 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEB_WHH@Z */
3125 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PBGHH@Z */
3126 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEBGHH@Z */
3127 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_open_wchar, 16)
3128 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_open_wchar(basic_filebuf_wchar *this, const wchar_t *name, int mode, int prot)
3129 {
3130     FILE *f = NULL;
3131
3132     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
3133
3134     if(basic_filebuf_wchar_is_open(this))
3135         return NULL;
3136
3137     if(!(f = _Fiopen_wchar(name, mode, prot)))
3138         return NULL;
3139
3140     basic_filebuf_wchar__Init(this, f, INITFL_open);
3141     basic_filebuf_wchar__Initcvt(this, codecvt_wchar_use_facet(this->base.loc));
3142     return this;
3143 }
3144
3145 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PB_WHH@Z */
3146 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEB_WHH@Z */
3147 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PBGHH@Z */
3148 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEBGHH@Z */
3149 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_open_wchar, 16)
3150 basic_filebuf_wchar* __thiscall basic_filebuf_short_open_wchar(basic_filebuf_wchar *this, const wchar_t *name, int mode, int prot)
3151 {
3152     FILE *f = NULL;
3153
3154     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
3155
3156     if(basic_filebuf_wchar_is_open(this))
3157         return NULL;
3158
3159     if(!(f = _Fiopen_wchar(name, mode, prot)))
3160         return NULL;
3161
3162     basic_filebuf_short__Init(this, f, INITFL_open);
3163     basic_filebuf_wchar__Initcvt(this, codecvt_short_use_facet(this->base.loc));
3164     return this;
3165 }
3166
3167 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PB_WI@Z */
3168 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEB_WI@Z */
3169 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PBGI@Z */
3170 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEBGI@Z */
3171 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_open_wchar_mode, 12)
3172 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_open_wchar_mode(basic_filebuf_wchar *this, const wchar_t *name, unsigned int mode)
3173 {
3174     return basic_filebuf_wchar_open_wchar(this, name, mode, SH_DENYNO);
3175 }
3176
3177 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PB_WI@Z */
3178 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEB_WI@Z */
3179 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PBGI@Z */
3180 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEBGI@Z */
3181 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_open_wchar_mode, 12)
3182 basic_filebuf_wchar* __thiscall basic_filebuf_short_open_wchar_mode(basic_filebuf_wchar *this, const wchar_t *name, unsigned int mode)
3183 {
3184     return basic_filebuf_short_open_wchar(this, name, mode, SH_DENYNO);
3185 }
3186
3187 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PBDHH@Z */
3188 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEBDHH@Z */
3189 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_open, 16)
3190 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_open(basic_filebuf_wchar *this, const char *name, int mode, int prot)
3191 {
3192     wchar_t nameW[FILENAME_MAX];
3193
3194     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
3195
3196     if(mbstowcs_s(NULL, nameW, FILENAME_MAX, name, FILENAME_MAX-1) != 0)
3197         return NULL;
3198     return basic_filebuf_wchar_open_wchar(this, nameW, mode, prot);
3199 }
3200
3201 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PBDHH@Z */
3202 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEBDHH@Z */
3203 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_open, 16)
3204 basic_filebuf_wchar* __thiscall basic_filebuf_short_open(basic_filebuf_wchar *this, const char *name, int mode, int prot)
3205 {
3206     wchar_t nameW[FILENAME_MAX];
3207
3208     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
3209
3210     if(mbstowcs_s(NULL, nameW, FILENAME_MAX, name, FILENAME_MAX-1) != 0)
3211         return NULL;
3212     return basic_filebuf_short_open_wchar(this, nameW, mode, prot);
3213 }
3214
3215 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PBDI@Z */
3216 /* ?open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEBDI@Z */
3217 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_open_mode, 12)
3218 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_open_mode(basic_filebuf_wchar *this, const char *name, unsigned int mode)
3219 {
3220     return basic_filebuf_wchar_open(this, name, mode, SH_DENYNO);
3221 }
3222
3223 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PBDI@Z */
3224 /* ?open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEBDI@Z */
3225 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_open_mode, 12)
3226 basic_filebuf_wchar* __thiscall basic_filebuf_short_open_mode(basic_filebuf_wchar *this, const char *name, unsigned int mode)
3227 {
3228     return basic_filebuf_short_open(this, name, mode, SH_DENYNO);
3229 }
3230
3231 /* ?overflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEGG@Z */
3232 /* ?overflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAGG@Z */
3233 /* ?overflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEGG@Z */
3234 /* ?overflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAGG@Z */
3235 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_overflow, 8)
3236 unsigned short __thiscall basic_filebuf_wchar_overflow(basic_filebuf_wchar *this, unsigned short c)
3237 {
3238     char buf[8], *dyn_buf, *to_next;
3239     wchar_t ch = c;
3240     const wchar_t *from_next;
3241     int max_size;
3242     unsigned short ret;
3243
3244
3245     TRACE("(%p %d)\n", this, c);
3246
3247     if(!basic_filebuf_wchar_is_open(this))
3248         return WEOF;
3249     if(c == WEOF)
3250         return !c;
3251
3252     if(!this->cvt)
3253         return fwrite(&ch, sizeof(wchar_t), 1, this->file) ? c : WEOF;
3254
3255     from_next = &ch;
3256     do {
3257         ret = codecvt_wchar_out(this->cvt, &this->state, from_next, &ch+1,
3258                 &from_next, buf, buf+sizeof(buf), &to_next);
3259
3260         switch(ret) {
3261         case CODECVT_partial:
3262             if(to_next == buf)
3263                 break;
3264             /* fall through */
3265         case CODECVT_ok:
3266             if(!fwrite(buf, to_next-buf, 1, this->file))
3267                 return WEOF;
3268             if(ret == CODECVT_partial)
3269                 continue;
3270             return c;
3271         case CODECVT_noconv:
3272             return fwrite(&ch, sizeof(wchar_t), 1, this->file) ? c : WEOF;
3273         default:
3274             return WEOF;
3275         }
3276
3277         break;
3278     } while(1);
3279
3280     max_size = codecvt_base_max_length(&this->cvt->base);
3281     dyn_buf = malloc(max_size);
3282     if(!dyn_buf)
3283         return WEOF;
3284
3285     ret = codecvt_wchar_out(this->cvt, &this->state, from_next, &ch+1,
3286             &from_next, dyn_buf, dyn_buf+max_size, &to_next);
3287
3288     switch(ret) {
3289     case CODECVT_ok:
3290         ret = fwrite(dyn_buf, to_next-dyn_buf, 1, this->file);
3291         free(dyn_buf);
3292         return ret ? c : WEOF;
3293     case CODECVT_partial:
3294         ERR("buffer should be big enough to store all output\n");
3295         /* fall through */
3296     default:
3297         free(dyn_buf);
3298         return WEOF;
3299     }
3300 }
3301
3302 /* ?pbackfail@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEGG@Z */
3303 /* ?pbackfail@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAGG@Z */
3304 /* ?pbackfail@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEGG@Z */
3305 /* ?pbackfail@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAGG@Z */
3306 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_pbackfail, 8)
3307 unsigned short __thiscall basic_filebuf_wchar_pbackfail(basic_filebuf_wchar *this, unsigned short c)
3308 {
3309     TRACE("(%p %d)\n", this, c);
3310
3311     if(!basic_filebuf_wchar_is_open(this))
3312         return WEOF;
3313
3314     if(basic_streambuf_wchar_gptr(&this->base)>basic_streambuf_wchar_eback(&this->base)
3315             && (c==WEOF || basic_streambuf_wchar_gptr(&this->base)[-1]==(wchar_t)c)) {
3316         basic_streambuf_wchar__Gndec(&this->base);
3317         return c==WEOF ? !c : c;
3318     }else if(c!=WEOF && !this->cvt) {
3319         return ungetwc(c, this->file);
3320     }else if(c!=WEOF && basic_streambuf_wchar_gptr(&this->base)!=&this->putback) {
3321         this->putback = c;
3322         basic_streambuf_wchar_setg(&this->base, &this->putback, &this->putback, &this->putback+1);
3323         return c;
3324     }
3325
3326     return WEOF;
3327 }
3328
3329 /* ?uflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEGXZ */
3330 /* ?uflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAGXZ */
3331 /* ?uflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEGXZ */
3332 /* ?uflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAGXZ */
3333 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_uflow, 4)
3334 unsigned short __thiscall basic_filebuf_wchar_uflow(basic_filebuf_wchar *this)
3335 {
3336     wchar_t ch, *to_next;
3337     char buf[128];
3338     const char *buf_next;
3339     int c, i;
3340
3341     TRACE("(%p)\n", this);
3342
3343     if(!basic_filebuf_wchar_is_open(this))
3344         return WEOF;
3345
3346     if(basic_streambuf_wchar_gptr(&this->base) < basic_streambuf_wchar_egptr(&this->base))
3347         return *basic_streambuf_wchar__Gninc(&this->base);
3348
3349     if(!this->cvt)
3350         return fgetwc(this->file);
3351
3352     buf_next = buf;
3353     for(i=0; i < sizeof(buf)/sizeof(buf[0]); i++) {
3354         if((c = fgetc(this->file)) == EOF)
3355             return WEOF;
3356         buf[i] = c;
3357
3358         switch(codecvt_wchar_in(this->cvt, &this->state, buf_next,
3359                     buf+i+1, &buf_next, &ch, &ch+1, &to_next)) {
3360         case CODECVT_partial:
3361         case CODECVT_ok:
3362             if(to_next == &ch)
3363                 continue;
3364
3365             for(i--; i>=buf_next-buf; i--)
3366                 ungetc(buf[i], this->file);
3367             return ch;
3368         case CODECVT_noconv:
3369             if(i+1 < sizeof(wchar_t))
3370                 continue;
3371
3372             memcpy(&ch, buf, sizeof(wchar_t));
3373             return ch;
3374         default:
3375             return WEOF;
3376         }
3377     }
3378
3379     FIXME("buffer is too small\n");
3380     return WEOF;
3381 }
3382
3383 /* ?underflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEGXZ */
3384 /* ?underflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAGXZ */
3385 /* ?underflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEGXZ */
3386 /* ?underflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAGXZ */
3387 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_underflow, 4)
3388 unsigned short __thiscall basic_filebuf_wchar_underflow(basic_filebuf_wchar *this)
3389 {
3390     unsigned short ret;
3391
3392     TRACE("(%p)\n", this);
3393
3394     if(basic_streambuf_wchar_gptr(&this->base) < basic_streambuf_wchar_egptr(&this->base))
3395         return *basic_streambuf_wchar_gptr(&this->base);
3396
3397     ret = call_basic_streambuf_wchar_uflow(&this->base);
3398     if(ret != WEOF)
3399         ret = call_basic_streambuf_wchar_pbackfail(&this->base, ret);
3400     return ret;
3401 }
3402
3403 /* ?seekoff@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
3404 /* ?seekoff@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
3405 /* ?seekoff@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
3406 /* ?seekoff@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
3407 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_seekoff, 20)
3408 fpos_int* __thiscall basic_filebuf_wchar_seekoff(basic_filebuf_wchar *this,
3409         fpos_int *ret, streamoff off, int way, int mode)
3410 {
3411     fpos_t pos;
3412
3413     TRACE("(%p %p %ld %d %d)\n", this, ret, off, way, mode);
3414
3415     if(basic_streambuf_wchar_gptr(&this->base) == &this->putback) {
3416         if(way == SEEKDIR_cur)
3417             off -= sizeof(wchar_t);
3418
3419         basic_streambuf_wchar_setg(&this->base, &this->putback, &this->putback+1, &this->putback+1);
3420     }
3421
3422     if(!basic_filebuf_wchar_is_open(this) || !basic_filebuf_wchar__Endwrite(this)
3423             || fseek(this->file, off, way)) {
3424         ret->off = 0;
3425         ret->pos = -1;
3426         ret->state = 0;
3427         return ret;
3428     }
3429
3430     fgetpos(this->file, &pos);
3431     ret->off = 0;
3432     ret->pos = pos;
3433     ret->state = this->state;
3434     return ret;
3435 }
3436
3437 /* ?seekpos@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
3438 /* ?seekpos@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
3439 /* ?seekpos@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
3440 /* ?seekpos@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
3441 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_seekpos, 36)
3442 fpos_int* __thiscall basic_filebuf_wchar_seekpos(basic_filebuf_wchar *this,
3443         fpos_int *ret, fpos_int pos, int mode)
3444 {
3445     fpos_t fpos;
3446
3447     TRACE("(%p %p %s %d)\n", this, ret, debugstr_fpos_int(&pos), mode);
3448
3449     if(!basic_filebuf_wchar_is_open(this) || !basic_filebuf_wchar__Endwrite(this)
3450             || fseek(this->file, (LONG)pos.pos, SEEK_SET)
3451             || (pos.off && fseek(this->file, pos.off, SEEK_CUR))) {
3452         ret->off = 0;
3453         ret->pos = -1;
3454         ret->state = 0;
3455         return ret;
3456     }
3457
3458     if(basic_streambuf_wchar_gptr(&this->base) == &this->putback)
3459         basic_streambuf_wchar_setg(&this->base, &this->putback, &this->putback+1, &this->putback+1);
3460
3461     fgetpos(this->file, &fpos);
3462     ret->off = 0;
3463     ret->pos = fpos;
3464     ret->state = this->state;
3465     return ret;
3466 }
3467
3468 /* ?setbuf@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEPAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@PA_WH@Z */
3469 /* ?setbuf@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAPEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@PEA_W_J@Z */
3470 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_setbuf, 12)
3471 basic_streambuf_wchar* __thiscall basic_filebuf_wchar_setbuf(basic_filebuf_wchar *this, wchar_t *buf, streamsize count)
3472 {
3473     TRACE("(%p %p %ld)\n", this, buf, count);
3474
3475     if(!basic_filebuf_wchar_is_open(this))
3476         return NULL;
3477
3478     if(setvbuf(this->file, (char*)buf, (buf==NULL && count==0) ? _IONBF : _IOFBF, count*sizeof(wchar_t)))
3479         return NULL;
3480
3481     basic_filebuf_wchar__Init(this, this->file, INITFL_open);
3482     return &this->base;
3483 }
3484
3485 /* ?setbuf@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEPAV?$basic_streambuf@GU?$char_traits@G@std@@@2@PAGH@Z */
3486 /* ?setbuf@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAPEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@PEAG_J@Z */
3487 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_setbuf, 12)
3488 basic_streambuf_wchar* __thiscall basic_filebuf_short_setbuf(basic_filebuf_wchar *this, wchar_t *buf, streamsize count)
3489 {
3490     TRACE("(%p %p %ld)\n", this, buf, count);
3491
3492     if(!basic_filebuf_wchar_is_open(this))
3493         return NULL;
3494
3495     if(setvbuf(this->file, (char*)buf, (buf==NULL && count==0) ? _IONBF : _IOFBF, count*sizeof(wchar_t)))
3496         return NULL;
3497
3498     basic_filebuf_short__Init(this, this->file, INITFL_open);
3499     return &this->base;
3500 }
3501
3502 /* ?sync@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEHXZ */
3503 /* ?sync@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAHXZ */
3504 /* ?sync@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEHXZ */
3505 /* ?sync@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAHXZ */
3506 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_sync, 4)
3507 int __thiscall basic_filebuf_wchar_sync(basic_filebuf_wchar *this)
3508 {
3509     TRACE("(%p)\n", this);
3510
3511     if(!basic_filebuf_wchar_is_open(this))
3512         return 0;
3513
3514     if(call_basic_streambuf_wchar_overflow(&this->base, WEOF) == WEOF)
3515         return 0;
3516     return fflush(this->file);
3517 }
3518
3519 /* ?imbue@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEXABVlocale@2@@Z */
3520 /* ?imbue@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAXAEBVlocale@2@@Z */
3521 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_imbue, 8)
3522 void __thiscall basic_filebuf_wchar_imbue(basic_filebuf_wchar *this, const locale *loc)
3523 {
3524     TRACE("(%p %p)\n", this, loc);
3525     basic_filebuf_wchar__Initcvt(this, codecvt_wchar_use_facet(loc));
3526 }
3527
3528 /* ?imbue@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEXABVlocale@2@@Z */
3529 /* ?imbue@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAXAEBVlocale@2@@Z */
3530 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_imbue, 8)
3531 void __thiscall basic_filebuf_short_imbue(basic_filebuf_wchar *this, const locale *loc)
3532 {
3533     TRACE("(%p %p)\n", this, loc);
3534     basic_filebuf_wchar__Initcvt(this, codecvt_short_use_facet(loc));
3535 }
3536
3537 /* ?_Getstate@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAEHH@Z */
3538 /* ?_Getstate@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEAAHH@Z */
3539 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char__Getstate, 8)
3540 int __thiscall basic_stringbuf_char__Getstate(basic_stringbuf_char *this, IOSB_openmode mode)
3541 {
3542     int state = 0;
3543
3544     if(!(mode & OPENMODE_in))
3545         state |= STRINGBUF_no_read;
3546
3547     if(!(mode & OPENMODE_out))
3548         state |= STRINGBUF_no_write;
3549
3550     if(mode & OPENMODE_ate)
3551         state |= STRINGBUF_at_end;
3552
3553     if(mode & OPENMODE_app)
3554         state |= STRINGBUF_append;
3555
3556     return state;
3557 }
3558
3559 /* ?_Init@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAEXPBDIH@Z */
3560 /* ?_Init@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IEAAXPEBD_KH@Z */
3561 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char__Init, 16)
3562 void __thiscall basic_stringbuf_char__Init(basic_stringbuf_char *this, const char *str, MSVCP_size_t count, int state)
3563 {
3564     TRACE("(%p, %p, %ld, %d)\n", this, str, count, state);
3565
3566     basic_streambuf_char__Init_empty(&this->base);
3567
3568     this->state = state;
3569     this->seekhigh = NULL;
3570
3571     if(count && str) {
3572         char *buf = MSVCRT_operator_new(count);
3573         if(!buf) {
3574             ERR("Out of memory\n");
3575             throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3576         }
3577
3578         memcpy(buf, str, count);
3579         this->seekhigh = buf + count;
3580
3581         this->state |= STRINGBUF_allocated;
3582
3583         if(!(state & STRINGBUF_no_read))
3584             basic_streambuf_char_setg(&this->base, buf, buf, buf + count);
3585
3586         if(!(state & STRINGBUF_no_write)) {
3587             basic_streambuf_char_setp_next(&this->base, buf, (state & STRINGBUF_at_end) ? buf + count : buf, buf + count);
3588
3589             if(!basic_streambuf_char_gptr(&this->base))
3590                 basic_streambuf_char_setg(&this->base, buf, 0, buf);
3591         }
3592     }
3593 }
3594
3595 /* ??0?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@H@Z */
3596 /* ??0?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@H@Z */
3597 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_ctor_str, 12)
3598 basic_stringbuf_char* __thiscall basic_stringbuf_char_ctor_str(basic_stringbuf_char *this,
3599         const basic_string_char *str, IOSB_openmode mode)
3600 {
3601     TRACE("(%p %p %d)\n", this, str, mode);
3602
3603     basic_streambuf_char_ctor(&this->base);
3604     this->base.vtable = &MSVCP_basic_stringbuf_char_vtable;
3605
3606     basic_stringbuf_char__Init(this, MSVCP_basic_string_char_c_str(str),
3607             str->size, basic_stringbuf_char__Getstate(this, mode));
3608     return this;
3609 }
3610
3611 /* ??0?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z */
3612 /* ??0?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@H@Z */
3613 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_ctor_mode, 8)
3614 basic_stringbuf_char* __thiscall basic_stringbuf_char_ctor_mode(
3615         basic_stringbuf_char *this, IOSB_openmode mode)
3616 {
3617     TRACE("(%p %d)\n", this, mode);
3618
3619     basic_streambuf_char_ctor(&this->base);
3620     this->base.vtable = &MSVCP_basic_stringbuf_char_vtable;
3621
3622     basic_stringbuf_char__Init(this, NULL, 0, basic_stringbuf_char__Getstate(this, mode));
3623     return this;
3624 }
3625
3626 /* ??_F?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
3627 /* ??_F?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
3628 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_ctor, 4)
3629 basic_stringbuf_char* __thiscall basic_stringbuf_char_ctor(basic_stringbuf_char *this)
3630 {
3631     return basic_stringbuf_char_ctor_mode(this, OPENMODE_in|OPENMODE_out);
3632 }
3633
3634 /* ?_Tidy@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAEXXZ */
3635 /* ?_Tidy@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IEAAXXZ */
3636 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char__Tidy, 4)
3637 void __thiscall basic_stringbuf_char__Tidy(basic_stringbuf_char *this)
3638 {
3639     TRACE("(%p)\n", this);
3640
3641     if(this->state & STRINGBUF_allocated) {
3642         MSVCRT_operator_delete(basic_streambuf_char_eback(&this->base));
3643         this->seekhigh = NULL;
3644         this->state &= ~STRINGBUF_allocated;
3645     }
3646
3647     basic_streambuf_char__Init_empty(&this->base);
3648 }
3649
3650 /* ??1?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UAE@XZ */
3651 /* ??1?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UEAA@XZ */
3652 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_dtor, 4)
3653 void __thiscall basic_stringbuf_char_dtor(basic_stringbuf_char *this)
3654 {
3655     TRACE("(%p)\n", this);
3656
3657     basic_stringbuf_char__Tidy(this);
3658     basic_streambuf_char_dtor(&this->base);
3659 }
3660
3661 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_vector_dtor, 8)
3662 basic_stringbuf_char* __thiscall basic_stringbuf_char_vector_dtor(basic_stringbuf_char *this, unsigned int flags)
3663 {
3664     TRACE("(%p %x)\n", this, flags);
3665
3666     if(flags & 2) {
3667         /* we have an array, with the number of elements stored before the first object */
3668         INT_PTR i, *ptr = (INT_PTR *) this - 1;
3669
3670         for (i = *ptr - 1; i >= 0; i--)
3671             basic_stringbuf_char_dtor(this+i);
3672
3673         MSVCRT_operator_delete(ptr);
3674     }else {
3675         basic_stringbuf_char_dtor(this);
3676
3677         if(flags & 1)
3678             MSVCRT_operator_delete(this);
3679     }
3680
3681     return this;
3682 }
3683
3684 /* ?overflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAEHH@Z */
3685 /* ?overflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MEAAHH@Z */
3686 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_overflow, 8)
3687 int __thiscall basic_stringbuf_char_overflow(basic_stringbuf_char *this, int meta)
3688 {
3689     MSVCP_size_t oldsize, size;
3690     char *ptr, *buf;
3691
3692     TRACE("(%p %x)\n", this, meta);
3693
3694     if(meta == EOF)
3695         return !EOF;
3696     if(this->state & STRINGBUF_no_write)
3697         return EOF;
3698
3699     ptr = basic_streambuf_char_pptr(&this->base);
3700     if((this->state&STRINGBUF_append) && ptr<this->seekhigh)
3701         basic_streambuf_char_setp_next(&this->base, basic_streambuf_char_pbase(&this->base),
3702                 this->seekhigh, basic_streambuf_char_epptr(&this->base));
3703
3704     if(ptr && ptr<basic_streambuf_char_epptr(&this->base))
3705         return (*basic_streambuf_char__Pninc(&this->base) = meta);
3706
3707     oldsize = (ptr ? basic_streambuf_char_epptr(&this->base)-basic_streambuf_char_eback(&this->base): 0);
3708     size = oldsize|0xf;
3709     size += size/2;
3710     buf = MSVCRT_operator_new(size);
3711     if(!buf) {
3712         ERR("Out of memory\n");
3713         throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3714     }
3715
3716     if(!oldsize) {
3717         this->seekhigh = buf;
3718         basic_streambuf_char_setp(&this->base, buf, buf+size);
3719         if(this->state & STRINGBUF_no_read)
3720             basic_streambuf_char_setg(&this->base, buf, NULL, buf);
3721         else
3722             basic_streambuf_char_setg(&this->base, buf, buf, buf+1);
3723
3724         this->state |= STRINGBUF_allocated;
3725     }else {
3726         ptr = basic_streambuf_char_eback(&this->base);
3727         memcpy(buf, ptr, oldsize);
3728
3729         this->seekhigh = buf+(this->seekhigh-ptr);
3730         basic_streambuf_char_setp_next(&this->base, buf,
3731                 buf+(basic_streambuf_char_pptr(&this->base)-ptr), buf+size);
3732         if(this->state & STRINGBUF_no_read)
3733             basic_streambuf_char_setg(&this->base, buf, NULL, buf);
3734         else
3735             basic_streambuf_char_setg(&this->base, buf,
3736                     buf+(basic_streambuf_char_gptr(&this->base)-ptr),
3737                     basic_streambuf_char_pptr(&this->base)+1);
3738
3739         MSVCRT_operator_delete(ptr);
3740     }
3741
3742     return (*basic_streambuf_char__Pninc(&this->base) = meta);
3743 }
3744
3745 /* ?pbackfail@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAEHH@Z */
3746 /* ?pbackfail@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MEAAHH@Z */
3747 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_pbackfail, 8)
3748 int __thiscall basic_stringbuf_char_pbackfail(basic_stringbuf_char *this, int c)
3749 {
3750     char *cur;
3751
3752     TRACE("(%p %x)\n", this, c);
3753
3754     cur = basic_streambuf_char_gptr(&this->base);
3755     if(!cur || cur==basic_streambuf_char_eback(&this->base)
3756             || (c!=EOF && c!=cur[-1] && this->state&STRINGBUF_no_write))
3757         return EOF;
3758
3759     if(c != EOF)
3760         cur[-1] = c;
3761     basic_streambuf_char_gbump(&this->base, -1);
3762     return c==EOF ? !EOF : c;
3763 }
3764
3765 /* ?underflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAEHXZ */
3766 /* ?underflow@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MEAAHXZ */
3767 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_underflow, 4)
3768 int __thiscall basic_stringbuf_char_underflow(basic_stringbuf_char *this)
3769 {
3770     char *ptr, *cur;
3771
3772     TRACE("(%p)\n", this);
3773
3774     cur = basic_streambuf_char_gptr(&this->base);
3775     if(!cur || this->state&STRINGBUF_no_read)
3776         return EOF;
3777
3778     ptr  = basic_streambuf_char_pptr(&this->base);
3779     if(this->seekhigh < ptr)
3780         this->seekhigh = ptr;
3781
3782     ptr = basic_streambuf_char_egptr(&this->base);
3783     if(this->seekhigh > ptr)
3784         basic_streambuf_char_setg(&this->base, basic_streambuf_char_eback(&this->base), cur, this->seekhigh);
3785
3786     if(cur < this->seekhigh)
3787         return *cur;
3788     return EOF;
3789 }
3790
3791 /* ?seekoff@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAE?AV?$fpos@H@2@JHH@Z */
3792 /* ?seekoff@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
3793 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_seekoff, 20)
3794 fpos_int* __thiscall basic_stringbuf_char_seekoff(basic_stringbuf_char *this,
3795         fpos_int *ret, streamoff off, int way, int mode)
3796 {
3797     char *beg, *cur_r, *cur_w;
3798
3799     TRACE("(%p %p %ld %d %d)\n", this, ret, off, way, mode);
3800
3801     cur_w = basic_streambuf_char_pptr(&this->base);
3802     if(cur_w > this->seekhigh)
3803         this->seekhigh = cur_w;
3804
3805     ret->off = 0;
3806     ret->state = 0;
3807
3808     beg = basic_streambuf_char_eback(&this->base);
3809     cur_r = basic_streambuf_char_gptr(&this->base);
3810     if((mode & OPENMODE_in) && cur_r) {
3811         if(way==SEEKDIR_cur && !(mode & OPENMODE_out))
3812             off += cur_r-beg;
3813         else if(way == SEEKDIR_end)
3814             off += this->seekhigh-beg;
3815         else if(way != SEEKDIR_beg)
3816             off = -1;
3817
3818         if(off<0 || off>this->seekhigh-beg) {
3819             off = -1;
3820         }else {
3821             basic_streambuf_char_gbump(&this->base, beg-cur_r+off);
3822             if((mode & OPENMODE_out) && cur_w) {
3823                 basic_streambuf_char_setp_next(&this->base, beg,
3824                         basic_streambuf_char_gptr(&this->base),
3825                         basic_streambuf_char_epptr(&this->base));
3826             }
3827         }
3828     }else if((mode & OPENMODE_out) && cur_w) {
3829         if(way == SEEKDIR_cur)
3830             off += cur_w-beg;
3831         else if(way == SEEKDIR_end)
3832             off += this->seekhigh-beg;
3833         else if(way != SEEKDIR_beg)
3834             off = -1;
3835
3836         if(off<0 || off>this->seekhigh-beg)
3837             off = -1;
3838         else
3839             basic_streambuf_char_pbump(&this->base, beg-cur_w+off);
3840     }else {
3841         off = -1;
3842     }
3843
3844     ret->pos = off;
3845     return ret;
3846 }
3847
3848 /* ?seekpos@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
3849 /* ?seekpos@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
3850 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_seekpos, 36)
3851 fpos_int* __thiscall basic_stringbuf_char_seekpos(basic_stringbuf_char *this,
3852         fpos_int *ret, fpos_int pos, int mode)
3853 {
3854     TRACE("(%p %p %s %d)\n", this, ret, debugstr_fpos_int(&pos), mode);
3855
3856     if(pos.off==0 && pos.pos==-1 && pos.state==0) {
3857         *ret = pos;
3858         return ret;
3859     }
3860
3861     return basic_stringbuf_char_seekoff(this, ret, pos.off, SEEKDIR_beg, mode);
3862 }
3863
3864 /* ?str@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
3865 /* ?str@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
3866 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_str_set, 8)
3867 void __thiscall basic_stringbuf_char_str_set(basic_stringbuf_char *this, const basic_string_char *str)
3868 {
3869     TRACE("(%p %p)\n", this, str);
3870
3871     basic_stringbuf_char__Tidy(this);
3872     basic_stringbuf_char__Init(this, MSVCP_basic_string_char_c_str(str), str->size, this->state);
3873 }
3874
3875 /* ?str@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3876 /* ?str@?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
3877 DEFINE_THISCALL_WRAPPER(basic_stringbuf_char_str_get, 8)
3878 basic_string_char* __thiscall basic_stringbuf_char_str_get(const basic_stringbuf_char *this, basic_string_char *ret)
3879 {
3880     char *ptr;
3881
3882     TRACE("(%p)\n", this);
3883
3884     if(!(this->state & STRINGBUF_no_write) && basic_streambuf_char_pptr(&this->base)) {
3885         char *pptr;
3886
3887         ptr = basic_streambuf_char_pbase(&this->base);
3888         pptr = basic_streambuf_char_pptr(&this->base);
3889
3890         return MSVCP_basic_string_char_ctor_cstr_len(ret, ptr, (this->seekhigh < pptr ? pptr : this->seekhigh) - ptr);
3891     }
3892
3893     if(!(this->state & STRINGBUF_no_read) && basic_streambuf_char_gptr(&this->base)) {
3894         ptr = basic_streambuf_char_eback(&this->base);
3895         return MSVCP_basic_string_char_ctor_cstr_len(ret, ptr, basic_streambuf_char_egptr(&this->base) - ptr);
3896     }
3897
3898     return MSVCP_basic_string_char_ctor(ret);
3899 }
3900
3901 /* ?_Getstate@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@AAEHH@Z */
3902 /* ?_Getstate@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@AEAAHH@Z */
3903 /* ?_Getstate@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AAEHH@Z */
3904 /* ?_Getstate@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@AEAAHH@Z */
3905 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar__Getstate, 8)
3906 int __thiscall basic_stringbuf_wchar__Getstate(basic_stringbuf_wchar *this, IOSB_openmode mode)
3907 {
3908     int state = 0;
3909
3910     if(!(mode & OPENMODE_in))
3911         state |= STRINGBUF_no_read;
3912
3913     if(!(mode & OPENMODE_out))
3914         state |= STRINGBUF_no_write;
3915
3916     if(mode & OPENMODE_ate)
3917         state |= STRINGBUF_at_end;
3918
3919     if(mode & OPENMODE_app)
3920         state |= STRINGBUF_append;
3921
3922     return state;
3923 }
3924
3925 /* ?_Init@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IAEXPB_WIH@Z */
3926 /* ?_Init@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IEAAXPEB_W_KH@Z */
3927 /* ?_Init@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IAEXPBGIH@Z */
3928 /* ?_Init@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IEAAXPEBG_KH@Z */
3929 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar__Init, 16)
3930 void __thiscall basic_stringbuf_wchar__Init(basic_stringbuf_wchar *this, const wchar_t *str, MSVCP_size_t count, int state)
3931 {
3932     TRACE("(%p, %p, %lu, %d)\n", this, str, count, state);
3933
3934     basic_streambuf_wchar__Init_empty(&this->base);
3935
3936     this->state = state;
3937     this->seekhigh = NULL;
3938
3939     if(count && str) {
3940         wchar_t *buf = MSVCRT_operator_new(count*sizeof(wchar_t));
3941         if(!buf) {
3942             ERR("Out of memory\n");
3943             throw_exception(EXCEPTION_BAD_ALLOC, NULL);
3944         }
3945
3946         memcpy(buf, str, count*sizeof(wchar_t));
3947         this->seekhigh = buf + count;
3948
3949         this->state |= STRINGBUF_allocated;
3950
3951         if(!(state & STRINGBUF_no_read))
3952             basic_streambuf_wchar_setg(&this->base, buf, buf, buf + count);
3953
3954         if(!(state & STRINGBUF_no_write)) {
3955             basic_streambuf_wchar_setp_next(&this->base, buf, (state & STRINGBUF_at_end) ? buf + count : buf, buf + count);
3956
3957             if(!basic_streambuf_wchar_gptr(&this->base))
3958                 basic_streambuf_wchar_setg(&this->base, buf, 0, buf);
3959         }
3960     }
3961 }
3962
3963 /* ??0?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@1@H@Z */
3964 /* ??0?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@AEBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@1@H@Z */
3965 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_ctor_str, 12)
3966 basic_stringbuf_wchar* __thiscall basic_stringbuf_wchar_ctor_str(basic_stringbuf_wchar *this,
3967         const basic_string_wchar *str, IOSB_openmode mode)
3968 {
3969     TRACE("(%p %p %d)\n", this, str, mode);
3970
3971     basic_streambuf_wchar_ctor(&this->base);
3972     this->base.vtable = &MSVCP_basic_stringbuf_wchar_vtable;
3973
3974     basic_stringbuf_wchar__Init(this, MSVCP_basic_string_wchar_c_str(str),
3975             str->size, basic_stringbuf_wchar__Getstate(this, mode));
3976     return this;
3977 }
3978
3979 /* ??0?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@1@H@Z */
3980 /* ??0?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@AEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@1@H@Z */
3981 DEFINE_THISCALL_WRAPPER(basic_stringbuf_short_ctor_str, 12)
3982 basic_stringbuf_wchar* __thiscall basic_stringbuf_short_ctor_str(basic_stringbuf_wchar *this,
3983         const basic_string_wchar *str, IOSB_openmode mode)
3984 {
3985     basic_stringbuf_wchar_ctor_str(this, str, mode);
3986     this->base.vtable = &MSVCP_basic_stringbuf_short_vtable;
3987     return this;
3988 }
3989
3990 /* ??0?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@H@Z */
3991 /* ??0?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@H@Z */
3992 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_ctor_mode, 8)
3993 basic_stringbuf_wchar* __thiscall basic_stringbuf_wchar_ctor_mode(
3994         basic_stringbuf_wchar *this, IOSB_openmode mode)
3995 {
3996     TRACE("(%p %d)\n", this, mode);
3997
3998     basic_streambuf_wchar_ctor(&this->base);
3999     this->base.vtable = &MSVCP_basic_stringbuf_wchar_vtable;
4000
4001     basic_stringbuf_wchar__Init(this, NULL, 0, basic_stringbuf_wchar__Getstate(this, mode));
4002     return this;
4003 }
4004
4005 /* ??0?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@H@Z */
4006 /* ??0?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@H@Z */
4007 DEFINE_THISCALL_WRAPPER(basic_stringbuf_short_ctor_mode, 8)
4008 basic_stringbuf_wchar* __thiscall basic_stringbuf_short_ctor_mode(
4009         basic_stringbuf_wchar *this, IOSB_openmode mode)
4010 {
4011     basic_stringbuf_wchar_ctor_mode(this, mode);
4012     this->base.vtable = &MSVCP_basic_stringbuf_short_vtable;
4013     return this;
4014 }
4015
4016 /* ??_F?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
4017 /* ??_F?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
4018 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_ctor, 4)
4019 basic_stringbuf_wchar* __thiscall basic_stringbuf_wchar_ctor(basic_stringbuf_wchar *this)
4020 {
4021     return basic_stringbuf_wchar_ctor_mode(this, OPENMODE_in|OPENMODE_out);
4022 }
4023
4024 /* ??_F?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
4025 /* ??_F?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
4026 DEFINE_THISCALL_WRAPPER(basic_stringbuf_short_ctor, 4)
4027 basic_stringbuf_wchar* __thiscall basic_stringbuf_short_ctor(basic_stringbuf_wchar *this)
4028 {
4029     return basic_stringbuf_short_ctor_mode(this, OPENMODE_in|OPENMODE_out);
4030 }
4031
4032 /* ?_Tidy@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IAEXXZ */
4033 /* ?_Tidy@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@IEAAXXZ */
4034 /* ?_Tidy@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IAEXXZ */
4035 /* ?_Tidy@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@IEAAXXZ */
4036 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar__Tidy, 4)
4037 void __thiscall basic_stringbuf_wchar__Tidy(basic_stringbuf_wchar *this)
4038 {
4039     TRACE("(%p)\n", this);
4040
4041     if(this->state & STRINGBUF_allocated) {
4042         MSVCRT_operator_delete(basic_streambuf_wchar_eback(&this->base));
4043         this->seekhigh = NULL;
4044         this->state &= ~STRINGBUF_allocated;
4045     }
4046
4047     basic_streambuf_wchar__Init_empty(&this->base);
4048 }
4049
4050 /* ??1?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UAE@XZ */
4051 /* ??1?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UEAA@XZ */
4052 /* ??1?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UAE@XZ */
4053 /* ??1?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UEAA@XZ */
4054 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_dtor, 4)
4055 void __thiscall basic_stringbuf_wchar_dtor(basic_stringbuf_wchar *this)
4056 {
4057     TRACE("(%p)\n", this);
4058
4059     basic_stringbuf_wchar__Tidy(this);
4060     basic_streambuf_wchar_dtor(&this->base);
4061 }
4062
4063 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_vector_dtor, 8)
4064 basic_stringbuf_wchar* __thiscall basic_stringbuf_wchar_vector_dtor(basic_stringbuf_wchar *this, unsigned int flags)
4065 {
4066     TRACE("(%p %x)\n", this, flags);
4067
4068     if(flags & 2) {
4069         /* we have an array, with the number of elements stored before the first object */
4070         INT_PTR i, *ptr = (INT_PTR *) this - 1;
4071
4072         for (i = *ptr - 1; i >= 0; i--)
4073             basic_stringbuf_wchar_dtor(this+i);
4074
4075         MSVCRT_operator_delete(ptr);
4076     }else {
4077         basic_stringbuf_wchar_dtor(this);
4078
4079         if(flags & 1)
4080             MSVCRT_operator_delete(this);
4081     }
4082
4083     return this;
4084 }
4085
4086 /* ?overflow@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MAEGG@Z */
4087 /* ?overflow@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MEAAGG@Z */
4088 /* ?overflow@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MAEGG@Z */
4089 /* ?overflow@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MEAAGG@Z */
4090 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_overflow, 8)
4091 unsigned short __thiscall basic_stringbuf_wchar_overflow(basic_stringbuf_wchar *this, unsigned short meta)
4092 {
4093     MSVCP_size_t oldsize, size;
4094     wchar_t *ptr, *buf;
4095
4096     TRACE("(%p %x)\n", this, meta);
4097
4098     if(meta == WEOF)
4099         return !WEOF;
4100     if(this->state & STRINGBUF_no_write)
4101         return WEOF;
4102
4103     ptr = basic_streambuf_wchar_pptr(&this->base);
4104     if((this->state&STRINGBUF_append) && ptr<this->seekhigh)
4105         basic_streambuf_wchar_setp_next(&this->base, basic_streambuf_wchar_pbase(&this->base),
4106                 this->seekhigh, basic_streambuf_wchar_epptr(&this->base));
4107
4108     if(ptr && ptr<basic_streambuf_wchar_epptr(&this->base))
4109         return (*basic_streambuf_wchar__Pninc(&this->base) = meta);
4110
4111     oldsize = (ptr ? basic_streambuf_wchar_epptr(&this->base)-basic_streambuf_wchar_eback(&this->base): 0);
4112     size = oldsize|0xf;
4113     size += size/2;
4114     buf = MSVCRT_operator_new(size*sizeof(wchar_t));
4115     if(!buf) {
4116         ERR("Out of memory\n");
4117         throw_exception(EXCEPTION_BAD_ALLOC, NULL);
4118     }
4119
4120     if(!oldsize) {
4121         this->seekhigh = buf;
4122         basic_streambuf_wchar_setp(&this->base, buf, buf+size);
4123         if(this->state & STRINGBUF_no_read)
4124             basic_streambuf_wchar_setg(&this->base, buf, NULL, buf);
4125         else
4126             basic_streambuf_wchar_setg(&this->base, buf, buf, buf+1);
4127
4128         this->state |= STRINGBUF_allocated;
4129     }else {
4130         ptr = basic_streambuf_wchar_eback(&this->base);
4131         memcpy(buf, ptr, oldsize*sizeof(wchar_t));
4132
4133         this->seekhigh = buf+(this->seekhigh-ptr);
4134         basic_streambuf_wchar_setp_next(&this->base, buf,
4135                 buf+(basic_streambuf_wchar_pptr(&this->base)-ptr), buf+size);
4136         if(this->state & STRINGBUF_no_read)
4137             basic_streambuf_wchar_setg(&this->base, buf, NULL, buf);
4138         else
4139             basic_streambuf_wchar_setg(&this->base, buf,
4140                     buf+(basic_streambuf_wchar_gptr(&this->base)-ptr),
4141                     basic_streambuf_wchar_pptr(&this->base)+1);
4142
4143         MSVCRT_operator_delete(ptr);
4144     }
4145
4146     return (*basic_streambuf_wchar__Pninc(&this->base) = meta);
4147 }
4148
4149 /* ?pbackfail@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MAEGG@Z */
4150 /* ?pbackfail@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MEAAGG@Z */
4151 /* ?pbackfail@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MAEGG@Z */
4152 /* ?pbackfail@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MEAAGG@Z */
4153 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_pbackfail, 8)
4154 unsigned short __thiscall basic_stringbuf_wchar_pbackfail(basic_stringbuf_wchar *this, unsigned short c)
4155 {
4156     wchar_t *cur;
4157
4158     TRACE("(%p %x)\n", this, c);
4159
4160     cur = basic_streambuf_wchar_gptr(&this->base);
4161     if(!cur || cur==basic_streambuf_wchar_eback(&this->base)
4162             || (c!=WEOF && c!=cur[-1] && this->state&STRINGBUF_no_write))
4163         return WEOF;
4164
4165     if(c != WEOF)
4166         cur[-1] = c;
4167     basic_streambuf_wchar_gbump(&this->base, -1);
4168     return c==WEOF ? !WEOF : c;
4169 }
4170
4171 /* ?underflow@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MAEGXZ */
4172 /* ?underflow@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MEAAGXZ */
4173 /* ?underflow@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MAEGXZ */
4174 /* ?underflow@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MEAAGXZ */
4175 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_underflow, 4)
4176 unsigned short __thiscall basic_stringbuf_wchar_underflow(basic_stringbuf_wchar *this)
4177 {
4178     wchar_t *ptr, *cur;
4179
4180     TRACE("(%p)\n", this);
4181
4182     cur = basic_streambuf_wchar_gptr(&this->base);
4183     if(!cur || this->state&STRINGBUF_no_read)
4184         return WEOF;
4185
4186     ptr  = basic_streambuf_wchar_pptr(&this->base);
4187     if(this->seekhigh < ptr)
4188         this->seekhigh = ptr;
4189
4190     ptr = basic_streambuf_wchar_egptr(&this->base);
4191     if(this->seekhigh > ptr)
4192         basic_streambuf_wchar_setg(&this->base, basic_streambuf_wchar_eback(&this->base), cur, this->seekhigh);
4193
4194     if(cur < this->seekhigh)
4195         return *cur;
4196     return WEOF;
4197 }
4198
4199 /* ?seekoff@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MAE?AV?$fpos@H@2@JHH@Z */
4200 /* ?seekoff@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
4201 /* ?seekoff@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MAE?AV?$fpos@H@2@JHH@Z */
4202 /* ?seekoff@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
4203 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_seekoff, 20)
4204 fpos_int* __thiscall basic_stringbuf_wchar_seekoff(basic_stringbuf_wchar *this,
4205         fpos_int *ret, streamoff off, int way, int mode)
4206 {
4207     wchar_t *beg, *cur_r, *cur_w;
4208
4209     TRACE("(%p %p %ld %d %d)\n", this, ret, off, way, mode);
4210
4211     cur_w = basic_streambuf_wchar_pptr(&this->base);
4212     if(cur_w > this->seekhigh)
4213         this->seekhigh = cur_w;
4214
4215     ret->off = 0;
4216     ret->state = 0;
4217
4218     beg = basic_streambuf_wchar_eback(&this->base);
4219     cur_r = basic_streambuf_wchar_gptr(&this->base);
4220     if((mode & OPENMODE_in) && cur_r) {
4221         if(way==SEEKDIR_cur && !(mode & OPENMODE_out))
4222             off += cur_r-beg;
4223         else if(way == SEEKDIR_end)
4224             off += this->seekhigh-beg;
4225         else if(way != SEEKDIR_beg)
4226             off = -1;
4227
4228         if(off<0 || off>this->seekhigh-beg) {
4229             off = -1;
4230         }else {
4231             basic_streambuf_wchar_gbump(&this->base, beg-cur_r+off);
4232             if((mode & OPENMODE_out) && cur_w) {
4233                 basic_streambuf_wchar_setp_next(&this->base, beg,
4234                         basic_streambuf_wchar_gptr(&this->base),
4235                         basic_streambuf_wchar_epptr(&this->base));
4236             }
4237         }
4238     }else if((mode & OPENMODE_out) && cur_w) {
4239         if(way == SEEKDIR_cur)
4240             off += cur_w-beg;
4241         else if(way == SEEKDIR_end)
4242             off += this->seekhigh-beg;
4243         else if(way != SEEKDIR_beg)
4244             off = -1;
4245
4246         if(off<0 || off>this->seekhigh-beg)
4247             off = -1;
4248         else
4249             basic_streambuf_wchar_pbump(&this->base, beg-cur_w+off);
4250     }else {
4251         off = -1;
4252     }
4253
4254     ret->pos = off;
4255     return ret;
4256 }
4257
4258 /* ?seekpos@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
4259 /* ?seekpos@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
4260 /* ?seekpos@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
4261 /* ?seekpos@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
4262 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_seekpos, 36)
4263 fpos_int* __thiscall basic_stringbuf_wchar_seekpos(basic_stringbuf_wchar *this,
4264         fpos_int *ret, fpos_int pos, int mode)
4265 {
4266     TRACE("(%p %p %s %d)\n", this, ret, debugstr_fpos_int(&pos), mode);
4267
4268     if(pos.off==0 && pos.pos==-1 && pos.state==0) {
4269         *ret = pos;
4270         return ret;
4271     }
4272
4273     return basic_stringbuf_wchar_seekoff(this, ret, pos.off, SEEKDIR_beg, mode);
4274 }
4275
4276 /* ?str@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@@Z */
4277 /* ?str@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXAEBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@@Z */
4278 /* ?str@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z */
4279 /* ?str@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z */
4280 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_str_set, 8)
4281 void __thiscall basic_stringbuf_wchar_str_set(basic_stringbuf_wchar *this, const basic_string_wchar *str)
4282 {
4283     TRACE("(%p %p)\n", this, str);
4284
4285     basic_stringbuf_wchar__Tidy(this);
4286     basic_stringbuf_wchar__Init(this, MSVCP_basic_string_wchar_c_str(str), str->size, this->state);
4287 }
4288
4289 /* ?str@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4290 /* ?str@?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
4291 /* ?str@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4292 /* ?str@?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
4293 DEFINE_THISCALL_WRAPPER(basic_stringbuf_wchar_str_get, 8)
4294 basic_string_wchar* __thiscall basic_stringbuf_wchar_str_get(const basic_stringbuf_wchar *this, basic_string_wchar *ret)
4295 {
4296     wchar_t *ptr;
4297
4298     TRACE("(%p)\n", this);
4299
4300     if(!(this->state & STRINGBUF_no_write) && basic_streambuf_wchar_pptr(&this->base)) {
4301         wchar_t *pptr;
4302
4303         ptr = basic_streambuf_wchar_pbase(&this->base);
4304         pptr = basic_streambuf_wchar_pptr(&this->base);
4305
4306         return MSVCP_basic_string_wchar_ctor_cstr_len(ret, ptr, (this->seekhigh < pptr ? pptr : this->seekhigh) - ptr);
4307     }
4308
4309     if(!(this->state & STRINGBUF_no_read) && basic_streambuf_wchar_gptr(&this->base)) {
4310         ptr = basic_streambuf_wchar_eback(&this->base);
4311         return MSVCP_basic_string_wchar_ctor_cstr_len(ret, ptr, basic_streambuf_wchar_egptr(&this->base) - ptr);
4312     }
4313
4314     return MSVCP_basic_string_wchar_ctor(ret);
4315 }
4316
4317 /* ??0ios_base@std@@IAE@XZ */
4318 /* ??0ios_base@std@@IEAA@XZ */
4319 DEFINE_THISCALL_WRAPPER(ios_base_ctor, 4)
4320 ios_base* __thiscall ios_base_ctor(ios_base *this)
4321 {
4322     TRACE("(%p)\n", this);
4323     this->vtable = &MSVCP_ios_base_vtable;
4324     return this;
4325 }
4326
4327 /* ??0ios_base@std@@QAE@ABV01@@Z */
4328 /* ??0ios_base@std@@QEAA@AEBV01@@Z */
4329 DEFINE_THISCALL_WRAPPER(ios_base_copy_ctor, 8)
4330 ios_base* __thiscall ios_base_copy_ctor(ios_base *this, const ios_base *copy)
4331 {
4332     TRACE("(%p %p)\n", this, copy);
4333     *this = *copy;
4334     this->vtable = &MSVCP_ios_base_vtable;
4335     return this;
4336 }
4337
4338 /* ?_Callfns@ios_base@std@@AAEXW4event@12@@Z */
4339 /* ?_Callfns@ios_base@std@@AEAAXW4event@12@@Z */
4340 DEFINE_THISCALL_WRAPPER(ios_base_Callfns, 8)
4341 void __thiscall ios_base_Callfns(ios_base *this, IOS_BASE_event event)
4342 {
4343     IOS_BASE_fnarray *cur;
4344
4345     TRACE("(%p %x)\n", this, event);
4346
4347     for(cur=this->calls; cur; cur=cur->next)
4348         cur->event_handler(event, this, cur->index);
4349 }
4350
4351 /* ?_Tidy@ios_base@std@@AAAXXZ */
4352 /* ?_Tidy@ios_base@std@@AEAAXXZ */
4353 void CDECL ios_base_Tidy(ios_base *this)
4354 {
4355     IOS_BASE_iosarray *arr_cur, *arr_next;
4356     IOS_BASE_fnarray *event_cur, *event_next;
4357
4358     TRACE("(%p)\n", this);
4359
4360     ios_base_Callfns(this, EVENT_erase_event);
4361
4362     for(arr_cur=this->arr; arr_cur; arr_cur=arr_next) {
4363         arr_next = arr_cur->next;
4364         MSVCRT_operator_delete(arr_cur);
4365     }
4366     this->arr = NULL;
4367
4368     for(event_cur=this->calls; event_cur; event_cur=event_next) {
4369         event_next = event_cur->next;
4370         MSVCRT_operator_delete(event_cur);
4371     }
4372     this->calls = NULL;
4373 }
4374
4375 /* ?_Ios_base_dtor@ios_base@std@@CAXPAV12@@Z */
4376 /* ?_Ios_base_dtor@ios_base@std@@CAXPEAV12@@Z */
4377 void CDECL ios_base_Ios_base_dtor(ios_base *obj)
4378 {
4379     TRACE("(%p)\n", obj);
4380     if(obj->loc) {
4381         locale_dtor(obj->loc);
4382         MSVCRT_operator_delete(obj->loc);
4383     }
4384     ios_base_Tidy(obj);
4385 }
4386
4387 /* ??1ios_base@std@@UAE@XZ */
4388 /* ??1ios_base@std@@UEAA@XZ */
4389 DEFINE_THISCALL_WRAPPER(ios_base_dtor, 4)
4390 void __thiscall ios_base_dtor(ios_base *this)
4391 {
4392     ios_base_Ios_base_dtor(this);
4393 }
4394
4395 DEFINE_THISCALL_WRAPPER(ios_base_vector_dtor, 8)
4396 ios_base* __thiscall ios_base_vector_dtor(ios_base *this, unsigned int flags)
4397 {
4398     TRACE("(%p %x)\n", this, flags);
4399     if(flags & 2) {
4400         /* we have an array, with the number of elements stored before the first object */
4401         INT_PTR i, *ptr = (INT_PTR *)this-1;
4402
4403         for(i=*ptr-1; i>=0; i--)
4404             ios_base_dtor(this+i);
4405         MSVCRT_operator_delete(ptr);
4406     } else {
4407         ios_base_dtor(this);
4408         if(flags & 1)
4409             MSVCRT_operator_delete(this);
4410     }
4411
4412     return this;
4413 }
4414
4415 DEFINE_THISCALL_WRAPPER(iosb_vector_dtor, 8)
4416 void* __thiscall iosb_vector_dtor(void *this, unsigned int flags)
4417 {
4418     TRACE("(%p %x)\n", this, flags);
4419     if(flags & 2) {
4420         INT_PTR *ptr = (INT_PTR *)this-1;
4421         MSVCRT_operator_delete(ptr);
4422     } else {
4423         if(flags & 1)
4424             MSVCRT_operator_delete(this);
4425     }
4426
4427     return this;
4428 }
4429
4430 /* ?_Findarr@ios_base@std@@AAEAAU_Iosarray@12@H@Z */
4431 /* ?_Findarr@ios_base@std@@AEAAAEAU_Iosarray@12@H@Z */
4432 DEFINE_THISCALL_WRAPPER(ios_base_Findarr, 8)
4433 IOS_BASE_iosarray* __thiscall ios_base_Findarr(ios_base *this, int index)
4434 {
4435     IOS_BASE_iosarray *p;
4436
4437     TRACE("(%p %d)\n", this, index);
4438
4439     for(p=this->arr; p; p=p->next) {
4440         if(p->index == index)
4441             return p;
4442     }
4443
4444     for(p=this->arr; p; p=p->next) {
4445         if(!p->long_val && !p->ptr_val) {
4446             p->index = index;
4447             return p;
4448         }
4449     }
4450
4451     p = MSVCRT_operator_new(sizeof(IOS_BASE_iosarray));
4452     p->next = this->arr;
4453     p->index = index;
4454     p->long_val = 0;
4455     p->ptr_val = NULL;
4456     this->arr = p;
4457     return p;
4458 }
4459
4460 /* ?iword@ios_base@std@@QAEAAJH@Z */
4461 /* ?iword@ios_base@std@@QEAAAEAJH@Z */
4462 DEFINE_THISCALL_WRAPPER(ios_base_iword, 8)
4463 LONG* __thiscall ios_base_iword(ios_base *this, int index)
4464 {
4465     TRACE("(%p %d)\n", this, index);
4466     return &ios_base_Findarr(this, index)->long_val;
4467 }
4468
4469 /* ?pword@ios_base@std@@QAEAAPAXH@Z */
4470 /* ?pword@ios_base@std@@QEAAAEAPEAXH@Z */
4471 DEFINE_THISCALL_WRAPPER(ios_base_pword, 8)
4472 void** __thiscall ios_base_pword(ios_base *this, int index)
4473 {
4474     TRACE("(%p %d)\n", this, index);
4475     return &ios_base_Findarr(this, index)->ptr_val;
4476 }
4477
4478 /* ?register_callback@ios_base@std@@QAEXP6AXW4event@12@AAV12@H@ZH@Z */
4479 /* ?register_callback@ios_base@std@@QEAAXP6AXW4event@12@AEAV12@H@ZH@Z */
4480 DEFINE_THISCALL_WRAPPER(ios_base_register_callback, 12)
4481 void __thiscall ios_base_register_callback(ios_base *this, IOS_BASE_event_callback callback, int index)
4482 {
4483     IOS_BASE_fnarray *event;
4484
4485     TRACE("(%p %p %d)\n", this, callback, index);
4486
4487     event = MSVCRT_operator_new(sizeof(IOS_BASE_fnarray));
4488     event->next = this->calls;
4489     event->index = index;
4490     event->event_handler = callback;
4491     this->calls = event;
4492 }
4493
4494 /* ?clear@ios_base@std@@QAEXH_N@Z */
4495 /* ?clear@ios_base@std@@QEAAXH_N@Z */
4496 DEFINE_THISCALL_WRAPPER(ios_base_clear_reraise, 12)
4497 void __thiscall ios_base_clear_reraise(ios_base *this, IOSB_iostate state, MSVCP_bool reraise)
4498 {
4499     TRACE("(%p %x %x)\n", this, state, reraise);
4500
4501     this->state = state & IOSTATE_mask;
4502     if(!(this->state & this->except))
4503         return;
4504
4505     if(reraise)
4506         throw_exception(EXCEPTION_RERAISE, NULL);
4507     else if(this->state & this->except & IOSTATE_eofbit)
4508         throw_exception(EXCEPTION_FAILURE, "eofbit is set");
4509     else if(this->state & this->except & IOSTATE_failbit)
4510         throw_exception(EXCEPTION_FAILURE, "failbit is set");
4511     else if(this->state & this->except & IOSTATE_badbit)
4512         throw_exception(EXCEPTION_FAILURE, "badbit is set");
4513     else if(this->state & this->except & IOSTATE__Hardfail)
4514         throw_exception(EXCEPTION_FAILURE, "_Hardfail is set");
4515 }
4516
4517 /* ?clear@ios_base@std@@QAEXH@Z */
4518 /* ?clear@ios_base@std@@QEAAXH@Z */
4519 DEFINE_THISCALL_WRAPPER(ios_base_clear, 8)
4520 void __thiscall ios_base_clear(ios_base *this, IOSB_iostate state)
4521 {
4522     ios_base_clear_reraise(this, state, FALSE);
4523 }
4524
4525 /* ?clear@ios_base@std@@QAEXI@Z */
4526 /* ?clear@ios_base@std@@QEAAXI@Z */
4527 DEFINE_THISCALL_WRAPPER(ios_base_clear_unsigned, 8)
4528 void __thiscall ios_base_clear_unsigned(ios_base *this, unsigned int state)
4529 {
4530     ios_base_clear_reraise(this, (IOSB_iostate)state, FALSE);
4531 }
4532
4533 /* ?exceptions@ios_base@std@@QAEXH@Z */
4534 /* ?exceptions@ios_base@std@@QEAAXH@Z */
4535 DEFINE_THISCALL_WRAPPER(ios_base_exceptions_set, 8)
4536 void __thiscall ios_base_exceptions_set(ios_base *this, IOSB_iostate state)
4537 {
4538     TRACE("(%p %x)\n", this, state);
4539     this->except = state & IOSTATE_mask;
4540     ios_base_clear(this, this->state);
4541 }
4542
4543 /* ?exceptions@ios_base@std@@QAEXI@Z */
4544 /* ?exceptions@ios_base@std@@QEAAXI@Z */
4545 DEFINE_THISCALL_WRAPPER(ios_base_exceptions_set_unsigned, 8)
4546 void __thiscall ios_base_exceptions_set_unsigned(ios_base *this, unsigned int state)
4547 {
4548     TRACE("(%p %x)\n", this, state);
4549     ios_base_exceptions_set(this, state);
4550 }
4551
4552 /* ?exceptions@ios_base@std@@QBEHXZ */
4553 /* ?exceptions@ios_base@std@@QEBAHXZ */
4554 DEFINE_THISCALL_WRAPPER(ios_base_exceptions_get, 4)
4555 IOSB_iostate __thiscall ios_base_exceptions_get(ios_base *this)
4556 {
4557     TRACE("(%p)\n", this);
4558     return this->except;
4559 }
4560
4561 /* ?copyfmt@ios_base@std@@QAEAAV12@ABV12@@Z */
4562 /* ?copyfmt@ios_base@std@@QEAAAEAV12@AEBV12@@Z */
4563 DEFINE_THISCALL_WRAPPER(ios_base_copyfmt, 8)
4564 ios_base* __thiscall ios_base_copyfmt(ios_base *this, const ios_base *rhs)
4565 {
4566     TRACE("(%p %p)\n", this, rhs);
4567
4568     if(this != rhs) {
4569         IOS_BASE_iosarray *arr_cur;
4570         IOS_BASE_fnarray *event_cur;
4571
4572         ios_base_Tidy(this);
4573
4574         for(arr_cur=rhs->arr; arr_cur; arr_cur=arr_cur->next) {
4575             if(arr_cur->long_val)
4576                 *ios_base_iword(this, arr_cur->index) = arr_cur->long_val;
4577             if(arr_cur->ptr_val)
4578                 *ios_base_pword(this, arr_cur->index) = arr_cur->ptr_val;
4579         }
4580         this->stdstr = rhs->stdstr;
4581         this->fmtfl = rhs->fmtfl;
4582         this->prec = rhs->prec;
4583         this->wide = rhs->wide;
4584         locale_operator_assign(this->loc, rhs->loc);
4585
4586         for(event_cur=rhs->calls; event_cur; event_cur=event_cur->next)
4587             ios_base_register_callback(this, event_cur->event_handler, event_cur->index);
4588
4589         ios_base_Callfns(this, EVENT_copyfmt_event);
4590         ios_base_exceptions_set(this, rhs->except);
4591     }
4592
4593     return this;
4594 }
4595
4596 /* ??4ios_base@std@@QAEAAV01@ABV01@@Z */
4597 /* ??4ios_base@std@@QEAAAEAV01@AEBV01@@Z */
4598 DEFINE_THISCALL_WRAPPER(ios_base_assign, 8)
4599 ios_base* __thiscall ios_base_assign(ios_base *this, const ios_base *right)
4600 {
4601     TRACE("(%p %p)\n", this, right);
4602
4603     if(this != right) {
4604         this->state = right->state;
4605         ios_base_copyfmt(this, right);
4606     }
4607
4608     return this;
4609 }
4610
4611 /* ?fail@ios_base@std@@QBE_NXZ */
4612 /* ?fail@ios_base@std@@QEBA_NXZ */
4613 DEFINE_THISCALL_WRAPPER(ios_base_fail, 4)
4614 MSVCP_bool __thiscall ios_base_fail(const ios_base *this)
4615 {
4616     TRACE("(%p)\n", this);
4617     return (this->state & (IOSTATE_failbit|IOSTATE_badbit)) != 0;
4618 }
4619
4620 /* ??7ios_base@std@@QBE_NXZ */
4621 /* ??7ios_base@std@@QEBA_NXZ */
4622 DEFINE_THISCALL_WRAPPER(ios_base_op_succ, 4)
4623 MSVCP_bool __thiscall ios_base_op_succ(const ios_base *this)
4624 {
4625     TRACE("(%p)\n", this);
4626     return ios_base_fail(this);
4627 }
4628
4629 /* ??Bios_base@std@@QBEPAXXZ */
4630 /* ??Bios_base@std@@QEBAPEAXXZ */
4631 DEFINE_THISCALL_WRAPPER(ios_base_op_fail, 4)
4632 void* __thiscall ios_base_op_fail(const ios_base *this)
4633 {
4634     TRACE("(%p)\n", this);
4635     return ios_base_fail(this) ? NULL : (void*)this;
4636 }
4637
4638 /* ?_Addstd@ios_base@std@@SAXPAV12@@Z */
4639 /* ?_Addstd@ios_base@std@@SAXPEAV12@@Z */
4640 void CDECL ios_base_Addstd(ios_base *add)
4641 {
4642     FIXME("(%p) stub\n", add);
4643 }
4644
4645 /* ?_Index_func@ios_base@std@@CAAAHXZ */
4646 /* ?_Index_func@ios_base@std@@CAAEAHXZ */
4647 int* CDECL ios_base_Index_func(void)
4648 {
4649     TRACE("\n");
4650     return &ios_base_Index;
4651 }
4652
4653 /* ?_Init@ios_base@std@@IAEXXZ */
4654 /* ?_Init@ios_base@std@@IEAAXXZ */
4655 DEFINE_THISCALL_WRAPPER(ios_base_Init, 4)
4656 void __thiscall ios_base_Init(ios_base *this)
4657 {
4658     TRACE("(%p)\n", this);
4659
4660     this->stdstr = 0;
4661     this->state = this->except = IOSTATE_goodbit;
4662     this->fmtfl = FMTFLAG_skipws | FMTFLAG_dec;
4663     this->prec = 6;
4664     this->wide = 0;
4665     this->arr = NULL;
4666     this->calls = NULL;
4667     this->loc = MSVCRT_operator_new(sizeof(locale));
4668     locale_ctor(this->loc);
4669 }
4670
4671 /* ?_Sync_func@ios_base@std@@CAAA_NXZ */
4672 /* ?_Sync_func@ios_base@std@@CAAEA_NXZ */
4673 MSVCP_bool* CDECL ios_base_Sync_func(void)
4674 {
4675     TRACE("\n");
4676     return &ios_base_Sync;
4677 }
4678
4679 /* ?bad@ios_base@std@@QBE_NXZ */
4680 /* ?bad@ios_base@std@@QEBA_NXZ */
4681 DEFINE_THISCALL_WRAPPER(ios_base_bad, 4)
4682 MSVCP_bool __thiscall ios_base_bad(const ios_base *this)
4683 {
4684     TRACE("(%p)\n", this);
4685     return (this->state & IOSTATE_badbit) != 0;
4686 }
4687
4688 /* ?eof@ios_base@std@@QBE_NXZ */
4689 /* ?eof@ios_base@std@@QEBA_NXZ */
4690 DEFINE_THISCALL_WRAPPER(ios_base_eof, 4)
4691 MSVCP_bool __thiscall ios_base_eof(const ios_base *this)
4692 {
4693     TRACE("(%p)\n", this);
4694     return (this->state & IOSTATE_eofbit) != 0;
4695 }
4696
4697 /* ?flags@ios_base@std@@QAEHH@Z */
4698 /* ?flags@ios_base@std@@QEAAHH@Z */
4699 DEFINE_THISCALL_WRAPPER(ios_base_flags_set, 8)
4700 IOSB_fmtflags __thiscall ios_base_flags_set(ios_base *this, IOSB_fmtflags flags)
4701 {
4702     IOSB_fmtflags ret = this->fmtfl;
4703
4704     TRACE("(%p %x)\n", this, flags);
4705
4706     this->fmtfl = flags & FMTFLAG_mask;
4707     return ret;
4708 }
4709
4710 /* ?flags@ios_base@std@@QBEHXZ */
4711 /* ?flags@ios_base@std@@QEBAHXZ */
4712 DEFINE_THISCALL_WRAPPER(ios_base_flags_get, 4)
4713 IOSB_fmtflags __thiscall ios_base_flags_get(const ios_base *this)
4714 {
4715     TRACE("(%p)\n", this);
4716     return this->fmtfl;
4717 }
4718
4719 /* ?getloc@ios_base@std@@QBE?AVlocale@2@XZ */
4720 /* ?getloc@ios_base@std@@QEBA?AVlocale@2@XZ */
4721 DEFINE_THISCALL_WRAPPER(ios_base_getloc, 8)
4722 locale* __thiscall ios_base_getloc(const ios_base *this, locale *ret)
4723 {
4724     TRACE("(%p)\n", this);
4725     return locale_copy_ctor(ret, this->loc);
4726 }
4727
4728 /* ?good@ios_base@std@@QBE_NXZ */
4729 /* ?good@ios_base@std@@QEBA_NXZ */
4730 DEFINE_THISCALL_WRAPPER(ios_base_good, 4)
4731 MSVCP_bool __thiscall ios_base_good(const ios_base *this)
4732 {
4733     TRACE("(%p)\n", this);
4734     return this->state == IOSTATE_goodbit;
4735 }
4736
4737 /* ?imbue@ios_base@std@@QAE?AVlocale@2@ABV32@@Z */
4738 /* ?imbue@ios_base@std@@QEAA?AVlocale@2@AEBV32@@Z */
4739 DEFINE_THISCALL_WRAPPER(ios_base_imbue, 12)
4740 locale* __thiscall ios_base_imbue(ios_base *this, locale *ret, const locale *loc)
4741 {
4742     TRACE("(%p %p)\n", this, loc);
4743     *ret = *this->loc;
4744     locale_copy_ctor(this->loc, loc);
4745     return ret;
4746 }
4747
4748 /* ?precision@ios_base@std@@QAEHH@Z */
4749 /* ?precision@ios_base@std@@QEAA_J_J@Z */
4750 DEFINE_THISCALL_WRAPPER(ios_base_precision_set, 8)
4751 streamsize __thiscall ios_base_precision_set(ios_base *this, streamsize precision)
4752 {
4753     streamsize ret = this->prec;
4754
4755     TRACE("(%p %ld)\n", this, precision);
4756
4757     this->prec = precision;
4758     return ret;
4759 }
4760
4761 /* ?precision@ios_base@std@@QBEHXZ */
4762 /* ?precision@ios_base@std@@QEBA_JXZ */
4763 DEFINE_THISCALL_WRAPPER(ios_base_precision_get, 4)
4764 streamsize __thiscall ios_base_precision_get(const ios_base *this)
4765 {
4766     TRACE("(%p)\n", this);
4767     return this->prec;
4768 }
4769
4770 /* ?rdstate@ios_base@std@@QBEHXZ */
4771 /* ?rdstate@ios_base@std@@QEBAHXZ */
4772 DEFINE_THISCALL_WRAPPER(ios_base_rdstate, 4)
4773 IOSB_iostate __thiscall ios_base_rdstate(const ios_base *this)
4774 {
4775     TRACE("(%p)\n", this);
4776     return this->state;
4777 }
4778
4779 /* ?setf@ios_base@std@@QAEHHH@Z */
4780 /* ?setf@ios_base@std@@QEAAHHH@Z */
4781 DEFINE_THISCALL_WRAPPER(ios_base_setf_mask, 12)
4782 IOSB_fmtflags __thiscall ios_base_setf_mask(ios_base *this, IOSB_fmtflags flags, IOSB_fmtflags mask)
4783 {
4784     IOSB_fmtflags ret = this->fmtfl;
4785
4786     TRACE("(%p %x %x)\n", this, flags, mask);
4787
4788     this->fmtfl = (this->fmtfl & (~mask)) | (flags & mask & FMTFLAG_mask);
4789     return ret;
4790 }
4791
4792 /* ?setf@ios_base@std@@QAEHH@Z */
4793 /* ?setf@ios_base@std@@QEAAHH@Z */
4794 DEFINE_THISCALL_WRAPPER(ios_base_setf, 8)
4795 IOSB_fmtflags __thiscall ios_base_setf(ios_base *this, IOSB_fmtflags flags)
4796 {
4797     return ios_base_setf_mask(this, flags, ~0);
4798 }
4799
4800 /* ?setstate@ios_base@std@@QAEXH_N@Z */
4801 /* ?setstate@ios_base@std@@QEAAXH_N@Z */
4802 DEFINE_THISCALL_WRAPPER(ios_base_setstate_reraise, 12)
4803 void __thiscall ios_base_setstate_reraise(ios_base *this, IOSB_iostate state, MSVCP_bool reraise)
4804 {
4805     TRACE("(%p %x %x)\n", this, state, reraise);
4806
4807     if(state != IOSTATE_goodbit)
4808         ios_base_clear_reraise(this, this->state | state, reraise);
4809 }
4810
4811 /* ?setstate@ios_base@std@@QAEXH@Z */
4812 /* ?setstate@ios_base@std@@QEAAXH@Z */
4813 DEFINE_THISCALL_WRAPPER(ios_base_setstate, 8)
4814 void __thiscall ios_base_setstate(ios_base *this, IOSB_iostate state)
4815 {
4816     ios_base_setstate_reraise(this, state, FALSE);
4817 }
4818
4819 /* ?setstate@ios_base@std@@QAEXI@Z */
4820 /* ?setstate@ios_base@std@@QEAAXI@Z */
4821 DEFINE_THISCALL_WRAPPER(ios_base_setstate_unsigned, 8)
4822 void __thiscall ios_base_setstate_unsigned(ios_base *this, unsigned int state)
4823 {
4824     ios_base_setstate_reraise(this, (IOSB_iostate)state, FALSE);
4825 }
4826
4827 /* ?sync_with_stdio@ios_base@std@@SA_N_N@Z */
4828 MSVCP_bool CDECL ios_base_sync_with_stdio(MSVCP_bool sync)
4829 {
4830     _Lockit lock;
4831     MSVCP_bool ret;
4832
4833     TRACE("(%x)\n", sync);
4834
4835     _Lockit_ctor_locktype(&lock, _LOCK_STREAM);
4836     ret = ios_base_Sync;
4837     ios_base_Sync = sync;
4838     _Lockit_dtor(&lock);
4839     return ret;
4840 }
4841
4842 /* ?unsetf@ios_base@std@@QAEXH@Z */
4843 /* ?unsetf@ios_base@std@@QEAAXH@Z */
4844 DEFINE_THISCALL_WRAPPER(ios_base_unsetf, 8)
4845 void __thiscall ios_base_unsetf(ios_base *this, IOSB_fmtflags flags)
4846 {
4847     TRACE("(%p %x)\n", this, flags);
4848     this->fmtfl &= ~flags;
4849 }
4850
4851 /* ?width@ios_base@std@@QAEHH@Z */
4852 /* ?width@ios_base@std@@QEAA_J_J@Z */
4853 DEFINE_THISCALL_WRAPPER(ios_base_width_set, 8)
4854 streamsize __thiscall ios_base_width_set(ios_base *this, streamsize width)
4855 {
4856     streamsize ret = this->wide;
4857
4858     TRACE("(%p %ld)\n", this, width);
4859
4860     this->wide = width;
4861     return ret;
4862 }
4863
4864 /* ?width@ios_base@std@@QBEHXZ */
4865 /* ?width@ios_base@std@@QEBA_JXZ */
4866 DEFINE_THISCALL_WRAPPER(ios_base_width_get, 4)
4867 streamsize __thiscall ios_base_width_get(ios_base *this)
4868 {
4869     TRACE("(%p)\n", this);
4870     return this->wide;
4871 }
4872
4873 /* ?xalloc@ios_base@std@@SAHXZ */
4874 int CDECL ios_base_xalloc(void)
4875 {
4876     _Lockit lock;
4877     int ret;
4878
4879     TRACE("\n");
4880
4881     _Lockit_ctor_locktype(&lock, _LOCK_STREAM);
4882     ret = ios_base_Index++;
4883     _Lockit_dtor(&lock);
4884     return ret;
4885 }
4886
4887 /* ??0?$basic_ios@DU?$char_traits@D@std@@@std@@IAE@XZ */
4888 /* ??0?$basic_ios@DU?$char_traits@D@std@@@std@@IEAA@XZ */
4889 DEFINE_THISCALL_WRAPPER(basic_ios_char_ctor, 4)
4890 basic_ios_char* __thiscall basic_ios_char_ctor(basic_ios_char *this)
4891 {
4892     TRACE("(%p)\n", this);
4893
4894     ios_base_ctor(&this->base);
4895     this->base.vtable = &MSVCP_basic_ios_char_vtable;
4896     return this;
4897 }
4898
4899 /* ?init@?$basic_ios@DU?$char_traits@D@std@@@std@@IAEXPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@_N@Z */
4900 /* ?init@?$basic_ios@DU?$char_traits@D@std@@@std@@IEAAXPEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@_N@Z */
4901 DEFINE_THISCALL_WRAPPER(basic_ios_char_init, 12)
4902 void __thiscall basic_ios_char_init(basic_ios_char *this, basic_streambuf_char *streambuf, MSVCP_bool isstd)
4903 {
4904     TRACE("(%p %p %x)\n", this, streambuf, isstd);
4905     ios_base_Init(&this->base);
4906     this->strbuf = streambuf;
4907     this->stream = NULL;
4908     this->fillch = ' ';
4909
4910     if(!streambuf)
4911         ios_base_setstate(&this->base, IOSTATE_badbit);
4912
4913     if(isstd)
4914         FIXME("standard streams not handled yet\n");
4915 }
4916
4917 /* ??0?$basic_ios@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
4918 /* ??0?$basic_ios@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
4919 DEFINE_THISCALL_WRAPPER(basic_ios_char_ctor_streambuf, 8)
4920 basic_ios_char* __thiscall basic_ios_char_ctor_streambuf(basic_ios_char *this, basic_streambuf_char *strbuf)
4921 {
4922     TRACE("(%p %p)\n", this, strbuf);
4923
4924     basic_ios_char_ctor(this);
4925     basic_ios_char_init(this, strbuf, FALSE);
4926     return this;
4927 }
4928
4929 /* ??1?$basic_ios@DU?$char_traits@D@std@@@std@@UAE@XZ */
4930 /* ??1?$basic_ios@DU?$char_traits@D@std@@@std@@UEAA@XZ */
4931 DEFINE_THISCALL_WRAPPER(basic_ios_char_dtor, 4)
4932 void __thiscall basic_ios_char_dtor(basic_ios_char *this)
4933 {
4934     TRACE("(%p)\n", this);
4935     ios_base_dtor(&this->base);
4936 }
4937
4938 DEFINE_THISCALL_WRAPPER(basic_ios_char_vector_dtor, 8)
4939 basic_ios_char* __thiscall basic_ios_char_vector_dtor(basic_ios_char *this, unsigned int flags)
4940 {
4941     TRACE("(%p %x)\n", this, flags);
4942     if(flags & 2) {
4943         /* we have an array, with the number of elements stored before the first object */
4944         INT_PTR i, *ptr = (INT_PTR *)this-1;
4945
4946         for(i=*ptr-1; i>=0; i--)
4947             basic_ios_char_dtor(this+i);
4948         MSVCRT_operator_delete(ptr);
4949     } else {
4950         basic_ios_char_dtor(this);
4951         if(flags & 1)
4952             MSVCRT_operator_delete(this);
4953     }
4954
4955     return this;
4956 }
4957
4958 /* ?clear@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z */
4959 /* ?clear@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAXH_N@Z */
4960 DEFINE_THISCALL_WRAPPER(basic_ios_char_clear_reraise, 12)
4961 void __thiscall basic_ios_char_clear_reraise(basic_ios_char *this, IOSB_iostate state, MSVCP_bool reraise)
4962 {
4963     TRACE("(%p %x %x)\n", this, state, reraise);
4964     ios_base_clear_reraise(&this->base, state | (this->strbuf ? IOSTATE_goodbit : IOSTATE_badbit), reraise);
4965 }
4966
4967 /* ?clear@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXI@Z */
4968 /* ?clear@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAXI@Z */
4969 DEFINE_THISCALL_WRAPPER(basic_ios_char_clear, 8)
4970 void __thiscall basic_ios_char_clear(basic_ios_char *this, unsigned int state)
4971 {
4972     basic_ios_char_clear_reraise(this, (IOSB_iostate)state, FALSE);
4973 }
4974
4975 /* ?copyfmt@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEAAV12@ABV12@@Z */
4976 /* ?copyfmt@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAAEAV12@AEBV12@@Z */
4977 DEFINE_THISCALL_WRAPPER(basic_ios_char_copyfmt, 8)
4978 basic_ios_char* __thiscall basic_ios_char_copyfmt(basic_ios_char *this, basic_ios_char *copy)
4979 {
4980     TRACE("(%p %p)\n", this, copy);
4981     if(this == copy)
4982         return this;
4983
4984     this->stream = copy->stream;
4985     this->fillch = copy->fillch;
4986     ios_base_copyfmt(&this->base, &copy->base);
4987     return this;
4988 }
4989
4990 /* ?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEDD@Z */
4991 /* ?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAADD@Z */
4992 DEFINE_THISCALL_WRAPPER(basic_ios_char_fill_set, 8)
4993 char __thiscall basic_ios_char_fill_set(basic_ios_char *this, char fill)
4994 {
4995     char ret = this->fillch;
4996
4997     TRACE("(%p %c)\n", this, fill);
4998
4999     this->fillch = fill;
5000     return ret;
5001 }
5002
5003 /* ?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEDXZ */
5004 /* ?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBADXZ */
5005 DEFINE_THISCALL_WRAPPER(basic_ios_char_fill_get, 4)
5006 char __thiscall basic_ios_char_fill_get(basic_ios_char *this)
5007 {
5008     TRACE("(%p)\n", this);
5009     return this->fillch;
5010 }
5011
5012 /* ?imbue@?$basic_ios@DU?$char_traits@D@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
5013 /* ?imbue@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
5014 DEFINE_THISCALL_WRAPPER(basic_ios_char_imbue, 12)
5015 locale *__thiscall basic_ios_char_imbue(basic_ios_char *this, locale *ret, const locale *loc)
5016 {
5017     TRACE("(%p %p %p)\n", this, ret, loc);
5018
5019     if(this->strbuf) {
5020         basic_streambuf_char_pubimbue(this->strbuf, ret, loc);
5021         locale_dtor(ret);
5022     }
5023
5024     return ios_base_imbue(&this->base, ret, loc);
5025 }
5026
5027 /* ?narrow@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEDDD@Z */
5028 /* ?narrow@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBADDD@Z */
5029 DEFINE_THISCALL_WRAPPER(basic_ios_char_narrow, 12)
5030 char __thiscall basic_ios_char_narrow(basic_ios_char *this, char ch, char def)
5031 {
5032     TRACE("(%p %c %c)\n", this, ch, def);
5033     return ctype_char_narrow_ch(ctype_char_use_facet(this->strbuf->loc), ch, def);
5034 }
5035
5036 /* ?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PAV32@@Z */
5037 /* ?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAPEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PEAV32@@Z */
5038 DEFINE_THISCALL_WRAPPER(basic_ios_char_rdbuf_set, 8)
5039 basic_streambuf_char* __thiscall basic_ios_char_rdbuf_set(basic_ios_char *this, basic_streambuf_char *streambuf)
5040 {
5041     basic_streambuf_char *ret = this->strbuf;
5042
5043     TRACE("(%p %p)\n", this, streambuf);
5044
5045     this->strbuf = streambuf;
5046     basic_ios_char_clear(this, IOSTATE_goodbit);
5047     return ret;
5048 }
5049
5050 /* ?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@XZ */
5051 /* ?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@XZ */
5052 DEFINE_THISCALL_WRAPPER(basic_ios_char_rdbuf_get, 4)
5053 basic_streambuf_char* __thiscall basic_ios_char_rdbuf_get(const basic_ios_char *this)
5054 {
5055     TRACE("(%p)\n", this);
5056     return this->strbuf;
5057 }
5058
5059 /* ?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z */
5060 /* ?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAXH_N@Z */
5061 DEFINE_THISCALL_WRAPPER(basic_ios_char_setstate_reraise, 12)
5062 void __thiscall basic_ios_char_setstate_reraise(basic_ios_char *this, IOSB_iostate state, MSVCP_bool reraise)
5063 {
5064     TRACE("(%p %x %x)\n", this, state, reraise);
5065
5066     if(state != IOSTATE_goodbit)
5067         basic_ios_char_clear_reraise(this, this->base.state | state, reraise);
5068 }
5069
5070 /* ?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXI@Z */
5071 /* ?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAXI@Z */
5072 DEFINE_THISCALL_WRAPPER(basic_ios_char_setstate, 8)
5073 void __thiscall basic_ios_char_setstate(basic_ios_char *this, unsigned int state)
5074 {
5075     basic_ios_char_setstate_reraise(this, (IOSB_iostate)state, FALSE);
5076 }
5077
5078 /* ?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEPAV?$basic_ostream@DU?$char_traits@D@std@@@2@PAV32@@Z */
5079 /* ?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAPEAV?$basic_ostream@DU?$char_traits@D@std@@@2@PEAV32@@Z */
5080 DEFINE_THISCALL_WRAPPER(basic_ios_char_tie_set, 8)
5081 basic_ostream_char* __thiscall basic_ios_char_tie_set(basic_ios_char *this, basic_ostream_char *ostream)
5082 {
5083     basic_ostream_char *ret = this->stream;
5084
5085     TRACE("(%p %p)\n", this, ostream);
5086
5087     this->stream = ostream;
5088     return ret;
5089 }
5090
5091 /* ?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_ostream@DU?$char_traits@D@std@@@2@XZ */
5092 /* ?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_ostream@DU?$char_traits@D@std@@@2@XZ */
5093 DEFINE_THISCALL_WRAPPER(basic_ios_char_tie_get, 4)
5094 basic_ostream_char* __thiscall basic_ios_char_tie_get(const basic_ios_char *this)
5095 {
5096     TRACE("(%p)\n", this);
5097     return this->stream;
5098 }
5099
5100 /* ?widen@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEDD@Z */
5101 /* ?widen@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBADD@Z */
5102 DEFINE_THISCALL_WRAPPER(basic_ios_char_widen, 8)
5103 char __thiscall basic_ios_char_widen(basic_ios_char *this, char ch)
5104 {
5105     TRACE("(%p %c)\n", this, ch);
5106     return ctype_char_widen_ch(ctype_char_use_facet(this->strbuf->loc), ch);
5107 }
5108
5109
5110 /* ??0?$basic_ios@_WU?$char_traits@_W@std@@@std@@IAE@XZ */
5111 /* ??0?$basic_ios@_WU?$char_traits@_W@std@@@std@@IEAA@XZ */
5112 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_ctor, 4)
5113 basic_ios_wchar* __thiscall basic_ios_wchar_ctor(basic_ios_wchar *this)
5114 {
5115     TRACE("(%p)\n", this);
5116
5117     ios_base_ctor(&this->base);
5118     this->base.vtable = &MSVCP_basic_ios_wchar_vtable;
5119     return this;
5120 }
5121
5122 /* ??0?$basic_ios@GU?$char_traits@G@std@@@std@@IAE@XZ */
5123 /* ??0?$basic_ios@GU?$char_traits@G@std@@@std@@IEAA@XZ */
5124 DEFINE_THISCALL_WRAPPER(basic_ios_short_ctor, 4)
5125 basic_ios_wchar* __thiscall basic_ios_short_ctor(basic_ios_wchar *this)
5126 {
5127     basic_ios_wchar_ctor(this);
5128     this->base.vtable = &MSVCP_basic_ios_short_vtable;
5129     return this;
5130 }
5131
5132 /* ?init@?$basic_ios@_WU?$char_traits@_W@std@@@std@@IAEXPAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@_N@Z */
5133 /* ?init@?$basic_ios@_WU?$char_traits@_W@std@@@std@@IEAAXPEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@_N@Z */
5134 /* ?init@?$basic_ios@GU?$char_traits@G@std@@@std@@IAEXPAV?$basic_streambuf@GU?$char_traits@G@std@@@2@_N@Z */
5135 /* ?init@?$basic_ios@GU?$char_traits@G@std@@@std@@IEAAXPEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@_N@Z */
5136 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_init, 12)
5137 void __thiscall basic_ios_wchar_init(basic_ios_wchar *this, basic_streambuf_wchar *streambuf, MSVCP_bool isstd)
5138 {
5139     TRACE("(%p %p %x)\n", this, streambuf, isstd);
5140     ios_base_Init(&this->base);
5141     this->strbuf = streambuf;
5142     this->stream = NULL;
5143     this->fillch = ' ';
5144
5145     if(!streambuf)
5146         ios_base_setstate(&this->base, IOSTATE_badbit);
5147
5148     if(isstd)
5149         FIXME("standard streams not handled yet\n");
5150 }
5151
5152 /* ??0?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAE@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
5153 /* ??0?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAA@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
5154 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_ctor_streambuf, 8)
5155 basic_ios_wchar* __thiscall basic_ios_wchar_ctor_streambuf(basic_ios_wchar *this, basic_streambuf_wchar *strbuf)
5156 {
5157     TRACE("(%p %p)\n", this, strbuf);
5158
5159     basic_ios_wchar_ctor(this);
5160     basic_ios_wchar_init(this, strbuf, FALSE);
5161     return this;
5162 }
5163
5164 /* ??0?$basic_ios@GU?$char_traits@G@std@@@std@@QAE@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
5165 /* ??0?$basic_ios@GU?$char_traits@G@std@@@std@@QEAA@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
5166 DEFINE_THISCALL_WRAPPER(basic_ios_short_ctor_streambuf, 8)
5167 basic_ios_wchar* __thiscall basic_ios_short_ctor_streambuf(basic_ios_wchar *this, basic_streambuf_wchar *strbuf)
5168 {
5169     basic_ios_wchar_ctor_streambuf(this, strbuf);
5170     this->base.vtable = &MSVCP_basic_ios_short_vtable;
5171     return this;
5172 }
5173
5174 /* ??1?$basic_ios@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
5175 /* ??1?$basic_ios@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
5176 /* ??1?$basic_ios@GU?$char_traits@G@std@@@std@@UAE@XZ */
5177 /* ??1?$basic_ios@GU?$char_traits@G@std@@@std@@UEAA@XZ */
5178 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_dtor, 4)
5179 void __thiscall basic_ios_wchar_dtor(basic_ios_wchar *this)
5180 {
5181     TRACE("(%p)\n", this);
5182     ios_base_dtor(&this->base);
5183 }
5184
5185 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_vector_dtor, 8)
5186 basic_ios_wchar* __thiscall basic_ios_wchar_vector_dtor(basic_ios_wchar *this, unsigned int flags)
5187 {
5188     TRACE("(%p %x)\n", this, flags);
5189     if(flags & 2) {
5190         /* we have an array, with the number of elements stored before the first object */
5191         INT_PTR i, *ptr = (INT_PTR *)this-1;
5192
5193         for(i=*ptr-1; i>=0; i--)
5194             basic_ios_wchar_dtor(this+i);
5195         MSVCRT_operator_delete(ptr);
5196     } else {
5197         basic_ios_wchar_dtor(this);
5198         if(flags & 1)
5199             MSVCRT_operator_delete(this);
5200     }
5201
5202     return this;
5203 }
5204
5205 /* ?clear@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEXH_N@Z */
5206 /* ?clear@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAXH_N@Z */
5207 /* ?clear@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEXH_N@Z */
5208 /* ?clear@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAXH_N@Z */
5209 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_clear_reraise, 12)
5210 void __thiscall basic_ios_wchar_clear_reraise(basic_ios_wchar *this, IOSB_iostate state, MSVCP_bool reraise)
5211 {
5212     TRACE("(%p %x %x)\n", this, state, reraise);
5213     ios_base_clear_reraise(&this->base, state | (this->strbuf ? IOSTATE_goodbit : IOSTATE_badbit), reraise);
5214 }
5215
5216 /* ?clear@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEXI@Z */
5217 /* ?clear@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAXI@Z */
5218 /* ?clear@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEXI@Z */
5219 /* ?clear@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAXI@Z */
5220 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_clear, 8)
5221 void __thiscall basic_ios_wchar_clear(basic_ios_wchar *this, unsigned int state)
5222 {
5223     basic_ios_wchar_clear_reraise(this, (IOSB_iostate)state, FALSE);
5224 }
5225
5226 /* ?copyfmt@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEAAV12@ABV12@@Z */
5227 /* ?copyfmt@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@AEBV12@@Z */
5228 /* ?copyfmt@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEAAV12@ABV12@@Z */
5229 /* ?copyfmt@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAAEAV12@AEBV12@@Z */
5230 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_copyfmt, 8)
5231 basic_ios_wchar* __thiscall basic_ios_wchar_copyfmt(basic_ios_wchar *this, basic_ios_wchar *copy)
5232 {
5233     TRACE("(%p %p)\n", this, copy);
5234     if(this == copy)
5235         return this;
5236
5237     this->stream = copy->stream;
5238     this->fillch = copy->fillch;
5239     ios_base_copyfmt(&this->base, &copy->base);
5240     return this;
5241 }
5242
5243 /* ?fill@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAE_W_W@Z */
5244 /* ?fill@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAA_W_W@Z */
5245 /* ?fill@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEGG@Z */
5246 /* ?fill@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAGG@Z */
5247 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_fill_set, 8)
5248 wchar_t __thiscall basic_ios_wchar_fill_set(basic_ios_wchar *this, wchar_t fill)
5249 {
5250     wchar_t ret = this->fillch;
5251
5252     TRACE("(%p %c)\n", this, fill);
5253
5254     this->fillch = fill;
5255     return ret;
5256 }
5257
5258 /* ?fill@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QBE_WXZ */
5259 /* ?fill@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEBA_WXZ */
5260 /* ?fill@?$basic_ios@GU?$char_traits@G@std@@@std@@QBEGXZ */
5261 /* ?fill@?$basic_ios@GU?$char_traits@G@std@@@std@@QEBAGXZ */
5262 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_fill_get, 4)
5263 wchar_t __thiscall basic_ios_wchar_fill_get(basic_ios_wchar *this)
5264 {
5265     TRACE("(%p)\n", this);
5266     return this->fillch;
5267 }
5268
5269 /* ?imbue@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
5270 /* ?imbue@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
5271 /* ?imbue@?$basic_ios@GU?$char_traits@G@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
5272 /* ?imbue@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
5273 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_imbue, 12)
5274 locale *__thiscall basic_ios_wchar_imbue(basic_ios_wchar *this, locale *ret, const locale *loc)
5275 {
5276     TRACE("(%p %p %p)\n", this, ret, loc);
5277
5278     if(this->strbuf)
5279         return basic_streambuf_wchar_pubimbue(this->strbuf, ret, loc);
5280
5281     locale_copy_ctor(ret, loc);
5282     return ret;
5283 }
5284
5285 /* ?narrow@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QBED_WD@Z */
5286 /* ?narrow@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEBAD_WD@Z */
5287 /* ?narrow@?$basic_ios@GU?$char_traits@G@std@@@std@@QBEDGD@Z */
5288 /* ?narrow@?$basic_ios@GU?$char_traits@G@std@@@std@@QEBADGD@Z */
5289 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_narrow, 12)
5290 char __thiscall basic_ios_wchar_narrow(basic_ios_wchar *this, wchar_t ch, char def)
5291 {
5292     TRACE("(%p %c %c)\n", this, ch, def);
5293     return ctype_wchar_narrow_ch(ctype_wchar_use_facet(this->strbuf->loc), ch, def);
5294 }
5295
5296 /* ?rdbuf@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEPAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@PAV32@@Z */
5297 /* ?rdbuf@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAPEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@PEAV32@@Z */
5298 /* ?rdbuf@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEPAV?$basic_streambuf@GU?$char_traits@G@std@@@2@PAV32@@Z */
5299 /* ?rdbuf@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAPEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@PEAV32@@Z */
5300 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_rdbuf_set, 8)
5301 basic_streambuf_wchar* __thiscall basic_ios_wchar_rdbuf_set(basic_ios_wchar *this, basic_streambuf_wchar *streambuf)
5302 {
5303     basic_streambuf_wchar *ret = this->strbuf;
5304
5305     TRACE("(%p %p)\n", this, streambuf);
5306
5307     this->strbuf = streambuf;
5308     basic_ios_wchar_clear(this, IOSTATE_goodbit);
5309     return ret;
5310 }
5311
5312 /* ?rdbuf@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QBEPAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@XZ */
5313 /* ?rdbuf@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEBAPEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@XZ */
5314 /* ?rdbuf@?$basic_ios@GU?$char_traits@G@std@@@std@@QBEPAV?$basic_streambuf@GU?$char_traits@G@std@@@2@XZ */
5315 /* ?rdbuf@?$basic_ios@GU?$char_traits@G@std@@@std@@QEBAPEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@XZ */
5316 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_rdbuf_get, 4)
5317 basic_streambuf_wchar* __thiscall basic_ios_wchar_rdbuf_get(const basic_ios_wchar *this)
5318 {
5319     TRACE("(%p)\n", this);
5320     return this->strbuf;
5321 }
5322
5323 /* ?setstate@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEXH_N@Z */
5324 /* ?setstate@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAXH_N@Z */
5325 /* ?setstate@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEXH_N@Z */
5326 /* ?setstate@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAXH_N@Z */
5327 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_setstate_reraise, 12)
5328 void __thiscall basic_ios_wchar_setstate_reraise(basic_ios_wchar *this, IOSB_iostate state, MSVCP_bool reraise)
5329 {
5330     TRACE("(%p %x %x)\n", this, state, reraise);
5331
5332     if(state != IOSTATE_goodbit)
5333         basic_ios_wchar_clear_reraise(this, this->base.state | state, reraise);
5334 }
5335
5336 /* ?setstate@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEXI@Z */
5337 /* ?setstate@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAXI@Z */
5338 /* ?setstate@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEXI@Z */
5339 /* ?setstate@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAXI@Z */
5340 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_setstate, 8)
5341 void __thiscall basic_ios_wchar_setstate(basic_ios_wchar *this, IOSB_iostate state)
5342 {
5343     basic_ios_wchar_setstate_reraise(this, state, FALSE);
5344 }
5345
5346 /* ?tie@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEPAV?$basic_ostream@_WU?$char_traits@_W@std@@@2@PAV32@@Z */
5347 /* ?tie@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAPEAV?$basic_ostream@_WU?$char_traits@_W@std@@@2@PEAV32@@Z */
5348 /* ?tie@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEPAV?$basic_ostream@GU?$char_traits@G@std@@@2@PAV32@@Z */
5349 /* ?tie@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAPEAV?$basic_ostream@GU?$char_traits@G@std@@@2@PEAV32@@Z */
5350 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_tie_set, 8)
5351 basic_ostream_wchar* __thiscall basic_ios_wchar_tie_set(basic_ios_wchar *this, basic_ostream_wchar *ostream)
5352 {
5353     basic_ostream_wchar *ret = this->stream;
5354
5355     TRACE("(%p %p)\n", this, ostream);
5356
5357     this->stream = ostream;
5358     return ret;
5359 }
5360
5361 /* ?tie@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QBEPAV?$basic_ostream@_WU?$char_traits@_W@std@@@2@XZ */
5362 /* ?tie@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEBAPEAV?$basic_ostream@_WU?$char_traits@_W@std@@@2@XZ */
5363 /* ?tie@?$basic_ios@GU?$char_traits@G@std@@@std@@QBEPAV?$basic_ostream@GU?$char_traits@G@std@@@2@XZ */
5364 /* ?tie@?$basic_ios@GU?$char_traits@G@std@@@std@@QEBAPEAV?$basic_ostream@GU?$char_traits@G@std@@@2@XZ */
5365 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_tie_get, 4)
5366 basic_ostream_wchar* __thiscall basic_ios_wchar_tie_get(const basic_ios_wchar *this)
5367 {
5368     TRACE("(%p)\n", this);
5369     return this->stream;
5370 }
5371
5372 /* ?widen@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QBE_WD@Z */
5373 /* ?widen@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEBA_WD@Z */
5374 /* ?widen@?$basic_ios@GU?$char_traits@G@std@@@std@@QBEGD@Z */
5375 /* ?widen@?$basic_ios@GU?$char_traits@G@std@@@std@@QEBAGD@Z */
5376 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_widen, 8)
5377 wchar_t __thiscall basic_ios_wchar_widen(basic_ios_wchar *this, char ch)
5378 {
5379     TRACE("(%p %c)\n", this, ch);
5380     return ctype_wchar_widen_ch(ctype_wchar_use_facet(this->strbuf->loc), ch);
5381 }
5382
5383 /* Caution: basic_ostream uses virtual inheritance.
5384  * All constructors have additional parameter that says if base class should be initialized.
5385  * Base class needs to be accessed using vbtable.
5386  */
5387 static inline basic_ios_char* basic_ostream_char_get_basic_ios(basic_ostream_char *this)
5388 {
5389     return (basic_ios_char*)((char*)this+this->vbtable[1]);
5390 }
5391
5392 static inline basic_ios_char* basic_ostream_char_to_basic_ios(basic_ostream_char *ptr)
5393 {
5394     return (basic_ios_char*)((char*)ptr+basic_ostream_char_vbtable[1]);
5395 }
5396
5397 static inline basic_ostream_char* basic_ostream_char_from_basic_ios(basic_ios_char *ptr)
5398 {
5399     return (basic_ostream_char*)((char*)ptr-basic_ostream_char_vbtable[1]);
5400 }
5401
5402 /* ??0?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z */
5403 /* ??0?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z */
5404 DEFINE_THISCALL_WRAPPER(basic_ostream_char_ctor, 16)
5405 basic_ostream_char* __thiscall basic_ostream_char_ctor(basic_ostream_char *this,
5406         basic_streambuf_char *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
5407 {
5408     basic_ios_char *base;
5409
5410     TRACE("(%p %p %d %d)\n", this, strbuf, isstd, virt_init);
5411
5412     if(virt_init) {
5413         this->vbtable = basic_ostream_char_vbtable;
5414         base = basic_ostream_char_get_basic_ios(this);
5415         basic_ios_char_ctor(base);
5416     }else {
5417         base = basic_ostream_char_get_basic_ios(this);
5418     }
5419
5420     base->base.vtable = &MSVCP_basic_ostream_char_vtable;
5421     basic_ios_char_init(base, strbuf, isstd);
5422     return this;
5423 }
5424
5425 /* ??0?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@W4_Uninitialized@1@_N@Z */
5426 /* ??0?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA@W4_Uninitialized@1@_N@Z */
5427 DEFINE_THISCALL_WRAPPER(basic_ostream_char_ctor_uninitialized, 16)
5428 basic_ostream_char* __thiscall basic_ostream_char_ctor_uninitialized(basic_ostream_char *this,
5429         int uninitialized, MSVCP_bool addstd, MSVCP_bool virt_init)
5430 {
5431     basic_ios_char *base;
5432
5433     TRACE("(%p %d %x)\n", this, uninitialized, addstd);
5434
5435     if(virt_init) {
5436         this->vbtable = basic_ostream_char_vbtable;
5437         base = basic_ostream_char_get_basic_ios(this);
5438         basic_ios_char_ctor(base);
5439     }else {
5440         base = basic_ostream_char_get_basic_ios(this);
5441     }
5442
5443     base->base.vtable = &MSVCP_basic_ostream_char_vtable;
5444     if(addstd)
5445         ios_base_Addstd(&base->base);
5446     return this;
5447 }
5448
5449 /* ??1?$basic_ostream@DU?$char_traits@D@std@@@std@@UAE@XZ */
5450 /* ??1?$basic_ostream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
5451 DEFINE_THISCALL_WRAPPER(basic_ostream_char_dtor, 4)
5452 void __thiscall basic_ostream_char_dtor(basic_ios_char *base)
5453 {
5454     basic_ostream_char *this = basic_ostream_char_from_basic_ios(base);
5455
5456     /* don't destroy virtual base here */
5457     TRACE("(%p)\n", this);
5458 }
5459
5460 /* ??_D?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ */
5461 /* ??_D?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
5462 DEFINE_THISCALL_WRAPPER(basic_ostream_char_vbase_dtor, 4)
5463 void __thiscall basic_ostream_char_vbase_dtor(basic_ostream_char *this)
5464 {
5465     TRACE("(%p)\n", this);
5466     basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(this));
5467     basic_ios_char_dtor(basic_ostream_char_get_basic_ios(this));
5468 }
5469
5470 DEFINE_THISCALL_WRAPPER(basic_ostream_char_vector_dtor, 8)
5471 basic_ostream_char* __thiscall basic_ostream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
5472 {
5473     basic_ostream_char *this = basic_ostream_char_from_basic_ios(base);
5474
5475     TRACE("(%p %x)\n", this, flags);
5476
5477     if(flags & 2) {
5478         /* we have an array, with the number of elements stored before the first object */
5479         INT_PTR i, *ptr = (INT_PTR *)this-1;
5480
5481         for(i=*ptr-1; i>=0; i--)
5482             basic_ostream_char_vbase_dtor(this+i);
5483         MSVCRT_operator_delete(ptr);
5484     } else {
5485         basic_ostream_char_vbase_dtor(this);
5486         if(flags & 1)
5487             MSVCRT_operator_delete(this);
5488     }
5489
5490     return this;
5491 }
5492
5493 /* ?flush@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@XZ */
5494 /* ?flush@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@XZ */
5495 DEFINE_THISCALL_WRAPPER(basic_ostream_char_flush, 4)
5496 basic_ostream_char* __thiscall basic_ostream_char_flush(basic_ostream_char *this)
5497 {
5498     /* this function is not matching C++ specification */
5499     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5500
5501     TRACE("(%p)\n", this);
5502
5503     if(basic_ios_char_rdbuf_get(base) && ios_base_good(&base->base)
5504             && basic_streambuf_char_pubsync(basic_ios_char_rdbuf_get(base))==-1)
5505         basic_ios_char_setstate(base, IOSTATE_badbit);
5506     return this;
5507 }
5508
5509 /* ?flush@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z */
5510 /* ?flush@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@1@AEAV21@@Z */
5511 basic_ostream_char* __cdecl flush_ostream_char(basic_ostream_char *ostream)
5512 {
5513     return basic_ostream_char_flush(ostream);
5514 }
5515
5516 /* ?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ */
5517 /* ?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
5518 DEFINE_THISCALL_WRAPPER(basic_ostream_char__Osfx, 4)
5519 void __thiscall basic_ostream_char__Osfx(basic_ostream_char *this)
5520 {
5521     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5522
5523     TRACE("(%p)\n", this);
5524
5525     if(base->base.fmtfl & FMTFLAG_unitbuf)
5526         basic_ostream_char_flush(this);
5527 }
5528
5529 /* ?osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ */
5530 /* ?osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
5531 DEFINE_THISCALL_WRAPPER(basic_ostream_char_osfx, 4)
5532 void __thiscall basic_ostream_char_osfx(basic_ostream_char *this)
5533 {
5534     TRACE("(%p)\n", this);
5535     basic_ostream_char__Osfx(this);
5536 }
5537
5538 static BOOL basic_ostream_char_sentry_create(basic_ostream_char *ostr)
5539 {
5540     basic_ios_char *base = basic_ostream_char_get_basic_ios(ostr);
5541
5542     if(basic_ios_char_rdbuf_get(base))
5543         basic_streambuf_char__Lock(base->strbuf);
5544
5545     if(ios_base_good(&base->base) && base->stream)
5546         basic_ostream_char_flush(base->stream);
5547
5548     return ios_base_good(&base->base);
5549 }
5550
5551 static void basic_ostream_char_sentry_destroy(basic_ostream_char *ostr)
5552 {
5553     basic_ios_char *base = basic_ostream_char_get_basic_ios(ostr);
5554
5555     if(ios_base_good(&base->base) && !__uncaught_exception())
5556         basic_ostream_char_osfx(ostr);
5557
5558     if(basic_ios_char_rdbuf_get(base))
5559         basic_streambuf_char__Unlock(base->strbuf);
5560 }
5561
5562 /* ?opfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE_NXZ */
5563 /* ?opfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA_NXZ */
5564 DEFINE_THISCALL_WRAPPER(basic_ostream_char_opfx, 4)
5565 MSVCP_bool __thiscall basic_ostream_char_opfx(basic_ostream_char *this)
5566 {
5567     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5568
5569     TRACE("(%p)\n", this);
5570
5571     if(ios_base_good(&base->base) && base->stream)
5572         basic_ostream_char_flush(base->stream);
5573     return ios_base_good(&base->base);
5574 }
5575
5576 /* ?put@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@D@Z */
5577 /* ?put@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@D@Z */
5578 DEFINE_THISCALL_WRAPPER(basic_ostream_char_put, 8)
5579 basic_ostream_char* __thiscall basic_ostream_char_put(basic_ostream_char *this, char ch)
5580 {
5581     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5582
5583     TRACE("(%p %c)\n", this, ch);
5584
5585     if(!basic_ostream_char_sentry_create(this)
5586             || basic_streambuf_char_sputc(base->strbuf, ch)==EOF) {
5587         basic_ostream_char_sentry_destroy(this);
5588         basic_ios_char_setstate(base, IOSTATE_badbit);
5589         return this;
5590     }
5591
5592     basic_ostream_char_sentry_destroy(this);
5593     return this;
5594 }
5595
5596 /* ?seekp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@JH@Z */
5597 /* ?seekp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@_JH@Z */
5598 DEFINE_THISCALL_WRAPPER(basic_ostream_char_seekp, 12)
5599 basic_ostream_char* __thiscall basic_ostream_char_seekp(basic_ostream_char *this, streamoff off, int way)
5600 {
5601     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5602
5603     TRACE("(%p %ld %d)\n", this, off, way);
5604
5605     if(!ios_base_fail(&base->base)) {
5606         fpos_int seek;
5607
5608         basic_streambuf_char_pubseekoff(basic_ios_char_rdbuf_get(base),
5609                 &seek, off, way, OPENMODE_out);
5610         if(seek.off==0 && seek.pos==-1 && seek.state==0)
5611             basic_ios_char_setstate(base, IOSTATE_failbit);
5612     }
5613     return this;
5614 }
5615
5616 /* ?seekp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
5617 /* ?seekp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
5618 DEFINE_THISCALL_WRAPPER(basic_ostream_char_seekp_fpos, 28)
5619 basic_ostream_char* __thiscall basic_ostream_char_seekp_fpos(basic_ostream_char *this, fpos_int pos)
5620 {
5621     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5622
5623     TRACE("(%p %s)\n", this, debugstr_fpos_int(&pos));
5624
5625     if(!ios_base_fail(&base->base)) {
5626         fpos_int seek;
5627
5628         basic_streambuf_char_pubseekpos(basic_ios_char_rdbuf_get(base),
5629                 &seek, pos, OPENMODE_out);
5630         if(seek.off==0 && seek.pos==-1 && seek.state==0)
5631             basic_ios_char_setstate(base, IOSTATE_failbit);
5632     }
5633     return this;
5634 }
5635
5636 /* ?tellp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@XZ */
5637 /* ?tellp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
5638 DEFINE_THISCALL_WRAPPER(basic_ostream_char_tellp, 8)
5639 fpos_int* __thiscall basic_ostream_char_tellp(basic_ostream_char *this, fpos_int *ret)
5640 {
5641     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5642
5643     TRACE("(%p)\n", this);
5644
5645     if(!ios_base_fail(&base->base)) {
5646         basic_streambuf_char_pubseekoff(basic_ios_char_rdbuf_get(base),
5647                 ret, 0, SEEKDIR_cur, OPENMODE_out);
5648     }else {
5649         ret->off = 0;
5650         ret->pos = -1;
5651         ret->state = 0;
5652     }
5653     return ret;
5654 }
5655
5656 /* ?write@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@PBDH@Z */
5657 /* ?write@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEBD_J@Z */
5658 DEFINE_THISCALL_WRAPPER(basic_ostream_char_write, 12)
5659 basic_ostream_char* __thiscall basic_ostream_char_write(basic_ostream_char *this, const char *str, streamsize count)
5660 {
5661     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5662
5663     TRACE("(%p %s %ld)\n", this, debugstr_a(str), count);
5664
5665     if(!basic_ostream_char_sentry_create(this)
5666             || basic_streambuf_char_sputn(base->strbuf, str, count)!=count) {
5667         basic_ostream_char_sentry_destroy(this);
5668         basic_ios_char_setstate(base, IOSTATE_badbit);
5669         return this;
5670     }
5671
5672     basic_ostream_char_sentry_destroy(this);
5673     return this;
5674 }
5675
5676 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@F@Z */
5677 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@F@Z */
5678 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_short, 8)
5679 basic_ostream_char* __thiscall basic_ostream_char_print_short(basic_ostream_char *this, short val)
5680 {
5681     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5682     int state = IOSTATE_goodbit;
5683
5684     TRACE("(%p %d)\n", this, val);
5685
5686     if(basic_ostream_char_sentry_create(this)) {
5687         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5688         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5689         ostreambuf_iterator_char dest = {0, strbuf};
5690
5691         num_put_char_put_long(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base),
5692                 (ios_base_flags_get(&base->base) & FMTFLAG_basefield & (FMTFLAG_oct | FMTFLAG_hex))
5693                 ? (LONG)((unsigned short)val) : (LONG)val);
5694     }
5695     basic_ostream_char_sentry_destroy(this);
5696
5697     basic_ios_char_setstate(base, state);
5698     return this;
5699 }
5700
5701 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@G@Z */
5702 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@G@Z */
5703 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_ushort, 8)
5704 basic_ostream_char* __thiscall basic_ostream_char_print_ushort(basic_ostream_char *this, unsigned short val)
5705 {
5706     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5707     int state = IOSTATE_goodbit;
5708
5709     TRACE("(%p %u)\n", this, val);
5710
5711     if(basic_ostream_char_sentry_create(this)) {
5712         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5713         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5714         ostreambuf_iterator_char dest = {0, strbuf};
5715
5716         num_put_char_put_ulong(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5717     }
5718     basic_ostream_char_sentry_destroy(this);
5719
5720     basic_ios_char_setstate(base, state);
5721     return this;
5722 }
5723
5724 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@H@Z */
5725 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@H@Z */
5726 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@J@Z */
5727 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@J@Z */
5728 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_int, 8)
5729 basic_ostream_char* __thiscall basic_ostream_char_print_int(basic_ostream_char *this, int val)
5730 {
5731     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5732     int state = IOSTATE_goodbit;
5733
5734     TRACE("(%p %d)\n", this, val);
5735
5736     if(basic_ostream_char_sentry_create(this)) {
5737         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5738         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5739         ostreambuf_iterator_char dest = {0, strbuf};
5740
5741         num_put_char_put_long(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5742     }
5743     basic_ostream_char_sentry_destroy(this);
5744
5745     basic_ios_char_setstate(base, state);
5746     return this;
5747 }
5748
5749 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@I@Z */
5750 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@I@Z */
5751 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@K@Z */
5752 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@K@Z */
5753 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_uint, 8)
5754 basic_ostream_char* __thiscall basic_ostream_char_print_uint(basic_ostream_char *this, unsigned int val)
5755 {
5756     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5757     int state = IOSTATE_goodbit;
5758
5759     TRACE("(%p %u)\n", this, val);
5760
5761     if(basic_ostream_char_sentry_create(this)) {
5762         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5763         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5764         ostreambuf_iterator_char dest = {0, strbuf};
5765
5766         num_put_char_put_ulong(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5767     }
5768     basic_ostream_char_sentry_destroy(this);
5769
5770     basic_ios_char_setstate(base, state);
5771     return this;
5772 }
5773
5774 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@M@Z */
5775 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@M@Z */
5776 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_float, 8)
5777 basic_ostream_char* __thiscall basic_ostream_char_print_float(basic_ostream_char *this, float val)
5778 {
5779     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5780     int state = IOSTATE_goodbit;
5781
5782     TRACE("(%p %f)\n", this, val);
5783
5784     if(basic_ostream_char_sentry_create(this)) {
5785         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5786         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5787         ostreambuf_iterator_char dest = {0, strbuf};
5788
5789         num_put_char_put_double(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5790     }
5791     basic_ostream_char_sentry_destroy(this);
5792
5793     basic_ios_char_setstate(base, state);
5794     return this;
5795 }
5796
5797 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@N@Z */
5798 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@N@Z */
5799 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_double, 12)
5800 basic_ostream_char* __thiscall basic_ostream_char_print_double(basic_ostream_char *this, double val)
5801 {
5802     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5803     int state = IOSTATE_goodbit;
5804
5805     TRACE("(%p %lf)\n", this, val);
5806
5807     if(basic_ostream_char_sentry_create(this)) {
5808         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5809         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5810         ostreambuf_iterator_char dest = {0, strbuf};
5811
5812         num_put_char_put_double(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5813     }
5814     basic_ostream_char_sentry_destroy(this);
5815
5816     basic_ios_char_setstate(base, state);
5817     return this;
5818 }
5819
5820 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@O@Z */
5821 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@O@Z */
5822 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_ldouble, 12)
5823 basic_ostream_char* __thiscall basic_ostream_char_print_ldouble(basic_ostream_char *this, double val)
5824 {
5825     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5826     int state = IOSTATE_goodbit;
5827
5828     TRACE("(%p %lf)\n", this, val);
5829
5830     if(basic_ostream_char_sentry_create(this)) {
5831         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5832         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5833         ostreambuf_iterator_char dest = {0, strbuf};
5834
5835         num_put_char_put_ldouble(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5836     }
5837     basic_ostream_char_sentry_destroy(this);
5838
5839     basic_ios_char_setstate(base, state);
5840     return this;
5841 }
5842
5843 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
5844 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
5845 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_streambuf, 8)
5846 basic_ostream_char* __thiscall basic_ostream_char_print_streambuf(basic_ostream_char *this, basic_streambuf_char *val)
5847 {
5848     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5849     IOSB_iostate state = IOSTATE_badbit;
5850     int c = '\n';
5851
5852     TRACE("(%p %p)\n", this, val);
5853
5854     if(basic_ostream_char_sentry_create(this)) {
5855         for(c = basic_streambuf_char_sgetc(val); c!=EOF;
5856                 c = basic_streambuf_char_snextc(val)) {
5857             state = IOSTATE_goodbit;
5858
5859             if(basic_streambuf_char_sputc(base->strbuf, c) == EOF) {
5860                 state = IOSTATE_badbit;
5861                 break;
5862             }
5863         }
5864     }else {
5865         state = IOSTATE_badbit;
5866     }
5867     basic_ostream_char_sentry_destroy(this);
5868
5869     ios_base_width_set(&base->base, 0);
5870     basic_ios_char_setstate(base, state);
5871     return this;
5872 }
5873
5874 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@PBX@Z */
5875 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@PEBX@Z */
5876 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_ptr, 8)
5877 basic_ostream_char* __thiscall basic_ostream_char_print_ptr(basic_ostream_char *this, const void *val)
5878 {
5879     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5880     int state = IOSTATE_goodbit;
5881
5882     TRACE("(%p %p)\n", this, val);
5883
5884     if(basic_ostream_char_sentry_create(this)) {
5885         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5886         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5887         ostreambuf_iterator_char dest = {0, strbuf};
5888
5889         num_put_char_put_ptr(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5890     }
5891     basic_ostream_char_sentry_destroy(this);
5892
5893     basic_ios_char_setstate(base, state);
5894     return this;
5895 }
5896
5897 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@_J@Z */
5898 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@_J@Z */
5899 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_int64, 12)
5900 basic_ostream_char* __thiscall basic_ostream_char_print_int64(basic_ostream_char *this, __int64 val)
5901 {
5902     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5903     int state = IOSTATE_goodbit;
5904
5905     TRACE("(%p)\n", this);
5906
5907     if(basic_ostream_char_sentry_create(this)) {
5908         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5909         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5910         ostreambuf_iterator_char dest = {0, strbuf};
5911
5912         num_put_char_put_int64(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5913     }
5914     basic_ostream_char_sentry_destroy(this);
5915
5916     basic_ios_char_setstate(base, state);
5917     return this;
5918 }
5919
5920 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@_K@Z */
5921 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@_K@Z */
5922 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_uint64, 12)
5923 basic_ostream_char* __thiscall basic_ostream_char_print_uint64(basic_ostream_char *this, unsigned __int64 val)
5924 {
5925     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5926     int state = IOSTATE_goodbit;
5927
5928     TRACE("(%p)\n", this);
5929
5930     if(basic_ostream_char_sentry_create(this)) {
5931         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5932         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5933         ostreambuf_iterator_char dest = {0, strbuf};
5934
5935         num_put_char_put_uint64(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5936     }
5937     basic_ostream_char_sentry_destroy(this);
5938
5939     basic_ios_char_setstate(base, state);
5940     return this;
5941 }
5942
5943 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@_N@Z */
5944 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@_N@Z */
5945 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_bool, 8)
5946 basic_ostream_char* __thiscall basic_ostream_char_print_bool(basic_ostream_char *this, MSVCP_bool val)
5947 {
5948     basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
5949     int state = IOSTATE_goodbit;
5950
5951     TRACE("(%p %x)\n", this, val);
5952
5953     if(basic_ostream_char_sentry_create(this)) {
5954         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5955         const num_put *numput = num_put_char_use_facet(strbuf->loc);
5956         ostreambuf_iterator_char dest = {0, strbuf};
5957
5958         num_put_char_put_bool(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
5959     }
5960     basic_ostream_char_sentry_destroy(this);
5961
5962     basic_ios_char_setstate(base, state);
5963     return this;
5964 }
5965
5966 /* ?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z */
5967 /* ?endl@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@1@AEAV21@@Z */
5968 basic_ostream_char* __cdecl basic_ostream_char_endl(basic_ostream_char *ostr)
5969 {
5970     TRACE("(%p)\n", ostr);
5971
5972     basic_ostream_char_put(ostr, '\n');
5973     basic_ostream_char_flush(ostr);
5974     return ostr;
5975 }
5976
5977 /* $?6DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
5978 /* ??$?6DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
5979 basic_ostream_char* __cdecl basic_ostream_char_print_bstr(basic_ostream_char *ostr, const basic_string_char *str)
5980 {
5981     basic_ios_char *base = basic_ostream_char_get_basic_ios(ostr);
5982     IOSB_iostate state = IOSTATE_goodbit;
5983
5984     TRACE("(%p %p)\n", ostr, str);
5985
5986     if(basic_ostream_char_sentry_create(ostr)) {
5987         MSVCP_size_t len = MSVCP_basic_string_char_length(str);
5988         streamsize pad = (base->base.wide>len ? base->base.wide-len : 0);
5989
5990         if((base->base.fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
5991             for(; pad!=0; pad--) {
5992                 if(basic_streambuf_char_sputc(base->strbuf, base->fillch) == EOF) {
5993                     state = IOSTATE_badbit;
5994                     break;
5995                 }
5996             }
5997         }
5998
5999         if(state == IOSTATE_goodbit) {
6000             if(basic_streambuf_char_sputn(base->strbuf, MSVCP_basic_string_char_c_str(str), len) != len)
6001                     state = IOSTATE_badbit;
6002         }
6003
6004         if(state == IOSTATE_goodbit) {
6005             for(; pad!=0; pad--) {
6006                 if(basic_streambuf_char_sputc(base->strbuf, base->fillch) == EOF) {
6007                     state = IOSTATE_badbit;
6008                     break;
6009                 }
6010             }
6011         }
6012
6013         base->base.wide = 0;
6014     }else {
6015         state = IOSTATE_badbit;
6016     }
6017     basic_ostream_char_sentry_destroy(ostr);
6018
6019     basic_ios_char_setstate(base, state);
6020     return ostr;
6021 }
6022
6023 /* ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@C@Z */
6024 /* ??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@C@Z */
6025 /* ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@D@Z */
6026 /* ??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@D@Z */
6027 /* ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@E@Z */
6028 /* ??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@E@Z */
6029 basic_ostream_char* __cdecl basic_ostream_char_print_ch(basic_ostream_char *ostr, char ch)
6030 {
6031     basic_ios_char *base = basic_ostream_char_get_basic_ios(ostr);
6032     IOSB_iostate state = IOSTATE_goodbit;
6033
6034     TRACE("(%p %d)\n", ostr, ch);
6035
6036     if(basic_ostream_char_sentry_create(ostr)) {
6037         streamsize pad = (base->base.wide>1 ? base->base.wide-1 : 0);
6038
6039         if((base->base.fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
6040             for(; pad!=0; pad--) {
6041                 if(basic_streambuf_char_sputc(base->strbuf, base->fillch) == EOF) {
6042                     state = IOSTATE_badbit;
6043                     break;
6044                 }
6045             }
6046         }
6047
6048         if(state == IOSTATE_goodbit) {
6049             if(basic_streambuf_char_sputc(base->strbuf, ch) == EOF)
6050                 state = IOSTATE_badbit;
6051         }
6052
6053         if(state == IOSTATE_goodbit) {
6054             for(; pad!=0; pad--) {
6055                 if(basic_streambuf_char_sputc(base->strbuf, base->fillch) == EOF) {
6056                     state = IOSTATE_badbit;
6057                     break;
6058                 }
6059             }
6060         }
6061
6062         base->base.wide = 0;
6063     }else {
6064         state = IOSTATE_badbit;
6065     }
6066     basic_ostream_char_sentry_destroy(ostr);
6067
6068     basic_ios_char_setstate(base, state);
6069     return ostr;
6070 }
6071
6072 /* ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBC@Z */
6073 /* ??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBC@Z */
6074 /* ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z */
6075 /* ??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z */
6076 /* ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBE@Z */
6077 /* ??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBE@Z */
6078 basic_ostream_char* __cdecl basic_ostream_char_print_str(basic_ostream_char *ostr, const char *str)
6079 {
6080     basic_ios_char *base = basic_ostream_char_get_basic_ios(ostr);
6081     IOSB_iostate state = IOSTATE_goodbit;
6082
6083     TRACE("(%p %s)\n", ostr, str);
6084
6085     if(basic_ostream_char_sentry_create(ostr)) {
6086         MSVCP_size_t len = strlen(str);
6087         streamsize pad = (base->base.wide>len ? base->base.wide-len : 0);
6088
6089         if((base->base.fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
6090             for(; pad!=0; pad--) {
6091                 if(basic_streambuf_char_sputc(base->strbuf, base->fillch) == EOF) {
6092                     state = IOSTATE_badbit;
6093                     break;
6094                 }
6095             }
6096         }
6097
6098         if(state == IOSTATE_goodbit) {
6099             if(basic_streambuf_char_sputn(base->strbuf, str, len) != len)
6100                 state = IOSTATE_badbit;
6101         }
6102
6103         if(state == IOSTATE_goodbit) {
6104             for(; pad!=0; pad--) {
6105                 if(basic_streambuf_char_sputc(base->strbuf, base->fillch) == EOF) {
6106                     state = IOSTATE_badbit;
6107                     break;
6108                 }
6109             }
6110         }
6111
6112         base->base.wide = 0;
6113     }else {
6114         state = IOSTATE_badbit;
6115     }
6116     basic_ostream_char_sentry_destroy(ostr);
6117
6118     basic_ios_char_setstate(base, state);
6119     return ostr;
6120 }
6121
6122 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
6123 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
6124 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_func, 8)
6125 basic_ostream_char* __thiscall basic_ostream_char_print_func(basic_ostream_char *this,
6126         basic_ostream_char* (__cdecl *pfunc)(basic_ostream_char*))
6127 {
6128     TRACE("(%p %p)\n", this, pfunc);
6129     pfunc(this);
6130     return this;
6131 }
6132
6133 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@DU?$char_traits@D@std@@@1@AAV21@@Z@Z */
6134 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@DU?$char_traits@D@std@@@1@AEAV21@@Z@Z */
6135 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_func_basic_ios, 8)
6136 basic_ostream_char* __thiscall basic_ostream_char_print_func_basic_ios(basic_ostream_char *this,
6137         basic_ios_char* (__cdecl *pfunc)(basic_ios_char*))
6138 {
6139     TRACE("(%p %p)\n", this, pfunc);
6140     pfunc(basic_ostream_char_get_basic_ios(this));
6141     return this;
6142 }
6143
6144 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
6145 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
6146 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_func_ios_base, 8)
6147 basic_ostream_char* __thiscall basic_ostream_char_print_func_ios_base(
6148         basic_ostream_char *this, ios_base* (__cdecl *pfunc)(ios_base*))
6149 {
6150     TRACE("(%p %p)\n", this, pfunc);
6151     pfunc(&basic_ostream_char_get_basic_ios(this)->base);
6152     return this;
6153 }
6154
6155 /* Caution: basic_ostream uses virtual inheritance. */
6156 static inline basic_ios_wchar* basic_ostream_wchar_get_basic_ios(basic_ostream_wchar *this)
6157 {
6158     return (basic_ios_wchar*)((char*)this+this->vbtable[1]);
6159 }
6160
6161 static inline basic_ios_wchar* basic_ostream_wchar_to_basic_ios(basic_ostream_wchar *ptr)
6162 {
6163     return (basic_ios_wchar*)((char*)ptr+basic_ostream_wchar_vbtable[1]);
6164 }
6165
6166 static inline basic_ostream_wchar* basic_ostream_wchar_from_basic_ios(basic_ios_wchar *ptr)
6167 {
6168     return (basic_ostream_wchar*)((char*)ptr-basic_ostream_wchar_vbtable[1]);
6169 }
6170
6171 /* ??0?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAE@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N@Z */
6172 /* ??0?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N@Z */
6173 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_ctor, 16)
6174 basic_ostream_wchar* __thiscall basic_ostream_wchar_ctor(basic_ostream_wchar *this,
6175         basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
6176 {
6177     basic_ios_wchar *base;
6178
6179     TRACE("(%p %p %d %d)\n", this, strbuf, isstd, virt_init);
6180
6181     if(virt_init) {
6182         this->vbtable = basic_ostream_wchar_vbtable;
6183         base = basic_ostream_wchar_get_basic_ios(this);
6184         basic_ios_wchar_ctor(base);
6185     }else {
6186         base = basic_ostream_wchar_get_basic_ios(this);
6187     }
6188
6189     base->base.vtable = &MSVCP_basic_ostream_wchar_vtable;
6190     basic_ios_wchar_init(base, strbuf, isstd);
6191     return this;
6192 }
6193
6194 /* ??0?$basic_ostream@GU?$char_traits@G@std@@@std@@QAE@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N@Z */
6195 /* ??0?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAA@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N@Z */
6196 DEFINE_THISCALL_WRAPPER(basic_ostream_short_ctor, 16)
6197 basic_ostream_wchar* __thiscall basic_ostream_short_ctor(basic_ostream_wchar *this,
6198         basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
6199 {
6200     basic_ostream_wchar_ctor(this, strbuf, isstd, virt_init);
6201     basic_ostream_wchar_get_basic_ios(this)->base.vtable = &MSVCP_basic_ostream_short_vtable;
6202     return this;
6203 }
6204
6205 /* ??0?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAE@W4_Uninitialized@1@_N@Z */
6206 /* ??0?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAA@W4_Uninitialized@1@_N@Z */
6207 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_ctor_uninitialized, 16)
6208 basic_ostream_wchar* __thiscall basic_ostream_wchar_ctor_uninitialized(basic_ostream_wchar *this,
6209         int uninitialized, MSVCP_bool addstd, MSVCP_bool virt_init)
6210 {
6211     basic_ios_wchar *base;
6212
6213     TRACE("(%p %d %x)\n", this, uninitialized, addstd);
6214
6215     if(virt_init) {
6216         this->vbtable = basic_ostream_wchar_vbtable;
6217         base = basic_ostream_wchar_get_basic_ios(this);
6218         basic_ios_wchar_ctor(base);
6219     }else {
6220         base = basic_ostream_wchar_get_basic_ios(this);
6221     }
6222
6223     base->base.vtable = &MSVCP_basic_ostream_wchar_vtable;
6224     if(addstd)
6225         ios_base_Addstd(&base->base);
6226     return this;
6227 }
6228
6229 /* ??0?$basic_ostream@GU?$char_traits@G@std@@@std@@QAE@W4_Uninitialized@1@_N@Z */
6230 /* ??0?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAA@W4_Uninitialized@1@_N@Z */
6231 DEFINE_THISCALL_WRAPPER(basic_ostream_short_ctor_uninitialized, 16)
6232 basic_ostream_wchar* __thiscall basic_ostream_short_ctor_uninitialized(basic_ostream_wchar *this,
6233         int uninitialized, MSVCP_bool addstd, MSVCP_bool virt_init)
6234 {
6235     basic_ostream_wchar_ctor_uninitialized(this, uninitialized, addstd, virt_init);
6236     basic_ostream_wchar_get_basic_ios(this)->base.vtable = &MSVCP_basic_ostream_short_vtable;
6237     return this;
6238 }
6239
6240 /* ??1?$basic_ostream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
6241 /* ??1?$basic_ostream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
6242 /* ??1?$basic_ostream@GU?$char_traits@G@std@@@std@@UAE@XZ */
6243 /* ??1?$basic_ostream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
6244 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_dtor, 4)
6245 void __thiscall basic_ostream_wchar_dtor(basic_ios_wchar *base)
6246 {
6247     basic_ostream_wchar *this = basic_ostream_wchar_from_basic_ios(base);
6248
6249     /* don't destroy virtual base here */
6250     TRACE("(%p)\n", this);
6251 }
6252
6253 /* ??_D?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
6254 /* ??_D?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
6255 /* ??_D?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEXXZ */
6256 /* ??_D?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
6257 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_vbase_dtor, 4)
6258 void __thiscall basic_ostream_wchar_vbase_dtor(basic_ostream_wchar *this)
6259 {
6260     TRACE("(%p)\n", this);
6261     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(this));
6262     basic_ios_wchar_dtor(basic_ostream_wchar_get_basic_ios(this));
6263 }
6264
6265 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_vector_dtor, 8)
6266 basic_ostream_wchar* __thiscall basic_ostream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
6267 {
6268     basic_ostream_wchar *this = basic_ostream_wchar_from_basic_ios(base);
6269
6270     TRACE("(%p %x)\n", this, flags);
6271
6272     if(flags & 2) {
6273         /* we have an array, with the number of elements stored before the first object */
6274         INT_PTR i, *ptr = (INT_PTR *)this-1;
6275
6276         for(i=*ptr-1; i>=0; i--)
6277             basic_ostream_wchar_vbase_dtor(this+i);
6278         MSVCRT_operator_delete(ptr);
6279     } else {
6280         basic_ostream_wchar_vbase_dtor(this);
6281         if(flags & 1)
6282             MSVCRT_operator_delete(this);
6283     }
6284
6285     return this;
6286 }
6287
6288 /* ?flush@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@XZ */
6289 /* ?flush@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@XZ */
6290 /* ?flush@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV12@XZ */
6291 /* ?flush@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@XZ */
6292 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_flush, 4)
6293 basic_ostream_wchar* __thiscall basic_ostream_wchar_flush(basic_ostream_wchar *this)
6294 {
6295     /* this function is not matching C++ specification */
6296     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6297
6298     TRACE("(%p)\n", this);
6299
6300     if(basic_ios_wchar_rdbuf_get(base) && ios_base_good(&base->base)
6301             && basic_streambuf_wchar_pubsync(basic_ios_wchar_rdbuf_get(base))==-1)
6302         basic_ios_wchar_setstate(base, IOSTATE_badbit);
6303     return this;
6304 }
6305
6306 /* ?flush@std@@YAAAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@AAV21@@Z */
6307 /* ?flush@std@@YAAEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@AEAV21@@Z */
6308 /* ?flush@std@@YAAAV?$basic_ostream@GU?$char_traits@G@std@@@1@AAV21@@Z */
6309 /* ?flush@std@@YAAEAV?$basic_ostream@GU?$char_traits@G@std@@@1@AEAV21@@Z */
6310 basic_ostream_wchar* __cdecl flush_ostream_wchar(basic_ostream_wchar *ostream)
6311 {
6312     return basic_ostream_wchar_flush(ostream);
6313 }
6314
6315 /* ?_Osfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
6316 /* ?_Osfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
6317 /* ?_Osfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEXXZ */
6318 /* ?_Osfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
6319 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar__Osfx, 4)
6320 void __thiscall basic_ostream_wchar__Osfx(basic_ostream_wchar *this)
6321 {
6322     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6323
6324     TRACE("(%p)\n", this);
6325
6326     if(base->base.fmtfl & FMTFLAG_unitbuf)
6327         basic_ostream_wchar_flush(this);
6328 }
6329
6330 /* ?osfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
6331 /* ?osfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
6332 /* ?osfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEXXZ */
6333 /* ?osfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
6334 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_osfx, 4)
6335 void __thiscall basic_ostream_wchar_osfx(basic_ostream_wchar *this)
6336 {
6337     TRACE("(%p)\n", this);
6338     basic_ostream_wchar__Osfx(this);
6339 }
6340
6341 static BOOL basic_ostream_wchar_sentry_create(basic_ostream_wchar *ostr)
6342 {
6343     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(ostr);
6344
6345     if(basic_ios_wchar_rdbuf_get(base))
6346         basic_streambuf_wchar__Lock(base->strbuf);
6347
6348     if(ios_base_good(&base->base) && base->stream)
6349         basic_ostream_wchar_flush(base->stream);
6350
6351     return ios_base_good(&base->base);
6352 }
6353
6354 static void basic_ostream_wchar_sentry_destroy(basic_ostream_wchar *ostr)
6355 {
6356     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(ostr);
6357
6358     if(ios_base_good(&base->base) && !__uncaught_exception())
6359         basic_ostream_wchar_osfx(ostr);
6360
6361     if(basic_ios_wchar_rdbuf_get(base))
6362         basic_streambuf_wchar__Unlock(base->strbuf);
6363 }
6364
6365 /* ?opfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAE_NXZ */
6366 /* ?opfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAA_NXZ */
6367 /* ?opfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAE_NXZ */
6368 /* ?opfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAA_NXZ */
6369 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_opfx, 4)
6370 MSVCP_bool __thiscall basic_ostream_wchar_opfx(basic_ostream_wchar *this)
6371 {
6372     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6373
6374     TRACE("(%p)\n", this);
6375
6376     if(ios_base_good(&base->base) && base->stream)
6377         basic_ostream_wchar_flush(base->stream);
6378     return ios_base_good(&base->base);
6379 }
6380
6381 /* ?put@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@_W@Z */
6382 /* ?put@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@_W@Z */
6383 /* ?put@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV12@G@Z */
6384 /* ?put@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@G@Z */
6385 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_put, 8)
6386 basic_ostream_wchar* __thiscall basic_ostream_wchar_put(basic_ostream_wchar *this, wchar_t ch)
6387 {
6388     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6389
6390     TRACE("(%p %c)\n", this, ch);
6391
6392     if(!basic_ostream_wchar_sentry_create(this)
6393             || basic_streambuf_wchar_sputc(base->strbuf, ch)==WEOF) {
6394         basic_ostream_wchar_sentry_destroy(this);
6395         basic_ios_wchar_setstate(base, IOSTATE_badbit);
6396         return this;
6397     }
6398
6399     basic_ostream_wchar_sentry_destroy(this);
6400     return this;
6401 }
6402
6403 /* ?seekp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@JH@Z */
6404 /* ?seekp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@_JH@Z */
6405 /* ?seekp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV12@JH@Z */
6406 /* ?seekp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@_JH@Z */
6407 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_seekp, 12)
6408 basic_ostream_wchar* __thiscall basic_ostream_wchar_seekp(basic_ostream_wchar *this, streamoff off, int way)
6409 {
6410     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6411
6412     TRACE("(%p %ld %d)\n", this, off, way);
6413
6414     if(!ios_base_fail(&base->base)) {
6415         fpos_int seek;
6416
6417         basic_streambuf_wchar_pubseekoff(basic_ios_wchar_rdbuf_get(base),
6418                 &seek, off, way, OPENMODE_out);
6419         if(seek.off==0 && seek.pos==-1 && seek.state==0)
6420             basic_ios_wchar_setstate(base, IOSTATE_failbit);
6421     }
6422     return this;
6423 }
6424
6425 /* ?seekp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
6426 /* ?seekp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
6427 /* ?seekp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
6428 /* ?seekp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
6429 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_seekp_fpos, 28)
6430 basic_ostream_wchar* __thiscall basic_ostream_wchar_seekp_fpos(basic_ostream_wchar *this, fpos_int pos)
6431 {
6432     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6433
6434     TRACE("(%p %s)\n", this, debugstr_fpos_int(&pos));
6435
6436     if(!ios_base_fail(&base->base)) {
6437         fpos_int seek;
6438
6439         basic_streambuf_wchar_pubseekpos(basic_ios_wchar_rdbuf_get(base),
6440                 &seek, pos, OPENMODE_out);
6441         if(seek.off==0 && seek.pos==-1 && seek.state==0)
6442             basic_ios_wchar_setstate(base, IOSTATE_failbit);
6443     }
6444     return this;
6445 }
6446
6447 /* ?tellp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@XZ */
6448 /* ?tellp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
6449 /* ?tellp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@XZ */
6450 /* ?tellp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
6451 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_tellp, 8)
6452 fpos_int* __thiscall basic_ostream_wchar_tellp(basic_ostream_wchar *this, fpos_int *ret)
6453 {
6454     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6455
6456     TRACE("(%p)\n", this);
6457
6458     if(!ios_base_fail(&base->base)) {
6459         basic_streambuf_wchar_pubseekoff(basic_ios_wchar_rdbuf_get(base),
6460                 ret, 0, SEEKDIR_cur, OPENMODE_out);
6461     }else {
6462         ret->off = 0;
6463         ret->pos = -1;
6464         ret->state = 0;
6465     }
6466     return ret;
6467 }
6468
6469 /* ?write@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PB_WH@Z */
6470 /* ?write@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEB_W_J@Z */
6471 /* ?write@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV12@PBGH@Z */
6472 /* ?write@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEBG_J@Z */
6473 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_write, 12)
6474 basic_ostream_wchar* __thiscall basic_ostream_wchar_write(basic_ostream_wchar *this, const wchar_t *str, streamsize count)
6475 {
6476     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6477
6478     TRACE("(%p %s %ld)\n", this, debugstr_w(str), count);
6479
6480     if(!basic_ostream_wchar_sentry_create(this)
6481             || basic_streambuf_wchar_sputn(base->strbuf, str, count)!=count) {
6482         basic_ostream_wchar_sentry_destroy(this);
6483         basic_ios_wchar_setstate(base, IOSTATE_badbit);
6484         return this;
6485     }
6486
6487     basic_ostream_wchar_sentry_destroy(this);
6488     return this;
6489 }
6490
6491 static basic_ostream_wchar* basic_ostream_print_short(basic_ostream_wchar *this, short val, const num_put *numput)
6492 {
6493     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6494     int state = IOSTATE_goodbit;
6495
6496     TRACE("(%p %d)\n", this, val);
6497
6498     if(basic_ostream_wchar_sentry_create(this)) {
6499         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6500         ostreambuf_iterator_wchar dest = {0, strbuf};
6501
6502         num_put_wchar_put_long(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base),
6503                 (ios_base_flags_get(&base->base) & FMTFLAG_basefield & (FMTFLAG_oct | FMTFLAG_hex))
6504                 ? (LONG)((unsigned short)val) : (LONG)val);
6505     }
6506     basic_ostream_wchar_sentry_destroy(this);
6507
6508     basic_ios_wchar_setstate(base, state);
6509     return this;
6510 }
6511
6512 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@F@Z */
6513 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@F@Z */
6514 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_short, 8)
6515 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_short(basic_ostream_wchar *this, short val)
6516 {
6517     return basic_ostream_print_short(this, val, num_put_wchar_use_facet(
6518                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6519 }
6520
6521 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@F@Z */
6522 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@F@Z */
6523 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_short, 8)
6524 basic_ostream_wchar* __thiscall basic_ostream_short_print_short(basic_ostream_wchar *this, short val)
6525 {
6526     return basic_ostream_print_short(this, val, num_put_short_use_facet(
6527                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6528 }
6529
6530 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@G@Z */
6531 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@G@Z */
6532 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_ushort, 8)
6533 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_ushort(basic_ostream_wchar *this, unsigned short val)
6534 {
6535     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6536     int state = IOSTATE_goodbit;
6537
6538     TRACE("(%p %u)\n", this, val);
6539
6540     if(basic_ostream_wchar_sentry_create(this)) {
6541         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6542         const num_put *numput = num_put_wchar_use_facet(strbuf->loc);
6543         ostreambuf_iterator_wchar dest = {0, strbuf};
6544
6545         num_put_wchar_put_ulong(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6546     }
6547     basic_ostream_wchar_sentry_destroy(this);
6548
6549     basic_ios_wchar_setstate(base, state);
6550     return this;
6551 }
6552
6553 static basic_ostream_wchar* basic_ostream_print_int(basic_ostream_wchar *this, int val, const num_put *numput)
6554 {
6555     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6556     int state = IOSTATE_goodbit;
6557
6558     TRACE("(%p %d)\n", this, val);
6559
6560     if(basic_ostream_wchar_sentry_create(this)) {
6561         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6562         ostreambuf_iterator_wchar dest = {0, strbuf};
6563
6564         num_put_wchar_put_long(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6565     }
6566     basic_ostream_wchar_sentry_destroy(this);
6567
6568     basic_ios_wchar_setstate(base, state);
6569     return this;
6570 }
6571
6572 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@H@Z */
6573 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@H@Z */
6574 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@J@Z */
6575 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@J@Z */
6576 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_int, 8)
6577 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_int(basic_ostream_wchar *this, int val)
6578 {
6579     return basic_ostream_print_int(this, val, num_put_wchar_use_facet(
6580                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6581 }
6582
6583 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@H@Z */
6584 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@H@Z */
6585 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@J@Z */
6586 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@J@Z */
6587 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_int, 8)
6588 basic_ostream_wchar* __thiscall basic_ostream_short_print_int(basic_ostream_wchar *this, int val)
6589 {
6590     return basic_ostream_print_int(this, val, num_put_short_use_facet(
6591                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6592 }
6593
6594 static basic_ostream_wchar* basic_ostream_print_uint(basic_ostream_wchar *this, unsigned int val, const num_put *numput)
6595 {
6596     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6597     int state = IOSTATE_goodbit;
6598
6599     TRACE("(%p %u)\n", this, val);
6600
6601     if(basic_ostream_wchar_sentry_create(this)) {
6602         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6603         ostreambuf_iterator_wchar dest = {0, strbuf};
6604
6605         num_put_wchar_put_ulong(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6606     }
6607     basic_ostream_wchar_sentry_destroy(this);
6608
6609     basic_ios_wchar_setstate(base, state);
6610     return this;
6611 }
6612
6613 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@I@Z */
6614 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@I@Z */
6615 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@K@Z */
6616 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@K@Z */
6617 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_uint, 8)
6618 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_uint(basic_ostream_wchar *this, unsigned int val)
6619 {
6620     return basic_ostream_print_uint(this, val, num_put_wchar_use_facet(
6621                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6622 }
6623
6624 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@I@Z */
6625 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@I@Z */
6626 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@K@Z */
6627 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@K@Z */
6628 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_uint, 8)
6629 basic_ostream_wchar* __thiscall basic_ostream_short_print_uint(basic_ostream_wchar *this, unsigned int val)
6630 {
6631     return basic_ostream_print_uint(this, val, num_put_short_use_facet(
6632                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6633 }
6634
6635 static basic_ostream_wchar* basic_ostream_print_float(basic_ostream_wchar *this, float val, const num_put *numput)
6636 {
6637     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6638     int state = IOSTATE_goodbit;
6639
6640     TRACE("(%p %f)\n", this, val);
6641
6642     if(basic_ostream_wchar_sentry_create(this)) {
6643         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6644         ostreambuf_iterator_wchar dest = {0, strbuf};
6645
6646         num_put_wchar_put_double(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6647     }
6648     basic_ostream_wchar_sentry_destroy(this);
6649
6650     basic_ios_wchar_setstate(base, state);
6651     return this;
6652 }
6653
6654 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@M@Z */
6655 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@M@Z */
6656 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_float, 8)
6657 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_float(basic_ostream_wchar *this, float val)
6658 {
6659     return basic_ostream_print_float(this, val, num_put_wchar_use_facet(
6660                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6661 }
6662
6663 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@M@Z */
6664 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@M@Z */
6665 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_float, 8)
6666 basic_ostream_wchar* __thiscall basic_ostream_short_print_float(basic_ostream_wchar *this, float val)
6667 {
6668     return basic_ostream_print_float(this, val, num_put_short_use_facet(
6669                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6670 }
6671
6672 static basic_ostream_wchar* basic_ostream_print_double(basic_ostream_wchar *this, double val, const num_put *numput)
6673 {
6674     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6675     int state = IOSTATE_goodbit;
6676
6677     TRACE("(%p %lf)\n", this, val);
6678
6679     if(basic_ostream_wchar_sentry_create(this)) {
6680         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6681         ostreambuf_iterator_wchar dest = {0, strbuf};
6682
6683         num_put_wchar_put_double(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6684     }
6685     basic_ostream_wchar_sentry_destroy(this);
6686
6687     basic_ios_wchar_setstate(base, state);
6688     return this;
6689 }
6690
6691 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@N@Z */
6692 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@N@Z */
6693 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_double, 12)
6694 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_double(basic_ostream_wchar *this, double val)
6695 {
6696     return basic_ostream_print_double(this, val, num_put_wchar_use_facet(
6697                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6698 }
6699
6700 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@N@Z */
6701 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@N@Z */
6702 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_double, 12)
6703 basic_ostream_wchar* __thiscall basic_ostream_short_print_double(basic_ostream_wchar *this, double val)
6704 {
6705     return basic_ostream_print_double(this, val, num_put_short_use_facet(
6706                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6707 }
6708
6709 static basic_ostream_wchar* basic_ostream_print_ldouble(basic_ostream_wchar *this, double val, const num_put *numput)
6710 {
6711     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6712     int state = IOSTATE_goodbit;
6713
6714     TRACE("(%p %lf)\n", this, val);
6715
6716     if(basic_ostream_wchar_sentry_create(this)) {
6717         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6718         ostreambuf_iterator_wchar dest = {0, strbuf};
6719
6720         num_put_wchar_put_ldouble(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6721     }
6722     basic_ostream_wchar_sentry_destroy(this);
6723
6724     basic_ios_wchar_setstate(base, state);
6725     return this;
6726 }
6727
6728 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@O@Z */
6729 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@O@Z */
6730 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_ldouble, 12)
6731 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_ldouble(basic_ostream_wchar *this, double val)
6732 {
6733     return basic_ostream_print_ldouble(this, val, num_put_wchar_use_facet(
6734                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6735 }
6736
6737 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@O@Z */
6738 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@O@Z */
6739 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_ldouble, 12)
6740 basic_ostream_wchar* __thiscall basic_ostream_short_print_ldouble(basic_ostream_wchar *this, double val)
6741 {
6742     return basic_ostream_print_ldouble(this, val, num_put_short_use_facet(
6743                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6744 }
6745
6746 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
6747 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
6748 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
6749 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
6750 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_streambuf, 8)
6751 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_streambuf(basic_ostream_wchar *this, basic_streambuf_wchar *val)
6752 {
6753     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6754     IOSB_iostate state = IOSTATE_badbit;
6755     unsigned short c = '\n';
6756
6757     TRACE("(%p %p)\n", this, val);
6758
6759     if(basic_ostream_wchar_sentry_create(this)) {
6760         for(c = basic_streambuf_wchar_sgetc(val); c!=WEOF;
6761                 c = basic_streambuf_wchar_snextc(val)) {
6762             state = IOSTATE_goodbit;
6763
6764             if(basic_streambuf_wchar_sputc(base->strbuf, c) == WEOF) {
6765                 state = IOSTATE_badbit;
6766                 break;
6767             }
6768         }
6769     }else {
6770         state = IOSTATE_badbit;
6771     }
6772     basic_ostream_wchar_sentry_destroy(this);
6773
6774     ios_base_width_set(&base->base, 0);
6775     basic_ios_wchar_setstate(base, state);
6776     return this;
6777 }
6778
6779 static basic_ostream_wchar* basic_ostream_print_ptr(basic_ostream_wchar *this, const void *val, const num_put *numput)
6780 {
6781     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6782     int state = IOSTATE_goodbit;
6783
6784     TRACE("(%p %p)\n", this, val);
6785
6786     if(basic_ostream_wchar_sentry_create(this)) {
6787         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6788         ostreambuf_iterator_wchar dest = {0, strbuf};
6789
6790         num_put_wchar_put_ptr(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6791     }
6792     basic_ostream_wchar_sentry_destroy(this);
6793
6794     basic_ios_wchar_setstate(base, state);
6795     return this;
6796 }
6797
6798 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@PBX@Z */
6799 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@PEBX@Z */
6800 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_ptr, 8)
6801 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_ptr(basic_ostream_wchar *this, const void *val)
6802 {
6803     return basic_ostream_print_ptr(this, val, num_put_wchar_use_facet(
6804                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6805 }
6806
6807 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@PBX@Z */
6808 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@PEBX@Z */
6809 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_ptr, 8)
6810 basic_ostream_wchar* __thiscall basic_ostream_short_print_ptr(basic_ostream_wchar *this, const void *val)
6811 {
6812     return basic_ostream_print_ptr(this, val, num_put_short_use_facet(
6813                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6814 }
6815
6816 static basic_ostream_wchar* basic_ostream_print_int64(basic_ostream_wchar *this, __int64 val, const num_put *numput)
6817 {
6818     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6819     int state = IOSTATE_goodbit;
6820
6821     TRACE("(%p)\n", this);
6822
6823     if(basic_ostream_wchar_sentry_create(this)) {
6824         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6825         ostreambuf_iterator_wchar dest = {0, strbuf};
6826
6827         num_put_wchar_put_int64(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6828     }
6829     basic_ostream_wchar_sentry_destroy(this);
6830
6831     basic_ios_wchar_setstate(base, state);
6832     return this;
6833 }
6834
6835 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@_J@Z */
6836 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@_J@Z */
6837 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_int64, 12)
6838 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_int64(basic_ostream_wchar *this, __int64 val)
6839 {
6840     return basic_ostream_print_int64(this, val, num_put_wchar_use_facet(
6841                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6842 }
6843
6844 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@_J@Z */
6845 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@_J@Z */
6846 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_int64, 12)
6847 basic_ostream_wchar* __thiscall basic_ostream_short_print_int64(basic_ostream_wchar *this, __int64 val)
6848 {
6849     return basic_ostream_print_int64(this, val, num_put_short_use_facet(
6850                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6851 }
6852
6853 static basic_ostream_wchar* basic_ostream_print_uint64(basic_ostream_wchar *this, unsigned __int64 val, const num_put *numput)
6854 {
6855     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6856     int state = IOSTATE_goodbit;
6857
6858     TRACE("(%p)\n", this);
6859
6860     if(basic_ostream_wchar_sentry_create(this)) {
6861         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6862         ostreambuf_iterator_wchar dest = {0, strbuf};
6863
6864         num_put_wchar_put_uint64(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6865     }
6866     basic_ostream_wchar_sentry_destroy(this);
6867
6868     basic_ios_wchar_setstate(base, state);
6869     return this;
6870 }
6871
6872 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@_K@Z */
6873 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@_K@Z */
6874 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_uint64, 12)
6875 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_uint64(basic_ostream_wchar *this, unsigned __int64 val)
6876 {
6877     return basic_ostream_print_uint64(this, val, num_put_wchar_use_facet(
6878                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6879 }
6880
6881 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@_K@Z */
6882 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@_K@Z */
6883 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_uint64, 12)
6884 basic_ostream_wchar* __thiscall basic_ostream_short_print_uint64(basic_ostream_wchar *this, unsigned __int64 val)
6885 {
6886     return basic_ostream_print_uint64(this, val, num_put_short_use_facet(
6887                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6888 }
6889
6890 static basic_ostream_wchar* basic_ostream_print_bool(basic_ostream_wchar *this, MSVCP_bool val, const num_put *numput)
6891 {
6892     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
6893     int state = IOSTATE_goodbit;
6894
6895     TRACE("(%p %x)\n", this, val);
6896
6897     if(basic_ostream_wchar_sentry_create(this)) {
6898         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6899         ostreambuf_iterator_wchar dest = {0, strbuf};
6900
6901         num_put_wchar_put_bool(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
6902     }
6903     basic_ostream_wchar_sentry_destroy(this);
6904
6905     basic_ios_wchar_setstate(base, state);
6906     return this;
6907 }
6908
6909 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@_N@Z */
6910 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@_N@Z */
6911 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_bool, 8)
6912 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_bool(basic_ostream_wchar *this, MSVCP_bool val)
6913 {
6914     return basic_ostream_print_bool(this, val, num_put_wchar_use_facet(
6915                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6916 }
6917
6918 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@_N@Z */
6919 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@_N@Z */
6920 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_bool, 8)
6921 basic_ostream_wchar* __thiscall basic_ostream_short_print_bool(basic_ostream_wchar *this, MSVCP_bool val)
6922 {
6923     return basic_ostream_print_bool(this, val, num_put_short_use_facet(
6924                 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
6925 }
6926
6927 /* ?endl@std@@YAAAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@AAV21@@Z */
6928 /* ?endl@std@@YAAEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@AEAV21@@Z */
6929 /* ?endl@std@@YAAAV?$basic_ostream@GU?$char_traits@G@std@@@1@AAV21@@Z */
6930 /* ?endl@std@@YAAEAV?$basic_ostream@GU?$char_traits@G@std@@@1@AEAV21@@Z */
6931 basic_ostream_wchar* __cdecl basic_ostream_wchar_endl(basic_ostream_wchar *ostr)
6932 {
6933     TRACE("(%p)\n", ostr);
6934
6935     basic_ostream_wchar_put(ostr, '\n');
6936     basic_ostream_wchar_flush(ostr);
6937     return ostr;
6938 }
6939
6940 /* ??$?6_WU?$char_traits@_W@std@@V?$allocator@_W@1@@std@@YAAAV?$basic_ostream@_WU?$char_traits@_W@std@@@0@AAV10@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@0@@Z */
6941 /* ??$?6_WU?$char_traits@_W@std@@V?$allocator@_W@1@@std@@YAAEAV?$basic_ostream@_WU?$char_traits@_W@std@@@0@AEAV10@AEBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@0@@Z */
6942 /* ??$?6GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YAAAV?$basic_ostream@GU?$char_traits@G@std@@@0@AAV10@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
6943 /* ??$?6GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YAAEAV?$basic_ostream@GU?$char_traits@G@std@@@0@AEAV10@AEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
6944 basic_ostream_wchar* __cdecl basic_ostream_wchar_print_bstr(basic_ostream_wchar *ostr, const basic_string_wchar *str)
6945 {
6946     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(ostr);
6947     IOSB_iostate state = IOSTATE_goodbit;
6948
6949     TRACE("(%p %p)\n", ostr, str);
6950
6951     if(basic_ostream_wchar_sentry_create(ostr)) {
6952         MSVCP_size_t len = MSVCP_basic_string_wchar_length(str);
6953         streamsize pad = (base->base.wide>len ? base->base.wide-len : 0);
6954
6955         if((base->base.fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
6956             for(; pad!=0; pad--) {
6957                 if(basic_streambuf_wchar_sputc(base->strbuf, base->fillch) == WEOF) {
6958                     state = IOSTATE_badbit;
6959                     break;
6960                 }
6961             }
6962         }
6963
6964         if(state == IOSTATE_goodbit) {
6965             if(basic_streambuf_wchar_sputn(base->strbuf, MSVCP_basic_string_wchar_c_str(str), len) != len)
6966                 state = IOSTATE_badbit;
6967         }
6968
6969         if(state == IOSTATE_goodbit) {
6970             for(; pad!=0; pad--) {
6971                 if(basic_streambuf_wchar_sputc(base->strbuf, base->fillch) == WEOF) {
6972                     state = IOSTATE_badbit;
6973                     break;
6974                 }
6975             }
6976         }
6977
6978         base->base.wide = 0;
6979     }else {
6980         state = IOSTATE_badbit;
6981     }
6982     basic_ostream_wchar_sentry_destroy(ostr);
6983
6984     basic_ios_wchar_setstate(base, state);
6985     return ostr;
6986 }
6987
6988 /* ??$?6_WU?$char_traits@_W@std@@@std@@YAAAV?$basic_ostream@_WU?$char_traits@_W@std@@@0@AAV10@_W@Z */
6989 /* ??$?6_WU?$char_traits@_W@std@@@std@@YAAEAV?$basic_ostream@_WU?$char_traits@_W@std@@@0@AEAV10@_W@Z */
6990 /* ??$?6GU?$char_traits@G@std@@@std@@YAAAV?$basic_ostream@GU?$char_traits@G@std@@@0@AAV10@G@Z */
6991 /* ??$?6GU?$char_traits@G@std@@@std@@YAAEAV?$basic_ostream@GU?$char_traits@G@std@@@0@AEAV10@G@Z */
6992 basic_ostream_wchar* __cdecl basic_ostream_wchar_print_ch(basic_ostream_wchar *ostr, wchar_t ch)
6993 {
6994     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(ostr);
6995     IOSB_iostate state = IOSTATE_goodbit;
6996
6997     TRACE("(%p %d)\n", ostr, ch);
6998
6999     if(basic_ostream_wchar_sentry_create(ostr)) {
7000         streamsize pad = (base->base.wide>1 ? base->base.wide-1 : 0);
7001
7002         if((base->base.fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
7003             for(; pad!=0; pad--) {
7004                 if(basic_streambuf_wchar_sputc(base->strbuf, base->fillch) == WEOF) {
7005                     state = IOSTATE_badbit;
7006                     break;
7007                 }
7008             }
7009         }
7010
7011         if(state == IOSTATE_goodbit) {
7012             if(basic_streambuf_wchar_sputc(base->strbuf, ch) == WEOF)
7013                 state = IOSTATE_badbit;
7014         }
7015
7016         if(state == IOSTATE_goodbit) {
7017             for(; pad!=0; pad--) {
7018                 if(basic_streambuf_wchar_sputc(base->strbuf, base->fillch) == WEOF) {
7019                     state = IOSTATE_badbit;
7020                     break;
7021                 }
7022             }
7023         }
7024
7025         base->base.wide = 0;
7026     }else {
7027         state = IOSTATE_badbit;
7028     }
7029     basic_ostream_wchar_sentry_destroy(ostr);
7030
7031     basic_ios_wchar_setstate(base, state);
7032     return ostr;
7033 }
7034
7035 /* ??$?6_WU?$char_traits@_W@std@@@std@@YAAAV?$basic_ostream@_WU?$char_traits@_W@std@@@0@AAV10@PB_W@Z */
7036 /* ??$?6_WU?$char_traits@_W@std@@@std@@YAAEAV?$basic_ostream@_WU?$char_traits@_W@std@@@0@AEAV10@PEB_W@Z */
7037 /* ??$?6GU?$char_traits@G@std@@@std@@YAAAV?$basic_ostream@GU?$char_traits@G@std@@@0@AAV10@PBG@Z */
7038 /* ??$?6GU?$char_traits@G@std@@@std@@YAAEAV?$basic_ostream@GU?$char_traits@G@std@@@0@AEAV10@PEBG@Z */
7039 basic_ostream_wchar* __cdecl basic_ostream_wchar_print_str(basic_ostream_wchar *ostr, const wchar_t *str)
7040 {
7041     basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(ostr);
7042     IOSB_iostate state = IOSTATE_goodbit;
7043
7044     TRACE("(%p %s)\n", ostr, debugstr_w(str));
7045
7046     if(basic_ostream_wchar_sentry_create(ostr)) {
7047         MSVCP_size_t len = wcslen(str);
7048         streamsize pad = (base->base.wide>len ? base->base.wide-len : 0);
7049
7050         if((base->base.fmtfl & FMTFLAG_adjustfield) != FMTFLAG_left) {
7051             for(; pad!=0; pad--) {
7052                 if(basic_streambuf_wchar_sputc(base->strbuf, base->fillch) == WEOF) {
7053                     state = IOSTATE_badbit;
7054                     break;
7055                 }
7056             }
7057         }
7058
7059         if(state == IOSTATE_goodbit) {
7060             if(basic_streambuf_wchar_sputn(base->strbuf, str, len) != len)
7061                                         state = IOSTATE_badbit;
7062         }
7063
7064         if(state == IOSTATE_goodbit) {
7065             for(; pad!=0; pad--) {
7066                 if(basic_streambuf_wchar_sputc(base->strbuf, base->fillch) == WEOF) {
7067                     state = IOSTATE_badbit;
7068                     break;
7069                 }
7070             }
7071         }
7072
7073         base->base.wide = 0;
7074     }else {
7075         state = IOSTATE_badbit;
7076     }
7077     basic_ostream_wchar_sentry_destroy(ostr);
7078
7079     basic_ios_wchar_setstate(base, state);
7080     return ostr;
7081 }
7082
7083 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
7084 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
7085 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
7086 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
7087 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_func, 8)
7088 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_func(basic_ostream_wchar *this,
7089         basic_ostream_wchar* (__cdecl *pfunc)(basic_ostream_wchar*))
7090 {
7091     TRACE("(%p %p)\n", this, pfunc);
7092     pfunc(this);
7093     return this;
7094 }
7095
7096 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@_WU?$char_traits@_W@std@@@1@AAV21@@Z@Z */
7097 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@_WU?$char_traits@_W@std@@@1@AEAV21@@Z@Z */
7098 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@GU?$char_traits@G@std@@@1@AAV21@@Z@Z */
7099 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@GU?$char_traits@G@std@@@1@AEAV21@@Z@Z */
7100 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_func_basic_ios, 8)
7101 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_func_basic_ios(basic_ostream_wchar *this,
7102         basic_ios_wchar* (__cdecl *pfunc)(basic_ios_wchar*))
7103 {
7104     TRACE("(%p %p)\n", this, pfunc);
7105     pfunc(basic_ostream_wchar_get_basic_ios(this));
7106     return this;
7107 }
7108
7109 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
7110 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
7111 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
7112 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
7113 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_func_ios_base, 8)
7114 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_func_ios_base(
7115         basic_ostream_wchar *this, ios_base* (__cdecl *pfunc)(ios_base*))
7116 {
7117     TRACE("(%p %p)\n", this, pfunc);
7118     pfunc(&basic_ostream_wchar_get_basic_ios(this)->base);
7119     return this;
7120 }
7121
7122 /* Caution: basic_istream uses virtual inheritance. */
7123 static inline basic_ios_char* basic_istream_char_get_basic_ios(basic_istream_char *this)
7124 {
7125     return (basic_ios_char*)((char*)this+this->vbtable[1]);
7126 }
7127
7128 static inline basic_ios_char* basic_istream_char_to_basic_ios(basic_istream_char *ptr)
7129 {
7130     return (basic_ios_char*)((char*)ptr+basic_istream_char_vbtable[1]);
7131 }
7132
7133 static inline basic_istream_char* basic_istream_char_from_basic_ios(basic_ios_char *ptr)
7134 {
7135     return (basic_istream_char*)((char*)ptr-basic_istream_char_vbtable[1]);
7136 }
7137
7138 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N1@Z */
7139 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N1@Z */
7140 DEFINE_THISCALL_WRAPPER(basic_istream_char_ctor_init, 20)
7141 basic_istream_char* __thiscall basic_istream_char_ctor_init(basic_istream_char *this, basic_streambuf_char *strbuf, MSVCP_bool isstd, MSVCP_bool noinit, MSVCP_bool virt_init)
7142 {
7143     basic_ios_char *base;
7144
7145     TRACE("(%p %p %d %d %d)\n", this, strbuf, isstd, noinit, virt_init);
7146
7147     if(virt_init) {
7148         this->vbtable = basic_istream_char_vbtable;
7149         base = basic_istream_char_get_basic_ios(this);
7150         basic_ios_char_ctor(base);
7151     }else {
7152         base = basic_istream_char_get_basic_ios(this);
7153     }
7154
7155     base->base.vtable = &MSVCP_basic_istream_char_vtable;
7156     this->count = 0;
7157     if(!noinit)
7158         basic_ios_char_init(base, strbuf, isstd);
7159     return this;
7160 }
7161
7162 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z */
7163 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z */
7164 DEFINE_THISCALL_WRAPPER(basic_istream_char_ctor, 16)
7165 basic_istream_char* __thiscall basic_istream_char_ctor(basic_istream_char *this, basic_streambuf_char *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
7166 {
7167     return basic_istream_char_ctor_init(this, strbuf, isstd, FALSE, virt_init);
7168 }
7169
7170 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QAE@W4_Uninitialized@1@@Z */
7171 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
7172 DEFINE_THISCALL_WRAPPER(basic_istream_char_ctor_uninitialized, 12)
7173 basic_istream_char* __thiscall basic_istream_char_ctor_uninitialized(basic_istream_char *this, int uninitialized, MSVCP_bool virt_init)
7174 {
7175     basic_ios_char *base;
7176
7177     TRACE("(%p %d %d)\n", this, uninitialized, virt_init);
7178
7179     if(virt_init) {
7180         this->vbtable = basic_istream_char_vbtable;
7181         base = basic_istream_char_get_basic_ios(this);
7182         basic_ios_char_ctor(base);
7183     }else {
7184         base = basic_istream_char_get_basic_ios(this);
7185     }
7186
7187     base->base.vtable = &MSVCP_basic_istream_char_vtable;
7188     ios_base_Addstd(&base->base);
7189     return this;
7190 }
7191
7192 /* ??1?$basic_istream@DU?$char_traits@D@std@@@std@@UAE@XZ */
7193 /* ??1?$basic_istream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
7194 DEFINE_THISCALL_WRAPPER(basic_istream_char_dtor, 4)
7195 void __thiscall basic_istream_char_dtor(basic_ios_char *base)
7196 {
7197     basic_istream_char *this = basic_istream_char_from_basic_ios(base);
7198
7199     /* don't destroy virtual base here */
7200     TRACE("(%p)\n", this);
7201 }
7202
7203 /* ??_D?$basic_istream@DU?$char_traits@D@std@@@std@@QAEXXZ */
7204 /* ??_D?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
7205 DEFINE_THISCALL_WRAPPER(basic_istream_char_vbase_dtor, 4)
7206 void __thiscall basic_istream_char_vbase_dtor(basic_istream_char *this)
7207 {
7208     TRACE("(%p)\n", this);
7209     basic_istream_char_dtor(basic_istream_char_to_basic_ios(this));
7210     basic_ios_char_dtor(basic_istream_char_get_basic_ios(this));
7211 }
7212
7213 DEFINE_THISCALL_WRAPPER(basic_istream_char_vector_dtor, 8)
7214 basic_istream_char* __thiscall basic_istream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
7215 {
7216     basic_istream_char *this = basic_istream_char_from_basic_ios(base);
7217
7218     TRACE("(%p %x)\n", this, flags);
7219
7220     if(flags & 2) {
7221         /* we have an array, with the number of elements stored before the first object */
7222         INT_PTR i, *ptr = (INT_PTR *)this-1;
7223
7224         for(i=*ptr-1; i>=0; i--)
7225             basic_istream_char_vbase_dtor(this+i);
7226         MSVCRT_operator_delete(ptr);
7227     } else {
7228         basic_istream_char_vbase_dtor(this);
7229         if(flags & 1)
7230             MSVCRT_operator_delete(this);
7231     }
7232
7233     return this;
7234 }
7235
7236 /* ?_Ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QAE_N_N@Z */
7237 /* ?_Ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA_N_N@Z */
7238 DEFINE_THISCALL_WRAPPER(basic_istream_char__Ipfx, 8)
7239 MSVCP_bool __thiscall basic_istream_char__Ipfx(basic_istream_char *this, MSVCP_bool noskip)
7240 {
7241     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7242
7243     TRACE("(%p %d)\n", this, noskip);
7244
7245     if(!ios_base_good(&base->base)) {
7246         basic_ios_char_setstate(base, IOSTATE_failbit);
7247         return FALSE;
7248     }
7249
7250     if(basic_ios_char_tie_get(base))
7251         basic_ostream_char_flush(basic_ios_char_tie_get(base));
7252
7253     if(!noskip && (ios_base_flags_get(&base->base) & FMTFLAG_skipws)) {
7254         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7255         const ctype_char *ctype = ctype_char_use_facet(base->strbuf->loc);
7256         int ch;
7257
7258         for(ch = basic_streambuf_char_sgetc(strbuf); ;
7259                 ch = basic_streambuf_char_snextc(strbuf)) {
7260             if(ch == EOF) {
7261                 basic_ios_char_setstate(base, IOSTATE_eofbit);
7262                 return FALSE;
7263             }
7264
7265             if(!ctype_char_is_ch(ctype, _SPACE|_BLANK, ch))
7266                 break;
7267         }
7268     }
7269
7270     return TRUE;
7271 }
7272
7273 /* ?ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QAE_N_N@Z */
7274 /* ?ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA_N_N@Z */
7275 DEFINE_THISCALL_WRAPPER(basic_istream_char_ipfx, 8)
7276 MSVCP_bool __thiscall basic_istream_char_ipfx(basic_istream_char *this, MSVCP_bool noskip)
7277 {
7278     return basic_istream_char__Ipfx(this, noskip);
7279 }
7280
7281 /* ?isfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEXXZ */
7282 /* ?isfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
7283 DEFINE_THISCALL_WRAPPER(basic_istream_char_isfx, 4)
7284 void __thiscall basic_istream_char_isfx(basic_istream_char *this)
7285 {
7286     TRACE("(%p)\n", this);
7287 }
7288
7289 static BOOL basic_istream_char_sentry_create(basic_istream_char *istr, MSVCP_bool noskip)
7290 {
7291     basic_ios_char *base = basic_istream_char_get_basic_ios(istr);
7292
7293     if(basic_ios_char_rdbuf_get(base))
7294         basic_streambuf_char__Lock(base->strbuf);
7295
7296     return basic_istream_char_ipfx(istr, noskip);
7297 }
7298
7299 static void basic_istream_char_sentry_destroy(basic_istream_char *istr)
7300 {
7301     basic_ios_char *base = basic_istream_char_get_basic_ios(istr);
7302
7303     if(basic_ios_char_rdbuf_get(base))
7304         basic_streambuf_char__Unlock(base->strbuf);
7305 }
7306
7307 /* ?gcount@?$basic_istream@DU?$char_traits@D@std@@@std@@QBEHXZ */
7308 /* ?gcount@?$basic_istream@DU?$char_traits@D@std@@@std@@QEBA_JXZ */
7309 DEFINE_THISCALL_WRAPPER(basic_istream_char_gcount, 4)
7310 int __thiscall basic_istream_char_gcount(const basic_istream_char *this)
7311 {
7312     TRACE("(%p)\n", this);
7313     return this->count;
7314 }
7315
7316 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHXZ */
7317 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAHXZ */
7318 DEFINE_THISCALL_WRAPPER(basic_istream_char_get, 4)
7319 int __thiscall basic_istream_char_get(basic_istream_char *this)
7320 {
7321     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7322     int ret;
7323
7324     TRACE("(%p)\n", this);
7325
7326     this->count = 0;
7327
7328     if(!basic_istream_char_sentry_create(this, TRUE)) {
7329         basic_istream_char_sentry_destroy(this);
7330         return EOF;
7331     }
7332
7333     ret = basic_streambuf_char_sbumpc(basic_ios_char_rdbuf_get(base));
7334     basic_istream_char_sentry_destroy(this);
7335     if(ret == EOF)
7336         basic_ios_char_setstate(base, IOSTATE_eofbit|IOSTATE_failbit);
7337     else
7338         this->count++;
7339
7340     return ret;
7341 }
7342
7343 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@AAD@Z */
7344 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@AEAD@Z */
7345 DEFINE_THISCALL_WRAPPER(basic_istream_char_get_ch, 8)
7346 basic_istream_char* __thiscall basic_istream_char_get_ch(basic_istream_char *this, char *ch)
7347 {
7348     int ret;
7349
7350     TRACE("(%p %p)\n", this, ch);
7351
7352     ret = basic_istream_char_get(this);
7353     if(ret != EOF)
7354         *ch = (char)ret;
7355     return this;
7356 }
7357
7358 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADHD@Z */
7359 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_JD@Z */
7360 DEFINE_THISCALL_WRAPPER(basic_istream_char_get_str_delim, 16)
7361 basic_istream_char* __thiscall basic_istream_char_get_str_delim(basic_istream_char *this, char *str, streamsize count, char delim)
7362 {
7363     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7364     int ch = delim;
7365
7366     TRACE("(%p %p %ld %c)\n", this, str, count, delim);
7367
7368     this->count = 0;
7369
7370     if(basic_istream_char_sentry_create(this, TRUE)) {
7371         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7372
7373         for(ch = basic_streambuf_char_sgetc(strbuf); count>1;
7374                 ch = basic_streambuf_char_snextc(strbuf)) {
7375             if(ch==EOF || ch==delim)
7376                 break;
7377
7378             *str++ = ch;
7379             this->count++;
7380             count--;
7381         }
7382     }
7383     basic_istream_char_sentry_destroy(this);
7384
7385     basic_ios_char_setstate(base, (!this->count ? IOSTATE_failbit : IOSTATE_goodbit) |
7386             (ch==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
7387     if(count > 0)
7388         *str = 0;
7389     return this;
7390 }
7391
7392 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADH@Z */
7393 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_J@Z */
7394 DEFINE_THISCALL_WRAPPER(basic_istream_char_get_str, 12)
7395 basic_istream_char* __thiscall basic_istream_char_get_str(basic_istream_char *this, char *str, streamsize count)
7396 {
7397     return basic_istream_char_get_str_delim(this, str, count, '\n');
7398 }
7399
7400 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@AAV?$basic_streambuf@DU?$char_traits@D@std@@@2@D@Z */
7401 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@D@Z */
7402 DEFINE_THISCALL_WRAPPER(basic_istream_char_get_streambuf_delim, 12)
7403 basic_istream_char* __thiscall basic_istream_char_get_streambuf_delim(basic_istream_char *this, basic_streambuf_char *strbuf, char delim)
7404 {
7405     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7406     int ch = delim;
7407
7408     TRACE("(%p %p %c)\n", this, strbuf, delim);
7409
7410     this->count = 0;
7411
7412     if(basic_istream_char_sentry_create(this, TRUE)) {
7413         basic_streambuf_char *strbuf_read = basic_ios_char_rdbuf_get(base);
7414
7415         for(ch = basic_streambuf_char_sgetc(strbuf_read); ;
7416                 ch = basic_streambuf_char_snextc(strbuf_read)) {
7417             if(ch==EOF || ch==delim)
7418                 break;
7419
7420             if(basic_streambuf_char_sputc(strbuf, ch) == EOF)
7421                 break;
7422             this->count++;
7423         }
7424     }
7425     basic_istream_char_sentry_destroy(this);
7426
7427     basic_ios_char_setstate(base, (!this->count ? IOSTATE_failbit : IOSTATE_goodbit) |
7428             (ch==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
7429     return this;
7430 }
7431
7432 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@AAV?$basic_streambuf@DU?$char_traits@D@std@@@2@@Z */
7433 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@@Z */
7434 DEFINE_THISCALL_WRAPPER(basic_istream_char_get_streambuf, 8)
7435 basic_istream_char* __thiscall basic_istream_char_get_streambuf(basic_istream_char *this, basic_streambuf_char *strbuf)
7436 {
7437     return basic_istream_char_get_streambuf_delim(this, strbuf, '\n');
7438 }
7439
7440 /* ?getline@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADHD@Z */
7441 /* ?getline@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_JD@Z */
7442 DEFINE_THISCALL_WRAPPER(basic_istream_char_getline_delim, 16)
7443 basic_istream_char* __thiscall basic_istream_char_getline_delim(basic_istream_char *this, char *str, streamsize count, char delim)
7444 {
7445     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7446     int ch = delim;
7447
7448     TRACE("(%p %p %ld %c)\n", this, str, count, delim);
7449
7450     this->count = 0;
7451
7452     if(basic_istream_char_sentry_create(this, TRUE) && count>0) {
7453         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7454
7455         while(count > 1) {
7456             ch = basic_streambuf_char_sbumpc(strbuf);
7457
7458             if(ch==EOF || ch==delim)
7459                 break;
7460
7461             *str++ = ch;
7462             this->count++;
7463             count--;
7464         }
7465
7466         if(ch == delim)
7467             this->count++;
7468         else if(ch != EOF) {
7469             ch = basic_streambuf_char_sgetc(strbuf);
7470
7471             if(ch == delim) {
7472                 basic_streambuf_char__Gninc(strbuf);
7473                 this->count++;
7474             }
7475         }
7476     }
7477     basic_istream_char_sentry_destroy(this);
7478
7479     basic_ios_char_setstate(base, (ch==EOF ? IOSTATE_eofbit : IOSTATE_goodbit) |
7480             (!this->count || (ch!=delim && ch!=EOF) ? IOSTATE_failbit : IOSTATE_goodbit));
7481     if(count > 0)
7482         *str = 0;
7483     return this;
7484 }
7485
7486 /* ?getline@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADH@Z */
7487 /* ?getline@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_J@Z */
7488 DEFINE_THISCALL_WRAPPER(basic_istream_char_getline, 12)
7489 basic_istream_char* __thiscall basic_istream_char_getline(basic_istream_char *this, char *str, streamsize count)
7490 {
7491     return basic_istream_char_getline_delim(this, str, count, '\n');
7492 }
7493
7494 /* ?ignore@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@HH@Z */
7495 /* ?ignore@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@_JH@Z */
7496 DEFINE_THISCALL_WRAPPER(basic_istream_char_ignore, 12)
7497 basic_istream_char* __thiscall basic_istream_char_ignore(basic_istream_char *this, streamsize count, int delim)
7498 {
7499     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7500     int ch = delim;
7501
7502     TRACE("(%p %ld %d)\n", this, count, delim);
7503
7504     this->count = 0;
7505
7506     if(basic_istream_char_sentry_create(this, TRUE)) {
7507         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7508
7509         while(count > 0) {
7510             ch = basic_streambuf_char_sbumpc(strbuf);
7511
7512             if(ch==EOF || ch==delim)
7513                 break;
7514
7515             this->count++;
7516             if(count != INT_MAX)
7517                 count--;
7518         }
7519     }
7520     basic_istream_char_sentry_destroy(this);
7521
7522     if(ch == EOF)
7523         basic_ios_char_setstate(base, IOSTATE_eofbit);
7524     return this;
7525 }
7526
7527 /* ?ws@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@1@AAV21@@Z */
7528 /* ?ws@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@1@AEAV21@@Z */
7529 basic_istream_char* __cdecl ws_basic_istream_char(basic_istream_char *istream)
7530 {
7531     basic_ios_char *base = basic_istream_char_get_basic_ios(istream);
7532     int ch = '\n';
7533
7534     TRACE("(%p)\n", istream);
7535
7536     if(basic_istream_char_sentry_create(istream, TRUE)) {
7537         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7538         const ctype_char *ctype = ctype_char_use_facet(strbuf->loc);
7539
7540         for(ch = basic_streambuf_char_sgetc(strbuf); ctype_char_is_ch(ctype, _SPACE, ch);
7541                 ch = basic_streambuf_char_snextc(strbuf)) {
7542             if(ch == EOF)
7543                 break;
7544         }
7545     }
7546     basic_istream_char_sentry_destroy(istream);
7547
7548     if(ch == EOF)
7549         basic_ios_char_setstate(base, IOSTATE_eofbit);
7550     return istream;
7551 }
7552
7553 /* ?peek@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHXZ */
7554 /* ?peek@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAHXZ */
7555 DEFINE_THISCALL_WRAPPER(basic_istream_char_peek, 4)
7556 int __thiscall basic_istream_char_peek(basic_istream_char *this)
7557 {
7558     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7559     int ret = EOF;
7560
7561     TRACE("(%p)\n", this);
7562
7563     this->count = 0;
7564
7565     if(basic_istream_char_sentry_create(this, TRUE))
7566         ret = basic_streambuf_char_sgetc(basic_ios_char_rdbuf_get(base));
7567     basic_istream_char_sentry_destroy(this);
7568     return ret;
7569 }
7570
7571 /* ?_Read_s@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADIH@Z */
7572 /* ?_Read_s@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_K_J@Z */
7573 DEFINE_THISCALL_WRAPPER(basic_istream_char__Read_s, 16)
7574 basic_istream_char* __thiscall basic_istream_char__Read_s(basic_istream_char *this, char *str, MSVCP_size_t size, streamsize count)
7575 {
7576     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7577     IOSB_iostate state = IOSTATE_goodbit;
7578
7579     TRACE("(%p %p %lu %ld)\n", this, str, size, count);
7580
7581     if(basic_istream_char_sentry_create(this, TRUE)) {
7582         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7583
7584         this->count = basic_streambuf_char__Sgetn_s(strbuf, str, size, count);
7585         if(this->count != count)
7586             state |= IOSTATE_failbit | IOSTATE_eofbit;
7587     }else {
7588         this->count = 0;
7589     }
7590     basic_istream_char_sentry_destroy(this);
7591
7592     basic_ios_char_setstate(base, state);
7593     return this;
7594 }
7595
7596 /* ?read@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADH@Z */
7597 /* ?read@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_J@Z */
7598 DEFINE_THISCALL_WRAPPER(basic_istream_char_read, 12)
7599 basic_istream_char* __thiscall basic_istream_char_read(basic_istream_char *this, char *str, streamsize count)
7600 {
7601     return basic_istream_char__Read_s(this, str, count, count);
7602 }
7603
7604 /* ?_Readsome_s@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHPADIH@Z */
7605 /* ?_Readsome_s@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA_JPEAD_K_J@Z */
7606 DEFINE_THISCALL_WRAPPER(basic_istream_char__Readsome_s, 16)
7607 streamsize __thiscall basic_istream_char__Readsome_s(basic_istream_char *this, char *str, MSVCP_size_t size, streamsize count)
7608 {
7609     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7610     IOSB_iostate state = IOSTATE_goodbit;
7611
7612     TRACE("(%p %p %lu %ld)\n", this, str, size, count);
7613
7614     this->count = 0;
7615
7616     if(basic_istream_char_sentry_create(this, TRUE)) {
7617         streamsize avail = basic_streambuf_char_in_avail(basic_ios_char_rdbuf_get(base));
7618         if(avail > count)
7619             avail = count;
7620
7621         if(avail == -1)
7622             state |= IOSTATE_eofbit;
7623         else if(avail > 0)
7624             basic_istream_char__Read_s(this, str, size, avail);
7625     }else {
7626         state |= IOSTATE_failbit;
7627     }
7628     basic_istream_char_sentry_destroy(this);
7629
7630     basic_ios_char_setstate(base, state);
7631     return this->count;
7632 }
7633
7634 /* ?readsome@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHPADH@Z */
7635 /* ?readsome@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA_JPEAD_J@Z */
7636 DEFINE_THISCALL_WRAPPER(basic_istream_char_readsome, 12)
7637 streamsize __thiscall basic_istream_char_readsome(basic_istream_char *this, char *str, streamsize count)
7638 {
7639     return basic_istream_char__Readsome_s(this, str, count, count);
7640 }
7641
7642 /* ?putback@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@D@Z */
7643 /* ?putback@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@D@Z */
7644 DEFINE_THISCALL_WRAPPER(basic_istream_char_putback, 8)
7645 basic_istream_char* __thiscall basic_istream_char_putback(basic_istream_char *this, char ch)
7646 {
7647     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7648     IOSB_iostate state = IOSTATE_goodbit;
7649
7650     TRACE("(%p %c)\n", this, ch);
7651
7652     this->count = 0;
7653
7654     if(basic_istream_char_sentry_create(this, TRUE)) {
7655         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7656
7657         if(!ios_base_good(&base->base))
7658             state |= IOSTATE_failbit;
7659         else if(!strbuf || basic_streambuf_char_sputbackc(strbuf, ch)==EOF)
7660             state |= IOSTATE_badbit;
7661     }
7662     basic_istream_char_sentry_destroy(this);
7663
7664     basic_ios_char_setstate(base, state);
7665     return this;
7666 }
7667
7668 /* ?unget@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@XZ */
7669 /* ?unget@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@XZ */
7670 DEFINE_THISCALL_WRAPPER(basic_istream_char_unget, 4)
7671 basic_istream_char* __thiscall basic_istream_char_unget(basic_istream_char *this)
7672 {
7673     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7674     IOSB_iostate state = IOSTATE_goodbit;
7675
7676     TRACE("(%p)\n", this);
7677
7678     this->count = 0;
7679
7680     if(basic_istream_char_sentry_create(this, TRUE)) {
7681         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7682
7683         if(!ios_base_good(&base->base))
7684             state |= IOSTATE_failbit;
7685         else if(!strbuf || basic_streambuf_char_sungetc(strbuf)==EOF)
7686             state |= IOSTATE_badbit;
7687     }
7688     basic_istream_char_sentry_destroy(this);
7689
7690     basic_ios_char_setstate(base, state);
7691     return this;
7692 }
7693
7694 /* ?sync@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHXZ */
7695 /* ?sync@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAHXZ */
7696 DEFINE_THISCALL_WRAPPER(basic_istream_char_sync, 4)
7697 int __thiscall basic_istream_char_sync(basic_istream_char *this)
7698 {
7699     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7700     basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7701
7702     TRACE("(%p)\n", this);
7703
7704     if(!strbuf)
7705         return -1;
7706
7707     if(basic_istream_char_sentry_create(this, TRUE)) {
7708         if(basic_streambuf_char_pubsync(strbuf) != -1) {
7709             basic_istream_char_sentry_destroy(this);
7710             return 0;
7711         }
7712     }
7713     basic_istream_char_sentry_destroy(this);
7714
7715     basic_ios_char_setstate(base, IOSTATE_badbit);
7716     return -1;
7717 }
7718
7719 /* ?tellg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@XZ */
7720 /* ?tellg@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
7721 DEFINE_THISCALL_WRAPPER(basic_istream_char_tellg, 8)
7722 fpos_int* __thiscall basic_istream_char_tellg(basic_istream_char *this, fpos_int *ret)
7723 {
7724     TRACE("(%p %p)\n", this, ret);
7725
7726     if(basic_istream_char_sentry_create(this, TRUE)) {
7727         basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7728         if(!ios_base_fail(&base->base)) {
7729             basic_streambuf_char_pubseekoff(basic_ios_char_rdbuf_get(base),
7730                     ret, 0, SEEKDIR_cur, OPENMODE_in);
7731             basic_istream_char_sentry_destroy(this);
7732
7733             if(ret->off==0 && ret->pos==-1 && ret->state==0)
7734                 basic_ios_char_setstate(base, IOSTATE_failbit);
7735             return ret;
7736         }
7737     }
7738     basic_istream_char_sentry_destroy(this);
7739
7740     ret->off = 0;
7741     ret->pos = -1;
7742     ret->state = 0;
7743     return ret;
7744 }
7745
7746 /* ?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@JH@Z */
7747 /* ?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@_JH@Z */
7748 DEFINE_THISCALL_WRAPPER(basic_istream_char_seekg, 12)
7749 basic_istream_char* __thiscall basic_istream_char_seekg(basic_istream_char *this, streamoff off, int dir)
7750 {
7751     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7752
7753     TRACE("(%p %ld %d)\n", this, off, dir);
7754
7755     if(basic_istream_char_sentry_create(this, TRUE)) {
7756         if(!ios_base_fail(&base->base)) {
7757             basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7758             fpos_int ret;
7759
7760             basic_streambuf_char_pubseekoff(strbuf, &ret, off, dir, OPENMODE_in);
7761             basic_istream_char_sentry_destroy(this);
7762
7763             if(ret.off==0 && ret.pos==-1 && ret.state==0)
7764                 basic_ios_char_setstate(base, IOSTATE_failbit);
7765             else
7766                 basic_ios_char_clear(base, IOSTATE_goodbit);
7767             return this;
7768         }
7769     }
7770     basic_istream_char_sentry_destroy(this);
7771
7772     basic_ios_char_setstate(base, IOSTATE_failbit);
7773     return this;
7774 }
7775
7776 /* ?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
7777 /* ?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
7778 DEFINE_THISCALL_WRAPPER(basic_istream_char_seekg_fpos, 28)
7779 basic_istream_char* __thiscall basic_istream_char_seekg_fpos(basic_istream_char *this, fpos_int pos)
7780 {
7781     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7782
7783     TRACE("(%p %s)\n", this, debugstr_fpos_int(&pos));
7784
7785     if(basic_istream_char_sentry_create(this, TRUE)) {
7786         if(!ios_base_fail(&base->base)) {
7787             basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7788             fpos_int ret;
7789
7790             basic_streambuf_char_pubseekpos(strbuf, &ret, pos, OPENMODE_in);
7791             basic_istream_char_sentry_destroy(this);
7792
7793             if(ret.off==0 && ret.pos==-1 && ret.state==0)
7794                 basic_ios_char_setstate(base, IOSTATE_failbit);
7795             else
7796                 basic_ios_char_clear(base, IOSTATE_goodbit);
7797             return this;
7798         }
7799     }
7800     basic_istream_char_sentry_destroy(this);
7801
7802     basic_ios_char_setstate(base, IOSTATE_failbit);
7803     return this;
7804 }
7805
7806 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAF@Z */
7807 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAF@Z */
7808 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_short, 8)
7809 basic_istream_char* __thiscall basic_istream_char_read_short(basic_istream_char *this, short *v)
7810 {
7811     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7812     int state = IOSTATE_goodbit;
7813
7814     TRACE("(%p %p)\n", this, v);
7815
7816     if(basic_istream_char_sentry_create(this, FALSE)) {
7817         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7818         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7819         istreambuf_iterator_char first={0}, last={0};
7820         LONG tmp;
7821
7822         first.strbuf = strbuf;
7823         num_get_char_get_long(numget, &last, first, last, &base->base, &state, &tmp);
7824
7825         if(!(state&IOSTATE_failbit) && tmp==(LONG)((short)tmp))
7826             *v = tmp;
7827         else
7828             state |= IOSTATE_failbit;
7829     }
7830     basic_istream_char_sentry_destroy(this);
7831
7832     basic_ios_char_setstate(base, state);
7833     return this;
7834 }
7835
7836 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAG@Z */
7837 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAG@Z */
7838 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_ushort, 8)
7839 basic_istream_char* __thiscall basic_istream_char_read_ushort(basic_istream_char *this, unsigned short *v)
7840 {
7841     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7842     int state = IOSTATE_goodbit;
7843
7844     TRACE("(%p %p)\n", this, v);
7845
7846     if(basic_istream_char_sentry_create(this, FALSE)) {
7847         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7848         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7849         istreambuf_iterator_char first={0}, last={0};
7850
7851         first.strbuf = strbuf;
7852         num_get_char_get_ushort(numget, &last, first, last, &base->base, &state, v);
7853     }
7854     basic_istream_char_sentry_destroy(this);
7855
7856     basic_ios_char_setstate(base, state);
7857     return this;
7858 }
7859
7860 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAH@Z */
7861 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAH@Z */
7862 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_int, 8)
7863 basic_istream_char* __thiscall basic_istream_char_read_int(basic_istream_char *this, int *v)
7864 {
7865     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7866     int state = IOSTATE_goodbit;
7867
7868     TRACE("(%p %p)\n", this, v);
7869
7870     if(basic_istream_char_sentry_create(this, FALSE)) {
7871         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7872         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7873         istreambuf_iterator_char first={0}, last={0};
7874
7875         first.strbuf = strbuf;
7876         num_get_char_get_long(numget, &last, first, last, &base->base, &state, v);
7877     }
7878     basic_istream_char_sentry_destroy(this);
7879
7880     basic_ios_char_setstate(base, state);
7881     return this;
7882 }
7883
7884 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAI@Z */
7885 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAI@Z */
7886 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_uint, 8)
7887 basic_istream_char* __thiscall basic_istream_char_read_uint(basic_istream_char *this, unsigned int *v)
7888 {
7889     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7890     int state = IOSTATE_goodbit;
7891
7892     TRACE("(%p %p)\n", this, v);
7893
7894     if(basic_istream_char_sentry_create(this, FALSE)) {
7895         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7896         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7897         istreambuf_iterator_char first={0}, last={0};
7898
7899         first.strbuf = strbuf;
7900         num_get_char_get_uint(numget, &last, first, last, &base->base, &state, v);
7901     }
7902     basic_istream_char_sentry_destroy(this);
7903
7904     basic_ios_char_setstate(base, state);
7905     return this;
7906 }
7907
7908 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAJ@Z */
7909 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAJ@Z */
7910 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_long, 8)
7911 basic_istream_char* __thiscall basic_istream_char_read_long(basic_istream_char *this, LONG *v)
7912 {
7913     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7914     int state = IOSTATE_goodbit;
7915
7916     TRACE("(%p %p)\n", this, v);
7917
7918     if(basic_istream_char_sentry_create(this, FALSE)) {
7919         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7920         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7921         istreambuf_iterator_char first={0}, last={0};
7922
7923         first.strbuf = strbuf;
7924         num_get_char_get_long(numget, &last, first, last, &base->base, &state, v);
7925     }
7926     basic_istream_char_sentry_destroy(this);
7927
7928     basic_ios_char_setstate(base, state);
7929     return this;
7930 }
7931
7932 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAK@Z */
7933 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAK@Z */
7934 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_ulong, 8)
7935 basic_istream_char* __thiscall basic_istream_char_read_ulong(basic_istream_char *this, ULONG *v)
7936 {
7937     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7938     int state = IOSTATE_goodbit;
7939
7940     TRACE("(%p %p)\n", this, v);
7941
7942     if(basic_istream_char_sentry_create(this, FALSE)) {
7943         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7944         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7945         istreambuf_iterator_char first={0}, last={0};
7946
7947         first.strbuf = strbuf;
7948         num_get_char_get_ulong(numget, &last, first, last, &base->base, &state, v);
7949     }
7950     basic_istream_char_sentry_destroy(this);
7951
7952     basic_ios_char_setstate(base, state);
7953     return this;
7954 }
7955
7956 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAM@Z */
7957 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAM@Z */
7958 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_float, 8)
7959 basic_istream_char* __thiscall basic_istream_char_read_float(basic_istream_char *this, float *v)
7960 {
7961     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7962     int state = IOSTATE_goodbit;
7963
7964     TRACE("(%p %p)\n", this, v);
7965
7966     if(basic_istream_char_sentry_create(this, FALSE)) {
7967         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7968         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7969         istreambuf_iterator_char first={0}, last={0};
7970
7971         first.strbuf = strbuf;
7972         num_get_char_get_float(numget, &last, first, last, &base->base, &state, v);
7973     }
7974     basic_istream_char_sentry_destroy(this);
7975
7976     basic_ios_char_setstate(base, state);
7977     return this;
7978 }
7979
7980 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAN@Z */
7981 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAN@Z */
7982 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_double, 8)
7983 basic_istream_char* __thiscall basic_istream_char_read_double(basic_istream_char *this, double *v)
7984 {
7985     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
7986     int state = IOSTATE_goodbit;
7987
7988     TRACE("(%p %p)\n", this, v);
7989
7990     if(basic_istream_char_sentry_create(this, FALSE)) {
7991         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
7992         const num_get *numget = num_get_char_use_facet(strbuf->loc);
7993         istreambuf_iterator_char first={0}, last={0};
7994
7995         first.strbuf = strbuf;
7996         num_get_char_get_double(numget, &last, first, last, &base->base, &state, v);
7997     }
7998     basic_istream_char_sentry_destroy(this);
7999
8000     basic_ios_char_setstate(base, state);
8001     return this;
8002 }
8003
8004 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAO@Z */
8005 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAO@Z */
8006 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_ldouble, 8)
8007 basic_istream_char* __thiscall basic_istream_char_read_ldouble(basic_istream_char *this, double *v)
8008 {
8009     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
8010     int state = IOSTATE_goodbit;
8011
8012     TRACE("(%p %p)\n", this, v);
8013
8014     if(basic_istream_char_sentry_create(this, FALSE)) {
8015         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
8016         const num_get *numget = num_get_char_use_facet(strbuf->loc);
8017         istreambuf_iterator_char first={0}, last={0};
8018
8019         first.strbuf = strbuf;
8020         num_get_char_get_ldouble(numget, &last, first, last, &base->base, &state, v);
8021     }
8022     basic_istream_char_sentry_destroy(this);
8023
8024     basic_ios_char_setstate(base, state);
8025     return this;
8026 }
8027
8028 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAPAX@Z */
8029 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAPEAX@Z */
8030 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_ptr, 8)
8031 basic_istream_char* __thiscall basic_istream_char_read_ptr(basic_istream_char *this, void **v)
8032 {
8033     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
8034     int state = IOSTATE_goodbit;
8035
8036     TRACE("(%p %p)\n", this, v);
8037
8038     if(basic_istream_char_sentry_create(this, FALSE)) {
8039         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
8040         const num_get *numget = num_get_char_use_facet(strbuf->loc);
8041         istreambuf_iterator_char first={0}, last={0};
8042
8043         first.strbuf = strbuf;
8044         num_get_char_get_void(numget, &last, first, last, &base->base, &state, v);
8045     }
8046     basic_istream_char_sentry_destroy(this);
8047
8048     basic_ios_char_setstate(base, state);
8049     return this;
8050 }
8051
8052 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AA_J@Z */
8053 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEA_J@Z */
8054 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_int64, 8)
8055 basic_istream_char* __thiscall basic_istream_char_read_int64(basic_istream_char *this, __int64 *v)
8056 {
8057     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
8058     int state = IOSTATE_goodbit;
8059
8060     TRACE("(%p %p)\n", this, v);
8061
8062     if(basic_istream_char_sentry_create(this, FALSE)) {
8063         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
8064         const num_get *numget = num_get_char_use_facet(strbuf->loc);
8065         istreambuf_iterator_char first={0}, last={0};
8066
8067         first.strbuf = strbuf;
8068         num_get_char_get_int64(numget, &last, first, last, &base->base, &state, v);
8069     }
8070     basic_istream_char_sentry_destroy(this);
8071
8072     basic_ios_char_setstate(base, state);
8073     return this;
8074 }
8075
8076 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AA_K@Z */
8077 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEA_K@Z */
8078 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_uint64, 8)
8079 basic_istream_char* __thiscall basic_istream_char_read_uint64(basic_istream_char *this, unsigned __int64 *v)
8080 {
8081     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
8082     int state = IOSTATE_goodbit;
8083
8084     TRACE("(%p %p)\n", this, v);
8085
8086     if(basic_istream_char_sentry_create(this, FALSE)) {
8087         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
8088         const num_get *numget = num_get_char_use_facet(strbuf->loc);
8089         istreambuf_iterator_char first={0}, last={0};
8090
8091         first.strbuf = strbuf;
8092         num_get_char_get_uint64(numget, &last, first, last, &base->base, &state, v);
8093     }
8094     basic_istream_char_sentry_destroy(this);
8095
8096     basic_ios_char_setstate(base, state);
8097     return this;
8098 }
8099
8100 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AA_N@Z */
8101 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEA_N@Z */
8102 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_bool, 8)
8103 basic_istream_char* __thiscall basic_istream_char_read_bool(basic_istream_char *this, MSVCP_bool *v)
8104 {
8105     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
8106     int state = IOSTATE_goodbit;
8107
8108     TRACE("(%p %p)\n", this, v);
8109
8110     if(basic_istream_char_sentry_create(this, FALSE)) {
8111         basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
8112         const num_get *numget = num_get_char_use_facet(strbuf->loc);
8113         istreambuf_iterator_char first={0}, last={0};
8114
8115         first.strbuf = strbuf;
8116         num_get_char_get_bool(numget, &last, first, last, &base->base, &state, v);
8117     }
8118     basic_istream_char_sentry_destroy(this);
8119
8120     basic_ios_char_setstate(base, state);
8121     return this;
8122 }
8123
8124 /* ??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@D@Z */
8125 /* ??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@D@Z */
8126 basic_istream_char* __cdecl basic_istream_char_getline_bstr_delim(
8127         basic_istream_char *istream, basic_string_char *str, char delim)
8128 {
8129     IOSB_iostate state = IOSTATE_failbit;
8130     int c = delim;
8131
8132     TRACE("(%p %p %c)\n", istream, str, delim);
8133
8134     if(basic_istream_char_sentry_create(istream, TRUE)) {
8135         MSVCP_basic_string_char_clear(str);
8136
8137         c = basic_istream_char_get(istream);
8138         if(c != EOF)
8139             state = IOSTATE_goodbit;
8140
8141         for(; c!=delim && c!=EOF; c = basic_istream_char_get(istream)) {
8142             state = IOSTATE_goodbit;
8143             MSVCP_basic_string_char_append_ch(str, c);
8144         }
8145     }
8146     basic_istream_char_sentry_destroy(istream);
8147
8148     basic_ios_char_setstate(basic_istream_char_get_basic_ios(istream),
8149         state | (c==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8150     return istream;
8151 }
8152
8153 /* ??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
8154 /* ??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
8155 basic_istream_char* __cdecl basic_istream_char_getline_bstr(
8156         basic_istream_char *istream, basic_string_char *str)
8157 {
8158     return basic_istream_char_getline_bstr_delim(istream, str, '\n');
8159 }
8160
8161 /* ??$?5DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
8162 /* ??$?5DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z */
8163 basic_istream_char* __cdecl basic_istream_char_read_bstr(
8164         basic_istream_char *istream, basic_string_char *str)
8165 {
8166     basic_ios_char *base = basic_istream_char_get_basic_ios(istream);
8167     IOSB_iostate state = IOSTATE_failbit;
8168     int c = '\n';
8169
8170     TRACE("(%p %p)\n", istream, str);
8171
8172     if(basic_istream_char_sentry_create(istream, FALSE)) {
8173         const ctype_char *ctype = ctype_char_use_facet(base->strbuf->loc);
8174         MSVCP_size_t count = ios_base_width_get(&base->base);
8175
8176         if(!count)
8177             count = -1;
8178
8179         MSVCP_basic_string_char_clear(str);
8180
8181         for(c = basic_streambuf_char_sgetc(basic_ios_char_rdbuf_get(base));
8182                 c!=EOF && !ctype_char_is_ch(ctype, _SPACE|_BLANK, c) && count>0;
8183                 c = basic_streambuf_char_snextc(basic_ios_char_rdbuf_get(base)), count--) {
8184             state = IOSTATE_goodbit;
8185             MSVCP_basic_string_char_append_ch(str, c);
8186         }
8187     }
8188     basic_istream_char_sentry_destroy(istream);
8189
8190     ios_base_width_set(&base->base, 0);
8191     basic_ios_char_setstate(base, state | (c==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8192     return istream;
8193 }
8194
8195 /* ??$?5DU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@PAD@Z */
8196 /* ??$?5DU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@PEAD@Z */
8197 /* ??$?5U?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@PAC@Z */
8198 /* ??$?5U?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@PEAC@Z */
8199 /* ??$?5U?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@PAE@Z */
8200 /* ??$?5U?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@PEAE@Z */
8201 basic_istream_char* __cdecl basic_istream_char_read_str(basic_istream_char *istream, char *str)
8202 {
8203     basic_ios_char *base = basic_istream_char_get_basic_ios(istream);
8204     IOSB_iostate state = IOSTATE_failbit;
8205     int c = '\n';
8206
8207     TRACE("(%p %p)\n", istream, str);
8208
8209     if(basic_istream_char_sentry_create(istream, FALSE)) {
8210         const ctype_char *ctype = ctype_char_use_facet(base->strbuf->loc);
8211         MSVCP_size_t count = ios_base_width_get(&base->base)-1;
8212
8213         for(c = basic_streambuf_char_sgetc(basic_ios_char_rdbuf_get(base));
8214                 c!=EOF && !ctype_char_is_ch(ctype, _SPACE|_BLANK, c) && count>0;
8215                 c = basic_streambuf_char_snextc(basic_ios_char_rdbuf_get(base)), count--) {
8216             state = IOSTATE_goodbit;
8217             *str++ = c;
8218         }
8219     }
8220     basic_istream_char_sentry_destroy(istream);
8221
8222     *str = 0;
8223     ios_base_width_set(&base->base, 0);
8224     basic_ios_char_setstate(base, state | (c==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8225     return istream;
8226 }
8227
8228 /* ??$?5DU?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAD@Z */
8229 /* ??$?5DU?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAD@Z */
8230 /* ??$?5U?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAC@Z */
8231 /* ??$?5U?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAC@Z */
8232 /* ??$?5U?$char_traits@D@std@@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAE@Z */
8233 /* ??$?5U?$char_traits@D@std@@@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@0@AEAV10@AEAE@Z */
8234 basic_istream_char* __cdecl basic_istream_char_read_ch(basic_istream_char *istream, char *ch)
8235 {
8236     IOSB_iostate state = IOSTATE_failbit;
8237     int c = 0;
8238
8239     TRACE("(%p %p)\n", istream, ch);
8240
8241     if(basic_istream_char_sentry_create(istream, FALSE)) {
8242         c = basic_streambuf_char_sbumpc(basic_ios_char_rdbuf_get(
8243                     basic_istream_char_get_basic_ios(istream)));
8244         if(c != EOF) {
8245             state = IOSTATE_goodbit;
8246             *ch = c;
8247         }
8248     }
8249     basic_istream_char_sentry_destroy(istream);
8250
8251     basic_ios_char_setstate(basic_istream_char_get_basic_ios(istream),
8252             state | (c==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8253     return istream;
8254 }
8255
8256 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
8257 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
8258 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_streambuf, 8)
8259 basic_istream_char* __thiscall basic_istream_char_read_streambuf(
8260         basic_istream_char *this, basic_streambuf_char *streambuf)
8261 {
8262     basic_ios_char *base = basic_istream_char_get_basic_ios(this);
8263     IOSB_iostate state = IOSTATE_failbit;
8264     int c = '\n';
8265
8266     TRACE("(%p %p)\n", this, streambuf);
8267
8268     if(basic_istream_char_sentry_create(this, FALSE)) {
8269         for(c = basic_streambuf_char_sgetc(basic_ios_char_rdbuf_get(base)); c!=EOF;
8270                 c = basic_streambuf_char_snextc(basic_ios_char_rdbuf_get(base))) {
8271             state = IOSTATE_goodbit;
8272             if(basic_streambuf_char_sputc(streambuf, c) == EOF)
8273                 break;
8274         }
8275     }
8276     basic_istream_char_sentry_destroy(this);
8277
8278     basic_ios_char_setstate(base, state | (c==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8279     return this;
8280 }
8281
8282 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
8283 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
8284 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_func, 8)
8285 basic_istream_char* __thiscall basic_istream_char_read_func(basic_istream_char *this,
8286         basic_istream_char* (__cdecl *pfunc)(basic_istream_char*))
8287 {
8288     TRACE("(%p %p)\n", this, pfunc);
8289     pfunc(this);
8290     return this;
8291 }
8292
8293 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@DU?$char_traits@D@std@@@1@AAV21@@Z@Z */
8294 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@DU?$char_traits@D@std@@@1@AEAV21@@Z@Z */
8295 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_func_basic_ios, 8)
8296 basic_istream_char* __thiscall basic_istream_char_read_func_basic_ios(basic_istream_char *this,
8297         basic_ios_char* (__cdecl *pfunc)(basic_ios_char*))
8298 {
8299     TRACE("(%p %p)\n", this, pfunc);
8300     pfunc(basic_istream_char_get_basic_ios(this));
8301     return this;
8302 }
8303
8304 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
8305 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
8306 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_func_ios_base, 8)
8307 basic_istream_char* __thiscall basic_istream_char_read_func_ios_base(basic_istream_char *this,
8308         ios_base* (__cdecl *pfunc)(ios_base*))
8309 {
8310     TRACE("(%p %p)\n", this, pfunc);
8311     pfunc(&basic_istream_char_get_basic_ios(this)->base);
8312     return this;
8313 }
8314
8315 /* Caution: basic_istream uses virtual inheritance. */
8316 static inline basic_ios_wchar* basic_istream_wchar_get_basic_ios(basic_istream_wchar *this)
8317 {
8318     return (basic_ios_wchar*)((char*)this+this->vbtable[1]);
8319 }
8320
8321 static inline basic_ios_wchar* basic_istream_wchar_to_basic_ios(basic_istream_wchar *ptr)
8322 {
8323     return (basic_ios_wchar*)((char*)ptr+basic_istream_wchar_vbtable[1]);
8324 }
8325
8326 static inline basic_istream_wchar* basic_istream_wchar_from_basic_ios(basic_ios_wchar *ptr)
8327 {
8328     return (basic_istream_wchar*)((char*)ptr-basic_istream_wchar_vbtable[1]);
8329 }
8330
8331 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N1@Z */
8332 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N1@Z */
8333 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_ctor_init, 20)
8334 basic_istream_wchar* __thiscall basic_istream_wchar_ctor_init(basic_istream_wchar *this,
8335         basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool noinit, MSVCP_bool virt_init)
8336 {
8337     basic_ios_wchar *base;
8338
8339     TRACE("(%p %p %d %d %d)\n", this, strbuf, isstd, noinit, virt_init);
8340
8341     if(virt_init) {
8342         this->vbtable = basic_istream_wchar_vbtable;
8343         base = basic_istream_wchar_get_basic_ios(this);
8344         basic_ios_wchar_ctor(base);
8345     }else {
8346         base = basic_istream_wchar_get_basic_ios(this);
8347     }
8348
8349     base->base.vtable = &MSVCP_basic_istream_wchar_vtable;
8350     this->count = 0;
8351     if(!noinit)
8352         basic_ios_wchar_init(base, strbuf, isstd);
8353     return this;
8354 }
8355
8356 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QAE@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N1@Z */
8357 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N1@Z */
8358 DEFINE_THISCALL_WRAPPER(basic_istream_short_ctor_init, 20)
8359 basic_istream_wchar* __thiscall basic_istream_short_ctor_init(basic_istream_wchar *this,
8360         basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool noinit, MSVCP_bool virt_init)
8361 {
8362     basic_istream_wchar_ctor_init(this, strbuf, isstd, noinit, virt_init);
8363     basic_istream_wchar_get_basic_ios(this)->base.vtable = &MSVCP_basic_istream_short_vtable;
8364     return this;
8365 }
8366
8367 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N@Z */
8368 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N@Z */
8369 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_ctor, 16)
8370 basic_istream_wchar* __thiscall basic_istream_wchar_ctor(basic_istream_wchar *this,
8371         basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
8372 {
8373     return basic_istream_wchar_ctor_init(this, strbuf, isstd, FALSE, virt_init);
8374 }
8375
8376 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QAE@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N@Z */
8377 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N@Z */
8378 DEFINE_THISCALL_WRAPPER(basic_istream_short_ctor, 16)
8379 basic_istream_wchar* __thiscall basic_istream_short_ctor(basic_istream_wchar *this,
8380         basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
8381 {
8382     return basic_istream_short_ctor_init(this, strbuf, isstd, FALSE, virt_init);
8383 }
8384
8385 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE@W4_Uninitialized@1@@Z */
8386 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
8387 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_ctor_uninitialized, 12)
8388 basic_istream_wchar* __thiscall basic_istream_wchar_ctor_uninitialized(
8389         basic_istream_wchar *this, int uninitialized, MSVCP_bool virt_init)
8390 {
8391     basic_ios_wchar *base;
8392
8393     TRACE("(%p %d %d)\n", this, uninitialized, virt_init);
8394
8395     if(virt_init) {
8396         this->vbtable = basic_istream_wchar_vbtable;
8397         base = basic_istream_wchar_get_basic_ios(this);
8398         basic_ios_wchar_ctor(base);
8399     }else {
8400         base = basic_istream_wchar_get_basic_ios(this);
8401     }
8402
8403     base->base.vtable = &MSVCP_basic_istream_wchar_vtable;
8404     ios_base_Addstd(&base->base);
8405     return this;
8406 }
8407
8408 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QAE@W4_Uninitialized@1@@Z */
8409 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
8410 DEFINE_THISCALL_WRAPPER(basic_istream_short_ctor_uninitialized, 12)
8411 basic_istream_wchar* __thiscall basic_istream_short_ctor_uninitialized(
8412         basic_istream_wchar *this, int uninitialized, MSVCP_bool virt_init)
8413 {
8414     basic_istream_wchar_ctor_uninitialized(this, uninitialized, virt_init);
8415     basic_istream_wchar_get_basic_ios(this)->base.vtable = &MSVCP_basic_istream_short_vtable;
8416     return this;
8417 }
8418
8419 /* ??1?$basic_istream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
8420 /* ??1?$basic_istream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
8421 /* ??1?$basic_istream@GU?$char_traits@G@std@@@std@@UAE@XZ */
8422 /* ??1?$basic_istream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
8423 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_dtor, 4)
8424 void __thiscall basic_istream_wchar_dtor(basic_ios_wchar *base)
8425 {
8426     basic_istream_wchar *this = basic_istream_wchar_from_basic_ios(base);
8427
8428     /* don't destroy virtual base here */
8429     TRACE("(%p)\n", this);
8430 }
8431
8432 /* ??_D?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
8433 /* ??_D?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
8434 /* ??_D?$basic_istream@GU?$char_traits@G@std@@@std@@QAEXXZ */
8435 /* ??_D?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
8436 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_vbase_dtor, 4)
8437 void __thiscall basic_istream_wchar_vbase_dtor(basic_istream_wchar *this)
8438 {
8439     TRACE("(%p)\n", this);
8440     basic_istream_wchar_dtor(basic_istream_wchar_to_basic_ios(this));
8441     basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(this));
8442 }
8443
8444 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_vector_dtor, 8)
8445 basic_istream_wchar* __thiscall basic_istream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
8446 {
8447     basic_istream_wchar *this = basic_istream_wchar_from_basic_ios(base);
8448
8449     TRACE("(%p %x)\n", this, flags);
8450
8451     if(flags & 2) {
8452         /* we have an array, with the number of elements stored before the first object */
8453         INT_PTR i, *ptr = (INT_PTR *)this-1;
8454
8455         for(i=*ptr-1; i>=0; i--)
8456             basic_istream_wchar_vbase_dtor(this+i);
8457         MSVCRT_operator_delete(ptr);
8458     } else {
8459         basic_istream_wchar_vbase_dtor(this);
8460         if(flags & 1)
8461             MSVCRT_operator_delete(this);
8462     }
8463
8464     return this;
8465 }
8466
8467 /* ?_Ipfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE_N_N@Z */
8468 /* ?_Ipfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA_N_N@Z */
8469 /* ?_Ipfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QAE_N_N@Z */
8470 /* ?_Ipfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA_N_N@Z */
8471 DEFINE_THISCALL_WRAPPER(basic_istream_wchar__Ipfx, 8)
8472 MSVCP_bool __thiscall basic_istream_wchar__Ipfx(basic_istream_wchar *this, MSVCP_bool noskip)
8473 {
8474     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8475
8476     TRACE("(%p %d)\n", this, noskip);
8477
8478     if(!ios_base_good(&base->base)) {
8479         basic_ios_wchar_setstate(base, IOSTATE_failbit);
8480         return FALSE;
8481     }
8482
8483     if(basic_ios_wchar_tie_get(base))
8484         basic_ostream_wchar_flush(basic_ios_wchar_tie_get(base));
8485
8486     if(!noskip && (ios_base_flags_get(&base->base) & FMTFLAG_skipws)) {
8487         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8488         const ctype_wchar *ctype = ctype_wchar_use_facet(base->strbuf->loc);
8489         int ch;
8490
8491         for(ch = basic_streambuf_wchar_sgetc(strbuf); ;
8492                 ch = basic_streambuf_wchar_snextc(strbuf)) {
8493             if(ch == WEOF) {
8494                 basic_ios_wchar_setstate(base, IOSTATE_eofbit);
8495                 return FALSE;
8496             }
8497
8498             if(!ctype_wchar_is_ch(ctype, _SPACE|_BLANK, ch))
8499                 break;
8500         }
8501     }
8502
8503     return TRUE;
8504 }
8505
8506 /* ?ipfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE_N_N@Z */
8507 /* ?ipfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA_N_N@Z */
8508 /* ?ipfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QAE_N_N@Z */
8509 /* ?ipfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA_N_N@Z */
8510 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_ipfx, 8)
8511 MSVCP_bool __thiscall basic_istream_wchar_ipfx(basic_istream_wchar *this, MSVCP_bool noskip)
8512 {
8513     return basic_istream_wchar__Ipfx(this, noskip);
8514 }
8515
8516 /* ?isfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
8517 /* ?isfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
8518 /* ?isfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEXXZ */
8519 /* ?isfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
8520 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_isfx, 4)
8521 void __thiscall basic_istream_wchar_isfx(basic_istream_wchar *this)
8522 {
8523     TRACE("(%p)\n", this);
8524 }
8525
8526 static BOOL basic_istream_wchar_sentry_create(basic_istream_wchar *istr, MSVCP_bool noskip)
8527 {
8528     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(istr);
8529
8530     if(basic_ios_wchar_rdbuf_get(base))
8531         basic_streambuf_wchar__Lock(base->strbuf);
8532
8533     return basic_istream_wchar_ipfx(istr, noskip);
8534 }
8535
8536 static void basic_istream_wchar_sentry_destroy(basic_istream_wchar *istr)
8537 {
8538     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(istr);
8539
8540     if(basic_ios_wchar_rdbuf_get(base))
8541         basic_streambuf_wchar__Unlock(base->strbuf);
8542 }
8543
8544 /* ?gcount@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QBEHXZ */
8545 /* ?gcount@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEBA_JXZ */
8546 /* ?gcount@?$basic_istream@GU?$char_traits@G@std@@@std@@QBEHXZ */
8547 /* ?gcount@?$basic_istream@GU?$char_traits@G@std@@@std@@QEBA_JXZ */
8548 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_gcount, 4)
8549 int __thiscall basic_istream_wchar_gcount(const basic_istream_wchar *this)
8550 {
8551     TRACE("(%p)\n", this);
8552     return this->count;
8553 }
8554
8555 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
8556 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
8557 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEGXZ */
8558 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAGXZ */
8559 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get, 4)
8560 unsigned short __thiscall basic_istream_wchar_get(basic_istream_wchar *this)
8561 {
8562     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8563     int ret;
8564
8565     TRACE("(%p)\n", this);
8566
8567     this->count = 0;
8568
8569     if(!basic_istream_wchar_sentry_create(this, TRUE)) {
8570         basic_istream_wchar_sentry_destroy(this);
8571         return WEOF;
8572     }
8573
8574     ret = basic_streambuf_wchar_sbumpc(basic_ios_wchar_rdbuf_get(base));
8575     basic_istream_wchar_sentry_destroy(this);
8576     if(ret == WEOF)
8577         basic_ios_wchar_setstate(base, IOSTATE_eofbit|IOSTATE_failbit);
8578     else
8579         this->count++;
8580
8581     return ret;
8582 }
8583
8584 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@AA_W@Z */
8585 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@AEA_W@Z */
8586 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@AAG@Z */
8587 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@AEAG@Z */
8588 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get_ch, 8)
8589 basic_istream_wchar* __thiscall basic_istream_wchar_get_ch(basic_istream_wchar *this, wchar_t *ch)
8590 {
8591     unsigned short ret;
8592
8593     TRACE("(%p %p)\n", this, ch);
8594
8595     ret = basic_istream_wchar_get(this);
8596     if(ret != WEOF)
8597         *ch = (wchar_t)ret;
8598     return this;
8599 }
8600
8601 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WH_W@Z */
8602 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_J_W@Z */
8603 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGHG@Z */
8604 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_JG@Z */
8605 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get_str_delim, 16)
8606 basic_istream_wchar* __thiscall basic_istream_wchar_get_str_delim(basic_istream_wchar *this, wchar_t *str, streamsize count, wchar_t delim)
8607 {
8608     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8609     unsigned short ch = delim;
8610
8611     TRACE("(%p %p %ld %c)\n", this, str, count, delim);
8612
8613     this->count = 0;
8614
8615     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8616         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8617
8618         for(ch = basic_streambuf_wchar_sgetc(strbuf); count>1;
8619                 ch = basic_streambuf_wchar_snextc(strbuf)) {
8620             if(ch==WEOF || ch==delim)
8621                 break;
8622
8623             *str++ = ch;
8624             this->count++;
8625             count--;
8626         }
8627     }
8628     basic_istream_wchar_sentry_destroy(this);
8629
8630     basic_ios_wchar_setstate(base, (!this->count ? IOSTATE_failbit : IOSTATE_goodbit) |
8631             (ch==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8632     if(count > 0)
8633         *str = 0;
8634     return this;
8635 }
8636
8637 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WH@Z */
8638 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_J@Z */
8639 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGH@Z */
8640 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_J@Z */
8641 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get_str, 12)
8642 basic_istream_wchar* __thiscall basic_istream_wchar_get_str(basic_istream_wchar *this, wchar_t *str, streamsize count)
8643 {
8644     return basic_istream_wchar_get_str_delim(this, str, count, '\n');
8645 }
8646
8647 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@AAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@_W@Z */
8648 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@_W@Z */
8649 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@AAV?$basic_streambuf@GU?$char_traits@G@std@@@2@G@Z */
8650 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@G@Z */
8651 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get_streambuf_delim, 12)
8652 basic_istream_wchar* __thiscall basic_istream_wchar_get_streambuf_delim(basic_istream_wchar *this, basic_streambuf_wchar *strbuf, wchar_t delim)
8653 {
8654     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8655     unsigned short ch = delim;
8656
8657     TRACE("(%p %p %c)\n", this, strbuf, delim);
8658
8659     this->count = 0;
8660
8661     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8662         basic_streambuf_wchar *strbuf_read = basic_ios_wchar_rdbuf_get(base);
8663
8664         for(ch = basic_streambuf_wchar_sgetc(strbuf_read); ;
8665                 ch = basic_streambuf_wchar_snextc(strbuf_read)) {
8666             if(ch==WEOF || ch==delim)
8667                 break;
8668
8669             if(basic_streambuf_wchar_sputc(strbuf, ch) == WEOF)
8670                 break;
8671             this->count++;
8672         }
8673     }
8674     basic_istream_wchar_sentry_destroy(this);
8675
8676     basic_ios_wchar_setstate(base, (!this->count ? IOSTATE_failbit : IOSTATE_goodbit) |
8677             (ch==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
8678     return this;
8679 }
8680
8681 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@AAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@@Z */
8682 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@@Z */
8683 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@AAV?$basic_streambuf@GU?$char_traits@G@std@@@2@@Z */
8684 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@@Z */
8685 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get_streambuf, 8)
8686 basic_istream_wchar* __thiscall basic_istream_wchar_get_streambuf(basic_istream_wchar *this, basic_streambuf_wchar *strbuf)
8687 {
8688     return basic_istream_wchar_get_streambuf_delim(this, strbuf, '\n');
8689 }
8690
8691 /* ?getline@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WH_W@Z */
8692 /* ?getline@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_J_W@Z */
8693 /* ?getline@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGHG@Z */
8694 /* ?getline@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_JG@Z */
8695 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_getline_delim, 16)
8696 basic_istream_wchar* __thiscall basic_istream_wchar_getline_delim(basic_istream_wchar *this, wchar_t *str, streamsize count, wchar_t delim)
8697 {
8698     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8699     unsigned short ch = delim;
8700
8701     TRACE("(%p %p %ld %c)\n", this, str, count, delim);
8702
8703     this->count = 0;
8704
8705     if(basic_istream_wchar_sentry_create(this, TRUE) && count>0) {
8706         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8707
8708         while(count > 1) {
8709             ch = basic_streambuf_wchar_sbumpc(strbuf);
8710
8711             if(ch==WEOF || ch==delim)
8712                 break;
8713
8714             *str++ = ch;
8715             this->count++;
8716             count--;
8717         }
8718
8719         if(ch == delim)
8720             this->count++;
8721         else if(ch != WEOF) {
8722             ch = basic_streambuf_wchar_sgetc(strbuf);
8723
8724             if(ch == delim) {
8725                 basic_streambuf_wchar__Gninc(strbuf);
8726                 this->count++;
8727             }
8728         }
8729     }
8730     basic_istream_wchar_sentry_destroy(this);
8731
8732     basic_ios_wchar_setstate(base, (ch==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit) |
8733             (!this->count || (ch!=delim && ch!=WEOF) ? IOSTATE_failbit : IOSTATE_goodbit));
8734     if(count > 0)
8735         *str = 0;
8736     return this;
8737 }
8738
8739 /* ?getline@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WH@Z */
8740 /* ?getline@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_J@Z */
8741 /* ?getline@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGH@Z */
8742 /* ?getline@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_J@Z */
8743 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_getline, 12)
8744 basic_istream_wchar* __thiscall basic_istream_wchar_getline(basic_istream_wchar *this, wchar_t *str, streamsize count)
8745 {
8746     return basic_istream_wchar_getline_delim(this, str, count, '\n');
8747 }
8748
8749 /* ?ignore@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@HG@Z */
8750 /* ?ignore@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@_JG@Z */
8751 /* ?ignore@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@HG@Z */
8752 /* ?ignore@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@_JG@Z */
8753 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_ignore, 12)
8754 basic_istream_wchar* __thiscall basic_istream_wchar_ignore(basic_istream_wchar *this, streamsize count, unsigned short delim)
8755 {
8756     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8757     unsigned short ch = delim;
8758
8759     TRACE("(%p %ld %d)\n", this, count, delim);
8760
8761     this->count = 0;
8762
8763     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8764         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8765
8766         while(count > 0) {
8767             ch = basic_streambuf_wchar_sbumpc(strbuf);
8768
8769             if(ch==WEOF || ch==delim)
8770                 break;
8771
8772             this->count++;
8773             if(count != INT_MAX)
8774                 count--;
8775         }
8776     }
8777     basic_istream_wchar_sentry_destroy(this);
8778
8779     if(ch == WEOF)
8780         basic_ios_wchar_setstate(base, IOSTATE_eofbit);
8781     return this;
8782 }
8783
8784 /* ?ws@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@1@AAV21@@Z */
8785 /* ?ws@std@@YAAEAV?$basic_istream@_WU?$char_traits@_W@std@@@1@AEAV21@@Z */
8786 /* ?ws@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@1@AAV21@@Z */
8787 /* ?ws@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@1@AEAV21@@Z */
8788 basic_istream_wchar* __cdecl ws_basic_istream_wchar(basic_istream_wchar *istream)
8789 {
8790     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(istream);
8791     unsigned short ch = '\n';
8792
8793     TRACE("(%p)\n", istream);
8794
8795     if(basic_istream_wchar_sentry_create(istream, TRUE)) {
8796         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8797         const ctype_wchar *ctype = ctype_wchar_use_facet(strbuf->loc);
8798
8799         for(ch = basic_streambuf_wchar_sgetc(strbuf); ctype_wchar_is_ch(ctype, _SPACE, ch);
8800                 ch = basic_streambuf_wchar_snextc(strbuf)) {
8801             if(ch == WEOF)
8802                 break;
8803         }
8804     }
8805     basic_istream_wchar_sentry_destroy(istream);
8806
8807     if(ch == WEOF)
8808         basic_ios_wchar_setstate(base, IOSTATE_eofbit);
8809     return istream;
8810 }
8811
8812 /* ?peek@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
8813 /* ?peek@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
8814 /* ?peek@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEGXZ */
8815 /* ?peek@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAGXZ */
8816 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_peek, 4)
8817 unsigned short __thiscall basic_istream_wchar_peek(basic_istream_wchar *this)
8818 {
8819     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8820     unsigned short ret = WEOF;
8821
8822     TRACE("(%p)\n", this);
8823
8824     this->count = 0;
8825
8826     if(basic_istream_wchar_sentry_create(this, TRUE))
8827         ret = basic_streambuf_wchar_sgetc(basic_ios_wchar_rdbuf_get(base));
8828     basic_istream_wchar_sentry_destroy(this);
8829     return ret;
8830 }
8831
8832 /* ?_Read_s@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WIH@Z */
8833 /* ?_Read_s@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_K_J@Z */
8834 /* ?_Read_s@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGIH@Z */
8835 /* ?_Read_s@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_K_J@Z */
8836 DEFINE_THISCALL_WRAPPER(basic_istream_wchar__Read_s, 16)
8837 basic_istream_wchar* __thiscall basic_istream_wchar__Read_s(basic_istream_wchar *this, wchar_t *str, MSVCP_size_t size, streamsize count)
8838 {
8839     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8840     IOSB_iostate state = IOSTATE_goodbit;
8841
8842     TRACE("(%p %p %lu %ld)\n", this, str, size, count);
8843
8844     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8845         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8846
8847         this->count = basic_streambuf_wchar__Sgetn_s(strbuf, str, size, count);
8848         if(this->count != count)
8849             state |= IOSTATE_failbit | IOSTATE_eofbit;
8850     }else {
8851         this->count = 0;
8852     }
8853     basic_istream_wchar_sentry_destroy(this);
8854
8855     basic_ios_wchar_setstate(base, state);
8856     return this;
8857 }
8858
8859 /* ?read@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WH@Z */
8860 /* ?read@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_J@Z */
8861 /* ?read@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGH@Z */
8862 /* ?read@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_J@Z */
8863 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read, 12)
8864 basic_istream_wchar* __thiscall basic_istream_wchar_read(basic_istream_wchar *this, wchar_t *str, streamsize count)
8865 {
8866     return basic_istream_wchar__Read_s(this, str, count, count);
8867 }
8868
8869 /* ?_Readsome_s@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEHPA_WIH@Z */
8870 /* ?_Readsome_s@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA_JPEA_W_K_J@Z */
8871 /* ?_Readsome_s@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEHPAGIH@Z */
8872 /* ?_Readsome_s@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA_JPEAG_K_J@Z */
8873 DEFINE_THISCALL_WRAPPER(basic_istream_wchar__Readsome_s, 16)
8874 streamsize __thiscall basic_istream_wchar__Readsome_s(basic_istream_wchar *this, wchar_t *str, MSVCP_size_t size, streamsize count)
8875 {
8876     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8877     IOSB_iostate state = IOSTATE_goodbit;
8878
8879     TRACE("(%p %p %lu %ld)\n", this, str, size, count);
8880
8881     this->count = 0;
8882
8883     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8884         streamsize avail = basic_streambuf_wchar_in_avail(basic_ios_wchar_rdbuf_get(base));
8885         if(avail > count)
8886             avail = count;
8887
8888         if(avail == -1)
8889             state |= IOSTATE_eofbit;
8890         else if(avail > 0)
8891             basic_istream_wchar__Read_s(this, str, size, avail);
8892     }else {
8893         state |= IOSTATE_failbit;
8894     }
8895     basic_istream_wchar_sentry_destroy(this);
8896
8897     basic_ios_wchar_setstate(base, state);
8898     return this->count;
8899 }
8900
8901 /* ?readsome@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEHPA_WH@Z */
8902 /* ?readsome@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA_JPEA_W_J@Z */
8903 /* ?readsome@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEHPAGH@Z */
8904 /* ?readsome@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA_JPEAG_J@Z */
8905 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_readsome, 12)
8906 streamsize __thiscall basic_istream_wchar_readsome(basic_istream_wchar *this, wchar_t *str, streamsize count)
8907 {
8908     return basic_istream_wchar__Readsome_s(this, str, count, count);
8909 }
8910
8911 /* ?putback@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@_W@Z */
8912 /* ?putback@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@_W@Z */
8913 /* ?putback@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@G@Z */
8914 /* ?putback@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@G@Z */
8915 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_putback, 8)
8916 basic_istream_wchar* __thiscall basic_istream_wchar_putback(basic_istream_wchar *this, wchar_t ch)
8917 {
8918     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8919     IOSB_iostate state = IOSTATE_goodbit;
8920
8921     TRACE("(%p %c)\n", this, ch);
8922
8923     this->count = 0;
8924
8925     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8926         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8927
8928         if(!ios_base_good(&base->base))
8929             state |= IOSTATE_failbit;
8930         else if(!strbuf || basic_streambuf_wchar_sputbackc(strbuf, ch)==WEOF)
8931             state |= IOSTATE_badbit;
8932     }
8933     basic_istream_wchar_sentry_destroy(this);
8934
8935     basic_ios_wchar_setstate(base, state);
8936     return this;
8937 }
8938
8939 /* ?unget@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@XZ */
8940 /* ?unget@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@XZ */
8941 /* ?unget@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@XZ */
8942 /* ?unget@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@XZ */
8943 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_unget, 4)
8944 basic_istream_wchar* __thiscall basic_istream_wchar_unget(basic_istream_wchar *this)
8945 {
8946     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8947     IOSB_iostate state = IOSTATE_goodbit;
8948
8949     TRACE("(%p)\n", this);
8950
8951     this->count = 0;
8952
8953     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8954         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8955
8956         if(!ios_base_good(&base->base))
8957             state |= IOSTATE_failbit;
8958         else if(!strbuf || basic_streambuf_wchar_sungetc(strbuf)==WEOF)
8959             state |= IOSTATE_badbit;
8960     }
8961     basic_istream_wchar_sentry_destroy(this);
8962
8963     basic_ios_wchar_setstate(base, state);
8964     return this;
8965 }
8966
8967 /* ?sync@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEHXZ */
8968 /* ?sync@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAHXZ */
8969 /* ?sync@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEHXZ */
8970 /* ?sync@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAHXZ */
8971 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_sync, 4)
8972 int __thiscall basic_istream_wchar_sync(basic_istream_wchar *this)
8973 {
8974     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
8975     basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
8976
8977     TRACE("(%p)\n", this);
8978
8979     if(!strbuf)
8980         return -1;
8981
8982     if(basic_istream_wchar_sentry_create(this, TRUE)) {
8983         if(basic_streambuf_wchar_pubsync(strbuf) != -1) {
8984             basic_istream_wchar_sentry_destroy(this);
8985             return 0;
8986         }
8987     }
8988     basic_istream_wchar_sentry_destroy(this);
8989
8990     basic_ios_wchar_setstate(base, IOSTATE_badbit);
8991     return -1;
8992 }
8993
8994 /* ?tellg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@XZ */
8995 /* ?tellg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
8996 /* ?tellg@?$basic_istream@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@XZ */
8997 /* ?tellg@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
8998 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_tellg, 8)
8999 fpos_int* __thiscall basic_istream_wchar_tellg(basic_istream_wchar *this, fpos_int *ret)
9000 {
9001     TRACE("(%p %p)\n", this, ret);
9002
9003     if(basic_istream_wchar_sentry_create(this, TRUE)) {
9004         basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9005         if(!ios_base_fail(&base->base)) {
9006             basic_streambuf_wchar_pubseekoff(basic_ios_wchar_rdbuf_get(base),
9007                     ret, 0, SEEKDIR_cur, OPENMODE_in);
9008             basic_istream_wchar_sentry_destroy(this);
9009
9010             if(ret->off==0 && ret->pos==-1 && ret->state==0)
9011                 basic_ios_wchar_setstate(base, IOSTATE_failbit);
9012             return ret;
9013         }
9014     }
9015     basic_istream_wchar_sentry_destroy(this);
9016
9017     ret->off = 0;
9018     ret->pos = -1;
9019     ret->state = 0;
9020     return ret;
9021 }
9022
9023 /* ?seekg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@JH@Z */
9024 /* ?seekg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@_JH@Z */
9025 /* ?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@JH@Z */
9026 /* ?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@_JH@Z */
9027 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_seekg, 12)
9028 basic_istream_wchar* __thiscall basic_istream_wchar_seekg(basic_istream_wchar *this, streamoff off, int dir)
9029 {
9030     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9031
9032     TRACE("(%p %ld %d)\n", this, off, dir);
9033
9034     if(basic_istream_wchar_sentry_create(this, TRUE)) {
9035         if(!ios_base_fail(&base->base)) {
9036             basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9037             fpos_int ret;
9038
9039             basic_streambuf_wchar_pubseekoff(strbuf, &ret, off, dir, OPENMODE_in);
9040             basic_istream_wchar_sentry_destroy(this);
9041
9042             if(ret.off==0 && ret.pos==-1 && ret.state==0)
9043                 basic_ios_wchar_setstate(base, IOSTATE_failbit);
9044             else
9045                 basic_ios_wchar_clear(base, IOSTATE_goodbit);
9046             return this;
9047         }
9048     }
9049     basic_istream_wchar_sentry_destroy(this);
9050
9051     basic_ios_wchar_setstate(base, IOSTATE_failbit);
9052     return this;
9053 }
9054
9055 /* ?seekg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
9056 /* ?seekg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
9057 /* ?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
9058 /* ?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
9059 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_seekg_fpos, 28)
9060 basic_istream_wchar* __thiscall basic_istream_wchar_seekg_fpos(basic_istream_wchar *this, fpos_int pos)
9061 {
9062     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9063
9064     TRACE("(%p %s)\n", this, debugstr_fpos_int(&pos));
9065
9066     if(basic_istream_wchar_sentry_create(this, TRUE)) {
9067         if(!ios_base_fail(&base->base)) {
9068             basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9069             fpos_int ret;
9070
9071             basic_streambuf_wchar_pubseekpos(strbuf, &ret, pos, OPENMODE_in);
9072             basic_istream_wchar_sentry_destroy(this);
9073
9074             if(ret.off==0 && ret.pos==-1 && ret.state==0)
9075                 basic_ios_wchar_setstate(base, IOSTATE_failbit);
9076             else
9077                 basic_ios_wchar_clear(base, IOSTATE_goodbit);
9078             return this;
9079         }
9080     }
9081     basic_istream_wchar_sentry_destroy(this);
9082
9083     basic_ios_wchar_setstate(base, IOSTATE_failbit);
9084     return this;
9085 }
9086
9087 static basic_istream_wchar* basic_istream_read_short(basic_istream_wchar *this, short *v, const num_get *numget)
9088 {
9089     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9090     int state = IOSTATE_goodbit;
9091
9092     TRACE("(%p %p)\n", this, v);
9093
9094     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9095         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9096         istreambuf_iterator_wchar first={0}, last={0};
9097         LONG tmp;
9098
9099         first.strbuf = strbuf;
9100         num_get_wchar_get_long(numget, &last, first, last, &base->base, &state, &tmp);
9101
9102         if(!(state&IOSTATE_failbit) && tmp==(LONG)((short)tmp))
9103             *v = tmp;
9104         else
9105             state |= IOSTATE_failbit;
9106     }
9107     basic_istream_wchar_sentry_destroy(this);
9108
9109     basic_ios_wchar_setstate(base, state);
9110     return this;
9111 }
9112
9113 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAF@Z */
9114 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAF@Z */
9115 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_short, 8)
9116 basic_istream_wchar* __thiscall basic_istream_wchar_read_short(basic_istream_wchar *this, short *v)
9117 {
9118     return basic_istream_read_short(this, v, num_get_wchar_use_facet(
9119                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9120 }
9121
9122 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAF@Z */
9123 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAF@Z */
9124 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_short, 8)
9125 basic_istream_wchar* __thiscall basic_istream_short_read_short(basic_istream_wchar *this, short *v)
9126 {
9127     return basic_istream_read_short(this, v, num_get_short_use_facet(
9128                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9129 }
9130
9131 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAG@Z */
9132 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAG@Z */
9133 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_ushort, 8)
9134 basic_istream_wchar* __thiscall basic_istream_wchar_read_ushort(basic_istream_wchar *this, unsigned short *v)
9135 {
9136     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9137     int state = IOSTATE_goodbit;
9138
9139     TRACE("(%p %p)\n", this, v);
9140
9141     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9142         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9143         const num_get *numget = num_get_wchar_use_facet(strbuf->loc);
9144         istreambuf_iterator_wchar first={0}, last={0};
9145
9146         first.strbuf = strbuf;
9147         num_get_wchar_get_ushort(numget, &last, first, last, &base->base, &state, v);
9148     }
9149     basic_istream_wchar_sentry_destroy(this);
9150
9151     basic_ios_wchar_setstate(base, state);
9152     return this;
9153 }
9154
9155 static basic_istream_wchar* basic_istream_read_int(basic_istream_wchar *this, int *v, const num_get *numget)
9156 {
9157     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9158     int state = IOSTATE_goodbit;
9159
9160     TRACE("(%p %p)\n", this, v);
9161
9162     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9163         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9164         istreambuf_iterator_wchar first={0}, last={0};
9165
9166         first.strbuf = strbuf;
9167         num_get_wchar_get_long(numget, &last, first, last, &base->base, &state, v);
9168     }
9169     basic_istream_wchar_sentry_destroy(this);
9170
9171     basic_ios_wchar_setstate(base, state);
9172     return this;
9173 }
9174
9175 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAH@Z */
9176 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAH@Z */
9177 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_int, 8)
9178 basic_istream_wchar* __thiscall basic_istream_wchar_read_int(basic_istream_wchar *this, int *v)
9179 {
9180     return basic_istream_read_int(this, v, num_get_wchar_use_facet(
9181                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9182 }
9183
9184 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAH@Z */
9185 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAH@Z */
9186 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_int, 8)
9187 basic_istream_wchar* __thiscall basic_istream_short_read_int(basic_istream_wchar *this, int *v)
9188 {
9189     return basic_istream_read_int(this, v, num_get_short_use_facet(
9190                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9191 }
9192
9193 static basic_istream_wchar* basic_istream_read_uint(basic_istream_wchar *this, unsigned int *v, const num_get *numget)
9194 {
9195     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9196     int state = IOSTATE_goodbit;
9197
9198     TRACE("(%p %p)\n", this, v);
9199
9200     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9201         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9202         istreambuf_iterator_wchar first={0}, last={0};
9203
9204         first.strbuf = strbuf;
9205         num_get_wchar_get_uint(numget, &last, first, last, &base->base, &state, v);
9206     }
9207     basic_istream_wchar_sentry_destroy(this);
9208
9209     basic_ios_wchar_setstate(base, state);
9210     return this;
9211 }
9212
9213 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAI@Z */
9214 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAI@Z */
9215 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_uint, 8)
9216 basic_istream_wchar* __thiscall basic_istream_wchar_read_uint(basic_istream_wchar *this, unsigned int *v)
9217 {
9218     return basic_istream_read_uint(this, v, num_get_wchar_use_facet(
9219                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9220 }
9221
9222 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAI@Z */
9223 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAI@Z */
9224 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_uint, 8)
9225 basic_istream_wchar* __thiscall basic_istream_short_read_uint(basic_istream_wchar *this, unsigned int *v)
9226 {
9227     return basic_istream_read_uint(this, v, num_get_short_use_facet(
9228                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9229 }
9230
9231 static basic_istream_wchar* basic_istream_read_long(basic_istream_wchar *this, LONG *v, const num_get *numget)
9232 {
9233     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9234     int state = IOSTATE_goodbit;
9235
9236     TRACE("(%p %p)\n", this, v);
9237
9238     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9239         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9240         istreambuf_iterator_wchar first={0}, last={0};
9241
9242         first.strbuf = strbuf;
9243         num_get_wchar_get_long(numget, &last, first, last, &base->base, &state, v);
9244     }
9245     basic_istream_wchar_sentry_destroy(this);
9246
9247     basic_ios_wchar_setstate(base, state);
9248     return this;
9249 }
9250
9251 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAJ@Z */
9252 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAJ@Z */
9253 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_long, 8)
9254 basic_istream_wchar* __thiscall basic_istream_wchar_read_long(basic_istream_wchar *this, LONG *v)
9255 {
9256     return basic_istream_read_long(this, v, num_get_wchar_use_facet(
9257                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9258 }
9259
9260 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAJ@Z */
9261 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAJ@Z */
9262 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_long, 8)
9263 basic_istream_wchar* __thiscall basic_istream_short_read_long(basic_istream_wchar *this, LONG *v)
9264 {
9265     return basic_istream_read_long(this, v, num_get_short_use_facet(
9266                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9267 }
9268
9269 static basic_istream_wchar* basic_istream_read_ulong(basic_istream_wchar *this, ULONG *v, const num_get *numget)
9270 {
9271     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9272     int state = IOSTATE_goodbit;
9273
9274     TRACE("(%p %p)\n", this, v);
9275
9276     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9277         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9278         istreambuf_iterator_wchar first={0}, last={0};
9279
9280         first.strbuf = strbuf;
9281         num_get_wchar_get_ulong(numget, &last, first, last, &base->base, &state, v);
9282     }
9283     basic_istream_wchar_sentry_destroy(this);
9284
9285     basic_ios_wchar_setstate(base, state);
9286     return this;
9287 }
9288
9289 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAK@Z */
9290 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAK@Z */
9291 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_ulong, 8)
9292 basic_istream_wchar* __thiscall basic_istream_wchar_read_ulong(basic_istream_wchar *this, ULONG *v)
9293 {
9294     return basic_istream_read_ulong(this, v, num_get_wchar_use_facet(
9295                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9296 }
9297
9298 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAK@Z */
9299 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAK@Z */
9300 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_ulong, 8)
9301 basic_istream_wchar* __thiscall basic_istream_short_read_ulong(basic_istream_wchar *this, ULONG *v)
9302 {
9303     return basic_istream_read_ulong(this, v, num_get_short_use_facet(
9304                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9305 }
9306
9307 static basic_istream_wchar* basic_istream_read_float(basic_istream_wchar *this, float *v, const num_get *numget)
9308 {
9309     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9310     int state = IOSTATE_goodbit;
9311
9312     TRACE("(%p %p)\n", this, v);
9313
9314     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9315         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9316         istreambuf_iterator_wchar first={0}, last={0};
9317
9318         first.strbuf = strbuf;
9319         num_get_wchar_get_float(numget, &last, first, last, &base->base, &state, v);
9320     }
9321     basic_istream_wchar_sentry_destroy(this);
9322
9323     basic_ios_wchar_setstate(base, state);
9324     return this;
9325 }
9326
9327 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAM@Z */
9328 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAM@Z */
9329 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_float, 8)
9330 basic_istream_wchar* __thiscall basic_istream_wchar_read_float(basic_istream_wchar *this, float *v)
9331 {
9332     return basic_istream_read_float(this, v, num_get_wchar_use_facet(
9333                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9334 }
9335
9336 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAM@Z */
9337 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAM@Z */
9338 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_float, 8)
9339 basic_istream_wchar* __thiscall basic_istream_short_read_float(basic_istream_wchar *this, float *v)
9340 {
9341     return basic_istream_read_float(this, v, num_get_short_use_facet(
9342                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9343 }
9344
9345 static basic_istream_wchar* basic_istream_read_double(basic_istream_wchar *this, double *v, const num_get *numget)
9346 {
9347     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9348     int state = IOSTATE_goodbit;
9349
9350     TRACE("(%p %p)\n", this, v);
9351
9352     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9353         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9354         istreambuf_iterator_wchar first={0}, last={0};
9355
9356         first.strbuf = strbuf;
9357         num_get_wchar_get_double(numget, &last, first, last, &base->base, &state, v);
9358     }
9359     basic_istream_wchar_sentry_destroy(this);
9360
9361     basic_ios_wchar_setstate(base, state);
9362     return this;
9363 }
9364
9365 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAN@Z */
9366 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAN@Z */
9367 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_double, 8)
9368 basic_istream_wchar* __thiscall basic_istream_wchar_read_double(basic_istream_wchar *this, double *v)
9369 {
9370     return basic_istream_read_double(this, v, num_get_wchar_use_facet(
9371                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9372 }
9373
9374 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAN@Z */
9375 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAN@Z */
9376 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_double, 8)
9377 basic_istream_wchar* __thiscall basic_istream_short_read_double(basic_istream_wchar *this, double *v)
9378 {
9379     return basic_istream_read_double(this, v, num_get_short_use_facet(
9380                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9381 }
9382
9383 static basic_istream_wchar* basic_istream_read_ldouble(basic_istream_wchar *this, double *v, const num_get *numget)
9384 {
9385     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9386     int state = IOSTATE_goodbit;
9387
9388     TRACE("(%p %p)\n", this, v);
9389
9390     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9391         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9392         istreambuf_iterator_wchar first={0}, last={0};
9393
9394         first.strbuf = strbuf;
9395         num_get_wchar_get_ldouble(numget, &last, first, last, &base->base, &state, v);
9396     }
9397     basic_istream_wchar_sentry_destroy(this);
9398
9399     basic_ios_wchar_setstate(base, state);
9400     return this;
9401 }
9402
9403 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAO@Z */
9404 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAO@Z */
9405 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_ldouble, 8)
9406 basic_istream_wchar* __thiscall basic_istream_wchar_read_ldouble(basic_istream_wchar *this, double *v)
9407 {
9408     return basic_istream_read_ldouble(this, v, num_get_wchar_use_facet(
9409                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9410 }
9411
9412 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAO@Z */
9413 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAO@Z */
9414 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_ldouble, 8)
9415 basic_istream_wchar* __thiscall basic_istream_short_read_ldouble(basic_istream_wchar *this, double *v)
9416 {
9417     return basic_istream_read_ldouble(this, v, num_get_short_use_facet(
9418                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9419 }
9420
9421 static basic_istream_wchar* basic_istream_read_ptr(basic_istream_wchar *this, void **v, const num_get *numget)
9422 {
9423     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9424     int state = IOSTATE_goodbit;
9425
9426     TRACE("(%p %p)\n", this, v);
9427
9428     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9429         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9430         istreambuf_iterator_wchar first={0}, last={0};
9431
9432         first.strbuf = strbuf;
9433         num_get_wchar_get_void(numget, &last, first, last, &base->base, &state, v);
9434     }
9435     basic_istream_wchar_sentry_destroy(this);
9436
9437     basic_ios_wchar_setstate(base, state);
9438     return this;
9439 }
9440
9441 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAPAX@Z */
9442 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAPEAX@Z */
9443 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_ptr, 8)
9444 basic_istream_wchar* __thiscall basic_istream_wchar_read_ptr(basic_istream_wchar *this, void **v)
9445 {
9446     return basic_istream_read_ptr(this, v, num_get_wchar_use_facet(
9447                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9448 }
9449
9450 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAPAX@Z */
9451 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAPEAX@Z */
9452 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_ptr, 8)
9453 basic_istream_wchar* __thiscall basic_istream_short_read_ptr(basic_istream_wchar *this, void **v)
9454 {
9455     return basic_istream_read_ptr(this, v, num_get_short_use_facet(
9456                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9457 }
9458
9459 static basic_istream_wchar* basic_istream_read_int64(basic_istream_wchar *this, __int64 *v, const num_get *numget)
9460 {
9461     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9462     int state = IOSTATE_goodbit;
9463
9464     TRACE("(%p %p)\n", this, v);
9465
9466     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9467         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9468         istreambuf_iterator_wchar first={0}, last={0};
9469
9470         first.strbuf = strbuf;
9471         num_get_wchar_get_int64(numget, &last, first, last, &base->base, &state, v);
9472     }
9473     basic_istream_wchar_sentry_destroy(this);
9474
9475     basic_ios_wchar_setstate(base, state);
9476     return this;
9477 }
9478
9479 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AA_J@Z */
9480 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEA_J@Z */
9481 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_int64, 8)
9482 basic_istream_wchar* __thiscall basic_istream_wchar_read_int64(basic_istream_wchar *this, __int64 *v)
9483 {
9484     return basic_istream_read_int64(this, v, num_get_wchar_use_facet(
9485                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9486 }
9487
9488 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AA_J@Z */
9489 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEA_J@Z */
9490 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_int64, 8)
9491 basic_istream_wchar* __thiscall basic_istream_short_read_int64(basic_istream_wchar *this, __int64 *v)
9492 {
9493     return basic_istream_read_int64(this, v, num_get_short_use_facet(
9494                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9495 }
9496
9497 static basic_istream_wchar* basic_istream_read_uint64(basic_istream_wchar *this, unsigned __int64 *v, const num_get *numget)
9498 {
9499     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9500     int state = IOSTATE_goodbit;
9501
9502     TRACE("(%p %p)\n", this, v);
9503
9504     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9505         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9506         istreambuf_iterator_wchar first={0}, last={0};
9507
9508         first.strbuf = strbuf;
9509         num_get_wchar_get_uint64(numget, &last, first, last, &base->base, &state, v);
9510     }
9511     basic_istream_wchar_sentry_destroy(this);
9512
9513     basic_ios_wchar_setstate(base, state);
9514     return this;
9515 }
9516
9517 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AA_K@Z */
9518 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEA_K@Z */
9519 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_uint64, 8)
9520 basic_istream_wchar* __thiscall basic_istream_wchar_read_uint64(basic_istream_wchar *this, unsigned __int64 *v)
9521 {
9522     return basic_istream_read_uint64(this, v, num_get_wchar_use_facet(
9523                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9524 }
9525
9526 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AA_K@Z */
9527 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEA_K@Z */
9528 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_uint64, 8)
9529 basic_istream_wchar* __thiscall basic_istream_short_read_uint64(basic_istream_wchar *this, unsigned __int64 *v)
9530 {
9531     return basic_istream_read_uint64(this, v, num_get_short_use_facet(
9532                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9533 }
9534
9535 static basic_istream_wchar* basic_istream_read_bool(basic_istream_wchar *this, MSVCP_bool *v, const num_get *numget)
9536 {
9537     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9538     int state = IOSTATE_goodbit;
9539
9540     TRACE("(%p %p)\n", this, v);
9541
9542     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9543         basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
9544         istreambuf_iterator_wchar first={0}, last={0};
9545
9546         first.strbuf = strbuf;
9547         num_get_wchar_get_bool(numget, &last, first, last, &base->base, &state, v);
9548     }
9549     basic_istream_wchar_sentry_destroy(this);
9550
9551     basic_ios_wchar_setstate(base, state);
9552     return this;
9553 }
9554
9555 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AA_N@Z */
9556 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEA_N@Z */
9557 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_bool, 8)
9558 basic_istream_wchar* __thiscall basic_istream_wchar_read_bool(basic_istream_wchar *this, MSVCP_bool *v)
9559 {
9560     return basic_istream_read_bool(this, v, num_get_wchar_use_facet(
9561                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9562 }
9563
9564 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AA_N@Z */
9565 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEA_N@Z */
9566 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_bool, 8)
9567 basic_istream_wchar* __thiscall basic_istream_short_read_bool(basic_istream_wchar *this, MSVCP_bool *v)
9568 {
9569     return basic_istream_read_bool(this, v, num_get_short_use_facet(
9570                 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
9571 }
9572
9573 /* ??$getline@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AAV10@AAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@0@_W@Z */
9574 /* ??$getline@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@YAAEAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AEAV10@AEAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@0@_W@Z */
9575 /* ??$getline@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@AAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@G@Z */
9576 /* ??$getline@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@AEAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@G@Z */
9577 basic_istream_wchar* __cdecl basic_istream_wchar_getline_bstr_delim(
9578         basic_istream_wchar *istream, basic_string_wchar *str, wchar_t delim)
9579 {
9580     IOSB_iostate state = IOSTATE_failbit;
9581     int c = delim;
9582
9583     TRACE("(%p %p %c)\n", istream, str, delim);
9584
9585     if(basic_istream_wchar_sentry_create(istream, TRUE)) {
9586         MSVCP_basic_string_wchar_clear(str);
9587
9588         c = basic_istream_wchar_get(istream);
9589         if(c != WEOF)
9590             state = IOSTATE_goodbit;
9591
9592         for(; c!=delim && c!=WEOF; c = basic_istream_wchar_get(istream)) {
9593             state = IOSTATE_goodbit;
9594             MSVCP_basic_string_wchar_append_ch(str, c);
9595         }
9596     }
9597     basic_istream_wchar_sentry_destroy(istream);
9598
9599     basic_ios_wchar_setstate(basic_istream_wchar_get_basic_ios(istream),
9600             state | (c==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
9601     return istream;
9602 }
9603
9604 /* ??$getline@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AAV10@AAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@0@@Z */
9605 /* ??$getline@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@YAAEAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AEAV10@AEAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@0@@Z */
9606 /* ??$getline@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@AAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
9607 /* ??$getline@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@AEAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
9608 basic_istream_wchar* __cdecl basic_istream_wchar_getline_bstr(
9609         basic_istream_wchar *istream, basic_string_wchar *str)
9610 {
9611     return basic_istream_wchar_getline_bstr_delim(istream, str, '\n');
9612 }
9613
9614 static basic_istream_wchar* basic_istream_read_bstr(basic_istream_wchar *istream,
9615         basic_string_wchar *str, const ctype_wchar *ctype)
9616 {
9617     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(istream);
9618     IOSB_iostate state = IOSTATE_failbit;
9619     int c = '\n';
9620
9621     TRACE("(%p %p)\n", istream, str);
9622
9623     if(basic_istream_wchar_sentry_create(istream, FALSE)) {
9624         MSVCP_size_t count = ios_base_width_get(&base->base);
9625
9626         if(!count)
9627             count = -1;
9628
9629         MSVCP_basic_string_wchar_clear(str);
9630
9631         for(c = basic_streambuf_wchar_sgetc(basic_ios_wchar_rdbuf_get(base));
9632                 c!=WEOF && !ctype_wchar_is_ch(ctype, _SPACE|_BLANK, c) && count>0;
9633                 c = basic_streambuf_wchar_snextc(basic_ios_wchar_rdbuf_get(base)), count--) {
9634             state = IOSTATE_goodbit;
9635             MSVCP_basic_string_wchar_append_ch(str, c);
9636         }
9637     }
9638     basic_istream_wchar_sentry_destroy(istream);
9639
9640     ios_base_width_set(&base->base, 0);
9641     basic_ios_wchar_setstate(base, state | (c==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
9642     return istream;
9643 }
9644
9645 /* ??$?5_WU?$char_traits@_W@std@@V?$allocator@_W@1@@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AAV10@AAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@0@@Z */
9646 /* ??$?5_WU?$char_traits@_W@std@@V?$allocator@_W@1@@std@@YAAEAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AEAV10@AEAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@0@@Z */
9647 basic_istream_wchar* __cdecl basic_istream_wchar_read_bstr(
9648         basic_istream_wchar *istream, basic_string_wchar *str)
9649 {
9650     return basic_istream_read_bstr(istream, str, ctype_wchar_use_facet(
9651                 basic_istream_wchar_get_basic_ios(istream)->strbuf->loc));
9652 }
9653
9654 /* ??$?5GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@AAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
9655 /* ??$?5GU?$char_traits@G@std@@V?$allocator@G@1@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@AEAV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@0@@Z */
9656 basic_istream_wchar* __cdecl basic_istream_short_read_bstr(
9657         basic_istream_wchar *istream, basic_string_wchar *str)
9658 {
9659     return basic_istream_read_bstr(istream, str, ctype_short_use_facet(
9660                 basic_istream_wchar_get_basic_ios(istream)->strbuf->loc));
9661 }
9662
9663 static basic_istream_wchar* basic_istream_read_str(basic_istream_wchar *istream, wchar_t *str, const ctype_wchar *ctype)
9664 {
9665     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(istream);
9666     IOSB_iostate state = IOSTATE_failbit;
9667     unsigned short c = '\n';
9668
9669     TRACE("(%p %p)\n", istream, str);
9670
9671     if(basic_istream_wchar_sentry_create(istream, FALSE)) {
9672         MSVCP_size_t count = ios_base_width_get(&base->base)-1;
9673
9674         for(c = basic_streambuf_wchar_sgetc(basic_ios_wchar_rdbuf_get(base));
9675                 c!=WEOF && !ctype_wchar_is_ch(ctype, _SPACE|_BLANK, c) && count>0;
9676                 c = basic_streambuf_wchar_snextc(basic_ios_wchar_rdbuf_get(base)), count--) {
9677             state = IOSTATE_goodbit;
9678             *str++ = c;
9679         }
9680     }
9681     basic_istream_wchar_sentry_destroy(istream);
9682
9683     *str = 0;
9684     ios_base_width_set(&base->base, 0);
9685     basic_ios_wchar_setstate(base, state | (c==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
9686     return istream;
9687 }
9688
9689 /* ??$?5_WU?$char_traits@_W@std@@@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AAV10@PA_W@Z */
9690 /* ??$?5_WU?$char_traits@_W@std@@@std@@YAAEAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AEAV10@PEA_W@Z */
9691 basic_istream_wchar* __cdecl basic_istream_wchar_read_str(basic_istream_wchar *istream, wchar_t *str)
9692 {
9693     return basic_istream_read_str(istream, str, ctype_wchar_use_facet(
9694                 basic_istream_wchar_get_basic_ios(istream)->strbuf->loc));
9695 }
9696
9697 /* ??$?5GU?$char_traits@G@std@@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@PAG@Z */
9698 /* ??$?5GU?$char_traits@G@std@@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@PEAG@Z */
9699 basic_istream_wchar* __cdecl basic_istream_short_read_str(basic_istream_wchar *istream, wchar_t *str)
9700 {
9701     return basic_istream_read_str(istream, str, ctype_short_use_facet(
9702                 basic_istream_wchar_get_basic_ios(istream)->strbuf->loc));
9703 }
9704
9705 /* ??$?5_WU?$char_traits@_W@std@@@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AAV10@AA_W@Z */
9706 /* ??$?5_WU?$char_traits@_W@std@@@std@@YAAEAV?$basic_istream@_WU?$char_traits@_W@std@@@0@AEAV10@AEA_W@Z */
9707 /* ??$?5GU?$char_traits@G@std@@@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@0@AAV10@AAG@Z */
9708 /* ??$?5GU?$char_traits@G@std@@@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@0@AEAV10@AEAG@Z */
9709 basic_istream_wchar* __cdecl basic_istream_wchar_read_ch(basic_istream_wchar *istream, wchar_t *ch)
9710 {
9711     IOSB_iostate state = IOSTATE_failbit;
9712     unsigned short c = 0;
9713
9714     TRACE("(%p %p)\n", istream, ch);
9715
9716     if(basic_istream_wchar_sentry_create(istream, FALSE)) {
9717         c = basic_streambuf_wchar_sbumpc(basic_ios_wchar_rdbuf_get(
9718                     basic_istream_wchar_get_basic_ios(istream)));
9719         if(c != WEOF) {
9720             state = IOSTATE_goodbit;
9721             *ch = c;
9722         }
9723     }
9724     basic_istream_wchar_sentry_destroy(istream);
9725
9726     basic_ios_wchar_setstate(basic_istream_wchar_get_basic_ios(istream),
9727             state | (c==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
9728     return istream;
9729 }
9730
9731 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
9732 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
9733 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
9734 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
9735 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_streambuf, 8)
9736 basic_istream_wchar* __thiscall basic_istream_wchar_read_streambuf(
9737         basic_istream_wchar *this, basic_streambuf_wchar *streambuf)
9738 {
9739     basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
9740     IOSB_iostate state = IOSTATE_failbit;
9741     unsigned short c = '\n';
9742
9743     TRACE("(%p %p)\n", this, streambuf);
9744
9745     if(basic_istream_wchar_sentry_create(this, FALSE)) {
9746         for(c = basic_streambuf_wchar_sgetc(basic_ios_wchar_rdbuf_get(base)); c!=WEOF;
9747                 c = basic_streambuf_wchar_snextc(basic_ios_wchar_rdbuf_get(base))) {
9748             state = IOSTATE_goodbit;
9749             if(basic_streambuf_wchar_sputc(streambuf, c) == WEOF)
9750                 break;
9751         }
9752     }
9753     basic_istream_wchar_sentry_destroy(this);
9754
9755     basic_ios_wchar_setstate(base, state | (c==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
9756     return this;
9757 }
9758
9759 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
9760 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
9761 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
9762 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
9763 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_func, 8)
9764 basic_istream_wchar* __thiscall basic_istream_wchar_read_func(basic_istream_wchar *this,
9765         basic_istream_wchar* (__cdecl *pfunc)(basic_istream_wchar*))
9766 {
9767     TRACE("(%p %p)\n", this, pfunc);
9768     pfunc(this);
9769     return this;
9770 }
9771
9772 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@_WU?$char_traits@_W@std@@@1@AAV21@@Z@Z */
9773 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@_WU?$char_traits@_W@std@@@1@AEAV21@@Z@Z */
9774 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@GU?$char_traits@G@std@@@1@AAV21@@Z@Z */
9775 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@GU?$char_traits@G@std@@@1@AEAV21@@Z@Z */
9776 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_func_basic_ios, 8)
9777 basic_istream_wchar* __thiscall basic_istream_wchar_read_func_basic_ios(basic_istream_wchar *this,
9778         basic_ios_wchar* (__cdecl *pfunc)(basic_ios_wchar*))
9779 {
9780     TRACE("(%p %p)\n", this, pfunc);
9781     pfunc(basic_istream_wchar_get_basic_ios(this));
9782     return this;
9783 }
9784
9785 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
9786 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
9787 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
9788 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
9789 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_func_ios_base, 8)
9790 basic_istream_wchar* __thiscall basic_istream_wchar_read_func_ios_base(
9791         basic_istream_wchar *this, ios_base* (__cdecl *pfunc)(ios_base*))
9792 {
9793     TRACE("(%p %p)\n", this, pfunc);
9794     pfunc(&basic_istream_wchar_get_basic_ios(this)->base);
9795     return this;
9796 }
9797
9798 static inline basic_ios_char* basic_iostream_char_to_basic_ios(basic_iostream_char *ptr)
9799 {
9800     return (basic_ios_char*)((char*)ptr+basic_iostream_char_vbtable1[1]);
9801 }
9802
9803 static inline basic_iostream_char* basic_iostream_char_from_basic_ios(basic_ios_char *ptr)
9804 {
9805     return (basic_iostream_char*)((char*)ptr-basic_iostream_char_vbtable1[1]);
9806 }
9807
9808 /* ??0?$basic_iostream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
9809 /* ??0?$basic_iostream@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
9810 DEFINE_THISCALL_WRAPPER(basic_iostream_char_ctor, 12)
9811 basic_iostream_char* __thiscall basic_iostream_char_ctor(basic_iostream_char *this, basic_streambuf_char *strbuf, MSVCP_bool virt_init)
9812 {
9813     basic_ios_char *basic_ios;
9814
9815     TRACE("(%p %p %d)\n", this, strbuf, virt_init);
9816
9817     if(virt_init) {
9818         this->base1.vbtable = basic_iostream_char_vbtable1;
9819         this->base2.vbtable = basic_iostream_char_vbtable2;
9820         basic_ios = basic_istream_char_get_basic_ios(&this->base1);
9821         basic_ios_char_ctor(basic_ios);
9822     }else {
9823         basic_ios = basic_istream_char_get_basic_ios(&this->base1);
9824     }
9825
9826     basic_ios->base.vtable = &MSVCP_basic_iostream_char_vtable;
9827
9828     basic_istream_char_ctor(&this->base1, strbuf, FALSE, FALSE);
9829     basic_ostream_char_ctor_uninitialized(&this->base2, 0, FALSE, FALSE);
9830     return this;
9831 }
9832
9833 /* ??1?$basic_iostream@DU?$char_traits@D@std@@@std@@UAE@XZ */
9834 /* ??1?$basic_iostream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
9835 DEFINE_THISCALL_WRAPPER(basic_iostream_char_dtor, 4)
9836 void __thiscall basic_iostream_char_dtor(basic_ios_char *base)
9837 {
9838     basic_iostream_char *this = basic_iostream_char_from_basic_ios(base);
9839
9840     TRACE("(%p)\n", this);
9841     basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(&this->base2));
9842     basic_istream_char_dtor(basic_istream_char_to_basic_ios(&this->base1));
9843 }
9844
9845 /* ??_D?$basic_iostream@DU?$char_traits@D@std@@@std@@QAEXXZ */
9846 /* ??_D?$basic_iostream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
9847 DEFINE_THISCALL_WRAPPER(basic_iostream_char_vbase_dtor, 4)
9848 void __thiscall basic_iostream_char_vbase_dtor(basic_iostream_char *this)
9849 {
9850     TRACE("(%p)\n", this);
9851     basic_iostream_char_dtor(basic_iostream_char_to_basic_ios(this));
9852     basic_ios_char_dtor(basic_istream_char_get_basic_ios(&this->base1));
9853 }
9854
9855 DEFINE_THISCALL_WRAPPER(basic_iostream_char_vector_dtor, 8)
9856 basic_iostream_char* __thiscall basic_iostream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
9857 {
9858     basic_iostream_char *this = basic_iostream_char_from_basic_ios(base);
9859
9860     TRACE("(%p %x)\n", this, flags);
9861
9862     if(flags & 2) {
9863         /* we have an array, with the number of elements stored before the first object */
9864         INT_PTR i, *ptr = (INT_PTR *)this-1;
9865
9866         for(i=*ptr-1; i>=0; i--)
9867             basic_iostream_char_vbase_dtor(this+i);
9868         MSVCRT_operator_delete(ptr);
9869     } else {
9870         basic_iostream_char_vbase_dtor(this);
9871         if(flags & 1)
9872             MSVCRT_operator_delete(this);
9873     }
9874
9875     return this;
9876 }
9877
9878 static inline basic_ios_wchar* basic_iostream_wchar_to_basic_ios(basic_iostream_wchar *ptr)
9879 {
9880     return (basic_ios_wchar*)((char*)ptr+basic_iostream_wchar_vbtable1[1]);
9881 }
9882
9883 static inline basic_iostream_wchar* basic_iostream_wchar_from_basic_ios(basic_ios_wchar *ptr)
9884 {
9885     return (basic_iostream_wchar*)((char*)ptr-basic_iostream_wchar_vbtable1[1]);
9886 }
9887
9888 /* ??0?$basic_iostream@_WU?$char_traits@_W@std@@@std@@QAE@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
9889 /* ??0?$basic_iostream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
9890 DEFINE_THISCALL_WRAPPER(basic_iostream_wchar_ctor, 12)
9891 basic_iostream_wchar* __thiscall basic_iostream_wchar_ctor(basic_iostream_wchar *this,
9892         basic_streambuf_wchar *strbuf, MSVCP_bool virt_init)
9893 {
9894     basic_ios_wchar *basic_ios;
9895
9896     TRACE("(%p %p %d)\n", this, strbuf, virt_init);
9897
9898     if(virt_init) {
9899         this->base1.vbtable = basic_iostream_wchar_vbtable1;
9900         this->base2.vbtable = basic_iostream_wchar_vbtable2;
9901         basic_ios = basic_istream_wchar_get_basic_ios(&this->base1);
9902         basic_ios_wchar_ctor(basic_ios);
9903     }else {
9904         basic_ios = basic_istream_wchar_get_basic_ios(&this->base1);
9905     }
9906
9907     basic_istream_wchar_ctor(&this->base1, strbuf, FALSE, FALSE);
9908     basic_ostream_wchar_ctor_uninitialized(&this->base2, 0, FALSE, FALSE);
9909
9910     basic_ios->base.vtable = &MSVCP_basic_iostream_wchar_vtable;
9911     return this;
9912 }
9913
9914 /* ??0?$basic_iostream@GU?$char_traits@G@std@@@std@@QAE@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
9915 /* ??0?$basic_iostream@GU?$char_traits@G@std@@@std@@QEAA@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
9916 DEFINE_THISCALL_WRAPPER(basic_iostream_short_ctor, 12)
9917 basic_iostream_wchar* __thiscall basic_iostream_short_ctor(basic_iostream_wchar *this,
9918         basic_streambuf_wchar *strbuf, MSVCP_bool virt_init)
9919 {
9920     basic_iostream_wchar_ctor(this, strbuf, virt_init);
9921     basic_istream_wchar_get_basic_ios(&this->base1)->base.vtable = &MSVCP_basic_iostream_short_vtable;
9922     return this;
9923 }
9924
9925 /* ??1?$basic_iostream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
9926 /* ??1?$basic_iostream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
9927 /* ??1?$basic_iostream@GU?$char_traits@G@std@@@std@@UAE@XZ */
9928 /* ??1?$basic_iostream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
9929 DEFINE_THISCALL_WRAPPER(basic_iostream_wchar_dtor, 4)
9930 void __thiscall basic_iostream_wchar_dtor(basic_ios_wchar *base)
9931 {
9932     basic_iostream_wchar *this = basic_iostream_wchar_from_basic_ios(base);
9933
9934     TRACE("(%p)\n", this);
9935     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&this->base2));
9936     basic_istream_wchar_dtor(basic_istream_wchar_to_basic_ios(&this->base1));
9937 }
9938
9939 /* ??_D?$basic_iostream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
9940 /* ??_D?$basic_iostream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
9941 /* ??_D?$basic_iostream@GU?$char_traits@G@std@@@std@@QAEXXZ */
9942 /* ??_D?$basic_iostream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
9943 DEFINE_THISCALL_WRAPPER(basic_iostream_wchar_vbase_dtor, 4)
9944 void __thiscall basic_iostream_wchar_vbase_dtor(basic_iostream_wchar *this)
9945 {
9946     TRACE("(%p)\n", this);
9947     basic_iostream_wchar_dtor(basic_iostream_wchar_to_basic_ios(this));
9948     basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(&this->base1));
9949 }
9950
9951 DEFINE_THISCALL_WRAPPER(basic_iostream_wchar_vector_dtor, 8)
9952 basic_iostream_wchar* __thiscall basic_iostream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
9953 {
9954     basic_iostream_wchar *this = basic_iostream_wchar_from_basic_ios(base);
9955
9956     TRACE("(%p %x)\n", this, flags);
9957
9958     if(flags & 2) {
9959         /* we have an array, with the number of elements stored before the first object */
9960         INT_PTR i, *ptr = (INT_PTR *)this-1;
9961
9962         for(i=*ptr-1; i>=0; i--)
9963             basic_iostream_wchar_vbase_dtor(this+i);
9964         MSVCRT_operator_delete(ptr);
9965     } else {
9966         basic_iostream_wchar_vbase_dtor(this);
9967         if(flags & 1)
9968             MSVCRT_operator_delete(this);
9969     }
9970
9971     return this;
9972 }
9973
9974 static inline basic_ios_char* basic_ofstream_char_to_basic_ios(basic_ofstream_char *ptr)
9975 {
9976     return (basic_ios_char*)((char*)ptr+basic_ofstream_char_vbtable[1]);
9977 }
9978
9979 static inline basic_ofstream_char* basic_ofstream_char_from_basic_ios(basic_ios_char *ptr)
9980 {
9981     return (basic_ofstream_char*)((char*)ptr-basic_ofstream_char_vbtable[1]);
9982 }
9983
9984 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAE@XZ */
9985 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAA@XZ */
9986 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_ctor, 8)
9987 basic_ofstream_char* __thiscall basic_ofstream_char_ctor(basic_ofstream_char *this, MSVCP_bool virt_init)
9988 {
9989     basic_ios_char *basic_ios;
9990
9991     TRACE("(%p %d)\n", this, virt_init);
9992
9993     if(virt_init) {
9994         this->base.vbtable = basic_ofstream_char_vbtable;
9995         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
9996         basic_ios_char_ctor(basic_ios);
9997     }else {
9998         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
9999     }
10000
10001     basic_filebuf_char_ctor(&this->filebuf);
10002     basic_ostream_char_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10003     basic_ios->base.vtable = &MSVCP_basic_ofstream_char_vtable;
10004     return this;
10005 }
10006
10007 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAE@PAU_iobuf@@@Z */
10008 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAA@PEAU_iobuf@@@Z */
10009 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_ctor_file, 12)
10010 basic_ofstream_char* __thiscall basic_ofstream_char_ctor_file(
10011         basic_ofstream_char *this, FILE *file, MSVCP_bool virt_init)
10012 {
10013     basic_ios_char *basic_ios;
10014
10015     TRACE("(%p %p %d)\n", this, file, virt_init);
10016
10017     if(virt_init) {
10018         this->base.vbtable = basic_ofstream_char_vbtable;
10019         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10020         basic_ios_char_ctor(basic_ios);
10021     }else {
10022         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10023     }
10024
10025     basic_filebuf_char_ctor_file(&this->filebuf, file);
10026     basic_ostream_char_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10027     basic_ios->base.vtable = &MSVCP_basic_ofstream_char_vtable;
10028     return this;
10029 }
10030
10031 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAE@PBDHH@Z */
10032 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAA@PEBDHH@Z */
10033 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_ctor_name, 20)
10034 basic_ofstream_char* __thiscall basic_ofstream_char_ctor_name(basic_ofstream_char *this,
10035         const char *name, int mode, int prot, MSVCP_bool virt_init)
10036 {
10037     TRACE("(%p %s %d %d %d)\n", this, name, mode, prot, virt_init);
10038
10039     basic_ofstream_char_ctor(this, virt_init);
10040
10041     if(!basic_filebuf_char_open(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10042         basic_ios_char *basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10043         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10044     }
10045     return this;
10046 }
10047
10048 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAE@PBGHH@Z */
10049 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAA@PEBGHH@Z */
10050 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAE@PB_WHH@Z */
10051 /* ??0?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAA@PEB_WHH@Z */
10052 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_ctor_name_wchar, 20)
10053 basic_ofstream_char* __thiscall basic_ofstream_char_ctor_name_wchar(basic_ofstream_char *this,
10054         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
10055 {
10056     TRACE("(%p %s %d %d %d)\n", this, debugstr_w(name), mode, prot, virt_init);
10057
10058     basic_ofstream_char_ctor(this, virt_init);
10059
10060     if(!basic_filebuf_char_open_wchar(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10061         basic_ios_char *basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10062         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10063     }
10064     return this;
10065 }
10066
10067 /* ??1?$basic_ofstream@DU?$char_traits@D@std@@@std@@UAE@XZ */
10068 /* ??1?$basic_ofstream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
10069 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_dtor, 4)
10070 void __thiscall basic_ofstream_char_dtor(basic_ios_char *base)
10071 {
10072     basic_ofstream_char *this = basic_ofstream_char_from_basic_ios(base);
10073
10074     TRACE("(%p)\n", this);
10075
10076     basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(&this->base));
10077     basic_filebuf_char_dtor(&this->filebuf);
10078 }
10079
10080 /* ??_D?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXXZ */
10081 /* ??_D?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
10082 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_vbase_dtor, 4)
10083 void __thiscall basic_ofstream_char_vbase_dtor(basic_ofstream_char *this)
10084 {
10085     TRACE("(%p)\n", this);
10086
10087     basic_ofstream_char_dtor(basic_ofstream_char_to_basic_ios(this));
10088     basic_ios_char_dtor(basic_ostream_char_get_basic_ios(&this->base));
10089 }
10090
10091 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_vector_dtor, 8)
10092 basic_ofstream_char* __thiscall basic_ofstream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
10093 {
10094     basic_ofstream_char *this = basic_ofstream_char_from_basic_ios(base);
10095
10096     TRACE("(%p %x)\n", this, flags);
10097
10098     if(flags & 2) {
10099         /* we have an array, with the number of elements stored before the first object */
10100         INT_PTR i, *ptr = (INT_PTR *)this-1;
10101
10102         for(i=*ptr-1; i>=0; i--)
10103             basic_ofstream_char_vbase_dtor(this+i);
10104         MSVCRT_operator_delete(ptr);
10105     } else {
10106         basic_ofstream_char_vbase_dtor(this);
10107         if(flags & 1)
10108             MSVCRT_operator_delete(this);
10109     }
10110
10111     return this;
10112 }
10113
10114 /* ?close@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXXZ */
10115 /* ?close@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
10116 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_close, 4)
10117 void __thiscall basic_ofstream_char_close(basic_ofstream_char *this)
10118 {
10119     TRACE("(%p)\n", this);
10120
10121     if(!basic_filebuf_char_close(&this->filebuf)) {
10122         basic_ios_char *basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10123         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10124     }
10125 }
10126
10127 /* ?is_open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QBE_NXZ */
10128 /* ?is_open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEBA_NXZ */
10129 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_is_open, 4)
10130 MSVCP_bool __thiscall basic_ofstream_char_is_open(const basic_ofstream_char *this)
10131 {
10132     TRACE("(%p)\n", this);
10133     return basic_filebuf_char_is_open(&this->filebuf);
10134 }
10135
10136 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXPBDHH@Z */
10137 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXPEBDHH@Z */
10138 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_open, 16)
10139 void __thiscall basic_ofstream_char_open(basic_ofstream_char *this,
10140         const char *name, int mode, int prot)
10141 {
10142     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
10143
10144     if(!basic_filebuf_char_open(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10145         basic_ios_char *basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10146         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10147     }
10148 }
10149
10150 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXPBDI@Z */
10151 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXPEBDI@Z */
10152 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_open_old, 12)
10153 void __thiscall basic_ofstream_char_open_old(basic_ofstream_char *this,
10154         const char *name, unsigned int mode)
10155 {
10156     basic_ofstream_char_open(this, name, mode, _SH_DENYNO);
10157 }
10158
10159 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXPBGHH@Z */
10160 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXPEBGHH@Z */
10161 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXPB_WHH@Z */
10162 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXPEB_WHH@Z */
10163 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_open_wchar, 16)
10164 void __thiscall basic_ofstream_char_open_wchar(basic_ofstream_char *this,
10165         const wchar_t *name, int mode, int prot)
10166 {
10167     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
10168
10169     if(!basic_filebuf_char_open_wchar(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10170         basic_ios_char *basic_ios = basic_ostream_char_get_basic_ios(&this->base);
10171         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10172     }
10173 }
10174
10175 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXPBGI@Z */
10176 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXPEBGI@Z */
10177 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QAEXPB_WI@Z */
10178 /* ?open@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEAAXPEB_WI@Z */
10179 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_open_wchar_old, 12)
10180 void __thiscall basic_ofstream_char_open_wchar_old(basic_ofstream_char *this,
10181         const wchar_t *name, unsigned int mode)
10182 {
10183     basic_ofstream_char_open_wchar(this, name, mode, _SH_DENYNO);
10184 }
10185
10186 /* ?rdbuf@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_filebuf@DU?$char_traits@D@std@@@2@XZ */
10187 /* ?rdbuf@?$basic_ofstream@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_filebuf@DU?$char_traits@D@std@@@2@XZ */
10188 DEFINE_THISCALL_WRAPPER(basic_ofstream_char_rdbuf, 4)
10189 basic_filebuf_char* __thiscall basic_ofstream_char_rdbuf(const basic_ofstream_char *this)
10190 {
10191     TRACE("(%p)\n", this);
10192     return (basic_filebuf_char*)&this->filebuf;
10193 }
10194
10195 static inline basic_ios_wchar* basic_ofstream_wchar_to_basic_ios(basic_ofstream_wchar *ptr)
10196 {
10197     return (basic_ios_wchar*)((char*)ptr+basic_ofstream_wchar_vbtable[1]);
10198 }
10199
10200 static inline basic_ofstream_wchar* basic_ofstream_wchar_from_basic_ios(basic_ios_wchar *ptr)
10201 {
10202     return (basic_ofstream_wchar*)((char*)ptr-basic_ofstream_wchar_vbtable[1]);
10203 }
10204
10205 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAE@XZ */
10206 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAA@XZ */
10207 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_ctor, 8)
10208 basic_ofstream_wchar* __thiscall basic_ofstream_wchar_ctor(basic_ofstream_wchar *this, MSVCP_bool virt_init)
10209 {
10210     basic_ios_wchar *basic_ios;
10211
10212     TRACE("(%p %d)\n", this, virt_init);
10213
10214     if(virt_init) {
10215         this->base.vbtable = basic_ofstream_wchar_vbtable;
10216         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10217         basic_ios_wchar_ctor(basic_ios);
10218     }else {
10219         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10220     }
10221
10222     basic_filebuf_wchar_ctor(&this->filebuf);
10223     basic_ostream_wchar_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10224     basic_ios->base.vtable = &MSVCP_basic_ofstream_wchar_vtable;
10225     return this;
10226 }
10227
10228 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAE@XZ */
10229 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAA@XZ */
10230 DEFINE_THISCALL_WRAPPER(basic_ofstream_short_ctor, 8)
10231 basic_ofstream_wchar* __thiscall basic_ofstream_short_ctor(basic_ofstream_wchar *this, MSVCP_bool virt_init)
10232 {
10233     basic_ofstream_wchar_ctor(this, virt_init);
10234     basic_ostream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ofstream_short_vtable;
10235     return this;
10236 }
10237
10238 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAE@PAU_iobuf@@@Z */
10239 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAU_iobuf@@@Z */
10240 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_ctor_file, 12)
10241 basic_ofstream_wchar* __thiscall basic_ofstream_wchar_ctor_file(
10242         basic_ofstream_wchar *this, FILE *file, MSVCP_bool virt_init)
10243 {
10244     basic_ios_wchar *basic_ios;
10245
10246     TRACE("(%p %p %d)\n", this, file, virt_init);
10247
10248     if(virt_init) {
10249         this->base.vbtable = basic_ofstream_wchar_vbtable;
10250         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10251         basic_ios_wchar_ctor(basic_ios);
10252     }else {
10253         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10254     }
10255
10256     basic_filebuf_wchar_ctor_file(&this->filebuf, file);
10257     basic_ostream_wchar_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10258     basic_ios->base.vtable = &MSVCP_basic_ofstream_wchar_vtable;
10259     return this;
10260 }
10261
10262 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAE@PAU_iobuf@@@Z */
10263 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAA@PEAU_iobuf@@@Z */
10264 DEFINE_THISCALL_WRAPPER(basic_ofstream_short_ctor_file, 12)
10265 basic_ofstream_wchar* __thiscall basic_ofstream_short_ctor_file(
10266         basic_ofstream_wchar *this, FILE *file, MSVCP_bool virt_init)
10267 {
10268     basic_ofstream_wchar_ctor_file(this, file, virt_init);
10269     basic_ostream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ofstream_short_vtable;
10270     return this;
10271 }
10272
10273 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAE@PBDHH@Z */
10274 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEBDHH@Z */
10275 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_ctor_name, 20)
10276 basic_ofstream_wchar* __thiscall basic_ofstream_wchar_ctor_name(basic_ofstream_wchar *this,
10277         const char *name, int mode, int prot, MSVCP_bool virt_init)
10278 {
10279     TRACE("(%p %s %d %d %d)\n", this, name, mode, prot, virt_init);
10280
10281     basic_ofstream_wchar_ctor(this, virt_init);
10282
10283     if(!basic_filebuf_wchar_open(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10284         basic_ios_wchar *basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10285         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10286     }
10287     return this;
10288 }
10289
10290 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAE@PBDHH@Z */
10291 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAA@PEBDHH@Z */
10292 DEFINE_THISCALL_WRAPPER(basic_ofstream_short_ctor_name, 20)
10293 basic_ofstream_wchar* __thiscall basic_ofstream_short_ctor_name(basic_ofstream_wchar *this,
10294         const char *name, int mode, int prot, MSVCP_bool virt_init)
10295 {
10296     basic_ofstream_wchar_ctor_name(this, name, mode, prot, virt_init);
10297     basic_ostream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ofstream_short_vtable;
10298     return this;
10299 }
10300
10301 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAE@PBGHH@Z */
10302 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEBGHH@Z */
10303 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAE@PB_WHH@Z */
10304 /* ??0?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEB_WHH@Z */
10305 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_ctor_name_wchar, 20)
10306 basic_ofstream_wchar* __thiscall basic_ofstream_wchar_ctor_name_wchar(basic_ofstream_wchar *this,
10307         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
10308 {
10309     TRACE("(%p %s %d %d %d)\n", this, debugstr_w(name), mode, prot, virt_init);
10310
10311     basic_ofstream_wchar_ctor(this, virt_init);
10312
10313     if(!basic_filebuf_wchar_open_wchar(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10314         basic_ios_wchar *basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10315         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10316     }
10317     return this;
10318 }
10319
10320 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAE@PBGHH@Z */
10321 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAA@PEBGHH@Z */
10322 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAE@PB_WHH@Z */
10323 /* ??0?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAA@PEB_WHH@Z */
10324 DEFINE_THISCALL_WRAPPER(basic_ofstream_short_ctor_name_wchar, 20)
10325 basic_ofstream_wchar* __thiscall basic_ofstream_short_ctor_name_wchar(basic_ofstream_wchar *this,
10326         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
10327 {
10328     basic_ofstream_wchar_ctor_name_wchar(this, name, mode, prot, virt_init);
10329     basic_ostream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ofstream_short_vtable;
10330     return this;
10331 }
10332
10333 /* ??1?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
10334 /* ??1?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
10335 /* ??1?$basic_ofstream@GU?$char_traits@G@std@@@std@@UAE@XZ */
10336 /* ??1?$basic_ofstream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
10337 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_dtor, 4)
10338 void __thiscall basic_ofstream_wchar_dtor(basic_ios_wchar *base)
10339 {
10340     basic_ofstream_wchar *this = basic_ofstream_wchar_from_basic_ios(base);
10341
10342     TRACE("(%p)\n", this);
10343
10344     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&this->base));
10345     basic_filebuf_wchar_dtor(&this->filebuf);
10346 }
10347
10348 /* ??_D?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
10349 /* ??_D?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
10350 /* ??_D?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXXZ */
10351 /* ??_D?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
10352 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_vbase_dtor, 4)
10353 void __thiscall basic_ofstream_wchar_vbase_dtor(basic_ofstream_wchar *this)
10354 {
10355     TRACE("(%p)\n", this);
10356
10357     basic_ofstream_wchar_dtor(basic_ofstream_wchar_to_basic_ios(this));
10358     basic_ios_wchar_dtor(basic_ostream_wchar_get_basic_ios(&this->base));
10359 }
10360
10361 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_vector_dtor, 8)
10362 basic_ofstream_wchar* __thiscall basic_ofstream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
10363 {
10364     basic_ofstream_wchar *this = basic_ofstream_wchar_from_basic_ios(base);
10365
10366     TRACE("(%p %x)\n", this, flags);
10367
10368     if(flags & 2) {
10369         /* we have an array, with the number of elements stored before the first object */
10370         INT_PTR i, *ptr = (INT_PTR *)this-1;
10371
10372         for(i=*ptr-1; i>=0; i--)
10373             basic_ofstream_wchar_vbase_dtor(this+i);
10374         MSVCRT_operator_delete(ptr);
10375     } else {
10376         basic_ofstream_wchar_vbase_dtor(this);
10377         if(flags & 1)
10378             MSVCRT_operator_delete(this);
10379     }
10380
10381     return this;
10382 }
10383
10384 /* ?close@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
10385 /* ?close@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
10386 /* ?close@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXXZ */
10387 /* ?close@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
10388 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_close, 4)
10389 void __thiscall basic_ofstream_wchar_close(basic_ofstream_wchar *this)
10390 {
10391     TRACE("(%p)\n", this);
10392
10393     if(!basic_filebuf_wchar_close(&this->filebuf)) {
10394         basic_ios_wchar *basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10395         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10396     }
10397 }
10398
10399 /* ?is_open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QBE_NXZ */
10400 /* ?is_open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEBA_NXZ */
10401 /* ?is_open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QBE_NXZ */
10402 /* ?is_open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEBA_NXZ */
10403 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_is_open, 4)
10404 MSVCP_bool __thiscall basic_ofstream_wchar_is_open(const basic_ofstream_wchar *this)
10405 {
10406     TRACE("(%p)\n", this);
10407     return basic_filebuf_wchar_is_open(&this->filebuf);
10408 }
10409
10410 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXPBDHH@Z */
10411 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBDHH@Z */
10412 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXPBDHH@Z */
10413 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXPEBDHH@Z */
10414 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_open, 16)
10415 void __thiscall basic_ofstream_wchar_open(basic_ofstream_wchar *this,
10416         const char *name, int mode, int prot)
10417 {
10418     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
10419
10420     if(!basic_filebuf_wchar_open(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10421         basic_ios_wchar *basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10422         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10423     }
10424 }
10425
10426 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXPBDI@Z */
10427 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBDI@Z */
10428 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXPBDI@Z */
10429 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXPEBDI@Z */
10430 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_open_old, 12)
10431 void __thiscall basic_ofstream_wchar_open_old(basic_ofstream_wchar *this,
10432         const char *name, unsigned int mode)
10433 {
10434     basic_ofstream_wchar_open(this, name, mode, _SH_DENYNO);
10435 }
10436
10437 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXPBGHH@Z */
10438 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBGHH@Z */
10439 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXPB_WHH@Z */
10440 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEB_WHH@Z */
10441 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXPBGHH@Z */
10442 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXPEBGHH@Z */
10443 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXPB_WHH@Z */
10444 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXPEB_WHH@Z */
10445 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_open_wchar, 16)
10446 void __thiscall basic_ofstream_wchar_open_wchar(basic_ofstream_wchar *this,
10447         const wchar_t *name, int mode, int prot)
10448 {
10449     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
10450
10451     if(!basic_filebuf_wchar_open_wchar(&this->filebuf, name, mode|OPENMODE_out, prot)) {
10452         basic_ios_wchar *basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
10453         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10454     }
10455 }
10456
10457 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXPBGI@Z */
10458 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBGI@Z */
10459 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QAEXPB_WI@Z */
10460 /* ?open@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEB_WI@Z */
10461 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXPBGI@Z */
10462 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXPEBGI@Z */
10463 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QAEXPB_WI@Z */
10464 /* ?open@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEAAXPEB_WI@Z */
10465 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_open_wchar_old, 12)
10466 void __thiscall basic_ofstream_wchar_open_wchar_old(basic_ofstream_wchar *this,
10467         const wchar_t *name, unsigned int mode)
10468 {
10469     basic_ofstream_wchar_open_wchar(this, name, mode, _SH_DENYNO);
10470 }
10471
10472 /* ?rdbuf@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QBEPAV?$basic_filebuf@_WU?$char_traits@_W@std@@@2@XZ */
10473 /* ?rdbuf@?$basic_ofstream@_WU?$char_traits@_W@std@@@std@@QEBAPEAV?$basic_filebuf@_WU?$char_traits@_W@std@@@2@XZ */
10474 /* ?rdbuf@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QBEPAV?$basic_filebuf@GU?$char_traits@G@std@@@2@XZ */
10475 /* ?rdbuf@?$basic_ofstream@GU?$char_traits@G@std@@@std@@QEBAPEAV?$basic_filebuf@GU?$char_traits@G@std@@@2@XZ */
10476 DEFINE_THISCALL_WRAPPER(basic_ofstream_wchar_rdbuf, 4)
10477 basic_filebuf_wchar* __thiscall basic_ofstream_wchar_rdbuf(const basic_ofstream_wchar *this)
10478 {
10479     TRACE("(%p)\n", this);
10480     return (basic_filebuf_wchar*)&this->filebuf;
10481 }
10482
10483 static inline basic_ios_char* basic_ifstream_char_to_basic_ios(basic_ifstream_char *ptr)
10484 {
10485     return (basic_ios_char*)((char*)ptr+basic_ifstream_char_vbtable[1]);
10486 }
10487
10488 static inline basic_ifstream_char* basic_ifstream_char_from_basic_ios(basic_ios_char *ptr)
10489 {
10490     return (basic_ifstream_char*)((char*)ptr-basic_ifstream_char_vbtable[1]);
10491 }
10492
10493 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAE@XZ */
10494 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAA@XZ */
10495 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_ctor, 8)
10496 basic_ifstream_char* __thiscall basic_ifstream_char_ctor(basic_ifstream_char *this, MSVCP_bool virt_init)
10497 {
10498     basic_ios_char *basic_ios;
10499
10500     TRACE("(%p %d)\n", this, virt_init);
10501
10502     if(virt_init) {
10503         this->base.vbtable = basic_ifstream_char_vbtable;
10504         basic_ios = basic_istream_char_get_basic_ios(&this->base);
10505         basic_ios_char_ctor(basic_ios);
10506     }else {
10507         basic_ios = basic_istream_char_get_basic_ios(&this->base);
10508     }
10509
10510     basic_filebuf_char_ctor(&this->filebuf);
10511     basic_istream_char_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10512     basic_ios->base.vtable = &MSVCP_basic_ifstream_char_vtable;
10513     return this;
10514 }
10515
10516 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAE@PAU_iobuf@@@Z */
10517 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAA@PEAU_iobuf@@@Z */
10518 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_ctor_file, 12)
10519 basic_ifstream_char* __thiscall basic_ifstream_char_ctor_file(
10520         basic_ifstream_char *this, FILE *file, MSVCP_bool virt_init)
10521 {
10522     basic_ios_char *basic_ios;
10523
10524     TRACE("(%p %p %d)\n", this, file, virt_init);
10525
10526     if(virt_init) {
10527         this->base.vbtable = basic_ifstream_char_vbtable;
10528         basic_ios = basic_istream_char_get_basic_ios(&this->base);
10529         basic_ios_char_ctor(basic_ios);
10530     }else {
10531         basic_ios = basic_istream_char_get_basic_ios(&this->base);
10532     }
10533
10534     basic_filebuf_char_ctor_file(&this->filebuf, file);
10535     basic_istream_char_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10536     basic_ios->base.vtable = &MSVCP_basic_ifstream_char_vtable;
10537     return this;
10538 }
10539
10540 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAE@PBDHH@Z */
10541 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAA@PEBDHH@Z */
10542 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_ctor_name, 20)
10543 basic_ifstream_char* __thiscall basic_ifstream_char_ctor_name(basic_ifstream_char *this,
10544         const char *name, int mode, int prot, MSVCP_bool virt_init)
10545 {
10546     TRACE("(%p %s %d %d %d)\n", this, name, mode, prot, virt_init);
10547
10548     basic_ifstream_char_ctor(this, virt_init);
10549
10550     if(!basic_filebuf_char_open(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10551         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base);
10552         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10553     }
10554     return this;
10555 }
10556
10557 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAE@PBGHH@Z */
10558 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAA@PEBGHH@Z */
10559 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAE@PB_WHH@Z */
10560 /* ??0?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAA@PEB_WHH@Z */
10561 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_ctor_name_wchar, 20)
10562 basic_ifstream_char* __thiscall basic_ifstream_char_ctor_name_wchar(basic_ifstream_char *this,
10563         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
10564 {
10565     TRACE("(%p %s %d %d %d)\n", this, debugstr_w(name), mode, prot, virt_init);
10566
10567     basic_ifstream_char_ctor(this, virt_init);
10568
10569     if(!basic_filebuf_char_open_wchar(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10570         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base);
10571         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10572     }
10573     return this;
10574 }
10575
10576 /* ??1?$basic_ifstream@DU?$char_traits@D@std@@@std@@UAE@XZ */
10577 /* ??1?$basic_ifstream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
10578 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_dtor, 4)
10579 void __thiscall basic_ifstream_char_dtor(basic_ios_char *base)
10580 {
10581     basic_ifstream_char *this = basic_ifstream_char_from_basic_ios(base);
10582
10583     TRACE("(%p)\n", this);
10584
10585     basic_istream_char_dtor(basic_istream_char_to_basic_ios(&this->base));
10586     basic_filebuf_char_dtor(&this->filebuf);
10587 }
10588
10589 /* ??_D?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXXZ */
10590 /* ??_D?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
10591 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_vbase_dtor, 4)
10592 void __thiscall basic_ifstream_char_vbase_dtor(basic_ifstream_char *this)
10593 {
10594     TRACE("(%p)\n", this);
10595
10596     basic_ifstream_char_dtor(basic_ifstream_char_to_basic_ios(this));
10597     basic_ios_char_dtor(basic_istream_char_get_basic_ios(&this->base));
10598 }
10599
10600 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_vector_dtor, 8)
10601 basic_ifstream_char* __thiscall basic_ifstream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
10602 {
10603     basic_ifstream_char *this = basic_ifstream_char_from_basic_ios(base);
10604
10605     TRACE("(%p %x)\n", this, flags);
10606
10607     if(flags & 2) {
10608         /* we have an array, with the number of elements stored before the first object */
10609         INT_PTR i, *ptr = (INT_PTR *)this-1;
10610
10611         for(i=*ptr-1; i>=0; i--)
10612             basic_ifstream_char_vbase_dtor(this+i);
10613         MSVCRT_operator_delete(ptr);
10614     } else {
10615         basic_ifstream_char_vbase_dtor(this);
10616         if(flags & 1)
10617             MSVCRT_operator_delete(this);
10618     }
10619
10620     return this;
10621 }
10622
10623 /* ?close@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXXZ */
10624 /* ?close@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
10625 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_close, 4)
10626 void __thiscall basic_ifstream_char_close(basic_ifstream_char *this)
10627 {
10628     TRACE("(%p)\n", this);
10629
10630     if(!basic_filebuf_char_close(&this->filebuf)) {
10631         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base);
10632         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10633     }
10634 }
10635
10636 /* ?is_open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QBE_NXZ */
10637 /* ?is_open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEBA_NXZ */
10638 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_is_open, 4)
10639 MSVCP_bool __thiscall basic_ifstream_char_is_open(const basic_ifstream_char *this)
10640 {
10641     TRACE("(%p)\n", this);
10642     return basic_filebuf_char_is_open(&this->filebuf);
10643 }
10644
10645 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXPBDHH@Z */
10646 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXPEBDHH@Z */
10647 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_open, 16)
10648 void __thiscall basic_ifstream_char_open(basic_ifstream_char *this,
10649         const char *name, int mode, int prot)
10650 {
10651     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
10652
10653     if(!basic_filebuf_char_open(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10654         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base);
10655         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10656     }
10657 }
10658
10659 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXPBDI@Z */
10660 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXPEBDI@Z */
10661 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_open_old, 12)
10662 void __thiscall basic_ifstream_char_open_old(basic_ifstream_char *this,
10663         const char *name, unsigned int mode)
10664 {
10665     basic_ifstream_char_open(this, name, mode, _SH_DENYNO);
10666 }
10667
10668 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXPBGHH@Z */
10669 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXPEBGHH@Z */
10670 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXPB_WHH@Z */
10671 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXPEB_WHH@Z */
10672 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_open_wchar, 16)
10673 void __thiscall basic_ifstream_char_open_wchar(basic_ifstream_char *this,
10674         const wchar_t *name, int mode, int prot)
10675 {
10676     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
10677
10678     if(!basic_filebuf_char_open_wchar(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10679         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base);
10680         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
10681     }
10682 }
10683
10684 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXPBGI@Z */
10685 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXPEBGI@Z */
10686 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXPB_WI@Z */
10687 /* ?open@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEAAXPEB_WI@Z */
10688 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_open_wchar_old, 12)
10689 void __thiscall basic_ifstream_char_open_wchar_old(basic_ifstream_char *this,
10690         const wchar_t *name, unsigned int mode)
10691 {
10692     basic_ifstream_char_open_wchar(this, name, mode, _SH_DENYNO);
10693 }
10694
10695 /* ?rdbuf@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_filebuf@DU?$char_traits@D@std@@@2@XZ */
10696 /* ?rdbuf@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_filebuf@DU?$char_traits@D@std@@@2@XZ */
10697 DEFINE_THISCALL_WRAPPER(basic_ifstream_char_rdbuf, 4)
10698 basic_filebuf_char* __thiscall basic_ifstream_char_rdbuf(const basic_ifstream_char *this)
10699 {
10700     TRACE("(%p)\n", this);
10701     return (basic_filebuf_char*)&this->filebuf;
10702 }
10703
10704 static inline basic_ios_wchar* basic_ifstream_wchar_to_basic_ios(basic_ifstream_wchar *ptr)
10705 {
10706     return (basic_ios_wchar*)((char*)ptr+basic_ifstream_wchar_vbtable[1]);
10707 }
10708
10709 static inline basic_ifstream_wchar* basic_ifstream_wchar_from_basic_ios(basic_ios_wchar *ptr)
10710 {
10711     return (basic_ifstream_wchar*)((char*)ptr-basic_ifstream_wchar_vbtable[1]);
10712 }
10713
10714 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAE@XZ */
10715 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAA@XZ */
10716 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_ctor, 8)
10717 basic_ifstream_wchar* __thiscall basic_ifstream_wchar_ctor(basic_ifstream_wchar *this, MSVCP_bool virt_init)
10718 {
10719     basic_ios_wchar *basic_ios;
10720
10721     TRACE("(%p %d)\n", this, virt_init);
10722
10723     if(virt_init) {
10724         this->base.vbtable = basic_ifstream_wchar_vbtable;
10725         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10726         basic_ios_wchar_ctor(basic_ios);
10727     }else {
10728         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10729     }
10730
10731     basic_filebuf_wchar_ctor(&this->filebuf);
10732     basic_istream_wchar_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10733     basic_ios->base.vtable = &MSVCP_basic_ifstream_wchar_vtable;
10734     return this;
10735 }
10736
10737 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAE@XZ */
10738 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAA@XZ */
10739 DEFINE_THISCALL_WRAPPER(basic_ifstream_short_ctor, 8)
10740 basic_ifstream_wchar* __thiscall basic_ifstream_short_ctor(basic_ifstream_wchar *this, MSVCP_bool virt_init)
10741 {
10742     basic_ifstream_wchar_ctor(this, virt_init);
10743     basic_istream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ifstream_short_vtable;
10744     return this;
10745 }
10746
10747 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAE@PAU_iobuf@@@Z */
10748 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAU_iobuf@@@Z */
10749 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_ctor_file, 12)
10750 basic_ifstream_wchar* __thiscall basic_ifstream_wchar_ctor_file(
10751         basic_ifstream_wchar *this, FILE *file, MSVCP_bool virt_init)
10752 {
10753     basic_ios_wchar *basic_ios;
10754
10755     TRACE("(%p %p %d)\n", this, file, virt_init);
10756
10757     if(virt_init) {
10758         this->base.vbtable = basic_ifstream_wchar_vbtable;
10759         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10760         basic_ios_wchar_ctor(basic_ios);
10761     }else {
10762         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10763     }
10764
10765     basic_filebuf_wchar_ctor_file(&this->filebuf, file);
10766     basic_istream_wchar_ctor(&this->base, &this->filebuf.base, FALSE, FALSE);
10767     basic_ios->base.vtable = &MSVCP_basic_ifstream_wchar_vtable;
10768     return this;
10769 }
10770
10771 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAE@PAU_iobuf@@@Z */
10772 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAA@PEAU_iobuf@@@Z */
10773 DEFINE_THISCALL_WRAPPER(basic_ifstream_short_ctor_file, 12)
10774 basic_ifstream_wchar* __thiscall basic_ifstream_short_ctor_file(
10775         basic_ifstream_wchar *this, FILE *file, MSVCP_bool virt_init)
10776 {
10777     basic_ifstream_wchar_ctor_file(this, file, virt_init);
10778     basic_istream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ifstream_short_vtable;
10779     return this;
10780 }
10781
10782 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAE@PBDHH@Z */
10783 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEBDHH@Z */
10784 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_ctor_name, 20)
10785 basic_ifstream_wchar* __thiscall basic_ifstream_wchar_ctor_name(basic_ifstream_wchar *this,
10786         const char *name, int mode, int prot, MSVCP_bool virt_init)
10787 {
10788     TRACE("(%p %s %d %d %d)\n", this, name, mode, prot, virt_init);
10789
10790     basic_ifstream_wchar_ctor(this, virt_init);
10791
10792     if(!basic_filebuf_wchar_open(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10793         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10794         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10795     }
10796     return this;
10797 }
10798
10799 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAE@PBDHH@Z */
10800 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAA@PEBDHH@Z */
10801 DEFINE_THISCALL_WRAPPER(basic_ifstream_short_ctor_name, 20)
10802 basic_ifstream_wchar* __thiscall basic_ifstream_short_ctor_name(basic_ifstream_wchar *this,
10803         const char *name, int mode, int prot, MSVCP_bool virt_init)
10804 {
10805     basic_ifstream_wchar_ctor_name(this, name, mode, prot, virt_init);
10806     basic_istream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ifstream_short_vtable;
10807     return this;
10808 }
10809
10810 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAE@PBGHH@Z */
10811 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEBGHH@Z */
10812 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAE@PB_WHH@Z */
10813 /* ??0?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEB_WHH@Z */
10814 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_ctor_name_wchar, 20)
10815 basic_ifstream_wchar* __thiscall basic_ifstream_wchar_ctor_name_wchar(basic_ifstream_wchar *this,
10816         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
10817 {
10818     TRACE("(%p %s %d %d %d)\n", this, debugstr_w(name), mode, prot, virt_init);
10819
10820     basic_ifstream_wchar_ctor(this, virt_init);
10821
10822     if(!basic_filebuf_wchar_open_wchar(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10823         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10824         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10825     }
10826     return this;
10827 }
10828
10829 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAE@PBGHH@Z */
10830 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAA@PEBGHH@Z */
10831 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAE@PB_WHH@Z */
10832 /* ??0?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAA@PEB_WHH@Z */
10833 DEFINE_THISCALL_WRAPPER(basic_ifstream_short_ctor_name_wchar, 20)
10834 basic_ifstream_wchar* __thiscall basic_ifstream_short_ctor_name_wchar(basic_ifstream_wchar *this,
10835         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
10836 {
10837     basic_ifstream_wchar_ctor_name_wchar(this, name, mode, prot, virt_init);
10838     basic_istream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ifstream_short_vtable;
10839     return this;
10840 }
10841
10842 /* ??1?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
10843 /* ??1?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
10844 /* ??1?$basic_ifstream@GU?$char_traits@G@std@@@std@@UAE@XZ */
10845 /* ??1?$basic_ifstream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
10846 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_dtor, 4)
10847 void __thiscall basic_ifstream_wchar_dtor(basic_ios_wchar *base)
10848 {
10849     basic_ifstream_wchar *this = basic_ifstream_wchar_from_basic_ios(base);
10850
10851     TRACE("(%p)\n", this);
10852
10853     basic_istream_wchar_dtor(basic_istream_wchar_to_basic_ios(&this->base));
10854     basic_filebuf_wchar_dtor(&this->filebuf);
10855 }
10856
10857 /* ??_D?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
10858 /* ??_D?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
10859 /* ??_D?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXXZ */
10860 /* ??_D?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
10861 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_vbase_dtor, 4)
10862 void __thiscall basic_ifstream_wchar_vbase_dtor(basic_ifstream_wchar *this)
10863 {
10864     TRACE("(%p)\n", this);
10865
10866     basic_ifstream_wchar_dtor(basic_ifstream_wchar_to_basic_ios(this));
10867     basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(&this->base));
10868 }
10869
10870 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_vector_dtor, 8)
10871 basic_ifstream_wchar* __thiscall basic_ifstream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
10872 {
10873     basic_ifstream_wchar *this = basic_ifstream_wchar_from_basic_ios(base);
10874
10875     TRACE("(%p %x)\n", this, flags);
10876
10877     if(flags & 2) {
10878         /* we have an array, with the number of elements stored before the first object */
10879         INT_PTR i, *ptr = (INT_PTR *)this-1;
10880
10881         for(i=*ptr-1; i>=0; i--)
10882             basic_ifstream_wchar_vbase_dtor(this+i);
10883         MSVCRT_operator_delete(ptr);
10884     } else {
10885         basic_ifstream_wchar_vbase_dtor(this);
10886         if(flags & 1)
10887             MSVCRT_operator_delete(this);
10888     }
10889
10890     return this;
10891 }
10892
10893 /* ?close@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
10894 /* ?close@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
10895 /* ?close@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXXZ */
10896 /* ?close@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
10897 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_close, 4)
10898 void __thiscall basic_ifstream_wchar_close(basic_ifstream_wchar *this)
10899 {
10900     TRACE("(%p)\n", this);
10901
10902     if(!basic_filebuf_wchar_close(&this->filebuf)) {
10903         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10904         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10905     }
10906 }
10907
10908 /* ?is_open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QBE_NXZ */
10909 /* ?is_open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEBA_NXZ */
10910 /* ?is_open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QBE_NXZ */
10911 /* ?is_open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEBA_NXZ */
10912 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_is_open, 4)
10913 MSVCP_bool __thiscall basic_ifstream_wchar_is_open(const basic_ifstream_wchar *this)
10914 {
10915     TRACE("(%p)\n", this);
10916     return basic_filebuf_wchar_is_open(&this->filebuf);
10917 }
10918
10919 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXPBDHH@Z */
10920 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBDHH@Z */
10921 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXPBDHH@Z */
10922 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXPEBDHH@Z */
10923 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_open, 16)
10924 void __thiscall basic_ifstream_wchar_open(basic_ifstream_wchar *this,
10925         const char *name, int mode, int prot)
10926 {
10927     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
10928
10929     if(!basic_filebuf_wchar_open(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10930         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10931         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10932     }
10933 }
10934
10935 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXPBDI@Z */
10936 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBDI@Z */
10937 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXPBDI@Z */
10938 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXPEBDI@Z */
10939 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_open_old, 12)
10940 void __thiscall basic_ifstream_wchar_open_old(basic_ifstream_wchar *this,
10941         const char *name, unsigned int mode)
10942 {
10943     basic_ifstream_wchar_open(this, name, mode, _SH_DENYNO);
10944 }
10945
10946 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXPBGHH@Z */
10947 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBGHH@Z */
10948 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXPB_WHH@Z */
10949 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEB_WHH@Z */
10950 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXPBGHH@Z */
10951 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXPEBGHH@Z */
10952 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXPB_WHH@Z */
10953 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXPEB_WHH@Z */
10954 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_open_wchar, 16)
10955 void __thiscall basic_ifstream_wchar_open_wchar(basic_ifstream_wchar *this,
10956         const wchar_t *name, int mode, int prot)
10957 {
10958     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
10959
10960     if(!basic_filebuf_wchar_open_wchar(&this->filebuf, name, mode|OPENMODE_in, prot)) {
10961         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
10962         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
10963     }
10964 }
10965
10966 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXPBGI@Z */
10967 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBGI@Z */
10968 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QAEXPB_WI@Z */
10969 /* ?open@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEB_WI@Z */
10970 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXPBGI@Z */
10971 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXPEBGI@Z */
10972 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QAEXPB_WI@Z */
10973 /* ?open@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEAAXPEB_WI@Z */
10974 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_open_wchar_old, 12)
10975 void __thiscall basic_ifstream_wchar_open_wchar_old(basic_ifstream_wchar *this,
10976         const wchar_t *name, unsigned int mode)
10977 {
10978     basic_ifstream_wchar_open_wchar(this, name, mode, _SH_DENYNO);
10979 }
10980
10981 /* ?rdbuf@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QBEPAV?$basic_filebuf@_WU?$char_traits@_W@std@@@2@XZ */
10982 /* ?rdbuf@?$basic_ifstream@_WU?$char_traits@_W@std@@@std@@QEBAPEAV?$basic_filebuf@_WU?$char_traits@_W@std@@@2@XZ */
10983 /* ?rdbuf@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QBEPAV?$basic_filebuf@GU?$char_traits@G@std@@@2@XZ */
10984 /* ?rdbuf@?$basic_ifstream@GU?$char_traits@G@std@@@std@@QEBAPEAV?$basic_filebuf@GU?$char_traits@G@std@@@2@XZ */
10985 DEFINE_THISCALL_WRAPPER(basic_ifstream_wchar_rdbuf, 4)
10986 basic_filebuf_wchar* __thiscall basic_ifstream_wchar_rdbuf(const basic_ifstream_wchar *this)
10987 {
10988     TRACE("(%p)\n", this);
10989     return (basic_filebuf_wchar*)&this->filebuf;
10990 }
10991
10992 static inline basic_ios_char* basic_fstream_char_to_basic_ios(basic_fstream_char *ptr)
10993 {
10994     return (basic_ios_char*)((char*)ptr+basic_fstream_char_vbtable1[1]);
10995 }
10996
10997 static inline basic_fstream_char* basic_fstream_char_from_basic_ios(basic_ios_char *ptr)
10998 {
10999     return (basic_fstream_char*)((char*)ptr-basic_fstream_char_vbtable1[1]);
11000 }
11001
11002 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QAE@XZ */
11003 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAA@XZ */
11004 DEFINE_THISCALL_WRAPPER(basic_fstream_char_ctor, 8)
11005 basic_fstream_char* __thiscall basic_fstream_char_ctor(basic_fstream_char *this, MSVCP_bool virt_init)
11006 {
11007     basic_ios_char *basic_ios;
11008
11009     TRACE("(%p %d)\n", this, virt_init);
11010
11011     if(virt_init) {
11012         this->base.base1.vbtable = basic_fstream_char_vbtable1;
11013         this->base.base2.vbtable = basic_fstream_char_vbtable2;
11014         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11015         basic_ios_char_ctor(basic_ios);
11016     }else {
11017         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11018     }
11019
11020     basic_filebuf_char_ctor(&this->filebuf);
11021     basic_iostream_char_ctor(&this->base, &this->filebuf.base, FALSE);
11022     basic_ios->base.vtable = &MSVCP_basic_fstream_char_vtable;
11023     return this;
11024 }
11025
11026 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QAE@PAU_iobuf@@@Z */
11027 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAA@PEAU_iobuf@@@Z */
11028 DEFINE_THISCALL_WRAPPER(basic_fstream_char_ctor_file, 12)
11029 basic_fstream_char* __thiscall basic_fstream_char_ctor_file(basic_fstream_char *this,
11030         FILE *file, MSVCP_bool virt_init)
11031 {
11032     basic_ios_char *basic_ios;
11033
11034     TRACE("(%p %p %d)\n", this, file, virt_init);
11035
11036     if(virt_init) {
11037         this->base.base1.vbtable = basic_fstream_char_vbtable1;
11038         this->base.base2.vbtable = basic_fstream_char_vbtable2;
11039         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11040         basic_ios_char_ctor(basic_ios);
11041     }else {
11042         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11043     }
11044
11045     basic_filebuf_char_ctor_file(&this->filebuf, file);
11046     basic_iostream_char_ctor(&this->base, &this->filebuf.base, FALSE);
11047     basic_ios->base.vtable = &MSVCP_basic_fstream_char_vtable;
11048     return this;
11049 }
11050
11051 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QAE@PBDHH@Z */
11052 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAA@PEBDHH@Z */
11053 DEFINE_THISCALL_WRAPPER(basic_fstream_char_ctor_name, 20)
11054 basic_fstream_char* __thiscall basic_fstream_char_ctor_name(basic_fstream_char *this,
11055         const char *name, int mode, int prot, MSVCP_bool virt_init)
11056 {
11057     TRACE("(%p %s %d %d %d)\n", this, name, mode, prot, virt_init);
11058
11059     basic_fstream_char_ctor(this, virt_init);
11060
11061     if(!basic_filebuf_char_open(&this->filebuf, name, mode, prot)) {
11062         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11063         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
11064     }
11065     return this;
11066 }
11067
11068 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QAE@PBGHH@Z */
11069 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAA@PEBGHH@Z */
11070 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QAE@PB_WHH@Z */
11071 /* ??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAA@PEB_WHH@Z */
11072 DEFINE_THISCALL_WRAPPER(basic_fstream_char_ctor_name_wchar, 20)
11073 basic_fstream_char* __thiscall basic_fstream_char_ctor_name_wchar(basic_fstream_char *this,
11074         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
11075 {
11076     TRACE("(%p %s %d %d %d)\n", this, debugstr_w(name), mode, prot, virt_init);
11077
11078     basic_fstream_char_ctor(this, virt_init);
11079
11080     if(!basic_filebuf_char_open_wchar(&this->filebuf, name, mode, prot)) {
11081         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11082         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
11083     }
11084     return this;
11085 }
11086
11087 /* ??1?$basic_fstream@DU?$char_traits@D@std@@@std@@UAE@XZ */
11088 /* ??1?$basic_fstream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
11089 DEFINE_THISCALL_WRAPPER(basic_fstream_char_dtor, 4)
11090 void __thiscall basic_fstream_char_dtor(basic_ios_char *base)
11091 {
11092     basic_fstream_char *this = basic_fstream_char_from_basic_ios(base);
11093
11094     TRACE("(%p)\n", this);
11095
11096     basic_iostream_char_dtor(basic_iostream_char_to_basic_ios(&this->base));
11097     basic_filebuf_char_dtor(&this->filebuf);
11098 }
11099
11100 /* ??_D?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXXZ */
11101 /* ??_D?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
11102 DEFINE_THISCALL_WRAPPER(basic_fstream_char_vbase_dtor, 4)
11103 void __thiscall basic_fstream_char_vbase_dtor(basic_fstream_char *this)
11104 {
11105     TRACE("(%p)\n", this);
11106
11107     basic_fstream_char_dtor(basic_fstream_char_to_basic_ios(this));
11108     basic_ios_char_dtor(basic_istream_char_get_basic_ios(&this->base.base1));
11109 }
11110
11111 DEFINE_THISCALL_WRAPPER(basic_fstream_char_vector_dtor, 8)
11112 basic_fstream_char* __thiscall basic_fstream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
11113 {
11114     basic_fstream_char *this = basic_fstream_char_from_basic_ios(base);
11115
11116     TRACE("(%p %x)\n", this, flags);
11117
11118     if(flags & 2) {
11119         /* we have an array, with the number of elements stored before the first object */
11120         INT_PTR i, *ptr = (INT_PTR *)this-1;
11121
11122         for(i=*ptr-1; i>=0; i--)
11123             basic_fstream_char_vbase_dtor(this+i);
11124         MSVCRT_operator_delete(ptr);
11125     } else {
11126         basic_fstream_char_vbase_dtor(this);
11127         if(flags & 1)
11128             MSVCRT_operator_delete(this);
11129     }
11130
11131     return this;
11132 }
11133
11134 /* ?close@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXXZ */
11135 /* ?close@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
11136 DEFINE_THISCALL_WRAPPER(basic_fstream_char_close, 4)
11137 void __thiscall basic_fstream_char_close(basic_fstream_char *this)
11138 {
11139     TRACE("(%p)\n", this);
11140
11141     if(!basic_filebuf_char_close(&this->filebuf)) {
11142         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11143         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
11144     }
11145 }
11146
11147 /* ?is_open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QBE_NXZ */
11148 /* ?is_open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEBA_NXZ */
11149 DEFINE_THISCALL_WRAPPER(basic_fstream_char_is_open, 4)
11150 MSVCP_bool __thiscall basic_fstream_char_is_open(const basic_fstream_char *this)
11151 {
11152     TRACE("(%p)\n", this);
11153     return basic_filebuf_char_is_open(&this->filebuf);
11154 }
11155
11156 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPBDHH@Z */
11157 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXPEBDHH@Z */
11158 DEFINE_THISCALL_WRAPPER(basic_fstream_char_open, 16)
11159 void __thiscall basic_fstream_char_open(basic_fstream_char *this,
11160         const char *name, int mode, int prot)
11161 {
11162     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
11163
11164     if(!basic_filebuf_char_open(&this->filebuf, name, mode, prot)) {
11165         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11166         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
11167     }
11168 }
11169
11170 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPBDI@Z */
11171 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXPEBDI@Z */
11172 DEFINE_THISCALL_WRAPPER(basic_fstream_char_open_old, 12)
11173 void __thiscall basic_fstream_char_open_old(basic_fstream_char *this,
11174         const char *name, unsigned int mode)
11175 {
11176     basic_fstream_char_open(this, name, mode, _SH_DENYNO);
11177 }
11178
11179 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPBGHH@Z */
11180 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXPEBGHH@Z */
11181 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPB_WHH@Z */
11182 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXPEB_WHH@Z */
11183 DEFINE_THISCALL_WRAPPER(basic_fstream_char_open_wchar, 16)
11184 void __thiscall basic_fstream_char_open_wchar(basic_fstream_char *this,
11185         const wchar_t *name, int mode, int prot)
11186 {
11187     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
11188
11189     if(!basic_filebuf_char_open_wchar(&this->filebuf, name, mode, prot)) {
11190         basic_ios_char *basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
11191         basic_ios_char_setstate(basic_ios, IOSTATE_failbit);
11192     }
11193 }
11194
11195 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPBGI@Z */
11196 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXPEBGI@Z */
11197 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QAEXPB_WI@Z */
11198 /* ?open@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEAAXPEB_WI@Z */
11199 DEFINE_THISCALL_WRAPPER(basic_fstream_char_open_wchar_old, 12)
11200 void __thiscall basic_fstream_char_open_wchar_old(basic_fstream_char *this,
11201         const wchar_t *name, unsigned int mode)
11202 {
11203     basic_fstream_char_open_wchar(this, name, mode, _SH_DENYNO);
11204 }
11205
11206 /* ?rdbuf@?$basic_fstream@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_filebuf@DU?$char_traits@D@std@@@2@XZ */
11207 /* ?rdbuf@?$basic_fstream@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_filebuf@DU?$char_traits@D@std@@@2@XZ */
11208 DEFINE_THISCALL_WRAPPER(basic_fstream_char_rdbuf, 4)
11209 basic_filebuf_char* __thiscall basic_fstream_char_rdbuf(const basic_fstream_char *this)
11210 {
11211     TRACE("(%p)\n", this);
11212     return (basic_filebuf_char*)&this->filebuf;
11213 }
11214
11215 static inline basic_ios_wchar* basic_fstream_wchar_to_basic_ios(basic_fstream_wchar *ptr)
11216 {
11217     return (basic_ios_wchar*)((char*)ptr+basic_fstream_wchar_vbtable1[1]);
11218 }
11219
11220 static inline basic_fstream_wchar* basic_fstream_wchar_from_basic_ios(basic_ios_wchar *ptr)
11221 {
11222     return (basic_fstream_wchar*)((char*)ptr-basic_fstream_wchar_vbtable1[1]);
11223 }
11224
11225 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAE@XZ */
11226 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAA@XZ */
11227 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_ctor, 8)
11228 basic_fstream_wchar* __thiscall basic_fstream_wchar_ctor(basic_fstream_wchar *this, MSVCP_bool virt_init)
11229 {
11230     basic_ios_wchar *basic_ios;
11231
11232     TRACE("(%p %d)\n", this, virt_init);
11233
11234     if(virt_init) {
11235         this->base.base1.vbtable = basic_fstream_wchar_vbtable1;
11236         this->base.base2.vbtable = basic_fstream_wchar_vbtable2;
11237         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11238         basic_ios_wchar_ctor(basic_ios);
11239     }else {
11240         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11241     }
11242
11243     basic_filebuf_wchar_ctor(&this->filebuf);
11244     basic_iostream_wchar_ctor(&this->base, &this->filebuf.base, FALSE);
11245     basic_ios->base.vtable = &MSVCP_basic_fstream_wchar_vtable;
11246     return this;
11247 }
11248
11249 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QAE@XZ */
11250 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAA@XZ */
11251 DEFINE_THISCALL_WRAPPER(basic_fstream_short_ctor, 8)
11252 basic_fstream_wchar* __thiscall basic_fstream_short_ctor(basic_fstream_wchar *this, MSVCP_bool virt_init)
11253 {
11254     basic_fstream_wchar_ctor(this, virt_init);
11255     basic_istream_wchar_get_basic_ios(&this->base.base1)->base.vtable = &MSVCP_basic_fstream_short_vtable;
11256     return this;
11257 }
11258
11259 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAE@PAU_iobuf@@@Z */
11260 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAU_iobuf@@@Z */
11261 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_ctor_file, 12)
11262 basic_fstream_wchar* __thiscall basic_fstream_wchar_ctor_file(basic_fstream_wchar *this,
11263         FILE *file, MSVCP_bool virt_init)
11264 {
11265     basic_ios_wchar *basic_ios;
11266
11267     TRACE("(%p %p %d)\n", this, file, virt_init);
11268
11269     if(virt_init) {
11270         this->base.base1.vbtable = basic_fstream_wchar_vbtable1;
11271         this->base.base2.vbtable = basic_fstream_wchar_vbtable2;
11272         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11273         basic_ios_wchar_ctor(basic_ios);
11274     }else {
11275         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11276     }
11277
11278     basic_filebuf_wchar_ctor_file(&this->filebuf, file);
11279     basic_iostream_wchar_ctor(&this->base, &this->filebuf.base, FALSE);
11280     basic_ios->base.vtable = &MSVCP_basic_fstream_wchar_vtable;
11281     return this;
11282 }
11283
11284 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QAE@PAU_iobuf@@@Z */
11285 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAA@PEAU_iobuf@@@Z */
11286 DEFINE_THISCALL_WRAPPER(basic_fstream_short_ctor_file, 12)
11287 basic_fstream_wchar* __thiscall basic_fstream_short_ctor_file(basic_fstream_wchar *this,
11288         FILE *file, MSVCP_bool virt_init)
11289 {
11290     basic_fstream_wchar_ctor_file(this, file, virt_init);
11291     basic_istream_wchar_get_basic_ios(&this->base.base1)->base.vtable = &MSVCP_basic_fstream_short_vtable;
11292     return this;
11293 }
11294
11295 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAE@PB_WHH@Z */
11296 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEB_WHH@Z */
11297 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_ctor_name, 20)
11298 basic_fstream_wchar* __thiscall basic_fstream_wchar_ctor_name(basic_fstream_wchar *this,
11299         const char *name, int mode, int prot, MSVCP_bool virt_init)
11300 {
11301     TRACE("(%p %s %d %d %d)\n", this, name, mode, prot, virt_init);
11302
11303     basic_fstream_wchar_ctor(this, virt_init);
11304
11305     if(!basic_filebuf_wchar_open(&this->filebuf, name, mode, prot)) {
11306         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11307         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
11308     }
11309     return this;
11310 }
11311
11312 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QAE@PBGHH@Z */
11313 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAA@PEBGHH@Z */
11314 DEFINE_THISCALL_WRAPPER(basic_fstream_short_ctor_name, 20)
11315 basic_fstream_wchar* __thiscall basic_fstream_short_ctor_name(basic_fstream_wchar *this,
11316         const char *name, int mode, int prot, MSVCP_bool virt_init)
11317 {
11318     basic_fstream_wchar_ctor_name(this, name, mode, prot, virt_init);
11319     basic_istream_wchar_get_basic_ios(&this->base.base1)->base.vtable = &MSVCP_basic_fstream_short_vtable;
11320     return this;
11321 }
11322
11323 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAE@PBGHH@Z */
11324 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEBGHH@Z */
11325 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAE@PB_WHH@Z */
11326 /* ??0?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAA@PEB_WHH@Z */
11327 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_ctor_name_wchar, 20)
11328 basic_fstream_wchar* __thiscall basic_fstream_wchar_ctor_name_wchar(basic_fstream_wchar *this,
11329         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
11330 {
11331     TRACE("(%p %s %d %d %d)\n", this, debugstr_w(name), mode, prot, virt_init);
11332
11333     basic_fstream_wchar_ctor(this, virt_init);
11334
11335     if(!basic_filebuf_wchar_open_wchar(&this->filebuf, name, mode, prot)) {
11336         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11337         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
11338     }
11339     return this;
11340 }
11341
11342 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QAE@PBGHH@Z */
11343 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAA@PEBGHH@Z */
11344 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QAE@PB_WHH@Z */
11345 /* ??0?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAA@PEB_WHH@Z */
11346 DEFINE_THISCALL_WRAPPER(basic_fstream_short_ctor_name_wchar, 20)
11347 basic_fstream_wchar* __thiscall basic_fstream_short_ctor_name_wchar(basic_fstream_wchar *this,
11348         const wchar_t *name, int mode, int prot, MSVCP_bool virt_init)
11349 {
11350     basic_fstream_wchar_ctor_name_wchar(this, name, mode, prot, virt_init);
11351     basic_istream_wchar_get_basic_ios(&this->base.base1)->base.vtable = &MSVCP_basic_fstream_short_vtable;
11352     return this;
11353 }
11354
11355 /* ??1?$basic_fstream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
11356 /* ??1?$basic_fstream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
11357 /* ??1?$basic_fstream@GU?$char_traits@G@std@@@std@@UAE@XZ */
11358 /* ??1?$basic_fstream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
11359 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_dtor, 4)
11360 void __thiscall basic_fstream_wchar_dtor(basic_ios_wchar *base)
11361 {
11362     basic_fstream_wchar *this = basic_fstream_wchar_from_basic_ios(base);
11363
11364     TRACE("(%p)\n", this);
11365
11366     basic_iostream_wchar_dtor(basic_iostream_wchar_to_basic_ios(&this->base));
11367     basic_filebuf_wchar_dtor(&this->filebuf);
11368 }
11369
11370 /* ??_D?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
11371 /* ??_D?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
11372 /* ??_D?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXXZ */
11373 /* ??_D?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
11374 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_vbase_dtor, 4)
11375 void __thiscall basic_fstream_wchar_vbase_dtor(basic_fstream_wchar *this)
11376 {
11377     TRACE("(%p)\n", this);
11378
11379     basic_fstream_wchar_dtor(basic_fstream_wchar_to_basic_ios(this));
11380     basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(&this->base.base1));
11381 }
11382
11383 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_vector_dtor, 8)
11384 basic_fstream_wchar* __thiscall basic_fstream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
11385 {
11386     basic_fstream_wchar *this = basic_fstream_wchar_from_basic_ios(base);
11387
11388     TRACE("(%p %x)\n", this, flags);
11389
11390     if(flags & 2) {
11391         /* we have an array, with the number of elements stored before the first object */
11392         INT_PTR i, *ptr = (INT_PTR *)this-1;
11393
11394         for(i=*ptr-1; i>=0; i--)
11395             basic_fstream_wchar_vbase_dtor(this+i);
11396         MSVCRT_operator_delete(ptr);
11397     } else {
11398         basic_fstream_wchar_vbase_dtor(this);
11399         if(flags & 1)
11400             MSVCRT_operator_delete(this);
11401     }
11402
11403     return this;
11404 }
11405
11406 /* ?close@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
11407 /* ?close@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
11408 /* ?close@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXXZ */
11409 /* ?close@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
11410 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_close, 4)
11411 void __thiscall basic_fstream_wchar_close(basic_fstream_wchar *this)
11412 {
11413     TRACE("(%p)\n", this);
11414
11415     if(!basic_filebuf_wchar_close(&this->filebuf)) {
11416         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11417         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
11418     }
11419 }
11420
11421 /* ?is_open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QBE_NXZ */
11422 /* ?is_open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEBA_NXZ */
11423 /* ?is_open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QBE_NXZ */
11424 /* ?is_open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEBA_NXZ */
11425 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_is_open, 4)
11426 MSVCP_bool __thiscall basic_fstream_wchar_is_open(const basic_fstream_wchar *this)
11427 {
11428     TRACE("(%p)\n", this);
11429     return basic_filebuf_wchar_is_open(&this->filebuf);
11430 }
11431
11432 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXPBDHH@Z */
11433 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBDHH@Z */
11434 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXPBDHH@Z */
11435 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXPEBDHH@Z */
11436 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_open, 16)
11437 void __thiscall basic_fstream_wchar_open(basic_fstream_wchar *this,
11438         const char *name, int mode, int prot)
11439 {
11440     TRACE("(%p %s %d %d)\n", this, name, mode, prot);
11441
11442     if(!basic_filebuf_wchar_open(&this->filebuf, name, mode, prot)) {
11443         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11444         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
11445     }
11446 }
11447
11448 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXPBDI@Z */
11449 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBDI@Z */
11450 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXPBDI@Z */
11451 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXPEBDI@Z */
11452 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_open_old, 12)
11453 void __thiscall basic_fstream_wchar_open_old(basic_fstream_wchar *this,
11454         const char *name, unsigned int mode)
11455 {
11456     basic_fstream_wchar_open(this, name, mode, _SH_DENYNO);
11457 }
11458
11459 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXPBGHH@Z */
11460 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBGHH@Z */
11461 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXPB_WHH@Z */
11462 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEB_WHH@Z */
11463 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXPBGHH@Z */
11464 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXPEBGHH@Z */
11465 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXPB_WHH@Z */
11466 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXPEB_WHH@Z */
11467 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_open_wchar, 16)
11468 void __thiscall basic_fstream_wchar_open_wchar(basic_fstream_wchar *this,
11469         const wchar_t *name, int mode, int prot)
11470 {
11471     TRACE("(%p %s %d %d)\n", this, debugstr_w(name), mode, prot);
11472
11473     if(!basic_filebuf_wchar_open_wchar(&this->filebuf, name, mode, prot)) {
11474         basic_ios_wchar *basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
11475         basic_ios_wchar_setstate(basic_ios, IOSTATE_failbit);
11476     }
11477 }
11478
11479 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXPBGI@Z */
11480 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEBGI@Z */
11481 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QAEXPB_WI@Z */
11482 /* ?open@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEAAXPEB_WI@Z */
11483 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXPBGI@Z */
11484 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXPEBGI@Z */
11485 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QAEXPB_WI@Z */
11486 /* ?open@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEAAXPEB_WI@Z */
11487 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_open_wchar_old, 12)
11488 void __thiscall basic_fstream_wchar_open_wchar_old(basic_fstream_wchar *this,
11489         const wchar_t *name, unsigned int mode)
11490 {
11491     basic_fstream_wchar_open_wchar(this, name, mode, _SH_DENYNO);
11492 }
11493
11494 /* ?rdbuf@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QBEPAV?$basic_filebuf@_WU?$char_traits@_W@std@@@2@XZ */
11495 /* ?rdbuf@?$basic_fstream@_WU?$char_traits@_W@std@@@std@@QEBAPEAV?$basic_filebuf@_WU?$char_traits@_W@std@@@2@XZ */
11496 /* ?rdbuf@?$basic_fstream@GU?$char_traits@G@std@@@std@@QBEPAV?$basic_filebuf@GU?$char_traits@G@std@@@2@XZ */
11497 /* ?rdbuf@?$basic_fstream@GU?$char_traits@G@std@@@std@@QEBAPEAV?$basic_filebuf@GU?$char_traits@G@std@@@2@XZ */
11498 DEFINE_THISCALL_WRAPPER(basic_fstream_wchar_rdbuf, 4)
11499 basic_filebuf_wchar* __thiscall basic_fstream_wchar_rdbuf(const basic_fstream_wchar *this)
11500 {
11501     TRACE("(%p)\n", this);
11502     return (basic_filebuf_wchar*)&this->filebuf;
11503 }
11504
11505 static inline basic_ios_char* basic_ostringstream_char_to_basic_ios(basic_ostringstream_char *ptr)
11506 {
11507     return (basic_ios_char*)((char*)ptr+basic_ostringstream_char_vbtable[1]);
11508 }
11509
11510 static inline basic_ostringstream_char* basic_ostringstream_char_from_basic_ios(basic_ios_char *ptr)
11511 {
11512     return (basic_ostringstream_char*)((char*)ptr-basic_ostringstream_char_vbtable[1]);
11513 }
11514
11515 /* ??0?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@H@Z */
11516 /* ??0?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@H@Z */
11517 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_ctor_str, 16)
11518 basic_ostringstream_char* __thiscall basic_ostringstream_char_ctor_str(basic_ostringstream_char *this,
11519         const basic_string_char *str, int mode, MSVCP_bool virt_init)
11520 {
11521     basic_ios_char *basic_ios;
11522
11523     TRACE("(%p %p %d %d)\n", this, str, mode, virt_init);
11524
11525     if(virt_init) {
11526         this->base.vbtable = basic_ostringstream_char_vbtable;
11527         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
11528         basic_ios_char_ctor(basic_ios);
11529     }else {
11530         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
11531     }
11532
11533     basic_stringbuf_char_ctor_str(&this->strbuf, str, mode|OPENMODE_out);
11534     basic_ostream_char_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11535     basic_ios->base.vtable = &MSVCP_basic_ostringstream_char_vtable;
11536     return this;
11537 }
11538
11539 /* ??0?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z */
11540 /* ??0?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@H@Z */
11541 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_ctor_mode, 12)
11542 basic_ostringstream_char* __thiscall basic_ostringstream_char_ctor_mode(
11543         basic_ostringstream_char *this, int mode, MSVCP_bool virt_init)
11544 {
11545     basic_ios_char *basic_ios;
11546
11547     TRACE("(%p %d %d)\n", this, mode, virt_init);
11548
11549     if(virt_init) {
11550         this->base.vbtable = basic_ostringstream_char_vbtable;
11551         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
11552         basic_ios_char_ctor(basic_ios);
11553     }else {
11554         basic_ios = basic_ostream_char_get_basic_ios(&this->base);
11555     }
11556
11557     basic_stringbuf_char_ctor_mode(&this->strbuf, mode|OPENMODE_out);
11558     basic_ostream_char_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11559     basic_ios->base.vtable = &MSVCP_basic_ostringstream_char_vtable;
11560     return this;
11561 }
11562
11563 /* ??_F?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
11564 /* ??_F?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
11565 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_ctor, 8)
11566 basic_ostringstream_char* __thiscall basic_ostringstream_char_ctor(
11567         basic_ostringstream_char *this, MSVCP_bool virt_init)
11568 {
11569     return basic_ostringstream_char_ctor_mode(this, 0, virt_init);
11570 }
11571
11572 /* ??1?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UAE@XZ */
11573 /* ??1?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UEAA@XZ */
11574 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_dtor, 4)
11575 void __thiscall basic_ostringstream_char_dtor(basic_ios_char *base)
11576 {
11577     basic_ostringstream_char *this = basic_ostringstream_char_from_basic_ios(base);
11578
11579     TRACE("(%p)\n", this);
11580
11581     basic_stringbuf_char_dtor(&this->strbuf);
11582     basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(&this->base));
11583 }
11584
11585 /* ??_D?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
11586 /* ??_D?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
11587 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_vbase_dtor, 4)
11588 void __thiscall basic_ostringstream_char_vbase_dtor(basic_ostringstream_char *this)
11589 {
11590     TRACE("(%p)\n", this);
11591
11592     basic_ostringstream_char_dtor(basic_ostringstream_char_to_basic_ios(this));
11593     basic_ios_char_dtor(basic_ostream_char_get_basic_ios(&this->base));
11594 }
11595
11596 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_vector_dtor, 8)
11597 basic_ostringstream_char* __thiscall basic_ostringstream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
11598 {
11599     basic_ostringstream_char *this = basic_ostringstream_char_from_basic_ios(base);
11600
11601     TRACE("(%p %x)\n", this, flags);
11602
11603     if(flags & 2) {
11604         /* we have an array, with the number of elements stored before the first object */
11605         INT_PTR i, *ptr = (INT_PTR *)this-1;
11606
11607         for(i=*ptr-1; i>=0; i--)
11608             basic_ostringstream_char_vbase_dtor(this+i);
11609         MSVCRT_operator_delete(ptr);
11610     } else {
11611         basic_ostringstream_char_vbase_dtor(this);
11612         if(flags & 1)
11613             MSVCRT_operator_delete(this);
11614     }
11615
11616     return this;
11617 }
11618
11619 /* ?rdbuf@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPAV?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
11620 /* ?rdbuf@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBAPEAV?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
11621 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_rdbuf, 4)
11622 basic_stringbuf_char* __thiscall basic_ostringstream_char_rdbuf(const basic_ostringstream_char *this)
11623 {
11624     TRACE("(%p)\n", this);
11625     return (basic_stringbuf_char*)&this->strbuf;
11626 }
11627
11628 /* ?str@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
11629 /* ?str@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
11630 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_str_set, 8)
11631 void __thiscall basic_ostringstream_char_str_set(basic_ostringstream_char *this, const basic_string_char *str)
11632 {
11633     TRACE("(%p %p)\n", this, str);
11634     basic_stringbuf_char_str_set(&this->strbuf, str);
11635 }
11636
11637 /* ?str@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
11638 /* ?str@?$basic_ostringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
11639 DEFINE_THISCALL_WRAPPER(basic_ostringstream_char_str_get, 8)
11640 basic_string_char* __thiscall basic_ostringstream_char_str_get(const basic_ostringstream_char *this, basic_string_char *ret)
11641 {
11642     TRACE("(%p %p)\n", this, ret);
11643     return basic_stringbuf_char_str_get(&this->strbuf, ret);
11644 }
11645
11646 static inline basic_ios_wchar* basic_ostringstream_wchar_to_basic_ios(basic_ostringstream_wchar *ptr)
11647 {
11648     return (basic_ios_wchar*)((char*)ptr+basic_ostringstream_wchar_vbtable[1]);
11649 }
11650
11651 static inline basic_ostringstream_wchar* basic_ostringstream_wchar_from_basic_ios(basic_ios_wchar *ptr)
11652 {
11653     return (basic_ostringstream_wchar*)((char*)ptr-basic_ostringstream_wchar_vbtable[1]);
11654 }
11655
11656 /* ??0?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@1@H@Z */
11657 /* ??0?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@AEBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@1@H@Z */
11658 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_ctor_str, 16)
11659 basic_ostringstream_wchar* __thiscall basic_ostringstream_wchar_ctor_str(basic_ostringstream_wchar *this,
11660         const basic_string_wchar *str, int mode, MSVCP_bool virt_init)
11661 {
11662     basic_ios_wchar *basic_ios;
11663
11664     TRACE("(%p %p %d %d)\n", this, str, mode, virt_init);
11665
11666     if(virt_init) {
11667         this->base.vbtable = basic_ostringstream_wchar_vbtable;
11668         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
11669         basic_ios_wchar_ctor(basic_ios);
11670     }else {
11671         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
11672     }
11673
11674     basic_stringbuf_wchar_ctor_str(&this->strbuf, str, mode|OPENMODE_out);
11675     basic_ostream_wchar_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11676     basic_ios->base.vtable = &MSVCP_basic_ostringstream_wchar_vtable;
11677     return this;
11678 }
11679
11680 /* ??0?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@1@H@Z */
11681 /* ??0?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@AEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@1@H@Z */
11682 DEFINE_THISCALL_WRAPPER(basic_ostringstream_short_ctor_str, 16)
11683 basic_ostringstream_wchar* __thiscall basic_ostringstream_short_ctor_str(basic_ostringstream_wchar *this,
11684         const basic_string_wchar *str, int mode, MSVCP_bool virt_init)
11685 {
11686     basic_ostringstream_wchar_ctor_str(this, str, mode, virt_init);
11687     basic_ostream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ostringstream_short_vtable;
11688     return this;
11689 }
11690
11691 /* ??0?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@H@Z */
11692 /* ??0?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@H@Z */
11693 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_ctor_mode, 12)
11694 basic_ostringstream_wchar* __thiscall basic_ostringstream_wchar_ctor_mode(
11695         basic_ostringstream_wchar *this, int mode, MSVCP_bool virt_init)
11696 {
11697     basic_ios_wchar *basic_ios;
11698
11699     TRACE("(%p %d %d)\n", this, mode, virt_init);
11700
11701     if(virt_init) {
11702         this->base.vbtable = basic_ostringstream_wchar_vbtable;
11703         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
11704         basic_ios_wchar_ctor(basic_ios);
11705     }else {
11706         basic_ios = basic_ostream_wchar_get_basic_ios(&this->base);
11707     }
11708
11709     basic_stringbuf_wchar_ctor_mode(&this->strbuf, mode|OPENMODE_out);
11710     basic_ostream_wchar_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11711     basic_ios->base.vtable = &MSVCP_basic_ostringstream_wchar_vtable;
11712     return this;
11713 }
11714
11715 /* ??0?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@H@Z */
11716 /* ??0?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@H@Z */
11717 DEFINE_THISCALL_WRAPPER(basic_ostringstream_short_ctor_mode, 12)
11718 basic_ostringstream_wchar* __thiscall basic_ostringstream_short_ctor_mode(
11719         basic_ostringstream_wchar *this, int mode, MSVCP_bool virt_init)
11720 {
11721     basic_ostringstream_wchar_ctor_mode(this, mode, virt_init);
11722     basic_ostream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_ostringstream_short_vtable;
11723     return this;
11724 }
11725
11726 /* ??_F?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
11727 /* ??_F?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
11728 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_ctor, 8)
11729 basic_ostringstream_wchar* __thiscall basic_ostringstream_wchar_ctor(
11730         basic_ostringstream_wchar *this, MSVCP_bool virt_init)
11731 {
11732     return basic_ostringstream_wchar_ctor_mode(this, 0, virt_init);
11733 }
11734
11735 /* ??_F?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
11736 /* ??_F?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
11737 DEFINE_THISCALL_WRAPPER(basic_ostringstream_short_ctor, 8)
11738 basic_ostringstream_wchar* __thiscall basic_ostringstream_short_ctor(
11739         basic_ostringstream_wchar *this, MSVCP_bool virt_init)
11740 {
11741     return basic_ostringstream_short_ctor_mode(this, 0, virt_init);
11742 }
11743
11744 /* ??1?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UAE@XZ */
11745 /* ??1?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UEAA@XZ */
11746 /* ??1?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UAE@XZ */
11747 /* ??1?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UEAA@XZ */
11748 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_dtor, 4)
11749 void __thiscall basic_ostringstream_wchar_dtor(basic_ios_wchar *base)
11750 {
11751     basic_ostringstream_wchar *this = basic_ostringstream_wchar_from_basic_ios(base);
11752
11753     TRACE("(%p)\n", this);
11754
11755     basic_stringbuf_wchar_dtor(&this->strbuf);
11756     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&this->base));
11757 }
11758
11759 /* ??_D?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
11760 /* ??_D?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
11761 /* ??_D?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
11762 /* ??_D?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
11763 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_vbase_dtor, 4)
11764 void __thiscall basic_ostringstream_wchar_vbase_dtor(basic_ostringstream_wchar *this)
11765 {
11766     TRACE("(%p)\n", this);
11767
11768     basic_ostringstream_wchar_dtor(basic_ostringstream_wchar_to_basic_ios(this));
11769     basic_ios_wchar_dtor(basic_ostream_wchar_get_basic_ios(&this->base));
11770 }
11771
11772 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_vector_dtor, 8)
11773 basic_ostringstream_wchar* __thiscall basic_ostringstream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
11774 {
11775     basic_ostringstream_wchar *this = basic_ostringstream_wchar_from_basic_ios(base);
11776
11777     TRACE("(%p %x)\n", this, flags);
11778
11779     if(flags & 2) {
11780         /* we have an array, with the number of elements stored before the first object */
11781         INT_PTR i, *ptr = (INT_PTR *)this-1;
11782
11783         for(i=*ptr-1; i>=0; i--)
11784             basic_ostringstream_wchar_vbase_dtor(this+i);
11785         MSVCRT_operator_delete(ptr);
11786     } else {
11787         basic_ostringstream_wchar_vbase_dtor(this);
11788         if(flags & 1)
11789             MSVCRT_operator_delete(this);
11790     }
11791
11792     return this;
11793 }
11794
11795 /* ?rdbuf@?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBEPAV?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
11796 /* ?rdbuf@?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEBAPEAV?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
11797 /* ?rdbuf@?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEPAV?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
11798 /* ?rdbuf@?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBAPEAV?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
11799 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_rdbuf, 4)
11800 basic_stringbuf_wchar* __thiscall basic_ostringstream_wchar_rdbuf(const basic_ostringstream_wchar *this)
11801 {
11802     TRACE("(%p)\n", this);
11803     return (basic_stringbuf_wchar*)&this->strbuf;
11804 }
11805
11806 /* ?str@?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@@Z */
11807 /* ?str@?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXAEBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@@Z */
11808 /* ?str@?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z */
11809 /* ?str@?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z */
11810 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_str_set, 8)
11811 void __thiscall basic_ostringstream_wchar_str_set(basic_ostringstream_wchar *this, const basic_string_wchar *str)
11812 {
11813     TRACE("(%p %p)\n", this, str);
11814     basic_stringbuf_wchar_str_set(&this->strbuf, str);
11815 }
11816
11817 /* ?str@?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
11818 /* ?str@?$basic_ostringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
11819 /* ?str@?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
11820 /* ?str@?$basic_ostringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
11821 DEFINE_THISCALL_WRAPPER(basic_ostringstream_wchar_str_get, 8)
11822 basic_string_wchar* __thiscall basic_ostringstream_wchar_str_get(const basic_ostringstream_wchar *this, basic_string_wchar *ret)
11823 {
11824     TRACE("(%p %p)\n", this, ret);
11825     return basic_stringbuf_wchar_str_get(&this->strbuf, ret);
11826 }
11827
11828 static inline basic_ios_char* basic_istringstream_char_to_basic_ios(basic_istringstream_char *ptr)
11829 {
11830     return (basic_ios_char*)((char*)ptr+basic_istringstream_char_vbtable[1]);
11831 }
11832
11833 static inline basic_istringstream_char* basic_istringstream_char_from_basic_ios(basic_ios_char *ptr)
11834 {
11835     return (basic_istringstream_char*)((char*)ptr-basic_istringstream_char_vbtable[1]);
11836 }
11837
11838 /* ??0?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@H@Z */
11839 /* ??0?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@H@Z */
11840 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_ctor_str, 16)
11841 basic_istringstream_char* __thiscall basic_istringstream_char_ctor_str(basic_istringstream_char *this,
11842         const basic_string_char *str, int mode, MSVCP_bool virt_init)
11843 {
11844     basic_ios_char *basic_ios;
11845
11846     TRACE("(%p %p %d %d)\n", this, str, mode, virt_init);
11847
11848     if(virt_init) {
11849         this->base.vbtable = basic_istringstream_char_vbtable;
11850         basic_ios = basic_istream_char_get_basic_ios(&this->base);
11851         basic_ios_char_ctor(basic_ios);
11852     }else {
11853         basic_ios = basic_istream_char_get_basic_ios(&this->base);
11854     }
11855
11856     basic_stringbuf_char_ctor_str(&this->strbuf, str, mode|OPENMODE_in);
11857     basic_istream_char_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11858     basic_ios->base.vtable = &MSVCP_basic_istringstream_char_vtable;
11859     return this;
11860 }
11861
11862 /* ??0?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z */
11863 /* ??0?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@H@Z */
11864 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_ctor_mode, 12)
11865 basic_istringstream_char* __thiscall basic_istringstream_char_ctor_mode(
11866         basic_istringstream_char *this, int mode, MSVCP_bool virt_init)
11867 {
11868     basic_ios_char *basic_ios;
11869
11870     TRACE("(%p %d %d)\n", this, mode, virt_init);
11871
11872     if(virt_init) {
11873         this->base.vbtable = basic_istringstream_char_vbtable;
11874         basic_ios = basic_istream_char_get_basic_ios(&this->base);
11875         basic_ios_char_ctor(basic_ios);
11876     }else {
11877         basic_ios = basic_istream_char_get_basic_ios(&this->base);
11878     }
11879
11880     basic_stringbuf_char_ctor_mode(&this->strbuf, mode|OPENMODE_in);
11881     basic_istream_char_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11882     basic_ios->base.vtable = &MSVCP_basic_istringstream_char_vtable;
11883     return this;
11884 }
11885
11886 /* ??_F?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
11887 /* ??_F?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
11888 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_ctor, 8)
11889 basic_istringstream_char* __thiscall basic_istringstream_char_ctor(
11890         basic_istringstream_char *this, MSVCP_bool virt_init)
11891 {
11892     return basic_istringstream_char_ctor_mode(this, 0, virt_init);
11893 }
11894
11895 /* ??1?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UAE@XZ */
11896 /* ??1?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UEAA@XZ */
11897 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_dtor, 4)
11898 void __thiscall basic_istringstream_char_dtor(basic_ios_char *base)
11899 {
11900     basic_istringstream_char *this = basic_istringstream_char_from_basic_ios(base);
11901
11902     TRACE("(%p)\n", this);
11903
11904     basic_stringbuf_char_dtor(&this->strbuf);
11905     basic_istream_char_dtor(basic_istream_char_to_basic_ios(&this->base));
11906 }
11907
11908 /* ??_D?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
11909 /* ??_D?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
11910 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_vbase_dtor, 4)
11911 void __thiscall basic_istringstream_char_vbase_dtor(basic_istringstream_char *this)
11912 {
11913     TRACE("(%p)\n", this);
11914
11915     basic_istringstream_char_dtor(basic_istringstream_char_to_basic_ios(this));
11916     basic_ios_char_dtor(basic_istream_char_get_basic_ios(&this->base));
11917 }
11918
11919 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_vector_dtor, 8)
11920 basic_istringstream_char* __thiscall basic_istringstream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
11921 {
11922     basic_istringstream_char *this = basic_istringstream_char_from_basic_ios(base);
11923
11924     TRACE("(%p %x)\n", this, flags);
11925
11926     if(flags & 2) {
11927         /* we have an array, with the number of elements stored before the first object */
11928         INT_PTR i, *ptr = (INT_PTR *)this-1;
11929
11930         for(i=*ptr-1; i>=0; i--)
11931             basic_istringstream_char_vbase_dtor(this+i);
11932         MSVCRT_operator_delete(ptr);
11933     } else {
11934         basic_istringstream_char_vbase_dtor(this);
11935         if(flags & 1)
11936             MSVCRT_operator_delete(this);
11937     }
11938
11939     return this;
11940 }
11941
11942 /* ?rdbuf@?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPAV?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
11943 /* ?rdbuf@?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBAPEAV?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
11944 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_rdbuf, 4)
11945 basic_stringbuf_char* __thiscall basic_istringstream_char_rdbuf(const basic_istringstream_char *this)
11946 {
11947     TRACE("(%p)\n", this);
11948     return (basic_stringbuf_char*)&this->strbuf;
11949 }
11950
11951 /* ?str@?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
11952 /* ?str@?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
11953 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_str_set, 8)
11954 void __thiscall basic_istringstream_char_str_set(basic_istringstream_char *this, const basic_string_char *str)
11955 {
11956     TRACE("(%p %p)\n", this, str);
11957     basic_stringbuf_char_str_set(&this->strbuf, str);
11958 }
11959
11960 /* ?str@?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
11961 /* ?str@?$basic_istringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
11962 DEFINE_THISCALL_WRAPPER(basic_istringstream_char_str_get, 8)
11963 basic_string_char* __thiscall basic_istringstream_char_str_get(const basic_istringstream_char *this, basic_string_char *ret)
11964 {
11965     TRACE("(%p %p)\n", this, ret);
11966     return basic_stringbuf_char_str_get(&this->strbuf, ret);
11967 }
11968
11969 static inline basic_ios_wchar* basic_istringstream_wchar_to_basic_ios(basic_istringstream_wchar *ptr)
11970 {
11971     return (basic_ios_wchar*)((char*)ptr+basic_istringstream_wchar_vbtable[1]);
11972 }
11973
11974 static inline basic_istringstream_wchar* basic_istringstream_wchar_from_basic_ios(basic_ios_wchar *ptr)
11975 {
11976     return (basic_istringstream_wchar*)((char*)ptr-basic_istringstream_wchar_vbtable[1]);
11977 }
11978
11979 /* ??0?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@1@H@Z */
11980 /* ??0?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@AEBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@1@H@Z */
11981 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_ctor_str, 16)
11982 basic_istringstream_wchar* __thiscall basic_istringstream_wchar_ctor_str(basic_istringstream_wchar *this,
11983         const basic_string_wchar *str, int mode, MSVCP_bool virt_init)
11984 {
11985     basic_ios_wchar *basic_ios;
11986
11987     TRACE("(%p %p %d %d)\n", this, str, mode, virt_init);
11988
11989     if(virt_init) {
11990         this->base.vbtable = basic_istringstream_wchar_vbtable;
11991         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
11992         basic_ios_wchar_ctor(basic_ios);
11993     }else {
11994         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
11995     }
11996
11997     basic_stringbuf_wchar_ctor_str(&this->strbuf, str, mode|OPENMODE_in);
11998     basic_istream_wchar_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
11999     basic_ios->base.vtable = &MSVCP_basic_istringstream_wchar_vtable;
12000     return this;
12001 }
12002
12003 /* ??0?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@1@H@Z */
12004 /* ??0?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@AEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@1@H@Z */
12005 DEFINE_THISCALL_WRAPPER(basic_istringstream_short_ctor_str, 16)
12006 basic_istringstream_wchar* __thiscall basic_istringstream_short_ctor_str(basic_istringstream_wchar *this,
12007         const basic_string_wchar *str, int mode, MSVCP_bool virt_init)
12008 {
12009     basic_istringstream_wchar_ctor_str(this, str, mode, virt_init);
12010     basic_istream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_istringstream_short_vtable;
12011     return this;
12012 }
12013
12014 /* ??0?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@H@Z */
12015 /* ??0?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@H@Z */
12016 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_ctor_mode, 12)
12017 basic_istringstream_wchar* __thiscall basic_istringstream_wchar_ctor_mode(
12018         basic_istringstream_wchar *this, int mode, MSVCP_bool virt_init)
12019 {
12020     basic_ios_wchar *basic_ios;
12021
12022     TRACE("(%p %d %d)\n", this, mode, virt_init);
12023
12024     if(virt_init) {
12025         this->base.vbtable = basic_istringstream_wchar_vbtable;
12026         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
12027         basic_ios_wchar_ctor(basic_ios);
12028     }else {
12029         basic_ios = basic_istream_wchar_get_basic_ios(&this->base);
12030     }
12031
12032     basic_stringbuf_wchar_ctor_mode(&this->strbuf, mode|OPENMODE_in);
12033     basic_istream_wchar_ctor(&this->base, &this->strbuf.base, FALSE, FALSE);
12034     basic_ios->base.vtable = &MSVCP_basic_istringstream_wchar_vtable;
12035     return this;
12036 }
12037
12038 /* ??0?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@H@Z */
12039 /* ??0?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@H@Z */
12040 DEFINE_THISCALL_WRAPPER(basic_istringstream_short_ctor_mode, 12)
12041 basic_istringstream_wchar* __thiscall basic_istringstream_short_ctor_mode(
12042         basic_istringstream_wchar *this, int mode, MSVCP_bool virt_init)
12043 {
12044     basic_istringstream_wchar_ctor_mode(this, mode, virt_init);
12045     basic_istream_wchar_get_basic_ios(&this->base)->base.vtable = &MSVCP_basic_istringstream_short_vtable;
12046     return this;
12047 }
12048
12049 /* ??_F?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
12050 /* ??_F?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
12051 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_ctor, 8)
12052 basic_istringstream_wchar* __thiscall basic_istringstream_wchar_ctor(
12053         basic_istringstream_wchar *this, MSVCP_bool virt_init)
12054 {
12055     return basic_istringstream_wchar_ctor_mode(this, 0, virt_init);
12056 }
12057
12058 /* ??_F?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
12059 /* ??_F?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
12060 DEFINE_THISCALL_WRAPPER(basic_istringstream_short_ctor, 8)
12061 basic_istringstream_wchar* __thiscall basic_istringstream_short_ctor(
12062         basic_istringstream_wchar *this, MSVCP_bool virt_init)
12063 {
12064     return basic_istringstream_short_ctor_mode(this, 0, virt_init);
12065 }
12066
12067 /* ??1?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UAE@XZ */
12068 /* ??1?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UEAA@XZ */
12069 /* ??1?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UAE@XZ */
12070 /* ??1?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UEAA@XZ */
12071 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_dtor, 4)
12072 void __thiscall basic_istringstream_wchar_dtor(basic_ios_wchar *base)
12073 {
12074     basic_istringstream_wchar *this = basic_istringstream_wchar_from_basic_ios(base);
12075
12076     TRACE("(%p)\n", this);
12077
12078     basic_stringbuf_wchar_dtor(&this->strbuf);
12079     basic_istream_wchar_dtor(basic_istream_wchar_to_basic_ios(&this->base));
12080 }
12081
12082 /* ??_D?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
12083 /* ??_D?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
12084 /* ??_D?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
12085 /* ??_D?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
12086 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_vbase_dtor, 4)
12087 void __thiscall basic_istringstream_wchar_vbase_dtor(basic_istringstream_wchar *this)
12088 {
12089     TRACE("(%p)\n", this);
12090
12091     basic_istringstream_wchar_dtor(basic_istringstream_wchar_to_basic_ios(this));
12092     basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(&this->base));
12093 }
12094
12095 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_vector_dtor, 8)
12096 basic_istringstream_wchar* __thiscall basic_istringstream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
12097 {
12098     basic_istringstream_wchar *this = basic_istringstream_wchar_from_basic_ios(base);
12099
12100     TRACE("(%p %x)\n", this, flags);
12101
12102     if(flags & 2) {
12103         /* we have an array, with the number of elements stored before the first object */
12104         INT_PTR i, *ptr = (INT_PTR *)this-1;
12105
12106         for(i=*ptr-1; i>=0; i--)
12107             basic_istringstream_wchar_vbase_dtor(this+i);
12108         MSVCRT_operator_delete(ptr);
12109     } else {
12110         basic_istringstream_wchar_vbase_dtor(this);
12111         if(flags & 1)
12112             MSVCRT_operator_delete(this);
12113     }
12114
12115     return this;
12116 }
12117
12118 /* ?rdbuf@?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBEPAV?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
12119 /* ?rdbuf@?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEBAPEAV?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
12120 /* ?rdbuf@?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEPAV?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
12121 /* ?rdbuf@?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBAPEAV?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
12122 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_rdbuf, 4)
12123 basic_stringbuf_wchar* __thiscall basic_istringstream_wchar_rdbuf(const basic_istringstream_wchar *this)
12124 {
12125     TRACE("(%p)\n", this);
12126     return (basic_stringbuf_wchar*)&this->strbuf;
12127 }
12128
12129 /* ?str@?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@@Z */
12130 /* ?str@?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXAEBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@@Z */
12131 /* ?str@?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z */
12132 /* ?str@?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z */
12133 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_str_set, 8)
12134 void __thiscall basic_istringstream_wchar_str_set(basic_istringstream_wchar *this, const basic_string_wchar *str)
12135 {
12136     TRACE("(%p %p)\n", this, str);
12137     basic_stringbuf_wchar_str_set(&this->strbuf, str);
12138 }
12139
12140 /* ?str@?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
12141 /* ?str@?$basic_istringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
12142 /* ?str@?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
12143 /* ?str@?$basic_istringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
12144 DEFINE_THISCALL_WRAPPER(basic_istringstream_wchar_str_get, 8)
12145 basic_string_wchar* __thiscall basic_istringstream_wchar_str_get(const basic_istringstream_wchar *this, basic_string_wchar *ret)
12146 {
12147     TRACE("(%p %p)\n", this, ret);
12148     return basic_stringbuf_wchar_str_get(&this->strbuf, ret);
12149 }
12150
12151 static inline basic_ios_char* basic_stringstream_char_to_basic_ios(basic_stringstream_char *ptr)
12152 {
12153     return (basic_ios_char*)((char*)ptr+basic_stringstream_char_vbtable1[1]);
12154 }
12155
12156 static inline basic_stringstream_char* basic_stringstream_char_from_basic_ios(basic_ios_char *ptr)
12157 {
12158     return (basic_stringstream_char*)((char*)ptr-basic_stringstream_char_vbtable1[1]);
12159 }
12160
12161 /* ??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@H@Z */
12162 /* ??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@H@Z */
12163 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_ctor_str, 16)
12164 basic_stringstream_char* __thiscall basic_stringstream_char_ctor_str(basic_stringstream_char *this,
12165         const basic_string_char *str, int mode, MSVCP_bool virt_init)
12166 {
12167     basic_ios_char *basic_ios;
12168
12169     TRACE("(%p %p %d %d)\n", this, str, mode, virt_init);
12170
12171     if(virt_init) {
12172         this->base.base1.vbtable = basic_stringstream_char_vbtable1;
12173         this->base.base2.vbtable = basic_stringstream_char_vbtable2;
12174         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
12175         basic_ios_char_ctor(basic_ios);
12176     }else {
12177         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
12178     }
12179
12180     basic_stringbuf_char_ctor_str(&this->strbuf, str, mode);
12181     basic_iostream_char_ctor(&this->base, &this->strbuf.base, FALSE);
12182     basic_ios->base.vtable = &MSVCP_basic_stringstream_char_vtable;
12183     return this;
12184 }
12185
12186 /* ??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@H@Z */
12187 /* ??0?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@H@Z */
12188 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_ctor_mode, 12)
12189 basic_stringstream_char* __thiscall basic_stringstream_char_ctor_mode(
12190         basic_stringstream_char *this, int mode, MSVCP_bool virt_init)
12191 {
12192     basic_ios_char *basic_ios;
12193
12194     TRACE("(%p %d %d)\n", this, mode, virt_init);
12195
12196     if(virt_init) {
12197         this->base.base1.vbtable = basic_stringstream_char_vbtable1;
12198         this->base.base2.vbtable = basic_stringstream_char_vbtable2;
12199         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
12200         basic_ios_char_ctor(basic_ios);
12201     }else {
12202         basic_ios = basic_istream_char_get_basic_ios(&this->base.base1);
12203     }
12204
12205     basic_stringbuf_char_ctor_mode(&this->strbuf, mode);
12206     basic_iostream_char_ctor(&this->base, &this->strbuf.base, FALSE);
12207     basic_ios->base.vtable = &MSVCP_basic_stringstream_char_vtable;
12208     return this;
12209 }
12210
12211 /* ??_F?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
12212 /* ??_F?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
12213 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_ctor, 8)
12214 basic_stringstream_char* __thiscall basic_stringstream_char_ctor(
12215         basic_stringstream_char *this, MSVCP_bool virt_init)
12216 {
12217     return basic_stringstream_char_ctor_mode(
12218             this, OPENMODE_out|OPENMODE_in, virt_init);
12219 }
12220
12221 /* ??1?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UAE@XZ */
12222 /* ??1?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@UEAA@XZ */
12223 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_dtor, 4)
12224 void __thiscall basic_stringstream_char_dtor(basic_ios_char *base)
12225 {
12226     basic_stringstream_char *this = basic_stringstream_char_from_basic_ios(base);
12227
12228     TRACE("(%p)\n", this);
12229
12230     basic_iostream_char_dtor(basic_iostream_char_to_basic_ios(&this->base));
12231     basic_stringbuf_char_dtor(&this->strbuf);
12232 }
12233
12234 /* ??_D?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ */
12235 /* ??_D?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXXZ */
12236 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_vbase_dtor, 4)
12237 void __thiscall basic_stringstream_char_vbase_dtor(basic_stringstream_char *this)
12238 {
12239     TRACE("(%p)\n", this);
12240
12241     basic_stringstream_char_dtor(basic_stringstream_char_to_basic_ios(this));
12242     basic_ios_char_dtor(basic_istream_char_get_basic_ios(&this->base.base1));
12243 }
12244
12245 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_vector_dtor, 8)
12246 basic_stringstream_char* __thiscall basic_stringstream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
12247 {
12248     basic_stringstream_char *this = basic_stringstream_char_from_basic_ios(base);
12249
12250     TRACE("(%p %x)\n", this, flags);
12251
12252     if(flags & 2) {
12253         /* we have an array, with the number of elements stored before the first object */
12254         INT_PTR i, *ptr = (INT_PTR *)this-1;
12255
12256         for(i=*ptr-1; i>=0; i--)
12257             basic_stringstream_char_vbase_dtor(this+i);
12258         MSVCRT_operator_delete(ptr);
12259     } else {
12260         basic_stringstream_char_vbase_dtor(this);
12261         if(flags & 1)
12262             MSVCRT_operator_delete(this);
12263     }
12264
12265     return this;
12266 }
12267
12268 /* ?rdbuf@?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPAV?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
12269 /* ?rdbuf@?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBAPEAV?$basic_stringbuf@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
12270 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_rdbuf, 4)
12271 basic_stringbuf_char* __thiscall basic_stringstream_char_rdbuf(const basic_stringstream_char *this)
12272 {
12273     TRACE("(%p)\n", this);
12274     return (basic_stringbuf_char*)&this->strbuf;
12275 }
12276
12277 /* ?str@?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
12278 /* ?str@?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@@Z */
12279 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_str_set, 8)
12280 void __thiscall basic_stringstream_char_str_set(basic_stringstream_char *this, const basic_string_char *str)
12281 {
12282     TRACE("(%p %p)\n", this, str);
12283     basic_stringbuf_char_str_set(&this->strbuf, str);
12284 }
12285
12286 /* ?str@?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
12287 /* ?str@?$basic_stringstream@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@XZ */
12288 DEFINE_THISCALL_WRAPPER(basic_stringstream_char_str_get, 8)
12289 basic_string_char* __thiscall basic_stringstream_char_str_get(const basic_stringstream_char *this, basic_string_char *ret)
12290 {
12291     TRACE("(%p %p)\n", this, ret);
12292     return basic_stringbuf_char_str_get(&this->strbuf, ret);
12293 }
12294
12295 static inline basic_ios_wchar* basic_stringstream_wchar_to_basic_ios(basic_stringstream_wchar *ptr)
12296 {
12297     return (basic_ios_wchar*)((char*)ptr+basic_stringstream_wchar_vbtable1[1]);
12298 }
12299
12300 static inline basic_stringstream_wchar* basic_stringstream_wchar_from_basic_ios(basic_ios_wchar *ptr)
12301 {
12302     return (basic_stringstream_wchar*)((char*)ptr-basic_stringstream_wchar_vbtable1[1]);
12303 }
12304
12305 /* ??0?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@ABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@1@H@Z */
12306 /* ??0?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@AEBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@1@H@Z */
12307 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_ctor_str, 16)
12308 basic_stringstream_wchar* __thiscall basic_stringstream_wchar_ctor_str(basic_stringstream_wchar *this,
12309         const basic_string_wchar *str, int mode, MSVCP_bool virt_init)
12310 {
12311     basic_ios_wchar *basic_ios;
12312
12313     TRACE("(%p %p %d %d)\n", this, str, mode, virt_init);
12314
12315     if(virt_init) {
12316         this->base.base1.vbtable = basic_stringstream_wchar_vbtable1;
12317         this->base.base2.vbtable = basic_stringstream_wchar_vbtable2;
12318         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
12319         basic_ios_wchar_ctor(basic_ios);
12320     }else {
12321         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
12322     }
12323
12324     basic_stringbuf_wchar_ctor_str(&this->strbuf, str, mode);
12325     basic_iostream_wchar_ctor(&this->base, &this->strbuf.base, FALSE);
12326     basic_ios->base.vtable = &MSVCP_basic_stringstream_wchar_vtable;
12327     return this;
12328 }
12329
12330 /* ??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@1@H@Z */
12331 /* ??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@AEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@1@H@Z */
12332 DEFINE_THISCALL_WRAPPER(basic_stringstream_short_ctor_str, 16)
12333 basic_stringstream_wchar* __thiscall basic_stringstream_short_ctor_str(basic_stringstream_wchar *this,
12334         const basic_string_wchar *str, int mode, MSVCP_bool virt_init)
12335 {
12336     basic_stringstream_wchar_ctor_str(this, str, mode, virt_init);
12337     basic_istream_wchar_get_basic_ios(&this->base.base1)->base.vtable = &MSVCP_basic_stringstream_short_vtable;
12338     return this;
12339 }
12340
12341 /* ??0?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAE@H@Z */
12342 /* ??0?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAA@H@Z */
12343 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_ctor_mode, 12)
12344 basic_stringstream_wchar* __thiscall basic_stringstream_wchar_ctor_mode(
12345         basic_stringstream_wchar *this, int mode, MSVCP_bool virt_init)
12346 {
12347     basic_ios_wchar *basic_ios;
12348
12349     TRACE("(%p %d %d)\n", this, mode, virt_init);
12350
12351     if(virt_init) {
12352         this->base.base1.vbtable = basic_stringstream_wchar_vbtable1;
12353         this->base.base2.vbtable = basic_stringstream_wchar_vbtable2;
12354         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
12355         basic_ios_wchar_ctor(basic_ios);
12356     }else {
12357         basic_ios = basic_istream_wchar_get_basic_ios(&this->base.base1);
12358     }
12359
12360     basic_stringbuf_wchar_ctor_mode(&this->strbuf, mode);
12361     basic_iostream_wchar_ctor(&this->base, &this->strbuf.base, FALSE);
12362     basic_ios->base.vtable = &MSVCP_basic_stringstream_wchar_vtable;
12363     return this;
12364 }
12365
12366 /* ??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAE@H@Z */
12367 /* ??0?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAA@H@Z */
12368 DEFINE_THISCALL_WRAPPER(basic_stringstream_short_ctor_mode, 12)
12369 basic_stringstream_wchar* __thiscall basic_stringstream_short_ctor_mode(
12370         basic_stringstream_wchar *this, int mode, MSVCP_bool virt_init)
12371 {
12372     basic_stringstream_wchar_ctor_mode(this, mode, virt_init);
12373     basic_istream_wchar_get_basic_ios(&this->base.base1)->base.vtable = &MSVCP_basic_stringstream_short_vtable;
12374     return this;
12375 }
12376
12377 /* ??_F?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
12378 /* ??_F?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
12379 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_ctor, 8)
12380 basic_stringstream_wchar* __thiscall basic_stringstream_wchar_ctor(
12381         basic_stringstream_wchar *this, MSVCP_bool virt_init)
12382 {
12383     return basic_stringstream_wchar_ctor_mode(
12384             this, OPENMODE_out|OPENMODE_in, virt_init);
12385 }
12386
12387 /* ??_F?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
12388 /* ??_F?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
12389 DEFINE_THISCALL_WRAPPER(basic_stringstream_short_ctor, 8)
12390 basic_stringstream_wchar* __thiscall basic_stringstream_short_ctor(
12391         basic_stringstream_wchar *this, MSVCP_bool virt_init)
12392 {
12393     return basic_stringstream_short_ctor_mode(
12394             this, OPENMODE_out|OPENMODE_in, virt_init);
12395 }
12396
12397 /* ??1?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UAE@XZ */
12398 /* ??1?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@UEAA@XZ */
12399 /* ??1?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UAE@XZ */
12400 /* ??1?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@UEAA@XZ */
12401 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_dtor, 4)
12402 void __thiscall basic_stringstream_wchar_dtor(basic_ios_wchar *base)
12403 {
12404     basic_stringstream_wchar *this = basic_stringstream_wchar_from_basic_ios(base);
12405
12406     TRACE("(%p)\n", this);
12407
12408     basic_iostream_wchar_dtor(basic_iostream_wchar_to_basic_ios(&this->base));
12409     basic_stringbuf_wchar_dtor(&this->strbuf);
12410 }
12411
12412 /* ??_D?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXXZ */
12413 /* ??_D?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXXZ */
12414 /* ??_D?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXXZ */
12415 /* ??_D?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXXZ */
12416 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_vbase_dtor, 4)
12417 void __thiscall basic_stringstream_wchar_vbase_dtor(basic_stringstream_wchar *this)
12418 {
12419     TRACE("(%p)\n", this);
12420
12421     basic_stringstream_wchar_dtor(basic_stringstream_wchar_to_basic_ios(this));
12422     basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(&this->base.base1));
12423 }
12424
12425 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_vector_dtor, 8)
12426 basic_stringstream_wchar* __thiscall basic_stringstream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
12427 {
12428     basic_stringstream_wchar *this = basic_stringstream_wchar_from_basic_ios(base);
12429
12430     TRACE("(%p %x)\n", this, flags);
12431
12432     if(flags & 2) {
12433         /* we have an array, with the number of elements stored before the first object */
12434         INT_PTR i, *ptr = (INT_PTR *)this-1;
12435
12436         for(i=*ptr-1; i>=0; i--)
12437             basic_stringstream_wchar_vbase_dtor(this+i);
12438         MSVCRT_operator_delete(ptr);
12439     } else {
12440         basic_stringstream_wchar_vbase_dtor(this);
12441         if(flags & 1)
12442             MSVCRT_operator_delete(this);
12443     }
12444
12445     return this;
12446 }
12447
12448 /* ?rdbuf@?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBEPAV?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
12449 /* ?rdbuf@?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEBAPEAV?$basic_stringbuf@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
12450 /* ?rdbuf@?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEPAV?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
12451 /* ?rdbuf@?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBAPEAV?$basic_stringbuf@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
12452 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_rdbuf, 4)
12453 basic_stringbuf_wchar* __thiscall basic_stringstream_wchar_rdbuf(const basic_stringstream_wchar *this)
12454 {
12455     TRACE("(%p)\n", this);
12456     return (basic_stringbuf_wchar*)&this->strbuf;
12457 }
12458
12459 /* ?str@?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QAEXABV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@@Z */
12460 /* ?str@?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEAAXAEBV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@@Z */
12461 /* ?str@?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z */
12462 /* ?str@?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXAEBV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@@Z */
12463 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_str_set, 8)
12464 void __thiscall basic_stringstream_wchar_str_set(basic_stringstream_wchar *this, const basic_string_wchar *str)
12465 {
12466     TRACE("(%p %p)\n", this, str);
12467     basic_stringbuf_wchar_str_set(&this->strbuf, str);
12468 }
12469
12470 /* ?str@?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QBE?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
12471 /* ?str@?$basic_stringstream@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@QEBA?AV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@XZ */
12472 /* ?str@?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBE?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
12473 /* ?str@?$basic_stringstream@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA?AV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@2@XZ */
12474 DEFINE_THISCALL_WRAPPER(basic_stringstream_wchar_str_get, 8)
12475 basic_string_wchar* __thiscall basic_stringstream_wchar_str_get(const basic_stringstream_wchar *this, basic_string_wchar *ret)
12476 {
12477     TRACE("(%p %p)\n", this, ret);
12478     return basic_stringbuf_wchar_str_get(&this->strbuf, ret);
12479 }
12480
12481 /* ?_Init@strstreambuf@std@@IAEXHPAD0H@Z */
12482 /* ?_Init@strstreambuf@std@@IEAAX_JPEAD1H@Z */
12483 DEFINE_THISCALL_WRAPPER(strstreambuf__Init, 20)
12484 void __thiscall strstreambuf__Init(strstreambuf *this, streamsize len, char *g, char *p, int mode)
12485 {
12486     TRACE("(%p %ld %p %p %d)\n", this, len, g, p, mode);
12487
12488     this->minsize = 32;
12489     this->endsave = NULL;
12490     this->strmode = mode;
12491     this->palloc = NULL;
12492     this->pfree = NULL;
12493
12494     if(!g) {
12495         this->strmode |= STRSTATE_Dynamic;
12496         if(len > this->minsize)
12497             this->minsize = len;
12498         this->seekhigh = NULL;
12499         return;
12500     }
12501
12502     if(len < 0)
12503         len = INT_MAX;
12504     else if(!len)
12505         len = strlen(g);
12506
12507     this->seekhigh = g+len;
12508     basic_streambuf_char_setg(&this->base, g, g, p ? p : this->seekhigh);
12509     if(p)
12510         basic_streambuf_char_setp(&this->base, p, this->seekhigh);
12511 }
12512
12513 /* ??0strstreambuf@std@@QAE@PACH0@Z */
12514 /* ??0strstreambuf@std@@QEAA@PEAC_J0@Z */
12515 /* ??0strstreambuf@std@@QAE@PADH0@Z */
12516 /* ??0strstreambuf@std@@QEAA@PEAD_J0@Z */
12517 /* ??0strstreambuf@std@@QAE@PAEH0@Z */
12518 /* ??0strstreambuf@std@@QEAA@PEAE_J0@Z */
12519 DEFINE_THISCALL_WRAPPER(strstreambuf_ctor_get_put, 16)
12520 strstreambuf* __thiscall strstreambuf_ctor_get_put(strstreambuf *this, char *g, streamsize len, char *p)
12521 {
12522     TRACE("(%p %p %ld %p)\n", this, g, len, p);
12523
12524     basic_streambuf_char_ctor(&this->base);
12525     this->base.vtable = &MSVCP_strstreambuf_vtable;
12526
12527     strstreambuf__Init(this, len, g, p, 0);
12528     return this;
12529 }
12530
12531 /* ??0strstreambuf@std@@QAE@H@Z */
12532 /* ??0strstreambuf@std@@QEAA@_J@Z */
12533 DEFINE_THISCALL_WRAPPER(strstreambuf_ctor_len, 8)
12534 strstreambuf* __thiscall strstreambuf_ctor_len(strstreambuf *this, streamsize len)
12535 {
12536     return strstreambuf_ctor_get_put(this, NULL, len, NULL);
12537 }
12538
12539 /* ??0strstreambuf@std@@QAE@P6APAXI@ZP6AXPAX@Z@Z */
12540 /* ??0strstreambuf@std@@QEAA@P6APEAX_K@ZP6AXPEAX@Z@Z */
12541 DEFINE_THISCALL_WRAPPER(strstreambuf_ctor_alloc, 12)
12542 strstreambuf* __thiscall strstreambuf_ctor_alloc(strstreambuf *this, void* (__cdecl *palloc)(MSVCP_size_t), void (__cdecl *pfree)(void*))
12543 {
12544     TRACE("(%p %p %p)\n", this, palloc, pfree);
12545
12546     strstreambuf_ctor_get_put(this, NULL, 0, NULL);
12547     this->palloc = palloc;
12548     this->pfree = pfree;
12549     return this;
12550 }
12551
12552 /* ??0strstreambuf@std@@QAE@PBCH@Z */
12553 /* ??0strstreambuf@std@@QEAA@PEBC_J@Z */
12554 /* ??0strstreambuf@std@@QAE@PBDH@Z */
12555 /* ??0strstreambuf@std@@QEAA@PEBD_J@Z */
12556 /* ??0strstreambuf@std@@QAE@PBEH@Z */
12557 /* ??0strstreambuf@std@@QEAA@PEBE_J@Z */
12558 DEFINE_THISCALL_WRAPPER(strstreambuf_ctor_get, 12)
12559 strstreambuf* __thiscall strstreambuf_ctor_get(strstreambuf *this, const char *g, streamsize len)
12560 {
12561     TRACE("(%p %p %ld)\n", this, g, len);
12562
12563     strstreambuf_ctor_get_put(this, NULL, 0, NULL);
12564     this->strmode |= STRSTATE_Constant;
12565     return this;
12566 }
12567
12568 /* ??_Fstrstreambuf@std@@QAEXXZ */
12569 /* ??_Fstrstreambuf@std@@QEAAXXZ */
12570 DEFINE_THISCALL_WRAPPER(strstreambuf_ctor, 4)
12571 strstreambuf* __thiscall strstreambuf_ctor(strstreambuf *this)
12572 {
12573     return strstreambuf_ctor_get_put(this, NULL, 0, NULL);
12574 }
12575
12576 /* ?_Tidy@strstreambuf@std@@IAEXXZ */
12577 /* ?_Tidy@strstreambuf@std@@IEAAXXZ */
12578 DEFINE_THISCALL_WRAPPER(strstreambuf__Tidy, 4)
12579 void __thiscall strstreambuf__Tidy(strstreambuf *this)
12580 {
12581     TRACE("(%p)\n", this);
12582
12583     if((this->strmode & STRSTATE_Allocated) && !(this->strmode & STRSTATE_Frozen)) {
12584         if(this->pfree)
12585             this->pfree(basic_streambuf_char_eback(&this->base));
12586         else
12587             MSVCRT_operator_delete(basic_streambuf_char_eback(&this->base));
12588     }
12589
12590     this->endsave = NULL;
12591     this->seekhigh = NULL;
12592     this->strmode &= ~(STRSTATE_Allocated | STRSTATE_Frozen);
12593     basic_streambuf_char_setg(&this->base, NULL, NULL, NULL);
12594     basic_streambuf_char_setp(&this->base, NULL, NULL);
12595 }
12596
12597 /* ??1strstreambuf@std@@UAE@XZ */
12598 /* ??1strstreambuf@std@@UEAA@XZ */
12599 DEFINE_THISCALL_WRAPPER(strstreambuf_dtor, 4)
12600 void __thiscall strstreambuf_dtor(strstreambuf *this)
12601 {
12602     TRACE("(%p)\n", this);
12603
12604     strstreambuf__Tidy(this);
12605     basic_streambuf_char_dtor(&this->base);
12606 }
12607
12608 DEFINE_THISCALL_WRAPPER(strstreambuf_vector_dtor, 8)
12609 strstreambuf* __thiscall strstreambuf_vector_dtor(strstreambuf *this, unsigned int flags)
12610 {
12611     TRACE("(%p %x)\n", this, flags);
12612     if(flags & 2) {
12613         /* we have an array, with the number of elements stored before the first object */
12614         INT_PTR i, *ptr = (INT_PTR *)this-1;
12615
12616         for(i=*ptr-1; i>=0; i--)
12617             strstreambuf_dtor(this+i);
12618         MSVCRT_operator_delete(ptr);
12619     } else {
12620         strstreambuf_dtor(this);
12621         if(flags & 1)
12622             MSVCRT_operator_delete(this);
12623     }
12624
12625     return this;
12626 }
12627
12628 /* ?freeze@strstreambuf@std@@QAEX_N@Z */
12629 /* ?freeze@strstreambuf@std@@QEAAX_N@Z */
12630 DEFINE_THISCALL_WRAPPER(strstreambuf_freeze, 8)
12631 void __thiscall strstreambuf_freeze(strstreambuf *this, MSVCP_bool freeze)
12632 {
12633     TRACE("(%p %d)\n", this, freeze);
12634
12635     if(!freeze == !(this->strmode *STRSTATE_Frozen))
12636         return;
12637
12638     if(freeze) {
12639         this->strmode |= STRSTATE_Frozen;
12640         this->endsave = basic_streambuf_char_epptr(&this->base);
12641         basic_streambuf_char_setp_next(&this->base, basic_streambuf_char_pbase(&this->base),
12642                 basic_streambuf_char_pptr(&this->base), basic_streambuf_char_eback(&this->base));
12643     }else {
12644         this->strmode &= ~STRSTATE_Frozen;
12645         basic_streambuf_char_setp_next(&this->base, basic_streambuf_char_pbase(&this->base),
12646                 basic_streambuf_char_pptr(&this->base), this->endsave);
12647     }
12648 }
12649
12650 /* ?str@strstreambuf@std@@QAEPADXZ */
12651 /* ?str@strstreambuf@std@@QEAAPEADXZ */
12652 DEFINE_THISCALL_WRAPPER(strstreambuf_str, 4)
12653 char* __thiscall strstreambuf_str(strstreambuf *this)
12654 {
12655     TRACE("(%p)\n", this);
12656
12657     strstreambuf_freeze(this, TRUE);
12658     return basic_streambuf_char_gptr(&this->base);
12659 }
12660
12661 /* ?pcount@strstreambuf@std@@QBEHXZ */
12662 /* ?pcount@strstreambuf@std@@QEBA_JXZ */
12663 DEFINE_THISCALL_WRAPPER(strstreambuf_pcount, 4)
12664 streamsize __thiscall strstreambuf_pcount(const strstreambuf *this)
12665 {
12666     char *ppos = basic_streambuf_char_pptr(&this->base);
12667
12668     TRACE("(%p)\n", this);
12669
12670     return ppos ? ppos-basic_streambuf_char_pbase(&this->base) : 0;
12671 }
12672
12673 /* ?overflow@strstreambuf@std@@MAEHH@Z */
12674 /* ?overflow@strstreambuf@std@@MEAAHH@Z */
12675 DEFINE_THISCALL_WRAPPER(strstreambuf_overflow, 8)
12676 int __thiscall strstreambuf_overflow(strstreambuf *this, int c)
12677 {
12678     MSVCP_size_t old_size, size;
12679     char *ptr, *buf;
12680
12681     TRACE("(%p %d)\n", this, c);
12682
12683     if(c == EOF)
12684         return !EOF;
12685
12686     if(this->strmode & STRSTATE_Frozen)
12687         return EOF;
12688
12689     ptr = basic_streambuf_char_pptr(&this->base);
12690     if(ptr && ptr<basic_streambuf_char_epptr(&this->base))
12691         return (unsigned char)(*basic_streambuf_char__Pninc(&this->base) = c);
12692
12693     if(!(this->strmode & STRSTATE_Dynamic) || (this->strmode & STRSTATE_Constant))
12694         return EOF;
12695
12696     ptr = basic_streambuf_char_eback(&this->base);
12697     old_size = ptr ? basic_streambuf_char_epptr(&this->base) - ptr : 0;
12698
12699     size = old_size + old_size/2;
12700     if(size < this->minsize)
12701         size = this->minsize;
12702
12703     if(this->palloc)
12704         buf = this->palloc(size);
12705     else
12706         buf = MSVCRT_operator_new(size);
12707     if(!buf)
12708         return EOF;
12709
12710     memcpy(buf, ptr, old_size);
12711     if(this->strmode & STRSTATE_Allocated) {
12712         if(this->pfree)
12713             this->pfree(ptr);
12714         else
12715             MSVCRT_operator_delete(ptr);
12716     }
12717
12718     this->strmode |= STRSTATE_Allocated;
12719     if(!old_size) {
12720         this->seekhigh = buf;
12721         basic_streambuf_char_setp(&this->base, buf, buf+size);
12722         basic_streambuf_char_setg(&this->base, buf, buf, buf);
12723     }else {
12724         this->seekhigh = this->seekhigh-ptr+buf;
12725         basic_streambuf_char_setp_next(&this->base, basic_streambuf_char_pbase(&this->base)-ptr+buf,
12726                 basic_streambuf_char_pptr(&this->base)-ptr+buf, buf+size);
12727         basic_streambuf_char_setg(&this->base, buf, basic_streambuf_char_gptr(&this->base)-ptr+buf,
12728                 basic_streambuf_char_pptr(&this->base));
12729     }
12730
12731     return (unsigned char)(*basic_streambuf_char__Pninc(&this->base) = c);
12732 }
12733
12734 /* ?pbackfail@strstreambuf@std@@MAEHH@Z */
12735 /* ?pbackfail@strstreambuf@std@@MEAAHH@Z */
12736 DEFINE_THISCALL_WRAPPER(strstreambuf_pbackfail, 8)
12737 int __thiscall strstreambuf_pbackfail(strstreambuf *this, int c)
12738 {
12739     char *ptr = basic_streambuf_char_gptr(&this->base);
12740
12741     TRACE("(%p %d)\n", this, c);
12742
12743     if(ptr<=basic_streambuf_char_eback(&this->base)
12744             || ((this->strmode & STRSTATE_Constant) && c!=ptr[-1]))
12745         return EOF;
12746
12747     basic_streambuf_char_gbump(&this->base, -1);
12748     if(c == EOF)
12749         return !EOF;
12750     if(this->strmode & STRSTATE_Constant)
12751         return (unsigned char)c;
12752
12753     return (unsigned char)(ptr[0] = c);
12754 }
12755
12756 /* ?seekoff@strstreambuf@std@@MAE?AV?$fpos@H@2@JHH@Z */
12757 /* ?seekoff@strstreambuf@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
12758 DEFINE_THISCALL_WRAPPER(strstreambuf_seekoff, 20)
12759 fpos_int* __thiscall strstreambuf_seekoff(strstreambuf *this, fpos_int *ret, streamoff off, int way, int mode)
12760 {
12761     char *eback = basic_streambuf_char_eback(&this->base);
12762     char *pptr = basic_streambuf_char_pptr(&this->base);
12763     char *gptr = basic_streambuf_char_gptr(&this->base);
12764
12765     TRACE("(%p %p %ld %d %d)\n", this, ret, off, way, mode);
12766
12767     ret->off = 0;
12768     ret->state = 0;
12769
12770     if(pptr > this->seekhigh)
12771         this->seekhigh = pptr;
12772
12773     if((mode & OPENMODE_in) && gptr) {
12774         if(way==SEEKDIR_cur && !(mode & OPENMODE_out))
12775             off += gptr-eback;
12776         else if(way == SEEKDIR_end)
12777             off += this->seekhigh-eback;
12778         else if(way != SEEKDIR_beg)
12779             off = -1;
12780
12781         if(off<0 || off>this->seekhigh-eback) {
12782             off = -1;
12783         }else {
12784             basic_streambuf_char_gbump(&this->base, eback-gptr+off);
12785             if((mode & OPENMODE_out) && pptr) {
12786                 basic_streambuf_char_setp_next(&this->base, eback,
12787                         gptr, basic_streambuf_char_epptr(&this->base));
12788             }
12789         }
12790     }else if((mode & OPENMODE_out) && pptr) {
12791         if(way == SEEKDIR_cur)
12792             off += pptr-eback;
12793         else if(way == SEEKDIR_end)
12794             off += this->seekhigh-eback;
12795         else if(way != SEEKDIR_beg)
12796             off = -1;
12797
12798          if(off<0 || off>this->seekhigh-eback)
12799              off = -1;
12800          else
12801              basic_streambuf_char_pbump(&this->base, eback-pptr+off);
12802     }else {
12803         off = -1;
12804     }
12805
12806     ret->pos = off;
12807     return ret;
12808 }
12809
12810 /* ?seekpos@strstreambuf@std@@MAE?AV?$fpos@H@2@V32@H@Z */
12811 /* ?seekpos@strstreambuf@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
12812 DEFINE_THISCALL_WRAPPER(strstreambuf_seekpos, 36)
12813 fpos_int* __thiscall strstreambuf_seekpos(strstreambuf *this, fpos_int *ret, fpos_int pos, int mode)
12814 {
12815     TRACE("(%p %p %s %d)\n", this, ret, debugstr_fpos_int(&pos), mode);
12816
12817     if(pos.off==0 && pos.pos==-1 && pos.state==0) {
12818         *ret = pos;
12819         return ret;
12820     }
12821
12822     return strstreambuf_seekoff(this, ret, pos.off, SEEKDIR_beg, mode);
12823 }
12824
12825 /* ?underflow@strstreambuf@std@@MAEHXZ */
12826 /* ?underflow@strstreambuf@std@@MEAAHXZ */
12827 DEFINE_THISCALL_WRAPPER(strstreambuf_underflow, 4)
12828 int __thiscall strstreambuf_underflow(strstreambuf *this)
12829 {
12830     char *gptr = basic_streambuf_char_gptr(&this->base);
12831     char *pptr;
12832
12833     TRACE("(%p)\n", this);
12834
12835     if(!gptr)
12836         return EOF;
12837
12838     if(gptr < basic_streambuf_char_egptr(&this->base))
12839         return (unsigned char)(*gptr);
12840
12841     pptr = basic_streambuf_char_gptr(&this->base);
12842     if(pptr > this->seekhigh)
12843         this->seekhigh = pptr;
12844
12845     if(this->seekhigh <= gptr)
12846         return EOF;
12847
12848     basic_streambuf_char_setg(&this->base, basic_streambuf_char_eback(&this->base),
12849             gptr, this->seekhigh);
12850     return (unsigned char)(*gptr);
12851 }
12852
12853 static void __cdecl setprecision_func(ios_base *base, streamsize prec)
12854 {
12855     ios_base_precision_set(base, prec);
12856 }
12857
12858 /* ?setprecision@std@@YA?AU?$_Smanip@H@1@H@Z */
12859 /* ?setprecision@std@@YA?AU?$_Smanip@_J@1@_J@Z */
12860 manip_streamsize* __cdecl setprecision(manip_streamsize *ret, streamsize prec)
12861 {
12862     TRACE("(%p %ld)\n", ret, prec);
12863
12864     ret->pfunc = setprecision_func;
12865     ret->arg = prec;
12866     return ret;
12867 }
12868
12869 static void __cdecl setw_func(ios_base *base, streamsize width)
12870 {
12871     ios_base_width_set(base, width);
12872 }
12873
12874 /* ?setw@std@@YA?AU?$_Smanip@H@1@H@Z */
12875 /* ?setw@std@@YA?AU?$_Smanip@_J@1@_J@Z */
12876 manip_streamsize* __cdecl setw(manip_streamsize *ret, streamsize width)
12877 {
12878     TRACE("(%p %ld)\n", ret, width);
12879
12880     ret->pfunc = setw_func;
12881     ret->arg = width;
12882     return ret;
12883 }
12884
12885 static void __cdecl resetioflags_func(ios_base *base, int mask)
12886 {
12887     ios_base_setf_mask(base, 0, mask);
12888 }
12889
12890 /* ?resetiosflags@std@@YA?AU?$_Smanip@H@1@H@Z */
12891 manip_int* __cdecl resetiosflags(manip_int *ret, int mask)
12892 {
12893     TRACE("(%p %d)\n", ret, mask);
12894
12895     ret->pfunc = resetioflags_func;
12896     ret->arg = mask;
12897     return ret;
12898 }
12899
12900 static void __cdecl setiosflags_func(ios_base *base, int mask)
12901 {
12902     ios_base_setf_mask(base, FMTFLAG_mask, mask);
12903 }
12904
12905 /* ?setiosflags@std@@YA?AU?$_Smanip@H@1@H@Z */
12906 manip_int* __cdecl setiosflags(manip_int *ret, int mask)
12907 {
12908     TRACE("(%p %d)\n", ret, mask);
12909
12910     ret->pfunc = setiosflags_func;
12911     ret->arg = mask;
12912     return ret;
12913 }
12914
12915 static void __cdecl setbase_func(ios_base *base, int set_base)
12916 {
12917     if(set_base == 10)
12918         set_base = FMTFLAG_dec;
12919     else if(set_base == 8)
12920         set_base = FMTFLAG_oct;
12921     else if(set_base == 16)
12922         set_base = FMTFLAG_hex;
12923     else
12924         set_base = 0;
12925
12926     ios_base_setf_mask(base, set_base, FMTFLAG_basefield);
12927 }
12928
12929 /* ?setbase@std@@YA?AU?$_Smanip@H@1@H@Z */
12930 manip_int* __cdecl setbase(manip_int *ret, int base)
12931 {
12932     TRACE("(%p %d)\n", ret, base);
12933
12934     ret->pfunc = setbase_func;
12935     ret->arg = base;
12936     return ret;
12937 }
12938
12939 static basic_filebuf_char filebuf_char_stdin;
12940 /* ?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A */
12941 struct {
12942     basic_istream_char obj;
12943     basic_ios_char vbase;
12944 } cin = { { 0 } };
12945 /* ?_Ptr_cin@std@@3PAV?$basic_istream@DU?$char_traits@D@std@@@1@A */
12946 /* ?_Ptr_cin@std@@3PEAV?$basic_istream@DU?$char_traits@D@std@@@1@EA */
12947 basic_istream_char *_Ptr_cin = &cin.obj;
12948
12949 static basic_filebuf_wchar filebuf_short_stdin;
12950 /* ?wcin@std@@3V?$basic_istream@GU?$char_traits@G@std@@@1@A */
12951 struct {
12952     basic_istream_wchar obj;
12953     basic_ios_wchar vbase;
12954 } ucin = { { 0 } };
12955 /* ?_Ptr_wcin@std@@3PAV?$basic_istream@GU?$char_traits@G@std@@@1@A */
12956 /* ?_Ptr_wcin@std@@3PEAV?$basic_istream@GU?$char_traits@G@std@@@1@EA */
12957 basic_istream_wchar *_Ptr_ucin = &ucin.obj;
12958
12959 static basic_filebuf_wchar filebuf_wchar_stdin;
12960 /* ?wcin@std@@3V?$basic_istream@_WU?$char_traits@_W@std@@@1@A */
12961 struct {
12962     basic_istream_wchar obj;
12963     basic_ios_wchar vbase;
12964 } wcin = { { 0 } };
12965 /* ?_Ptr_wcin@std@@3PAV?$basic_istream@_WU?$char_traits@_W@std@@@1@A */
12966 /* ?_Ptr_wcin@std@@3PEAV?$basic_istream@_WU?$char_traits@_W@std@@@1@EA */
12967 basic_istream_wchar *_Ptr_wcin = &wcin.obj;
12968
12969 static basic_filebuf_char filebuf_char_stdout;
12970 /* ?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A */
12971 struct {
12972     basic_ostream_char obj;
12973     basic_ios_char vbase;
12974 } cout = { { 0 } };
12975 /* ?_Ptr_cout@std@@3PAV?$basic_ostream@DU?$char_traits@D@std@@@1@A */
12976 /* ?_Ptr_cout@std@@3PEAV?$basic_ostream@DU?$char_traits@D@std@@@1@EA */
12977 basic_ostream_char *_Ptr_cout = &cout.obj;
12978
12979 static basic_filebuf_wchar filebuf_short_stdout;
12980 /* ?wcout@std@@3V?$basic_ostream@GU?$char_traits@G@std@@@1@A */
12981 struct {
12982     basic_ostream_wchar obj;
12983     basic_ios_wchar vbase;
12984 } ucout = { { 0 } };
12985 /* ?_Ptr_wcout@std@@3PAV?$basic_ostream@GU?$char_traits@G@std@@@1@A */
12986 /* ?_Ptr_wcout@std@@3PEAV?$basic_ostream@GU?$char_traits@G@std@@@1@EA */
12987 basic_ostream_wchar *_Ptr_ucout = &ucout.obj;
12988
12989 static basic_filebuf_wchar filebuf_wchar_stdout;
12990 /* ?wcout@std@@3V?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
12991 struct {
12992     basic_ostream_wchar obj;
12993     basic_ios_wchar vbase;
12994 } wcout = { { 0 } };
12995 /* ?_Ptr_wcout@std@@3PAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
12996 /* ?_Ptr_wcout@std@@3PEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@EA */
12997 basic_ostream_wchar *_Ptr_wcout = &wcout.obj;
12998
12999 static basic_filebuf_char filebuf_char_stderr;
13000 /* ?cerr@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A */
13001 struct {
13002     basic_ostream_char obj;
13003     basic_ios_char vbase;
13004 } cerr = { { 0 } };
13005 /* ?_Ptr_cerr@std@@3PAV?$basic_ostream@DU?$char_traits@D@std@@@1@A */
13006 /* ?_Ptr_cerr@std@@3PEAV?$basic_ostream@DU?$char_traits@D@std@@@1@EA */
13007 basic_ostream_char *_Ptr_cerr = &cerr.obj;
13008
13009 static basic_filebuf_wchar filebuf_short_stderr;
13010 /* ?wcerr@std@@3V?$basic_ostream@GU?$char_traits@G@std@@@1@A */
13011 struct {
13012     basic_ostream_wchar obj;
13013     basic_ios_wchar vbase;
13014 } ucerr = { { 0 } };
13015 /* ?_Ptr_wcerr@std@@3PAV?$basic_ostream@GU?$char_traits@G@std@@@1@A */
13016 /* ?_Ptr_wcerr@std@@3PEAV?$basic_ostream@GU?$char_traits@G@std@@@1@EA */
13017 basic_ostream_wchar *_Ptr_ucerr = &ucerr.obj;
13018
13019 static basic_filebuf_wchar filebuf_wchar_stderr;
13020 /* ?wcerr@std@@3V?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
13021 struct {
13022     basic_ostream_wchar obj;
13023     basic_ios_wchar vbase;
13024 } wcerr = { { 0 } };
13025 /* ?_Ptr_wcerr@std@@3PAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
13026 /* ?_Ptr_wcerr@std@@3PEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@EA */
13027 basic_ostream_wchar *_Ptr_wcerr = &wcerr.obj;
13028
13029 static basic_filebuf_char filebuf_char_log;
13030 /* ?clog@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A */
13031 struct {
13032     basic_ostream_char obj;
13033     basic_ios_char vbase;
13034 } clog = { { 0 } };
13035 /* ?_Ptr_clog@std@@3PAV?$basic_ostream@DU?$char_traits@D@std@@@1@A */
13036 /* ?_Ptr_clog@std@@3PEAV?$basic_ostream@DU?$char_traits@D@std@@@1@EA */
13037 basic_ostream_char *_Ptr_clog = &clog.obj;
13038
13039 static basic_filebuf_wchar filebuf_short_log;
13040 /* ?wclog@std@@3V?$basic_ostream@GU?$char_traits@G@std@@@1@A */
13041 struct {
13042     basic_ostream_wchar obj;
13043     basic_ios_wchar vbase;
13044 } uclog = { { 0 } };
13045 /* ?_Ptr_wclog@std@@3PAV?$basic_ostream@GU?$char_traits@G@std@@@1@A */
13046 /* ?_Ptr_wclog@std@@3PEAV?$basic_ostream@GU?$char_traits@G@std@@@1@EA */
13047 basic_ostream_wchar *_Ptr_uclog = &uclog.obj;
13048
13049 static basic_filebuf_wchar filebuf_wchar_log;
13050 /* ?wclog@std@@3V?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
13051 struct {
13052     basic_ostream_wchar obj;
13053     basic_ios_wchar vbase;
13054 } wclog = { { 0 } };
13055 /* ?_Ptr_wclog@std@@3PAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
13056 /* ?_Ptr_wclog@std@@3PEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@EA */
13057 basic_ostream_wchar *_Ptr_wclog = &wclog.obj;
13058
13059 void init_io(void *base)
13060 {
13061 #ifdef __x86_64__
13062     init_iosb_rtti(base);
13063     init_ios_base_rtti(base);
13064     init_basic_ios_char_rtti(base);
13065     init_basic_ios_wchar_rtti(base);
13066     init_basic_ios_short_rtti(base);
13067     init_basic_streambuf_char_rtti(base);
13068     init_basic_streambuf_wchar_rtti(base);
13069     init_basic_streambuf_short_rtti(base);
13070     init_basic_filebuf_char_rtti(base);
13071     init_basic_filebuf_wchar_rtti(base);
13072     init_basic_filebuf_short_rtti(base);
13073     init_basic_stringbuf_char_rtti(base);
13074     init_basic_stringbuf_wchar_rtti(base);
13075     init_basic_stringbuf_short_rtti(base);
13076     init_basic_ostream_char_rtti(base);
13077     init_basic_ostream_wchar_rtti(base);
13078     init_basic_ostream_short_rtti(base);
13079     init_basic_istream_char_rtti(base);
13080     init_basic_istream_wchar_rtti(base);
13081     init_basic_istream_short_rtti(base);
13082     init_basic_iostream_char_rtti(base);
13083     init_basic_iostream_wchar_rtti(base);
13084     init_basic_iostream_short_rtti(base);
13085     init_basic_ofstream_char_rtti(base);
13086     init_basic_ofstream_wchar_rtti(base);
13087     init_basic_ofstream_short_rtti(base);
13088     init_basic_ifstream_char_rtti(base);
13089     init_basic_ifstream_wchar_rtti(base);
13090     init_basic_ifstream_short_rtti(base);
13091     init_basic_fstream_char_rtti(base);
13092     init_basic_fstream_wchar_rtti(base);
13093     init_basic_fstream_short_rtti(base);
13094     init_basic_ostringstream_char_rtti(base);
13095     init_basic_ostringstream_wchar_rtti(base);
13096     init_basic_ostringstream_short_rtti(base);
13097     init_basic_istringstream_char_rtti(base);
13098     init_basic_istringstream_wchar_rtti(base);
13099     init_basic_istringstream_short_rtti(base);
13100     init_basic_stringstream_char_rtti(base);
13101     init_basic_stringstream_wchar_rtti(base);
13102     init_basic_stringstream_short_rtti(base);
13103     init_strstreambuf_rtti(base);
13104 #endif
13105
13106     basic_filebuf_char_ctor_file(&filebuf_char_stdin, stdin);
13107     basic_istream_char_ctor(&cin.obj, &filebuf_char_stdin.base, FALSE/*FIXME*/, TRUE);
13108
13109     basic_filebuf_short_ctor_file(&filebuf_short_stdin, stdin);
13110     basic_istream_short_ctor(&ucin.obj, &filebuf_short_stdin.base, FALSE/*FIXME*/, TRUE);
13111
13112     basic_filebuf_wchar_ctor_file(&filebuf_wchar_stdin, stdin);
13113     basic_istream_wchar_ctor(&wcin.obj, &filebuf_wchar_stdin.base, FALSE/*FIXME*/, TRUE);
13114
13115     basic_filebuf_char_ctor_file(&filebuf_char_stdout, stdout);
13116     basic_ostream_char_ctor(&cout.obj, &filebuf_char_stdout.base, FALSE/*FIXME*/, TRUE);
13117
13118     basic_filebuf_short_ctor_file(&filebuf_short_stdout, stdout);
13119     basic_ostream_short_ctor(&ucout.obj, &filebuf_short_stdout.base, FALSE/*FIXME*/, TRUE);
13120
13121     basic_filebuf_wchar_ctor_file(&filebuf_wchar_stdout, stdout);
13122     basic_ostream_wchar_ctor(&wcout.obj, &filebuf_wchar_stdout.base, FALSE/*FIXME*/, TRUE);
13123
13124     basic_filebuf_char_ctor_file(&filebuf_char_stderr, stderr);
13125     basic_ostream_char_ctor(&cerr.obj, &filebuf_char_stderr.base, FALSE/*FIXME*/, TRUE);
13126
13127     basic_filebuf_short_ctor_file(&filebuf_short_stderr, stderr);
13128     basic_ostream_short_ctor(&ucerr.obj, &filebuf_short_stderr.base, FALSE/*FIXME*/, TRUE);
13129
13130     basic_filebuf_wchar_ctor_file(&filebuf_wchar_stderr, stderr);
13131     basic_ostream_wchar_ctor(&wcerr.obj, &filebuf_wchar_stderr.base, FALSE/*FIXME*/, TRUE);
13132
13133     basic_filebuf_char_ctor_file(&filebuf_char_log, stderr);
13134     basic_ostream_char_ctor(&clog.obj, &filebuf_char_log.base, FALSE/*FIXME*/, TRUE);
13135
13136     basic_filebuf_short_ctor_file(&filebuf_short_log, stderr);
13137     basic_ostream_short_ctor(&uclog.obj, &filebuf_short_log.base, FALSE/*FIXME*/, TRUE);
13138
13139     basic_filebuf_wchar_ctor_file(&filebuf_wchar_log, stderr);
13140     basic_ostream_wchar_ctor(&wclog.obj, &filebuf_wchar_log.base, FALSE/*FIXME*/, TRUE);
13141 }
13142
13143 void free_io(void)
13144 {
13145     basic_istream_char_dtor(basic_istream_char_to_basic_ios(&cin.obj));
13146     basic_filebuf_char_dtor(&filebuf_char_stdin);
13147
13148     basic_istream_wchar_dtor(basic_istream_wchar_to_basic_ios(&ucin.obj));
13149     basic_filebuf_wchar_dtor(&filebuf_short_stdin);
13150
13151     basic_istream_wchar_dtor(basic_istream_wchar_to_basic_ios(&wcin.obj));
13152     basic_filebuf_wchar_dtor(&filebuf_wchar_stdin);
13153
13154     basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(&cout.obj));
13155     basic_filebuf_char_dtor(&filebuf_char_stdout);
13156
13157     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&ucout.obj));
13158     basic_filebuf_wchar_dtor(&filebuf_short_stdout);
13159
13160     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&wcout.obj));
13161     basic_filebuf_wchar_dtor(&filebuf_wchar_stdout);
13162
13163     basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(&cerr.obj));
13164     basic_filebuf_char_dtor(&filebuf_char_stderr);
13165
13166     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&ucerr.obj));
13167     basic_filebuf_wchar_dtor(&filebuf_short_stderr);
13168
13169     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&wcerr.obj));
13170     basic_filebuf_wchar_dtor(&filebuf_wchar_stderr);
13171
13172     basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(&clog.obj));
13173     basic_filebuf_char_dtor(&filebuf_char_log);
13174
13175     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&uclog.obj));
13176     basic_filebuf_wchar_dtor(&filebuf_short_log);
13177
13178     basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&wclog.obj));
13179     basic_filebuf_wchar_dtor(&filebuf_wchar_log);
13180 }