mirror of
https://github.com/reactos/reactos.git
synced 2025-04-27 09:00:27 +00:00
- Update many parts of CRT, and misc cleanup.
- Largely based on the patch by Samuel Serapion. - Include file.c from Wine's msvcrt, but exclude its contents from the build process for now. svn path=/trunk/; revision=33866
This commit is contained in:
parent
3f2bc58da5
commit
45ebe0ccc2
89 changed files with 4487 additions and 1700 deletions
|
@ -18,6 +18,7 @@
|
|||
<define name="__MINGW_IMPORT">"extern __attribute__ ((dllexport))"</define>
|
||||
|
||||
<library>crt</library>
|
||||
<library>wine</library>
|
||||
<library>kernel32</library>
|
||||
<library>ntdll</library>
|
||||
<pch>precomp.h</pch>
|
||||
|
|
|
@ -23,9 +23,11 @@
|
|||
#include <precomp.h>
|
||||
#include <internal/wine/msvcrt.h>
|
||||
#include <sys/stat.h>
|
||||
#include <locale.h>
|
||||
#include <mbctype.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
#include "wine/debug.h"
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(crtdll);
|
||||
|
||||
|
||||
/* EXTERNAL PROTOTYPES ********************************************************/
|
||||
|
@ -114,7 +116,7 @@ DllMain(PVOID hinstDll, ULONG dwReason, PVOID reserved)
|
|||
{
|
||||
case DLL_PROCESS_ATTACH://1
|
||||
/* initialize version info */
|
||||
DPRINT("Attach %d\n", nAttachCount);
|
||||
//TRACE("Attach %d\n", nAttachCount);
|
||||
|
||||
_osver = GetVersion();
|
||||
|
||||
|
@ -157,8 +159,10 @@ DllMain(PVOID hinstDll, ULONG dwReason, PVOID reserved)
|
|||
|
||||
/* FIXME: Initialization of the WINE code */
|
||||
msvcrt_init_mt_locks();
|
||||
setlocale(0, "C");
|
||||
//_setmbcp(_MB_CP_LOCALE);
|
||||
|
||||
DPRINT("Attach done\n");
|
||||
TRACE("Attach done\n");
|
||||
break;
|
||||
|
||||
case DLL_THREAD_ATTACH://2
|
||||
|
@ -169,7 +173,7 @@ DllMain(PVOID hinstDll, ULONG dwReason, PVOID reserved)
|
|||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH://0
|
||||
DPRINT("Detach %d\n", nAttachCount);
|
||||
//TRACE("Detach %d\n", nAttachCount);
|
||||
/* FIXME: more cleanup... */
|
||||
_fcloseall();
|
||||
_atexit_cleanup();
|
||||
|
@ -190,7 +194,7 @@ DllMain(PVOID hinstDll, ULONG dwReason, PVOID reserved)
|
|||
/* destroy heap */
|
||||
HeapDestroy(hHeap);
|
||||
|
||||
DPRINT("Detach done\n");
|
||||
TRACE("Detach done\n");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,10 +22,11 @@
|
|||
|
||||
#include <precomp.h>
|
||||
#include <internal/wine/msvcrt.h>
|
||||
#include <locale.h>
|
||||
#include <mbctype.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
#include "wine/debug.h"
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
|
||||
|
||||
/* EXTERNAL PROTOTYPES ********************************************************/
|
||||
|
||||
|
@ -96,20 +97,22 @@ DllMain(PVOID hinstDll, ULONG dwReason, PVOID reserved)
|
|||
|
||||
/* FIXME: more initializations... */
|
||||
|
||||
/* FIXME: Initialization of the WINE code */
|
||||
/* Initialization of the WINE code */
|
||||
msvcrt_init_mt_locks();
|
||||
setlocale(0, "C");
|
||||
//_setmbcp(_MB_CP_LOCALE);
|
||||
|
||||
DPRINT("Attach done\n");
|
||||
TRACE("Attach done\n");
|
||||
break;
|
||||
|
||||
case DLL_THREAD_ATTACH://2
|
||||
case DLL_THREAD_ATTACH:
|
||||
break;
|
||||
|
||||
case DLL_THREAD_DETACH://4
|
||||
case DLL_THREAD_DETACH:
|
||||
FreeThreadData(NULL);
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH://0
|
||||
case DLL_PROCESS_DETACH:
|
||||
//DPRINT1("Detach %d\n", nAttachCount);
|
||||
//DPRINT("Detach\n");
|
||||
/* FIXME: more cleanup... */
|
||||
|
@ -132,7 +135,7 @@ DllMain(PVOID hinstDll, ULONG dwReason, PVOID reserved)
|
|||
/* destroy heap */
|
||||
HeapDestroy(hHeap);
|
||||
|
||||
DPRINT("Detach done\n");
|
||||
TRACE("Detach done\n");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,5 @@
|
|||
<library>ntdll</library>
|
||||
<pch>precomp.h</pch>
|
||||
<file>dllmain.c</file>
|
||||
<file>stubs.c</file>
|
||||
<file>msvcrt.rc</file>
|
||||
</module>
|
||||
|
|
|
@ -1,95 +0,0 @@
|
|||
/* File generated automatically from dll\win32\msvcrt\msvcrt.spec; do not edit! */
|
||||
/* This file can be copied, modified and distributed without restriction. */
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wine/config.h"
|
||||
#include "wine/exception.h"
|
||||
|
||||
void __wine_spec_unimplemented_stub( const char *module, const char *function )
|
||||
{
|
||||
ULONG_PTR args[2];
|
||||
|
||||
args[0] = (ULONG_PTR)module;
|
||||
args[1] = (ULONG_PTR)function;
|
||||
RaiseException( EXCEPTION_WINE_STUB, EH_NONCONTINUABLE, 2, args );
|
||||
}
|
||||
|
||||
static const char __wine_spec_file_name[] = "msvcrt.dll";
|
||||
|
||||
void __wine_stub_msvcrt_dll_81(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "__STRINGTOLD"); }
|
||||
void __wine_stub_msvcrt_dll_86(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "__crtCompareStringW"); }
|
||||
void __wine_stub_msvcrt_dll_92(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "__get_app_type"); }
|
||||
void __wine_stub_msvcrt_dll_99(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "__lc_collate"); }
|
||||
void __wine_stub_msvcrt_dll_116(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "__p__fileinfo"); }
|
||||
void __wine_stub_msvcrt_dll_119(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "__p__mbcasemap"); }
|
||||
void __wine_stub_msvcrt_dll_124(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "__p__pwctype"); }
|
||||
void __wine_stub_msvcrt_dll_134(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "__pxcptinfoptrs"); }
|
||||
void __wine_stub_msvcrt_dll_150(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_adj_fdiv_m16i"); }
|
||||
void __wine_stub_msvcrt_dll_155(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_adj_fdivr_m16i"); }
|
||||
void __wine_stub_msvcrt_dll_159(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_adj_fpatan"); }
|
||||
void __wine_stub_msvcrt_dll_160(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_adj_fprem"); }
|
||||
void __wine_stub_msvcrt_dll_161(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_adj_fprem1"); }
|
||||
void __wine_stub_msvcrt_dll_162(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_adj_fptan"); }
|
||||
void __wine_stub_msvcrt_dll_164(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_aligned_free"); }
|
||||
void __wine_stub_msvcrt_dll_165(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_aligned_malloc"); }
|
||||
void __wine_stub_msvcrt_dll_166(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_aligned_offset_malloc"); }
|
||||
void __wine_stub_msvcrt_dll_167(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_aligned_offset_realloc"); }
|
||||
void __wine_stub_msvcrt_dll_168(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_aligned_realloc"); }
|
||||
void __wine_stub_msvcrt_dll_171(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_atodbl"); }
|
||||
void __wine_stub_msvcrt_dll_173(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_atoldbl"); }
|
||||
void __wine_stub_msvcrt_dll_179(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_callnewh"); }
|
||||
void __wine_stub_msvcrt_dll_185(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_chkesp"); }
|
||||
void __wine_stub_msvcrt_dll_202(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_dstbias"); }
|
||||
void __wine_stub_msvcrt_dll_242(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_fpieee_flt"); }
|
||||
void __wine_stub_msvcrt_dll_248(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_fstat64"); }
|
||||
void __wine_stub_msvcrt_dll_256(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_get_sbh_threshold"); }
|
||||
void __wine_stub_msvcrt_dll_257(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_get_terminate"); }
|
||||
void __wine_stub_msvcrt_dll_258(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_get_unexpected"); }
|
||||
void __wine_stub_msvcrt_dll_267(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_getmaxstdio"); }
|
||||
void __wine_stub_msvcrt_dll_268(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_getmbcp"); }
|
||||
void __wine_stub_msvcrt_dll_270(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_getsystime"); }
|
||||
void __wine_stub_msvcrt_dll_278(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_heapused"); }
|
||||
void __wine_stub_msvcrt_dll_284(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_inp"); }
|
||||
void __wine_stub_msvcrt_dll_285(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_inpd"); }
|
||||
void __wine_stub_msvcrt_dll_286(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_inpw"); }
|
||||
void __wine_stub_msvcrt_dll_290(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_ismbbalnum"); }
|
||||
void __wine_stub_msvcrt_dll_291(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_ismbbalpha"); }
|
||||
void __wine_stub_msvcrt_dll_292(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_ismbbgraph"); }
|
||||
void __wine_stub_msvcrt_dll_293(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_ismbbkalnum"); }
|
||||
void __wine_stub_msvcrt_dll_295(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_ismbbkprint"); }
|
||||
void __wine_stub_msvcrt_dll_296(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_ismbbkpunct"); }
|
||||
void __wine_stub_msvcrt_dll_298(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_ismbbprint"); }
|
||||
void __wine_stub_msvcrt_dll_299(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_ismbbpunct"); }
|
||||
void __wine_stub_msvcrt_dll_304(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_ismbcgraph"); }
|
||||
void __wine_stub_msvcrt_dll_307(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_ismbcl0"); }
|
||||
void __wine_stub_msvcrt_dll_308(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_ismbcl1"); }
|
||||
void __wine_stub_msvcrt_dll_309(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_ismbcl2"); }
|
||||
void __wine_stub_msvcrt_dll_310(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_ismbclegal"); }
|
||||
void __wine_stub_msvcrt_dll_313(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_ismbcpunct"); }
|
||||
void __wine_stub_msvcrt_dll_332(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_longjmpex"); }
|
||||
void __wine_stub_msvcrt_dll_341(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_matherr"); }
|
||||
void __wine_stub_msvcrt_dll_373(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_mbsnbcpy_s"); }
|
||||
void __wine_stub_msvcrt_dll_407(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_outp"); }
|
||||
void __wine_stub_msvcrt_dll_408(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_outpd"); }
|
||||
void __wine_stub_msvcrt_dll_409(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_outpw"); }
|
||||
void __wine_stub_msvcrt_dll_425(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_safe_fdiv"); }
|
||||
void __wine_stub_msvcrt_dll_426(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_safe_fdivr"); }
|
||||
void __wine_stub_msvcrt_dll_427(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_safe_fprem"); }
|
||||
void __wine_stub_msvcrt_dll_428(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_safe_fprem1"); }
|
||||
void __wine_stub_msvcrt_dll_432(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_set_error_mode"); }
|
||||
void __wine_stub_msvcrt_dll_433(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_set_sbh_threshold"); }
|
||||
void __wine_stub_msvcrt_dll_437(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_setmaxstdio"); }
|
||||
void __wine_stub_msvcrt_dll_455(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_stat64"); }
|
||||
void __wine_stub_msvcrt_dll_542(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_wperror"); }
|
||||
void __wine_stub_msvcrt_dll_543(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_wpgmptr"); }
|
||||
void __wine_stub_msvcrt_dll_553(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_wspawnl"); }
|
||||
void __wine_stub_msvcrt_dll_554(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_wspawnle"); }
|
||||
void __wine_stub_msvcrt_dll_555(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_wspawnlp"); }
|
||||
void __wine_stub_msvcrt_dll_556(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_wspawnlpe"); }
|
||||
void __wine_stub_msvcrt_dll_564(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_wstat64"); }
|
||||
void __wine_stub_msvcrt_dll_567(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_wsystem"); }
|
||||
void __wine_stub_msvcrt_dll_569(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "_wtmpnam"); }
|
||||
void __wine_stub_msvcrt_dll_709(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "strcat_s"); }
|
||||
void __wine_stub_msvcrt_dll_714(void) { __wine_spec_unimplemented_stub(__wine_spec_file_name, "strcpy_s"); }
|
|
@ -82,7 +82,7 @@
|
|||
<file>chsize.c</file>
|
||||
<file>close.c</file>
|
||||
<file>commit.c</file>
|
||||
<file>create.c</file>
|
||||
<file>creat.c</file>
|
||||
<file>dup.c</file>
|
||||
<file>dup2.c</file>
|
||||
<file>eof.c</file>
|
||||
|
@ -108,7 +108,7 @@
|
|||
<file>utime.c</file>
|
||||
<file>waccess.c</file>
|
||||
<file>wchmod.c</file>
|
||||
<file>wcreate.c</file>
|
||||
<file>wcreat.c</file>
|
||||
<file>wfind.c</file>
|
||||
<file>wmktemp.c</file>
|
||||
<file>wopen.c</file>
|
||||
|
@ -285,6 +285,7 @@
|
|||
<file>fgets.c</file>
|
||||
<file>fgetws.c</file>
|
||||
<file>filbuf.c</file>
|
||||
<file>file.c</file>
|
||||
<file>fileno.c</file>
|
||||
<file>flsbuf.c</file>
|
||||
<file>fopen.c</file>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crt/??????
|
||||
* PURPOSE: Unknown
|
||||
* PROGRAMER: Unknown
|
||||
* FILE: lib/crt/chdrive.c
|
||||
* PURPOSE: Change the current drive.
|
||||
* PROGRAMER: WINE
|
||||
* UPDATE HISTORY:
|
||||
* 25/11/05: Added license header
|
||||
*/
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include <precomp.h>
|
||||
#include <direct.h>
|
||||
#include <internal/debug.h>
|
||||
#include <tchar.h>
|
||||
|
||||
/*
|
||||
|
@ -60,3 +59,4 @@ _TCHAR* _tgetdcwd(int drive, _TCHAR * buf, int size)
|
|||
return buf;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,20 +1,51 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#define __USE_ISOC9X 1
|
||||
#define __USE_ISOC99 1
|
||||
#include <math.h>
|
||||
|
||||
#ifdef HAVE_IEEEFP_H
|
||||
#include <ieeefp.h>
|
||||
#endif
|
||||
|
||||
int _matherr(struct _exception* e)
|
||||
#ifndef HAVE_FINITE
|
||||
#ifndef finite /* Could be a macro */
|
||||
#ifdef isfinite
|
||||
#define finite(x) isfinite(x)
|
||||
#else
|
||||
#define finite(x) (!isnan(x)) /* At least catch some cases */
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef signbit
|
||||
#define signbit(x) 0
|
||||
#endif
|
||||
|
||||
typedef int (*MSVCRT_matherr_func)(struct _exception *);
|
||||
|
||||
static MSVCRT_matherr_func MSVCRT_default_matherr_func = NULL;
|
||||
|
||||
int CDECL _matherr(struct _exception *e)
|
||||
{
|
||||
return 0;
|
||||
if (e)
|
||||
TRACE("(%p = %d, %s, %g %g %g)\n",e, e->type, e->name, e->arg1, e->arg2,
|
||||
e->retval);
|
||||
else
|
||||
TRACE("(null)\n");
|
||||
if (MSVCRT_default_matherr_func)
|
||||
return MSVCRT_default_matherr_func(e);
|
||||
ERR(":Unhandled math error!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* not exported by NTDLL
|
||||
*
|
||||
* @unimplemented
|
||||
/*********************************************************************
|
||||
* __setusermatherr (MSVCRT.@)
|
||||
*/
|
||||
void __setusermatherr(int (*handler)(struct _exception*))
|
||||
void CDECL __setusermatherr(MSVCRT_matherr_func func)
|
||||
{
|
||||
|
||||
MSVCRT_default_matherr_func = func;
|
||||
TRACE(":new matherr handler %p\n", func);
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,5 +60,6 @@ int _fpieee_flt(
|
|||
int (*handler)(_FPIEEE_RECORD*)
|
||||
)
|
||||
{
|
||||
FIXME("Unimplemented!\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <precomp.h>
|
||||
#include "include/internal/wine/msvcrt.h"
|
||||
#include "include/internal/wine/cppexcept.h"
|
||||
#include "internal/wine/msvcrt.h"
|
||||
#include "internal/wine/cppexcept.h"
|
||||
|
||||
typedef void (*sighandler_t)(int);
|
||||
static sighandler_t sighandlers[NSIG] = { SIG_DFL };
|
||||
|
@ -104,3 +104,4 @@ int CDECL __CppXcptFilter(NTSTATUS ex, PEXCEPTION_POINTERS ptr)
|
|||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -10,12 +10,14 @@
|
|||
|
||||
#include <precomp.h>
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
/*********************************************************************
|
||||
* _fpreset (MSVCRT.@)
|
||||
*/
|
||||
void _fpreset(void)
|
||||
void CDECL _fpreset(void)
|
||||
{
|
||||
/* FIXME: This causes an exception */
|
||||
// __asm__ __volatile__("fninit\n\t");
|
||||
return;
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
__asm__ __volatile__( "fninit" );
|
||||
#else
|
||||
FIXME(":Not Implemented!\n");
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -12,18 +12,17 @@
|
|||
|
||||
unsigned int _statusfp( void );
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
/*********************************************************************
|
||||
* _clearfp (MSVCRT.@)
|
||||
*/
|
||||
unsigned int _clearfp (void)
|
||||
unsigned int CDECL _clearfp(void)
|
||||
{
|
||||
unsigned short __res = _statusfp();
|
||||
#ifdef __GNUC__
|
||||
__asm__ __volatile__ (
|
||||
"fclex \n\t"
|
||||
);
|
||||
unsigned int retVal = _statusfp();
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
__asm__ __volatile__( "fnclex" );
|
||||
#else
|
||||
#endif /*__GNUC__*/
|
||||
return __res;
|
||||
FIXME(":Not Implemented\n");
|
||||
#endif
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
|
||||
|
||||
#include <precomp.h>
|
||||
#include <float.h>
|
||||
|
||||
#define X87_CW_IM (1<<0) /* Invalid operation mask */
|
||||
#define X87_CW_DM (1<<1) /* Denormal operand mask */
|
||||
|
@ -25,150 +26,83 @@
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned int _controlfp(unsigned int unNew, unsigned int unMask)
|
||||
|
||||
unsigned int CDECL _controlfp(unsigned int newval, unsigned int mask)
|
||||
{
|
||||
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");
|
||||
#ifdef __i386__
|
||||
return _control87( newval, mask & ~_EM_DENORMAL );
|
||||
#else
|
||||
#endif /*__GNUC__*/
|
||||
return __res;
|
||||
FIXME(":Not Implemented!\n");
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* _control87 (MSVCRT.@)
|
||||
*/
|
||||
unsigned int CDECL _control87(unsigned int newval, unsigned int mask)
|
||||
{
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
unsigned int fpword = 0;
|
||||
unsigned int flags = 0;
|
||||
|
||||
TRACE("(%08x, %08x): Called\n", newval, mask);
|
||||
|
||||
/* Get fp control word */
|
||||
__asm__ __volatile__( "fstcw %0" : "=m" (fpword) : );
|
||||
|
||||
TRACE("Control word before : %08x\n", fpword);
|
||||
|
||||
/* Convert into mask constants */
|
||||
if (fpword & 0x1) flags |= _EM_INVALID;
|
||||
if (fpword & 0x2) flags |= _EM_DENORMAL;
|
||||
if (fpword & 0x4) flags |= _EM_ZERODIVIDE;
|
||||
if (fpword & 0x8) flags |= _EM_OVERFLOW;
|
||||
if (fpword & 0x10) flags |= _EM_UNDERFLOW;
|
||||
if (fpword & 0x20) flags |= _EM_INEXACT;
|
||||
switch(fpword & 0xC00) {
|
||||
case 0xC00: flags |= _RC_UP|_RC_DOWN; break;
|
||||
case 0x800: flags |= _RC_UP; break;
|
||||
case 0x400: flags |= _RC_DOWN; break;
|
||||
}
|
||||
switch(fpword & 0x300) {
|
||||
case 0x0: flags |= _PC_24; break;
|
||||
case 0x200: flags |= _PC_53; break;
|
||||
case 0x300: flags |= _PC_64; break;
|
||||
}
|
||||
if (fpword & 0x1000) flags |= _IC_AFFINE;
|
||||
|
||||
/* Mask with parameters */
|
||||
flags = (flags & ~mask) | (newval & mask);
|
||||
|
||||
/* Convert (masked) value back to fp word */
|
||||
fpword = 0;
|
||||
if (flags & _EM_INVALID) fpword |= 0x1;
|
||||
if (flags & _EM_DENORMAL) fpword |= 0x2;
|
||||
if (flags & _EM_ZERODIVIDE) fpword |= 0x4;
|
||||
if (flags & _EM_OVERFLOW) fpword |= 0x8;
|
||||
if (flags & _EM_UNDERFLOW) fpword |= 0x10;
|
||||
if (flags & _EM_INEXACT) fpword |= 0x20;
|
||||
switch(flags & (_RC_UP | _RC_DOWN)) {
|
||||
case _RC_UP|_RC_DOWN: fpword |= 0xC00; break;
|
||||
case _RC_UP: fpword |= 0x800; break;
|
||||
case _RC_DOWN: fpword |= 0x400; break;
|
||||
}
|
||||
switch (flags & (_PC_24 | _PC_53)) {
|
||||
case _PC_64: fpword |= 0x300; break;
|
||||
case _PC_53: fpword |= 0x200; break;
|
||||
case _PC_24: fpword |= 0x0; break;
|
||||
}
|
||||
if (flags & _IC_AFFINE) fpword |= 0x1000;
|
||||
|
||||
TRACE("Control word after : %08x\n", fpword);
|
||||
|
||||
/* Put fp control word */
|
||||
__asm__ __volatile__( "fldcw %0" : : "m" (fpword) );
|
||||
|
||||
return flags;
|
||||
#else
|
||||
FIXME(":Not Implemented!\n");
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -9,21 +9,34 @@
|
|||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
#include "float.h"
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
//WTF IS HAPPENING WITH float.h !??!?!
|
||||
#define _SW_INVALID 0x00000010 /* invalid */
|
||||
#define _SW_ZERODIVIDE 0x00000008 /* zero divide */
|
||||
#define _SW_UNDERFLOW 0x00000002 /* underflow */
|
||||
#define _SW_OVERFLOW 0x00000004 /* overflow */
|
||||
#define _SW_INEXACT 0x00000001 /* inexact (precision) */
|
||||
#define _SW_DENORMAL 0x00080000 /* denormal status bit */
|
||||
|
||||
/**********************************************************************
|
||||
* _statusfp (MSVCRT.@)
|
||||
*/
|
||||
unsigned int _statusfp (void)
|
||||
unsigned int CDECL _statusfp(void)
|
||||
{
|
||||
unsigned int retVal = 0;
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
unsigned int fpword;
|
||||
|
||||
register unsigned short __res;
|
||||
#ifdef __GNUC__
|
||||
__asm__ __volatile__ (
|
||||
"fstsw %0 \n\t"
|
||||
// "movzwl %ax, %eax"
|
||||
:"=a" (__res)
|
||||
);
|
||||
__asm__ __volatile__( "fstsw %0" : "=m" (fpword) : );
|
||||
if (fpword & 0x1) retVal |= _SW_INVALID;
|
||||
if (fpword & 0x2) retVal |= _SW_DENORMAL;
|
||||
if (fpword & 0x4) retVal |= _SW_ZERODIVIDE;
|
||||
if (fpword & 0x8) retVal |= _SW_OVERFLOW;
|
||||
if (fpword & 0x10) retVal |= _SW_UNDERFLOW;
|
||||
if (fpword & 0x20) retVal |= _SW_INEXACT;
|
||||
#else
|
||||
#endif /*__GNUC__*/
|
||||
return __res;
|
||||
FIXME(":Not implemented!\n");
|
||||
#endif
|
||||
return retVal;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
double _nextafter( double x, double y )
|
||||
{
|
||||
WARN("This function is not implemented correctly\n");
|
||||
if ( x == y)
|
||||
return x;
|
||||
|
||||
|
|
|
@ -72,11 +72,18 @@
|
|||
#define _FPCLASS_PINF 0x0200 /* Positive Infinity */
|
||||
#endif /* __MINGW_FPCLASS_DEFINED */
|
||||
|
||||
/* invalid subconditions (_SW_INVALID also set) */
|
||||
#define _SW_UNEMULATED 0x0040 /* unemulated instruction */
|
||||
#define _SW_SQRTNEG 0x0080 /* square root of a neg number */
|
||||
#define _SW_STACKOVERFLOW 0x0200 /* FP stack overflow */
|
||||
#define _SW_STACKUNDERFLOW 0x0400 /* FP stack underflow */
|
||||
/* _statusfp bit flags */
|
||||
#define _SW_INEXACT 0x00000001 /* inexact (precision) */
|
||||
#define _SW_UNDERFLOW 0x00000002 /* underflow */
|
||||
#define _SW_OVERFLOW 0x00000004 /* overflow */
|
||||
#define _SW_ZERODIVIDE 0x00000008 /* zero divide */
|
||||
#define _SW_INVALID 0x00000010 /* invalid */
|
||||
#define _SW_DENORMAL 0x00080000 /* denormal status bit */
|
||||
|
||||
#define _SW_UNEMULATED 0x00000040 /* unemulated instruction */
|
||||
#define _SW_SQRTNEG 0x00000080 /* square root of a neg number */
|
||||
#define _SW_STACKOVERFLOW 0x00000200 /* FP stack overflow */
|
||||
#define _SW_STACKUNDERFLOW 0x00000400 /* FP stack underflow */
|
||||
|
||||
/* Floating point error signals and return codes */
|
||||
#define _FPE_INVALID 0x81
|
||||
|
@ -169,3 +176,4 @@ _CRTIMP int __cdecl _isnan (double);
|
|||
|
||||
#endif /* _FLOAT_H_ */
|
||||
|
||||
|
||||
|
|
|
@ -1,97 +0,0 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: include/msvcrt/msvcrtdbg.h
|
||||
* PURPOSE: Useful debugging macros
|
||||
* PROGRAMMER:
|
||||
* UPDATE HISTORY:
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* NOTE: Define NDEBUG before including this header to disable debugging
|
||||
* macros
|
||||
*/
|
||||
|
||||
#ifndef __MSVCRT_DEBUG
|
||||
#define __MSVCRT_DEBUG
|
||||
|
||||
#include <roscfg.h>
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
#define MK_STR(s) #s
|
||||
|
||||
#ifdef _UNICODE
|
||||
#define sT "S"
|
||||
#else
|
||||
#define sT "s"
|
||||
#endif
|
||||
|
||||
unsigned long DbgPrint(const char *Format,...);
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define TRACE(...)
|
||||
#endif
|
||||
|
||||
#ifdef DBG
|
||||
#ifdef __GNUC__
|
||||
#define DPRINT1(args...) do { DbgPrint("(MSVCRT:%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
|
||||
#else
|
||||
#define DPRINT1 DbgPrint
|
||||
#endif
|
||||
#define CHECKPOINT1 do { DbgPrint("MSVCRT:%s:%d\n",__FILE__,__LINE__); } while(0);
|
||||
#else
|
||||
#ifdef __GNUC__
|
||||
#define DPRINT1(args...)
|
||||
#else
|
||||
#define DPRINT DbgPrint
|
||||
#endif
|
||||
#define CHECKPOINT1
|
||||
#endif
|
||||
|
||||
#if !defined(NDEBUG) && defined(DBG)
|
||||
#ifdef __GNUC__
|
||||
#define DPRINT(args...) do { DbgPrint("(MSVCRT:%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
|
||||
#endif
|
||||
#define CHECKPOINT do { DbgPrint("MSVCRT:%s:%d\n",__FILE__,__LINE__); } while(0);
|
||||
#else
|
||||
#ifdef __GNUC__
|
||||
#define DPRINT(args...)
|
||||
#else
|
||||
#define DPRINT DbgPrint
|
||||
#endif
|
||||
#define CHECKPOINT
|
||||
#endif /* NDEBUG */
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
#define TRACE_RETURN(format_str, ret_type) \
|
||||
ret_type __return_value__; \
|
||||
static char* __return_format_str__ = "%s ret: "format_str"\n"
|
||||
|
||||
#define FUNCTION(func) \
|
||||
static char* __func_name__ = #func
|
||||
|
||||
#define TRACE(a,b...) DPRINT1(a"\n", b)
|
||||
|
||||
#define RETURN(a) \
|
||||
do{ __return_value__ = (a); DPRINT1(__return_format_str__ ,__func_name__,__return_value__); return __return_value__ ; }while(0)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* ULONG CDECL DbgPrint(PCH Format, ...); */
|
||||
ULONG DbgPrint(PCCH Format,...);
|
||||
/* unsigned long DbgPrint(const char* Format, ...); */
|
||||
|
||||
|
||||
|
||||
/* #define TRACE 0 ? (void)0 : Trace */
|
||||
|
||||
/* void Trace(TCHAR* lpszFormat, ...); */
|
||||
|
||||
|
||||
|
||||
#endif /* __MSVCRT_DEBUG */
|
|
@ -1,22 +1,43 @@
|
|||
#ifndef __CRT_INTERNAL_MBSTRING_H
|
||||
#define __CRT_INTERNAL_MBSTRING_H
|
||||
|
||||
#define _KNJ_M ((char)0x01) /* Non-punctuation of Kana-set */
|
||||
#define _KNJ_P ((char)0x02) /* Punctuation of Kana-set */
|
||||
#define _KNJ_1 ((char)0x04) /* Legal 1st byte of double byte stream */
|
||||
#define _KNJ_2 ((char)0x08) /* Legal 2nd btye of double byte stream */
|
||||
#define _MALPHA 0x01
|
||||
#define _MBLANK 0x02
|
||||
#define _MDIGIT 0x04
|
||||
#define _MKMOJI 0x08
|
||||
#define _MKPNCT 0x10
|
||||
#define _MLEAD 0x20
|
||||
#define _MPUNCT 0x40
|
||||
#define _MTRAIL 0x80
|
||||
|
||||
#define _MBALNUM (_MALPHA | _MDIGIT | _MKPNCT | _MKMOJI)
|
||||
#define _MBALPHA (_MALPHA | _MKPNCT | _MKMOJI)
|
||||
#define _MBGRAPH (_MALPHA | _MDIGIT | _MPUNCT | _MKPNCT | _MKMOJI)
|
||||
#define _MBKANA (_MKPNCT | _MKMOJI)
|
||||
#define _MBPRINT (_MALPHA | _MDIGIT | _MPUNCT | _MBLANK | _MKPNCT | _MKMOJI)
|
||||
#define _MBPUNCT (_MPUNCT | _MKPNCT)
|
||||
|
||||
#define ___ 0
|
||||
#define _1_ _KNJ_1 /* Legal 1st byte of double byte code */
|
||||
#define __2 _KNJ_2 /* Legal 2nd byte of double byte code */
|
||||
#define _M_ _KNJ_M /* Non-puntuation in Kana-set */
|
||||
#define _P_ _KNJ_P /* Punctuation of Kana-set */
|
||||
#define _12 (_1_|__2)
|
||||
#ifndef _M2
|
||||
#define _M2 (_M_|__2)
|
||||
#endif
|
||||
#define _P2 (_P_|__2)
|
||||
#define _MBLMASK(c) ((c) & 255)
|
||||
#define _MBHMASK(c) ((c) & ~255)
|
||||
#define _MBGETL(c) ((c) & 255)
|
||||
#define _MBGETH(c) (((c) >> 8) & 255)
|
||||
|
||||
#define _MBIS16(c) ((c) & 0xff00)
|
||||
|
||||
/* Macros */
|
||||
#define B _MBLANK
|
||||
#define D _MDIGIT
|
||||
#define P _MPUNCT
|
||||
#define T _MTRAIL
|
||||
|
||||
/* Macros */
|
||||
#define AT (_MALPHA | _MTRAIL)
|
||||
#define GT (_MKPNCT | _MTRAIL)
|
||||
#define KT (_MKMOJI | _MTRAIL)
|
||||
#define LT (_MLEAD | _MTRAIL)
|
||||
#define PT (_MPUNCT | _MTRAIL)
|
||||
|
||||
extern unsigned char _mbctype[257];
|
||||
|
||||
#if defined (_MSC_VER)
|
||||
|
||||
|
|
|
@ -20,16 +20,9 @@
|
|||
#define __WINE_MSVCRT_H
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "float.h"
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
#include "winnls.h"
|
||||
|
||||
#include "eh.h"
|
||||
|
||||
|
@ -133,44 +126,12 @@ extern void msvcrt_init_console(void);
|
|||
extern void msvcrt_free_console(void);
|
||||
extern void msvcrt_init_args(void);
|
||||
extern void msvcrt_free_args(void);
|
||||
extern void msvcrt_init_signals(void);
|
||||
extern void msvcrt_free_signals(void);
|
||||
|
||||
#define MSVCRT__OUT_TO_DEFAULT 0
|
||||
#define MSVCRT__REPORT_ERRMODE 3
|
||||
|
||||
/* run-time error codes */
|
||||
#define _RT_STACK 0
|
||||
#define _RT_NULLPTR 1
|
||||
#define _RT_FLOAT 2
|
||||
#define _RT_INTDIV 3
|
||||
#define _RT_EXECMEM 5
|
||||
#define _RT_EXECFORM 6
|
||||
#define _RT_EXECENV 7
|
||||
#define _RT_SPACEARG 8
|
||||
#define _RT_SPACEENV 9
|
||||
#define _RT_ABORT 10
|
||||
#define _RT_NPTR 12
|
||||
#define _RT_FPTR 13
|
||||
#define _RT_BREAK 14
|
||||
#define _RT_INT 15
|
||||
#define _RT_THREAD 16
|
||||
#define _RT_LOCK 17
|
||||
#define _RT_HEAP 18
|
||||
#define _RT_OPENCON 19
|
||||
#define _RT_QWIN 20
|
||||
#define _RT_NOMAIN 21
|
||||
#define _RT_NONCONT 22
|
||||
#define _RT_INVALDISP 23
|
||||
#define _RT_ONEXIT 24
|
||||
#define _RT_PUREVIRT 25
|
||||
#define _RT_STDIOINIT 26
|
||||
#define _RT_LOWIOINIT 27
|
||||
#define _RT_HEAPINIT 28
|
||||
#define _RT_DOMAIN 120
|
||||
#define _RT_SING 121
|
||||
#define _RT_TLOSS 122
|
||||
#define _RT_CRNL 252
|
||||
#define _RT_BANNER 255
|
||||
|
||||
#ifdef __i386__
|
||||
struct MSVCRT___JUMP_BUFFER {
|
||||
unsigned long Ebp;
|
||||
|
@ -203,7 +164,9 @@ typedef void* (*malloc_func_t)(size_t);
|
|||
typedef void (*free_func_t)(void*);
|
||||
#define MSVCRT_malloc malloc
|
||||
#define MSVCRT_free free
|
||||
char* _setlocale(int,const char*);
|
||||
NTSYSAPI VOID NTAPI RtlAssert(PVOID FailedAssertion,PVOID FileName,ULONG LineNumber,PCHAR Message);
|
||||
extern char* __unDName(char *,const char*,int,malloc_func_t,free_func_t,unsigned short int);
|
||||
|
||||
|
||||
#endif /* __WINE_MSVCRT_H */
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#include <precomp.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
#ifdef _UNICODE
|
||||
#define _TS S
|
||||
#define sT "S"
|
||||
#else
|
||||
#define _TS s
|
||||
#define sT "s"
|
||||
#endif
|
||||
|
||||
#define MK_STR(s) #s
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
|
@ -17,9 +17,9 @@
|
|||
int _taccess( const _TCHAR *_path, int _amode )
|
||||
{
|
||||
DWORD Attributes = GetFileAttributes(_path);
|
||||
DPRINT(MK_STR(_taccess)"('%"sT"', %x)\n", _path, _amode);
|
||||
TRACE(MK_STR(_taccess)"('%"sT"', %x)\n", _path, _amode);
|
||||
|
||||
if (Attributes == (DWORD)-1) {
|
||||
if (!_path || Attributes == INVALID_FILE_ATTRIBUTES) {
|
||||
_dosmaperr(GetLastError());
|
||||
return -1;
|
||||
}
|
||||
|
@ -33,15 +33,13 @@ int _taccess( const _TCHAR *_path, int _amode )
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* INTERNAL
|
||||
*/
|
||||
int access_dirT(const _TCHAR *_path)
|
||||
{
|
||||
DWORD Attributes = GetFileAttributes(_path);
|
||||
DPRINT(MK_STR(is_dirT)"('%"sT"')\n", _path);
|
||||
TRACE(MK_STR(is_dirT)"('%"sT"')\n", _path);
|
||||
|
||||
if (Attributes == (DWORD)-1) {
|
||||
_dosmaperr(GetLastError());
|
||||
|
@ -57,3 +55,4 @@ int access_dirT(const _TCHAR *_path)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -12,12 +12,15 @@
|
|||
#include <sys/stat.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
|
||||
#define mode_t int
|
||||
|
||||
#define MK_STR(s) #s
|
||||
|
||||
#ifdef _UNICODE
|
||||
#define sT "S"
|
||||
#else
|
||||
#define sT "s"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
|
@ -27,10 +30,10 @@ int _tchmod(const _TCHAR* filename, mode_t mode)
|
|||
DWORD FileAttributes = 0;
|
||||
BOOLEAN Set = FALSE;
|
||||
|
||||
DPRINT(MK_STR(_tchmod)"('%"sT"', %x)\n", filename, mode);
|
||||
TRACE(MK_STR(_tchmod)"('%"sT"', %x)\n", filename, mode);
|
||||
|
||||
FileAttributes = GetFileAttributes(filename);
|
||||
if ( FileAttributes == (DWORD)-1 ) {
|
||||
if ( FileAttributes == INVALID_FILE_ATTRIBUTES ) {
|
||||
_dosmaperr(GetLastError());
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <precomp.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _chsize(int _fd, long size)
|
||||
{
|
||||
DPRINT("_chsize(fd %d, size %d)\n", _fd, size);
|
||||
TRACE("_chsize(fd %d, size %d)\n", _fd, size);
|
||||
long location = _lseek(_fd, 0, SEEK_CUR);
|
||||
if (location == -1) return -1;
|
||||
if (_lseek(_fd, size, 0) == -1)
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
|
@ -12,9 +10,12 @@ int _close(int _fd)
|
|||
|
||||
if (_fd == -1)
|
||||
return(-1);
|
||||
if (CloseHandle((HANDLE)_get_osfhandle(_fd)) == FALSE)
|
||||
return(-1);
|
||||
//return
|
||||
if (!CloseHandle((HANDLE)_get_osfhandle(_fd)))
|
||||
{
|
||||
WARN(":failed-last error (%d)\n",GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
return -1;
|
||||
}
|
||||
free_fd(_fd);
|
||||
return(0);
|
||||
}
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
#include <precomp.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
|
||||
/*
|
||||
|
@ -19,6 +17,6 @@
|
|||
*/
|
||||
int _creat(const char* filename, int mode)
|
||||
{
|
||||
DPRINT("_creat('%s', mode %x)\n", filename, mode);
|
||||
TRACE("_creat('%s', mode %x)\n", filename, mode);
|
||||
return _open(filename,_O_CREAT|_O_TRUNC,mode);
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
|
|
|
@ -15,9 +15,6 @@
|
|||
|
||||
#include <precomp.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
|
@ -27,7 +24,7 @@ char* _mktemp(char* _template)
|
|||
char *cp, *dp;
|
||||
int i, len, xcount, loopcnt;
|
||||
|
||||
DPRINT("_mktemp('%s')\n", _template);
|
||||
TRACE("_mktemp('%s')\n", _template);
|
||||
len = strlen (_template);
|
||||
cp = _template + len;
|
||||
|
||||
|
|
|
@ -46,10 +46,6 @@
|
|||
#include <string.h>
|
||||
#include <share.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
|
||||
|
||||
FDINFO first_bucket[FDINFO_ENTRIES_PER_BUCKET];
|
||||
FDINFO* __pioinfo[FDINFO_BUCKETS] = {first_bucket};
|
||||
|
@ -96,12 +92,12 @@ __inline BOOL is_valid_fd(int fd)
|
|||
if (!b){
|
||||
if (fd >= 0 && fd < g_fdend)
|
||||
{
|
||||
DPRINT1("not valid fd %i, g_fdend %i, fdinfo %x, bucket %x, fdflags %x\n",
|
||||
ERR("not valid fd %i, g_fdend %i, fdinfo %x, bucket %x, fdflags %x\n",
|
||||
fd,g_fdend,fdinfo(fd),fdinfo_bucket(fd),fdinfo(fd)->fdflags);
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT1("not valid fd %i, g_fdend %i\n",fd,g_fdend);
|
||||
ERR("not valid fd %i, g_fdend %i\n",fd,g_fdend);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -128,7 +124,7 @@ char split_oflags(int oflags)
|
|||
if (oflags & ~(_O_BINARY|_O_TEXT|_O_APPEND|_O_TRUNC|
|
||||
_O_EXCL|_O_CREAT|_O_RDWR|_O_WRONLY|
|
||||
_O_TEMPORARY|_O_NOINHERIT))
|
||||
DPRINT1(":unsupported oflags 0x%04x\n",oflags);
|
||||
ERR(":unsupported oflags 0x%04x\n",oflags);
|
||||
|
||||
return fdflags;
|
||||
}
|
||||
|
@ -145,116 +141,29 @@ char __is_text_file(FILE* p)
|
|||
return (!((p)->_flag&_IOSTRG) && (fdinfo((p)->_file)->fdflags & FTEXT));
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
|
||||
/*********************************************************************
|
||||
* _open (MSVCRT.@)
|
||||
*/
|
||||
int _open(const char* _path, int _oflag,...)
|
||||
int CDECL _open( const char *path, int flags, ... )
|
||||
{
|
||||
#if !defined(NDEBUG) && defined(DBG)
|
||||
va_list arg;
|
||||
int pmode;
|
||||
#endif
|
||||
HANDLE hFile;
|
||||
DWORD dwDesiredAccess = 0;
|
||||
DWORD dwShareMode = 0;
|
||||
DWORD dwCreationDistribution = 0;
|
||||
DWORD dwFlagsAndAttributes = 0;
|
||||
SECURITY_ATTRIBUTES sa = {sizeof(SECURITY_ATTRIBUTES), NULL, TRUE};
|
||||
va_list ap;
|
||||
|
||||
#if !defined(NDEBUG) && defined(DBG)
|
||||
va_start(arg, _oflag);
|
||||
pmode = va_arg(arg, int);
|
||||
#endif
|
||||
|
||||
|
||||
TRACE("_open('%s', %x, (%x))\n", _path, _oflag);
|
||||
|
||||
|
||||
if ((_oflag & S_IREAD ) == S_IREAD)
|
||||
dwShareMode = FILE_SHARE_READ;
|
||||
else if ((_oflag & S_IWRITE) == S_IWRITE) {
|
||||
dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
|
||||
}
|
||||
/*
|
||||
*
|
||||
* _O_BINARY Opens file in binary (untranslated) mode. (See fopen for a description of binary mode.)
|
||||
* _O_TEXT Opens file in text (translated) mode. (For more information, see Text and Binary Mode File I/O and fopen.)
|
||||
*
|
||||
* _O_APPEND Moves file pointer to end of file before every write operation.
|
||||
*/
|
||||
#ifdef _OLD_BUILD_
|
||||
if ((_oflag & _O_RDWR) == _O_RDWR)
|
||||
dwDesiredAccess |= GENERIC_WRITE|GENERIC_READ;
|
||||
else if ((_oflag & O_RDONLY) == O_RDONLY)
|
||||
dwDesiredAccess |= GENERIC_READ;
|
||||
else if ((_oflag & _O_WRONLY) == _O_WRONLY)
|
||||
dwDesiredAccess |= GENERIC_WRITE ;
|
||||
#else
|
||||
if ((_oflag & _O_WRONLY) == _O_WRONLY )
|
||||
dwDesiredAccess |= GENERIC_WRITE ;
|
||||
else if ((_oflag & _O_RDWR) == _O_RDWR )
|
||||
dwDesiredAccess |= GENERIC_WRITE|GENERIC_READ;
|
||||
else //if ((_oflag & O_RDONLY) == O_RDONLY)
|
||||
dwDesiredAccess |= GENERIC_READ;
|
||||
#endif
|
||||
|
||||
if (( _oflag & (_O_CREAT | _O_EXCL)) == (_O_CREAT | _O_EXCL))
|
||||
dwCreationDistribution |= CREATE_NEW;
|
||||
|
||||
else if ((_oflag & O_TRUNC ) == O_TRUNC) {
|
||||
if ((_oflag & O_CREAT ) == O_CREAT)
|
||||
dwCreationDistribution |= CREATE_ALWAYS;
|
||||
else if ((_oflag & O_RDONLY ) != O_RDONLY)
|
||||
dwCreationDistribution |= TRUNCATE_EXISTING;
|
||||
}
|
||||
else if ((_oflag & _O_APPEND) == _O_APPEND)
|
||||
dwCreationDistribution |= OPEN_EXISTING;
|
||||
else if ((_oflag & _O_CREAT) == _O_CREAT)
|
||||
dwCreationDistribution |= OPEN_ALWAYS;
|
||||
else
|
||||
dwCreationDistribution |= OPEN_EXISTING;
|
||||
|
||||
if ((_oflag & _O_RANDOM) == _O_RANDOM )
|
||||
dwFlagsAndAttributes |= FILE_FLAG_RANDOM_ACCESS;
|
||||
if ((_oflag & _O_SEQUENTIAL) == _O_SEQUENTIAL)
|
||||
dwFlagsAndAttributes |= FILE_FLAG_SEQUENTIAL_SCAN;
|
||||
if ((_oflag & _O_TEMPORARY) == _O_TEMPORARY) {
|
||||
dwFlagsAndAttributes |= FILE_FLAG_DELETE_ON_CLOSE;
|
||||
DPRINT("FILE_FLAG_DELETE_ON_CLOSE\n");
|
||||
}
|
||||
if ((_oflag & _O_SHORT_LIVED) == _O_SHORT_LIVED) {
|
||||
dwFlagsAndAttributes |= FILE_FLAG_DELETE_ON_CLOSE;
|
||||
DPRINT("FILE_FLAG_DELETE_ON_CLOSE\n");
|
||||
}
|
||||
if (_oflag & _O_NOINHERIT)
|
||||
sa.bInheritHandle = FALSE;
|
||||
|
||||
if (dwCreationDistribution == OPEN_EXISTING &&
|
||||
(dwDesiredAccess & (GENERIC_WRITE|GENERIC_READ)) == GENERIC_READ) {
|
||||
/* Allow always shared read for a file which is opened for read only */
|
||||
dwShareMode |= FILE_SHARE_READ;
|
||||
}
|
||||
|
||||
hFile = CreateFileA(_path,
|
||||
dwDesiredAccess,
|
||||
dwShareMode,
|
||||
&sa,
|
||||
dwCreationDistribution,
|
||||
dwFlagsAndAttributes,
|
||||
NULL);
|
||||
if (hFile == (HANDLE)-1) {
|
||||
_dosmaperr(GetLastError());
|
||||
return( -1);
|
||||
}
|
||||
DPRINT("OK\n");
|
||||
if (!(_oflag & (_O_TEXT|_O_BINARY))) {
|
||||
_oflag |= _fmode;
|
||||
}
|
||||
return(alloc_fd(hFile, split_oflags(_oflag)));
|
||||
if (flags & O_CREAT)
|
||||
{
|
||||
int pmode;
|
||||
va_start(ap, flags);
|
||||
pmode = va_arg(ap, int);
|
||||
va_end(ap);
|
||||
return _sopen( path, flags, SH_DENYNO, pmode );
|
||||
}
|
||||
else
|
||||
return _sopen( path, flags, SH_DENYNO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* INTERNAL
|
||||
*/
|
||||
|
@ -299,7 +208,7 @@ static int alloc_fd_from(HANDLE hand, char flag, int fd)
|
|||
|
||||
if (fd >= FDINFO_ENTRIES)
|
||||
{
|
||||
DPRINT1("files exhausted!\n");
|
||||
ERR("files exhausted!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -358,7 +267,7 @@ static int alloc_fd_from(HANDLE hand, char flag, int fd)
|
|||
alloc_init_bucket(g_fdstart);
|
||||
}
|
||||
|
||||
DPRINT("fdstart is %d, fdend is %d\n", g_fdstart, g_fdend);
|
||||
TRACE("fdstart is %d, fdend is %d\n", g_fdstart, g_fdend);
|
||||
|
||||
switch (fd)
|
||||
{
|
||||
|
@ -686,44 +595,3 @@ unsigned create_io_inherit_block(STARTUPINFOA* si)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _setmode(int fd, int newmode)
|
||||
{
|
||||
int prevmode;
|
||||
|
||||
TRACE("_setmode(%d, %d)", fd, newmode);
|
||||
|
||||
if (!is_valid_fd(fd))
|
||||
{
|
||||
DPRINT1("_setmode: inval fd (%d)\n",fd);
|
||||
//errno = EBADF;
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if (newmode & ~(_O_TEXT|_O_BINARY))
|
||||
{
|
||||
DPRINT1("_setmode: fd (%d) mode (0x%08x) unknown\n",fd,newmode);
|
||||
/* FIXME: Should we fail with EINVAL here? */
|
||||
}
|
||||
|
||||
prevmode = fdinfo(fd)->fdflags & FTEXT ? _O_TEXT : _O_BINARY;
|
||||
|
||||
if ((newmode & _O_TEXT) == _O_TEXT)
|
||||
{
|
||||
fdinfo(fd)->fdflags |= FTEXT;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME: If both _O_TEXT and _O_BINARY are set, we get here.
|
||||
* Should we fail with EINVAL instead? -Gunnar
|
||||
*/
|
||||
fdinfo(fd)->fdflags &= ~FTEXT;
|
||||
}
|
||||
|
||||
return(prevmode);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,10 +11,6 @@
|
|||
|
||||
#include <precomp.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
|
|
|
@ -14,9 +14,6 @@
|
|||
|
||||
#include <precomp.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
|
@ -27,7 +24,7 @@ int _read(int _fd, void *_buf, unsigned int _nbyte)
|
|||
HANDLE hfile;
|
||||
int istext, error;
|
||||
|
||||
DPRINT("_read(fd %d, buf %x, nbyte %d)\n", _fd, _buf, _nbyte);
|
||||
TRACE("_read(fd %d, buf %x, nbyte %d)\n", _fd, _buf, _nbyte);
|
||||
|
||||
/* null read */
|
||||
if(_nbyte == 0)
|
||||
|
@ -95,6 +92,6 @@ int _read(int _fd, void *_buf, unsigned int _nbyte)
|
|||
/* ignore the carriage returns */
|
||||
_rbyte -= cr;
|
||||
}
|
||||
DPRINT("%d\n", _rbyte);
|
||||
TRACE("%d\n", _rbyte);
|
||||
return _rbyte;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,45 @@
|
|||
*/
|
||||
#include <precomp.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
__inline BOOL is_valid_fd(int fd);
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _setmode(int fd, int newmode)
|
||||
{
|
||||
int prevmode;
|
||||
|
||||
TRACE("_setmode(%d, %d)", fd, newmode);
|
||||
|
||||
if (!is_valid_fd(fd))
|
||||
{
|
||||
ERR("_setmode: inval fd (%d)\n",fd);
|
||||
//errno = EBADF;
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if (newmode & ~(_O_TEXT|_O_BINARY))
|
||||
{
|
||||
ERR("_setmode: fd (%d) mode (0x%08x) unknown\n",fd,newmode);
|
||||
/* FIXME: Should we fail with EINVAL here? */
|
||||
}
|
||||
|
||||
prevmode = fdinfo(fd)->fdflags & FTEXT ? _O_TEXT : _O_BINARY;
|
||||
|
||||
if ((newmode & _O_TEXT) == _O_TEXT)
|
||||
{
|
||||
fdinfo(fd)->fdflags |= FTEXT;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* FIXME: If both _O_TEXT and _O_BINARY are set, we get here.
|
||||
* Should we fail with EINVAL instead? -Gunnar
|
||||
*/
|
||||
fdinfo(fd)->fdflags &= ~FTEXT;
|
||||
}
|
||||
|
||||
return(prevmode);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -13,8 +13,99 @@
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _sopen(const char *path, int access, int shflag, ... /*mode, permissin*/)
|
||||
/*********************************************************************
|
||||
* _sopen (MSVCRT.@)
|
||||
*/
|
||||
int CDECL _sopen( const char *path, int oflags, int shflags, ... )
|
||||
{
|
||||
//FIXME: vararg
|
||||
return _open((path), (access)|(shflag));//, (mode));
|
||||
va_list ap;
|
||||
int pmode;
|
||||
DWORD access = 0, creation = 0, attrib;
|
||||
DWORD sharing;
|
||||
int wxflag = 0, fd;
|
||||
HANDLE hand;
|
||||
SECURITY_ATTRIBUTES sa;
|
||||
|
||||
|
||||
TRACE(":file (%s) oflags: 0x%04x shflags: 0x%04x\n",
|
||||
path, oflags, shflags);
|
||||
|
||||
wxflag = split_oflags(oflags);
|
||||
switch (oflags & (O_RDONLY | O_WRONLY | O_RDWR))
|
||||
{
|
||||
case O_RDONLY: access |= GENERIC_READ; break;
|
||||
case O_WRONLY: access |= GENERIC_WRITE; break;
|
||||
case O_RDWR: access |= GENERIC_WRITE | GENERIC_READ; break;
|
||||
}
|
||||
|
||||
if (oflags & O_CREAT)
|
||||
{
|
||||
va_start(ap, shflags);
|
||||
pmode = va_arg(ap, int);
|
||||
va_end(ap);
|
||||
|
||||
if(pmode & ~(S_IREAD | S_IWRITE))
|
||||
FIXME(": pmode 0x%04x ignored\n", pmode);
|
||||
else
|
||||
WARN(": pmode 0x%04x ignored\n", pmode);
|
||||
|
||||
if (oflags & O_EXCL)
|
||||
creation = CREATE_NEW;
|
||||
else if (oflags & O_TRUNC)
|
||||
creation = CREATE_ALWAYS;
|
||||
else
|
||||
creation = OPEN_ALWAYS;
|
||||
}
|
||||
else /* no O_CREAT */
|
||||
{
|
||||
if (oflags & O_TRUNC)
|
||||
creation = TRUNCATE_EXISTING;
|
||||
else
|
||||
creation = OPEN_EXISTING;
|
||||
}
|
||||
|
||||
switch( shflags )
|
||||
{
|
||||
case SH_DENYRW:
|
||||
sharing = 0L;
|
||||
break;
|
||||
case SH_DENYWR:
|
||||
sharing = FILE_SHARE_READ;
|
||||
break;
|
||||
case SH_DENYRD:
|
||||
sharing = FILE_SHARE_WRITE;
|
||||
break;
|
||||
case SH_DENYNO:
|
||||
sharing = FILE_SHARE_READ | FILE_SHARE_WRITE;
|
||||
break;
|
||||
default:
|
||||
ERR( "Unhandled shflags 0x%x\n", shflags );
|
||||
return -1;
|
||||
}
|
||||
attrib = FILE_ATTRIBUTE_NORMAL;
|
||||
|
||||
if (oflags & O_TEMPORARY)
|
||||
{
|
||||
attrib |= FILE_FLAG_DELETE_ON_CLOSE;
|
||||
access |= DELETE;
|
||||
sharing |= FILE_SHARE_DELETE;
|
||||
}
|
||||
|
||||
sa.nLength = sizeof( SECURITY_ATTRIBUTES );
|
||||
sa.lpSecurityDescriptor = NULL;
|
||||
sa.bInheritHandle = (oflags & O_NOINHERIT) ? FALSE : TRUE;
|
||||
|
||||
hand = CreateFileA(path, access, sharing, &sa, creation, attrib, 0);
|
||||
|
||||
if (hand == INVALID_HANDLE_VALUE) {
|
||||
WARN(":failed-last error (%d)\n",GetLastError());
|
||||
_dosmaperr(GetLastError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
fd = alloc_fd(hand, wxflag);
|
||||
|
||||
TRACE(":fd (%d) handle (%p)\n",fd, hand);
|
||||
return fd;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,16 +10,12 @@
|
|||
|
||||
#include <precomp.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _unlink(const char* filename)
|
||||
{
|
||||
DPRINT("_unlink('%s')\n", filename);
|
||||
TRACE("_unlink('%s')\n", filename);
|
||||
if (!DeleteFileA(filename)) {
|
||||
_dosmaperr(GetLastError());
|
||||
return -1;
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
#include <precomp.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
|
||||
/*
|
||||
|
@ -19,6 +17,6 @@
|
|||
*/
|
||||
int _wcreat(const wchar_t* filename, int mode)
|
||||
{
|
||||
DPRINT("_wcreat('%S', mode %x)\n", filename, mode);
|
||||
TRACE("_wcreat('%S', mode %x)\n", filename, mode);
|
||||
return _wopen(filename,_O_CREAT|_O_TRUNC,mode);
|
||||
}
|
|
@ -15,9 +15,6 @@
|
|||
|
||||
#include <precomp.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
|
@ -28,7 +25,7 @@ wchar_t* _wmktemp (wchar_t *_template)
|
|||
wchar_t *cp, *dp;
|
||||
int i, len, xcount, loopcnt;
|
||||
|
||||
DPRINT("_wmktemp('%S')\n", _template);
|
||||
TRACE("_wmktemp('%S')\n", _template);
|
||||
len = wcslen (_template);
|
||||
cp = _template + len;
|
||||
|
||||
|
|
|
@ -19,125 +19,53 @@
|
|||
#include <sys/stat.h>
|
||||
#include <share.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
/*********************************************************************
|
||||
* _wopen (MSVCRT.@)
|
||||
*/
|
||||
int _wopen(const wchar_t* _path, int _oflag, ...)
|
||||
int CDECL _wopen(const wchar_t *path,int flags,...)
|
||||
{
|
||||
#if !defined(NDEBUG) && defined(DBG)
|
||||
va_list arg;
|
||||
int pmode;
|
||||
#endif
|
||||
HANDLE hFile;
|
||||
DWORD dwDesiredAccess = 0;
|
||||
DWORD dwShareMode = 0;
|
||||
DWORD dwCreationDistribution = 0;
|
||||
DWORD dwFlagsAndAttributes = 0;
|
||||
SECURITY_ATTRIBUTES sa = {sizeof(SECURITY_ATTRIBUTES), NULL, TRUE};
|
||||
const unsigned int len = strlenW(path);
|
||||
char *patha = calloc(len + 1,1);
|
||||
va_list ap;
|
||||
int pmode;
|
||||
|
||||
#if !defined(NDEBUG) && defined(DBG)
|
||||
va_start(arg, _oflag);
|
||||
pmode = va_arg(arg, int);
|
||||
#endif
|
||||
va_start(ap, flags);
|
||||
pmode = va_arg(ap, int);
|
||||
va_end(ap);
|
||||
|
||||
// DPRINT("_wopen('%S', %x, (%x))\n", _path, _oflag, pmode);
|
||||
if (patha && WideCharToMultiByte(CP_ACP,0,path,len,patha,len,NULL,NULL))
|
||||
{
|
||||
int retval = _open(patha,flags,pmode);
|
||||
free(patha);
|
||||
return retval;
|
||||
}
|
||||
|
||||
if ((_oflag & S_IREAD) == S_IREAD)
|
||||
dwShareMode = FILE_SHARE_READ;
|
||||
else if ( ( _oflag & S_IWRITE) == S_IWRITE) {
|
||||
dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* _O_BINARY Opens file in binary (untranslated) mode. (See fopen for a description of binary mode.)
|
||||
* _O_TEXT Opens file in text (translated) mode. (For more information, see Text and Binary Mode File I/O and fopen.)
|
||||
*
|
||||
* _O_APPEND Moves file pointer to end of file before every write operation.
|
||||
*/
|
||||
#if 0
|
||||
if ((_oflag & _O_RDWR) == _O_RDWR)
|
||||
dwDesiredAccess |= GENERIC_WRITE|GENERIC_READ | FILE_READ_DATA |
|
||||
FILE_WRITE_DATA | FILE_READ_ATTRIBUTES |
|
||||
FILE_WRITE_ATTRIBUTES;
|
||||
else if ((_oflag & O_RDONLY) == O_RDONLY)
|
||||
dwDesiredAccess |= GENERIC_READ | FILE_READ_DATA | FILE_READ_ATTRIBUTES |
|
||||
FILE_WRITE_ATTRIBUTES;
|
||||
else if ((_oflag & _O_WRONLY) == _O_WRONLY)
|
||||
dwDesiredAccess |= GENERIC_WRITE | FILE_WRITE_DATA |
|
||||
FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES;
|
||||
#else
|
||||
if ((_oflag & _O_WRONLY) == _O_WRONLY)
|
||||
dwDesiredAccess |= GENERIC_WRITE | FILE_WRITE_DATA |
|
||||
FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES;
|
||||
else if ((_oflag & _O_RDWR) == _O_RDWR)
|
||||
dwDesiredAccess |= GENERIC_WRITE|GENERIC_READ | FILE_READ_DATA |
|
||||
FILE_WRITE_DATA | FILE_READ_ATTRIBUTES |
|
||||
FILE_WRITE_ATTRIBUTES;
|
||||
else //if ((_oflag & O_RDONLY) == O_RDONLY)
|
||||
dwDesiredAccess |= GENERIC_READ | FILE_READ_DATA | FILE_READ_ATTRIBUTES |
|
||||
FILE_WRITE_ATTRIBUTES;
|
||||
#endif
|
||||
|
||||
if ((_oflag & S_IREAD) == S_IREAD)
|
||||
dwShareMode |= FILE_SHARE_READ;
|
||||
|
||||
if ((_oflag & S_IWRITE) == S_IWRITE)
|
||||
dwShareMode |= FILE_SHARE_WRITE;
|
||||
|
||||
if ((_oflag & (_O_CREAT | _O_EXCL)) == (_O_CREAT | _O_EXCL))
|
||||
dwCreationDistribution |= CREATE_NEW;
|
||||
|
||||
else if ((_oflag & O_TRUNC) == O_TRUNC) {
|
||||
if ((_oflag & O_CREAT) == O_CREAT)
|
||||
dwCreationDistribution |= CREATE_ALWAYS;
|
||||
else if ((_oflag & O_RDONLY) != O_RDONLY)
|
||||
dwCreationDistribution |= TRUNCATE_EXISTING;
|
||||
}
|
||||
else if ((_oflag & _O_APPEND) == _O_APPEND)
|
||||
dwCreationDistribution |= OPEN_EXISTING;
|
||||
else if ((_oflag & _O_CREAT) == _O_CREAT)
|
||||
dwCreationDistribution |= OPEN_ALWAYS;
|
||||
else
|
||||
dwCreationDistribution |= OPEN_EXISTING;
|
||||
|
||||
if ((_oflag & _O_RANDOM) == _O_RANDOM)
|
||||
dwFlagsAndAttributes |= FILE_FLAG_RANDOM_ACCESS;
|
||||
if ((_oflag & _O_SEQUENTIAL) == _O_SEQUENTIAL)
|
||||
dwFlagsAndAttributes |= FILE_FLAG_SEQUENTIAL_SCAN;
|
||||
|
||||
if ((_oflag & _O_TEMPORARY) == _O_TEMPORARY)
|
||||
dwFlagsAndAttributes |= FILE_FLAG_DELETE_ON_CLOSE;
|
||||
|
||||
if ((_oflag & _O_SHORT_LIVED) == _O_SHORT_LIVED)
|
||||
dwFlagsAndAttributes |= FILE_FLAG_DELETE_ON_CLOSE;
|
||||
|
||||
if (_oflag & _O_NOINHERIT)
|
||||
sa.bInheritHandle = FALSE;
|
||||
|
||||
hFile = CreateFileW(_path,
|
||||
dwDesiredAccess,
|
||||
dwShareMode,
|
||||
&sa,
|
||||
dwCreationDistribution,
|
||||
dwFlagsAndAttributes,
|
||||
NULL);
|
||||
if (hFile == (HANDLE)-1) {
|
||||
_dosmaperr(GetLastError());
|
||||
return -1;
|
||||
}
|
||||
return alloc_fd(hFile,split_oflags(_oflag));
|
||||
_dosmaperr(GetLastError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
/*********************************************************************
|
||||
* _wsopen (MSVCRT.@)
|
||||
*/
|
||||
int _wsopen(const wchar_t* path, int access, int shflag,.../* int mode*/)
|
||||
int CDECL _wsopen( const wchar_t* path, int oflags, int shflags, ... )
|
||||
{
|
||||
//FIXME: vararg
|
||||
return _wopen((path), (access)|(shflag));//, (mode));
|
||||
const unsigned int len = strlenW(path);
|
||||
char *patha = calloc(len + 1,1);
|
||||
va_list ap;
|
||||
int pmode;
|
||||
|
||||
va_start(ap, shflags);
|
||||
pmode = va_arg(ap, int);
|
||||
va_end(ap);
|
||||
|
||||
if (patha && WideCharToMultiByte(CP_ACP,0,path,len,patha,len,NULL,NULL))
|
||||
{
|
||||
int retval = sopen(patha,oflags,shflags,pmode);
|
||||
free(patha);
|
||||
return retval;
|
||||
}
|
||||
|
||||
_dosmaperr(GetLastError());
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
#include <precomp.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
#define BUFSIZE 4096
|
||||
/*
|
||||
|
@ -40,7 +38,7 @@ int _write(int _fd, const void* _buf, unsigned int _nbyte)
|
|||
unsigned int count;
|
||||
DWORD wbyte;
|
||||
|
||||
DPRINT("_write(fd %d, buf %x, nbyte %d)\n", _fd, _buf, _nbyte);
|
||||
TRACE("_write(fd %d, buf %x, nbyte %d)\n", _fd, _buf, _nbyte);
|
||||
if (__fileno_getmode(_fd) & O_TEXT) {
|
||||
result = _nbyte;
|
||||
tmp = (char*) malloc(BUFSIZE);
|
||||
|
|
|
@ -10,15 +10,12 @@
|
|||
|
||||
#include <precomp.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _wunlink(const wchar_t* filename)
|
||||
{
|
||||
DPRINT("_wunlink('%S')\n", filename);
|
||||
TRACE("_wunlink('%S')\n", filename);
|
||||
if (!DeleteFileW(filename)) {
|
||||
_dosmaperr(GetLastError());
|
||||
return -1;
|
||||
|
|
|
@ -6,11 +6,8 @@
|
|||
|
||||
#include <precomp.h>
|
||||
#include <locale.h>
|
||||
#include <internal/mtdll.h>
|
||||
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
#include "mbctype.h"
|
||||
|
||||
// mtdll.h
|
||||
#define _SETLOCALE_LOCK 19
|
||||
|
@ -30,6 +27,29 @@
|
|||
*/
|
||||
#define MAX_ELEM_LEN 64 /* Max length of country/language/CP string */
|
||||
#define MAX_LOCALE_LENGTH 256
|
||||
|
||||
unsigned char MSVCRT_mbctype[257];
|
||||
static int g_mbcp_is_multibyte = 0;
|
||||
|
||||
/* It seems that the data about valid trail bytes is not available from kernel32
|
||||
* so we have to store is here. The format is the same as for lead bytes in CPINFO */
|
||||
struct cp_extra_info_t
|
||||
{
|
||||
int cp;
|
||||
BYTE TrailBytes[MAX_LEADBYTES];
|
||||
};
|
||||
|
||||
static struct cp_extra_info_t g_cpextrainfo[] =
|
||||
{
|
||||
{932, {0x40, 0x7e, 0x80, 0xfc, 0, 0}},
|
||||
{936, {0x40, 0xfe, 0, 0}},
|
||||
{949, {0x41, 0xfe, 0, 0}},
|
||||
{950, {0x40, 0x7e, 0xa1, 0xfe, 0, 0}},
|
||||
{20932, {1, 255, 0, 0}}, /* seems to give different results on different systems */
|
||||
{0, {1, 255, 0, 0}} /* match all with FIXME */
|
||||
};
|
||||
|
||||
|
||||
char MSVCRT_current_lc_all[MAX_LOCALE_LENGTH];
|
||||
LCID MSVCRT_current_lc_all_lcid;
|
||||
int MSVCRT___lc_codepage;
|
||||
|
@ -354,7 +374,7 @@ char *setlocale(int category, const char *locale)
|
|||
|
||||
if (locale[0] == 'L' && locale[1] == 'C' && locale[2] == '_')
|
||||
{
|
||||
DPRINT1(":restore previous locale not implemented!\n");
|
||||
WARN(":restore previous locale not implemented!\n");
|
||||
/* FIXME: Easiest way to do this is parse the string and
|
||||
* call this function recursively with its elements,
|
||||
* Where they differ for each lc_ type.
|
||||
|
@ -449,7 +469,7 @@ char *setlocale(int category, const char *locale)
|
|||
|
||||
if (haveCP && !haveCountry && !haveLang)
|
||||
{
|
||||
DPRINT1(":Codepage only locale not implemented\n");
|
||||
ERR(":Codepage only locale not implemented\n");
|
||||
/* FIXME: Use default lang/country and skip locale_to_LCID()
|
||||
* call below...
|
||||
*/
|
||||
|
@ -500,7 +520,7 @@ wchar_t* _wsetlocale(int category, const wchar_t* locale)
|
|||
'E','n','g','l','i','s','h','_','U','n','i','t','e','d',' ',
|
||||
'S','t','a','t','e','s','.','1','2','5','2',0 };
|
||||
|
||||
DPRINT1("%d %S\n", category, locale);
|
||||
TRACE("%d %S\n", category, locale);
|
||||
|
||||
return fake;
|
||||
}
|
||||
|
@ -609,13 +629,127 @@ struct lconv *localeconv(void)
|
|||
|
||||
/*********************************************************************
|
||||
* _setmbcp (MSVCRT.@)
|
||||
*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
void _setmbcp(int cp)
|
||||
int CDECL _setmbcp(int cp)
|
||||
{
|
||||
DPRINT1("_setmbcp - stub\n");
|
||||
return;
|
||||
int newcp;
|
||||
CPINFO cpi;
|
||||
BYTE *bytes;
|
||||
WORD chartypes[256];
|
||||
WORD *curr_type;
|
||||
char bufA[256];
|
||||
WCHAR bufW[256];
|
||||
int charcount;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
TRACE("_setmbcp %d\n",cp);
|
||||
switch (cp)
|
||||
{
|
||||
case _MB_CP_ANSI:
|
||||
newcp = GetACP();
|
||||
break;
|
||||
case _MB_CP_OEM:
|
||||
newcp = GetOEMCP();
|
||||
break;
|
||||
case _MB_CP_LOCALE:
|
||||
newcp = MSVCRT___lc_codepage;
|
||||
break;
|
||||
case _MB_CP_SBCS:
|
||||
newcp = 20127; /* ASCII */
|
||||
break;
|
||||
default:
|
||||
newcp = cp;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!GetCPInfo(newcp, &cpi))
|
||||
{
|
||||
ERR("Codepage %d not found\n", newcp);
|
||||
__set_errno(EINVAL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* setup the _mbctype */
|
||||
memset(MSVCRT_mbctype, 0, sizeof(MSVCRT_mbctype));
|
||||
|
||||
bytes = cpi.LeadByte;
|
||||
while (bytes[0] || bytes[1])
|
||||
{
|
||||
for (i = bytes[0]; i <= bytes[1]; i++)
|
||||
MSVCRT_mbctype[i + 1] |= _M1;
|
||||
bytes += 2;
|
||||
}
|
||||
|
||||
if (cpi.MaxCharSize > 1)
|
||||
{
|
||||
/* trail bytes not available through kernel32 but stored in a structure in msvcrt */
|
||||
struct cp_extra_info_t *cpextra = g_cpextrainfo;
|
||||
|
||||
g_mbcp_is_multibyte = 1;
|
||||
while (TRUE)
|
||||
{
|
||||
if (cpextra->cp == 0 || cpextra->cp == newcp)
|
||||
{
|
||||
if (cpextra->cp == 0)
|
||||
ERR("trail bytes data not available for DBCS codepage %d - assuming all bytes\n", newcp);
|
||||
|
||||
bytes = cpextra->TrailBytes;
|
||||
while (bytes[0] || bytes[1])
|
||||
{
|
||||
for (i = bytes[0]; i <= bytes[1]; i++)
|
||||
MSVCRT_mbctype[i + 1] |= _M2;
|
||||
bytes += 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
cpextra++;
|
||||
}
|
||||
}
|
||||
else
|
||||
g_mbcp_is_multibyte = 0;
|
||||
|
||||
/* we can't use GetStringTypeA directly because we don't have a locale - only a code page
|
||||
*/
|
||||
charcount = 0;
|
||||
for (i = 0; i < 256; i++)
|
||||
if (!(MSVCRT_mbctype[i + 1] & _M1))
|
||||
bufA[charcount++] = i;
|
||||
|
||||
ret = MultiByteToWideChar(newcp, 0, bufA, charcount, bufW, charcount);
|
||||
if (ret != charcount)
|
||||
ERR("MultiByteToWideChar of chars failed for cp %d, ret=%d (exp %d), error=%d\n", newcp, ret, charcount, GetLastError());
|
||||
|
||||
GetStringTypeW(CT_CTYPE1, bufW, charcount, chartypes);
|
||||
|
||||
curr_type = chartypes;
|
||||
for (i = 0; i < 256; i++)
|
||||
if (!(MSVCRT_mbctype[i + 1] & _M1))
|
||||
{
|
||||
if ((*curr_type) & C1_UPPER)
|
||||
MSVCRT_mbctype[i + 1] |= _SBUP;
|
||||
if ((*curr_type) & C1_LOWER)
|
||||
MSVCRT_mbctype[i + 1] |= _SBLOW;
|
||||
curr_type++;
|
||||
}
|
||||
|
||||
if (newcp == 932) /* CP932 only - set _MP and _MS */
|
||||
{
|
||||
/* On Windows it's possible to calculate the _MP and _MS from CT_CTYPE1
|
||||
* and CT_CTYPE3. But as of Wine 0.9.43 we return wrong values what makes
|
||||
* it hard. As this is set only for codepage 932 we hardcode it what gives
|
||||
* also faster execution.
|
||||
*/
|
||||
for (i = 161; i <= 165; i++)
|
||||
MSVCRT_mbctype[i + 1] |= _MP;
|
||||
for (i = 166; i <= 223; i++)
|
||||
MSVCRT_mbctype[i + 1] |= _MS;
|
||||
}
|
||||
|
||||
MSVCRT___lc_collate_cp = MSVCRT___lc_codepage = newcp;
|
||||
TRACE("(%d) -> %d\n", cp, MSVCRT___lc_codepage);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -626,7 +760,7 @@ return;
|
|||
*/
|
||||
void __lc_collate_cp(int cp)
|
||||
{
|
||||
DPRINT1("__lc_collate_cp - stub\n");
|
||||
FIXME("__lc_collate_cp - stub\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -638,7 +772,7 @@ return;
|
|||
*/
|
||||
void __lc_handle(void)
|
||||
{
|
||||
DPRINT1("__lc_handle - stub\n");
|
||||
FIXME("__lc_handle - stub\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -650,7 +784,7 @@ return;
|
|||
*/
|
||||
void __lc_codepage(void)
|
||||
{
|
||||
DPRINT1("__lc_codepage - stub\n");
|
||||
FIXME("__lc_codepage - stub\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -660,7 +794,7 @@ return;
|
|||
*/
|
||||
void *_Gettnames(void)
|
||||
{
|
||||
DPRINT1("(void), stub!\n");
|
||||
FIXME("(void), stub!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -669,7 +803,7 @@ void *_Gettnames(void)
|
|||
*/
|
||||
void __lconv_init(void)
|
||||
{
|
||||
DPRINT1(" stub\n");
|
||||
FIXME(" stub\n");
|
||||
}
|
||||
|
||||
|
||||
|
@ -680,7 +814,7 @@ const char* _Strftime(char *out, unsigned int len, const char *fmt,
|
|||
const void *tm, void *foo)
|
||||
{
|
||||
/* FIXME: */
|
||||
DPRINT1("(%p %d %s %p %p) stub\n", out, len, fmt, tm, foo);
|
||||
FIXME("(%p %d %s %p %p) stub\n", out, len, fmt, tm, foo);
|
||||
return "";
|
||||
}
|
||||
|
||||
|
@ -693,7 +827,7 @@ const char* _Getdays(void)
|
|||
static const char *MSVCRT_days = ":Sun:Sunday:Mon:Monday:Tue:Tuesday:Wed:"
|
||||
"Wednesday:Thu:Thursday:Fri:Friday:Sat:Saturday";
|
||||
/* FIXME: Use locale */
|
||||
DPRINT1("(void) semi-stub\n");
|
||||
FIXME("(void) semi-stub\n");
|
||||
return MSVCRT_days;
|
||||
}
|
||||
|
||||
|
@ -706,7 +840,7 @@ const char* _Getmonths(void)
|
|||
"April:May:May:Jun:June:Jul:July:Aug:August:Sep:September:Oct:"
|
||||
"October:Nov:November:Dec:December";
|
||||
/* FIXME: Use locale */
|
||||
DPRINT1("(void) semi-stub\n");
|
||||
FIXME("(void) semi-stub\n");
|
||||
return MSVCRT_months;
|
||||
}
|
||||
|
||||
|
@ -717,7 +851,7 @@ int __crtLCMapStringA(
|
|||
LCID lcid, DWORD mapflags, const char* src, int srclen, char* dst,
|
||||
int dstlen, unsigned int codepage, int xflag
|
||||
) {
|
||||
DPRINT1("(lcid %lx, flags %lx, %s(%d), %p(%d), %x, %d), partial stub!\n",
|
||||
TRACE("(lcid %lx, flags %lx, %s(%d), %p(%d), %x, %d), partial stub!\n",
|
||||
lcid,mapflags,src,srclen,dst,dstlen,codepage,xflag);
|
||||
/* FIXME: A bit incorrect. But msvcrt itself just converts its
|
||||
* arguments to wide strings and then calls LCMapStringW
|
||||
|
@ -725,6 +859,19 @@ int __crtLCMapStringA(
|
|||
return LCMapStringA(lcid,mapflags,src,srclen,dst,dstlen);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* __crtLCMapStringW (MSVCRT.@)
|
||||
*/
|
||||
int __crtLCMapStringW(
|
||||
LCID lcid, DWORD mapflags, LPCWSTR src, int srclen, LPWSTR dst,
|
||||
int dstlen, unsigned int codepage, int xflag
|
||||
) {
|
||||
TRACE("(lcid %lx, flags %lx, %s(%d), %p(%d), %x, %d), partial stub!\n",
|
||||
lcid,mapflags,src,srclen,dst,dstlen,codepage,xflag);
|
||||
|
||||
return LCMapStringW(lcid,mapflags,src,srclen,dst,dstlen);
|
||||
}
|
||||
|
||||
int CDECL _getmbcp(void)
|
||||
{
|
||||
return MSVCRT___lc_codepage;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <precomp.h>
|
||||
#include <math.h>
|
||||
#include <internal/debug.h>
|
||||
|
||||
double _CIsin(double x);
|
||||
double _CIcos(double x);
|
||||
|
@ -135,85 +135,86 @@ double _CIfmod(double x, double y)
|
|||
/* The following functions are likely workarounds for the pentium fdiv bug */
|
||||
void __stdcall _adj_fdiv_m32( unsigned int arg )
|
||||
{
|
||||
DPRINT("_adj_fdiv_m32 stub\n");
|
||||
FIXME("_adj_fdiv_m32 stub\n");
|
||||
}
|
||||
void __stdcall _adj_fdiv_m32i( int arg )
|
||||
{
|
||||
DPRINT1("_adj_fdiv_m32i stub\n");
|
||||
FIXME("_adj_fdiv_m32i stub\n");
|
||||
}
|
||||
|
||||
void __stdcall _adj_fdiv_m64( unsigned __int64 arg )
|
||||
{
|
||||
DPRINT1("_adj_fdiv_m64 stub\n");
|
||||
FIXME("_adj_fdiv_m64 stub\n");
|
||||
}
|
||||
|
||||
void _adj_fdiv_r(void)
|
||||
{
|
||||
DPRINT1("_adj_fdiv_r stub\n");
|
||||
FIXME("_adj_fdiv_r stub\n");
|
||||
}
|
||||
|
||||
void __stdcall _adj_fdivr_m32( unsigned int arg )
|
||||
{
|
||||
DPRINT1("_adj_fdivr_m32i stub\n");
|
||||
FIXME("_adj_fdivr_m32i stub\n");
|
||||
}
|
||||
|
||||
void __stdcall _adj_fdivr_m32i( int arg )
|
||||
{
|
||||
DPRINT1("_adj_fdivr_m32i stub\n");
|
||||
FIXME("_adj_fdivr_m32i stub\n");
|
||||
}
|
||||
|
||||
void __stdcall _adj_fdivr_m64( unsigned __int64 arg )
|
||||
{
|
||||
DPRINT1("_adj_fdivr_m64 stub\n");
|
||||
FIXME("_adj_fdivr_m64 stub\n");
|
||||
}
|
||||
|
||||
void _adj_fpatan(void)
|
||||
{
|
||||
DPRINT1("_adj_fpatan stub\n");
|
||||
FIXME("_adj_fpatan stub\n");
|
||||
}
|
||||
|
||||
void __stdcall _adj_fdiv_m16i( short arg )
|
||||
{
|
||||
DPRINT("_adj_fdiv_m16i stub\n");
|
||||
FIXME("_adj_fdiv_m16i stub\n");
|
||||
}
|
||||
|
||||
void __stdcall _adj_fdivr_m16i( short arg )
|
||||
{
|
||||
DPRINT("_adj_fdivr_m16i stub\n");
|
||||
FIXME("_adj_fdivr_m16i stub\n");
|
||||
}
|
||||
|
||||
void _adj_fprem(void)
|
||||
{
|
||||
DPRINT("_adj_fprem stub\n");
|
||||
FIXME("_adj_fprem stub\n");
|
||||
}
|
||||
|
||||
void _adj_fprem1(void)
|
||||
{
|
||||
DPRINT("_adj_fprem1 stub\n");
|
||||
FIXME("_adj_fprem1 stub\n");
|
||||
}
|
||||
|
||||
void _adj_fptan(void)
|
||||
{
|
||||
DPRINT("_adj_fptan stub\n");
|
||||
FIXME("_adj_fptan stub\n");
|
||||
}
|
||||
|
||||
void _safe_fdiv(void)
|
||||
{
|
||||
DPRINT("_safe_fdiv stub\n");
|
||||
FIXME("_safe_fdiv stub\n");
|
||||
}
|
||||
|
||||
void _safe_fdivr(void)
|
||||
{
|
||||
DPRINT("_safe_fdivr stub\n");
|
||||
FIXME("_safe_fdivr stub\n");
|
||||
}
|
||||
|
||||
void _safe_fprem(void)
|
||||
{
|
||||
DPRINT("_safe_fprem stub\n");
|
||||
FIXME("_safe_fprem stub\n");
|
||||
}
|
||||
|
||||
void _safe_fprem1(void)
|
||||
{
|
||||
DPRINT("_safe_fprem1 stub\n");
|
||||
FIXME("_safe_fprem1 stub\n");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/msvcrt/mbstring/ischira.c
|
||||
* FILE: lib/sdk/crt/mbstring/ischira.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER: Ariadne
|
||||
* PROGRAMER:
|
||||
* UPDATE HISTORY:
|
||||
* 12/04/99: Created
|
||||
* 12/04/99: Ariadne Created
|
||||
* 05/30/08: Samuel Serapion adapted from PROJECT C Library
|
||||
*
|
||||
*/
|
||||
|
||||
#include <mbstring.h>
|
||||
#include <mbctype.h>
|
||||
|
||||
|
||||
|
@ -29,18 +30,29 @@ int _ismbckata( unsigned int c )
|
|||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
unsigned int _mbctohira( unsigned int c )
|
||||
{
|
||||
return c;
|
||||
if (c >= 0x8340 && c <= 0x837e)
|
||||
return c - 0xa1;
|
||||
else if (c >= 0x8380 && c <= 0x8396)
|
||||
return c - 0xa2;
|
||||
else
|
||||
return c;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
unsigned int _mbctokata( unsigned int c )
|
||||
{
|
||||
return c;
|
||||
if (c >= 0x829f && c <= 0x82dd)
|
||||
return c + 0xa1;
|
||||
else if (c >= 0x82de && c <= 0x82f1)
|
||||
return c + 0xa2;
|
||||
else
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/msvcrt/mbstring/iskana.c
|
||||
* FILE: lib/sdk/crt/mbstring/iskana.c
|
||||
* PURPOSE: Checks for kana character
|
||||
* PROGRAMER: Ariadne, Taiji Yamada
|
||||
* PROGRAMER:
|
||||
* UPDATE HISTORY:
|
||||
Modified from Taiji Yamada japanese code system utilities
|
||||
* 12/04/99: Created
|
||||
* 12/04/99: Ariadne, Taiji Yamada Created
|
||||
* 05/30/08: Samuel Serapion adapted from PROJECT C Library
|
||||
*
|
||||
*/
|
||||
#include <mbstring.h>
|
||||
#include <mbctype.h>
|
||||
#include <internal/mbstring.h>
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbbkana(unsigned int c)
|
||||
{
|
||||
return ((_mbctype+1)[(unsigned char)(c)] & (_KNJ_M|_KNJ_P));
|
||||
return (_mbctype[c & 0xff] & _MBKANA);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/sdk/crt/mbstring/iskmoji.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER:
|
||||
* UPDATE HISTORY:
|
||||
* 05/30/08: Samuel Serapion adapted from PROJECT C Library
|
||||
*
|
||||
*/
|
||||
|
||||
#include <mbctype.h>
|
||||
|
||||
int _ismbbkalpha(unsigned char c)
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/msvcrt/mbstring/iskpun.c
|
||||
* FILE: lib/sdk/crt/mbstring/iskpun.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER: Ariadne
|
||||
* PROGRAMER:
|
||||
* UPDATE HISTORY:
|
||||
* 12/04/99: Created
|
||||
* 12/04/99: Ariadne Created
|
||||
* 05/30/08: Samuel Serapion adapted from PROJECT C Library
|
||||
*
|
||||
*/
|
||||
#include <mbctype.h>
|
||||
#include <internal/mbstring.h>
|
||||
|
||||
#include <precomp.h>
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbbkpunct( unsigned int c )
|
||||
{
|
||||
return ((_mbctype+1)[(unsigned char)(c)] & (_KNJ_P));
|
||||
return (_mbctype[c & 0xff] & _MKPNCT);
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
#include <mbstring.h>
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
int isleadbyte(int byte)
|
||||
int isleadbyte(int c)
|
||||
{
|
||||
return 0;
|
||||
//return IsDBCSLeadByteEx(0,*c);
|
||||
return _isctype( c, _MLEAD );
|
||||
|
||||
}
|
||||
|
|
|
@ -1,26 +1,22 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/msvcrt/mbstring/islwr.c
|
||||
* FILE: lib/sdk/crt/mbstring/ishwr.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER: Ariadne
|
||||
* PROGRAMER:
|
||||
* UPDATE HISTORY:
|
||||
* 12/04/99: Created
|
||||
* 12/04/99: Ariadne Created
|
||||
* 05/30/08: Samuel Serapion adapted from PROJECT C Library
|
||||
*
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
/*
|
||||
* code page 952 only
|
||||
*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbclower( unsigned int c )
|
||||
{
|
||||
if ((c & 0xFF00) != 0) {
|
||||
if ( c >= 0x829A && c<= 0x829A )
|
||||
return 1;
|
||||
}
|
||||
return ((c) >= 0x8281 && (c) <= 0x829a);
|
||||
|
||||
return islower(c);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,19 @@
|
|||
#include <mbctype.h>
|
||||
#include <ctype.h>
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/sdk/crt/mbstring/ismbaln.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER:
|
||||
* UPDATE HISTORY:
|
||||
* 05/30/08: Samuel Serapion adapted from PROJECT C Library
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
int _ismbbkalnum( unsigned int c );
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
|
@ -10,3 +22,4 @@ int _ismbbalnum(unsigned int c)
|
|||
return (isalnum(c) || _ismbbkalnum(c));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,38 @@
|
|||
#include <mbstring.h>
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/sdk/crt/mbstring/ismbc.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER:
|
||||
* UPDATE HISTORY:
|
||||
* 05/30/08: Samuel Serapion adapted from PROJECT C Library
|
||||
*
|
||||
*/
|
||||
|
||||
int _ismbbalpha(unsigned char c);
|
||||
int _ismbbalnum(unsigned char c);
|
||||
|
||||
#include <precomp.h>
|
||||
#include <mbstring.h>
|
||||
#include <mbctype.h>
|
||||
|
||||
unsigned char _mbctype[257] = {
|
||||
0, /* EOF */
|
||||
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 ,0 ,0 ,0 ,0 ,0 ,0 , /* 1 */
|
||||
B ,P ,P ,P ,P ,P ,P ,P ,P ,P ,P ,P ,P ,P ,P ,P , /* 2 */
|
||||
D ,D ,D ,P ,D ,D ,D ,D ,D ,D ,P ,P ,P ,P ,P ,P , /* 3 */
|
||||
PT,AT,AT,AT,AT,AT,AT,AT,AT,AT,AT,AT,AT,AT,AT,AT, /* 4 */
|
||||
AT,AT,AT,AT,AT,AT,AT,AT,AT,AT,AT,PT,PT,PT,PT,PT, /* 5 */
|
||||
PT,AT,AT,AT,AT,AT,AT,AT,AT,AT,AT,AT,AT,AT,AT,AT, /* 6 */
|
||||
AT,AT,AT,AT,AT,AT,AT,AT,AT,AT,AT,PT,PT,PT,PT,0 , /* 7 */
|
||||
T ,LT,LT,LT,LT,LT,LT,LT,LT,LT,LT,LT,LT,LT,LT,LT, /* 8 */
|
||||
LT,LT,LT,LT,LT,LT,LT,LT,LT,LT,LT,LT,LT,LT,LT,LT, /* 9 */
|
||||
T ,GT,GT,GT,GT,GT,KT,KT,KT,KT,KT,KT,KT,KT,KT,KT, /* A */
|
||||
KT,KT,KT,KT,KT,KT,KT,KT,KT,KT,KT,KT,KT,KT,KT,KT, /* B */
|
||||
KT,KT,KT,KT,KT,KT,KT,KT,KT,KT,KT,KT,KT,KT,KT,KT, /* C */
|
||||
KT,KT,KT,KT,KT,KT,KT,KT,KT,KT,KT,KT,KT,KT,GT,GT, /* D */
|
||||
LT,LT,LT,LT,LT,LT,LT,LT,LT,LT,LT,LT,LT,LT,LT,LT, /* E */
|
||||
LT,LT,LT,LT,LT,LT,LT,LT,LT,LT,LT,LT,LT,0 ,0 ,0 , /* F */
|
||||
};
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
|
@ -23,14 +54,7 @@ int _ismbcalnum( unsigned int c )
|
|||
*/
|
||||
int _ismbcalpha( unsigned int c )
|
||||
{
|
||||
if ((c & 0xFF00) != 0) {
|
||||
// true multibyte character
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return _ismbbalpha(c);
|
||||
|
||||
return 0;
|
||||
return (_ismbcupper (c) || _ismbclower (c));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -38,100 +62,62 @@ int _ismbcalpha( unsigned int c )
|
|||
*/
|
||||
int _ismbcdigit( unsigned int c )
|
||||
{
|
||||
if ((c & 0xFF00) != 0) {
|
||||
// true multibyte character
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
// return _ismbbdigit(c);
|
||||
|
||||
return 0;
|
||||
return ((c) >= 0x824f && (c) <= 0x8258);
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbcprint( unsigned int c )
|
||||
{
|
||||
if ((c & 0xFF00) != 0) {
|
||||
// true multibyte character
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
// return _ismbbdigit(c);
|
||||
|
||||
return 0;
|
||||
return (_MBHMASK (c) ? _ismbclegal (c) : (isprint (c) || _ismbbkana (c)));
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbcsymbol( unsigned int c )
|
||||
{
|
||||
if ((c & 0xFF00) != 0) {
|
||||
// true multibyte character
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
// return _ismbbdigit(c);
|
||||
|
||||
return 0;
|
||||
return (c >= 0x8141 && c <= 0x817e) || (c >= 0x8180 && c <= 0x81ac);
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbcspace( unsigned int c )
|
||||
{
|
||||
if ((c & 0xFF00) != 0) {
|
||||
// true multibyte character
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
// return _ismbbdigit(c);
|
||||
|
||||
return 0;
|
||||
return ((c) == 0x8140);
|
||||
}
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbclegal(unsigned int c)
|
||||
{
|
||||
if ((c & 0xFF00) != 0) {
|
||||
return _ismbblead(c>>8) && _ismbbtrail(c&0xFF);
|
||||
}
|
||||
else
|
||||
return _ismbbtrail(c&0xFF);
|
||||
|
||||
return 0;
|
||||
return (_ismbblead (_MBGETH (c)) && _ismbbtrail (_MBGETL (c)));
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbcl0(unsigned int c)
|
||||
{
|
||||
return 0;
|
||||
return (c >= 0x8140 && c <= 0x889e);
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbcl1(unsigned int c)
|
||||
{
|
||||
return 0;
|
||||
return (c >= 0x889f && c <= 0x9872);
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbcl2(unsigned int c)
|
||||
{
|
||||
return 0;
|
||||
return (c >= 0x989f && c <= 0xea9e);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/msvcrt/mbstring/ismbkaln.c
|
||||
* FILE: lib/sdk/crt/mbstring/ismbkaln.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER: Ariadne
|
||||
* PROGRAMER:
|
||||
* UPDATE HISTORY:
|
||||
* 12/04/99: Created
|
||||
* 12/04/99: Ariadne Created
|
||||
* 05/30/08: Samuel Serapion adapted from PROJECT C Library
|
||||
*
|
||||
*/
|
||||
#include <mbctype.h>
|
||||
#include <ctype.h>
|
||||
#include <internal/mbstring.h>
|
||||
|
||||
#include <precomp.h>
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbbkalnum( unsigned int c )
|
||||
{
|
||||
return ((_mbctype+1)[(unsigned char)(c)] & (_KNJ_P));
|
||||
return (_mbctype[c & 0xff] & _MKMOJI);
|
||||
}
|
||||
|
|
|
@ -1,54 +1,26 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/msvcrt/mbstring/ismblead.c
|
||||
* PURPOSE: Checks for a lead byte
|
||||
* PROGRAMER: Ariadne
|
||||
* FILE: lib/sdk/crt/mbstring/iskana.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER:
|
||||
* UPDATE HISTORY:
|
||||
* Modified from Taiji Yamada japanese code system utilities
|
||||
* 12/04/99: Created
|
||||
* 12/04/99: Ariadne, Taiji Yamada Created
|
||||
* 05/30/08: Samuel Serapion adapted from PROJECT C Library
|
||||
*
|
||||
*/
|
||||
|
||||
#include <mbstring.h>
|
||||
#include <stdlib.h>
|
||||
#include <mbctype.h>
|
||||
#include <internal/mbstring.h>
|
||||
#include <precomp.h>
|
||||
|
||||
size_t _mbclen2(const unsigned int s);
|
||||
|
||||
unsigned char _mbctype[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,___,___,___
|
||||
};
|
||||
|
||||
//unsigned char _mbctype = _jctype;
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbblead(unsigned int c)
|
||||
{
|
||||
return ((_mbctype+1)[(unsigned char)(c)] & _KNJ_1);
|
||||
return (_mbctype[c & 0xff] & _MLEAD);
|
||||
}
|
||||
//int _ismbblead(unsigned int byte)
|
||||
//{
|
||||
//
|
||||
// return (int)IsDBCSLeadByte(byte)
|
||||
//}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
|
@ -67,8 +39,9 @@ int _ismbslead( const unsigned char *str, const unsigned char *t)
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned char *__p__mbctype(void)
|
||||
const unsigned char *__p__mbctype(void)
|
||||
{
|
||||
return _mbctype;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,19 +1,16 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crt/??????
|
||||
* PURPOSE: Unknown
|
||||
* PROGRAMER: Unknown
|
||||
* FILE: lib/sdk/crt/mbstring/ismbpun.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER:
|
||||
* UPDATE HISTORY:
|
||||
* 25/11/05: Added license header
|
||||
* 05/30/08: Samuel Serapion adapted from PROJECT C Library
|
||||
*
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
#include <mbstring.h>
|
||||
#include <mbctype.h>
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
|
@ -21,7 +18,7 @@
|
|||
int _ismbbpunct(unsigned int c)
|
||||
{
|
||||
// (0xA1 <= c <= 0xA6)
|
||||
return (ispunct(c) || _ismbbkana(c));
|
||||
return (_mbctype[c & 0xff] & _MBPUNCT);
|
||||
}
|
||||
|
||||
//iskana() :(0xA1 <= c <= 0xDF)
|
||||
|
|
|
@ -8,9 +8,7 @@
|
|||
* 12/04/99: Created
|
||||
*/
|
||||
|
||||
#include <mbstring.h>
|
||||
#include <mbctype.h>
|
||||
#include <internal/mbstring.h>
|
||||
#include <precomp.h>
|
||||
|
||||
size_t _mbclen2(const unsigned int s);
|
||||
|
||||
|
@ -21,14 +19,9 @@ size_t _mbclen2(const unsigned int s);
|
|||
*/
|
||||
int _ismbbtrail(unsigned int c)
|
||||
{
|
||||
return ((_mbctype+1)[(unsigned char)(c)] & _KNJ_2);
|
||||
return (_mbctype[c & 0xff] & _MTRAIL);
|
||||
}
|
||||
|
||||
//int _ismbbtrail( unsigned int b)
|
||||
//{
|
||||
// return ((b >= 0x40 && b <= 0x7e ) || (b >= 0x80 && b <= 0xfc ) );
|
||||
//}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
|
|
|
@ -1,26 +1,21 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/msvcrt/mbstring/isuppr.c
|
||||
* FILE: lib/sdk/crt/mbstring/isuppr.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER: Ariadne
|
||||
* PROGRAMER:
|
||||
* UPDATE HISTORY:
|
||||
* 12/04/99: Created
|
||||
* 12/04/99: Ariadne Created
|
||||
* 05/30/08: Samuel Serapion adapted from PROJECT C Library
|
||||
*
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
/*
|
||||
* code page 952 only
|
||||
*
|
||||
* @implemented
|
||||
*/
|
||||
int _ismbcupper( unsigned int c )
|
||||
{
|
||||
if ((c & 0xFF00) != 0) {
|
||||
if ( c >= 0x8260 && c<= 0x8279 )
|
||||
return 1;
|
||||
}
|
||||
|
||||
return isupper(c);
|
||||
return ((c) >= 0x8260 && (c) <= 0x8279);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
|
||||
#include <precomp.h>
|
||||
#include <mbstring.h>
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,23 +1,34 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/sdk/crt/mbstring/mbscpn.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER:
|
||||
* UPDATE HISTORY:
|
||||
* 05/30/08: Samuel Serapion adapted from PROJECT C Library
|
||||
*
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
#include <mbstring.h>
|
||||
|
||||
/*
|
||||
* FIXME not correct
|
||||
*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
size_t _mbscspn(const unsigned char *s1, const unsigned char *s2)
|
||||
size_t _mbscspn (const unsigned char *str1, const unsigned char *str2)
|
||||
{
|
||||
const unsigned char *p, *spanp;
|
||||
char c, sc;
|
||||
int c;
|
||||
unsigned char *ptr;
|
||||
const unsigned char *save = str1;
|
||||
|
||||
for (p = s1;;)
|
||||
{
|
||||
c = *p++;
|
||||
spanp = s2;
|
||||
do {
|
||||
if ((sc = *spanp++) == c)
|
||||
return (size_t)(p - 1) - (size_t)s1;
|
||||
} while (sc != 0);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
while ((c = _mbsnextc (str1))) {
|
||||
|
||||
if ((ptr = _mbschr (str2, c)))
|
||||
break;
|
||||
|
||||
str1 = _mbsinc ((unsigned char *) str1);
|
||||
|
||||
}
|
||||
|
||||
return str1 - save;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
*/
|
||||
#include <precomp.h>
|
||||
#include <mbstring.h>
|
||||
#include <mbctype.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
|
|
|
@ -1,3 +1,15 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/sdk/crt/mbstring/ismbpun.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER:
|
||||
* UPDATE HISTORY:
|
||||
* 05/30/08: Samuel Serapion adapted from PROJECT C Library
|
||||
*
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
#include <mbstring.h>
|
||||
#include <ctype.h>
|
||||
|
||||
|
@ -8,22 +20,12 @@ unsigned int _mbbtolower(unsigned int 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;
|
||||
return _ismbcupper (c) ? c + 0x21 : c;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -8,34 +8,37 @@
|
|||
* 12/04/99: Created
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
#include <mbstring.h>
|
||||
#include <string.h>
|
||||
|
||||
size_t _mbclen2(const unsigned int s);
|
||||
unsigned char *_mbset (unsigned char *string, int c);
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned char * _mbsncat(unsigned char *dst, const unsigned char *src, size_t n)
|
||||
unsigned char *_mbsncat (unsigned char *dst, const unsigned char *src, size_t n)
|
||||
{
|
||||
unsigned char *d = dst;
|
||||
const unsigned char *s = src;
|
||||
if (n != 0) {
|
||||
d = dst + _mbslen(dst); // get the end of string
|
||||
d += _mbclen2(*d); // move 1 or 2 up
|
||||
int c;
|
||||
unsigned char *save = dst;
|
||||
|
||||
do {
|
||||
if ((*d++ = *s++) == 0)
|
||||
{
|
||||
while (--n != 0)
|
||||
*d++ = 0;
|
||||
break;
|
||||
}
|
||||
if (!_ismbblead(*s) )
|
||||
n--;
|
||||
} while (n > 0);
|
||||
}
|
||||
return dst;
|
||||
while ((c = _mbsnextc (dst)))
|
||||
dst = _mbsinc (dst);
|
||||
|
||||
while (n-- > 0 && (c = _mbsnextc (src))) {
|
||||
|
||||
_mbset (dst, c);
|
||||
|
||||
dst = _mbsinc (dst);
|
||||
|
||||
src = _mbsinc ((unsigned char *) src);
|
||||
|
||||
}
|
||||
|
||||
*dst = '\0';
|
||||
|
||||
return save;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <stdlib.h>
|
||||
#include <precomp.h>
|
||||
#include <mbstring.h>
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
|
||||
#include <precomp.h>
|
||||
#include <mbstring.h>
|
||||
|
||||
/*
|
||||
|
@ -5,7 +7,8 @@
|
|||
*/
|
||||
int _mbsnicoll(const unsigned char *s1, const unsigned char *s2, size_t n)
|
||||
{
|
||||
return 0;
|
||||
WARN("_mbsnicoll unimplemented\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -13,5 +16,6 @@ int _mbsnicoll(const unsigned char *s1, const unsigned char *s2, size_t n)
|
|||
*/
|
||||
int _mbsnbicoll(const unsigned char *s1, const unsigned char *s2, size_t n)
|
||||
{
|
||||
return 0;
|
||||
WARN("_mbsnbicoll unimplemented\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,20 +1,34 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/sdk/crt/mbstring/ismbpun.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER:
|
||||
* UPDATE HISTORY:
|
||||
* 05/30/08: Samuel Serapion adapted from PROJECT C Library
|
||||
*
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
#include <mbstring.h>
|
||||
|
||||
/*
|
||||
* FIXME not correct
|
||||
*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
size_t _mbsspn(const unsigned char *s1, const unsigned char *s2)
|
||||
size_t _mbsspn (const unsigned char *str1, const unsigned char *str2)
|
||||
{
|
||||
const unsigned char *p = s1, *spanp;
|
||||
char c, sc;
|
||||
int c;
|
||||
unsigned char *ptr;
|
||||
const unsigned char *save = str1;
|
||||
|
||||
cont:
|
||||
c = *p++;
|
||||
for (spanp = s2; (sc = *spanp++) != 0;)
|
||||
if (sc == c)
|
||||
goto cont;
|
||||
return (size_t)(p - 1) - (size_t)s1;
|
||||
// - (char *)s1);
|
||||
while ((c = _mbsnextc (str1))) {
|
||||
|
||||
if ((ptr = _mbschr (str2, c)) == 0)
|
||||
break;
|
||||
|
||||
str1 = _mbsinc ((unsigned char *) str1);
|
||||
|
||||
}
|
||||
|
||||
return str1 - save;
|
||||
}
|
||||
|
|
|
@ -1,19 +1,22 @@
|
|||
#include <precomp.h>
|
||||
#include <mbstring.h>
|
||||
|
||||
/*
|
||||
* FIXME not correct
|
||||
*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
unsigned char * _mbsspnp(const unsigned char *s1, const unsigned char *s2)
|
||||
unsigned char *_mbsspnp (const unsigned char *str1, const unsigned char *str2)
|
||||
{
|
||||
const unsigned char *p = s1, *spanp;
|
||||
char c, sc;
|
||||
int c;
|
||||
unsigned char *ptr;
|
||||
|
||||
cont:
|
||||
c = *p++;
|
||||
for (spanp = s2; (sc = *spanp++) != 0;)
|
||||
if (sc == c)
|
||||
goto cont;
|
||||
return (unsigned char *)p;
|
||||
while ((c = _mbsnextc (str1))) {
|
||||
|
||||
if ((ptr = _mbschr (str2, c)) == 0)
|
||||
return (unsigned char *) str1;
|
||||
|
||||
str1 = _mbsinc ((unsigned char *) str1);
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
* UPDATE HISTORY:
|
||||
* 12/04/99: Created
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
#include <mbstring.h>
|
||||
#include <ctype.h>
|
||||
|
||||
|
@ -18,39 +20,57 @@ unsigned int _mbbtoupper(unsigned int c)
|
|||
return c;
|
||||
}
|
||||
|
||||
// codepage 952
|
||||
#define CASE_DIFF (0x8281 - 0x8260)
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned int _mbctoupper(unsigned int c)
|
||||
{
|
||||
return _ismbclower (c) ? c - 0x21 : c;
|
||||
}
|
||||
|
||||
if ((c & 0xFF00) != 0) {
|
||||
// true multibyte case conversion needed
|
||||
if ( _ismbcupper(c) )
|
||||
return c + CASE_DIFF;
|
||||
unsigned char *_mbset (unsigned char *string, int c)
|
||||
{
|
||||
unsigned char *save = string;
|
||||
|
||||
} else
|
||||
return _mbbtoupper(c);
|
||||
if (_MBIS16 (c)) {
|
||||
|
||||
return 0;
|
||||
if (_MBLMASK (c) == 0) {
|
||||
*string++ = '\0';
|
||||
*string++ = '\0';
|
||||
}
|
||||
else {
|
||||
*string++ = _MBGETH (c);
|
||||
*string++ = _MBGETL (c);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
*string++ = c;
|
||||
|
||||
}
|
||||
|
||||
return save;
|
||||
}
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
unsigned char * _mbsupr(unsigned char *x)
|
||||
unsigned char *_mbsupr (unsigned char *string)
|
||||
{
|
||||
unsigned char *y=x;
|
||||
while (*y) {
|
||||
if (!_ismbblead(*y) )
|
||||
*y = toupper(*y);
|
||||
else {
|
||||
*y=_mbctoupper(*(unsigned short *)y);
|
||||
y++;
|
||||
}
|
||||
}
|
||||
return x;
|
||||
int c;
|
||||
unsigned char *save = string;
|
||||
|
||||
while ((c = _mbsnextc (string))) {
|
||||
|
||||
if (_MBIS16 (c) == 0)
|
||||
c = toupper (c);
|
||||
|
||||
_mbset (string, c);
|
||||
|
||||
string = _mbsinc (string);
|
||||
|
||||
}
|
||||
|
||||
return save;
|
||||
}
|
||||
|
|
|
@ -1,92 +0,0 @@
|
|||
/* $Id$
|
||||
*
|
||||
* ReactOS MSVCRT.DLL Compatibility Library
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
#ifndef __GNUC__
|
||||
|
||||
/* GLOBAL VARIABLES *******************************************************/
|
||||
|
||||
int _fltused;
|
||||
|
||||
|
||||
/* FUNCTIONS **************************************************************/
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
int
|
||||
STDCALL
|
||||
_except_handler3(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
int
|
||||
STDCALL
|
||||
_local_unwind2(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /*__GNUC__*/
|
||||
|
||||
#endif /*__GNUC__*/
|
||||
|
||||
|
||||
/*
|
||||
int __cdecl _allmul(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __cdecl _allshl(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void __cdecl _chkesp(int value1, int value2)
|
||||
{
|
||||
}
|
||||
|
||||
int __cdecl _alloca_probe(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int STDCALL _abnormal_termination(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int STDCALL _setjmp(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
/*
|
||||
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved);
|
||||
|
||||
int STDCALL _DllMainCRTStartup(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
||||
{
|
||||
BOOL result;
|
||||
|
||||
//__fileno_init();
|
||||
//result = DllMain(hInst, ul_reason_for_call, lpReserved);
|
||||
|
||||
result = DllMain(hInst, DLL_PROCESS_ATTACH, lpReserved);
|
||||
|
||||
|
||||
return (result ? 1 : 0);
|
||||
}
|
||||
*/
|
||||
|
||||
/* EOF */
|
|
@ -1,6 +1,6 @@
|
|||
/* $Id$
|
||||
*
|
||||
* dllmain.c
|
||||
* environ.c
|
||||
*
|
||||
* ReactOS MSVCRT.DLL Compatibility Library
|
||||
*/
|
||||
|
@ -10,9 +10,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
|
||||
unsigned int _osver = 0;
|
||||
unsigned int _winminor = 0;
|
||||
|
@ -44,7 +41,7 @@ int BlockEnvToEnvironA(void)
|
|||
char **envptr;
|
||||
int count = 1, len;
|
||||
|
||||
DPRINT("BlockEnvToEnvironA()\n");
|
||||
TRACE("BlockEnvToEnvironA()\n");
|
||||
|
||||
environment_strings = GetEnvironmentStringsA();
|
||||
if (environment_strings == NULL) {
|
||||
|
@ -95,7 +92,7 @@ int BlockEnvToEnvironW(void)
|
|||
wchar_t **envptr;
|
||||
int count = 1, len;
|
||||
|
||||
DPRINT("BlockEnvToEnvironW()\n");
|
||||
TRACE("BlockEnvToEnvironW()\n");
|
||||
|
||||
environment_strings = GetEnvironmentStringsW();
|
||||
if (environment_strings == NULL) {
|
||||
|
|
|
@ -362,10 +362,3 @@ wchar_t*** __p___wargv(void)
|
|||
return &__wargv;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
int _chkstk(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -18,9 +18,6 @@
|
|||
|
||||
#include <precomp.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
#include <internal/mtdll.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -58,7 +55,7 @@ void msvcrt_init_mt_locks(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
DPRINT( "initializing mtlocks\n" );
|
||||
TRACE( "initializing mtlocks\n" );
|
||||
|
||||
/* Initialize the table */
|
||||
for( i=0; i < _TOTAL_LOCKS; i++ )
|
||||
|
@ -81,7 +78,7 @@ void msvcrt_free_mt_locks(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
DPRINT(": uninitializing all mtlocks\n" );
|
||||
TRACE(": uninitializing all mtlocks\n" );
|
||||
|
||||
/* Uninitialize the table */
|
||||
for( i=0; i < _TOTAL_LOCKS; i++ )
|
||||
|
@ -99,7 +96,7 @@ void msvcrt_free_mt_locks(void)
|
|||
*/
|
||||
void _lock( int locknum )
|
||||
{
|
||||
DPRINT( "(%d)\n", locknum );
|
||||
TRACE( "(%d)\n", locknum );
|
||||
|
||||
/* If the lock doesn't exist yet, create it */
|
||||
if( lock_table[ locknum ].bInit == FALSE )
|
||||
|
@ -110,7 +107,7 @@ void _lock( int locknum )
|
|||
/* Check again if we've got a bit of a race on lock creation */
|
||||
if( lock_table[ locknum ].bInit == FALSE )
|
||||
{
|
||||
DPRINT( ": creating lock #%d\n", locknum );
|
||||
TRACE( ": creating lock #%d\n", locknum );
|
||||
msvcrt_initialize_mlock( locknum );
|
||||
}
|
||||
|
||||
|
@ -128,8 +125,9 @@ void _lock( int locknum )
|
|||
*/
|
||||
void _unlock( int locknum )
|
||||
{
|
||||
DPRINT( "(%d)\n", locknum );
|
||||
TRACE( "(%d)\n", locknum );
|
||||
|
||||
LeaveCriticalSection( &(lock_table[ locknum ].crit) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
int __STRINGTOLD( long double *value, char **endptr, const char *str, int flags )
|
||||
{
|
||||
DPRINT1("%p %p %s %x stub\n", value, endptr, str, flags );
|
||||
FIXME("%p %p %s %x stub\n", value, endptr, str, flags );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -20,17 +17,17 @@ void MSVCRT_I10_OUTPUT(void)
|
|||
|
||||
void __p__amblksiz(void)
|
||||
{
|
||||
DPRINT1("__p__amblksiz stub\n");
|
||||
FIXME("__p__amblksiz stub\n");
|
||||
}
|
||||
|
||||
void __fileinfo(void)
|
||||
{
|
||||
DPRINT1("__fileinfo stub\n");
|
||||
FIXME("__fileinfo stub\n");
|
||||
}
|
||||
|
||||
void stub(void)
|
||||
{
|
||||
DPRINT1("stub\n");
|
||||
FIXME("stub\n");
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
|
@ -38,7 +35,7 @@ void stub(void)
|
|||
*/
|
||||
int CDECL _getmaxstdio(void)
|
||||
{
|
||||
DPRINT1("stub, always returns 512\n");
|
||||
FIXME("stub, always returns 512\n");
|
||||
return 512;
|
||||
}
|
||||
|
||||
|
@ -52,6 +49,6 @@ int CDECL _setmaxstdio(int newmax)
|
|||
res = -1;
|
||||
else
|
||||
res = newmax;
|
||||
DPRINT1("stub: setting new maximum for number of simultaneously open files not implemented,returning %d\n",res);
|
||||
FIXME("stub: setting new maximum for number of simultaneously open files not implemented,returning %d\n",res);
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -32,11 +32,27 @@
|
|||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#include "wine/unicode.h"
|
||||
|
||||
/* kernelmode libcnt should not include Wine-debugging crap */
|
||||
#ifndef _LIBCNT_
|
||||
#include "wine/debug.h"
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(msvcrt);
|
||||
#else
|
||||
#include <debug.h>
|
||||
#define TRACE DPRINT
|
||||
#define WARN DPRINT1
|
||||
#endif
|
||||
|
||||
/* CRT Internal data */
|
||||
#include <internal/atexit.h>
|
||||
#include <internal/console.h>
|
||||
#include <internal/file.h>
|
||||
#include <internal/ieee.h>
|
||||
#include <internal/math.h>
|
||||
#include <internal/mbstring.h>
|
||||
#include <internal/mtdll.h>
|
||||
#include <internal/rterror.h>
|
||||
#include <internal/tls.h>
|
||||
|
||||
#endif /* _CRT_PRECOMP_H */
|
||||
|
|
|
@ -14,8 +14,7 @@
|
|||
#include <string.h>
|
||||
#include <process.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include<internal/debug.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
|
@ -117,6 +116,6 @@ int system(const char *command)
|
|||
|
||||
int CDECL _wsystem(const wchar_t* cmd)
|
||||
{
|
||||
DPRINT1("_wsystem stub\n");
|
||||
FIXME("_wsystem stub\n");
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -2,16 +2,15 @@
|
|||
#include <process.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
#ifdef _UNICODE
|
||||
#define sT "S"
|
||||
#define find_execT find_execW
|
||||
#define argvtosT argvtosW
|
||||
#define do_spawnT do_spawnW
|
||||
#define valisttosT valisttosW
|
||||
#define extT extW
|
||||
#else
|
||||
#define sT "s"
|
||||
#define find_execT find_execA
|
||||
#define argvtosT argvtosA
|
||||
#define do_spawnT do_spawnA
|
||||
|
@ -19,6 +18,7 @@
|
|||
#define extT extA
|
||||
#endif
|
||||
|
||||
#define MK_STR(s) #s
|
||||
|
||||
_TCHAR const* extT[] =
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ const _TCHAR* find_execT(const _TCHAR* path, _TCHAR* rpath)
|
|||
const _TCHAR *rd;
|
||||
unsigned int i, found = 0;
|
||||
|
||||
DPRINT(MK_STR(find_execT)"('%"sT"', %x)\n", path, rpath);
|
||||
TRACE(MK_STR(find_execT)"('%"sT"', %x)\n", path, rpath);
|
||||
|
||||
if (path == NULL)
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ const _TCHAR* find_execT(const _TCHAR* path, _TCHAR* rpath)
|
|||
{
|
||||
_tcscpy(rp, extT[i]);
|
||||
|
||||
DPRINT("trying '%"sT"'\n", rpath);
|
||||
TRACE("trying '%"sT"'\n", rpath);
|
||||
|
||||
if (_taccess(rpath, F_OK) == 0 && access_dirT(rpath) != 0)
|
||||
{
|
||||
|
@ -90,7 +90,7 @@ const _TCHAR* find_execT(const _TCHAR* path, _TCHAR* rpath)
|
|||
{
|
||||
_tcscpy(rp, extT[i]);
|
||||
|
||||
DPRINT("trying '%"sT"'\n", rpath);
|
||||
TRACE("trying '%"sT"'\n", rpath);
|
||||
|
||||
if (_taccess(rpath, F_OK) == 0 && access_dirT(rpath) != 0)
|
||||
{
|
||||
|
@ -286,7 +286,7 @@ do_spawnT(int mode, const _TCHAR* cmdname, const _TCHAR* args, const _TCHAR* env
|
|||
if (!bResult)
|
||||
{
|
||||
dwError = GetLastError();
|
||||
DPRINT("%x\n", dwError);
|
||||
ERR("%x\n", dwError);
|
||||
__set_errno(dwError);
|
||||
return(-1);
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ int _tspawnl(int mode, const _TCHAR *cmdname, const _TCHAR* arg0, ...)
|
|||
_TCHAR* args;
|
||||
int ret = -1;
|
||||
|
||||
DPRINT(MK_STR(_tspawnl)"('%"sT"')\n", cmdname);
|
||||
TRACE(MK_STR(_tspawnl)"('%"sT"')\n", cmdname);
|
||||
|
||||
va_start(argp, arg0);
|
||||
args = valisttosT(arg0, argp, ' ');
|
||||
|
@ -341,7 +341,7 @@ int _tspawnv(int mode, const _TCHAR *cmdname, const _TCHAR* const* argv)
|
|||
_TCHAR* args;
|
||||
int ret = -1;
|
||||
|
||||
DPRINT(MK_STR(_tspawnv)"('%"sT"')\n", cmdname);
|
||||
TRACE(MK_STR(_tspawnv)"('%"sT"')\n", cmdname);
|
||||
|
||||
args = argvtosT(argv, ' ');
|
||||
|
||||
|
@ -364,7 +364,7 @@ int _tspawnle(int mode, const _TCHAR *cmdname, const _TCHAR* arg0, ... /*, NULL,
|
|||
_TCHAR const * const* ptr;
|
||||
int ret = -1;
|
||||
|
||||
DPRINT(MK_STR(_tspawnle)"('%"sT"')\n", cmdname);
|
||||
TRACE(MK_STR(_tspawnle)"('%"sT"')\n", cmdname);
|
||||
|
||||
va_start(argp, arg0);
|
||||
args = valisttosT(arg0, argp, ' ');
|
||||
|
@ -397,7 +397,7 @@ int _tspawnve(int mode, const _TCHAR *cmdname, const _TCHAR* const* argv, const
|
|||
_TCHAR *envs;
|
||||
int ret = -1;
|
||||
|
||||
DPRINT(MK_STR(_tspawnve)"('%"sT"')\n", cmdname);
|
||||
TRACE(MK_STR(_tspawnve)"('%"sT"')\n", cmdname);
|
||||
|
||||
args = argvtosT(argv, ' ');
|
||||
envs = argvtosT(envp, 0);
|
||||
|
@ -421,7 +421,7 @@ int _tspawnvp(int mode, const _TCHAR* cmdname, const _TCHAR* const* argv)
|
|||
{
|
||||
_TCHAR pathname[FILENAME_MAX];
|
||||
|
||||
DPRINT(MK_STR(_tspawnvp)"('%"sT"')\n", cmdname);
|
||||
TRACE(MK_STR(_tspawnvp)"('%"sT"')\n", cmdname);
|
||||
|
||||
return _tspawnv(mode, find_execT(cmdname, pathname), argv);
|
||||
}
|
||||
|
@ -436,7 +436,7 @@ int _tspawnlp(int mode, const _TCHAR* cmdname, const _TCHAR* arg0, .../*, NULL*/
|
|||
int ret = -1;
|
||||
_TCHAR pathname[FILENAME_MAX];
|
||||
|
||||
DPRINT(MK_STR(_tspawnlp)"('%"sT"')\n", cmdname);
|
||||
TRACE(MK_STR(_tspawnlp)"('%"sT"')\n", cmdname);
|
||||
|
||||
va_start(argp, arg0);
|
||||
args = valisttosT(arg0, argp, ' ');
|
||||
|
@ -461,7 +461,7 @@ int _tspawnlpe(int mode, const _TCHAR* cmdname, const _TCHAR* arg0, .../*, NULL,
|
|||
int ret = -1;
|
||||
_TCHAR pathname[FILENAME_MAX];
|
||||
|
||||
DPRINT(MK_STR(_tspawnlpe)"('%"sT"')\n", cmdname);
|
||||
TRACE(MK_STR(_tspawnlpe)"('%"sT"')\n", cmdname);
|
||||
|
||||
va_start(argp, arg0);
|
||||
args = valisttosT(arg0, argp, ' ');
|
||||
|
@ -491,7 +491,7 @@ int _tspawnvpe(int mode, const _TCHAR* cmdname, const _TCHAR* const* argv, const
|
|||
{
|
||||
_TCHAR pathname[FILENAME_MAX];
|
||||
|
||||
DPRINT(MK_STR(_tspawnvpe)"('%"sT"')\n", cmdname);
|
||||
TRACE(MK_STR(_tspawnvpe)"('%"sT"')\n", cmdname);
|
||||
|
||||
return _tspawnve(mode, find_execT(cmdname, pathname), argv, envp);
|
||||
}
|
||||
|
@ -505,7 +505,7 @@ int _texecl(const _TCHAR* cmdname, const _TCHAR* arg0, ...)
|
|||
va_list argp;
|
||||
int ret = -1;
|
||||
|
||||
DPRINT(MK_STR(_texecl)"('%"sT"')\n", cmdname);
|
||||
TRACE(MK_STR(_texecl)"('%"sT"')\n", cmdname);
|
||||
|
||||
va_start(argp, arg0);
|
||||
args = valisttosT(arg0, argp, ' ');
|
||||
|
@ -523,7 +523,7 @@ int _texecl(const _TCHAR* cmdname, const _TCHAR* arg0, ...)
|
|||
*/
|
||||
int _texecv(const _TCHAR* cmdname, const _TCHAR* const* argv)
|
||||
{
|
||||
DPRINT(MK_STR(_texecv)"('%"sT"')\n", cmdname);
|
||||
TRACE(MK_STR(_texecv)"('%"sT"')\n", cmdname);
|
||||
return _tspawnv(P_OVERLAY, cmdname, argv);
|
||||
}
|
||||
|
||||
|
@ -538,7 +538,7 @@ int _texecle(const _TCHAR* cmdname, const _TCHAR* arg0, ... /*, NULL, char* cons
|
|||
_TCHAR const* const* ptr;
|
||||
int ret = -1;
|
||||
|
||||
DPRINT(MK_STR(_texecle)"('%"sT"')\n", cmdname);
|
||||
TRACE(MK_STR(_texecle)"('%"sT"')\n", cmdname);
|
||||
|
||||
va_start(argp, arg0);
|
||||
args = valisttosT(arg0, argp, ' ');
|
||||
|
@ -566,7 +566,7 @@ int _texecle(const _TCHAR* cmdname, const _TCHAR* arg0, ... /*, NULL, char* cons
|
|||
*/
|
||||
int _texecve(const _TCHAR* cmdname, const _TCHAR* const* argv, const _TCHAR* const* envp)
|
||||
{
|
||||
DPRINT(MK_STR(_texecve)"('%"sT"')\n", cmdname);
|
||||
TRACE(MK_STR(_texecve)"('%"sT"')\n", cmdname);
|
||||
return _tspawnve(P_OVERLAY, cmdname, argv, envp);
|
||||
}
|
||||
|
||||
|
@ -580,7 +580,7 @@ int _texeclp(const _TCHAR* cmdname, const _TCHAR* arg0, ...)
|
|||
int ret = -1;
|
||||
_TCHAR pathname[FILENAME_MAX];
|
||||
|
||||
DPRINT(MK_STR(_texeclp)"('%"sT"')\n", cmdname);
|
||||
TRACE(MK_STR(_texeclp)"('%"sT"')\n", cmdname);
|
||||
|
||||
va_start(argp, arg0);
|
||||
args = valisttosT(arg0, argp, ' ');
|
||||
|
@ -598,7 +598,7 @@ int _texeclp(const _TCHAR* cmdname, const _TCHAR* arg0, ...)
|
|||
*/
|
||||
int _texecvp(const _TCHAR* cmdname, const _TCHAR* const* argv)
|
||||
{
|
||||
DPRINT(MK_STR(_texecvp)"('%"sT"')\n", cmdname);
|
||||
TRACE(MK_STR(_texecvp)"('%"sT"')\n", cmdname);
|
||||
return _tspawnvp(P_OVERLAY, cmdname, argv);
|
||||
}
|
||||
|
||||
|
@ -614,7 +614,7 @@ int _texeclpe(const _TCHAR* cmdname, const _TCHAR* arg0, ... /*, NULL, char* con
|
|||
int ret = -1;
|
||||
_TCHAR pathname[FILENAME_MAX];
|
||||
|
||||
DPRINT(MK_STR(_texeclpe)"('%"sT"')\n", cmdname);
|
||||
TRACE(MK_STR(_texeclpe)"('%"sT"')\n", cmdname);
|
||||
|
||||
va_start(argp, arg0);
|
||||
args = valisttosT(arg0, argp, ' ');
|
||||
|
@ -642,7 +642,8 @@ int _texeclpe(const _TCHAR* cmdname, const _TCHAR* arg0, ... /*, NULL, char* con
|
|||
*/
|
||||
int _texecvpe(const _TCHAR* cmdname, const _TCHAR* const* argv, const _TCHAR* const* envp)
|
||||
{
|
||||
DPRINT(MK_STR(_texecvpe)"('%"sT"')\n", cmdname);
|
||||
TRACE(MK_STR(_texecvpe)"('%"sT"')\n", cmdname);
|
||||
return _tspawnvpe(P_OVERLAY, cmdname, argv, envp);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,117 +1,115 @@
|
|||
/*
|
||||
* msvcrt.dll thread functions
|
||||
*
|
||||
* Copyright 2000 Jon Griffiths
|
||||
*
|
||||
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
#include <internal/wine/msvcrt.h>
|
||||
|
||||
#include <malloc.h>
|
||||
#include <process.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
void _amsg_exit (int errnum);
|
||||
/* Index to TLS */
|
||||
DWORD MSVCRT_tls_index;
|
||||
|
||||
typedef void (*_beginthread_start_routine_t)(void *);
|
||||
typedef unsigned int (__stdcall *_beginthreadex_start_routine_t)(void *);
|
||||
|
||||
/********************************************************************/
|
||||
|
||||
typedef struct {
|
||||
_beginthread_start_routine_t start_address;
|
||||
void *arglist;
|
||||
} _beginthread_trampoline_t;
|
||||
|
||||
/*********************************************************************
|
||||
* msvcrt_get_thread_data
|
||||
*
|
||||
* Return the thread local storage structure.
|
||||
*/
|
||||
MSVCRT_thread_data *msvcrt_get_thread_data(void)
|
||||
{
|
||||
MSVCRT_thread_data *ptr;
|
||||
DWORD err = GetLastError(); /* need to preserve last error */
|
||||
|
||||
if (!(ptr = TlsGetValue( MSVCRT_tls_index )))
|
||||
{
|
||||
if (!(ptr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ptr) )))
|
||||
_amsg_exit( _RT_THREAD );
|
||||
if (!TlsSetValue( MSVCRT_tls_index, ptr )) _amsg_exit( _RT_THREAD );
|
||||
ptr->random_seed = 1;
|
||||
}
|
||||
SetLastError( err );
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* _beginthread_trampoline
|
||||
*/
|
||||
static DWORD CALLBACK _beginthread_trampoline(LPVOID arg)
|
||||
{
|
||||
_beginthread_trampoline_t local_trampoline;
|
||||
|
||||
/* Maybe it's just being paranoid, but freeing arg right
|
||||
* away seems safer.
|
||||
*/
|
||||
memcpy(&local_trampoline,arg,sizeof(local_trampoline));
|
||||
free(arg);
|
||||
|
||||
local_trampoline.start_address(local_trampoline.arglist);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* _beginthread (MSVCRT.@)
|
||||
*/
|
||||
unsigned long _beginthread(
|
||||
_beginthread_start_routine_t start_address, /* [in] Start address of routine that begins execution of new thread */
|
||||
unsigned int stack_size, /* [in] Stack size for new thread or 0 */
|
||||
void *arglist) /* [in] Argument list to be passed to new thread or NULL */
|
||||
{
|
||||
_beginthread_trampoline_t* trampoline;
|
||||
|
||||
DPRINT("(%p, %d, %p)\n", start_address, stack_size, arglist);
|
||||
|
||||
/* Allocate the trampoline here so that it is still valid when the thread
|
||||
* starts... typically after this function has returned.
|
||||
* _beginthread_trampoline is responsible for freeing the trampoline
|
||||
*/
|
||||
trampoline=malloc(sizeof(*trampoline));
|
||||
trampoline->start_address = start_address;
|
||||
trampoline->arglist = arglist;
|
||||
|
||||
/* FIXME */
|
||||
return (unsigned long)CreateThread(NULL, stack_size, _beginthread_trampoline,
|
||||
trampoline, 0, NULL);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* _endthread (MSVCRT.@)
|
||||
*/
|
||||
void CDECL _endthread(void)
|
||||
{
|
||||
DPRINT("(void)\n");
|
||||
|
||||
/* FIXME */
|
||||
ExitThread(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* msvcrt.dll thread functions
|
||||
*
|
||||
* Copyright 2000 Jon Griffiths
|
||||
*
|
||||
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
#include <internal/wine/msvcrt.h>
|
||||
|
||||
#include <malloc.h>
|
||||
#include <process.h>
|
||||
|
||||
void _amsg_exit (int errnum);
|
||||
/* Index to TLS */
|
||||
DWORD MSVCRT_tls_index;
|
||||
|
||||
typedef void (*_beginthread_start_routine_t)(void *);
|
||||
typedef unsigned int (__stdcall *_beginthreadex_start_routine_t)(void *);
|
||||
|
||||
/********************************************************************/
|
||||
|
||||
typedef struct {
|
||||
_beginthread_start_routine_t start_address;
|
||||
void *arglist;
|
||||
} _beginthread_trampoline_t;
|
||||
|
||||
/*********************************************************************
|
||||
* msvcrt_get_thread_data
|
||||
*
|
||||
* Return the thread local storage structure.
|
||||
*/
|
||||
MSVCRT_thread_data *msvcrt_get_thread_data(void)
|
||||
{
|
||||
MSVCRT_thread_data *ptr;
|
||||
DWORD err = GetLastError(); /* need to preserve last error */
|
||||
|
||||
if (!(ptr = TlsGetValue( MSVCRT_tls_index )))
|
||||
{
|
||||
if (!(ptr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ptr) )))
|
||||
_amsg_exit( _RT_THREAD );
|
||||
if (!TlsSetValue( MSVCRT_tls_index, ptr )) _amsg_exit( _RT_THREAD );
|
||||
ptr->random_seed = 1;
|
||||
}
|
||||
SetLastError( err );
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* _beginthread_trampoline
|
||||
*/
|
||||
static DWORD CALLBACK _beginthread_trampoline(LPVOID arg)
|
||||
{
|
||||
_beginthread_trampoline_t local_trampoline;
|
||||
|
||||
/* Maybe it's just being paranoid, but freeing arg right
|
||||
* away seems safer.
|
||||
*/
|
||||
memcpy(&local_trampoline,arg,sizeof(local_trampoline));
|
||||
free(arg);
|
||||
|
||||
local_trampoline.start_address(local_trampoline.arglist);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* _beginthread (MSVCRT.@)
|
||||
*/
|
||||
unsigned long _beginthread(
|
||||
_beginthread_start_routine_t start_address, /* [in] Start address of routine that begins execution of new thread */
|
||||
unsigned int stack_size, /* [in] Stack size for new thread or 0 */
|
||||
void *arglist) /* [in] Argument list to be passed to new thread or NULL */
|
||||
{
|
||||
_beginthread_trampoline_t* trampoline;
|
||||
|
||||
TRACE("(%p, %d, %p)\n", start_address, stack_size, arglist);
|
||||
|
||||
/* Allocate the trampoline here so that it is still valid when the thread
|
||||
* starts... typically after this function has returned.
|
||||
* _beginthread_trampoline is responsible for freeing the trampoline
|
||||
*/
|
||||
trampoline=malloc(sizeof(*trampoline));
|
||||
trampoline->start_address = start_address;
|
||||
trampoline->arglist = arglist;
|
||||
|
||||
/* FIXME */
|
||||
return (unsigned long)CreateThread(NULL, stack_size, _beginthread_trampoline,
|
||||
trampoline, 0, NULL);
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* _endthread (MSVCRT.@)
|
||||
*/
|
||||
void CDECL _endthread(void)
|
||||
{
|
||||
TRACE("(void)\n");
|
||||
|
||||
/* FIXME */
|
||||
ExitThread(0);
|
||||
}
|
||||
|
||||
|
|
3199
reactos/lib/sdk/crt/stdio/file.c
Normal file
3199
reactos/lib/sdk/crt/stdio/file.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,9 +1,5 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
|
|
|
@ -11,10 +11,13 @@
|
|||
#include <precomp.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
#ifdef _UNICODE
|
||||
#define sT "S"
|
||||
#else
|
||||
#define sT "s"
|
||||
#endif
|
||||
|
||||
#define MK_STR(s) #s
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
|
@ -132,3 +135,4 @@ int _pclose (FILE *pp)
|
|||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
#include <precomp.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
#ifdef _UNICODE
|
||||
#define sT "S"
|
||||
#else
|
||||
#define sT "s"
|
||||
#endif
|
||||
|
||||
#define MK_STR(s) #s
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
|
@ -10,10 +15,11 @@
|
|||
int _tremove(const _TCHAR *fn)
|
||||
{
|
||||
int result = 0;
|
||||
DPRINT(MK_STR(_tremove)"('%"sT"')\n", fn);
|
||||
TRACE(MK_STR(_tremove)"('%"sT"')\n", fn);
|
||||
if (!DeleteFile(fn))
|
||||
result = -1;
|
||||
DPRINT("%d\n", result);
|
||||
TRACE("%d\n", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
/* $Id$
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/crt/errno.c
|
||||
* PURPOSE: Unknown
|
||||
* PROGRAMER: Unknown
|
||||
*
|
||||
*/
|
||||
#include <precomp.h>
|
||||
|
|
|
@ -9,10 +9,6 @@
|
|||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
#undef environ
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,120 +1,28 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#if 1
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
size_t mbstowcs(wchar_t* wcstr, const char* mbstr, size_t count)
|
||||
size_t mbstowcs (wchar_t *widechar, const char *multibyte, size_t number)
|
||||
{
|
||||
size_t size;
|
||||
int i;
|
||||
int bytes;
|
||||
int n = 0;
|
||||
|
||||
printf("\nmbstowcs(%p, %p, %d) called.\n\n", wcstr, mbstr, count);
|
||||
while (n < number) {
|
||||
|
||||
if (count <= 0 || !mbstr)
|
||||
return 0;
|
||||
if ((bytes = mbtowc (widechar, multibyte, MB_LEN_MAX)) < 0)
|
||||
return -1;
|
||||
|
||||
if (!*mbstr)
|
||||
return 0;
|
||||
if (bytes == 0) {
|
||||
*widechar = (wchar_t) '\0';
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
if (wcstr == NULL) {
|
||||
// return required size for the converted string
|
||||
return strlen(mbstr); // TODO: fixme
|
||||
widechar++;
|
||||
multibyte += bytes;
|
||||
n++;
|
||||
}
|
||||
for (size = 0, i = 0; i < count; size++) {
|
||||
int result;
|
||||
|
||||
////int mbtowc( wchar_t *wchar, const char *mbchar, size_t count )
|
||||
//// result = mbtowc(wcstr + size, mbstr + i, count - i);
|
||||
// result = mbtowc(wcstr + size, mbstr + i, 1);
|
||||
|
||||
/////////////////////////////////////////
|
||||
if (mbstr[i] == 0) {
|
||||
result = 0;
|
||||
} else {
|
||||
wcstr[size] = mbstr[i];
|
||||
result = 1;
|
||||
}
|
||||
/////////////////////////////////////////
|
||||
if (result == -1) {
|
||||
return -1;
|
||||
} else if (result == 0) {
|
||||
wcstr[size] = L'\0';
|
||||
break;
|
||||
} else {
|
||||
i += result;
|
||||
}
|
||||
|
||||
}
|
||||
return size;
|
||||
return n;
|
||||
}
|
||||
|
||||
#else
|
||||
#if 1
|
||||
|
||||
//int mbtowc(wchar_t *dst, const char *str, size_t n)
|
||||
size_t mbstowcs(wchar_t* wcstr, const char* mbstr, size_t count)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
if (count <= 0 || !mbstr)
|
||||
return 0;
|
||||
len = MultiByteToWideChar(CP_ACP, 0, mbstr, count, wcstr, (wcstr == NULL) ? 0 : count);
|
||||
|
||||
if (!len) {
|
||||
DWORD err = GetLastError();
|
||||
switch (err) {
|
||||
case ERROR_INSUFFICIENT_BUFFER:
|
||||
break;
|
||||
case ERROR_INVALID_FLAGS:
|
||||
break;
|
||||
case ERROR_INVALID_PARAMETER:
|
||||
break;
|
||||
case ERROR_NO_UNICODE_TRANSLATION:
|
||||
break;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
/* return the number of bytes from src that have been used */
|
||||
if (!*mbstr)
|
||||
return 0;
|
||||
// if (count >= 2 && isleadbyte(*mbstr) && mbstr[1])
|
||||
// return 2;
|
||||
return len;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
size_t mbstowcs(wchar_t* wcstr, const char* mbstr, size_t count)
|
||||
{
|
||||
size_t size;
|
||||
int i;
|
||||
|
||||
if (wcstr == NULL) {
|
||||
// return required size for the converted string
|
||||
return strlen(mbstr); // TODO: fixme
|
||||
}
|
||||
for (size = 0, i = 0; i < count; size++) {
|
||||
int result;
|
||||
|
||||
//int mbtowc( wchar_t *wchar, const char *mbchar, size_t count )
|
||||
// result = mbtowc(wcstr + size, mbstr + i, count - i);
|
||||
result = mbtowc(wcstr + size, mbstr + i, 1);
|
||||
if (result == -1) {
|
||||
return -1;
|
||||
} else if (result == 0) {
|
||||
wcstr[size] = L'\0';
|
||||
break;
|
||||
} else {
|
||||
i += result;
|
||||
}
|
||||
|
||||
}
|
||||
return (size_t)size;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -10,53 +10,36 @@
|
|||
|
||||
#include <precomp.h>
|
||||
|
||||
#if 1
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int mbtowc(wchar_t *dst, const char *str, size_t n)
|
||||
|
||||
int mbtowc (wchar_t *charptr, const char *address, size_t number)
|
||||
{
|
||||
// printf("\t\t\tmbtowc(%p, %p, %d) called.\n", dst, str, n);
|
||||
int bytes;
|
||||
|
||||
if (n <= 0 || !str)
|
||||
return 0;
|
||||
if (address == 0)
|
||||
return 0;
|
||||
|
||||
*dst = *str;
|
||||
if ((bytes = mblen (address, number)) < 0)
|
||||
return bytes;
|
||||
|
||||
if (!*str)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int mbtowc(wchar_t *dst, const char *str, size_t n)
|
||||
{
|
||||
if (n <= 0 || !str)
|
||||
return 0;
|
||||
if (!MultiByteToWideChar(CP_ACP, 0, str, n, dst, (dst == NULL) ? 0 : 1)) {
|
||||
DWORD err = GetLastError();
|
||||
switch (err) {
|
||||
case ERROR_INSUFFICIENT_BUFFER:
|
||||
break;
|
||||
case ERROR_INVALID_FLAGS:
|
||||
break;
|
||||
case ERROR_INVALID_PARAMETER:
|
||||
break;
|
||||
case ERROR_NO_UNICODE_TRANSLATION:
|
||||
break;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
if (charptr) {
|
||||
switch (bytes) {
|
||||
case 0:
|
||||
if (number > 0)
|
||||
*charptr = (wchar_t) '\0';
|
||||
break;
|
||||
case 1:
|
||||
*charptr = (wchar_t) ((unsigned char) address[0]);
|
||||
break;
|
||||
case 2:
|
||||
*charptr = (wchar_t) (((unsigned char) address[0] << 8)
|
||||
| (unsigned char) address[1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* return the number of bytes from src that have been used */
|
||||
if (!*str)
|
||||
return 0;
|
||||
if (n >= 2 && isleadbyte(*str) && str[1])
|
||||
return 2;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
return bytes;
|
||||
}
|
||||
|
|
|
@ -9,9 +9,6 @@
|
|||
*/
|
||||
#include <precomp.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
/* misc/environ.c */
|
||||
int SetEnv(const wchar_t *option);
|
||||
|
||||
|
|
|
@ -13,8 +13,13 @@
|
|||
#include <string.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
#ifdef _UNICODE
|
||||
#define sT "S"
|
||||
#else
|
||||
#define sT "s"
|
||||
#endif
|
||||
|
||||
#define MK_STR(s) #s
|
||||
|
||||
|
||||
/*
|
||||
|
@ -27,7 +32,7 @@ void _tsearchenv(const _TCHAR* file,const _TCHAR* var,_TCHAR* path)
|
|||
_TCHAR* y;
|
||||
_TCHAR* FilePart;
|
||||
|
||||
DPRINT(MK_STR(_tsearchenv)"()\n");
|
||||
TRACE(MK_STR(_tsearchenv)"()\n");
|
||||
|
||||
x = _tcschr(env,'=');
|
||||
if ( x != NULL ) {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#include <precomp.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
/* misc/environ.c */
|
||||
int SetEnv(const wchar_t *option);
|
||||
|
|
|
@ -28,10 +28,10 @@
|
|||
#include <wchar.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
#define WARN DPRINT1
|
||||
// HACK for LIBCNT
|
||||
#ifndef debugstr_a
|
||||
#define debugstr_a
|
||||
#endif
|
||||
|
||||
extern FILE _iob[];
|
||||
|
||||
|
|
|
@ -1,20 +1,39 @@
|
|||
#include <stdlib.h>
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/msvcrt/mbstring/wcstom.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER:
|
||||
* UPDATE HISTORY:
|
||||
* 05/30/08: Samuel Serapion adapted from PROJECT C Library
|
||||
*
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
#include <mbctype.h>
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
size_t wcstombs (char* mbsDest, const wchar_t* wsConvert, size_t size)
|
||||
size_t wcstombs (char *string, const wchar_t *widechar, size_t count)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int n, bytes;
|
||||
int cnt = 0;
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
int wctomb (char* mbDest, wchar_t wc)
|
||||
{
|
||||
return 0;
|
||||
for (n = 0; n < count; n++) {
|
||||
|
||||
if ((bytes = wctomb (string, *widechar)) < 0)
|
||||
return -1;
|
||||
|
||||
if (*string == 0)
|
||||
return cnt;
|
||||
|
||||
widechar++;
|
||||
string += bytes;
|
||||
cnt += bytes;
|
||||
}
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,145 +1,47 @@
|
|||
/* Copyright (C) 1991, 1992, 1995, 1996, 1997 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. */
|
||||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/sdk/crt/mbstring/wctomb.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER:
|
||||
* UPDATE HISTORY:
|
||||
* 05/30/08: Samuel Serapion adapted from PROJECT C Library
|
||||
*
|
||||
*/
|
||||
|
||||
#include <precomp.h>
|
||||
|
||||
int
|
||||
STDCALL
|
||||
WideCharToMultiByte(
|
||||
UINT CodePage,
|
||||
DWORD dwFlags,
|
||||
LPCWSTR lpWideCharStr,
|
||||
int cchWideChar,
|
||||
LPSTR lpMultiByteStr,
|
||||
int cchMultiByte,
|
||||
LPCSTR lpDefaultChar,
|
||||
LPBOOL lpUsedDefaultChar);
|
||||
|
||||
#include <mbstring.h>
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
int wctomb(char* dst, wchar_t ch)
|
||||
int wctomb (char *string, wchar_t widechar)
|
||||
{
|
||||
#if 0
|
||||
return WideCharToMultiByte(CP_ACP, 0, &ch, 1, dst, 6, NULL, NULL);
|
||||
#else
|
||||
if (dst == NULL) {
|
||||
return 1;
|
||||
} else if (0 != (ch & 0xff00)) {
|
||||
return -1;
|
||||
int c1, c2;
|
||||
|
||||
if (string == 0)
|
||||
return 0;
|
||||
|
||||
if (widechar & 0xff00) {
|
||||
|
||||
c1 = (widechar >> 8) & 0xff;
|
||||
c2 = (widechar & 0xff);
|
||||
|
||||
if (_ismbblead (c1) == 0 || _ismbbtrail (c2) == 0)
|
||||
return -1;
|
||||
|
||||
*string++ = (char) c1;
|
||||
*string = (char) c2;
|
||||
|
||||
return 2;
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
*string = (char) widechar & 0xff;
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
*dst = ch;
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
|
||||
#ifndef EILSEQ
|
||||
#define EILSEQ EINVAL
|
||||
#endif
|
||||
|
||||
static const wchar_t encoding_mask[] =
|
||||
{
|
||||
/* This reflects the sources *nix origin where type wchar_t
|
||||
was 32 bits wide. Since our type wchar_t is only 16 bits
|
||||
wide all this module will need to be reviewed.
|
||||
Simplest option may well be to forward this modules work
|
||||
on to the kernel which already has support for this.
|
||||
*/
|
||||
~0x7ff, ~0xffff, ~0x1fffff, ~0x3ffffff
|
||||
//~0x0000-07ff, ~0x0000-ffff, ~0x001f-ffff, ~0x03ff-ffff
|
||||
};
|
||||
|
||||
static const unsigned char encoding_byte[] =
|
||||
{
|
||||
0xc0, 0xe0, 0xf0, 0xf8, 0xfc
|
||||
};
|
||||
|
||||
/* The state is for this UTF8 encoding not used. */
|
||||
//static mbstate_t internal;
|
||||
//extern mbstate_t __no_r_state; /* Defined in mbtowc.c. */
|
||||
|
||||
size_t __wcrtomb(char *s, wchar_t wc);
|
||||
|
||||
/* Convert WCHAR into its multibyte character representation,
|
||||
putting this in S and returning its length.
|
||||
|
||||
Attention: this function should NEVER be intentionally used.
|
||||
The interface is completely stupid. The state is shared between
|
||||
all conversion functions. You should use instead the restartable
|
||||
version `wcrtomb'. */
|
||||
|
||||
int wctomb(char *s, wchar_t wchar)
|
||||
{
|
||||
/* If S is NULL the function has to return null or not null
|
||||
depending on the encoding having a state depending encoding or
|
||||
not. This is nonsense because any multibyte encoding has a
|
||||
state. The ISO C amendment 1 corrects this while introducing the
|
||||
restartable functions. We simply say here all encodings have a
|
||||
state. */
|
||||
if (s == NULL) {
|
||||
return 1;
|
||||
}
|
||||
return __wcrtomb(s, wchar);
|
||||
}
|
||||
|
||||
size_t __wcrtomb(char *s, wchar_t wc)
|
||||
{
|
||||
char fake[1];
|
||||
size_t written = 0;
|
||||
|
||||
if (s == NULL) {
|
||||
s = fake;
|
||||
wc = L'\0';
|
||||
}
|
||||
/* Store the UTF8 representation of WC. */
|
||||
//if (wc < 0 || wc > 0x7fffffff) {
|
||||
if (wc < 0 || wc > 0x7fff) {
|
||||
/* This is no correct ISO 10646 character. */
|
||||
__set_errno (EILSEQ);
|
||||
return (size_t) -1;
|
||||
}
|
||||
if (wc < 0x80) {
|
||||
/* It's a one byte sequence. */
|
||||
if (s != NULL) {
|
||||
*s = (char)wc;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
for (written = 2; written < 6; ++written) {
|
||||
if ((wc & encoding_mask[written - 2]) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (s != NULL) {
|
||||
size_t cnt = written;
|
||||
s[0] = encoding_byte[cnt - 2];
|
||||
--cnt;
|
||||
do {
|
||||
s[cnt] = 0x80 | (wc & 0x3f);
|
||||
wc >>= 6;
|
||||
} while (--cnt > 0);
|
||||
s[0] |= wc;
|
||||
}
|
||||
return written;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
|
||||
#include <precomp.h>
|
||||
#include <sys/stat.h>
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
|
@ -83,6 +81,6 @@ int _fstati64(int fd, struct _stati64* statbuf)
|
|||
|
||||
int _fstat64(int fd, struct __stat64* buf)
|
||||
{
|
||||
DPRINT1("stub\n");
|
||||
FIXME("stub\n");
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -12,9 +12,6 @@
|
|||
#include <sys/stat.h>
|
||||
#include <direct.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
/* for stat mode, permissions apply to all,owner and group */
|
||||
#define ALL_S_IREAD (S_IREAD | (S_IREAD >> 3) | (S_IREAD >> 6))
|
||||
#define ALL_S_IWRITE (S_IWRITE | (S_IWRITE >> 3) | (S_IWRITE >> 6))
|
||||
|
@ -139,7 +136,7 @@ int CDECL _stat64(const char* path, struct __stat64 * buf)
|
|||
|
||||
if (!GetFileAttributesExA(path, GetFileExInfoStandard, &hfi))
|
||||
{
|
||||
DPRINT1("failed (%d)\n",GetLastError());
|
||||
ERR("failed (%d)\n",GetLastError());
|
||||
*_errno() = ERROR_FILE_NOT_FOUND;
|
||||
return -1;
|
||||
}
|
||||
|
@ -186,10 +183,11 @@ int CDECL _stat64(const char* path, struct __stat64 * buf)
|
|||
RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw);
|
||||
buf->st_mtime = buf->st_ctime = dw;
|
||||
|
||||
DPRINT("%d %d 0x%08lx%08lx %ld %ld %ld\n", buf->st_mode,buf->st_nlink,
|
||||
TRACE("%d %d 0x%08lx%08lx %ld %ld %ld\n", buf->st_mode,buf->st_nlink,
|
||||
(long)(buf->st_size >> 32),(long)buf->st_size,
|
||||
(long)buf->st_atime,(long)buf->st_mtime,(long)buf->st_ctime);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#define CPP_CONST
|
||||
#endif
|
||||
|
||||
#undef P
|
||||
#define P(s) s
|
||||
#define alloc_size_t size_t
|
||||
#define qsort_size_t size_t
|
||||
|
|
|
@ -23,13 +23,6 @@
|
|||
|
||||
#include <precomp.h>
|
||||
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
#include <internal/mtdll.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* MT */
|
||||
#define LOCK_HEAP _mlock( _HEAP_LOCK )
|
||||
#define UNLOCK_HEAP _munlock( _HEAP_LOCK )
|
||||
|
@ -55,7 +48,7 @@ static size_t MSVCRT_sbh_threshold = 0;
|
|||
void* MSVCRT_operator_new(unsigned long size)
|
||||
{
|
||||
void *retval = malloc(size);
|
||||
DPRINT("(%ld) returning %p\n", size, retval);
|
||||
TRACE("(%ld) returning %p\n", size, retval);
|
||||
LOCK_HEAP;
|
||||
if(!retval && MSVCRT_new_handler)
|
||||
(*MSVCRT_new_handler)(size);
|
||||
|
@ -68,7 +61,7 @@ void* MSVCRT_operator_new(unsigned long size)
|
|||
*/
|
||||
void MSVCRT_operator_delete(void *mem)
|
||||
{
|
||||
DPRINT("(%p)\n", mem);
|
||||
TRACE("(%p)\n", mem);
|
||||
free(mem);
|
||||
}
|
||||
|
||||
|
@ -108,7 +101,7 @@ MSVCRT_new_handler_func MSVCRT__set_new_handler(MSVCRT_new_handler_func func)
|
|||
*/
|
||||
MSVCRT_new_handler_func MSVCRT_set_new_handler(void *func)
|
||||
{
|
||||
DPRINT("(%p)\n",func);
|
||||
TRACE("(%p)\n",func);
|
||||
MSVCRT__set_new_handler(NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -158,7 +151,7 @@ int CDECL _set_sbh_threshold(size_t threshold)
|
|||
*/
|
||||
int _heapadd(void* mem, size_t size)
|
||||
{
|
||||
DPRINT("(%p,%d) unsupported in Win32\n", mem,size);
|
||||
TRACE("(%p,%d) unsupported in Win32\n", mem,size);
|
||||
*_errno() = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue