[CRT] Improve _matherr handling

This commit is contained in:
Timo Kreuzer 2022-08-23 23:36:33 +02:00
parent 4d50f81419
commit 3d497ca883
2 changed files with 15 additions and 6 deletions

View file

@ -1,12 +1,10 @@
/*
* PROJECT: ReactOS CRT library
* LICENSE: MIT (https://spdx.org/licenses/MIT)
* PURPOSE: Implementation of __setusermatherr and _invoke_user_matherr
* PURPOSE: Implementation of _invoke_matherr and __setusermatherr
* COPYRIGHT: Copyright 2021 Timo Kreuzer <timo.kreuzer@reactos.org>
*/
// DO NOT SYNC WITH WINE OR MINGW32
#include <math.h>
/* MS headers have this in corecrt_startup.h */
@ -23,11 +21,22 @@ __setusermatherr(_UserMathErrorFunctionPointer func)
int
__cdecl
_invoke_user_matherr(struct _exception *e)
_invoke_matherr(
int type,
char* name,
double arg1,
double arg2,
double retval)
{
if (user_matherr != NULL)
{
return user_matherr(e);
struct _exception excpt;
excpt.type = type;
excpt.name = name;
excpt.arg1 = arg1;
excpt.arg2 = arg2;
excpt.retval = retval;
return user_matherr(&excpt);
}
else
{

View file

@ -1,9 +1,9 @@
list(APPEND LIBCNTPR_MATH_SOURCE
math/_invoke_matherr.c
math/abs.c
math/div.c
math/labs.c
math/usermatherr.c
)
if(ARCH STREQUAL "i386")