diff --git a/reactos/lib/crtdll/conio/cgets.c b/reactos/lib/crtdll/conio/cgets.c deleted file mode 100644 index fed3024a259..00000000000 --- a/reactos/lib/crtdll/conio/cgets.c +++ /dev/null @@ -1,67 +0,0 @@ -#include -#include - - -/* - * @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); -} - - diff --git a/reactos/lib/crtdll/conio/cprintf.c b/reactos/lib/crtdll/conio/cprintf.c deleted file mode 100644 index b668157a39d..00000000000 --- a/reactos/lib/crtdll/conio/cprintf.c +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -/* - * @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; -} diff --git a/reactos/lib/crtdll/conio/cputs.c b/reactos/lib/crtdll/conio/cputs.c deleted file mode 100644 index 4f7ad5558c1..00000000000 --- a/reactos/lib/crtdll/conio/cputs.c +++ /dev/null @@ -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 -#include -#include -#include - -/* - * @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; -} diff --git a/reactos/lib/crtdll/conio/cscanf.c b/reactos/lib/crtdll/conio/cscanf.c deleted file mode 100644 index 4839931aef7..00000000000 --- a/reactos/lib/crtdll/conio/cscanf.c +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include -#include -#include - -/* - * @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; -} diff --git a/reactos/lib/crtdll/conio/getch.c b/reactos/lib/crtdll/conio/getch.c deleted file mode 100644 index 02b2906ae3c..00000000000 --- a/reactos/lib/crtdll/conio/getch.c +++ /dev/null @@ -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 -#include -#include -#include - - -/* - * @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 diff --git a/reactos/lib/crtdll/conio/getche.c b/reactos/lib/crtdll/conio/getche.c deleted file mode 100644 index f994649e73d..00000000000 --- a/reactos/lib/crtdll/conio/getche.c +++ /dev/null @@ -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 -#include - - -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())); -} diff --git a/reactos/lib/crtdll/conio/kbhit.c b/reactos/lib/crtdll/conio/kbhit.c deleted file mode 100644 index 4c28e4b61f4..00000000000 --- a/reactos/lib/crtdll/conio/kbhit.c +++ /dev/null @@ -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 -#include - - -// 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; -} diff --git a/reactos/lib/crtdll/conio/putch.c b/reactos/lib/crtdll/conio/putch.c deleted file mode 100644 index 5cf65255a96..00000000000 --- a/reactos/lib/crtdll/conio/putch.c +++ /dev/null @@ -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 - -/* - * @implemented - */ -int _putch( int c ) -{ - DWORD NumberOfCharsWritten; - - if ( WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),&c,1,&NumberOfCharsWritten,NULL) ) { - return -1; - } - return NumberOfCharsWritten; -} diff --git a/reactos/lib/crtdll/conio/ungetch.c b/reactos/lib/crtdll/conio/ungetch.c deleted file mode 100644 index 6439f9e505a..00000000000 --- a/reactos/lib/crtdll/conio/ungetch.c +++ /dev/null @@ -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 -#include - -#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); -} diff --git a/reactos/lib/crtdll/ctype/isctype.c b/reactos/lib/crtdll/ctype/isctype.c deleted file mode 100644 index 2629ccfb9b0..00000000000 --- a/reactos/lib/crtdll/ctype/isctype.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include - - -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 */ diff --git a/reactos/lib/crtdll/direct/getdfree.c b/reactos/lib/crtdll/direct/getdfree.c deleted file mode 100644 index 84601c43eeb..00000000000 --- a/reactos/lib/crtdll/direct/getdfree.c +++ /dev/null @@ -1,23 +0,0 @@ -#include "precomp.h" -#include -#include - - -/* - * @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; -} diff --git a/reactos/lib/crtdll/direct/getdrive.c b/reactos/lib/crtdll/direct/getdrive.c deleted file mode 100644 index 4074bafbd18..00000000000 --- a/reactos/lib/crtdll/direct/getdrive.c +++ /dev/null @@ -1,30 +0,0 @@ -#include "precomp.h" -#include -#include - - -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 -} diff --git a/reactos/lib/crtdll/direct/mkdir.c b/reactos/lib/crtdll/direct/mkdir.c deleted file mode 100644 index 15e85d3f197..00000000000 --- a/reactos/lib/crtdll/direct/mkdir.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "precomp.h" -#include - - -/* - * @implemented - */ -int _mkdir(const char* _path) -{ - if (!CreateDirectoryA(_path, NULL)) - return -1; - return 0; -} diff --git a/reactos/lib/crtdll/except/abnorter.c b/reactos/lib/crtdll/except/abnorter.c deleted file mode 100644 index 3f27a81208c..00000000000 --- a/reactos/lib/crtdll/except/abnorter.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "precomp.h" -#include - -#ifdef __GNUC__ - -/* - * @unimplemented - */ -int _abnormal_termination(void) -{ - printf("Abnormal Termination\n"); -// return AbnormalTermination(); - return 0; -} - -#else -#endif diff --git a/reactos/lib/crtdll/except/exhand2.c b/reactos/lib/crtdll/except/exhand2.c deleted file mode 100644 index 49001483225..00000000000 --- a/reactos/lib/crtdll/except/exhand2.c +++ /dev/null @@ -1,33 +0,0 @@ -#include "precomp.h" -#include - - -#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; -} diff --git a/reactos/lib/crtdll/except/matherr.c b/reactos/lib/crtdll/except/matherr.c deleted file mode 100644 index c800b2c920c..00000000000 --- a/reactos/lib/crtdll/except/matherr.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "precomp.h" -#include - - -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; -} diff --git a/reactos/lib/crtdll/except/unwind.c b/reactos/lib/crtdll/except/unwind.c deleted file mode 100644 index de846f957fe..00000000000 --- a/reactos/lib/crtdll/except/unwind.c +++ /dev/null @@ -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; -} diff --git a/reactos/lib/crtdll/float/clearfp.c b/reactos/lib/crtdll/float/clearfp.c deleted file mode 100644 index 9e65bd29285..00000000000 --- a/reactos/lib/crtdll/float/clearfp.c +++ /dev/null @@ -1,17 +0,0 @@ -#include - -/* - * @implemented - */ -unsigned int _clearfp (void) -{ -unsigned short __res = _statusfp(); -#ifdef __GNUC__ -__asm__ __volatile__ ( - "fclex \n\t" - ); -#else -#endif /*__GNUC__*/ - return __res; -} - diff --git a/reactos/lib/crtdll/float/cntrlfp.c b/reactos/lib/crtdll/float/cntrlfp.c deleted file mode 100644 index c093d827e64..00000000000 --- a/reactos/lib/crtdll/float/cntrlfp.c +++ /dev/null @@ -1,174 +0,0 @@ -/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ - -#include - -#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 -} diff --git a/reactos/lib/crtdll/float/fpreset.c b/reactos/lib/crtdll/float/fpreset.c deleted file mode 100644 index 1a4efe4f31c..00000000000 --- a/reactos/lib/crtdll/float/fpreset.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - - -/* - * @unimplemented - */ -void _fpreset(void) -{ - /* FIXME: This causes an exception */ -// __asm__ __volatile__("fninit\n\t"); - return; -} diff --git a/reactos/lib/crtdll/float/logb.c b/reactos/lib/crtdll/float/logb.c deleted file mode 100644 index d71c654ee77..00000000000 --- a/reactos/lib/crtdll/float/logb.c +++ /dev/null @@ -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 , 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 - -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; -} diff --git a/reactos/lib/crtdll/float/nafter.c b/reactos/lib/crtdll/float/nafter.c deleted file mode 100644 index dd007322e4b..00000000000 --- a/reactos/lib/crtdll/float/nafter.c +++ /dev/null @@ -1,16 +0,0 @@ -#include - - -/* - * @implemented - */ -double _nextafter(double x, double y) -{ - if (x == y) - return x; - - if (isnan(x) || isnan(y)) - return x; - - return x; -} diff --git a/reactos/lib/crtdll/float/statfp.c b/reactos/lib/crtdll/float/statfp.c deleted file mode 100644 index e2d2112afb6..00000000000 --- a/reactos/lib/crtdll/float/statfp.c +++ /dev/null @@ -1,19 +0,0 @@ -#include - -/* - * @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; -} diff --git a/reactos/lib/crtdll/io/chsize.c b/reactos/lib/crtdll/io/chsize.c deleted file mode 100644 index 678c0f5e24e..00000000000 --- a/reactos/lib/crtdll/io/chsize.c +++ /dev/null @@ -1,18 +0,0 @@ -/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ -#include - -#define NDEBUG -#include - -/* - * @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; -} diff --git a/reactos/lib/crtdll/io/close.c b/reactos/lib/crtdll/io/close.c deleted file mode 100644 index 9388877e866..00000000000 --- a/reactos/lib/crtdll/io/close.c +++ /dev/null @@ -1,19 +0,0 @@ -#include "precomp.h" -#include -#include - -#define NDEBUG -#include - -/* - * @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); -} diff --git a/reactos/lib/crtdll/io/commit.c b/reactos/lib/crtdll/io/commit.c deleted file mode 100644 index d4024a6cd0c..00000000000 --- a/reactos/lib/crtdll/io/commit.c +++ /dev/null @@ -1,18 +0,0 @@ -#include "precomp.h" -#include -#include -#include - - -/* - * @implemented - */ -int _commit(int _fd) -{ - if (! FlushFileBuffers(_get_osfhandle(_fd)) ) { - __set_errno(EBADF); - return -1; - } - - return 0; -} diff --git a/reactos/lib/crtdll/io/dup2.c b/reactos/lib/crtdll/io/dup2.c deleted file mode 100644 index 995e48b00cd..00000000000 --- a/reactos/lib/crtdll/io/dup2.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include - -/* - * @implemented - */ -int _dup2( int handle1, int handle2 ) -{ - return __fileno_dup2( handle1, handle2 ); -} diff --git a/reactos/lib/crtdll/io/isatty.c b/reactos/lib/crtdll/io/isatty.c deleted file mode 100644 index a1d67b85289..00000000000 --- a/reactos/lib/crtdll/io/isatty.c +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include - -#define NDEBUG -#include - -/* - * @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; -} diff --git a/reactos/lib/crtdll/io/mktemp.c b/reactos/lib/crtdll/io/mktemp.c deleted file mode 100644 index a47f8d09b61..00000000000 --- a/reactos/lib/crtdll/io/mktemp.c +++ /dev/null @@ -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 -#include -#include - -#define NDEBUG -#include - - -/* - * @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; -} diff --git a/reactos/lib/crtdll/io/setmode.c b/reactos/lib/crtdll/io/setmode.c deleted file mode 100644 index 0fe6ac54dfb..00000000000 --- a/reactos/lib/crtdll/io/setmode.c +++ /dev/null @@ -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 -#include -#include - -#define NDEBUG -#include - - -/* - * @implemented - */ -int _setmode(int _fd, int _newmode) -{ - DPRINT("_setmod(fd %d, newmode %x)\n", _fd, _newmode); - return __fileno_setmode(_fd, _newmode); -} diff --git a/reactos/lib/crtdll/io/sopen.c b/reactos/lib/crtdll/io/sopen.c deleted file mode 100644 index 8ebadea6a83..00000000000 --- a/reactos/lib/crtdll/io/sopen.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - - -/* - * @implemented - */ -int _sopen(char *path,int access,int shflag,int mode) -{ - return _open((path), (access)|(shflag), (mode)); -} diff --git a/reactos/lib/crtdll/io/tell.c b/reactos/lib/crtdll/io/tell.c deleted file mode 100644 index 4f81bc83e1e..00000000000 --- a/reactos/lib/crtdll/io/tell.c +++ /dev/null @@ -1,12 +0,0 @@ -/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include - - -/* - * @implemented - */ -off_t _tell(int _file) -{ - return _lseek(_file, 0, SEEK_CUR); -} diff --git a/reactos/lib/crtdll/io/umask.c b/reactos/lib/crtdll/io/umask.c deleted file mode 100644 index b5419310899..00000000000 --- a/reactos/lib/crtdll/io/umask.c +++ /dev/null @@ -1,14 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include - -unsigned _unMode_dll = 022; - -/* - * @implemented - */ -unsigned _umask (unsigned unMode) -{ - unsigned old_mask = _unMode_dll; - _unMode_dll = unMode; - return old_mask; -} diff --git a/reactos/lib/crtdll/io/utime.c b/reactos/lib/crtdll/io/utime.c deleted file mode 100644 index 593ca7e1538..00000000000 --- a/reactos/lib/crtdll/io/utime.c +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include -#include -#include -#include - - -/* - * @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; -} diff --git a/reactos/lib/crtdll/math/acos.c b/reactos/lib/crtdll/math/acos.c deleted file mode 100644 index 23376a6116c..00000000000 --- a/reactos/lib/crtdll/math/acos.c +++ /dev/null @@ -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 , 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 - - -double acos(double __x) -{ - return atan2(sqrt(1.0 - __x * __x), __x); -} diff --git a/reactos/lib/crtdll/math/asin.c b/reactos/lib/crtdll/math/asin.c deleted file mode 100644 index fa57df2850c..00000000000 --- a/reactos/lib/crtdll/math/asin.c +++ /dev/null @@ -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 , 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 - - -double asin(double __x) -{ - return atan2(__x, sqrt(1.0 - __x * __x)); -} diff --git a/reactos/lib/crtdll/math/atan.c b/reactos/lib/crtdll/math/atan.c deleted file mode 100644 index af0e219e728..00000000000 --- a/reactos/lib/crtdll/math/atan.c +++ /dev/null @@ -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 , 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 - -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; -} diff --git a/reactos/lib/crtdll/math/atan2.c b/reactos/lib/crtdll/math/atan2.c deleted file mode 100644 index 8ce57f1e433..00000000000 --- a/reactos/lib/crtdll/math/atan2.c +++ /dev/null @@ -1,21 +0,0 @@ - -#include - -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; -} diff --git a/reactos/lib/crtdll/math/cabs.c b/reactos/lib/crtdll/math/cabs.c deleted file mode 100644 index ca9e8426c73..00000000000 --- a/reactos/lib/crtdll/math/cabs.c +++ /dev/null @@ -1,14 +0,0 @@ -#include - -/* - * @implemented - */ -double _cabs( struct _complex z ) -{ - return sqrt( z.x*z.x + z.y*z.y ); -// return hypot(z.x,z.y); -} - - - - diff --git a/reactos/lib/crtdll/math/cos.c b/reactos/lib/crtdll/math/cos.c deleted file mode 100644 index 131fa2dbdb0..00000000000 --- a/reactos/lib/crtdll/math/cos.c +++ /dev/null @@ -1,19 +0,0 @@ -#include - -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; -} diff --git a/reactos/lib/crtdll/math/cosh.c b/reactos/lib/crtdll/math/cosh.c deleted file mode 100644 index a21e717cadc..00000000000 --- a/reactos/lib/crtdll/math/cosh.c +++ /dev/null @@ -1,12 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include - - -/* - * @implemented - */ -double cosh(double x) -{ - const double ebig = exp(fabs(x)); - return (ebig + 1.0/ebig) / 2.0; -} diff --git a/reactos/lib/crtdll/math/exp.c b/reactos/lib/crtdll/math/exp.c deleted file mode 100644 index 2707cf8ca3a..00000000000 --- a/reactos/lib/crtdll/math/exp.c +++ /dev/null @@ -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 , 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 - -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__*/ -} diff --git a/reactos/lib/crtdll/math/fabs.c b/reactos/lib/crtdll/math/fabs.c deleted file mode 100644 index 5db505ad11b..00000000000 --- a/reactos/lib/crtdll/math/fabs.c +++ /dev/null @@ -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 , 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 - -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; -} diff --git a/reactos/lib/crtdll/math/fmod.c b/reactos/lib/crtdll/math/fmod.c deleted file mode 100644 index 263d6878829..00000000000 --- a/reactos/lib/crtdll/math/fmod.c +++ /dev/null @@ -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 , 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 - -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; -} diff --git a/reactos/lib/crtdll/math/hypot.c b/reactos/lib/crtdll/math/hypot.c deleted file mode 100644 index de078a140e8..00000000000 --- a/reactos/lib/crtdll/math/hypot.c +++ /dev/null @@ -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 -#include -#include - -/* 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 - -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 diff --git a/reactos/lib/crtdll/math/j0_y0.c b/reactos/lib/crtdll/math/j0_y0.c deleted file mode 100644 index 01143ef3dcc..00000000000 --- a/reactos/lib/crtdll/math/j0_y0.c +++ /dev/null @@ -1,18 +0,0 @@ -#include - - -/* - * @unimplemented - */ -double _j0(double x) -{ - return x; -} - -/* - * @unimplemented - */ -double _y0(double x) -{ - return x; -} diff --git a/reactos/lib/crtdll/math/j1_y1.c b/reactos/lib/crtdll/math/j1_y1.c deleted file mode 100644 index 3c899886491..00000000000 --- a/reactos/lib/crtdll/math/j1_y1.c +++ /dev/null @@ -1,18 +0,0 @@ -#include - - -/* - * @unimplemented - */ -double _j1(double x) -{ - return x; -} - -/* - * @unimplemented - */ -double _y1(double x) -{ - return x; -} diff --git a/reactos/lib/crtdll/math/jn_yn.c b/reactos/lib/crtdll/math/jn_yn.c deleted file mode 100644 index a9304720a2e..00000000000 --- a/reactos/lib/crtdll/math/jn_yn.c +++ /dev/null @@ -1,18 +0,0 @@ -#include - - -/* - * @unimplemented - */ -double _jn(int n, double x) -{ - return x; -} - -/* - * @unimplemented - */ -double _yn(int n, double x) -{ - return x; -} diff --git a/reactos/lib/crtdll/math/ldexp.c b/reactos/lib/crtdll/math/ldexp.c deleted file mode 100644 index 9c603445509..00000000000 --- a/reactos/lib/crtdll/math/ldexp.c +++ /dev/null @@ -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 , 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 - -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; -} diff --git a/reactos/lib/crtdll/math/log.c b/reactos/lib/crtdll/math/log.c deleted file mode 100644 index 014c78a2304..00000000000 --- a/reactos/lib/crtdll/math/log.c +++ /dev/null @@ -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 , 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 - -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; -} diff --git a/reactos/lib/crtdll/math/log10.c b/reactos/lib/crtdll/math/log10.c deleted file mode 100644 index 58e8cd6ebc9..00000000000 --- a/reactos/lib/crtdll/math/log10.c +++ /dev/null @@ -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 , 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 - -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; -} diff --git a/reactos/lib/crtdll/math/pow.c b/reactos/lib/crtdll/math/pow.c deleted file mode 100644 index 91e07216944..00000000000 --- a/reactos/lib/crtdll/math/pow.c +++ /dev/null @@ -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 , 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 - -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); -} diff --git a/reactos/lib/crtdll/math/sin.c b/reactos/lib/crtdll/math/sin.c deleted file mode 100644 index db070a31d17..00000000000 --- a/reactos/lib/crtdll/math/sin.c +++ /dev/null @@ -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 , 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 - -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; -} diff --git a/reactos/lib/crtdll/math/sinh.c b/reactos/lib/crtdll/math/sinh.c deleted file mode 100644 index f977a6acfa5..00000000000 --- a/reactos/lib/crtdll/math/sinh.c +++ /dev/null @@ -1,19 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include - -/* - * @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; - } -} diff --git a/reactos/lib/crtdll/math/sqrt.c b/reactos/lib/crtdll/math/sqrt.c deleted file mode 100644 index d414fcdbc2e..00000000000 --- a/reactos/lib/crtdll/math/sqrt.c +++ /dev/null @@ -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 , 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 - -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; -} diff --git a/reactos/lib/crtdll/math/stubs.c b/reactos/lib/crtdll/math/stubs.c deleted file mode 100644 index 82fe881ebc0..00000000000 --- a/reactos/lib/crtdll/math/stubs.c +++ /dev/null @@ -1,133 +0,0 @@ -#include - - -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); -} diff --git a/reactos/lib/crtdll/math/tan.c b/reactos/lib/crtdll/math/tan.c deleted file mode 100644 index 1acc03619f9..00000000000 --- a/reactos/lib/crtdll/math/tan.c +++ /dev/null @@ -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 , 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 - -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; -} diff --git a/reactos/lib/crtdll/math/tanh.c b/reactos/lib/crtdll/math/tanh.c deleted file mode 100644 index 88b9acca5ae..00000000000 --- a/reactos/lib/crtdll/math/tanh.c +++ /dev/null @@ -1,20 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ - -#include - -/* - * @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); - } -} diff --git a/reactos/lib/crtdll/mbstring/hanzen.c b/reactos/lib/crtdll/mbstring/hanzen.c deleted file mode 100644 index 60853efead4..00000000000 --- a/reactos/lib/crtdll/mbstring/hanzen.c +++ /dev/null @@ -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 - -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; -} - - - diff --git a/reactos/lib/crtdll/mbstring/ischira.c b/reactos/lib/crtdll/mbstring/ischira.c deleted file mode 100644 index 9fa4426b3e6..00000000000 --- a/reactos/lib/crtdll/mbstring/ischira.c +++ /dev/null @@ -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 -#include - - -/* - * @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; -} - diff --git a/reactos/lib/crtdll/mbstring/iskana.c b/reactos/lib/crtdll/mbstring/iskana.c deleted file mode 100644 index fdf57960522..00000000000 --- a/reactos/lib/crtdll/mbstring/iskana.c +++ /dev/null @@ -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 -#include - -/* - * @implemented - */ -int _ismbbkana(unsigned char c) -{ - return ((_jctype+1)[(unsigned char)(c)] & (_KNJ_M|_KNJ_P)); -} diff --git a/reactos/lib/crtdll/mbstring/iskmoji.c b/reactos/lib/crtdll/mbstring/iskmoji.c deleted file mode 100644 index e2f1d48c840..00000000000 --- a/reactos/lib/crtdll/mbstring/iskmoji.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int _ismbbkalpha(unsigned char c) -{ - return (0xA7 <= c && c <= 0xDF); -} diff --git a/reactos/lib/crtdll/mbstring/iskpun.c b/reactos/lib/crtdll/mbstring/iskpun.c deleted file mode 100644 index 935c850cb0d..00000000000 --- a/reactos/lib/crtdll/mbstring/iskpun.c +++ /dev/null @@ -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 - -/* - * @implemented - */ -int _ismbbkpunct( unsigned int c ) -{ - return ((_jctype+1)[(unsigned char)(c)] & (_KNJ_P)); -} diff --git a/reactos/lib/crtdll/mbstring/islwr.c b/reactos/lib/crtdll/mbstring/islwr.c deleted file mode 100644 index 44167a836f3..00000000000 --- a/reactos/lib/crtdll/mbstring/islwr.c +++ /dev/null @@ -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 -#include - -/* - * code page 952 only - * - * @implemented - */ -int _ismbclower( unsigned int c ) -{ - if ((c & 0xFF00) != 0) { - if ( c >= 0x829A && c<= 0x829A ) - return 1; - } - - return islower(c); -} diff --git a/reactos/lib/crtdll/mbstring/ismbal.c b/reactos/lib/crtdll/mbstring/ismbal.c deleted file mode 100644 index 398d22df624..00000000000 --- a/reactos/lib/crtdll/mbstring/ismbal.c +++ /dev/null @@ -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 -#include - -/* - * @implemented - */ -int _ismbbalpha(unsigned char c) -{ - return (isalpha(c) ||_ismbbkalnum(c)); -} - diff --git a/reactos/lib/crtdll/mbstring/ismbaln.c b/reactos/lib/crtdll/mbstring/ismbaln.c deleted file mode 100644 index 109a2f5ef76..00000000000 --- a/reactos/lib/crtdll/mbstring/ismbaln.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include - - -/* - * @implemented - */ -int _ismbbalnum(unsigned char c) -{ - return (isalnum(c) || _ismbbkalnum(c)); -} - diff --git a/reactos/lib/crtdll/mbstring/ismbc.c b/reactos/lib/crtdll/mbstring/ismbc.c deleted file mode 100644 index f4bcc7a1a25..00000000000 --- a/reactos/lib/crtdll/mbstring/ismbc.c +++ /dev/null @@ -1,132 +0,0 @@ -#include - -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; -} diff --git a/reactos/lib/crtdll/mbstring/ismbgra.c b/reactos/lib/crtdll/mbstring/ismbgra.c deleted file mode 100644 index f38499b0b80..00000000000 --- a/reactos/lib/crtdll/mbstring/ismbgra.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include -#include - -/* - * @implemented - */ -int _ismbbgraph(unsigned char c) -{ - return (isgraph(c) || _ismbbkana(c)); -} diff --git a/reactos/lib/crtdll/mbstring/ismbkaln.c b/reactos/lib/crtdll/mbstring/ismbkaln.c deleted file mode 100644 index 44f764ad0c4..00000000000 --- a/reactos/lib/crtdll/mbstring/ismbkaln.c +++ /dev/null @@ -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 -#include - -/* - * @implemented - */ -int _ismbbkalnum( unsigned int c ) -{ - return ((_jctype+1)[(unsigned char)(c)] & (_KNJ_P)); -} diff --git a/reactos/lib/crtdll/mbstring/ismblead.c b/reactos/lib/crtdll/mbstring/ismblead.c deleted file mode 100644 index ba65a2c7a61..00000000000 --- a/reactos/lib/crtdll/mbstring/ismblead.c +++ /dev/null @@ -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 -#include -#include - -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); -} - diff --git a/reactos/lib/crtdll/mbstring/ismbpri.c b/reactos/lib/crtdll/mbstring/ismbpri.c deleted file mode 100644 index e6d5ebc9881..00000000000 --- a/reactos/lib/crtdll/mbstring/ismbpri.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include -#include - -/* - * @implemented - */ -int _ismbbprint(unsigned char c) -{ - return (isprint(c) || _ismbbkana(c)); -} diff --git a/reactos/lib/crtdll/mbstring/ismbpun.c b/reactos/lib/crtdll/mbstring/ismbpun.c deleted file mode 100644 index 2ccd434c37d..00000000000 --- a/reactos/lib/crtdll/mbstring/ismbpun.c +++ /dev/null @@ -1,18 +0,0 @@ - -#include -#include -#include - - -/* - * @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) diff --git a/reactos/lib/crtdll/mbstring/ismbtrl.c b/reactos/lib/crtdll/mbstring/ismbtrl.c deleted file mode 100644 index c68eca45bb6..00000000000 --- a/reactos/lib/crtdll/mbstring/ismbtrl.c +++ /dev/null @@ -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 -#include - -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); -} diff --git a/reactos/lib/crtdll/mbstring/isuppr.c b/reactos/lib/crtdll/mbstring/isuppr.c deleted file mode 100644 index 00638379b62..00000000000 --- a/reactos/lib/crtdll/mbstring/isuppr.c +++ /dev/null @@ -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 -#include - -/* - * code page 952 only - * - * @implemented - */ -int _ismbcupper( unsigned int c ) -{ - if ((c & 0xFF00) != 0) { - if ( c >= 0x8260 && c<= 0x8279 ) - return 1; - } - - return isupper(c); -} diff --git a/reactos/lib/crtdll/mbstring/jistojms.c b/reactos/lib/crtdll/mbstring/jistojms.c deleted file mode 100644 index c47b223a58a..00000000000 --- a/reactos/lib/crtdll/mbstring/jistojms.c +++ /dev/null @@ -1,27 +0,0 @@ -#include - -/* - * @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; -} diff --git a/reactos/lib/crtdll/mbstring/jmstojis.c b/reactos/lib/crtdll/mbstring/jmstojis.c deleted file mode 100644 index cf349f673db..00000000000 --- a/reactos/lib/crtdll/mbstring/jmstojis.c +++ /dev/null @@ -1,28 +0,0 @@ -#include - -/* - * @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; -} diff --git a/reactos/lib/crtdll/mbstring/mbbtype.c b/reactos/lib/crtdll/mbstring/mbbtype.c deleted file mode 100644 index 0f67c57bb38..00000000000 --- a/reactos/lib/crtdll/mbstring/mbbtype.c +++ /dev/null @@ -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 -#include - -/* - * @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); -} diff --git a/reactos/lib/crtdll/mbstring/mbccpy.c b/reactos/lib/crtdll/mbstring/mbccpy.c deleted file mode 100644 index 94ea4fda4d4..00000000000 --- a/reactos/lib/crtdll/mbstring/mbccpy.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include - -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)); -} diff --git a/reactos/lib/crtdll/mbstring/mbscoll.c b/reactos/lib/crtdll/mbstring/mbscoll.c deleted file mode 100644 index dad12be050b..00000000000 --- a/reactos/lib/crtdll/mbstring/mbscoll.c +++ /dev/null @@ -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 - -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 diff --git a/reactos/lib/crtdll/mbstring/mbsdec.c b/reactos/lib/crtdll/mbstring/mbsdec.c deleted file mode 100644 index 14c228c81c5..00000000000 --- a/reactos/lib/crtdll/mbstring/mbsdec.c +++ /dev/null @@ -1,17 +0,0 @@ -#include - -/* - * @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; -} diff --git a/reactos/lib/crtdll/mbstring/mbsicmp.c b/reactos/lib/crtdll/mbstring/mbsicmp.c deleted file mode 100644 index b1b7c41e096..00000000000 --- a/reactos/lib/crtdll/mbstring/mbsicmp.c +++ /dev/null @@ -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 -#include -#include - -/* - * @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)); -} diff --git a/reactos/lib/crtdll/mbstring/mbsicoll.c b/reactos/lib/crtdll/mbstring/mbsicoll.c deleted file mode 100644 index 32020cc8348..00000000000 --- a/reactos/lib/crtdll/mbstring/mbsicoll.c +++ /dev/null @@ -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 -#include -#include - -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; -} diff --git a/reactos/lib/crtdll/mbstring/mbsinc.c b/reactos/lib/crtdll/mbstring/mbsinc.c deleted file mode 100644 index 98a5fb5dbd9..00000000000 --- a/reactos/lib/crtdll/mbstring/mbsinc.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -/* - * @implemented - */ -unsigned char * _mbsinc(const unsigned char *s) -{ - unsigned char *c = (unsigned char *)s; - if (_ismbblead(*s) ) - c++; - c++; - return c; -} diff --git a/reactos/lib/crtdll/mbstring/mbslen.c b/reactos/lib/crtdll/mbstring/mbslen.c deleted file mode 100644 index 8529fbf27f5..00000000000 --- a/reactos/lib/crtdll/mbstring/mbslen.c +++ /dev/null @@ -1,18 +0,0 @@ -#include - -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; -} diff --git a/reactos/lib/crtdll/mbstring/mbslwr.c b/reactos/lib/crtdll/mbstring/mbslwr.c deleted file mode 100644 index 071a7659ca1..00000000000 --- a/reactos/lib/crtdll/mbstring/mbslwr.c +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include - -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; -} diff --git a/reactos/lib/crtdll/mbstring/mbsnccnt.c b/reactos/lib/crtdll/mbstring/mbsnccnt.c deleted file mode 100644 index af739200fd0..00000000000 --- a/reactos/lib/crtdll/mbstring/mbsnccnt.c +++ /dev/null @@ -1,35 +0,0 @@ -#include - -/* - * @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); -} diff --git a/reactos/lib/crtdll/mbstring/mbsncmp.c b/reactos/lib/crtdll/mbstring/mbsncmp.c deleted file mode 100644 index 94c349d97a5..00000000000 --- a/reactos/lib/crtdll/mbstring/mbsncmp.c +++ /dev/null @@ -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 - -/* - * @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; -} diff --git a/reactos/lib/crtdll/mbstring/mbsncoll.c b/reactos/lib/crtdll/mbstring/mbsncoll.c deleted file mode 100644 index 1a35922dd32..00000000000 --- a/reactos/lib/crtdll/mbstring/mbsncoll.c +++ /dev/null @@ -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 - -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; -} diff --git a/reactos/lib/crtdll/mbstring/mbsncpy.c b/reactos/lib/crtdll/mbstring/mbsncpy.c deleted file mode 100644 index 112c7513785..00000000000 --- a/reactos/lib/crtdll/mbstring/mbsncpy.c +++ /dev/null @@ -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 - - -/* - * @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; -} diff --git a/reactos/lib/crtdll/mbstring/mbsnextc.c b/reactos/lib/crtdll/mbstring/mbsnextc.c deleted file mode 100644 index 44ad9502994..00000000000 --- a/reactos/lib/crtdll/mbstring/mbsnextc.c +++ /dev/null @@ -1,19 +0,0 @@ -#include - -/* - * @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; -} diff --git a/reactos/lib/crtdll/mbstring/mbsnicmp.c b/reactos/lib/crtdll/mbstring/mbsnicmp.c deleted file mode 100644 index cb5c2555f8d..00000000000 --- a/reactos/lib/crtdll/mbstring/mbsnicmp.c +++ /dev/null @@ -1,47 +0,0 @@ -#include - - -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; -} diff --git a/reactos/lib/crtdll/mbstring/mbsnicoll.c b/reactos/lib/crtdll/mbstring/mbsnicoll.c deleted file mode 100644 index 3fead6d6a7b..00000000000 --- a/reactos/lib/crtdll/mbstring/mbsnicoll.c +++ /dev/null @@ -1,11 +0,0 @@ -#include - -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; -} diff --git a/reactos/lib/crtdll/mbstring/mbsninc.c b/reactos/lib/crtdll/mbstring/mbsninc.c deleted file mode 100644 index 419ee3a3ac1..00000000000 --- a/reactos/lib/crtdll/mbstring/mbsninc.c +++ /dev/null @@ -1,16 +0,0 @@ -#include - -/* - * @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; -} diff --git a/reactos/lib/crtdll/mbstring/mbsnset.c b/reactos/lib/crtdll/mbstring/mbsnset.c deleted file mode 100644 index af367ee9949..00000000000 --- a/reactos/lib/crtdll/mbstring/mbsnset.c +++ /dev/null @@ -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 - -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; -} diff --git a/reactos/lib/crtdll/mbstring/mbsset.c b/reactos/lib/crtdll/mbstring/mbsset.c deleted file mode 100644 index f6067f2b8a9..00000000000 --- a/reactos/lib/crtdll/mbstring/mbsset.c +++ /dev/null @@ -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 - -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; -} diff --git a/reactos/lib/crtdll/mbstring/mbstrlen.c b/reactos/lib/crtdll/mbstring/mbstrlen.c deleted file mode 100644 index b8c64cce6f1..00000000000 --- a/reactos/lib/crtdll/mbstring/mbstrlen.c +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include - -/* - * @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; -} diff --git a/reactos/lib/crtdll/mbstring/mbsupr.c b/reactos/lib/crtdll/mbstring/mbsupr.c deleted file mode 100644 index 3ac3e61fe54..00000000000 --- a/reactos/lib/crtdll/mbstring/mbsupr.c +++ /dev/null @@ -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 -#include - -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; -} diff --git a/reactos/lib/crtdll/process/dll.c b/reactos/lib/crtdll/process/dll.c deleted file mode 100644 index 771732dd590..00000000000 --- a/reactos/lib/crtdll/process/dll.c +++ /dev/null @@ -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 - - -/* - * @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); -} diff --git a/reactos/lib/crtdll/process/procid.c b/reactos/lib/crtdll/process/procid.c deleted file mode 100644 index 87c145828c6..00000000000 --- a/reactos/lib/crtdll/process/procid.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "precomp.h" -#include - -/* - * @implemented - */ -int _getpid (void) -{ - return (int)GetCurrentProcessId(); -} - diff --git a/reactos/lib/crtdll/process/threadid.c b/reactos/lib/crtdll/process/threadid.c deleted file mode 100644 index 2b17a83c7fc..00000000000 --- a/reactos/lib/crtdll/process/threadid.c +++ /dev/null @@ -1,18 +0,0 @@ -#include "precomp.h" -#include - -/* - * @implemented - */ -unsigned long __threadid (void) -{ - return GetCurrentThreadId(); -} - -/* - * @implemented - */ -void *__threadhandle(void) -{ - return GetCurrentThread(); -} diff --git a/reactos/lib/crtdll/search/lfind.c b/reactos/lib/crtdll/search/lfind.c deleted file mode 100644 index e89efa63c9b..00000000000 --- a/reactos/lib/crtdll/search/lfind.c +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include - - -/* - * @implemented - */ -void *_lfind(const void *key, const void *base, size_t *nelp, - size_t width, int (*compar)(const void *, const void *)) -{ - char* char_base = (char*)base; - int i; - - for (i = 0; i < *nelp; i++) { - if (compar(key, char_base) == 0) - return char_base; - char_base += width; - } - return NULL; -} - diff --git a/reactos/lib/crtdll/search/lsearch.c b/reactos/lib/crtdll/search/lsearch.c deleted file mode 100644 index a8465ae7853..00000000000 --- a/reactos/lib/crtdll/search/lsearch.c +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include -#include - -/* - * @implemented - */ -void *_lsearch(const void *key, void *base, size_t *nelp, size_t width, - int (*compar)(const void *, const void *)) -{ - void *ret_find = _lfind(key,base,nelp,width,compar); - - if (ret_find != NULL) - return ret_find; - -#ifdef __GNUC__ - memcpy(base + (*nelp*width), key, width); -#else - memcpy((int*)base + (*nelp*width), key, width); -#endif - (*nelp)++; - return base; -} - diff --git a/reactos/lib/crtdll/signal/signal.c b/reactos/lib/crtdll/signal/signal.c deleted file mode 100644 index 6272b2f6854..00000000000 --- a/reactos/lib/crtdll/signal/signal.c +++ /dev/null @@ -1,113 +0,0 @@ -#include -#include -#include -#include -#include - -void _default_handler(int signal); - -typedef struct _sig_element -{ - int signal; - char *signame; - _p_sig_fn_t handler; -} sig_element; - -static sig_element signal_list[SIGMAX] = - { - { 0, "Signal 0", SIG_DFL }, - { SIGABRT, "Aborted",SIG_DFL }, - { SIGFPE, "Erroneous arithmetic operation",SIG_DFL }, - { SIGILL, "Illegal instruction",SIG_DFL }, - { SIGINT, "Interrupt",SIG_DFL }, - { SIGSEGV, "Invalid access to storage",SIG_DFL }, - { SIGTERM, "Terminated",SIG_DFL }, - { SIGHUP, "Hangup",SIG_DFL }, - { SIGQUIT, "Quit",SIG_DFL }, - { SIGPIPE, "Broken pipe",SIG_DFL }, - { SIGKILL, "Killed",SIG_DFL }, - { SIGALRM, "Alarm clock",SIG_DFL }, - { 0, "Stopped (signal)",SIG_DFL }, - { 0, "Stopped",SIG_DFL }, - { 0, "Continued",SIG_DFL }, - { 0, "Child exited",SIG_DFL }, - { 0, "Stopped (tty input)",SIG_DFL }, - { 0, "Stopped (tty output)",SIG_DFL }, - { 0, NULL, SIG_DFL } - }; - -int nsignal = 21; - -/* - * @implemented - */ -_p_sig_fn_t signal(int sig, _p_sig_fn_t func) -{ - _p_sig_fn_t temp; - int i; - if(sig <= 0 || sig > SIGMAX || sig == SIGKILL) - { - __set_errno(EINVAL); - return SIG_ERR; - } -// check with IsBadCodePtr - - if ( func < (_p_sig_fn_t)4096 ) { - __set_errno(EINVAL); - return SIG_ERR; - } - - for(i=0;i SIGMAX) - return -1; - for(i=0;i - -/* - * @unimplemented - */ -void **__pxcptinfoptrs (void) -{ - return NULL; -} diff --git a/reactos/lib/crtdll/stdio/allocfil.c b/reactos/lib/crtdll/stdio/allocfil.c deleted file mode 100644 index 139cf0efa42..00000000000 --- a/reactos/lib/crtdll/stdio/allocfil.c +++ /dev/null @@ -1,101 +0,0 @@ -/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include - - -FILE * __alloc_file(void); - -char __validfp (FILE *f) -{ - if ( (unsigned int)f < 256) - return FALSE; - - if( f == NULL || (int)f== -1 ) - return FALSE; - - return TRUE; -} - -/* A FILE* is considered "free" if its flag is zero. */ - -FILE *__alloc_file(void) -{ - __file_rec *fr = __file_rec_list; - __file_rec **last_fr = &__file_rec_list; - FILE *rv=0; - int i; - - /* Try to find an empty slot */ - while (fr) - { - last_fr = &(fr->next); - - /* If one of the existing slots is available, return it */ - for (i=0; icount; i++) - { - if (fr->files[i]->_flag == 0) - { - return fr->files[i]; - } - } - - /* If this one is full, go to the next */ - if (fr->count == __FILE_REC_MAX) - fr = fr->next; - else - /* it isn't full, we can add to it */ - break; - } - if (!fr) - { - /* add another one to the end, make it empty */ - fr = *last_fr = (__file_rec *)malloc(sizeof(__file_rec)); - if (fr == 0) - return 0; - fr->next = 0; - fr->count = 0; - } - /* fr is a pointer to a rec with empty slots in it */ - rv = fr->files[fr->count] = (FILE *)malloc(sizeof(FILE)); - if (rv == 0) - return 0; - memset(rv, 0, sizeof(FILE)); - fr->count ++; - return rv; -} - - -/* - * @implemented - */ -int _fcloseall( void ) -{ - __file_rec *fr = __file_rec_list; - __file_rec **last_fr = &__file_rec_list; - - int total_closed = 0; - int i = 0; - - /* Try to find an empty slot */ - while (fr) - { - last_fr = &(fr->next); - - /* If one of the existing slots is available, return it */ - for (i=0; icount; i++) - if (fr->files[i]->_flag != 0) { - fclose(fr->files[i]); - total_closed++; - } - - /* If this one is full, go to the next */ - if (fr->count == __FILE_REC_MAX) - fr = fr->next; - else - /* it isn't full, we can add to it */ - break; - } - return total_closed; -} diff --git a/reactos/lib/crtdll/stdio/clearerr.c b/reactos/lib/crtdll/stdio/clearerr.c deleted file mode 100644 index 29ff9120475..00000000000 --- a/reactos/lib/crtdll/stdio/clearerr.c +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include - -#ifdef clearerr -#undef clearerr -void clearerr(FILE *stream); -#endif - -/* - * @implemented - */ -void -clearerr(FILE *f) -{ - if (!__validfp (f)) { - __set_errno (EINVAL); - return; - } - f->_flag &= ~(_IOERR|_IOEOF); -} diff --git a/reactos/lib/crtdll/stdio/fclose.c b/reactos/lib/crtdll/stdio/fclose.c deleted file mode 100644 index f39c21f1a91..00000000000 --- a/reactos/lib/crtdll/stdio/fclose.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ - -#include -#include -#include -#include -#include -#include -#include - -// changed check for writable stream - - -/* - * @implemented - */ -int -fclose(FILE *f) -{ - int r = 0; - - if (f == NULL) { - __set_errno (EINVAL); - return EOF; - } - - - -// flush only if stream was opened for writing - if ( !(f->_flag&_IOSTRG) ) { - if ( OPEN4WRITING(f) ) - r = fflush(f); - - if (_close(fileno(f)) < 0) - r = EOF; - if (f->_flag&_IOMYBUF) - free(f->_base); - -// Kernel might do this later - if (f->_flag & _IORMONCL && f->_name_to_remove) - { - remove(f->_name_to_remove); - free(f->_name_to_remove); - f->_name_to_remove = 0; - } - } - f->_cnt = 0; - f->_base = 0; - f->_ptr = 0; - f->_bufsiz = 0; - f->_flag = 0; - f->_file = -1; - return r; -} diff --git a/reactos/lib/crtdll/stdio/fdopen.c b/reactos/lib/crtdll/stdio/fdopen.c deleted file mode 100644 index 1bdb627b220..00000000000 --- a/reactos/lib/crtdll/stdio/fdopen.c +++ /dev/null @@ -1,57 +0,0 @@ -#include -#include - -FILE * __alloc_file(void); - - -/* - * @implemented - */ -FILE *_fdopen(int handle, char *mode) -{ - FILE *file; - int rw; - - if ( handle == 0 ) - return stdin; - - if ( handle == 1 ) - return stdout; - - if ( handle == 2 ) - return stderr; - - if ( handle == 3 ) - return stdaux; - - if ( handle == 4 ) - return stdprn; - - file = __alloc_file(); - if (file == NULL) - return NULL; - file->_file = handle; - - rw = (mode[1] == '+') || (mode[1] && (mode[2] == '+')); - - if (*mode == 'a') - _lseek(handle, 0, SEEK_END); - - file->_cnt = 0; - file->_file = handle; - file->_bufsiz = 0; - -// The mode of the stream must be compatible with the mode of the file descriptor. -// this should be checked. - - if (rw) - file->_flag = _IOREAD | _IOWRT; - else if (*mode == 'r') - file->_flag = _IOREAD; - else - file->_flag = _IOWRT; - - file->_base = file->_ptr = NULL; - - return file; -} diff --git a/reactos/lib/crtdll/stdio/feof.c b/reactos/lib/crtdll/stdio/feof.c deleted file mode 100644 index 9591e213705..00000000000 --- a/reactos/lib/crtdll/stdio/feof.c +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include - -#ifdef feof -#undef feof -int feof(FILE *stream); -#endif - -/* - * @implemented - */ -int feof(FILE *stream) -{ - if (stream == NULL) { - __set_errno (EINVAL); - return EOF; - } - - return stream->_flag & _IOEOF; -} diff --git a/reactos/lib/crtdll/stdio/ferror.c b/reactos/lib/crtdll/stdio/ferror.c deleted file mode 100644 index 8192ee0bd62..00000000000 --- a/reactos/lib/crtdll/stdio/ferror.c +++ /dev/null @@ -1,16 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include - -#ifdef ferror -#undef ferror -int ferror(FILE *stream); -#endif - -/* - * @implemented - */ -int ferror(FILE *stream) -{ - return stream->_flag & _IOERR; -} diff --git a/reactos/lib/crtdll/stdio/fflush.c b/reactos/lib/crtdll/stdio/fflush.c deleted file mode 100644 index 83852e65747..00000000000 --- a/reactos/lib/crtdll/stdio/fflush.c +++ /dev/null @@ -1,119 +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 - */ -/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ -/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ -/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ - -#include -#include -#include -#include -#include -#include -#include - - -/* - * @implemented - */ -int fflush(FILE *f) -{ - char *base; - int n, rn; - - - - if (f == NULL) - { - int e = errno; - - __set_errno(0); - _fwalk((void (*)(FILE *))fflush); - if (*_errno()) - return EOF; - __set_errno(e); - return 0; - } - - -// nothing to do if stream can not be written to - - if ( !OPEN4WRITING(f) ) { - __set_errno (EINVAL); - return 0; - } - -// discard any unget characters - - f->_flag &= ~_IOUNGETC; - - -// check for buffered dirty block - - if ( (f->_flag&(_IODIRTY|_IONBF)) ==_IODIRTY && f->_base != NULL) - { - - base = f->_base; - - -// if the buffer is read ahead and dirty we will flush it entirely -// else the buffer is appended to the file to the extend it has valid bytes - - if ( (f->_flag & _IOAHEAD) == _IOAHEAD ) - rn = n = f->_ptr - base + f->_cnt; - else - rn = n = f->_ptr - base; - - f->_ptr = base; - - if ((f->_flag & _IOFBF) == _IOFBF) { - if ( (f->_flag & _IOAHEAD) == _IOAHEAD ) - _lseek(fileno(f),-rn, SEEK_CUR); - } - - f->_flag &= ~_IOAHEAD; - - - f->_cnt = (f->_flag&(_IOLBF|_IONBF)) ? 0 : f->_bufsiz; - -// how can write return less than rn without being on error ??? - -// possibly commit the flushed data -// better open the file in write through mode - - do { - n = _write(fileno(f), base, rn); - if (n <= 0) { - f->_flag |= _IOERR; - return EOF; - } - rn -= n; - base += n; - } while (rn > 0); - f->_flag &= ~_IODIRTY; - -// commit flushed data -// _commit(fileno(f)); - } - if (OPEN4READING(f) && OPEN4WRITING(f) ) - { - f->_cnt = 0; - f->_ptr = f->_base; - } - return 0; -} - -/* - * @implemented - */ -int _flushall( void ) -{ - return fflush(NULL); -} diff --git a/reactos/lib/crtdll/stdio/fgetc.c b/reactos/lib/crtdll/stdio/fgetc.c deleted file mode 100644 index 0852a71f5ad..00000000000 --- a/reactos/lib/crtdll/stdio/fgetc.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib/crtdll/stdio/fgetc.c - * PURPOSE: Get a character string from stdin - * PROGRAMER: Boudewijn Dekker - * UPDATE HISTORY: - * 28/12/98: Appropriated for Reactos - 25/02/99: Added fgetwc - */ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include - -/* - * @implemented - */ -int fgetc(FILE *f) -{ - return getc(f); -} - -/* - * @implemented - */ -wint_t fgetwc(FILE *f) -{ - return getwc(f); -} diff --git a/reactos/lib/crtdll/stdio/fgetchar.c b/reactos/lib/crtdll/stdio/fgetchar.c deleted file mode 100644 index ccf9253a745..00000000000 --- a/reactos/lib/crtdll/stdio/fgetchar.c +++ /dev/null @@ -1,38 +0,0 @@ -/* $Id$ - * - * ReactOS msvcrt library - * - * fgetchar.c - * - * Copyright (C) 2002 Robert Dickenson - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include -#include - -int _fgetchar (void) -{ - return _getch(); -} - -/* - * @implemented - */ -int _fgetwchar (void) -{ - return _getch(); -} diff --git a/reactos/lib/crtdll/stdio/fgetpos.c b/reactos/lib/crtdll/stdio/fgetpos.c deleted file mode 100644 index 94b03b74843..00000000000 --- a/reactos/lib/crtdll/stdio/fgetpos.c +++ /dev/null @@ -1,17 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include - -/* - * @implemented - */ -int fgetpos(FILE *stream, fpos_t *pos) -{ - if (stream && pos) - { - *pos = (fpos_t)ftell(stream); - return 0; - } - //errno = EFAULT; - return 1; -} diff --git a/reactos/lib/crtdll/stdio/fgets.c b/reactos/lib/crtdll/stdio/fgets.c deleted file mode 100644 index c2eaffaa3c8..00000000000 --- a/reactos/lib/crtdll/stdio/fgets.c +++ /dev/null @@ -1,47 +0,0 @@ -/* $Id$ - * - * ReactOS msvcrt library - * - * fgets.c - * - * Copyright (C) 2002 Robert Dickenson - * - * Based on original work Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details - * 28/12/1998: Appropriated for Reactos - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ - -#include -#include - - -char* fgets(char* s, int n, FILE* f) -{ - int c=0; - char *cs; - - cs = s; - while (--n>0 && (c = getc(f)) != EOF) { - *cs++ = c; - if (c == '\n') - break; - } - if (c == EOF && cs == s) - return NULL; - *cs++ = '\0'; - return s; -} diff --git a/reactos/lib/crtdll/stdio/fileno.c b/reactos/lib/crtdll/stdio/fileno.c deleted file mode 100644 index f10681dca5e..00000000000 --- a/reactos/lib/crtdll/stdio/fileno.c +++ /dev/null @@ -1,16 +0,0 @@ -#include - -#undef fileno -int fileno(FILE *f) -{ - return f->_file; -} - - -/* - * @implemented - */ -int _fileno(FILE *f) -{ - return f->_file; -} diff --git a/reactos/lib/crtdll/stdio/fopen.c b/reactos/lib/crtdll/stdio/fopen.c deleted file mode 100644 index 485764190c5..00000000000 --- a/reactos/lib/crtdll/stdio/fopen.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ - -#include -#include -#include -#include -#include - -//might change fopen(file,mode) -> fsopen(file,mode,_SH_DENYNO); - -FILE * __alloc_file(void); - - -/* - * @implemented - */ -FILE* fopen(const char *file, const char *mode) -{ - FILE *f; - int fd, rw, oflags = 0; - char tbchar; - - if (file == 0) - return 0; - if (mode == 0) - return 0; - - f = __alloc_file(); - if (f == NULL) - return NULL; - - rw = (mode[1] == '+') || (mode[1] && (mode[2] == '+')); - - switch (*mode) - { - case 'a': - oflags = O_CREAT | (rw ? O_RDWR : O_WRONLY); - break; - case 'r': - oflags = rw ? O_RDWR : O_RDONLY; - break; - case 'w': - oflags = O_TRUNC | O_CREAT | (rw ? O_RDWR : O_WRONLY); - break; - default: - return (NULL); - } - if (mode[1] == '+') - tbchar = mode[2]; - else - tbchar = mode[1]; - if (tbchar == 't') - oflags |= O_TEXT; - else if (tbchar == 'b') - oflags |= O_BINARY; - else - oflags |= (_fmode & (O_TEXT|O_BINARY)); - - fd = _open(file, oflags, 0666); - if (fd < 0) - return NULL; - -// ms crtdll ensures that writes will end up at the end of file in append mode -// we just move the file pointer to the end of file initially - if (*mode == 'a') - lseek(fd, 0, SEEK_END); - - f->_cnt = 0; - f->_file = fd; - f->_bufsiz = 0; - if (rw) - f->_flag = _IOREAD | _IOWRT; - else if (*mode == 'r') - f->_flag = _IOREAD; - else - f->_flag = _IOWRT; - - f->_base = f->_ptr = NULL; - return f; -} diff --git a/reactos/lib/crtdll/stdio/fprintf.c b/reactos/lib/crtdll/stdio/fprintf.c deleted file mode 100644 index a5589b6de6a..00000000000 --- a/reactos/lib/crtdll/stdio/fprintf.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include - -/* - * @implemented - */ -int -fprintf(register FILE *iop, const char *fmt, ...) -{ - int len; - char localbuf[BUFSIZ]; - va_list a=0; - - - va_start( a, fmt ); - if (iop->_flag & _IONBF) - { - iop->_flag &= ~_IONBF; - iop->_ptr = iop->_base = localbuf; - iop->_bufsiz = BUFSIZ; - len = vfprintf(iop,fmt,a); - fflush(iop); - iop->_flag |= _IONBF; - iop->_base = NULL; - iop->_bufsiz = 0; - iop->_cnt = 0; - } - else - len = vfprintf(iop, fmt, a); - return ferror(iop) ? EOF : len; -} - -/* - * @implemented - */ -int -fwprintf(register FILE *iop, const wchar_t *fmt, ...) -{ - int len; - wchar_t localbuf[BUFSIZ]; - va_list a=0; - - - va_start( a, fmt ); - if (iop->_flag & _IONBF) - { - iop->_flag &= ~_IONBF; - iop->_ptr = iop->_base = (char *)localbuf; - iop->_bufsiz = BUFSIZ; - len = vfwprintf(iop,fmt,a); - fflush(iop); - iop->_flag |= _IONBF; - iop->_base = NULL; - iop->_bufsiz = 0; - iop->_cnt = 0; - } - else - len = vfwprintf(iop, fmt, a); - return ferror(iop) ? EOF : len; -} diff --git a/reactos/lib/crtdll/stdio/fputc.c b/reactos/lib/crtdll/stdio/fputc.c deleted file mode 100644 index f4cd15ef24a..00000000000 --- a/reactos/lib/crtdll/stdio/fputc.c +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include - -/* - * @implemented - */ -int -fputc(int c, FILE *fp) -{ - return putc(c, fp); -} - -/* - * @implemented - */ -wint_t -fputwc(wchar_t c, FILE *fp) -{ - return putwc(c,fp); -} - diff --git a/reactos/lib/crtdll/stdio/fputs.c b/reactos/lib/crtdll/stdio/fputs.c deleted file mode 100644 index e88b5c612d2..00000000000 --- a/reactos/lib/crtdll/stdio/fputs.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ - -#include "precomp.h" -#include -#include -#include - - -/* - * @implemented - */ -int -fputs(const char *s, FILE *f) -{ - - int r = 0; - int c; - int unbuffered; - char localbuf[BUFSIZ]; - - unbuffered = f->_flag & _IONBF; - if (unbuffered) - { - f->_flag &= ~_IONBF; - f->_ptr = f->_base = localbuf; - f->_bufsiz = BUFSIZ; - } - - while ((c = *s++)) - r = putc(c, f); - - if (unbuffered) - { - fflush(f); - f->_flag |= _IONBF; - f->_base = NULL; - f->_bufsiz = 0; - f->_cnt = 0; - } - - return(r); - -} diff --git a/reactos/lib/crtdll/stdio/freopen.c b/reactos/lib/crtdll/stdio/freopen.c deleted file mode 100644 index 09b97d4a544..00000000000 --- a/reactos/lib/crtdll/stdio/freopen.c +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ - -#include -#include -#include -#include -#include - - -/* - * @implemented - */ -FILE *freopen(const char *file, const char *mode, FILE *f) -{ - int fd, rw, oflags=0; - char tbchar; - - if (file == 0 || mode == 0 || f == 0) - return 0; - - rw = (mode[1] == '+'); - - fclose(f); - - switch (*mode) { - case 'a': - oflags = O_CREAT | (rw ? O_RDWR : O_WRONLY); - break; - case 'r': - oflags = rw ? O_RDWR : O_RDONLY; - break; - case 'w': - oflags = O_TRUNC | O_CREAT | (rw ? O_RDWR : O_WRONLY); - break; - default: - return NULL; - } - if (mode[1] == '+') - tbchar = mode[2]; - else - tbchar = mode[1]; - if (tbchar == 't') - oflags |= O_TEXT; - else if (tbchar == 'b') - oflags |= O_BINARY; - else - oflags |= (_fmode & (O_TEXT|O_BINARY)); - - fd = _open(file, oflags, 0666); - if (fd < 0) - return NULL; - - if (*mode == 'a') - lseek(fd, 0, SEEK_END); - - f->_cnt = 0; - f->_file = fd; - f->_bufsiz = 0; - if (rw) - f->_flag = _IOREAD | _IOWRT; - else if (*mode == 'r') - f->_flag = _IOREAD; - else - f->_flag = _IOWRT; - - f->_base = f->_ptr = NULL; - return f; -} diff --git a/reactos/lib/crtdll/stdio/fscanf.c b/reactos/lib/crtdll/stdio/fscanf.c deleted file mode 100644 index fefde0ce436..00000000000 --- a/reactos/lib/crtdll/stdio/fscanf.c +++ /dev/null @@ -1,65 +0,0 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. -This file is part of the GNU C Library. - -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., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - - -#include -#include -#include -#include -#include - - -/* Read formatted input from STREAM according to the format string FORMAT. */ -/* VARARGS2 */ -/* - * @implemented - */ -int fscanf(FILE *stream,const char *format, ...) -{ - va_list arg; - int done; - - va_start(arg, format); - done = __vfscanf(stream, format, arg); - va_end(arg); - - return done; -} - -/* - * @implemented - */ -int -fwscanf(FILE *stream, const wchar_t *fmt, ...) -{ - va_list arg; - int done; - char *cf; - int i,len = wcslen(fmt); - - cf = malloc(len+1); - for(i=0;i -#include -#include -#include -#include - - -/* - * @implemented - */ -int fseek(FILE *f, long offset, int ptrname) -{ - long p = -1; /* can't happen? */ - if ( f == NULL ) { - __set_errno (EINVAL); - return -1; - } - - f->_flag &= ~_IOEOF; - if (!OPEN4WRITING(f)) - { - if (f->_base && !(f->_flag & _IONBF)) - { - p = ftell(f); - if (ptrname == SEEK_CUR) - { - offset += p; - ptrname = SEEK_SET; - } - /* check if the target position is in the buffer and - optimize seek by moving inside the buffer */ - if (ptrname == SEEK_SET && (f->_flag & (_IOUNGETC|_IOREAD|_IOWRT )) == 0 - && p-offset <= f->_ptr-f->_base && offset-p <= f->_cnt) - { - f->_ptr+=offset-p; - f->_cnt+=p-offset; - return 0; - } - } - - p = lseek(fileno(f), offset, ptrname); - f->_cnt = 0; - f->_ptr = f->_base; - f->_flag &= ~_IOUNGETC; - } - else - { - p = fflush(f); - return lseek(fileno(f), offset, ptrname) == -1 || p == EOF ? - -1 : 0; - } - return p==-1 ? -1 : 0; -} diff --git a/reactos/lib/crtdll/stdio/fsetpos.c b/reactos/lib/crtdll/stdio/fsetpos.c deleted file mode 100644 index 9c66fb9a17d..00000000000 --- a/reactos/lib/crtdll/stdio/fsetpos.c +++ /dev/null @@ -1,18 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include - -/* - * @implemented - */ -int fsetpos(FILE *stream,const fpos_t *pos) -{ - if (stream && pos) - { - fseek(stream, (long)(*pos), SEEK_SET); - return 0; - } - __set_errno(EFAULT); - return -1; -} diff --git a/reactos/lib/crtdll/stdio/fsopen.c b/reactos/lib/crtdll/stdio/fsopen.c deleted file mode 100644 index e216c7a0a34..00000000000 --- a/reactos/lib/crtdll/stdio/fsopen.c +++ /dev/null @@ -1,102 +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 - */ -/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ - -#include -#include -#include -#include -#include -#include - - -FILE* __alloc_file(void); - - -/* - * @implemented - */ -FILE* _fsopen(const char* file, const char* mode, int shflag) -{ - FILE* f; - int fd, rw, oflags = 0; - char tbchar; - - int shf; - - if (file == 0) - return 0; - if (mode == 0) - return 0; - - f = __alloc_file(); - if (f == NULL) - return NULL; - - rw = (mode[1] == '+') || (mode[1] && (mode[2] == '+')); - - switch (*mode) - { - case 'a': - oflags = O_CREAT | (rw ? O_RDWR : O_WRONLY); - break; - case 'r': - oflags = rw ? O_RDWR : O_RDONLY; - break; - case 'w': - oflags = O_TRUNC | O_CREAT | (rw ? O_RDWR : O_WRONLY); - break; - default: - return (NULL); - } - if (mode[1] == '+') - tbchar = mode[2]; - else - tbchar = mode[1]; - if (tbchar == 't') - oflags |= O_TEXT; - else if (tbchar == 'b') - oflags |= O_BINARY; - else - oflags |= (_fmode & (O_TEXT|O_BINARY)); - - if ( shflag == _SH_DENYNO ) - shf = _S_IREAD | _S_IWRITE; - else if( shflag == _SH_DENYRD ) - shf = _S_IWRITE; - else if( shflag == _SH_DENYRW ) - shf = 0; - else if( shflag == _SH_DENYWR ) - shf = _S_IREAD; - else - shf = _S_IREAD | _S_IWRITE; - - fd = _open(file, oflags, shf); - if (fd < 0) - return NULL; - -// ms crtdll ensures that writes will end up at the end of file in append mode -// we just move the file pointer to the end of file initially - if (*mode == 'a') - lseek(fd, 0, SEEK_END); - - f->_cnt = 0; - f->_file = fd; - f->_bufsiz = 0; - if (rw) - f->_flag = _IOREAD | _IOWRT; - else if (*mode == 'r') - f->_flag = _IOREAD; - else - f->_flag = _IOWRT; - - f->_base = f->_ptr = NULL; - return f; -} diff --git a/reactos/lib/crtdll/stdio/ftell.c b/reactos/lib/crtdll/stdio/ftell.c deleted file mode 100644 index 25109101fee..00000000000 --- a/reactos/lib/crtdll/stdio/ftell.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ -/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ - -#include -#include -#include -#include -#include - - -/* - * @implemented - */ -long ftell(FILE *f) -{ - long tres; - int adjust=0; - - if (!f) - { - __set_errno(EBADF); - return -1; - } - - if (f->_cnt < 0) - f->_cnt = 0; - else if (f->_flag&_IOREAD) - { - adjust = - f->_cnt; - } - else if (f->_flag&(_IOWRT)) - { - if (f->_base && (f->_flag&_IONBF)==0) - adjust = f->_ptr - f->_base; - } - else - return -1; - - tres = lseek(fileno(f), 0L, SEEK_CUR); - if (tres<0) - return tres; - tres += adjust; - - //f->_cnt = f->_bufsiz - tres; - //f->_ptr = f->_base + tres; - - return tres; -} diff --git a/reactos/lib/crtdll/stdio/fwalk.c b/reactos/lib/crtdll/stdio/fwalk.c deleted file mode 100644 index ef747c1f166..00000000000 --- a/reactos/lib/crtdll/stdio/fwalk.c +++ /dev/null @@ -1,18 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include - - -// not exported by msvcrt or crtdll -__file_rec* __file_rec_list; - -void _fwalk(void (*func)(FILE*)) -{ - __file_rec* fr; - int i; - - for (fr=__file_rec_list; fr; fr=fr->next) - for (i=0; icount; i++) - if (fr->files[i]->_flag) - func(fr->files[i]); -} diff --git a/reactos/lib/crtdll/stdio/getc.c b/reactos/lib/crtdll/stdio/getc.c deleted file mode 100644 index 0b0a1c1c88f..00000000000 --- a/reactos/lib/crtdll/stdio/getc.c +++ /dev/null @@ -1,61 +0,0 @@ -#include "precomp.h" -#include -#include -#include -#include - -//getc can be a macro -#undef getc - -/* - * @implemented - */ -int getc(FILE *fp) -{ - int c = -1; -// check for invalid stream - - if ( !__validfp (fp) ) { - __set_errno(EINVAL); - return EOF; - } -// check for read access on stream - - if ( !OPEN4READING(fp) ) { - __set_errno(EINVAL); - return -1; - } - - if(fp->_cnt > 0) { - fp->_cnt--; - c = (int)(*fp->_ptr++ & 0377); - } - else { - c = _filbuf(fp); - } - return c; -} - -// not exported - -wint_t getwc(FILE *fp) -{ - wint_t c; - - // might check on multi bytes if text mode - - if(fp->_cnt > 0) { - fp->_cnt -= sizeof(wchar_t); - c = *((wchar_t *)(fp->_ptr)); - fp->_ptr += sizeof(wchar_t); - } - else { - c = _filwbuf(fp); - } - - return c; -} - - - - diff --git a/reactos/lib/crtdll/stdio/gets.c b/reactos/lib/crtdll/stdio/gets.c deleted file mode 100644 index c0319655a1e..00000000000 --- a/reactos/lib/crtdll/stdio/gets.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib/crtdll/stdio/gets.c - * PURPOSE: Get a character string from stdin - * PROGRAMER: DJ Delorie - * UPDATE HISTORY: - * 28/12/98: Appropriated for Reactos - */ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include - -/* - * @implemented - */ -char* gets(char* s) -{ - int c; - char *cs; - - cs = s; - while ((c = getchar()) != '\n' && c != EOF) - *cs++ = c; - if (c == EOF && cs==s) - return NULL; - *cs++ = '\0'; - return s; -} - -#if 0 -/* Copyright (C) 1991, 1994, 1995, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. - -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., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include -#include -#include - -link_warning (gets, "the `gets' function is dangerous and should not be used.") - - -/* Read a newline-terminated multibyte string from stdin into S, - removing the trailing newline. Return S or NULL. */ - -char * -gets (s) - char *s; -{ - register char *p = s; - register int c; - FILE *stream = stdin; - int l; - - if (!__validfp (stream) || p == NULL) - { - __set_errno (EINVAL); - return NULL; - } - - if (feof (stream) || ferror (stream)) - return NULL; - - while ((c = getc(stdin)) != EOF) { - if (c == '\n') - break; - if ( isascii(c) ) - *cs++ = c; -#ifdef _MULTIBYTE - else if ( isleadbyte(c) ) { - l = mblen(c); - while(l > 0 ) { - c = getchar(); - if ( isleadbyte(c) || c == EOF ) - return NULL; // encoding error - *cs++ = c; - l--; - } - } -#endif - else - return NULL; // suspicious input - } - - *p = '\0'; - - /* Return null if we had an error, or if we got EOF - before writing any characters. */ - - if (ferror (stream) || (feof (stream) && p == s)) - return NULL; - - return s; -} - -#endif diff --git a/reactos/lib/crtdll/stdio/getw.c b/reactos/lib/crtdll/stdio/getw.c deleted file mode 100644 index bbba2d10263..00000000000 --- a/reactos/lib/crtdll/stdio/getw.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. -This file is part of the GNU C Library. - -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., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include - - -/* - * Read a word (int) from STREAM. - * - * @implemented - */ -int _getw(FILE *stream) -{ - int w; - - /* Is there a better way? */ - if (fread( &w, sizeof(w), 1, stream) != 1) { - // EOF is a legitimate integer value so users must - // check feof or ferror to verify an EOF return. - return(EOF); - } - return(w); -} - diff --git a/reactos/lib/crtdll/stdio/perror.c b/reactos/lib/crtdll/stdio/perror.c deleted file mode 100644 index 0ad0d792428..00000000000 --- a/reactos/lib/crtdll/stdio/perror.c +++ /dev/null @@ -1,19 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include - - -#ifdef perror -#undef perror -void perror(const char *s); -#endif - -/* - * @implemented - */ -void perror(const char *s) -{ - - fprintf(stderr, "%s: %s\n", s, _strerror(NULL)); -} diff --git a/reactos/lib/crtdll/stdio/printf.c b/reactos/lib/crtdll/stdio/printf.c deleted file mode 100644 index 7c39a058739..00000000000 --- a/reactos/lib/crtdll/stdio/printf.c +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - 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 -#include -#include - -/* Write formatted output to stdout from the format string FORMAT. */ -/* VARARGS1 */ -/* - * @implemented - */ -int -printf (const char *format, ...) -{ - va_list arg; - int done; - - va_start (arg, format); - done = vprintf (format, arg); - va_end (arg); - return done; -} - -/* - * @implemented - */ -int -wprintf (const wchar_t *format, ...) -{ - va_list arg; - int done; - - va_start (arg, format); - done = vwprintf (format, arg); - va_end (arg); - return done; -} - -#ifdef USE_IN_LIBIO -# undef _IO_printf -/* This is for libg++. */ -strong_alias (printf, _IO_printf); -#endif - diff --git a/reactos/lib/crtdll/stdio/puts.c b/reactos/lib/crtdll/stdio/puts.c deleted file mode 100644 index aaf26b19eea..00000000000 --- a/reactos/lib/crtdll/stdio/puts.c +++ /dev/null @@ -1,21 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include "precomp.h" -#include -#include -#include - -#undef putchar - - -/* - * @implemented - */ -int puts(const char *s) -{ - int c; - - while ((c = *s++)) - putchar(c); - return putchar('\n'); - -} diff --git a/reactos/lib/crtdll/stdio/putw.c b/reactos/lib/crtdll/stdio/putw.c deleted file mode 100644 index dab2f31ee0c..00000000000 --- a/reactos/lib/crtdll/stdio/putw.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. - * This file is part of the GNU C Library. - * - * 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., 675 Mass Ave, - * Cambridge, MA 02139, USA. */ - - -#include - - -/* - * Write the word (int) W to STREAM. - * - * @implemented - */ -int _putw(int w,FILE *stream) -{ - /* Is there a better way? */ - if (fwrite( &w, sizeof(w), 1, stream) < 1) - return(EOF); - return(0); -} diff --git a/reactos/lib/crtdll/stdio/remove.c b/reactos/lib/crtdll/stdio/remove.c deleted file mode 100644 index c29670089e6..00000000000 --- a/reactos/lib/crtdll/stdio/remove.c +++ /dev/null @@ -1,12 +0,0 @@ -#include "precomp.h" - - -/* - * @implemented - */ -int remove(const char *fn) -{ - if (!DeleteFileA(fn)) - return -1; - return 0; -} diff --git a/reactos/lib/crtdll/stdio/rename.c b/reactos/lib/crtdll/stdio/rename.c deleted file mode 100644 index cb71b6ae788..00000000000 --- a/reactos/lib/crtdll/stdio/rename.c +++ /dev/null @@ -1,18 +0,0 @@ -#include "precomp.h" -#include -#include - - -/* - * @implemented - */ -int rename(const char *old_, const char *new_) -{ - if ( old_ == NULL || new_ == NULL ) - return -1; - - if ( !MoveFileA(old_,new_) ) - return -1; - - return 0; -} diff --git a/reactos/lib/crtdll/stdio/rewind.c b/reactos/lib/crtdll/stdio/rewind.c deleted file mode 100644 index e3b6703e43e..00000000000 --- a/reactos/lib/crtdll/stdio/rewind.c +++ /dev/null @@ -1,18 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ - -#include -#include -#include - - -/* - * @implemented - */ -void rewind(FILE *f) -{ - fflush(f); - lseek(fileno(f), 0L, SEEK_SET); - f->_cnt = 0; - f->_ptr = f->_base; - f->_flag &= ~(_IOERR|_IOEOF|_IOAHEAD); -} diff --git a/reactos/lib/crtdll/stdio/rmtmp.c b/reactos/lib/crtdll/stdio/rmtmp.c deleted file mode 100644 index 69894475007..00000000000 --- a/reactos/lib/crtdll/stdio/rmtmp.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib/crtdll/stdio/rmtmp.c - * PURPOSE: remove temporary files in current directory - * PROGRAMMER: Boudewijn ( ariadne@xs4all.nl) - * UPDATE HISTORY: - * Created 19/01/99 - * NOTE Not tested. - */ - -#include -#include -#include - -#ifndef F_OK - #define F_OK 0x01 -#endif -#ifndef R_OK - #define R_OK 0x02 -#endif -#ifndef W_OK - #define W_OK 0x04 -#endif -#ifndef X_OK - #define X_OK 0x08 -#endif -#ifndef D_OK - #define D_OK 0x10 -#endif - -// should be replace by a closure of the tmp files -extern __file_rec *__file_rec_list; - -int _rmtmp( void ) -{ -/* -loop files and check for name_to_remove -*/ - __file_rec *fr = __file_rec_list; - __file_rec **last_fr = &__file_rec_list; - - int total_closed = 0; - int i = 0; - char temp_name[260]; - - /* Try to find an empty slot */ - while (fr) - { - last_fr = &(fr->next); - - /* If one of the existing slots is available, return it */ - for (i=0; icount; i++) { - if (fr->files[i]->_name_to_remove != NULL) { - if ( _access(fr->files[i]->_name_to_remove,W_OK) ) { - strcpy(temp_name,fr->files[i]->_name_to_remove); - fclose(fr->files[i]); - remove(temp_name); - total_closed++; - } - } - } - - /* If this one is full, go to the next */ - if (fr->count == __FILE_REC_MAX) - fr = fr->next; - else - /* it isn't full, we can add to it */ - break; - } - return total_closed; -} diff --git a/reactos/lib/crtdll/stdio/setbuf.c b/reactos/lib/crtdll/stdio/setbuf.c deleted file mode 100644 index b18dfb588b9..00000000000 --- a/reactos/lib/crtdll/stdio/setbuf.c +++ /dev/null @@ -1,15 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include - -/* - * @implemented - */ -void setbuf(FILE *f, char *buf) -{ - if (buf) - setvbuf(f, buf, _IOFBF, BUFSIZ); - else - setvbuf(f, 0, _IONBF, BUFSIZ); -} diff --git a/reactos/lib/crtdll/stdio/sprintf.c b/reactos/lib/crtdll/stdio/sprintf.c deleted file mode 100644 index 6a020ae06d8..00000000000 --- a/reactos/lib/crtdll/stdio/sprintf.c +++ /dev/null @@ -1,96 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ - -/* Copyright (C) 1991, 1995 Free Software Foundation, Inc. -This file is part of the GNU C Library. - -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., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include -#include -#include -#include -#include - -#undef sprintf -#undef wsprintf -/* - * @implemented - */ -int -sprintf(char *str, const char *fmt, ...) -{ - va_list arg; - int done; - - va_start (arg, fmt); - done = vsprintf (str, fmt, arg); - va_end (arg); - return done; -} - -/* - * @implemented - */ -int -swprintf(wchar_t *str, const wchar_t *fmt, ...) -{ - va_list arg; - int done; - - va_start (arg, fmt); - done = vswprintf (str, fmt, arg); - va_end (arg); - return done; -} - - - -/* Write formatted output into S, according to the format - string FORMAT, writing no more than MAXLEN characters. */ -/* VARARGS3 */ -/* - * @implemented - */ -int -_snprintf (char *s, size_t maxlen,const char *format, ...) -{ - va_list arg; - int done; - - va_start (arg, format); - done = _vsnprintf (s, maxlen, format, arg); - va_end (arg); - - return done; -} - -/* - * @implemented - */ -int -_snwprintf (wchar_t *s, size_t maxlen,const wchar_t *format, ...) -{ - va_list arg; - int done; - - va_start (arg, format); - done = _vsnwprintf (s, maxlen, format, arg); - va_end (arg); - - return done; -} - - diff --git a/reactos/lib/crtdll/stdio/sscanf.c b/reactos/lib/crtdll/stdio/sscanf.c deleted file mode 100644 index 381f91c47fe..00000000000 --- a/reactos/lib/crtdll/stdio/sscanf.c +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - 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 -#include -#include -#include -#include - - -/* Read formatted input from S, according to the format string FORMAT. */ -/* VARARGS2 */ -/* - * @implemented - */ -int sscanf (const char *s,const char *format, ...) -{ - va_list arg; - int done; - - va_start (arg, format); - done = __vsscanf (s, format, arg); - va_end (arg); - - return done; -} - -/* - * @implemented - */ -int swscanf(const wchar_t *str, const wchar_t *fmt, ...) -{ - va_list arg; - int done; - char *f , *s; - int i,len = wcslen(fmt); - - f = malloc(len+1); - for(i=0;i -#include - - -/* - * @unimplemented - */ -char *_tempnam(const char *dir,const char *prefix ) -{ - char *TempFileName = malloc(MAX_PATH); - char *d; - - if ( dir == NULL ) - d = getenv("TMP"); - else - d = (char *)dir; - -#ifdef _MSVCRT_LIB_ // TODO: check on difference? - if (GetTempFileNameA(d, prefix, 1, TempFileName) == 0) { -#else// TODO: FIXME: review which is correct - if (GetTempFileNameA(d, prefix, 0, TempFileName) == 0) { -#endif /*_MSVCRT_LIB_*/ - - free(TempFileName); - return NULL; - } - - return TempFileName; -} diff --git a/reactos/lib/crtdll/stdio/tmpfile.c b/reactos/lib/crtdll/stdio/tmpfile.c deleted file mode 100644 index 76d890d1d08..00000000000 --- a/reactos/lib/crtdll/stdio/tmpfile.c +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ -/* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */ -/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ -/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ - -#include -#include -#include -#include -#include -//#include -#include -#include -#include - - -FILE * __alloc_file(void); - -/* - * @implemented - */ -FILE * -tmpfile(void) -{ - int temp_fd; - FILE *f; - char *temp_name = tmpnam(0); - char *n_t_r = (char *)malloc(L_tmpnam); - - if (!n_t_r) - return 0; - - /* We could have a race condition, whereby another program - (in another virtual machine, or if the temporary file is - in a directory which is shared via a network) opens the - file returned by `tmpnam' between the call above and the - moment when we actually open the file below. This loop - retries the call to `tmpnam' until we actually succeed - to create the file which didn't exist before. */ - do { - // errno = 0; - temp_fd = _open(temp_name, 0, SH_DENYRW); - // if ( errno == ENOENT ) -// break; - } while (temp_fd == -1 && (temp_name = tmpnam(0)) != 0); - - if (temp_name == 0) - return 0; - - /* This should have been fdopen(temp_fd, "wb+"), but `fdopen' - is non-ANSI. So we need to dump some of its guts here. Sigh... */ - f = __alloc_file(); - if (f) - { - f->_file = temp_fd; - f->_cnt = 0; - f->_bufsiz = 0; - f->_flag = _IORMONCL | _IOREAD | _IOWRT; - f->_name_to_remove = n_t_r; - strcpy(f->_name_to_remove, temp_name); - f->_base = f->_ptr = NULL; - } - else - { - close(temp_fd); - remove(temp_name); - free(n_t_r); - } - return f; -} diff --git a/reactos/lib/crtdll/stdio/tmpnam.c b/reactos/lib/crtdll/stdio/tmpnam.c deleted file mode 100644 index e54217192d9..00000000000 --- a/reactos/lib/crtdll/stdio/tmpnam.c +++ /dev/null @@ -1,19 +0,0 @@ -#include "precomp.h" -#include -#include - - -/* - * @implemented - */ -char * tmpnam(char *s) -{ - char PathName[MAX_PATH]; - static char static_buf[MAX_PATH]; - - GetTempPathA(MAX_PATH, PathName); - GetTempFileNameA(PathName, "ARI",007,static_buf); - strcpy(s,static_buf); - - return s; -} diff --git a/reactos/lib/crtdll/stdio/ungetc.c b/reactos/lib/crtdll/stdio/ungetc.c deleted file mode 100644 index 00cc274bc42..00000000000 --- a/reactos/lib/crtdll/stdio/ungetc.c +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include - - -/* - * @implemented - */ -int ungetc(int c, FILE *f) -{ - if (!__validfp (f) || !OPEN4READING(f)) { - __set_errno (EINVAL); - return EOF; - } - - if (c == EOF ) - return EOF; - - if ( f->_ptr == NULL || f->_base == NULL) - return EOF; - - if (f->_ptr == f->_base) - { - if (f->_cnt == 0) - f->_ptr++; - else - return EOF; - } - - f->_cnt++; - f->_ptr--; - if(*f->_ptr != c) - { - f->_flag |= _IOUNGETC; - *f->_ptr = c; - } - return c; -} - - -/* - * @implemented - */ -wint_t -ungetwc(wchar_t c, FILE *f) -{ - if (!__validfp (f) || !OPEN4READING(f)) { - __set_errno (EINVAL); - return EOF; - } - - if (c == (wchar_t)EOF ) - return EOF; - - if ( f->_ptr == NULL || f->_base == NULL) - return EOF; - - if (f->_ptr == f->_base) - { - if (f->_cnt == 0) - f->_ptr+=sizeof(wchar_t); - else - return EOF; - } - - f->_cnt+=sizeof(wchar_t); - f->_ptr-=sizeof(wchar_t); - - f->_flag |= _IOUNGETC; - *((wchar_t *)(f->_ptr)) = c; - - return c; -} diff --git a/reactos/lib/crtdll/stdio/vscanf.c b/reactos/lib/crtdll/stdio/vscanf.c deleted file mode 100644 index 4c6b7968964..00000000000 --- a/reactos/lib/crtdll/stdio/vscanf.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc. -This file is part of the GNU C Library. - -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., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include -#include -#include -#include - - -#undef vscanf - - -/* Read formatted input from stdin according to the format - string in FORMAT, using the argument list in ARG. */ -int __vscanf (const char *format, va_list arg) -{ - return __vfscanf(stdin, format, arg); -} - diff --git a/reactos/lib/crtdll/stdlib/_exit.c b/reactos/lib/crtdll/stdlib/_exit.c deleted file mode 100644 index cb7b5e1a37b..00000000000 --- a/reactos/lib/crtdll/stdlib/_exit.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "precomp.h" -#include -#include -#include -#include - -struct __atexit *__atexit_ptr = 0; - -/* - * @implemented - */ -void exit(int status) -{ - //int i; - struct __atexit *a = __atexit_ptr; - __atexit_ptr = 0; /* to prevent infinite loops */ - while (a) - { - (a->__function)(); - a = a->__next; - } -/* - if (__stdio_cleanup_hook) - __stdio_cleanup_hook(); - for (i=0; i -#include -#include -#include - -char *msg ="Abort\n\r"; - -/* - * @implemented - */ -void abort() -{ - fflush(NULL); - fcloseall(); - raise(SIGABRT); - _write(stderr->_file, msg, sizeof(msg)-1); - exit(3); -} - diff --git a/reactos/lib/crtdll/stdlib/abs.c b/reactos/lib/crtdll/stdlib/abs.c deleted file mode 100644 index 3efdce831fd..00000000000 --- a/reactos/lib/crtdll/stdlib/abs.c +++ /dev/null @@ -1,12 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include - -/* - * @implemented - */ -int -abs(int j) -{ - return j<0 ? -j : j; -} diff --git a/reactos/lib/crtdll/stdlib/atof.c b/reactos/lib/crtdll/stdlib/atof.c deleted file mode 100644 index e3021084b92..00000000000 --- a/reactos/lib/crtdll/stdlib/atof.c +++ /dev/null @@ -1,11 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include - -/* - * @implemented - */ -double -atof(const char *ascii) -{ - return strtod(ascii, 0); -} diff --git a/reactos/lib/crtdll/stdlib/atoi.c b/reactos/lib/crtdll/stdlib/atoi.c deleted file mode 100644 index df6a0c47002..00000000000 --- a/reactos/lib/crtdll/stdlib/atoi.c +++ /dev/null @@ -1,11 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include - -/* - * @implemented - */ -int -atoi(const char *str) -{ - return (int)strtol(str, 0, 10); -} diff --git a/reactos/lib/crtdll/stdlib/atol.c b/reactos/lib/crtdll/stdlib/atol.c deleted file mode 100644 index 663301d95fc..00000000000 --- a/reactos/lib/crtdll/stdlib/atol.c +++ /dev/null @@ -1,11 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include - -/* - * @implemented - */ -long -atol(const char *str) -{ - return strtol(str, 0, 10); -} diff --git a/reactos/lib/crtdll/stdlib/atold.c b/reactos/lib/crtdll/stdlib/atold.c deleted file mode 100644 index c9b511684a4..00000000000 --- a/reactos/lib/crtdll/stdlib/atold.c +++ /dev/null @@ -1,8 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include - -long double -_atold(const char *ascii) -{ - return _strtold(ascii, 0); -} diff --git a/reactos/lib/crtdll/stdlib/bsearch.c b/reactos/lib/crtdll/stdlib/bsearch.c deleted file mode 100644 index 7efbdbd9897..00000000000 --- a/reactos/lib/crtdll/stdlib/bsearch.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include - -/* - * @implemented - */ -void * -bsearch(const void *key, const void *base0, size_t nelem, - size_t size, int (*cmp)(const void *ck, const void *ce)) -{ - char *base = (char *)base0; - int lim, cmpval; - void *p; - - for (lim = nelem; lim != 0; lim >>= 1) - { - p = base + (lim >> 1) * size; - cmpval = (*cmp)(key, p); - if (cmpval == 0) - return p; - if (cmpval > 0) - { /* key > p: move right */ - base = (char *)p + size; - lim--; - } /* else move left */ - } - return 0; -} diff --git a/reactos/lib/crtdll/stdlib/div.c b/reactos/lib/crtdll/stdlib/div.c deleted file mode 100644 index 56b8b4422f8..00000000000 --- a/reactos/lib/crtdll/stdlib/div.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include - -/* - * @implemented - */ -div_t -div(int num, int denom) -{ - div_t r; - - if (num > 0 && denom < 0) { - num = -num; - denom = -denom; - } - r.quot = num / denom; - r.rem = num % denom; - if (num < 0 && denom > 0) - { - if (r.rem > 0) - { - r.quot++; - r.rem -= denom; - } - } - return r; -} diff --git a/reactos/lib/crtdll/stdlib/ecvt.c b/reactos/lib/crtdll/stdlib/ecvt.c deleted file mode 100644 index 940ffb2ed27..00000000000 --- a/reactos/lib/crtdll/stdlib/ecvt.c +++ /dev/null @@ -1,15 +0,0 @@ -/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ -#include -#include - -char *ecvtbuf (double, int, int *, int *, char *); - -/* - * @implemented - */ -char * -_ecvt (double value, int ndigits, int *decpt, int *sign) -{ - static char ecvt_buf[DBL_MAX_10_EXP + 10]; - return ecvtbuf (value, ndigits, decpt, sign, ecvt_buf); -} diff --git a/reactos/lib/crtdll/stdlib/ecvtbuf.c b/reactos/lib/crtdll/stdlib/ecvtbuf.c deleted file mode 100644 index 1d0f65fbba8..00000000000 --- a/reactos/lib/crtdll/stdlib/ecvtbuf.c +++ /dev/null @@ -1,108 +0,0 @@ -/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include -#include -// #include - -void __ecvround (char *, char *, const char *, int *); - -void -__ecvround (char *numbuf, char *last_digit, const char *after_last, int *decpt) -{ - char *p; - int carry = 0; - - /* Do we have at all to round the last digit? */ - if (*after_last > '4') - { - p = last_digit; - carry = 1; - - /* Propagate the rounding through trailing '9' digits. */ - do { - int sum = *p + carry; - carry = sum > '9'; - *p-- = sum - carry * 10; - } while (carry && p >= numbuf); - - /* We have 9999999... which needs to be rounded to 100000.. */ - if (carry && p == numbuf) - { - *p = '1'; - *decpt += 1; - } - } -} - -char * -ecvtbuf (double value, int ndigits, int *decpt, int *sign, char *buf) -{ - static char INFINITY[] = "Infinity"; - char decimal = '.' /* localeconv()->decimal_point[0] */; - char *cvtbuf = (char *)alloca (ndigits + 20); /* +3 for sign, dot, null; */ - /* two extra for rounding */ - /* 15 extra for alignment */ - char *s = cvtbuf, *d = buf; - - /* Produce two extra digits, so we could round properly. */ - sprintf (cvtbuf, "%-+.*E", ndigits + 2, value); - *decpt = 0; - - /* The sign. */ - if (*s++ == '-') - *sign = 1; - else - *sign = 0; - - /* Special values get special treatment. */ - if (strncmp (s, "Inf", 3) == 0) - { - /* SunOS docs says we have return "Infinity" for NDIGITS >= 8. */ - memcpy (buf, INFINITY, ndigits >= 8 ? 9 : 3); - if (ndigits < 8) - buf[3] = '\0'; - } - else if (strcmp (s, "NaN") == 0) - memcpy (buf, s, 4); - else - { - char *last_digit, *digit_after_last; - - /* Copy (the single) digit before the decimal. */ - while (*s && *s != decimal && d - buf < ndigits) - *d++ = *s++; - - /* If we don't see any exponent, here's our decimal point. */ - *decpt = d - buf; - if (*s) - s++; - - /* Copy the fraction digits. */ - while (*s && *s != 'E' && d - buf < ndigits) - *d++ = *s++; - - /* Remember the last digit copied and the one after it. */ - last_digit = d > buf ? d - 1 : d; - digit_after_last = s; - - /* Get past the E in exponent field. */ - while (*s && *s++ != 'E') - ; - - /* Adjust the decimal point by the exponent value. */ - *decpt += atoi (s); - - /* Pad with zeroes if needed. */ - while (d - buf < ndigits) - *d++ = '0'; - - /* Zero-terminate. */ - *d = '\0'; - - /* Round if necessary. */ - __ecvround (buf, last_digit, digit_after_last, decpt); - } - return buf; -} diff --git a/reactos/lib/crtdll/stdlib/fcvt.c b/reactos/lib/crtdll/stdlib/fcvt.c deleted file mode 100644 index 423b7f2380d..00000000000 --- a/reactos/lib/crtdll/stdlib/fcvt.c +++ /dev/null @@ -1,15 +0,0 @@ -/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ -#include -#include - -char *fcvtbuf (double, int, int *, int *, char *); - -/* - * @implemented - */ -char * -_fcvt (double value, int ndigits, int *decpt, int *sign) -{ - static char fcvt_buf[2 * DBL_MAX_10_EXP + 10]; - return fcvtbuf (value, ndigits, decpt, sign, fcvt_buf); -} diff --git a/reactos/lib/crtdll/stdlib/fcvtbuf.c b/reactos/lib/crtdll/stdlib/fcvtbuf.c deleted file mode 100644 index 2bf85aa6483..00000000000 --- a/reactos/lib/crtdll/stdlib/fcvtbuf.c +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include -#include -// #include - -void __ecvround (char *, char *, const char *, int *); -char *ecvtbuf (double, int, int *, int *, char *); - -char * -fcvtbuf (double value, int ndigits, int *decpt, int *sign, char *buf) -{ - static char INFINITY[] = "Infinity"; - char decimal = '.' /* localeconv()->decimal_point[0] */; - int digits = ndigits >= 0 ? ndigits : 0; - char *cvtbuf = (char *)alloca (2*DBL_MAX_10_EXP + 16); - char *s = cvtbuf; - char *dot; - - sprintf (cvtbuf, "%-+#.*f", DBL_MAX_10_EXP + digits + 1, value); - - /* The sign. */ - if (*s++ == '-') - *sign = 1; - else - *sign = 0; - - /* Where's the decimal point? */ - dot = strchr (s, decimal); - *decpt = dot ? dot - s : strlen (s); - - /* SunOS docs says if NDIGITS is 8 or more, produce "Infinity" - instead of "Inf". */ - if (strncmp (s, "Inf", 3) == 0) - { - memcpy (buf, INFINITY, ndigits >= 8 ? 9 : 3); - if (ndigits < 8) - buf[3] = '\0'; - return buf; - } - else if (ndigits < 0) - return ecvtbuf (value, *decpt + ndigits, decpt, sign, buf); - else if (*s == '0' && value != 0.0) - return ecvtbuf (value, ndigits, decpt, sign, buf); - else - { - memcpy (buf, s, *decpt); - if (s[*decpt] == decimal) - { - memcpy (buf + *decpt, s + *decpt + 1, ndigits); - buf[*decpt + ndigits] = '\0'; - } - else - buf[*decpt] = '\0'; - __ecvround (buf, buf + *decpt + ndigits - 1, - s + *decpt + ndigits + 1, decpt); - return buf; - } -} diff --git a/reactos/lib/crtdll/stdlib/gcvt.c b/reactos/lib/crtdll/stdlib/gcvt.c deleted file mode 100644 index c077566c83a..00000000000 --- a/reactos/lib/crtdll/stdlib/gcvt.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include - -/* - * @implemented - */ -char * -_gcvt (double value, int ndigits, char *buf) -{ - char *p = buf; - - sprintf (buf, "%-#.*g", ndigits, value); - - /* It seems they expect us to return .XXXX instead of 0.XXXX */ - if (*p == '-') - p++; - if (*p == '0' && p[1] == '.') - memmove (p, p + 1, strlen (p + 1) + 1); - - /* They want Xe-YY, not X.e-YY, and XXXX instead of XXXX. */ - p = strchr (buf, 'e'); - if (!p) - { - p = buf + strlen (buf); - /* They don't want trailing zeroes. */ - while (p[-1] == '0' && p > buf + 2) - *--p = '\0'; - } - if (p > buf && p[-1] == '.') - memmove (p - 1, p, strlen (p) + 1); - return buf; -} diff --git a/reactos/lib/crtdll/stdlib/labs.c b/reactos/lib/crtdll/stdlib/labs.c deleted file mode 100644 index 8c1d3fff3f0..00000000000 --- a/reactos/lib/crtdll/stdlib/labs.c +++ /dev/null @@ -1,12 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include - -/* - * @implemented - */ -long -labs(long j) -{ - return j<0 ? -j : j; -} diff --git a/reactos/lib/crtdll/stdlib/ldiv.c b/reactos/lib/crtdll/stdlib/ldiv.c deleted file mode 100644 index a40597d0e95..00000000000 --- a/reactos/lib/crtdll/stdlib/ldiv.c +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include - -/* - * @implemented - */ -ldiv_t -ldiv(long num, long denom) -{ - ldiv_t r; - - if (num > 0 && denom < 0) - { - num = -num; - denom = -denom; - } - r.quot = num / denom; - r.rem = num % denom; - if (num < 0 && denom > 0) - { - if (r.rem > 0) - { - r.quot++; - r.rem -= denom; - } - } - return r; -} diff --git a/reactos/lib/crtdll/stdlib/obsol.c b/reactos/lib/crtdll/stdlib/obsol.c deleted file mode 100644 index 48e465fc2d0..00000000000 --- a/reactos/lib/crtdll/stdlib/obsol.c +++ /dev/null @@ -1,33 +0,0 @@ -#include "precomp.h" -#include - -#undef _cpumode -unsigned char _cpumode = 0; -unsigned char *_cpumode_dll = &_cpumode; - -/* - * @implemented - */ -void _seterrormode(int nMode) -{ - SetErrorMode(nMode); - return; -} - -/* - * @implemented - */ -void _beep(unsigned nFreq, unsigned nDur) -{ - Beep(nFreq,nDur); - return; -} - -/* - * @implemented - */ -void _sleep(unsigned long ulTime) -{ - Sleep(ulTime); - return; -} diff --git a/reactos/lib/crtdll/stdlib/rot.c b/reactos/lib/crtdll/stdlib/rot.c deleted file mode 100644 index a5b46543e47..00000000000 --- a/reactos/lib/crtdll/stdlib/rot.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib/crtdll/stdlib/rot.c - * PURPOSE: Performs a bit wise rotation - * PROGRAMER: Boudewijn Dekker - * UPDATE HISTORY: - * 03/04/99: Created - */ - -#include -#include - -/* - * @implemented - */ -unsigned int _rotl( unsigned int value, int shift ) -{ - int max_bits = sizeof(unsigned int)<<3; - if ( shift < 0 ) - return _rotr(value,-shift); - - if ( shift > max_bits ) - shift = shift % max_bits; - return (value << shift) | (value >> (max_bits-shift)); -} - -/* - * @implemented - */ -unsigned int _rotr( unsigned int value, int shift ) -{ - int max_bits = sizeof(unsigned int)<<3; - if ( shift < 0 ) - return _rotl(value,-shift); - - if ( shift > max_bits<<3 ) - shift = shift % max_bits; - return (value >> shift) | (value << (max_bits-shift)); -} - - -/* - * @implemented - */ -unsigned long _lrotl( unsigned long value, int shift ) -{ - int max_bits = sizeof(unsigned long)<<3; - if ( shift < 0 ) - return _lrotr(value,-shift); - - if ( shift > max_bits ) - shift = shift % max_bits; - return (value << shift) | (value >> (max_bits-shift)); -} - -/* - * @implemented - */ -unsigned long _lrotr( unsigned long value, int shift ) -{ - int max_bits = sizeof(unsigned long)<<3; - if ( shift < 0 ) - return _lrotl(value,-shift); - - if ( shift > max_bits ) - shift = shift % max_bits; - return (value >> shift) | (value << (max_bits-shift)); -} diff --git a/reactos/lib/crtdll/stdlib/senv.c b/reactos/lib/crtdll/stdlib/senv.c deleted file mode 100644 index 918c9ce107f..00000000000 --- a/reactos/lib/crtdll/stdlib/senv.c +++ /dev/null @@ -1,36 +0,0 @@ -#include "precomp.h" -#include -#include - -#define NDEBUG -#include - - -/* - * @implemented - */ -void _searchenv(const char *file,const char *var,char *path ) -{ - char *env = getenv(var); - char *x; - char *y; - char *FilePart; - - DPRINT("_searchenv()\n"); - - x = strchr(env,'='); - if ( x != NULL ) { - *x = 0; - x++; - } - y = strchr(env,';'); - while ( y != NULL ) { - *y = 0; - if ( SearchPathA(x,file,NULL,MAX_PATH,path,&FilePart) > 0 ) { - return; - } - x = y+1; - y = strchr(env,';'); - } - return; -} diff --git a/reactos/lib/crtdll/stdlib/strtod.c b/reactos/lib/crtdll/stdlib/strtod.c deleted file mode 100644 index 29d936ebdd0..00000000000 --- a/reactos/lib/crtdll/stdlib/strtod.c +++ /dev/null @@ -1,100 +0,0 @@ -/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ - -#include - - -/* - * @implemented - */ -double -strtod(const char *s, char **sret) -{ - long double r; /* result */ - int e; /* exponent */ - long double d; /* scale */ - int sign; /* +- 1.0 */ - int esign; - int i; - int flags=0; - - r = 0.0; - sign = 1; - e = 0; - esign = 1; - - while ((*s == ' ') || (*s == '\t')) - s++; - - if (*s == '+') - s++; - else if (*s == '-') - { - sign = -1; - s++; - } - - while ((*s >= '0') && (*s <= '9')) - { - flags |= 1; - r *= 10.0; - r += *s - '0'; - s++; - } - - if (*s == '.') - { - d = 0.1L; - s++; - while ((*s >= '0') && (*s <= '9')) - { - flags |= 2; - r += d * (*s - '0'); - s++; - d *= 0.1L; - } - } - - if (flags == 0) - { - if (sret) - *sret = (char *)s; - return 0; - } - - if ((*s == 'e') || (*s == 'E')) - { - s++; - if (*s == '+') - s++; - else if (*s == '-') - { - s++; - esign = -1; - } - if ((*s < '0') || (*s > '9')) - { - if (sret) - *sret = (char *)s; - return r; - } - - while ((*s >= '0') && (*s <= '9')) - { - e *= 10; - e += *s - '0'; - s++; - } - } - - if (esign < 0) - for (i = 1; i <= e; i++) - r *= 0.1L; - else - for (i = 1; i <= e; i++) - r *= 10.0; - - if (sret) - *sret = (char *)s; - return r * sign; -} diff --git a/reactos/lib/crtdll/stdlib/strtol.c b/reactos/lib/crtdll/stdlib/strtol.c deleted file mode 100644 index 0ae10c9b6e3..00000000000 --- a/reactos/lib/crtdll/stdlib/strtol.c +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include - - -/* - * @implemented - */ -long -strtol(const char *nptr, char **endptr, int base) -{ - const char *s = nptr; - unsigned long acc; - int c; - unsigned long cutoff; - int neg = 0, any, cutlim; - - /* - * Skip white space and pick up leading +/- sign if any. - * If base is 0, allow 0x for hex and 0 for octal, else - * assume decimal; if base is already 16, allow 0x. - */ - do { - c = *s++; - } while (isspace(c)); - if (c == '-') - { - neg = 1; - c = *s++; - } - else if (c == '+') - c = *s++; - if ((base == 0 || base == 16) && - c == '0' && (*s == 'x' || *s == 'X')) - { - c = s[1]; - s += 2; - base = 16; - } - if (base == 0) - base = c == '0' ? 8 : 10; - - /* - * Compute the cutoff value between legal numbers and illegal - * numbers. That is the largest legal value, divided by the - * base. An input number that is greater than this value, if - * followed by a legal input character, is too big. One that - * is equal to this value may be valid or not; the limit - * between valid and invalid numbers is then based on the last - * digit. For instance, if the range for longs is - * [-2147483648..2147483647] and the input base is 10, - * cutoff will be set to 214748364 and cutlim to either - * 7 (neg==0) or 8 (neg==1), meaning that if we have accumulated - * a value > 214748364, or equal but the next digit is > 7 (or 8), - * the number is too big, and we will return a range error. - * - * Set any if any `digits' consumed; make it negative to indicate - * overflow. - */ - cutoff = neg ? -(unsigned long)LONG_MIN : LONG_MAX; - cutlim = cutoff % (unsigned long)base; - cutoff /= (unsigned long)base; - for (acc = 0, any = 0;; c = *s++) - { - if (isdigit(c)) - c -= '0'; - else if (isalpha(c)) - c -= isupper(c) ? 'A' - 10 : 'a' - 10; - else - break; - if (c >= base) - break; - if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) - any = -1; - else - { - any = 1; - acc *= base; - acc += c; - } - } - if (any < 0) - { - acc = neg ? LONG_MIN : LONG_MAX; - __set_errno(ERANGE); - } - else if (neg) - acc = -acc; - if (endptr != 0) - *endptr = any ? (char *)s - 1 : (char *)nptr; - return acc; -} diff --git a/reactos/lib/crtdll/stdlib/strtold.c b/reactos/lib/crtdll/stdlib/strtold.c deleted file mode 100644 index 2cdc6ec3c71..00000000000 --- a/reactos/lib/crtdll/stdlib/strtold.c +++ /dev/null @@ -1,126 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -//#include - -static double powten[] = -{ - 1e1L, 1e2L, 1e4L, 1e8L, 1e16L, 1e32L, 1e64L, 1e128L, 1e256L, -#ifdef __GNUC__ - 1e512L, 1e512L*1e512L, 1e2048L, 1e4096L -#else - 1e256L, 1e256L, 1e256L, 1e256L -#endif -}; - -long double -_strtold(const char *s, char **sret) -{ - double r; /* result */ - int e, ne; /* exponent */ - int sign; /* +- 1.0 */ - int esign; - int flags=0; - int l2powm1; - - r = 0.0L; - sign = 1; - e = ne = 0; - esign = 1; - - while(*s && isspace(*s)) - s++; - - if (*s == '+') - s++; - else if (*s == '-') - { - sign = -1; - s++; - } - - while ((*s >= '0') && (*s <= '9')) - { - flags |= 1; - r *= 10.0L; - r += *s - '0'; - s++; - } - - if (*s == '.') - { - s++; - while ((*s >= '0') && (*s <= '9')) - { - flags |= 2; - r *= 10.0L; - r += *s - '0'; - s++; - ne++; - } - } - if (flags == 0) - { - if (sret) - *sret = (char *)s; - return 0.0L; - } - - if ((*s == 'e') || (*s == 'E')) - { - s++; - if (*s == '+') - s++; - else if (*s == '-') - { - s++; - esign = -1; - } - while ((*s >= '0') && (*s <= '9')) - { - e *= 10; - e += *s - '0'; - s++; - } - } - if (esign < 0) - { - esign = -esign; - e = -e; - } - e = e - ne; - if (e < -4096) - { - /* possibly subnormal number, 10^e would overflow */ - r *= 1.0e-2048L; - e += 2048; - } - if (e < 0) - { - e = -e; - esign = -esign; - } - if (e >= 8192) - e = 8191; - if (e) - { - double d = 1.0L; - l2powm1 = 0; - while (e) - { - if (e & 1) - d *= powten[l2powm1]; - e >>= 1; - l2powm1++; - } - if (esign > 0) - r *= d; - else - r /= d; - } - if (sret) - *sret = (char *)s; - return r * sign; - - return 0; -} diff --git a/reactos/lib/crtdll/stdlib/strtoll.c b/reactos/lib/crtdll/stdlib/strtoll.c deleted file mode 100644 index b609e79d233..00000000000 --- a/reactos/lib/crtdll/stdlib/strtoll.c +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include -//#include - -/* constants used in Solaris */ -#define LLONG_MIN -9223372036854775807L-1L -#define LLONG_MAX 9223372036854775807L -#define ULLONG_MAX 18446744073709551615UL - -long -strtoll(const char *nptr, char **endptr, int base) -{ - const char *s = nptr; - unsigned long acc; - int c; - unsigned long cutoff; - int neg = 0, any, cutlim; - - /* - * See strtol for comments as to the logic used. - */ - do { - c = *s++; - } while (isspace(c)); - if (c == '-') - { - neg = 1; - c = *s++; - } - else if (c == '+') - c = *s++; - if ((base == 0 || base == 16) && - c == '0' && (*s == 'x' || *s == 'X')) - { - c = s[1]; - s += 2; - base = 16; - } - if (base == 0) - base = c == '0' ? 8 : 10; - -/* to prevent overflow, we take max-1 and add 1 after division */ - cutoff = neg ? -(LLONG_MIN+1) : LLONG_MAX-1; - cutlim = cutoff % base; - cutoff /= base; - if (++cutlim == base) - { - cutlim = 0; - cutoff++; - } - for (acc = 0, any = 0;; c = *s++) - { - if (isdigit(c)) - c -= '0'; - else if (isalpha(c)) - c -= isupper(c) ? 'A' - 10 : 'a' - 10; - else - break; - if (c >= base) - break; - if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) - any = -1; - else - { - any = 1; - acc *= base; - acc += c; - } - } - if (any < 0) - { - acc = neg ? LLONG_MIN : LLONG_MAX; - errno = ERANGE; - } - else if (neg) - acc *= -1; - if (endptr != 0) - *endptr = any ? (char *)s - 1 : (char *)nptr; - return acc; -} diff --git a/reactos/lib/crtdll/stdlib/strtoul.c b/reactos/lib/crtdll/stdlib/strtoul.c deleted file mode 100644 index 63ee96adcc1..00000000000 --- a/reactos/lib/crtdll/stdlib/strtoul.c +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include - -/* - * Convert a string to an unsigned long integer. - * - * Ignores `locale' stuff. Assumes that the upper and lower case - * alphabets and digits are each contiguous. - * - * @implemented - */ -unsigned long -strtoul(const char *nptr, char **endptr, int base) -{ - const char *s = nptr; - unsigned long acc; - int c; - unsigned long cutoff; - int neg = 0, any, cutlim; - - /* - * See strtol for comments as to the logic used. - */ - do { - c = *s++; - } while (isspace(c)); - if (c == '-') - { - neg = 1; - c = *s++; - } - else if (c == '+') - c = *s++; - if ((base == 0 || base == 16) && - c == '0' && (*s == 'x' || *s == 'X')) - { - c = s[1]; - s += 2; - base = 16; - } - if (base == 0) - base = c == '0' ? 8 : 10; - cutoff = (unsigned long)ULONG_MAX / (unsigned long)base; - cutlim = (unsigned long)ULONG_MAX % (unsigned long)base; - for (acc = 0, any = 0;; c = *s++) - { - if (isdigit(c)) - c -= '0'; - else if (isalpha(c)) - c -= isupper(c) ? 'A' - 10 : 'a' - 10; - else - break; - if (c >= base) - break; - if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) - any = -1; - else { - any = 1; - acc *= base; - acc += c; - } - } - if (any < 0) - { - acc = ULONG_MAX; - __set_errno(ERANGE); - } - else if (neg) - acc = -acc; - if (endptr != 0) - *endptr = any ? (char *)s - 1 : (char *)nptr; - return acc; -} diff --git a/reactos/lib/crtdll/sys_stat/futime.c b/reactos/lib/crtdll/sys_stat/futime.c deleted file mode 100644 index 4fe2137bb88..00000000000 --- a/reactos/lib/crtdll/sys_stat/futime.c +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - - -/* - * @implemented - */ -int _futime(int nHandle, struct _utimbuf* pTimes) -{ - FILETIME LastAccessTime; - FILETIME LastWriteTime; - - // check for stdin / stdout handles ?? - if (nHandle == -1) { - __set_errno(EBADF); - return -1; - } - - if (pTimes == NULL) { - pTimes = alloca(sizeof(struct _utimbuf)); - time(&pTimes->actime); - time(&pTimes->modtime); - } - - if (pTimes->actime < pTimes->modtime) { - __set_errno(EINVAL); - return -1; - } - - UnixTimeToFileTime(pTimes->actime, &LastAccessTime, 0); - UnixTimeToFileTime(pTimes->modtime, &LastWriteTime, 0); - if (!SetFileTime(_get_osfhandle(nHandle), NULL, &LastAccessTime, &LastWriteTime)) { - __set_errno(EBADF); - return -1; - } - - return 0; -} diff --git a/reactos/lib/crtdll/sys_stat/systime.c b/reactos/lib/crtdll/sys_stat/systime.c deleted file mode 100644 index 0fa73435a99..00000000000 --- a/reactos/lib/crtdll/sys_stat/systime.c +++ /dev/null @@ -1,70 +0,0 @@ -#include "precomp.h" -#include - - -int month[12] = { 31,28,31,30,31,30,31,31,30,31,30,31}; - -/* - * @unimplemented - */ -unsigned int _getsystime(struct tm* tp) -{ - SYSTEMTIME Time; - int i; - - GetLocalTime(&Time); - - tp->tm_year = Time.wYear - 1900; - tp->tm_mon = Time.wMonth - 1; - tp->tm_wday = Time.wDayOfWeek; - tp->tm_mday = Time.wDay; - tp->tm_hour = Time.wHour; - tp->tm_min = Time.wMinute; - tp->tm_sec = Time.wSecond; - - tp->tm_isdst = -1; - - //FIXME GetTimeZoneInformation currently not in kernel32 - - //TimeZoneId = GetTimeZoneInformation(&TimeZoneInformation ); - //if ( TimeZoneId == TIME_ZONE_ID_DAYLIGHT ) { - // tp->tm_isdst = 1; - //} - //else - // tp->tm_isdst = 0; - - if (tp->tm_year % 4 == 0) { - if (tp->tm_year % 100 != 0) - tp->tm_yday = 1; - else if ((tp->tm_year-100) % 1000 == 0) - tp->tm_yday = 1; - } - - for (i = 0; i <= tp->tm_mon; i++) - tp->tm_yday += month[i]; - - return Time.wMilliseconds; -} - - -/* - * @implemented - */ -unsigned int _setsystime(struct tm* tp, unsigned int ms) -{ - SYSTEMTIME Time; - - Time.wYear = tp->tm_year + 1900; - Time.wMonth = tp->tm_mon + 1; - Time.wDayOfWeek = tp->tm_wday; - Time.wDay = tp->tm_mday; - Time.wHour = tp->tm_hour; - Time.wMinute = tp->tm_min; - Time.wSecond = tp->tm_sec; - Time.wMilliseconds = ms; - - if (!SetLocalTime(&Time)) - return -1; - - return 0; -} diff --git a/reactos/lib/crtdll/time/clock.c b/reactos/lib/crtdll/time/clock.c deleted file mode 100644 index 4ad606c8ffc..00000000000 --- a/reactos/lib/crtdll/time/clock.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib/crtdll/time/clock.c - * PURPOSE: Get elapsed time - * PROGRAMER: Boudewijn Dekker - * UPDATE HISTORY: - * 28/12/98: Created - */ - -#include "precomp.h" -#include -#include - -VOID STDCALL GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime ); - -/* - * @implemented - */ -clock_t clock ( void ) -{ - FILETIME CreationTime; - FILETIME ExitTime; - FILETIME KernelTime; - FILETIME UserTime; - DWORD Remainder; - - if (!GetProcessTimes(GetCurrentProcess(),&CreationTime,&ExitTime,&KernelTime,&UserTime)) - return -1; - - return FileTimeToUnixTime(&KernelTime,&Remainder) + FileTimeToUnixTime(&UserTime,&Remainder); -} diff --git a/reactos/lib/crtdll/time/difftime.c b/reactos/lib/crtdll/time/difftime.c deleted file mode 100644 index 9e9d590a2cb..00000000000 --- a/reactos/lib/crtdll/time/difftime.c +++ /dev/null @@ -1,11 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include - -/* - * @implemented - */ -double -difftime(time_t time1, time_t time0) -{ - return time1-time0; -} diff --git a/reactos/lib/crtdll/time/posixrul.h b/reactos/lib/crtdll/time/posixrul.h deleted file mode 100644 index 48c5ceeab0d..00000000000 --- a/reactos/lib/crtdll/time/posixrul.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -/* generated with bin2h from DJGPP/zoneinfo/posixrules */ - -unsigned char _posixrules_data[] = { -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0, -0,1,16,0,0,0,2,0,0,0,8,0,151,254,240,1,135,225,224,2,119,224,240,3,112,254,96,4,96,253,112,5,80, -224,96,6,64,223,112,7,48,194,96,7,141,25,112,9,16,164,96,9,173,148,240,10,240,134,96,11,224,133,112,12,217,162, -224,13,192,103,112,14,185,132,224,15,169,131,240,16,153,102,224,17,137,101,240,18,121,72,224,19,105,71,240,20,89,42,224, -21,73,41,240,22,57,12,224,23,41,11,240,24,34,41,96,25,8,237,240,26,2,11,96,26,242,10,112,27,225,237,96,28, -209,236,112,29,193,207,96,30,177,206,112,31,161,177,96,32,118,0,240,33,129,147,96,34,85,226,240,35,106,175,224,36,53, -196,240,37,74,145,224,38,21,166,240,39,42,115,224,39,254,195,112,41,10,85,224,41,222,165,112,42,234,55,224,43,190,135, -112,44,211,84,96,45,158,105,112,46,179,54,96,47,126,75,112,48,147,24,96,49,103,103,240,50,114,250,96,51,71,73,240, -52,82,220,96,53,39,43,240,54,50,190,96,55,7,13,240,56,27,218,224,56,230,239,240,57,251,188,224,58,198,209,240,59, -219,158,224,60,175,238,112,61,187,128,224,62,143,208,112,63,155,98,224,64,111,178,112,65,132,127,96,66,79,148,112,67,100, -97,96,68,47,118,112,69,68,67,96,70,15,88,112,71,36,37,96,71,248,116,240,73,4,7,96,73,216,86,240,74,227,233, -96,75,184,56,240,76,205,5,224,77,152,26,240,78,172,231,224,79,119,252,240,80,140,201,224,81,97,25,112,82,108,171,224, -83,64,251,112,84,76,141,224,85,32,221,112,86,44,111,224,87,0,191,112,88,21,140,96,88,224,161,112,89,245,110,96,90, -192,131,112,91,213,80,96,92,169,159,240,93,181,50,96,94,137,129,240,95,149,20,96,96,105,99,240,97,126,48,224,98,73, -69,240,99,94,18,224,100,41,39,240,101,61,244,224,102,18,68,112,103,29,214,224,103,242,38,112,104,253,184,224,105,210,8, -112,106,221,154,224,107,177,234,112,108,198,183,96,109,145,204,112,110,166,153,96,111,113,174,112,112,134,123,96,113,90,202,240, -114,102,93,96,115,58,172,240,116,70,63,96,117,26,142,240,118,47,91,224,118,250,112,240,120,15,61,224,120,218,82,240,121, -239,31,224,122,186,52,240,123,207,1,224,124,163,81,112,125,174,227,224,126,131,51,112,127,142,197,224,128,99,21,112,129,119, -226,96,130,66,247,112,131,87,196,96,132,34,217,112,133,55,166,96,134,11,245,240,135,23,136,96,135,235,215,240,136,247,106, -96,137,203,185,240,138,215,76,96,139,171,155,240,140,192,104,224,141,139,125,240,142,160,74,224,143,107,95,240,144,128,44,224, -145,84,124,112,146,96,14,224,147,52,94,112,148,63,240,224,149,20,64,112,150,41,13,96,150,244,34,112,152,8,239,96,152, -212,4,112,153,232,209,96,154,189,32,240,155,200,179,96,156,157,2,240,157,168,149,96,158,124,228,240,159,136,119,96,160,92, -198,240,161,113,147,224,162,60,168,240,163,81,117,224,164,28,138,240,165,49,87,224,166,5,167,112,167,17,57,224,167,229,137, -112,168,241,27,224,169,197,107,112,170,218,56,96,171,165,77,112,172,186,26,96,173,133,47,112,174,153,252,96,175,101,17,112, -176,121,222,96,177,78,45,240,178,89,192,96,179,46,15,240,180,57,162,96,181,13,241,240,182,34,190,224,182,237,211,240,184, -2,160,224,184,205,181,240,185,226,130,224,186,182,210,112,187,194,100,224,188,150,180,112,189,162,70,224,190,118,150,112,191,130, -40,224,192,86,120,112,193,107,69,96,194,54,90,112,195,75,39,96,196,22,60,112,197,43,9,96,197,255,88,240,199,10,235, -96,199,223,58,240,200,234,205,96,201,191,28,240,202,211,233,224,203,158,254,240,204,179,203,224,205,126,224,240,206,147,173,224, -207,103,253,112,208,115,143,224,209,71,223,112,210,83,113,224,211,39,193,112,212,51,83,224,213,7,163,112,214,28,112,96,214, -231,133,112,215,252,82,96,216,199,103,112,217,220,52,96,218,176,131,240,219,188,22,96,220,144,101,240,221,155,248,96,222,112, -71,240,223,133,20,224,224,80,41,240,225,100,246,224,226,48,11,240,227,68,216,224,228,15,237,240,229,36,186,224,229,249,10, -112,231,4,156,224,231,216,236,112,232,228,126,224,233,184,206,112,234,205,155,96,235,152,176,112,236,173,125,96,237,120,146,112, -238,141,95,96,239,97,174,240,240,109,65,96,241,65,144,240,242,77,35,96,243,33,114,240,244,45,5,96,245,1,84,240,246, -22,33,224,246,225,54,240,247,246,3,224,248,193,24,240,249,213,229,224,250,160,250,240,251,181,199,224,252,138,23,112,253,149, -169,224,254,105,249,112,255,117,139,224,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0, -1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1, -0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0, -1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1, -0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0, -1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1, -0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0, -1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1, -0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,255,255,199,192,1,0,255,255,185,176,0,4,69,68,84, -0,69,83,84,0,0,0 -}; diff --git a/reactos/lib/crtdll/time/strdate.c b/reactos/lib/crtdll/time/strdate.c deleted file mode 100644 index 17df993483a..00000000000 --- a/reactos/lib/crtdll/time/strdate.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib/crtdll/time/strtime.c - * PURPOSE: Fills a buffer with a formatted date representation - * PROGRAMER: Boudewijn Dekker - * UPDATE HISTORY: - * 28/12/98: Created - */ -#include -#include -#include -#include - - -/* - * @implemented - */ -char *_strdate( const char *datestr ) -{ - time_t t; - struct tm *d; - char *dt = (char *)datestr; - - if ( datestr == NULL ){ - __set_errno(EINVAL); - return NULL; - } - t = time(NULL); - d = localtime(&t); - sprintf(dt,"%d/%d/%d",d->tm_mday,d->tm_mon+1,d->tm_year); - return dt; -} diff --git a/reactos/lib/crtdll/time/strftime.c b/reactos/lib/crtdll/time/strftime.c deleted file mode 100644 index 0f5c3b61b3c..00000000000 --- a/reactos/lib/crtdll/time/strftime.c +++ /dev/null @@ -1,260 +0,0 @@ -/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ -#include -#include -#include -#include - - -#define TM_YEAR_BASE 1900 - -static const char* afmt[] = { - "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", -}; -static const char* Afmt[] = { - "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", - "Saturday", -}; -static const char* bfmt[] = { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", - "Oct", "Nov", "Dec", -}; -static const char* Bfmt[] = { - "January", "February", "March", "April", "May", "June", "July", - "August", "September", "October", "November", "December", -}; - -static size_t gsize; -static char* pt; - - -static int _add(const char* str) -{ - for (;; ++pt, --gsize) - { - if (!gsize) - return 0; - if (!(*pt = *str++)) - return 1; - } -} - -static int _conv(int n, int digits, char pad) -{ - static char buf[10]; - char* p; - - for (p = buf + sizeof(buf) - 2; n > 0 && p > buf; n /= 10, --digits) - *p-- = n % 10 + '0'; - while (p > buf && digits-- > 0) - *p-- = pad; - return _add(++p); -} - -static size_t _fmt(const char* format, const struct tm* t) -{ - for (; *format; ++format) - { - if (*format == '%') { - if (*(format+1) == '#') {format++;} - - switch(*++format) { - case '\0': - --format; - break; - case 'A': - if (t->tm_wday < 0 || t->tm_wday > 6) - return 0; - if (!_add(Afmt[t->tm_wday])) - return 0; - continue; - case 'a': - if (t->tm_wday < 0 || t->tm_wday > 6) - return 0; - if (!_add(afmt[t->tm_wday])) - return 0; - continue; - case 'B': - if (t->tm_mon < 0 || t->tm_mon > 11) - return 0; - if (!_add(Bfmt[t->tm_mon])) - return 0; - continue; - case 'b': - case 'h': - if (t->tm_mon < 0 || t->tm_mon > 11) - return 0; - if (!_add(bfmt[t->tm_mon])) - return 0; - continue; - case 'C': - if (!_fmt("%a %b %e %H:%M:%S %Y", t)) - return 0; - continue; - case 'c': - if (!_fmt("%m/%d/%y %H:%M:%S", t)) - return 0; - continue; - case 'e': - if (!_conv(t->tm_mday, 2, ' ')) - return 0; - continue; - case 'D': - if (!_fmt("%m/%d/%y", t)) - return 0; - continue; - case 'd': - if (!_conv(t->tm_mday, 2, '0')) - return 0; - continue; - case 'H': - if (!_conv(t->tm_hour, 2, '0')) - return 0; - continue; - case 'I': - if (!_conv(t->tm_hour % 12 ? t->tm_hour % 12 : 12, 2, '0')) - return 0; - continue; - case 'j': - if (!_conv(t->tm_yday + 1, 3, '0')) - return 0; - continue; - case 'k': - if (!_conv(t->tm_hour, 2, ' ')) - return 0; - continue; - case 'l': - if (!_conv(t->tm_hour % 12 ? t->tm_hour % 12 : 12, 2, ' ')) - return 0; - continue; - case 'M': - if (!_conv(t->tm_min, 2, '0')) - return 0; - continue; - case 'm': - if (!_conv(t->tm_mon + 1, 2, '0')) - return 0; - continue; - case 'n': - if (!_add("\n")) - return 0; - continue; - case 'p': - if (!_add(t->tm_hour >= 12 ? "PM" : "AM")) - return 0; - continue; - case 'R': - if (!_fmt("%H:%M", t)) - return 0; - continue; - case 'r': - if (!_fmt("%I:%M:%S %p", t)) - return 0; - continue; - case 'S': - if (!_conv(t->tm_sec, 2, '0')) - return 0; - continue; - case 'T': - case 'X': - if (!_fmt("%H:%M:%S", t)) - return 0; - continue; - case 't': - if (!_add("\t")) - return 0; - continue; - case 'U': - if (!_conv((t->tm_yday + 7 - t->tm_wday) / 7, 2, '0')) - return 0; - continue; - case 'W': - if (!_conv((t->tm_yday + 7 - (t->tm_wday ? (t->tm_wday - 1) : 6)) / 7, 2, '0')) - return 0; - continue; - case 'w': - if (!_conv(t->tm_wday, 1, '0')) - return 0; - continue; - case 'x': - if (!_fmt("%m/%d/%y", t)) - return 0; - continue; - case 'y': - if (!_conv((t->tm_year + TM_YEAR_BASE) % 100, 2, '0')) - return 0; - continue; - case 'Y': - if (!_conv(t->tm_year + TM_YEAR_BASE, 4, '0')) - return 0; - continue; - case 'Z': - if (!t->tm_zone || !_add(t->tm_zone)) - return 0; - continue; - case '%': - /* - * X311J/88-090 (4.12.3.5): if conversion char is - * undefined, behavior is undefined. Print out the - * character itself as printf(3) does. - */ - default: - break; - } - } - if (!gsize--) - return 0; - *pt++ = *format; - } - return gsize; -} - -/* - * @implemented - */ -size_t -strftime(char *s, size_t maxsize, const char *format, const struct tm *t) -{ - pt = s; - if ((gsize = maxsize) < 1) - return 0; - if (_fmt(format, t)) - { - *pt = '\0'; - return maxsize - gsize; - } - return 0; -} - -/* - * @implemented - */ -size_t wcsftime(wchar_t* s, size_t maxsize, const wchar_t* format, const struct tm* t) -{ - char* x; - char* f; - int i,j; - x = malloc(maxsize); - j = wcslen(format); - f = malloc(j+1); - for (i = 0; i < j; i++) - f[i] = (char)*format; - f[i] = 0; - pt = x; - if ((gsize = maxsize) < 1) - return 0; - if (_fmt(f, t)) { - *pt = '\0'; - free(f); - for (i = 0; i < maxsize;i ++) - s[i] = (wchar_t)x[i]; - s[i] = 0; - free(x); - return maxsize - gsize; - } - for (i = 0; i < maxsize; i++) - s[i] = (wchar_t)x[i]; - s[i] = 0; - free(f); - free(x); - return 0; -} diff --git a/reactos/lib/crtdll/time/strtime.c b/reactos/lib/crtdll/time/strtime.c deleted file mode 100644 index a6a26230a1e..00000000000 --- a/reactos/lib/crtdll/time/strtime.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib/crtdll/time/strtime.c - * PURPOSE: Fills a buffer with a formatted time representation - * PROGRAMER: Boudewijn Dekker - * UPDATE HISTORY: - * 28/12/98: Created - */ -#include -#include -#include -#include - - -/* - * @implemented - */ -char *_strtime(char* buf) -{ - time_t t; - struct tm *d; - char *dt = (char *)buf; - - if ( buf == NULL ) { - __set_errno(EINVAL); - return NULL; - } - t = time(NULL); - d = localtime(&t); - sprintf(dt,"%d:%d:%d",d->tm_hour,d->tm_min,d->tm_sec); - return dt; -} diff --git a/reactos/lib/crtdll/time/time.c b/reactos/lib/crtdll/time/time.c deleted file mode 100644 index 905083e503a..00000000000 --- a/reactos/lib/crtdll/time/time.c +++ /dev/null @@ -1,226 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib/crtdll/time/time.c - * PURPOSE: Get system time - * PROGRAMER: Boudewijn Dekker - * UPDATE HISTORY: - * 28/12/98: Created - */ - -/* - * DOS file system functions - * - * Copyright 1993 Erik Bos - * Copyright 1996 Alexandre Julliard - */ - -#include "precomp.h" -#include -#include - - -VOID STDCALL GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime ); - -/* - * @implemented - */ -time_t time(time_t* t) -{ - FILETIME SystemTime; - DWORD Remainder; - time_t tt; - GetSystemTimeAsFileTime(&SystemTime); - tt = FileTimeToUnixTime( &SystemTime,&Remainder ); - if (t) - *t = tt; - return tt; -} - -/*********************************************************************** - * DOSFS_UnixTimeToFileTime - * - * Convert a Unix time to FILETIME format. - * The FILETIME structure is a 64-bit value representing the number of - * 100-nanosecond intervals since January 1, 1601, 0:00. - * 'remainder' is the nonnegative number of 100-ns intervals - * corresponding to the time fraction smaller than 1 second that - * couldn't be stored in the time_t value. - */ -void UnixTimeToFileTime( time_t unix_time, FILETIME *filetime, - DWORD remainder ) -{ - /* NOTES: - - CONSTANTS: - The time difference between 1 January 1601, 00:00:00 and - 1 January 1970, 00:00:00 is 369 years, plus the leap years - from 1604 to 1968, excluding 1700, 1800, 1900. - This makes (1968 - 1600) / 4 - 3 = 89 leap days, and a total - of 134774 days. - - Any day in that period had 24 * 60 * 60 = 86400 seconds. - - The time difference is 134774 * 86400 * 10000000, which can be written - 116444736000000000 - 27111902 * 2^32 + 3577643008 - 413 * 2^48 + 45534 * 2^32 + 54590 * 2^16 + 32768 - - If you find that these constants are buggy, please change them in all - instances in both conversion functions. - - VERSIONS: - There are two versions, one of them uses long long variables and - is presumably faster but not ISO C. The other one uses standard C - data types and operations but relies on the assumption that negative - numbers are stored as 2's complement (-1 is 0xffff....). If this - assumption is violated, dates before 1970 will not convert correctly. - This should however work on any reasonable architecture where WINE - will run. - - DETAILS: - - Take care not to remove the casts. I have tested these functions - (in both versions) for a lot of numbers. I would be interested in - results on other compilers than GCC. - - The operations have been designed to account for the possibility - of 64-bit time_t in future UNICES. Even the versions without - internal long long numbers will work if time_t only is 64 bit. - A 32-bit shift, which was necessary for that operation, turned out - not to work correctly in GCC, besides giving the warning. So I - used a double 16-bit shift instead. Numbers are in the ISO version - represented by three limbs, the most significant with 32 bit, the - other two with 16 bit each. - - As the modulo-operator % is not well-defined for negative numbers, - negative divisors have been avoided in DOSFS_FileTimeToUnixTime. - - There might be quicker ways to do this in C. Certainly so in - assembler. - - Claus Fischer, fischer@iue.tuwien.ac.at - */ - - - - - unsigned long a0; /* 16 bit, low bits */ - unsigned long a1; /* 16 bit, medium bits */ - unsigned long a2; /* 32 bit, high bits */ - - /* Copy the unix time to a2/a1/a0 */ - a0 = unix_time & 0xffff; - a1 = (unix_time >> 16) & 0xffff; - /* This is obsolete if unix_time is only 32 bits, but it does not hurt. - Do not replace this by >> 32, it gives a compiler warning and it does - not work. */ - a2 = (unix_time >= 0 ? (unix_time >> 16) >> 16 : - ~((~unix_time >> 16) >> 16)); - - /* Multiply a by 10000000 (a = a2/a1/a0) - Split the factor into 10000 * 1000 which are both less than 0xffff. */ - a0 *= 10000; - a1 = a1 * 10000 + (a0 >> 16); - a2 = a2 * 10000 + (a1 >> 16); - a0 &= 0xffff; - a1 &= 0xffff; - - a0 *= 1000; - a1 = a1 * 1000 + (a0 >> 16); - a2 = a2 * 1000 + (a1 >> 16); - a0 &= 0xffff; - a1 &= 0xffff; - - /* Add the time difference and the remainder */ - a0 += 32768 + (remainder & 0xffff); - a1 += 54590 + (remainder >> 16 ) + (a0 >> 16); - a2 += 27111902 + (a1 >> 16); - a0 &= 0xffff; - a1 &= 0xffff; - - /* Set filetime */ - filetime->dwLowDateTime = (a1 << 16) + a0; - filetime->dwHighDateTime = a2; -} - - -/*********************************************************************** - * DOSFS_FileTimeToUnixTime - * - * Convert a FILETIME format to Unix time. - * If not NULL, 'remainder' contains the fractional part of the filetime, - * in the range of [0..9999999] (even if time_t is negative). - */ -time_t FileTimeToUnixTime( const FILETIME *filetime, DWORD *remainder ) -{ - /* Read the comment in the function DOSFS_UnixTimeToFileTime. */ - - unsigned long a0; /* 16 bit, low bits */ - unsigned long a1; /* 16 bit, medium bits */ - unsigned long a2; /* 32 bit, high bits */ - unsigned long r; /* remainder of division */ - unsigned int carry; /* carry bit for subtraction */ - int negative; /* whether a represents a negative value */ - - /* Copy the time values to a2/a1/a0 */ - a2 = (unsigned long)filetime->dwHighDateTime; - a1 = ((unsigned long)filetime->dwLowDateTime ) >> 16; - a0 = ((unsigned long)filetime->dwLowDateTime ) & 0xffff; - - /* Subtract the time difference */ - if (a0 >= 32768 ) a0 -= 32768 , carry = 0; - else a0 += (1 << 16) - 32768 , carry = 1; - - if (a1 >= 54590 + carry) a1 -= 54590 + carry, carry = 0; - else a1 += (1 << 16) - 54590 - carry, carry = 1; - - a2 -= 27111902 + carry; - - /* If a is negative, replace a by (-1-a) */ - negative = (a2 >= ((unsigned long)1) << 31); - if (negative) - { - /* Set a to -a - 1 (a is a2/a1/a0) */ - a0 = 0xffff - a0; - a1 = 0xffff - a1; - a2 = ~a2; - } - - /* Divide a by 10000000 (a = a2/a1/a0), put the rest into r. - Split the divisor into 10000 * 1000 which are both less than 0xffff. */ - a1 += (a2 % 10000) << 16; - a2 /= 10000; - a0 += (a1 % 10000) << 16; - a1 /= 10000; - r = a0 % 10000; - a0 /= 10000; - - a1 += (a2 % 1000) << 16; - a2 /= 1000; - a0 += (a1 % 1000) << 16; - a1 /= 1000; - r += (a0 % 1000) * 10000; - a0 /= 1000; - - /* If a was negative, replace a by (-1-a) and r by (9999999 - r) */ - if (negative) - { - /* Set a to -a - 1 (a is a2/a1/a0) */ - a0 = 0xffff - a0; - a1 = 0xffff - a1; - a2 = ~a2; - - r = 9999999 - r; - } - - if (remainder) *remainder = r; - - /* Do not replace this by << 32, it gives a compiler warning and it does - not work. */ - return ((((time_t)a2) << 16) << 16) + (a1 << 16) + a0; - -} - - - diff --git a/reactos/lib/crtdll/time/tz_vars.c b/reactos/lib/crtdll/time/tz_vars.c deleted file mode 100644 index 3ccf17709b5..00000000000 --- a/reactos/lib/crtdll/time/tz_vars.c +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include -#include - - -int _daylight_dll; -int _timezone_dll; - - -void _set_daylight_export(int value) -{ - _daylight_dll = value; -} - -void _set_timezone_export(int value) -{ - _timezone_dll = value; -} - - - diff --git a/reactos/lib/crtdll/time/tzfile.h b/reactos/lib/crtdll/time/tzfile.h deleted file mode 100644 index 3999029adb9..00000000000 --- a/reactos/lib/crtdll/time/tzfile.h +++ /dev/null @@ -1,160 +0,0 @@ -/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#ifndef __dj_include_tzfile_h__ -#define __dj_include_tzfile_h__ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __dj_ENFORCE_ANSI_FREESTANDING - -#ifndef __STRICT_ANSI__ - -#ifndef _POSIX_SOURCE - -/* - * Copyright (c) 1988 Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Arthur David Olson of the National Cancer Institute. - * - * Redistribution and use in source and binary forms are permitted provided - * that: (1) source distributions retain this entire copyright notice and - * comment, and (2) distributions including binaries display the following - * acknowledgement: ``This product includes software developed by the - * University of California, Berkeley and its contributors'' in the - * documentation or other materials provided with the distribution and in - * all advertising materials mentioning features or use of this software. - * Neither the name of the University nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - * - * @(#)tzfile.h 5.9 (Berkeley) 6/11/90 - */ - -/* -** Information about time zone files. -*/ - - /* Time zone object file directory */ -#define TZDIR "/usr/share/zoneinfo" -#define TZDEFAULT "/etc/localtime" -#define TZDEFRULES "posixrules" - -/* -** Each file begins with. . . -*/ - -struct tzhead { - char tzh_reserved[24]; /* reserved for future use */ - char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */ - char tzh_leapcnt[4]; /* coded number of leap seconds */ - char tzh_timecnt[4]; /* coded number of transition times */ - char tzh_typecnt[4]; /* coded number of local time types */ - char tzh_charcnt[4]; /* coded number of abbr. chars */ -}; - -/* -** . . .followed by. . . -** -** tzh_timecnt (char [4])s coded transition times a la time(2) -** tzh_timecnt (unsigned char)s types of local time starting at above -** tzh_typecnt repetitions of -** one (char [4]) coded GMT offset in seconds -** one (unsigned char) used to set tm_isdst -** one (unsigned char) that's an abbreviation list index -** tzh_charcnt (char)s '\0'-terminated zone abbreviations -** tzh_leapcnt repetitions of -** one (char [4]) coded leap second transition times -** one (char [4]) total correction after above -** tzh_ttisstdcnt (char)s indexed by type; if TRUE, transition -** time is standard time, if FALSE, -** transition time is wall clock time -** if absent, transition times are -** assumed to be wall clock time -*/ - -/* -** In the current implementation, "tzset()" refuses to deal with files that -** exceed any of the limits below. -*/ - -/* -** The TZ_MAX_TIMES value below is enough to handle a bit more than a -** year's worth of solar time (corrected daily to the nearest second) or -** 138 years of Pacific Presidential Election time -** (where there are three time zone transitions every fourth year). -*/ -#define TZ_MAX_TIMES 370 - -#define NOSOLAR /* 4BSD doesn't currently handle solar time */ - -#ifndef NOSOLAR -#define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */ -#else -#define TZ_MAX_TYPES 10 /* Maximum number of local time types */ -#endif - -#define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */ - -#define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */ - -#define SECSPERMIN 60 -#define MINSPERHOUR 60 -#define HOURSPERDAY 24 -#define DAYSPERWEEK 7 -#define DAYSPERNYEAR 365 -#define DAYSPERLYEAR 366 -#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR) -#define SECSPERDAY ((long) SECSPERHOUR * HOURSPERDAY) -#define MONSPERYEAR 12 - -#define TM_SUNDAY 0 -#define TM_MONDAY 1 -#define TM_TUESDAY 2 -#define TM_WEDNESDAY 3 -#define TM_THURSDAY 4 -#define TM_FRIDAY 5 -#define TM_SATURDAY 6 - -#define TM_JANUARY 0 -#define TM_FEBRUARY 1 -#define TM_MARCH 2 -#define TM_APRIL 3 -#define TM_MAY 4 -#define TM_JUNE 5 -#define TM_JULY 6 -#define TM_AUGUST 7 -#define TM_SEPTEMBER 8 -#define TM_OCTOBER 9 -#define TM_NOVEMBER 10 -#define TM_DECEMBER 11 - -#define TM_YEAR_BASE 1900 - -#define EPOCH_YEAR 1970 -#define EPOCH_WDAY TM_THURSDAY - -/* -** Accurate only for the past couple of centuries; -** that will probably do. -*/ - -#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0) - -#endif /* !_POSIX_SOURCE */ -#endif /* !__STRICT_ANSI__ */ -#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */ - -#ifndef __dj_ENFORCE_FUNCTION_CALLS -#endif /* !__dj_ENFORCE_FUNCTION_CALLS */ - -#ifdef __cplusplus -} -#endif - -#endif /* __dj_include_tzfile_h__ */ diff --git a/reactos/lib/crtdll/wchar/wcscoll.c b/reactos/lib/crtdll/wchar/wcscoll.c deleted file mode 100644 index f79ed9da607..00000000000 --- a/reactos/lib/crtdll/wchar/wcscoll.c +++ /dev/null @@ -1,22 +0,0 @@ - -#include - -/* - * @unimplemented - */ -int wcscoll(const wchar_t *a1,const wchar_t *a2) -{ - /* FIXME: handle collates */ - return wcscmp(a1,a2); -} - - -/* - * @unimplemented - */ -int _wcsicoll(const wchar_t *a1,const wchar_t *a2) -{ - /* FIXME: handle collates */ - return _wcsicmp(a1,a2); -} -