Release 1.6-rc2.
[wine/testsucceed.git] / dlls / msvcp100 / ios.c
blob16677f23339b69c88ed7015b7b20302fce6c5087
1 /*
2 * Copyright 2011 Piotr Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "config.h"
21 #include <stdarg.h>
22 #include <stdio.h>
23 #include <limits.h>
24 #include <share.h>
26 #include "msvcp.h"
27 #include "windef.h"
28 #include "winbase.h"
29 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(msvcp);
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;
37 typedef struct {
38 streamoff off;
39 __int64 DECLSPEC_ALIGN(8) pos;
40 int state;
41 } fpos_int;
43 static inline const char* debugstr_fpos_int(fpos_int *fpos)
45 return wine_dbg_sprintf("fpos(%s %s %d)", wine_dbgstr_longlong(fpos->off), wine_dbgstr_longlong(fpos->pos), fpos->state);
48 typedef struct {
49 void (__cdecl *pfunc)(ios_base*, streamsize);
50 streamsize arg;
51 } manip_streamsize;
53 typedef struct {
54 void (__cdecl *pfunc)(ios_base*, int);
55 int arg;
56 } manip_int;
58 typedef enum {
59 INITFL_new = 0,
60 INITFL_open = 1,
61 INITFL_close = 2
62 } basic_filebuf__Initfl;
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;
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;
84 typedef struct {
85 ios_base base;
86 basic_streambuf_char *strbuf;
87 struct _basic_ostream_char *stream;
88 char fillch;
89 } basic_ios_char;
91 typedef struct {
92 ios_base base;
93 basic_streambuf_wchar *strbuf;
94 struct _basic_ostream_wchar *stream;
95 wchar_t fillch;
96 } basic_ios_wchar;
98 typedef struct _basic_ostream_char {
99 const int *vbtable;
100 /* virtual inheritance
101 * basic_ios_char basic_ios;
103 } basic_ostream_char;
105 typedef struct _basic_ostream_wchar {
106 const int *vbtable;
107 /* virtual inheritance
108 * basic_ios_wchar basic_ios;
110 } basic_ostream_wchar;
112 typedef struct {
113 const int *vbtable;
114 streamsize count;
115 /* virtual inheritance
116 * basic_ios_char basic_ios;
118 } basic_istream_char;
120 typedef struct {
121 const int *vbtable;
122 streamsize count;
123 /* virtual inheritance
124 * basic_ios_wchar basic_ios;
126 } basic_istream_wchar;
128 typedef struct {
129 basic_istream_char base1;
130 basic_ostream_char base2;
131 /* virtual inheritance
132 * basic_ios_char basic_ios;
134 } basic_iostream_char;
136 typedef struct {
137 basic_istream_wchar base1;
138 basic_ostream_wchar base2;
139 /* virtual inheritance
140 * basic_ios_wchar basic_ios;
142 } basic_iostream_wchar;
144 extern const vtable_ptr MSVCP_iosb_vtable;
146 /* ??_7ios_base@std@@6B@ */
147 extern const vtable_ptr MSVCP_ios_base_vtable;
149 /* ??_7?$basic_ios@DU?$char_traits@D@std@@@std@@6B@ */
150 extern const vtable_ptr MSVCP_basic_ios_char_vtable;
152 /* ??_7?$basic_ios@_WU?$char_traits@_W@std@@@std@@6B@ */
153 extern const vtable_ptr MSVCP_basic_ios_wchar_vtable;
155 /* ??_7?$basic_ios@GU?$char_traits@G@std@@@std@@6B@ */
156 extern const vtable_ptr MSVCP_basic_ios_short_vtable;
158 /* ??_7?$basic_streambuf@DU?$char_traits@D@std@@@std@@6B@ */
159 extern const vtable_ptr MSVCP_basic_streambuf_char_vtable;
161 /* ??_7?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@6B@ */
162 extern const vtable_ptr MSVCP_basic_streambuf_wchar_vtable;
164 /* ??_7?$basic_streambuf@GU?$char_traits@G@std@@@std@@6B@ */
165 extern const vtable_ptr MSVCP_basic_streambuf_short_vtable;
167 /* ??_7?$basic_filebuf@DU?$char_traits@D@std@@@std@@6B@ */
168 extern const vtable_ptr MSVCP_basic_filebuf_char_vtable;
170 /* ??_7?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@6B@ */
171 extern const vtable_ptr MSVCP_basic_filebuf_wchar_vtable;
173 /* ??_7?$basic_filebuf@GU?$char_traits@G@std@@@std@@6B@ */
174 extern const vtable_ptr MSVCP_basic_filebuf_short_vtable;
176 /* ??_8?$basic_ostream@DU?$char_traits@D@std@@@std@@7B@ */
177 const int basic_ostream_char_vbtable[] = {0, ALIGNED_SIZE(sizeof(basic_ostream_char), 8)};
178 /* ??_7?$basic_ostream@DU?$char_traits@D@std@@@std@@6B@ */
179 extern const vtable_ptr MSVCP_basic_ostream_char_vtable;
181 /* ??_8?$basic_ostream@_WU?$char_traits@_W@std@@@std@@7B@ */
182 const int basic_ostream_wchar_vbtable[] = {0, ALIGNED_SIZE(sizeof(basic_ostream_wchar), 8)};
183 /* ??_7?$basic_ostream@_WU?$char_traits@_W@std@@@std@@6B@ */
184 extern const vtable_ptr MSVCP_basic_ostream_wchar_vtable;
186 /* ??_8?$basic_ostream@GU?$char_traits@G@std@@@std@@7B@ */
187 const int basic_ostream_short_vbtable[] = {0, ALIGNED_SIZE(sizeof(basic_ostream_wchar), 8)};
188 /* ??_7?$basic_ostream@GU?$char_traits@G@std@@@std@@6B@ */
189 extern const vtable_ptr MSVCP_basic_ostream_short_vtable;
191 /* ??_8?$basic_istream@DU?$char_traits@D@std@@@std@@7B@ */
192 const int basic_istream_char_vbtable[] = {0, ALIGNED_SIZE(sizeof(basic_istream_char), 8)};
193 /* ??_7?$basic_istream@DU?$char_traits@D@std@@@std@@6B@ */
194 extern const vtable_ptr MSVCP_basic_istream_char_vtable;
196 /* ??_8?$basic_istream@_WU?$char_traits@_W@std@@@std@@7B@ */
197 const int basic_istream_wchar_vbtable[] = {0, ALIGNED_SIZE(sizeof(basic_istream_wchar), 8)};
198 /* ??_7?$basic_istream@_WU?$char_traits@_W@std@@@std@@6B@ */
199 extern const vtable_ptr MSVCP_basic_istream_wchar_vtable;
201 /* ??_8?$basic_istream@GU?$char_traits@G@std@@@std@@7B@ */
202 const int basic_istream_short_vbtable[] = {0, ALIGNED_SIZE(sizeof(basic_istream_wchar), 8)};
203 /* ??_7?$basic_istream@GU?$char_traits@G@std@@@std@@6B@ */
204 extern const vtable_ptr MSVCP_basic_istream_short_vtable;
206 /* ??_8?$basic_iostream@DU?$char_traits@D@std@@@std@@7B?$basic_istream@DU?$char_traits@D@std@@@1@@ */
207 const int basic_iostream_char_vbtable1[] = {0, ALIGNED_SIZE(sizeof(basic_iostream_char), 8)};
208 /* ??_8?$basic_iostream@DU?$char_traits@D@std@@@std@@7B?$basic_ostream@DU?$char_traits@D@std@@@1@@ */
209 const int basic_iostream_char_vbtable2[] = {0, ALIGNED_SIZE(sizeof(basic_iostream_char), 8)-FIELD_OFFSET(basic_iostream_char, base2)};
210 /* ??_7?$basic_iostream@DU?$char_traits@D@std@@@std@@6B@ */
211 extern const vtable_ptr MSVCP_basic_iostream_char_vtable;
213 /* ??_8?$basic_iostream@_WU?$char_traits@_W@std@@@std@@7B?$basic_istream@_WU?$char_traits@_W@std@@@1@@ */
214 /* ??_8?$basic_iostream@GU?$char_traits@G@std@@@std@@7B?$basic_istream@GU?$char_traits@G@std@@@1@@ */
215 const int basic_iostream_wchar_vbtable1[] = {0, ALIGNED_SIZE(sizeof(basic_iostream_wchar), 8)};
216 /* ??_8?$basic_iostream@_WU?$char_traits@_W@std@@@std@@7B?$basic_ostream@_WU?$char_traits@_W@std@@@1@@ */
217 /* ??_8?$basic_iostream@GU?$char_traits@G@std@@@std@@7B?$basic_ostream@GU?$char_traits@G@std@@@1@@ */
218 const int basic_iostream_wchar_vbtable2[] = {0, ALIGNED_SIZE(sizeof(basic_iostream_wchar), 8)-FIELD_OFFSET(basic_iostream_wchar, base2)};
219 /* ??_7?$basic_iostream@_WU?$char_traits@_W@std@@@std@@6B@ */
220 extern const vtable_ptr MSVCP_basic_iostream_wchar_vtable;
221 /* ??_7?$basic_iostream@GU?$char_traits@G@std@@@std@@6B@ */
222 extern const vtable_ptr MSVCP_basic_iostream_short_vtable;
224 DEFINE_RTTI_DATA0(iosb, 0, ".?AV?$_Iosb@H@std@@")
225 DEFINE_RTTI_DATA1(ios_base, 0, &iosb_rtti_base_descriptor, ".?AV?$_Iosb@H@std@@")
226 DEFINE_RTTI_DATA2(basic_ios_char, 0, &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
227 ".?AV?$basic_ios@DU?$char_traits@D@std@@@std@@")
228 DEFINE_RTTI_DATA2(basic_ios_wchar, 0, &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
229 ".?AV?$basic_ios@_WU?$char_traits@_W@std@@@std@@")
230 DEFINE_RTTI_DATA2(basic_ios_short, 0, &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
231 ".?AV?$basic_ios@GU?$char_traits@G@std@@@std@@")
232 DEFINE_RTTI_DATA0(basic_streambuf_char, 0,
233 ".?AV?$basic_streambuf@DU?$char_traits@D@std@@@std@@")
234 DEFINE_RTTI_DATA0(basic_streambuf_wchar, 0,
235 ".?AV?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@")
236 DEFINE_RTTI_DATA0(basic_streambuf_short, 0,
237 ".?AV?$basic_streambuf@GU?$char_traits@G@std@@@std@@")
238 DEFINE_RTTI_DATA1(basic_filebuf_char, 0, &basic_streambuf_char_rtti_base_descriptor,
239 ".?AV?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@")
240 DEFINE_RTTI_DATA1(basic_filebuf_wchar, 0, &basic_streambuf_wchar_rtti_base_descriptor,
241 ".?AV?$basic_filebuf@GU?$char_traits@G@std@@@std@@")
242 DEFINE_RTTI_DATA1(basic_filebuf_short, 0, &basic_streambuf_short_rtti_base_descriptor,
243 ".?AV?$basic_filebuf@DU?$char_traits@D@std@@@std@@")
244 DEFINE_RTTI_DATA3(basic_ostream_char, sizeof(basic_ostream_char), &basic_ios_char_rtti_base_descriptor,
245 &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
246 ".?AV?$basic_ostream@DU?$char_traits@D@std@@@std@@")
247 DEFINE_RTTI_DATA3(basic_ostream_wchar, sizeof(basic_ostream_wchar), &basic_ios_wchar_rtti_base_descriptor,
248 &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
249 ".?AV?$basic_ostream@_WU?$char_traits@_W@std@@@std@@")
250 DEFINE_RTTI_DATA3(basic_ostream_short, sizeof(basic_ostream_wchar), &basic_ios_short_rtti_base_descriptor,
251 &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
252 ".?AV?$basic_ostream@GU?$char_traits@G@std@@@std@@")
253 DEFINE_RTTI_DATA3(basic_istream_char, sizeof(basic_istream_char), &basic_ios_char_rtti_base_descriptor,
254 &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
255 ".?AV?$basic_istream@DU?$char_traits@D@std@@@std@@")
256 DEFINE_RTTI_DATA3(basic_istream_wchar, sizeof(basic_istream_wchar), &basic_ios_wchar_rtti_base_descriptor,
257 &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
258 ".?AV?$basic_istream@_WU?$char_traits@_W@std@@@std@@")
259 DEFINE_RTTI_DATA3(basic_istream_short, sizeof(basic_istream_wchar), &basic_ios_short_rtti_base_descriptor,
260 &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
261 ".?AV?$basic_istream@GU?$char_traits@G@std@@@std@@")
262 DEFINE_RTTI_DATA8(basic_iostream_char, sizeof(basic_iostream_char),
263 &basic_istream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
264 &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
265 &basic_ostream_char_rtti_base_descriptor, &basic_ios_char_rtti_base_descriptor,
266 &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
267 ".?AV?$basic_iostream@DU?$char_traits@D@std@@@std@@")
268 DEFINE_RTTI_DATA8(basic_iostream_wchar, sizeof(basic_iostream_wchar),
269 &basic_istream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
270 &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
271 &basic_ostream_wchar_rtti_base_descriptor, &basic_ios_wchar_rtti_base_descriptor,
272 &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
273 ".?AV?$basic_iostream@_WU?$char_traits@_W@std@@@std@@")
274 DEFINE_RTTI_DATA8(basic_iostream_short, sizeof(basic_iostream_wchar),
275 &basic_istream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
276 &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
277 &basic_ostream_short_rtti_base_descriptor, &basic_ios_short_rtti_base_descriptor,
278 &ios_base_rtti_base_descriptor, &iosb_rtti_base_descriptor,
279 ".?AV?$basic_iostream@GU?$char_traits@G@std@@@std@@")
281 #ifndef __GNUC__
282 void __asm_dummy_vtables(void) {
283 #endif
284 __ASM_VTABLE(iosb,
285 VTABLE_ADD_FUNC(iosb_vector_dtor));
286 __ASM_VTABLE(ios_base,
287 VTABLE_ADD_FUNC(ios_base_vector_dtor));
288 __ASM_VTABLE(basic_ios_char,
289 VTABLE_ADD_FUNC(basic_ios_char_vector_dtor));
290 __ASM_VTABLE(basic_ios_wchar,
291 VTABLE_ADD_FUNC(basic_ios_wchar_vector_dtor));
292 __ASM_VTABLE(basic_ios_short,
293 VTABLE_ADD_FUNC(basic_ios_wchar_vector_dtor));
294 __ASM_VTABLE(basic_streambuf_char,
295 VTABLE_ADD_FUNC(basic_streambuf_char_vector_dtor)
296 VTABLE_ADD_FUNC(basic_streambuf_char__Lock)
297 VTABLE_ADD_FUNC(basic_streambuf_char__Unlock)
298 VTABLE_ADD_FUNC(basic_streambuf_char_overflow)
299 VTABLE_ADD_FUNC(basic_streambuf_char_pbackfail)
300 VTABLE_ADD_FUNC(basic_streambuf_char_showmanyc)
301 VTABLE_ADD_FUNC(basic_streambuf_char_underflow)
302 VTABLE_ADD_FUNC(basic_streambuf_char_uflow)
303 VTABLE_ADD_FUNC(basic_streambuf_char_xsgetn)
304 VTABLE_ADD_FUNC(basic_streambuf_char_xsputn)
305 VTABLE_ADD_FUNC(basic_streambuf_char_seekoff)
306 VTABLE_ADD_FUNC(basic_streambuf_char_seekpos)
307 VTABLE_ADD_FUNC(basic_streambuf_char_setbuf)
308 VTABLE_ADD_FUNC(basic_streambuf_char_sync)
309 VTABLE_ADD_FUNC(basic_streambuf_char_imbue));
310 __ASM_VTABLE(basic_streambuf_wchar,
311 VTABLE_ADD_FUNC(basic_streambuf_wchar_vector_dtor)
312 VTABLE_ADD_FUNC(basic_streambuf_wchar__Lock)
313 VTABLE_ADD_FUNC(basic_streambuf_wchar__Unlock)
314 VTABLE_ADD_FUNC(basic_streambuf_wchar_overflow)
315 VTABLE_ADD_FUNC(basic_streambuf_wchar_pbackfail)
316 VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
317 VTABLE_ADD_FUNC(basic_streambuf_wchar_underflow)
318 VTABLE_ADD_FUNC(basic_streambuf_wchar_uflow)
319 VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
320 VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
321 VTABLE_ADD_FUNC(basic_streambuf_wchar_seekoff)
322 VTABLE_ADD_FUNC(basic_streambuf_wchar_seekpos)
323 VTABLE_ADD_FUNC(basic_streambuf_wchar_setbuf)
324 VTABLE_ADD_FUNC(basic_streambuf_wchar_sync)
325 VTABLE_ADD_FUNC(basic_streambuf_wchar_imbue));
326 __ASM_VTABLE(basic_streambuf_short,
327 VTABLE_ADD_FUNC(basic_streambuf_wchar_vector_dtor)
328 VTABLE_ADD_FUNC(basic_streambuf_wchar__Lock)
329 VTABLE_ADD_FUNC(basic_streambuf_wchar__Unlock)
330 VTABLE_ADD_FUNC(basic_streambuf_wchar_overflow)
331 VTABLE_ADD_FUNC(basic_streambuf_wchar_pbackfail)
332 VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
333 VTABLE_ADD_FUNC(basic_streambuf_wchar_underflow)
334 VTABLE_ADD_FUNC(basic_streambuf_wchar_uflow)
335 VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
336 VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
337 VTABLE_ADD_FUNC(basic_streambuf_wchar_seekoff)
338 VTABLE_ADD_FUNC(basic_streambuf_wchar_seekpos)
339 VTABLE_ADD_FUNC(basic_streambuf_wchar_setbuf)
340 VTABLE_ADD_FUNC(basic_streambuf_wchar_sync)
341 VTABLE_ADD_FUNC(basic_streambuf_wchar_imbue));
342 __ASM_VTABLE(basic_filebuf_char,
343 VTABLE_ADD_FUNC(basic_filebuf_char_vector_dtor)
344 VTABLE_ADD_FUNC(basic_streambuf_char__Lock)
345 VTABLE_ADD_FUNC(basic_streambuf_char__Unlock)
346 VTABLE_ADD_FUNC(basic_filebuf_char_overflow)
347 VTABLE_ADD_FUNC(basic_filebuf_char_pbackfail)
348 VTABLE_ADD_FUNC(basic_streambuf_char_showmanyc)
349 VTABLE_ADD_FUNC(basic_filebuf_char_underflow)
350 VTABLE_ADD_FUNC(basic_filebuf_char_uflow)
351 VTABLE_ADD_FUNC(basic_streambuf_char_xsgetn)
352 VTABLE_ADD_FUNC(basic_streambuf_char_xsputn)
353 VTABLE_ADD_FUNC(basic_filebuf_char_seekoff)
354 VTABLE_ADD_FUNC(basic_filebuf_char_seekpos)
355 VTABLE_ADD_FUNC(basic_filebuf_char_setbuf)
356 VTABLE_ADD_FUNC(basic_filebuf_char_sync)
357 VTABLE_ADD_FUNC(basic_filebuf_char_imbue));
358 __ASM_VTABLE(basic_filebuf_wchar,
359 VTABLE_ADD_FUNC(basic_filebuf_wchar_vector_dtor)
360 VTABLE_ADD_FUNC(basic_streambuf_wchar__Lock)
361 VTABLE_ADD_FUNC(basic_streambuf_wchar__Unlock)
362 VTABLE_ADD_FUNC(basic_filebuf_wchar_overflow)
363 VTABLE_ADD_FUNC(basic_filebuf_wchar_pbackfail)
364 VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
365 VTABLE_ADD_FUNC(basic_filebuf_wchar_underflow)
366 VTABLE_ADD_FUNC(basic_filebuf_wchar_uflow)
367 VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
368 VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
369 VTABLE_ADD_FUNC(basic_filebuf_wchar_seekoff)
370 VTABLE_ADD_FUNC(basic_filebuf_wchar_seekpos)
371 VTABLE_ADD_FUNC(basic_filebuf_wchar_setbuf)
372 VTABLE_ADD_FUNC(basic_filebuf_wchar_sync)
373 VTABLE_ADD_FUNC(basic_filebuf_wchar_imbue));
374 __ASM_VTABLE(basic_filebuf_short,
375 VTABLE_ADD_FUNC(basic_filebuf_wchar_vector_dtor)
376 VTABLE_ADD_FUNC(basic_streambuf_wchar__Lock)
377 VTABLE_ADD_FUNC(basic_streambuf_wchar__Unlock)
378 VTABLE_ADD_FUNC(basic_filebuf_wchar_overflow)
379 VTABLE_ADD_FUNC(basic_filebuf_wchar_pbackfail)
380 VTABLE_ADD_FUNC(basic_streambuf_wchar_showmanyc)
381 VTABLE_ADD_FUNC(basic_filebuf_wchar_underflow)
382 VTABLE_ADD_FUNC(basic_filebuf_wchar_uflow)
383 VTABLE_ADD_FUNC(basic_streambuf_wchar_xsgetn)
384 VTABLE_ADD_FUNC(basic_streambuf_wchar_xsputn)
385 VTABLE_ADD_FUNC(basic_filebuf_wchar_seekoff)
386 VTABLE_ADD_FUNC(basic_filebuf_wchar_seekpos)
387 VTABLE_ADD_FUNC(basic_filebuf_short_setbuf)
388 VTABLE_ADD_FUNC(basic_filebuf_wchar_sync)
389 VTABLE_ADD_FUNC(basic_filebuf_short_imbue));
390 __ASM_VTABLE(basic_ostream_char,
391 VTABLE_ADD_FUNC(basic_ostream_char_vector_dtor));
392 __ASM_VTABLE(basic_ostream_wchar,
393 VTABLE_ADD_FUNC(basic_ostream_wchar_vector_dtor));
394 __ASM_VTABLE(basic_ostream_short,
395 VTABLE_ADD_FUNC(basic_ostream_wchar_vector_dtor));
396 __ASM_VTABLE(basic_istream_char,
397 VTABLE_ADD_FUNC(basic_istream_char_vector_dtor));
398 __ASM_VTABLE(basic_istream_wchar,
399 VTABLE_ADD_FUNC(basic_istream_wchar_vector_dtor));
400 __ASM_VTABLE(basic_istream_short,
401 VTABLE_ADD_FUNC(basic_istream_wchar_vector_dtor));
402 __ASM_VTABLE(basic_iostream_char,
403 VTABLE_ADD_FUNC(basic_iostream_char_vector_dtor));
404 __ASM_VTABLE(basic_iostream_wchar,
405 VTABLE_ADD_FUNC(basic_iostream_wchar_vector_dtor));
406 __ASM_VTABLE(basic_iostream_short,
407 VTABLE_ADD_FUNC(basic_iostream_wchar_vector_dtor));
408 #ifndef __GNUC__
410 #endif
412 /* ?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD00@Z */
413 /* ?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXPEAD00@Z */
414 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_setp_next, 16)
415 void __thiscall basic_streambuf_char_setp_next(basic_streambuf_char *this, char *first, char *next, char *last)
417 TRACE("(%p %p %p %p)\n", this, first, next, last);
419 this->wbuf = first;
420 this->wpos = next;
421 this->wsize = last-next;
424 /* ?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD0@Z */
425 /* ?setp@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXPEAD0@Z */
426 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_setp, 12)
427 void __thiscall basic_streambuf_char_setp(basic_streambuf_char *this, char *first, char *last)
429 basic_streambuf_char_setp_next(this, first, first, last);
432 /* ?setg@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAD00@Z */
433 /* ?setg@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXPEAD00@Z */
434 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_setg, 16)
435 void __thiscall basic_streambuf_char_setg(basic_streambuf_char *this, char *first, char *next, char *last)
437 TRACE("(%p %p %p %p)\n", this, first, next, last);
439 this->rbuf = first;
440 this->rpos = next;
441 this->rsize = last-next;
444 /* ?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXXZ */
445 /* ?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXXZ */
446 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Init_empty, 4)
447 void __thiscall basic_streambuf_char__Init_empty(basic_streambuf_char *this)
449 TRACE("(%p)\n", this);
451 this->prbuf = &this->rbuf;
452 this->pwbuf = &this->wbuf;
453 this->prpos = &this->rpos;
454 this->pwpos = &this->wpos;
455 this->prsize = &this->rsize;
456 this->pwsize = &this->wsize;
458 basic_streambuf_char_setp(this, NULL, NULL);
459 basic_streambuf_char_setg(this, NULL, NULL, NULL);
462 /* ??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAE@W4_Uninitialized@1@@Z */
463 /* ??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAA@W4_Uninitialized@1@@Z */
464 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_ctor_uninitialized, 8)
465 basic_streambuf_char* __thiscall basic_streambuf_char_ctor_uninitialized(basic_streambuf_char *this, int uninitialized)
467 TRACE("(%p %d)\n", this, uninitialized);
468 this->vtable = &MSVCP_basic_streambuf_char_vtable;
469 mutex_ctor(&this->lock);
470 return this;
473 /* ??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAE@XZ */
474 /* ??0?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAA@XZ */
475 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_ctor, 4)
476 basic_streambuf_char* __thiscall basic_streambuf_char_ctor(basic_streambuf_char *this)
478 TRACE("(%p)\n", this);
480 this->vtable = &MSVCP_basic_streambuf_char_vtable;
481 mutex_ctor(&this->lock);
482 this->loc = MSVCRT_operator_new(sizeof(locale));
483 locale_ctor(this->loc);
484 basic_streambuf_char__Init_empty(this);
486 return this;
489 /* ??1?$basic_streambuf@DU?$char_traits@D@std@@@std@@UAE@XZ */
490 /* ??1?$basic_streambuf@DU?$char_traits@D@std@@@std@@UEAA@XZ */
491 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_dtor, 4)
492 void __thiscall basic_streambuf_char_dtor(basic_streambuf_char *this)
494 TRACE("(%p)\n", this);
496 mutex_dtor(&this->lock);
497 locale_dtor(this->loc);
498 MSVCRT_operator_delete(this->loc);
501 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_vector_dtor, 8)
502 basic_streambuf_char* __thiscall basic_streambuf_char_vector_dtor(basic_streambuf_char *this, unsigned int flags)
504 TRACE("(%p %x)\n", this, flags);
505 if(flags & 2) {
506 /* we have an array, with the number of elements stored before the first object */
507 INT_PTR i, *ptr = (INT_PTR *)this-1;
509 for(i=*ptr-1; i>=0; i--)
510 basic_streambuf_char_dtor(this+i);
511 MSVCRT_operator_delete(ptr);
512 } else {
513 basic_streambuf_char_dtor(this);
514 if(flags & 1)
515 MSVCRT_operator_delete(this);
518 return this;
521 /* ?_Gnavail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEHXZ */
522 /* ?_Gnavail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBA_JXZ */
523 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Gnavail, 4)
524 streamsize __thiscall basic_streambuf_char__Gnavail(const basic_streambuf_char *this)
526 TRACE("(%p)\n", this);
527 return *this->prpos ? *this->prsize : 0;
530 /* ?_Gndec@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ */
531 /* ?_Gndec@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAPEADXZ */
532 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Gndec, 4)
533 char* __thiscall basic_streambuf_char__Gndec(basic_streambuf_char *this)
535 TRACE("(%p)\n", this);
536 (*this->prsize)++;
537 (*this->prpos)--;
538 return *this->prpos;
541 /* ?_Gninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ */
542 /* ?_Gninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAPEADXZ */
543 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Gninc, 4)
544 char* __thiscall basic_streambuf_char__Gninc(basic_streambuf_char *this)
546 TRACE("(%p)\n", this);
547 (*this->prsize)--;
548 return (*this->prpos)++;
551 /* ?_Gnpreinc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ */
552 /* ?_Gnpreinc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAPEADXZ */
553 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Gnpreinc, 4)
554 char* __thiscall basic_streambuf_char__Gnpreinc(basic_streambuf_char *this)
556 TRACE("(%p)\n", this);
557 (*this->prsize)--;
558 (*this->prpos)++;
559 return *this->prpos;
562 /* ?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXPAPAD0PAH001@Z */
563 /* ?_Init@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXPEAPEAD0PEAH001@Z */
564 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Init, 28)
565 void __thiscall basic_streambuf_char__Init(basic_streambuf_char *this, char **gf, char **gn, int *gc, char **pf, char **pn, int *pc)
567 TRACE("(%p %p %p %p %p %p %p)\n", this, gf, gn, gc, pf, pn, pc);
569 this->prbuf = gf;
570 this->pwbuf = pf;
571 this->prpos = gn;
572 this->pwpos = pn;
573 this->prsize = gc;
574 this->pwsize = pc;
577 /* ?_Lock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ */
578 /* ?_Lock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAXXZ */
579 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Lock, 4)
580 #define call_basic_streambuf_char__Lock(this) CALL_VTBL_FUNC(this, 4, \
581 void, (basic_streambuf_char*), (this))
582 void __thiscall basic_streambuf_char__Lock(basic_streambuf_char *this)
584 TRACE("(%p)\n", this);
585 mutex_lock(&this->lock);
588 /* ?_Pnavail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEHXZ */
589 /* ?_Pnavail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBA_JXZ */
590 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Pnavail, 4)
591 streamsize __thiscall basic_streambuf_char__Pnavail(const basic_streambuf_char *this)
593 TRACE("(%p)\n", this);
594 return *this->pwpos ? *this->pwsize : 0;
597 /* ?_Pninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEPADXZ */
598 /* ?_Pninc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAPEADXZ */
599 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Pninc, 4)
600 char* __thiscall basic_streambuf_char__Pninc(basic_streambuf_char *this)
602 TRACE("(%p)\n", this);
603 (*this->pwsize)--;
604 return (*this->pwpos)++;
607 /* ?underflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
608 /* ?underflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
609 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_underflow, 4)
610 #define call_basic_streambuf_char_underflow(this) CALL_VTBL_FUNC(this, 24, \
611 int, (basic_streambuf_char*), (this))
612 int __thiscall basic_streambuf_char_underflow(basic_streambuf_char *this)
614 TRACE("(%p)\n", this);
615 return EOF;
618 /* ?uflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
619 /* ?uflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
620 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_uflow, 4)
621 #define call_basic_streambuf_char_uflow(this) CALL_VTBL_FUNC(this, 28, \
622 int, (basic_streambuf_char*), (this))
623 int __thiscall basic_streambuf_char_uflow(basic_streambuf_char *this)
625 int ret;
627 TRACE("(%p)\n", this);
629 if(call_basic_streambuf_char_underflow(this)==EOF)
630 return EOF;
632 ret = (unsigned char)**this->prpos;
633 (*this->prsize)--;
634 (*this->prpos)++;
635 return ret;
638 /* ?_Xsgetn_s@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHPADIH@Z */
639 /* ?_Xsgetn_s@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JPEAD_K_J@Z */
640 static streamsize basic_streambuf_char__Xsgetn_s(basic_streambuf_char *this, char *ptr, MSVCP_size_t size, streamsize count)
642 streamsize copied, chunk;
643 int c;
645 TRACE("(%p %p %lu %s)\n", this, ptr, size, wine_dbgstr_longlong(count));
647 for(copied=0; copied<count && size;) {
648 chunk = basic_streambuf_char__Gnavail(this);
649 if(chunk > count-copied)
650 chunk = count-copied;
652 if(chunk > 0) {
653 memcpy_s(ptr+copied, size, *this->prpos, chunk);
654 *this->prpos += chunk;
655 *this->prsize -= chunk;
656 copied += chunk;
657 size -= chunk;
658 }else if((c = call_basic_streambuf_char_uflow(this)) != EOF) {
659 ptr[copied] = c;
660 copied++;
661 size--;
662 }else {
663 break;
667 return copied;
670 /* ?_Sgetn_s@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPADIH@Z */
671 /* ?_Sgetn_s@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA_JPEAD_K_J@Z */
672 static streamsize basic_streambuf_char__Sgetn_s(basic_streambuf_char *this, char *ptr, MSVCP_size_t size, streamsize count)
674 TRACE("(%p %p %lu %s)\n", this, ptr, size, wine_dbgstr_longlong(count));
675 return basic_streambuf_char__Xsgetn_s(this, ptr, size, count);
678 /* ?_Unlock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ */
679 /* ?_Unlock@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAXXZ */
680 DEFINE_THISCALL_WRAPPER(basic_streambuf_char__Unlock, 4)
681 #define call_basic_streambuf_char__Unlock(this) CALL_VTBL_FUNC(this, 8, \
682 void, (basic_streambuf_char*), (this))
683 void __thiscall basic_streambuf_char__Unlock(basic_streambuf_char *this)
685 TRACE("(%p)\n", this);
686 mutex_unlock(&this->lock);
689 /* ?eback@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
690 /* ?eback@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
691 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_eback, 4)
692 char* __thiscall basic_streambuf_char_eback(const basic_streambuf_char *this)
694 TRACE("(%p)\n", this);
695 return *this->prbuf;
698 /* ?gptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
699 /* ?gptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
700 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_gptr, 4)
701 char* __thiscall basic_streambuf_char_gptr(const basic_streambuf_char *this)
703 TRACE("(%p)\n", this);
704 return *this->prpos;
707 /* ?egptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
708 /* ?egptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
709 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_egptr, 4)
710 char* __thiscall basic_streambuf_char_egptr(const basic_streambuf_char *this)
712 TRACE("(%p)\n", this);
713 return *this->prpos+*this->prsize;
716 /* ?epptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
717 /* ?epptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
718 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_epptr, 4)
719 char* __thiscall basic_streambuf_char_epptr(const basic_streambuf_char *this)
721 TRACE("(%p)\n", this);
722 return *this->pwpos+*this->pwsize;
725 /* ?gbump@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXH@Z */
726 /* ?gbump@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXH@Z */
727 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_gbump, 8)
728 void __thiscall basic_streambuf_char_gbump(basic_streambuf_char *this, int off)
730 TRACE("(%p %d)\n", this, off);
731 *this->prpos += off;
732 *this->prsize -= off;
735 /* ?getloc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QBE?AVlocale@2@XZ */
736 /* ?getloc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEBA?AVlocale@2@XZ */
737 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_getloc, 8)
738 locale* __thiscall basic_streambuf_char_getloc(const basic_streambuf_char *this, locale *ret)
740 TRACE("(%p)\n", this);
741 return locale_copy_ctor(ret, this->loc);
744 /* ?imbue@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEXABVlocale@2@@Z */
745 /* ?imbue@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAXAEBVlocale@2@@Z */
746 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_imbue, 8)
747 #define call_basic_streambuf_char_imbue(this, loc) CALL_VTBL_FUNC(this, 56, \
748 void, (basic_streambuf_char*, const locale*), (this, loc))
749 void __thiscall basic_streambuf_char_imbue(basic_streambuf_char *this, const locale *loc)
751 TRACE("(%p %p)\n", this, loc);
754 /* ?overflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHH@Z */
755 /* ?overflow@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHH@Z */
756 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_overflow, 8)
757 #define call_basic_streambuf_char_overflow(this, ch) CALL_VTBL_FUNC(this, 12, \
758 int, (basic_streambuf_char*, int), (this, ch))
759 int __thiscall basic_streambuf_char_overflow(basic_streambuf_char *this, int ch)
761 TRACE("(%p %d)\n", this, ch);
762 return EOF;
765 /* ?pbackfail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHH@Z */
766 /* ?pbackfail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHH@Z */
767 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pbackfail, 8)
768 #define call_basic_streambuf_char_pbackfail(this, ch) CALL_VTBL_FUNC(this, 16, \
769 int, (basic_streambuf_char*, int), (this, ch))
770 int __thiscall basic_streambuf_char_pbackfail(basic_streambuf_char *this, int ch)
772 TRACE("(%p %d)\n", this, ch);
773 return EOF;
776 /* ?pbase@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
777 /* ?pbase@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
778 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pbase, 4)
779 char* __thiscall basic_streambuf_char_pbase(const basic_streambuf_char *this)
781 TRACE("(%p)\n", this);
782 return *this->pwbuf;
785 /* ?pbump@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IAEXH@Z */
786 /* ?pbump@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEAAXH@Z */
787 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pbump, 8)
788 void __thiscall basic_streambuf_char_pbump(basic_streambuf_char *this, int off)
790 TRACE("(%p %d)\n", this, off);
791 *this->pwpos += off;
792 *this->pwsize -= off;
795 /* ?pptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IBEPADXZ */
796 /* ?pptr@?$basic_streambuf@DU?$char_traits@D@std@@@std@@IEBAPEADXZ */
797 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pptr, 4)
798 char* __thiscall basic_streambuf_char_pptr(const basic_streambuf_char *this)
800 TRACE("(%p)\n", this);
801 return *this->pwpos;
804 /* ?pubimbue@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
805 /* ?pubimbue@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
806 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubimbue, 12)
807 locale* __thiscall basic_streambuf_char_pubimbue(basic_streambuf_char *this, locale *ret, const locale *loc)
809 TRACE("(%p %p)\n", this, loc);
810 memcpy(ret, this->loc, sizeof(locale));
811 call_basic_streambuf_char_imbue(this, loc);
812 locale_copy_ctor(this->loc, loc);
813 return ret;
816 /* ?seekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
817 /* ?seekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
818 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_seekoff, 24)
819 #define call_basic_streambuf_char_seekoff(this, ret, off, way, mode) CALL_VTBL_FUNC(this, 40, \
820 fpos_int*, (basic_streambuf_char*, fpos_int*, streamoff, int, int), (this, ret, off, way, mode))
821 fpos_int* __thiscall basic_streambuf_char_seekoff(basic_streambuf_char *this,
822 fpos_int *ret, streamoff off, int way, int mode)
824 TRACE("(%p %s %d %d)\n", this, wine_dbgstr_longlong(off), way, mode);
825 ret->off = -1;
826 ret->pos = 0;
827 ret->state = 0;
828 return ret;
831 /* ?pubseekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@JHH@Z */
832 /* ?pubseekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@_JHH@Z */
833 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubseekoff, 24)
834 fpos_int* __thiscall basic_streambuf_char_pubseekoff(basic_streambuf_char *this,
835 fpos_int *ret, streamoff off, int way, int mode)
837 TRACE("(%p %s %d %d)\n", this, wine_dbgstr_longlong(off), way, mode);
838 return call_basic_streambuf_char_seekoff(this, ret, off, way, mode);
841 /* ?pubseekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@JII@Z */
842 /* ?pubseekoff@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@_JII@Z */
843 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubseekoff_old, 24)
844 fpos_int* __thiscall basic_streambuf_char_pubseekoff_old(basic_streambuf_char *this,
845 fpos_int *ret, streamoff off, unsigned int way, unsigned int mode)
847 TRACE("(%p %s %d %d)\n", this, wine_dbgstr_longlong(off), way, mode);
848 return basic_streambuf_char_pubseekoff(this, ret, off, way, mode);
851 /* ?seekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
852 /* ?seekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
853 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_seekpos, 36)
854 #define call_basic_streambuf_char_seekpos(this, ret, pos, mode) CALL_VTBL_FUNC(this, 44, \
855 fpos_int*, (basic_streambuf_char*, fpos_int*, fpos_int, int), (this, ret, pos, mode))
856 fpos_int* __thiscall basic_streambuf_char_seekpos(basic_streambuf_char *this,
857 fpos_int *ret, fpos_int pos, int mode)
859 TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
860 ret->off = -1;
861 ret->pos = 0;
862 ret->state = 0;
863 return ret;
866 /* ?pubseekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@V32@H@Z */
867 /* ?pubseekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@V32@H@Z */
868 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubseekpos, 36)
869 fpos_int* __thiscall basic_streambuf_char_pubseekpos(basic_streambuf_char *this,
870 fpos_int *ret, fpos_int pos, int mode)
872 TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
873 return call_basic_streambuf_char_seekpos(this, ret, pos, mode);
876 /* ?pubseekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@V32@I@Z */
877 /* ?pubseekpos@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@V32@I@Z */
878 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubseekpos_old, 36)
879 fpos_int* __thiscall basic_streambuf_char_pubseekpos_old(basic_streambuf_char *this,
880 fpos_int *ret, fpos_int pos, unsigned int mode)
882 TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
883 return basic_streambuf_char_pubseekpos(this, ret, pos, mode);
886 /* ?setbuf@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEPAV12@PADH@Z */
887 /* ?setbuf@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAPEAV12@PEAD_J@Z */
888 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_setbuf, 16)
889 #define call_basic_streambuf_char_setbuf(this, buf, count) CALL_VTBL_FUNC(this, 48, \
890 basic_streambuf_char*, (basic_streambuf_char*, char*, streamsize), (this, buf, count))
891 basic_streambuf_char* __thiscall basic_streambuf_char_setbuf(basic_streambuf_char *this, char *buf, streamsize count)
893 TRACE("(%p %p %s)\n", this, buf, wine_dbgstr_longlong(count));
894 return this;
897 /* ?pubsetbuf@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEPAV12@PADH@Z */
898 /* ?pubsetbuf@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@PEAD_J@Z */
899 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubsetbuf, 16)
900 basic_streambuf_char* __thiscall basic_streambuf_char_pubsetbuf(basic_streambuf_char *this, char *buf, streamsize count)
902 TRACE("(%p %p %s)\n", this, buf, wine_dbgstr_longlong(count));
903 return call_basic_streambuf_char_setbuf(this, buf, count);
906 /* ?sync@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
907 /* ?sync@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
908 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sync, 4)
909 #define call_basic_streambuf_char_sync(this) CALL_VTBL_FUNC(this, 52, \
910 int, (basic_streambuf_char*), (this))
911 int __thiscall basic_streambuf_char_sync(basic_streambuf_char *this)
913 TRACE("(%p)\n", this);
914 return 0;
917 /* ?pubsync@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
918 /* ?pubsync@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ */
919 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_pubsync, 4)
920 int __thiscall basic_streambuf_char_pubsync(basic_streambuf_char *this)
922 TRACE("(%p)\n", this);
923 return call_basic_streambuf_char_sync(this);
926 /* ?sgetn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPADH@Z */
927 /* ?sgetn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA_JPEAD_J@Z */
928 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sgetn, 16)
929 streamsize __thiscall basic_streambuf_char_sgetn(basic_streambuf_char *this, char *ptr, streamsize count)
931 TRACE("(%p %p %s)\n", this, ptr, wine_dbgstr_longlong(count));
932 return basic_streambuf_char__Xsgetn_s(this, ptr, -1, count);
935 /* ?showmanyc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
936 /* ?showmanyc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JXZ */
937 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_showmanyc, 4)
938 #define call_basic_streambuf_char_showmanyc(this) CALL_VTBL_FUNC(this, 20, \
939 streamsize, (basic_streambuf_char*), (this))
940 streamsize __thiscall basic_streambuf_char_showmanyc(basic_streambuf_char *this)
942 TRACE("(%p)\n", this);
943 return 0;
946 /* ?in_avail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
947 /* ?in_avail@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA_JXZ */
948 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_in_avail, 4)
949 streamsize __thiscall basic_streambuf_char_in_avail(basic_streambuf_char *this)
951 streamsize ret;
953 TRACE("(%p)\n", this);
955 ret = basic_streambuf_char__Gnavail(this);
956 return ret ? ret : call_basic_streambuf_char_showmanyc(this);
959 /* ?sputbackc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHD@Z */
960 /* ?sputbackc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHD@Z */
961 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sputbackc, 8)
962 int __thiscall basic_streambuf_char_sputbackc(basic_streambuf_char *this, char ch)
964 TRACE("(%p %d)\n", this, ch);
965 if(*this->prpos && *this->prpos>*this->prbuf && (*this->prpos)[-1]==ch) {
966 (*this->prsize)++;
967 (*this->prpos)--;
968 return (unsigned char)ch;
971 return call_basic_streambuf_char_pbackfail(this, (unsigned char)ch);
974 /* ?sputc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHD@Z */
975 /* ?sputc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHD@Z */
976 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sputc, 8)
977 int __thiscall basic_streambuf_char_sputc(basic_streambuf_char *this, char ch)
979 TRACE("(%p %d)\n", this, ch);
980 return basic_streambuf_char__Pnavail(this) ?
981 (*basic_streambuf_char__Pninc(this) = ch) :
982 call_basic_streambuf_char_overflow(this, (unsigned char)ch);
985 /* ?sungetc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
986 /* ?sungetc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ */
987 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sungetc, 4)
988 int __thiscall basic_streambuf_char_sungetc(basic_streambuf_char *this)
990 TRACE("(%p)\n", this);
991 if(*this->prpos && *this->prpos>*this->prbuf) {
992 (*this->prsize)++;
993 (*this->prpos)--;
994 return (unsigned char)**this->prpos;
997 return call_basic_streambuf_char_pbackfail(this, EOF);
1000 /* ?stossc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEXXZ */
1001 /* ?stossc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAXXZ */
1002 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_stossc, 4)
1003 void __thiscall basic_streambuf_char_stossc(basic_streambuf_char *this)
1005 TRACE("(%p)\n", this);
1006 if(basic_streambuf_char__Gnavail(this))
1007 basic_streambuf_char__Gninc(this);
1008 else
1009 call_basic_streambuf_char_uflow(this);
1012 /* ?sbumpc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1013 /* ?sbumpc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ */
1014 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sbumpc, 4)
1015 int __thiscall basic_streambuf_char_sbumpc(basic_streambuf_char *this)
1017 TRACE("(%p)\n", this);
1018 return basic_streambuf_char__Gnavail(this) ?
1019 (int)(unsigned char)*basic_streambuf_char__Gninc(this) : call_basic_streambuf_char_uflow(this);
1022 /* ?sgetc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1023 /* ?sgetc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ */
1024 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sgetc, 4)
1025 int __thiscall basic_streambuf_char_sgetc(basic_streambuf_char *this)
1027 TRACE("(%p)\n", this);
1028 return basic_streambuf_char__Gnavail(this) ?
1029 (int)(unsigned char)*basic_streambuf_char_gptr(this) : call_basic_streambuf_char_underflow(this);
1032 /* ?snextc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHXZ */
1033 /* ?snextc@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAAHXZ */
1034 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_snextc, 4)
1035 int __thiscall basic_streambuf_char_snextc(basic_streambuf_char *this)
1037 TRACE("(%p)\n", this);
1039 if(basic_streambuf_char__Gnavail(this) > 1)
1040 return (unsigned char)*basic_streambuf_char__Gnpreinc(this);
1041 return basic_streambuf_char_sbumpc(this)==EOF ?
1042 EOF : basic_streambuf_char_sgetc(this);
1045 /* ?xsgetn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHPADH@Z */
1046 /* ?xsgetn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JPEAD_J@Z */
1047 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_xsgetn, 16)
1048 #define call_basic_streambuf_char_xsgetn(this, ptr, count) CALL_VTBL_FUNC(this, 32, \
1049 streamsize, (basic_streambuf_char*, char*, streamsize), (this, ptr, count))
1050 streamsize __thiscall basic_streambuf_char_xsgetn(basic_streambuf_char *this, char *ptr, streamsize count)
1052 TRACE("(%p %p %s)\n", this, ptr, wine_dbgstr_longlong(count));
1053 return basic_streambuf_char__Xsgetn_s(this, ptr, -1, count);
1056 /* ?xsputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MAEHPBDH@Z */
1057 /* ?xsputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@MEAA_JPEBD_J@Z */
1058 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_xsputn, 16)
1059 #define call_basic_streambuf_char_xsputn(this, ptr, count) CALL_VTBL_FUNC(this, 36, \
1060 streamsize, (basic_streambuf_char*, const char*, streamsize), (this, ptr, count))
1061 streamsize __thiscall basic_streambuf_char_xsputn(basic_streambuf_char *this, const char *ptr, streamsize count)
1063 streamsize copied, chunk;
1065 TRACE("(%p %p %s)\n", this, ptr, wine_dbgstr_longlong(count));
1067 for(copied=0; copied<count;) {
1068 chunk = basic_streambuf_char__Pnavail(this);
1069 if(chunk > count-copied)
1070 chunk = count-copied;
1072 if(chunk > 0) {
1073 memcpy(*this->pwpos, ptr+copied, chunk);
1074 *this->pwpos += chunk;
1075 *this->pwsize -= chunk;
1076 copied += chunk;
1077 }else if(call_basic_streambuf_char_overflow(this, (unsigned char)ptr[copied]) != EOF) {
1078 copied++;
1079 }else {
1080 break;
1084 return copied;
1087 /* ?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QAEHPBDH@Z */
1088 /* ?sputn@?$basic_streambuf@DU?$char_traits@D@std@@@std@@QEAA_JPEBD_J@Z */
1089 DEFINE_THISCALL_WRAPPER(basic_streambuf_char_sputn, 16)
1090 streamsize __thiscall basic_streambuf_char_sputn(basic_streambuf_char *this, const char *ptr, streamsize count)
1092 TRACE("(%p %p %s)\n", this, ptr, wine_dbgstr_longlong(count));
1093 return call_basic_streambuf_char_xsputn(this, ptr, count);
1096 /* ?setp@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXPA_W00@Z */
1097 /* ?setp@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEA_W00@Z */
1098 /* ?setp@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXPAG00@Z */
1099 /* ?setp@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXPEAG00@Z */
1100 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_setp_next, 16)
1101 void __thiscall basic_streambuf_wchar_setp_next(basic_streambuf_wchar *this, wchar_t *first, wchar_t *next, wchar_t *last)
1103 TRACE("(%p %p %p %p)\n", this, first, next, last);
1105 this->wbuf = first;
1106 this->wpos = next;
1107 this->wsize = last-next;
1110 /* ?setp@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXPA_W0@Z */
1111 /* ?setp@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEA_W0@Z */
1112 /* ?setp@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXPAG0@Z */
1113 /* ?setp@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXPEAG0@Z */
1114 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_setp, 12)
1115 void __thiscall basic_streambuf_wchar_setp(basic_streambuf_wchar *this, wchar_t *first, wchar_t *last)
1117 basic_streambuf_wchar_setp_next(this, first, first, last);
1120 /* ?setg@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXPA_W00@Z */
1121 /* ?setg@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEA_W00@Z */
1122 /* ?setg@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXPAG00@Z */
1123 /* ?setg@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXPEAG00@Z */
1124 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_setg, 16)
1125 void __thiscall basic_streambuf_wchar_setg(basic_streambuf_wchar *this, wchar_t *first, wchar_t *next, wchar_t *last)
1127 TRACE("(%p %p %p %p)\n", this, first, next, last);
1129 this->rbuf = first;
1130 this->rpos = next;
1131 this->rsize = last-next;
1134 /* ?_Init@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXXZ */
1135 /* ?_Init@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXXZ */
1136 /* ?_Init@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXXZ */
1137 /* ?_Init@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXXZ */
1138 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Init_empty, 4)
1139 void __thiscall basic_streambuf_wchar__Init_empty(basic_streambuf_wchar *this)
1141 TRACE("(%p)\n", this);
1143 this->prbuf = &this->rbuf;
1144 this->pwbuf = &this->wbuf;
1145 this->prpos = &this->rpos;
1146 this->pwpos = &this->wpos;
1147 this->prsize = &this->rsize;
1148 this->pwsize = &this->wsize;
1150 basic_streambuf_wchar_setp(this, NULL, NULL);
1151 basic_streambuf_wchar_setg(this, NULL, NULL, NULL);
1154 /* ??0?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAE@W4_Uninitialized@1@@Z */
1155 /* ??0?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAA@W4_Uninitialized@1@@Z */
1156 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_ctor_uninitialized, 8)
1157 basic_streambuf_wchar* __thiscall basic_streambuf_wchar_ctor_uninitialized(basic_streambuf_wchar *this, int uninitialized)
1159 TRACE("(%p %d)\n", this, uninitialized);
1160 this->vtable = &MSVCP_basic_streambuf_wchar_vtable;
1161 mutex_ctor(&this->lock);
1162 return this;
1165 /* ??0?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAE@W4_Uninitialized@1@@Z */
1166 /* ??0?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAA@W4_Uninitialized@1@@Z */
1167 DEFINE_THISCALL_WRAPPER(basic_streambuf_short_ctor_uninitialized, 8)
1168 basic_streambuf_wchar* __thiscall basic_streambuf_short_ctor_uninitialized(basic_streambuf_wchar *this, int uninitialized)
1170 TRACE("(%p %d)\n", this, uninitialized);
1171 basic_streambuf_wchar_ctor_uninitialized(this, uninitialized);
1172 this->vtable = &MSVCP_basic_streambuf_short_vtable;
1173 return this;
1176 /* ??0?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAE@XZ */
1177 /* ??0?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAA@XZ */
1178 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_ctor, 4)
1179 basic_streambuf_wchar* __thiscall basic_streambuf_wchar_ctor(basic_streambuf_wchar *this)
1181 TRACE("(%p)\n", this);
1183 this->vtable = &MSVCP_basic_streambuf_wchar_vtable;
1184 mutex_ctor(&this->lock);
1185 this->loc = MSVCRT_operator_new(sizeof(locale));
1186 locale_ctor(this->loc);
1187 basic_streambuf_wchar__Init_empty(this);
1189 return this;
1192 /* ??0?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAE@XZ */
1193 /* ??0?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAA@XZ */
1194 DEFINE_THISCALL_WRAPPER(basic_streambuf_short_ctor, 4)
1195 basic_streambuf_wchar* __thiscall basic_streambuf_short_ctor(basic_streambuf_wchar *this)
1197 TRACE("(%p)\n", this);
1198 basic_streambuf_wchar_ctor(this);
1199 this->vtable = &MSVCP_basic_streambuf_short_vtable;
1200 return this;
1203 /* ??1?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
1204 /* ??1?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
1205 /* ??1?$basic_streambuf@GU?$char_traits@G@std@@@std@@UAE@XZ */
1206 /* ??1?$basic_streambuf@GU?$char_traits@G@std@@@std@@UEAA@XZ */
1207 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_dtor, 4)
1208 void __thiscall basic_streambuf_wchar_dtor(basic_streambuf_wchar *this)
1210 TRACE("(%p)\n", this);
1212 mutex_dtor(&this->lock);
1213 locale_dtor(this->loc);
1214 MSVCRT_operator_delete(this->loc);
1217 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_vector_dtor, 8)
1218 basic_streambuf_wchar* __thiscall basic_streambuf_wchar_vector_dtor(basic_streambuf_wchar *this, unsigned int flags)
1220 TRACE("(%p %x)\n", this, flags);
1221 if(flags & 2) {
1222 /* we have an array, with the number of elements stored before the first object */
1223 INT_PTR i, *ptr = (INT_PTR *)this-1;
1225 for(i=*ptr-1; i>=0; i--)
1226 basic_streambuf_wchar_dtor(this+i);
1227 MSVCRT_operator_delete(ptr);
1228 } else {
1229 basic_streambuf_wchar_dtor(this);
1230 if(flags & 1)
1231 MSVCRT_operator_delete(this);
1234 return this;
1237 /* ?_Gnavail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEHXZ */
1238 /* ?_Gnavail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBA_JXZ */
1239 /* ?_Gnavail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEHXZ */
1240 /* ?_Gnavail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBA_JXZ */
1241 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Gnavail, 4)
1242 streamsize __thiscall basic_streambuf_wchar__Gnavail(const basic_streambuf_wchar *this)
1244 TRACE("(%p)\n", this);
1245 return *this->prpos ? *this->prsize : 0;
1248 /* ?_Gndec@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEPA_WXZ */
1249 /* ?_Gndec@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAPEA_WXZ */
1250 /* ?_Gndec@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEPAGXZ */
1251 /* ?_Gndec@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAPEAGXZ */
1252 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Gndec, 4)
1253 wchar_t* __thiscall basic_streambuf_wchar__Gndec(basic_streambuf_wchar *this)
1255 TRACE("(%p)\n", this);
1256 (*this->prsize)++;
1257 (*this->prpos)--;
1258 return *this->prpos;
1261 /* ?_Gninc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEPA_WXZ */
1262 /* ?_Gninc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAPEA_WXZ */
1263 /* ?_Gninc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEPAGXZ */
1264 /* ?_Gninc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAPEAGXZ */
1265 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Gninc, 4)
1266 wchar_t* __thiscall basic_streambuf_wchar__Gninc(basic_streambuf_wchar *this)
1268 TRACE("(%p)\n", this);
1269 (*this->prsize)--;
1270 return (*this->prpos)++;
1273 /* ?_Gnpreinc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEPA_WXZ */
1274 /* ?_Gnpreinc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAPEA_WXZ */
1275 /* ?_Gnpreinc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEPAGXZ */
1276 /* ?_Gnpreinc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAPEAGXZ */
1277 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Gnpreinc, 4)
1278 wchar_t* __thiscall basic_streambuf_wchar__Gnpreinc(basic_streambuf_wchar *this)
1280 TRACE("(%p)\n", this);
1281 (*this->prsize)--;
1282 (*this->prpos)++;
1283 return *this->prpos;
1286 /* ?_Init@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXPAPA_W0PAH001@Z */
1287 /* ?_Init@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEAPEA_W0PEAH001@Z */
1288 /* ?_Init@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXPAPAG0PAH001@Z */
1289 /* ?_Init@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXPEAPEAG0PEAH001@Z */
1290 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Init, 28)
1291 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)
1293 TRACE("(%p %p %p %p %p %p %p)\n", this, gf, gn, gc, pf, pn, pc);
1295 this->prbuf = gf;
1296 this->pwbuf = pf;
1297 this->prpos = gn;
1298 this->pwpos = pn;
1299 this->prsize = gc;
1300 this->pwsize = pc;
1303 /* ?_Lock@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
1304 /* ?_Lock@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
1305 /* ?_Lock@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEXXZ */
1306 /* ?_Lock@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAXXZ */
1307 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Lock, 4)
1308 void __thiscall basic_streambuf_wchar__Lock(basic_streambuf_wchar *this)
1310 TRACE("(%p)\n", this);
1311 mutex_lock(&this->lock);
1314 /* ?_Pnavail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEHXZ */
1315 /* ?_Pnavail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBA_JXZ */
1316 /* ?_Pnavail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEHXZ */
1317 /* ?_Pnavail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBA_JXZ */
1318 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Pnavail, 4)
1319 streamsize __thiscall basic_streambuf_wchar__Pnavail(const basic_streambuf_wchar *this)
1321 TRACE("(%p)\n", this);
1322 return *this->pwpos ? *this->pwsize : 0;
1325 /* ?_Pninc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEPA_WXZ */
1326 /* ?_Pninc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAPEA_WXZ */
1327 /* ?_Pninc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEPAGXZ */
1328 /* ?_Pninc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAPEAGXZ */
1329 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Pninc, 4)
1330 wchar_t* __thiscall basic_streambuf_wchar__Pninc(basic_streambuf_wchar *this)
1332 TRACE("(%p)\n", this);
1333 (*this->pwsize)--;
1334 return (*this->pwpos)++;
1337 /* ?underflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEGXZ */
1338 /* ?underflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAGXZ */
1339 /* ?underflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEGXZ */
1340 /* ?underflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAGXZ */
1341 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_underflow, 4)
1342 #define call_basic_streambuf_wchar_underflow(this) CALL_VTBL_FUNC(this, 24, \
1343 unsigned short, (basic_streambuf_wchar*), (this))
1344 unsigned short __thiscall basic_streambuf_wchar_underflow(basic_streambuf_wchar *this)
1346 TRACE("(%p)\n", this);
1347 return WEOF;
1350 /* ?uflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEGXZ */
1351 /* ?uflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAGXZ */
1352 /* ?uflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEGXZ */
1353 /* ?uflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAGXZ */
1354 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_uflow, 4)
1355 #define call_basic_streambuf_wchar_uflow(this) CALL_VTBL_FUNC(this, 28, \
1356 unsigned short, (basic_streambuf_wchar*), (this))
1357 unsigned short __thiscall basic_streambuf_wchar_uflow(basic_streambuf_wchar *this)
1359 int ret;
1361 TRACE("(%p)\n", this);
1363 if(call_basic_streambuf_wchar_underflow(this)==WEOF)
1364 return WEOF;
1366 ret = **this->prpos;
1367 (*this->prsize)--;
1368 (*this->prpos)++;
1369 return ret;
1372 /* ?_Xsgetn_s@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHPA_WIH@Z */
1373 /* ?_Xsgetn_s@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA_JPEA_W_K_J@Z */
1374 /* ?_Xsgetn_s@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHPAGIH@Z */
1375 /* ?_Xsgetn_s@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA_JPEAG_K_J@Z */
1376 static streamsize basic_streambuf_wchar__Xsgetn_s(basic_streambuf_wchar *this, wchar_t *ptr, MSVCP_size_t size, streamsize count)
1378 streamsize copied, chunk;
1379 unsigned short c;
1381 TRACE("(%p %p %lu %s)\n", this, ptr, size, wine_dbgstr_longlong(count));
1383 for(copied=0; copied<count && size;) {
1384 chunk = basic_streambuf_wchar__Gnavail(this);
1385 if(chunk > count-copied)
1386 chunk = count-copied;
1388 if(chunk > 0) {
1389 memcpy_s(ptr+copied, size, *this->prpos, chunk*sizeof(wchar_t));
1390 *this->prpos += chunk;
1391 *this->prsize -= chunk;
1392 copied += chunk;
1393 size -= chunk*sizeof(wchar_t);
1394 }else if((c = call_basic_streambuf_wchar_uflow(this)) != WEOF) {
1395 ptr[copied] = c;
1396 copied++;
1397 size--;
1398 }else {
1399 break;
1403 return copied;
1406 /* ?_Sgetn_s@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEHPA_WIH@Z */
1407 /* ?_Sgetn_s@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA_JPEA_W_K_J@Z */
1408 /* ?_Sgetn_s@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEHPAGIH@Z */
1409 /* ?_Sgetn_s@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA_JPEAG_K_J@Z */
1410 static streamsize basic_streambuf_wchar__Sgetn_s(basic_streambuf_wchar *this, wchar_t *ptr, MSVCP_size_t size, streamsize count)
1412 TRACE("(%p %p %lu %s)\n", this, ptr, size, wine_dbgstr_longlong(count));
1413 return basic_streambuf_wchar__Xsgetn_s(this, ptr, size, count);
1416 /* ?_Unlock@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
1417 /* ?_Unlock@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
1418 /* ?_Unlock@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEXXZ */
1419 /* ?_Unlock@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAXXZ */
1420 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar__Unlock, 4)
1421 void __thiscall basic_streambuf_wchar__Unlock(basic_streambuf_wchar *this)
1423 TRACE("(%p)\n", this);
1424 mutex_unlock(&this->lock);
1427 /* ?eback@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1428 /* ?eback@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1429 /* ?eback@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1430 /* ?eback@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1431 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_eback, 4)
1432 wchar_t* __thiscall basic_streambuf_wchar_eback(const basic_streambuf_wchar *this)
1434 TRACE("(%p)\n", this);
1435 return *this->prbuf;
1438 /* ?gptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1439 /* ?gptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1440 /* ?gptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1441 /* ?gptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1442 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_gptr, 4)
1443 wchar_t* __thiscall basic_streambuf_wchar_gptr(const basic_streambuf_wchar *this)
1445 TRACE("(%p)\n", this);
1446 return *this->prpos;
1449 /* ?egptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1450 /* ?egptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1451 /* ?egptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1452 /* ?egptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1453 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_egptr, 4)
1454 wchar_t* __thiscall basic_streambuf_wchar_egptr(const basic_streambuf_wchar *this)
1456 TRACE("(%p)\n", this);
1457 return *this->prpos+*this->prsize;
1460 /* ?epptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1461 /* ?epptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1462 /* ?epptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1463 /* ?epptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1464 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_epptr, 4)
1465 wchar_t* __thiscall basic_streambuf_wchar_epptr(const basic_streambuf_wchar *this)
1467 TRACE("(%p)\n", this);
1468 return *this->pwpos+*this->pwsize;
1471 /* ?gbump@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXH@Z */
1472 /* ?gbump@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXH@Z */
1473 /* ?gbump@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXH@Z */
1474 /* ?gbump@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXH@Z */
1475 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_gbump, 8)
1476 void __thiscall basic_streambuf_wchar_gbump(basic_streambuf_wchar *this, int off)
1478 TRACE("(%p %d)\n", this, off);
1479 *this->prpos += off;
1480 *this->prsize -= off;
1483 /* ?getloc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QBE?AVlocale@2@XZ */
1484 /* ?getloc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEBA?AVlocale@2@XZ */
1485 /* ?getloc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QBE?AVlocale@2@XZ */
1486 /* ?getloc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEBA?AVlocale@2@XZ */
1487 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_getloc, 8)
1488 locale* __thiscall basic_streambuf_wchar_getloc(const basic_streambuf_wchar *this, locale *ret)
1490 TRACE("(%p)\n", this);
1491 return locale_copy_ctor(ret, this->loc);
1494 /* ?imbue@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEXABVlocale@2@@Z */
1495 /* ?imbue@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAXAEBVlocale@2@@Z */
1496 /* ?imbue@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEXABVlocale@2@@Z */
1497 /* ?imbue@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAXAEBVlocale@2@@Z */
1498 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_imbue, 8)
1499 #define call_basic_streambuf_wchar_imbue(this, loc) CALL_VTBL_FUNC(this, 56, \
1500 void, (basic_streambuf_wchar*, const locale*), (this, loc))
1501 void __thiscall basic_streambuf_wchar_imbue(basic_streambuf_wchar *this, const locale *loc)
1503 TRACE("(%p %p)\n", this, loc);
1506 /* ?overflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEGG@Z */
1507 /* ?overflow@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAGG@Z */
1508 /* ?overflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEGG@Z */
1509 /* ?overflow@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAGG@Z */
1510 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_overflow, 8)
1511 #define call_basic_streambuf_wchar_overflow(this, ch) CALL_VTBL_FUNC(this, 12, \
1512 unsigned short, (basic_streambuf_wchar*, unsigned short), (this, ch))
1513 unsigned short __thiscall basic_streambuf_wchar_overflow(basic_streambuf_wchar *this, unsigned short ch)
1515 TRACE("(%p %d)\n", this, ch);
1516 return WEOF;
1519 /* ?pbackfail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEGG@Z */
1520 /* ?pbackfail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAGG@Z */
1521 /* ?pbackfail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEGG@Z */
1522 /* ?pbackfail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAGG@Z */
1523 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pbackfail, 8)
1524 #define call_basic_streambuf_wchar_pbackfail(this, ch) CALL_VTBL_FUNC(this, 16, \
1525 unsigned short, (basic_streambuf_wchar*, unsigned short), (this, ch))
1526 unsigned short __thiscall basic_streambuf_wchar_pbackfail(basic_streambuf_wchar *this, unsigned short ch)
1528 TRACE("(%p %d)\n", this, ch);
1529 return WEOF;
1532 /* ?pbase@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1533 /* ?pbase@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1534 /* ?pbase@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1535 /* ?pbase@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1536 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pbase, 4)
1537 wchar_t* __thiscall basic_streambuf_wchar_pbase(const basic_streambuf_wchar *this)
1539 TRACE("(%p)\n", this);
1540 return *this->pwbuf;
1543 /* ?pbump@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IAEXH@Z */
1544 /* ?pbump@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEAAXH@Z */
1545 /* ?pbump@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IAEXH@Z */
1546 /* ?pbump@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEAAXH@Z */
1547 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pbump, 8)
1548 void __thiscall basic_streambuf_wchar_pbump(basic_streambuf_wchar *this, int off)
1550 TRACE("(%p %d)\n", this, off);
1551 *this->pwpos += off;
1552 *this->pwsize -= off;
1555 /* ?pptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IBEPA_WXZ */
1556 /* ?pptr@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@IEBAPEA_WXZ */
1557 /* ?pptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IBEPAGXZ */
1558 /* ?pptr@?$basic_streambuf@GU?$char_traits@G@std@@@std@@IEBAPEAGXZ */
1559 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pptr, 4)
1560 wchar_t* __thiscall basic_streambuf_wchar_pptr(const basic_streambuf_wchar *this)
1562 TRACE("(%p)\n", this);
1563 return *this->pwpos;
1566 /* ?pubimbue@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
1567 /* ?pubimbue@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
1568 /* ?pubimbue@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
1569 /* ?pubimbue@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
1570 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubimbue, 12)
1571 locale* __thiscall basic_streambuf_wchar_pubimbue(basic_streambuf_wchar *this, locale *ret, const locale *loc)
1573 TRACE("(%p %p)\n", this, loc);
1574 memcpy(ret, this->loc, sizeof(locale));
1575 call_basic_streambuf_wchar_imbue(this, loc);
1576 locale_copy_ctor(this->loc, loc);
1577 return ret;
1580 /* ?seekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
1581 /* ?seekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
1582 /* ?seekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
1583 /* ?seekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
1584 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_seekoff, 24)
1585 #define call_basic_streambuf_wchar_seekoff(this, ret, off, way, mode) CALL_VTBL_FUNC(this, 40, \
1586 fpos_int*, (basic_streambuf_wchar*, fpos_int*, streamoff, int, int), (this, ret, off, way, mode))
1587 fpos_int* __thiscall basic_streambuf_wchar_seekoff(basic_streambuf_wchar *this,
1588 fpos_int *ret, streamoff off, int way, int mode)
1590 TRACE("(%p %s %d %d)\n", this, wine_dbgstr_longlong(off), way, mode);
1591 ret->off = -1;
1592 ret->pos = 0;
1593 ret->state = 0;
1594 return ret;
1597 /* ?pubseekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@JHH@Z */
1598 /* ?pubseekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@_JHH@Z */
1599 /* ?pubseekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@JHH@Z */
1600 /* ?pubseekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@_JHH@Z */
1601 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubseekoff, 24)
1602 fpos_int* __thiscall basic_streambuf_wchar_pubseekoff(basic_streambuf_wchar *this,
1603 fpos_int *ret, streamoff off, int way, int mode)
1605 TRACE("(%p %s %d %d)\n", this, wine_dbgstr_longlong(off), way, mode);
1606 return call_basic_streambuf_wchar_seekoff(this, ret, off, way, mode);
1609 /* ?pubseekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@JII@Z */
1610 /* ?pubseekoff@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@_JII@Z */
1611 /* ?pubseekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@JII@Z */
1612 /* ?pubseekoff@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@_JII@Z */
1613 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubseekoff_old, 24)
1614 fpos_int* __thiscall basic_streambuf_wchar_pubseekoff_old(basic_streambuf_wchar *this,
1615 fpos_int *ret, streamoff off, unsigned int way, unsigned int mode)
1617 TRACE("(%p %s %d %d)\n", this, wine_dbgstr_longlong(off), way, mode);
1618 return basic_streambuf_wchar_pubseekoff(this, ret, off, way, mode);
1621 /* ?seekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
1622 /* ?seekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
1623 /* ?seekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
1624 /* ?seekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
1625 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_seekpos, 36)
1626 #define call_basic_streambuf_wchar_seekpos(this, ret, pos, mode) CALL_VTBL_FUNC(this, 44, \
1627 fpos_int*, (basic_streambuf_wchar*, fpos_int*, fpos_int, int), (this, ret, pos, mode))
1628 fpos_int* __thiscall basic_streambuf_wchar_seekpos(basic_streambuf_wchar *this,
1629 fpos_int *ret, fpos_int pos, int mode)
1631 TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
1632 ret->off = -1;
1633 ret->pos = 0;
1634 ret->state = 0;
1635 return ret;
1638 /* ?pubseekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@V32@H@Z */
1639 /* ?pubseekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@V32@H@Z */
1640 /* ?pubseekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@V32@H@Z */
1641 /* ?pubseekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@V32@H@Z */
1642 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubseekpos, 36)
1643 fpos_int* __thiscall basic_streambuf_wchar_pubseekpos(basic_streambuf_wchar *this,
1644 fpos_int *ret, fpos_int pos, int mode)
1646 TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
1647 return call_basic_streambuf_wchar_seekpos(this, ret, pos, mode);
1650 /* ?pubseekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@V32@I@Z */
1651 /* ?pubseekpos@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@V32@I@Z */
1652 /* ?pubseekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@V32@I@Z */
1653 /* ?pubseekpos@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@V32@I@Z */
1654 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubseekpos_old, 36)
1655 fpos_int* __thiscall basic_streambuf_wchar_pubseekpos_old(basic_streambuf_wchar *this,
1656 fpos_int *ret, fpos_int pos, unsigned int mode)
1658 TRACE("(%p %s %d)\n", this, debugstr_fpos_int(&pos), mode);
1659 return basic_streambuf_wchar_pubseekpos(this, ret, pos, mode);
1662 /* ?setbuf@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEPAV12@PA_WH@Z */
1663 /* ?setbuf@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAPEAV12@PEA_W_J@Z */
1664 /* ?setbuf@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEPAV12@PAGH@Z */
1665 /* ?setbuf@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAPEAV12@PEAG_J@Z */
1666 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_setbuf, 16)
1667 #define call_basic_streambuf_wchar_setbuf(this, buf, count) CALL_VTBL_FUNC(this, 48, \
1668 basic_streambuf_wchar*, (basic_streambuf_wchar*, wchar_t*, streamsize), (this, buf, count))
1669 basic_streambuf_wchar* __thiscall basic_streambuf_wchar_setbuf(basic_streambuf_wchar *this, wchar_t *buf, streamsize count)
1671 TRACE("(%p %p %s)\n", this, buf, wine_dbgstr_longlong(count));
1672 return this;
1675 /* ?pubsetbuf@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@PA_WH@Z */
1676 /* ?pubsetbuf@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@PEA_W_J@Z */
1677 /* ?pubsetbuf@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEPAV12@PAGH@Z */
1678 /* ?pubsetbuf@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@PEAG_J@Z */
1679 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubsetbuf, 16)
1680 basic_streambuf_wchar* __thiscall basic_streambuf_wchar_pubsetbuf(basic_streambuf_wchar *this, wchar_t *buf, streamsize count)
1682 TRACE("(%p %p %s)\n", this, buf, wine_dbgstr_longlong(count));
1683 return call_basic_streambuf_wchar_setbuf(this, buf, count);
1686 /* ?sync@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHXZ */
1687 /* ?sync@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAAHXZ */
1688 /* ?sync@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHXZ */
1689 /* ?sync@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAAHXZ */
1690 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sync, 4)
1691 #define call_basic_streambuf_wchar_sync(this) CALL_VTBL_FUNC(this, 52, \
1692 int, (basic_streambuf_wchar*), (this))
1693 int __thiscall basic_streambuf_wchar_sync(basic_streambuf_wchar *this)
1695 TRACE("(%p)\n", this);
1696 return 0;
1699 /* ?pubsync@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEHXZ */
1700 /* ?pubsync@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAHXZ */
1701 /* ?pubsync@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEHXZ */
1702 /* ?pubsync@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAHXZ */
1703 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_pubsync, 4)
1704 int __thiscall basic_streambuf_wchar_pubsync(basic_streambuf_wchar *this)
1706 TRACE("(%p)\n", this);
1707 return call_basic_streambuf_wchar_sync(this);
1710 /* ?sgetn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEHPA_WH@Z */
1711 /* ?sgetn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA_JPEA_W_J@Z */
1712 /* ?sgetn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEHPAGH@Z */
1713 /* ?sgetn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA_JPEAG_J@Z */
1714 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sgetn, 16)
1715 streamsize __thiscall basic_streambuf_wchar_sgetn(basic_streambuf_wchar *this, wchar_t *ptr, streamsize count)
1717 TRACE("(%p %p %s)\n", this, ptr, wine_dbgstr_longlong(count));
1718 return basic_streambuf_wchar__Xsgetn_s(this, ptr, -1, count);
1721 /* ?showmanyc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHXZ */
1722 /* ?showmanyc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA_JXZ */
1723 /* ?showmanyc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHXZ */
1724 /* ?showmanyc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA_JXZ */
1725 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_showmanyc, 4)
1726 #define call_basic_streambuf_wchar_showmanyc(this) CALL_VTBL_FUNC(this, 20, \
1727 streamsize, (basic_streambuf_wchar*), (this))
1728 streamsize __thiscall basic_streambuf_wchar_showmanyc(basic_streambuf_wchar *this)
1730 TRACE("(%p)\n", this);
1731 return 0;
1734 /* ?in_avail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEHXZ */
1735 /* ?in_avail@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA_JXZ */
1736 /* ?in_avail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEHXZ */
1737 /* ?in_avail@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA_JXZ */
1738 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_in_avail, 4)
1739 streamsize __thiscall basic_streambuf_wchar_in_avail(basic_streambuf_wchar *this)
1741 streamsize ret;
1743 TRACE("(%p)\n", this);
1745 ret = basic_streambuf_wchar__Gnavail(this);
1746 return ret ? ret : call_basic_streambuf_wchar_showmanyc(this);
1749 /* ?sputbackc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEG_W@Z */
1750 /* ?sputbackc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAG_W@Z */
1751 /* ?sputbackc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGG@Z */
1752 /* ?sputbackc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAGG@Z */
1753 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sputbackc, 8)
1754 unsigned short __thiscall basic_streambuf_wchar_sputbackc(basic_streambuf_wchar *this, wchar_t ch)
1756 TRACE("(%p %d)\n", this, ch);
1757 if(*this->prpos && *this->prpos>*this->prbuf && (*this->prpos)[-1]==ch) {
1758 (*this->prsize)++;
1759 (*this->prpos)--;
1760 return ch;
1763 return call_basic_streambuf_wchar_pbackfail(this, ch);
1766 /* ?sputc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEG_W@Z */
1767 /* ?sputc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAG_W@Z */
1768 /* ?sputc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGG@Z */
1769 /* ?sputc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAHG@Z */
1770 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sputc, 8)
1771 unsigned short __thiscall basic_streambuf_wchar_sputc(basic_streambuf_wchar *this, wchar_t ch)
1773 TRACE("(%p %d)\n", this, ch);
1774 return basic_streambuf_wchar__Pnavail(this) ?
1775 (*basic_streambuf_wchar__Pninc(this) = ch) :
1776 call_basic_streambuf_wchar_overflow(this, ch);
1779 /* ?sungetc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
1780 /* ?sungetc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
1781 /* ?sungetc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGXZ */
1782 /* ?sungetc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAGXZ */
1783 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sungetc, 4)
1784 unsigned short __thiscall basic_streambuf_wchar_sungetc(basic_streambuf_wchar *this)
1786 TRACE("(%p)\n", this);
1787 if(*this->prpos && *this->prpos>*this->prbuf) {
1788 (*this->prsize)++;
1789 (*this->prpos)--;
1790 return **this->prpos;
1793 return call_basic_streambuf_wchar_pbackfail(this, WEOF);
1796 /* ?stossc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
1797 /* ?stossc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
1798 /* ?stossc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEXXZ */
1799 /* ?stossc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAXXZ */
1800 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_stossc, 4)
1801 void __thiscall basic_streambuf_wchar_stossc(basic_streambuf_wchar *this)
1803 TRACE("(%p)\n", this);
1804 if(basic_streambuf_wchar__Gnavail(this))
1805 basic_streambuf_wchar__Gninc(this);
1806 else
1807 call_basic_streambuf_wchar_uflow(this);
1810 /* ?sbumpc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
1811 /* ?sbumpc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
1812 /* ?sbumpc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGXZ */
1813 /* ?sbumpc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAGXZ */
1814 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sbumpc, 4)
1815 unsigned short __thiscall basic_streambuf_wchar_sbumpc(basic_streambuf_wchar *this)
1817 TRACE("(%p)\n", this);
1818 return basic_streambuf_wchar__Gnavail(this) ?
1819 *basic_streambuf_wchar__Gninc(this) : call_basic_streambuf_wchar_uflow(this);
1822 /* ?sgetc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
1823 /* ?sgetc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
1824 /* ?sgetc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGXZ */
1825 /* ?sgetc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAGXZ */
1826 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sgetc, 4)
1827 unsigned short __thiscall basic_streambuf_wchar_sgetc(basic_streambuf_wchar *this)
1829 TRACE("(%p)\n", this);
1830 return basic_streambuf_wchar__Gnavail(this) ?
1831 *basic_streambuf_wchar_gptr(this) : call_basic_streambuf_wchar_underflow(this);
1834 /* ?snextc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
1835 /* ?snextc@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
1836 /* ?snextc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEGXZ */
1837 /* ?snextc@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAAGXZ */
1838 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_snextc, 4)
1839 unsigned short __thiscall basic_streambuf_wchar_snextc(basic_streambuf_wchar *this)
1841 TRACE("(%p)\n", this);
1843 if(basic_streambuf_wchar__Gnavail(this) > 1)
1844 return *basic_streambuf_wchar__Gnpreinc(this);
1845 return basic_streambuf_wchar_sbumpc(this)==WEOF ?
1846 WEOF : basic_streambuf_wchar_sgetc(this);
1849 /* ?xsgetn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHPA_WH@Z */
1850 /* ?xsgetn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA_JPEA_W_J@Z */
1851 /* ?xsgetn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHPAGH@Z */
1852 /* ?xsgetn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA_JPEAG_J@Z */
1853 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_xsgetn, 16)
1854 #define call_basic_streambuf_wchar_xsgetn(this, ptr, count) CALL_VTBL_FUNC(this, 32, \
1855 streamsize, (basic_streambuf_wchar*, wchar_t*, streamsize), (this, ptr, count))
1856 streamsize __thiscall basic_streambuf_wchar_xsgetn(basic_streambuf_wchar *this, wchar_t *ptr, streamsize count)
1858 TRACE("(%p %p %s)\n", this, ptr, wine_dbgstr_longlong(count));
1859 return basic_streambuf_wchar__Xsgetn_s(this, ptr, -1, count);
1862 /* ?xsputn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHPB_WH@Z */
1863 /* ?xsputn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MEAA_JPEB_W_J@Z */
1864 /* ?xsputn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHPBGH@Z */
1865 /* ?xsputn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MEAA_JPEBG_J@Z */
1866 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_xsputn, 16)
1867 #define call_basic_streambuf_wchar_xsputn(this, ptr, count) CALL_VTBL_FUNC(this, 36, \
1868 streamsize, (basic_streambuf_wchar*, const wchar_t*, streamsize), (this, ptr, count))
1869 streamsize __thiscall basic_streambuf_wchar_xsputn(basic_streambuf_wchar *this, const wchar_t *ptr, streamsize count)
1871 streamsize copied, chunk;
1873 TRACE("(%p %p %s)\n", this, ptr, wine_dbgstr_longlong(count));
1875 for(copied=0; copied<count;) {
1876 chunk = basic_streambuf_wchar__Pnavail(this);
1877 if(chunk > count-copied)
1878 chunk = count-copied;
1880 if(chunk > 0) {
1881 memcpy(*this->pwpos, ptr+copied, chunk*sizeof(wchar_t));
1882 *this->pwpos += chunk;
1883 *this->pwsize -= chunk;
1884 copied += chunk;
1885 }else if(call_basic_streambuf_wchar_overflow(this, ptr[copied]) != WEOF) {
1886 copied++;
1887 }else {
1888 break;
1892 return copied;
1895 /* ?sputn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QAEHPB_WH@Z */
1896 /* ?sputn@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@QEAA_JPEB_W_J@Z */
1897 /* ?sputn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QAEHPBGH@Z */
1898 /* ?sputn@?$basic_streambuf@GU?$char_traits@G@std@@@std@@QEAA_JPEBG_J@Z */
1899 DEFINE_THISCALL_WRAPPER(basic_streambuf_wchar_sputn, 16)
1900 streamsize __thiscall basic_streambuf_wchar_sputn(basic_streambuf_wchar *this, const wchar_t *ptr, streamsize count)
1902 TRACE("(%p %p %s)\n", this, ptr, wine_dbgstr_longlong(count));
1903 return call_basic_streambuf_wchar_xsputn(this, ptr, count);
1906 /* ?_Stinit@?1??_Init@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@23@@Z@4HA */
1907 /* ?_Stinit@?1??_Init@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@23@@Z@4HA */
1908 static int basic_filebuf_char__Init__Stinit = 0;
1910 /* ?_Init@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@12@@Z */
1911 /* ?_Init@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@12@@Z */
1912 static void basic_filebuf_char__Init(basic_filebuf_char *this, FILE *file, basic_filebuf__Initfl which)
1914 TRACE("(%p %p %d)\n", this, file, which);
1916 this->cvt = NULL;
1917 this->wrotesome = FALSE;
1918 this->state = basic_filebuf_char__Init__Stinit;
1919 this->close = (which == INITFL_open);
1920 this->file = file;
1922 basic_streambuf_char__Init_empty(&this->base);
1923 if(file)
1924 basic_streambuf_char__Init(&this->base, &file->_base, &file->_ptr,
1925 &file->_cnt, &file->_base, &file->_ptr, &file->_cnt);
1928 /* ?_Initcvt@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IAEXPAV?$codecvt@DDH@2@@Z */
1929 /* ?_Initcvt@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IEAAXPEAV?$codecvt@DDH@2@@Z */
1930 static void basic_filebuf_char__Initcvt(basic_filebuf_char *this, codecvt_char *cvt)
1932 TRACE("(%p %p)\n", this, cvt);
1934 if(codecvt_base_always_noconv(&cvt->base)) {
1935 this->cvt = NULL;
1936 }else {
1937 basic_streambuf_char__Init_empty(&this->base);
1938 this->cvt = cvt;
1942 /* ?_Endwrite@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IAE_NXZ */
1943 /* ?_Endwrite@?$basic_filebuf@DU?$char_traits@D@std@@@std@@IEAA_NXZ */
1944 static MSVCP_bool basic_filebuf_char__Endwrite(basic_filebuf_char *this)
1946 TRACE("(%p)\n", this);
1948 if(!this->wrotesome || !this->cvt)
1949 return TRUE;
1952 if(call_basic_streambuf_char_overflow(&this->base, EOF) == EOF)
1953 return FALSE;
1955 while(1) {
1956 /* TODO: check if we need a dynamic buffer here */
1957 char buf[128];
1958 char *next;
1959 int ret;
1961 ret = codecvt_char_unshift(this->cvt, &this->state, buf, buf+sizeof(buf), &next);
1962 switch(ret) {
1963 case CODECVT_ok:
1964 this->wrotesome = FALSE;
1965 /* fall through */
1966 case CODECVT_partial:
1967 if(!fwrite(buf, next-buf, 1, this->file))
1968 return FALSE;
1969 if(this->wrotesome)
1970 break;
1971 /* fall through */
1972 case CODECVT_noconv:
1973 if(call_basic_streambuf_char_overflow(&this->base, EOF) == EOF)
1974 return FALSE;
1975 return TRUE;
1976 default:
1977 return FALSE;
1982 /* ?close@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAEPAV12@XZ */
1983 /* ?close@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAAPEAV12@XZ */
1984 static basic_filebuf_char* basic_filebuf_char_close(basic_filebuf_char *this)
1986 basic_filebuf_char *ret = this;
1988 TRACE("(%p)\n", this);
1990 if(!this->file)
1991 return NULL;
1993 /* TODO: handle exceptions */
1994 if(!basic_filebuf_char__Endwrite(this))
1995 ret = NULL;
1996 if(fclose(this->file))
1997 ret = NULL;
1999 basic_filebuf_char__Init(this, NULL, INITFL_close);
2000 return ret;
2003 /* ??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QAE@PAU_iobuf@@@Z */
2004 /* ??0?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEAA@PEAU_iobuf@@@Z */
2005 static basic_filebuf_char* basic_filebuf_char_ctor_file(basic_filebuf_char *this, FILE *file)
2007 TRACE("(%p %p)\n", this, file);
2009 basic_streambuf_char_ctor(&this->base);
2010 this->base.vtable = &MSVCP_basic_filebuf_char_vtable;
2012 basic_filebuf_char__Init(this, file, INITFL_new);
2013 return this;
2016 /* ??1?$basic_filebuf@DU?$char_traits@D@std@@@std@@UAE@XZ */
2017 /* ??1?$basic_filebuf@DU?$char_traits@D@std@@@std@@UEAA@XZ */
2018 static void basic_filebuf_char_dtor(basic_filebuf_char *this)
2020 TRACE("(%p)\n", this);
2022 if(this->close)
2023 basic_filebuf_char_close(this);
2024 basic_streambuf_char_dtor(&this->base);
2027 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_vector_dtor, 8)
2028 basic_filebuf_char* __thiscall basic_filebuf_char_vector_dtor(basic_filebuf_char *this, unsigned int flags)
2030 TRACE("(%p %x)\n", this, flags);
2031 if(flags & 2) {
2032 /* we have an array, with the number of elements stored before the first object */
2033 INT_PTR i, *ptr = (INT_PTR *)this-1;
2035 for(i=*ptr-1; i>=0; i--)
2036 basic_filebuf_char_dtor(this+i);
2037 MSVCRT_operator_delete(ptr);
2038 } else {
2039 basic_filebuf_char_dtor(this);
2040 if(flags & 1)
2041 MSVCRT_operator_delete(this);
2044 return this;
2047 /* ?is_open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QBE_NXZ */
2048 /* ?is_open@?$basic_filebuf@DU?$char_traits@D@std@@@std@@QEBA_NXZ */
2049 static MSVCP_bool basic_filebuf_char_is_open(const basic_filebuf_char *this)
2051 TRACE("(%p)\n", this);
2052 return this->file != NULL;
2055 /* ?_Fiopen@std@@YAPAU_iobuf@@PB_WHH@Z */
2056 /* ?_Fiopen@std@@YAPEAU_iobuf@@PEB_WHH@Z */
2057 FILE* __cdecl _Fiopen_wchar(const wchar_t *name, int mode, int prot)
2059 static const wchar_t rW[] = {'r',0};
2060 static const struct {
2061 int mode;
2062 const wchar_t str[4];
2063 const wchar_t str_bin[4];
2064 } str_mode[] = {
2065 {OPENMODE_out, {'w',0}, {'w','b',0}},
2066 {OPENMODE_out|OPENMODE_app, {'a',0}, {'a','b',0}},
2067 {OPENMODE_app, {'a',0}, {'a','b',0}},
2068 {OPENMODE_out|OPENMODE_trunc, {'w',0}, {'w','b',0}},
2069 {OPENMODE_in, {'r',0}, {'r','b',0}},
2070 {OPENMODE_in|OPENMODE_out, {'r','+',0}, {'r','+','b',0}},
2071 {OPENMODE_in|OPENMODE_out|OPENMODE_trunc, {'w','+',0}, {'w','+','b',0}},
2072 {OPENMODE_in|OPENMODE_out|OPENMODE_app, {'a','+',0}, {'a','+','b',0}},
2073 {OPENMODE_in|OPENMODE_app, {'a','+',0}, {'a','+','b',0}}
2076 int real_mode = mode & ~(OPENMODE_ate|OPENMODE__Nocreate|OPENMODE__Noreplace|OPENMODE_binary);
2077 size_t mode_idx;
2078 FILE *f = NULL;
2080 TRACE("(%s %d %d)\n", debugstr_w(name), mode, prot);
2082 for(mode_idx=0; mode_idx<sizeof(str_mode)/sizeof(str_mode[0]); mode_idx++)
2083 if(str_mode[mode_idx].mode == real_mode)
2084 break;
2085 if(mode_idx == sizeof(str_mode)/sizeof(str_mode[0]))
2086 return NULL;
2088 if((mode & OPENMODE__Nocreate) && !(f = _wfopen(name, rW)))
2089 return NULL;
2090 else if(f)
2091 fclose(f);
2093 if((mode & OPENMODE__Noreplace) && (mode & (OPENMODE_out|OPENMODE_app))
2094 && (f = _wfopen(name, rW))) {
2095 fclose(f);
2096 return NULL;
2099 f = _wfsopen(name, (mode & OPENMODE_binary) ? str_mode[mode_idx].str_bin
2100 : str_mode[mode_idx].str, prot);
2101 if(!f)
2102 return NULL;
2104 if((mode & OPENMODE_ate) && fseek(f, 0, SEEK_END)) {
2105 fclose(f);
2106 return NULL;
2109 return f;
2112 /* ?_Fiopen@std@@YAPAU_iobuf@@PBDHH@Z */
2113 /* ?_Fiopen@std@@YAPEAU_iobuf@@PEBDHH@Z */
2114 FILE* __cdecl _Fiopen(const char *name, int mode, int prot)
2116 wchar_t nameW[FILENAME_MAX];
2118 TRACE("(%s %d %d)\n", name, mode, prot);
2120 if(mbstowcs_s(NULL, nameW, FILENAME_MAX, name, FILENAME_MAX-1) != 0)
2121 return NULL;
2122 return _Fiopen_wchar(nameW, mode, prot);
2125 /* ?overflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHH@Z */
2126 /* ?overflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHH@Z */
2127 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_overflow, 8)
2128 int __thiscall basic_filebuf_char_overflow(basic_filebuf_char *this, int c)
2130 char buf[8], *dyn_buf;
2131 char ch = c, *to_next;
2132 const char *from_next;
2133 int ret, max_size;
2136 TRACE("(%p %d)\n", this, c);
2138 if(!basic_filebuf_char_is_open(this))
2139 return EOF;
2140 if(c == EOF)
2141 return !c;
2143 if(!this->cvt)
2144 return fwrite(&ch, sizeof(char), 1, this->file) ? c : EOF;
2146 from_next = &ch;
2147 do {
2148 ret = codecvt_char_out(this->cvt, &this->state, from_next, &ch+1,
2149 &from_next, buf, buf+sizeof(buf), &to_next);
2151 switch(ret) {
2152 case CODECVT_partial:
2153 if(to_next == buf)
2154 break;
2155 /* fall through */
2156 case CODECVT_ok:
2157 if(!fwrite(buf, to_next-buf, 1, this->file))
2158 return EOF;
2159 if(ret == CODECVT_partial)
2160 continue;
2161 return c;
2162 case CODECVT_noconv:
2163 return fwrite(&ch, sizeof(char), 1, this->file) ? c : EOF;
2164 default:
2165 return EOF;
2168 break;
2169 } while(1);
2171 max_size = codecvt_base_max_length(&this->cvt->base);
2172 dyn_buf = malloc(max_size);
2173 if(!dyn_buf)
2174 return EOF;
2176 ret = codecvt_char_out(this->cvt, &this->state, from_next, &ch+1,
2177 &from_next, dyn_buf, dyn_buf+max_size, &to_next);
2179 switch(ret) {
2180 case CODECVT_ok:
2181 ret = fwrite(dyn_buf, to_next-dyn_buf, 1, this->file);
2182 free(dyn_buf);
2183 return ret ? c : EOF;
2184 case CODECVT_partial:
2185 ERR("buffer should be big enough to store all output\n");
2186 /* fall through */
2187 default:
2188 free(dyn_buf);
2189 return EOF;
2193 /* ?pbackfail@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHH@Z */
2194 /* ?pbackfail@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHH@Z */
2195 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_pbackfail, 8)
2196 int __thiscall basic_filebuf_char_pbackfail(basic_filebuf_char *this, int c)
2198 TRACE("(%p %d)\n", this, c);
2200 if(!basic_filebuf_char_is_open(this))
2201 return EOF;
2203 if(basic_streambuf_char_gptr(&this->base)>basic_streambuf_char_eback(&this->base)
2204 && (c==EOF || (int)(unsigned char)basic_streambuf_char_gptr(&this->base)[-1]==c)) {
2205 basic_streambuf_char__Gndec(&this->base);
2206 return c==EOF ? !c : c;
2207 }else if(c!=EOF && !this->cvt) {
2208 return ungetc(c, this->file);
2211 return EOF;
2214 /* ?uflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
2215 /* ?uflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
2216 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_uflow, 4)
2217 int __thiscall basic_filebuf_char_uflow(basic_filebuf_char *this)
2219 char ch, buf[128], *to_next;
2220 const char *buf_next;
2221 int c;
2222 size_t i;
2224 TRACE("(%p)\n", this);
2226 if(!basic_filebuf_char_is_open(this))
2227 return EOF;
2229 if(basic_streambuf_char_gptr(&this->base) < basic_streambuf_char_egptr(&this->base))
2230 return (unsigned char)*basic_streambuf_char__Gninc(&this->base);
2232 c = fgetc(this->file);
2233 if(!this->cvt || c==EOF)
2234 return c;
2236 buf_next = buf;
2237 for(i=0; i < sizeof(buf)/sizeof(buf[0]); i++) {
2238 buf[i] = c;
2240 switch(codecvt_char_in(this->cvt, &this->state, buf_next,
2241 buf+i+1, &buf_next, &ch, &ch+1, &to_next)) {
2242 case CODECVT_partial:
2243 case CODECVT_ok:
2244 if(to_next == &ch) {
2245 c = fgetc(this->file);
2246 if(c == EOF)
2247 return EOF;
2248 continue;
2252 ptrdiff_t j;
2254 for(j = --i; j >= buf_next-buf; j--)
2255 ungetc(buf[j], this->file);
2257 return ch;
2258 case CODECVT_noconv:
2259 return (unsigned char)buf[0];
2260 default:
2261 return EOF;
2265 FIXME("buffer is too small\n");
2266 return EOF;
2269 /* ?underflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
2270 /* ?underflow@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
2271 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_underflow, 4)
2272 int __thiscall basic_filebuf_char_underflow(basic_filebuf_char *this)
2274 int ret;
2276 TRACE("(%p)\n", this);
2278 if(basic_streambuf_char_gptr(&this->base) < basic_streambuf_char_egptr(&this->base))
2279 return (unsigned char)*basic_streambuf_char_gptr(&this->base);
2281 ret = call_basic_streambuf_char_uflow(&this->base);
2282 if(ret != EOF)
2283 ret = call_basic_streambuf_char_pbackfail(&this->base, ret);
2284 return ret;
2287 /* ?seekoff@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
2288 /* ?seekoff@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
2289 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_seekoff, 24)
2290 fpos_int* __thiscall basic_filebuf_char_seekoff(basic_filebuf_char *this,
2291 fpos_int *ret, streamoff off, int way, int mode)
2293 fpos_t pos;
2295 TRACE("(%p %p %s %d %d)\n", this, ret, wine_dbgstr_longlong(off), way, mode);
2297 if(!basic_filebuf_char_is_open(this) || !basic_filebuf_char__Endwrite(this)
2298 || fseek(this->file, off, way)) {
2299 ret->off = -1;
2300 ret->pos = 0;
2301 ret->state = 0;
2302 return ret;
2305 fgetpos(this->file, &pos);
2306 ret->off = 0;
2307 ret->pos = pos;
2308 ret->state = this->state;
2309 return ret;
2312 /* ?seekpos@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
2313 /* ?seekpos@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
2314 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_seekpos, 36)
2315 fpos_int* __thiscall basic_filebuf_char_seekpos(basic_filebuf_char *this,
2316 fpos_int *ret, fpos_int pos, int mode)
2318 fpos_t fpos;
2320 TRACE("(%p %p %s %d)\n", this, ret, debugstr_fpos_int(&pos), mode);
2322 if(!basic_filebuf_char_is_open(this) || !basic_filebuf_char__Endwrite(this)
2323 || fseek(this->file, (LONG)pos.pos, SEEK_SET)
2324 || (pos.off && fseek(this->file, pos.off, SEEK_CUR))) {
2325 ret->off = -1;
2326 ret->pos = 0;
2327 ret->state = 0;
2328 return ret;
2331 fgetpos(this->file, &fpos);
2332 ret->off = 0;
2333 ret->pos = fpos;
2334 ret->state = this->state;
2335 return ret;
2338 /* ?setbuf@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PADH@Z */
2339 /* ?setbuf@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAPEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PEAD_J@Z */
2340 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_setbuf, 16)
2341 basic_streambuf_char* __thiscall basic_filebuf_char_setbuf(basic_filebuf_char *this, char *buf, streamsize count)
2343 TRACE("(%p %p %s)\n", this, buf, wine_dbgstr_longlong(count));
2345 if(!basic_filebuf_char_is_open(this))
2346 return NULL;
2348 if(setvbuf(this->file, buf, (buf==NULL && count==0) ? _IONBF : _IOFBF, count))
2349 return NULL;
2351 basic_filebuf_char__Init(this, this->file, INITFL_open);
2352 return &this->base;
2355 /* ?sync@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEHXZ */
2356 /* ?sync@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAHXZ */
2357 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_sync, 4)
2358 int __thiscall basic_filebuf_char_sync(basic_filebuf_char *this)
2360 TRACE("(%p)\n", this);
2362 if(!basic_filebuf_char_is_open(this))
2363 return 0;
2365 if(call_basic_streambuf_char_overflow(&this->base, EOF) == EOF)
2366 return 0;
2367 return fflush(this->file);
2370 /* ?imbue@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MAEXABVlocale@2@@Z */
2371 /* ?imbue@?$basic_filebuf@DU?$char_traits@D@std@@@std@@MEAAXAEBVlocale@2@@Z */
2372 DEFINE_THISCALL_WRAPPER(basic_filebuf_char_imbue, 8)
2373 void __thiscall basic_filebuf_char_imbue(basic_filebuf_char *this, const locale *loc)
2375 TRACE("(%p %p)\n", this, loc);
2376 basic_filebuf_char__Initcvt(this, codecvt_char_use_facet(loc));
2379 /* ?_Stinit@?1??_Init@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@23@@Z@4HA */
2380 /* ?_Stinit@?1??_Init@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@23@@Z@4HA */
2381 static int basic_filebuf_wchar__Init__Stinit = 0;
2383 /* ?_Stinit@?1??_Init@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@23@@Z@4HA */
2384 /* ?_Stinit@?1??_Init@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@23@@Z@4HA */
2385 static int basic_filebuf_short__Init__Stinit = 0;
2387 /* ?_Init@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@12@@Z */
2388 /* ?_Init@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@12@@Z */
2389 static void basic_filebuf_wchar__Init(basic_filebuf_wchar *this, FILE *file, basic_filebuf__Initfl which)
2391 TRACE("(%p %p %d)\n", this, file, which);
2393 this->cvt = NULL;
2394 this->wrotesome = FALSE;
2395 this->state = basic_filebuf_wchar__Init__Stinit;
2396 this->close = (which == INITFL_open);
2397 this->file = file;
2399 basic_streambuf_wchar__Init_empty(&this->base);
2402 /* ?_Init@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IAEXPAU_iobuf@@W4_Initfl@12@@Z */
2403 /* ?_Init@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IEAAXPEAU_iobuf@@W4_Initfl@12@@Z */
2404 static void basic_filebuf_short__Init(basic_filebuf_wchar *this, FILE *file, basic_filebuf__Initfl which)
2406 TRACE("(%p %p %d)\n", this, file, which);
2408 this->cvt = NULL;
2409 this->wrotesome = FALSE;
2410 this->state = basic_filebuf_short__Init__Stinit;
2411 this->close = (which == INITFL_open);
2412 this->file = file;
2414 basic_streambuf_wchar__Init_empty(&this->base);
2417 /* ?_Initcvt@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IAEXPAV?$codecvt@_WDH@2@@Z */
2418 /* ?_Initcvt@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IEAAXPEAV?$codecvt@_WDH@2@@Z */
2419 /* ?_Initcvt@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IAEXPAV?$codecvt@GDH@2@@Z */
2420 /* ?_Initcvt@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IEAAXPEAV?$codecvt@GDH@2@@Z */
2421 static void basic_filebuf_wchar__Initcvt(basic_filebuf_wchar *this, codecvt_wchar *cvt)
2423 TRACE("(%p %p)\n", this, cvt);
2425 if(codecvt_base_always_noconv(&cvt->base)) {
2426 this->cvt = NULL;
2427 }else {
2428 basic_streambuf_wchar__Init_empty(&this->base);
2429 this->cvt = cvt;
2433 /* ?_Endwrite@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IAE_NXZ */
2434 /* ?_Endwrite@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@IEAA_NXZ */
2435 /* ?_Endwrite@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IAE_NXZ */
2436 /* ?_Endwrite@?$basic_filebuf@GU?$char_traits@G@std@@@std@@IEAA_NXZ */
2437 static MSVCP_bool basic_filebuf_wchar__Endwrite(basic_filebuf_wchar *this)
2439 TRACE("(%p)\n", this);
2441 if(!this->wrotesome || !this->cvt)
2442 return TRUE;
2444 if(call_basic_streambuf_wchar_overflow(&this->base, WEOF) == WEOF)
2445 return FALSE;
2447 while(1) {
2448 /* TODO: check if we need a dynamic buffer here */
2449 char buf[128];
2450 char *next;
2451 int ret;
2453 ret = codecvt_wchar_unshift(this->cvt, &this->state, buf, buf+sizeof(buf), &next);
2454 switch(ret) {
2455 case CODECVT_ok:
2456 this->wrotesome = FALSE;
2457 /* fall through */
2458 case CODECVT_partial:
2459 if(!fwrite(buf, next-buf, 1, this->file))
2460 return FALSE;
2461 if(this->wrotesome)
2462 break;
2463 /* fall through */
2464 case CODECVT_noconv:
2465 if(call_basic_streambuf_wchar_overflow(&this->base, WEOF) == WEOF)
2466 return FALSE;
2467 return TRUE;
2468 default:
2469 return FALSE;
2474 /* ?close@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAEPAV12@XZ */
2475 /* ?close@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAAPEAV12@XZ */
2476 /* ?close@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAEPAV12@XZ */
2477 /* ?close@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAAPEAV12@XZ */
2478 static basic_filebuf_wchar* basic_filebuf_wchar_close(basic_filebuf_wchar *this)
2480 basic_filebuf_wchar *ret = this;
2482 TRACE("(%p)\n", this);
2484 if(!this->file)
2485 return NULL;
2487 /* TODO: handle exceptions */
2488 if(!basic_filebuf_wchar__Endwrite(this))
2489 ret = NULL;
2490 if(fclose(this->file))
2491 ret = NULL;
2493 basic_filebuf_wchar__Init(this, NULL, INITFL_close);
2494 return ret;
2497 /* ??0?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QAE@PAU_iobuf@@@Z */
2498 /* ??0?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEAA@PEAU_iobuf@@@Z */
2499 static basic_filebuf_wchar* basic_filebuf_wchar_ctor_file(basic_filebuf_wchar *this, FILE *file)
2501 TRACE("(%p %p)\n", this, file);
2503 basic_streambuf_wchar_ctor(&this->base);
2504 this->base.vtable = &MSVCP_basic_filebuf_wchar_vtable;
2506 basic_filebuf_wchar__Init(this, file, INITFL_new);
2507 return this;
2510 /* ??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QAE@PAU_iobuf@@@Z */
2511 /* ??0?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEAA@PEAU_iobuf@@@Z */
2512 static basic_filebuf_wchar* basic_filebuf_short_ctor_file(basic_filebuf_wchar *this, FILE *file)
2514 TRACE("(%p %p)\n", this, file);
2516 basic_streambuf_short_ctor(&this->base);
2517 this->base.vtable = &MSVCP_basic_filebuf_short_vtable;
2519 basic_filebuf_short__Init(this, file, INITFL_new);
2520 return this;
2523 /* ??1?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
2524 /* ??1?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
2525 /* ??1?$basic_filebuf@GU?$char_traits@G@std@@@std@@UAE@XZ */
2526 /* ??1?$basic_filebuf@GU?$char_traits@G@std@@@std@@UEAA@XZ */
2527 static void basic_filebuf_wchar_dtor(basic_filebuf_wchar *this)
2529 TRACE("(%p)\n", this);
2531 if(this->close)
2532 basic_filebuf_wchar_close(this);
2533 basic_streambuf_wchar_dtor(&this->base);
2536 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_vector_dtor, 8)
2537 basic_filebuf_wchar* __thiscall basic_filebuf_wchar_vector_dtor(basic_filebuf_wchar *this, unsigned int flags)
2539 TRACE("(%p %x)\n", this, flags);
2540 if(flags & 2) {
2541 /* we have an array, with the number of elements stored before the first object */
2542 INT_PTR i, *ptr = (INT_PTR *)this-1;
2544 for(i=*ptr-1; i>=0; i--)
2545 basic_filebuf_wchar_dtor(this+i);
2546 MSVCRT_operator_delete(ptr);
2547 } else {
2548 basic_filebuf_wchar_dtor(this);
2549 if(flags & 1)
2550 MSVCRT_operator_delete(this);
2553 return this;
2556 /* ?is_open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QBE_NXZ */
2557 /* ?is_open@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@QEBA_NXZ */
2558 /* ?is_open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QBE_NXZ */
2559 /* ?is_open@?$basic_filebuf@GU?$char_traits@G@std@@@std@@QEBA_NXZ */
2560 static MSVCP_bool basic_filebuf_wchar_is_open(const basic_filebuf_wchar *this)
2562 TRACE("(%p)\n", this);
2563 return this->file != NULL;
2566 /* ?overflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEGG@Z */
2567 /* ?overflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAGG@Z */
2568 /* ?overflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEGG@Z */
2569 /* ?overflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAGG@Z */
2570 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_overflow, 8)
2571 unsigned short __thiscall basic_filebuf_wchar_overflow(basic_filebuf_wchar *this, unsigned short c)
2573 char buf[8], *dyn_buf, *to_next;
2574 wchar_t ch = c;
2575 const wchar_t *from_next;
2576 int max_size;
2577 unsigned short ret;
2580 TRACE("(%p %d)\n", this, c);
2582 if(!basic_filebuf_wchar_is_open(this))
2583 return WEOF;
2584 if(c == WEOF)
2585 return !c;
2587 if(!this->cvt)
2588 return fwrite(&ch, sizeof(wchar_t), 1, this->file) ? c : WEOF;
2590 from_next = &ch;
2591 do {
2592 ret = codecvt_wchar_out(this->cvt, &this->state, from_next, &ch+1,
2593 &from_next, buf, buf+sizeof(buf), &to_next);
2595 switch(ret) {
2596 case CODECVT_partial:
2597 if(to_next == buf)
2598 break;
2599 /* fall through */
2600 case CODECVT_ok:
2601 if(!fwrite(buf, to_next-buf, 1, this->file))
2602 return WEOF;
2603 if(ret == CODECVT_partial)
2604 continue;
2605 return c;
2606 case CODECVT_noconv:
2607 return fwrite(&ch, sizeof(wchar_t), 1, this->file) ? c : WEOF;
2608 default:
2609 return WEOF;
2612 break;
2613 } while(1);
2615 max_size = codecvt_base_max_length(&this->cvt->base);
2616 dyn_buf = malloc(max_size);
2617 if(!dyn_buf)
2618 return WEOF;
2620 ret = codecvt_wchar_out(this->cvt, &this->state, from_next, &ch+1,
2621 &from_next, dyn_buf, dyn_buf+max_size, &to_next);
2623 switch(ret) {
2624 case CODECVT_ok:
2625 ret = fwrite(dyn_buf, to_next-dyn_buf, 1, this->file);
2626 free(dyn_buf);
2627 return ret ? c : WEOF;
2628 case CODECVT_partial:
2629 ERR("buffer should be big enough to store all output\n");
2630 /* fall through */
2631 default:
2632 free(dyn_buf);
2633 return WEOF;
2637 /* ?pbackfail@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEGG@Z */
2638 /* ?pbackfail@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAGG@Z */
2639 /* ?pbackfail@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEGG@Z */
2640 /* ?pbackfail@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAGG@Z */
2641 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_pbackfail, 8)
2642 unsigned short __thiscall basic_filebuf_wchar_pbackfail(basic_filebuf_wchar *this, unsigned short c)
2644 TRACE("(%p %d)\n", this, c);
2646 if(!basic_filebuf_wchar_is_open(this))
2647 return WEOF;
2649 if(basic_streambuf_wchar_gptr(&this->base)>basic_streambuf_wchar_eback(&this->base)
2650 && (c==WEOF || basic_streambuf_wchar_gptr(&this->base)[-1]==c)) {
2651 basic_streambuf_wchar__Gndec(&this->base);
2652 return c==WEOF ? !c : c;
2653 }else if(c!=WEOF && !this->cvt) {
2654 return ungetwc(c, this->file);
2655 }else if(c!=WEOF && basic_streambuf_wchar_gptr(&this->base)!=&this->putback) {
2656 this->putback = c;
2657 basic_streambuf_wchar_setg(&this->base, &this->putback, &this->putback, &this->putback+1);
2658 return c;
2661 return WEOF;
2664 /* ?uflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEGXZ */
2665 /* ?uflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAGXZ */
2666 /* ?uflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEGXZ */
2667 /* ?uflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAGXZ */
2668 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_uflow, 4)
2669 unsigned short __thiscall basic_filebuf_wchar_uflow(basic_filebuf_wchar *this)
2671 wchar_t ch, *to_next;
2672 char buf[128];
2673 const char *buf_next;
2674 int c;
2675 size_t i;
2677 TRACE("(%p)\n", this);
2679 if(!basic_filebuf_wchar_is_open(this))
2680 return WEOF;
2682 if(basic_streambuf_wchar_gptr(&this->base) < basic_streambuf_wchar_egptr(&this->base))
2683 return *basic_streambuf_wchar__Gninc(&this->base);
2685 if(!this->cvt)
2686 return fgetwc(this->file);
2688 buf_next = buf;
2689 for(i=0; i < sizeof(buf)/sizeof(buf[0]); i++) {
2690 if((c = fgetc(this->file)) == EOF)
2691 return WEOF;
2692 buf[i] = c;
2694 switch(codecvt_wchar_in(this->cvt, &this->state, buf_next,
2695 buf+i+1, &buf_next, &ch, &ch+1, &to_next)) {
2696 case CODECVT_partial:
2697 case CODECVT_ok:
2698 if(to_next == &ch)
2699 continue;
2702 ptrdiff_t j;
2704 for(j = --i; j >= buf_next-buf; j--)
2705 ungetc(buf[j], this->file);
2707 return ch;
2708 case CODECVT_noconv:
2709 if(i+1 < sizeof(wchar_t))
2710 continue;
2712 memcpy(&ch, buf, sizeof(wchar_t));
2713 return ch;
2714 default:
2715 return WEOF;
2719 FIXME("buffer is too small\n");
2720 return WEOF;
2723 /* ?underflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEGXZ */
2724 /* ?underflow@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAGXZ */
2725 /* ?underflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEGXZ */
2726 /* ?underflow@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAGXZ */
2727 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_underflow, 4)
2728 unsigned short __thiscall basic_filebuf_wchar_underflow(basic_filebuf_wchar *this)
2730 unsigned short ret;
2732 TRACE("(%p)\n", this);
2734 if(basic_streambuf_wchar_gptr(&this->base) < basic_streambuf_wchar_egptr(&this->base))
2735 return *basic_streambuf_wchar_gptr(&this->base);
2737 ret = call_basic_streambuf_wchar_uflow(&this->base);
2738 if(ret != WEOF)
2739 ret = call_basic_streambuf_wchar_pbackfail(&this->base, ret);
2740 return ret;
2743 /* ?seekoff@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
2744 /* ?seekoff@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
2745 /* ?seekoff@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAE?AV?$fpos@H@2@JHH@Z */
2746 /* ?seekoff@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAA?AV?$fpos@H@2@_JHH@Z */
2747 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_seekoff, 24)
2748 fpos_int* __thiscall basic_filebuf_wchar_seekoff(basic_filebuf_wchar *this,
2749 fpos_int *ret, streamoff off, int way, int mode)
2751 fpos_t pos;
2753 TRACE("(%p %p %s %d %d)\n", this, ret, wine_dbgstr_longlong(off), way, mode);
2755 if(basic_streambuf_wchar_gptr(&this->base) == &this->putback) {
2756 if(way == SEEKDIR_cur)
2757 off -= sizeof(wchar_t);
2759 basic_streambuf_wchar_setg(&this->base, &this->putback, &this->putback+1, &this->putback+1);
2762 if(!basic_filebuf_wchar_is_open(this) || !basic_filebuf_wchar__Endwrite(this)
2763 || fseek(this->file, off, way)) {
2764 ret->off = -1;
2765 ret->pos = 0;
2766 ret->state = 0;
2767 return ret;
2770 fgetpos(this->file, &pos);
2771 ret->off = 0;
2772 ret->pos = pos;
2773 ret->state = this->state;
2774 return ret;
2777 /* ?seekpos@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
2778 /* ?seekpos@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
2779 /* ?seekpos@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAE?AV?$fpos@H@2@V32@H@Z */
2780 /* ?seekpos@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAA?AV?$fpos@H@2@V32@H@Z */
2781 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_seekpos, 36)
2782 fpos_int* __thiscall basic_filebuf_wchar_seekpos(basic_filebuf_wchar *this,
2783 fpos_int *ret, fpos_int pos, int mode)
2785 fpos_t fpos;
2787 TRACE("(%p %p %s %d)\n", this, ret, debugstr_fpos_int(&pos), mode);
2789 if(!basic_filebuf_wchar_is_open(this) || !basic_filebuf_wchar__Endwrite(this)
2790 || fseek(this->file, (LONG)pos.pos, SEEK_SET)
2791 || (pos.off && fseek(this->file, pos.off, SEEK_CUR))) {
2792 ret->off = -1;
2793 ret->pos = 0;
2794 ret->state = 0;
2795 return ret;
2798 if(basic_streambuf_wchar_gptr(&this->base) == &this->putback)
2799 basic_streambuf_wchar_setg(&this->base, &this->putback, &this->putback+1, &this->putback+1);
2801 fgetpos(this->file, &fpos);
2802 ret->off = 0;
2803 ret->pos = fpos;
2804 ret->state = this->state;
2805 return ret;
2808 /* ?setbuf@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEPAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@PA_WH@Z */
2809 /* ?setbuf@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAPEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@PEA_W_J@Z */
2810 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_setbuf, 16)
2811 basic_streambuf_wchar* __thiscall basic_filebuf_wchar_setbuf(basic_filebuf_wchar *this, wchar_t *buf, streamsize count)
2813 TRACE("(%p %p %s)\n", this, buf, wine_dbgstr_longlong(count));
2815 if(!basic_filebuf_wchar_is_open(this))
2816 return NULL;
2818 if(setvbuf(this->file, (char*)buf, (buf==NULL && count==0) ? _IONBF : _IOFBF, count*sizeof(wchar_t)))
2819 return NULL;
2821 basic_filebuf_wchar__Init(this, this->file, INITFL_open);
2822 return &this->base;
2825 /* ?setbuf@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEPAV?$basic_streambuf@GU?$char_traits@G@std@@@2@PAGH@Z */
2826 /* ?setbuf@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAPEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@PEAG_J@Z */
2827 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_setbuf, 16)
2828 basic_streambuf_wchar* __thiscall basic_filebuf_short_setbuf(basic_filebuf_wchar *this, wchar_t *buf, streamsize count)
2830 TRACE("(%p %p %s)\n", this, buf, wine_dbgstr_longlong(count));
2832 if(!basic_filebuf_wchar_is_open(this))
2833 return NULL;
2835 if(setvbuf(this->file, (char*)buf, (buf==NULL && count==0) ? _IONBF : _IOFBF, count*sizeof(wchar_t)))
2836 return NULL;
2838 basic_filebuf_short__Init(this, this->file, INITFL_open);
2839 return &this->base;
2842 /* ?sync@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEHXZ */
2843 /* ?sync@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAHXZ */
2844 /* ?sync@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEHXZ */
2845 /* ?sync@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAHXZ */
2846 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_sync, 4)
2847 int __thiscall basic_filebuf_wchar_sync(basic_filebuf_wchar *this)
2849 TRACE("(%p)\n", this);
2851 if(!basic_filebuf_wchar_is_open(this))
2852 return 0;
2854 if(call_basic_streambuf_wchar_overflow(&this->base, WEOF) == WEOF)
2855 return 0;
2856 return fflush(this->file);
2859 /* ?imbue@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MAEXABVlocale@2@@Z */
2860 /* ?imbue@?$basic_filebuf@_WU?$char_traits@_W@std@@@std@@MEAAXAEBVlocale@2@@Z */
2861 DEFINE_THISCALL_WRAPPER(basic_filebuf_wchar_imbue, 8)
2862 void __thiscall basic_filebuf_wchar_imbue(basic_filebuf_wchar *this, const locale *loc)
2864 TRACE("(%p %p)\n", this, loc);
2865 basic_filebuf_wchar__Initcvt(this, codecvt_wchar_use_facet(loc));
2868 /* ?imbue@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MAEXABVlocale@2@@Z */
2869 /* ?imbue@?$basic_filebuf@GU?$char_traits@G@std@@@std@@MEAAXAEBVlocale@2@@Z */
2870 DEFINE_THISCALL_WRAPPER(basic_filebuf_short_imbue, 8)
2871 void __thiscall basic_filebuf_short_imbue(basic_filebuf_wchar *this, const locale *loc)
2873 TRACE("(%p %p)\n", this, loc);
2874 basic_filebuf_wchar__Initcvt(this, codecvt_short_use_facet(loc));
2877 /* ??0ios_base@std@@IAE@XZ */
2878 /* ??0ios_base@std@@IEAA@XZ */
2879 DEFINE_THISCALL_WRAPPER(ios_base_ctor, 4)
2880 ios_base* __thiscall ios_base_ctor(ios_base *this)
2882 TRACE("(%p)\n", this);
2883 this->vtable = &MSVCP_ios_base_vtable;
2884 return this;
2887 /* ??0ios_base@std@@QAE@ABV01@@Z */
2888 /* ??0ios_base@std@@QEAA@AEBV01@@Z */
2889 DEFINE_THISCALL_WRAPPER(ios_base_copy_ctor, 8)
2890 ios_base* __thiscall ios_base_copy_ctor(ios_base *this, const ios_base *copy)
2892 TRACE("(%p %p)\n", this, copy);
2893 *this = *copy;
2894 this->vtable = &MSVCP_ios_base_vtable;
2895 return this;
2898 /* ?_Callfns@ios_base@std@@AAEXW4event@12@@Z */
2899 /* ?_Callfns@ios_base@std@@AEAAXW4event@12@@Z */
2900 DEFINE_THISCALL_WRAPPER(ios_base_Callfns, 8)
2901 void __thiscall ios_base_Callfns(ios_base *this, IOS_BASE_event event)
2903 IOS_BASE_fnarray *cur;
2905 TRACE("(%p %x)\n", this, event);
2907 for(cur=this->calls; cur; cur=cur->next)
2908 cur->event_handler(event, this, cur->index);
2911 /* ?_Tidy@ios_base@std@@AAAXXZ */
2912 /* ?_Tidy@ios_base@std@@AEAAXXZ */
2913 void CDECL ios_base_Tidy(ios_base *this)
2915 IOS_BASE_iosarray *arr_cur, *arr_next;
2916 IOS_BASE_fnarray *event_cur, *event_next;
2918 TRACE("(%p)\n", this);
2920 ios_base_Callfns(this, EVENT_erase_event);
2922 for(arr_cur=this->arr; arr_cur; arr_cur=arr_next) {
2923 arr_next = arr_cur->next;
2924 MSVCRT_operator_delete(arr_cur);
2926 this->arr = NULL;
2928 for(event_cur=this->calls; event_cur; event_cur=event_next) {
2929 event_next = event_cur->next;
2930 MSVCRT_operator_delete(event_cur);
2932 this->calls = NULL;
2935 /* ?_Ios_base_dtor@ios_base@std@@CAXPAV12@@Z */
2936 /* ?_Ios_base_dtor@ios_base@std@@CAXPEAV12@@Z */
2937 void CDECL ios_base_Ios_base_dtor(ios_base *obj)
2939 TRACE("(%p)\n", obj);
2940 if(obj->loc) {
2941 locale_dtor(obj->loc);
2942 MSVCRT_operator_delete(obj->loc);
2944 ios_base_Tidy(obj);
2947 /* ??1ios_base@std@@UAE@XZ */
2948 /* ??1ios_base@std@@UEAA@XZ */
2949 DEFINE_THISCALL_WRAPPER(ios_base_dtor, 4)
2950 void __thiscall ios_base_dtor(ios_base *this)
2952 ios_base_Ios_base_dtor(this);
2955 DEFINE_THISCALL_WRAPPER(ios_base_vector_dtor, 8)
2956 ios_base* __thiscall ios_base_vector_dtor(ios_base *this, unsigned int flags)
2958 TRACE("(%p %x)\n", this, flags);
2959 if(flags & 2) {
2960 /* we have an array, with the number of elements stored before the first object */
2961 INT_PTR i, *ptr = (INT_PTR *)this-1;
2963 for(i=*ptr-1; i>=0; i--)
2964 ios_base_dtor(this+i);
2965 MSVCRT_operator_delete(ptr);
2966 } else {
2967 ios_base_dtor(this);
2968 if(flags & 1)
2969 MSVCRT_operator_delete(this);
2972 return this;
2975 DEFINE_THISCALL_WRAPPER(iosb_vector_dtor, 8)
2976 void* __thiscall iosb_vector_dtor(void *this, unsigned int flags)
2978 TRACE("(%p %x)\n", this, flags);
2979 if(flags & 2) {
2980 INT_PTR *ptr = (INT_PTR *)this-1;
2981 MSVCRT_operator_delete(ptr);
2982 } else {
2983 if(flags & 1)
2984 MSVCRT_operator_delete(this);
2987 return this;
2990 /* ?_Findarr@ios_base@std@@AAEAAU_Iosarray@12@H@Z */
2991 /* ?_Findarr@ios_base@std@@AEAAAEAU_Iosarray@12@H@Z */
2992 DEFINE_THISCALL_WRAPPER(ios_base_Findarr, 8)
2993 IOS_BASE_iosarray* __thiscall ios_base_Findarr(ios_base *this, int index)
2995 IOS_BASE_iosarray *p;
2997 TRACE("(%p %d)\n", this, index);
2999 for(p=this->arr; p; p=p->next) {
3000 if(p->index == index)
3001 return p;
3004 for(p=this->arr; p; p=p->next) {
3005 if(!p->long_val && !p->ptr_val) {
3006 p->index = index;
3007 return p;
3011 p = MSVCRT_operator_new(sizeof(IOS_BASE_iosarray));
3012 p->next = this->arr;
3013 p->index = index;
3014 p->long_val = 0;
3015 p->ptr_val = NULL;
3016 this->arr = p;
3017 return p;
3020 /* ?iword@ios_base@std@@QAEAAJH@Z */
3021 /* ?iword@ios_base@std@@QEAAAEAJH@Z */
3022 DEFINE_THISCALL_WRAPPER(ios_base_iword, 8)
3023 LONG* __thiscall ios_base_iword(ios_base *this, int index)
3025 TRACE("(%p %d)\n", this, index);
3026 return &ios_base_Findarr(this, index)->long_val;
3029 /* ?pword@ios_base@std@@QAEAAPAXH@Z */
3030 /* ?pword@ios_base@std@@QEAAAEAPEAXH@Z */
3031 DEFINE_THISCALL_WRAPPER(ios_base_pword, 8)
3032 void** __thiscall ios_base_pword(ios_base *this, int index)
3034 TRACE("(%p %d)\n", this, index);
3035 return &ios_base_Findarr(this, index)->ptr_val;
3038 /* ?register_callback@ios_base@std@@QAEXP6AXW4event@12@AAV12@H@ZH@Z */
3039 /* ?register_callback@ios_base@std@@QEAAXP6AXW4event@12@AEAV12@H@ZH@Z */
3040 DEFINE_THISCALL_WRAPPER(ios_base_register_callback, 12)
3041 void __thiscall ios_base_register_callback(ios_base *this, IOS_BASE_event_callback callback, int index)
3043 IOS_BASE_fnarray *event;
3045 TRACE("(%p %p %d)\n", this, callback, index);
3047 event = MSVCRT_operator_new(sizeof(IOS_BASE_fnarray));
3048 event->next = this->calls;
3049 event->index = index;
3050 event->event_handler = callback;
3051 this->calls = event;
3054 /* ?clear@ios_base@std@@QAEXH_N@Z */
3055 /* ?clear@ios_base@std@@QEAAXH_N@Z */
3056 DEFINE_THISCALL_WRAPPER(ios_base_clear_reraise, 12)
3057 void __thiscall ios_base_clear_reraise(ios_base *this, IOSB_iostate state, MSVCP_bool reraise)
3059 TRACE("(%p %x %x)\n", this, state, reraise);
3061 this->state = state & IOSTATE_mask;
3062 if(!(this->state & this->except))
3063 return;
3065 if(reraise)
3066 throw_exception(EXCEPTION_RERAISE, NULL);
3067 else if(this->state & this->except & IOSTATE_eofbit)
3068 throw_exception(EXCEPTION_FAILURE, "eofbit is set");
3069 else if(this->state & this->except & IOSTATE_failbit)
3070 throw_exception(EXCEPTION_FAILURE, "failbit is set");
3071 else if(this->state & this->except & IOSTATE_badbit)
3072 throw_exception(EXCEPTION_FAILURE, "badbit is set");
3073 else if(this->state & this->except & IOSTATE__Hardfail)
3074 throw_exception(EXCEPTION_FAILURE, "_Hardfail is set");
3077 /* ?clear@ios_base@std@@QAEXH@Z */
3078 /* ?clear@ios_base@std@@QEAAXH@Z */
3079 DEFINE_THISCALL_WRAPPER(ios_base_clear, 8)
3080 void __thiscall ios_base_clear(ios_base *this, IOSB_iostate state)
3082 ios_base_clear_reraise(this, state, FALSE);
3085 /* ?clear@ios_base@std@@QAEXI@Z */
3086 /* ?clear@ios_base@std@@QEAAXI@Z */
3087 DEFINE_THISCALL_WRAPPER(ios_base_clear_unsigned, 8)
3088 void __thiscall ios_base_clear_unsigned(ios_base *this, unsigned int state)
3090 ios_base_clear_reraise(this, (IOSB_iostate)state, FALSE);
3093 /* ?exceptions@ios_base@std@@QAEXH@Z */
3094 /* ?exceptions@ios_base@std@@QEAAXH@Z */
3095 DEFINE_THISCALL_WRAPPER(ios_base_exceptions_set, 8)
3096 void __thiscall ios_base_exceptions_set(ios_base *this, IOSB_iostate state)
3098 TRACE("(%p %x)\n", this, state);
3099 this->except = state & IOSTATE_mask;
3100 ios_base_clear(this, this->state);
3103 /* ?exceptions@ios_base@std@@QAEXI@Z */
3104 /* ?exceptions@ios_base@std@@QEAAXI@Z */
3105 DEFINE_THISCALL_WRAPPER(ios_base_exceptions_set_unsigned, 8)
3106 void __thiscall ios_base_exceptions_set_unsigned(ios_base *this, unsigned int state)
3108 TRACE("(%p %x)\n", this, state);
3109 ios_base_exceptions_set(this, state);
3112 /* ?exceptions@ios_base@std@@QBEHXZ */
3113 /* ?exceptions@ios_base@std@@QEBAHXZ */
3114 DEFINE_THISCALL_WRAPPER(ios_base_exceptions_get, 4)
3115 IOSB_iostate __thiscall ios_base_exceptions_get(ios_base *this)
3117 TRACE("(%p)\n", this);
3118 return this->except;
3121 /* ?copyfmt@ios_base@std@@QAEAAV12@ABV12@@Z */
3122 /* ?copyfmt@ios_base@std@@QEAAAEAV12@AEBV12@@Z */
3123 DEFINE_THISCALL_WRAPPER(ios_base_copyfmt, 8)
3124 ios_base* __thiscall ios_base_copyfmt(ios_base *this, const ios_base *rhs)
3126 TRACE("(%p %p)\n", this, rhs);
3128 if(this != rhs) {
3129 IOS_BASE_iosarray *arr_cur;
3130 IOS_BASE_fnarray *event_cur;
3132 ios_base_Tidy(this);
3134 for(arr_cur=rhs->arr; arr_cur; arr_cur=arr_cur->next) {
3135 if(arr_cur->long_val)
3136 *ios_base_iword(this, arr_cur->index) = arr_cur->long_val;
3137 if(arr_cur->ptr_val)
3138 *ios_base_pword(this, arr_cur->index) = arr_cur->ptr_val;
3140 this->stdstr = rhs->stdstr;
3141 this->fmtfl = rhs->fmtfl;
3142 this->prec = rhs->prec;
3143 this->wide = rhs->wide;
3144 locale_operator_assign(this->loc, rhs->loc);
3146 for(event_cur=rhs->calls; event_cur; event_cur=event_cur->next)
3147 ios_base_register_callback(this, event_cur->event_handler, event_cur->index);
3149 ios_base_Callfns(this, EVENT_copyfmt_event);
3150 ios_base_exceptions_set(this, rhs->except);
3153 return this;
3156 /* ??4ios_base@std@@QAEAAV01@ABV01@@Z */
3157 /* ??4ios_base@std@@QEAAAEAV01@AEBV01@@Z */
3158 DEFINE_THISCALL_WRAPPER(ios_base_assign, 8)
3159 ios_base* __thiscall ios_base_assign(ios_base *this, const ios_base *right)
3161 TRACE("(%p %p)\n", this, right);
3163 if(this != right) {
3164 this->state = right->state;
3165 ios_base_copyfmt(this, right);
3168 return this;
3171 /* ?fail@ios_base@std@@QBE_NXZ */
3172 /* ?fail@ios_base@std@@QEBA_NXZ */
3173 DEFINE_THISCALL_WRAPPER(ios_base_fail, 4)
3174 MSVCP_bool __thiscall ios_base_fail(const ios_base *this)
3176 TRACE("(%p)\n", this);
3177 return (this->state & (IOSTATE_failbit|IOSTATE_badbit)) != 0;
3180 /* ??7ios_base@std@@QBE_NXZ */
3181 /* ??7ios_base@std@@QEBA_NXZ */
3182 DEFINE_THISCALL_WRAPPER(ios_base_op_succ, 4)
3183 MSVCP_bool __thiscall ios_base_op_succ(const ios_base *this)
3185 TRACE("(%p)\n", this);
3186 return ios_base_fail(this);
3189 /* ??Bios_base@std@@QBEPAXXZ */
3190 /* ??Bios_base@std@@QEBAPEAXXZ */
3191 DEFINE_THISCALL_WRAPPER(ios_base_op_fail, 4)
3192 void* __thiscall ios_base_op_fail(const ios_base *this)
3194 TRACE("(%p)\n", this);
3195 return ios_base_fail(this) ? NULL : (void*)this;
3198 /* ?_Addstd@ios_base@std@@SAXPAV12@@Z */
3199 /* ?_Addstd@ios_base@std@@SAXPEAV12@@Z */
3200 void CDECL ios_base_Addstd(ios_base *add)
3202 FIXME("(%p) stub\n", add);
3205 /* ?_Init@ios_base@std@@IAEXXZ */
3206 /* ?_Init@ios_base@std@@IEAAXXZ */
3207 DEFINE_THISCALL_WRAPPER(ios_base__Init, 4)
3208 void __thiscall ios_base__Init(ios_base *this)
3210 TRACE("(%p)\n", this);
3212 this->stdstr = 0;
3213 this->state = this->except = IOSTATE_goodbit;
3214 this->fmtfl = FMTFLAG_skipws | FMTFLAG_dec;
3215 this->prec = 6;
3216 this->wide = 0;
3217 this->arr = NULL;
3218 this->calls = NULL;
3219 this->loc = MSVCRT_operator_new(sizeof(locale));
3220 locale_ctor(this->loc);
3223 /* ?bad@ios_base@std@@QBE_NXZ */
3224 /* ?bad@ios_base@std@@QEBA_NXZ */
3225 DEFINE_THISCALL_WRAPPER(ios_base_bad, 4)
3226 MSVCP_bool __thiscall ios_base_bad(const ios_base *this)
3228 TRACE("(%p)\n", this);
3229 return (this->state & IOSTATE_badbit) != 0;
3232 /* ?eof@ios_base@std@@QBE_NXZ */
3233 /* ?eof@ios_base@std@@QEBA_NXZ */
3234 DEFINE_THISCALL_WRAPPER(ios_base_eof, 4)
3235 MSVCP_bool __thiscall ios_base_eof(const ios_base *this)
3237 TRACE("(%p)\n", this);
3238 return (this->state & IOSTATE_eofbit) != 0;
3241 /* ?flags@ios_base@std@@QAEHH@Z */
3242 /* ?flags@ios_base@std@@QEAAHH@Z */
3243 DEFINE_THISCALL_WRAPPER(ios_base_flags_set, 8)
3244 IOSB_fmtflags __thiscall ios_base_flags_set(ios_base *this, IOSB_fmtflags flags)
3246 IOSB_fmtflags ret = this->fmtfl;
3248 TRACE("(%p %x)\n", this, flags);
3250 this->fmtfl = flags & FMTFLAG_mask;
3251 return ret;
3254 /* ?flags@ios_base@std@@QBEHXZ */
3255 /* ?flags@ios_base@std@@QEBAHXZ */
3256 DEFINE_THISCALL_WRAPPER(ios_base_flags_get, 4)
3257 IOSB_fmtflags __thiscall ios_base_flags_get(const ios_base *this)
3259 TRACE("(%p)\n", this);
3260 return this->fmtfl;
3263 /* ?getloc@ios_base@std@@QBE?AVlocale@2@XZ */
3264 /* ?getloc@ios_base@std@@QEBA?AVlocale@2@XZ */
3265 DEFINE_THISCALL_WRAPPER(ios_base_getloc, 8)
3266 locale* __thiscall ios_base_getloc(const ios_base *this, locale *ret)
3268 TRACE("(%p)\n", this);
3269 return locale_copy_ctor(ret, this->loc);
3272 /* ?good@ios_base@std@@QBE_NXZ */
3273 /* ?good@ios_base@std@@QEBA_NXZ */
3274 DEFINE_THISCALL_WRAPPER(ios_base_good, 4)
3275 MSVCP_bool __thiscall ios_base_good(const ios_base *this)
3277 TRACE("(%p)\n", this);
3278 return this->state == IOSTATE_goodbit;
3281 /* ?imbue@ios_base@std@@QAE?AVlocale@2@ABV32@@Z */
3282 /* ?imbue@ios_base@std@@QEAA?AVlocale@2@AEBV32@@Z */
3283 DEFINE_THISCALL_WRAPPER(ios_base_imbue, 12)
3284 locale* __thiscall ios_base_imbue(ios_base *this, locale *ret, const locale *loc)
3286 TRACE("(%p %p)\n", this, loc);
3287 *ret = *this->loc;
3288 locale_copy_ctor(this->loc, loc);
3289 return ret;
3292 /* ?precision@ios_base@std@@QAEHH@Z */
3293 /* ?precision@ios_base@std@@QEAA_J_J@Z */
3294 DEFINE_THISCALL_WRAPPER(ios_base_precision_set, 12)
3295 streamsize __thiscall ios_base_precision_set(ios_base *this, streamsize precision)
3297 streamsize ret = this->prec;
3299 TRACE("(%p %s)\n", this, wine_dbgstr_longlong(precision));
3301 this->prec = precision;
3302 return ret;
3305 /* ?precision@ios_base@std@@QBEHXZ */
3306 /* ?precision@ios_base@std@@QEBA_JXZ */
3307 DEFINE_THISCALL_WRAPPER(ios_base_precision_get, 4)
3308 streamsize __thiscall ios_base_precision_get(const ios_base *this)
3310 TRACE("(%p)\n", this);
3311 return this->prec;
3314 /* ?rdstate@ios_base@std@@QBEHXZ */
3315 /* ?rdstate@ios_base@std@@QEBAHXZ */
3316 DEFINE_THISCALL_WRAPPER(ios_base_rdstate, 4)
3317 IOSB_iostate __thiscall ios_base_rdstate(const ios_base *this)
3319 TRACE("(%p)\n", this);
3320 return this->state;
3323 /* ?setf@ios_base@std@@QAEHHH@Z */
3324 /* ?setf@ios_base@std@@QEAAHHH@Z */
3325 DEFINE_THISCALL_WRAPPER(ios_base_setf_mask, 12)
3326 IOSB_fmtflags __thiscall ios_base_setf_mask(ios_base *this, IOSB_fmtflags flags, IOSB_fmtflags mask)
3328 IOSB_fmtflags ret = this->fmtfl;
3330 TRACE("(%p %x %x)\n", this, flags, mask);
3332 this->fmtfl = (this->fmtfl & (~mask)) | (flags & mask & FMTFLAG_mask);
3333 return ret;
3336 /* ?setf@ios_base@std@@QAEHH@Z */
3337 /* ?setf@ios_base@std@@QEAAHH@Z */
3338 DEFINE_THISCALL_WRAPPER(ios_base_setf, 8)
3339 IOSB_fmtflags __thiscall ios_base_setf(ios_base *this, IOSB_fmtflags flags)
3341 return ios_base_setf_mask(this, flags, ~0);
3344 /* ?setstate@ios_base@std@@QAEXH_N@Z */
3345 /* ?setstate@ios_base@std@@QEAAXH_N@Z */
3346 DEFINE_THISCALL_WRAPPER(ios_base_setstate_reraise, 12)
3347 void __thiscall ios_base_setstate_reraise(ios_base *this, IOSB_iostate state, MSVCP_bool reraise)
3349 TRACE("(%p %x %x)\n", this, state, reraise);
3351 if(state != IOSTATE_goodbit)
3352 ios_base_clear_reraise(this, this->state | state, reraise);
3355 /* ?setstate@ios_base@std@@QAEXH@Z */
3356 /* ?setstate@ios_base@std@@QEAAXH@Z */
3357 DEFINE_THISCALL_WRAPPER(ios_base_setstate, 8)
3358 void __thiscall ios_base_setstate(ios_base *this, IOSB_iostate state)
3360 ios_base_setstate_reraise(this, state, FALSE);
3363 /* ?setstate@ios_base@std@@QAEXI@Z */
3364 /* ?setstate@ios_base@std@@QEAAXI@Z */
3365 DEFINE_THISCALL_WRAPPER(ios_base_setstate_unsigned, 8)
3366 void __thiscall ios_base_setstate_unsigned(ios_base *this, unsigned int state)
3368 ios_base_setstate_reraise(this, (IOSB_iostate)state, FALSE);
3371 /* ?sync_with_stdio@ios_base@std@@SA_N_N@Z */
3372 MSVCP_bool CDECL ios_base_sync_with_stdio(MSVCP_bool sync)
3374 _Lockit lock;
3375 MSVCP_bool ret;
3377 TRACE("(%x)\n", sync);
3379 _Lockit_ctor_locktype(&lock, _LOCK_STREAM);
3380 ret = ios_base_Sync;
3381 ios_base_Sync = sync;
3382 _Lockit_dtor(&lock);
3383 return ret;
3386 /* ?unsetf@ios_base@std@@QAEXH@Z */
3387 /* ?unsetf@ios_base@std@@QEAAXH@Z */
3388 DEFINE_THISCALL_WRAPPER(ios_base_unsetf, 8)
3389 void __thiscall ios_base_unsetf(ios_base *this, IOSB_fmtflags flags)
3391 TRACE("(%p %x)\n", this, flags);
3392 this->fmtfl &= ~flags;
3395 /* ?width@ios_base@std@@QAEHH@Z */
3396 /* ?width@ios_base@std@@QEAA_J_J@Z */
3397 DEFINE_THISCALL_WRAPPER(ios_base_width_set, 12)
3398 streamsize __thiscall ios_base_width_set(ios_base *this, streamsize width)
3400 streamsize ret = this->wide;
3402 TRACE("(%p %s)\n", this, wine_dbgstr_longlong(width));
3404 this->wide = width;
3405 return ret;
3408 /* ?width@ios_base@std@@QBEHXZ */
3409 /* ?width@ios_base@std@@QEBA_JXZ */
3410 DEFINE_THISCALL_WRAPPER(ios_base_width_get, 4)
3411 streamsize __thiscall ios_base_width_get(ios_base *this)
3413 TRACE("(%p)\n", this);
3414 return this->wide;
3417 /* ?xalloc@ios_base@std@@SAHXZ */
3418 int CDECL ios_base_xalloc(void)
3420 _Lockit lock;
3421 int ret;
3423 TRACE("\n");
3425 _Lockit_ctor_locktype(&lock, _LOCK_STREAM);
3426 ret = ios_base_Index++;
3427 _Lockit_dtor(&lock);
3428 return ret;
3431 /* ??0?$basic_ios@DU?$char_traits@D@std@@@std@@IAE@XZ */
3432 /* ??0?$basic_ios@DU?$char_traits@D@std@@@std@@IEAA@XZ */
3433 DEFINE_THISCALL_WRAPPER(basic_ios_char_ctor, 4)
3434 basic_ios_char* __thiscall basic_ios_char_ctor(basic_ios_char *this)
3436 TRACE("(%p)\n", this);
3438 ios_base_ctor(&this->base);
3439 this->base.vtable = &MSVCP_basic_ios_char_vtable;
3440 return this;
3443 /* ?init@?$basic_ios@DU?$char_traits@D@std@@@std@@IAEXPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@_N@Z */
3444 /* ?init@?$basic_ios@DU?$char_traits@D@std@@@std@@IEAAXPEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@_N@Z */
3445 DEFINE_THISCALL_WRAPPER(basic_ios_char_init, 12)
3446 void __thiscall basic_ios_char_init(basic_ios_char *this, basic_streambuf_char *streambuf, MSVCP_bool isstd)
3448 TRACE("(%p %p %x)\n", this, streambuf, isstd);
3449 ios_base__Init(&this->base);
3450 this->strbuf = streambuf;
3451 this->stream = NULL;
3452 this->fillch = ' ';
3454 if(!streambuf)
3455 ios_base_setstate(&this->base, IOSTATE_badbit);
3457 if(isstd)
3458 FIXME("standard streams not handled yet\n");
3461 /* ??0?$basic_ios@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
3462 /* ??0?$basic_ios@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
3463 DEFINE_THISCALL_WRAPPER(basic_ios_char_ctor_streambuf, 8)
3464 basic_ios_char* __thiscall basic_ios_char_ctor_streambuf(basic_ios_char *this, basic_streambuf_char *strbuf)
3466 TRACE("(%p %p)\n", this, strbuf);
3468 basic_ios_char_ctor(this);
3469 basic_ios_char_init(this, strbuf, FALSE);
3470 return this;
3473 /* ??1?$basic_ios@DU?$char_traits@D@std@@@std@@UAE@XZ */
3474 /* ??1?$basic_ios@DU?$char_traits@D@std@@@std@@UEAA@XZ */
3475 DEFINE_THISCALL_WRAPPER(basic_ios_char_dtor, 4)
3476 void __thiscall basic_ios_char_dtor(basic_ios_char *this)
3478 TRACE("(%p)\n", this);
3479 ios_base_dtor(&this->base);
3482 DEFINE_THISCALL_WRAPPER(basic_ios_char_vector_dtor, 8)
3483 basic_ios_char* __thiscall basic_ios_char_vector_dtor(basic_ios_char *this, unsigned int flags)
3485 TRACE("(%p %x)\n", this, flags);
3486 if(flags & 2) {
3487 /* we have an array, with the number of elements stored before the first object */
3488 INT_PTR i, *ptr = (INT_PTR *)this-1;
3490 for(i=*ptr-1; i>=0; i--)
3491 basic_ios_char_dtor(this+i);
3492 MSVCRT_operator_delete(ptr);
3493 } else {
3494 basic_ios_char_dtor(this);
3495 if(flags & 1)
3496 MSVCRT_operator_delete(this);
3499 return this;
3502 /* ?clear@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z */
3503 /* ?clear@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAXH_N@Z */
3504 DEFINE_THISCALL_WRAPPER(basic_ios_char_clear_reraise, 12)
3505 void __thiscall basic_ios_char_clear_reraise(basic_ios_char *this, IOSB_iostate state, MSVCP_bool reraise)
3507 TRACE("(%p %x %x)\n", this, state, reraise);
3508 ios_base_clear_reraise(&this->base, state | (this->strbuf ? IOSTATE_goodbit : IOSTATE_badbit), reraise);
3511 /* ?clear@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXI@Z */
3512 /* ?clear@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAXI@Z */
3513 DEFINE_THISCALL_WRAPPER(basic_ios_char_clear, 8)
3514 void __thiscall basic_ios_char_clear(basic_ios_char *this, unsigned int state)
3516 basic_ios_char_clear_reraise(this, (IOSB_iostate)state, FALSE);
3519 /* ?copyfmt@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEAAV12@ABV12@@Z */
3520 /* ?copyfmt@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAAEAV12@AEBV12@@Z */
3521 DEFINE_THISCALL_WRAPPER(basic_ios_char_copyfmt, 8)
3522 basic_ios_char* __thiscall basic_ios_char_copyfmt(basic_ios_char *this, basic_ios_char *copy)
3524 TRACE("(%p %p)\n", this, copy);
3525 if(this == copy)
3526 return this;
3528 this->stream = copy->stream;
3529 this->fillch = copy->fillch;
3530 ios_base_copyfmt(&this->base, &copy->base);
3531 return this;
3534 /* ?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEDD@Z */
3535 /* ?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAADD@Z */
3536 DEFINE_THISCALL_WRAPPER(basic_ios_char_fill_set, 8)
3537 char __thiscall basic_ios_char_fill_set(basic_ios_char *this, char fill)
3539 char ret = this->fillch;
3541 TRACE("(%p %c)\n", this, fill);
3543 this->fillch = fill;
3544 return ret;
3547 /* ?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEDXZ */
3548 /* ?fill@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBADXZ */
3549 DEFINE_THISCALL_WRAPPER(basic_ios_char_fill_get, 4)
3550 char __thiscall basic_ios_char_fill_get(basic_ios_char *this)
3552 TRACE("(%p)\n", this);
3553 return this->fillch;
3556 /* ?imbue@?$basic_ios@DU?$char_traits@D@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
3557 /* ?imbue@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
3558 DEFINE_THISCALL_WRAPPER(basic_ios_char_imbue, 12)
3559 locale *__thiscall basic_ios_char_imbue(basic_ios_char *this, locale *ret, const locale *loc)
3561 TRACE("(%p %p %p)\n", this, ret, loc);
3563 if(this->strbuf) {
3564 basic_streambuf_char_pubimbue(this->strbuf, ret, loc);
3565 locale_dtor(ret);
3568 return ios_base_imbue(&this->base, ret, loc);
3571 /* ?narrow@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEDDD@Z */
3572 /* ?narrow@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBADDD@Z */
3573 DEFINE_THISCALL_WRAPPER(basic_ios_char_narrow, 12)
3574 char __thiscall basic_ios_char_narrow(basic_ios_char *this, char ch, char def)
3576 TRACE("(%p %c %c)\n", this, ch, def);
3577 return ctype_char_narrow_ch(ctype_char_use_facet(this->strbuf->loc), ch, def);
3580 /* ?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PAV32@@Z */
3581 /* ?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAPEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@PEAV32@@Z */
3582 DEFINE_THISCALL_WRAPPER(basic_ios_char_rdbuf_set, 8)
3583 basic_streambuf_char* __thiscall basic_ios_char_rdbuf_set(basic_ios_char *this, basic_streambuf_char *streambuf)
3585 basic_streambuf_char *ret = this->strbuf;
3587 TRACE("(%p %p)\n", this, streambuf);
3589 this->strbuf = streambuf;
3590 basic_ios_char_clear(this, IOSTATE_goodbit);
3591 return ret;
3594 /* ?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_streambuf@DU?$char_traits@D@std@@@2@XZ */
3595 /* ?rdbuf@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@XZ */
3596 DEFINE_THISCALL_WRAPPER(basic_ios_char_rdbuf_get, 4)
3597 basic_streambuf_char* __thiscall basic_ios_char_rdbuf_get(const basic_ios_char *this)
3599 TRACE("(%p)\n", this);
3600 return this->strbuf;
3603 /* ?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXH_N@Z */
3604 /* ?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAXH_N@Z */
3605 DEFINE_THISCALL_WRAPPER(basic_ios_char_setstate_reraise, 12)
3606 void __thiscall basic_ios_char_setstate_reraise(basic_ios_char *this, IOSB_iostate state, MSVCP_bool reraise)
3608 TRACE("(%p %x %x)\n", this, state, reraise);
3610 if(state != IOSTATE_goodbit)
3611 basic_ios_char_clear_reraise(this, this->base.state | state, reraise);
3614 /* ?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEXI@Z */
3615 /* ?setstate@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAXI@Z */
3616 DEFINE_THISCALL_WRAPPER(basic_ios_char_setstate, 8)
3617 void __thiscall basic_ios_char_setstate(basic_ios_char *this, unsigned int state)
3619 basic_ios_char_setstate_reraise(this, (IOSB_iostate)state, FALSE);
3622 /* ?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QAEPAV?$basic_ostream@DU?$char_traits@D@std@@@2@PAV32@@Z */
3623 /* ?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QEAAPEAV?$basic_ostream@DU?$char_traits@D@std@@@2@PEAV32@@Z */
3624 DEFINE_THISCALL_WRAPPER(basic_ios_char_tie_set, 8)
3625 basic_ostream_char* __thiscall basic_ios_char_tie_set(basic_ios_char *this, basic_ostream_char *ostream)
3627 basic_ostream_char *ret = this->stream;
3629 TRACE("(%p %p)\n", this, ostream);
3631 this->stream = ostream;
3632 return ret;
3635 /* ?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEPAV?$basic_ostream@DU?$char_traits@D@std@@@2@XZ */
3636 /* ?tie@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBAPEAV?$basic_ostream@DU?$char_traits@D@std@@@2@XZ */
3637 DEFINE_THISCALL_WRAPPER(basic_ios_char_tie_get, 4)
3638 basic_ostream_char* __thiscall basic_ios_char_tie_get(const basic_ios_char *this)
3640 TRACE("(%p)\n", this);
3641 return this->stream;
3644 /* ?widen@?$basic_ios@DU?$char_traits@D@std@@@std@@QBEDD@Z */
3645 /* ?widen@?$basic_ios@DU?$char_traits@D@std@@@std@@QEBADD@Z */
3646 DEFINE_THISCALL_WRAPPER(basic_ios_char_widen, 8)
3647 char __thiscall basic_ios_char_widen(basic_ios_char *this, char ch)
3649 TRACE("(%p %c)\n", this, ch);
3650 return ctype_char_widen_ch(ctype_char_use_facet(this->strbuf->loc), ch);
3654 /* ??0?$basic_ios@_WU?$char_traits@_W@std@@@std@@IAE@XZ */
3655 /* ??0?$basic_ios@_WU?$char_traits@_W@std@@@std@@IEAA@XZ */
3656 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_ctor, 4)
3657 basic_ios_wchar* __thiscall basic_ios_wchar_ctor(basic_ios_wchar *this)
3659 TRACE("(%p)\n", this);
3661 ios_base_ctor(&this->base);
3662 this->base.vtable = &MSVCP_basic_ios_wchar_vtable;
3663 return this;
3666 /* ??0?$basic_ios@GU?$char_traits@G@std@@@std@@IAE@XZ */
3667 /* ??0?$basic_ios@GU?$char_traits@G@std@@@std@@IEAA@XZ */
3668 DEFINE_THISCALL_WRAPPER(basic_ios_short_ctor, 4)
3669 basic_ios_wchar* __thiscall basic_ios_short_ctor(basic_ios_wchar *this)
3671 basic_ios_wchar_ctor(this);
3672 this->base.vtable = &MSVCP_basic_ios_short_vtable;
3673 return this;
3676 /* ?init@?$basic_ios@_WU?$char_traits@_W@std@@@std@@IAEXPAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@_N@Z */
3677 /* ?init@?$basic_ios@_WU?$char_traits@_W@std@@@std@@IEAAXPEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@_N@Z */
3678 /* ?init@?$basic_ios@GU?$char_traits@G@std@@@std@@IAEXPAV?$basic_streambuf@GU?$char_traits@G@std@@@2@_N@Z */
3679 /* ?init@?$basic_ios@GU?$char_traits@G@std@@@std@@IEAAXPEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@_N@Z */
3680 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_init, 12)
3681 void __thiscall basic_ios_wchar_init(basic_ios_wchar *this, basic_streambuf_wchar *streambuf, MSVCP_bool isstd)
3683 TRACE("(%p %p %x)\n", this, streambuf, isstd);
3684 ios_base__Init(&this->base);
3685 this->strbuf = streambuf;
3686 this->stream = NULL;
3687 this->fillch = ' ';
3689 if(!streambuf)
3690 ios_base_setstate(&this->base, IOSTATE_badbit);
3692 if(isstd)
3693 FIXME("standard streams not handled yet\n");
3696 /* ??0?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAE@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
3697 /* ??0?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAA@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
3698 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_ctor_streambuf, 8)
3699 basic_ios_wchar* __thiscall basic_ios_wchar_ctor_streambuf(basic_ios_wchar *this, basic_streambuf_wchar *strbuf)
3701 TRACE("(%p %p)\n", this, strbuf);
3703 basic_ios_wchar_ctor(this);
3704 basic_ios_wchar_init(this, strbuf, FALSE);
3705 return this;
3708 /* ??0?$basic_ios@GU?$char_traits@G@std@@@std@@QAE@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
3709 /* ??0?$basic_ios@GU?$char_traits@G@std@@@std@@QEAA@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
3710 DEFINE_THISCALL_WRAPPER(basic_ios_short_ctor_streambuf, 8)
3711 basic_ios_wchar* __thiscall basic_ios_short_ctor_streambuf(basic_ios_wchar *this, basic_streambuf_wchar *strbuf)
3713 basic_ios_wchar_ctor_streambuf(this, strbuf);
3714 this->base.vtable = &MSVCP_basic_ios_short_vtable;
3715 return this;
3718 /* ??1?$basic_ios@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
3719 /* ??1?$basic_ios@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
3720 /* ??1?$basic_ios@GU?$char_traits@G@std@@@std@@UAE@XZ */
3721 /* ??1?$basic_ios@GU?$char_traits@G@std@@@std@@UEAA@XZ */
3722 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_dtor, 4)
3723 void __thiscall basic_ios_wchar_dtor(basic_ios_wchar *this)
3725 TRACE("(%p)\n", this);
3726 ios_base_dtor(&this->base);
3729 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_vector_dtor, 8)
3730 basic_ios_wchar* __thiscall basic_ios_wchar_vector_dtor(basic_ios_wchar *this, unsigned int flags)
3732 TRACE("(%p %x)\n", this, flags);
3733 if(flags & 2) {
3734 /* we have an array, with the number of elements stored before the first object */
3735 INT_PTR i, *ptr = (INT_PTR *)this-1;
3737 for(i=*ptr-1; i>=0; i--)
3738 basic_ios_wchar_dtor(this+i);
3739 MSVCRT_operator_delete(ptr);
3740 } else {
3741 basic_ios_wchar_dtor(this);
3742 if(flags & 1)
3743 MSVCRT_operator_delete(this);
3746 return this;
3749 /* ?clear@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEXH_N@Z */
3750 /* ?clear@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAXH_N@Z */
3751 /* ?clear@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEXH_N@Z */
3752 /* ?clear@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAXH_N@Z */
3753 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_clear_reraise, 12)
3754 void __thiscall basic_ios_wchar_clear_reraise(basic_ios_wchar *this, IOSB_iostate state, MSVCP_bool reraise)
3756 TRACE("(%p %x %x)\n", this, state, reraise);
3757 ios_base_clear_reraise(&this->base, state | (this->strbuf ? IOSTATE_goodbit : IOSTATE_badbit), reraise);
3760 /* ?clear@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEXI@Z */
3761 /* ?clear@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAXI@Z */
3762 /* ?clear@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEXI@Z */
3763 /* ?clear@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAXI@Z */
3764 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_clear, 8)
3765 void __thiscall basic_ios_wchar_clear(basic_ios_wchar *this, unsigned int state)
3767 basic_ios_wchar_clear_reraise(this, (IOSB_iostate)state, FALSE);
3770 /* ?copyfmt@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEAAV12@ABV12@@Z */
3771 /* ?copyfmt@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@AEBV12@@Z */
3772 /* ?copyfmt@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEAAV12@ABV12@@Z */
3773 /* ?copyfmt@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAAEAV12@AEBV12@@Z */
3774 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_copyfmt, 8)
3775 basic_ios_wchar* __thiscall basic_ios_wchar_copyfmt(basic_ios_wchar *this, basic_ios_wchar *copy)
3777 TRACE("(%p %p)\n", this, copy);
3778 if(this == copy)
3779 return this;
3781 this->stream = copy->stream;
3782 this->fillch = copy->fillch;
3783 ios_base_copyfmt(&this->base, &copy->base);
3784 return this;
3787 /* ?fill@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAE_W_W@Z */
3788 /* ?fill@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAA_W_W@Z */
3789 /* ?fill@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEGG@Z */
3790 /* ?fill@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAGG@Z */
3791 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_fill_set, 8)
3792 wchar_t __thiscall basic_ios_wchar_fill_set(basic_ios_wchar *this, wchar_t fill)
3794 wchar_t ret = this->fillch;
3796 TRACE("(%p %c)\n", this, fill);
3798 this->fillch = fill;
3799 return ret;
3802 /* ?fill@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QBE_WXZ */
3803 /* ?fill@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEBA_WXZ */
3804 /* ?fill@?$basic_ios@GU?$char_traits@G@std@@@std@@QBEGXZ */
3805 /* ?fill@?$basic_ios@GU?$char_traits@G@std@@@std@@QEBAGXZ */
3806 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_fill_get, 4)
3807 wchar_t __thiscall basic_ios_wchar_fill_get(basic_ios_wchar *this)
3809 TRACE("(%p)\n", this);
3810 return this->fillch;
3813 /* ?imbue@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
3814 /* ?imbue@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
3815 /* ?imbue@?$basic_ios@GU?$char_traits@G@std@@@std@@QAE?AVlocale@2@ABV32@@Z */
3816 /* ?imbue@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAA?AVlocale@2@AEBV32@@Z */
3817 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_imbue, 12)
3818 locale *__thiscall basic_ios_wchar_imbue(basic_ios_wchar *this, locale *ret, const locale *loc)
3820 TRACE("(%p %p %p)\n", this, ret, loc);
3822 if(this->strbuf) {
3823 basic_streambuf_wchar_pubimbue(this->strbuf, ret, loc);
3824 locale_dtor(ret);
3827 return ios_base_imbue(&this->base, ret, loc);
3830 /* ?narrow@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QBED_WD@Z */
3831 /* ?narrow@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEBAD_WD@Z */
3832 /* ?narrow@?$basic_ios@GU?$char_traits@G@std@@@std@@QBEDGD@Z */
3833 /* ?narrow@?$basic_ios@GU?$char_traits@G@std@@@std@@QEBADGD@Z */
3834 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_narrow, 12)
3835 char __thiscall basic_ios_wchar_narrow(basic_ios_wchar *this, wchar_t ch, char def)
3837 TRACE("(%p %c %c)\n", this, ch, def);
3838 return ctype_wchar_narrow_ch(ctype_wchar_use_facet(this->strbuf->loc), ch, def);
3841 /* ?rdbuf@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEPAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@PAV32@@Z */
3842 /* ?rdbuf@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAPEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@PEAV32@@Z */
3843 /* ?rdbuf@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEPAV?$basic_streambuf@GU?$char_traits@G@std@@@2@PAV32@@Z */
3844 /* ?rdbuf@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAPEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@PEAV32@@Z */
3845 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_rdbuf_set, 8)
3846 basic_streambuf_wchar* __thiscall basic_ios_wchar_rdbuf_set(basic_ios_wchar *this, basic_streambuf_wchar *streambuf)
3848 basic_streambuf_wchar *ret = this->strbuf;
3850 TRACE("(%p %p)\n", this, streambuf);
3852 this->strbuf = streambuf;
3853 basic_ios_wchar_clear(this, IOSTATE_goodbit);
3854 return ret;
3857 /* ?rdbuf@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QBEPAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@XZ */
3858 /* ?rdbuf@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEBAPEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@XZ */
3859 /* ?rdbuf@?$basic_ios@GU?$char_traits@G@std@@@std@@QBEPAV?$basic_streambuf@GU?$char_traits@G@std@@@2@XZ */
3860 /* ?rdbuf@?$basic_ios@GU?$char_traits@G@std@@@std@@QEBAPEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@XZ */
3861 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_rdbuf_get, 4)
3862 basic_streambuf_wchar* __thiscall basic_ios_wchar_rdbuf_get(const basic_ios_wchar *this)
3864 TRACE("(%p)\n", this);
3865 return this->strbuf;
3868 /* ?setstate@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEXH_N@Z */
3869 /* ?setstate@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAXH_N@Z */
3870 /* ?setstate@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEXH_N@Z */
3871 /* ?setstate@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAXH_N@Z */
3872 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_setstate_reraise, 12)
3873 void __thiscall basic_ios_wchar_setstate_reraise(basic_ios_wchar *this, IOSB_iostate state, MSVCP_bool reraise)
3875 TRACE("(%p %x %x)\n", this, state, reraise);
3877 if(state != IOSTATE_goodbit)
3878 basic_ios_wchar_clear_reraise(this, this->base.state | state, reraise);
3881 /* ?setstate@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEXI@Z */
3882 /* ?setstate@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAXI@Z */
3883 /* ?setstate@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEXI@Z */
3884 /* ?setstate@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAXI@Z */
3885 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_setstate, 8)
3886 void __thiscall basic_ios_wchar_setstate(basic_ios_wchar *this, IOSB_iostate state)
3888 basic_ios_wchar_setstate_reraise(this, state, FALSE);
3891 /* ?tie@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QAEPAV?$basic_ostream@_WU?$char_traits@_W@std@@@2@PAV32@@Z */
3892 /* ?tie@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEAAPEAV?$basic_ostream@_WU?$char_traits@_W@std@@@2@PEAV32@@Z */
3893 /* ?tie@?$basic_ios@GU?$char_traits@G@std@@@std@@QAEPAV?$basic_ostream@GU?$char_traits@G@std@@@2@PAV32@@Z */
3894 /* ?tie@?$basic_ios@GU?$char_traits@G@std@@@std@@QEAAPEAV?$basic_ostream@GU?$char_traits@G@std@@@2@PEAV32@@Z */
3895 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_tie_set, 8)
3896 basic_ostream_wchar* __thiscall basic_ios_wchar_tie_set(basic_ios_wchar *this, basic_ostream_wchar *ostream)
3898 basic_ostream_wchar *ret = this->stream;
3900 TRACE("(%p %p)\n", this, ostream);
3902 this->stream = ostream;
3903 return ret;
3906 /* ?tie@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QBEPAV?$basic_ostream@_WU?$char_traits@_W@std@@@2@XZ */
3907 /* ?tie@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEBAPEAV?$basic_ostream@_WU?$char_traits@_W@std@@@2@XZ */
3908 /* ?tie@?$basic_ios@GU?$char_traits@G@std@@@std@@QBEPAV?$basic_ostream@GU?$char_traits@G@std@@@2@XZ */
3909 /* ?tie@?$basic_ios@GU?$char_traits@G@std@@@std@@QEBAPEAV?$basic_ostream@GU?$char_traits@G@std@@@2@XZ */
3910 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_tie_get, 4)
3911 basic_ostream_wchar* __thiscall basic_ios_wchar_tie_get(const basic_ios_wchar *this)
3913 TRACE("(%p)\n", this);
3914 return this->stream;
3917 /* ?widen@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QBE_WD@Z */
3918 /* ?widen@?$basic_ios@_WU?$char_traits@_W@std@@@std@@QEBA_WD@Z */
3919 /* ?widen@?$basic_ios@GU?$char_traits@G@std@@@std@@QBEGD@Z */
3920 /* ?widen@?$basic_ios@GU?$char_traits@G@std@@@std@@QEBAGD@Z */
3921 DEFINE_THISCALL_WRAPPER(basic_ios_wchar_widen, 8)
3922 wchar_t __thiscall basic_ios_wchar_widen(basic_ios_wchar *this, char ch)
3924 TRACE("(%p %c)\n", this, ch);
3925 return ctype_wchar_widen_ch(ctype_wchar_use_facet(this->strbuf->loc), ch);
3928 /* Caution: basic_ostream uses virtual inheritance.
3929 * All constructors have additional parameter that says if base class should be initialized.
3930 * Base class needs to be accessed using vbtable.
3932 static inline basic_ios_char* basic_ostream_char_get_basic_ios(basic_ostream_char *this)
3934 return (basic_ios_char*)((char*)this+this->vbtable[1]);
3937 static inline basic_ios_char* basic_ostream_char_to_basic_ios(basic_ostream_char *ptr)
3939 return (basic_ios_char*)((char*)ptr+basic_ostream_char_vbtable[1]);
3942 static inline basic_ostream_char* basic_ostream_char_from_basic_ios(basic_ios_char *ptr)
3944 return (basic_ostream_char*)((char*)ptr-basic_ostream_char_vbtable[1]);
3947 /* ??0?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z */
3948 /* ??0?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z */
3949 DEFINE_THISCALL_WRAPPER(basic_ostream_char_ctor, 16)
3950 basic_ostream_char* __thiscall basic_ostream_char_ctor(basic_ostream_char *this,
3951 basic_streambuf_char *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
3953 basic_ios_char *base;
3955 TRACE("(%p %p %d %d)\n", this, strbuf, isstd, virt_init);
3957 if(virt_init) {
3958 this->vbtable = basic_ostream_char_vbtable;
3959 base = basic_ostream_char_get_basic_ios(this);
3960 basic_ios_char_ctor(base);
3961 }else {
3962 base = basic_ostream_char_get_basic_ios(this);
3965 base->base.vtable = &MSVCP_basic_ostream_char_vtable;
3966 basic_ios_char_init(base, strbuf, isstd);
3967 return this;
3970 /* ??0?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE@W4_Uninitialized@1@_N@Z */
3971 /* ??0?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA@W4_Uninitialized@1@_N@Z */
3972 DEFINE_THISCALL_WRAPPER(basic_ostream_char_ctor_uninitialized, 16)
3973 basic_ostream_char* __thiscall basic_ostream_char_ctor_uninitialized(basic_ostream_char *this,
3974 int uninitialized, MSVCP_bool addstd, MSVCP_bool virt_init)
3976 basic_ios_char *base;
3978 TRACE("(%p %d %x)\n", this, uninitialized, addstd);
3980 if(virt_init) {
3981 this->vbtable = basic_ostream_char_vbtable;
3982 base = basic_ostream_char_get_basic_ios(this);
3983 basic_ios_char_ctor(base);
3984 }else {
3985 base = basic_ostream_char_get_basic_ios(this);
3988 base->base.vtable = &MSVCP_basic_ostream_char_vtable;
3989 if(addstd)
3990 ios_base_Addstd(&base->base);
3991 return this;
3994 /* ??1?$basic_ostream@DU?$char_traits@D@std@@@std@@UAE@XZ */
3995 /* ??1?$basic_ostream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
3996 DEFINE_THISCALL_WRAPPER(basic_ostream_char_dtor, 4)
3997 void __thiscall basic_ostream_char_dtor(basic_ios_char *base)
3999 basic_ostream_char *this = basic_ostream_char_from_basic_ios(base);
4001 /* don't destroy virtual base here */
4002 TRACE("(%p)\n", this);
4005 /* ??_D?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ */
4006 /* ??_D?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
4007 DEFINE_THISCALL_WRAPPER(basic_ostream_char_vbase_dtor, 4)
4008 void __thiscall basic_ostream_char_vbase_dtor(basic_ostream_char *this)
4010 TRACE("(%p)\n", this);
4011 basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(this));
4012 basic_ios_char_dtor(basic_ostream_char_get_basic_ios(this));
4015 DEFINE_THISCALL_WRAPPER(basic_ostream_char_vector_dtor, 8)
4016 basic_ostream_char* __thiscall basic_ostream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
4018 basic_ostream_char *this = basic_ostream_char_from_basic_ios(base);
4020 TRACE("(%p %x)\n", this, flags);
4022 if(flags & 2) {
4023 /* we have an array, with the number of elements stored before the first object */
4024 INT_PTR i, *ptr = (INT_PTR *)this-1;
4026 for(i=*ptr-1; i>=0; i--)
4027 basic_ostream_char_vbase_dtor(this+i);
4028 MSVCRT_operator_delete(ptr);
4029 } else {
4030 basic_ostream_char_vbase_dtor(this);
4031 if(flags & 1)
4032 MSVCRT_operator_delete(this);
4035 return this;
4038 /* ?flush@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@XZ */
4039 /* ?flush@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@XZ */
4040 DEFINE_THISCALL_WRAPPER(basic_ostream_char_flush, 4)
4041 basic_ostream_char* __thiscall basic_ostream_char_flush(basic_ostream_char *this)
4043 /* this function is not matching C++ specification */
4044 basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
4046 TRACE("(%p)\n", this);
4048 if(basic_ios_char_rdbuf_get(base) && ios_base_good(&base->base)
4049 && basic_streambuf_char_pubsync(basic_ios_char_rdbuf_get(base))==-1)
4050 basic_ios_char_setstate(base, IOSTATE_badbit);
4051 return this;
4054 /* ?flush@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z */
4055 /* ?flush@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@1@AEAV21@@Z */
4056 basic_ostream_char* __cdecl flush_ostream_char(basic_ostream_char *ostream)
4058 return basic_ostream_char_flush(ostream);
4061 /* ?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ */
4062 /* ?_Osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
4063 DEFINE_THISCALL_WRAPPER(basic_ostream_char__Osfx, 4)
4064 void __thiscall basic_ostream_char__Osfx(basic_ostream_char *this)
4066 basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
4068 TRACE("(%p)\n", this);
4070 if(base->base.fmtfl & FMTFLAG_unitbuf)
4071 basic_ostream_char_flush(this);
4074 /* ?osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEXXZ */
4075 /* ?osfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
4076 DEFINE_THISCALL_WRAPPER(basic_ostream_char_osfx, 4)
4077 void __thiscall basic_ostream_char_osfx(basic_ostream_char *this)
4079 TRACE("(%p)\n", this);
4080 basic_ostream_char__Osfx(this);
4083 static BOOL basic_ostream_char_sentry_create(basic_ostream_char *ostr)
4085 basic_ios_char *base = basic_ostream_char_get_basic_ios(ostr);
4087 if(basic_ios_char_rdbuf_get(base))
4088 call_basic_streambuf_char__Lock(base->strbuf);
4090 if(ios_base_good(&base->base) && base->stream)
4091 basic_ostream_char_flush(base->stream);
4093 return ios_base_good(&base->base);
4096 static void basic_ostream_char_sentry_destroy(basic_ostream_char *ostr)
4098 basic_ios_char *base = basic_ostream_char_get_basic_ios(ostr);
4100 if(ios_base_good(&base->base) && !__uncaught_exception())
4101 basic_ostream_char_osfx(ostr);
4103 if(basic_ios_char_rdbuf_get(base))
4104 call_basic_streambuf_char__Unlock(base->strbuf);
4107 /* ?opfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE_NXZ */
4108 /* ?opfx@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA_NXZ */
4109 DEFINE_THISCALL_WRAPPER(basic_ostream_char_opfx, 4)
4110 MSVCP_bool __thiscall basic_ostream_char_opfx(basic_ostream_char *this)
4112 basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
4114 TRACE("(%p)\n", this);
4116 if(ios_base_good(&base->base) && base->stream)
4117 basic_ostream_char_flush(base->stream);
4118 return ios_base_good(&base->base);
4121 /* ?put@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@D@Z */
4122 /* ?put@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@D@Z */
4123 DEFINE_THISCALL_WRAPPER(basic_ostream_char_put, 8)
4124 basic_ostream_char* __thiscall basic_ostream_char_put(basic_ostream_char *this, char ch)
4126 basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
4128 TRACE("(%p %c)\n", this, ch);
4130 if(!basic_ostream_char_sentry_create(this)
4131 || basic_streambuf_char_sputc(base->strbuf, ch)==EOF) {
4132 basic_ostream_char_sentry_destroy(this);
4133 basic_ios_char_setstate(base, IOSTATE_badbit);
4134 return this;
4137 basic_ostream_char_sentry_destroy(this);
4138 return this;
4141 /* ?seekp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@JH@Z */
4142 /* ?seekp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@_JH@Z */
4143 DEFINE_THISCALL_WRAPPER(basic_ostream_char_seekp, 16)
4144 basic_ostream_char* __thiscall basic_ostream_char_seekp(basic_ostream_char *this, streamoff off, int way)
4146 basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
4148 TRACE("(%p %s %d)\n", this, wine_dbgstr_longlong(off), way);
4150 if(!ios_base_fail(&base->base)) {
4151 fpos_int seek;
4153 basic_streambuf_char_pubseekoff(basic_ios_char_rdbuf_get(base),
4154 &seek, off, way, OPENMODE_out);
4155 if(seek.off==-1 && seek.pos==0 && seek.state==0)
4156 basic_ios_char_setstate(base, IOSTATE_failbit);
4158 return this;
4161 /* ?seekp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
4162 /* ?seekp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
4163 DEFINE_THISCALL_WRAPPER(basic_ostream_char_seekp_fpos, 28)
4164 basic_ostream_char* __thiscall basic_ostream_char_seekp_fpos(basic_ostream_char *this, fpos_int pos)
4166 basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
4168 TRACE("(%p %s)\n", this, debugstr_fpos_int(&pos));
4170 if(!ios_base_fail(&base->base)) {
4171 fpos_int seek;
4173 basic_streambuf_char_pubseekpos(basic_ios_char_rdbuf_get(base),
4174 &seek, pos, OPENMODE_out);
4175 if(seek.off==-1 && seek.pos==0 && seek.state==0)
4176 basic_ios_char_setstate(base, IOSTATE_failbit);
4178 return this;
4181 /* ?tellp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@XZ */
4182 /* ?tellp@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
4183 DEFINE_THISCALL_WRAPPER(basic_ostream_char_tellp, 8)
4184 fpos_int* __thiscall basic_ostream_char_tellp(basic_ostream_char *this, fpos_int *ret)
4186 basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
4188 TRACE("(%p)\n", this);
4190 if(!ios_base_fail(&base->base)) {
4191 basic_streambuf_char_pubseekoff(basic_ios_char_rdbuf_get(base),
4192 ret, 0, SEEKDIR_cur, OPENMODE_out);
4193 }else {
4194 ret->off = -1;
4195 ret->pos = 0;
4196 ret->state = 0;
4198 return ret;
4201 /* ?write@?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV12@PBDH@Z */
4202 /* ?write@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEBD_J@Z */
4203 DEFINE_THISCALL_WRAPPER(basic_ostream_char_write, 16)
4204 basic_ostream_char* __thiscall basic_ostream_char_write(basic_ostream_char *this, const char *str, streamsize count)
4206 basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
4208 TRACE("(%p %s %s)\n", this, debugstr_a(str), wine_dbgstr_longlong(count));
4210 if(!basic_ostream_char_sentry_create(this)
4211 || basic_streambuf_char_sputn(base->strbuf, str, count)!=count) {
4212 basic_ostream_char_sentry_destroy(this);
4213 basic_ios_char_setstate(base, IOSTATE_badbit);
4214 return this;
4217 basic_ostream_char_sentry_destroy(this);
4218 return this;
4221 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@F@Z */
4222 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@F@Z */
4223 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_short, 8)
4224 basic_ostream_char* __thiscall basic_ostream_char_print_short(basic_ostream_char *this, short val)
4226 basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
4227 int state = IOSTATE_goodbit;
4229 TRACE("(%p %d)\n", this, val);
4231 if(basic_ostream_char_sentry_create(this)) {
4232 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
4233 const num_put *numput = num_put_char_use_facet(strbuf->loc);
4234 ostreambuf_iterator_char dest = {0, strbuf};
4236 num_put_char_put_long(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base),
4237 (ios_base_flags_get(&base->base) & FMTFLAG_basefield & (FMTFLAG_oct | FMTFLAG_hex))
4238 ? (LONG)((unsigned short)val) : (LONG)val);
4240 basic_ostream_char_sentry_destroy(this);
4242 basic_ios_char_setstate(base, state);
4243 return this;
4246 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@G@Z */
4247 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@G@Z */
4248 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_ushort, 8)
4249 basic_ostream_char* __thiscall basic_ostream_char_print_ushort(basic_ostream_char *this, unsigned short val)
4251 basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
4252 int state = IOSTATE_goodbit;
4254 TRACE("(%p %u)\n", this, val);
4256 if(basic_ostream_char_sentry_create(this)) {
4257 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
4258 const num_put *numput = num_put_char_use_facet(strbuf->loc);
4259 ostreambuf_iterator_char dest = {0, strbuf};
4261 num_put_char_put_ulong(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
4263 basic_ostream_char_sentry_destroy(this);
4265 basic_ios_char_setstate(base, state);
4266 return this;
4269 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@H@Z */
4270 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@H@Z */
4271 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@J@Z */
4272 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@J@Z */
4273 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_int, 8)
4274 basic_ostream_char* __thiscall basic_ostream_char_print_int(basic_ostream_char *this, int val)
4276 basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
4277 int state = IOSTATE_goodbit;
4279 TRACE("(%p %d)\n", this, val);
4281 if(basic_ostream_char_sentry_create(this)) {
4282 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
4283 const num_put *numput = num_put_char_use_facet(strbuf->loc);
4284 ostreambuf_iterator_char dest = {0, strbuf};
4286 num_put_char_put_long(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
4288 basic_ostream_char_sentry_destroy(this);
4290 basic_ios_char_setstate(base, state);
4291 return this;
4294 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@I@Z */
4295 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@I@Z */
4296 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@K@Z */
4297 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@K@Z */
4298 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_uint, 8)
4299 basic_ostream_char* __thiscall basic_ostream_char_print_uint(basic_ostream_char *this, unsigned int val)
4301 basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
4302 int state = IOSTATE_goodbit;
4304 TRACE("(%p %u)\n", this, val);
4306 if(basic_ostream_char_sentry_create(this)) {
4307 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
4308 const num_put *numput = num_put_char_use_facet(strbuf->loc);
4309 ostreambuf_iterator_char dest = {0, strbuf};
4311 num_put_char_put_ulong(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
4313 basic_ostream_char_sentry_destroy(this);
4315 basic_ios_char_setstate(base, state);
4316 return this;
4319 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@M@Z */
4320 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@M@Z */
4321 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_float, 8)
4322 basic_ostream_char* __thiscall basic_ostream_char_print_float(basic_ostream_char *this, float val)
4324 basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
4325 int state = IOSTATE_goodbit;
4327 TRACE("(%p %f)\n", this, val);
4329 if(basic_ostream_char_sentry_create(this)) {
4330 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
4331 const num_put *numput = num_put_char_use_facet(strbuf->loc);
4332 ostreambuf_iterator_char dest = {0, strbuf};
4334 num_put_char_put_double(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
4336 basic_ostream_char_sentry_destroy(this);
4338 basic_ios_char_setstate(base, state);
4339 return this;
4342 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@N@Z */
4343 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@N@Z */
4344 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_double, 12)
4345 basic_ostream_char* __thiscall basic_ostream_char_print_double(basic_ostream_char *this, double val)
4347 basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
4348 int state = IOSTATE_goodbit;
4350 TRACE("(%p %lf)\n", this, val);
4352 if(basic_ostream_char_sentry_create(this)) {
4353 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
4354 const num_put *numput = num_put_char_use_facet(strbuf->loc);
4355 ostreambuf_iterator_char dest = {0, strbuf};
4357 num_put_char_put_double(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
4359 basic_ostream_char_sentry_destroy(this);
4361 basic_ios_char_setstate(base, state);
4362 return this;
4365 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@O@Z */
4366 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@O@Z */
4367 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_ldouble, 12)
4368 basic_ostream_char* __thiscall basic_ostream_char_print_ldouble(basic_ostream_char *this, double val)
4370 basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
4371 int state = IOSTATE_goodbit;
4373 TRACE("(%p %lf)\n", this, val);
4375 if(basic_ostream_char_sentry_create(this)) {
4376 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
4377 const num_put *numput = num_put_char_use_facet(strbuf->loc);
4378 ostreambuf_iterator_char dest = {0, strbuf};
4380 num_put_char_put_ldouble(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
4382 basic_ostream_char_sentry_destroy(this);
4384 basic_ios_char_setstate(base, state);
4385 return this;
4388 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
4389 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
4390 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_streambuf, 8)
4391 basic_ostream_char* __thiscall basic_ostream_char_print_streambuf(basic_ostream_char *this, basic_streambuf_char *val)
4393 basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
4394 IOSB_iostate state = IOSTATE_badbit;
4395 int c = '\n';
4397 TRACE("(%p %p)\n", this, val);
4399 if(basic_ostream_char_sentry_create(this)) {
4400 for(c = basic_streambuf_char_sgetc(val); c!=EOF;
4401 c = basic_streambuf_char_snextc(val)) {
4402 state = IOSTATE_goodbit;
4404 if(basic_streambuf_char_sputc(base->strbuf, c) == EOF) {
4405 state = IOSTATE_badbit;
4406 break;
4409 }else {
4410 state = IOSTATE_badbit;
4412 basic_ostream_char_sentry_destroy(this);
4414 ios_base_width_set(&base->base, 0);
4415 basic_ios_char_setstate(base, state);
4416 return this;
4419 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@PBX@Z */
4420 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@PEBX@Z */
4421 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_ptr, 8)
4422 basic_ostream_char* __thiscall basic_ostream_char_print_ptr(basic_ostream_char *this, const void *val)
4424 basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
4425 int state = IOSTATE_goodbit;
4427 TRACE("(%p %p)\n", this, val);
4429 if(basic_ostream_char_sentry_create(this)) {
4430 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
4431 const num_put *numput = num_put_char_use_facet(strbuf->loc);
4432 ostreambuf_iterator_char dest = {0, strbuf};
4434 num_put_char_put_ptr(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
4436 basic_ostream_char_sentry_destroy(this);
4438 basic_ios_char_setstate(base, state);
4439 return this;
4442 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@_J@Z */
4443 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@_J@Z */
4444 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_int64, 12)
4445 basic_ostream_char* __thiscall basic_ostream_char_print_int64(basic_ostream_char *this, __int64 val)
4447 basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
4448 int state = IOSTATE_goodbit;
4450 TRACE("(%p)\n", this);
4452 if(basic_ostream_char_sentry_create(this)) {
4453 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
4454 const num_put *numput = num_put_char_use_facet(strbuf->loc);
4455 ostreambuf_iterator_char dest = {0, strbuf};
4457 num_put_char_put_int64(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
4459 basic_ostream_char_sentry_destroy(this);
4461 basic_ios_char_setstate(base, state);
4462 return this;
4465 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@_K@Z */
4466 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@_K@Z */
4467 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_uint64, 12)
4468 basic_ostream_char* __thiscall basic_ostream_char_print_uint64(basic_ostream_char *this, unsigned __int64 val)
4470 basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
4471 int state = IOSTATE_goodbit;
4473 TRACE("(%p)\n", this);
4475 if(basic_ostream_char_sentry_create(this)) {
4476 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
4477 const num_put *numput = num_put_char_use_facet(strbuf->loc);
4478 ostreambuf_iterator_char dest = {0, strbuf};
4480 num_put_char_put_uint64(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
4482 basic_ostream_char_sentry_destroy(this);
4484 basic_ios_char_setstate(base, state);
4485 return this;
4488 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@_N@Z */
4489 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@_N@Z */
4490 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_bool, 8)
4491 basic_ostream_char* __thiscall basic_ostream_char_print_bool(basic_ostream_char *this, MSVCP_bool val)
4493 basic_ios_char *base = basic_ostream_char_get_basic_ios(this);
4494 int state = IOSTATE_goodbit;
4496 TRACE("(%p %x)\n", this, val);
4498 if(basic_ostream_char_sentry_create(this)) {
4499 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
4500 const num_put *numput = num_put_char_use_facet(strbuf->loc);
4501 ostreambuf_iterator_char dest = {0, strbuf};
4503 num_put_char_put_bool(numput, &dest, dest, &base->base, basic_ios_char_fill_get(base), val);
4505 basic_ostream_char_sentry_destroy(this);
4507 basic_ios_char_setstate(base, state);
4508 return this;
4511 /* ?ends@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z */
4512 /* ?ends@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@1@AEAV21@@Z */
4513 basic_ostream_char* __cdecl basic_ostream_char_ends(basic_ostream_char *ostr)
4515 TRACE("(%p)\n", ostr);
4517 basic_ostream_char_put(ostr, 0);
4518 return ostr;
4521 /* ?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z */
4522 /* ?endl@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@1@AEAV21@@Z */
4523 basic_ostream_char* __cdecl basic_ostream_char_endl(basic_ostream_char *ostr)
4525 TRACE("(%p)\n", ostr);
4527 basic_ostream_char_put(ostr, '\n');
4528 basic_ostream_char_flush(ostr);
4529 return ostr;
4532 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
4533 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
4534 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_func, 8)
4535 basic_ostream_char* __thiscall basic_ostream_char_print_func(basic_ostream_char *this,
4536 basic_ostream_char* (__cdecl *pfunc)(basic_ostream_char*))
4538 TRACE("(%p %p)\n", this, pfunc);
4539 pfunc(this);
4540 return this;
4543 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@DU?$char_traits@D@std@@@1@AAV21@@Z@Z */
4544 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@DU?$char_traits@D@std@@@1@AEAV21@@Z@Z */
4545 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_func_basic_ios, 8)
4546 basic_ostream_char* __thiscall basic_ostream_char_print_func_basic_ios(basic_ostream_char *this,
4547 basic_ios_char* (__cdecl *pfunc)(basic_ios_char*))
4549 TRACE("(%p %p)\n", this, pfunc);
4550 pfunc(basic_ostream_char_get_basic_ios(this));
4551 return this;
4554 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
4555 /* ??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
4556 DEFINE_THISCALL_WRAPPER(basic_ostream_char_print_func_ios_base, 8)
4557 basic_ostream_char* __thiscall basic_ostream_char_print_func_ios_base(
4558 basic_ostream_char *this, ios_base* (__cdecl *pfunc)(ios_base*))
4560 TRACE("(%p %p)\n", this, pfunc);
4561 pfunc(&basic_ostream_char_get_basic_ios(this)->base);
4562 return this;
4565 /* Caution: basic_ostream uses virtual inheritance. */
4566 static inline basic_ios_wchar* basic_ostream_wchar_get_basic_ios(basic_ostream_wchar *this)
4568 return (basic_ios_wchar*)((char*)this+this->vbtable[1]);
4571 static inline basic_ios_wchar* basic_ostream_wchar_to_basic_ios(basic_ostream_wchar *ptr)
4573 return (basic_ios_wchar*)((char*)ptr+basic_ostream_wchar_vbtable[1]);
4576 static inline basic_ostream_wchar* basic_ostream_wchar_from_basic_ios(basic_ios_wchar *ptr)
4578 return (basic_ostream_wchar*)((char*)ptr-basic_ostream_wchar_vbtable[1]);
4581 /* ??0?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAE@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N@Z */
4582 /* ??0?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N@Z */
4583 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_ctor, 16)
4584 basic_ostream_wchar* __thiscall basic_ostream_wchar_ctor(basic_ostream_wchar *this,
4585 basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
4587 basic_ios_wchar *base;
4589 TRACE("(%p %p %d %d)\n", this, strbuf, isstd, virt_init);
4591 if(virt_init) {
4592 this->vbtable = basic_ostream_wchar_vbtable;
4593 base = basic_ostream_wchar_get_basic_ios(this);
4594 basic_ios_wchar_ctor(base);
4595 }else {
4596 base = basic_ostream_wchar_get_basic_ios(this);
4599 base->base.vtable = &MSVCP_basic_ostream_wchar_vtable;
4600 basic_ios_wchar_init(base, strbuf, isstd);
4601 return this;
4604 /* ??0?$basic_ostream@GU?$char_traits@G@std@@@std@@QAE@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N@Z */
4605 /* ??0?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAA@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N@Z */
4606 DEFINE_THISCALL_WRAPPER(basic_ostream_short_ctor, 16)
4607 basic_ostream_wchar* __thiscall basic_ostream_short_ctor(basic_ostream_wchar *this,
4608 basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
4610 basic_ostream_wchar_ctor(this, strbuf, isstd, virt_init);
4611 basic_ostream_wchar_get_basic_ios(this)->base.vtable = &MSVCP_basic_ostream_short_vtable;
4612 return this;
4615 /* ??0?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAE@W4_Uninitialized@1@_N@Z */
4616 /* ??0?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAA@W4_Uninitialized@1@_N@Z */
4617 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_ctor_uninitialized, 16)
4618 basic_ostream_wchar* __thiscall basic_ostream_wchar_ctor_uninitialized(basic_ostream_wchar *this,
4619 int uninitialized, MSVCP_bool addstd, MSVCP_bool virt_init)
4621 basic_ios_wchar *base;
4623 TRACE("(%p %d %x)\n", this, uninitialized, addstd);
4625 if(virt_init) {
4626 this->vbtable = basic_ostream_wchar_vbtable;
4627 base = basic_ostream_wchar_get_basic_ios(this);
4628 basic_ios_wchar_ctor(base);
4629 }else {
4630 base = basic_ostream_wchar_get_basic_ios(this);
4633 base->base.vtable = &MSVCP_basic_ostream_wchar_vtable;
4634 if(addstd)
4635 ios_base_Addstd(&base->base);
4636 return this;
4639 /* ??0?$basic_ostream@GU?$char_traits@G@std@@@std@@QAE@W4_Uninitialized@1@_N@Z */
4640 /* ??0?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAA@W4_Uninitialized@1@_N@Z */
4641 DEFINE_THISCALL_WRAPPER(basic_ostream_short_ctor_uninitialized, 16)
4642 basic_ostream_wchar* __thiscall basic_ostream_short_ctor_uninitialized(basic_ostream_wchar *this,
4643 int uninitialized, MSVCP_bool addstd, MSVCP_bool virt_init)
4645 basic_ostream_wchar_ctor_uninitialized(this, uninitialized, addstd, virt_init);
4646 basic_ostream_wchar_get_basic_ios(this)->base.vtable = &MSVCP_basic_ostream_short_vtable;
4647 return this;
4650 /* ??1?$basic_ostream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
4651 /* ??1?$basic_ostream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
4652 /* ??1?$basic_ostream@GU?$char_traits@G@std@@@std@@UAE@XZ */
4653 /* ??1?$basic_ostream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
4654 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_dtor, 4)
4655 void __thiscall basic_ostream_wchar_dtor(basic_ios_wchar *base)
4657 basic_ostream_wchar *this = basic_ostream_wchar_from_basic_ios(base);
4659 /* don't destroy virtual base here */
4660 TRACE("(%p)\n", this);
4663 /* ??_D?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
4664 /* ??_D?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
4665 /* ??_D?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEXXZ */
4666 /* ??_D?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
4667 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_vbase_dtor, 4)
4668 void __thiscall basic_ostream_wchar_vbase_dtor(basic_ostream_wchar *this)
4670 TRACE("(%p)\n", this);
4671 basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(this));
4672 basic_ios_wchar_dtor(basic_ostream_wchar_get_basic_ios(this));
4675 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_vector_dtor, 8)
4676 basic_ostream_wchar* __thiscall basic_ostream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
4678 basic_ostream_wchar *this = basic_ostream_wchar_from_basic_ios(base);
4680 TRACE("(%p %x)\n", this, flags);
4682 if(flags & 2) {
4683 /* we have an array, with the number of elements stored before the first object */
4684 INT_PTR i, *ptr = (INT_PTR *)this-1;
4686 for(i=*ptr-1; i>=0; i--)
4687 basic_ostream_wchar_vbase_dtor(this+i);
4688 MSVCRT_operator_delete(ptr);
4689 } else {
4690 basic_ostream_wchar_vbase_dtor(this);
4691 if(flags & 1)
4692 MSVCRT_operator_delete(this);
4695 return this;
4698 /* ?flush@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@XZ */
4699 /* ?flush@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@XZ */
4700 /* ?flush@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV12@XZ */
4701 /* ?flush@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@XZ */
4702 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_flush, 4)
4703 basic_ostream_wchar* __thiscall basic_ostream_wchar_flush(basic_ostream_wchar *this)
4705 /* this function is not matching C++ specification */
4706 basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
4708 TRACE("(%p)\n", this);
4710 if(basic_ios_wchar_rdbuf_get(base) && ios_base_good(&base->base)
4711 && basic_streambuf_wchar_pubsync(basic_ios_wchar_rdbuf_get(base))==-1)
4712 basic_ios_wchar_setstate(base, IOSTATE_badbit);
4713 return this;
4716 /* ?flush@std@@YAAAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@AAV21@@Z */
4717 /* ?flush@std@@YAAEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@AEAV21@@Z */
4718 /* ?flush@std@@YAAAV?$basic_ostream@GU?$char_traits@G@std@@@1@AAV21@@Z */
4719 /* ?flush@std@@YAAEAV?$basic_ostream@GU?$char_traits@G@std@@@1@AEAV21@@Z */
4720 basic_ostream_wchar* __cdecl flush_ostream_wchar(basic_ostream_wchar *ostream)
4722 return basic_ostream_wchar_flush(ostream);
4725 /* ?_Osfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
4726 /* ?_Osfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
4727 /* ?_Osfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEXXZ */
4728 /* ?_Osfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
4729 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar__Osfx, 4)
4730 void __thiscall basic_ostream_wchar__Osfx(basic_ostream_wchar *this)
4732 basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
4734 TRACE("(%p)\n", this);
4736 if(base->base.fmtfl & FMTFLAG_unitbuf)
4737 basic_ostream_wchar_flush(this);
4740 /* ?osfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
4741 /* ?osfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
4742 /* ?osfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEXXZ */
4743 /* ?osfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
4744 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_osfx, 4)
4745 void __thiscall basic_ostream_wchar_osfx(basic_ostream_wchar *this)
4747 TRACE("(%p)\n", this);
4748 basic_ostream_wchar__Osfx(this);
4751 static BOOL basic_ostream_wchar_sentry_create(basic_ostream_wchar *ostr)
4753 basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(ostr);
4755 if(basic_ios_wchar_rdbuf_get(base))
4756 basic_streambuf_wchar__Lock(base->strbuf);
4758 if(ios_base_good(&base->base) && base->stream)
4759 basic_ostream_wchar_flush(base->stream);
4761 return ios_base_good(&base->base);
4764 static void basic_ostream_wchar_sentry_destroy(basic_ostream_wchar *ostr)
4766 basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(ostr);
4768 if(ios_base_good(&base->base) && !__uncaught_exception())
4769 basic_ostream_wchar_osfx(ostr);
4771 if(basic_ios_wchar_rdbuf_get(base))
4772 basic_streambuf_wchar__Unlock(base->strbuf);
4775 /* ?opfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAE_NXZ */
4776 /* ?opfx@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAA_NXZ */
4777 /* ?opfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAE_NXZ */
4778 /* ?opfx@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAA_NXZ */
4779 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_opfx, 4)
4780 MSVCP_bool __thiscall basic_ostream_wchar_opfx(basic_ostream_wchar *this)
4782 basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
4784 TRACE("(%p)\n", this);
4786 if(ios_base_good(&base->base) && base->stream)
4787 basic_ostream_wchar_flush(base->stream);
4788 return ios_base_good(&base->base);
4791 /* ?put@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@_W@Z */
4792 /* ?put@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@_W@Z */
4793 /* ?put@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV12@G@Z */
4794 /* ?put@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@G@Z */
4795 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_put, 8)
4796 basic_ostream_wchar* __thiscall basic_ostream_wchar_put(basic_ostream_wchar *this, wchar_t ch)
4798 basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
4800 TRACE("(%p %c)\n", this, ch);
4802 if(!basic_ostream_wchar_sentry_create(this)
4803 || basic_streambuf_wchar_sputc(base->strbuf, ch)==WEOF) {
4804 basic_ostream_wchar_sentry_destroy(this);
4805 basic_ios_wchar_setstate(base, IOSTATE_badbit);
4806 return this;
4809 basic_ostream_wchar_sentry_destroy(this);
4810 return this;
4813 /* ?seekp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@JH@Z */
4814 /* ?seekp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@_JH@Z */
4815 /* ?seekp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV12@JH@Z */
4816 /* ?seekp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@_JH@Z */
4817 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_seekp, 16)
4818 basic_ostream_wchar* __thiscall basic_ostream_wchar_seekp(basic_ostream_wchar *this, streamoff off, int way)
4820 basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
4822 TRACE("(%p %s %d)\n", this, wine_dbgstr_longlong(off), way);
4824 if(!ios_base_fail(&base->base)) {
4825 fpos_int seek;
4827 basic_streambuf_wchar_pubseekoff(basic_ios_wchar_rdbuf_get(base),
4828 &seek, off, way, OPENMODE_out);
4829 if(seek.off==-1 && seek.pos==0 && seek.state==0)
4830 basic_ios_wchar_setstate(base, IOSTATE_failbit);
4832 return this;
4835 /* ?seekp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
4836 /* ?seekp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
4837 /* ?seekp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
4838 /* ?seekp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
4839 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_seekp_fpos, 28)
4840 basic_ostream_wchar* __thiscall basic_ostream_wchar_seekp_fpos(basic_ostream_wchar *this, fpos_int pos)
4842 basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
4844 TRACE("(%p %s)\n", this, debugstr_fpos_int(&pos));
4846 if(!ios_base_fail(&base->base)) {
4847 fpos_int seek;
4849 basic_streambuf_wchar_pubseekpos(basic_ios_wchar_rdbuf_get(base),
4850 &seek, pos, OPENMODE_out);
4851 if(seek.off==-1 && seek.pos==0 && seek.state==0)
4852 basic_ios_wchar_setstate(base, IOSTATE_failbit);
4854 return this;
4857 /* ?tellp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@XZ */
4858 /* ?tellp@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
4859 /* ?tellp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@XZ */
4860 /* ?tellp@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
4861 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_tellp, 8)
4862 fpos_int* __thiscall basic_ostream_wchar_tellp(basic_ostream_wchar *this, fpos_int *ret)
4864 basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
4866 TRACE("(%p)\n", this);
4868 if(!ios_base_fail(&base->base)) {
4869 basic_streambuf_wchar_pubseekoff(basic_ios_wchar_rdbuf_get(base),
4870 ret, 0, SEEKDIR_cur, OPENMODE_out);
4871 }else {
4872 ret->off = -1;
4873 ret->pos = 0;
4874 ret->state = 0;
4876 return ret;
4879 /* ?write@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PB_WH@Z */
4880 /* ?write@?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEB_W_J@Z */
4881 /* ?write@?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV12@PBGH@Z */
4882 /* ?write@?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEBG_J@Z */
4883 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_write, 16)
4884 basic_ostream_wchar* __thiscall basic_ostream_wchar_write(basic_ostream_wchar *this, const wchar_t *str, streamsize count)
4886 basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
4888 TRACE("(%p %s %s)\n", this, debugstr_w(str), wine_dbgstr_longlong(count));
4890 if(!basic_ostream_wchar_sentry_create(this)
4891 || basic_streambuf_wchar_sputn(base->strbuf, str, count)!=count) {
4892 basic_ostream_wchar_sentry_destroy(this);
4893 basic_ios_wchar_setstate(base, IOSTATE_badbit);
4894 return this;
4897 basic_ostream_wchar_sentry_destroy(this);
4898 return this;
4901 static basic_ostream_wchar* basic_ostream_print_short(basic_ostream_wchar *this, short val, const num_put *numput)
4903 basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
4904 int state = IOSTATE_goodbit;
4906 TRACE("(%p %d)\n", this, val);
4908 if(basic_ostream_wchar_sentry_create(this)) {
4909 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
4910 ostreambuf_iterator_wchar dest = {0, strbuf};
4912 num_put_wchar_put_long(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base),
4913 (ios_base_flags_get(&base->base) & FMTFLAG_basefield & (FMTFLAG_oct | FMTFLAG_hex))
4914 ? (LONG)((unsigned short)val) : (LONG)val);
4916 basic_ostream_wchar_sentry_destroy(this);
4918 basic_ios_wchar_setstate(base, state);
4919 return this;
4922 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@F@Z */
4923 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@F@Z */
4924 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_short, 8)
4925 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_short(basic_ostream_wchar *this, short val)
4927 return basic_ostream_print_short(this, val, num_put_wchar_use_facet(
4928 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
4931 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@F@Z */
4932 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@F@Z */
4933 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_short, 8)
4934 basic_ostream_wchar* __thiscall basic_ostream_short_print_short(basic_ostream_wchar *this, short val)
4936 return basic_ostream_print_short(this, val, num_put_short_use_facet(
4937 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
4940 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@G@Z */
4941 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@G@Z */
4942 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_ushort, 8)
4943 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_ushort(basic_ostream_wchar *this, unsigned short val)
4945 basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
4946 int state = IOSTATE_goodbit;
4948 TRACE("(%p %u)\n", this, val);
4950 if(basic_ostream_wchar_sentry_create(this)) {
4951 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
4952 const num_put *numput = num_put_wchar_use_facet(strbuf->loc);
4953 ostreambuf_iterator_wchar dest = {0, strbuf};
4955 num_put_wchar_put_ulong(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
4957 basic_ostream_wchar_sentry_destroy(this);
4959 basic_ios_wchar_setstate(base, state);
4960 return this;
4963 static basic_ostream_wchar* basic_ostream_print_int(basic_ostream_wchar *this, int val, const num_put *numput)
4965 basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
4966 int state = IOSTATE_goodbit;
4968 TRACE("(%p %d)\n", this, val);
4970 if(basic_ostream_wchar_sentry_create(this)) {
4971 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
4972 ostreambuf_iterator_wchar dest = {0, strbuf};
4974 num_put_wchar_put_long(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
4976 basic_ostream_wchar_sentry_destroy(this);
4978 basic_ios_wchar_setstate(base, state);
4979 return this;
4982 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@H@Z */
4983 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@H@Z */
4984 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@J@Z */
4985 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@J@Z */
4986 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_int, 8)
4987 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_int(basic_ostream_wchar *this, int val)
4989 return basic_ostream_print_int(this, val, num_put_wchar_use_facet(
4990 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
4993 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@H@Z */
4994 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@H@Z */
4995 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@J@Z */
4996 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@J@Z */
4997 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_int, 8)
4998 basic_ostream_wchar* __thiscall basic_ostream_short_print_int(basic_ostream_wchar *this, int val)
5000 return basic_ostream_print_int(this, val, num_put_short_use_facet(
5001 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
5004 static basic_ostream_wchar* basic_ostream_print_uint(basic_ostream_wchar *this, unsigned int val, const num_put *numput)
5006 basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
5007 int state = IOSTATE_goodbit;
5009 TRACE("(%p %u)\n", this, val);
5011 if(basic_ostream_wchar_sentry_create(this)) {
5012 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
5013 ostreambuf_iterator_wchar dest = {0, strbuf};
5015 num_put_wchar_put_ulong(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
5017 basic_ostream_wchar_sentry_destroy(this);
5019 basic_ios_wchar_setstate(base, state);
5020 return this;
5023 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@I@Z */
5024 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@I@Z */
5025 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@K@Z */
5026 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@K@Z */
5027 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_uint, 8)
5028 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_uint(basic_ostream_wchar *this, unsigned int val)
5030 return basic_ostream_print_uint(this, val, num_put_wchar_use_facet(
5031 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
5034 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@I@Z */
5035 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@I@Z */
5036 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@K@Z */
5037 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@K@Z */
5038 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_uint, 8)
5039 basic_ostream_wchar* __thiscall basic_ostream_short_print_uint(basic_ostream_wchar *this, unsigned int val)
5041 return basic_ostream_print_uint(this, val, num_put_short_use_facet(
5042 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
5045 static basic_ostream_wchar* basic_ostream_print_float(basic_ostream_wchar *this, float val, const num_put *numput)
5047 basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
5048 int state = IOSTATE_goodbit;
5050 TRACE("(%p %f)\n", this, val);
5052 if(basic_ostream_wchar_sentry_create(this)) {
5053 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
5054 ostreambuf_iterator_wchar dest = {0, strbuf};
5056 num_put_wchar_put_double(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
5058 basic_ostream_wchar_sentry_destroy(this);
5060 basic_ios_wchar_setstate(base, state);
5061 return this;
5064 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@M@Z */
5065 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@M@Z */
5066 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_float, 8)
5067 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_float(basic_ostream_wchar *this, float val)
5069 return basic_ostream_print_float(this, val, num_put_wchar_use_facet(
5070 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
5073 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@M@Z */
5074 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@M@Z */
5075 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_float, 8)
5076 basic_ostream_wchar* __thiscall basic_ostream_short_print_float(basic_ostream_wchar *this, float val)
5078 return basic_ostream_print_float(this, val, num_put_short_use_facet(
5079 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
5082 static basic_ostream_wchar* basic_ostream_print_double(basic_ostream_wchar *this, double val, const num_put *numput)
5084 basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
5085 int state = IOSTATE_goodbit;
5087 TRACE("(%p %lf)\n", this, val);
5089 if(basic_ostream_wchar_sentry_create(this)) {
5090 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
5091 ostreambuf_iterator_wchar dest = {0, strbuf};
5093 num_put_wchar_put_double(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
5095 basic_ostream_wchar_sentry_destroy(this);
5097 basic_ios_wchar_setstate(base, state);
5098 return this;
5101 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@N@Z */
5102 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@N@Z */
5103 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_double, 12)
5104 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_double(basic_ostream_wchar *this, double val)
5106 return basic_ostream_print_double(this, val, num_put_wchar_use_facet(
5107 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
5110 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@N@Z */
5111 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@N@Z */
5112 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_double, 12)
5113 basic_ostream_wchar* __thiscall basic_ostream_short_print_double(basic_ostream_wchar *this, double val)
5115 return basic_ostream_print_double(this, val, num_put_short_use_facet(
5116 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
5119 static basic_ostream_wchar* basic_ostream_print_ldouble(basic_ostream_wchar *this, double val, const num_put *numput)
5121 basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
5122 int state = IOSTATE_goodbit;
5124 TRACE("(%p %lf)\n", this, val);
5126 if(basic_ostream_wchar_sentry_create(this)) {
5127 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
5128 ostreambuf_iterator_wchar dest = {0, strbuf};
5130 num_put_wchar_put_ldouble(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
5132 basic_ostream_wchar_sentry_destroy(this);
5134 basic_ios_wchar_setstate(base, state);
5135 return this;
5138 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@O@Z */
5139 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@O@Z */
5140 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_ldouble, 12)
5141 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_ldouble(basic_ostream_wchar *this, double val)
5143 return basic_ostream_print_ldouble(this, val, num_put_wchar_use_facet(
5144 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
5147 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@O@Z */
5148 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@O@Z */
5149 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_ldouble, 12)
5150 basic_ostream_wchar* __thiscall basic_ostream_short_print_ldouble(basic_ostream_wchar *this, double val)
5152 return basic_ostream_print_ldouble(this, val, num_put_short_use_facet(
5153 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
5156 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
5157 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
5158 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
5159 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
5160 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_streambuf, 8)
5161 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_streambuf(basic_ostream_wchar *this, basic_streambuf_wchar *val)
5163 basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
5164 IOSB_iostate state = IOSTATE_badbit;
5165 unsigned short c = '\n';
5167 TRACE("(%p %p)\n", this, val);
5169 if(basic_ostream_wchar_sentry_create(this)) {
5170 for(c = basic_streambuf_wchar_sgetc(val); c!=WEOF;
5171 c = basic_streambuf_wchar_snextc(val)) {
5172 state = IOSTATE_goodbit;
5174 if(basic_streambuf_wchar_sputc(base->strbuf, c) == WEOF) {
5175 state = IOSTATE_badbit;
5176 break;
5179 }else {
5180 state = IOSTATE_badbit;
5182 basic_ostream_wchar_sentry_destroy(this);
5184 ios_base_width_set(&base->base, 0);
5185 basic_ios_wchar_setstate(base, state);
5186 return this;
5189 static basic_ostream_wchar* basic_ostream_print_ptr(basic_ostream_wchar *this, const void *val, const num_put *numput)
5191 basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
5192 int state = IOSTATE_goodbit;
5194 TRACE("(%p %p)\n", this, val);
5196 if(basic_ostream_wchar_sentry_create(this)) {
5197 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
5198 ostreambuf_iterator_wchar dest = {0, strbuf};
5200 num_put_wchar_put_ptr(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
5202 basic_ostream_wchar_sentry_destroy(this);
5204 basic_ios_wchar_setstate(base, state);
5205 return this;
5208 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@PBX@Z */
5209 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@PEBX@Z */
5210 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_ptr, 8)
5211 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_ptr(basic_ostream_wchar *this, const void *val)
5213 return basic_ostream_print_ptr(this, val, num_put_wchar_use_facet(
5214 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
5217 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@PBX@Z */
5218 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@PEBX@Z */
5219 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_ptr, 8)
5220 basic_ostream_wchar* __thiscall basic_ostream_short_print_ptr(basic_ostream_wchar *this, const void *val)
5222 return basic_ostream_print_ptr(this, val, num_put_short_use_facet(
5223 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
5226 static basic_ostream_wchar* basic_ostream_print_int64(basic_ostream_wchar *this, __int64 val, const num_put *numput)
5228 basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
5229 int state = IOSTATE_goodbit;
5231 TRACE("(%p)\n", this);
5233 if(basic_ostream_wchar_sentry_create(this)) {
5234 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
5235 ostreambuf_iterator_wchar dest = {0, strbuf};
5237 num_put_wchar_put_int64(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
5239 basic_ostream_wchar_sentry_destroy(this);
5241 basic_ios_wchar_setstate(base, state);
5242 return this;
5245 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@_J@Z */
5246 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@_J@Z */
5247 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_int64, 12)
5248 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_int64(basic_ostream_wchar *this, __int64 val)
5250 return basic_ostream_print_int64(this, val, num_put_wchar_use_facet(
5251 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
5254 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@_J@Z */
5255 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@_J@Z */
5256 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_int64, 12)
5257 basic_ostream_wchar* __thiscall basic_ostream_short_print_int64(basic_ostream_wchar *this, __int64 val)
5259 return basic_ostream_print_int64(this, val, num_put_short_use_facet(
5260 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
5263 static basic_ostream_wchar* basic_ostream_print_uint64(basic_ostream_wchar *this, unsigned __int64 val, const num_put *numput)
5265 basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
5266 int state = IOSTATE_goodbit;
5268 TRACE("(%p)\n", this);
5270 if(basic_ostream_wchar_sentry_create(this)) {
5271 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
5272 ostreambuf_iterator_wchar dest = {0, strbuf};
5274 num_put_wchar_put_uint64(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
5276 basic_ostream_wchar_sentry_destroy(this);
5278 basic_ios_wchar_setstate(base, state);
5279 return this;
5282 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@_K@Z */
5283 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@_K@Z */
5284 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_uint64, 12)
5285 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_uint64(basic_ostream_wchar *this, unsigned __int64 val)
5287 return basic_ostream_print_uint64(this, val, num_put_wchar_use_facet(
5288 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
5291 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@_K@Z */
5292 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@_K@Z */
5293 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_uint64, 12)
5294 basic_ostream_wchar* __thiscall basic_ostream_short_print_uint64(basic_ostream_wchar *this, unsigned __int64 val)
5296 return basic_ostream_print_uint64(this, val, num_put_short_use_facet(
5297 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
5300 static basic_ostream_wchar* basic_ostream_print_bool(basic_ostream_wchar *this, MSVCP_bool val, const num_put *numput)
5302 basic_ios_wchar *base = basic_ostream_wchar_get_basic_ios(this);
5303 int state = IOSTATE_goodbit;
5305 TRACE("(%p %x)\n", this, val);
5307 if(basic_ostream_wchar_sentry_create(this)) {
5308 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
5309 ostreambuf_iterator_wchar dest = {0, strbuf};
5311 num_put_wchar_put_bool(numput, &dest, dest, &base->base, basic_ios_wchar_fill_get(base), val);
5313 basic_ostream_wchar_sentry_destroy(this);
5315 basic_ios_wchar_setstate(base, state);
5316 return this;
5319 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@_N@Z */
5320 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@_N@Z */
5321 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_bool, 8)
5322 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_bool(basic_ostream_wchar *this, MSVCP_bool val)
5324 return basic_ostream_print_bool(this, val, num_put_wchar_use_facet(
5325 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
5328 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@_N@Z */
5329 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@_N@Z */
5330 DEFINE_THISCALL_WRAPPER(basic_ostream_short_print_bool, 8)
5331 basic_ostream_wchar* __thiscall basic_ostream_short_print_bool(basic_ostream_wchar *this, MSVCP_bool val)
5333 return basic_ostream_print_bool(this, val, num_put_short_use_facet(
5334 basic_ios_wchar_rdbuf_get(basic_ostream_wchar_get_basic_ios(this))->loc));
5337 /* ?ends@std@@YAAAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@AAV21@@Z */
5338 /* ?ends@std@@YAAEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@AEAV21@@Z */
5339 /* ?ends@std@@YAAAV?$basic_ostream@GU?$char_traits@G@std@@@1@AAV21@@Z */
5340 /* ?ends@std@@YAAEAV?$basic_ostream@GU?$char_traits@G@std@@@1@AEAV21@@Z */
5341 basic_ostream_wchar* __cdecl basic_ostream_wchar_ends(basic_ostream_wchar *ostr)
5343 TRACE("(%p)\n", ostr);
5345 basic_ostream_wchar_put(ostr, 0);
5346 return ostr;
5349 /* ?endl@std@@YAAAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@AAV21@@Z */
5350 /* ?endl@std@@YAAEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@AEAV21@@Z */
5351 /* ?endl@std@@YAAAV?$basic_ostream@GU?$char_traits@G@std@@@1@AAV21@@Z */
5352 /* ?endl@std@@YAAEAV?$basic_ostream@GU?$char_traits@G@std@@@1@AEAV21@@Z */
5353 basic_ostream_wchar* __cdecl basic_ostream_wchar_endl(basic_ostream_wchar *ostr)
5355 TRACE("(%p)\n", ostr);
5357 basic_ostream_wchar_put(ostr, '\n');
5358 basic_ostream_wchar_flush(ostr);
5359 return ostr;
5362 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
5363 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
5364 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
5365 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
5366 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_func, 8)
5367 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_func(basic_ostream_wchar *this,
5368 basic_ostream_wchar* (__cdecl *pfunc)(basic_ostream_wchar*))
5370 TRACE("(%p %p)\n", this, pfunc);
5371 pfunc(this);
5372 return this;
5375 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@_WU?$char_traits@_W@std@@@1@AAV21@@Z@Z */
5376 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@_WU?$char_traits@_W@std@@@1@AEAV21@@Z@Z */
5377 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@GU?$char_traits@G@std@@@1@AAV21@@Z@Z */
5378 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@GU?$char_traits@G@std@@@1@AEAV21@@Z@Z */
5379 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_func_basic_ios, 8)
5380 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_func_basic_ios(basic_ostream_wchar *this,
5381 basic_ios_wchar* (__cdecl *pfunc)(basic_ios_wchar*))
5383 TRACE("(%p %p)\n", this, pfunc);
5384 pfunc(basic_ostream_wchar_get_basic_ios(this));
5385 return this;
5388 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
5389 /* ??6?$basic_ostream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
5390 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
5391 /* ??6?$basic_ostream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
5392 DEFINE_THISCALL_WRAPPER(basic_ostream_wchar_print_func_ios_base, 8)
5393 basic_ostream_wchar* __thiscall basic_ostream_wchar_print_func_ios_base(
5394 basic_ostream_wchar *this, ios_base* (__cdecl *pfunc)(ios_base*))
5396 TRACE("(%p %p)\n", this, pfunc);
5397 pfunc(&basic_ostream_wchar_get_basic_ios(this)->base);
5398 return this;
5401 /* Caution: basic_istream uses virtual inheritance. */
5402 static inline basic_ios_char* basic_istream_char_get_basic_ios(basic_istream_char *this)
5404 return (basic_ios_char*)((char*)this+this->vbtable[1]);
5407 static inline basic_ios_char* basic_istream_char_to_basic_ios(basic_istream_char *ptr)
5409 return (basic_ios_char*)((char*)ptr+basic_istream_char_vbtable[1]);
5412 static inline basic_istream_char* basic_istream_char_from_basic_ios(basic_ios_char *ptr)
5414 return (basic_istream_char*)((char*)ptr-basic_istream_char_vbtable[1]);
5417 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N1@Z */
5418 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N1@Z */
5419 DEFINE_THISCALL_WRAPPER(basic_istream_char_ctor_init, 20)
5420 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)
5422 basic_ios_char *base;
5424 TRACE("(%p %p %d %d %d)\n", this, strbuf, isstd, noinit, virt_init);
5426 if(virt_init) {
5427 this->vbtable = basic_istream_char_vbtable;
5428 base = basic_istream_char_get_basic_ios(this);
5429 basic_ios_char_ctor(base);
5430 }else {
5431 base = basic_istream_char_get_basic_ios(this);
5434 base->base.vtable = &MSVCP_basic_istream_char_vtable;
5435 this->count = 0;
5436 if(!noinit)
5437 basic_ios_char_init(base, strbuf, isstd);
5438 return this;
5441 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z */
5442 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@_N@Z */
5443 DEFINE_THISCALL_WRAPPER(basic_istream_char_ctor, 16)
5444 basic_istream_char* __thiscall basic_istream_char_ctor(basic_istream_char *this, basic_streambuf_char *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
5446 return basic_istream_char_ctor_init(this, strbuf, isstd, FALSE, virt_init);
5449 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QAE@W4_Uninitialized@1@@Z */
5450 /* ??0?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
5451 DEFINE_THISCALL_WRAPPER(basic_istream_char_ctor_uninitialized, 12)
5452 basic_istream_char* __thiscall basic_istream_char_ctor_uninitialized(basic_istream_char *this, int uninitialized, MSVCP_bool virt_init)
5454 basic_ios_char *base;
5456 TRACE("(%p %d %d)\n", this, uninitialized, virt_init);
5458 if(virt_init) {
5459 this->vbtable = basic_istream_char_vbtable;
5460 base = basic_istream_char_get_basic_ios(this);
5461 basic_ios_char_ctor(base);
5462 }else {
5463 base = basic_istream_char_get_basic_ios(this);
5466 base->base.vtable = &MSVCP_basic_istream_char_vtable;
5467 ios_base_Addstd(&base->base);
5468 return this;
5471 /* ??1?$basic_istream@DU?$char_traits@D@std@@@std@@UAE@XZ */
5472 /* ??1?$basic_istream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
5473 DEFINE_THISCALL_WRAPPER(basic_istream_char_dtor, 4)
5474 void __thiscall basic_istream_char_dtor(basic_ios_char *base)
5476 basic_istream_char *this = basic_istream_char_from_basic_ios(base);
5478 /* don't destroy virtual base here */
5479 TRACE("(%p)\n", this);
5482 /* ??_D?$basic_istream@DU?$char_traits@D@std@@@std@@QAEXXZ */
5483 /* ??_D?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
5484 DEFINE_THISCALL_WRAPPER(basic_istream_char_vbase_dtor, 4)
5485 void __thiscall basic_istream_char_vbase_dtor(basic_istream_char *this)
5487 TRACE("(%p)\n", this);
5488 basic_istream_char_dtor(basic_istream_char_to_basic_ios(this));
5489 basic_ios_char_dtor(basic_istream_char_get_basic_ios(this));
5492 DEFINE_THISCALL_WRAPPER(basic_istream_char_vector_dtor, 8)
5493 basic_istream_char* __thiscall basic_istream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
5495 basic_istream_char *this = basic_istream_char_from_basic_ios(base);
5497 TRACE("(%p %x)\n", this, flags);
5499 if(flags & 2) {
5500 /* we have an array, with the number of elements stored before the first object */
5501 INT_PTR i, *ptr = (INT_PTR *)this-1;
5503 for(i=*ptr-1; i>=0; i--)
5504 basic_istream_char_vbase_dtor(this+i);
5505 MSVCRT_operator_delete(ptr);
5506 } else {
5507 basic_istream_char_vbase_dtor(this);
5508 if(flags & 1)
5509 MSVCRT_operator_delete(this);
5512 return this;
5515 /* ?_Ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QAE_N_N@Z */
5516 /* ?_Ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA_N_N@Z */
5517 DEFINE_THISCALL_WRAPPER(basic_istream_char__Ipfx, 8)
5518 MSVCP_bool __thiscall basic_istream_char__Ipfx(basic_istream_char *this, MSVCP_bool noskip)
5520 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
5522 TRACE("(%p %d)\n", this, noskip);
5524 if(ios_base_good(&base->base)) {
5525 if(basic_ios_char_tie_get(base))
5526 basic_ostream_char_flush(basic_ios_char_tie_get(base));
5528 if(!noskip && (ios_base_flags_get(&base->base) & FMTFLAG_skipws)) {
5529 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5530 const ctype_char *ctype = ctype_char_use_facet(base->strbuf->loc);
5531 int ch;
5533 for(ch = basic_streambuf_char_sgetc(strbuf); ;
5534 ch = basic_streambuf_char_snextc(strbuf)) {
5535 if(ch == EOF) {
5536 basic_ios_char_setstate(base, IOSTATE_eofbit);
5537 break;
5540 if(!ctype_char_is_ch(ctype, _SPACE|_BLANK, ch))
5541 break;
5546 if(!ios_base_good(&base->base)) {
5547 basic_ios_char_setstate(base, IOSTATE_failbit);
5548 return FALSE;
5551 return TRUE;
5554 /* ?ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QAE_N_N@Z */
5555 /* ?ipfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA_N_N@Z */
5556 DEFINE_THISCALL_WRAPPER(basic_istream_char_ipfx, 8)
5557 MSVCP_bool __thiscall basic_istream_char_ipfx(basic_istream_char *this, MSVCP_bool noskip)
5559 return basic_istream_char__Ipfx(this, noskip);
5562 /* ?isfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEXXZ */
5563 /* ?isfx@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
5564 DEFINE_THISCALL_WRAPPER(basic_istream_char_isfx, 4)
5565 void __thiscall basic_istream_char_isfx(basic_istream_char *this)
5567 TRACE("(%p)\n", this);
5570 static BOOL basic_istream_char_sentry_create(basic_istream_char *istr, MSVCP_bool noskip)
5572 basic_ios_char *base = basic_istream_char_get_basic_ios(istr);
5574 if(basic_ios_char_rdbuf_get(base))
5575 call_basic_streambuf_char__Lock(base->strbuf);
5577 return basic_istream_char_ipfx(istr, noskip);
5580 static void basic_istream_char_sentry_destroy(basic_istream_char *istr)
5582 basic_ios_char *base = basic_istream_char_get_basic_ios(istr);
5584 if(basic_ios_char_rdbuf_get(base))
5585 call_basic_streambuf_char__Unlock(base->strbuf);
5588 /* ?gcount@?$basic_istream@DU?$char_traits@D@std@@@std@@QBEHXZ */
5589 /* ?gcount@?$basic_istream@DU?$char_traits@D@std@@@std@@QEBA_JXZ */
5590 DEFINE_THISCALL_WRAPPER(basic_istream_char_gcount, 4)
5591 int __thiscall basic_istream_char_gcount(const basic_istream_char *this)
5593 TRACE("(%p)\n", this);
5594 return this->count;
5597 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHXZ */
5598 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAHXZ */
5599 DEFINE_THISCALL_WRAPPER(basic_istream_char_get, 4)
5600 int __thiscall basic_istream_char_get(basic_istream_char *this)
5602 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
5603 int ret;
5605 TRACE("(%p)\n", this);
5607 this->count = 0;
5609 if(!basic_istream_char_sentry_create(this, TRUE)) {
5610 basic_istream_char_sentry_destroy(this);
5611 return EOF;
5614 ret = basic_streambuf_char_sbumpc(basic_ios_char_rdbuf_get(base));
5615 basic_istream_char_sentry_destroy(this);
5616 if(ret == EOF)
5617 basic_ios_char_setstate(base, IOSTATE_eofbit|IOSTATE_failbit);
5618 else
5619 this->count++;
5621 return ret;
5624 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@AAD@Z */
5625 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@AEAD@Z */
5626 DEFINE_THISCALL_WRAPPER(basic_istream_char_get_ch, 8)
5627 basic_istream_char* __thiscall basic_istream_char_get_ch(basic_istream_char *this, char *ch)
5629 int ret;
5631 TRACE("(%p %p)\n", this, ch);
5633 ret = basic_istream_char_get(this);
5634 if(ret != EOF)
5635 *ch = (char)ret;
5636 return this;
5639 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADHD@Z */
5640 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_JD@Z */
5641 DEFINE_THISCALL_WRAPPER(basic_istream_char_get_str_delim, 20)
5642 basic_istream_char* __thiscall basic_istream_char_get_str_delim(basic_istream_char *this, char *str, streamsize count, char delim)
5644 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
5645 int ch = delim;
5647 TRACE("(%p %p %s %c)\n", this, str, wine_dbgstr_longlong(count), delim);
5649 this->count = 0;
5651 if(basic_istream_char_sentry_create(this, TRUE)) {
5652 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5654 for(ch = basic_streambuf_char_sgetc(strbuf); count>1;
5655 ch = basic_streambuf_char_snextc(strbuf)) {
5656 if(ch==EOF || ch==delim)
5657 break;
5659 *str++ = ch;
5660 this->count++;
5661 count--;
5664 basic_istream_char_sentry_destroy(this);
5666 basic_ios_char_setstate(base, (!this->count ? IOSTATE_failbit : IOSTATE_goodbit) |
5667 (ch==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
5668 if(count > 0)
5669 *str = 0;
5670 return this;
5673 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADH@Z */
5674 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_J@Z */
5675 DEFINE_THISCALL_WRAPPER(basic_istream_char_get_str, 16)
5676 basic_istream_char* __thiscall basic_istream_char_get_str(basic_istream_char *this, char *str, streamsize count)
5678 return basic_istream_char_get_str_delim(this, str, count, '\n');
5681 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@AAV?$basic_streambuf@DU?$char_traits@D@std@@@2@D@Z */
5682 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@D@Z */
5683 DEFINE_THISCALL_WRAPPER(basic_istream_char_get_streambuf_delim, 12)
5684 basic_istream_char* __thiscall basic_istream_char_get_streambuf_delim(basic_istream_char *this, basic_streambuf_char *strbuf, char delim)
5686 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
5687 int ch = delim;
5689 TRACE("(%p %p %c)\n", this, strbuf, delim);
5691 this->count = 0;
5693 if(basic_istream_char_sentry_create(this, TRUE)) {
5694 basic_streambuf_char *strbuf_read = basic_ios_char_rdbuf_get(base);
5696 for(ch = basic_streambuf_char_sgetc(strbuf_read); ;
5697 ch = basic_streambuf_char_snextc(strbuf_read)) {
5698 if(ch==EOF || ch==delim)
5699 break;
5701 if(basic_streambuf_char_sputc(strbuf, ch) == EOF)
5702 break;
5703 this->count++;
5706 basic_istream_char_sentry_destroy(this);
5708 basic_ios_char_setstate(base, (!this->count ? IOSTATE_failbit : IOSTATE_goodbit) |
5709 (ch==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
5710 return this;
5713 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@AAV?$basic_streambuf@DU?$char_traits@D@std@@@2@@Z */
5714 /* ?get@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@DU?$char_traits@D@std@@@2@@Z */
5715 DEFINE_THISCALL_WRAPPER(basic_istream_char_get_streambuf, 8)
5716 basic_istream_char* __thiscall basic_istream_char_get_streambuf(basic_istream_char *this, basic_streambuf_char *strbuf)
5718 return basic_istream_char_get_streambuf_delim(this, strbuf, '\n');
5721 /* ?getline@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADHD@Z */
5722 /* ?getline@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_JD@Z */
5723 DEFINE_THISCALL_WRAPPER(basic_istream_char_getline_delim, 20)
5724 basic_istream_char* __thiscall basic_istream_char_getline_delim(basic_istream_char *this, char *str, streamsize count, char delim)
5726 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
5727 int ch = (unsigned char)delim;
5729 TRACE("(%p %p %s %c)\n", this, str, wine_dbgstr_longlong(count), delim);
5731 this->count = 0;
5733 if(basic_istream_char_sentry_create(this, TRUE) && count>0) {
5734 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5736 while(count > 1) {
5737 ch = basic_streambuf_char_sbumpc(strbuf);
5739 if(ch==EOF || ch==(unsigned char)delim)
5740 break;
5742 *str++ = ch;
5743 this->count++;
5744 count--;
5747 if(ch == (unsigned char)delim)
5748 this->count++;
5749 else if(ch != EOF) {
5750 ch = basic_streambuf_char_sgetc(strbuf);
5752 if(ch == (unsigned char)delim) {
5753 basic_streambuf_char__Gninc(strbuf);
5754 this->count++;
5758 basic_istream_char_sentry_destroy(this);
5760 basic_ios_char_setstate(base, (ch==EOF ? IOSTATE_eofbit : IOSTATE_goodbit) |
5761 (!this->count || (ch!=(unsigned char)delim && ch!=EOF) ? IOSTATE_failbit : IOSTATE_goodbit));
5762 if(count > 0)
5763 *str = 0;
5764 return this;
5767 /* ?getline@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADH@Z */
5768 /* ?getline@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_J@Z */
5769 DEFINE_THISCALL_WRAPPER(basic_istream_char_getline, 16)
5770 basic_istream_char* __thiscall basic_istream_char_getline(basic_istream_char *this, char *str, streamsize count)
5772 return basic_istream_char_getline_delim(this, str, count, '\n');
5775 /* ?ignore@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@HH@Z */
5776 /* ?ignore@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@_JH@Z */
5777 DEFINE_THISCALL_WRAPPER(basic_istream_char_ignore, 16)
5778 basic_istream_char* __thiscall basic_istream_char_ignore(basic_istream_char *this, streamsize count, int delim)
5780 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
5781 int ch = (unsigned char)delim;
5782 unsigned int state;
5784 TRACE("(%p %s %d)\n", this, wine_dbgstr_longlong(count), delim);
5786 this->count = 0;
5788 if(basic_istream_char_sentry_create(this, TRUE)) {
5789 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5790 state = IOSTATE_goodbit;
5792 while(count > 0) {
5793 ch = basic_streambuf_char_sbumpc(strbuf);
5795 if(ch==EOF) {
5796 state = IOSTATE_eofbit;
5797 break;
5800 if(ch==(unsigned char)delim)
5801 break;
5803 this->count++;
5804 if(count != INT_MAX)
5805 count--;
5807 }else
5808 state = IOSTATE_failbit;
5809 basic_istream_char_sentry_destroy(this);
5811 basic_ios_char_setstate(base, state);
5812 return this;
5815 /* ?ws@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@1@AAV21@@Z */
5816 /* ?ws@std@@YAAEAV?$basic_istream@DU?$char_traits@D@std@@@1@AEAV21@@Z */
5817 basic_istream_char* __cdecl ws_basic_istream_char(basic_istream_char *istream)
5819 basic_ios_char *base = basic_istream_char_get_basic_ios(istream);
5820 int ch = '\n';
5822 TRACE("(%p)\n", istream);
5824 if(basic_istream_char_sentry_create(istream, TRUE)) {
5825 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5826 const ctype_char *ctype = ctype_char_use_facet(strbuf->loc);
5828 for(ch = basic_streambuf_char_sgetc(strbuf); ctype_char_is_ch(ctype, _SPACE, ch);
5829 ch = basic_streambuf_char_snextc(strbuf)) {
5830 if(ch == EOF)
5831 break;
5834 basic_istream_char_sentry_destroy(istream);
5836 if(ch == EOF)
5837 basic_ios_char_setstate(base, IOSTATE_eofbit);
5838 return istream;
5841 /* ?peek@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHXZ */
5842 /* ?peek@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAHXZ */
5843 DEFINE_THISCALL_WRAPPER(basic_istream_char_peek, 4)
5844 int __thiscall basic_istream_char_peek(basic_istream_char *this)
5846 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
5847 int ret = EOF;
5849 TRACE("(%p)\n", this);
5851 this->count = 0;
5853 if(basic_istream_char_sentry_create(this, TRUE))
5854 ret = basic_streambuf_char_sgetc(basic_ios_char_rdbuf_get(base));
5855 basic_istream_char_sentry_destroy(this);
5857 if (ret == EOF)
5858 basic_ios_char_setstate(base, IOSTATE_eofbit);
5860 return ret;
5863 /* ?_Read_s@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADIH@Z */
5864 /* ?_Read_s@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_K_J@Z */
5865 static basic_istream_char* basic_istream_char__Read_s(basic_istream_char *this, char *str, MSVCP_size_t size, streamsize count)
5867 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
5868 IOSB_iostate state = IOSTATE_goodbit;
5870 TRACE("(%p %p %lu %s)\n", this, str, size, wine_dbgstr_longlong(count));
5872 if(basic_istream_char_sentry_create(this, TRUE)) {
5873 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5875 this->count = basic_streambuf_char__Sgetn_s(strbuf, str, size, count);
5876 if(this->count != count)
5877 state |= IOSTATE_failbit | IOSTATE_eofbit;
5878 }else {
5879 this->count = 0;
5881 basic_istream_char_sentry_destroy(this);
5883 basic_ios_char_setstate(base, state);
5884 return this;
5887 /* ?read@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADH@Z */
5888 /* ?read@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_J@Z */
5889 DEFINE_THISCALL_WRAPPER(basic_istream_char_read, 16)
5890 basic_istream_char* __thiscall basic_istream_char_read(basic_istream_char *this, char *str, streamsize count)
5892 return basic_istream_char__Read_s(this, str, count, count);
5895 /* ?_Readsome_s@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHPADIH@Z */
5896 /* ?_Readsome_s@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA_JPEAD_K_J@Z */
5897 static streamsize basic_istream_char__Readsome_s(basic_istream_char *this, char *str, MSVCP_size_t size, streamsize count)
5899 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
5900 IOSB_iostate state = IOSTATE_goodbit;
5902 TRACE("(%p %p %lu %s)\n", this, str, size, wine_dbgstr_longlong(count));
5904 this->count = 0;
5906 if(basic_istream_char_sentry_create(this, TRUE)) {
5907 streamsize avail = basic_streambuf_char_in_avail(basic_ios_char_rdbuf_get(base));
5908 if(avail > count)
5909 avail = count;
5911 if(avail == -1)
5912 state |= IOSTATE_eofbit;
5913 else if(avail > 0)
5914 basic_istream_char__Read_s(this, str, size, avail);
5915 }else {
5916 state |= IOSTATE_failbit;
5918 basic_istream_char_sentry_destroy(this);
5920 basic_ios_char_setstate(base, state);
5921 return this->count;
5924 /* ?readsome@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHPADH@Z */
5925 /* ?readsome@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA_JPEAD_J@Z */
5926 DEFINE_THISCALL_WRAPPER(basic_istream_char_readsome, 16)
5927 streamsize __thiscall basic_istream_char_readsome(basic_istream_char *this, char *str, streamsize count)
5929 return basic_istream_char__Readsome_s(this, str, count, count);
5932 /* ?putback@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@D@Z */
5933 /* ?putback@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@D@Z */
5934 DEFINE_THISCALL_WRAPPER(basic_istream_char_putback, 8)
5935 basic_istream_char* __thiscall basic_istream_char_putback(basic_istream_char *this, char ch)
5937 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
5938 IOSB_iostate state = IOSTATE_goodbit;
5940 TRACE("(%p %c)\n", this, ch);
5942 this->count = 0;
5944 if(basic_istream_char_sentry_create(this, TRUE)) {
5945 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5947 if(!ios_base_good(&base->base))
5948 state |= IOSTATE_failbit;
5949 else if(!strbuf || basic_streambuf_char_sputbackc(strbuf, ch)==EOF)
5950 state |= IOSTATE_badbit;
5952 basic_istream_char_sentry_destroy(this);
5954 basic_ios_char_setstate(base, state);
5955 return this;
5958 /* ?unget@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@XZ */
5959 /* ?unget@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@XZ */
5960 DEFINE_THISCALL_WRAPPER(basic_istream_char_unget, 4)
5961 basic_istream_char* __thiscall basic_istream_char_unget(basic_istream_char *this)
5963 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
5964 IOSB_iostate state = IOSTATE_goodbit;
5966 TRACE("(%p)\n", this);
5968 this->count = 0;
5970 if(basic_istream_char_sentry_create(this, TRUE)) {
5971 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5973 if(!ios_base_good(&base->base))
5974 state |= IOSTATE_failbit;
5975 else if(!strbuf || basic_streambuf_char_sungetc(strbuf)==EOF)
5976 state |= IOSTATE_badbit;
5978 basic_istream_char_sentry_destroy(this);
5980 basic_ios_char_setstate(base, state);
5981 return this;
5984 /* ?sync@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEHXZ */
5985 /* ?sync@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAHXZ */
5986 DEFINE_THISCALL_WRAPPER(basic_istream_char_sync, 4)
5987 int __thiscall basic_istream_char_sync(basic_istream_char *this)
5989 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
5990 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
5992 TRACE("(%p)\n", this);
5994 if(!strbuf)
5995 return -1;
5997 if(basic_istream_char_sentry_create(this, TRUE)) {
5998 if(basic_streambuf_char_pubsync(strbuf) != -1) {
5999 basic_istream_char_sentry_destroy(this);
6000 return 0;
6003 basic_istream_char_sentry_destroy(this);
6005 basic_ios_char_setstate(base, IOSTATE_badbit);
6006 return -1;
6009 /* ?tellg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAE?AV?$fpos@H@2@XZ */
6010 /* ?tellg@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
6011 DEFINE_THISCALL_WRAPPER(basic_istream_char_tellg, 8)
6012 fpos_int* __thiscall basic_istream_char_tellg(basic_istream_char *this, fpos_int *ret)
6014 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
6016 TRACE("(%p %p)\n", this, ret);
6018 if(ios_base_fail(&base->base)) {
6019 ret->off = -1;
6020 ret->pos = 0;
6021 ret->state = 0;
6022 return ret;
6025 basic_streambuf_char_pubseekoff(basic_ios_char_rdbuf_get(base),
6026 ret, 0, SEEKDIR_cur, OPENMODE_in);
6028 if(ret->off==-1 && ret->pos==0 && ret->state==0)
6029 basic_ios_char_setstate(base, IOSTATE_failbit);
6031 return ret;
6034 /* ?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@JH@Z */
6035 /* ?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@_JH@Z */
6036 DEFINE_THISCALL_WRAPPER(basic_istream_char_seekg, 16)
6037 basic_istream_char* __thiscall basic_istream_char_seekg(basic_istream_char *this, streamoff off, int dir)
6039 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
6041 TRACE("(%p %s %d)\n", this, wine_dbgstr_longlong(off), dir);
6043 if(!ios_base_fail(&base->base)) {
6044 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
6045 fpos_int ret;
6047 basic_streambuf_char_pubseekoff(strbuf, &ret, off, dir, OPENMODE_in);
6049 if(ret.off==-1 && ret.pos==0 && ret.state==0)
6050 basic_ios_char_setstate(base, IOSTATE_failbit);
6051 else
6052 basic_ios_char_clear(base, IOSTATE_goodbit);
6053 return this;
6054 }else
6055 basic_ios_char_clear(base, IOSTATE_goodbit);
6057 return this;
6060 /* ?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
6061 /* ?seekg@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
6062 DEFINE_THISCALL_WRAPPER(basic_istream_char_seekg_fpos, 28)
6063 basic_istream_char* __thiscall basic_istream_char_seekg_fpos(basic_istream_char *this, fpos_int pos)
6065 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
6067 TRACE("(%p %s)\n", this, debugstr_fpos_int(&pos));
6069 if(!ios_base_fail(&base->base)) {
6070 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
6071 fpos_int ret;
6073 basic_streambuf_char_pubseekpos(strbuf, &ret, pos, OPENMODE_in);
6075 if(ret.off==-1 && ret.pos==0 && ret.state==0)
6076 basic_ios_char_setstate(base, IOSTATE_failbit);
6077 else
6078 basic_ios_char_clear(base, IOSTATE_goodbit);
6079 return this;
6080 }else
6081 basic_ios_char_clear(base, IOSTATE_goodbit);
6083 return this;
6086 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAF@Z */
6087 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAF@Z */
6088 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_short, 8)
6089 basic_istream_char* __thiscall basic_istream_char_read_short(basic_istream_char *this, short *v)
6091 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
6092 int state = IOSTATE_goodbit;
6094 TRACE("(%p %p)\n", this, v);
6096 if(basic_istream_char_sentry_create(this, FALSE)) {
6097 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
6098 const num_get *numget = num_get_char_use_facet(strbuf->loc);
6099 istreambuf_iterator_char first={0}, last={0};
6100 LONG tmp;
6102 first.strbuf = strbuf;
6103 num_get_char_get_long(numget, &last, first, last, &base->base, &state, &tmp);
6105 if(!(state&IOSTATE_failbit) && tmp==(LONG)((short)tmp))
6106 *v = tmp;
6107 else
6108 state |= IOSTATE_failbit;
6110 basic_istream_char_sentry_destroy(this);
6112 basic_ios_char_setstate(base, state);
6113 return this;
6116 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAG@Z */
6117 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAG@Z */
6118 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_ushort, 8)
6119 basic_istream_char* __thiscall basic_istream_char_read_ushort(basic_istream_char *this, unsigned short *v)
6121 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
6122 int state = IOSTATE_goodbit;
6124 TRACE("(%p %p)\n", this, v);
6126 if(basic_istream_char_sentry_create(this, FALSE)) {
6127 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
6128 const num_get *numget = num_get_char_use_facet(strbuf->loc);
6129 istreambuf_iterator_char first={0}, last={0};
6131 first.strbuf = strbuf;
6132 num_get_char_get_ushort(numget, &last, first, last, &base->base, &state, v);
6134 basic_istream_char_sentry_destroy(this);
6136 basic_ios_char_setstate(base, state);
6137 return this;
6140 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAH@Z */
6141 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAH@Z */
6142 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_int, 8)
6143 basic_istream_char* __thiscall basic_istream_char_read_int(basic_istream_char *this, int *v)
6145 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
6146 int state = IOSTATE_goodbit;
6148 TRACE("(%p %p)\n", this, v);
6150 if(basic_istream_char_sentry_create(this, FALSE)) {
6151 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
6152 const num_get *numget = num_get_char_use_facet(strbuf->loc);
6153 istreambuf_iterator_char first={0}, last={0};
6155 first.strbuf = strbuf;
6156 num_get_char_get_long(numget, &last, first, last, &base->base, &state, v);
6158 basic_istream_char_sentry_destroy(this);
6160 basic_ios_char_setstate(base, state);
6161 return this;
6164 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAI@Z */
6165 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAI@Z */
6166 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_uint, 8)
6167 basic_istream_char* __thiscall basic_istream_char_read_uint(basic_istream_char *this, unsigned int *v)
6169 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
6170 int state = IOSTATE_goodbit;
6172 TRACE("(%p %p)\n", this, v);
6174 if(basic_istream_char_sentry_create(this, FALSE)) {
6175 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
6176 const num_get *numget = num_get_char_use_facet(strbuf->loc);
6177 istreambuf_iterator_char first={0}, last={0};
6179 first.strbuf = strbuf;
6180 num_get_char_get_uint(numget, &last, first, last, &base->base, &state, v);
6182 basic_istream_char_sentry_destroy(this);
6184 basic_ios_char_setstate(base, state);
6185 return this;
6188 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAJ@Z */
6189 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAJ@Z */
6190 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_long, 8)
6191 basic_istream_char* __thiscall basic_istream_char_read_long(basic_istream_char *this, LONG *v)
6193 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
6194 int state = IOSTATE_goodbit;
6196 TRACE("(%p %p)\n", this, v);
6198 if(basic_istream_char_sentry_create(this, FALSE)) {
6199 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
6200 const num_get *numget = num_get_char_use_facet(strbuf->loc);
6201 istreambuf_iterator_char first={0}, last={0};
6203 first.strbuf = strbuf;
6204 num_get_char_get_long(numget, &last, first, last, &base->base, &state, v);
6206 basic_istream_char_sentry_destroy(this);
6208 basic_ios_char_setstate(base, state);
6209 return this;
6212 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAK@Z */
6213 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAK@Z */
6214 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_ulong, 8)
6215 basic_istream_char* __thiscall basic_istream_char_read_ulong(basic_istream_char *this, ULONG *v)
6217 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
6218 int state = IOSTATE_goodbit;
6220 TRACE("(%p %p)\n", this, v);
6222 if(basic_istream_char_sentry_create(this, FALSE)) {
6223 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
6224 const num_get *numget = num_get_char_use_facet(strbuf->loc);
6225 istreambuf_iterator_char first={0}, last={0};
6227 first.strbuf = strbuf;
6228 num_get_char_get_ulong(numget, &last, first, last, &base->base, &state, v);
6230 basic_istream_char_sentry_destroy(this);
6232 basic_ios_char_setstate(base, state);
6233 return this;
6236 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAM@Z */
6237 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAM@Z */
6238 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_float, 8)
6239 basic_istream_char* __thiscall basic_istream_char_read_float(basic_istream_char *this, float *v)
6241 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
6242 int state = IOSTATE_goodbit;
6244 TRACE("(%p %p)\n", this, v);
6246 if(basic_istream_char_sentry_create(this, FALSE)) {
6247 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
6248 const num_get *numget = num_get_char_use_facet(strbuf->loc);
6249 istreambuf_iterator_char first={0}, last={0};
6251 first.strbuf = strbuf;
6252 num_get_char_get_float(numget, &last, first, last, &base->base, &state, v);
6254 basic_istream_char_sentry_destroy(this);
6256 basic_ios_char_setstate(base, state);
6257 return this;
6260 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAN@Z */
6261 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAN@Z */
6262 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_double, 8)
6263 basic_istream_char* __thiscall basic_istream_char_read_double(basic_istream_char *this, double *v)
6265 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
6266 int state = IOSTATE_goodbit;
6268 TRACE("(%p %p)\n", this, v);
6270 if(basic_istream_char_sentry_create(this, FALSE)) {
6271 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
6272 const num_get *numget = num_get_char_use_facet(strbuf->loc);
6273 istreambuf_iterator_char first={0}, last={0};
6275 first.strbuf = strbuf;
6276 num_get_char_get_double(numget, &last, first, last, &base->base, &state, v);
6278 basic_istream_char_sentry_destroy(this);
6280 basic_ios_char_setstate(base, state);
6281 return this;
6284 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAO@Z */
6285 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAO@Z */
6286 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_ldouble, 8)
6287 basic_istream_char* __thiscall basic_istream_char_read_ldouble(basic_istream_char *this, double *v)
6289 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
6290 int state = IOSTATE_goodbit;
6292 TRACE("(%p %p)\n", this, v);
6294 if(basic_istream_char_sentry_create(this, FALSE)) {
6295 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
6296 const num_get *numget = num_get_char_use_facet(strbuf->loc);
6297 istreambuf_iterator_char first={0}, last={0};
6299 first.strbuf = strbuf;
6300 num_get_char_get_ldouble(numget, &last, first, last, &base->base, &state, v);
6302 basic_istream_char_sentry_destroy(this);
6304 basic_ios_char_setstate(base, state);
6305 return this;
6308 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAPAX@Z */
6309 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEAPEAX@Z */
6310 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_ptr, 8)
6311 basic_istream_char* __thiscall basic_istream_char_read_ptr(basic_istream_char *this, void **v)
6313 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
6314 int state = IOSTATE_goodbit;
6316 TRACE("(%p %p)\n", this, v);
6318 if(basic_istream_char_sentry_create(this, FALSE)) {
6319 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
6320 const num_get *numget = num_get_char_use_facet(strbuf->loc);
6321 istreambuf_iterator_char first={0}, last={0};
6323 first.strbuf = strbuf;
6324 num_get_char_get_void(numget, &last, first, last, &base->base, &state, v);
6326 basic_istream_char_sentry_destroy(this);
6328 basic_ios_char_setstate(base, state);
6329 return this;
6332 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AA_J@Z */
6333 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEA_J@Z */
6334 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_int64, 8)
6335 basic_istream_char* __thiscall basic_istream_char_read_int64(basic_istream_char *this, __int64 *v)
6337 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
6338 int state = IOSTATE_goodbit;
6340 TRACE("(%p %p)\n", this, v);
6342 if(basic_istream_char_sentry_create(this, FALSE)) {
6343 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
6344 const num_get *numget = num_get_char_use_facet(strbuf->loc);
6345 istreambuf_iterator_char first={0}, last={0};
6347 first.strbuf = strbuf;
6348 num_get_char_get_int64(numget, &last, first, last, &base->base, &state, v);
6350 basic_istream_char_sentry_destroy(this);
6352 basic_ios_char_setstate(base, state);
6353 return this;
6356 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AA_K@Z */
6357 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEA_K@Z */
6358 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_uint64, 8)
6359 basic_istream_char* __thiscall basic_istream_char_read_uint64(basic_istream_char *this, unsigned __int64 *v)
6361 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
6362 int state = IOSTATE_goodbit;
6364 TRACE("(%p %p)\n", this, v);
6366 if(basic_istream_char_sentry_create(this, FALSE)) {
6367 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
6368 const num_get *numget = num_get_char_use_facet(strbuf->loc);
6369 istreambuf_iterator_char first={0}, last={0};
6371 first.strbuf = strbuf;
6372 num_get_char_get_uint64(numget, &last, first, last, &base->base, &state, v);
6374 basic_istream_char_sentry_destroy(this);
6376 basic_ios_char_setstate(base, state);
6377 return this;
6380 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AA_N@Z */
6381 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@AEA_N@Z */
6382 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_bool, 8)
6383 basic_istream_char* __thiscall basic_istream_char_read_bool(basic_istream_char *this, MSVCP_bool *v)
6385 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
6386 int state = IOSTATE_goodbit;
6388 TRACE("(%p %p)\n", this, v);
6390 if(basic_istream_char_sentry_create(this, FALSE)) {
6391 basic_streambuf_char *strbuf = basic_ios_char_rdbuf_get(base);
6392 const num_get *numget = num_get_char_use_facet(strbuf->loc);
6393 istreambuf_iterator_char first={0}, last={0};
6395 first.strbuf = strbuf;
6396 num_get_char_get_bool(numget, &last, first, last, &base->base, &state, v);
6398 basic_istream_char_sentry_destroy(this);
6400 basic_ios_char_setstate(base, state);
6401 return this;
6404 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
6405 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
6406 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_streambuf, 8)
6407 basic_istream_char* __thiscall basic_istream_char_read_streambuf(
6408 basic_istream_char *this, basic_streambuf_char *streambuf)
6410 basic_ios_char *base = basic_istream_char_get_basic_ios(this);
6411 IOSB_iostate state = IOSTATE_failbit;
6412 int c = '\n';
6414 TRACE("(%p %p)\n", this, streambuf);
6416 if(basic_istream_char_sentry_create(this, FALSE)) {
6417 for(c = basic_streambuf_char_sgetc(basic_ios_char_rdbuf_get(base)); c!=EOF;
6418 c = basic_streambuf_char_snextc(basic_ios_char_rdbuf_get(base))) {
6419 state = IOSTATE_goodbit;
6420 if(basic_streambuf_char_sputc(streambuf, c) == EOF)
6421 break;
6424 basic_istream_char_sentry_destroy(this);
6426 basic_ios_char_setstate(base, state | (c==EOF ? IOSTATE_eofbit : IOSTATE_goodbit));
6427 return this;
6430 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
6431 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
6432 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_func, 8)
6433 basic_istream_char* __thiscall basic_istream_char_read_func(basic_istream_char *this,
6434 basic_istream_char* (__cdecl *pfunc)(basic_istream_char*))
6436 TRACE("(%p %p)\n", this, pfunc);
6437 pfunc(this);
6438 return this;
6441 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@DU?$char_traits@D@std@@@1@AAV21@@Z@Z */
6442 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@DU?$char_traits@D@std@@@1@AEAV21@@Z@Z */
6443 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_func_basic_ios, 8)
6444 basic_istream_char* __thiscall basic_istream_char_read_func_basic_ios(basic_istream_char *this,
6445 basic_ios_char* (__cdecl *pfunc)(basic_ios_char*))
6447 TRACE("(%p %p)\n", this, pfunc);
6448 pfunc(basic_istream_char_get_basic_ios(this));
6449 return this;
6452 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
6453 /* ??5?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
6454 DEFINE_THISCALL_WRAPPER(basic_istream_char_read_func_ios_base, 8)
6455 basic_istream_char* __thiscall basic_istream_char_read_func_ios_base(basic_istream_char *this,
6456 ios_base* (__cdecl *pfunc)(ios_base*))
6458 TRACE("(%p %p)\n", this, pfunc);
6459 pfunc(&basic_istream_char_get_basic_ios(this)->base);
6460 return this;
6463 /* Caution: basic_istream uses virtual inheritance. */
6464 static inline basic_ios_wchar* basic_istream_wchar_get_basic_ios(basic_istream_wchar *this)
6466 return (basic_ios_wchar*)((char*)this+this->vbtable[1]);
6469 static inline basic_ios_wchar* basic_istream_wchar_to_basic_ios(basic_istream_wchar *ptr)
6471 return (basic_ios_wchar*)((char*)ptr+basic_istream_wchar_vbtable[1]);
6474 static inline basic_istream_wchar* basic_istream_wchar_from_basic_ios(basic_ios_wchar *ptr)
6476 return (basic_istream_wchar*)((char*)ptr-basic_istream_wchar_vbtable[1]);
6479 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N1@Z */
6480 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N1@Z */
6481 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_ctor_init, 20)
6482 basic_istream_wchar* __thiscall basic_istream_wchar_ctor_init(basic_istream_wchar *this,
6483 basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool noinit, MSVCP_bool virt_init)
6485 basic_ios_wchar *base;
6487 TRACE("(%p %p %d %d %d)\n", this, strbuf, isstd, noinit, virt_init);
6489 if(virt_init) {
6490 this->vbtable = basic_istream_wchar_vbtable;
6491 base = basic_istream_wchar_get_basic_ios(this);
6492 basic_ios_wchar_ctor(base);
6493 }else {
6494 base = basic_istream_wchar_get_basic_ios(this);
6497 base->base.vtable = &MSVCP_basic_istream_wchar_vtable;
6498 this->count = 0;
6499 if(!noinit)
6500 basic_ios_wchar_init(base, strbuf, isstd);
6501 return this;
6504 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QAE@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N1@Z */
6505 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N1@Z */
6506 DEFINE_THISCALL_WRAPPER(basic_istream_short_ctor_init, 20)
6507 basic_istream_wchar* __thiscall basic_istream_short_ctor_init(basic_istream_wchar *this,
6508 basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool noinit, MSVCP_bool virt_init)
6510 basic_istream_wchar_ctor_init(this, strbuf, isstd, noinit, virt_init);
6511 basic_istream_wchar_get_basic_ios(this)->base.vtable = &MSVCP_basic_istream_short_vtable;
6512 return this;
6515 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N@Z */
6516 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@_N@Z */
6517 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_ctor, 16)
6518 basic_istream_wchar* __thiscall basic_istream_wchar_ctor(basic_istream_wchar *this,
6519 basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
6521 return basic_istream_wchar_ctor_init(this, strbuf, isstd, FALSE, virt_init);
6524 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QAE@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N@Z */
6525 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@_N@Z */
6526 DEFINE_THISCALL_WRAPPER(basic_istream_short_ctor, 16)
6527 basic_istream_wchar* __thiscall basic_istream_short_ctor(basic_istream_wchar *this,
6528 basic_streambuf_wchar *strbuf, MSVCP_bool isstd, MSVCP_bool virt_init)
6530 return basic_istream_short_ctor_init(this, strbuf, isstd, FALSE, virt_init);
6533 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE@W4_Uninitialized@1@@Z */
6534 /* ??0?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
6535 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_ctor_uninitialized, 12)
6536 basic_istream_wchar* __thiscall basic_istream_wchar_ctor_uninitialized(
6537 basic_istream_wchar *this, int uninitialized, MSVCP_bool virt_init)
6539 basic_ios_wchar *base;
6541 TRACE("(%p %d %d)\n", this, uninitialized, virt_init);
6543 if(virt_init) {
6544 this->vbtable = basic_istream_wchar_vbtable;
6545 base = basic_istream_wchar_get_basic_ios(this);
6546 basic_ios_wchar_ctor(base);
6547 }else {
6548 base = basic_istream_wchar_get_basic_ios(this);
6551 base->base.vtable = &MSVCP_basic_istream_wchar_vtable;
6552 ios_base_Addstd(&base->base);
6553 return this;
6556 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QAE@W4_Uninitialized@1@@Z */
6557 /* ??0?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA@W4_Uninitialized@1@@Z */
6558 DEFINE_THISCALL_WRAPPER(basic_istream_short_ctor_uninitialized, 12)
6559 basic_istream_wchar* __thiscall basic_istream_short_ctor_uninitialized(
6560 basic_istream_wchar *this, int uninitialized, MSVCP_bool virt_init)
6562 basic_istream_wchar_ctor_uninitialized(this, uninitialized, virt_init);
6563 basic_istream_wchar_get_basic_ios(this)->base.vtable = &MSVCP_basic_istream_short_vtable;
6564 return this;
6567 /* ??1?$basic_istream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
6568 /* ??1?$basic_istream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
6569 /* ??1?$basic_istream@GU?$char_traits@G@std@@@std@@UAE@XZ */
6570 /* ??1?$basic_istream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
6571 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_dtor, 4)
6572 void __thiscall basic_istream_wchar_dtor(basic_ios_wchar *base)
6574 basic_istream_wchar *this = basic_istream_wchar_from_basic_ios(base);
6576 /* don't destroy virtual base here */
6577 TRACE("(%p)\n", this);
6580 /* ??_D?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
6581 /* ??_D?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
6582 /* ??_D?$basic_istream@GU?$char_traits@G@std@@@std@@QAEXXZ */
6583 /* ??_D?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
6584 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_vbase_dtor, 4)
6585 void __thiscall basic_istream_wchar_vbase_dtor(basic_istream_wchar *this)
6587 TRACE("(%p)\n", this);
6588 basic_istream_wchar_dtor(basic_istream_wchar_to_basic_ios(this));
6589 basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(this));
6592 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_vector_dtor, 8)
6593 basic_istream_wchar* __thiscall basic_istream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
6595 basic_istream_wchar *this = basic_istream_wchar_from_basic_ios(base);
6597 TRACE("(%p %x)\n", this, flags);
6599 if(flags & 2) {
6600 /* we have an array, with the number of elements stored before the first object */
6601 INT_PTR i, *ptr = (INT_PTR *)this-1;
6603 for(i=*ptr-1; i>=0; i--)
6604 basic_istream_wchar_vbase_dtor(this+i);
6605 MSVCRT_operator_delete(ptr);
6606 } else {
6607 basic_istream_wchar_vbase_dtor(this);
6608 if(flags & 1)
6609 MSVCRT_operator_delete(this);
6612 return this;
6615 /* ?_Ipfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE_N_N@Z */
6616 /* ?_Ipfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA_N_N@Z */
6617 /* ?_Ipfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QAE_N_N@Z */
6618 /* ?_Ipfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA_N_N@Z */
6619 DEFINE_THISCALL_WRAPPER(basic_istream_wchar__Ipfx, 8)
6620 MSVCP_bool __thiscall basic_istream_wchar__Ipfx(basic_istream_wchar *this, MSVCP_bool noskip)
6622 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
6624 TRACE("(%p %d)\n", this, noskip);
6626 if(ios_base_good(&base->base)) {
6627 if(basic_ios_wchar_tie_get(base))
6628 basic_ostream_wchar_flush(basic_ios_wchar_tie_get(base));
6630 if(!noskip && (ios_base_flags_get(&base->base) & FMTFLAG_skipws)) {
6631 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6632 const ctype_wchar *ctype = ctype_wchar_use_facet(base->strbuf->loc);
6633 int ch;
6635 for(ch = basic_streambuf_wchar_sgetc(strbuf); ;
6636 ch = basic_streambuf_wchar_snextc(strbuf)) {
6637 if(ch == WEOF) {
6638 basic_ios_wchar_setstate(base, IOSTATE_eofbit);
6639 break;
6642 if(!ctype_wchar_is_ch(ctype, _SPACE|_BLANK, ch))
6643 break;
6648 if(!ios_base_good(&base->base)) {
6649 basic_ios_wchar_setstate(base, IOSTATE_failbit);
6650 return FALSE;
6652 return TRUE;
6655 /* ?ipfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE_N_N@Z */
6656 /* ?ipfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA_N_N@Z */
6657 /* ?ipfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QAE_N_N@Z */
6658 /* ?ipfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA_N_N@Z */
6659 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_ipfx, 8)
6660 MSVCP_bool __thiscall basic_istream_wchar_ipfx(basic_istream_wchar *this, MSVCP_bool noskip)
6662 return basic_istream_wchar__Ipfx(this, noskip);
6665 /* ?isfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
6666 /* ?isfx@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
6667 /* ?isfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEXXZ */
6668 /* ?isfx@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
6669 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_isfx, 4)
6670 void __thiscall basic_istream_wchar_isfx(basic_istream_wchar *this)
6672 TRACE("(%p)\n", this);
6675 static BOOL basic_istream_wchar_sentry_create(basic_istream_wchar *istr, MSVCP_bool noskip)
6677 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(istr);
6679 if(basic_ios_wchar_rdbuf_get(base))
6680 basic_streambuf_wchar__Lock(base->strbuf);
6682 return basic_istream_wchar_ipfx(istr, noskip);
6685 static void basic_istream_wchar_sentry_destroy(basic_istream_wchar *istr)
6687 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(istr);
6689 if(basic_ios_wchar_rdbuf_get(base))
6690 basic_streambuf_wchar__Unlock(base->strbuf);
6693 /* ?gcount@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QBEHXZ */
6694 /* ?gcount@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEBA_JXZ */
6695 /* ?gcount@?$basic_istream@GU?$char_traits@G@std@@@std@@QBEHXZ */
6696 /* ?gcount@?$basic_istream@GU?$char_traits@G@std@@@std@@QEBA_JXZ */
6697 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_gcount, 4)
6698 int __thiscall basic_istream_wchar_gcount(const basic_istream_wchar *this)
6700 TRACE("(%p)\n", this);
6701 return this->count;
6704 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
6705 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
6706 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEGXZ */
6707 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAGXZ */
6708 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get, 4)
6709 unsigned short __thiscall basic_istream_wchar_get(basic_istream_wchar *this)
6711 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
6712 int ret;
6714 TRACE("(%p)\n", this);
6716 this->count = 0;
6718 if(!basic_istream_wchar_sentry_create(this, TRUE)) {
6719 basic_istream_wchar_sentry_destroy(this);
6720 return WEOF;
6723 ret = basic_streambuf_wchar_sbumpc(basic_ios_wchar_rdbuf_get(base));
6724 basic_istream_wchar_sentry_destroy(this);
6725 if(ret == WEOF)
6726 basic_ios_wchar_setstate(base, IOSTATE_eofbit|IOSTATE_failbit);
6727 else
6728 this->count++;
6730 return ret;
6733 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@AA_W@Z */
6734 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@AEA_W@Z */
6735 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@AAG@Z */
6736 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@AEAG@Z */
6737 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get_ch, 8)
6738 basic_istream_wchar* __thiscall basic_istream_wchar_get_ch(basic_istream_wchar *this, wchar_t *ch)
6740 unsigned short ret;
6742 TRACE("(%p %p)\n", this, ch);
6744 ret = basic_istream_wchar_get(this);
6745 if(ret != WEOF)
6746 *ch = (wchar_t)ret;
6747 return this;
6750 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WH_W@Z */
6751 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_J_W@Z */
6752 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGHG@Z */
6753 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_JG@Z */
6754 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get_str_delim, 20)
6755 basic_istream_wchar* __thiscall basic_istream_wchar_get_str_delim(basic_istream_wchar *this, wchar_t *str, streamsize count, wchar_t delim)
6757 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
6758 unsigned short ch = delim;
6760 TRACE("(%p %p %s %c)\n", this, str, wine_dbgstr_longlong(count), delim);
6762 this->count = 0;
6764 if(basic_istream_wchar_sentry_create(this, TRUE)) {
6765 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6767 for(ch = basic_streambuf_wchar_sgetc(strbuf); count>1;
6768 ch = basic_streambuf_wchar_snextc(strbuf)) {
6769 if(ch==WEOF || ch==delim)
6770 break;
6772 *str++ = ch;
6773 this->count++;
6774 count--;
6777 basic_istream_wchar_sentry_destroy(this);
6779 basic_ios_wchar_setstate(base, (!this->count ? IOSTATE_failbit : IOSTATE_goodbit) |
6780 (ch==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
6781 if(count > 0)
6782 *str = 0;
6783 return this;
6786 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WH@Z */
6787 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_J@Z */
6788 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGH@Z */
6789 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_J@Z */
6790 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get_str, 16)
6791 basic_istream_wchar* __thiscall basic_istream_wchar_get_str(basic_istream_wchar *this, wchar_t *str, streamsize count)
6793 return basic_istream_wchar_get_str_delim(this, str, count, '\n');
6796 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@AAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@_W@Z */
6797 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@_W@Z */
6798 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@AAV?$basic_streambuf@GU?$char_traits@G@std@@@2@G@Z */
6799 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@G@Z */
6800 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get_streambuf_delim, 12)
6801 basic_istream_wchar* __thiscall basic_istream_wchar_get_streambuf_delim(basic_istream_wchar *this, basic_streambuf_wchar *strbuf, wchar_t delim)
6803 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
6804 unsigned short ch = delim;
6806 TRACE("(%p %p %c)\n", this, strbuf, delim);
6808 this->count = 0;
6810 if(basic_istream_wchar_sentry_create(this, TRUE)) {
6811 basic_streambuf_wchar *strbuf_read = basic_ios_wchar_rdbuf_get(base);
6813 for(ch = basic_streambuf_wchar_sgetc(strbuf_read); ;
6814 ch = basic_streambuf_wchar_snextc(strbuf_read)) {
6815 if(ch==WEOF || ch==delim)
6816 break;
6818 if(basic_streambuf_wchar_sputc(strbuf, ch) == WEOF)
6819 break;
6820 this->count++;
6823 basic_istream_wchar_sentry_destroy(this);
6825 basic_ios_wchar_setstate(base, (!this->count ? IOSTATE_failbit : IOSTATE_goodbit) |
6826 (ch==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
6827 return this;
6830 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@AAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@@Z */
6831 /* ?get@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@2@@Z */
6832 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@AAV?$basic_streambuf@GU?$char_traits@G@std@@@2@@Z */
6833 /* ?get@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@AEAV?$basic_streambuf@GU?$char_traits@G@std@@@2@@Z */
6834 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_get_streambuf, 8)
6835 basic_istream_wchar* __thiscall basic_istream_wchar_get_streambuf(basic_istream_wchar *this, basic_streambuf_wchar *strbuf)
6837 return basic_istream_wchar_get_streambuf_delim(this, strbuf, '\n');
6840 /* ?getline@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WH_W@Z */
6841 /* ?getline@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_J_W@Z */
6842 /* ?getline@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGHG@Z */
6843 /* ?getline@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_JG@Z */
6844 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_getline_delim, 20)
6845 basic_istream_wchar* __thiscall basic_istream_wchar_getline_delim(basic_istream_wchar *this, wchar_t *str, streamsize count, wchar_t delim)
6847 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
6848 unsigned short ch = delim;
6850 TRACE("(%p %p %s %c)\n", this, str, wine_dbgstr_longlong(count), delim);
6852 this->count = 0;
6854 if(basic_istream_wchar_sentry_create(this, TRUE) && count>0) {
6855 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6857 while(count > 1) {
6858 ch = basic_streambuf_wchar_sbumpc(strbuf);
6860 if(ch==WEOF || ch==delim)
6861 break;
6863 *str++ = ch;
6864 this->count++;
6865 count--;
6868 if(ch == delim)
6869 this->count++;
6870 else if(ch != WEOF) {
6871 ch = basic_streambuf_wchar_sgetc(strbuf);
6873 if(ch == delim) {
6874 basic_streambuf_wchar__Gninc(strbuf);
6875 this->count++;
6879 basic_istream_wchar_sentry_destroy(this);
6881 basic_ios_wchar_setstate(base, (ch==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit) |
6882 (!this->count || (ch!=delim && ch!=WEOF) ? IOSTATE_failbit : IOSTATE_goodbit));
6883 if(count > 0)
6884 *str = 0;
6885 return this;
6888 /* ?getline@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WH@Z */
6889 /* ?getline@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_J@Z */
6890 /* ?getline@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGH@Z */
6891 /* ?getline@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_J@Z */
6892 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_getline, 16)
6893 basic_istream_wchar* __thiscall basic_istream_wchar_getline(basic_istream_wchar *this, wchar_t *str, streamsize count)
6895 return basic_istream_wchar_getline_delim(this, str, count, '\n');
6898 /* ?ignore@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@HG@Z */
6899 /* ?ignore@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@_JG@Z */
6900 /* ?ignore@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@HG@Z */
6901 /* ?ignore@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@_JG@Z */
6902 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_ignore, 16)
6903 basic_istream_wchar* __thiscall basic_istream_wchar_ignore(basic_istream_wchar *this, streamsize count, unsigned short delim)
6905 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
6906 unsigned short ch = delim;
6907 unsigned int state;
6909 TRACE("(%p %s %d)\n", this, wine_dbgstr_longlong(count), delim);
6911 this->count = 0;
6913 if(basic_istream_wchar_sentry_create(this, TRUE)) {
6914 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6915 state = IOSTATE_goodbit;
6917 while(count > 0) {
6918 ch = basic_streambuf_wchar_sbumpc(strbuf);
6920 if(ch==WEOF) {
6921 state = IOSTATE_eofbit;
6922 break;
6925 if(ch==delim)
6926 break;
6928 this->count++;
6929 if(count != INT_MAX)
6930 count--;
6932 }else
6933 state = IOSTATE_failbit;
6934 basic_istream_wchar_sentry_destroy(this);
6936 basic_ios_wchar_setstate(base, state);
6937 return this;
6940 /* ?ws@std@@YAAAV?$basic_istream@_WU?$char_traits@_W@std@@@1@AAV21@@Z */
6941 /* ?ws@std@@YAAEAV?$basic_istream@_WU?$char_traits@_W@std@@@1@AEAV21@@Z */
6942 /* ?ws@std@@YAAAV?$basic_istream@GU?$char_traits@G@std@@@1@AAV21@@Z */
6943 /* ?ws@std@@YAAEAV?$basic_istream@GU?$char_traits@G@std@@@1@AEAV21@@Z */
6944 basic_istream_wchar* __cdecl ws_basic_istream_wchar(basic_istream_wchar *istream)
6946 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(istream);
6947 unsigned short ch = '\n';
6949 TRACE("(%p)\n", istream);
6951 if(basic_istream_wchar_sentry_create(istream, TRUE)) {
6952 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
6953 const ctype_wchar *ctype = ctype_wchar_use_facet(strbuf->loc);
6955 for(ch = basic_streambuf_wchar_sgetc(strbuf); ctype_wchar_is_ch(ctype, _SPACE, ch);
6956 ch = basic_streambuf_wchar_snextc(strbuf)) {
6957 if(ch == WEOF)
6958 break;
6961 basic_istream_wchar_sentry_destroy(istream);
6963 if(ch == WEOF)
6964 basic_ios_wchar_setstate(base, IOSTATE_eofbit);
6965 return istream;
6968 /* ?peek@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEGXZ */
6969 /* ?peek@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAGXZ */
6970 /* ?peek@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEGXZ */
6971 /* ?peek@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAGXZ */
6972 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_peek, 4)
6973 unsigned short __thiscall basic_istream_wchar_peek(basic_istream_wchar *this)
6975 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
6976 unsigned short ret = WEOF;
6978 TRACE("(%p)\n", this);
6980 this->count = 0;
6982 if(basic_istream_wchar_sentry_create(this, TRUE))
6983 ret = basic_streambuf_wchar_sgetc(basic_ios_wchar_rdbuf_get(base));
6984 basic_istream_wchar_sentry_destroy(this);
6986 if (ret == WEOF)
6987 basic_ios_wchar_setstate(base, IOSTATE_eofbit);
6989 return ret;
6992 /* ?_Read_s@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WIH@Z */
6993 /* ?_Read_s@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_K_J@Z */
6994 /* ?_Read_s@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGIH@Z */
6995 /* ?_Read_s@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_K_J@Z */
6996 static basic_istream_wchar* basic_istream_wchar__Read_s(basic_istream_wchar *this, wchar_t *str, MSVCP_size_t size, streamsize count)
6998 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
6999 IOSB_iostate state = IOSTATE_goodbit;
7001 TRACE("(%p %p %lu %s)\n", this, str, size, wine_dbgstr_longlong(count));
7003 if(basic_istream_wchar_sentry_create(this, TRUE)) {
7004 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
7006 this->count = basic_streambuf_wchar__Sgetn_s(strbuf, str, size, count);
7007 if(this->count != count)
7008 state |= IOSTATE_failbit | IOSTATE_eofbit;
7009 }else {
7010 this->count = 0;
7012 basic_istream_wchar_sentry_destroy(this);
7014 basic_ios_wchar_setstate(base, state);
7015 return this;
7018 /* ?read@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@PA_WH@Z */
7019 /* ?read@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@PEA_W_J@Z */
7020 /* ?read@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGH@Z */
7021 /* ?read@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@PEAG_J@Z */
7022 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read, 16)
7023 basic_istream_wchar* __thiscall basic_istream_wchar_read(basic_istream_wchar *this, wchar_t *str, streamsize count)
7025 return basic_istream_wchar__Read_s(this, str, count, count);
7028 /* ?_Readsome_s@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEHPA_WIH@Z */
7029 /* ?_Readsome_s@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA_JPEA_W_K_J@Z */
7030 /* ?_Readsome_s@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEHPAGIH@Z */
7031 /* ?_Readsome_s@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA_JPEAG_K_J@Z */
7032 static streamsize basic_istream_wchar__Readsome_s(basic_istream_wchar *this, wchar_t *str, MSVCP_size_t size, streamsize count)
7034 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
7035 IOSB_iostate state = IOSTATE_goodbit;
7037 TRACE("(%p %p %lu %s)\n", this, str, size, wine_dbgstr_longlong(count));
7039 this->count = 0;
7041 if(basic_istream_wchar_sentry_create(this, TRUE)) {
7042 streamsize avail = basic_streambuf_wchar_in_avail(basic_ios_wchar_rdbuf_get(base));
7043 if(avail > count)
7044 avail = count;
7046 if(avail == -1)
7047 state |= IOSTATE_eofbit;
7048 else if(avail > 0)
7049 basic_istream_wchar__Read_s(this, str, size, avail);
7050 }else {
7051 state |= IOSTATE_failbit;
7053 basic_istream_wchar_sentry_destroy(this);
7055 basic_ios_wchar_setstate(base, state);
7056 return this->count;
7059 /* ?readsome@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEHPA_WH@Z */
7060 /* ?readsome@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA_JPEA_W_J@Z */
7061 /* ?readsome@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEHPAGH@Z */
7062 /* ?readsome@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA_JPEAG_J@Z */
7063 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_readsome, 16)
7064 streamsize __thiscall basic_istream_wchar_readsome(basic_istream_wchar *this, wchar_t *str, streamsize count)
7066 return basic_istream_wchar__Readsome_s(this, str, count, count);
7069 /* ?putback@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@_W@Z */
7070 /* ?putback@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@_W@Z */
7071 /* ?putback@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@G@Z */
7072 /* ?putback@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@G@Z */
7073 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_putback, 8)
7074 basic_istream_wchar* __thiscall basic_istream_wchar_putback(basic_istream_wchar *this, wchar_t ch)
7076 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
7077 IOSB_iostate state = IOSTATE_goodbit;
7079 TRACE("(%p %c)\n", this, ch);
7081 this->count = 0;
7083 if(basic_istream_wchar_sentry_create(this, TRUE)) {
7084 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
7086 if(!ios_base_good(&base->base))
7087 state |= IOSTATE_failbit;
7088 else if(!strbuf || basic_streambuf_wchar_sputbackc(strbuf, ch)==WEOF)
7089 state |= IOSTATE_badbit;
7091 basic_istream_wchar_sentry_destroy(this);
7093 basic_ios_wchar_setstate(base, state);
7094 return this;
7097 /* ?unget@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@XZ */
7098 /* ?unget@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@XZ */
7099 /* ?unget@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@XZ */
7100 /* ?unget@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@XZ */
7101 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_unget, 4)
7102 basic_istream_wchar* __thiscall basic_istream_wchar_unget(basic_istream_wchar *this)
7104 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
7105 IOSB_iostate state = IOSTATE_goodbit;
7107 TRACE("(%p)\n", this);
7109 this->count = 0;
7111 if(basic_istream_wchar_sentry_create(this, TRUE)) {
7112 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
7114 if(!ios_base_good(&base->base))
7115 state |= IOSTATE_failbit;
7116 else if(!strbuf || basic_streambuf_wchar_sungetc(strbuf)==WEOF)
7117 state |= IOSTATE_badbit;
7119 basic_istream_wchar_sentry_destroy(this);
7121 basic_ios_wchar_setstate(base, state);
7122 return this;
7125 /* ?sync@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEHXZ */
7126 /* ?sync@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAHXZ */
7127 /* ?sync@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEHXZ */
7128 /* ?sync@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAHXZ */
7129 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_sync, 4)
7130 int __thiscall basic_istream_wchar_sync(basic_istream_wchar *this)
7132 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
7133 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
7135 TRACE("(%p)\n", this);
7137 if(!strbuf)
7138 return -1;
7140 if(basic_istream_wchar_sentry_create(this, TRUE)) {
7141 if(basic_streambuf_wchar_pubsync(strbuf) != -1) {
7142 basic_istream_wchar_sentry_destroy(this);
7143 return 0;
7146 basic_istream_wchar_sentry_destroy(this);
7148 basic_ios_wchar_setstate(base, IOSTATE_badbit);
7149 return -1;
7152 /* ?tellg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAE?AV?$fpos@H@2@XZ */
7153 /* ?tellg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
7154 /* ?tellg@?$basic_istream@GU?$char_traits@G@std@@@std@@QAE?AV?$fpos@H@2@XZ */
7155 /* ?tellg@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAA?AV?$fpos@H@2@XZ */
7156 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_tellg, 8)
7157 fpos_int* __thiscall basic_istream_wchar_tellg(basic_istream_wchar *this, fpos_int *ret)
7159 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
7161 TRACE("(%p %p)\n", this, ret);
7163 if(ios_base_fail(&base->base)) {
7164 ret->off = -1;
7165 ret->pos = 0;
7166 ret->state = 0;
7167 return ret;
7170 basic_streambuf_wchar_pubseekoff(basic_ios_wchar_rdbuf_get(base),
7171 ret, 0, SEEKDIR_cur, OPENMODE_in);
7172 if(ret->off==-1 && ret->pos==0 && ret->state==0)
7173 basic_ios_wchar_setstate(base, IOSTATE_failbit);
7175 return ret;
7178 /* ?seekg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@JH@Z */
7179 /* ?seekg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@_JH@Z */
7180 /* ?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@JH@Z */
7181 /* ?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@_JH@Z */
7182 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_seekg, 16)
7183 basic_istream_wchar* __thiscall basic_istream_wchar_seekg(basic_istream_wchar *this, streamoff off, int dir)
7185 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
7187 TRACE("(%p %s %d)\n", this, wine_dbgstr_longlong(off), dir);
7189 if(!ios_base_fail(&base->base)) {
7190 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
7191 fpos_int ret;
7193 basic_streambuf_wchar_pubseekoff(strbuf, &ret, off, dir, OPENMODE_in);
7195 if(ret.off==-1 && ret.pos==0 && ret.state==0)
7196 basic_ios_wchar_setstate(base, IOSTATE_failbit);
7197 else
7198 basic_ios_wchar_clear(base, IOSTATE_goodbit);
7199 return this;
7200 }else
7201 basic_ios_wchar_clear(base, IOSTATE_goodbit);
7203 return this;
7206 /* ?seekg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
7207 /* ?seekg@?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
7208 /* ?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@V?$fpos@H@2@@Z */
7209 /* ?seekg@?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV12@V?$fpos@H@2@@Z */
7210 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_seekg_fpos, 28)
7211 basic_istream_wchar* __thiscall basic_istream_wchar_seekg_fpos(basic_istream_wchar *this, fpos_int pos)
7213 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
7215 TRACE("(%p %s)\n", this, debugstr_fpos_int(&pos));
7217 if(!ios_base_fail(&base->base)) {
7218 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
7219 fpos_int ret;
7221 basic_streambuf_wchar_pubseekpos(strbuf, &ret, pos, OPENMODE_in);
7223 if(ret.off==-1 && ret.pos==0 && ret.state==0)
7224 basic_ios_wchar_setstate(base, IOSTATE_failbit);
7225 else
7226 basic_ios_wchar_clear(base, IOSTATE_goodbit);
7227 return this;
7228 }else
7229 basic_ios_wchar_clear(base, IOSTATE_goodbit);
7231 return this;
7234 static basic_istream_wchar* basic_istream_read_short(basic_istream_wchar *this, short *v, const num_get *numget)
7236 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
7237 int state = IOSTATE_goodbit;
7239 TRACE("(%p %p)\n", this, v);
7241 if(basic_istream_wchar_sentry_create(this, FALSE)) {
7242 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
7243 istreambuf_iterator_wchar first={0}, last={0};
7244 LONG tmp;
7246 first.strbuf = strbuf;
7247 num_get_wchar_get_long(numget, &last, first, last, &base->base, &state, &tmp);
7249 if(!(state&IOSTATE_failbit) && tmp==(LONG)((short)tmp))
7250 *v = tmp;
7251 else
7252 state |= IOSTATE_failbit;
7254 basic_istream_wchar_sentry_destroy(this);
7256 basic_ios_wchar_setstate(base, state);
7257 return this;
7260 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAF@Z */
7261 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAF@Z */
7262 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_short, 8)
7263 basic_istream_wchar* __thiscall basic_istream_wchar_read_short(basic_istream_wchar *this, short *v)
7265 return basic_istream_read_short(this, v, num_get_wchar_use_facet(
7266 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
7269 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAF@Z */
7270 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAF@Z */
7271 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_short, 8)
7272 basic_istream_wchar* __thiscall basic_istream_short_read_short(basic_istream_wchar *this, short *v)
7274 return basic_istream_read_short(this, v, num_get_short_use_facet(
7275 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
7278 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAG@Z */
7279 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAG@Z */
7280 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_ushort, 8)
7281 basic_istream_wchar* __thiscall basic_istream_wchar_read_ushort(basic_istream_wchar *this, unsigned short *v)
7283 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
7284 int state = IOSTATE_goodbit;
7286 TRACE("(%p %p)\n", this, v);
7288 if(basic_istream_wchar_sentry_create(this, FALSE)) {
7289 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
7290 const num_get *numget = num_get_wchar_use_facet(strbuf->loc);
7291 istreambuf_iterator_wchar first={0}, last={0};
7293 first.strbuf = strbuf;
7294 num_get_wchar_get_ushort(numget, &last, first, last, &base->base, &state, v);
7296 basic_istream_wchar_sentry_destroy(this);
7298 basic_ios_wchar_setstate(base, state);
7299 return this;
7302 static basic_istream_wchar* basic_istream_read_int(basic_istream_wchar *this, int *v, const num_get *numget)
7304 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
7305 int state = IOSTATE_goodbit;
7307 TRACE("(%p %p)\n", this, v);
7309 if(basic_istream_wchar_sentry_create(this, FALSE)) {
7310 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
7311 istreambuf_iterator_wchar first={0}, last={0};
7313 first.strbuf = strbuf;
7314 num_get_wchar_get_long(numget, &last, first, last, &base->base, &state, v);
7316 basic_istream_wchar_sentry_destroy(this);
7318 basic_ios_wchar_setstate(base, state);
7319 return this;
7322 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAH@Z */
7323 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAH@Z */
7324 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_int, 8)
7325 basic_istream_wchar* __thiscall basic_istream_wchar_read_int(basic_istream_wchar *this, int *v)
7327 return basic_istream_read_int(this, v, num_get_wchar_use_facet(
7328 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
7331 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAH@Z */
7332 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAH@Z */
7333 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_int, 8)
7334 basic_istream_wchar* __thiscall basic_istream_short_read_int(basic_istream_wchar *this, int *v)
7336 return basic_istream_read_int(this, v, num_get_short_use_facet(
7337 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
7340 static basic_istream_wchar* basic_istream_read_uint(basic_istream_wchar *this, unsigned int *v, const num_get *numget)
7342 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
7343 int state = IOSTATE_goodbit;
7345 TRACE("(%p %p)\n", this, v);
7347 if(basic_istream_wchar_sentry_create(this, FALSE)) {
7348 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
7349 istreambuf_iterator_wchar first={0}, last={0};
7351 first.strbuf = strbuf;
7352 num_get_wchar_get_uint(numget, &last, first, last, &base->base, &state, v);
7354 basic_istream_wchar_sentry_destroy(this);
7356 basic_ios_wchar_setstate(base, state);
7357 return this;
7360 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAI@Z */
7361 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAI@Z */
7362 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_uint, 8)
7363 basic_istream_wchar* __thiscall basic_istream_wchar_read_uint(basic_istream_wchar *this, unsigned int *v)
7365 return basic_istream_read_uint(this, v, num_get_wchar_use_facet(
7366 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
7369 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAI@Z */
7370 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAI@Z */
7371 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_uint, 8)
7372 basic_istream_wchar* __thiscall basic_istream_short_read_uint(basic_istream_wchar *this, unsigned int *v)
7374 return basic_istream_read_uint(this, v, num_get_short_use_facet(
7375 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
7378 static basic_istream_wchar* basic_istream_read_long(basic_istream_wchar *this, LONG *v, const num_get *numget)
7380 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
7381 int state = IOSTATE_goodbit;
7383 TRACE("(%p %p)\n", this, v);
7385 if(basic_istream_wchar_sentry_create(this, FALSE)) {
7386 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
7387 istreambuf_iterator_wchar first={0}, last={0};
7389 first.strbuf = strbuf;
7390 num_get_wchar_get_long(numget, &last, first, last, &base->base, &state, v);
7392 basic_istream_wchar_sentry_destroy(this);
7394 basic_ios_wchar_setstate(base, state);
7395 return this;
7398 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAJ@Z */
7399 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAJ@Z */
7400 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_long, 8)
7401 basic_istream_wchar* __thiscall basic_istream_wchar_read_long(basic_istream_wchar *this, LONG *v)
7403 return basic_istream_read_long(this, v, num_get_wchar_use_facet(
7404 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
7407 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAJ@Z */
7408 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAJ@Z */
7409 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_long, 8)
7410 basic_istream_wchar* __thiscall basic_istream_short_read_long(basic_istream_wchar *this, LONG *v)
7412 return basic_istream_read_long(this, v, num_get_short_use_facet(
7413 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
7416 static basic_istream_wchar* basic_istream_read_ulong(basic_istream_wchar *this, ULONG *v, const num_get *numget)
7418 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
7419 int state = IOSTATE_goodbit;
7421 TRACE("(%p %p)\n", this, v);
7423 if(basic_istream_wchar_sentry_create(this, FALSE)) {
7424 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
7425 istreambuf_iterator_wchar first={0}, last={0};
7427 first.strbuf = strbuf;
7428 num_get_wchar_get_ulong(numget, &last, first, last, &base->base, &state, v);
7430 basic_istream_wchar_sentry_destroy(this);
7432 basic_ios_wchar_setstate(base, state);
7433 return this;
7436 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAK@Z */
7437 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAK@Z */
7438 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_ulong, 8)
7439 basic_istream_wchar* __thiscall basic_istream_wchar_read_ulong(basic_istream_wchar *this, ULONG *v)
7441 return basic_istream_read_ulong(this, v, num_get_wchar_use_facet(
7442 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
7445 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAK@Z */
7446 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAK@Z */
7447 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_ulong, 8)
7448 basic_istream_wchar* __thiscall basic_istream_short_read_ulong(basic_istream_wchar *this, ULONG *v)
7450 return basic_istream_read_ulong(this, v, num_get_short_use_facet(
7451 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
7454 static basic_istream_wchar* basic_istream_read_float(basic_istream_wchar *this, float *v, const num_get *numget)
7456 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
7457 int state = IOSTATE_goodbit;
7459 TRACE("(%p %p)\n", this, v);
7461 if(basic_istream_wchar_sentry_create(this, FALSE)) {
7462 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
7463 istreambuf_iterator_wchar first={0}, last={0};
7465 first.strbuf = strbuf;
7466 num_get_wchar_get_float(numget, &last, first, last, &base->base, &state, v);
7468 basic_istream_wchar_sentry_destroy(this);
7470 basic_ios_wchar_setstate(base, state);
7471 return this;
7474 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAM@Z */
7475 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAM@Z */
7476 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_float, 8)
7477 basic_istream_wchar* __thiscall basic_istream_wchar_read_float(basic_istream_wchar *this, float *v)
7479 return basic_istream_read_float(this, v, num_get_wchar_use_facet(
7480 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
7483 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAM@Z */
7484 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAM@Z */
7485 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_float, 8)
7486 basic_istream_wchar* __thiscall basic_istream_short_read_float(basic_istream_wchar *this, float *v)
7488 return basic_istream_read_float(this, v, num_get_short_use_facet(
7489 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
7492 static basic_istream_wchar* basic_istream_read_double(basic_istream_wchar *this, double *v, const num_get *numget)
7494 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
7495 int state = IOSTATE_goodbit;
7497 TRACE("(%p %p)\n", this, v);
7499 if(basic_istream_wchar_sentry_create(this, FALSE)) {
7500 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
7501 istreambuf_iterator_wchar first={0}, last={0};
7503 first.strbuf = strbuf;
7504 num_get_wchar_get_double(numget, &last, first, last, &base->base, &state, v);
7506 basic_istream_wchar_sentry_destroy(this);
7508 basic_ios_wchar_setstate(base, state);
7509 return this;
7512 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAN@Z */
7513 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAN@Z */
7514 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_double, 8)
7515 basic_istream_wchar* __thiscall basic_istream_wchar_read_double(basic_istream_wchar *this, double *v)
7517 return basic_istream_read_double(this, v, num_get_wchar_use_facet(
7518 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
7521 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAN@Z */
7522 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAN@Z */
7523 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_double, 8)
7524 basic_istream_wchar* __thiscall basic_istream_short_read_double(basic_istream_wchar *this, double *v)
7526 return basic_istream_read_double(this, v, num_get_short_use_facet(
7527 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
7530 static basic_istream_wchar* basic_istream_read_ldouble(basic_istream_wchar *this, double *v, const num_get *numget)
7532 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
7533 int state = IOSTATE_goodbit;
7535 TRACE("(%p %p)\n", this, v);
7537 if(basic_istream_wchar_sentry_create(this, FALSE)) {
7538 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
7539 istreambuf_iterator_wchar first={0}, last={0};
7541 first.strbuf = strbuf;
7542 num_get_wchar_get_ldouble(numget, &last, first, last, &base->base, &state, v);
7544 basic_istream_wchar_sentry_destroy(this);
7546 basic_ios_wchar_setstate(base, state);
7547 return this;
7550 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAO@Z */
7551 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAO@Z */
7552 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_ldouble, 8)
7553 basic_istream_wchar* __thiscall basic_istream_wchar_read_ldouble(basic_istream_wchar *this, double *v)
7555 return basic_istream_read_ldouble(this, v, num_get_wchar_use_facet(
7556 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
7559 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAO@Z */
7560 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAO@Z */
7561 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_ldouble, 8)
7562 basic_istream_wchar* __thiscall basic_istream_short_read_ldouble(basic_istream_wchar *this, double *v)
7564 return basic_istream_read_ldouble(this, v, num_get_short_use_facet(
7565 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
7568 static basic_istream_wchar* basic_istream_read_ptr(basic_istream_wchar *this, void **v, const num_get *numget)
7570 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
7571 int state = IOSTATE_goodbit;
7573 TRACE("(%p %p)\n", this, v);
7575 if(basic_istream_wchar_sentry_create(this, FALSE)) {
7576 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
7577 istreambuf_iterator_wchar first={0}, last={0};
7579 first.strbuf = strbuf;
7580 num_get_wchar_get_void(numget, &last, first, last, &base->base, &state, v);
7582 basic_istream_wchar_sentry_destroy(this);
7584 basic_ios_wchar_setstate(base, state);
7585 return this;
7588 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AAPAX@Z */
7589 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEAPEAX@Z */
7590 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_ptr, 8)
7591 basic_istream_wchar* __thiscall basic_istream_wchar_read_ptr(basic_istream_wchar *this, void **v)
7593 return basic_istream_read_ptr(this, v, num_get_wchar_use_facet(
7594 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
7597 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AAPAX@Z */
7598 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEAPEAX@Z */
7599 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_ptr, 8)
7600 basic_istream_wchar* __thiscall basic_istream_short_read_ptr(basic_istream_wchar *this, void **v)
7602 return basic_istream_read_ptr(this, v, num_get_short_use_facet(
7603 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
7606 static basic_istream_wchar* basic_istream_read_int64(basic_istream_wchar *this, __int64 *v, const num_get *numget)
7608 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
7609 int state = IOSTATE_goodbit;
7611 TRACE("(%p %p)\n", this, v);
7613 if(basic_istream_wchar_sentry_create(this, FALSE)) {
7614 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
7615 istreambuf_iterator_wchar first={0}, last={0};
7617 first.strbuf = strbuf;
7618 num_get_wchar_get_int64(numget, &last, first, last, &base->base, &state, v);
7620 basic_istream_wchar_sentry_destroy(this);
7622 basic_ios_wchar_setstate(base, state);
7623 return this;
7626 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AA_J@Z */
7627 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEA_J@Z */
7628 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_int64, 8)
7629 basic_istream_wchar* __thiscall basic_istream_wchar_read_int64(basic_istream_wchar *this, __int64 *v)
7631 return basic_istream_read_int64(this, v, num_get_wchar_use_facet(
7632 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
7635 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AA_J@Z */
7636 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEA_J@Z */
7637 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_int64, 8)
7638 basic_istream_wchar* __thiscall basic_istream_short_read_int64(basic_istream_wchar *this, __int64 *v)
7640 return basic_istream_read_int64(this, v, num_get_short_use_facet(
7641 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
7644 static basic_istream_wchar* basic_istream_read_uint64(basic_istream_wchar *this, unsigned __int64 *v, const num_get *numget)
7646 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
7647 int state = IOSTATE_goodbit;
7649 TRACE("(%p %p)\n", this, v);
7651 if(basic_istream_wchar_sentry_create(this, FALSE)) {
7652 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
7653 istreambuf_iterator_wchar first={0}, last={0};
7655 first.strbuf = strbuf;
7656 num_get_wchar_get_uint64(numget, &last, first, last, &base->base, &state, v);
7658 basic_istream_wchar_sentry_destroy(this);
7660 basic_ios_wchar_setstate(base, state);
7661 return this;
7664 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AA_K@Z */
7665 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEA_K@Z */
7666 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_uint64, 8)
7667 basic_istream_wchar* __thiscall basic_istream_wchar_read_uint64(basic_istream_wchar *this, unsigned __int64 *v)
7669 return basic_istream_read_uint64(this, v, num_get_wchar_use_facet(
7670 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
7673 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AA_K@Z */
7674 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEA_K@Z */
7675 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_uint64, 8)
7676 basic_istream_wchar* __thiscall basic_istream_short_read_uint64(basic_istream_wchar *this, unsigned __int64 *v)
7678 return basic_istream_read_uint64(this, v, num_get_short_use_facet(
7679 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
7682 static basic_istream_wchar* basic_istream_read_bool(basic_istream_wchar *this, MSVCP_bool *v, const num_get *numget)
7684 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
7685 int state = IOSTATE_goodbit;
7687 TRACE("(%p %p)\n", this, v);
7689 if(basic_istream_wchar_sentry_create(this, FALSE)) {
7690 basic_streambuf_wchar *strbuf = basic_ios_wchar_rdbuf_get(base);
7691 istreambuf_iterator_wchar first={0}, last={0};
7693 first.strbuf = strbuf;
7694 num_get_wchar_get_bool(numget, &last, first, last, &base->base, &state, v);
7696 basic_istream_wchar_sentry_destroy(this);
7698 basic_ios_wchar_setstate(base, state);
7699 return this;
7702 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@AA_N@Z */
7703 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@AEA_N@Z */
7704 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_bool, 8)
7705 basic_istream_wchar* __thiscall basic_istream_wchar_read_bool(basic_istream_wchar *this, MSVCP_bool *v)
7707 return basic_istream_read_bool(this, v, num_get_wchar_use_facet(
7708 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
7711 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@AA_N@Z */
7712 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@AEA_N@Z */
7713 DEFINE_THISCALL_WRAPPER(basic_istream_short_read_bool, 8)
7714 basic_istream_wchar* __thiscall basic_istream_short_read_bool(basic_istream_wchar *this, MSVCP_bool *v)
7716 return basic_istream_read_bool(this, v, num_get_short_use_facet(
7717 basic_istream_wchar_get_basic_ios(this)->strbuf->loc));
7720 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
7721 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
7722 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
7723 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
7724 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_streambuf, 8)
7725 basic_istream_wchar* __thiscall basic_istream_wchar_read_streambuf(
7726 basic_istream_wchar *this, basic_streambuf_wchar *streambuf)
7728 basic_ios_wchar *base = basic_istream_wchar_get_basic_ios(this);
7729 IOSB_iostate state = IOSTATE_failbit;
7730 unsigned short c = '\n';
7732 TRACE("(%p %p)\n", this, streambuf);
7734 if(basic_istream_wchar_sentry_create(this, FALSE)) {
7735 for(c = basic_streambuf_wchar_sgetc(basic_ios_wchar_rdbuf_get(base)); c!=WEOF;
7736 c = basic_streambuf_wchar_snextc(basic_ios_wchar_rdbuf_get(base))) {
7737 state = IOSTATE_goodbit;
7738 if(basic_streambuf_wchar_sputc(streambuf, c) == WEOF)
7739 break;
7742 basic_istream_wchar_sentry_destroy(this);
7744 basic_ios_wchar_setstate(base, state | (c==WEOF ? IOSTATE_eofbit : IOSTATE_goodbit));
7745 return this;
7748 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
7749 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
7750 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z */
7751 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAV01@AEAV01@@Z@Z */
7752 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_func, 8)
7753 basic_istream_wchar* __thiscall basic_istream_wchar_read_func(basic_istream_wchar *this,
7754 basic_istream_wchar* (__cdecl *pfunc)(basic_istream_wchar*))
7756 TRACE("(%p %p)\n", this, pfunc);
7757 pfunc(this);
7758 return this;
7761 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@_WU?$char_traits@_W@std@@@1@AAV21@@Z@Z */
7762 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@_WU?$char_traits@_W@std@@@1@AEAV21@@Z@Z */
7763 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAV?$basic_ios@GU?$char_traits@G@std@@@1@AAV21@@Z@Z */
7764 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAV?$basic_ios@GU?$char_traits@G@std@@@1@AEAV21@@Z@Z */
7765 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_func_basic_ios, 8)
7766 basic_istream_wchar* __thiscall basic_istream_wchar_read_func_basic_ios(basic_istream_wchar *this,
7767 basic_ios_wchar* (__cdecl *pfunc)(basic_ios_wchar*))
7769 TRACE("(%p %p)\n", this, pfunc);
7770 pfunc(basic_istream_wchar_get_basic_ios(this));
7771 return this;
7774 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
7775 /* ??5?$basic_istream@_WU?$char_traits@_W@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
7776 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV01@P6AAAVios_base@1@AAV21@@Z@Z */
7777 /* ??5?$basic_istream@GU?$char_traits@G@std@@@std@@QEAAAEAV01@P6AAEAVios_base@1@AEAV21@@Z@Z */
7778 DEFINE_THISCALL_WRAPPER(basic_istream_wchar_read_func_ios_base, 8)
7779 basic_istream_wchar* __thiscall basic_istream_wchar_read_func_ios_base(
7780 basic_istream_wchar *this, ios_base* (__cdecl *pfunc)(ios_base*))
7782 TRACE("(%p %p)\n", this, pfunc);
7783 pfunc(&basic_istream_wchar_get_basic_ios(this)->base);
7784 return this;
7787 static inline basic_ios_char* basic_iostream_char_to_basic_ios(basic_iostream_char *ptr)
7789 return (basic_ios_char*)((char*)ptr+basic_iostream_char_vbtable1[1]);
7792 static inline basic_iostream_char* basic_iostream_char_from_basic_ios(basic_ios_char *ptr)
7794 return (basic_iostream_char*)((char*)ptr-basic_iostream_char_vbtable1[1]);
7797 /* ??0?$basic_iostream@DU?$char_traits@D@std@@@std@@QAE@PAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
7798 /* ??0?$basic_iostream@DU?$char_traits@D@std@@@std@@QEAA@PEAV?$basic_streambuf@DU?$char_traits@D@std@@@1@@Z */
7799 DEFINE_THISCALL_WRAPPER(basic_iostream_char_ctor, 12)
7800 basic_iostream_char* __thiscall basic_iostream_char_ctor(basic_iostream_char *this, basic_streambuf_char *strbuf, MSVCP_bool virt_init)
7802 basic_ios_char *basic_ios;
7804 TRACE("(%p %p %d)\n", this, strbuf, virt_init);
7806 if(virt_init) {
7807 this->base1.vbtable = basic_iostream_char_vbtable1;
7808 this->base2.vbtable = basic_iostream_char_vbtable2;
7809 basic_ios = basic_istream_char_get_basic_ios(&this->base1);
7810 basic_ios_char_ctor(basic_ios);
7811 }else {
7812 basic_ios = basic_istream_char_get_basic_ios(&this->base1);
7815 basic_ios->base.vtable = &MSVCP_basic_iostream_char_vtable;
7817 basic_istream_char_ctor(&this->base1, strbuf, FALSE, FALSE);
7818 basic_ostream_char_ctor_uninitialized(&this->base2, 0, FALSE, FALSE);
7819 return this;
7822 /* ??1?$basic_iostream@DU?$char_traits@D@std@@@std@@UAE@XZ */
7823 /* ??1?$basic_iostream@DU?$char_traits@D@std@@@std@@UEAA@XZ */
7824 DEFINE_THISCALL_WRAPPER(basic_iostream_char_dtor, 4)
7825 void __thiscall basic_iostream_char_dtor(basic_ios_char *base)
7827 basic_iostream_char *this = basic_iostream_char_from_basic_ios(base);
7829 TRACE("(%p)\n", this);
7830 basic_ostream_char_dtor(basic_ostream_char_to_basic_ios(&this->base2));
7831 basic_istream_char_dtor(basic_istream_char_to_basic_ios(&this->base1));
7834 /* ??_D?$basic_iostream@DU?$char_traits@D@std@@@std@@QAEXXZ */
7835 /* ??_D?$basic_iostream@DU?$char_traits@D@std@@@std@@QEAAXXZ */
7836 DEFINE_THISCALL_WRAPPER(basic_iostream_char_vbase_dtor, 4)
7837 void __thiscall basic_iostream_char_vbase_dtor(basic_iostream_char *this)
7839 TRACE("(%p)\n", this);
7840 basic_iostream_char_dtor(basic_iostream_char_to_basic_ios(this));
7841 basic_ios_char_dtor(basic_istream_char_get_basic_ios(&this->base1));
7844 DEFINE_THISCALL_WRAPPER(basic_iostream_char_vector_dtor, 8)
7845 basic_iostream_char* __thiscall basic_iostream_char_vector_dtor(basic_ios_char *base, unsigned int flags)
7847 basic_iostream_char *this = basic_iostream_char_from_basic_ios(base);
7849 TRACE("(%p %x)\n", this, flags);
7851 if(flags & 2) {
7852 /* we have an array, with the number of elements stored before the first object */
7853 INT_PTR i, *ptr = (INT_PTR *)this-1;
7855 for(i=*ptr-1; i>=0; i--)
7856 basic_iostream_char_vbase_dtor(this+i);
7857 MSVCRT_operator_delete(ptr);
7858 } else {
7859 basic_iostream_char_vbase_dtor(this);
7860 if(flags & 1)
7861 MSVCRT_operator_delete(this);
7864 return this;
7867 static inline basic_ios_wchar* basic_iostream_wchar_to_basic_ios(basic_iostream_wchar *ptr)
7869 return (basic_ios_wchar*)((char*)ptr+basic_iostream_wchar_vbtable1[1]);
7872 static inline basic_iostream_wchar* basic_iostream_wchar_from_basic_ios(basic_ios_wchar *ptr)
7874 return (basic_iostream_wchar*)((char*)ptr-basic_iostream_wchar_vbtable1[1]);
7877 /* ??0?$basic_iostream@_WU?$char_traits@_W@std@@@std@@QAE@PAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
7878 /* ??0?$basic_iostream@_WU?$char_traits@_W@std@@@std@@QEAA@PEAV?$basic_streambuf@_WU?$char_traits@_W@std@@@1@@Z */
7879 DEFINE_THISCALL_WRAPPER(basic_iostream_wchar_ctor, 12)
7880 basic_iostream_wchar* __thiscall basic_iostream_wchar_ctor(basic_iostream_wchar *this,
7881 basic_streambuf_wchar *strbuf, MSVCP_bool virt_init)
7883 basic_ios_wchar *basic_ios;
7885 TRACE("(%p %p %d)\n", this, strbuf, virt_init);
7887 if(virt_init) {
7888 this->base1.vbtable = basic_iostream_wchar_vbtable1;
7889 this->base2.vbtable = basic_iostream_wchar_vbtable2;
7890 basic_ios = basic_istream_wchar_get_basic_ios(&this->base1);
7891 basic_ios_wchar_ctor(basic_ios);
7892 }else {
7893 basic_ios = basic_istream_wchar_get_basic_ios(&this->base1);
7896 basic_istream_wchar_ctor(&this->base1, strbuf, FALSE, FALSE);
7897 basic_ostream_wchar_ctor_uninitialized(&this->base2, 0, FALSE, FALSE);
7899 basic_ios->base.vtable = &MSVCP_basic_iostream_wchar_vtable;
7900 return this;
7903 /* ??0?$basic_iostream@GU?$char_traits@G@std@@@std@@QAE@PAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
7904 /* ??0?$basic_iostream@GU?$char_traits@G@std@@@std@@QEAA@PEAV?$basic_streambuf@GU?$char_traits@G@std@@@1@@Z */
7905 DEFINE_THISCALL_WRAPPER(basic_iostream_short_ctor, 12)
7906 basic_iostream_wchar* __thiscall basic_iostream_short_ctor(basic_iostream_wchar *this,
7907 basic_streambuf_wchar *strbuf, MSVCP_bool virt_init)
7909 basic_iostream_wchar_ctor(this, strbuf, virt_init);
7910 basic_istream_wchar_get_basic_ios(&this->base1)->base.vtable = &MSVCP_basic_iostream_short_vtable;
7911 return this;
7914 /* ??1?$basic_iostream@_WU?$char_traits@_W@std@@@std@@UAE@XZ */
7915 /* ??1?$basic_iostream@_WU?$char_traits@_W@std@@@std@@UEAA@XZ */
7916 /* ??1?$basic_iostream@GU?$char_traits@G@std@@@std@@UAE@XZ */
7917 /* ??1?$basic_iostream@GU?$char_traits@G@std@@@std@@UEAA@XZ */
7918 DEFINE_THISCALL_WRAPPER(basic_iostream_wchar_dtor, 4)
7919 void __thiscall basic_iostream_wchar_dtor(basic_ios_wchar *base)
7921 basic_iostream_wchar *this = basic_iostream_wchar_from_basic_ios(base);
7923 TRACE("(%p)\n", this);
7924 basic_ostream_wchar_dtor(basic_ostream_wchar_to_basic_ios(&this->base2));
7925 basic_istream_wchar_dtor(basic_istream_wchar_to_basic_ios(&this->base1));
7928 /* ??_D?$basic_iostream@_WU?$char_traits@_W@std@@@std@@QAEXXZ */
7929 /* ??_D?$basic_iostream@_WU?$char_traits@_W@std@@@std@@QEAAXXZ */
7930 /* ??_D?$basic_iostream@GU?$char_traits@G@std@@@std@@QAEXXZ */
7931 /* ??_D?$basic_iostream@GU?$char_traits@G@std@@@std@@QEAAXXZ */
7932 DEFINE_THISCALL_WRAPPER(basic_iostream_wchar_vbase_dtor, 4)
7933 void __thiscall basic_iostream_wchar_vbase_dtor(basic_iostream_wchar *this)
7935 TRACE("(%p)\n", this);
7936 basic_iostream_wchar_dtor(basic_iostream_wchar_to_basic_ios(this));
7937 basic_ios_wchar_dtor(basic_istream_wchar_get_basic_ios(&this->base1));
7940 DEFINE_THISCALL_WRAPPER(basic_iostream_wchar_vector_dtor, 8)
7941 basic_iostream_wchar* __thiscall basic_iostream_wchar_vector_dtor(basic_ios_wchar *base, unsigned int flags)
7943 basic_iostream_wchar *this = basic_iostream_wchar_from_basic_ios(base);
7945 TRACE("(%p %x)\n", this, flags);
7947 if(flags & 2) {
7948 /* we have an array, with the number of elements stored before the first object */
7949 INT_PTR i, *ptr = (INT_PTR *)this-1;
7951 for(i=*ptr-1; i>=0; i--)
7952 basic_iostream_wchar_vbase_dtor(this+i);
7953 MSVCRT_operator_delete(ptr);
7954 } else {
7955 basic_iostream_wchar_vbase_dtor(this);
7956 if(flags & 1)
7957 MSVCRT_operator_delete(this);
7960 return this;
7963 static void __cdecl setprecision_func(ios_base *base, streamsize prec)
7965 ios_base_precision_set(base, prec);
7968 /* ?setprecision@std@@YA?AU?$_Smanip@H@1@H@Z */
7969 /* ?setprecision@std@@YA?AU?$_Smanip@_J@1@_J@Z */
7970 manip_streamsize* __cdecl setprecision(manip_streamsize *ret, streamsize prec)
7972 TRACE("(%p %s)\n", ret, wine_dbgstr_longlong(prec));
7974 ret->pfunc = setprecision_func;
7975 ret->arg = prec;
7976 return ret;
7979 static void __cdecl setw_func(ios_base *base, streamsize width)
7981 ios_base_width_set(base, width);
7984 /* ?setw@std@@YA?AU?$_Smanip@H@1@H@Z */
7985 /* ?setw@std@@YA?AU?$_Smanip@_J@1@_J@Z */
7986 manip_streamsize* __cdecl setw(manip_streamsize *ret, streamsize width)
7988 TRACE("(%p %s)\n", ret, wine_dbgstr_longlong(width));
7990 ret->pfunc = setw_func;
7991 ret->arg = width;
7992 return ret;
7995 static void __cdecl resetioflags_func(ios_base *base, int mask)
7997 ios_base_setf_mask(base, 0, mask);
8000 /* ?resetiosflags@std@@YA?AU?$_Smanip@H@1@H@Z */
8001 manip_int* __cdecl resetiosflags(manip_int *ret, int mask)
8003 TRACE("(%p %d)\n", ret, mask);
8005 ret->pfunc = resetioflags_func;
8006 ret->arg = mask;
8007 return ret;
8010 static void __cdecl setiosflags_func(ios_base *base, int mask)
8012 ios_base_setf_mask(base, FMTFLAG_mask, mask);
8015 /* ?setiosflags@std@@YA?AU?$_Smanip@H@1@H@Z */
8016 manip_int* __cdecl setiosflags(manip_int *ret, int mask)
8018 TRACE("(%p %d)\n", ret, mask);
8020 ret->pfunc = setiosflags_func;
8021 ret->arg = mask;
8022 return ret;
8025 static void __cdecl setbase_func(ios_base *base, int set_base)
8027 if(set_base == 10)
8028 set_base = FMTFLAG_dec;
8029 else if(set_base == 8)
8030 set_base = FMTFLAG_oct;
8031 else if(set_base == 16)
8032 set_base = FMTFLAG_hex;
8033 else
8034 set_base = 0;
8036 ios_base_setf_mask(base, set_base, FMTFLAG_basefield);
8039 /* ?setbase@std@@YA?AU?$_Smanip@H@1@H@Z */
8040 manip_int* __cdecl setbase(manip_int *ret, int base)
8042 TRACE("(%p %d)\n", ret, base);
8044 ret->pfunc = setbase_func;
8045 ret->arg = base;
8046 return ret;
8049 static basic_filebuf_char filebuf_char_stdin;
8050 /* ?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A */
8051 struct {
8052 basic_istream_char obj;
8053 basic_ios_char vbase;
8054 } cin = { { 0 } };
8055 /* ?_Ptr_cin@std@@3PAV?$basic_istream@DU?$char_traits@D@std@@@1@A */
8056 /* ?_Ptr_cin@std@@3PEAV?$basic_istream@DU?$char_traits@D@std@@@1@EA */
8057 basic_istream_char *_Ptr_cin = &cin.obj;
8059 static basic_filebuf_wchar filebuf_short_stdin;
8060 /* ?wcin@std@@3V?$basic_istream@GU?$char_traits@G@std@@@1@A */
8061 struct {
8062 basic_istream_wchar obj;
8063 basic_ios_wchar vbase;
8064 } ucin = { { 0 } };
8065 /* ?_Ptr_wcin@std@@3PAV?$basic_istream@GU?$char_traits@G@std@@@1@A */
8066 /* ?_Ptr_wcin@std@@3PEAV?$basic_istream@GU?$char_traits@G@std@@@1@EA */
8067 basic_istream_wchar *_Ptr_ucin = &ucin.obj;
8069 static basic_filebuf_wchar filebuf_wchar_stdin;
8070 /* ?wcin@std@@3V?$basic_istream@_WU?$char_traits@_W@std@@@1@A */
8071 struct {
8072 basic_istream_wchar obj;
8073 basic_ios_wchar vbase;
8074 } wcin = { { 0 } };
8075 /* ?_Ptr_wcin@std@@3PAV?$basic_istream@_WU?$char_traits@_W@std@@@1@A */
8076 /* ?_Ptr_wcin@std@@3PEAV?$basic_istream@_WU?$char_traits@_W@std@@@1@EA */
8077 basic_istream_wchar *_Ptr_wcin = &wcin.obj;
8079 static basic_filebuf_char filebuf_char_stdout;
8080 /* ?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A */
8081 struct {
8082 basic_ostream_char obj;
8083 basic_ios_char vbase;
8084 } cout = { { 0 } };
8085 /* ?_Ptr_cout@std@@3PAV?$basic_ostream@DU?$char_traits@D@std@@@1@A */
8086 /* ?_Ptr_cout@std@@3PEAV?$basic_ostream@DU?$char_traits@D@std@@@1@EA */
8087 basic_ostream_char *_Ptr_cout = &cout.obj;
8089 static basic_filebuf_wchar filebuf_short_stdout;
8090 /* ?wcout@std@@3V?$basic_ostream@GU?$char_traits@G@std@@@1@A */
8091 struct {
8092 basic_ostream_wchar obj;
8093 basic_ios_wchar vbase;
8094 } ucout = { { 0 } };
8095 /* ?_Ptr_wcout@std@@3PAV?$basic_ostream@GU?$char_traits@G@std@@@1@A */
8096 /* ?_Ptr_wcout@std@@3PEAV?$basic_ostream@GU?$char_traits@G@std@@@1@EA */
8097 basic_ostream_wchar *_Ptr_ucout = &ucout.obj;
8099 static basic_filebuf_wchar filebuf_wchar_stdout;
8100 /* ?wcout@std@@3V?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
8101 struct {
8102 basic_ostream_wchar obj;
8103 basic_ios_wchar vbase;
8104 } wcout = { { 0 } };
8105 /* ?_Ptr_wcout@std@@3PAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
8106 /* ?_Ptr_wcout@std@@3PEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@EA */
8107 basic_ostream_wchar *_Ptr_wcout = &wcout.obj;
8109 static basic_filebuf_char filebuf_char_stderr;
8110 /* ?cerr@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A */
8111 struct {
8112 basic_ostream_char obj;
8113 basic_ios_char vbase;
8114 } cerr = { { 0 } };
8115 /* ?_Ptr_cerr@std@@3PAV?$basic_ostream@DU?$char_traits@D@std@@@1@A */
8116 /* ?_Ptr_cerr@std@@3PEAV?$basic_ostream@DU?$char_traits@D@std@@@1@EA */
8117 basic_ostream_char *_Ptr_cerr = &cerr.obj;
8119 static basic_filebuf_wchar filebuf_short_stderr;
8120 /* ?wcerr@std@@3V?$basic_ostream@GU?$char_traits@G@std@@@1@A */
8121 struct {
8122 basic_ostream_wchar obj;
8123 basic_ios_wchar vbase;
8124 } ucerr = { { 0 } };
8125 /* ?_Ptr_wcerr@std@@3PAV?$basic_ostream@GU?$char_traits@G@std@@@1@A */
8126 /* ?_Ptr_wcerr@std@@3PEAV?$basic_ostream@GU?$char_traits@G@std@@@1@EA */
8127 basic_ostream_wchar *_Ptr_ucerr = &ucerr.obj;
8129 static basic_filebuf_wchar filebuf_wchar_stderr;
8130 /* ?wcerr@std@@3V?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
8131 struct {
8132 basic_ostream_wchar obj;
8133 basic_ios_wchar vbase;
8134 } wcerr = { { 0 } };
8135 /* ?_Ptr_wcerr@std@@3PAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
8136 /* ?_Ptr_wcerr@std@@3PEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@EA */
8137 basic_ostream_wchar *_Ptr_wcerr = &wcerr.obj;
8139 static basic_filebuf_char filebuf_char_log;
8140 /* ?clog@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A */
8141 struct {
8142 basic_ostream_char obj;
8143 basic_ios_char vbase;
8144 } clog = { { 0 } };
8145 /* ?_Ptr_clog@std@@3PAV?$basic_ostream@DU?$char_traits@D@std@@@1@A */
8146 /* ?_Ptr_clog@std@@3PEAV?$basic_ostream@DU?$char_traits@D@std@@@1@EA */
8147 basic_ostream_char *_Ptr_clog = &clog.obj;
8149 static basic_filebuf_wchar filebuf_short_log;
8150 /* ?wclog@std@@3V?$basic_ostream@GU?$char_traits@G@std@@@1@A */
8151 struct {
8152 basic_ostream_wchar obj;
8153 basic_ios_wchar vbase;
8154 } uclog = { { 0 } };
8155 /* ?_Ptr_wclog@std@@3PAV?$basic_ostream@GU?$char_traits@G@std@@@1@A */
8156 /* ?_Ptr_wclog@std@@3PEAV?$basic_ostream@GU?$char_traits@G@std@@@1@EA */
8157 basic_ostream_wchar *_Ptr_uclog = &uclog.obj;
8159 static basic_filebuf_wchar filebuf_wchar_log;
8160 /* ?wclog@std@@3V?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
8161 struct {
8162 basic_ostream_wchar obj;
8163 basic_ios_wchar vbase;
8164 } wclog = { { 0 } };
8165 /* ?_Ptr_wclog@std@@3PAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@A */
8166 /* ?_Ptr_wclog@std@@3PEAV?$basic_ostream@_WU?$char_traits@_W@std@@@1@EA */
8167 basic_ostream_wchar *_Ptr_wclog = &wclog.obj;
8169 /* ?_Init_cnt@Init@ios_base@std@@0HA */
8170 int ios_base_Init__Init_cnt = -1;
8172 /* ?_Init_cnt_func@Init@ios_base@std@@CAAAHXZ */
8173 /* ?_Init_cnt_func@Init@ios_base@std@@CAAEAHXZ */
8174 int* __cdecl ios_base_Init__Init_cnt_func(void)
8176 return &ios_base_Init__Init_cnt;
8179 /* ?_Init_ctor@Init@ios_base@std@@CAXPAV123@@Z */
8180 /* ?_Init_ctor@Init@ios_base@std@@CAXPEAV123@@Z */
8181 void __cdecl ios_base_Init__Init_ctor(void *this)
8183 TRACE("(%p)\n", this);
8185 if(ios_base_Init__Init_cnt < 0)
8186 ios_base_Init__Init_cnt = 1;
8187 else
8188 ios_base_Init__Init_cnt++;
8191 /* ??0Init@ios_base@std@@QAE@XZ */
8192 /* ??0Init@ios_base@std@@QEAA@XZ */
8193 DEFINE_THISCALL_WRAPPER(ios_base_Init_ctor, 4)
8194 void* __thiscall ios_base_Init_ctor(void *this)
8196 ios_base_Init__Init_ctor(this);
8197 return this;
8200 /* ?_Init_dtor@Init@ios_base@std@@CAXPAV123@@Z */
8201 /* ?_Init_dtor@Init@ios_base@std@@CAXPEAV123@@Z */
8202 void __cdecl ios_base_Init__Init_dtor(void *this)
8204 TRACE("(%p)\n", this);
8206 ios_base_Init__Init_cnt--;
8207 if(!ios_base_Init__Init_cnt) {
8208 basic_ostream_char_flush(&cout.obj);
8209 basic_ostream_char_flush(&cerr.obj);
8210 basic_ostream_char_flush(&clog.obj);
8214 /* ??1Init@ios_base@std@@QAE@XZ */
8215 /* ??1Init@ios_base@std@@QEAA@XZ */
8216 DEFINE_THISCALL_WRAPPER(ios_base_Init_dtor, 4)
8217 void __thiscall ios_base_Init_dtor(void *this)
8219 ios_base_Init__Init_dtor(this);
8222 /* ??4Init@ios_base@std@@QAEAAV012@ABV012@@Z */
8223 /* ??4Init@ios_base@std@@QEAAAEAV012@AEBV012@@Z */
8224 DEFINE_THISCALL_WRAPPER(ios_base_Init_op_assign, 8)
8225 void* __thiscall ios_base_Init_op_assign(void *this, void *rhs)
8227 TRACE("(%p %p)\n", this, rhs);
8228 return this;
8231 /* ?_Init_cnt@_Winit@std@@0HA */
8232 int _Winit__Init_cnt = -1;
8234 /* ??0_Winit@std@@QAE@XZ */
8235 /* ??0_Winit@std@@QEAA@XZ */
8236 DEFINE_THISCALL_WRAPPER(_Winit_ctor, 4)
8237 void* __thiscall _Winit_ctor(void *this)
8239 TRACE("(%p)\n", this);
8241 if(_Winit__Init_cnt < 0)
8242 _Winit__Init_cnt = 1;
8243 else
8244 _Winit__Init_cnt++;
8246 return this;
8249 /* ??1_Winit@std@@QAE@XZ */
8250 /* ??1_Winit@std@@QAE@XZ */
8251 DEFINE_THISCALL_WRAPPER(_Winit_dtor, 4)
8252 void __thiscall _Winit_dtor(void *this)
8254 TRACE("(%p)\n", this);
8256 _Winit__Init_cnt--;
8257 if(!_Winit__Init_cnt) {
8258 basic_ostream_wchar_flush(&wcout.obj);
8259 basic_ostream_wchar_flush(&wcerr.obj);
8260 basic_ostream_wchar_flush(&wclog.obj);
8264 /* ??4_Winit@std@@QAEAAV01@ABV01@@Z */
8265 /* ??4_Winit@std@@QEAAAEAV01@AEBV01@@Z */
8266 DEFINE_THISCALL_WRAPPER(_Winit_op_assign, 8)
8267 void* __thiscall _Winit_op_assign(void *this, void *rhs)
8269 TRACE("(%p %p)\n", this, rhs);
8270 return this;
8273 void init_io(void *base)
8275 #ifdef __x86_64__
8276 init_iosb_rtti(base);
8277 init_ios_base_rtti(base);
8278 init_basic_ios_char_rtti(base);
8279 init_basic_ios_wchar_rtti(base);
8280 init_basic_ios_short_rtti(base);
8281 init_basic_streambuf_char_rtti(base);
8282 init_basic_streambuf_wchar_rtti(base);
8283 init_basic_streambuf_short_rtti(base);
8284 init_basic_filebuf_char_rtti(base);
8285 init_basic_filebuf_wchar_rtti(base);
8286 init_basic_filebuf_short_rtti(base);
8287 init_basic_ostream_char_rtti(base);
8288 init_basic_ostream_wchar_rtti(base);
8289 init_basic_ostream_short_rtti(base);
8290 init_basic_istream_char_rtti(base);
8291 init_basic_istream_wchar_rtti(base);
8292 init_basic_istream_short_rtti(base);
8293 init_basic_iostream_char_rtti(base);
8294 init_basic_iostream_wchar_rtti(base);
8295 init_basic_iostream_short_rtti(base);
8296 #endif
8298 basic_filebuf_char_ctor_file(&filebuf_char_stdin, stdin);
8299 basic_istream_char_ctor(&cin.obj, &filebuf_char_stdin.base, FALSE/*FIXME*/, TRUE);
8301 basic_filebuf_short_ctor_file(&filebuf_short_stdin, stdin);
8302 basic_istream_short_ctor(&ucin.obj, &filebuf_short_stdin.base, FALSE/*FIXME*/, TRUE);
8304 basic_filebuf_wchar_ctor_file(&filebuf_wchar_stdin, stdin);
8305 basic_istream_wchar_ctor(&wcin.obj, &filebuf_wchar_stdin.base, FALSE/*FIXME*/, TRUE);
8307 basic_filebuf_char_ctor_file(&filebuf_char_stdout, stdout);
8308 basic_ostream_char_ctor(&cout.obj, &filebuf_char_stdout.base, FALSE/*FIXME*/, TRUE);
8310 basic_filebuf_short_ctor_file(&filebuf_short_stdout, stdout);
8311 basic_ostream_short_ctor(&ucout.obj, &filebuf_short_stdout.base, FALSE/*FIXME*/, TRUE);
8313 basic_filebuf_wchar_ctor_file(&filebuf_wchar_stdout, stdout);
8314 basic_ostream_wchar_ctor(&wcout.obj, &filebuf_wchar_stdout.base, FALSE/*FIXME*/, TRUE);
8316 basic_filebuf_char_ctor_file(&filebuf_char_stderr, stderr);
8317 basic_ostream_char_ctor(&cerr.obj, &filebuf_char_stderr.base, FALSE/*FIXME*/, TRUE);
8319 basic_filebuf_short_ctor_file(&filebuf_short_stderr, stderr);
8320 basic_ostream_short_ctor(&ucerr.obj, &filebuf_short_stderr.base, FALSE/*FIXME*/, TRUE);
8322 basic_filebuf_wchar_ctor_file(&filebuf_wchar_stderr, stderr);
8323 basic_ostream_wchar_ctor(&wcerr.obj, &filebuf_wchar_stderr.base, FALSE/*FIXME*/, TRUE);
8325 basic_filebuf_char_ctor_file(&filebuf_char_log, stderr);
8326 basic_ostream_char_ctor(&clog.obj, &filebuf_char_log.base, FALSE/*FIXME*/, TRUE);
8328 basic_filebuf_short_ctor_file(&filebuf_short_log, stderr);
8329 basic_ostream_short_ctor(&uclog.obj, &filebuf_short_log.base, FALSE/*FIXME*/, TRUE);
8331 basic_filebuf_wchar_ctor_file(&filebuf_wchar_log, stderr);
8332 basic_ostream_wchar_ctor(&wclog.obj, &filebuf_wchar_log.base, FALSE/*FIXME*/, TRUE);
8335 void free_io(void)
8337 basic_istream_char_vbase_dtor(&cin.obj);
8338 basic_filebuf_char_dtor(&filebuf_char_stdin);
8340 basic_istream_wchar_vbase_dtor(&ucin.obj);
8341 basic_filebuf_wchar_dtor(&filebuf_short_stdin);
8343 basic_istream_wchar_vbase_dtor(&wcin.obj);
8344 basic_filebuf_wchar_dtor(&filebuf_wchar_stdin);
8346 basic_ostream_char_vbase_dtor(&cout.obj);
8347 basic_filebuf_char_dtor(&filebuf_char_stdout);
8349 basic_ostream_wchar_vbase_dtor(&ucout.obj);
8350 basic_filebuf_wchar_dtor(&filebuf_short_stdout);
8352 basic_ostream_wchar_vbase_dtor(&wcout.obj);
8353 basic_filebuf_wchar_dtor(&filebuf_wchar_stdout);
8355 basic_ostream_char_vbase_dtor(&cerr.obj);
8356 basic_filebuf_char_dtor(&filebuf_char_stderr);
8358 basic_ostream_wchar_vbase_dtor(&ucerr.obj);
8359 basic_filebuf_wchar_dtor(&filebuf_short_stderr);
8361 basic_ostream_wchar_vbase_dtor(&wcerr.obj);
8362 basic_filebuf_wchar_dtor(&filebuf_wchar_stderr);
8364 basic_ostream_char_vbase_dtor(&clog.obj);
8365 basic_filebuf_char_dtor(&filebuf_char_log);
8367 basic_ostream_wchar_vbase_dtor(&uclog.obj);
8368 basic_filebuf_wchar_dtor(&filebuf_short_log);
8370 basic_ostream_wchar_vbase_dtor(&wclog.obj);
8371 basic_filebuf_wchar_dtor(&filebuf_wchar_log);