2 * Copyright (C) 2007 Alexandre Julliard
3 * Copyright (C) 2015 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
;
123 const vtable_ptr
*vtable
;
128 struct _ostream
*tie
;
134 CRITICAL_SECTION lock
;
137 ios
* __thiscall
ios_assign(ios
*, const ios
*);
138 int __thiscall
ios_fail(const ios
*);
139 void __cdecl
ios_lock(ios
*);
140 void __cdecl
ios_lockc(void);
141 LONG __thiscall
ios_setf_mask(ios
*, LONG
, LONG
);
142 void __cdecl
ios_unlock(ios
*);
143 void __cdecl
ios_unlockc(void);
146 typedef struct _ostream
{
147 const vtable_ptr
*vtable
;
150 /* ??_7streambuf@@6B@ */
151 extern const vtable_ptr MSVCP_streambuf_vtable
;
152 /* ??_7filebuf@@6B@ */
153 extern const vtable_ptr MSVCP_filebuf_vtable
;
154 /* ??_7strstreambuf@@6B@ */
155 extern const vtable_ptr MSVCP_strstreambuf_vtable
;
157 extern const vtable_ptr MSVCP_ios_vtable
;
160 void __asm_dummy_vtables(void) {
162 __ASM_VTABLE(streambuf
,
163 VTABLE_ADD_FUNC(streambuf_vector_dtor
)
164 VTABLE_ADD_FUNC(streambuf_sync
)
165 VTABLE_ADD_FUNC(streambuf_setbuf
)
166 VTABLE_ADD_FUNC(streambuf_seekoff
)
167 VTABLE_ADD_FUNC(streambuf_seekpos
)
168 VTABLE_ADD_FUNC(streambuf_xsputn
)
169 VTABLE_ADD_FUNC(streambuf_xsgetn
)
170 VTABLE_ADD_FUNC(streambuf_overflow
)
171 VTABLE_ADD_FUNC(streambuf_underflow
)
172 VTABLE_ADD_FUNC(streambuf_pbackfail
)
173 VTABLE_ADD_FUNC(streambuf_doallocate
));
174 __ASM_VTABLE(filebuf
,
175 VTABLE_ADD_FUNC(filebuf_vector_dtor
)
176 VTABLE_ADD_FUNC(filebuf_sync
)
177 VTABLE_ADD_FUNC(filebuf_setbuf
)
178 VTABLE_ADD_FUNC(filebuf_seekoff
)
179 VTABLE_ADD_FUNC(streambuf_seekpos
)
180 VTABLE_ADD_FUNC(streambuf_xsputn
)
181 VTABLE_ADD_FUNC(streambuf_xsgetn
)
182 VTABLE_ADD_FUNC(filebuf_overflow
)
183 VTABLE_ADD_FUNC(filebuf_underflow
)
184 VTABLE_ADD_FUNC(streambuf_pbackfail
)
185 VTABLE_ADD_FUNC(streambuf_doallocate
));
186 __ASM_VTABLE(strstreambuf
,
187 VTABLE_ADD_FUNC(strstreambuf_vector_dtor
)
188 VTABLE_ADD_FUNC(strstreambuf_sync
)
189 VTABLE_ADD_FUNC(strstreambuf_setbuf
)
190 VTABLE_ADD_FUNC(strstreambuf_seekoff
)
191 VTABLE_ADD_FUNC(streambuf_seekpos
)
192 VTABLE_ADD_FUNC(streambuf_xsputn
)
193 VTABLE_ADD_FUNC(streambuf_xsgetn
)
194 VTABLE_ADD_FUNC(strstreambuf_overflow
)
195 VTABLE_ADD_FUNC(strstreambuf_underflow
)
196 VTABLE_ADD_FUNC(streambuf_pbackfail
)
197 VTABLE_ADD_FUNC(strstreambuf_doallocate
));
199 VTABLE_ADD_FUNC(ios_vector_dtor
));
204 DEFINE_RTTI_DATA0(streambuf
, 0, ".?AVstreambuf@@")
205 DEFINE_RTTI_DATA1(filebuf
, 0, &streambuf_rtti_base_descriptor
, ".?AVfilebuf@@")
206 DEFINE_RTTI_DATA1(strstreambuf
, 0, &streambuf_rtti_base_descriptor
, ".?AVstrstreambuf@@")
207 DEFINE_RTTI_DATA0(ios
, 0, ".?AVios@@")
209 /* ??0streambuf@@IAE@PADH@Z */
210 /* ??0streambuf@@IEAA@PEADH@Z */
211 DEFINE_THISCALL_WRAPPER(streambuf_reserve_ctor
, 12)
212 streambuf
* __thiscall
streambuf_reserve_ctor(streambuf
*this, char *buffer
, int length
)
214 TRACE("(%p %p %d)\n", this, buffer
, length
);
215 this->vtable
= &MSVCP_streambuf_vtable
;
217 this->stored_char
= EOF
;
220 streambuf_setbuf(this, buffer
, length
);
221 streambuf_setg(this, NULL
, NULL
, NULL
);
222 streambuf_setp(this, NULL
, NULL
);
223 InitializeCriticalSection(&this->lock
);
227 /* ??0streambuf@@IAE@XZ */
228 /* ??0streambuf@@IEAA@XZ */
229 DEFINE_THISCALL_WRAPPER(streambuf_ctor
, 4)
230 streambuf
* __thiscall
streambuf_ctor(streambuf
*this)
232 streambuf_reserve_ctor(this, NULL
, 0);
233 this->unbuffered
= 0;
237 /* ??0streambuf@@QAE@ABV0@@Z */
238 /* ??0streambuf@@QEAA@AEBV0@@Z */
239 DEFINE_THISCALL_WRAPPER(streambuf_copy_ctor
, 8)
240 streambuf
* __thiscall
streambuf_copy_ctor(streambuf
*this, const streambuf
*copy
)
242 TRACE("(%p %p)\n", this, copy
);
244 this->vtable
= &MSVCP_streambuf_vtable
;
248 /* ??1streambuf@@UAE@XZ */
249 /* ??1streambuf@@UEAA@XZ */
250 DEFINE_THISCALL_WRAPPER(streambuf_dtor
, 4)
251 void __thiscall
streambuf_dtor(streambuf
*this)
253 TRACE("(%p)\n", this);
255 MSVCRT_operator_delete(this->base
);
256 DeleteCriticalSection(&this->lock
);
259 /* ??4streambuf@@QAEAAV0@ABV0@@Z */
260 /* ??4streambuf@@QEAAAEAV0@AEBV0@@Z */
261 DEFINE_THISCALL_WRAPPER(streambuf_assign
, 8)
262 streambuf
* __thiscall
streambuf_assign(streambuf
*this, const streambuf
*rhs
)
264 streambuf_dtor(this);
265 return streambuf_copy_ctor(this, rhs
);
268 /* ??_Estreambuf@@UAEPAXI@Z */
269 DEFINE_THISCALL_WRAPPER(streambuf_vector_dtor
, 8)
270 #define call_streambuf_vector_dtor(this, flags) CALL_VTBL_FUNC(this, 0,\
271 streambuf*, (streambuf*, unsigned int), (this, flags))
272 streambuf
* __thiscall
streambuf_vector_dtor(streambuf
*this, unsigned int flags
)
274 TRACE("(%p %x)\n", this, flags
);
276 /* we have an array, with the number of elements stored before the first object */
277 INT_PTR i
, *ptr
= (INT_PTR
*)this-1;
279 for (i
= *ptr
-1; i
>= 0; i
--)
280 streambuf_dtor(this+i
);
281 MSVCRT_operator_delete(ptr
);
283 streambuf_dtor(this);
285 MSVCRT_operator_delete(this);
290 /* ??_Gstreambuf@@UAEPAXI@Z */
291 DEFINE_THISCALL_WRAPPER(streambuf_scalar_dtor
, 8)
292 streambuf
* __thiscall
streambuf_scalar_dtor(streambuf
*this, unsigned int flags
)
294 TRACE("(%p %x)\n", this, flags
);
295 streambuf_dtor(this);
296 if (flags
& 1) MSVCRT_operator_delete(this);
300 /* ?doallocate@streambuf@@MAEHXZ */
301 /* ?doallocate@streambuf@@MEAAHXZ */
302 DEFINE_THISCALL_WRAPPER(streambuf_doallocate
, 4)
303 #define call_streambuf_doallocate(this) CALL_VTBL_FUNC(this, 40, int, (streambuf*), (this))
304 int __thiscall
streambuf_doallocate(streambuf
*this)
308 TRACE("(%p)\n", this);
309 reserve
= MSVCRT_operator_new(RESERVE_SIZE
);
313 streambuf_setb(this, reserve
, reserve
+ RESERVE_SIZE
, 1);
317 /* ?allocate@streambuf@@IAEHXZ */
318 /* ?allocate@streambuf@@IEAAHXZ */
319 DEFINE_THISCALL_WRAPPER(streambuf_allocate
, 4)
320 int __thiscall
streambuf_allocate(streambuf
*this)
322 TRACE("(%p)\n", this);
323 if (this->base
!= NULL
|| this->unbuffered
)
325 return call_streambuf_doallocate(this);
328 /* ?base@streambuf@@IBEPADXZ */
329 /* ?base@streambuf@@IEBAPEADXZ */
330 DEFINE_THISCALL_WRAPPER(streambuf_base
, 4)
331 char* __thiscall
streambuf_base(const streambuf
*this)
333 TRACE("(%p)\n", this);
337 /* ?blen@streambuf@@IBEHXZ */
338 /* ?blen@streambuf@@IEBAHXZ */
339 DEFINE_THISCALL_WRAPPER(streambuf_blen
, 4)
340 int __thiscall
streambuf_blen(const streambuf
*this)
342 TRACE("(%p)\n", this);
343 return this->ebuf
- this->base
;
346 /* ?eback@streambuf@@IBEPADXZ */
347 /* ?eback@streambuf@@IEBAPEADXZ */
348 DEFINE_THISCALL_WRAPPER(streambuf_eback
, 4)
349 char* __thiscall
streambuf_eback(const streambuf
*this)
351 TRACE("(%p)\n", this);
355 /* ?ebuf@streambuf@@IBEPADXZ */
356 /* ?ebuf@streambuf@@IEBAPEADXZ */
357 DEFINE_THISCALL_WRAPPER(streambuf_ebuf
, 4)
358 char* __thiscall
streambuf_ebuf(const streambuf
*this)
360 TRACE("(%p)\n", this);
364 /* ?egptr@streambuf@@IBEPADXZ */
365 /* ?egptr@streambuf@@IEBAPEADXZ */
366 DEFINE_THISCALL_WRAPPER(streambuf_egptr
, 4)
367 char* __thiscall
streambuf_egptr(const streambuf
*this)
369 TRACE("(%p)\n", this);
373 /* ?epptr@streambuf@@IBEPADXZ */
374 /* ?epptr@streambuf@@IEBAPEADXZ */
375 DEFINE_THISCALL_WRAPPER(streambuf_epptr
, 4)
376 char* __thiscall
streambuf_epptr(const streambuf
*this)
378 TRACE("(%p)\n", this);
382 /* ?gptr@streambuf@@IBEPADXZ */
383 /* ?gptr@streambuf@@IEBAPEADXZ */
384 DEFINE_THISCALL_WRAPPER(streambuf_gptr
, 4)
385 char* __thiscall
streambuf_gptr(const streambuf
*this)
387 TRACE("(%p)\n", this);
391 /* ?pbase@streambuf@@IBEPADXZ */
392 /* ?pbase@streambuf@@IEBAPEADXZ */
393 DEFINE_THISCALL_WRAPPER(streambuf_pbase
, 4)
394 char* __thiscall
streambuf_pbase(const streambuf
*this)
396 TRACE("(%p)\n", this);
400 /* ?pptr@streambuf@@IBEPADXZ */
401 /* ?pptr@streambuf@@IEBAPEADXZ */
402 DEFINE_THISCALL_WRAPPER(streambuf_pptr
, 4)
403 char* __thiscall
streambuf_pptr(const streambuf
*this)
405 TRACE("(%p)\n", this);
409 /* ?clrlock@streambuf@@QAEXXZ */
410 /* ?clrlock@streambuf@@QEAAXXZ */
411 DEFINE_THISCALL_WRAPPER(streambuf_clrlock
, 4)
412 void __thiscall
streambuf_clrlock(streambuf
*this)
414 TRACE("(%p)\n", this);
415 if (this->do_lock
<= 0)
419 /* ?lock@streambuf@@QAEXXZ */
420 /* ?lock@streambuf@@QEAAXXZ */
421 DEFINE_THISCALL_WRAPPER(streambuf_lock
, 4)
422 void __thiscall
streambuf_lock(streambuf
*this)
424 TRACE("(%p)\n", this);
425 if (this->do_lock
< 0)
426 EnterCriticalSection(&this->lock
);
429 /* ?lockptr@streambuf@@IAEPAU_CRT_CRITICAL_SECTION@@XZ */
430 /* ?lockptr@streambuf@@IEAAPEAU_CRT_CRITICAL_SECTION@@XZ */
431 DEFINE_THISCALL_WRAPPER(streambuf_lockptr
, 4)
432 CRITICAL_SECTION
* __thiscall
streambuf_lockptr(streambuf
*this)
434 TRACE("(%p)\n", this);
438 /* ?gbump@streambuf@@IAEXH@Z */
439 /* ?gbump@streambuf@@IEAAXH@Z */
440 DEFINE_THISCALL_WRAPPER(streambuf_gbump
, 8)
441 void __thiscall
streambuf_gbump(streambuf
*this, int count
)
443 TRACE("(%p %d)\n", this, count
);
447 /* ?pbump@streambuf@@IAEXH@Z */
448 /* ?pbump@streambuf@@IEAAXH@Z */
449 DEFINE_THISCALL_WRAPPER(streambuf_pbump
, 8)
450 void __thiscall
streambuf_pbump(streambuf
*this, int count
)
452 TRACE("(%p %d)\n", this, count
);
456 /* ?in_avail@streambuf@@QBEHXZ */
457 /* ?in_avail@streambuf@@QEBAHXZ */
458 DEFINE_THISCALL_WRAPPER(streambuf_in_avail
, 4)
459 int __thiscall
streambuf_in_avail(const streambuf
*this)
461 TRACE("(%p)\n", this);
462 return this->egptr
- this->gptr
;
465 /* ?out_waiting@streambuf@@QBEHXZ */
466 /* ?out_waiting@streambuf@@QEBAHXZ */
467 DEFINE_THISCALL_WRAPPER(streambuf_out_waiting
, 4)
468 int __thiscall
streambuf_out_waiting(const streambuf
*this)
470 TRACE("(%p)\n", this);
471 return this->pptr
- this->pbase
;
475 DEFINE_THISCALL_WRAPPER(streambuf_overflow
, 8)
476 #define call_streambuf_overflow(this, c) CALL_VTBL_FUNC(this, 28, int, (streambuf*, int), (this, c))
477 int __thiscall
streambuf_overflow(streambuf
*this, int c
)
479 ERR("overflow is not implemented in streambuf\n");
483 /* ?pbackfail@streambuf@@UAEHH@Z */
484 /* ?pbackfail@streambuf@@UEAAHH@Z */
485 DEFINE_THISCALL_WRAPPER(streambuf_pbackfail
, 8)
486 #define call_streambuf_pbackfail(this, c) CALL_VTBL_FUNC(this, 36, int, (streambuf*, int), (this, c))
487 int __thiscall
streambuf_pbackfail(streambuf
*this, int c
)
489 TRACE("(%p %d)\n", this, c
);
490 if (this->gptr
<= this->eback
)
492 return *--this->gptr
= c
;
495 /* ?seekoff@streambuf@@UAEJJW4seek_dir@ios@@H@Z */
496 /* ?seekoff@streambuf@@UEAAJJW4seek_dir@ios@@H@Z */
497 DEFINE_THISCALL_WRAPPER(streambuf_seekoff
, 16)
498 #define call_streambuf_seekoff(this, off, dir, mode) CALL_VTBL_FUNC(this, 12, streampos, (streambuf*, streamoff, ios_seek_dir, int), (this, off, dir, mode))
499 streampos __thiscall
streambuf_seekoff(streambuf
*this, streamoff offset
, ios_seek_dir dir
, int mode
)
501 TRACE("(%p %d %d %d)\n", this, offset
, dir
, mode
);
505 /* ?seekpos@streambuf@@UAEJJH@Z */
506 /* ?seekpos@streambuf@@UEAAJJH@Z */
507 DEFINE_THISCALL_WRAPPER(streambuf_seekpos
, 12)
508 streampos __thiscall
streambuf_seekpos(streambuf
*this, streampos pos
, int mode
)
510 TRACE("(%p %d %d)\n", this, pos
, mode
);
511 return call_streambuf_seekoff(this, pos
, SEEKDIR_beg
, mode
);
514 /* ?setb@streambuf@@IAEXPAD0H@Z */
515 /* ?setb@streambuf@@IEAAXPEAD0H@Z */
516 DEFINE_THISCALL_WRAPPER(streambuf_setb
, 16)
517 void __thiscall
streambuf_setb(streambuf
*this, char *ba
, char *eb
, int delete)
519 TRACE("(%p %p %p %d)\n", this, ba
, eb
, delete);
521 MSVCRT_operator_delete(this->base
);
522 this->allocated
= delete;
527 /* ?setbuf@streambuf@@UAEPAV1@PADH@Z */
528 /* ?setbuf@streambuf@@UEAAPEAV1@PEADH@Z */
529 DEFINE_THISCALL_WRAPPER(streambuf_setbuf
, 12)
530 streambuf
* __thiscall
streambuf_setbuf(streambuf
*this, char *buffer
, int length
)
532 TRACE("(%p %p %d)\n", this, buffer
, length
);
533 if (this->base
!= NULL
)
536 if (buffer
== NULL
|| !length
) {
537 this->unbuffered
= 1;
538 this->base
= this->ebuf
= NULL
;
540 this->unbuffered
= 0;
542 this->ebuf
= buffer
+ length
;
547 /* ?setg@streambuf@@IAEXPAD00@Z */
548 /* ?setg@streambuf@@IEAAXPEAD00@Z */
549 DEFINE_THISCALL_WRAPPER(streambuf_setg
, 16)
550 void __thiscall
streambuf_setg(streambuf
*this, char *ek
, char *gp
, char *eg
)
552 TRACE("(%p %p %p %p)\n", this, ek
, gp
, eg
);
558 /* ?setlock@streambuf@@QAEXXZ */
559 /* ?setlock@streambuf@@QEAAXXZ */
560 DEFINE_THISCALL_WRAPPER(streambuf_setlock
, 4)
561 void __thiscall
streambuf_setlock(streambuf
*this)
563 TRACE("(%p)\n", this);
567 /* ?setp@streambuf@@IAEXPAD0@Z */
568 /* ?setp@streambuf@@IEAAXPEAD0@Z */
569 DEFINE_THISCALL_WRAPPER(streambuf_setp
, 12)
570 void __thiscall
streambuf_setp(streambuf
*this, char *pb
, char *ep
)
572 TRACE("(%p %p %p)\n", this, pb
, ep
);
573 this->pbase
= this->pptr
= pb
;
577 /* ?sync@streambuf@@UAEHXZ */
578 /* ?sync@streambuf@@UEAAHXZ */
579 DEFINE_THISCALL_WRAPPER(streambuf_sync
, 4)
580 #define call_streambuf_sync(this) CALL_VTBL_FUNC(this, 4, int, (streambuf*), (this))
581 int __thiscall
streambuf_sync(streambuf
*this)
583 TRACE("(%p)\n", this);
584 return (this->gptr
>= this->egptr
&& this->pbase
>= this->pptr
) ? 0 : EOF
;
587 /* ?unbuffered@streambuf@@IAEXH@Z */
588 /* ?unbuffered@streambuf@@IEAAXH@Z */
589 DEFINE_THISCALL_WRAPPER(streambuf_unbuffered_set
, 8)
590 void __thiscall
streambuf_unbuffered_set(streambuf
*this, int buf
)
592 TRACE("(%p %d)\n", this, buf
);
593 this->unbuffered
= buf
;
596 /* ?unbuffered@streambuf@@IBEHXZ */
597 /* ?unbuffered@streambuf@@IEBAHXZ */
598 DEFINE_THISCALL_WRAPPER(streambuf_unbuffered_get
, 4)
599 int __thiscall
streambuf_unbuffered_get(const streambuf
*this)
601 TRACE("(%p)\n", this);
602 return this->unbuffered
;
606 DEFINE_THISCALL_WRAPPER(streambuf_underflow
, 4)
607 #define call_streambuf_underflow(this) CALL_VTBL_FUNC(this, 32, int, (streambuf*), (this))
608 int __thiscall
streambuf_underflow(streambuf
*this)
610 ERR("underflow is not implemented in streambuf\n");
614 /* ?unlock@streambuf@@QAEXXZ */
615 /* ?unlock@streambuf@@QEAAXXZ */
616 DEFINE_THISCALL_WRAPPER(streambuf_unlock
, 4)
617 void __thiscall
streambuf_unlock(streambuf
*this)
619 TRACE("(%p)\n", this);
620 if (this->do_lock
< 0)
621 LeaveCriticalSection(&this->lock
);
624 /* ?xsgetn@streambuf@@UAEHPADH@Z */
625 /* ?xsgetn@streambuf@@UEAAHPEADH@Z */
626 DEFINE_THISCALL_WRAPPER(streambuf_xsgetn
, 12)
627 #define call_streambuf_xsgetn(this, buffer, count) CALL_VTBL_FUNC(this, 24, int, (streambuf*, char*, int), (this, buffer, count))
628 int __thiscall
streambuf_xsgetn(streambuf
*this, char *buffer
, int count
)
630 int copied
= 0, chunk
;
632 TRACE("(%p %p %d)\n", this, buffer
, count
);
634 if (this->unbuffered
) {
635 if (this->stored_char
== EOF
)
636 this->stored_char
= call_streambuf_underflow(this);
637 while (copied
< count
&& this->stored_char
!= EOF
) {
638 buffer
[copied
++] = this->stored_char
;
639 this->stored_char
= call_streambuf_underflow(this);
642 while (copied
< count
) {
643 if (call_streambuf_underflow(this) == EOF
)
645 chunk
= this->egptr
- this->gptr
;
646 if (chunk
> count
- copied
)
647 chunk
= count
- copied
;
648 memcpy(buffer
+copied
, this->gptr
, chunk
);
656 /* ?xsputn@streambuf@@UAEHPBDH@Z */
657 /* ?xsputn@streambuf@@UEAAHPEBDH@Z */
658 DEFINE_THISCALL_WRAPPER(streambuf_xsputn
, 12)
659 #define call_streambuf_xsputn(this, data, length) CALL_VTBL_FUNC(this, 20, int, (streambuf*, const char*, int), (this, data, length))
660 int __thiscall
streambuf_xsputn(streambuf
*this, const char *data
, int length
)
662 int copied
= 0, chunk
;
664 TRACE("(%p %p %d)\n", this, data
, length
);
666 while (copied
< length
) {
667 if (this->unbuffered
|| this->pptr
== this->epptr
) {
668 if (call_streambuf_overflow(this, data
[copied
]) == EOF
)
672 chunk
= this->epptr
- this->pptr
;
673 if (chunk
> length
- copied
)
674 chunk
= length
- copied
;
675 memcpy(this->pptr
, data
+copied
, chunk
);
683 /* ?sgetc@streambuf@@QAEHXZ */
684 /* ?sgetc@streambuf@@QEAAHXZ */
685 DEFINE_THISCALL_WRAPPER(streambuf_sgetc
, 4)
686 int __thiscall
streambuf_sgetc(streambuf
*this)
688 TRACE("(%p)\n", this);
689 if (this->unbuffered
) {
690 if (this->stored_char
== EOF
)
691 this->stored_char
= call_streambuf_underflow(this);
692 return this->stored_char
;
694 return call_streambuf_underflow(this);
697 /* ?sputc@streambuf@@QAEHH@Z */
698 /* ?sputc@streambuf@@QEAAHH@Z */
699 DEFINE_THISCALL_WRAPPER(streambuf_sputc
, 8)
700 int __thiscall
streambuf_sputc(streambuf
*this, int ch
)
702 TRACE("(%p %d)\n", this, ch
);
703 return (this->pptr
< this->epptr
) ? *this->pptr
++ = ch
: call_streambuf_overflow(this, ch
);
706 /* ?sgetn@streambuf@@QAEHPADH@Z */
707 /* ?sgetn@streambuf@@QEAAHPEADH@Z */
708 DEFINE_THISCALL_WRAPPER(streambuf_sgetn
, 12)
709 int __thiscall
streambuf_sgetn(streambuf
*this, char *buffer
, int count
)
711 return call_streambuf_xsgetn(this, buffer
, count
);
714 /* ?sputn@streambuf@@QAEHPBDH@Z */
715 /* ?sputn@streambuf@@QEAAHPEBDH@Z */
716 DEFINE_THISCALL_WRAPPER(streambuf_sputn
, 12)
717 int __thiscall
streambuf_sputn(streambuf
*this, const char *data
, int length
)
719 return call_streambuf_xsputn(this, data
, length
);
722 /* ?snextc@streambuf@@QAEHXZ */
723 /* ?snextc@streambuf@@QEAAHXZ */
724 DEFINE_THISCALL_WRAPPER(streambuf_snextc
, 4)
725 int __thiscall
streambuf_snextc(streambuf
*this)
727 TRACE("(%p)\n", this);
728 if (this->unbuffered
) {
729 if (this->stored_char
== EOF
)
730 call_streambuf_underflow(this);
731 return this->stored_char
= call_streambuf_underflow(this);
733 if (this->gptr
>= this->egptr
)
734 call_streambuf_underflow(this);
736 return (this->gptr
< this->egptr
) ? *this->gptr
: call_streambuf_underflow(this);
740 /* ?sbumpc@streambuf@@QAEHXZ */
741 /* ?sbumpc@streambuf@@QEAAHXZ */
742 DEFINE_THISCALL_WRAPPER(streambuf_sbumpc
, 4)
743 int __thiscall
streambuf_sbumpc(streambuf
*this)
747 TRACE("(%p)\n", this);
749 if (this->unbuffered
) {
750 ret
= this->stored_char
;
751 this->stored_char
= EOF
;
753 ret
= call_streambuf_underflow(this);
755 ret
= (this->gptr
< this->egptr
) ? *this->gptr
: call_streambuf_underflow(this);
761 /* ?stossc@streambuf@@QAEXXZ */
762 /* ?stossc@streambuf@@QEAAXXZ */
763 DEFINE_THISCALL_WRAPPER(streambuf_stossc
, 4)
764 void __thiscall
streambuf_stossc(streambuf
*this)
766 TRACE("(%p)\n", this);
767 if (this->unbuffered
) {
768 if (this->stored_char
== EOF
)
769 call_streambuf_underflow(this);
771 this->stored_char
= EOF
;
773 if (this->gptr
>= this->egptr
)
774 call_streambuf_underflow(this);
775 if (this->gptr
< this->egptr
)
780 /* ?sputbackc@streambuf@@QAEHD@Z */
781 /* ?sputbackc@streambuf@@QEAAHD@Z */
782 DEFINE_THISCALL_WRAPPER(streambuf_sputbackc
, 8)
783 int __thiscall
streambuf_sputbackc(streambuf
*this, char ch
)
785 TRACE("(%p %d)\n", this, ch
);
786 return call_streambuf_pbackfail(this, ch
);
789 /* ?dbp@streambuf@@QAEXXZ */
790 /* ?dbp@streambuf@@QEAAXXZ */
791 DEFINE_THISCALL_WRAPPER(streambuf_dbp
, 4)
792 void __thiscall
streambuf_dbp(streambuf
*this)
794 printf("\nSTREAMBUF DEBUG INFO: this=%p, ", this);
795 if (this->unbuffered
) {
796 printf("unbuffered\n");
798 printf("_fAlloc=%d\n", this->allocated
);
799 printf(" base()=%p, ebuf()=%p, blen()=%d\n", this->base
, this->ebuf
, streambuf_blen(this));
800 printf("pbase()=%p, pptr()=%p, epptr()=%d\n", this->pbase
, this->pptr
, this->epptr
);
801 printf("eback()=%p, gptr()=%p, egptr()=%d\n", this->eback
, this->gptr
, this->egptr
);
805 /* ??0filebuf@@QAE@ABV0@@Z */
806 /* ??0filebuf@@QEAA@AEBV0@@Z */
807 DEFINE_THISCALL_WRAPPER(filebuf_copy_ctor
, 8)
808 filebuf
* __thiscall
filebuf_copy_ctor(filebuf
* this, const filebuf
*copy
)
810 TRACE("(%p %p)\n", this, copy
);
812 this->base
.vtable
= &MSVCP_filebuf_vtable
;
816 /* ??0filebuf@@QAE@HPADH@Z */
817 /* ??0filebuf@@QEAA@HPEADH@Z */
818 DEFINE_THISCALL_WRAPPER(filebuf_fd_reserve_ctor
, 16)
819 filebuf
* __thiscall
filebuf_fd_reserve_ctor(filebuf
* this, filedesc fd
, char *buffer
, int length
)
821 TRACE("(%p %d %p %d)\n", this, fd
, buffer
, length
);
822 streambuf_reserve_ctor(&this->base
, buffer
, length
);
823 this->base
.vtable
= &MSVCP_filebuf_vtable
;
829 /* ??0filebuf@@QAE@H@Z */
830 /* ??0filebuf@@QEAA@H@Z */
831 DEFINE_THISCALL_WRAPPER(filebuf_fd_ctor
, 8)
832 filebuf
* __thiscall
filebuf_fd_ctor(filebuf
* this, filedesc fd
)
834 filebuf_fd_reserve_ctor(this, fd
, NULL
, 0);
835 this->base
.unbuffered
= 0;
839 /* ??0filebuf@@QAE@XZ */
840 /* ??0filebuf@@QEAA@XZ */
841 DEFINE_THISCALL_WRAPPER(filebuf_ctor
, 4)
842 filebuf
* __thiscall
filebuf_ctor(filebuf
* this)
844 return filebuf_fd_ctor(this, -1);
847 /* ??1filebuf@@UAE@XZ */
848 /* ??1filebuf@@UEAA@XZ */
849 DEFINE_THISCALL_WRAPPER(filebuf_dtor
, 4)
850 void __thiscall
filebuf_dtor(filebuf
* this)
852 TRACE("(%p)\n", this);
855 streambuf_dtor(&this->base
);
858 /* ??4filebuf@@QAEAAV0@ABV0@@Z */
859 /* ??4filebuf@@QEAAAEAV0@AEBV0@@Z */
860 DEFINE_THISCALL_WRAPPER(filebuf_assign
, 8)
861 filebuf
* __thiscall
filebuf_assign(filebuf
* this, const filebuf
*rhs
)
864 return filebuf_copy_ctor(this, rhs
);
867 /* ??_Efilebuf@@UAEPAXI@Z */
868 DEFINE_THISCALL_WRAPPER(filebuf_vector_dtor
, 8)
869 filebuf
* __thiscall
filebuf_vector_dtor(filebuf
*this, unsigned int flags
)
871 TRACE("(%p %x)\n", this, flags
);
873 /* we have an array, with the number of elements stored before the first object */
874 INT_PTR i
, *ptr
= (INT_PTR
*)this-1;
876 for (i
= *ptr
-1; i
>= 0; i
--)
877 filebuf_dtor(this+i
);
878 MSVCRT_operator_delete(ptr
);
882 MSVCRT_operator_delete(this);
887 /* ??_Gfilebuf@@UAEPAXI@Z */
888 DEFINE_THISCALL_WRAPPER(filebuf_scalar_dtor
, 8)
889 filebuf
* __thiscall
filebuf_scalar_dtor(filebuf
*this, unsigned int flags
)
891 TRACE("(%p %x)\n", this, flags
);
893 if (flags
& 1) MSVCRT_operator_delete(this);
897 /* ?attach@filebuf@@QAEPAV1@H@Z */
898 /* ?attach@filebuf@@QEAAPEAV1@H@Z */
899 DEFINE_THISCALL_WRAPPER(filebuf_attach
, 8)
900 filebuf
* __thiscall
filebuf_attach(filebuf
*this, filedesc fd
)
902 TRACE("(%p %d)\n", this, fd
);
906 streambuf_lock(&this->base
);
908 streambuf_allocate(&this->base
);
909 streambuf_unlock(&this->base
);
913 /* ?close@filebuf@@QAEPAV1@XZ */
914 /* ?close@filebuf@@QEAAPEAV1@XZ */
915 DEFINE_THISCALL_WRAPPER(filebuf_close
, 4)
916 filebuf
* __thiscall
filebuf_close(filebuf
*this)
920 TRACE("(%p)\n", this);
924 streambuf_lock(&this->base
);
925 if (call_streambuf_sync(&this->base
) == EOF
|| _close(this->fd
) < 0) {
931 streambuf_unlock(&this->base
);
935 /* ?fd@filebuf@@QBEHXZ */
936 /* ?fd@filebuf@@QEBAHXZ */
937 DEFINE_THISCALL_WRAPPER(filebuf_fd
, 4)
938 filedesc __thiscall
filebuf_fd(const filebuf
*this)
940 TRACE("(%p)\n", this);
944 /* ?is_open@filebuf@@QBEHXZ */
945 /* ?is_open@filebuf@@QEBAHXZ */
946 DEFINE_THISCALL_WRAPPER(filebuf_is_open
, 4)
947 int __thiscall
filebuf_is_open(const filebuf
*this)
949 TRACE("(%p)\n", this);
950 return this->fd
!= -1;
953 /* ?open@filebuf@@QAEPAV1@PBDHH@Z */
954 /* ?open@filebuf@@QEAAPEAV1@PEBDHH@Z */
955 DEFINE_THISCALL_WRAPPER(filebuf_open
, 16)
956 filebuf
* __thiscall
filebuf_open(filebuf
*this, const char *name
, ios_open_mode mode
, int protection
)
958 const int inout_mode
[4] = {-1, _O_RDONLY
, _O_WRONLY
, _O_RDWR
};
959 const int share_mode
[4] = {_SH_DENYRW
, _SH_DENYWR
, _SH_DENYRD
, _SH_DENYNO
};
960 int op_flags
, sh_flags
, fd
;
962 TRACE("(%p %s %x %x)\n", this, name
, mode
, protection
);
967 if (mode
& (OPENMODE_app
|OPENMODE_trunc
))
968 mode
|= OPENMODE_out
;
969 op_flags
= inout_mode
[mode
& (OPENMODE_in
|OPENMODE_out
)];
972 if (mode
& OPENMODE_app
)
973 op_flags
|= _O_APPEND
;
974 if ((mode
& OPENMODE_trunc
) ||
975 ((mode
& OPENMODE_out
) && !(mode
& (OPENMODE_in
|OPENMODE_app
|OPENMODE_ate
))))
976 op_flags
|= _O_TRUNC
;
977 if (!(mode
& OPENMODE_nocreate
))
978 op_flags
|= _O_CREAT
;
979 if (mode
& OPENMODE_noreplace
)
981 op_flags
|= (mode
& OPENMODE_binary
) ? _O_BINARY
: _O_TEXT
;
983 /* share protection */
984 sh_flags
= (protection
& filebuf_sh_none
) ? share_mode
[(protection
>> 9) & 3] : _SH_DENYNO
;
986 TRACE("op_flags %x, sh_flags %x\n", op_flags
, sh_flags
);
987 fd
= _sopen(name
, op_flags
, sh_flags
, _S_IREAD
|_S_IWRITE
);
991 streambuf_lock(&this->base
);
994 if ((mode
& OPENMODE_ate
) &&
995 call_streambuf_seekoff(&this->base
, 0, SEEKDIR_end
, mode
& (OPENMODE_in
|OPENMODE_out
)) == EOF
) {
999 streambuf_allocate(&this->base
);
1000 streambuf_unlock(&this->base
);
1001 return (this->fd
== -1) ? NULL
: this;
1004 /* ?overflow@filebuf@@UAEHH@Z */
1005 /* ?overflow@filebuf@@UEAAHH@Z */
1006 DEFINE_THISCALL_WRAPPER(filebuf_overflow
, 8)
1007 int __thiscall
filebuf_overflow(filebuf
*this, int c
)
1009 TRACE("(%p %d)\n", this, c
);
1010 if (call_streambuf_sync(&this->base
) == EOF
)
1012 if (this->base
.unbuffered
)
1013 return (c
== EOF
) ? 1 : _write(this->fd
, &c
, 1);
1014 if (streambuf_allocate(&this->base
) == EOF
)
1017 this->base
.pbase
= this->base
.pptr
= this->base
.base
;
1018 this->base
.epptr
= this->base
.ebuf
;
1020 *this->base
.pptr
++ = c
;
1024 /* ?seekoff@filebuf@@UAEJJW4seek_dir@ios@@H@Z */
1025 /* ?seekoff@filebuf@@UEAAJJW4seek_dir@ios@@H@Z */
1026 DEFINE_THISCALL_WRAPPER(filebuf_seekoff
, 16)
1027 streampos __thiscall
filebuf_seekoff(filebuf
*this, streamoff offset
, ios_seek_dir dir
, int mode
)
1029 TRACE("(%p %d %d %d)\n", this, offset
, dir
, mode
);
1030 if (call_streambuf_sync(&this->base
) == EOF
)
1032 return _lseek(this->fd
, offset
, dir
);
1035 /* ?setbuf@filebuf@@UAEPAVstreambuf@@PADH@Z */
1036 /* ?setbuf@filebuf@@UEAAPEAVstreambuf@@PEADH@Z */
1037 DEFINE_THISCALL_WRAPPER(filebuf_setbuf
, 12)
1038 streambuf
* __thiscall
filebuf_setbuf(filebuf
*this, char *buffer
, int length
)
1042 TRACE("(%p %p %d)\n", this, buffer
, length
);
1043 if (this->base
.base
!= NULL
)
1046 streambuf_lock(&this->base
);
1047 ret
= streambuf_setbuf(&this->base
, buffer
, length
);
1048 streambuf_unlock(&this->base
);
1052 /* ?setmode@filebuf@@QAEHH@Z */
1053 /* ?setmode@filebuf@@QEAAHH@Z */
1054 DEFINE_THISCALL_WRAPPER(filebuf_setmode
, 8)
1055 int __thiscall
filebuf_setmode(filebuf
*this, int mode
)
1059 TRACE("(%p %d)\n", this, mode
);
1060 if (mode
!= filebuf_text
&& mode
!= filebuf_binary
)
1063 streambuf_lock(&this->base
);
1064 ret
= (call_streambuf_sync(&this->base
) == EOF
) ? -1 : _setmode(this->fd
, mode
);
1065 streambuf_unlock(&this->base
);
1069 /* ?sync@filebuf@@UAEHXZ */
1070 /* ?sync@filebuf@@UEAAHXZ */
1071 DEFINE_THISCALL_WRAPPER(filebuf_sync
, 4)
1072 int __thiscall
filebuf_sync(filebuf
*this)
1078 TRACE("(%p)\n", this);
1081 if (this->base
.unbuffered
)
1084 /* flush output buffer */
1085 if (this->base
.pptr
!= NULL
) {
1086 count
= this->base
.pptr
- this->base
.pbase
;
1087 if (count
> 0 && _write(this->fd
, this->base
.pbase
, count
) != count
)
1089 this->base
.pbase
= this->base
.pptr
= this->base
.epptr
= NULL
;
1091 /* flush input buffer */
1092 if (this->base
.egptr
!= NULL
) {
1093 offset
= this->base
.egptr
- this->base
.gptr
;
1095 mode
= _setmode(this->fd
, _O_TEXT
);
1096 _setmode(this->fd
, mode
);
1097 if (mode
& _O_TEXT
) {
1098 /* in text mode, '\n' in the buffer means '\r\n' in the file */
1099 for (ptr
= this->base
.gptr
; ptr
< this->base
.egptr
; ptr
++)
1103 if (_lseek(this->fd
, -offset
, SEEK_CUR
) < 0)
1106 this->base
.eback
= this->base
.gptr
= this->base
.egptr
= NULL
;
1111 /* ?underflow@filebuf@@UAEHXZ */
1112 /* ?underflow@filebuf@@UEAAHXZ */
1113 DEFINE_THISCALL_WRAPPER(filebuf_underflow
, 4)
1114 int __thiscall
filebuf_underflow(filebuf
*this)
1116 int buffer_size
, read_bytes
;
1119 TRACE("(%p)\n", this);
1121 if (this->base
.unbuffered
)
1122 return (_read(this->fd
, &c
, 1) < 1) ? EOF
: c
;
1124 if (this->base
.gptr
>= this->base
.egptr
) {
1125 if (call_streambuf_sync(&this->base
) == EOF
)
1127 buffer_size
= this->base
.ebuf
- this->base
.base
;
1128 read_bytes
= _read(this->fd
, this->base
.base
, buffer_size
);
1129 if (read_bytes
<= 0)
1131 this->base
.eback
= this->base
.gptr
= this->base
.base
;
1132 this->base
.egptr
= this->base
.base
+ read_bytes
;
1134 return *this->base
.gptr
;
1137 /* ??0strstreambuf@@QAE@ABV0@@Z */
1138 /* ??0strstreambuf@@QEAA@AEBV0@@Z */
1139 DEFINE_THISCALL_WRAPPER(strstreambuf_copy_ctor
, 8)
1140 strstreambuf
* __thiscall
strstreambuf_copy_ctor(strstreambuf
*this, const strstreambuf
*copy
)
1142 TRACE("(%p %p)\n", this, copy
);
1144 this->base
.vtable
= &MSVCP_strstreambuf_vtable
;
1148 /* ??0strstreambuf@@QAE@H@Z */
1149 /* ??0strstreambuf@@QEAA@H@Z */
1150 DEFINE_THISCALL_WRAPPER(strstreambuf_dynamic_ctor
, 8)
1151 strstreambuf
* __thiscall
strstreambuf_dynamic_ctor(strstreambuf
* this, int length
)
1153 TRACE("(%p %d)\n", this, length
);
1154 streambuf_ctor(&this->base
);
1155 this->base
.vtable
= &MSVCP_strstreambuf_vtable
;
1157 this->increase
= length
;
1159 this->f_alloc
= NULL
;
1160 this->f_free
= NULL
;
1164 /* ??0strstreambuf@@QAE@P6APAXJ@ZP6AXPAX@Z@Z */
1165 /* ??0strstreambuf@@QEAA@P6APEAXJ@ZP6AXPEAX@Z@Z */
1166 DEFINE_THISCALL_WRAPPER(strstreambuf_funcs_ctor
, 12)
1167 strstreambuf
* __thiscall
strstreambuf_funcs_ctor(strstreambuf
* this, allocFunction falloc
, freeFunction ffree
)
1169 TRACE("(%p %p %p)\n", this, falloc
, ffree
);
1170 strstreambuf_dynamic_ctor(this, 1);
1171 this->f_alloc
= falloc
;
1172 this->f_free
= ffree
;
1176 /* ??0strstreambuf@@QAE@PADH0@Z */
1177 /* ??0strstreambuf@@QEAA@PEADH0@Z */
1178 DEFINE_THISCALL_WRAPPER(strstreambuf_buffer_ctor
, 16)
1179 strstreambuf
* __thiscall
strstreambuf_buffer_ctor(strstreambuf
*this, char *buffer
, int length
, char *put
)
1183 TRACE("(%p %p %d %p)\n", this, buffer
, length
, put
);
1186 end_buffer
= buffer
+ length
;
1187 else if (length
== 0)
1188 end_buffer
= buffer
+ strlen(buffer
);
1190 end_buffer
= (char*) -1;
1192 streambuf_ctor(&this->base
);
1193 streambuf_setb(&this->base
, buffer
, end_buffer
, 0);
1195 streambuf_setg(&this->base
, buffer
, buffer
, end_buffer
);
1197 streambuf_setg(&this->base
, buffer
, buffer
, put
);
1198 streambuf_setp(&this->base
, put
, end_buffer
);
1200 this->base
.vtable
= &MSVCP_strstreambuf_vtable
;
1206 /* ??0strstreambuf@@QAE@PAEH0@Z */
1207 /* ??0strstreambuf@@QEAA@PEAEH0@Z */
1208 DEFINE_THISCALL_WRAPPER(strstreambuf_ubuffer_ctor
, 16)
1209 strstreambuf
* __thiscall
strstreambuf_ubuffer_ctor(strstreambuf
*this, unsigned char *buffer
, int length
, unsigned char *put
)
1211 TRACE("(%p %p %d %p)\n", this, buffer
, length
, put
);
1212 return strstreambuf_buffer_ctor(this, (char*)buffer
, length
, (char*)put
);
1215 /* ??0strstreambuf@@QAE@XZ */
1216 /* ??0strstreambuf@@QEAA@XZ */
1217 DEFINE_THISCALL_WRAPPER(strstreambuf_ctor
, 4)
1218 strstreambuf
* __thiscall
strstreambuf_ctor(strstreambuf
*this)
1220 TRACE("(%p)\n", this);
1221 return strstreambuf_dynamic_ctor(this, 1);
1224 /* ??1strstreambuf@@UAE@XZ */
1225 /* ??1strstreambuf@@UEAA@XZ */
1226 DEFINE_THISCALL_WRAPPER(strstreambuf_dtor
, 4)
1227 void __thiscall
strstreambuf_dtor(strstreambuf
*this)
1229 TRACE("(%p)\n", this);
1230 if (this->dynamic
&& this->base
.base
) {
1232 this->f_free(this->base
.base
);
1234 MSVCRT_operator_delete(this->base
.base
);
1236 streambuf_dtor(&this->base
);
1239 /* ??4strstreambuf@@QAEAAV0@ABV0@@Z */
1240 /* ??4strstreambuf@@QEAAAEAV0@AEBV0@@Z */
1241 DEFINE_THISCALL_WRAPPER(strstreambuf_assign
, 8)
1242 strstreambuf
* __thiscall
strstreambuf_assign(strstreambuf
*this, const strstreambuf
*rhs
)
1244 strstreambuf_dtor(this);
1245 return strstreambuf_copy_ctor(this, rhs
);
1248 /* ??_Estrstreambuf@@UAEPAXI@Z */
1249 DEFINE_THISCALL_WRAPPER(strstreambuf_vector_dtor
, 8)
1250 strstreambuf
* __thiscall
strstreambuf_vector_dtor(strstreambuf
*this, unsigned int flags
)
1252 TRACE("(%p %x)\n", this, flags
);
1254 /* we have an array, with the number of elements stored before the first object */
1255 INT_PTR i
, *ptr
= (INT_PTR
*)this-1;
1257 for (i
= *ptr
-1; i
>= 0; i
--)
1258 strstreambuf_dtor(this+i
);
1259 MSVCRT_operator_delete(ptr
);
1261 strstreambuf_dtor(this);
1263 MSVCRT_operator_delete(this);
1268 /* ??_Gstrstreambuf@@UAEPAXI@Z */
1269 DEFINE_THISCALL_WRAPPER(strstreambuf_scalar_dtor
, 8)
1270 strstreambuf
* __thiscall
strstreambuf_scalar_dtor(strstreambuf
*this, unsigned int flags
)
1272 TRACE("(%p %x)\n", this, flags
);
1273 strstreambuf_dtor(this);
1274 if (flags
& 1) MSVCRT_operator_delete(this);
1278 /* ?doallocate@strstreambuf@@MAEHXZ */
1279 /* ?doallocate@strstreambuf@@MEAAHXZ */
1280 DEFINE_THISCALL_WRAPPER(strstreambuf_doallocate
, 4)
1281 int __thiscall
strstreambuf_doallocate(strstreambuf
*this)
1283 FIXME("(%p) stub\n", this);
1287 /* ?freeze@strstreambuf@@QAEXH@Z */
1288 /* ?freeze@strstreambuf@@QEAAXH@Z */
1289 DEFINE_THISCALL_WRAPPER(strstreambuf_freeze
, 8)
1290 void __thiscall
strstreambuf_freeze(strstreambuf
*this, int frozen
)
1292 TRACE("(%p %d)\n", this, frozen
);
1293 if (!this->constant
)
1294 this->dynamic
= !frozen
;
1297 /* ?overflow@strstreambuf@@UAEHH@Z */
1298 /* ?overflow@strstreambuf@@UEAAHH@Z */
1299 DEFINE_THISCALL_WRAPPER(strstreambuf_overflow
, 8)
1300 int __thiscall
strstreambuf_overflow(strstreambuf
*this, int c
)
1302 FIXME("(%p %d) stub\n", this, c
);
1306 /* ?seekoff@strstreambuf@@UAEJJW4seek_dir@ios@@H@Z */
1307 /* ?seekoff@strstreambuf@@UEAAJJW4seek_dir@ios@@H@Z */
1308 DEFINE_THISCALL_WRAPPER(strstreambuf_seekoff
, 16)
1309 streampos __thiscall
strstreambuf_seekoff(strstreambuf
*this, streamoff offset
, ios_seek_dir dir
, int mode
)
1311 FIXME("(%p %d %d %d) stub\n", this, offset
, dir
, mode
);
1315 /* ?setbuf@strstreambuf@@UAEPAVstreambuf@@PADH@Z */
1316 /* ?setbuf@strstreambuf@@UEAAPEAVstreambuf@@PEADH@Z */
1317 DEFINE_THISCALL_WRAPPER(strstreambuf_setbuf
, 12)
1318 streambuf
* __thiscall
strstreambuf_setbuf(strstreambuf
*this, char *buffer
, int length
)
1320 FIXME("(%p %p %d) stub\n", this, buffer
, length
);
1324 /* ?str@strstreambuf@@QAEPADXZ */
1325 /* ?str@strstreambuf@@QEAAPEADXZ */
1326 DEFINE_THISCALL_WRAPPER(strstreambuf_str
, 4)
1327 char* __thiscall
strstreambuf_str(strstreambuf
*this)
1329 TRACE("(%p)\n", this);
1330 strstreambuf_freeze(this, 1);
1331 return this->base
.base
;
1334 /* ?sync@strstreambuf@@UAEHXZ */
1335 /* ?sync@strstreambuf@@UEAAHXZ */
1336 DEFINE_THISCALL_WRAPPER(strstreambuf_sync
, 4)
1337 int __thiscall
strstreambuf_sync(strstreambuf
*this)
1339 FIXME("(%p) stub\n", this);
1343 /* ?underflow@strstreambuf@@UAEHXZ */
1344 /* ?underflow@strstreambuf@@UEAAHXZ */
1345 DEFINE_THISCALL_WRAPPER(strstreambuf_underflow
, 4)
1346 int __thiscall
strstreambuf_underflow(strstreambuf
*this)
1348 FIXME("(%p) stub\n", this);
1352 /* ??0ios@@IAE@ABV0@@Z */
1353 /* ??0ios@@IEAA@AEBV0@@Z */
1354 DEFINE_THISCALL_WRAPPER(ios_copy_ctor
, 8)
1355 ios
* __thiscall
ios_copy_ctor(ios
*this, const ios
*copy
)
1357 TRACE("(%p %p)\n", this, copy
);
1359 this->vtable
= &MSVCP_ios_vtable
;
1362 InitializeCriticalSection(&this->lock
);
1363 return ios_assign(this, copy
);
1366 /* ??0ios@@QAE@PAVstreambuf@@@Z */
1367 /* ??0ios@@QEAA@PEAVstreambuf@@@Z */
1368 DEFINE_THISCALL_WRAPPER(ios_sb_ctor
, 8)
1369 ios
* __thiscall
ios_sb_ctor(ios
*this, streambuf
*sb
)
1371 TRACE("(%p %p)\n", this, sb
);
1373 this->vtable
= &MSVCP_ios_vtable
;
1375 this->state
= sb
? IOSTATE_goodbit
: IOSTATE_badbit
;
1376 this->special
[0] = this->special
[1] = 0;
1380 this->precision
= 6;
1384 InitializeCriticalSection(&this->lock
);
1388 /* ??0ios@@IAE@XZ */
1389 /* ??0ios@@IEAA@XZ */
1390 DEFINE_THISCALL_WRAPPER(ios_ctor
, 4)
1391 ios
* __thiscall
ios_ctor(ios
*this)
1393 return ios_sb_ctor(this, NULL
);
1396 /* ??1ios@@UAE@XZ */
1397 /* ??1ios@@UEAA@XZ */
1398 DEFINE_THISCALL_WRAPPER(ios_dtor
, 4)
1399 void __thiscall
ios_dtor(ios
*this)
1401 TRACE("(%p)\n", this);
1403 if (this->delbuf
&& this->sb
)
1404 call_streambuf_vector_dtor(this->sb
, 1);
1406 this->state
= IOSTATE_badbit
;
1407 DeleteCriticalSection(&this->lock
);
1410 /* ??4ios@@IAEAAV0@ABV0@@Z */
1411 /* ??4ios@@IEAAAEAV0@AEBV0@@Z */
1412 DEFINE_THISCALL_WRAPPER(ios_assign
, 8)
1413 ios
* __thiscall
ios_assign(ios
*this, const ios
*rhs
)
1415 TRACE("(%p %p)\n", this, rhs
);
1416 this->state
= rhs
->state
;
1418 this->state
|= IOSTATE_badbit
;
1419 this->tie
= rhs
->tie
;
1420 this->flags
= rhs
->flags
;
1421 this->precision
= (char) rhs
->precision
;
1422 this->fill
= rhs
->fill
;
1423 this->width
= (char) rhs
->width
;
1427 /* ??7ios@@QBEHXZ */
1428 /* ??7ios@@QEBAHXZ */
1429 DEFINE_THISCALL_WRAPPER(ios_op_not
, 4)
1430 int __thiscall
ios_op_not(const ios
*this)
1432 TRACE("(%p)\n", this);
1433 return ios_fail(this);
1436 /* ??Bios@@QBEPAXXZ */
1437 /* ??Bios@@QEBAPEAXXZ */
1438 DEFINE_THISCALL_WRAPPER(ios_op_void
, 4)
1439 void* __thiscall
ios_op_void(const ios
*this)
1441 TRACE("(%p)\n", this);
1442 return ios_fail(this) ? NULL
: (void*)this;
1445 /* ??_Eios@@UAEPAXI@Z */
1446 DEFINE_THISCALL_WRAPPER(ios_vector_dtor
, 8)
1447 ios
* __thiscall
ios_vector_dtor(ios
*this, unsigned int flags
)
1449 TRACE("(%p %x)\n", this, flags
);
1451 /* we have an array, with the number of elements stored before the first object */
1452 INT_PTR i
, *ptr
= (INT_PTR
*)this-1;
1454 for (i
= *ptr
-1; i
>= 0; i
--)
1456 MSVCRT_operator_delete(ptr
);
1460 MSVCRT_operator_delete(this);
1465 /* ??_Gios@@UAEPAXI@Z */
1466 DEFINE_THISCALL_WRAPPER(ios_scalar_dtor
, 8)
1467 ios
* __thiscall
ios_scalar_dtor(ios
*this, unsigned int flags
)
1469 TRACE("(%p %x)\n", this, flags
);
1471 if (flags
& 1) MSVCRT_operator_delete(this);
1475 /* ?bad@ios@@QBEHXZ */
1476 /* ?bad@ios@@QEBAHXZ */
1477 DEFINE_THISCALL_WRAPPER(ios_bad
, 4)
1478 int __thiscall
ios_bad(const ios
*this)
1480 TRACE("(%p)\n", this);
1481 return (this->state
& IOSTATE_badbit
);
1484 /* ?bitalloc@ios@@SAJXZ */
1485 LONG __cdecl
ios_bitalloc(void)
1494 /* ?clear@ios@@QAEXH@Z */
1495 /* ?clear@ios@@QEAAXH@Z */
1496 DEFINE_THISCALL_WRAPPER(ios_clear
, 8)
1497 void __thiscall
ios_clear(ios
*this, int state
)
1499 TRACE("(%p %d)\n", this, state
);
1501 this->state
= state
;
1505 /* ?clrlock@ios@@QAAXXZ */
1506 /* ?clrlock@ios@@QEAAXXZ */
1507 void __cdecl
ios_clrlock(ios
*this)
1509 TRACE("(%p)\n", this);
1510 if (this->do_lock
<= 0)
1513 streambuf_clrlock(this->sb
);
1516 /* ?delbuf@ios@@QAEXH@Z */
1517 /* ?delbuf@ios@@QEAAXH@Z */
1518 DEFINE_THISCALL_WRAPPER(ios_delbuf_set
, 8)
1519 void __thiscall
ios_delbuf_set(ios
*this, int delete)
1521 TRACE("(%p %d)\n", this, delete);
1522 this->delbuf
= delete;
1525 /* ?delbuf@ios@@QBEHXZ */
1526 /* ?delbuf@ios@@QEBAHXZ */
1527 DEFINE_THISCALL_WRAPPER(ios_delbuf_get
, 4)
1528 int __thiscall
ios_delbuf_get(const ios
*this)
1530 TRACE("(%p)\n", this);
1531 return this->delbuf
;
1534 /* ?dec@@YAAAVios@@AAV1@@Z */
1535 /* ?dec@@YAAEAVios@@AEAV1@@Z */
1536 ios
* __cdecl
ios_dec(ios
*this)
1538 TRACE("(%p)\n", this);
1539 ios_setf_mask(this, FLAGS_dec
, ios_basefield
);
1543 /* ?eof@ios@@QBEHXZ */
1544 /* ?eof@ios@@QEBAHXZ */
1545 DEFINE_THISCALL_WRAPPER(ios_eof
, 4)
1546 int __thiscall
ios_eof(const ios
*this)
1548 TRACE("(%p)\n", this);
1549 return (this->state
& IOSTATE_eofbit
);
1552 /* ?fail@ios@@QBEHXZ */
1553 /* ?fail@ios@@QEBAHXZ */
1554 DEFINE_THISCALL_WRAPPER(ios_fail
, 4)
1555 int __thiscall
ios_fail(const ios
*this)
1557 TRACE("(%p)\n", this);
1558 return (this->state
& (IOSTATE_failbit
|IOSTATE_badbit
));
1561 /* ?fill@ios@@QAEDD@Z */
1562 /* ?fill@ios@@QEAADD@Z */
1563 DEFINE_THISCALL_WRAPPER(ios_fill_set
, 8)
1564 char __thiscall
ios_fill_set(ios
*this, char fill
)
1566 char prev
= this->fill
;
1568 TRACE("(%p %d)\n", this, fill
);
1574 /* ?fill@ios@@QBEDXZ */
1575 /* ?fill@ios@@QEBADXZ */
1576 DEFINE_THISCALL_WRAPPER(ios_fill_get
, 4)
1577 char __thiscall
ios_fill_get(const ios
*this)
1579 TRACE("(%p)\n", this);
1583 /* ?flags@ios@@QAEJJ@Z */
1584 /* ?flags@ios@@QEAAJJ@Z */
1585 DEFINE_THISCALL_WRAPPER(ios_flags_set
, 8)
1586 LONG __thiscall
ios_flags_set(ios
*this, LONG flags
)
1588 LONG prev
= this->flags
;
1590 TRACE("(%p %x)\n", this, flags
);
1592 this->flags
= flags
;
1596 /* ?flags@ios@@QBEJXZ */
1597 /* ?flags@ios@@QEBAJXZ */
1598 DEFINE_THISCALL_WRAPPER(ios_flags_get
, 4)
1599 LONG __thiscall
ios_flags_get(const ios
*this)
1601 TRACE("(%p)\n", this);
1605 /* ?good@ios@@QBEHXZ */
1606 /* ?good@ios@@QEBAHXZ */
1607 DEFINE_THISCALL_WRAPPER(ios_good
, 4)
1608 int __thiscall
ios_good(const ios
*this)
1610 TRACE("(%p)\n", this);
1611 return this->state
== IOSTATE_goodbit
;
1614 /* ?hex@@YAAAVios@@AAV1@@Z */
1615 /* ?hex@@YAAEAVios@@AEAV1@@Z */
1616 ios
* __cdecl
ios_hex(ios
*this)
1618 TRACE("(%p)\n", this);
1619 ios_setf_mask(this, FLAGS_hex
, ios_basefield
);
1623 /* ?init@ios@@IAEXPAVstreambuf@@@Z */
1624 /* ?init@ios@@IEAAXPEAVstreambuf@@@Z */
1625 DEFINE_THISCALL_WRAPPER(ios_init
, 8)
1626 void __thiscall
ios_init(ios
*this, streambuf
*sb
)
1628 TRACE("(%p %p)\n", this, sb
);
1629 if (this->delbuf
&& this->sb
)
1630 call_streambuf_vector_dtor(this->sb
, 1);
1633 this->state
|= IOSTATE_badbit
;
1635 this->state
&= ~IOSTATE_badbit
;
1638 /* ?iword@ios@@QBEAAJH@Z */
1639 /* ?iword@ios@@QEBAAEAJH@Z */
1640 DEFINE_THISCALL_WRAPPER(ios_iword
, 8)
1641 LONG
* __thiscall
ios_iword(const ios
*this, int index
)
1643 TRACE("(%p %d)\n", this, index
);
1644 return &ios_statebuf
[index
];
1647 /* ?lock@ios@@QAAXXZ */
1648 /* ?lock@ios@@QEAAXXZ */
1649 void __cdecl
ios_lock(ios
*this)
1651 TRACE("(%p)\n", this);
1652 if (this->do_lock
< 0)
1653 EnterCriticalSection(&this->lock
);
1656 /* ?lockbuf@ios@@QAAXXZ */
1657 /* ?lockbuf@ios@@QEAAXXZ */
1658 void __cdecl
ios_lockbuf(ios
*this)
1660 TRACE("(%p)\n", this);
1661 streambuf_lock(this->sb
);
1664 /* ?lockc@ios@@KAXXZ */
1665 void __cdecl
ios_lockc(void)
1668 EnterCriticalSection(&ios_static_lock
);
1671 /* ?lockptr@ios@@IAEPAU_CRT_CRITICAL_SECTION@@XZ */
1672 /* ?lockptr@ios@@IEAAPEAU_CRT_CRITICAL_SECTION@@XZ */
1673 DEFINE_THISCALL_WRAPPER(ios_lockptr
, 4)
1674 CRITICAL_SECTION
* __thiscall
ios_lockptr(ios
*this)
1676 TRACE("(%p)\n", this);
1680 /* ?oct@@YAAAVios@@AAV1@@Z */
1681 /* ?oct@@YAAEAVios@@AEAV1@@Z */
1682 ios
* __cdecl
ios_oct(ios
*this)
1684 TRACE("(%p)\n", this);
1685 ios_setf_mask(this, FLAGS_oct
, ios_basefield
);
1689 /* ?precision@ios@@QAEHH@Z */
1690 /* ?precision@ios@@QEAAHH@Z */
1691 DEFINE_THISCALL_WRAPPER(ios_precision_set
, 8)
1692 int __thiscall
ios_precision_set(ios
*this, int prec
)
1694 int prev
= this->precision
;
1696 TRACE("(%p %d)\n", this, prec
);
1698 this->precision
= prec
;
1702 /* ?precision@ios@@QBEHXZ */
1703 /* ?precision@ios@@QEBAHXZ */
1704 DEFINE_THISCALL_WRAPPER(ios_precision_get
, 4)
1705 int __thiscall
ios_precision_get(const ios
*this)
1707 TRACE("(%p)\n", this);
1708 return this->precision
;
1711 /* ?pword@ios@@QBEAAPAXH@Z */
1712 /* ?pword@ios@@QEBAAEAPEAXH@Z */
1713 DEFINE_THISCALL_WRAPPER(ios_pword
, 8)
1714 void** __thiscall
ios_pword(const ios
*this, int index
)
1716 TRACE("(%p %d)\n", this, index
);
1717 return (void**)&ios_statebuf
[index
];
1720 /* ?rdbuf@ios@@QBEPAVstreambuf@@XZ */
1721 /* ?rdbuf@ios@@QEBAPEAVstreambuf@@XZ */
1722 DEFINE_THISCALL_WRAPPER(ios_rdbuf
, 4)
1723 streambuf
* __thiscall
ios_rdbuf(const ios
*this)
1725 TRACE("(%p)\n", this);
1729 /* ?rdstate@ios@@QBEHXZ */
1730 /* ?rdstate@ios@@QEBAHXZ */
1731 DEFINE_THISCALL_WRAPPER(ios_rdstate
, 4)
1732 int __thiscall
ios_rdstate(const ios
*this)
1734 TRACE("(%p)\n", this);
1738 /* ?setf@ios@@QAEJJ@Z */
1739 /* ?setf@ios@@QEAAJJ@Z */
1740 DEFINE_THISCALL_WRAPPER(ios_setf
, 8)
1741 LONG __thiscall
ios_setf(ios
*this, LONG flags
)
1743 LONG prev
= this->flags
;
1745 TRACE("(%p %x)\n", this, flags
);
1748 this->flags
|= flags
;
1753 /* ?setf@ios@@QAEJJJ@Z */
1754 /* ?setf@ios@@QEAAJJJ@Z */
1755 DEFINE_THISCALL_WRAPPER(ios_setf_mask
, 12)
1756 LONG __thiscall
ios_setf_mask(ios
*this, LONG flags
, LONG mask
)
1758 LONG prev
= this->flags
;
1760 TRACE("(%p %x %x)\n", this, flags
, mask
);
1763 this->flags
= (this->flags
& (~mask
)) | (flags
& mask
);
1768 /* ?setlock@ios@@QAAXXZ */
1769 /* ?setlock@ios@@QEAAXXZ */
1770 void __cdecl
ios_setlock(ios
*this)
1772 TRACE("(%p)\n", this);
1775 streambuf_setlock(this->sb
);
1778 /* ?sync_with_stdio@ios@@SAXXZ */
1779 void __cdecl
ios_sync_with_stdio(void)
1784 /* ?tie@ios@@QAEPAVostream@@PAV2@@Z */
1785 /* ?tie@ios@@QEAAPEAVostream@@PEAV2@@Z */
1786 DEFINE_THISCALL_WRAPPER(ios_tie_set
, 8)
1787 ostream
* __thiscall
ios_tie_set(ios
*this, ostream
*ostr
)
1789 ostream
*prev
= this->tie
;
1791 TRACE("(%p %p)\n", this, ostr
);
1797 /* ?tie@ios@@QBEPAVostream@@XZ */
1798 /* ?tie@ios@@QEBAPEAVostream@@XZ */
1799 DEFINE_THISCALL_WRAPPER(ios_tie_get
, 4)
1800 ostream
* __thiscall
ios_tie_get(const ios
*this)
1802 TRACE("(%p)\n", this);
1806 /* ?unlock@ios@@QAAXXZ */
1807 /* ?unlock@ios@@QEAAXXZ */
1808 void __cdecl
ios_unlock(ios
*this)
1810 TRACE("(%p)\n", this);
1811 if (this->do_lock
< 0)
1812 LeaveCriticalSection(&this->lock
);
1815 /* ?unlockbuf@ios@@QAAXXZ */
1816 /* ?unlockbuf@ios@@QEAAXXZ */
1817 void __cdecl
ios_unlockbuf(ios
*this)
1819 TRACE("(%p)\n", this);
1820 streambuf_unlock(this->sb
);
1823 /* ?unlockc@ios@@KAXXZ */
1824 void __cdecl
ios_unlockc(void)
1827 LeaveCriticalSection(&ios_static_lock
);
1830 /* ?unsetf@ios@@QAEJJ@Z */
1831 /* ?unsetf@ios@@QEAAJJ@Z */
1832 DEFINE_THISCALL_WRAPPER(ios_unsetf
, 8)
1833 LONG __thiscall
ios_unsetf(ios
*this, LONG flags
)
1835 LONG prev
= this->flags
;
1837 TRACE("(%p %x)\n", this, flags
);
1840 this->flags
&= ~flags
;
1845 /* ?width@ios@@QAEHH@Z */
1846 /* ?width@ios@@QEAAHH@Z */
1847 DEFINE_THISCALL_WRAPPER(ios_width_set
, 8)
1848 int __thiscall
ios_width_set(ios
*this, int width
)
1850 int prev
= this->width
;
1852 TRACE("(%p %d)\n", this, width
);
1854 this->width
= width
;
1858 /* ?width@ios@@QBEHXZ */
1859 /* ?width@ios@@QEBAHXZ */
1860 DEFINE_THISCALL_WRAPPER(ios_width_get
, 4)
1861 int __thiscall
ios_width_get(const ios
*this)
1863 TRACE("(%p)\n", this);
1867 /* ?xalloc@ios@@SAHXZ */
1868 int __cdecl
ios_xalloc(void)
1875 ret
= (ios_curindex
< STATEBUF_SIZE
-1) ? ++ios_curindex
: -1;
1880 /******************************************************************
1881 * ??0ostrstream@@QAE@XZ (MSVCRTI.@)
1883 DEFINE_THISCALL_WRAPPER(MSVCIRT_ostrstream_ctor
,8)
1884 void * __thiscall
MSVCIRT_ostrstream_ctor(ostream
*this, BOOL virt_init
)
1886 FIXME("(%p %x) stub\n", this, virt_init
);
1890 /******************************************************************
1891 * ??1ostrstream@@UAE@XZ (MSVCRTI.@)
1893 DEFINE_THISCALL_WRAPPER(MSVCIRT_ostrstream_dtor
,4)
1894 void __thiscall
MSVCIRT_ostrstream_dtor(ios
*base
)
1896 FIXME("(%p) stub\n", base
);
1899 /******************************************************************
1900 * ??6ostream@@QAEAAV0@E@Z (MSVCRTI.@)
1901 * class ostream & __thiscall ostream::operator<<(unsigned char)
1903 DEFINE_THISCALL_WRAPPER(MSVCIRT_operator_sl_uchar
,8)
1904 void * __thiscall
MSVCIRT_operator_sl_uchar(ostream
* _this
, unsigned char ch
)
1906 FIXME("(%p)->(%c) stub\n", _this
, ch
);
1910 /******************************************************************
1911 * ??6ostream@@QAEAAV0@H@Z (MSVCRTI.@)
1912 * class ostream & __thiscall ostream::operator<<(int)
1914 DEFINE_THISCALL_WRAPPER(MSVCIRT_operator_sl_int
,8)
1915 void * __thiscall
MSVCIRT_operator_sl_int(ostream
* _this
, int integer
)
1917 FIXME("(%p)->(%d) stub\n", _this
, integer
);
1921 /******************************************************************
1922 * ??6ostream@@QAEAAV0@PBD@Z (MSVCRTI.@)
1923 * class ostream & __thiscall ostream::operator<<(char const *)
1925 DEFINE_THISCALL_WRAPPER(MSVCIRT_operator_sl_pchar
,8)
1926 void * __thiscall
MSVCIRT_operator_sl_pchar(ostream
* _this
, const char * string
)
1928 FIXME("(%p)->(%s) stub\n", _this
, debugstr_a(string
));
1932 /******************************************************************
1933 * ??6ostream@@QAEAAV0@P6AAAV0@AAV0@@Z@Z (MSVCRTI.@)
1934 * class ostream & __thiscall ostream::operator<<(class ostream & (__cdecl*)(class ostream &))
1936 DEFINE_THISCALL_WRAPPER(MSVCIRT_operator_sl_callback
,8)
1937 void * __thiscall
MSVCIRT_operator_sl_callback(ostream
* _this
, ostream
* (__cdecl
*func
)(ostream
*))
1939 TRACE("%p, %p\n", _this
, func
);
1943 /******************************************************************
1944 * ?endl@@YAAAVostream@@AAV1@@Z (MSVCRTI.@)
1945 * class ostream & __cdecl endl(class ostream &)
1947 void * CDECL
MSVCIRT_endl(ostream
* _this
)
1949 FIXME("(%p)->() stub\n", _this
);
1953 /******************************************************************
1954 * ?ends@@YAAAVostream@@AAV1@@Z (MSVCRTI.@)
1955 * class ostream & __cdecl ends(class ostream &)
1957 void * CDECL
MSVCIRT_ends(ostream
* _this
)
1959 FIXME("(%p)->() stub\n", _this
);
1965 #define DEFINE_VTBL_WRAPPER(off) \
1966 __ASM_GLOBAL_FUNC(vtbl_wrapper_ ## off, \
1970 "movl 0(%ecx), %eax\n\t" \
1971 "jmp *" #off "(%eax)\n\t")
1973 DEFINE_VTBL_WRAPPER(0);
1974 DEFINE_VTBL_WRAPPER(4);
1975 DEFINE_VTBL_WRAPPER(8);
1976 DEFINE_VTBL_WRAPPER(12);
1977 DEFINE_VTBL_WRAPPER(16);
1978 DEFINE_VTBL_WRAPPER(20);
1979 DEFINE_VTBL_WRAPPER(24);
1980 DEFINE_VTBL_WRAPPER(28);
1981 DEFINE_VTBL_WRAPPER(32);
1982 DEFINE_VTBL_WRAPPER(36);
1983 DEFINE_VTBL_WRAPPER(40);
1984 DEFINE_VTBL_WRAPPER(44);
1985 DEFINE_VTBL_WRAPPER(48);
1986 DEFINE_VTBL_WRAPPER(52);
1987 DEFINE_VTBL_WRAPPER(56);
1991 void* (__cdecl
*MSVCRT_operator_new
)(SIZE_T
);
1992 void (__cdecl
*MSVCRT_operator_delete
)(void*);
1994 static void init_cxx_funcs(void)
1996 HMODULE hmod
= GetModuleHandleA("msvcrt.dll");
1998 if (sizeof(void *) > sizeof(int)) /* 64-bit has different names */
2000 MSVCRT_operator_new
= (void*)GetProcAddress(hmod
, "??2@YAPEAX_K@Z");
2001 MSVCRT_operator_delete
= (void*)GetProcAddress(hmod
, "??3@YAXPEAX@Z");
2005 MSVCRT_operator_new
= (void*)GetProcAddress(hmod
, "??2@YAPAXI@Z");
2006 MSVCRT_operator_delete
= (void*)GetProcAddress(hmod
, "??3@YAXPAX@Z");
2010 static void init_io(void *base
)
2013 init_streambuf_rtti(base
);
2014 init_filebuf_rtti(base
);
2015 init_strstreambuf_rtti(base
);
2016 init_ios_rtti(base
);
2020 BOOL WINAPI
DllMain( HINSTANCE inst
, DWORD reason
, LPVOID reserved
)
2024 case DLL_WINE_PREATTACH
:
2025 return FALSE
; /* prefer native version */
2026 case DLL_PROCESS_ATTACH
:
2028 init_exception(inst
);
2030 DisableThreadLibraryCalls( inst
);