mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-28 19:26:16 +00:00
remove obvious duplicates
svn path=/trunk/; revision=13372
This commit is contained in:
@@ -1,67 +0,0 @@
|
||||
#include <msvcrt/conio.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
char* _cgets(char *string)
|
||||
{
|
||||
unsigned len = 0;
|
||||
unsigned int maxlen_wanted;
|
||||
char *sp;
|
||||
int c;
|
||||
/*
|
||||
* Be smart and check for NULL pointer.
|
||||
* Don't know wether TURBOC does this.
|
||||
*/
|
||||
if (!string)
|
||||
return(NULL);
|
||||
maxlen_wanted = (unsigned int)((unsigned char)string[0]);
|
||||
sp = &(string[2]);
|
||||
/*
|
||||
* Should the string be shorter maxlen_wanted including or excluding
|
||||
* the trailing '\0' ? We don't take any risk.
|
||||
*/
|
||||
while(len < maxlen_wanted-1)
|
||||
{
|
||||
c=_getch();
|
||||
/*
|
||||
* shold we check for backspace here?
|
||||
* TURBOC does (just checked) but doesn't in cscanf (thats harder
|
||||
* or even impossible). We do the same.
|
||||
*/
|
||||
if (c == '\b')
|
||||
{
|
||||
if (len > 0)
|
||||
{
|
||||
_cputs("\b \b"); /* go back, clear char on screen with space
|
||||
and go back again */
|
||||
len--;
|
||||
sp[len] = '\0'; /* clear the character in the string */
|
||||
}
|
||||
}
|
||||
else if (c == '\r')
|
||||
{
|
||||
sp[len] = '\0';
|
||||
break;
|
||||
}
|
||||
else if (c == 0)
|
||||
{
|
||||
/* special character ends input */
|
||||
sp[len] = '\0';
|
||||
_ungetch(c); /* keep the char for later processing */
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
sp[len] = _putch(c);
|
||||
len++;
|
||||
}
|
||||
}
|
||||
sp[maxlen_wanted-1] = '\0';
|
||||
string[1] = (char)((unsigned char)len);
|
||||
return(sp);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/conio.h>
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
int
|
||||
_cprintf(const char *fmt, ...)
|
||||
{
|
||||
int cnt;
|
||||
char buf[ 2048 ]; /* this is buggy, because buffer might be too small. */
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
cnt = vsprintf(buf, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
_cputs(buf);
|
||||
return cnt;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/conio/cputs.c
|
||||
* PURPOSE: Writes a character to stdout
|
||||
* PROGRAMER: Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* 28/12/98: Created
|
||||
*/
|
||||
#include "precomp.h"
|
||||
#include <msvcrt/conio.h>
|
||||
#include <msvcrt/string.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _cputs(const char *_str)
|
||||
{
|
||||
int len = strlen(_str);
|
||||
DWORD written = 0;
|
||||
if (!WriteFile(filehnd(stdout->_file),_str,len,&written,NULL))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
#include <msvcrt/conio.h>
|
||||
#include <msvcrt/stdarg.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/internal/stdio.h>
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
int _cscanf(char *fmt, ...)
|
||||
{
|
||||
int cnt;
|
||||
|
||||
va_list ap;
|
||||
|
||||
//fixme cscanf should scan the console's keyboard
|
||||
va_start(ap, fmt);
|
||||
cnt = __vscanf(fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return cnt;
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/conio/getch.c
|
||||
* PURPOSE: Writes a character to stdout
|
||||
* PROGRAMER: Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* 28/12/98: Created
|
||||
*/
|
||||
#include "precomp.h"
|
||||
#include <msvcrt/conio.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/io.h>
|
||||
#include <msvcrt/internal/console.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _getch(void)
|
||||
{
|
||||
DWORD NumberOfCharsRead = 0;
|
||||
char c;
|
||||
if (char_avail) {
|
||||
c = ungot_char;
|
||||
char_avail = 0;
|
||||
} else {
|
||||
ReadConsoleA(_get_osfhandle(stdin->_file),
|
||||
&c,
|
||||
1,
|
||||
&NumberOfCharsRead,
|
||||
NULL);
|
||||
}
|
||||
if (c == 10)
|
||||
c = 13;
|
||||
putchar(c);
|
||||
return c;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
int _getche(void)
|
||||
{
|
||||
int c;
|
||||
|
||||
c = _getch();
|
||||
_putch(c);
|
||||
|
||||
return c;
|
||||
}
|
||||
#endif
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/conio/getche.c
|
||||
* PURPOSE: Reads a character from stdin
|
||||
* PROGRAMER: DJ Delorie
|
||||
Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* 28/12/98: Created
|
||||
*/
|
||||
|
||||
#include <msvcrt/conio.h>
|
||||
#include <msvcrt/internal/console.h>
|
||||
|
||||
|
||||
int getche(void)
|
||||
{
|
||||
if (char_avail)
|
||||
/*
|
||||
* We don't know, wether the ungot char was already echoed
|
||||
* we assume yes (for example in cscanf, probably the only
|
||||
* place where ungetch is ever called.
|
||||
* There is no way to check for this really, because
|
||||
* ungetch could have been called with a character that
|
||||
* hasn't been got by a conio function.
|
||||
* We don't echo again.
|
||||
*/
|
||||
return(getch());
|
||||
return (_putch(getch()));
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/conio/kbhit.c
|
||||
* PURPOSE: Checks for keyboard hits
|
||||
* PROGRAMER: Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* 28/12/98: Created
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <msvcrt/conio.h>
|
||||
#include <msvcrt/internal/console.h>
|
||||
|
||||
|
||||
// FIXME PeekCosoleInput returns more than keyboard hits
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
int _kbhit(void)
|
||||
{
|
||||
//INPUT_RECORD InputRecord;
|
||||
DWORD NumberRead=0;
|
||||
if (char_avail)
|
||||
return(1);
|
||||
else {
|
||||
//FIXME PeekConsoleInput might do DeviceIo
|
||||
//PeekConsoleInput((HANDLE)stdin->_file,&InputRecord,1,&NumberRead);
|
||||
return NumberRead;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/conio/putch.c
|
||||
* PURPOSE: Writes a character to stdout
|
||||
* PROGRAMER: Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* 28/12/98: Created
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <msvcrt/conio.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _putch( int c )
|
||||
{
|
||||
DWORD NumberOfCharsWritten;
|
||||
|
||||
if ( WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),&c,1,&NumberOfCharsWritten,NULL) ) {
|
||||
return -1;
|
||||
}
|
||||
return NumberOfCharsWritten;
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/conio/ungetch.c
|
||||
* PURPOSE: Ungets a character from stdin
|
||||
* PROGRAMER: DJ Delorie
|
||||
Boudewijn Dekker [ Adapted from djgpp libc ]
|
||||
* UPDATE HISTORY:
|
||||
* 28/12/98: Created
|
||||
*/
|
||||
|
||||
#include <msvcrt/conio.h>
|
||||
#include <msvcrt/internal/console.h>
|
||||
|
||||
#define EOF -1
|
||||
|
||||
int char_avail = 0;
|
||||
int ungot_char = 0;
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ungetch(int c)
|
||||
{
|
||||
if (char_avail)
|
||||
return(EOF);
|
||||
ungot_char = c;
|
||||
char_avail = 1;
|
||||
return(c);
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <msvcrt/ctype.h>
|
||||
|
||||
|
||||
extern unsigned short _ctype[];
|
||||
|
||||
unsigned short *_pctype_dll = _ctype + 1;
|
||||
unsigned short *_pwctype_dll = _ctype + 1;
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _isctype(unsigned int c, int ctypeFlags)
|
||||
{
|
||||
return (_pctype_dll[(unsigned char)(c & 0xFF)] & ctypeFlags);
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int iswctype(wint_t wc, wctype_t wctypeFlags)
|
||||
{
|
||||
return (_pwctype_dll[(unsigned char)(wc & 0xFF)] & wctypeFlags);
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int is_wctype(wint_t wc, wctype_t wctypeFlags)
|
||||
{
|
||||
return (_pwctype_dll[(unsigned char)(wc & 0xFF)] & wctypeFlags);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
@@ -1,23 +0,0 @@
|
||||
#include "precomp.h"
|
||||
#include <msvcrt/ctype.h>
|
||||
#include <msvcrt/direct.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned int _getdiskfree(unsigned int _drive, struct _diskfree_t* _diskspace)
|
||||
{
|
||||
char RootPathName[10];
|
||||
|
||||
RootPathName[0] = toupper(_drive +'@');
|
||||
RootPathName[1] = ':';
|
||||
RootPathName[2] = '\\';
|
||||
RootPathName[3] = 0;
|
||||
if (_diskspace == NULL)
|
||||
return 0;
|
||||
if (!GetDiskFreeSpaceA(RootPathName,(LPDWORD)&_diskspace->sectors_per_cluster,(LPDWORD)&_diskspace->bytes_per_sector,
|
||||
(LPDWORD )&_diskspace->avail_clusters,(LPDWORD )&_diskspace->total_clusters))
|
||||
return 0;
|
||||
return _diskspace->avail_clusters;
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
#include "precomp.h"
|
||||
#include <msvcrt/ctype.h>
|
||||
#include <msvcrt/direct.h>
|
||||
|
||||
|
||||
extern int cur_drive;
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _getdrive(void)
|
||||
{
|
||||
char Buffer[MAX_PATH];
|
||||
|
||||
if (cur_drive == 0) {
|
||||
GetCurrentDirectoryA(MAX_PATH, Buffer);
|
||||
cur_drive = toupper(Buffer[0] - '@');
|
||||
}
|
||||
return cur_drive;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
unsigned long _getdrives(void)
|
||||
{
|
||||
//fixme get logical drives
|
||||
//return GetLogicalDrives();
|
||||
return 5; // drive A and C
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#include "precomp.h"
|
||||
#include <msvcrt/direct.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _mkdir(const char* _path)
|
||||
{
|
||||
if (!CreateDirectoryA(_path, NULL))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
#include "precomp.h"
|
||||
#include <msvcrt/stdio.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
int _abnormal_termination(void)
|
||||
{
|
||||
printf("Abnormal Termination\n");
|
||||
// return AbnormalTermination();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
#endif
|
||||
@@ -1,33 +0,0 @@
|
||||
#include "precomp.h"
|
||||
#include <ntos/except.h>
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#else
|
||||
#endif
|
||||
|
||||
ULONG DbgPrint(PCH Format, ...)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
VOID STDCALL
|
||||
MsvcrtDebug(ULONG Value)
|
||||
{
|
||||
//DbgPrint("MsvcrtDebug 0x%.08x\n", Value);
|
||||
}
|
||||
|
||||
struct _EXCEPTION_RECORD;
|
||||
struct _CONTEXT;
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
EXCEPTION_DISPOSITION
|
||||
_except_handler2(
|
||||
struct _EXCEPTION_RECORD* ExceptionRecord, void* Frame,
|
||||
struct _CONTEXT *ContextRecord, void* DispatcherContext)
|
||||
{
|
||||
//printf("_except_handler2()\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
#include "precomp.h"
|
||||
#include <ntos/except.h>
|
||||
|
||||
|
||||
struct _exception {
|
||||
int type;
|
||||
char* name;
|
||||
double arg1;
|
||||
double arg2;
|
||||
double retval;
|
||||
} ;
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
int _matherr(struct _exception* e)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// not exported by NTDLL
|
||||
void __setusermatherr(int (*handler)(struct _exception*))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
#define _FPIEEE_RECORD void
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
int _fpieee_flt(
|
||||
unsigned long exception_code,
|
||||
struct _EXCEPTION_POINTERS* ExceptionPointer,
|
||||
int (*handler)(_FPIEEE_RECORD*)
|
||||
)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#include "precomp.h"
|
||||
#define PEXCEPTION_FRAME void*
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
void _global_unwind2( PEXCEPTION_FRAME frame )
|
||||
{
|
||||
//RtlUnwind( frame, 0, NULL, 0 );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
void _local_unwind2( PEXCEPTION_FRAME endframe, DWORD nr )
|
||||
{
|
||||
//TRACE(crtdll,"(%p,%ld)\n",endframe,nr);
|
||||
return;
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
#include <msvcrt/float.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned int _clearfp (void)
|
||||
{
|
||||
unsigned short __res = _statusfp();
|
||||
#ifdef __GNUC__
|
||||
__asm__ __volatile__ (
|
||||
"fclex \n\t"
|
||||
);
|
||||
#else
|
||||
#endif /*__GNUC__*/
|
||||
return __res;
|
||||
}
|
||||
|
||||
@@ -1,174 +0,0 @@
|
||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||
|
||||
#include <msvcrt/float.h>
|
||||
|
||||
#define X87_CW_IM (1<<0) /* Invalid operation mask */
|
||||
#define X87_CW_DM (1<<1) /* Denormal operand mask */
|
||||
#define X87_CW_ZM (1<<2) /* Zero divide mask */
|
||||
#define X87_CW_OM (1<<3) /* Overflow mask */
|
||||
#define X87_CW_UM (1<<4) /* Underflow mask */
|
||||
#define X87_CW_PM (1<<5) /* Precision mask */
|
||||
|
||||
#define X87_CW_PC_MASK (3<<8) /* precision control mask */
|
||||
#define X87_CW_PC24 (0<<8) /* 24 bit precision */
|
||||
#define X87_CW_PC53 (2<<8) /* 53 bit precision */
|
||||
#define X87_CW_PC64 (3<<8) /* 64 bit precision */
|
||||
|
||||
#define X87_CW_RC_MASK (3<<10) /* rounding control mask */
|
||||
#define X87_CW_RC_NEAREST (0<<10) /* round to nearest */
|
||||
#define X87_CW_RC_DOWN (1<<10) /* round down */
|
||||
#define X87_CW_RC_UP (2<<10) /* round up */
|
||||
#define X87_CW_RC_ZERO (3<<10) /* round toward zero (chop) */
|
||||
|
||||
#define X87_CW_IC (1<<12) /* infinity control flag */
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned int _controlfp(unsigned int unNew, unsigned int unMask)
|
||||
{
|
||||
return _control87(unNew,unMask);
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned int _control87(unsigned int unNew, unsigned int unMask)
|
||||
{
|
||||
unsigned int FpuCw;
|
||||
unsigned int DummyCw = 0;
|
||||
|
||||
/* get the controlword */
|
||||
asm volatile("fstcw %0\n\t" : "=m"(FpuCw));
|
||||
FpuCw &= 0x0000ffff;
|
||||
|
||||
/* translate it into _control87 format */
|
||||
if (FpuCw & X87_CW_IM)
|
||||
DummyCw |= _EM_INVALID;
|
||||
if (FpuCw & X87_CW_DM)
|
||||
DummyCw |= _EM_DENORMAL;
|
||||
if (FpuCw & X87_CW_ZM)
|
||||
DummyCw |= _EM_ZERODIVIDE;
|
||||
if (FpuCw & X87_CW_OM)
|
||||
DummyCw |= _EM_OVERFLOW;
|
||||
if (FpuCw & X87_CW_UM)
|
||||
DummyCw |= _EM_UNDERFLOW;
|
||||
if (FpuCw & X87_CW_PM)
|
||||
DummyCw |= _EM_INEXACT;
|
||||
|
||||
switch (FpuCw & X87_CW_PC_MASK)
|
||||
{
|
||||
case X87_CW_PC24:
|
||||
DummyCw |= _PC_24;
|
||||
break;
|
||||
case X87_CW_PC53:
|
||||
DummyCw |= _PC_53;
|
||||
break;
|
||||
case X87_CW_PC64:
|
||||
DummyCw |= _PC_64;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (FpuCw & X87_CW_RC_MASK)
|
||||
{
|
||||
case X87_CW_RC_NEAREST:
|
||||
DummyCw |= _RC_NEAR;
|
||||
break;
|
||||
case X87_CW_RC_DOWN:
|
||||
DummyCw |= _RC_DOWN;
|
||||
break;
|
||||
case X87_CW_RC_UP:
|
||||
DummyCw |= _RC_UP;
|
||||
break;
|
||||
case X87_CW_RC_ZERO:
|
||||
DummyCw |= _RC_CHOP;
|
||||
break;
|
||||
}
|
||||
|
||||
/* unset (un)masked bits */
|
||||
DummyCw &= ~unMask;
|
||||
unNew &= unMask;
|
||||
|
||||
/* set new bits */
|
||||
DummyCw |= unNew;
|
||||
|
||||
/* translate back into x87 format
|
||||
* FIXME: translate infinity control!
|
||||
*/
|
||||
FpuCw = 0;
|
||||
if (DummyCw & _EM_INVALID)
|
||||
FpuCw |= X87_CW_IM;
|
||||
if (DummyCw & _EM_DENORMAL)
|
||||
FpuCw |= X87_CW_DM;
|
||||
if (DummyCw & _EM_ZERODIVIDE)
|
||||
FpuCw |= X87_CW_ZM;
|
||||
if (DummyCw & _EM_OVERFLOW)
|
||||
FpuCw |= X87_CW_OM;
|
||||
if (DummyCw & _EM_UNDERFLOW)
|
||||
FpuCw |= X87_CW_UM;
|
||||
if (DummyCw & _EM_INEXACT)
|
||||
FpuCw |= X87_CW_PM;
|
||||
|
||||
switch (DummyCw & _MCW_PC)
|
||||
{
|
||||
case _PC_24:
|
||||
FpuCw |= X87_CW_PC24;
|
||||
break;
|
||||
case _PC_53:
|
||||
FpuCw |= X87_CW_PC53;
|
||||
break;
|
||||
case _PC_64:
|
||||
default:
|
||||
FpuCw |= X87_CW_PC64;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (DummyCw & _MCW_RC)
|
||||
{
|
||||
case _RC_NEAR:
|
||||
FpuCw |= X87_CW_RC_NEAREST;
|
||||
break;
|
||||
case _RC_DOWN:
|
||||
FpuCw |= X87_CW_RC_DOWN;
|
||||
break;
|
||||
case _RC_UP:
|
||||
FpuCw |= X87_CW_RC_UP;
|
||||
break;
|
||||
case _RC_CHOP:
|
||||
FpuCw |= X87_CW_RC_ZERO;
|
||||
break;
|
||||
}
|
||||
|
||||
/* set controlword */
|
||||
asm volatile("fldcw %0" : : "m"(FpuCw));
|
||||
|
||||
return DummyCw;
|
||||
|
||||
#if 0 /* The follwing is the original code, broken I think! -blight */
|
||||
register unsigned int __res;
|
||||
#ifdef __GNUC__
|
||||
__asm__ __volatile__ (
|
||||
"pushl %%eax \n\t" /* make room on stack */
|
||||
"fstcw (%%esp) \n\t"
|
||||
"fwait \n\t"
|
||||
"popl %%eax \n\t"
|
||||
"andl $0xffff, %%eax \n\t" /* OK; we have the old value ready */
|
||||
|
||||
"movl %1, %%ecx \n\t"
|
||||
"notl %%ecx \n\t"
|
||||
"andl %%eax, %%ecx \n\t" /* the bits we want to keep */
|
||||
|
||||
"movl %2, %%edx \n\t"
|
||||
"andl %1, %%edx \n\t" /* the bits we want to change */
|
||||
|
||||
"orl %%ecx, %%edx\n\t" /* the new value */
|
||||
"pushl %%edx \n\t"
|
||||
"fldcw (%%esp) \n\t"
|
||||
"popl %%edx \n\t"
|
||||
|
||||
:"=a" (__res):"r" (unNew),"r" (unMask): "dx", "cx");
|
||||
#else
|
||||
#endif /*__GNUC__*/
|
||||
return __res;
|
||||
#endif
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#include <msvcrt/float.h>
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
void _fpreset(void)
|
||||
{
|
||||
/* FIXME: This causes an exception */
|
||||
// __asm__ __volatile__("fninit\n\t");
|
||||
return;
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/* Math functions for i387.
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by John C. Bowman <[email protected]>, 1995.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <msvcrt/float.h>
|
||||
|
||||
double _logb (double __x)
|
||||
{
|
||||
register double __value;
|
||||
#ifdef __GNUC__
|
||||
register double __junk;
|
||||
__asm __volatile__
|
||||
("fxtract\n\t"
|
||||
: "=t" (__junk), "=u" (__value) : "0" (__x));
|
||||
#else
|
||||
#endif /*__GNUC__*/
|
||||
return __value;
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
#include <msvcrt/float.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double _nextafter(double x, double y)
|
||||
{
|
||||
if (x == y)
|
||||
return x;
|
||||
|
||||
if (isnan(x) || isnan(y))
|
||||
return x;
|
||||
|
||||
return x;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
#include <msvcrt/float.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned int _statusfp (void)
|
||||
{
|
||||
|
||||
register unsigned short __res;
|
||||
#ifdef __GNUC__
|
||||
__asm__ __volatile__ (
|
||||
"fstsw %0 \n\t"
|
||||
// "movzwl %ax, %eax"
|
||||
:"=a" (__res)
|
||||
);
|
||||
#else
|
||||
#endif /*__GNUC__*/
|
||||
return __res;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <msvcrt/io.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <msvcrt/msvcrtdbg.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _chsize(int _fd, long size)
|
||||
{
|
||||
DPRINT("_chsize(fd %d, size %d)\n", _fd, size);
|
||||
if (lseek(_fd, size, 0) == -1)
|
||||
return -1;
|
||||
if (_write(_fd, 0, 0) < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
#include "precomp.h"
|
||||
#include <msvcrt/io.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <msvcrt/msvcrtdbg.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _close(int _fd)
|
||||
{
|
||||
DPRINT("_close(fd %d)\n", _fd);
|
||||
if (_fd == -1)
|
||||
return -1;
|
||||
if (CloseHandle(_get_osfhandle(_fd)) == FALSE)
|
||||
return -1;
|
||||
return __fileno_close(_fd);
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
#include "precomp.h"
|
||||
#include <msvcrt/io.h>
|
||||
#include <msvcrt/errno.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _commit(int _fd)
|
||||
{
|
||||
if (! FlushFileBuffers(_get_osfhandle(_fd)) ) {
|
||||
__set_errno(EBADF);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
#include <msvcrt/io.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _dup2( int handle1, int handle2 )
|
||||
{
|
||||
return __fileno_dup2( handle1, handle2 );
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
#include <msvcrt/io.h>
|
||||
#include <msvcrt/sys/stat.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <msvcrt/msvcrtdbg.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _isatty( int fd )
|
||||
{
|
||||
struct stat buf;
|
||||
DPRINT("_isatty(fd %d)\n", fd);
|
||||
if (_fstat (fd, &buf) < 0)
|
||||
return 0;
|
||||
if (S_ISCHR (buf.st_mode))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/io/mktemp.c
|
||||
* PURPOSE: Makes a temp file based on a template
|
||||
* PROGRAMER: DJ Delorie
|
||||
Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* 28/12/98: Appropriated for the Reactos Kernel
|
||||
*/
|
||||
|
||||
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
|
||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/string.h>
|
||||
#include <msvcrt/io.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <msvcrt/msvcrtdbg.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
char* _mktemp (char *_template)
|
||||
{
|
||||
static int count = 0;
|
||||
char *cp, *dp;
|
||||
int i, len, xcount, loopcnt;
|
||||
|
||||
DPRINT("_mktemp('%s')\n", _template);
|
||||
len = strlen (_template);
|
||||
cp = _template + len;
|
||||
|
||||
xcount = 0;
|
||||
while (xcount < 6 && cp > _template && cp[-1] == 'X')
|
||||
xcount++, cp--;
|
||||
|
||||
if (xcount) {
|
||||
dp = cp;
|
||||
while (dp > _template && dp[-1] != '/' && dp[-1] != '\\' && dp[-1] != ':')
|
||||
dp--;
|
||||
|
||||
/* Keep the first characters of the template, but turn the rest into
|
||||
Xs. */
|
||||
while (cp > dp + 8 - xcount) {
|
||||
*--cp = 'X';
|
||||
xcount = (xcount >= 6) ? 6 : 1 + xcount;
|
||||
}
|
||||
|
||||
/* If dots occur too early -- squash them. */
|
||||
while (dp < cp) {
|
||||
if (*dp == '.') *dp = 'a';
|
||||
dp++;
|
||||
}
|
||||
|
||||
/* Try to add ".tmp" to the filename. Truncate unused Xs. */
|
||||
if (cp + xcount + 3 < _template + len)
|
||||
strcpy (cp + xcount, ".tmp");
|
||||
else
|
||||
cp[xcount] = 0;
|
||||
|
||||
/* This loop can run up to 2<<(5*6) times, or about 10^9 times. */
|
||||
for (loopcnt = 0; loopcnt < (1 << (5 * xcount)); loopcnt++) {
|
||||
int c = count++;
|
||||
for (i = 0; i < xcount; i++, c >>= 5)
|
||||
cp[i] = "abcdefghijklmnopqrstuvwxyz012345"[c & 0x1f];
|
||||
if (_access(_template,0) == -1)
|
||||
return _template;
|
||||
}
|
||||
}
|
||||
|
||||
/* Failure: truncate the template and return NULL. */
|
||||
*_template = 0;
|
||||
return 0;
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/io/setmode.c
|
||||
* PURPOSE: Sets the file translation mode
|
||||
* PROGRAMER: Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* 28/12/98: Created
|
||||
*/
|
||||
|
||||
#include <msvcrt/io.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <msvcrt/msvcrtdbg.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _setmode(int _fd, int _newmode)
|
||||
{
|
||||
DPRINT("_setmod(fd %d, newmode %x)\n", _fd, _newmode);
|
||||
return __fileno_setmode(_fd, _newmode);
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
#include <msvcrt/io.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _sopen(char *path,int access,int shflag,int mode)
|
||||
{
|
||||
return _open((path), (access)|(shflag), (mode));
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <msvcrt/errno.h>
|
||||
#include <msvcrt/io.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
off_t _tell(int _file)
|
||||
{
|
||||
return _lseek(_file, 0, SEEK_CUR);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <msvcrt/sys/stat.h>
|
||||
|
||||
unsigned _unMode_dll = 022;
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned _umask (unsigned unMode)
|
||||
{
|
||||
unsigned old_mask = _unMode_dll;
|
||||
_unMode_dll = unMode;
|
||||
return old_mask;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/io.h>
|
||||
#include <msvcrt/errno.h>
|
||||
#include <msvcrt/sys/utime.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _utime(const char* filename, struct _utimbuf* buf)
|
||||
{
|
||||
int fn;
|
||||
int ret;
|
||||
|
||||
fn = _open(filename, _O_RDWR);
|
||||
if ( fn == -1 ) {
|
||||
__set_errno(EBADF);
|
||||
return -1;
|
||||
}
|
||||
ret = _futime(fn,buf);
|
||||
if ( _close(fn) < 0 )
|
||||
return -1;
|
||||
return ret;
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/* Math functions for i387.
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by John C. Bowman <[email protected]>, 1995.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
|
||||
double acos(double __x)
|
||||
{
|
||||
return atan2(sqrt(1.0 - __x * __x), __x);
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/* Math functions for i387.
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by John C. Bowman <[email protected]>, 1995.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
|
||||
double asin(double __x)
|
||||
{
|
||||
return atan2(__x, sqrt(1.0 - __x * __x));
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/* Math functions for i387.
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by John C. Bowman <[email protected]>, 1995.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
double atan (double __x);
|
||||
|
||||
double atan (double __x)
|
||||
{
|
||||
register double __value;
|
||||
#ifdef __GNUC__
|
||||
__asm __volatile__
|
||||
("fld1\n\t"
|
||||
"fpatan"
|
||||
: "=t" (__value) : "0" (__x));
|
||||
#else
|
||||
__value = linkme_atan(__x);
|
||||
#endif /*__GNUC__*/
|
||||
return __value;
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
double atan2 (double __y, double __x);
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double atan2 (double __y, double __x)
|
||||
{
|
||||
register double __value;
|
||||
#ifdef __GNUC__
|
||||
__asm __volatile__
|
||||
("fpatan\n\t"
|
||||
"fld %%st(0)"
|
||||
: "=t" (__value) : "0" (__x), "u" (__y));
|
||||
#else
|
||||
__value = linkme_atan2(__x, __y);
|
||||
#endif /*__GNUC__*/
|
||||
return __value;
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double _cabs( struct _complex z )
|
||||
{
|
||||
return sqrt( z.x*z.x + z.y*z.y );
|
||||
// return hypot(z.x,z.y);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
double cos (double __x);
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double cos (double __x)
|
||||
{
|
||||
register double __value;
|
||||
#ifdef __GNUC__
|
||||
__asm __volatile__
|
||||
("fcos"
|
||||
: "=t" (__value): "0" (__x));
|
||||
#else
|
||||
__value = linkme_cos(__x);
|
||||
#endif /*__GNUC__*/
|
||||
return __value;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double cosh(double x)
|
||||
{
|
||||
const double ebig = exp(fabs(x));
|
||||
return (ebig + 1.0/ebig) / 2.0;
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/* Math functions for i387.
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by John C. Bowman <[email protected]>, 1995.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
double exp (double __x);
|
||||
|
||||
double exp (double __x)
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
register double __value, __exponent;
|
||||
__asm __volatile__
|
||||
("fldl2e # e^x = 2^(x * log2(e))\n\t"
|
||||
"fmul %%st(1) # x * log2(e)\n\t"
|
||||
"fst %%st(1)\n\t"
|
||||
"frndint # int(x * log2(e))\n\t"
|
||||
"fxch\n\t"
|
||||
"fsub %%st(1) # fract(x * log2(e))\n\t"
|
||||
"f2xm1 # 2^(fract(x * log2(e))) - 1\n\t"
|
||||
: "=t" (__value), "=u" (__exponent) : "0" (__x));
|
||||
__value += 1.0;
|
||||
__asm __volatile__
|
||||
("fscale"
|
||||
: "=t" (__value) : "0" (__value), "u" (__exponent));
|
||||
|
||||
return __value;
|
||||
#else
|
||||
return linkme_exp(__x);
|
||||
#endif /*__GNUC__*/
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/* Math functions for i387.
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by John C. Bowman <[email protected]>, 1995.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
double fabs (double __x);
|
||||
|
||||
double fabs (double __x)
|
||||
{
|
||||
register double __value;
|
||||
#ifdef __GNUC__
|
||||
__asm __volatile__
|
||||
("fabs"
|
||||
: "=t" (__value) : "0" (__x));
|
||||
#else
|
||||
__value = linkme_fabs(__x);
|
||||
#endif /*__GNUC__*/
|
||||
return __value;
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/* Math functions for i387.
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by John C. Bowman <[email protected]>, 1995.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
double fmod (double __x, double __y);
|
||||
|
||||
double fmod (double __x, double __y)
|
||||
{
|
||||
register double __value;
|
||||
#ifdef __GNUC__
|
||||
__asm __volatile__
|
||||
("1: fprem\n\t"
|
||||
"fstsw %%ax\n\t"
|
||||
"sahf\n\t"
|
||||
"jp 1b"
|
||||
: "=t" (__value) : "0" (__x), "u" (__y) : "ax", "cc");
|
||||
#else
|
||||
__value = linkme_fmod(__x, __y);
|
||||
#endif /*__GNUC__*/
|
||||
return __value;
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||
/*
|
||||
* hypot() function for DJGPP.
|
||||
*
|
||||
* hypot() computes sqrt(x^2 + y^2). The problem with the obvious
|
||||
* naive implementation is that it might fail for very large or
|
||||
* very small arguments. For instance, for large x or y the result
|
||||
* might overflow even if the value of the function should not,
|
||||
* because squaring a large number might trigger an overflow. For
|
||||
* very small numbers, their square might underflow and will be
|
||||
* silently replaced by zero; this won't cause an exception, but might
|
||||
* have an adverse effect on the accuracy of the result.
|
||||
*
|
||||
* This implementation tries to avoid the above pitfals, without
|
||||
* inflicting too much of a performance hit.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <msvcrt/float.h>
|
||||
#include <msvcrt/math.h>
|
||||
#include <msvcrt/errno.h>
|
||||
|
||||
/* Approximate square roots of DBL_MAX and DBL_MIN. Numbers
|
||||
between these two shouldn't neither overflow nor underflow
|
||||
when squared. */
|
||||
#define __SQRT_DBL_MAX 1.3e+154
|
||||
#define __SQRT_DBL_MIN 2.3e-162
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double
|
||||
_hypot(double x, double y)
|
||||
{
|
||||
double abig = fabs(x), asmall = fabs(y);
|
||||
double ratio;
|
||||
|
||||
/* Make abig = max(|x|, |y|), asmall = min(|x|, |y|). */
|
||||
if (abig < asmall)
|
||||
{
|
||||
double temp = abig;
|
||||
|
||||
abig = asmall;
|
||||
asmall = temp;
|
||||
}
|
||||
|
||||
/* Trivial case. */
|
||||
if (asmall == 0.)
|
||||
return abig;
|
||||
|
||||
/* Scale the numbers as much as possible by using its ratio.
|
||||
For example, if both ABIG and ASMALL are VERY small, then
|
||||
X^2 + Y^2 might be VERY inaccurate due to loss of
|
||||
significant digits. Dividing ASMALL by ABIG scales them
|
||||
to a certain degree, so that accuracy is better. */
|
||||
|
||||
if ((ratio = asmall / abig) > __SQRT_DBL_MIN && abig < __SQRT_DBL_MAX)
|
||||
return abig * sqrt(1.0 + ratio*ratio);
|
||||
else
|
||||
{
|
||||
/* Slower but safer algorithm due to Moler and Morrison. Never
|
||||
produces any intermediate result greater than roughly the
|
||||
larger of X and Y. Should converge to machine-precision
|
||||
accuracy in 3 iterations. */
|
||||
|
||||
double r = ratio*ratio, t, s, p = abig, q = asmall;
|
||||
|
||||
do {
|
||||
t = 4. + r;
|
||||
if (t == 4.)
|
||||
break;
|
||||
s = r / t;
|
||||
p += 2. * s * p;
|
||||
q *= s;
|
||||
r = (q / p) * (q / p);
|
||||
} while (1);
|
||||
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef TEST
|
||||
|
||||
#include <msvcrt/stdio.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
printf("hypot(3, 4) =\t\t\t %25.17e\n", _hypot(3., 4.));
|
||||
printf("hypot(3*10^150, 4*10^150) =\t %25.17g\n", _hypot(3.e+150, 4.e+150));
|
||||
printf("hypot(3*10^306, 4*10^306) =\t %25.17g\n", _hypot(3.e+306, 4.e+306));
|
||||
printf("hypot(3*10^-320, 4*10^-320) =\t %25.17g\n",_hypot(3.e-320, 4.e-320));
|
||||
printf("hypot(0.7*DBL_MAX, 0.7*DBL_MAX) =%25.17g\n",_hypot(0.7*DBL_MAX, 0.7*DBL_MAX));
|
||||
printf("hypot(DBL_MAX, 1.0) =\t\t %25.17g\n", _hypot(DBL_MAX, 1.0));
|
||||
printf("hypot(1.0, DBL_MAX) =\t\t %25.17g\n", _hypot(1.0, DBL_MAX));
|
||||
printf("hypot(0.0, DBL_MAX) =\t\t %25.17g\n", _hypot(0.0, DBL_MAX));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,18 +0,0 @@
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
double _j0(double x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
double _y0(double x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
double _j1(double x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
double _y1(double x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
double _jn(int n, double x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
double _yn(int n, double x)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/* Math functions for i387.
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by John C. Bowman <[email protected]>, 1995.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
double ldexp (double __x, int __y);
|
||||
|
||||
double ldexp (double __x, int __y)
|
||||
{
|
||||
register double __value;
|
||||
#ifdef __GNUC__
|
||||
__asm __volatile__
|
||||
("fscale"
|
||||
: "=t" (__value) : "0" (__x), "u" ((double) __y));
|
||||
#else
|
||||
__value = linkme_ldexp(__x, __y);
|
||||
#endif /*__GNUC__*/
|
||||
return __value;
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/* Math functions for i387.
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by John C. Bowman <[email protected]>, 1995.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
double log (double __x);
|
||||
|
||||
double log (double __x)
|
||||
{
|
||||
register double __value;
|
||||
#ifdef __GNUC__
|
||||
__asm __volatile__
|
||||
("fldln2\n\t"
|
||||
"fxch\n\t"
|
||||
"fyl2x"
|
||||
: "=t" (__value) : "0" (__x));
|
||||
#else
|
||||
__value = linkme_log(__x);
|
||||
#endif /*__GNUC__*/
|
||||
return __value;
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/* Math functions for i387.
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by John C. Bowman <[email protected]>, 1995.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
double log10 (double __x);
|
||||
|
||||
double log10 (double __x)
|
||||
{
|
||||
register double __value;
|
||||
#ifdef __GNUC__
|
||||
__asm __volatile__
|
||||
("fldlg2\n\t"
|
||||
"fxch\n\t"
|
||||
"fyl2x"
|
||||
: "=t" (__value) : "0" (__x));
|
||||
#else
|
||||
__value = linkme_log10(__x);
|
||||
#endif /*__GNUC__*/
|
||||
return __value;
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
/* Math functions for i387.
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by John C. Bowman <[email protected]>, 1995.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
double pow (double __x, double __y);
|
||||
|
||||
double __log2 (double __x);
|
||||
|
||||
double __log2 (double __x)
|
||||
{
|
||||
register double __value;
|
||||
#ifdef __GNUC__
|
||||
__asm __volatile__
|
||||
("fld1\n\t"
|
||||
"fxch\n\t"
|
||||
"fyl2x"
|
||||
: "=t" (__value) : "0" (__x));
|
||||
#else
|
||||
//__value = linkme_log2(__x);
|
||||
__value = 0;
|
||||
#endif /*__GNUC__*/
|
||||
return __value;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double pow (double __x, double __y)
|
||||
{
|
||||
register double __value;
|
||||
#ifdef __GNUC__
|
||||
register double __exponent;
|
||||
long __p = (long) __y;
|
||||
|
||||
if (__x == 0.0 && __y > 0.0)
|
||||
return 0.0;
|
||||
if (__y == (double) __p)
|
||||
{
|
||||
double __r = 1.0;
|
||||
if (__p == 0)
|
||||
return 1.0;
|
||||
if (__p < 0)
|
||||
{
|
||||
__p = -__p;
|
||||
__x = 1.0 / __x;
|
||||
}
|
||||
while (1)
|
||||
{
|
||||
if (__p & 1)
|
||||
__r *= __x;
|
||||
__p >>= 1;
|
||||
if (__p == 0)
|
||||
return __r;
|
||||
__x *= __x;
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
||||
__asm __volatile__
|
||||
("fmul %%st(1) # y * log2(x)\n\t"
|
||||
"fst %%st(1)\n\t"
|
||||
"frndint # int(y * log2(x))\n\t"
|
||||
"fxch\n\t"
|
||||
"fsub %%st(1) # fract(y * log2(x))\n\t"
|
||||
"f2xm1 # 2^(fract(y * log2(x))) - 1\n\t"
|
||||
: "=t" (__value), "=u" (__exponent) : "0" (__log2 (__x)), "1" (__y));
|
||||
__value += 1.0;
|
||||
__asm __volatile__
|
||||
("fscale"
|
||||
: "=t" (__value) : "0" (__value), "u" (__exponent));
|
||||
#else
|
||||
__value = linkme_pow(__x, __y);
|
||||
#endif /*__GNUC__*/
|
||||
return __value;
|
||||
}
|
||||
|
||||
long double powl (long double __x,long double __y)
|
||||
{
|
||||
return pow(__x,__y/2)*pow(__x,__y/2);
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/* Math functions for i387.
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by John C. Bowman <[email protected]>, 1995.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
double sin (double __x);
|
||||
|
||||
double sin (double __x)
|
||||
{
|
||||
register double __value;
|
||||
#ifdef __GNUC__
|
||||
__asm __volatile__
|
||||
("fsin"
|
||||
: "=t" (__value) : "0" (__x));
|
||||
#else
|
||||
__value = linkme_sin(__x);
|
||||
#endif /*__GNUC__*/
|
||||
return __value;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double sinh(double x)
|
||||
{
|
||||
if(x >= 0.0)
|
||||
{
|
||||
const double epos = exp(x);
|
||||
return (epos - 1.0/epos) / 2.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
const double eneg = exp(-x);
|
||||
return (1.0/eneg - eneg) / 2.0;
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/* Math functions for i387.
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by John C. Bowman <[email protected]>, 1995.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
double sqrt (double __x);
|
||||
|
||||
double sqrt (double __x)
|
||||
{
|
||||
register double __value;
|
||||
#ifdef __GNUC__
|
||||
__asm __volatile__
|
||||
("fsqrt"
|
||||
: "=t" (__value) : "0" (__x));
|
||||
#else
|
||||
__value = linkme_sqrt(__x);
|
||||
#endif /*__GNUC__*/
|
||||
return __value;
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
|
||||
double _CIsin(double x);
|
||||
double _CIcos(double x);
|
||||
double _CItan(double x);
|
||||
double _CIsinh(double x);
|
||||
double _CIcosh(double x);
|
||||
double _CItanh(double x);
|
||||
double _CIasin(double x);
|
||||
double _CIacos(double x);
|
||||
double _CIatan(double x);
|
||||
double _CIatan2(double y, double x);
|
||||
double _CIexp(double x);
|
||||
double _CIlog(double x);
|
||||
double _CIlog10(double x);
|
||||
double _CIpow(double x, double y);
|
||||
double _CIsqrt(double x);
|
||||
double _CIfmod(double x, double y);
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double _CIsin(double x)
|
||||
{
|
||||
return sin(x);
|
||||
}
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double _CIcos(double x)
|
||||
{
|
||||
return cos(x);
|
||||
}
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double _CItan(double x)
|
||||
{
|
||||
return tan(x);
|
||||
}
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double _CIsinh(double x)
|
||||
{
|
||||
return sinh(x);
|
||||
}
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double _CIcosh(double x)
|
||||
{
|
||||
return cosh(x);
|
||||
}
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double _CItanh(double x)
|
||||
{
|
||||
return tanh(x);
|
||||
}
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double _CIasin(double x)
|
||||
{
|
||||
return asin(x);
|
||||
}
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double _CIacos(double x)
|
||||
{
|
||||
return acos(x);
|
||||
}
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double _CIatan(double x)
|
||||
{
|
||||
return atan(x);
|
||||
}
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double _CIatan2(double y, double x)
|
||||
{
|
||||
return atan2(y, x);
|
||||
}
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double _CIexp(double x)
|
||||
{
|
||||
return exp(x);
|
||||
}
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double _CIlog(double x)
|
||||
{
|
||||
return log(x);
|
||||
}
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double _CIlog10(double x)
|
||||
{
|
||||
return log10(x);
|
||||
}
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double _CIpow(double x, double y)
|
||||
{
|
||||
return pow(x, y);
|
||||
}
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double _CIsqrt(double x)
|
||||
{
|
||||
return sqrt(x);
|
||||
}
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double _CIfmod(double x, double y)
|
||||
{
|
||||
return fmod(x, y);
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/* Math functions for i387.
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by John C. Bowman <[email protected]>, 1995.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
double tan (double __x);
|
||||
|
||||
double tan (double __x)
|
||||
{
|
||||
register double __value;
|
||||
#ifdef __GNUC__
|
||||
register double __value2 __attribute__ ((unused));
|
||||
__asm __volatile__
|
||||
("fptan"
|
||||
: "=t" (__value2), "=u" (__value) : "0" (__x));
|
||||
#else
|
||||
__value = linkme_tan(__x);
|
||||
#endif /*__GNUC__*/
|
||||
return __value;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
double tanh(double x)
|
||||
{
|
||||
if (x > 50)
|
||||
return 1;
|
||||
else if (x < -50)
|
||||
return -1;
|
||||
else
|
||||
{
|
||||
const double ebig = exp(x);
|
||||
const double esmall = 1.0/ebig;
|
||||
return (ebig - esmall) / (ebig + esmall);
|
||||
}
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/mbstring/hanzen.c
|
||||
* PURPOSE: Multibyte conversion routines formerly called hantozen and zentohan
|
||||
* PROGRAMER: Boudewijn Dekker, Taiji Yamada
|
||||
* UPDATE HISTORY:
|
||||
Modified from Taiji Yamada japanese code system utilities
|
||||
* 12/04/99: Created
|
||||
*/
|
||||
|
||||
#include <msvcrt/mbctype.h>
|
||||
|
||||
static unsigned short han_to_zen_ascii_table[0x5f] = {
|
||||
0x8140, 0x8149, 0x8168, 0x8194, 0x8190, 0x8193, 0x8195, 0x8166,
|
||||
0x8169, 0x816a, 0x8196, 0x817b, 0x8143, 0x817c, 0x8144, 0x815e,
|
||||
0x824f, 0x8250, 0x8251, 0x8252, 0x8253, 0x8254, 0x8255, 0x8256,
|
||||
0x8257, 0x8258, 0x8146, 0x8147, 0x8183, 0x8181, 0x8184, 0x8148,
|
||||
0x8197, 0x8260, 0x8261, 0x8262, 0x8263, 0x8264, 0x8265, 0x8266,
|
||||
0x8267, 0x8268, 0x8269, 0x826a, 0x826b, 0x826c, 0x826d, 0x826e,
|
||||
0x826f, 0x8270, 0x8271, 0x8272, 0x8273, 0x8274, 0x8275, 0x8276,
|
||||
0x8277, 0x8278, 0x8279, 0x816d, 0x818f, 0x816e, 0x814f, 0x8151,
|
||||
0x8165, 0x8281, 0x8282, 0x8283, 0x8284, 0x8285, 0x8286, 0x8287,
|
||||
0x8288, 0x8289, 0x828a, 0x828b, 0x828c, 0x828d, 0x828e, 0x828f,
|
||||
0x8290, 0x8291, 0x8292, 0x8293, 0x8294, 0x8295, 0x8296, 0x8297,
|
||||
0x8298, 0x8299, 0x829a, 0x816f, 0x8162, 0x8170, 0x8150
|
||||
};
|
||||
static unsigned short han_to_zen_kana_table[0x40] = {
|
||||
0x8140, 0x8142, 0x8175, 0x8176, 0x8141, 0x8145, 0x8392, 0x8340,
|
||||
0x8342, 0x8344, 0x8346, 0x8348, 0x8383, 0x8385, 0x8387, 0x8362,
|
||||
0x815b, 0x8341, 0x8343, 0x8345, 0x8347, 0x8349, 0x834a, 0x834c,
|
||||
0x834e, 0x8350, 0x8352, 0x8354, 0x8356, 0x8358, 0x835a, 0x835c,
|
||||
0x835e, 0x8360, 0x8363, 0x8365, 0x8367, 0x8369, 0x836a, 0x836b,
|
||||
0x836c, 0x836d, 0x836e, 0x8371, 0x8374, 0x8377, 0x837a, 0x837d,
|
||||
0x837e, 0x8380, 0x8381, 0x8382, 0x8384, 0x8386, 0x8388, 0x8389,
|
||||
0x838a, 0x838b, 0x838c, 0x838d, 0x838f, 0x8393, 0x814a, 0x814b
|
||||
};
|
||||
static unsigned char zen_to_han_kana_table[0x8396-0x8340+1] = {
|
||||
0xa7, 0xb1, 0xa8, 0xb2, 0xa9, 0xb3, 0xaa, 0xb4,
|
||||
0xab, 0xb5, 0xb6, 0xb6, 0xb7, 0xb7, 0xb8, 0xb8,
|
||||
0xb9, 0xb9, 0xba, 0xba, 0xbb, 0xbb, 0xbc, 0xbc,
|
||||
0xbd, 0xbd, 0xbe, 0xbe, 0xbf, 0xbf, 0xc0, 0xc0,
|
||||
0xc1, 0xc1, 0xaf, 0xc2, 0xc2, 0xc3, 0xc3, 0xc4,
|
||||
0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xca,
|
||||
0xca, 0xcb, 0xcb, 0xcb, 0xcc, 0xcc, 0xcc, 0xcd,
|
||||
0xcd, 0xcd, 0xce, 0xce, 0xce, 0xcf, 0xd0, 0,
|
||||
0xd1, 0xd2, 0xd3, 0xac, 0xd4, 0xad, 0xd5, 0xae,
|
||||
0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdc,
|
||||
0xb2, 0xb4, 0xa6, 0xdd, 0xb3, 0xb6, 0xb9
|
||||
};
|
||||
#define ZTOH_SYMBOLS 9
|
||||
static unsigned short zen_to_han_symbol_table_1[ZTOH_SYMBOLS] = {
|
||||
0x8142, 0x8175, 0x8176, 0x8141, 0x8145, 0x815b, 0x814a, 0x814b
|
||||
};
|
||||
static unsigned char zen_to_han_symbol_table_2[ZTOH_SYMBOLS] = {
|
||||
0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xb0, 0xde, 0xdf
|
||||
};
|
||||
#define ISKANA(c) ((c) >= 0xa1 && (c) <= 0xdf)
|
||||
#define JISHIRA(c) ((c) >= 0x829f && (c) <= 0x82f1)
|
||||
#define JISKANA(c) ((c) >= 0x8340 && (c) <= 0x8396 && (c) != 0x837f)
|
||||
#define JTOKANA(c) ((c) <= 0x82dd ? (c) + 0xa1 : (c) + 0xa2)
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned short _mbbtombc(unsigned short c)
|
||||
{
|
||||
if (c >= 0x20 && c <= 0x7e) {
|
||||
return han_to_zen_ascii_table[c - 0x20];
|
||||
} else if (ISKANA(c)) {
|
||||
return han_to_zen_kana_table[c - 0xa0];
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned short _mbctombb(unsigned short c)
|
||||
{
|
||||
int i;
|
||||
unsigned short *p;
|
||||
|
||||
if (JISKANA(c)) {
|
||||
return zen_to_han_kana_table[c - 0x8340];
|
||||
} else if (JISHIRA(c)) {
|
||||
c = JTOKANA(c);
|
||||
return zen_to_han_kana_table[c - 0x8340];
|
||||
} else if (c <= 0x8396) {
|
||||
for (i = 0x20, p = han_to_zen_ascii_table; i <= 0x7e; i++, p++) {
|
||||
if (*p == c) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < ZTOH_SYMBOLS; i++) {
|
||||
if (zen_to_han_symbol_table_1[i] == c) {
|
||||
return zen_to_han_symbol_table_2[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/mbstring/ischira.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER: Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* 12/04/99: Created
|
||||
*/
|
||||
|
||||
#include <msvcrt/mbstring.h>
|
||||
#include <msvcrt/mbctype.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbchira(unsigned int c)
|
||||
{
|
||||
return ((c>=0x829F) && (c<=0x82F1));
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbckata(unsigned int c)
|
||||
{
|
||||
return ((c>=0x8340) && (c<=0x8396));
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned int _mbctohira(unsigned int c)
|
||||
{
|
||||
return c;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned int _mbctokata(unsigned int c)
|
||||
{
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/mbstring/hanzen.c
|
||||
* PURPOSE: Checks for kana character
|
||||
* PROGRAMER: Boudewijn Dekker, Taiji Yamada
|
||||
* UPDATE HISTORY:
|
||||
Modified from Taiji Yamada japanese code system utilities
|
||||
* 12/04/99: Created
|
||||
*/
|
||||
#include <msvcrt/mbstring.h>
|
||||
#include <msvcrt/mbctype.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbbkana(unsigned char c)
|
||||
{
|
||||
return ((_jctype+1)[(unsigned char)(c)] & (_KNJ_M|_KNJ_P));
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
#include <msvcrt/mbctype.h>
|
||||
|
||||
int _ismbbkalpha(unsigned char c)
|
||||
{
|
||||
return (0xA7 <= c && c <= 0xDF);
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/mbstring/iskpun.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER: Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* 12/04/99: Created
|
||||
*/
|
||||
#include <msvcrt/mbctype.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbbkpunct( unsigned int c )
|
||||
{
|
||||
return ((_jctype+1)[(unsigned char)(c)] & (_KNJ_P));
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/mbstring/mbsncmp.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER: Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* 12/04/99: Created
|
||||
*/
|
||||
|
||||
#include <msvcrt/mbctype.h>
|
||||
#include <msvcrt/ctype.h>
|
||||
|
||||
/*
|
||||
* code page 952 only
|
||||
*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbclower( unsigned int c )
|
||||
{
|
||||
if ((c & 0xFF00) != 0) {
|
||||
if ( c >= 0x829A && c<= 0x829A )
|
||||
return 1;
|
||||
}
|
||||
|
||||
return islower(c);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/mbstring/hanzen.c
|
||||
* PURPOSE: Checks for alphabetic multibyte character
|
||||
* PROGRAMER: Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* 12/04/99: Created
|
||||
*/
|
||||
#include <msvcrt/mbctype.h>
|
||||
#include <msvcrt/ctype.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbbalpha(unsigned char c)
|
||||
{
|
||||
return (isalpha(c) ||_ismbbkalnum(c));
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#include <msvcrt/mbctype.h>
|
||||
#include <msvcrt/ctype.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbbalnum(unsigned char c)
|
||||
{
|
||||
return (isalnum(c) || _ismbbkalnum(c));
|
||||
}
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
#include <msvcrt/mbstring.h>
|
||||
|
||||
int _ismbbalpha(unsigned char c);
|
||||
int _ismbbalnum(unsigned char c);
|
||||
|
||||
int _ismbcalnum( unsigned int c )
|
||||
{
|
||||
if ((c & 0xFF00) != 0) {
|
||||
// true multibyte character
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return _ismbbalnum(c);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbcalpha( unsigned int c )
|
||||
{
|
||||
if ((c & 0xFF00) != 0) {
|
||||
// true multibyte character
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return _ismbbalpha(c);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbcdigit( unsigned int c )
|
||||
{
|
||||
if ((c & 0xFF00) != 0) {
|
||||
// true multibyte character
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
// return _ismbbdigit(c);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbcprint( unsigned int c )
|
||||
{
|
||||
if ((c & 0xFF00) != 0) {
|
||||
// true multibyte character
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
// return _ismbbdigit(c);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbcsymbol( unsigned int c )
|
||||
{
|
||||
if ((c & 0xFF00) != 0) {
|
||||
// true multibyte character
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
// return _ismbbdigit(c);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbcspace( unsigned int c )
|
||||
{
|
||||
if ((c & 0xFF00) != 0) {
|
||||
// true multibyte character
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
// return _ismbbdigit(c);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbclegal(unsigned int c)
|
||||
{
|
||||
if ((c & 0xFF00) != 0) {
|
||||
return _ismbblead(c>>8) && _ismbbtrail(c&0xFF);
|
||||
}
|
||||
else
|
||||
return _ismbbtrail(c&0xFF);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
int _ismbcl0(unsigned int c)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
int _ismbcl1(unsigned int c)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
int _ismbcl2(unsigned int c)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#include <msvcrt/mbstring.h>
|
||||
#include <msvcrt/mbctype.h>
|
||||
#include <msvcrt/ctype.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbbgraph(unsigned char c)
|
||||
{
|
||||
return (isgraph(c) || _ismbbkana(c));
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/mbstring/iskpun.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER: Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* 12/04/99: Created
|
||||
*/
|
||||
#include <msvcrt/mbctype.h>
|
||||
#include <msvcrt/ctype.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbbkalnum( unsigned int c )
|
||||
{
|
||||
return ((_jctype+1)[(unsigned char)(c)] & (_KNJ_P));
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/mbstring/ismblead.c
|
||||
* PURPOSE: Checks for a lead byte
|
||||
* PROGRAMER: Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* Modified from Taiji Yamada japanese code system utilities
|
||||
* 12/04/99: Created
|
||||
*/
|
||||
|
||||
#include <msvcrt/mbstring.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
#include <msvcrt/mbctype.h>
|
||||
|
||||
size_t _mbclen2(const unsigned int s);
|
||||
|
||||
char _jctype[257] = {
|
||||
/*-1*/ ___,
|
||||
/*0x*/ ___,___,___,___,___,___,___,___,___,___,___,___,___,___,___,___,
|
||||
/*1x*/ ___,___,___,___,___,___,___,___,___,___,___,___,___,___,___,___,
|
||||
/*2x*/ ___,___,___,___,___,___,___,___,___,___,___,___,___,___,___,___,
|
||||
/*3x*/ ___,___,___,___,___,___,___,___,___,___,___,___,___,___,___,___,
|
||||
/*4x*/ __2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,
|
||||
/*5x*/ __2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,
|
||||
/*6x*/ __2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,
|
||||
/*7x*/ __2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,__2,___,
|
||||
/*8x*/ __2,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,
|
||||
/*9x*/ _12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,
|
||||
/*Ax*/ __2,_P2,_P2,_P2,_P2,_P2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,
|
||||
/*Bx*/ _M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,
|
||||
/*Cx*/ _M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,
|
||||
/*Dx*/ _M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,_M2,
|
||||
/*Ex*/ _12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,
|
||||
/*Fx*/ _12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,_12,___,___,___
|
||||
};
|
||||
|
||||
char *_mbctype = _jctype;
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbblead(unsigned int c)
|
||||
{
|
||||
return ((_jctype+1)[(unsigned char)(c)] & _KNJ_1);
|
||||
}
|
||||
//int _ismbblead(unsigned int byte)
|
||||
//{
|
||||
//
|
||||
// return (int)IsDBCSLeadByte(byte)
|
||||
//}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbslead( const unsigned char *str, const unsigned char *t)
|
||||
{
|
||||
unsigned char *s = (unsigned char *)str;
|
||||
while(*s != 0 && s != t)
|
||||
{
|
||||
|
||||
s+= _mbclen2(*s);
|
||||
}
|
||||
return _ismbblead( *s);
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
#include <msvcrt/mbstring.h>
|
||||
#include <msvcrt/mbctype.h>
|
||||
#include <msvcrt/ctype.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbbprint(unsigned char c)
|
||||
{
|
||||
return (isprint(c) || _ismbbkana(c));
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
|
||||
#include <msvcrt/mbstring.h>
|
||||
#include <msvcrt/mbctype.h>
|
||||
#include <msvcrt/ctype.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbbpunct(unsigned char c)
|
||||
{
|
||||
// (0xA1 <= c <= 0xA6)
|
||||
return (ispunct(c) || _ismbbkana(c));
|
||||
}
|
||||
|
||||
//iskana() :(0xA1 <= c <= 0xDF)
|
||||
//iskpun() :(0xA1 <= c <= 0xA6)
|
||||
//iskmoji() :(0xA7 <= c <= 0xDF)
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/mbstring/ismbtrail.c
|
||||
* PURPOSE: Checks for a trailing byte
|
||||
* PROGRAMER: Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* 12/04/99: Created
|
||||
*/
|
||||
|
||||
#include <msvcrt/mbstring.h>
|
||||
#include <msvcrt/mbctype.h>
|
||||
|
||||
size_t _mbclen2(const unsigned int s);
|
||||
|
||||
// iskanji2() : (0x40 <= c <= 0x7E 0x80 <= c <= 0xFC)
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbbtrail(unsigned int c)
|
||||
{
|
||||
return ((_jctype+1)[(unsigned char)(c)] & _KNJ_2);
|
||||
}
|
||||
|
||||
//int _ismbbtrail( unsigned int b)
|
||||
//{
|
||||
// return ((b >= 0x40 && b <= 0x7e ) || (b >= 0x80 && b <= 0xfc ) );
|
||||
//}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbstrail( const unsigned char *str, const unsigned char *t)
|
||||
{
|
||||
unsigned char *s = (unsigned char *)str;
|
||||
while(*s != 0 && s != t)
|
||||
{
|
||||
|
||||
s+= _mbclen2(*s);
|
||||
}
|
||||
|
||||
return _ismbbtrail(*s);
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/mbstring/mbsncmp.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER: Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* 12/04/99: Created
|
||||
*/
|
||||
|
||||
#include <msvcrt/mbctype.h>
|
||||
#include <msvcrt/ctype.h>
|
||||
|
||||
/*
|
||||
* code page 952 only
|
||||
*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbcupper( unsigned int c )
|
||||
{
|
||||
if ((c & 0xFF00) != 0) {
|
||||
if ( c >= 0x8260 && c<= 0x8279 )
|
||||
return 1;
|
||||
}
|
||||
|
||||
return isupper(c);
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
#include <msvcrt/mbstring.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned short _mbcjistojms(unsigned short c)
|
||||
{
|
||||
int c1, c2;
|
||||
|
||||
c2 = (unsigned char)c;
|
||||
c1 = c >> 8;
|
||||
if (c1 >= 0x21 && c1 <= 0x7e && c2 >= 0x21 && c2 <= 0x7e) {
|
||||
if (c1 & 0x01) {
|
||||
c2 += 0x1f;
|
||||
if (c2 >= 0x7f)
|
||||
c2 ++;
|
||||
} else {
|
||||
c2 += 0x7e;
|
||||
}
|
||||
c1 += 0xe1;
|
||||
c1 >>= 1;
|
||||
if (c1 >= 0xa0)
|
||||
c1 += 0x40;
|
||||
return ((c1 << 8) | c2);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
#include <msvcrt/mbstring.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned short _mbcjmstojis(unsigned short c)
|
||||
{
|
||||
int c1, c2;
|
||||
|
||||
c2 = (unsigned char)c;
|
||||
c1 = c >> 8;
|
||||
if (c1 < 0xf0 && _ismbblead(c1) && _ismbbtrail(c2)) {
|
||||
if (c1 >= 0xe0)
|
||||
c1 -= 0x40;
|
||||
c1 -= 0x70;
|
||||
c1 <<= 1;
|
||||
if (c2 < 0x9f) {
|
||||
c1 --;
|
||||
c2 -= 0x1f;
|
||||
if (c2 >= (0x80-0x1f))
|
||||
c2 --;
|
||||
} else {
|
||||
c2 -= 0x7e;
|
||||
}
|
||||
return ((c1 << 8) | c2);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/mbstring/mbbtype.c
|
||||
* PURPOSE: Determines the type of a multibyte character
|
||||
* PROGRAMER: Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* 12/04/99: Created
|
||||
*/
|
||||
|
||||
#include <msvcrt/mbstring.h>
|
||||
#include <msvcrt/mbctype.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _mbbtype(unsigned char c , int type)
|
||||
{
|
||||
if ( type == 1 ) {
|
||||
if ((c >= 0x40 && c <= 0x7e ) || (c >= 0x80 && c <= 0xfc ) )
|
||||
{
|
||||
return _MBC_TRAIL;
|
||||
}
|
||||
else if (( c >= 0x20 && c >= 0x7E ) || ( c >= 0xA1 && c <= 0xDF ) ||
|
||||
( c >= 0x81 && c <= 0x9F ) || ( c >= 0xE0 && c <= 0xFC ) )
|
||||
return _MBC_ILLEGAL;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
else {
|
||||
if (( c >= 0x20 && c <= 0x7E ) || ( c >= 0xA1 && c <= 0xDF )) {
|
||||
return _MBC_SINGLE;
|
||||
}
|
||||
else if ( (c >= 0x81 && c <= 0x9F ) || ( c >= 0xE0 && c <= 0xFC) )
|
||||
return _MBC_LEAD;
|
||||
else if (( c >= 0x20 && c >= 0x7E ) || ( c >= 0xA1 && c <= 0xDF ) ||
|
||||
( c >= 0x81 && c <= 0x9F ) || ( c >= 0xE0 && c <= 0xFC ) )
|
||||
return _MBC_ILLEGAL;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _mbsbtype( const unsigned char *str, size_t n )
|
||||
{
|
||||
if ( str == NULL )
|
||||
return -1;
|
||||
return _mbbtype(*(str+n),1);
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
#include <msvcrt/mbstring.h>
|
||||
#include <msvcrt/string.h>
|
||||
|
||||
size_t _mbclen2(const unsigned int s);
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
void _mbccpy(unsigned char *dst, const unsigned char *src)
|
||||
{
|
||||
if (!_ismbblead(*src) )
|
||||
return;
|
||||
|
||||
memcpy(dst,src,_mbclen2(*src));
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/mbstring/mbscoll.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER: Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* 12/04/99: Created
|
||||
*/
|
||||
|
||||
#include <msvcrt/mbstring.h>
|
||||
|
||||
int colldif(unsigned short c1, unsigned short c2);
|
||||
|
||||
int _mbscoll(const unsigned char *str1, const unsigned char *str2)
|
||||
{
|
||||
unsigned char *s1 = (unsigned char *)str1;
|
||||
unsigned char *s2 = (unsigned char *)str2;
|
||||
|
||||
unsigned short *short_s1, *short_s2;
|
||||
|
||||
int l1, l2;
|
||||
|
||||
while ( *s1 != 0 ) {
|
||||
|
||||
if (*s1 == 0)
|
||||
break;
|
||||
|
||||
l1 = _ismbblead(*s1);
|
||||
l2 = _ismbblead(*s2);
|
||||
if ( !l1 && !l2 ) {
|
||||
|
||||
if (*s1 != *s2)
|
||||
return colldif(*s1, *s2);
|
||||
else {
|
||||
s1 += 1;
|
||||
s2 += 1;
|
||||
}
|
||||
}
|
||||
else if ( l1 && l2 ){
|
||||
short_s1 = (unsigned short *)s1;
|
||||
short_s2 = (unsigned short *)s2;
|
||||
if ( *short_s1 != *short_s2 )
|
||||
return colldif(*short_s1, *short_s2);
|
||||
else {
|
||||
s1 += 2;
|
||||
s2 += 2;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
return colldif(*s1, *s2);
|
||||
} ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
int _mbsbcoll(const unsigned char *str1, const unsigned char *str2)
|
||||
{
|
||||
unsigned char *s1 = (unsigned char *)str1;
|
||||
unsigned char *s2 = (unsigned char *)str2;
|
||||
|
||||
unsigned short *short_s1, *short_s2;
|
||||
|
||||
int l1, l2;
|
||||
|
||||
|
||||
while ( *s1 != 0 ) {
|
||||
|
||||
|
||||
l1 = _ismbblead(*s1);
|
||||
l2 = _ismbblead(*s2);
|
||||
if ( !l1 && !l2 ) {
|
||||
|
||||
if (*s1 != *s2)
|
||||
return colldif(*s1, *s2);
|
||||
else {
|
||||
s1 += 1;
|
||||
s2 += 1;
|
||||
}
|
||||
}
|
||||
else if ( l1 && l2 ){
|
||||
short_s1 = (unsigned short *)s1;
|
||||
short_s2 = (unsigned short *)s2;
|
||||
if ( *short_s1 != *short_s2 )
|
||||
return colldif(*short_s1, *short_s2);
|
||||
else {
|
||||
s1 += 2;
|
||||
s2 += 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
return colldif(*s1, *s2);
|
||||
} ;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -1,17 +0,0 @@
|
||||
#include <msvcrt/mbstring.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned char * _mbsdec(const unsigned char *str, const unsigned char *cur)
|
||||
{
|
||||
unsigned char *s = (unsigned char *)cur;
|
||||
if ( str >= cur )
|
||||
return NULL;
|
||||
|
||||
s--;
|
||||
if (_ismbblead(*(s-1)) )
|
||||
s--;
|
||||
|
||||
return s;
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/mbstring/mbsicmp.c
|
||||
* PURPOSE: Duplicates a multi byte string
|
||||
* PROGRAMER: Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* 12/04/99: Created
|
||||
*/
|
||||
#include <msvcrt/mbstring.h>
|
||||
#include <msvcrt/mbctype.h>
|
||||
#include <msvcrt/ctype.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _mbsicmp(const unsigned char *str1, const unsigned char *str2)
|
||||
{
|
||||
unsigned char *s1 = (unsigned char *)str1;
|
||||
unsigned char *s2 = (unsigned char *)str2;
|
||||
|
||||
unsigned short *short_s1, *short_s2;
|
||||
|
||||
int l1, l2;
|
||||
|
||||
do {
|
||||
|
||||
if (*s1 == 0)
|
||||
break;
|
||||
|
||||
l1 = _ismbblead(*s1);
|
||||
l2 = _ismbblead(*s2);
|
||||
if ( !l1 && !l2 ) {
|
||||
|
||||
if (toupper(*s1) != toupper(*s2))
|
||||
return toupper(*s1) - toupper(*s2);
|
||||
else {
|
||||
s1 += 1;
|
||||
s2 += 1;
|
||||
}
|
||||
}
|
||||
else if ( l1 && l2 ){
|
||||
short_s1 = (unsigned short *)s1;
|
||||
short_s2 = (unsigned short *)s2;
|
||||
if ( _mbctoupper(*short_s1) != _mbctoupper(*short_s2 ))
|
||||
return _mbctoupper(*short_s1) - _mbctoupper(*short_s2);
|
||||
else {
|
||||
s1 += 2;
|
||||
s2 += 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
return *s1 - *s2;
|
||||
} while (*s1 != 0);
|
||||
return 0;
|
||||
|
||||
while (toupper(*s1) == toupper(*s2))
|
||||
{
|
||||
if (*s1 == 0)
|
||||
return 0;
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
return toupper(*(unsigned const char *)s1) - toupper(*(unsigned const char *)(s2));
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/mbstring/iskpun.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER: Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* 12/04/99: Created
|
||||
*/
|
||||
#include <msvcrt/mbstring.h>
|
||||
#include <msvcrt/mbctype.h>
|
||||
#include <msvcrt/ctype.h>
|
||||
|
||||
int colldif(unsigned short c1, unsigned short c2);
|
||||
int _mbsicoll(const unsigned char *str1, const unsigned char *str2)
|
||||
{
|
||||
unsigned char *s1 = (unsigned char *)str1;
|
||||
unsigned char *s2 = (unsigned char *)str2;
|
||||
|
||||
unsigned short *short_s1, *short_s2;
|
||||
|
||||
int l1, l2;
|
||||
|
||||
while ( *s1 != 0 ) {
|
||||
|
||||
if (*s1 == 0)
|
||||
break;
|
||||
|
||||
l1 = _ismbblead(*s1);
|
||||
l2 = _ismbblead(*s2);
|
||||
if ( !l1 && !l2 ) {
|
||||
|
||||
if (toupper(*s1) != toupper(*s2))
|
||||
return colldif(*s1, *s2);
|
||||
else {
|
||||
s1 += 1;
|
||||
s2 += 1;
|
||||
}
|
||||
}
|
||||
else if ( l1 && l2 ){
|
||||
short_s1 = (unsigned short *)s1;
|
||||
short_s2 = (unsigned short *)s2;
|
||||
if ( _mbctoupper(*short_s1) != _mbctoupper(*short_s2 ))
|
||||
return colldif(*short_s1, *short_s2);
|
||||
else {
|
||||
s1 += 2;
|
||||
s2 += 2;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
return colldif(*s1, *s2);
|
||||
} ;
|
||||
return 0;
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#include <msvcrt/mbstring.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned char * _mbsinc(const unsigned char *s)
|
||||
{
|
||||
unsigned char *c = (unsigned char *)s;
|
||||
if (_ismbblead(*s) )
|
||||
c++;
|
||||
c++;
|
||||
return c;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
#include <msvcrt/mbstring.h>
|
||||
|
||||
size_t _mbclen2(const unsigned int s);
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
size_t _mbslen(const unsigned char *str)
|
||||
{
|
||||
int i = 0;
|
||||
unsigned char *s;
|
||||
|
||||
if (str == 0)
|
||||
return 0;
|
||||
|
||||
for (s = (unsigned char *)str; *s; s+=_mbclen2(*s),i++);
|
||||
return i;
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
#include <msvcrt/mbstring.h>
|
||||
#include <msvcrt/ctype.h>
|
||||
|
||||
unsigned int _mbbtolower(unsigned int c)
|
||||
{
|
||||
if (!_ismbblead(c) )
|
||||
return tolower(c);
|
||||
return c;
|
||||
}
|
||||
|
||||
// code page 952
|
||||
#define CASE_DIFF (0x8281 - 0x8260)
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned int _mbctolower(unsigned int c)
|
||||
{
|
||||
if ((c & 0xFF00) != 0) {
|
||||
// true multibyte case conversion needed
|
||||
if (_ismbclower(c))
|
||||
return c + CASE_DIFF;
|
||||
} else {
|
||||
return _mbbtolower(c);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned char * _mbslwr(unsigned char *x)
|
||||
{
|
||||
unsigned char *y=x;
|
||||
|
||||
while (*y) {
|
||||
if (!_ismbblead(*y)) {
|
||||
*y = tolower(*y);
|
||||
} else {
|
||||
*y=_mbctolower(*(unsigned short *)y);
|
||||
y++;
|
||||
}
|
||||
}
|
||||
return x;
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
#include <msvcrt/mbstring.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
size_t _mbsnccnt(const unsigned char *str, size_t n)
|
||||
{
|
||||
unsigned char *s = (unsigned char *)str;
|
||||
size_t cnt = 0;
|
||||
while(*s != 0 && n > 0) {
|
||||
if (_ismbblead(*s) )
|
||||
s++;
|
||||
else
|
||||
n--;
|
||||
s++;
|
||||
cnt++;
|
||||
}
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
size_t _mbsnbcnt(const unsigned char *str, size_t n)
|
||||
{
|
||||
unsigned char *s = (unsigned char *)str;
|
||||
while(*s != 0 && n > 0) {
|
||||
if (!_ismbblead(*s) )
|
||||
n--;
|
||||
s++;
|
||||
}
|
||||
|
||||
return (size_t)(s - str);
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/mbstring/mbsncmp.c
|
||||
* PURPOSE: Compares two strings to a maximum of n bytes or characters
|
||||
* PROGRAMER: Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* 12/04/99: Created
|
||||
*/
|
||||
|
||||
#include <msvcrt/mbstring.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _mbsncmp(const unsigned char *str1, const unsigned char *str2, size_t n)
|
||||
{
|
||||
unsigned char *s1 = (unsigned char *)str1;
|
||||
unsigned char *s2 = (unsigned char *)str2;
|
||||
|
||||
unsigned short *short_s1, *short_s2;
|
||||
|
||||
int l1, l2;
|
||||
|
||||
if (n == 0)
|
||||
return 0;
|
||||
do {
|
||||
|
||||
if (*s1 == 0)
|
||||
break;
|
||||
|
||||
l1 = _ismbblead(*s1);
|
||||
l2 = _ismbblead(*s2);
|
||||
if ( !l1 && !l2 ) {
|
||||
|
||||
if (*s1 != *s2)
|
||||
return *s1 - *s2;
|
||||
else {
|
||||
s1 += 1;
|
||||
s2 += 1;
|
||||
n--;
|
||||
}
|
||||
}
|
||||
else if ( l1 && l2 ){
|
||||
short_s1 = (unsigned short *)s1;
|
||||
short_s2 = (unsigned short *)s2;
|
||||
if ( *short_s1 != *short_s2 )
|
||||
return *short_s1 - *short_s2;
|
||||
else {
|
||||
s1 += 2;
|
||||
s2 += 2;
|
||||
n--;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
return *s1 - *s2;
|
||||
} while (n > 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _mbsnbcmp(const unsigned char *str1, const unsigned char *str2, size_t n)
|
||||
{
|
||||
unsigned char *s1 = (unsigned char *)str1;
|
||||
unsigned char *s2 = (unsigned char *)str2;
|
||||
|
||||
unsigned short *short_s1, *short_s2;
|
||||
|
||||
int l1, l2;
|
||||
|
||||
if (n == 0)
|
||||
return 0;
|
||||
do {
|
||||
|
||||
if (*s1 == 0)
|
||||
break;
|
||||
|
||||
l1 = _ismbblead(*s1);
|
||||
l2 = _ismbblead(*s2);
|
||||
if ( !l1 && !l2 ) {
|
||||
|
||||
if (*s1 != *s2)
|
||||
return *s1 - *s2;
|
||||
else {
|
||||
s1 += 1;
|
||||
s2 += 1;
|
||||
n--;
|
||||
}
|
||||
}
|
||||
else if ( l1 && l2 ){
|
||||
short_s1 = (unsigned short *)s1;
|
||||
short_s2 = (unsigned short *)s2;
|
||||
if ( *short_s1 != *short_s2 )
|
||||
return *short_s1 - *short_s2;
|
||||
else {
|
||||
s1 += 2;
|
||||
s2 += 2;
|
||||
n-=2;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
return *s1 - *s2;
|
||||
} while (n > 0);
|
||||
return 0;
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/mbstring/mbsncoll.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER: Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* 12/04/99: Created
|
||||
*/
|
||||
#include <msvcrt/mbstring.h>
|
||||
|
||||
int colldif(unsigned short c1, unsigned short c2);
|
||||
|
||||
int _mbsncoll(const unsigned char *str1, const unsigned char *str2, size_t n)
|
||||
{
|
||||
unsigned char *s1 = (unsigned char *)str1;
|
||||
unsigned char *s2 = (unsigned char *)str2;
|
||||
|
||||
unsigned short *short_s1, *short_s2;
|
||||
|
||||
int l1, l2;
|
||||
|
||||
if (n == 0)
|
||||
return 0;
|
||||
do {
|
||||
|
||||
if (*s1 == 0)
|
||||
break;
|
||||
|
||||
l1 = _ismbblead(*s1);
|
||||
l2 = _ismbblead(*s2);
|
||||
if ( !l1 && !l2 ) {
|
||||
|
||||
if (*s1 != *s2)
|
||||
return colldif(*s1, *s2);
|
||||
else {
|
||||
s1 += 1;
|
||||
s2 += 1;
|
||||
n--;
|
||||
}
|
||||
}
|
||||
else if ( l1 && l2 ){
|
||||
short_s1 = (unsigned short *)s1;
|
||||
short_s2 = (unsigned short *)s2;
|
||||
if ( *short_s1 != *short_s2 )
|
||||
return colldif(*short_s1, *short_s2);
|
||||
else {
|
||||
s1 += 2;
|
||||
s2 += 2;
|
||||
n--;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
return colldif(*s1, *s2);
|
||||
} while (n > 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int _mbsnbcoll(const unsigned char *str1, const unsigned char *str2, size_t n)
|
||||
{
|
||||
unsigned char *s1 = (unsigned char *)str1;
|
||||
unsigned char *s2 = (unsigned char *)str2;
|
||||
|
||||
unsigned short *short_s1, *short_s2;
|
||||
|
||||
int l1, l2;
|
||||
|
||||
if (n == 0)
|
||||
return 0;
|
||||
do {
|
||||
|
||||
if (*s1 == 0)
|
||||
break;
|
||||
|
||||
l1 = _ismbblead(*s1);
|
||||
l2 = _ismbblead(*s2);
|
||||
if ( !l1 && !l2 ) {
|
||||
|
||||
if (*s1 != *s2)
|
||||
return colldif(*s1, *s2);
|
||||
else {
|
||||
s1 += 1;
|
||||
s2 += 1;
|
||||
n--;
|
||||
}
|
||||
}
|
||||
else if ( l1 && l2 ){
|
||||
short_s1 = (unsigned short *)s1;
|
||||
short_s2 = (unsigned short *)s2;
|
||||
if ( *short_s1 != *short_s2 )
|
||||
return colldif(*short_s1, *short_s2);
|
||||
else {
|
||||
s1 += 2;
|
||||
s2 += 2;
|
||||
n-=2;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
return colldif(*s1, *s2);
|
||||
} while (n > 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int colldif(unsigned short c1, unsigned short c2)
|
||||
{
|
||||
return c1 - c2;
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/mbstring/mbsncpy.c
|
||||
* PURPOSE: Copies a string to a maximum of n bytes or characters
|
||||
* PROGRAMER: Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* 12/04/99: Created
|
||||
*/
|
||||
|
||||
#include <msvcrt/mbstring.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned char *_mbsncpy(unsigned char *str1, const unsigned char *str2, size_t n)
|
||||
{
|
||||
unsigned char *s1 = (unsigned char *)str1;
|
||||
unsigned char *s2 = (unsigned char *)str2;
|
||||
|
||||
unsigned short *short_s1, *short_s2;
|
||||
|
||||
if (n == 0)
|
||||
return 0;
|
||||
do {
|
||||
|
||||
if (*s2 == 0)
|
||||
break;
|
||||
|
||||
if ( !_ismbblead(*s2) ) {
|
||||
|
||||
*s1 = *s2;
|
||||
s1 += 1;
|
||||
s2 += 1;
|
||||
n--;
|
||||
}
|
||||
else {
|
||||
short_s1 = (unsigned short *)s1;
|
||||
short_s2 = (unsigned short *)s2;
|
||||
*short_s1 = *short_s2;
|
||||
s1 += 2;
|
||||
s2 += 2;
|
||||
n--;
|
||||
}
|
||||
} while (n > 0);
|
||||
return str1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* The _mbsnbcpy function copies count bytes from src to dest. If src is shorter
|
||||
* than dest, the string is padded with null characters. If dest is less than or
|
||||
* equal to count it is not terminated with a null character.
|
||||
*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned char * _mbsnbcpy(unsigned char *str1, const unsigned char *str2, size_t n)
|
||||
{
|
||||
unsigned char *s1 = (unsigned char *)str1;
|
||||
unsigned char *s2 = (unsigned char *)str2;
|
||||
|
||||
unsigned short *short_s1, *short_s2;
|
||||
|
||||
if (n == 0)
|
||||
return 0;
|
||||
do {
|
||||
|
||||
if (*s2 == 0) {
|
||||
*s1 = *s2;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !_ismbblead(*s2) ) {
|
||||
|
||||
*s1 = *s2;
|
||||
s1 += 1;
|
||||
s2 += 1;
|
||||
n--;
|
||||
}
|
||||
else {
|
||||
short_s1 = (unsigned short *)s1;
|
||||
short_s2 = (unsigned short *)s2;
|
||||
*short_s1 = *short_s2;
|
||||
s1 += 2;
|
||||
s2 += 2;
|
||||
n-=2;
|
||||
}
|
||||
} while (n > 0);
|
||||
return str1;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
#include <msvcrt/mbstring.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned int _mbsnextc (const unsigned char *src)
|
||||
{
|
||||
unsigned char *char_src = (unsigned char *)src;
|
||||
unsigned short *short_src = (unsigned short *)src;
|
||||
|
||||
if ( src == NULL )
|
||||
return 0;
|
||||
|
||||
if ( !_ismbblead(*src) )
|
||||
return *char_src;
|
||||
else
|
||||
return *short_src;
|
||||
return 0;
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
#include <msvcrt/mbstring.h>
|
||||
|
||||
|
||||
size_t _mbclen2(const unsigned int s);
|
||||
unsigned int _mbbtoupper(unsigned int c);
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _mbsnicmp(const unsigned char* s1, const unsigned char* s2, size_t n)
|
||||
{
|
||||
if (n == 0)
|
||||
return 0;
|
||||
do {
|
||||
if (_mbbtoupper(*s1) != _mbbtoupper(*s2))
|
||||
return _mbbtoupper(*(unsigned const char*)s1) - _mbbtoupper(*(unsigned const char*)s2);
|
||||
s1 += _mbclen2(*s1);
|
||||
s2 += _mbclen2(*s2);
|
||||
|
||||
if (*s1 == 0)
|
||||
break;
|
||||
if (!_ismbblead(*s1) )
|
||||
n--;
|
||||
} while (n > 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _mbsnbicmp(const unsigned char* s1, const unsigned char* s2, size_t n)
|
||||
{
|
||||
if (n == 0)
|
||||
return 0;
|
||||
do {
|
||||
if (_mbbtoupper(*s1) != _mbbtoupper(*s2))
|
||||
return _mbbtoupper(*(unsigned const char*)s1) - _mbbtoupper(*(unsigned const char*)s2);
|
||||
s1 += _mbclen2(*s1);
|
||||
s2 += _mbclen2(*s2);
|
||||
|
||||
if (*s1 == 0)
|
||||
break;
|
||||
n--;
|
||||
} while (n > 0);
|
||||
return 0;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#include <msvcrt/mbstring.h>
|
||||
|
||||
int _mbsnicoll(const unsigned char *s1, const unsigned char *s2, size_t n)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int _mbsnbicoll(const unsigned char *s1, const unsigned char *s2, size_t n)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
#include <msvcrt/mbstring.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned char * _mbsninc(const unsigned char *str, size_t n)
|
||||
{
|
||||
unsigned char *s = (unsigned char *)str;
|
||||
while(*s != 0 && n > 0) {
|
||||
if (!_ismbblead(*s) )
|
||||
n--;
|
||||
s++;
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/mbstring/mbsset.c
|
||||
* PURPOSE: Fills a string with a multibyte character
|
||||
* PROGRAMER: Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* 12/04/99: Created
|
||||
*/
|
||||
#include <msvcrt/mbstring.h>
|
||||
|
||||
size_t _mbclen2(const unsigned int s);
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned char * _mbsnset(unsigned char *src, unsigned int val, size_t count)
|
||||
{
|
||||
unsigned char *char_src = (unsigned char *)src;
|
||||
unsigned short *short_src = (unsigned short *)src;
|
||||
|
||||
if ( _mbclen2(val) == 1 ) {
|
||||
|
||||
while(count > 0) {
|
||||
*char_src = val;
|
||||
char_src++;
|
||||
count--;
|
||||
}
|
||||
*char_src = 0;
|
||||
}
|
||||
else {
|
||||
while(count > 0) {
|
||||
*short_src = val;
|
||||
short_src++;
|
||||
count-=2;
|
||||
}
|
||||
*short_src = 0;
|
||||
}
|
||||
|
||||
return src;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned char * _mbsnbset(unsigned char *src, unsigned int val, size_t count)
|
||||
{
|
||||
unsigned char *char_src = (unsigned char *)src;
|
||||
unsigned short *short_src = (unsigned short *)src;
|
||||
|
||||
if ( _mbclen2(val) == 1 ) {
|
||||
|
||||
while(count > 0) {
|
||||
*char_src = val;
|
||||
char_src++;
|
||||
count--;
|
||||
}
|
||||
*char_src = 0;
|
||||
}
|
||||
else {
|
||||
while(count > 0) {
|
||||
*short_src = val;
|
||||
short_src++;
|
||||
count-=2;
|
||||
}
|
||||
*short_src = 0;
|
||||
}
|
||||
|
||||
return src;
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/mbstring/mbsset.c
|
||||
* PURPOSE: Fills a string with a multibyte character
|
||||
* PROGRAMER: Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* 12/04/99: Created
|
||||
*/
|
||||
|
||||
#include <msvcrt/mbstring.h>
|
||||
|
||||
size_t _mbclen2(const unsigned int s);
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned char * _mbsset(unsigned char *src, unsigned int c)
|
||||
{
|
||||
unsigned char *char_src = src;
|
||||
unsigned short *short_src = (unsigned short *)src;
|
||||
|
||||
if ( _mbclen2(c) == 1 ) {
|
||||
|
||||
while(*char_src != 0) {
|
||||
*char_src = c;
|
||||
char_src++;
|
||||
}
|
||||
*char_src = 0;
|
||||
}
|
||||
else {
|
||||
while(*short_src != 0) {
|
||||
*short_src = c;
|
||||
short_src++;
|
||||
}
|
||||
*short_src = 0;
|
||||
}
|
||||
|
||||
return src;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
#include <msvcrt/mbstring.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
size_t _mbstrlen( const char *string )
|
||||
{
|
||||
char *s = (char *)string;
|
||||
size_t i = 0;
|
||||
|
||||
while ( *s != 0 ) {
|
||||
if ( _ismbblead(*s) )
|
||||
s++;
|
||||
s++;
|
||||
i++;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/mbstring/mbsncmp.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER: Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* 12/04/99: Created
|
||||
*/
|
||||
#include <msvcrt/mbstring.h>
|
||||
#include <msvcrt/ctype.h>
|
||||
|
||||
unsigned int _mbbtoupper(unsigned int c)
|
||||
{
|
||||
if (!_ismbblead(c) )
|
||||
return toupper(c);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
// codepage 952
|
||||
#define CASE_DIFF (0x8281 - 0x8260)
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned int _mbctoupper(unsigned int c)
|
||||
{
|
||||
|
||||
if ((c & 0xFF00) != 0) {
|
||||
// true multibyte case conversion needed
|
||||
if ( _ismbcupper(c) )
|
||||
return c + CASE_DIFF;
|
||||
|
||||
} else
|
||||
return _mbbtoupper(c);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned char * _mbsupr(unsigned char *x)
|
||||
{
|
||||
unsigned char *y=x;
|
||||
while (*y) {
|
||||
if (!_ismbblead(*y) )
|
||||
*y = toupper(*y);
|
||||
else {
|
||||
*y=_mbctoupper(*(unsigned short *)y);
|
||||
y++;
|
||||
}
|
||||
}
|
||||
return x;
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crtdll/process/dll.c
|
||||
* PURPOSE: Dll support routines
|
||||
* PROGRAMER: Boudewijn Dekker
|
||||
* UPDATE HISTORY:
|
||||
* 04/03/99: Created
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <msvcrt/process.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
void* _loaddll(char* name)
|
||||
{
|
||||
return LoadLibraryA(name);
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _unloaddll(void* handle)
|
||||
{
|
||||
return FreeLibrary(handle);
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
FARPROC _getdllprocaddr(void* hModule, char* lpProcName, int iOrdinal)
|
||||
{
|
||||
if (lpProcName != NULL)
|
||||
return GetProcAddress(hModule, lpProcName);
|
||||
else
|
||||
return GetProcAddress(hModule, (LPSTR)iOrdinal);
|
||||
return (NULL);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
#include "precomp.h"
|
||||
#include <msvcrt/process.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _getpid (void)
|
||||
{
|
||||
return (int)GetCurrentProcessId();
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
#include "precomp.h"
|
||||
#include <msvcrt/process.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned long __threadid (void)
|
||||
{
|
||||
return GetCurrentThreadId();
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
void *__threadhandle(void)
|
||||
{
|
||||
return GetCurrentThread();
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user