mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
- Update MSVCRT_thread_data
- Winesync cpp.c. svn path=/trunk/; revision=30361
This commit is contained in:
parent
2db7ea2321
commit
04be216fbb
5 changed files with 365 additions and 350 deletions
File diff suppressed because it is too large
Load diff
|
@ -78,10 +78,10 @@ __inline static void call_dtor( void *func, void *object )
|
|||
|
||||
static void dump_type( const cxx_type_info *type )
|
||||
{
|
||||
DPRINTF( "flags %x type %p", type->flags, type->type_info );
|
||||
if (type->type_info) DPRINTF( " (%p %s)", type->type_info->name, type->type_info->mangled );
|
||||
DPRINTF( " offset %d vbase %d,%d size %d copy ctor %p\n", type->this_offset,
|
||||
type->vbase_descr, type->vbase_offset, type->size, type->copy_ctor );
|
||||
TRACE( "flags %x type %p %s offsets %d,%d,%d size %d copy ctor %p\n",
|
||||
type->flags, type->type_info, dbgstr_type_info(type->type_info),
|
||||
type->offsets.this_offset, type->offsets.vbase_descr, type->offsets.vbase_offset,
|
||||
type->size, type->copy_ctor );
|
||||
}
|
||||
|
||||
static void dump_exception_type( const cxx_exception_type *type )
|
||||
|
@ -129,25 +129,6 @@ static void dump_function_descr( const cxx_function_descr *descr, const cxx_exce
|
|||
}
|
||||
}
|
||||
|
||||
/* compute the this pointer for a base class of a given type */
|
||||
static void *get_this_pointer( const cxx_type_info *type, void *object )
|
||||
{
|
||||
void *this_ptr;
|
||||
int *offset_ptr;
|
||||
|
||||
if (!object) return NULL;
|
||||
this_ptr = (char *)object + type->this_offset;
|
||||
if (type->vbase_descr >= 0)
|
||||
{
|
||||
/* move this ptr to vbase descriptor */
|
||||
this_ptr = (char *)this_ptr + type->vbase_descr;
|
||||
/* and fetch additional offset from vbase descriptor */
|
||||
offset_ptr = (int *)(*(char **)this_ptr + type->vbase_offset);
|
||||
this_ptr = (char *)this_ptr + *offset_ptr;
|
||||
}
|
||||
return this_ptr;
|
||||
}
|
||||
|
||||
/* check if the exception type is caught by a given catch block, and return the type that matched */
|
||||
static const cxx_type_info *find_caught_type( cxx_exception_type *exc_type, catchblock_info *catchblock )
|
||||
{
|
||||
|
@ -185,21 +166,21 @@ static void copy_exception( void *object, cxx_exception_frame *frame,
|
|||
|
||||
if (catchblock->flags & TYPE_FLAG_REFERENCE)
|
||||
{
|
||||
*dest_ptr = get_this_pointer( type, object );
|
||||
*dest_ptr = get_this_pointer( &type->offsets, object );
|
||||
}
|
||||
else if (type->flags & CLASS_IS_SIMPLE_TYPE)
|
||||
{
|
||||
memmove( dest_ptr, object, type->size );
|
||||
/* if it is a pointer, adjust it */
|
||||
if (type->size == sizeof(void *)) *dest_ptr = get_this_pointer( type, *dest_ptr );
|
||||
if (type->size == sizeof(void *)) *dest_ptr = get_this_pointer( &type->offsets, *dest_ptr );
|
||||
}
|
||||
else /* copy the object */
|
||||
{
|
||||
if (type->copy_ctor)
|
||||
call_copy_ctor( type->copy_ctor, dest_ptr, get_this_pointer(type,object),
|
||||
call_copy_ctor( type->copy_ctor, dest_ptr, get_this_pointer(&type->offsets,object),
|
||||
(type->flags & CLASS_HAS_VIRTUAL_BASE_CLASS) );
|
||||
else
|
||||
memmove( dest_ptr, get_this_pointer(type,object), type->size );
|
||||
memmove( dest_ptr, get_this_pointer(&type->offsets,object), type->size );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,11 +29,19 @@ typedef void (*vtable_ptr)();
|
|||
/* type_info object, see cpp.c for inplementation */
|
||||
typedef struct __type_info
|
||||
{
|
||||
vtable_ptr *vtable;
|
||||
const vtable_ptr *vtable;
|
||||
char *name; /* Unmangled name, allocated lazily */
|
||||
char mangled[32]; /* Variable length, but we declare it large enough for static RTTI */
|
||||
} type_info;
|
||||
|
||||
/* exception object */
|
||||
typedef struct __exception
|
||||
{
|
||||
const vtable_ptr *vtable;
|
||||
char *name; /* Name of this exception, always a new copy for each object */
|
||||
int do_free; /* Whether to free 'name' in our dtor */
|
||||
} exception;
|
||||
|
||||
/* the exception frame used by CxxFrameHandler */
|
||||
typedef struct __cxx_exception_frame
|
||||
{
|
||||
|
@ -84,15 +92,21 @@ typedef struct __cxx_function_descr
|
|||
|
||||
typedef void (*cxx_copy_ctor)(void);
|
||||
|
||||
/* offsets for computing the this pointer */
|
||||
typedef struct
|
||||
{
|
||||
int this_offset; /* offset of base class this pointer from start of object */
|
||||
int vbase_descr; /* offset of virtual base class descriptor */
|
||||
int vbase_offset; /* offset of this pointer offset in virtual base class descriptor */
|
||||
} this_ptr_offsets;
|
||||
|
||||
/* complete information about a C++ type */
|
||||
typedef struct __cxx_type_info
|
||||
{
|
||||
UINT flags; /* flags (see CLASS_* flags below) */
|
||||
type_info *type_info; /* C++ type info */
|
||||
int this_offset; /* offset of base class this pointer from start of object */
|
||||
int vbase_descr; /* offset of virtual base class descriptor */
|
||||
int vbase_offset; /* offset of this pointer offset in virtual base class descriptor */
|
||||
size_t size; /* object size */
|
||||
const type_info *type_info; /* C++ type info */
|
||||
this_ptr_offsets offsets; /* offsets for computing the this pointer */
|
||||
unsigned int size; /* object size */
|
||||
cxx_copy_ctor copy_ctor; /* copy constructor */
|
||||
} cxx_type_info;
|
||||
#define CLASS_IS_SIMPLE_TYPE 1
|
||||
|
@ -121,4 +135,30 @@ typedef struct __cxx_exception_type
|
|||
|
||||
void _CxxThrowException(void*,const cxx_exception_type*);
|
||||
|
||||
static inline const char *dbgstr_type_info( const type_info *info )
|
||||
{
|
||||
if (!info) return "{}";
|
||||
return wine_dbg_sprintf( "{vtable=%p name=%s (%s)}",
|
||||
info->vtable, info->mangled, info->name ? info->name : "" );
|
||||
}
|
||||
|
||||
/* compute the this pointer for a base class of a given type */
|
||||
static inline void *get_this_pointer( const this_ptr_offsets *off, void *object )
|
||||
{
|
||||
void *this_ptr;
|
||||
int *offset_ptr;
|
||||
|
||||
if (!object) return NULL;
|
||||
this_ptr = (char *)object + off->this_offset;
|
||||
if (off->vbase_descr >= 0)
|
||||
{
|
||||
/* move this ptr to vbase descriptor */
|
||||
this_ptr = (char *)this_ptr + off->vbase_descr;
|
||||
/* and fetch additional offset from vbase descriptor */
|
||||
offset_ptr = (int *)(*(char **)this_ptr + off->vbase_offset);
|
||||
this_ptr = (char *)this_ptr + *offset_ptr;
|
||||
}
|
||||
return this_ptr;
|
||||
}
|
||||
|
||||
#endif /* __MSVCRT_CPPEXCEPT_H */
|
||||
|
|
|
@ -31,15 +31,56 @@
|
|||
//#include "msvcrt/string.h"
|
||||
#include "eh.h"
|
||||
|
||||
typedef unsigned short MSVCRT_wchar_t;
|
||||
typedef unsigned short MSVCRT_wint_t;
|
||||
typedef unsigned short MSVCRT_wctype_t;
|
||||
typedef unsigned short MSVCRT__ino_t;
|
||||
typedef unsigned long MSVCRT__fsize_t;
|
||||
#ifdef _WIN64
|
||||
typedef unsigned __int64 MSVCRT_size_t;
|
||||
typedef __int64 MSVCRT_intptr_t;
|
||||
typedef unsigned __int64 MSVCRT_uintptr_t;
|
||||
#else
|
||||
typedef unsigned int MSVCRT_size_t;
|
||||
typedef int MSVCRT_intptr_t;
|
||||
typedef unsigned int MSVCRT_uintptr_t;
|
||||
#endif
|
||||
typedef unsigned int MSVCRT__dev_t;
|
||||
typedef int MSVCRT__off_t;
|
||||
typedef long MSVCRT_clock_t;
|
||||
typedef long MSVCRT_time_t;
|
||||
typedef __int64 MSVCRT___time64_t;
|
||||
typedef __int64 MSVCRT_fpos_t;
|
||||
|
||||
struct MSVCRT_tm {
|
||||
int tm_sec;
|
||||
int tm_min;
|
||||
int tm_hour;
|
||||
int tm_mday;
|
||||
int tm_mon;
|
||||
int tm_year;
|
||||
int tm_wday;
|
||||
int tm_yday;
|
||||
int tm_isdst;
|
||||
};
|
||||
|
||||
/* TLS data */
|
||||
extern DWORD MSVCRT_tls_index;
|
||||
|
||||
typedef struct __MSVCRT_thread_data
|
||||
{
|
||||
int _errno; // ros
|
||||
unsigned long doserrno;
|
||||
char *mbstok_next; /* next ptr for mbstok() */
|
||||
int thread_errno;
|
||||
unsigned long thread_doserrno;
|
||||
unsigned int random_seed; /* seed for rand() */
|
||||
char *strtok_next; /* next ptr for strtok() */
|
||||
unsigned char *mbstok_next; /* next ptr for mbstok() */
|
||||
MSVCRT_wchar_t *wcstok_next; /* next ptr for wcstok() */
|
||||
char *efcvt_buffer; /* buffer for ecvt/fcvt */
|
||||
char *asctime_buffer; /* buffer for asctime */
|
||||
MSVCRT_wchar_t *wasctime_buffer; /* buffer for wasctime */
|
||||
struct MSVCRT_tm time_buffer; /* buffer for localtime/gmtime */
|
||||
char *strerror_buffer; /* buffer for strerror */
|
||||
int fpecode;
|
||||
terminate_function terminate_handler;
|
||||
unexpected_function unexpected_handler;
|
||||
_se_translator_function se_translator;
|
||||
|
|
|
@ -120,6 +120,7 @@ kernel32 -
|
|||
msvcrt -
|
||||
reactos/dll/win32/msvcrt/wine/*.c # Out of sync
|
||||
reactos/lib/sdk/crt/except # Synced at XXXXXXXX
|
||||
reactos/lib/sdk/crt/cpp.c # Synced at 20071111
|
||||
reactos/lib/sdk/crt/wine # Synced at XXXXXXXX
|
||||
|
||||
User32 -
|
||||
|
|
Loading…
Reference in a new issue