Sweden-Number/dlls/msvcrt/unixlib.c

275 lines
5.4 KiB
C

/*
* MSVCRT Unix interface
*
* Copyright 2020 Alexandre Julliard
*
* 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
*/
#if 0
#pragma makedep unix
#endif
#include "config.h"
#include "wine/port.h"
#include <stdio.h>
#include <stdarg.h>
#define __USE_ISOC9X 1
#define __USE_ISOC99 1
#include <math.h>
#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
#endif
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "winternl.h"
#include "unixlib.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
/*********************************************************************
* exp
*/
static double CDECL unix_exp( double x )
{
return exp( x );
}
/*********************************************************************
* expf
*/
static float CDECL unix_expf( float x )
{
return expf( x );
}
/*********************************************************************
* exp2
*/
static double CDECL unix_exp2( double x )
{
#ifdef HAVE_EXP2
return exp2(x);
#else
return pow(2, x);
#endif
}
/*********************************************************************
* exp2f
*/
static float CDECL unix_exp2f( float x )
{
#ifdef HAVE_EXP2F
return exp2f(x);
#else
return unix_exp2(x);
#endif
}
/*********************************************************************
* fmaf
*/
static float CDECL unix_fmaf( float x, float y, float z )
{
#ifdef HAVE_FMAF
return fmaf(x, y, z);
#else
return x * y + z;
#endif
}
/*********************************************************************
* lgamma
*/
static double CDECL unix_lgamma(double x)
{
#ifdef HAVE_LGAMMA
return lgamma(x);
#else
FIXME( "not implemented\n" );
return 0;
#endif
}
/*********************************************************************
* lgammaf
*/
static float CDECL unix_lgammaf(float x)
{
#ifdef HAVE_LGAMMAF
return lgammaf(x);
#else
FIXME( "not implemented\n" );
return 0;
#endif
}
/*********************************************************************
* log
*/
static double CDECL unix_log( double x )
{
return log( x );
}
/*********************************************************************
* logf
*/
static float CDECL unix_logf( float x )
{
return logf( x );
}
/*********************************************************************
* log10
*/
static double CDECL unix_log10( double x )
{
return log10( x );
}
/*********************************************************************
* log10f
*/
static float CDECL unix_log10f( float x )
{
return log10f( x );
}
/*********************************************************************
* log1p
*/
static double CDECL unix_log1p(double x)
{
#ifdef HAVE_LOG1P
return log1p(x);
#else
return log(1 + x);
#endif
}
/*********************************************************************
* log1pf
*/
static float CDECL unix_log1pf(float x)
{
#ifdef HAVE_LOG1PF
return log1pf(x);
#else
return log(1 + x);
#endif
}
/*********************************************************************
* log2
*/
static double CDECL unix_log2(double x)
{
#ifdef HAVE_LOG2
return log2(x);
#else
return log(x) / log(2);
#endif
}
/*********************************************************************
* log2f
*/
static float CDECL unix_log2f(float x)
{
#ifdef HAVE_LOG2F
return log2f(x);
#else
return unix_log2(x);
#endif
}
/*********************************************************************
* pow
*/
static double CDECL unix_pow( double x, double y )
{
return pow( x, y );
}
/*********************************************************************
* powf
*/
static float CDECL unix_powf( float x, float y )
{
return powf( x, y );
}
/*********************************************************************
* tgamma
*/
static double CDECL unix_tgamma(double x)
{
#ifdef HAVE_TGAMMA
return tgamma(x);
#else
FIXME( "not implemented\n" );
return 0;
#endif
}
/*********************************************************************
* tgammaf
*/
static float CDECL unix_tgammaf(float x)
{
#ifdef HAVE_TGAMMAF
return tgammaf(x);
#else
FIXME( "not implemented\n" );
return 0;
#endif
}
static const struct unix_funcs funcs =
{
unix_exp,
unix_expf,
unix_exp2,
unix_exp2f,
unix_fmaf,
unix_lgamma,
unix_lgammaf,
unix_log,
unix_logf,
unix_log10,
unix_log10f,
unix_log1p,
unix_log1pf,
unix_log2,
unix_log2f,
unix_pow,
unix_powf,
unix_tgamma,
unix_tgammaf,
};
NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out )
{
if (reason != DLL_PROCESS_ATTACH) return STATUS_SUCCESS;
TRACE( "\n" );
*(const struct unix_funcs **)ptr_out = &funcs;
return STATUS_SUCCESS;
}