From b34ac466b1bb7085484b39e0fc5b12a2876466e9 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sat, 14 Jan 2006 17:40:29 +0100 Subject: [PATCH] msvcrt: Added wrappers for a few functions instead of linking them directly to libc. --- dlls/msvcrt/math.c | 76 +++++++++++++++++++++++++++++++++++++++++ dlls/msvcrt/mbcs.c | 26 ++++++++++++++ dlls/msvcrt/msvcrt.spec | 32 ++++++++--------- dlls/msvcrt/string.c | 36 +++++++++++++++++++ 4 files changed, 154 insertions(+), 16 deletions(-) diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index f5277b0717c..66a3ec08a19 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -489,6 +489,55 @@ double _scalb(double num, long power) return scalb(num, dblpower); } +/********************************************************************* + * _hypot (MSVCRT.@) + */ +double _hypot(double x, double y) +{ + /* FIXME: errno handling */ + return hypot( x, y ); +} + +/********************************************************************* + * ceil (MSVCRT.@) + */ +double MSVCRT_ceil( double x ) +{ + return ceil(x); +} + +/********************************************************************* + * floor (MSVCRT.@) + */ +double MSVCRT_floor( double x ) +{ + return floor(x); +} + +/********************************************************************* + * fabs (MSVCRT.@) + */ +double MSVCRT_fabs( double x ) +{ + return fabs(x); +} + +/********************************************************************* + * frexp (MSVCRT.@) + */ +double MSVCRT_frexp( double x, int *exp ) +{ + return frexp( x, exp ); +} + +/********************************************************************* + * modf (MSVCRT.@) + */ +double MSVCRT_modf( double x, double *iptr ) +{ + return modf( x, iptr ); +} + /********************************************************************* * _matherr (MSVCRT.@) */ @@ -714,6 +763,33 @@ INT _isnan(double num) return isnan(num) ? 1 : 0; } +/********************************************************************* + * _j0 (MSVCRT.@) + */ +double _j0(double num) +{ + /* FIXME: errno handling */ + return j0(num); +} + +/********************************************************************* + * _j1 (MSVCRT.@) + */ +double _j1(double num) +{ + /* FIXME: errno handling */ + return j1(num); +} + +/********************************************************************* + * jn (MSVCRT.@) + */ +double _jn(int n, double num) +{ + /* FIXME: errno handling */ + return jn(n, num); +} + /********************************************************************* * _y0 (MSVCRT.@) */ diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c index 939c314252f..59bb182a674 100644 --- a/dlls/msvcrt/mbcs.c +++ b/dlls/msvcrt/mbcs.c @@ -605,6 +605,32 @@ int _mbsnbicmp(const unsigned char* str, const unsigned char* cmp, MSVCRT_size_t return u_strncmp(str,cmp,len); } +/********************************************************************* + * _mbscat (MSVCRT.@) + */ +unsigned char *_mbscat( unsigned char *dst, const unsigned char *src ) +{ + strcat( (char *)dst, (const char *)src ); + return dst; +} + +/********************************************************************* + * _mbscpy (MSVCRT.@) + */ +unsigned char* _mbscpy( unsigned char *dst, const unsigned char *src ) +{ + strcpy( (char *)dst, (const char *)src ); + return dst; +} + +/********************************************************************* + * _mbsstr (MSVCRT.@) + */ +unsigned char *_mbsstr(const unsigned char *haystack, const unsigned char *needle) +{ + return (unsigned char *)strstr( (const char *)haystack, (const char *)needle ); +} + /********************************************************************* * _mbschr(MSVCRT.@) * diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index 9a6da3ac317..66610ada979 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -270,7 +270,7 @@ @ cdecl _heapset(long) @ stub _heapused #(ptr ptr) @ cdecl _heapwalk(ptr) -@ cdecl _hypot(double double) hypot +@ cdecl _hypot(double double) @ cdecl _i64toa(long long ptr long) ntdll._i64toa @ cdecl _i64tow(long long ptr long) ntdll._i64tow @ cdecl _initterm(ptr ptr) @@ -312,9 +312,9 @@ @ cdecl _isnan( double ) @ cdecl _itoa(long ptr long) ntdll._itoa @ cdecl _itow(long ptr long) ntdll._itow -@ cdecl _j0(double) j0 -@ cdecl _j1(double) j1 -@ cdecl _jn(long double) jn +@ cdecl _j0(double) +@ cdecl _j1(double) +@ cdecl _jn(long double) @ cdecl _kbhit() @ cdecl _lfind(ptr ptr ptr long ptr) @ cdecl _loaddll(str) @@ -346,11 +346,11 @@ @ cdecl _mbctoupper(long) @ extern _mbctype MSVCRT_mbctype @ stub _mbsbtype #(str long) -@ cdecl _mbscat(str str) strcat +@ cdecl _mbscat(str str) @ cdecl _mbschr(str long) @ cdecl _mbscmp(str str) @ cdecl _mbscoll(str str) -@ cdecl _mbscpy(ptr str) strcpy +@ cdecl _mbscpy(ptr str) @ cdecl _mbscspn (str str) @ cdecl _mbsdec(ptr ptr) @ cdecl _mbsdup(str) _strdup @@ -383,7 +383,7 @@ @ cdecl _mbsset(str long) @ cdecl _mbsspn(str str) @ stub _mbsspnp #(str str) -@ cdecl _mbsstr(str str) strstr +@ cdecl _mbsstr(str str) @ cdecl _mbstok(str str) @ cdecl _mbstrlen(str) @ cdecl _mbsupr(str) @@ -575,12 +575,12 @@ @ cdecl atan(double) MSVCRT_atan @ cdecl atan2(double double) MSVCRT_atan2 @ cdecl atexit(ptr) MSVCRT_atexit -@ cdecl atof(str) +@ cdecl atof(str) MSVCRT_atof @ cdecl atoi(str) @ cdecl atol(str) @ cdecl bsearch(ptr ptr long long ptr) @ cdecl calloc(long long) MSVCRT_calloc -@ cdecl ceil(double) +@ cdecl ceil(double) MSVCRT_ceil @ cdecl clearerr(ptr) MSVCRT_clearerr @ cdecl clock() MSVCRT_clock @ cdecl cos(double) MSVCRT_cos @@ -590,7 +590,7 @@ @ cdecl div(long long) MSVCRT_div @ cdecl exit(long) MSVCRT_exit @ cdecl exp(double) MSVCRT_exp -@ cdecl fabs(double) +@ cdecl fabs(double) MSVCRT_fabs @ cdecl fclose(ptr) MSVCRT_fclose @ cdecl feof(ptr) MSVCRT_feof @ cdecl ferror(ptr) MSVCRT_ferror @@ -600,7 +600,7 @@ @ cdecl fgets(ptr long ptr) MSVCRT_fgets @ cdecl fgetwc(ptr) MSVCRT_fgetwc @ cdecl fgetws(ptr long ptr) MSVCRT_fgetws -@ cdecl floor(double) +@ cdecl floor(double) MSVCRT_floor @ cdecl fmod(double double) MSVCRT_fmod @ cdecl fopen(str str) MSVCRT_fopen @ varargs fprintf(ptr str) MSVCRT_fprintf @@ -611,7 +611,7 @@ @ cdecl fread(ptr long long ptr) MSVCRT_fread @ cdecl free(ptr) MSVCRT_free @ cdecl freopen(str str ptr) MSVCRT_freopen -@ cdecl frexp(double ptr) +@ cdecl frexp(double ptr) MSVCRT_frexp @ varargs fscanf(ptr str) MSVCRT_fscanf @ cdecl fseek(ptr long long) MSVCRT_fseek @ cdecl fsetpos(ptr ptr) MSVCRT_fsetpos @@ -670,7 +670,7 @@ @ cdecl memmove(ptr ptr long) @ cdecl memset(ptr long long) @ cdecl mktime(ptr) MSVCRT_mktime -@ cdecl modf(double ptr) +@ cdecl modf(double ptr) MSVCRT_modf @ cdecl perror(str) MSVCRT_perror @ cdecl pow(double double) MSVCRT_pow @ varargs printf(str) MSVCRT_printf @@ -700,7 +700,7 @@ @ cdecl strcat(str str) @ cdecl strchr(str long) @ cdecl strcmp(str str) -@ cdecl strcoll(str str) +@ cdecl strcoll(str str) MSVCRT_strcoll @ cdecl strcpy(ptr str) @ cdecl strcspn(str str) @ cdecl strerror(long) MSVCRT_strerror @@ -713,11 +713,11 @@ @ cdecl strrchr(str long) @ cdecl strspn(str str) @ cdecl strstr(str str) -@ cdecl strtod(str ptr) +@ cdecl strtod(str ptr) MSVCRT_strtod @ cdecl strtok(str str) MSVCRT_strtok @ cdecl strtol(str ptr long) @ cdecl strtoul(str ptr long) -@ cdecl strxfrm(ptr str long) +@ cdecl strxfrm(ptr str long) MSVCRT_strxfrm @ varargs swprintf(wstr wstr) MSVCRT_swprintf @ varargs swscanf(wstr wstr) MSVCRT_swscanf @ cdecl system(str) MSVCRT_system diff --git a/dlls/msvcrt/string.c b/dlls/msvcrt/string.c index 057dbf80c1d..579c9bd8730 100644 --- a/dlls/msvcrt/string.c +++ b/dlls/msvcrt/string.c @@ -21,6 +21,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include "msvcrt.h" #include "wine/debug.h" @@ -135,6 +136,41 @@ void MSVCRT__swab(char* src, char* dst, int len) } } } + +/********************************************************************* + * atof (MSVCRT.@) + */ +double MSVCRT_atof( const char *str ) +{ + return atof( str ); +} + +/********************************************************************* + * strtod (MSVCRT.@) + */ +double MSVCRT_strtod( const char *str, char **end ) +{ + return strtod( str, end ); +} + +/********************************************************************* + * strcoll (MSVCRT.@) + */ +int MSVCRT_strcoll( const char* str1, const char* str2 ) +{ + /* FIXME: handle Windows locale */ + return strcoll( str1, str2 ); +} + +/********************************************************************* + * strxfrm (MSVCRT.@) + */ +MSVCRT_size_t MSVCRT_strxfrm( char *dest, const char *src, MSVCRT_size_t len ) +{ + /* FIXME: handle Windows locale */ + return strxfrm( dest, src, len ); +} + /********************************************************************* * _stricoll (MSVCRT.@) */