2 * Copyright (C) 2007 Alexandre Julliard
3 * Copyright (C) 2015-2016 Iván Matellanes
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
32 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(msvcirt
);
36 #define RESERVE_SIZE 512
37 #define STATEBUF_SIZE 8
39 /* ?sh_none@filebuf@@2HB */
40 const int filebuf_sh_none
= 0x800;
41 /* ?sh_read@filebuf@@2HB */
42 const int filebuf_sh_read
= 0xa00;
43 /* ?sh_write@filebuf@@2HB */
44 const int filebuf_sh_write
= 0xc00;
45 /* ?openprot@filebuf@@2HB */
46 const int filebuf_openprot
= 420;
47 /* ?binary@filebuf@@2HB */
48 const int filebuf_binary
= _O_BINARY
;
49 /* ?text@filebuf@@2HB */
50 const int filebuf_text
= _O_TEXT
;
52 /* ?adjustfield@ios@@2JB */
53 const LONG ios_adjustfield
= FLAGS_left
| FLAGS_right
| FLAGS_internal
;
54 /* ?basefield@ios@@2JB */
55 const LONG ios_basefield
= FLAGS_dec
| FLAGS_oct
| FLAGS_hex
;
56 /* ?floatfield@ios@@2JB */
57 const LONG ios_floatfield
= FLAGS_scientific
| FLAGS_fixed
;
58 /* ?fLockcInit@ios@@0HA */
59 /* FIXME: should be initialized to 0 and increased on construction of cin, cout, cerr and clog */
60 int ios_fLockcInit
= 4;
61 /* ?x_lockc@ios@@0U_CRT_CRITICAL_SECTION@@A */
62 extern CRITICAL_SECTION ios_static_lock
;
63 CRITICAL_SECTION_DEBUG ios_static_lock_debug
=
65 0, 0, &ios_static_lock
,
66 { &ios_static_lock_debug
.ProcessLocksList
, &ios_static_lock_debug
.ProcessLocksList
},
67 0, 0, { (DWORD_PTR
)(__FILE__
": ios_static_lock") }
69 CRITICAL_SECTION ios_static_lock
= { &ios_static_lock_debug
, -1, 0, 0, 0, 0 };
70 /* ?x_maxbit@ios@@0JA */
71 LONG ios_maxbit
= 0x8000;
72 /* ?x_curindex@ios@@0HA */
73 int ios_curindex
= -1;
74 /* ?x_statebuf@ios@@0PAJA */
75 LONG ios_statebuf
[STATEBUF_SIZE
] = {0};
79 const vtable_ptr
*vtable
;
92 CRITICAL_SECTION lock
;
95 void __thiscall
streambuf_setb(streambuf
*, char*, char*, int);
96 streambuf
* __thiscall
streambuf_setbuf(streambuf
*, char*, int);
97 void __thiscall
streambuf_setg(streambuf
*, char*, char*, char*);
98 void __thiscall
streambuf_setp(streambuf
*, char*, char*);
107 filebuf
* __thiscall
filebuf_close(filebuf
*);
109 /* class strstreambuf */
116 allocFunction f_alloc
;
129 const vtable_ptr
*vtable
;
134 struct _ostream
*tie
;
140 CRITICAL_SECTION lock
;
143 ios
* __thiscall
ios_assign(ios
*, const ios
*);
144 int __thiscall
ios_fail(const ios
*);
145 void __cdecl
ios_lock(ios
*);
146 void __cdecl
ios_lockc(void);
147 LONG __thiscall
ios_setf_mask(ios
*, LONG
, LONG
);
148 void __cdecl
ios_unlock(ios
*);
149 void __cdecl
ios_unlockc(void);
152 typedef struct _ostream
{
157 /* ??_7streambuf@@6B@ */
158 extern const vtable_ptr MSVCP_streambuf_vtable
;
159 /* ??_7filebuf@@6B@ */
160 extern const vtable_ptr MSVCP_filebuf_vtable
;
161 /* ??_7strstreambuf@@6B@ */
162 extern const vtable_ptr MSVCP_strstreambuf_vtable
;
163 /* ??_7stdiobuf@@6B@ */
164 extern const vtable_ptr MSVCP_stdiobuf_vtable
;
166 extern const vtable_ptr MSVCP_ios_vtable
;
167 /* ??_7ostream@@6B@ */
168 extern const vtable_ptr MSVCP_ostream_vtable
;
171 void __asm_dummy_vtables(void) {
173 __ASM_VTABLE(streambuf
,
174 VTABLE_ADD_FUNC(streambuf_vector_dtor
)
175 VTABLE_ADD_FUNC(streambuf_sync
)
176 VTABLE_ADD_FUNC(streambuf_setbuf
)
177 VTABLE_ADD_FUNC(streambuf_seekoff
)
178 VTABLE_ADD_FUNC(streambuf_seekpos
)
179 VTABLE_ADD_FUNC(streambuf_xsputn
)
180 VTABLE_ADD_FUNC(streambuf_xsgetn
)
181 VTABLE_ADD_FUNC(streambuf_overflow
)
182 VTABLE_ADD_FUNC(streambuf_underflow
)
183 VTABLE_ADD_FUNC(streambuf_pbackfail
)
184 VTABLE_ADD_FUNC(streambuf_doallocate
));
185 __ASM_VTABLE(filebuf
,
186 VTABLE_ADD_FUNC(filebuf_vector_dtor
)
187 VTABLE_ADD_FUNC(filebuf_sync
)
188 VTABLE_ADD_FUNC(filebuf_setbuf
)
189 VTABLE_ADD_FUNC(filebuf_seekoff
)
190 VTABLE_ADD_FUNC(streambuf_seekpos
)
191 VTABLE_ADD_FUNC(streambuf_xsputn
)
192 VTABLE_ADD_FUNC(streambuf_xsgetn
)
193 VTABLE_ADD_FUNC(filebuf_overflow
)
194 VTABLE_ADD_FUNC(filebuf_underflow
)
195 VTABLE_ADD_FUNC(streambuf_pbackfail
)
196 VTABLE_ADD_FUNC(streambuf_doallocate
));
197 __ASM_VTABLE(strstreambuf
,
198 VTABLE_ADD_FUNC(strstreambuf_vector_dtor
)
199 VTABLE_ADD_FUNC(strstreambuf_sync
)
200 VTABLE_ADD_FUNC(strstreambuf_setbuf
)
201 VTABLE_ADD_FUNC(strstreambuf_seekoff
)
202 VTABLE_ADD_FUNC(streambuf_seekpos
)
203 VTABLE_ADD_FUNC(streambuf_xsputn
)
204 VTABLE_ADD_FUNC(streambuf_xsgetn
)
205 VTABLE_ADD_FUNC(strstreambuf_overflow
)
206 VTABLE_ADD_FUNC(strstreambuf_underflow
)
207 VTABLE_ADD_FUNC(streambuf_pbackfail
)
208 VTABLE_ADD_FUNC(strstreambuf_doallocate
));
209 __ASM_VTABLE(stdiobuf
,
210 VTABLE_ADD_FUNC(stdiobuf_vector_dtor
)
211 VTABLE_ADD_FUNC(stdiobuf_sync
)
212 VTABLE_ADD_FUNC(streambuf_setbuf
)
213 VTABLE_ADD_FUNC(stdiobuf_seekoff
)
214 VTABLE_ADD_FUNC(streambuf_seekpos
)
215 VTABLE_ADD_FUNC(streambuf_xsputn
)
216 VTABLE_ADD_FUNC(streambuf_xsgetn
)
217 VTABLE_ADD_FUNC(stdiobuf_overflow
)
218 VTABLE_ADD_FUNC(stdiobuf_underflow
)
219 VTABLE_ADD_FUNC(stdiobuf_pbackfail
)
220 VTABLE_ADD_FUNC(streambuf_doallocate
));
222 VTABLE_ADD_FUNC(ios_vector_dtor
));
223 __ASM_VTABLE(ostream
,
224 VTABLE_ADD_FUNC(ostream_vector_dtor
));
229 #define ALIGNED_SIZE(size, alignment) (((size)+((alignment)-1))/(alignment)*(alignment))
230 #define VBTABLE_ENTRY(class, offset, vbase) ALIGNED_SIZE(sizeof(class), TYPE_ALIGNMENT(vbase))-offset
232 /* ??_8ostream@@7B@ */
233 const int ostream_vbtable
[] = {0, VBTABLE_ENTRY(ostream
, FIELD_OFFSET(ostream
, vbtable
), ios
)};
235 DEFINE_RTTI_DATA0(streambuf
, 0, ".?AVstreambuf@@")
236 DEFINE_RTTI_DATA1(filebuf
, 0, &streambuf_rtti_base_descriptor
, ".?AVfilebuf@@")
237 DEFINE_RTTI_DATA1(strstreambuf
, 0, &streambuf_rtti_base_descriptor
, ".?AVstrstreambuf@@")
238 DEFINE_RTTI_DATA1(stdiobuf
, 0, &streambuf_rtti_base_descriptor
, ".?AVstdiobuf@@")
239 DEFINE_RTTI_DATA0(ios
, 0, ".?AVios@@")
240 DEFINE_RTTI_DATA1(ostream
, sizeof(ostream
), &ios_rtti_base_descriptor
, ".?AVostream@@")
242 /* ??0streambuf@@IAE@PADH@Z */
243 /* ??0streambuf@@IEAA@PEADH@Z */
244 DEFINE_THISCALL_WRAPPER(streambuf_reserve_ctor
, 12)
245 streambuf
* __thiscall
streambuf_reserve_ctor(streambuf
*this, char *buffer
, int length
)
247 TRACE("(%p %p %d)\n", this, buffer
, length
);
248 this->vtable
= &MSVCP_streambuf_vtable
;
250 this->stored_char
= EOF
;
253 streambuf_setbuf(this, buffer
, length
);
254 streambuf_setg(this, NULL
, NULL
, NULL
);
255 streambuf_setp(this, NULL
, NULL
);
256 InitializeCriticalSection(&this->lock
);
260 /* ??0streambuf@@IAE@XZ */
261 /* ??0streambuf@@IEAA@XZ */
262 DEFINE_THISCALL_WRAPPER(streambuf_ctor
, 4)
263 streambuf
* __thiscall
streambuf_ctor(streambuf
*this)
265 streambuf_reserve_ctor(this, NULL
, 0);
266 this->unbuffered
= 0;
270 /* ??0streambuf@@QAE@ABV0@@Z */
271 /* ??0streambuf@@QEAA@AEBV0@@Z */
272 DEFINE_THISCALL_WRAPPER(streambuf_copy_ctor
, 8)
273 streambuf
* __thiscall
streambuf_copy_ctor(streambuf
*this, const streambuf
*copy
)
275 TRACE("(%p %p)\n", this, copy
);
277 this->vtable
= &MSVCP_streambuf_vtable
;
281 /* ??1streambuf@@UAE@XZ */
282 /* ??1streambuf@@UEAA@XZ */
283 DEFINE_THISCALL_WRAPPER(streambuf_dtor
, 4)
284 void __thiscall
streambuf_dtor(streambuf
*this)
286 TRACE("(%p)\n", this);
288 MSVCRT_operator_delete(this->base
);
289 DeleteCriticalSection(&this->lock
);
292 /* ??4streambuf@@QAEAAV0@ABV0@@Z */
293 /* ??4streambuf@@QEAAAEAV0@AEBV0@@Z */
294 DEFINE_THISCALL_WRAPPER(streambuf_assign
, 8)
295 streambuf
* __thiscall
streambuf_assign(streambuf
*this, const streambuf
*rhs
)
297 streambuf_dtor(this);
298 return streambuf_copy_ctor(this, rhs
);
301 /* ??_Estreambuf@@UAEPAXI@Z */
302 DEFINE_THISCALL_WRAPPER(streambuf_vector_dtor
, 8)
303 #define call_streambuf_vector_dtor(this, flags) CALL_VTBL_FUNC(this, 0,\
304 streambuf*, (streambuf*, unsigned int), (this, flags))
305 streambuf
* __thiscall
streambuf_vector_dtor(streambuf
*this, unsigned int flags
)
307 TRACE("(%p %x)\n", this, flags
);
309 /* we have an array, with the number of elements stored before the first object */
310 INT_PTR i
, *ptr
= (INT_PTR
*)this-1;
312 for (i
= *ptr
-1; i
>= 0; i
--)
313 streambuf_dtor(this+i
);
314 MSVCRT_operator_delete(ptr
);
316 streambuf_dtor(this);
318 MSVCRT_operator_delete(this);
323 /* ??_Gstreambuf@@UAEPAXI@Z */
324 DEFINE_THISCALL_WRAPPER(streambuf_scalar_dtor
, 8)
325 streambuf
* __thiscall
streambuf_scalar_dtor(streambuf
*this, unsigned int flags
)
327 TRACE("(%p %x)\n", this, flags
);
328 streambuf_dtor(this);
329 if (flags
& 1) MSVCRT_operator_delete(this);
333 /* ?doallocate@streambuf@@MAEHXZ */
334 /* ?doallocate@streambuf@@MEAAHXZ */
335 DEFINE_THISCALL_WRAPPER(streambuf_doallocate
, 4)
336 #define call_streambuf_doallocate(this) CALL_VTBL_FUNC(this, 40, int, (streambuf*), (this))
337 int __thiscall
streambuf_doallocate(streambuf
*this)
341 TRACE("(%p)\n", this);
342 reserve
= MSVCRT_operator_new(RESERVE_SIZE
);
346 streambuf_setb(this, reserve
, reserve
+ RESERVE_SIZE
, 1);
350 /* ?allocate@streambuf@@IAEHXZ */
351 /* ?allocate@streambuf@@IEAAHXZ */
352 DEFINE_THISCALL_WRAPPER(streambuf_allocate
, 4)
353 int __thiscall
streambuf_allocate(streambuf
*this)
355 TRACE("(%p)\n", this);
356 if (this->base
!= NULL
|| this->unbuffered
)
358 return call_streambuf_doallocate(this);
361 /* ?base@streambuf@@IBEPADXZ */
362 /* ?base@streambuf@@IEBAPEADXZ */
363 DEFINE_THISCALL_WRAPPER(streambuf_base
, 4)
364 char* __thiscall
streambuf_base(const streambuf
*this)
366 TRACE("(%p)\n", this);
370 /* ?blen@streambuf@@IBEHXZ */
371 /* ?blen@streambuf@@IEBAHXZ */
372 DEFINE_THISCALL_WRAPPER(streambuf_blen
, 4)
373 int __thiscall
streambuf_blen(const streambuf
*this)
375 TRACE("(%p)\n", this);
376 return this->ebuf
- this->base
;
379 /* ?eback@streambuf@@IBEPADXZ */
380 /* ?eback@streambuf@@IEBAPEADXZ */
381 DEFINE_THISCALL_WRAPPER(streambuf_eback
, 4)
382 char* __thiscall
streambuf_eback(const streambuf
*this)
384 TRACE("(%p)\n", this);
388 /* ?ebuf@streambuf@@IBEPADXZ */
389 /* ?ebuf@streambuf@@IEBAPEADXZ */
390 DEFINE_THISCALL_WRAPPER(streambuf_ebuf
, 4)
391 char* __thiscall
streambuf_ebuf(const streambuf
*this)
393 TRACE("(%p)\n", this);
397 /* ?egptr@streambuf@@IBEPADXZ */
398 /* ?egptr@streambuf@@IEBAPEADXZ */
399 DEFINE_THISCALL_WRAPPER(streambuf_egptr
, 4)
400 char* __thiscall
streambuf_egptr(const streambuf
*this)
402 TRACE("(%p)\n", this);
406 /* ?epptr@streambuf@@IBEPADXZ */
407 /* ?epptr@streambuf@@IEBAPEADXZ */
408 DEFINE_THISCALL_WRAPPER(streambuf_epptr
, 4)
409 char* __thiscall
streambuf_epptr(const streambuf
*this)
411 TRACE("(%p)\n", this);
415 /* ?gptr@streambuf@@IBEPADXZ */
416 /* ?gptr@streambuf@@IEBAPEADXZ */
417 DEFINE_THISCALL_WRAPPER(streambuf_gptr
, 4)
418 char* __thiscall
streambuf_gptr(const streambuf
*this)
420 TRACE("(%p)\n", this);
424 /* ?pbase@streambuf@@IBEPADXZ */
425 /* ?pbase@streambuf@@IEBAPEADXZ */
426 DEFINE_THISCALL_WRAPPER(streambuf_pbase
, 4)
427 char* __thiscall
streambuf_pbase(const streambuf
*this)
429 TRACE("(%p)\n", this);
433 /* ?pptr@streambuf@@IBEPADXZ */
434 /* ?pptr@streambuf@@IEBAPEADXZ */
435 DEFINE_THISCALL_WRAPPER(streambuf_pptr
, 4)
436 char* __thiscall
streambuf_pptr(const streambuf
*this)
438 TRACE("(%p)\n", this);
442 /* ?clrlock@streambuf@@QAEXXZ */
443 /* ?clrlock@streambuf@@QEAAXXZ */
444 DEFINE_THISCALL_WRAPPER(streambuf_clrlock
, 4)
445 void __thiscall
streambuf_clrlock(streambuf
*this)
447 TRACE("(%p)\n", this);
448 if (this->do_lock
<= 0)
452 /* ?lock@streambuf@@QAEXXZ */
453 /* ?lock@streambuf@@QEAAXXZ */
454 DEFINE_THISCALL_WRAPPER(streambuf_lock
, 4)
455 void __thiscall
streambuf_lock(streambuf
*this)
457 TRACE("(%p)\n", this);
458 if (this->do_lock
< 0)
459 EnterCriticalSection(&this->lock
);
462 /* ?lockptr@streambuf@@IAEPAU_CRT_CRITICAL_SECTION@@XZ */
463 /* ?lockptr@streambuf@@IEAAPEAU_CRT_CRITICAL_SECTION@@XZ */
464 DEFINE_THISCALL_WRAPPER(streambuf_lockptr
, 4)
465 CRITICAL_SECTION
* __thiscall
streambuf_lockptr(streambuf
*this)
467 TRACE("(%p)\n", this);
471 /* ?gbump@streambuf@@IAEXH@Z */
472 /* ?gbump@streambuf@@IEAAXH@Z */
473 DEFINE_THISCALL_WRAPPER(streambuf_gbump
, 8)
474 void __thiscall
streambuf_gbump(streambuf
*this, int count
)
476 TRACE("(%p %d)\n", this, count
);
480 /* ?pbump@streambuf@@IAEXH@Z */
481 /* ?pbump@streambuf@@IEAAXH@Z */
482 DEFINE_THISCALL_WRAPPER(streambuf_pbump
, 8)
483 void __thiscall
streambuf_pbump(streambuf
*this, int count
)
485 TRACE("(%p %d)\n", this, count
);
489 /* ?in_avail@streambuf@@QBEHXZ */
490 /* ?in_avail@streambuf@@QEBAHXZ */
491 DEFINE_THISCALL_WRAPPER(streambuf_in_avail
, 4)
492 int __thiscall
streambuf_in_avail(const streambuf
*this)
494 TRACE("(%p)\n", this);
495 return this->egptr
- this->gptr
;
498 /* ?out_waiting@streambuf@@QBEHXZ */
499 /* ?out_waiting@streambuf@@QEBAHXZ */
500 DEFINE_THISCALL_WRAPPER(streambuf_out_waiting
, 4)
501 int __thiscall
streambuf_out_waiting(const streambuf
*this)
503 TRACE("(%p)\n", this);
504 return this->pptr
- this->pbase
;
508 DEFINE_THISCALL_WRAPPER(streambuf_overflow
, 8)
509 #define call_streambuf_overflow(this, c) CALL_VTBL_FUNC(this, 28, int, (streambuf*, int), (this, c))
510 int __thiscall
streambuf_overflow(streambuf
*this, int c
)
512 ERR("overflow is not implemented in streambuf\n");
516 /* ?seekoff@streambuf@@UAEJJW4seek_dir@ios@@H@Z */
517 /* ?seekoff@streambuf@@UEAAJJW4seek_dir@ios@@H@Z */
518 DEFINE_THISCALL_WRAPPER(streambuf_seekoff
, 16)
519 #define call_streambuf_seekoff(this, off, dir, mode) CALL_VTBL_FUNC(this, 12, streampos, (streambuf*, streamoff, ios_seek_dir, int), (this, off, dir, mode))
520 streampos __thiscall
streambuf_seekoff(streambuf
*this, streamoff offset
, ios_seek_dir dir
, int mode
)
522 TRACE("(%p %d %d %d)\n", this, offset
, dir
, mode
);
526 /* ?seekpos@streambuf@@UAEJJH@Z */
527 /* ?seekpos@streambuf@@UEAAJJH@Z */
528 DEFINE_THISCALL_WRAPPER(streambuf_seekpos
, 12)
529 streampos __thiscall
streambuf_seekpos(streambuf
*this, streampos pos
, int mode
)
531 TRACE("(%p %d %d)\n", this, pos
, mode
);
532 return call_streambuf_seekoff(this, pos
, SEEKDIR_beg
, mode
);
535 /* ?pbackfail@streambuf@@UAEHH@Z */
536 /* ?pbackfail@streambuf@@UEAAHH@Z */
537 DEFINE_THISCALL_WRAPPER(streambuf_pbackfail
, 8)
538 #define call_streambuf_pbackfail(this, c) CALL_VTBL_FUNC(this, 36, int, (streambuf*, int), (this, c))
539 int __thiscall
streambuf_pbackfail(streambuf
*this, int c
)
541 TRACE("(%p %d)\n", this, c
);
542 if (this->gptr
> this->eback
)
543 return *--this->gptr
= c
;
544 if (call_streambuf_seekoff(this, -1, SEEKDIR_cur
, OPENMODE_in
) == EOF
)
546 if (!this->unbuffered
&& this->egptr
) {
547 /* 'c' should be the next character read */
548 memmove(this->gptr
+ 1, this->gptr
, this->egptr
- this->gptr
- 1);
554 /* ?setb@streambuf@@IAEXPAD0H@Z */
555 /* ?setb@streambuf@@IEAAXPEAD0H@Z */
556 DEFINE_THISCALL_WRAPPER(streambuf_setb
, 16)
557 void __thiscall
streambuf_setb(streambuf
*this, char *ba
, char *eb
, int delete)
559 TRACE("(%p %p %p %d)\n", this, ba
, eb
, delete);
561 MSVCRT_operator_delete(this->base
);
562 this->allocated
= delete;
567 /* ?setbuf@streambuf@@UAEPAV1@PADH@Z */
568 /* ?setbuf@streambuf@@UEAAPEAV1@PEADH@Z */
569 DEFINE_THISCALL_WRAPPER(streambuf_setbuf
, 12)
570 streambuf
* __thiscall
streambuf_setbuf(streambuf
*this, char *buffer
, int length
)
572 TRACE("(%p %p %d)\n", this, buffer
, length
);
573 if (this->base
!= NULL
)
576 if (buffer
== NULL
|| !length
) {
577 this->unbuffered
= 1;
578 this->base
= this->ebuf
= NULL
;
580 this->unbuffered
= 0;
582 this->ebuf
= buffer
+ length
;
587 /* ?setg@streambuf@@IAEXPAD00@Z */
588 /* ?setg@streambuf@@IEAAXPEAD00@Z */
589 DEFINE_THISCALL_WRAPPER(streambuf_setg
, 16)
590 void __thiscall
streambuf_setg(streambuf
*this, char *ek
, char *gp
, char *eg
)
592 TRACE("(%p %p %p %p)\n", this, ek
, gp
, eg
);
598 /* ?setlock@streambuf@@QAEXXZ */
599 /* ?setlock@streambuf@@QEAAXXZ */
600 DEFINE_THISCALL_WRAPPER(streambuf_setlock
, 4)
601 void __thiscall
streambuf_setlock(streambuf
*this)
603 TRACE("(%p)\n", this);
607 /* ?setp@streambuf@@IAEXPAD0@Z */
608 /* ?setp@streambuf@@IEAAXPEAD0@Z */
609 DEFINE_THISCALL_WRAPPER(streambuf_setp
, 12)
610 void __thiscall
streambuf_setp(streambuf
*this, char *pb
, char *ep
)
612 TRACE("(%p %p %p)\n", this, pb
, ep
);
613 this->pbase
= this->pptr
= pb
;
617 /* ?sync@streambuf@@UAEHXZ */
618 /* ?sync@streambuf@@UEAAHXZ */
619 DEFINE_THISCALL_WRAPPER(streambuf_sync
, 4)
620 #define call_streambuf_sync(this) CALL_VTBL_FUNC(this, 4, int, (streambuf*), (this))
621 int __thiscall
streambuf_sync(streambuf
*this)
623 TRACE("(%p)\n", this);
624 return (this->gptr
>= this->egptr
&& this->pbase
>= this->pptr
) ? 0 : EOF
;
627 /* ?unbuffered@streambuf@@IAEXH@Z */
628 /* ?unbuffered@streambuf@@IEAAXH@Z */
629 DEFINE_THISCALL_WRAPPER(streambuf_unbuffered_set
, 8)
630 void __thiscall
streambuf_unbuffered_set(streambuf
*this, int buf
)
632 TRACE("(%p %d)\n", this, buf
);
633 this->unbuffered
= buf
;
636 /* ?unbuffered@streambuf@@IBEHXZ */
637 /* ?unbuffered@streambuf@@IEBAHXZ */
638 DEFINE_THISCALL_WRAPPER(streambuf_unbuffered_get
, 4)
639 int __thiscall
streambuf_unbuffered_get(const streambuf
*this)
641 TRACE("(%p)\n", this);
642 return this->unbuffered
;
646 DEFINE_THISCALL_WRAPPER(streambuf_underflow
, 4)
647 #define call_streambuf_underflow(this) CALL_VTBL_FUNC(this, 32, int, (streambuf*), (this))
648 int __thiscall
streambuf_underflow(streambuf
*this)
650 ERR("underflow is not implemented in streambuf\n");
654 /* ?unlock@streambuf@@QAEXXZ */
655 /* ?unlock@streambuf@@QEAAXXZ */
656 DEFINE_THISCALL_WRAPPER(streambuf_unlock
, 4)
657 void __thiscall
streambuf_unlock(streambuf
*this)
659 TRACE("(%p)\n", this);
660 if (this->do_lock
< 0)
661 LeaveCriticalSection(&this->lock
);
664 /* ?xsgetn@streambuf@@UAEHPADH@Z */
665 /* ?xsgetn@streambuf@@UEAAHPEADH@Z */
666 DEFINE_THISCALL_WRAPPER(streambuf_xsgetn
, 12)
667 #define call_streambuf_xsgetn(this, buffer, count) CALL_VTBL_FUNC(this, 24, int, (streambuf*, char*, int), (this, buffer, count))
668 int __thiscall
streambuf_xsgetn(streambuf
*this, char *buffer
, int count
)
670 int copied
= 0, chunk
;
672 TRACE("(%p %p %d)\n", this, buffer
, count
);
674 if (this->unbuffered
) {
675 if (this->stored_char
== EOF
)
676 this->stored_char
= call_streambuf_underflow(this);
677 while (copied
< count
&& this->stored_char
!= EOF
) {
678 buffer
[copied
++] = this->stored_char
;
679 this->stored_char
= call_streambuf_underflow(this);
682 while (copied
< count
) {
683 if (call_streambuf_underflow(this) == EOF
)
685 chunk
= this->egptr
- this->gptr
;
686 if (chunk
> count
- copied
)
687 chunk
= count
- copied
;
688 memcpy(buffer
+copied
, this->gptr
, chunk
);
696 /* ?xsputn@streambuf@@UAEHPBDH@Z */
697 /* ?xsputn@streambuf@@UEAAHPEBDH@Z */
698 DEFINE_THISCALL_WRAPPER(streambuf_xsputn
, 12)
699 #define call_streambuf_xsputn(this, data, length) CALL_VTBL_FUNC(this, 20, int, (streambuf*, const char*, int), (this, data, length))
700 int __thiscall
streambuf_xsputn(streambuf
*this, const char *data
, int length
)
702 int copied
= 0, chunk
;
704 TRACE("(%p %p %d)\n", this, data
, length
);
706 while (copied
< length
) {
707 if (this->unbuffered
|| this->pptr
== this->epptr
) {
708 if (call_streambuf_overflow(this, data
[copied
]) == EOF
)
712 chunk
= this->epptr
- this->pptr
;
713 if (chunk
> length
- copied
)
714 chunk
= length
- copied
;
715 memcpy(this->pptr
, data
+copied
, chunk
);
723 /* ?sgetc@streambuf@@QAEHXZ */
724 /* ?sgetc@streambuf@@QEAAHXZ */
725 DEFINE_THISCALL_WRAPPER(streambuf_sgetc
, 4)
726 int __thiscall
streambuf_sgetc(streambuf
*this)
728 TRACE("(%p)\n", this);
729 if (this->unbuffered
) {
730 if (this->stored_char
== EOF
)
731 this->stored_char
= call_streambuf_underflow(this);
732 return this->stored_char
;
734 return call_streambuf_underflow(this);
737 /* ?sputc@streambuf@@QAEHH@Z */
738 /* ?sputc@streambuf@@QEAAHH@Z */
739 DEFINE_THISCALL_WRAPPER(streambuf_sputc
, 8)
740 int __thiscall
streambuf_sputc(streambuf
*this, int ch
)
742 TRACE("(%p %d)\n", this, ch
);
743 return (this->pptr
< this->epptr
) ? *this->pptr
++ = ch
: call_streambuf_overflow(this, ch
);
746 /* ?sgetn@streambuf@@QAEHPADH@Z */
747 /* ?sgetn@streambuf@@QEAAHPEADH@Z */
748 DEFINE_THISCALL_WRAPPER(streambuf_sgetn
, 12)
749 int __thiscall
streambuf_sgetn(streambuf
*this, char *buffer
, int count
)
751 return call_streambuf_xsgetn(this, buffer
, count
);
754 /* ?sputn@streambuf@@QAEHPBDH@Z */
755 /* ?sputn@streambuf@@QEAAHPEBDH@Z */
756 DEFINE_THISCALL_WRAPPER(streambuf_sputn
, 12)
757 int __thiscall
streambuf_sputn(streambuf
*this, const char *data
, int length
)
759 return call_streambuf_xsputn(this, data
, length
);
762 /* ?snextc@streambuf@@QAEHXZ */
763 /* ?snextc@streambuf@@QEAAHXZ */
764 DEFINE_THISCALL_WRAPPER(streambuf_snextc
, 4)
765 int __thiscall
streambuf_snextc(streambuf
*this)
767 TRACE("(%p)\n", this);
768 if (this->unbuffered
) {
769 if (this->stored_char
== EOF
)
770 call_streambuf_underflow(this);
771 return this->stored_char
= call_streambuf_underflow(this);
773 if (this->gptr
>= this->egptr
)
774 call_streambuf_underflow(this);
776 return (this->gptr
< this->egptr
) ? *this->gptr
: call_streambuf_underflow(this);
780 /* ?sbumpc@streambuf@@QAEHXZ */
781 /* ?sbumpc@streambuf@@QEAAHXZ */
782 DEFINE_THISCALL_WRAPPER(streambuf_sbumpc
, 4)
783 int __thiscall
streambuf_sbumpc(streambuf
*this)
787 TRACE("(%p)\n", this);
789 if (this->unbuffered
) {
790 ret
= this->stored_char
;
791 this->stored_char
= EOF
;
793 ret
= call_streambuf_underflow(this);
795 ret
= (this->gptr
< this->egptr
) ? *this->gptr
: call_streambuf_underflow(this);
801 /* ?stossc@streambuf@@QAEXXZ */
802 /* ?stossc@streambuf@@QEAAXXZ */
803 DEFINE_THISCALL_WRAPPER(streambuf_stossc
, 4)
804 void __thiscall
streambuf_stossc(streambuf
*this)
806 TRACE("(%p)\n", this);
807 if (this->unbuffered
) {
808 if (this->stored_char
== EOF
)
809 call_streambuf_underflow(this);
811 this->stored_char
= EOF
;
813 if (this->gptr
>= this->egptr
)
814 call_streambuf_underflow(this);
815 if (this->gptr
< this->egptr
)
820 /* ?sputbackc@streambuf@@QAEHD@Z */
821 /* ?sputbackc@streambuf@@QEAAHD@Z */
822 DEFINE_THISCALL_WRAPPER(streambuf_sputbackc
, 8)
823 int __thiscall
streambuf_sputbackc(streambuf
*this, char ch
)
825 TRACE("(%p %d)\n", this, ch
);
826 return call_streambuf_pbackfail(this, ch
);
829 /* ?dbp@streambuf@@QAEXXZ */
830 /* ?dbp@streambuf@@QEAAXXZ */
831 DEFINE_THISCALL_WRAPPER(streambuf_dbp
, 4)
832 void __thiscall
streambuf_dbp(streambuf
*this)
834 printf("\nSTREAMBUF DEBUG INFO: this=%p, ", this);
835 if (this->unbuffered
) {
836 printf("unbuffered\n");
838 printf("_fAlloc=%d\n", this->allocated
);
839 printf(" base()=%p, ebuf()=%p, blen()=%d\n", this->base
, this->ebuf
, streambuf_blen(this));
840 printf("pbase()=%p, pptr()=%p, epptr()=%p\n", this->pbase
, this->pptr
, this->epptr
);
841 printf("eback()=%p, gptr()=%p, egptr()=%p\n", this->eback
, this->gptr
, this->egptr
);
845 /* ??0filebuf@@QAE@ABV0@@Z */
846 /* ??0filebuf@@QEAA@AEBV0@@Z */
847 DEFINE_THISCALL_WRAPPER(filebuf_copy_ctor
, 8)
848 filebuf
* __thiscall
filebuf_copy_ctor(filebuf
* this, const filebuf
*copy
)
850 TRACE("(%p %p)\n", this, copy
);
852 this->base
.vtable
= &MSVCP_filebuf_vtable
;
856 /* ??0filebuf@@QAE@HPADH@Z */
857 /* ??0filebuf@@QEAA@HPEADH@Z */
858 DEFINE_THISCALL_WRAPPER(filebuf_fd_reserve_ctor
, 16)
859 filebuf
* __thiscall
filebuf_fd_reserve_ctor(filebuf
* this, filedesc fd
, char *buffer
, int length
)
861 TRACE("(%p %d %p %d)\n", this, fd
, buffer
, length
);
862 streambuf_reserve_ctor(&this->base
, buffer
, length
);
863 this->base
.vtable
= &MSVCP_filebuf_vtable
;
869 /* ??0filebuf@@QAE@H@Z */
870 /* ??0filebuf@@QEAA@H@Z */
871 DEFINE_THISCALL_WRAPPER(filebuf_fd_ctor
, 8)
872 filebuf
* __thiscall
filebuf_fd_ctor(filebuf
* this, filedesc fd
)
874 filebuf_fd_reserve_ctor(this, fd
, NULL
, 0);
875 this->base
.unbuffered
= 0;
879 /* ??0filebuf@@QAE@XZ */
880 /* ??0filebuf@@QEAA@XZ */
881 DEFINE_THISCALL_WRAPPER(filebuf_ctor
, 4)
882 filebuf
* __thiscall
filebuf_ctor(filebuf
* this)
884 return filebuf_fd_ctor(this, -1);
887 /* ??1filebuf@@UAE@XZ */
888 /* ??1filebuf@@UEAA@XZ */
889 DEFINE_THISCALL_WRAPPER(filebuf_dtor
, 4)
890 void __thiscall
filebuf_dtor(filebuf
* this)
892 TRACE("(%p)\n", this);
895 streambuf_dtor(&this->base
);
898 /* ??4filebuf@@QAEAAV0@ABV0@@Z */
899 /* ??4filebuf@@QEAAAEAV0@AEBV0@@Z */
900 DEFINE_THISCALL_WRAPPER(filebuf_assign
, 8)
901 filebuf
* __thiscall
filebuf_assign(filebuf
* this, const filebuf
*rhs
)
904 return filebuf_copy_ctor(this, rhs
);
907 /* ??_Efilebuf@@UAEPAXI@Z */
908 DEFINE_THISCALL_WRAPPER(filebuf_vector_dtor
, 8)
909 filebuf
* __thiscall
filebuf_vector_dtor(filebuf
*this, unsigned int flags
)
911 TRACE("(%p %x)\n", this, flags
);
913 /* we have an array, with the number of elements stored before the first object */
914 INT_PTR i
, *ptr
= (INT_PTR
*)this-1;
916 for (i
= *ptr
-1; i
>= 0; i
--)
917 filebuf_dtor(this+i
);
918 MSVCRT_operator_delete(ptr
);
922 MSVCRT_operator_delete(this);
927 /* ??_Gfilebuf@@UAEPAXI@Z */
928 DEFINE_THISCALL_WRAPPER(filebuf_scalar_dtor
, 8)
929 filebuf
* __thiscall
filebuf_scalar_dtor(filebuf
*this, unsigned int flags
)
931 TRACE("(%p %x)\n", this, flags
);
933 if (flags
& 1) MSVCRT_operator_delete(this);
937 /* ?attach@filebuf@@QAEPAV1@H@Z */
938 /* ?attach@filebuf@@QEAAPEAV1@H@Z */
939 DEFINE_THISCALL_WRAPPER(filebuf_attach
, 8)
940 filebuf
* __thiscall
filebuf_attach(filebuf
*this, filedesc fd
)
942 TRACE("(%p %d)\n", this, fd
);
946 streambuf_lock(&this->base
);
948 streambuf_allocate(&this->base
);
949 streambuf_unlock(&this->base
);
953 /* ?close@filebuf@@QAEPAV1@XZ */
954 /* ?close@filebuf@@QEAAPEAV1@XZ */
955 DEFINE_THISCALL_WRAPPER(filebuf_close
, 4)
956 filebuf
* __thiscall
filebuf_close(filebuf
*this)
960 TRACE("(%p)\n", this);
964 streambuf_lock(&this->base
);
965 if (call_streambuf_sync(&this->base
) == EOF
|| _close(this->fd
) < 0) {
971 streambuf_unlock(&this->base
);
975 /* ?fd@filebuf@@QBEHXZ */
976 /* ?fd@filebuf@@QEBAHXZ */
977 DEFINE_THISCALL_WRAPPER(filebuf_fd
, 4)
978 filedesc __thiscall
filebuf_fd(const filebuf
*this)
980 TRACE("(%p)\n", this);
984 /* ?is_open@filebuf@@QBEHXZ */
985 /* ?is_open@filebuf@@QEBAHXZ */
986 DEFINE_THISCALL_WRAPPER(filebuf_is_open
, 4)
987 int __thiscall
filebuf_is_open(const filebuf
*this)
989 TRACE("(%p)\n", this);
990 return this->fd
!= -1;
993 /* ?open@filebuf@@QAEPAV1@PBDHH@Z */
994 /* ?open@filebuf@@QEAAPEAV1@PEBDHH@Z */
995 DEFINE_THISCALL_WRAPPER(filebuf_open
, 16)
996 filebuf
* __thiscall
filebuf_open(filebuf
*this, const char *name
, ios_open_mode mode
, int protection
)
998 const int inout_mode
[4] = {-1, _O_RDONLY
, _O_WRONLY
, _O_RDWR
};
999 const int share_mode
[4] = {_SH_DENYRW
, _SH_DENYWR
, _SH_DENYRD
, _SH_DENYNO
};
1000 int op_flags
, sh_flags
, fd
;
1002 TRACE("(%p %s %x %x)\n", this, name
, mode
, protection
);
1007 if (mode
& (OPENMODE_app
|OPENMODE_trunc
))
1008 mode
|= OPENMODE_out
;
1009 op_flags
= inout_mode
[mode
& (OPENMODE_in
|OPENMODE_out
)];
1012 if (mode
& OPENMODE_app
)
1013 op_flags
|= _O_APPEND
;
1014 if ((mode
& OPENMODE_trunc
) ||
1015 ((mode
& OPENMODE_out
) && !(mode
& (OPENMODE_in
|OPENMODE_app
|OPENMODE_ate
))))
1016 op_flags
|= _O_TRUNC
;
1017 if (!(mode
& OPENMODE_nocreate
))
1018 op_flags
|= _O_CREAT
;
1019 if (mode
& OPENMODE_noreplace
)
1020 op_flags
|= _O_EXCL
;
1021 op_flags
|= (mode
& OPENMODE_binary
) ? _O_BINARY
: _O_TEXT
;
1023 /* share protection */
1024 sh_flags
= (protection
& filebuf_sh_none
) ? share_mode
[(protection
>> 9) & 3] : _SH_DENYNO
;
1026 TRACE("op_flags %x, sh_flags %x\n", op_flags
, sh_flags
);
1027 fd
= _sopen(name
, op_flags
, sh_flags
, _S_IREAD
|_S_IWRITE
);
1031 streambuf_lock(&this->base
);
1034 if ((mode
& OPENMODE_ate
) &&
1035 call_streambuf_seekoff(&this->base
, 0, SEEKDIR_end
, mode
& (OPENMODE_in
|OPENMODE_out
)) == EOF
) {
1039 streambuf_allocate(&this->base
);
1040 streambuf_unlock(&this->base
);
1041 return (this->fd
== -1) ? NULL
: this;
1044 /* ?overflow@filebuf@@UAEHH@Z */
1045 /* ?overflow@filebuf@@UEAAHH@Z */
1046 DEFINE_THISCALL_WRAPPER(filebuf_overflow
, 8)
1047 int __thiscall
filebuf_overflow(filebuf
*this, int c
)
1049 TRACE("(%p %d)\n", this, c
);
1050 if (call_streambuf_sync(&this->base
) == EOF
)
1052 if (this->base
.unbuffered
)
1053 return (c
== EOF
) ? 1 : _write(this->fd
, &c
, 1);
1054 if (streambuf_allocate(&this->base
) == EOF
)
1057 this->base
.pbase
= this->base
.pptr
= this->base
.base
;
1058 this->base
.epptr
= this->base
.ebuf
;
1060 *this->base
.pptr
++ = c
;
1064 /* ?seekoff@filebuf@@UAEJJW4seek_dir@ios@@H@Z */
1065 /* ?seekoff@filebuf@@UEAAJJW4seek_dir@ios@@H@Z */
1066 DEFINE_THISCALL_WRAPPER(filebuf_seekoff
, 16)
1067 streampos __thiscall
filebuf_seekoff(filebuf
*this, streamoff offset
, ios_seek_dir dir
, int mode
)
1069 TRACE("(%p %d %d %d)\n", this, offset
, dir
, mode
);
1070 if (call_streambuf_sync(&this->base
) == EOF
)
1072 return _lseek(this->fd
, offset
, dir
);
1075 /* ?setbuf@filebuf@@UAEPAVstreambuf@@PADH@Z */
1076 /* ?setbuf@filebuf@@UEAAPEAVstreambuf@@PEADH@Z */
1077 DEFINE_THISCALL_WRAPPER(filebuf_setbuf
, 12)
1078 streambuf
* __thiscall
filebuf_setbuf(filebuf
*this, char *buffer
, int length
)
1082 TRACE("(%p %p %d)\n", this, buffer
, length
);
1083 if (this->base
.base
!= NULL
)
1086 streambuf_lock(&this->base
);
1087 ret
= streambuf_setbuf(&this->base
, buffer
, length
);
1088 streambuf_unlock(&this->base
);
1092 /* ?setmode@filebuf@@QAEHH@Z */
1093 /* ?setmode@filebuf@@QEAAHH@Z */
1094 DEFINE_THISCALL_WRAPPER(filebuf_setmode
, 8)
1095 int __thiscall
filebuf_setmode(filebuf
*this, int mode
)
1099 TRACE("(%p %d)\n", this, mode
);
1100 if (mode
!= filebuf_text
&& mode
!= filebuf_binary
)
1103 streambuf_lock(&this->base
);
1104 ret
= (call_streambuf_sync(&this->base
) == EOF
) ? -1 : _setmode(this->fd
, mode
);
1105 streambuf_unlock(&this->base
);
1109 /* ?sync@filebuf@@UAEHXZ */
1110 /* ?sync@filebuf@@UEAAHXZ */
1111 DEFINE_THISCALL_WRAPPER(filebuf_sync
, 4)
1112 int __thiscall
filebuf_sync(filebuf
*this)
1118 TRACE("(%p)\n", this);
1121 if (this->base
.unbuffered
)
1124 /* flush output buffer */
1125 if (this->base
.pptr
!= NULL
) {
1126 count
= this->base
.pptr
- this->base
.pbase
;
1127 if (count
> 0 && _write(this->fd
, this->base
.pbase
, count
) != count
)
1129 this->base
.pbase
= this->base
.pptr
= this->base
.epptr
= NULL
;
1131 /* flush input buffer */
1132 if (this->base
.egptr
!= NULL
) {
1133 offset
= this->base
.egptr
- this->base
.gptr
;
1135 mode
= _setmode(this->fd
, _O_TEXT
);
1136 _setmode(this->fd
, mode
);
1137 if (mode
& _O_TEXT
) {
1138 /* in text mode, '\n' in the buffer means '\r\n' in the file */
1139 for (ptr
= this->base
.gptr
; ptr
< this->base
.egptr
; ptr
++)
1143 if (_lseek(this->fd
, -offset
, SEEK_CUR
) < 0)
1146 this->base
.eback
= this->base
.gptr
= this->base
.egptr
= NULL
;
1151 /* ?underflow@filebuf@@UAEHXZ */
1152 /* ?underflow@filebuf@@UEAAHXZ */
1153 DEFINE_THISCALL_WRAPPER(filebuf_underflow
, 4)
1154 int __thiscall
filebuf_underflow(filebuf
*this)
1156 int buffer_size
, read_bytes
;
1159 TRACE("(%p)\n", this);
1161 if (this->base
.unbuffered
)
1162 return (_read(this->fd
, &c
, 1) < 1) ? EOF
: c
;
1164 if (this->base
.gptr
>= this->base
.egptr
) {
1165 if (call_streambuf_sync(&this->base
) == EOF
)
1167 buffer_size
= this->base
.ebuf
- this->base
.base
;
1168 read_bytes
= _read(this->fd
, this->base
.base
, buffer_size
);
1169 if (read_bytes
<= 0)
1171 this->base
.eback
= this->base
.gptr
= this->base
.base
;
1172 this->base
.egptr
= this->base
.base
+ read_bytes
;
1174 return *this->base
.gptr
;
1177 /* ??0strstreambuf@@QAE@ABV0@@Z */
1178 /* ??0strstreambuf@@QEAA@AEBV0@@Z */
1179 DEFINE_THISCALL_WRAPPER(strstreambuf_copy_ctor
, 8)
1180 strstreambuf
* __thiscall
strstreambuf_copy_ctor(strstreambuf
*this, const strstreambuf
*copy
)
1182 TRACE("(%p %p)\n", this, copy
);
1184 this->base
.vtable
= &MSVCP_strstreambuf_vtable
;
1188 /* ??0strstreambuf@@QAE@H@Z */
1189 /* ??0strstreambuf@@QEAA@H@Z */
1190 DEFINE_THISCALL_WRAPPER(strstreambuf_dynamic_ctor
, 8)
1191 strstreambuf
* __thiscall
strstreambuf_dynamic_ctor(strstreambuf
* this, int length
)
1193 TRACE("(%p %d)\n", this, length
);
1194 streambuf_ctor(&this->base
);
1195 this->base
.vtable
= &MSVCP_strstreambuf_vtable
;
1197 this->increase
= length
;
1199 this->f_alloc
= NULL
;
1200 this->f_free
= NULL
;
1204 /* ??0strstreambuf@@QAE@P6APAXJ@ZP6AXPAX@Z@Z */
1205 /* ??0strstreambuf@@QEAA@P6APEAXJ@ZP6AXPEAX@Z@Z */
1206 DEFINE_THISCALL_WRAPPER(strstreambuf_funcs_ctor
, 12)
1207 strstreambuf
* __thiscall
strstreambuf_funcs_ctor(strstreambuf
* this, allocFunction falloc
, freeFunction ffree
)
1209 TRACE("(%p %p %p)\n", this, falloc
, ffree
);
1210 strstreambuf_dynamic_ctor(this, 1);
1211 this->f_alloc
= falloc
;
1212 this->f_free
= ffree
;
1216 /* ??0strstreambuf@@QAE@PADH0@Z */
1217 /* ??0strstreambuf@@QEAA@PEADH0@Z */
1218 DEFINE_THISCALL_WRAPPER(strstreambuf_buffer_ctor
, 16)
1219 strstreambuf
* __thiscall
strstreambuf_buffer_ctor(strstreambuf
*this, char *buffer
, int length
, char *put
)
1223 TRACE("(%p %p %d %p)\n", this, buffer
, length
, put
);
1226 end_buffer
= buffer
+ length
;
1227 else if (length
== 0)
1228 end_buffer
= buffer
+ strlen(buffer
);
1230 end_buffer
= (char*) -1;
1232 streambuf_ctor(&this->base
);
1233 streambuf_setb(&this->base
, buffer
, end_buffer
, 0);
1235 streambuf_setg(&this->base
, buffer
, buffer
, end_buffer
);
1237 streambuf_setg(&this->base
, buffer
, buffer
, put
);
1238 streambuf_setp(&this->base
, put
, end_buffer
);
1240 this->base
.vtable
= &MSVCP_strstreambuf_vtable
;
1246 /* ??0strstreambuf@@QAE@PAEH0@Z */
1247 /* ??0strstreambuf@@QEAA@PEAEH0@Z */
1248 DEFINE_THISCALL_WRAPPER(strstreambuf_ubuffer_ctor
, 16)
1249 strstreambuf
* __thiscall
strstreambuf_ubuffer_ctor(strstreambuf
*this, unsigned char *buffer
, int length
, unsigned char *put
)
1251 TRACE("(%p %p %d %p)\n", this, buffer
, length
, put
);
1252 return strstreambuf_buffer_ctor(this, (char*)buffer
, length
, (char*)put
);
1255 /* ??0strstreambuf@@QAE@XZ */
1256 /* ??0strstreambuf@@QEAA@XZ */
1257 DEFINE_THISCALL_WRAPPER(strstreambuf_ctor
, 4)
1258 strstreambuf
* __thiscall
strstreambuf_ctor(strstreambuf
*this)
1260 TRACE("(%p)\n", this);
1261 return strstreambuf_dynamic_ctor(this, 1);
1264 /* ??1strstreambuf@@UAE@XZ */
1265 /* ??1strstreambuf@@UEAA@XZ */
1266 DEFINE_THISCALL_WRAPPER(strstreambuf_dtor
, 4)
1267 void __thiscall
strstreambuf_dtor(strstreambuf
*this)
1269 TRACE("(%p)\n", this);
1270 if (this->dynamic
&& this->base
.base
) {
1272 this->f_free(this->base
.base
);
1274 MSVCRT_operator_delete(this->base
.base
);
1276 streambuf_dtor(&this->base
);
1279 /* ??4strstreambuf@@QAEAAV0@ABV0@@Z */
1280 /* ??4strstreambuf@@QEAAAEAV0@AEBV0@@Z */
1281 DEFINE_THISCALL_WRAPPER(strstreambuf_assign
, 8)
1282 strstreambuf
* __thiscall
strstreambuf_assign(strstreambuf
*this, const strstreambuf
*rhs
)
1284 strstreambuf_dtor(this);
1285 return strstreambuf_copy_ctor(this, rhs
);
1288 /* ??_Estrstreambuf@@UAEPAXI@Z */
1289 DEFINE_THISCALL_WRAPPER(strstreambuf_vector_dtor
, 8)
1290 strstreambuf
* __thiscall
strstreambuf_vector_dtor(strstreambuf
*this, unsigned int flags
)
1292 TRACE("(%p %x)\n", this, flags
);
1294 /* we have an array, with the number of elements stored before the first object */
1295 INT_PTR i
, *ptr
= (INT_PTR
*)this-1;
1297 for (i
= *ptr
-1; i
>= 0; i
--)
1298 strstreambuf_dtor(this+i
);
1299 MSVCRT_operator_delete(ptr
);
1301 strstreambuf_dtor(this);
1303 MSVCRT_operator_delete(this);
1308 /* ??_Gstrstreambuf@@UAEPAXI@Z */
1309 DEFINE_THISCALL_WRAPPER(strstreambuf_scalar_dtor
, 8)
1310 strstreambuf
* __thiscall
strstreambuf_scalar_dtor(strstreambuf
*this, unsigned int flags
)
1312 TRACE("(%p %x)\n", this, flags
);
1313 strstreambuf_dtor(this);
1314 if (flags
& 1) MSVCRT_operator_delete(this);
1318 /* ?doallocate@strstreambuf@@MAEHXZ */
1319 /* ?doallocate@strstreambuf@@MEAAHXZ */
1320 DEFINE_THISCALL_WRAPPER(strstreambuf_doallocate
, 4)
1321 int __thiscall
strstreambuf_doallocate(strstreambuf
*this)
1323 char *prev_buffer
= this->base
.base
, *new_buffer
;
1324 LONG prev_size
= this->base
.ebuf
- this->base
.base
, new_size
;
1326 TRACE("(%p)\n", this);
1328 /* calculate the size of the new buffer */
1329 new_size
= (prev_size
> 0 ? prev_size
: 0) + (this->increase
> 0 ? this->increase
: 1);
1330 /* get a new buffer */
1332 new_buffer
= this->f_alloc(new_size
);
1334 new_buffer
= MSVCRT_operator_new(new_size
);
1337 if (this->base
.ebuf
) {
1338 /* copy the contents and adjust the pointers */
1339 memcpy(new_buffer
, this->base
.base
, prev_size
);
1340 if (this->base
.egptr
) {
1341 this->base
.eback
+= new_buffer
- prev_buffer
;
1342 this->base
.gptr
+= new_buffer
- prev_buffer
;
1343 this->base
.egptr
+= new_buffer
- prev_buffer
;
1345 if (this->base
.epptr
) {
1346 this->base
.pbase
+= new_buffer
- prev_buffer
;
1347 this->base
.pptr
+= new_buffer
- prev_buffer
;
1348 this->base
.epptr
+= new_buffer
- prev_buffer
;
1350 /* free the old buffer */
1352 this->f_free(this->base
.base
);
1354 MSVCRT_operator_delete(this->base
.base
);
1356 streambuf_setb(&this->base
, new_buffer
, new_buffer
+ new_size
, 0);
1360 /* ?freeze@strstreambuf@@QAEXH@Z */
1361 /* ?freeze@strstreambuf@@QEAAXH@Z */
1362 DEFINE_THISCALL_WRAPPER(strstreambuf_freeze
, 8)
1363 void __thiscall
strstreambuf_freeze(strstreambuf
*this, int frozen
)
1365 TRACE("(%p %d)\n", this, frozen
);
1366 if (!this->constant
)
1367 this->dynamic
= !frozen
;
1370 /* ?overflow@strstreambuf@@UAEHH@Z */
1371 /* ?overflow@strstreambuf@@UEAAHH@Z */
1372 DEFINE_THISCALL_WRAPPER(strstreambuf_overflow
, 8)
1373 int __thiscall
strstreambuf_overflow(strstreambuf
*this, int c
)
1375 TRACE("(%p %d)\n", this, c
);
1376 if (this->base
.pptr
>= this->base
.epptr
) {
1377 /* increase the buffer size if it's dynamic */
1378 if (!this->dynamic
|| call_streambuf_doallocate(&this->base
) == EOF
)
1380 if (!this->base
.epptr
)
1381 this->base
.pbase
= this->base
.pptr
= this->base
.egptr
? this->base
.egptr
: this->base
.base
;
1382 this->base
.epptr
= this->base
.ebuf
;
1385 *this->base
.pptr
++ = c
;
1389 /* ?seekoff@strstreambuf@@UAEJJW4seek_dir@ios@@H@Z */
1390 /* ?seekoff@strstreambuf@@UEAAJJW4seek_dir@ios@@H@Z */
1391 DEFINE_THISCALL_WRAPPER(strstreambuf_seekoff
, 16)
1392 streampos __thiscall
strstreambuf_seekoff(strstreambuf
*this, streamoff offset
, ios_seek_dir dir
, int mode
)
1396 TRACE("(%p %d %d %d)\n", this, offset
, dir
, mode
);
1398 if ((unsigned int)dir
> SEEKDIR_end
|| !(mode
& (OPENMODE_in
|OPENMODE_out
)))
1401 if (mode
& OPENMODE_in
) {
1402 call_streambuf_underflow(&this->base
);
1403 base
[SEEKDIR_beg
] = this->base
.eback
;
1404 base
[SEEKDIR_cur
] = this->base
.gptr
;
1405 base
[SEEKDIR_end
] = this->base
.egptr
;
1406 if (base
[dir
] + offset
< this->base
.eback
|| base
[dir
] + offset
> this->base
.egptr
)
1408 this->base
.gptr
= base
[dir
] + offset
;
1411 if (mode
& OPENMODE_out
) {
1412 if (!this->base
.epptr
&& call_streambuf_overflow(&this->base
, EOF
) == EOF
)
1414 base
[SEEKDIR_beg
] = this->base
.pbase
;
1415 base
[SEEKDIR_cur
] = this->base
.pptr
;
1416 base
[SEEKDIR_end
] = this->base
.epptr
;
1417 if (base
[dir
] + offset
< this->base
.pbase
)
1419 if (base
[dir
] + offset
> this->base
.epptr
) {
1420 /* make room if the buffer is dynamic */
1423 this->increase
= offset
;
1424 if (call_streambuf_doallocate(&this->base
) == EOF
)
1427 this->base
.pptr
= base
[dir
] + offset
;
1428 return this->base
.pptr
- base
[SEEKDIR_beg
];
1430 return this->base
.gptr
- base
[SEEKDIR_beg
];
1433 /* ?setbuf@strstreambuf@@UAEPAVstreambuf@@PADH@Z */
1434 /* ?setbuf@strstreambuf@@UEAAPEAVstreambuf@@PEADH@Z */
1435 DEFINE_THISCALL_WRAPPER(strstreambuf_setbuf
, 12)
1436 streambuf
* __thiscall
strstreambuf_setbuf(strstreambuf
*this, char *buffer
, int length
)
1438 TRACE("(%p %p %d)\n", this, buffer
, length
);
1440 this->increase
= length
;
1444 /* ?str@strstreambuf@@QAEPADXZ */
1445 /* ?str@strstreambuf@@QEAAPEADXZ */
1446 DEFINE_THISCALL_WRAPPER(strstreambuf_str
, 4)
1447 char* __thiscall
strstreambuf_str(strstreambuf
*this)
1449 TRACE("(%p)\n", this);
1450 strstreambuf_freeze(this, 1);
1451 return this->base
.base
;
1454 /* ?sync@strstreambuf@@UAEHXZ */
1455 /* ?sync@strstreambuf@@UEAAHXZ */
1456 DEFINE_THISCALL_WRAPPER(strstreambuf_sync
, 4)
1457 int __thiscall
strstreambuf_sync(strstreambuf
*this)
1459 TRACE("(%p)\n", this);
1463 /* ?underflow@strstreambuf@@UAEHXZ */
1464 /* ?underflow@strstreambuf@@UEAAHXZ */
1465 DEFINE_THISCALL_WRAPPER(strstreambuf_underflow
, 4)
1466 int __thiscall
strstreambuf_underflow(strstreambuf
*this)
1468 TRACE("(%p)\n", this);
1469 if (this->base
.gptr
< this->base
.egptr
)
1470 return *this->base
.gptr
;
1471 /* extend the get area to include the characters written */
1472 if (this->base
.egptr
< this->base
.pptr
)
1473 this->base
.egptr
= this->base
.pptr
;
1474 return (this->base
.gptr
< this->base
.egptr
) ? *this->base
.gptr
: EOF
;
1477 /* ??0stdiobuf@@QAE@ABV0@@Z */
1478 /* ??0stdiobuf@@QEAA@AEBV0@@Z */
1479 DEFINE_THISCALL_WRAPPER(stdiobuf_copy_ctor
, 8)
1480 stdiobuf
* __thiscall
stdiobuf_copy_ctor(stdiobuf
*this, const stdiobuf
*copy
)
1482 TRACE("(%p %p)\n", this, copy
);
1484 this->base
.vtable
= &MSVCP_stdiobuf_vtable
;
1488 /* ??0stdiobuf@@QAE@PAU_iobuf@@@Z */
1489 /* ??0stdiobuf@@QEAA@PEAU_iobuf@@@Z */
1490 DEFINE_THISCALL_WRAPPER(stdiobuf_file_ctor
, 8)
1491 stdiobuf
* __thiscall
stdiobuf_file_ctor(stdiobuf
*this, FILE *file
)
1493 TRACE("(%p %p)\n", this, file
);
1494 streambuf_reserve_ctor(&this->base
, NULL
, 0);
1495 this->base
.vtable
= &MSVCP_stdiobuf_vtable
;
1500 /* ??1stdiobuf@@UAE@XZ */
1501 /* ??1stdiobuf@@UEAA@XZ */
1502 DEFINE_THISCALL_WRAPPER(stdiobuf_dtor
, 4)
1503 void __thiscall
stdiobuf_dtor(stdiobuf
*this)
1505 TRACE("(%p)\n", this);
1506 call_streambuf_sync(&this->base
);
1507 streambuf_dtor(&this->base
);
1510 /* ??4stdiobuf@@QAEAAV0@ABV0@@Z */
1511 /* ??4stdiobuf@@QEAAAEAV0@AEBV0@@Z */
1512 DEFINE_THISCALL_WRAPPER(stdiobuf_assign
, 8)
1513 stdiobuf
* __thiscall
stdiobuf_assign(stdiobuf
*this, const stdiobuf
*rhs
)
1515 stdiobuf_dtor(this);
1516 return stdiobuf_copy_ctor(this, rhs
);
1519 /* ??_Estdiobuf@@UAEPAXI@Z */
1520 DEFINE_THISCALL_WRAPPER(stdiobuf_vector_dtor
, 8)
1521 stdiobuf
* __thiscall
stdiobuf_vector_dtor(stdiobuf
*this, unsigned int flags
)
1523 TRACE("(%p %x)\n", this, flags
);
1525 /* we have an array, with the number of elements stored before the first object */
1526 INT_PTR i
, *ptr
= (INT_PTR
*)this-1;
1528 for (i
= *ptr
-1; i
>= 0; i
--)
1529 stdiobuf_dtor(this+i
);
1530 MSVCRT_operator_delete(ptr
);
1532 stdiobuf_dtor(this);
1534 MSVCRT_operator_delete(this);
1539 /* ??_Gstdiobuf@@UAEPAXI@Z */
1540 DEFINE_THISCALL_WRAPPER(stdiobuf_scalar_dtor
, 8)
1541 stdiobuf
* __thiscall
stdiobuf_scalar_dtor(stdiobuf
*this, unsigned int flags
)
1543 TRACE("(%p %x)\n", this, flags
);
1544 stdiobuf_dtor(this);
1545 if (flags
& 1) MSVCRT_operator_delete(this);
1549 /* ?overflow@stdiobuf@@UAEHH@Z */
1550 /* ?overflow@stdiobuf@@UEAAHH@Z */
1551 DEFINE_THISCALL_WRAPPER(stdiobuf_overflow
, 8)
1552 int __thiscall
stdiobuf_overflow(stdiobuf
*this, int c
)
1554 TRACE("(%p %d)\n", this, c
);
1555 if (this->base
.unbuffered
)
1556 return (c
== EOF
) ? 1 : fputc(c
, this->file
);
1557 if (streambuf_allocate(&this->base
) == EOF
)
1560 if (!this->base
.epptr
) {
1561 /* set the put area to the second half of the buffer */
1562 streambuf_setp(&this->base
,
1563 this->base
.base
+ (this->base
.ebuf
- this->base
.base
) / 2, this->base
.ebuf
);
1564 } else if (this->base
.pptr
> this->base
.pbase
) {
1565 /* flush the put area */
1566 int count
= this->base
.pptr
- this->base
.pbase
;
1567 if (fwrite(this->base
.pbase
, sizeof(char), count
, this->file
) != count
)
1569 this->base
.pptr
= this->base
.pbase
;
1572 if (this->base
.pbase
>= this->base
.epptr
)
1573 return fputc(c
, this->file
);
1574 *this->base
.pptr
++ = c
;
1579 /* ?pbackfail@stdiobuf@@UAEHH@Z */
1580 /* ?pbackfail@stdiobuf@@UEAAHH@Z */
1581 DEFINE_THISCALL_WRAPPER(stdiobuf_pbackfail
, 8)
1582 int __thiscall
stdiobuf_pbackfail(stdiobuf
*this, int c
)
1584 TRACE("(%p %d)\n", this, c
);
1585 return streambuf_pbackfail(&this->base
, c
);
1588 /* ?seekoff@stdiobuf@@UAEJJW4seek_dir@ios@@H@Z */
1589 /* ?seekoff@stdiobuf@@UEAAJJW4seek_dir@ios@@H@Z */
1590 DEFINE_THISCALL_WRAPPER(stdiobuf_seekoff
, 16)
1591 streampos __thiscall
stdiobuf_seekoff(stdiobuf
*this, streamoff offset
, ios_seek_dir dir
, int mode
)
1593 TRACE("(%p %d %d %d)\n", this, offset
, dir
, mode
);
1594 call_streambuf_overflow(&this->base
, EOF
);
1595 if (fseek(this->file
, offset
, dir
))
1597 return ftell(this->file
);
1600 /* ?setrwbuf@stdiobuf@@QAEHHH@Z */
1601 /* ?setrwbuf@stdiobuf@@QEAAHHH@Z */
1602 DEFINE_THISCALL_WRAPPER(stdiobuf_setrwbuf
, 12)
1603 int __thiscall
stdiobuf_setrwbuf(stdiobuf
*this, int read_size
, int write_size
)
1606 int buffer_size
= read_size
+ write_size
;
1608 TRACE("(%p %d %d)\n", this, read_size
, write_size
);
1609 if (read_size
< 0 || write_size
< 0)
1612 this->base
.unbuffered
= 1;
1615 /* get a new buffer */
1616 reserve
= MSVCRT_operator_new(buffer_size
);
1619 streambuf_setb(&this->base
, reserve
, reserve
+ buffer_size
, 1);
1620 this->base
.unbuffered
= 0;
1621 /* set the get/put areas */
1623 streambuf_setg(&this->base
, reserve
, reserve
+ read_size
, reserve
+ read_size
);
1625 streambuf_setg(&this->base
, NULL
, NULL
, NULL
);
1627 streambuf_setp(&this->base
, reserve
+ read_size
, reserve
+ buffer_size
);
1629 streambuf_setp(&this->base
, NULL
, NULL
);
1633 /* ?stdiofile@stdiobuf@@QAEPAU_iobuf@@XZ */
1634 /* ?stdiofile@stdiobuf@@QEAAPEAU_iobuf@@XZ */
1635 DEFINE_THISCALL_WRAPPER(stdiobuf_stdiofile
, 4)
1636 FILE* __thiscall
stdiobuf_stdiofile(stdiobuf
*this)
1638 TRACE("(%p)\n", this);
1642 /* ?sync@stdiobuf@@UAEHXZ */
1643 /* ?sync@stdiobuf@@UEAAHXZ */
1644 DEFINE_THISCALL_WRAPPER(stdiobuf_sync
, 4)
1645 int __thiscall
stdiobuf_sync(stdiobuf
*this)
1647 TRACE("(%p)\n", this);
1648 if (this->base
.unbuffered
)
1650 /* flush the put area */
1651 if (call_streambuf_overflow(&this->base
, EOF
) == EOF
)
1653 /* flush the get area */
1654 if (this->base
.gptr
< this->base
.egptr
) {
1656 int fd
, mode
, offset
= this->base
.egptr
- this->base
.gptr
;
1657 if ((fd
= fileno(this->file
)) < 0)
1659 mode
= _setmode(fd
, _O_TEXT
);
1661 if (mode
& _O_TEXT
) {
1662 /* in text mode, '\n' in the buffer means '\r\n' in the file */
1663 for (ptr
= this->base
.gptr
; ptr
< this->base
.egptr
; ptr
++)
1667 if (fseek(this->file
, -offset
, SEEK_CUR
))
1669 this->base
.gptr
= this->base
.egptr
;
1674 /* ?underflow@stdiobuf@@UAEHXZ */
1675 /* ?underflow@stdiobuf@@UEAAHXZ */
1676 DEFINE_THISCALL_WRAPPER(stdiobuf_underflow
, 4)
1677 int __thiscall
stdiobuf_underflow(stdiobuf
*this)
1679 TRACE("(%p)\n", this);
1682 if (this->base
.unbuffered
)
1683 return fgetc(this->file
);
1684 if (streambuf_allocate(&this->base
) == EOF
)
1687 if (!this->base
.egptr
) {
1688 /* set the get area to the first half of the buffer */
1689 char *middle
= this->base
.base
+ (this->base
.ebuf
- this->base
.base
) / 2;
1690 streambuf_setg(&this->base
, this->base
.base
, middle
, middle
);
1692 if (this->base
.gptr
>= this->base
.egptr
) {
1693 /* read characters from the file */
1694 int buffer_size
= this->base
.egptr
- this->base
.eback
, read_bytes
;
1695 if (!this->base
.eback
||
1696 (read_bytes
= fread(this->base
.eback
, sizeof(char), buffer_size
, this->file
)) <= 0)
1698 memmove(this->base
.egptr
- read_bytes
, this->base
.eback
, read_bytes
);
1699 this->base
.gptr
= this->base
.egptr
- read_bytes
;
1701 return *this->base
.gptr
++;
1704 /* ??0ios@@IAE@ABV0@@Z */
1705 /* ??0ios@@IEAA@AEBV0@@Z */
1706 DEFINE_THISCALL_WRAPPER(ios_copy_ctor
, 8)
1707 ios
* __thiscall
ios_copy_ctor(ios
*this, const ios
*copy
)
1709 TRACE("(%p %p)\n", this, copy
);
1711 this->vtable
= &MSVCP_ios_vtable
;
1714 InitializeCriticalSection(&this->lock
);
1715 return ios_assign(this, copy
);
1718 /* ??0ios@@QAE@PAVstreambuf@@@Z */
1719 /* ??0ios@@QEAA@PEAVstreambuf@@@Z */
1720 DEFINE_THISCALL_WRAPPER(ios_sb_ctor
, 8)
1721 ios
* __thiscall
ios_sb_ctor(ios
*this, streambuf
*sb
)
1723 TRACE("(%p %p)\n", this, sb
);
1725 this->vtable
= &MSVCP_ios_vtable
;
1727 this->state
= sb
? IOSTATE_goodbit
: IOSTATE_badbit
;
1728 this->special
[0] = this->special
[1] = 0;
1732 this->precision
= 6;
1736 InitializeCriticalSection(&this->lock
);
1740 /* ??0ios@@IAE@XZ */
1741 /* ??0ios@@IEAA@XZ */
1742 DEFINE_THISCALL_WRAPPER(ios_ctor
, 4)
1743 ios
* __thiscall
ios_ctor(ios
*this)
1745 return ios_sb_ctor(this, NULL
);
1748 /* ??1ios@@UAE@XZ */
1749 /* ??1ios@@UEAA@XZ */
1750 DEFINE_THISCALL_WRAPPER(ios_dtor
, 4)
1751 void __thiscall
ios_dtor(ios
*this)
1753 TRACE("(%p)\n", this);
1755 if (this->delbuf
&& this->sb
)
1756 call_streambuf_vector_dtor(this->sb
, 1);
1758 this->state
= IOSTATE_badbit
;
1759 DeleteCriticalSection(&this->lock
);
1762 /* ??4ios@@IAEAAV0@ABV0@@Z */
1763 /* ??4ios@@IEAAAEAV0@AEBV0@@Z */
1764 DEFINE_THISCALL_WRAPPER(ios_assign
, 8)
1765 ios
* __thiscall
ios_assign(ios
*this, const ios
*rhs
)
1767 TRACE("(%p %p)\n", this, rhs
);
1768 this->state
= rhs
->state
;
1770 this->state
|= IOSTATE_badbit
;
1771 this->tie
= rhs
->tie
;
1772 this->flags
= rhs
->flags
;
1773 this->precision
= (char) rhs
->precision
;
1774 this->fill
= rhs
->fill
;
1775 this->width
= (char) rhs
->width
;
1779 /* ??7ios@@QBEHXZ */
1780 /* ??7ios@@QEBAHXZ */
1781 DEFINE_THISCALL_WRAPPER(ios_op_not
, 4)
1782 int __thiscall
ios_op_not(const ios
*this)
1784 TRACE("(%p)\n", this);
1785 return ios_fail(this);
1788 /* ??Bios@@QBEPAXXZ */
1789 /* ??Bios@@QEBAPEAXXZ */
1790 DEFINE_THISCALL_WRAPPER(ios_op_void
, 4)
1791 void* __thiscall
ios_op_void(const ios
*this)
1793 TRACE("(%p)\n", this);
1794 return ios_fail(this) ? NULL
: (void*)this;
1797 /* ??_Eios@@UAEPAXI@Z */
1798 DEFINE_THISCALL_WRAPPER(ios_vector_dtor
, 8)
1799 ios
* __thiscall
ios_vector_dtor(ios
*this, unsigned int flags
)
1801 TRACE("(%p %x)\n", this, flags
);
1803 /* we have an array, with the number of elements stored before the first object */
1804 INT_PTR i
, *ptr
= (INT_PTR
*)this-1;
1806 for (i
= *ptr
-1; i
>= 0; i
--)
1808 MSVCRT_operator_delete(ptr
);
1812 MSVCRT_operator_delete(this);
1817 /* ??_Gios@@UAEPAXI@Z */
1818 DEFINE_THISCALL_WRAPPER(ios_scalar_dtor
, 8)
1819 ios
* __thiscall
ios_scalar_dtor(ios
*this, unsigned int flags
)
1821 TRACE("(%p %x)\n", this, flags
);
1823 if (flags
& 1) MSVCRT_operator_delete(this);
1827 /* ?bad@ios@@QBEHXZ */
1828 /* ?bad@ios@@QEBAHXZ */
1829 DEFINE_THISCALL_WRAPPER(ios_bad
, 4)
1830 int __thiscall
ios_bad(const ios
*this)
1832 TRACE("(%p)\n", this);
1833 return (this->state
& IOSTATE_badbit
);
1836 /* ?bitalloc@ios@@SAJXZ */
1837 LONG __cdecl
ios_bitalloc(void)
1846 /* ?clear@ios@@QAEXH@Z */
1847 /* ?clear@ios@@QEAAXH@Z */
1848 DEFINE_THISCALL_WRAPPER(ios_clear
, 8)
1849 void __thiscall
ios_clear(ios
*this, int state
)
1851 TRACE("(%p %d)\n", this, state
);
1853 this->state
= state
;
1857 /* ?clrlock@ios@@QAAXXZ */
1858 /* ?clrlock@ios@@QEAAXXZ */
1859 void __cdecl
ios_clrlock(ios
*this)
1861 TRACE("(%p)\n", this);
1862 if (this->do_lock
<= 0)
1865 streambuf_clrlock(this->sb
);
1868 /* ?delbuf@ios@@QAEXH@Z */
1869 /* ?delbuf@ios@@QEAAXH@Z */
1870 DEFINE_THISCALL_WRAPPER(ios_delbuf_set
, 8)
1871 void __thiscall
ios_delbuf_set(ios
*this, int delete)
1873 TRACE("(%p %d)\n", this, delete);
1874 this->delbuf
= delete;
1877 /* ?delbuf@ios@@QBEHXZ */
1878 /* ?delbuf@ios@@QEBAHXZ */
1879 DEFINE_THISCALL_WRAPPER(ios_delbuf_get
, 4)
1880 int __thiscall
ios_delbuf_get(const ios
*this)
1882 TRACE("(%p)\n", this);
1883 return this->delbuf
;
1886 /* ?dec@@YAAAVios@@AAV1@@Z */
1887 /* ?dec@@YAAEAVios@@AEAV1@@Z */
1888 ios
* __cdecl
ios_dec(ios
*this)
1890 TRACE("(%p)\n", this);
1891 ios_setf_mask(this, FLAGS_dec
, ios_basefield
);
1895 /* ?eof@ios@@QBEHXZ */
1896 /* ?eof@ios@@QEBAHXZ */
1897 DEFINE_THISCALL_WRAPPER(ios_eof
, 4)
1898 int __thiscall
ios_eof(const ios
*this)
1900 TRACE("(%p)\n", this);
1901 return (this->state
& IOSTATE_eofbit
);
1904 /* ?fail@ios@@QBEHXZ */
1905 /* ?fail@ios@@QEBAHXZ */
1906 DEFINE_THISCALL_WRAPPER(ios_fail
, 4)
1907 int __thiscall
ios_fail(const ios
*this)
1909 TRACE("(%p)\n", this);
1910 return (this->state
& (IOSTATE_failbit
|IOSTATE_badbit
));
1913 /* ?fill@ios@@QAEDD@Z */
1914 /* ?fill@ios@@QEAADD@Z */
1915 DEFINE_THISCALL_WRAPPER(ios_fill_set
, 8)
1916 char __thiscall
ios_fill_set(ios
*this, char fill
)
1918 char prev
= this->fill
;
1920 TRACE("(%p %d)\n", this, fill
);
1926 /* ?fill@ios@@QBEDXZ */
1927 /* ?fill@ios@@QEBADXZ */
1928 DEFINE_THISCALL_WRAPPER(ios_fill_get
, 4)
1929 char __thiscall
ios_fill_get(const ios
*this)
1931 TRACE("(%p)\n", this);
1935 /* ?flags@ios@@QAEJJ@Z */
1936 /* ?flags@ios@@QEAAJJ@Z */
1937 DEFINE_THISCALL_WRAPPER(ios_flags_set
, 8)
1938 LONG __thiscall
ios_flags_set(ios
*this, LONG flags
)
1940 LONG prev
= this->flags
;
1942 TRACE("(%p %x)\n", this, flags
);
1944 this->flags
= flags
;
1948 /* ?flags@ios@@QBEJXZ */
1949 /* ?flags@ios@@QEBAJXZ */
1950 DEFINE_THISCALL_WRAPPER(ios_flags_get
, 4)
1951 LONG __thiscall
ios_flags_get(const ios
*this)
1953 TRACE("(%p)\n", this);
1957 /* ?good@ios@@QBEHXZ */
1958 /* ?good@ios@@QEBAHXZ */
1959 DEFINE_THISCALL_WRAPPER(ios_good
, 4)
1960 int __thiscall
ios_good(const ios
*this)
1962 TRACE("(%p)\n", this);
1963 return this->state
== IOSTATE_goodbit
;
1966 /* ?hex@@YAAAVios@@AAV1@@Z */
1967 /* ?hex@@YAAEAVios@@AEAV1@@Z */
1968 ios
* __cdecl
ios_hex(ios
*this)
1970 TRACE("(%p)\n", this);
1971 ios_setf_mask(this, FLAGS_hex
, ios_basefield
);
1975 /* ?init@ios@@IAEXPAVstreambuf@@@Z */
1976 /* ?init@ios@@IEAAXPEAVstreambuf@@@Z */
1977 DEFINE_THISCALL_WRAPPER(ios_init
, 8)
1978 void __thiscall
ios_init(ios
*this, streambuf
*sb
)
1980 TRACE("(%p %p)\n", this, sb
);
1981 if (this->delbuf
&& this->sb
)
1982 call_streambuf_vector_dtor(this->sb
, 1);
1985 this->state
|= IOSTATE_badbit
;
1987 this->state
&= ~IOSTATE_badbit
;
1990 /* ?iword@ios@@QBEAAJH@Z */
1991 /* ?iword@ios@@QEBAAEAJH@Z */
1992 DEFINE_THISCALL_WRAPPER(ios_iword
, 8)
1993 LONG
* __thiscall
ios_iword(const ios
*this, int index
)
1995 TRACE("(%p %d)\n", this, index
);
1996 return &ios_statebuf
[index
];
1999 /* ?lock@ios@@QAAXXZ */
2000 /* ?lock@ios@@QEAAXXZ */
2001 void __cdecl
ios_lock(ios
*this)
2003 TRACE("(%p)\n", this);
2004 if (this->do_lock
< 0)
2005 EnterCriticalSection(&this->lock
);
2008 /* ?lockbuf@ios@@QAAXXZ */
2009 /* ?lockbuf@ios@@QEAAXXZ */
2010 void __cdecl
ios_lockbuf(ios
*this)
2012 TRACE("(%p)\n", this);
2013 streambuf_lock(this->sb
);
2016 /* ?lockc@ios@@KAXXZ */
2017 void __cdecl
ios_lockc(void)
2020 EnterCriticalSection(&ios_static_lock
);
2023 /* ?lockptr@ios@@IAEPAU_CRT_CRITICAL_SECTION@@XZ */
2024 /* ?lockptr@ios@@IEAAPEAU_CRT_CRITICAL_SECTION@@XZ */
2025 DEFINE_THISCALL_WRAPPER(ios_lockptr
, 4)
2026 CRITICAL_SECTION
* __thiscall
ios_lockptr(ios
*this)
2028 TRACE("(%p)\n", this);
2032 /* ?oct@@YAAAVios@@AAV1@@Z */
2033 /* ?oct@@YAAEAVios@@AEAV1@@Z */
2034 ios
* __cdecl
ios_oct(ios
*this)
2036 TRACE("(%p)\n", this);
2037 ios_setf_mask(this, FLAGS_oct
, ios_basefield
);
2041 /* ?precision@ios@@QAEHH@Z */
2042 /* ?precision@ios@@QEAAHH@Z */
2043 DEFINE_THISCALL_WRAPPER(ios_precision_set
, 8)
2044 int __thiscall
ios_precision_set(ios
*this, int prec
)
2046 int prev
= this->precision
;
2048 TRACE("(%p %d)\n", this, prec
);
2050 this->precision
= prec
;
2054 /* ?precision@ios@@QBEHXZ */
2055 /* ?precision@ios@@QEBAHXZ */
2056 DEFINE_THISCALL_WRAPPER(ios_precision_get
, 4)
2057 int __thiscall
ios_precision_get(const ios
*this)
2059 TRACE("(%p)\n", this);
2060 return this->precision
;
2063 /* ?pword@ios@@QBEAAPAXH@Z */
2064 /* ?pword@ios@@QEBAAEAPEAXH@Z */
2065 DEFINE_THISCALL_WRAPPER(ios_pword
, 8)
2066 void** __thiscall
ios_pword(const ios
*this, int index
)
2068 TRACE("(%p %d)\n", this, index
);
2069 return (void**)&ios_statebuf
[index
];
2072 /* ?rdbuf@ios@@QBEPAVstreambuf@@XZ */
2073 /* ?rdbuf@ios@@QEBAPEAVstreambuf@@XZ */
2074 DEFINE_THISCALL_WRAPPER(ios_rdbuf
, 4)
2075 streambuf
* __thiscall
ios_rdbuf(const ios
*this)
2077 TRACE("(%p)\n", this);
2081 /* ?rdstate@ios@@QBEHXZ */
2082 /* ?rdstate@ios@@QEBAHXZ */
2083 DEFINE_THISCALL_WRAPPER(ios_rdstate
, 4)
2084 int __thiscall
ios_rdstate(const ios
*this)
2086 TRACE("(%p)\n", this);
2090 /* ?setf@ios@@QAEJJ@Z */
2091 /* ?setf@ios@@QEAAJJ@Z */
2092 DEFINE_THISCALL_WRAPPER(ios_setf
, 8)
2093 LONG __thiscall
ios_setf(ios
*this, LONG flags
)
2095 LONG prev
= this->flags
;
2097 TRACE("(%p %x)\n", this, flags
);
2100 this->flags
|= flags
;
2105 /* ?setf@ios@@QAEJJJ@Z */
2106 /* ?setf@ios@@QEAAJJJ@Z */
2107 DEFINE_THISCALL_WRAPPER(ios_setf_mask
, 12)
2108 LONG __thiscall
ios_setf_mask(ios
*this, LONG flags
, LONG mask
)
2110 LONG prev
= this->flags
;
2112 TRACE("(%p %x %x)\n", this, flags
, mask
);
2115 this->flags
= (this->flags
& (~mask
)) | (flags
& mask
);
2120 /* ?setlock@ios@@QAAXXZ */
2121 /* ?setlock@ios@@QEAAXXZ */
2122 void __cdecl
ios_setlock(ios
*this)
2124 TRACE("(%p)\n", this);
2127 streambuf_setlock(this->sb
);
2130 /* ?sync_with_stdio@ios@@SAXXZ */
2131 void __cdecl
ios_sync_with_stdio(void)
2136 /* ?tie@ios@@QAEPAVostream@@PAV2@@Z */
2137 /* ?tie@ios@@QEAAPEAVostream@@PEAV2@@Z */
2138 DEFINE_THISCALL_WRAPPER(ios_tie_set
, 8)
2139 ostream
* __thiscall
ios_tie_set(ios
*this, ostream
*ostr
)
2141 ostream
*prev
= this->tie
;
2143 TRACE("(%p %p)\n", this, ostr
);
2149 /* ?tie@ios@@QBEPAVostream@@XZ */
2150 /* ?tie@ios@@QEBAPEAVostream@@XZ */
2151 DEFINE_THISCALL_WRAPPER(ios_tie_get
, 4)
2152 ostream
* __thiscall
ios_tie_get(const ios
*this)
2154 TRACE("(%p)\n", this);
2158 /* ?unlock@ios@@QAAXXZ */
2159 /* ?unlock@ios@@QEAAXXZ */
2160 void __cdecl
ios_unlock(ios
*this)
2162 TRACE("(%p)\n", this);
2163 if (this->do_lock
< 0)
2164 LeaveCriticalSection(&this->lock
);
2167 /* ?unlockbuf@ios@@QAAXXZ */
2168 /* ?unlockbuf@ios@@QEAAXXZ */
2169 void __cdecl
ios_unlockbuf(ios
*this)
2171 TRACE("(%p)\n", this);
2172 streambuf_unlock(this->sb
);
2175 /* ?unlockc@ios@@KAXXZ */
2176 void __cdecl
ios_unlockc(void)
2179 LeaveCriticalSection(&ios_static_lock
);
2182 /* ?unsetf@ios@@QAEJJ@Z */
2183 /* ?unsetf@ios@@QEAAJJ@Z */
2184 DEFINE_THISCALL_WRAPPER(ios_unsetf
, 8)
2185 LONG __thiscall
ios_unsetf(ios
*this, LONG flags
)
2187 LONG prev
= this->flags
;
2189 TRACE("(%p %x)\n", this, flags
);
2192 this->flags
&= ~flags
;
2197 /* ?width@ios@@QAEHH@Z */
2198 /* ?width@ios@@QEAAHH@Z */
2199 DEFINE_THISCALL_WRAPPER(ios_width_set
, 8)
2200 int __thiscall
ios_width_set(ios
*this, int width
)
2202 int prev
= this->width
;
2204 TRACE("(%p %d)\n", this, width
);
2206 this->width
= width
;
2210 /* ?width@ios@@QBEHXZ */
2211 /* ?width@ios@@QEBAHXZ */
2212 DEFINE_THISCALL_WRAPPER(ios_width_get
, 4)
2213 int __thiscall
ios_width_get(const ios
*this)
2215 TRACE("(%p)\n", this);
2219 /* ?xalloc@ios@@SAHXZ */
2220 int __cdecl
ios_xalloc(void)
2227 ret
= (ios_curindex
< STATEBUF_SIZE
-1) ? ++ios_curindex
: -1;
2232 /* ??0ostream@@QAE@PAVstreambuf@@@Z */
2233 /* ??0ostream@@QEAA@PEAVstreambuf@@@Z */
2234 DEFINE_THISCALL_WRAPPER(ostream_sb_ctor
, 12)
2235 ostream
* __thiscall
ostream_sb_ctor(ostream
*this, streambuf
*sb
, BOOL virt_init
)
2237 FIXME("(%p %p %d) stub\n", this, sb
, virt_init
);
2241 /* ??0ostream@@IAE@ABV0@@Z */
2242 /* ??0ostream@@IEAA@AEBV0@@Z */
2243 DEFINE_THISCALL_WRAPPER(ostream_copy_ctor
, 12)
2244 ostream
* __thiscall
ostream_copy_ctor(ostream
*this, const ostream
*copy
, BOOL virt_init
)
2246 FIXME("(%p %p %d) stub\n", this, copy
, virt_init
);
2250 /* ??0ostream@@IAE@XZ */
2251 /* ??0ostream@@IEAA@XZ */
2252 DEFINE_THISCALL_WRAPPER(ostream_ctor
, 8)
2253 ostream
* __thiscall
ostream_ctor(ostream
*this, BOOL virt_init
)
2255 FIXME("(%p %d) stub\n", this, virt_init
);
2259 /* ??1ostream@@UAE@XZ */
2260 /* ??1ostream@@UEAA@XZ */
2261 DEFINE_THISCALL_WRAPPER(ostream_dtor
, 4)
2262 void __thiscall
ostream_dtor(ios
*base
)
2264 FIXME("(%p) stub\n", base
);
2267 /* ??4ostream@@IAEAAV0@PAVstreambuf@@@Z */
2268 /* ??4ostream@@IEAAAEAV0@PEAVstreambuf@@@Z */
2269 DEFINE_THISCALL_WRAPPER(ostream_assign_sb
, 8)
2270 ostream
* __thiscall
ostream_assign_sb(ostream
*this, streambuf
*sb
)
2272 FIXME("(%p %p) stub\n", this, sb
);
2276 /* ??4ostream@@IAEAAV0@ABV0@@Z */
2277 /* ??4ostream@@IEAAAEAV0@AEBV0@@Z */
2278 DEFINE_THISCALL_WRAPPER(ostream_assign
, 8)
2279 ostream
* __thiscall
ostream_assign(ostream
*this, const ostream
*rhs
)
2281 FIXME("(%p %p) stub\n", this, rhs
);
2285 /* ??_Dostream@@QAEXXZ */
2286 /* ??_Dostream@@QEAAXXZ */
2287 DEFINE_THISCALL_WRAPPER(ostream_vbase_dtor
, 4)
2288 void __thiscall
ostream_vbase_dtor(ostream
*this)
2290 FIXME("(%p) stub\n", this);
2293 /* ??_Eostream@@UAEPAXI@Z */
2294 DEFINE_THISCALL_WRAPPER(ostream_vector_dtor
, 8)
2295 ostream
* __thiscall
ostream_vector_dtor(ios
*base
, unsigned int flags
)
2297 FIXME("(%p %x) stub\n", base
, flags
);
2301 /* ??_Gostream@@UAEPAXI@Z */
2302 DEFINE_THISCALL_WRAPPER(ostream_scalar_dtor
, 8)
2303 ostream
* __thiscall
ostream_scalar_dtor(ios
*base
, unsigned int flags
)
2305 FIXME("(%p %x) stub\n", base
, flags
);
2309 /* ?flush@ostream@@QAEAAV1@XZ */
2310 /* ?flush@ostream@@QEAAAEAV1@XZ */
2311 DEFINE_THISCALL_WRAPPER(ostream_flush
, 4)
2312 ostream
* __thiscall
ostream_flush(ostream
*this)
2314 FIXME("(%p) stub\n", this);
2318 /* ?opfx@ostream@@QAEHXZ */
2319 /* ?opfx@ostream@@QEAAHXZ */
2320 DEFINE_THISCALL_WRAPPER(ostream_opfx
, 4)
2321 int __thiscall
ostream_opfx(ostream
*this)
2323 FIXME("(%p) stub\n", this);
2327 /* ?osfx@ostream@@QAEXXZ */
2328 /* ?osfx@ostream@@QEAAXXZ */
2329 DEFINE_THISCALL_WRAPPER(ostream_osfx
, 4)
2330 void __thiscall
ostream_osfx(ostream
*this)
2332 FIXME("(%p) stub\n", this);
2335 /* ?put@ostream@@QAEAAV1@D@Z */
2336 /* ?put@ostream@@QEAAAEAV1@D@Z */
2337 DEFINE_THISCALL_WRAPPER(ostream_put_char
, 8)
2338 ostream
* __thiscall
ostream_put_char(ostream
*this, char c
)
2340 FIXME("(%p %c) stub\n", this, c
);
2344 /* ?put@ostream@@QAEAAV1@C@Z */
2345 /* ?put@ostream@@QEAAAEAV1@C@Z */
2346 DEFINE_THISCALL_WRAPPER(ostream_put_signed_char
, 8)
2347 ostream
* __thiscall
ostream_put_signed_char(ostream
*this, signed char c
)
2349 FIXME("(%p %c) stub\n", this, c
);
2353 /* ?put@ostream@@QAEAAV1@E@Z */
2354 /* ?put@ostream@@QEAAAEAV1@E@Z */
2355 DEFINE_THISCALL_WRAPPER(ostream_put_unsigned_char
, 8)
2356 ostream
* __thiscall
ostream_put_unsigned_char(ostream
*this, unsigned char c
)
2358 FIXME("(%p %c) stub\n", this, c
);
2362 /* ?seekp@ostream@@QAEAAV1@J@Z */
2363 /* ?seekp@ostream@@QEAAAEAV1@J@Z */
2364 DEFINE_THISCALL_WRAPPER(ostream_seekp
, 8)
2365 ostream
* __thiscall
ostream_seekp(ostream
*this, streampos pos
)
2367 FIXME("(%p %d) stub\n", this, pos
);
2371 /* ?seekp@ostream@@QAEAAV1@JW4seek_dir@ios@@@Z */
2372 /* ?seekp@ostream@@QEAAAEAV1@JW4seek_dir@ios@@@Z */
2373 DEFINE_THISCALL_WRAPPER(ostream_seekp_offset
, 12)
2374 ostream
* __thiscall
ostream_seekp_offset(ostream
*this, streamoff off
, ios_seek_dir dir
)
2376 FIXME("(%p %d %d) stub\n", this, off
, dir
);
2380 /* ?tellp@ostream@@QAEJXZ */
2381 /* ?tellp@ostream@@QEAAJXZ */
2382 DEFINE_THISCALL_WRAPPER(ostream_tellp
, 4)
2383 streampos __thiscall
ostream_tellp(ostream
*this)
2385 FIXME("(%p) stub\n", this);
2389 /* ?write@ostream@@QAEAAV1@PBDH@Z */
2390 /* ?write@ostream@@QEAAAEAV1@PEBDH@Z */
2391 DEFINE_THISCALL_WRAPPER(ostream_write_char
, 12)
2392 ostream
* __thiscall
ostream_write_char(ostream
*this, const char *str
, int count
)
2394 FIXME("(%p %s %d) stub\n", this, str
, count
);
2398 /* ?write@ostream@@QAEAAV1@PBCH@Z */
2399 /* ?write@ostream@@QEAAAEAV1@PEBCH@Z */
2400 DEFINE_THISCALL_WRAPPER(ostream_write_signed_char
, 12)
2401 ostream
* __thiscall
ostream_write_signed_char(ostream
*this, const signed char *str
, int count
)
2403 FIXME("(%p %s %d) stub\n", this, str
, count
);
2407 /* ?write@ostream@@QAEAAV1@PBEH@Z */
2408 /* ?write@ostream@@QEAAAEAV1@PEBEH@Z */
2409 DEFINE_THISCALL_WRAPPER(ostream_write_unsigned_char
, 12)
2410 ostream
* __thiscall
ostream_write_unsigned_char(ostream
*this, const unsigned char *str
, int count
)
2412 FIXME("(%p %s %d) stub\n", this, str
, count
);
2416 /* ?writepad@ostream@@AAEAAV1@PBD0@Z */
2417 /* ?writepad@ostream@@AEAAAEAV1@PEBD0@Z */
2418 DEFINE_THISCALL_WRAPPER(ostream_writepad
, 12)
2419 ostream
* __thiscall
ostream_writepad(ostream
*this, const char *str1
, const char *str2
)
2421 FIXME("(%p %s %s) stub\n", this, str1
, str2
);
2425 /* ?endl@@YAAAVostream@@AAV1@@Z */
2426 /* ?endl@@YAAEAVostream@@AEAV1@@Z */
2427 ostream
* __cdecl
ostream_endl(ostream
*this)
2429 FIXME("(%p) stub\n", this);
2433 /* ?ends@@YAAAVostream@@AAV1@@Z */
2434 /* ?ends@@YAAEAVostream@@AEAV1@@Z */
2435 ostream
* __cdecl
ostream_ends(ostream
*this)
2437 FIXME("(%p) stub\n", this);
2441 /* ?flush@@YAAAVostream@@AAV1@@Z */
2442 /* ?flush@@YAAEAVostream@@AEAV1@@Z */
2443 ostream
* __cdecl
ostream_flush_manip(ostream
*this)
2445 FIXME("(%p) stub\n", this);
2449 /******************************************************************
2450 * ??0ostrstream@@QAE@XZ (MSVCRTI.@)
2452 DEFINE_THISCALL_WRAPPER(MSVCIRT_ostrstream_ctor
,8)
2453 void * __thiscall
MSVCIRT_ostrstream_ctor(ostream
*this, BOOL virt_init
)
2455 FIXME("(%p %x) stub\n", this, virt_init
);
2459 /******************************************************************
2460 * ??1ostrstream@@UAE@XZ (MSVCRTI.@)
2462 DEFINE_THISCALL_WRAPPER(MSVCIRT_ostrstream_dtor
,4)
2463 void __thiscall
MSVCIRT_ostrstream_dtor(ios
*base
)
2465 FIXME("(%p) stub\n", base
);
2468 /******************************************************************
2469 * ??6ostream@@QAEAAV0@E@Z (MSVCRTI.@)
2470 * class ostream & __thiscall ostream::operator<<(unsigned char)
2472 DEFINE_THISCALL_WRAPPER(MSVCIRT_operator_sl_uchar
,8)
2473 void * __thiscall
MSVCIRT_operator_sl_uchar(ostream
* _this
, unsigned char ch
)
2475 FIXME("(%p)->(%c) stub\n", _this
, ch
);
2479 /******************************************************************
2480 * ??6ostream@@QAEAAV0@H@Z (MSVCRTI.@)
2481 * class ostream & __thiscall ostream::operator<<(int)
2483 DEFINE_THISCALL_WRAPPER(MSVCIRT_operator_sl_int
,8)
2484 void * __thiscall
MSVCIRT_operator_sl_int(ostream
* _this
, int integer
)
2486 FIXME("(%p)->(%d) stub\n", _this
, integer
);
2490 /******************************************************************
2491 * ??6ostream@@QAEAAV0@PBD@Z (MSVCRTI.@)
2492 * class ostream & __thiscall ostream::operator<<(char const *)
2494 DEFINE_THISCALL_WRAPPER(MSVCIRT_operator_sl_pchar
,8)
2495 void * __thiscall
MSVCIRT_operator_sl_pchar(ostream
* _this
, const char * string
)
2497 FIXME("(%p)->(%s) stub\n", _this
, debugstr_a(string
));
2501 /******************************************************************
2502 * ??6ostream@@QAEAAV0@P6AAAV0@AAV0@@Z@Z (MSVCRTI.@)
2503 * class ostream & __thiscall ostream::operator<<(class ostream & (__cdecl*)(class ostream &))
2505 DEFINE_THISCALL_WRAPPER(MSVCIRT_operator_sl_callback
,8)
2506 void * __thiscall
MSVCIRT_operator_sl_callback(ostream
* _this
, ostream
* (__cdecl
*func
)(ostream
*))
2508 TRACE("%p, %p\n", _this
, func
);
2514 #define DEFINE_VTBL_WRAPPER(off) \
2515 __ASM_GLOBAL_FUNC(vtbl_wrapper_ ## off, \
2519 "movl 0(%ecx), %eax\n\t" \
2520 "jmp *" #off "(%eax)\n\t")
2522 DEFINE_VTBL_WRAPPER(0);
2523 DEFINE_VTBL_WRAPPER(4);
2524 DEFINE_VTBL_WRAPPER(8);
2525 DEFINE_VTBL_WRAPPER(12);
2526 DEFINE_VTBL_WRAPPER(16);
2527 DEFINE_VTBL_WRAPPER(20);
2528 DEFINE_VTBL_WRAPPER(24);
2529 DEFINE_VTBL_WRAPPER(28);
2530 DEFINE_VTBL_WRAPPER(32);
2531 DEFINE_VTBL_WRAPPER(36);
2532 DEFINE_VTBL_WRAPPER(40);
2533 DEFINE_VTBL_WRAPPER(44);
2534 DEFINE_VTBL_WRAPPER(48);
2535 DEFINE_VTBL_WRAPPER(52);
2536 DEFINE_VTBL_WRAPPER(56);
2540 void* (__cdecl
*MSVCRT_operator_new
)(SIZE_T
);
2541 void (__cdecl
*MSVCRT_operator_delete
)(void*);
2543 static void init_cxx_funcs(void)
2545 HMODULE hmod
= GetModuleHandleA("msvcrt.dll");
2547 if (sizeof(void *) > sizeof(int)) /* 64-bit has different names */
2549 MSVCRT_operator_new
= (void*)GetProcAddress(hmod
, "??2@YAPEAX_K@Z");
2550 MSVCRT_operator_delete
= (void*)GetProcAddress(hmod
, "??3@YAXPEAX@Z");
2554 MSVCRT_operator_new
= (void*)GetProcAddress(hmod
, "??2@YAPAXI@Z");
2555 MSVCRT_operator_delete
= (void*)GetProcAddress(hmod
, "??3@YAXPAX@Z");
2559 static void init_io(void *base
)
2562 init_streambuf_rtti(base
);
2563 init_filebuf_rtti(base
);
2564 init_strstreambuf_rtti(base
);
2565 init_stdiobuf_rtti(base
);
2566 init_ios_rtti(base
);
2567 init_ostream_rtti(base
);
2571 BOOL WINAPI
DllMain( HINSTANCE inst
, DWORD reason
, LPVOID reserved
)
2575 case DLL_WINE_PREATTACH
:
2576 return FALSE
; /* prefer native version */
2577 case DLL_PROCESS_ATTACH
:
2579 init_exception(inst
);
2581 DisableThreadLibraryCalls( inst
);