- Implement _wfreopen, _y0, _y1, _yn

- Partially implement _j0, _j1, _jn
All from Wine.

svn path=/trunk/; revision=40778
This commit is contained in:
Dmitry Chapyshev 2009-05-03 14:57:56 +00:00
parent d3452a30c0
commit 2b41ac2a04
4 changed files with 80 additions and 17 deletions

View file

@ -1,18 +1,30 @@
#include <math.h>
typedef int fpclass_t;
fpclass_t _fpclass(double __d);
int *_errno(void);
/*
* @unimplemented
*/
double _j0(double x)
double _j0(double num)
{
return x;
/* FIXME: errno handling */
return j0(num);
}
/*
* @unimplemented
* @implemented
*/
double _y0(double x)
double _y0(double num)
{
return x;
double retval;
if (!isfinite(num)) *_errno() = EDOM;
retval = y0(num);
if (_fpclass(retval) == _FPCLASS_NINF)
{
*_errno() = EDOM;
retval = sqrt(-1);
}
return retval;
}

View file

@ -1,18 +1,30 @@
#include <math.h>
typedef int fpclass_t;
fpclass_t _fpclass(double __d);
int *_errno(void);
/*
* @unimplemented
*/
double _j1(double x)
double _j1(double num)
{
return x;
/* FIXME: errno handling */
return j1(num);
}
/*
* @unimplemented
* @implemented
*/
double _y1(double x)
double _y1(double num)
{
return x;
double retval;
if (!isfinite(num)) *_errno() = EDOM;
retval = y1(num);
if (_fpclass(retval) == _FPCLASS_NINF)
{
*_errno() = EDOM;
retval = sqrt(-1);
}
return retval;
}

View file

@ -1,18 +1,30 @@
#include <math.h>
typedef int fpclass_t;
fpclass_t _fpclass(double __d);
int *_errno(void);
/*
* @unimplemented
*/
double _jn(int n, double x)
double _jn(int n, double num)
{
return x;
/* FIXME: errno handling */
return jn(n, num);
}
/*
* @unimplemented
* @implemented
*/
double _yn(int n, double x)
double _yn(int order, double num)
{
return x;
double retval;
if (!isfinite(num)) *_errno() = EDOM;
retval = yn(order,num);
if (_fpclass(retval) == _FPCLASS_NINF)
{
*_errno() = EDOM;
retval = sqrt(-1);
}
return retval;
}

View file

@ -2434,8 +2434,35 @@ FILE* CDECL freopen(const char *path, const char *mode,FILE* file)
*/
FILE* CDECL _wfreopen(const wchar_t *path, const wchar_t *mode,FILE* file)
{
FIXME("UNIMPLEMENTED stub!\n");
return NULL;
int open_flags, stream_flags, fd;
TRACE(":path (%p) mode (%s) file (%p) fd (%d)\n", debugstr_w(path), debugstr_w(mode), file, file->_file);
LOCK_FILES();
if (!file || ((fd = file->_file) < 0) || fd > fdend)
file = NULL;
else
{
fclose(file);
/* map mode string to open() flags. "man fopen" for possibilities. */
if (get_flags((char*)mode, &open_flags, &stream_flags) == -1)
file = NULL;
else
{
fd = _wopen(path, open_flags, _S_IREAD | _S_IWRITE);
if (fd < 0)
file = NULL;
else if (init_fp(file, fd, stream_flags) == -1)
{
file->_flag = 0;
WARN(":failed-last error (%d)\n",GetLastError());
_dosmaperr(GetLastError());
file = NULL;
}
}
}
UNLOCK_FILES();
return file;
}
/*********************************************************************