msvcp90: Added allocator<char> implementation.
This commit is contained in:
parent
8f1ea6eeb1
commit
e79af2f0d9
|
@ -8,6 +8,7 @@ MODCFLAGS = @BUILTINFLAG@
|
|||
EXTRAINCL = -I$(TOPSRCDIR)/include/msvcrt
|
||||
|
||||
C_SRCS = \
|
||||
memory.c \
|
||||
msvcp90_main.c \
|
||||
string.c
|
||||
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* Copyright 2010 Piotr Caban for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "msvcp90.h"
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wine/debug.h"
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(msvcp90);
|
||||
|
||||
/* ?address@?$allocator@D@std@@QBEPADAAD@Z */
|
||||
DEFINE_THISCALL_WRAPPER(MSVCP_allocator_char_address, 8)
|
||||
char* __stdcall MSVCP_allocator_char_address(void *this, char *ptr)
|
||||
{
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/* ?address@?$allocator@D@std@@QBEPBDABD@Z */
|
||||
DEFINE_THISCALL_WRAPPER(MSVCP_allocator_char_const_address, 8)
|
||||
const char* __stdcall MSVCP_allocator_char_const_address(void *this, const char *ptr)
|
||||
{
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/* ??0?$allocator@D@std@@QAE@XZ */
|
||||
DEFINE_THISCALL_WRAPPER(MSVCP_allocator_char_ctor, 4)
|
||||
void* __stdcall MSVCP_allocator_char_ctor(void *this)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
/* ??0?$allocator@D@std@@QAE@ABV01@@Z */
|
||||
DEFINE_THISCALL_WRAPPER(MSVCP_allocator_char_copy_ctor, 8)
|
||||
void* __stdcall MSVCP_allocator_char_copy_ctor(void *this, void *copy)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
/* ??4?$allocator@D@std@@QAEAAV01@ABV01@@Z */
|
||||
DEFINE_THISCALL_WRAPPER(MSVCP_allocator_char_assign, 8);
|
||||
void* __stdcall MSVCP_allocator_char_assign(void *this, void *assign)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
/* ?deallocate@?$allocator@D@std@@QAEXPADI@Z */
|
||||
DEFINE_THISCALL_WRAPPER(MSVCP_allocator_char_deallocate, 12);
|
||||
void __stdcall MSVCP_allocator_char_deallocate(void *this, char *ptr, unsigned int size)
|
||||
{
|
||||
MSVCRT_operator_delete(ptr);
|
||||
}
|
||||
|
||||
/* ?allocate@?$allocator@D@std@@QAEPADI@Z */
|
||||
DEFINE_THISCALL_WRAPPER(MSVCP_allocator_char_allocate, 8);
|
||||
char* __stdcall MSVCP_allocator_char_allocate(void *this, unsigned int count)
|
||||
{
|
||||
return MSVCRT_operator_new(sizeof(char[count]));
|
||||
}
|
||||
|
||||
/* ?allocate@?$allocator@D@std@@QAEPADIPBX@Z */
|
||||
DEFINE_THISCALL_WRAPPER(MSVCP_allocator_char_allocate_hint, 12);
|
||||
char* __stdcall MSVCP_allocator_char_allocate_hint(void *this,
|
||||
unsigned int count, const void *hint)
|
||||
{
|
||||
/* Native ignores hint */
|
||||
return MSVCP_allocator_char_allocate(this, count);
|
||||
}
|
||||
|
||||
/* ?construct@?$allocator@D@std@@QAEXPADABD@Z */
|
||||
DEFINE_THISCALL_WRAPPER(MSVCP_allocator_char_construct, 12);
|
||||
void __stdcall MSVCP_allocator_char_construct(void *this, char *ptr, const char *val)
|
||||
{
|
||||
*ptr = *val;
|
||||
}
|
||||
|
||||
/* ?destroy@?$allocator@D@std@@QAEXPAD@Z */
|
||||
DEFINE_THISCALL_WRAPPER(MSVCP_allocator_char_destroy, 8);
|
||||
void __stdcall MSVCP_allocator_char_destroy(void *this, char *ptr)
|
||||
{
|
||||
}
|
||||
|
||||
/* ?max_size@?$allocator@D@std@@QBEIXZ */
|
||||
DEFINE_THISCALL_WRAPPER(MSVCP_allocator_char_max_size, 4);
|
||||
unsigned int __stdcall MSVCP_allocator_char_max_size(void *this)
|
||||
{
|
||||
return UINT_MAX/sizeof(char);
|
||||
}
|
|
@ -22,3 +22,24 @@ typedef unsigned char MSVCP_BOOL;
|
|||
|
||||
void __cdecl _invalid_parameter(const wchar_t*, const wchar_t*,
|
||||
const wchar_t*, unsigned int, uintptr_t);
|
||||
|
||||
void* (__cdecl *MSVCRT_operator_new)(size_t);
|
||||
void (__cdecl *MSVCRT_operator_delete)(void*);
|
||||
|
||||
/* Copied from dlls/msvcrt/cpp.c */
|
||||
#ifdef __i386__ /* thiscall functions are i386-specific */
|
||||
|
||||
#define THISCALL(func) __thiscall_ ## func
|
||||
#define DEFINE_THISCALL_WRAPPER(func,args) \
|
||||
extern void THISCALL(func)(void); \
|
||||
__ASM_GLOBAL_FUNC(__thiscall_ ## func, \
|
||||
"popl %eax\n\t" \
|
||||
"pushl %ecx\n\t" \
|
||||
"pushl %eax\n\t" \
|
||||
"jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
|
||||
#else /* __i386__ */
|
||||
|
||||
#define THISCALL(func) func
|
||||
#define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */
|
||||
|
||||
#endif /* __i386__ */
|
||||
|
|
|
@ -264,8 +264,8 @@
|
|||
@ stub ??0?$_String_val@GV?$allocator@G@std@@@std@@QAE@ABV01@@Z
|
||||
@ stub ??0?$_String_val@_WV?$allocator@_W@std@@@std@@IAE@V?$allocator@_W@1@@Z
|
||||
@ stub ??0?$_String_val@_WV?$allocator@_W@std@@@std@@QAE@ABV01@@Z
|
||||
@ stub ??0?$allocator@D@std@@QAE@ABV01@@Z
|
||||
@ stub ??0?$allocator@D@std@@QAE@XZ
|
||||
@ cdecl -i386 -norelay ??0?$allocator@D@std@@QAE@ABV01@@Z(ptr) __thiscall_MSVCP_allocator_char_copy_ctor
|
||||
@ cdecl -i386 -norelay ??0?$allocator@D@std@@QAE@XZ() __thiscall_MSVCP_allocator_char_ctor
|
||||
@ stub ??0?$allocator@G@std@@QAE@ABV01@@Z
|
||||
@ stub ??0?$allocator@G@std@@QAE@XZ
|
||||
@ stub ??0?$allocator@X@std@@QAE@ABV01@@Z
|
||||
|
@ -685,7 +685,7 @@
|
|||
@ stub ??4?$_String_val@DV?$allocator@D@std@@@std@@QAEAAV01@ABV01@@Z
|
||||
@ stub ??4?$_String_val@GV?$allocator@G@std@@@std@@QAEAAV01@ABV01@@Z
|
||||
@ stub ??4?$_String_val@_WV?$allocator@_W@std@@@std@@QAEAAV01@ABV01@@Z
|
||||
@ stub ??4?$allocator@D@std@@QAEAAV01@ABV01@@Z
|
||||
@ cdecl -i386 -norelay ??4?$allocator@D@std@@QAEAAV01@ABV01@@Z(ptr) __thiscall_MSVCP_allocator_char_assign
|
||||
@ stub ??4?$allocator@G@std@@QAEAAV01@ABV01@@Z
|
||||
@ stub ??4?$allocator@X@std@@QAEAAV01@ABV01@@Z
|
||||
@ stub ??4?$allocator@_W@std@@QAEAAV01@ABV01@@Z
|
||||
|
@ -1524,14 +1524,14 @@
|
|||
@ stub ?_Xsgetn_s@?$basic_streambuf@GU?$char_traits@G@std@@@std@@MAEHPAGIH@Z
|
||||
@ stub ?_Xsgetn_s@?$basic_streambuf@_WU?$char_traits@_W@std@@@std@@MAEHPA_WIH@Z
|
||||
@ stub ?_Xweak@tr1@std@@YAXXZ
|
||||
@ stub ?address@?$allocator@D@std@@QBEPADAAD@Z
|
||||
@ stub ?address@?$allocator@D@std@@QBEPBDABD@Z
|
||||
@ cdecl -i386 -norelay ?address@?$allocator@D@std@@QBEPADAAD@Z(ptr) __thiscall_MSVCP_allocator_char_address
|
||||
@ cdecl -i386 -norelay ?address@?$allocator@D@std@@QBEPBDABD@Z(ptr) __thiscall_MSVCP_allocator_char_const_address
|
||||
@ stub ?address@?$allocator@G@std@@QBEPAGAAG@Z
|
||||
@ stub ?address@?$allocator@G@std@@QBEPBGABG@Z
|
||||
@ stub ?address@?$allocator@_W@std@@QBEPA_WAA_W@Z
|
||||
@ stub ?address@?$allocator@_W@std@@QBEPB_WAB_W@Z
|
||||
@ stub ?allocate@?$allocator@D@std@@QAEPADI@Z
|
||||
@ stub ?allocate@?$allocator@D@std@@QAEPADIPBX@Z
|
||||
@ cdecl -i386 -norelay ?allocate@?$allocator@D@std@@QAEPADI@Z(long) __thiscall_MSVCP_allocator_char_allocate
|
||||
@ cdecl -i386 -norelay ?allocate@?$allocator@D@std@@QAEPADIPBX@Z(long ptr) __thiscall_MSVCP_allocator_char_allocate_hint
|
||||
@ stub ?allocate@?$allocator@G@std@@QAEPAGI@Z
|
||||
@ stub ?allocate@?$allocator@G@std@@QAEPAGIPBX@Z
|
||||
@ stub ?allocate@?$allocator@_W@std@@QAEPA_WI@Z
|
||||
|
@ -1663,7 +1663,7 @@
|
|||
@ stub ?compare@?$collate@D@std@@QBEHPBD000@Z
|
||||
@ stub ?compare@?$collate@G@std@@QBEHPBG000@Z
|
||||
@ stub ?compare@?$collate@_W@std@@QBEHPB_W000@Z
|
||||
@ stub ?construct@?$allocator@D@std@@QAEXPADABD@Z
|
||||
@ cdecl -i386 -norelay ?construct@?$allocator@D@std@@QAEXPADABD@Z(ptr ptr) __thiscall_MSVCP_allocator_char_construct
|
||||
@ stub ?construct@?$allocator@G@std@@QAEXPAGABG@Z
|
||||
@ stub ?construct@?$allocator@_W@std@@QAEXPA_WAB_W@Z
|
||||
@ stub ?copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIPADII@Z
|
||||
|
@ -1689,7 +1689,7 @@
|
|||
@ stub ?date_order@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@QBE?AW4dateorder@time_base@2@XZ
|
||||
@ stub ?date_order@?$time_get@GV?$istreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@QBE?AW4dateorder@time_base@2@XZ
|
||||
@ stub ?date_order@?$time_get@_WV?$istreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@QBE?AW4dateorder@time_base@2@XZ
|
||||
@ stub ?deallocate@?$allocator@D@std@@QAEXPADI@Z
|
||||
@ cdecl -i386 -norelay ?deallocate@?$allocator@D@std@@QAEXPADI@Z(ptr long) __thiscall_MSVCP_allocator_char_deallocate
|
||||
@ stub ?deallocate@?$allocator@G@std@@QAEXPAGI@Z
|
||||
@ stub ?deallocate@?$allocator@_W@std@@QAEXPA_WI@Z
|
||||
@ stub ?decimal_point@?$_Mpunct@D@std@@QBEDXZ
|
||||
|
@ -1714,7 +1714,7 @@
|
|||
@ stub ?denorm_min@?$numeric_limits@_K@std@@SA_KXZ
|
||||
@ stub ?denorm_min@?$numeric_limits@_N@std@@SA_NXZ
|
||||
@ stub ?denorm_min@?$numeric_limits@_W@std@@SA_WXZ
|
||||
@ stub ?destroy@?$allocator@D@std@@QAEXPAD@Z
|
||||
@ cdecl -i386 -norelay ?destroy@?$allocator@D@std@@QAEXPAD@Z(ptr) __thiscall_MSVCP_allocator_char_destroy
|
||||
@ stub ?destroy@?$allocator@G@std@@QAEXPAG@Z
|
||||
@ stub ?destroy@?$allocator@_W@std@@QAEXPA_W@Z
|
||||
@ stub ?digits10@?$numeric_limits@C@std@@2HB
|
||||
|
@ -2442,7 +2442,7 @@
|
|||
@ stub ?max_exponent@?$numeric_limits@O@std@@2HB
|
||||
@ stub ?max_exponent@_Num_base@std@@2HB
|
||||
@ stub ?max_length@codecvt_base@std@@QBEHXZ
|
||||
@ stub ?max_size@?$allocator@D@std@@QBEIXZ
|
||||
@ cdecl -i386 -norelay ?max_size@?$allocator@D@std@@QBEIXZ() __thiscall_MSVCP_allocator_char_max_size
|
||||
@ stub ?max_size@?$allocator@G@std@@QBEIXZ
|
||||
@ stub ?max_size@?$allocator@_W@std@@QBEIXZ
|
||||
@ stub ?max_size@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEIXZ
|
||||
|
|
|
@ -20,12 +20,30 @@
|
|||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "msvcp90.h"
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(msvcp90);
|
||||
|
||||
void init_cxx_funcs(void)
|
||||
{
|
||||
HMODULE hmod = GetModuleHandleA("msvcrt.dll");
|
||||
|
||||
if (sizeof(void *) > sizeof(int)) /* 64-bit has different names */
|
||||
{
|
||||
MSVCRT_operator_new = (void*)GetProcAddress(hmod, "??2@YAPEAX_K@Z");
|
||||
MSVCRT_operator_delete = (void*)GetProcAddress(hmod, "??3@YAXPEAX@Z");
|
||||
}
|
||||
else
|
||||
{
|
||||
MSVCRT_operator_new = (void*)GetProcAddress(hmod, "??2@YAPAXI@Z");
|
||||
MSVCRT_operator_delete = (void*)GetProcAddress(hmod, "??3@YAXPAX@Z");
|
||||
}
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||
{
|
||||
TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
|
||||
|
@ -35,6 +53,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|||
case DLL_WINE_PREATTACH:
|
||||
return FALSE; /* prefer native version */
|
||||
case DLL_PROCESS_ATTACH:
|
||||
init_cxx_funcs();
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue