Commit aa11357d authored by Iván Matellanes's avatar Iván Matellanes Committed by Alexandre Julliard

msvcirt: Add stub of class filebuf.

parent be3e9884
......@@ -80,6 +80,13 @@ streambuf* __thiscall streambuf_setbuf(streambuf*, char*, int);
void __thiscall streambuf_setg(streambuf*, char*, char*, char*);
void __thiscall streambuf_setp(streambuf*, char*, char*);
/* class filebuf */
typedef struct {
streambuf base;
filedesc fd;
int close;
} filebuf;
/* class ios */
struct _ostream;
typedef struct {
......@@ -116,6 +123,8 @@ typedef struct {
/* ??_7streambuf@@6B@ */
extern const vtable_ptr MSVCP_streambuf_vtable;
/* ??_7filebuf@@6B@ */
extern const vtable_ptr MSVCP_filebuf_vtable;
/* ??_7ios@@6B@ */
extern const vtable_ptr MSVCP_ios_vtable;
......@@ -134,6 +143,18 @@ void __asm_dummy_vtables(void) {
VTABLE_ADD_FUNC(streambuf_underflow)
VTABLE_ADD_FUNC(streambuf_pbackfail)
VTABLE_ADD_FUNC(streambuf_doallocate));
__ASM_VTABLE(filebuf,
VTABLE_ADD_FUNC(filebuf_vector_dtor)
VTABLE_ADD_FUNC(filebuf_sync)
VTABLE_ADD_FUNC(filebuf_setbuf)
VTABLE_ADD_FUNC(filebuf_seekoff)
VTABLE_ADD_FUNC(streambuf_seekpos)
VTABLE_ADD_FUNC(streambuf_xsputn)
VTABLE_ADD_FUNC(streambuf_xsgetn)
VTABLE_ADD_FUNC(filebuf_overflow)
VTABLE_ADD_FUNC(filebuf_underflow)
VTABLE_ADD_FUNC(streambuf_pbackfail)
VTABLE_ADD_FUNC(streambuf_doallocate));
__ASM_VTABLE(ios,
VTABLE_ADD_FUNC(ios_vector_dtor));
#ifndef __GNUC__
......@@ -141,6 +162,7 @@ void __asm_dummy_vtables(void) {
#endif
DEFINE_RTTI_DATA0(streambuf, 0, ".?AVstreambuf@@")
DEFINE_RTTI_DATA1(filebuf, 0, &streambuf_rtti_base_descriptor, ".?AVfilebuf@@")
DEFINE_RTTI_DATA0(ios, 0, ".?AVios@@")
/* ??0streambuf@@IAE@PADH@Z */
......@@ -738,6 +760,188 @@ void __thiscall streambuf_dbp(streambuf *this)
}
}
/* ??0filebuf@@QAE@ABV0@@Z */
/* ??0filebuf@@QEAA@AEBV0@@Z */
DEFINE_THISCALL_WRAPPER(filebuf_copy_ctor, 8)
filebuf* __thiscall filebuf_copy_ctor(filebuf* this, const filebuf *copy)
{
FIXME("(%p %p) stub\n", this, copy);
return this;
}
/* ??0filebuf@@QAE@H@Z */
/* ??0filebuf@@QEAA@H@Z */
DEFINE_THISCALL_WRAPPER(filebuf_fd_ctor, 8)
filebuf* __thiscall filebuf_fd_ctor(filebuf* this, filedesc fd)
{
FIXME("(%p %d) stub\n", this, fd);
return this;
}
/* ??0filebuf@@QAE@HPADH@Z */
/* ??0filebuf@@QEAA@HPEADH@Z */
DEFINE_THISCALL_WRAPPER(filebuf_fd_reserve_ctor, 16)
filebuf* __thiscall filebuf_fd_reserve_ctor(filebuf* this, filedesc fd, char *buffer, int length)
{
FIXME("(%p %d %p %d) stub\n", this, fd, buffer, length);
return this;
}
/* ??0filebuf@@QAE@XZ */
/* ??0filebuf@@QEAA@XZ */
DEFINE_THISCALL_WRAPPER(filebuf_ctor, 4)
filebuf* __thiscall filebuf_ctor(filebuf* this)
{
FIXME("(%p) stub\n", this);
return this;
}
/* ??1filebuf@@UAE@XZ */
/* ??1filebuf@@UEAA@XZ */
DEFINE_THISCALL_WRAPPER(filebuf_dtor, 4)
void __thiscall filebuf_dtor(filebuf* this)
{
FIXME("(%p) stub\n", this);
}
/* ??4filebuf@@QAEAAV0@ABV0@@Z */
/* ??4filebuf@@QEAAAEAV0@AEBV0@@Z */
DEFINE_THISCALL_WRAPPER(filebuf_assign, 8)
filebuf* __thiscall filebuf_assign(filebuf* this, const filebuf *rhs)
{
FIXME("(%p %p) stub\n", this, rhs);
return this;
}
/* ??_Efilebuf@@UAEPAXI@Z */
DEFINE_THISCALL_WRAPPER(filebuf_vector_dtor, 8)
filebuf* __thiscall filebuf_vector_dtor(filebuf *this, unsigned int flags)
{
TRACE("(%p %x)\n", this, flags);
if (flags & 2) {
/* we have an array, with the number of elements stored before the first object */
INT_PTR i, *ptr = (INT_PTR *)this-1;
for (i = *ptr-1; i >= 0; i--)
filebuf_dtor(this+i);
MSVCRT_operator_delete(ptr);
} else {
filebuf_dtor(this);
if (flags & 1)
MSVCRT_operator_delete(this);
}
return this;
}
/* ??_Gfilebuf@@UAEPAXI@Z */
DEFINE_THISCALL_WRAPPER(filebuf_scalar_dtor, 8)
filebuf* __thiscall filebuf_scalar_dtor(filebuf *this, unsigned int flags)
{
TRACE("(%p %x)\n", this, flags);
filebuf_dtor(this);
if (flags & 1) MSVCRT_operator_delete(this);
return this;
}
/* ?attach@filebuf@@QAEPAV1@H@Z */
/* ?attach@filebuf@@QEAAPEAV1@H@Z */
DEFINE_THISCALL_WRAPPER(filebuf_attach, 8)
filebuf* __thiscall filebuf_attach(filebuf *this, filedesc fd)
{
FIXME("(%p %d) stub\n", this, fd);
return NULL;
}
/* ?close@filebuf@@QAEPAV1@XZ */
/* ?close@filebuf@@QEAAPEAV1@XZ */
DEFINE_THISCALL_WRAPPER(filebuf_close, 4)
filebuf* __thiscall filebuf_close(filebuf *this)
{
FIXME("(%p) stub\n", this);
return NULL;
}
/* ?fd@filebuf@@QBEHXZ */
/* ?fd@filebuf@@QEBAHXZ */
DEFINE_THISCALL_WRAPPER(filebuf_fd, 4)
filedesc __thiscall filebuf_fd(const filebuf *this)
{
FIXME("(%p) stub\n", this);
return EOF;
}
/* ?is_open@filebuf@@QBEHXZ */
/* ?is_open@filebuf@@QEBAHXZ */
DEFINE_THISCALL_WRAPPER(filebuf_is_open, 4)
int __thiscall filebuf_is_open(const filebuf *this)
{
FIXME("(%p) stub\n", this);
return 0;
}
/* ?open@filebuf@@QAEPAV1@PBDHH@Z */
/* ?open@filebuf@@QEAAPEAV1@PEBDHH@Z */
DEFINE_THISCALL_WRAPPER(filebuf_open, 16)
filebuf* __thiscall filebuf_open(filebuf *this, const char *name, ios_open_mode mode, int protection)
{
FIXME("(%p %s %d %d) stub\n", this, name, mode, protection);
return NULL;
}
/* ?overflow@filebuf@@UAEHH@Z */
/* ?overflow@filebuf@@UEAAHH@Z */
DEFINE_THISCALL_WRAPPER(filebuf_overflow, 8)
int __thiscall filebuf_overflow(filebuf *this, int c)
{
FIXME("(%p %d) stub\n", this, c);
return EOF;
}
/* ?seekoff@filebuf@@UAEJJW4seek_dir@ios@@H@Z */
/* ?seekoff@filebuf@@UEAAJJW4seek_dir@ios@@H@Z */
DEFINE_THISCALL_WRAPPER(filebuf_seekoff, 16)
streampos __thiscall filebuf_seekoff(filebuf *this, streamoff offset, ios_seek_dir dir, int mode)
{
FIXME("(%p %d %d %d) stub\n", this, offset, dir, mode);
return EOF;
}
/* ?setbuf@filebuf@@UAEPAVstreambuf@@PADH@Z */
/* ?setbuf@filebuf@@UEAAPEAVstreambuf@@PEADH@Z */
DEFINE_THISCALL_WRAPPER(filebuf_setbuf, 12)
streambuf* __thiscall filebuf_setbuf(filebuf *this, char *buffer, int length)
{
FIXME("(%p %p %d) stub\n", this, buffer, length);
return NULL;
}
/* ?setmode@filebuf@@QAEHH@Z */
/* ?setmode@filebuf@@QEAAHH@Z */
DEFINE_THISCALL_WRAPPER(filebuf_setmode, 8)
int __thiscall filebuf_setmode(filebuf *this, int mode)
{
FIXME("(%p %d) stub\n", this, mode);
return 0;
}
/* ?sync@filebuf@@UAEHXZ */
/* ?sync@filebuf@@UEAAHXZ */
DEFINE_THISCALL_WRAPPER(filebuf_sync, 4)
int __thiscall filebuf_sync(filebuf *this)
{
FIXME("(%p) stub\n", this);
return EOF;
}
/* ?underflow@filebuf@@UAEHXZ */
/* ?underflow@filebuf@@UEAAHXZ */
DEFINE_THISCALL_WRAPPER(filebuf_underflow, 4)
int __thiscall filebuf_underflow(filebuf *this)
{
FIXME("(%p) stub\n", this);
return EOF;
}
/* ??0ios@@IAE@ABV0@@Z */
/* ??0ios@@IEAA@AEBV0@@Z */
DEFINE_THISCALL_WRAPPER(ios_copy_ctor, 8)
......@@ -1411,6 +1615,7 @@ static void init_io(void *base)
{
#ifdef __x86_64__
init_streambuf_rtti(base);
init_filebuf_rtti(base);
init_ios_rtti(base);
#endif
}
......
......@@ -22,6 +22,7 @@
typedef LONG streamoff;
typedef LONG streampos;
typedef int filedesc;
typedef enum {
IOSTATE_goodbit = 0x0,
......@@ -31,6 +32,17 @@ typedef enum {
} ios_io_state;
typedef enum {
OPENMODE_in = 0x1,
OPENMODE_out = 0x2,
OPENMODE_ate = 0x4,
OPENMODE_app = 0x8,
OPENMODE_trunc = 0x10,
OPENMODE_nocreate = 0x20,
OPENMODE_noreplace = 0x40,
OPENMODE_binary = 0x80
} ios_open_mode;
typedef enum {
SEEKDIR_beg = 0,
SEEKDIR_cur = 1,
SEEKDIR_end = 2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment