mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 04:13:34 +00:00
Updating include path in files previously missed.
svn path=/trunk/; revision=3808
This commit is contained in:
@@ -1,44 +1,42 @@
|
||||
#include <windows.h>
|
||||
#include <kernel32/heap.h>
|
||||
#include <crtdll/malloc.h>
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <msvcrt/malloc.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
void *_expand( void *pold, size_t size )
|
||||
void* _expand(void* pold, size_t size)
|
||||
{
|
||||
PHEAP_BUCKET pbucket;
|
||||
PHEAP_SUBALLOC psub;
|
||||
PHEAP_FRAGMENT pfrag=(PHEAP_FRAGMENT)((LPVOID)pold-HEAP_FRAG_ADMIN_SIZE);
|
||||
PHEAP_SUBALLOC psub;
|
||||
PHEAP_FRAGMENT pfrag = (PHEAP_FRAGMENT)((LPVOID)pold-HEAP_FRAG_ADMIN_SIZE);
|
||||
|
||||
/* sanity checks */
|
||||
if(pfrag->Magic!=HEAP_FRAG_MAGIC)
|
||||
if (pfrag->Magic != HEAP_FRAG_MAGIC)
|
||||
return NULL;
|
||||
|
||||
/* get bucket size */
|
||||
psub=pfrag->Sub;
|
||||
pbucket=psub->Bucket;
|
||||
if(size<=pbucket->Size)
|
||||
{
|
||||
psub = pfrag->Sub;
|
||||
pbucket = psub->Bucket;
|
||||
if(size <= pbucket->Size) {
|
||||
pfrag->Size=size;
|
||||
return pold;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size_t _msize (void* pBlock)
|
||||
size_t _msize(void* pBlock)
|
||||
{
|
||||
PHEAP_BUCKET pbucket;
|
||||
PHEAP_SUBALLOC psub;
|
||||
PHEAP_FRAGMENT pfrag=(PHEAP_FRAGMENT)((LPVOID)pBlock-HEAP_FRAG_ADMIN_SIZE);
|
||||
PHEAP_SUBALLOC psub;
|
||||
PHEAP_FRAGMENT pfrag = (PHEAP_FRAGMENT)((LPVOID)pBlock-HEAP_FRAG_ADMIN_SIZE);
|
||||
|
||||
/* sanity checks */
|
||||
if(pfrag->Magic!=HEAP_FRAG_MAGIC)
|
||||
if (pfrag->Magic != HEAP_FRAG_MAGIC)
|
||||
return 0;
|
||||
|
||||
/* get bucket size */
|
||||
psub=pfrag->Sub;
|
||||
pbucket=psub->Bucket;
|
||||
psub = pfrag->Sub;
|
||||
pbucket = psub->Bucket;
|
||||
return pbucket->Size;
|
||||
}
|
||||
|
||||
@@ -1,29 +1,30 @@
|
||||
|
||||
#include <windows.h>
|
||||
#include <crtdll/malloc.h>
|
||||
#include <msvcrt/malloc.h>
|
||||
|
||||
int _heapchk (void)
|
||||
int _heapchk(void)
|
||||
{
|
||||
if (!HeapValidate(GetProcessHeap(), 0, NULL))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
int _heapmin (void)
|
||||
|
||||
int _heapmin(void)
|
||||
{
|
||||
if ( !HeapCompact( GetProcessHeap(), 0 ))
|
||||
if (!HeapCompact(GetProcessHeap(), 0))
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
int _heapset (unsigned int unFill)
|
||||
|
||||
int _heapset(unsigned int unFill)
|
||||
{
|
||||
if ( _heapchk() == -1 )
|
||||
if (_heapchk() == -1)
|
||||
return -1;
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
int _heapwalk ( struct _heapinfo *entry)
|
||||
int _heapwalk(struct _heapinfo* entry)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -18,9 +18,10 @@
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <crtdll/math.h>
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
double acos (double __x)
|
||||
|
||||
double acos(double __x)
|
||||
{
|
||||
return atan2 (sqrt (1.0 - __x * __x), __x);
|
||||
return atan2(sqrt(1.0 - __x * __x), __x);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/math.h>
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
double
|
||||
acosh(double x)
|
||||
|
||||
double acosh(double x)
|
||||
{
|
||||
return log(x + sqrt(x*x - 1));
|
||||
return log(x + sqrt(x*x - 1));
|
||||
}
|
||||
|
||||
@@ -18,9 +18,10 @@
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <crtdll/math.h>
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
double asin (double __x)
|
||||
|
||||
double asin(double __x)
|
||||
{
|
||||
return atan2 (__x, sqrt (1.0 - __x * __x));
|
||||
return atan2(__x, sqrt(1.0 - __x * __x));
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/math.h>
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
double
|
||||
asinh(double x)
|
||||
|
||||
double asinh(double x)
|
||||
{
|
||||
return x>0 ? log(x + sqrt(x*x + 1)) : -log(sqrt(x*x+1)-x);
|
||||
return x>0 ? log(x + sqrt(x*x + 1)) : -log(sqrt(x*x+1)-x);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/math.h>
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
double
|
||||
atanh(double x)
|
||||
|
||||
double atanh(double x)
|
||||
{
|
||||
return log((1+x)/(1-x)) / 2.0;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/math.h>
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
|
||||
double cosh(double x)
|
||||
{
|
||||
const double ebig = exp(fabs(x));
|
||||
return (ebig + 1.0/ebig) / 2.0;
|
||||
const double ebig = exp(fabs(x));
|
||||
return (ebig + 1.0/ebig) / 2.0;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <crtdll/math.h>
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
|
||||
double _j0(double x)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <crtdll/math.h>
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
|
||||
double _j1(double x)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <crtdll/math.h>
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
|
||||
double _jn(int n, double x)
|
||||
{
|
||||
|
||||
@@ -1,84 +1,85 @@
|
||||
#include <crtdll/math.h>
|
||||
|
||||
double _CIsin (double x);
|
||||
double _CIcos (double x);
|
||||
double _CItan (double x);
|
||||
double _CIsinh (double x);
|
||||
double _CIcosh (double x);
|
||||
double _CItanh (double x);
|
||||
double _CIasin (double x);
|
||||
double _CIacos (double x);
|
||||
double _CIatan (double x);
|
||||
double _CIatan2 (double y, double x);
|
||||
double _CIexp (double x);
|
||||
double _CIlog (double x);
|
||||
double _CIlog10 (double x);
|
||||
double _CIpow (double x, double y);
|
||||
double _CIsqrt (double x);
|
||||
double _CIfmod (double x, double y);
|
||||
#include <msvcrt/math.h>
|
||||
|
||||
|
||||
double _CIsin (double x)
|
||||
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);
|
||||
|
||||
|
||||
double _CIsin(double x)
|
||||
{
|
||||
return sin(x);
|
||||
}
|
||||
double _CIcos (double x)
|
||||
double _CIcos(double x)
|
||||
{
|
||||
return cos(x);
|
||||
}
|
||||
double _CItan (double x)
|
||||
double _CItan(double x)
|
||||
{
|
||||
return tan(x);
|
||||
}
|
||||
double _CIsinh (double x)
|
||||
double _CIsinh(double x)
|
||||
{
|
||||
return sinh(x);
|
||||
}
|
||||
double _CIcosh (double x)
|
||||
double _CIcosh(double x)
|
||||
{
|
||||
return cosh(x);
|
||||
}
|
||||
double _CItanh (double x)
|
||||
double _CItanh(double x)
|
||||
{
|
||||
return tanh(x);
|
||||
}
|
||||
double _CIasin (double x)
|
||||
double _CIasin(double x)
|
||||
{
|
||||
return asin(x);
|
||||
}
|
||||
double _CIacos (double x)
|
||||
double _CIacos(double x)
|
||||
{
|
||||
return acos(x);
|
||||
}
|
||||
double _CIatan (double x)
|
||||
double _CIatan(double x)
|
||||
{
|
||||
return atan(x);
|
||||
}
|
||||
double _CIatan2 (double y, double x)
|
||||
double _CIatan2(double y, double x)
|
||||
{
|
||||
return atan2(y,x);
|
||||
return atan2(y, x);
|
||||
}
|
||||
double _CIexp (double x)
|
||||
double _CIexp(double x)
|
||||
{
|
||||
return exp(x);
|
||||
}
|
||||
double _CIlog (double x)
|
||||
double _CIlog(double x)
|
||||
{
|
||||
return log(x);
|
||||
}
|
||||
double _CIlog10 (double x)
|
||||
double _CIlog10(double x)
|
||||
{
|
||||
return log10(x);
|
||||
}
|
||||
double _CIpow (double x, double y)
|
||||
double _CIpow(double x, double y)
|
||||
{
|
||||
return pow(x,y);
|
||||
return pow(x, y);
|
||||
}
|
||||
double _CIsqrt (double x)
|
||||
double _CIsqrt(double x)
|
||||
{
|
||||
return sqrt(x);
|
||||
}
|
||||
double _CIfmod (double x, double y)
|
||||
double _CIfmod(double x, double y)
|
||||
{
|
||||
return fmod(x,y);
|
||||
return fmod(x, y);
|
||||
}
|
||||
|
||||
@@ -8,25 +8,26 @@
|
||||
* 12/04/99: Created
|
||||
*/
|
||||
|
||||
#include <crtdll/mbstring.h>
|
||||
#include <crtdll/mbctype.h>
|
||||
#include <msvcrt/mbstring.h>
|
||||
#include <msvcrt/mbctype.h>
|
||||
|
||||
int _ismbchira( unsigned int c )
|
||||
|
||||
int _ismbchira(unsigned int c)
|
||||
{
|
||||
return ((c>=0x829F) && (c<=0x82F1));
|
||||
}
|
||||
|
||||
int _ismbckata( unsigned int c )
|
||||
int _ismbckata(unsigned int c)
|
||||
{
|
||||
return ((c>=0x8340) && (c<=0x8396));
|
||||
}
|
||||
|
||||
unsigned int _mbctohira( unsigned int c )
|
||||
unsigned int _mbctohira(unsigned int c)
|
||||
{
|
||||
return c;
|
||||
}
|
||||
|
||||
unsigned int _mbctokata( unsigned int c )
|
||||
unsigned int _mbctokata(unsigned int c)
|
||||
{
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
|
||||
//iskana() :(0xA1 <= c <= 0xDF)
|
||||
//iskpun() :(0xA1 <= c <= 0xA6)
|
||||
//iskmoji() :(0xA7 <= c <= 0xDF)
|
||||
#include <crtdll/mbstring.h>
|
||||
#include <crtdll/mbctype.h>
|
||||
#include <crtdll/ctype.h>
|
||||
#include <msvcrt/mbstring.h>
|
||||
#include <msvcrt/mbctype.h>
|
||||
#include <msvcrt/ctype.h>
|
||||
|
||||
|
||||
int _ismbbpunct(unsigned char c)
|
||||
{
|
||||
@@ -12,3 +10,6 @@ int _ismbbpunct(unsigned char c)
|
||||
return (ispunct(c) || _ismbbkana(c));
|
||||
}
|
||||
|
||||
//iskana() :(0xA1 <= c <= 0xDF)
|
||||
//iskpun() :(0xA1 <= c <= 0xA6)
|
||||
//iskmoji() :(0xA7 <= c <= 0xDF)
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
#include <crtdll/mbstring.h>
|
||||
#include <msvcrt/mbstring.h>
|
||||
|
||||
|
||||
size_t _mbclen2(const unsigned int s);
|
||||
unsigned int _mbbtoupper(unsigned int c);
|
||||
|
||||
int _mbsnicmp(const unsigned char *s1, const unsigned char *s2, size_t n)
|
||||
|
||||
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);
|
||||
return _mbbtoupper(*(unsigned const char*)s1) - _mbbtoupper(*(unsigned const char*)s2);
|
||||
s1 += _mbclen2(*s1);
|
||||
s2 += _mbclen2(*s2);
|
||||
|
||||
@@ -21,13 +23,13 @@ int _mbsnicmp(const unsigned char *s1, const unsigned char *s2, size_t n)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int _mbsnbicmp(const unsigned char *s1, const unsigned char *s2, size_t n)
|
||||
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);
|
||||
return _mbbtoupper(*(unsigned const char*)s1) - _mbbtoupper(*(unsigned const char*)s2);
|
||||
s1 += _mbclen2(*s1);
|
||||
s2 += _mbclen2(*s2);
|
||||
|
||||
|
||||
@@ -20,17 +20,18 @@
|
||||
* DISCLAMED. This includes but is not limited to warrenties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Author: ariadne $
|
||||
* $Date: 1999/04/02 21:43:56 $
|
||||
* $Revision: 1.3 $
|
||||
* $Author: robd $
|
||||
* $Date: 2002/11/29 12:27:48 $
|
||||
*
|
||||
*/
|
||||
|
||||
#include <crtdll/stdio.h>
|
||||
#include <crtdll/io.h>
|
||||
#include <crtdll/process.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/io.h>
|
||||
#include <msvcrt/process.h>
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
/* See note in crt0.c */
|
||||
#include "init.c"
|
||||
|
||||
@@ -46,12 +47,11 @@ extern void __do_global_dtors();
|
||||
extern BOOL WINAPI DllMain(HANDLE, DWORD, LPVOID);
|
||||
|
||||
BOOL WINAPI
|
||||
DllMainCRTStartup (HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
|
||||
DllMainCRTStartup(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
|
||||
{
|
||||
BOOL bRet;
|
||||
|
||||
if (dwReason == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
if (dwReason == DLL_PROCESS_ATTACH) {
|
||||
_mingw32_init_mainargs();
|
||||
|
||||
#ifdef __GNUC__
|
||||
@@ -68,8 +68,7 @@ DllMainCRTStartup (HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
|
||||
bRet = DllMain(hDll, dwReason, lpReserved);
|
||||
|
||||
#ifdef __GNUC__
|
||||
if (dwReason == DLL_PROCESS_DETACH)
|
||||
{
|
||||
if (dwReason == DLL_PROCESS_DETACH) {
|
||||
/* From libgcc.a, calls global class destructors. */
|
||||
__do_global_dtors();
|
||||
}
|
||||
@@ -87,7 +86,7 @@ DllMainCRTStartup (HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
|
||||
* Thanks to Andrey A. Smirnov for pointing this one out.
|
||||
*/
|
||||
int
|
||||
atexit (void (*pfn)())
|
||||
atexit(void (*pfn)())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -11,23 +11,23 @@
|
||||
* Contributors:
|
||||
* Code supplied by Stan Cox <[email protected]>
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Author: ariadne $
|
||||
* $Date: 1999/04/02 21:43:56 $
|
||||
* $Revision: 1.3 $
|
||||
* $Author: robd $
|
||||
* $Date: 2002/11/29 12:27:48 $
|
||||
*
|
||||
*/
|
||||
|
||||
/* Needed for the atexit prototype. */
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
|
||||
typedef void (*func_ptr) (void);
|
||||
extern func_ptr __CTOR_LIST__[];
|
||||
extern func_ptr __DTOR_LIST__[];
|
||||
|
||||
void
|
||||
__do_global_dtors (void)
|
||||
void __do_global_dtors(void)
|
||||
{
|
||||
static func_ptr *p = __DTOR_LIST__ + 1;
|
||||
static func_ptr* p = __DTOR_LIST__ + 1;
|
||||
|
||||
/*
|
||||
* Call each destructor in the destructor list until a null pointer
|
||||
@@ -40,10 +40,9 @@ __do_global_dtors (void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
__do_global_ctors (void)
|
||||
void __do_global_ctors(void)
|
||||
{
|
||||
unsigned long nptrs = (unsigned long) __CTOR_LIST__[0];
|
||||
unsigned long nptrs = (unsigned long)__CTOR_LIST__[0];
|
||||
unsigned i;
|
||||
|
||||
/*
|
||||
@@ -51,8 +50,7 @@ __do_global_ctors (void)
|
||||
* is terminated with a null entry. Otherwise the first entry was
|
||||
* the number of pointers in the list.
|
||||
*/
|
||||
if (nptrs == -1)
|
||||
{
|
||||
if (nptrs == -1) {
|
||||
for (nptrs = 0; __CTOR_LIST__[nptrs + 1] != 0; nptrs++)
|
||||
;
|
||||
}
|
||||
@@ -60,24 +58,21 @@ __do_global_ctors (void)
|
||||
/*
|
||||
* Go through the list backwards calling constructors.
|
||||
*/
|
||||
for (i = nptrs; i >= 1; i--)
|
||||
{
|
||||
for (i = nptrs; i >= 1; i--) {
|
||||
__CTOR_LIST__[i] ();
|
||||
}
|
||||
|
||||
/*
|
||||
* Register the destructors for processing on exit.
|
||||
*/
|
||||
atexit (__do_global_dtors);
|
||||
atexit(__do_global_dtors);
|
||||
}
|
||||
|
||||
static int initialized = 0;
|
||||
|
||||
void
|
||||
__main (void)
|
||||
void __main(void)
|
||||
{
|
||||
if (! initialized)
|
||||
{
|
||||
if (!initialized) {
|
||||
initialized = 1;
|
||||
__do_global_ctors ();
|
||||
}
|
||||
|
||||
@@ -20,27 +20,26 @@
|
||||
* DISCLAMED. This includes but is not limited to warrenties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Revision: 1.2 $
|
||||
* $Author: ariadne $
|
||||
* $Date: 1999/04/02 21:43:56 $
|
||||
* $Revision: 1.3 $
|
||||
* $Author: robd $
|
||||
* $Date: 2002/11/29 12:27:48 $
|
||||
*
|
||||
*/
|
||||
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <crtdll/process.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
#include <msvcrt/process.h>
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
#define ISSPACE(a) (a == ' ' || a == '\t')
|
||||
|
||||
extern int PASCAL WinMain (HANDLE hInst, HANDLE hPrevInst, LPSTR szCmdLine,
|
||||
int nShow);
|
||||
extern int PASCAL WinMain (HANDLE hInst, HANDLE hPrevInst, LPSTR szCmdLine, int nShow);
|
||||
|
||||
int
|
||||
main (int argc, char* argv[], char* environ[])
|
||||
int main(int argc, char* argv[], char* environ[])
|
||||
{
|
||||
char* szCmd;
|
||||
char* szCmd;
|
||||
STARTUPINFO startinfo;
|
||||
int nRet;
|
||||
int nRet;
|
||||
|
||||
/* Get the command line passed to the process. */
|
||||
szCmd = GetCommandLineA();
|
||||
@@ -92,4 +91,3 @@ main (int argc, char* argv[], char* environ[])
|
||||
|
||||
return nRet;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,29 +1,28 @@
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
|
||||
typedef int (* new_handler_t)( size_t );
|
||||
typedef int (*new_handler_t)(size_t);
|
||||
|
||||
new_handler_t new_handler;
|
||||
|
||||
#undef _set_new_handler
|
||||
new_handler_t _set_new_handler__FPFUi_i(new_handler_t hnd)
|
||||
{
|
||||
new_handler_t old = new_handler;
|
||||
|
||||
new_handler = hnd;
|
||||
|
||||
return old;
|
||||
new_handler_t old = new_handler;
|
||||
|
||||
new_handler = hnd;
|
||||
return old;
|
||||
}
|
||||
|
||||
#undef delete
|
||||
void __builtin_delete (void* m)
|
||||
void __builtin_delete(void* m)
|
||||
{
|
||||
if ( m != NULL )
|
||||
free( m );
|
||||
if (m != NULL)
|
||||
free(m);
|
||||
}
|
||||
|
||||
#undef new
|
||||
void * __builtin_new (unsigned int s )
|
||||
void* __builtin_new(unsigned int s)
|
||||
{
|
||||
return malloc( s );
|
||||
return malloc( s );
|
||||
}
|
||||
|
||||
@@ -8,23 +8,24 @@
|
||||
* 04/03/99: Created
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <crtdll/process.h>
|
||||
#include <crtdll/errno.h>
|
||||
#include <crtdll/internal/file.h>
|
||||
#include <msvcrt/process.h>
|
||||
#include <msvcrt/errno.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
|
||||
int _cwait (int* pnStatus, int hProc, int nAction)
|
||||
|
||||
int _cwait(int* pnStatus, int hProc, int nAction)
|
||||
{
|
||||
DWORD ExitCode;
|
||||
DWORD ExitCode;
|
||||
|
||||
nAction = 0;
|
||||
if ( WaitForSingleObject((void *)hProc,INFINITE) != WAIT_OBJECT_0 ) {
|
||||
if (WaitForSingleObject((void*)hProc, INFINITE) != WAIT_OBJECT_0) {
|
||||
__set_errno(ECHILD);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( !GetExitCodeProcess((void *)hProc,&ExitCode) )
|
||||
if (!GetExitCodeProcess((void*)hProc, &ExitCode))
|
||||
return -1;
|
||||
if (pnStatus != NULL)
|
||||
*pnStatus = (int)ExitCode;
|
||||
*pnStatus = (int)ExitCode;
|
||||
return hProc;
|
||||
}
|
||||
|
||||
@@ -9,23 +9,22 @@
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <crtdll/process.h>
|
||||
#include <msvcrt/process.h>
|
||||
|
||||
void *_loaddll (char *name)
|
||||
|
||||
void* _loaddll(char* name)
|
||||
{
|
||||
return LoadLibraryA(name);
|
||||
}
|
||||
|
||||
int _unloaddll(void *handle)
|
||||
int _unloaddll(void* handle)
|
||||
{
|
||||
return FreeLibrary(handle);
|
||||
}
|
||||
|
||||
FARPROC _getdllprocaddr(void *hModule,char * lpProcName, int iOrdinal)
|
||||
FARPROC _getdllprocaddr(void* hModule, char* lpProcName, int iOrdinal)
|
||||
{
|
||||
|
||||
|
||||
if ( lpProcName != NULL )
|
||||
if (lpProcName != NULL)
|
||||
return GetProcAddress(hModule, lpProcName);
|
||||
else
|
||||
return GetProcAddress(hModule, (LPSTR)iOrdinal);
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/process.h>
|
||||
#include <msvcrt/process.h>
|
||||
|
||||
|
||||
int _execve(const char* szPath, char* const* szaArgv, char* const* szaEnv)
|
||||
{
|
||||
return spawnve(P_OVERLAY, szPath, szaArgv, szaEnv);
|
||||
return spawnve(P_OVERLAY, szPath, szaArgv, szaEnv);
|
||||
}
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||
|
||||
#include <crtdll/process.h>
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <msvcrt/process.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
|
||||
int _spawnl(int nMode, const char* szPath, const char* szArgv0,...)
|
||||
{
|
||||
char *szArg[100];
|
||||
const char *a;
|
||||
char* szArg[100];
|
||||
const char* a;
|
||||
int i = 1;
|
||||
va_list l = 0;
|
||||
szArg[0]=(char*)szArgv0;
|
||||
va_start(l,szArgv0);
|
||||
do {
|
||||
a = va_arg(l,const char *);
|
||||
szArg[i++] = (char *)a;
|
||||
} while ( a != NULL && i < 100 );
|
||||
a = va_arg(l, const char*);
|
||||
szArg[i++] = (char*)a;
|
||||
} while (a != NULL && i < 100);
|
||||
|
||||
return _spawnve(nMode, szPath, szArg, _environ);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <crtdll/process.h>
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <crtdll/stdarg.h>
|
||||
#include <msvcrt/process.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
#include <msvcrt/stdarg.h>
|
||||
|
||||
|
||||
int _spawnle(int mode, const char *path, const char *szArgv0, ... /*, const char **envp */)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdio.h>
|
||||
#include <crtdll/string.h>
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <crtdll/internal/file.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/string.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
|
||||
|
||||
FILE * __alloc_file(void);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdio.h>
|
||||
#include <crtdll/errno.h>
|
||||
#include <crtdll/internal/file.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/errno.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
|
||||
#ifdef clearerr
|
||||
#undef clearerr
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/* Copyright (C) 1997 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 <crtdll/stdio.h>
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <crtdll/ctype.h>
|
||||
#include <crtdll/internal/file.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
#include <msvcrt/ctype.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
|
||||
|
||||
#define atold atof
|
||||
@@ -16,7 +16,7 @@ int
|
||||
_doscan_low(FILE *iop, int (*scan_getc)(FILE *), int (*scan_ungetc)(int, FILE *),
|
||||
const char *fmt, va_list argp);
|
||||
|
||||
//#include <crtdll/local.h>
|
||||
//#include <msvcrt/local.h>
|
||||
|
||||
#define SPC 01
|
||||
#define STP 02
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||
|
||||
#include <crtdll/stdio.h>
|
||||
#include <crtdll/io.h>
|
||||
#include <crtdll/sys/types.h>
|
||||
#include <crtdll/sys/stat.h>
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <crtdll/errno.h>
|
||||
#include <crtdll/internal/file.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/io.h>
|
||||
#include <msvcrt/sys/types.h>
|
||||
#include <msvcrt/sys/stat.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
#include <msvcrt/errno.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
|
||||
// changed check for writable stream
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdio.h>
|
||||
#include <crtdll/errno.h>
|
||||
#include <crtdll/internal/file.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/errno.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
|
||||
#ifdef feof
|
||||
#undef feof
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdio.h>
|
||||
#include <crtdll/internal/file.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
|
||||
#ifdef ferror
|
||||
#undef ferror
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
|
||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||
|
||||
#include <crtdll/stdio.h>
|
||||
#include <crtdll/sys/types.h>
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <crtdll/string.h>
|
||||
#include <crtdll/internal/file.h>
|
||||
#include <crtdll/io.h>
|
||||
#include <crtdll/wchar.h>
|
||||
#include <crtdll/errno.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/sys/types.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
#include <msvcrt/string.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
#include <msvcrt/io.h>
|
||||
#include <msvcrt/wchar.h>
|
||||
#include <msvcrt/errno.h>
|
||||
|
||||
int _readcnv(int fn, void *buf, size_t siz );
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||
|
||||
#include <crtdll/sys/types.h>
|
||||
#include <crtdll/stdio.h>
|
||||
#include <crtdll/io.h>
|
||||
#include <crtdll/fcntl.h>
|
||||
#include <crtdll/internal/file.h>
|
||||
#include <msvcrt/sys/types.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/io.h>
|
||||
#include <msvcrt/fcntl.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
|
||||
//might change fopen(file,mode) -> fsopen(file,mode,_SH_DENYNO);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdio.h>
|
||||
#include <crtdll/wchar.h>
|
||||
#include <crtdll/internal/file.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/wchar.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
|
||||
int
|
||||
fprintf(register FILE *iop, const char *fmt, ...)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdio.h>
|
||||
#include <crtdll/internal/file.h>
|
||||
#include <crtdll/string.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
#include <msvcrt/string.h>
|
||||
#include <windows.h>
|
||||
|
||||
int
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include <crtdll/stdio.h>
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <crtdll/string.h>
|
||||
#include <crtdll/errno.h>
|
||||
#include <crtdll/internal/file.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
#include <msvcrt/string.h>
|
||||
#include <msvcrt/errno.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
|
||||
|
||||
// carriage return line feed conversion is done in filbuf and flsbuf
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdio.h>
|
||||
//#include <crtdll/local.h>
|
||||
#include <crtdll/internal/file.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
//#include <msvcrt/local.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
|
||||
|
||||
static __file_rec __initial_file_rec = {
|
||||
|
||||
@@ -18,9 +18,9 @@ Cambridge, MA 02139, USA. */
|
||||
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <crtdll/stdio.h>
|
||||
#include <crtdll/wchar.h>
|
||||
#include <crtdll/alloc.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/wchar.h>
|
||||
#include <msvcrt/alloc.h>
|
||||
|
||||
|
||||
int __vfscanf (FILE *s, const char *format, va_list argptr);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include <windows.h>
|
||||
#include <crtdll/stdio.h>
|
||||
#include <crtdll/wchar.h>
|
||||
#include <crtdll/errno.h>
|
||||
#include <crtdll/internal/file.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/wchar.h>
|
||||
#include <msvcrt/errno.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
|
||||
//getc can be a macro
|
||||
#undef getc
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdio.h>
|
||||
#include <crtdll/internal/file.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
|
||||
#undef getchar
|
||||
int
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <windows.h>
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
void *malloc(size_t size);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
//#include <crtdll/stubs.h>
|
||||
#include <crtdll/stdio.h>
|
||||
#include <crtdll/stdlib.h>
|
||||
//#include <msvcrt/stubs.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
void setbuffer(FILE *f, void *buf, int size)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdio.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
|
||||
// not exported
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
|
||||
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdio.h>
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <crtdll/io.h>
|
||||
#include <crtdll/errno.h>
|
||||
#include <crtdll/internal/file.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
#include <msvcrt/io.h>
|
||||
#include <msvcrt/errno.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
|
||||
|
||||
int setvbuf(FILE *f, char *buf, int type, size_t len)
|
||||
|
||||
@@ -19,10 +19,10 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <crtdll/stdio.h>
|
||||
#include <crtdll/wchar.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/wchar.h>
|
||||
#include <limits.h>
|
||||
#include <crtdll/internal/file.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
|
||||
#undef sprintf
|
||||
#undef wsprintf
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdio.h>
|
||||
#include <crtdll/internal/file.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
|
||||
|
||||
static void fcloseall_helper(FILE *f)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include <windows.h>
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <crtdll/io.h>
|
||||
#include <crtdll/fcntl.h>
|
||||
#include <crtdll/internal/atexit.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
#include <msvcrt/io.h>
|
||||
#include <msvcrt/fcntl.h>
|
||||
#include <msvcrt/internal/atexit.h>
|
||||
|
||||
struct __atexit *__atexit_ptr = 0;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <crtdll/stdio.h>
|
||||
#include <crtdll/io.h>
|
||||
#include <crtdll/signal.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/io.h>
|
||||
#include <msvcrt/signal.h>
|
||||
|
||||
char *msg ="Abort\n\r";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <crtdll/internal/atexit.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
#include <msvcrt/internal/atexit.h>
|
||||
|
||||
int
|
||||
atexit(void (*a)(void))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
double
|
||||
atof(const char *ascii)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
int
|
||||
atoi(const char *str)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
long
|
||||
atol(const char *str)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
long double
|
||||
_atold(const char *ascii)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
void *
|
||||
bsearch(const void *key, const void *base0, size_t nelem,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <crtdll/string.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
#include <msvcrt/string.h>
|
||||
|
||||
void *
|
||||
calloc(size_t size, size_t nelem)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
div_t
|
||||
div(int num, int denom)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <windows.h>
|
||||
#include <crtdll/errno.h>
|
||||
#include <msvcrt/errno.h>
|
||||
|
||||
#undef errno
|
||||
int errno;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <crtdll/stdio.h>
|
||||
#include <crtdll/string.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
#include <msvcrt/stdio.h>
|
||||
#include <msvcrt/string.h>
|
||||
|
||||
char *
|
||||
_gcvt (double value, int ndigits, char *buf)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
ldiv_t
|
||||
ldiv(long num, long denom)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
long long
|
||||
llabs(long long j)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
lldiv_t
|
||||
lldiv(long long num, long long denom)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1980, 1983 The Regents of the University of California.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
static unsigned long long next = 0;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <limits.h>
|
||||
#include <crtdll/ctype.h>
|
||||
#include <crtdll/errno.h>
|
||||
#include <crtdll/stdlib.h>
|
||||
//#include <crtdll/unconst.h>
|
||||
#include <msvcrt/ctype.h>
|
||||
#include <msvcrt/errno.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
//#include <msvcrt/unconst.h>
|
||||
|
||||
/* constants used in Solaris */
|
||||
#define LLONG_MIN -9223372036854775807L-1L
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <limits.h>
|
||||
#include <crtdll/ctype.h>
|
||||
#include <crtdll/errno.h>
|
||||
#include <crtdll/stdlib.h>
|
||||
//#include <crtdll/unconst.h>
|
||||
#include <msvcrt/ctype.h>
|
||||
#include <msvcrt/errno.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
//#include <msvcrt/unconst.h>
|
||||
|
||||
/*
|
||||
* Convert a string to an unsigned long integer.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
void _swab (const char* caFrom, char* caTo, size_t sizeToCopy)
|
||||
{
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <crtdll/wchar.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
#include <msvcrt/wchar.h>
|
||||
|
||||
#include <crtdll/errno.h>
|
||||
#include <crtdll/wchar.h>
|
||||
#include <crtdll/internal/file.h>
|
||||
#include <msvcrt/errno.h>
|
||||
#include <msvcrt/wchar.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
|
||||
#ifndef EILSEQ
|
||||
#define EILSEQ EINVAL
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
* DISCLAMED. This includes but is not limited to warrenties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Revision: 1.3 $
|
||||
* $Author: ariadne $
|
||||
* $Date: 1999/04/03 10:42:18 $
|
||||
* $Revision: 1.4 $
|
||||
* $Author: robd $
|
||||
* $Date: 2002/11/29 12:27:49 $
|
||||
*
|
||||
*/
|
||||
|
||||
#include <crtdll/string.h>
|
||||
#include <crtdll/wchar.h>
|
||||
#include <msvcrt/string.h>
|
||||
#include <msvcrt/wchar.h>
|
||||
|
||||
int
|
||||
strcasecmp (const char* sz1, const char* sz2)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/string.h>
|
||||
#include <crtdll/ctype.h>
|
||||
#include <msvcrt/string.h>
|
||||
#include <msvcrt/ctype.h>
|
||||
|
||||
int
|
||||
_stricmp(const char *s1, const char *s2)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <crtdll/string.h>
|
||||
#include <msvcrt/string.h>
|
||||
|
||||
char * _strrev(char *s)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: fstat.c,v 1.11 2002/11/24 18:42:19 robd Exp $
|
||||
/* $Id: fstat.c,v 1.12 2002/11/29 12:27:49 robd Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
@@ -19,35 +19,34 @@
|
||||
|
||||
int _fstat(int fd, struct stat* statbuf)
|
||||
{
|
||||
BY_HANDLE_FILE_INFORMATION FileInformation;
|
||||
BY_HANDLE_FILE_INFORMATION FileInformation;
|
||||
|
||||
if (!statbuf)
|
||||
{
|
||||
__set_errno(EINVAL);
|
||||
return -1;
|
||||
if (!statbuf) {
|
||||
__set_errno(EINVAL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( !GetFileInformationByHandle(_get_osfhandle(fd),&FileInformation) ) {
|
||||
__set_errno (EBADF);
|
||||
return -1;
|
||||
}
|
||||
statbuf->st_ctime = FileTimeToUnixTime( &FileInformation.ftCreationTime,NULL);
|
||||
statbuf->st_atime = FileTimeToUnixTime( &FileInformation.ftLastAccessTime,NULL);
|
||||
statbuf->st_mtime = FileTimeToUnixTime( &FileInformation.ftLastWriteTime,NULL);
|
||||
if (statbuf->st_atime ==0)
|
||||
statbuf->st_atime = statbuf->st_mtime;
|
||||
if (statbuf->st_ctime ==0)
|
||||
statbuf->st_ctime = statbuf->st_mtime;
|
||||
if (!GetFileInformationByHandle(_get_osfhandle(fd),&FileInformation)) {
|
||||
__set_errno (EBADF);
|
||||
return -1;
|
||||
}
|
||||
statbuf->st_ctime = FileTimeToUnixTime(&FileInformation.ftCreationTime,NULL);
|
||||
statbuf->st_atime = FileTimeToUnixTime(&FileInformation.ftLastAccessTime,NULL);
|
||||
statbuf->st_mtime = FileTimeToUnixTime(&FileInformation.ftLastWriteTime,NULL);
|
||||
if (statbuf->st_atime ==0)
|
||||
statbuf->st_atime = statbuf->st_mtime;
|
||||
if (statbuf->st_ctime ==0)
|
||||
statbuf->st_ctime = statbuf->st_mtime;
|
||||
|
||||
statbuf->st_dev = FileInformation.dwVolumeSerialNumber;
|
||||
statbuf->st_size = FileInformation.nFileSizeLow;
|
||||
statbuf->st_nlink = FileInformation.nNumberOfLinks;
|
||||
statbuf->st_mode = S_IREAD;
|
||||
if (FileInformation.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
statbuf->st_mode |= S_IFDIR | S_IEXEC;
|
||||
else
|
||||
statbuf->st_mode |= S_IFREG;
|
||||
if ( !(FileInformation.dwFileAttributes & FILE_ATTRIBUTE_READONLY))
|
||||
statbuf->st_mode |= S_IWRITE;
|
||||
return 0;
|
||||
statbuf->st_dev = FileInformation.dwVolumeSerialNumber;
|
||||
statbuf->st_size = FileInformation.nFileSizeLow;
|
||||
statbuf->st_nlink = FileInformation.nNumberOfLinks;
|
||||
statbuf->st_mode = S_IREAD;
|
||||
if (FileInformation.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
statbuf->st_mode |= S_IFDIR | S_IEXEC;
|
||||
else
|
||||
statbuf->st_mode |= S_IFREG;
|
||||
if (!(FileInformation.dwFileAttributes & FILE_ATTRIBUTE_READONLY))
|
||||
statbuf->st_mode |= S_IWRITE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -26,21 +26,21 @@ Cambridge, MA 02139, USA. */
|
||||
// crtdll has void return type instead of int
|
||||
void _ftime(struct timeb* timebuf)
|
||||
{
|
||||
int save = errno;
|
||||
struct tm *tp;
|
||||
int save = errno;
|
||||
struct tm* tp;
|
||||
|
||||
__set_errno (0);
|
||||
if (time (&timebuf->time) == (time_t) -1 && errno != 0)
|
||||
__set_errno (0);
|
||||
if (time (&timebuf->time) == (time_t) -1 && errno != 0)
|
||||
return;
|
||||
timebuf->millitm = 0;
|
||||
tp = localtime(&timebuf->time);
|
||||
if (tp == NULL)
|
||||
return;
|
||||
|
||||
timebuf->_timezone = tp->tm_gmtoff / 60;
|
||||
timebuf->dstflag = tp->tm_isdst;
|
||||
|
||||
free(tp);
|
||||
__set_errno(save);
|
||||
return;
|
||||
timebuf->millitm = 0;
|
||||
tp = localtime(&timebuf->time);
|
||||
if (tp == NULL)
|
||||
return;
|
||||
|
||||
timebuf->_timezone = tp->tm_gmtoff / 60;
|
||||
timebuf->dstflag = tp->tm_isdst;
|
||||
|
||||
free(tp);
|
||||
__set_errno (save);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,39 +1,40 @@
|
||||
#include <crtdll/alloc.h>
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <crtdll/sys/utime.h>
|
||||
#include <crtdll/io.h>
|
||||
#include <crtdll/time.h>
|
||||
#include <crtdll/errno.h>
|
||||
#include <crtdll/internal/file.h>
|
||||
#include <msvcrt/alloc.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
#include <msvcrt/sys/utime.h>
|
||||
#include <msvcrt/io.h>
|
||||
#include <msvcrt/time.h>
|
||||
#include <msvcrt/errno.h>
|
||||
#include <msvcrt/internal/file.h>
|
||||
|
||||
int _futime (int nHandle, struct _utimbuf *pTimes)
|
||||
|
||||
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;
|
||||
}
|
||||
FILETIME LastAccessTime;
|
||||
FILETIME LastWriteTime;
|
||||
|
||||
return 0;
|
||||
// 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;
|
||||
}
|
||||
|
||||
@@ -6,51 +6,46 @@
|
||||
#include <msvcrt/errno.h>
|
||||
|
||||
|
||||
int _stat( const char *path, struct stat *buffer )
|
||||
int _stat(const char* path, struct stat* buffer)
|
||||
{
|
||||
HANDLE fh;
|
||||
WIN32_FIND_DATA wfd;
|
||||
HANDLE fh;
|
||||
WIN32_FIND_DATA wfd;
|
||||
|
||||
fh = FindFirstFile (path,&wfd);
|
||||
if ( fh == INVALID_HANDLE_VALUE )
|
||||
{
|
||||
__set_errno(ENOFILE);
|
||||
return -1;
|
||||
}
|
||||
if ( ! (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
|
||||
{
|
||||
int fd = _open(path,_O_RDONLY);
|
||||
int ret;
|
||||
|
||||
ret = fstat(fd,buffer);
|
||||
_close(fd);
|
||||
fh = FindFirstFile(path, &wfd);
|
||||
if (fh == INVALID_HANDLE_VALUE) {
|
||||
__set_errno(ENOFILE);
|
||||
return -1;
|
||||
}
|
||||
if (!(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
|
||||
int fd = _open(path, _O_RDONLY);
|
||||
int ret;
|
||||
ret = fstat(fd, buffer);
|
||||
_close(fd);
|
||||
return ret;
|
||||
}
|
||||
buffer->st_ctime = FileTimeToUnixTime(&wfd.ftCreationTime,NULL);
|
||||
buffer->st_atime = FileTimeToUnixTime(&wfd.ftLastAccessTime,NULL);
|
||||
buffer->st_mtime = FileTimeToUnixTime(&wfd.ftLastWriteTime,NULL);
|
||||
|
||||
return ret;
|
||||
}
|
||||
buffer->st_ctime = FileTimeToUnixTime( &wfd.ftCreationTime,NULL);
|
||||
buffer->st_atime = FileTimeToUnixTime( &wfd.ftLastAccessTime,NULL);
|
||||
buffer->st_mtime = FileTimeToUnixTime( &wfd.ftLastWriteTime,NULL);
|
||||
if (buffer->st_atime ==0)
|
||||
buffer->st_atime = buffer->st_mtime;
|
||||
if (buffer->st_ctime ==0)
|
||||
buffer->st_ctime = buffer->st_mtime;
|
||||
|
||||
if (buffer->st_atime ==0)
|
||||
buffer->st_atime = buffer->st_mtime;
|
||||
if (buffer->st_ctime ==0)
|
||||
buffer->st_ctime = buffer->st_mtime;
|
||||
buffer->st_mode = S_IREAD;
|
||||
if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
buffer->st_mode |= S_IFDIR;
|
||||
else
|
||||
buffer->st_mode |= S_IFREG;
|
||||
if (!(wfd.dwFileAttributes & FILE_ATTRIBUTE_READONLY))
|
||||
buffer->st_mode |= S_IWRITE | S_IEXEC;
|
||||
|
||||
buffer->st_mode = S_IREAD;
|
||||
if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
buffer->st_mode |= S_IFDIR;
|
||||
else
|
||||
buffer->st_mode |= S_IFREG;
|
||||
if ( ! (wfd.dwFileAttributes & FILE_ATTRIBUTE_READONLY))
|
||||
buffer->st_mode |= S_IWRITE | S_IEXEC;
|
||||
|
||||
buffer->st_size = wfd.nFileSizeLow;
|
||||
buffer->st_nlink = 1;
|
||||
if (FindNextFile(fh,&wfd))
|
||||
{
|
||||
__set_errno(ENOFILE);
|
||||
FindClose(fh);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
buffer->st_size = wfd.nFileSizeLow;
|
||||
buffer->st_nlink = 1;
|
||||
if (FindNextFile(fh, &wfd)) {
|
||||
__set_errno(ENOFILE);
|
||||
FindClose(fh);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,67 +1,66 @@
|
||||
#include <windows.h>
|
||||
#include <crtdll/sys/time.h>
|
||||
#include <msvcrt/sys/time.h>
|
||||
|
||||
|
||||
int month[12] = { 31,28,31,30,31,30,31,31,30,31,30,31};
|
||||
unsigned int _getsystime(struct tm *tp)
|
||||
|
||||
unsigned int _getsystime(struct tm* tp)
|
||||
{
|
||||
SYSTEMTIME Time;
|
||||
TIME_ZONE_INFORMATION TimeZoneInformation;
|
||||
DWORD TimeZoneId;
|
||||
int i;
|
||||
SYSTEMTIME Time;
|
||||
TIME_ZONE_INFORMATION TimeZoneInformation;
|
||||
DWORD TimeZoneId;
|
||||
int i;
|
||||
|
||||
GetLocalTime(&Time);
|
||||
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_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;
|
||||
tp->tm_isdst = -1;
|
||||
|
||||
//FIXME GetTimeZoneInformation currently not in kernel32
|
||||
//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;
|
||||
}
|
||||
//TimeZoneId = GetTimeZoneInformation(&TimeZoneInformation );
|
||||
//if ( TimeZoneId == TIME_ZONE_ID_DAYLIGHT ) {
|
||||
// tp->tm_isdst = 1;
|
||||
//}
|
||||
//else
|
||||
// tp->tm_isdst = 0;
|
||||
|
||||
for(i=0;i<=tp->tm_mon;i++)
|
||||
tp->tm_yday += month[i];
|
||||
|
||||
return Time.wMilliseconds;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
unsigned int _setsystime(struct tm *tp, unsigned int ms)
|
||||
unsigned int _setsystime(struct tm* tp, unsigned int ms)
|
||||
{
|
||||
SYSTEMTIME Time;
|
||||
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;
|
||||
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;
|
||||
if (!SetLocalTime(&Time))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,32 +1,33 @@
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/string.h>
|
||||
#include <crtdll/time.h>
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <crtdll/wchar.h>
|
||||
#include <msvcrt/string.h>
|
||||
#include <msvcrt/time.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
#include <msvcrt/wchar.h>
|
||||
|
||||
|
||||
#define TM_YEAR_BASE 1900
|
||||
|
||||
static const char *afmt[] = {
|
||||
static const char* afmt[] = {
|
||||
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
|
||||
};
|
||||
static const char *Afmt[] = {
|
||||
static const char* Afmt[] = {
|
||||
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
|
||||
"Saturday",
|
||||
};
|
||||
static const char *bfmt[] = {
|
||||
static const char* bfmt[] = {
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
|
||||
"Oct", "Nov", "Dec",
|
||||
};
|
||||
static const char *Bfmt[] = {
|
||||
static const char* Bfmt[] = {
|
||||
"January", "February", "March", "April", "May", "June", "July",
|
||||
"August", "September", "October", "November", "December",
|
||||
};
|
||||
|
||||
static size_t gsize;
|
||||
static char *pt;
|
||||
static char* pt;
|
||||
|
||||
static int
|
||||
_add(const char *str)
|
||||
|
||||
static int _add(const char* str)
|
||||
{
|
||||
for (;; ++pt, --gsize)
|
||||
{
|
||||
@@ -37,11 +38,10 @@ _add(const char *str)
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
_conv(int n, int digits, char pad)
|
||||
static int _conv(int n, int digits, char pad)
|
||||
{
|
||||
static char buf[10];
|
||||
char *p;
|
||||
char* p;
|
||||
|
||||
for (p = buf + sizeof(buf) - 2; n > 0 && p > buf; n /= 10, --digits)
|
||||
*p-- = n % 10 + '0';
|
||||
@@ -50,16 +50,14 @@ _conv(int n, int digits, char pad)
|
||||
return _add(++p);
|
||||
}
|
||||
|
||||
static size_t
|
||||
_fmt(const char *format, const struct tm *t)
|
||||
static size_t _fmt(const char* format, const struct tm* t)
|
||||
{
|
||||
for (; *format; ++format)
|
||||
{
|
||||
if (*format == '%') {
|
||||
if (*(format+1) == '#' ) {format++;}
|
||||
if (*(format+1) == '#') {format++;}
|
||||
|
||||
switch(*++format)
|
||||
{
|
||||
switch(*++format) {
|
||||
case '\0':
|
||||
--format;
|
||||
break;
|
||||
@@ -113,8 +111,7 @@ _fmt(const char *format, const struct tm *t)
|
||||
return 0;
|
||||
continue;
|
||||
case 'I':
|
||||
if (!_conv(t->tm_hour % 12 ?
|
||||
t->tm_hour % 12 : 12, 2, '0'))
|
||||
if (!_conv(t->tm_hour % 12 ? t->tm_hour % 12 : 12, 2, '0'))
|
||||
return 0;
|
||||
continue;
|
||||
case 'j':
|
||||
@@ -126,8 +123,7 @@ _fmt(const char *format, const struct tm *t)
|
||||
return 0;
|
||||
continue;
|
||||
case 'l':
|
||||
if (!_conv(t->tm_hour % 12 ?
|
||||
t->tm_hour % 12 : 12, 2, ' '))
|
||||
if (!_conv(t->tm_hour % 12 ? t->tm_hour % 12 : 12, 2, ' '))
|
||||
return 0;
|
||||
continue;
|
||||
case 'M':
|
||||
@@ -168,14 +164,11 @@ _fmt(const char *format, const struct tm *t)
|
||||
return 0;
|
||||
continue;
|
||||
case 'U':
|
||||
if (!_conv((t->tm_yday + 7 - t->tm_wday) / 7,
|
||||
2, '0'))
|
||||
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'))
|
||||
if (!_conv((t->tm_yday + 7 - (t->tm_wday ? (t->tm_wday - 1) : 6)) / 7, 2, '0'))
|
||||
return 0;
|
||||
continue;
|
||||
case 'w':
|
||||
@@ -187,8 +180,7 @@ _fmt(const char *format, const struct tm *t)
|
||||
return 0;
|
||||
continue;
|
||||
case 'y':
|
||||
if (!_conv((t->tm_year + TM_YEAR_BASE)
|
||||
% 100, 2, '0'))
|
||||
if (!_conv((t->tm_year + TM_YEAR_BASE) % 100, 2, '0'))
|
||||
return 0;
|
||||
continue;
|
||||
case 'Y':
|
||||
@@ -230,32 +222,30 @@ strftime(char *s, size_t maxsize, const char *format, const struct tm *t)
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t
|
||||
wcsftime(wchar_t *s, size_t maxsize, const wchar_t *format, const struct tm *t)
|
||||
size_t wcsftime(wchar_t* s, size_t maxsize, const wchar_t* format, const struct tm* t)
|
||||
{
|
||||
char *x;
|
||||
char *f;
|
||||
char* x;
|
||||
char* f;
|
||||
int i,j;
|
||||
x = malloc(maxsize);
|
||||
j = wcslen(format);
|
||||
f = malloc(j+1);
|
||||
for(i=0;i<j;i++)
|
||||
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))
|
||||
{
|
||||
if (_fmt(f, t)) {
|
||||
*pt = '\0';
|
||||
free(f);
|
||||
for(i=0;i<maxsize;i++)
|
||||
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++)
|
||||
for (i = 0; i < maxsize; i++)
|
||||
s[i] = (wchar_t)x[i];
|
||||
s[i] = 0;
|
||||
free(f);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
|
||||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
|
||||
double wcstod(const wchar_t *s, wchar_t **sret)
|
||||
double wcstod(const wchar_t* s, wchar_t** sret)
|
||||
{
|
||||
long double r; /* result */
|
||||
int e; /* exponent */
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#include <crtdll/wchar.h>
|
||||
#include <msvcrt/wchar.h>
|
||||
|
||||
|
||||
long wcstol(const wchar_t *cp,wchar_t **endp,int base)
|
||||
long wcstol(const wchar_t* cp, wchar_t** endp, int base)
|
||||
{
|
||||
long result = 0,value;
|
||||
long result = 0, value;
|
||||
int sign = 1;
|
||||
|
||||
if ( *cp == L'-' ) {
|
||||
if (*cp == L'-') {
|
||||
sign = -1;
|
||||
cp++;
|
||||
}
|
||||
@@ -28,14 +28,13 @@ long wcstol(const wchar_t *cp,wchar_t **endp,int base)
|
||||
cp++;
|
||||
}
|
||||
if (endp)
|
||||
*endp = (wchar_t *)cp;
|
||||
*endp = (wchar_t*)cp;
|
||||
return result * sign;
|
||||
}
|
||||
|
||||
|
||||
unsigned long wcstoul(const wchar_t *cp,wchar_t **endp,int base)
|
||||
unsigned long wcstoul(const wchar_t* cp, wchar_t** endp, int base)
|
||||
{
|
||||
unsigned long result = 0,value;
|
||||
unsigned long result = 0, value;
|
||||
|
||||
if (!base) {
|
||||
base = 10;
|
||||
@@ -54,7 +53,6 @@ unsigned long wcstoul(const wchar_t *cp,wchar_t **endp,int base)
|
||||
cp++;
|
||||
}
|
||||
if (endp)
|
||||
*endp = (wchar_t *)cp;
|
||||
*endp = (wchar_t*)cp;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <crtdll/wchar.h>
|
||||
#include <crtdll/stdlib.h>
|
||||
#include <msvcrt/wchar.h>
|
||||
#include <msvcrt/stdlib.h>
|
||||
|
||||
size_t wcstombs( char *dst, const wchar_t *src, size_t len )
|
||||
{
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
#include <crtdll/wchar.h>
|
||||
#include <msvcrt/wchar.h>
|
||||
|
||||
int _wtoi( const wchar_t *str )
|
||||
|
||||
int _wtoi(const wchar_t* str)
|
||||
{
|
||||
return (int)wcstol(str, 0, 10);
|
||||
}
|
||||
|
||||
long _wtol( const wchar_t *str )
|
||||
long _wtol(const wchar_t* str)
|
||||
{
|
||||
return (int)wcstol(str, 0, 10);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user