[CRT] Remove obsolete CRT files

This commit is contained in:
Timo Kreuzer
2025-06-18 13:13:32 +03:00
parent ac63dd5639
commit de7e707459
299 changed files with 29 additions and 28738 deletions

View File

@@ -1,11 +1,8 @@
include_directories(include)
#include_directories(.)
add_definitions(-D_CRTBLD)
include(conio/conio.cmake)
include(direct/direct.cmake)
include(except/except.cmake)
include(float/float.cmake)
include(math/math.cmake)
@@ -13,17 +10,12 @@ include(mbstring/mbstring.cmake)
include(mem/mem.cmake)
include(misc/misc.cmake)
include(printf/printf.cmake)
include(process/process.cmake)
include(search/search.cmake)
include(startup/startup.cmake)
include(stdio/stdio.cmake)
include(stdlib/stdlib.cmake)
include(string/string.cmake)
include(time/time.cmake)
include(wine/wine.cmake)
include(wstring/wstring.cmake)
include(crt.cmake)
include(crtmath.cmake)
include(libcntpr.cmake)
include(msvcrtex.cmake)

View File

@@ -1,73 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: lib/sdk/crt/conio/cgets.c
* PURPOSE: C Runtime
* PROGRAMMER: Eric Kohl (Imported from DJGPP)
*/
#include <precomp.h>
/*
* @implemented
*/
char *_cgets(char *string)
{
unsigned len = 0;
unsigned int maxlen_wanted;
char *sp;
int c;
/*
* Be smart and check for NULL pointer.
* Don't know wether TURBOC does this.
*/
if (!string)
return(NULL);
maxlen_wanted = (unsigned int)((unsigned char)string[0]);
sp = &(string[2]);
/*
* Should the string be shorter maxlen_wanted including or excluding
* the trailing '\0' ? We don't take any risk.
*/
while(len < maxlen_wanted-1)
{
c=_getch();
/*
* shold we check for backspace here?
* TURBOC does (just checked) but doesn't in cscanf (thats harder
* or even impossible). We do the same.
*/
if (c == '\b')
{
if (len > 0)
{
_cputs("\b \b"); /* go back, clear char on screen with space
and go back again */
len--;
sp[len] = '\0'; /* clear the character in the string */
}
}
else if (c == '\r')
{
sp[len] = '\0';
break;
}
else if (c == 0)
{
/* special character ends input */
sp[len] = '\0';
_ungetch(c); /* keep the char for later processing */
break;
}
else
{
sp[len] = _putch(c);
len++;
}
}
sp[maxlen_wanted-1] = '\0';
string[1] = (char)((unsigned char)len);
return(sp);
}

View File

@@ -1,10 +0,0 @@
list(APPEND CRT_CONIO_SOURCE
conio/cgets.c
conio/cputs.c
conio/getch.c
conio/getche.c
conio/kbhit.c
conio/putch.c
conio/ungetch.c
)

View File

@@ -1,29 +0,0 @@
/* Imported from msvcrt/console.c */
#include <precomp.h>
/*********************************************************************
* _cputs (MSVCRT.@)
*/
int CDECL _cputs(const char* str)
{
DWORD count;
int len, retval = -1;
#ifdef __REACTOS__ /* r54651 */
HANDLE MSVCRT_console_out = GetStdHandle(STD_OUTPUT_HANDLE);
#endif
if (!MSVCRT_CHECK_PMT(str != NULL)) return -1;
len = strlen(str);
#ifndef __REACTOS__ /* r54651 */
LOCK_CONSOLE;
#endif
if (WriteConsoleA(MSVCRT_console_out, str, len, &count, NULL)
&& count == len)
retval = 0;
#ifndef __REACTOS__ /* r54651 */
UNLOCK_CONSOLE;
#endif
return retval;
}

View File

@@ -1,55 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/conio/getch.c
* PURPOSE: Writes a character to stdout
* PROGRAMER: Ariadne
* UPDATE HISTORY:
* 28/12/98: Created
*/
#include <precomp.h>
/*
* @implemented
*/
int _getch(void)
{
DWORD NumberOfCharsRead = 0;
char c;
HANDLE ConsoleHandle;
BOOL RestoreMode;
DWORD ConsoleMode;
if (char_avail) {
c = ungot_char;
char_avail = 0;
} else {
/*
* _getch() is documented to NOT echo characters. Testing shows it
* doesn't wait for a CR either. So we need to switch off
* ENABLE_ECHO_INPUT and ENABLE_LINE_INPUT if they're currently
* switched on.
*/
ConsoleHandle = (HANDLE) _get_osfhandle(stdin->_file);
RestoreMode = GetConsoleMode(ConsoleHandle, &ConsoleMode) &&
(0 != (ConsoleMode &
(ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT)));
if (RestoreMode) {
SetConsoleMode(ConsoleHandle,
ConsoleMode & (~ (ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT)));
}
ReadConsoleA((HANDLE)_get_osfhandle(stdin->_file),
&c,
1,
&NumberOfCharsRead,
NULL);
if (RestoreMode) {
SetConsoleMode(ConsoleHandle, ConsoleMode);
}
}
if (c == 10)
c = 13;
return c;
}

View File

@@ -1,29 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/conio/getche.c
* PURPOSE: Reads a character from stdin
* PROGRAMER: DJ Delorie
Ariadne
* UPDATE HISTORY:
* 28/12/98: Created
*/
#include <precomp.h>
int _getche(void)
{
if (char_avail)
/*
* We don't know, wether the ungot char was already echoed
* we assume yes (for example in cscanf, probably the only
* place where ungetch is ever called.
* There is no way to check for this really, because
* ungetch could have been called with a character that
* hasn't been got by a conio function.
* We don't echo again.
*/
return(_getch());
return (_putch(_getch()));
}

View File

@@ -1,99 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/conio/kbhit.c
* PURPOSE: Checks for keyboard hits
* PROGRAMERS: Ariadne, Russell
* UPDATE HISTORY:
* 28/12/98: Created
* 27/9/08: An almost 100% working version of _kbhit()
*/
#include <precomp.h>
static CRITICAL_SECTION CriticalSection;
volatile BOOL CriticalSectionInitialized=FALSE;
/*
* @implemented
*/
int _kbhit(void)
{
PINPUT_RECORD InputRecord = NULL;
DWORD NumberRead = 0;
DWORD EventsRead = 0;
DWORD RecordIndex = 0;
DWORD BufferIndex = 0;
HANDLE StdInputHandle = 0;
DWORD ConsoleInputMode = 0;
/* Attempt some thread safety */
if (!CriticalSectionInitialized)
{
InitializeCriticalSectionAndSpinCount(&CriticalSection, 0x80000400);
CriticalSectionInitialized = TRUE;
}
EnterCriticalSection(&CriticalSection);
if (char_avail)
{
LeaveCriticalSection(&CriticalSection);
return 1;
}
StdInputHandle = GetStdHandle(STD_INPUT_HANDLE);
/* Turn off processed input so we get key modifiers as well */
GetConsoleMode(StdInputHandle, &ConsoleInputMode);
SetConsoleMode(StdInputHandle, ConsoleInputMode & ~ENABLE_PROCESSED_INPUT);
/* Start the process */
if (!GetNumberOfConsoleInputEvents(StdInputHandle, &EventsRead))
{
LeaveCriticalSection(&CriticalSection);
return 0;
}
if (!EventsRead)
{
LeaveCriticalSection(&CriticalSection);
return 0;
}
if (!(InputRecord = (PINPUT_RECORD)malloc(EventsRead * sizeof(INPUT_RECORD))))
{
LeaveCriticalSection(&CriticalSection);
return 0;
}
if (!PeekConsoleInput(StdInputHandle, InputRecord, EventsRead, &NumberRead))
{
free(InputRecord);
LeaveCriticalSection(&CriticalSection);
return 0;
}
for (RecordIndex = 0; RecordIndex < NumberRead; RecordIndex++)
{
if (InputRecord[RecordIndex].EventType == KEY_EVENT &&
InputRecord[RecordIndex].Event.KeyEvent.bKeyDown)
{
BufferIndex = 1;
break;
}
}
free(InputRecord);
/* Restore console input mode */
SetConsoleMode(StdInputHandle, ConsoleInputMode);
LeaveCriticalSection(&CriticalSection);
return BufferIndex;
}

View File

@@ -1,24 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/conio/putch.c
* PURPOSE: Writes a character to stdout
* PROGRAMER: Ariadne
* UPDATE HISTORY:
* 28/12/98: Created
*/
#include <precomp.h>
/*
* @implemented
*/
int _putch(int c)
{
DWORD NumberOfCharsWritten;
if (WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),&c,1,&NumberOfCharsWritten,NULL)) {
return -1;
}
return NumberOfCharsWritten;
}

View File

@@ -1,29 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/conio/ungetch.c
* PURPOSE: Ungets a character from stdin
* PROGRAMER: DJ Delorie
Ariadne [ Adapted from djgpp libc ]
* UPDATE HISTORY:
* 28/12/98: Created
*/
#include <precomp.h>
int char_avail = 0;
int ungot_char = 0;
/*
* @implemented
*/
int _ungetch(int c)
{
if (char_avail)
return(EOF);
ungot_char = c;
char_avail = 1;
return(c);
}

View File

@@ -1,45 +0,0 @@
list(APPEND CRT_SOURCE
${CRT_CONIO_SOURCE}
${CRT_DIRECT_SOURCE}
${CRT_EXCEPT_SOURCE}
locale/locale.c
${CRT_MBSTRING_SOURCE}
${CRT_MEM_SOURCE}
${CRT_MISC_SOURCE}
${CRT_PRINTF_SOURCE}
${CRT_PROCESS_SOURCE}
${CRT_SEARCH_SOURCE}
signal/signal.c
${CRT_STARTUP_SOURCE}
${CRT_STDIO_SOURCE}
${CRT_STDLIB_SOURCE}
${CRT_STRING_SOURCE}
sys_stat/systime.c
${CRT_TIME_SOURCE}
${CRT_WINE_SOURCE}
${CRT_WSTRING_SOURCE}
)
list(APPEND CRT_ASM_SOURCE
${CRT_EXCEPT_ASM_SOURCE}
${CRT_STDLIB_ASM_SOURCE}
${CRT_STRING_ASM_SOURCE}
${CRT_WINE_ASM_SOURCE}
)
set_source_files_properties(${CRT_ASM_SOURCE} PROPERTIES COMPILE_DEFINITIONS "__MINGW_IMPORT=extern;USE_MSVCRT_PREFIX;_MSVCRT_LIB_;_MSVCRT_;_MT;CRTDLL")
add_asm_files(crt_asm ${CRT_ASM_SOURCE})
add_library(crt ${CRT_SOURCE} ${crt_asm})
target_link_libraries(crt chkstk ${PSEH_LIB})
target_sources(crt PRIVATE $<TARGET_OBJECTS:crtmath>)
target_compile_definitions(crt
PRIVATE __MINGW_IMPORT=extern
USE_MSVCRT_PREFIX
_MSVCRT_LIB_
_MSVCRT_
_MT
CRTDLL)
#add_pch(crt precomp.h)
add_dependencies(crt psdk asm)

View File

@@ -1,29 +0,0 @@
#include <precomp.h>
#include <tchar.h>
#include <process.h>
/*
* @implemented
*/
int _tchdir(const _TCHAR* _path)
{
WCHAR newdir[MAX_PATH];
if (!SetCurrentDirectory(_path))
{
_dosmaperr(_path ? GetLastError() : 0);
return -1;
}
/* Update the drive-specific current directory variable */
if (GetCurrentDirectoryW(MAX_PATH, newdir) >= 2)
{
if (newdir[1] == L':')
{
WCHAR envvar[4] = { L'=', towupper(newdir[0]), L':', L'\0' };
SetEnvironmentVariableW(envvar, newdir);
}
}
return 0;
}

View File

@@ -1,45 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/direct/chdrive.c
* PURPOSE: Change the current drive.
* PROGRAMER: WINE
* UPDATE HISTORY:
* 25/11/05: Added license header
*/
#include <precomp.h>
/*
* @implemented
*
* _chdrive (MSVCRT.@)
*
* Change the current drive.
*
* PARAMS
* newdrive [I] Drive number to change to (1 = 'A', 2 = 'B', ...)
*
* RETURNS
* Success: 0. The current drive is set to newdrive.
* Failure: -1. errno indicates the error.
*
* NOTES
* See SetCurrentDirectoryA.
*/
int _chdrive(int newdrive)
{
WCHAR buffer[] = L"A:";
buffer[0] += newdrive - 1;
if (!SetCurrentDirectoryW( buffer ))
{
_dosmaperr(GetLastError());
if (newdrive <= 0)
{
_set_errno(EACCES);
}
return -1;
}
return 0;
}

View File

@@ -1,16 +0,0 @@
list(APPEND CRT_DIRECT_SOURCE
direct/chdir.c
direct/chdrive.c
direct/getcwd.c
direct/getdcwd.c
direct/getdfree.c
direct/getdrive.c
direct/mkdir.c
direct/rmdir.c
direct/wchdir.c
direct/wgetcwd.c
direct/wgetdcwd.c
direct/wmkdir.c
direct/wrmdir.c
)

View File

@@ -1,33 +0,0 @@
#include <precomp.h>
#include <direct.h>
#include <process.h>
#include <tchar.h>
/*
* @implemented
*/
_TCHAR* _tgetcwd(_TCHAR* buf, int size)
{
_TCHAR dir[MAX_PATH];
DWORD dir_len = GetCurrentDirectory(MAX_PATH,dir);
if (dir_len == 0)
{
_dosmaperr(GetLastError());
return NULL; /* FIXME: Real return value untested */
}
if (!buf)
{
return _tcsdup(dir);
}
if (dir_len >= (DWORD)size)
{
_set_errno(ERANGE);
return NULL; /* buf too small */
}
_tcscpy(buf,dir);
return buf;
}

View File

@@ -1,62 +0,0 @@
#include <precomp.h>
#include <direct.h>
#include <tchar.h>
/*
* @implemented
*
* _getdcwd (MSVCRT.@)
*
* Get the current working directory on a given disk.
*
* PARAMS
* drive [I] Drive letter to get the current working directory from.
* buf [O] Destination for the current working directory.
* size [I] Length of drive in characters.
*
* RETURNS
* Success: If drive is NULL, returns an allocated string containing the path.
* Otherwise populates drive with the path and returns it.
* Failure: NULL. errno indicates the error.
*/
_TCHAR* _tgetdcwd(int drive, _TCHAR * buf, int size)
{
static _TCHAR* dummy;
TRACE(":drive %d(%c), size %d\n",drive, drive + 'A' - 1, size);
if (!drive || drive == _getdrive())
return _tgetcwd(buf,size); /* current */
else
{
_TCHAR dir[MAX_PATH];
_TCHAR drivespec[] = _T("A:");
int dir_len;
drivespec[0] += drive - 1;
if (GetDriveType(drivespec) < DRIVE_REMOVABLE)
{
_set_errno(EACCES);
return NULL;
}
/* GetFullPathName for X: means "get working directory on drive X",
* just like passing X: to SetCurrentDirectory means "switch to working
* directory on drive X". -Gunnar */
dir_len = GetFullPathName(drivespec,MAX_PATH,dir,&dummy);
if (dir_len >= size || dir_len < 1)
{
_set_errno(ERANGE);
return NULL; /* buf too small */
}
TRACE(":returning '%s'\n", dir);
if (!buf)
return _tcsdup(dir); /* allocate */
_tcscpy(buf,dir);
}
return buf;
}

View File

@@ -1,23 +0,0 @@
#include <precomp.h>
#include <ctype.h>
#include <direct.h>
/*
* @implemented
*/
unsigned int _getdiskfree(unsigned int _drive, struct _diskfree_t* _diskspace)
{
char RootPathName[10];
RootPathName[0] = toupper(_drive +'@');
RootPathName[1] = ':';
RootPathName[2] = '\\';
RootPathName[3] = 0;
if (_diskspace == NULL)
return 0;
if (!GetDiskFreeSpaceA(RootPathName,(LPDWORD)&_diskspace->sectors_per_cluster,(LPDWORD)&_diskspace->bytes_per_sector,
(LPDWORD )&_diskspace->avail_clusters,(LPDWORD )&_diskspace->total_clusters))
return 0;
return _diskspace->avail_clusters;
}

View File

@@ -1,38 +0,0 @@
#include <precomp.h>
#include <ctype.h>
#include <direct.h>
/*
* @implemented
*
* _getdrive (MSVCRT.@)
*
* Get the current drive number.
*
* PARAMS
* None.
*
* RETURNS
* Success: The drive letter number from 1 to 26 ("A:" to "Z:").
* Failure: 0.
*/
int _getdrive(void)
{
WCHAR buffer[MAX_PATH];
if (GetCurrentDirectoryW( MAX_PATH, buffer )>=2)
{
buffer[0]=towupper(buffer[0]);
if (buffer[0] >= L'A' && buffer[0] <= L'Z' && buffer[1] == L':')
return buffer[0] - L'A' + 1;
}
return 0;
}
/*
* @implemented
*/
unsigned long _getdrives(void)
{
return GetLogicalDrives();
}

View File

@@ -1,15 +0,0 @@
#include <precomp.h>
#include <direct.h>
#include <tchar.h>
/*
* @implemented
*/
int _tmkdir(const _TCHAR* _path)
{
if (!CreateDirectory(_path, NULL)) {
_dosmaperr(GetLastError());
return -1;
}
return 0;
}

View File

@@ -1,15 +0,0 @@
#include <precomp.h>
#include <direct.h>
#include <tchar.h>
/*
* @implemented
*/
int _trmdir(const _TCHAR* _path)
{
if (!RemoveDirectory(_path)) {
_dosmaperr(GetLastError());
return -1;
}
return 0;
}

View File

@@ -1,4 +0,0 @@
#define UNICODE
#define _UNICODE
#include "chdir.c"

View File

@@ -1,5 +0,0 @@
#define UNICODE
#define _UNICODE
#include "getcwd.c"

View File

@@ -1,5 +0,0 @@
#define UNICODE
#define _UNICODE
#include "getdcwd.c"

View File

@@ -1,4 +0,0 @@
#define UNICODE
#define _UNICODE
#include "mkdir.c"

View File

@@ -1,4 +0,0 @@
#define UNICODE
#define _UNICODE
#include "rmdir.c"

View File

@@ -1,31 +0,0 @@
#include <asm.inc>
.code64
.align 4
MACRO(START_VTABLE, shortname, cxxname)
EXTERN shortname&_rtti:PROC
EXTERN &shortname&_vector_dtor:PROC
.quad shortname&_rtti
PUBLIC &shortname&_vtable
&shortname&_vtable:
PUBLIC &cxxname
&cxxname:
.quad &shortname&_vector_dtor
ENDM
MACRO(DEFINE_EXCEPTION_VTABLE, shortname, cxxname)
START_VTABLE shortname, cxxname
EXTERN exception_what:ABS
.quad exception_what
ENDM
START_VTABLE type_info, __dummyname_type_info
DEFINE_EXCEPTION_VTABLE exception, ??_7exception@@6B@
DEFINE_EXCEPTION_VTABLE bad_typeid, ??_7bad_typeid@@6B@
DEFINE_EXCEPTION_VTABLE bad_cast, ??_7bad_cast@@6B@
DEFINE_EXCEPTION_VTABLE __non_rtti_object, ??_7__non_rtti_object@@6B@
END

View File

@@ -1,64 +0,0 @@
#include <asm.inc>
.code64
.align 4
MACRO(DEFINE_ALIAS, alias, orig)
EXTERN &orig:ABS
ALIAS <&alias> = <&orig>
ENDM
DEFINE_ALIAS ??3@YAXPEAX@Z, operator_delete
DEFINE_ALIAS ??_U@YAPEAX_K@Z, operator_new
DEFINE_ALIAS ??_U@YAPEAX_KHPEBDH@Z, operator_new_dbg
DEFINE_ALIAS ??_V@YAXPEAX@Z, operator_delete
DEFINE_ALIAS ??2@YAPEAX_K@Z, operator_new
DEFINE_ALIAS ??2@YAPEAX_KHPEBDH@Z, operator_new_dbg
DEFINE_ALIAS ?_query_new_handler@@YAP6AHI@ZXZ, _query_new_handler
DEFINE_ALIAS ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z, _set_new_handler
DEFINE_ALIAS ?set_new_handler@@YAP6AXXZP6AXXZ@Z, set_new_handler
DEFINE_ALIAS ?_query_new_mode@@YAHXZ, _query_new_mode
DEFINE_ALIAS ?_set_new_mode@@YAHH@Z, _set_new_mode
DEFINE_ALIAS ?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z, _set_se_translator
DEFINE_ALIAS ?set_terminate@@YAP6AXXZP6AXXZ@Z, set_terminate
DEFINE_ALIAS ?set_unexpected@@YAP6AXXZP6AXXZ@Z, set_unexpected
DEFINE_ALIAS ?terminate@@YAXXZ, terminate
DEFINE_ALIAS ?unexpected@@YAXXZ, unexpected
DEFINE_ALIAS ?what@exception@@UEBAPEBDXZ, exception_what
DEFINE_ALIAS ??0exception@@QEAA@AEBQEBDH@Z, exception_ctor_noalloc
DEFINE_ALIAS ??0exception@@QEAA@AEBV0@@Z, exception_copy_ctor
DEFINE_ALIAS ??0exception@@QEAA@XZ, exception_default_ctor
DEFINE_ALIAS ??1exception@@UEAA@XZ, exception_dtor
DEFINE_ALIAS ??4exception@@QEAAAEAV0@AEBV0@@Z, exception_opequals
DEFINE_ALIAS ??1type_info@@UEAA@XZ, type_info_dtor
DEFINE_ALIAS ??0__non_rtti_object@@QEAA@AEBV0@@Z, __non_rtti_object_copy_ctor
DEFINE_ALIAS ??0__non_rtti_object@@QEAA@PEBD@Z, __non_rtti_object_ctor
DEFINE_ALIAS ??0bad_cast@@AAE@PBQBD@Z, bad_cast_ctor
DEFINE_ALIAS ??0bad_cast@@AEAA@PEBQEBD@Z, bad_cast_ctor
DEFINE_ALIAS ??0bad_cast@@QAE@ABQBD@Z, bad_cast_ctor
DEFINE_ALIAS ??0bad_cast@@QEAA@AEBQEBD@Z, bad_cast_ctor
DEFINE_ALIAS ??0bad_cast@@QEAA@AEBV0@@Z, bad_cast_copy_ctor
DEFINE_ALIAS ??0bad_cast@@QEAA@PEBD@Z, bad_cast_ctor_charptr
DEFINE_ALIAS ??0bad_typeid@@QEAA@AEBV0@@Z, bad_typeid_copy_ctor
DEFINE_ALIAS ??0bad_typeid@@QEAA@PEBD@Z, bad_typeid_ctor
DEFINE_ALIAS ??0exception@@QEAA@AEBQEBD@Z, exception_ctor
DEFINE_ALIAS ??1__non_rtti_object@@UEAA@XZ, __non_rtti_object_dtor
DEFINE_ALIAS ??1bad_cast@@UEAA@XZ, bad_cast_dtor
DEFINE_ALIAS ??1bad_typeid@@UEAA@XZ, bad_typeid_dtor
DEFINE_ALIAS ??4bad_cast@@QEAAAEAV0@AEBV0@@Z, bad_cast_opequals
DEFINE_ALIAS ??4bad_typeid@@QEAAAEAV0@AEBV0@@Z, bad_typeid_opequals
DEFINE_ALIAS ??8type_info@@QEBAHAEBV0@@Z, type_info_opequals_equals
DEFINE_ALIAS ??9type_info@@QEBAHAEBV0@@Z, type_info_opnot_equals
DEFINE_ALIAS ??_Fbad_cast@@QEAAXXZ, bad_cast_default_ctor
DEFINE_ALIAS ??_Fbad_typeid@@QEAAXXZ, bad_typeid_default_ctor
DEFINE_ALIAS ?_query_new_handler@@YAP6AH_K@ZXZ, _query_new_handler
DEFINE_ALIAS ?_set_new_handler@@YAP6AH_K@ZP6AH0@Z@Z, _set_new_handler
DEFINE_ALIAS ?_set_se_translator@@YAP6AXIPEAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z, _set_se_translator
DEFINE_ALIAS ?before@type_info@@QEBAHAEBV1@@Z, type_info_before
DEFINE_ALIAS ?name@type_info@@QEBAPEBDXZ, type_info_name
DEFINE_ALIAS ?raw_name@type_info@@QEBAPEBDXZ, type_info_raw_name
DEFINE_ALIAS ??4__non_rtti_object@@QEAAAEAV0@AEBV0@@Z, __non_rtti_object_opequals
END

View File

@@ -1,61 +0,0 @@
/*
* COPYRIGHT: BSD - See COPYING.ARM in the top level directory
* PROJECT: ReactOS CRT library
* PURPOSE: MSVC wrappers for C++ functions
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <kxarm.h>
/* CODE **********************************************************************/
TEXTAREA
#undef _MSVCRT_
MACRO
START_VTABLE $ShortName, $CxxName
LCLS RttiName
LCLS VtblName
LCLS DtorName
LCLS CxxLabel
CxxLabel SETS "|$CxxName|"
RttiName SETS "|$ShortName._rtti|"
VtblName SETS "|":CC:"$ShortName._vtable|"
DtorName SETS "|":CC:"$ShortName._vector_dtor|"
EXTERN $RttiName
DCD $RttiName
EXPORT $VtblName
$VtblName
EXPORT $CxxLabel
$CxxLabel
EXTERN $DtorName
DCD $DtorName
MEND
MACRO
DEFINE_EXCEPTION_VTABLE $ShortName, $CxxName
START_VTABLE $ShortName, $CxxName
EXTERN exception_what
DCD exception_what
MEND
START_VTABLE type_info, __dummyname_type_info
DEFINE_EXCEPTION_VTABLE exception, ??_7exception@@6B@
DEFINE_EXCEPTION_VTABLE bad_typeid, ??_7bad_typeid@@6B@
DEFINE_EXCEPTION_VTABLE bad_cast, ??_7bad_cast@@6B@
DEFINE_EXCEPTION_VTABLE __non_rtti_object, ??_7__non_rtti_object@@6B@
GBLS FuncName
//EXTERN operator_delete
//__ExportName ??3@YAXPAX@Z
//b operator_delete
//EXTERN operator_new
//__ExportName ??_U@YAPAXI@Z
//b operator_new
END
/* EOF */

View File

@@ -1,69 +0,0 @@
/*
* COPYRIGHT: BSD - See COPYING.ARM in the top level directory
* PROJECT: ReactOS CRT library
* PURPOSE: MSVC wrappers for C++ functions
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <kxarm.h>
/* CODE **********************************************************************/
TEXTAREA
MACRO
DEFINE_ALIAS $FuncName, $Target
LCLS _FuncName
LCLS _Target
_FuncName SETS "|$FuncName|"
_Target SETS "|$Target|"
IMPORT $_FuncName, WEAK $_Target
MEND
DEFINE_ALIAS ??0__non_rtti_object@@QAA@ABV0@@Z, __non_rtti_object_copy_ctor
DEFINE_ALIAS ??0__non_rtti_object@@QAA@PBD@Z, __non_rtti_object_ctor
DEFINE_ALIAS ??0bad_cast@@AAA@PBQBD@Z, bad_cast_ctor // private: __cdecl bad_cast::bad_cast(char const * const *)
DEFINE_ALIAS ??0bad_cast@@QAA@ABV0@@Z, bad_cast_copy_ctor // public: __cdecl bad_cast::bad_cast(class bad_cast const &)
DEFINE_ALIAS ??0bad_cast@@QAA@PBD@Z, bad_cast_ctor // public: __cdecl bad_cast::bad_cast(char const *)
DEFINE_ALIAS ??0bad_typeid@@QAA@ABV0@@Z, bad_typeid_copy_ctor // public: __cdecl bad_typeid::bad_typeid(class bad_typeid const &)
DEFINE_ALIAS ??0bad_typeid@@QAA@PBD@Z, bad_typeid_ctor // public: __cdecl bad_typeid::bad_typeid(char const *)
DEFINE_ALIAS ??0exception@@QAA@ABQBD@Z, exception_ctor // public: __cdecl exception::exception(char const * const &)
DEFINE_ALIAS ??0exception@@QAA@ABQBDH@Z, exception_ctor_noalloc // public: __cdecl exception::exception(char const * const &,int)
DEFINE_ALIAS ??0exception@@QAA@ABV0@@Z, exception_copy_ctor // public: __cdecl exception::exception(class exception const &)
DEFINE_ALIAS ??0exception@@QAA@XZ, exception_default_ctor // public: __cdecl exception::exception(void)
DEFINE_ALIAS ??1__non_rtti_object@@UAA@XZ, __non_rtti_object_dtor // public: virtual __cdecl __non_rtti_object::~__non_rtti_object(void)
DEFINE_ALIAS ??1bad_cast@@UAA@XZ, bad_cast_dtor // public: virtual __cdecl bad_cast::~bad_cast(void)
DEFINE_ALIAS ??1bad_typeid@@UAA@XZ, bad_typeid_dtor // public: virtual __cdecl bad_typeid::~bad_typeid(void)
DEFINE_ALIAS ??1exception@@UAA@XZ, exception_dtor // public: virtual __cdecl exception::~exception(void)
DEFINE_ALIAS ??1type_info@@UAA@XZ, type_info_dtor // public: virtual __cdecl type_info::~type_info(void)
DEFINE_ALIAS ??2@YAPAXI@Z, operator_new // void * __cdecl operator new(unsigned int)
DEFINE_ALIAS ??2@YAPAXIHPBDH@Z, operator_new_dbg // void * __cdecl operator new(unsigned int,int,char const *,int)
DEFINE_ALIAS ??3@YAXPAX@Z, operator_delete // void __cdecl operator delete(void *)
DEFINE_ALIAS ??4__non_rtti_object@@QAAAAV0@ABV0@@Z, __non_rtti_object_opequals // public: class __non_rtti_object & __cdecl __non_rtti_object::operator=(class __non_rtti_object const &)
DEFINE_ALIAS ??4bad_cast@@QAAAAV0@ABV0@@Z, bad_cast_opequals // public: class bad_cast & __cdecl bad_cast::operator=(class bad_cast const &)
DEFINE_ALIAS ??4bad_typeid@@QAAAAV0@ABV0@@Z, bad_typeid_opequals // public: class bad_typeid & __cdecl bad_typeid::operator=(class bad_typeid const &)
DEFINE_ALIAS ??4exception@@QAAAAV0@ABV0@@Z, exception_opequals // public: class exception & __cdecl exception::operator=(class exception const &)
DEFINE_ALIAS ??8type_info@@QBAHABV0@@Z, type_info_opequals_equals // public: int __cdecl type_info::operator==(class type_info const &)const
DEFINE_ALIAS ??9type_info@@QBAHABV0@@Z, type_info_opnot_equals // public: int __cdecl type_info::operator!=(class type_info const &)const
DEFINE_ALIAS ??_Fbad_cast@@QAAXXZ, bad_cast_default_ctor // public: void __cdecl bad_cast::`default constructor closure'(void)
DEFINE_ALIAS ??_Fbad_typeid@@QAAXXZ, bad_typeid_default_ctor // public: void __cdecl bad_typeid::`default constructor closure'(void)
DEFINE_ALIAS ??_U@YAPAXI@Z, operator_new // void * __cdecl operator new[](unsigned int)
DEFINE_ALIAS ??_U@YAPAXIHPBDH@Z, operator_new_dbg // void * __cdecl operator new[](unsigned int,int,char const *,int)
DEFINE_ALIAS ??_V@YAXPAX@Z, operator_delete // void __cdecl operator delete[](void *)
DEFINE_ALIAS ?_query_new_handler@@YAP6AHI@ZXZ, _query_new_handler // int (__cdecl*__cdecl _query_new_handler(void))(unsigned int)
DEFINE_ALIAS ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z, _set_new_handler // int (__cdecl*__cdecl _set_new_handler(int (__cdecl*)(unsigned int)))(unsigned int)
DEFINE_ALIAS ?_set_new_mode@@YAHH@Z, _set_new_mode // int __cdecl _set_new_mode(int)
DEFINE_ALIAS ?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z, _set_se_translator // void (__cdecl*__cdecl _set_se_translator(void (__cdecl*)(unsigned int,struct _EXCEPTION_POINTERS *)))(unsigned int,struct _EXCEPTION_POINTERS *)
DEFINE_ALIAS ?before@type_info@@QBAHABV1@@Z, type_info_before // public: int __cdecl type_info::before(class type_info const &)const
DEFINE_ALIAS ?name@type_info@@QBAPBDXZ, type_info_name // public: char const * __cdecl type_info::name(void)const
DEFINE_ALIAS ?raw_name@type_info@@QBAPBDXZ, type_info_raw_name // public: char const * __cdecl type_info::raw_name(void)const
DEFINE_ALIAS ?set_terminate@@YAP6AXXZP6AXXZ@Z, set_terminate // void (__cdecl*__cdecl set_terminate(void (__cdecl*)(void)))(void)
DEFINE_ALIAS ?set_unexpected@@YAP6AXXZP6AXXZ@Z, set_unexpected // void (__cdecl*__cdecl set_unexpected(void (__cdecl*)(void)))(void)
DEFINE_ALIAS ?terminate@@YAXXZ, terminate // void __cdecl terminate(void)
DEFINE_ALIAS ?unexpected@@YAXXZ, unexpected // void __cdecl unexpected(void)
DEFINE_ALIAS ?what@exception@@UBAPBDXZ, exception_what // public: virtual char const * __cdecl exception::what(void)const
END
/* EOF */

View File

@@ -3,19 +3,6 @@ if(ARCH STREQUAL "i386")
list(APPEND LIBCNTPR_EXCEPT_ASM_SOURCE
except/i386/chkstk_asm.s
)
list(APPEND CRT_EXCEPT_ASM_SOURCE
except/i386/__CxxFrameHandler3.s
except/i386/chkesp.s
except/i386/prolog.s
)
list(APPEND CRT_EXCEPT_SOURCE
except/i386/CxxHandleV8Frame.c
)
if(MSVC)
list(APPEND CRT_EXCEPT_ASM_SOURCE
except/i386/cpp.s
except/i386/cpp_alias.s)
endif()
elseif(ARCH STREQUAL "amd64")
list(APPEND LIBCNTPR_EXCEPT_SOURCE
except/amd64/ehandler.c
@@ -24,14 +11,6 @@ elseif(ARCH STREQUAL "amd64")
except/amd64/chkstk_ms.s
except/amd64/seh.s
)
list(APPEND CRT_EXCEPT_ASM_SOURCE
except/amd64/seh.s
)
if(MSVC)
list(APPEND CRT_EXCEPT_ASM_SOURCE
except/amd64/cpp.s
except/amd64/cpp_alias.s)
endif()
elseif(ARCH STREQUAL "arm")
list(APPEND LIBCNTPR_EXCEPT_SOURCE
except/arm/ehandler.c
@@ -45,26 +24,8 @@ elseif(ARCH STREQUAL "arm")
except/arm/_local_unwind2.s
except/arm/chkstk_asm.s
)
list(APPEND CRT_EXCEPT_ASM_SOURCE
except/arm/_abnormal_termination.s
except/arm/_except_handler2.s
except/arm/_except_handler3.s
except/arm/_global_unwind2.s
except/arm/_local_unwind2.s
except/arm/chkstk_asm.s
)
if(MSVC)
list(APPEND CRT_EXCEPT_ASM_SOURCE
except/arm/cpp.s
except/arm/cpp_alias.s)
endif()
endif()
list(APPEND CRT_EXCEPT_SOURCE
${LIBCNTPR_EXCEPT_SOURCE}
except/stack.c
)
if(ARCH STREQUAL "i386")
list(APPEND CHKSTK_ASM_SOURCE except/i386/chkstk_asm.s)
elseif(ARCH STREQUAL "amd64")

View File

@@ -13,7 +13,6 @@
#define WINE_NO_TRACE_MSGS
#include <wine/debug.h>
#include <wine/exception.h>
#include <internal/wine/msvcrt.h>
#include <internal/wine/cppexcept.h>
extern DWORD CDECL CallCxxFrameHandler(PEXCEPTION_RECORD rec, EXCEPTION_REGISTRATION_RECORD *frame,

View File

@@ -1,45 +0,0 @@
#include <precomp.h>
/*********************************************************************
* _chkesp (MSVCRT.@)
*
* Trap to a debugger if the value of the stack pointer has changed.
*
* PARAMS
* None.
*
* RETURNS
* Does not return.
*
* NOTES
* This function is available for iX86 only.
*
* When VC++ generates debug code, it stores the value of the stack pointer
* before calling any external function, and checks the value following
* the call. It then calls this function, which will trap if the values are
* not the same. Usually this means that the prototype used to call
* the function is incorrect. It can also mean that the .spec entry has
* the wrong calling convention or parameters.
*/
#ifdef __i386__
void _chkesp_failed(void)
{
ERR("stack got corrupted!\n");
__debugbreak();
}
#endif /* __i386__ */
/*********************************************************************
* _resetstkoflw (MSVCRT.@)
*/
int CDECL _resetstkoflw(void)
{
int stack_addr;
DWORD oldprot;
/* causes stack fault that updates NtCurrentTeb()->Tib.StackLimit */
return VirtualProtect(&stack_addr, 1, PAGE_GUARD|PAGE_READWRITE, &oldprot);
}

View File

@@ -5,7 +5,7 @@ list(APPEND CRT_FLOAT_SOURCE
float/_controlfp_s.c
float/copysign.c
float/fpclass.c
float/fpecode.c
#float/fpecode.c
float/scalb.c
)

View File

@@ -1,19 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/float/fpecode.c
* PURPOSE: Unknown
* PROGRAMER: Unknown
* UPDATE HISTORY:
* 25/11/05: Added license header
*/
#include <precomp.h>
/*
* @implemented
*/
int * __fpecode(void)
{
return &msvcrt_get_thread_data()->fpecode;
}

View File

@@ -1,17 +0,0 @@
#ifndef __CRT_INTERNAL_ATEXIT_H
#define __CRT_INTERNAL_ATEXIT_H
#ifndef _CRT_PRECOMP_H
#error DO NOT INCLUDE THIS HEADER DIRECTLY
#endif
#define LOCK_EXIT _mlock(_EXIT_LOCK1)
#define UNLOCK_EXIT _munlock(_EXIT_LOCK1)
extern _onexit_t *atexit_table;
extern int atexit_table_size;
extern int atexit_registered; /* Points to free slot */
void __call_atexit(void);
#endif

View File

@@ -1,16 +0,0 @@
/* console.h */
#ifndef __CRT_INTERNAL_CONSOLE_H
#define __CRT_INTERNAL_CONSOLE_H
#ifndef _CRT_PRECOMP_H
#error DO NOT INCLUDE THIS HEADER DIRECTLY
#endif
extern int char_avail;
extern int ungot_char;
#endif
/* EOF */

View File

@@ -1,60 +0,0 @@
#ifndef __CRT_INTERNAL_MBSTRING_H
#define __CRT_INTERNAL_MBSTRING_H
#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 _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)
#define MAX_LOCALE_LENGTH 256
extern unsigned char _mbctype[257];
extern char MSVCRT_current_lc_all[MAX_LOCALE_LENGTH];
#if defined (_MSC_VER)
#undef _ismbbkana
#undef _ismbbkpunct
#undef _ismbbalpha
#undef _ismbbalnum
#undef _ismbbgraph
#undef _ismbbkalnum
#undef _ismbblead
#undef _ismbbprint
#undef _ismbbpunct
#undef _ismbbtrail
#endif
#endif

View File

@@ -1,14 +0,0 @@
extern int msvcrt_error_mode;
extern int __app_type;
#define _UNKNOWN_APP 0
#define _CONSOLE_APP 1
#define _GUI_APP 2
int
__cdecl
__crt_MessageBoxA (
_In_opt_ const char *pszText,
_In_ unsigned int uType);

View File

@@ -1,72 +0,0 @@
/*
* Copyright (c) 2002, TransGaming Technologies Inc.
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __CRT_INTERNAL_WINE_MTDLL_H
#define __CRT_INTERNAL_WINE_MTDLL_H
#if defined(_MT)
#define _mlock(locknum) _lock(locknum)
#define _munlock(locknum) _unlock(locknum)
void _unlock( int locknum );
void _lock( int locknum );
#else
#define _mlock(locknum) do {} while(0)
#define _munlock(locknum) do {} while(0)
#endif
#define _SIGNAL_LOCK 1
#define _IOB_SCAN_LOCK 2
#define _TMPNAM_LOCK 3
#define _INPUT_LOCK 4
#define _OUTPUT_LOCK 5
#define _CSCANF_LOCK 6
#define _CPRINTF_LOCK 7
#define _CONIO_LOCK 8
#define _HEAP_LOCK 9
#define _BHEAP_LOCK 10 /* No longer used? */
#define _TIME_LOCK 11
#define _ENV_LOCK 12
#define _EXIT_LOCK1 13
#define _EXIT_LOCK2 14
#define _THREADDATA_LOCK 15 /* No longer used? */
#define _POPEN_LOCK 16
#define _LOCKTAB_LOCK 17
#define _OSFHND_LOCK 18
#define _SETLOCALE_LOCK 19
#define _LC_COLLATE_LOCK 20 /* No longer used? */
#define _LC_CTYPE_LOCK 21 /* No longer used? */
#define _LC_MONETARY_LOCK 22 /* No longer used? */
#define _LC_NUMERIC_LOCK 23 /* No longer used? */
#define _LC_TIME_LOCK 24 /* No longer used? */
#define _MB_CP_LOCK 25
#define _NLG_LOCK 26
#define _TYPEINFO_LOCK 27
#define _STREAM_LOCKS 28
/* Must match definition in msvcrt/stdio.h */
#define _IOB_ENTRIES 20
#define _LAST_STREAM_LOCK (_STREAM_LOCKS+_IOB_ENTRIES-1)
#define _TOTAL_LOCKS (_LAST_STREAM_LOCK+1)
#endif /* WINE_MTDLL_H */

View File

@@ -1,15 +0,0 @@
#ifndef __CRT_INTERNAL_POPEN_H
#define __CRT_INTERNAL_POPEN_H
#ifndef _CRT_PRECOMP_H
#error DO NOT INCLUDE THIS HEADER DIRECTLY
#endif
struct popen_handle {
FILE *f;
HANDLE proc;
};
extern struct popen_handle *popen_handles;
extern DWORD popen_handles_size;
#endif

View File

@@ -1,33 +0,0 @@
/* rterror.h */
#ifndef __CRT_INTERNAL_RTERROR_H
#define __CRT_INTERNAL_RTERROR_H
#define _RT_STACK 0 /* stack overflow */
#define _RT_NULLPTR 1 /* null pointer assignment */
#define _RT_FLOAT 2 /* floating point not loaded */
#define _RT_INTDIV 3 /* integer divide by 0 */
#define _RT_SPACEARG 4 /* not enough space for arguments */
#define _RT_SPACEENV 5 /* not enough space for environment */
#define _RT_ABORT 6 /* abnormal program termination */
#define _RT_THREAD 7 /* not enough space for thread data */
#define _RT_LOCK 8 /* unexpected multi-thread lock error */
#define _RT_HEAP 9 /* unexpected heap error */
#define _RT_OPENCON 10 /* unable to open console device */
#define _RT_NONCONT 11 /* non-continuable exception */
#define _RT_INVALDISP 12 /* invalid disposition of exception */
#define _RT_ONEXIT 13 /* insufficient heap to allocate
* initial table of function pointers
* used by _onexit()/atexit(). */
#define _RT_PUREVIRT 14 /* pure virtual function call attempted
* (C++ error) */
#define _RT_STDIOINIT 15 /* not enough space for stdio initialization */
#define _RT_LOWIOINIT 16 /* not enough space for lowio initialization */
__declspec(noreturn) void _amsg_exit (int errnum);
/* not in any other header */
void _dosmaperr(unsigned long oserrcode);
#endif /* __MSVCRT_INTERNAL_RTERROR_H */

View File

@@ -1,55 +0,0 @@
#define DIFFTIME 0x19db1ded53e8000ULL
#define DIFFDAYS (3 * DAYSPER100YEARS + 17 * DAYSPER4YEARS + 1 * DAYSPERYEAR)
#define DAYSPERYEAR 365
#define DAYSPER4YEARS (4*DAYSPERYEAR+1)
#define DAYSPER100YEARS (25*DAYSPER4YEARS-1)
#define DAYSPER400YEARS (4*DAYSPER100YEARS+1)
#define SECONDSPERDAY (24*60*60)
#define SECONDSPERHOUR (60*60)
#define LEAPDAY 59
static __inline
__time64_t
FileTimeToUnixTime(const FILETIME *FileTime, USHORT *millitm)
{
ULARGE_INTEGER ULargeInt;
__time64_t time;
ULargeInt.LowPart = FileTime->dwLowDateTime;
ULargeInt.HighPart = FileTime->dwHighDateTime;
ULargeInt.QuadPart -= DIFFTIME;
time = ULargeInt.QuadPart / 10000000;
if (millitm)
*millitm = (USHORT)((ULargeInt.QuadPart % 10000000) / 10000);
return time;
}
static __inline
long leapyears_passed(long days)
{
long quadcenturies, centuries, quadyears;
quadcenturies = days / DAYSPER400YEARS;
days -= quadcenturies;
centuries = days / DAYSPER100YEARS;
days += centuries;
quadyears = days / DAYSPER4YEARS;
return quadyears - centuries + quadcenturies;
}
static __inline
long leapdays_passed(long days)
{
return leapyears_passed(days + DAYSPERYEAR - LEAPDAY + 1);
}
static __inline
long years_passed(long days)
{
return (days - leapdays_passed(days)) / 365;
}
extern long dst_begin;
extern long dst_end;

View File

@@ -1,70 +0,0 @@
/* tls.h */
#ifndef __CRT_INTERNAL_TLS_H
#define __CRT_INTERNAL_TLS_H
#ifndef _CRT_PRECOMP_H
#error DO NOT INCLUDE THIS HEADER DIRECTLY
#endif
#include <stddef.h>
#include <time.h>
#include <locale.h>
#include <windef.h>
#include <winbase.h>
#include <winnt.h>
#include <internal/wine/eh.h>
/* TLS data */
extern DWORD tls_index;
struct __thread_data {
DWORD tid;
HANDLE handle;
int thread_errno;
unsigned long thread_doserrno;
int unk1;
unsigned int random_seed; /* seed for rand() */
char *strtok_next; /* next ptr for strtok() */
wchar_t *wcstok_next; /* next ptr for wcstok() */
unsigned char *mbstok_next; /* next ptr for mbstok() */
char *strerror_buffer; /* buffer for strerror */
wchar_t *wcserror_buffer; /* buffer for wcserror */
char *tmpnam_buffer; /* buffer for tmpname() */
wchar_t *wtmpnam_buffer; /* buffer for wtmpname() */
void *unk2[2];
char *asctime_buffer; /* buffer for asctime */
wchar_t *wasctime_buffer; /* buffer for wasctime */
struct tm *time_buffer; /* buffer for localtime/gmtime */
char *efcvt_buffer; /* buffer for ecvt/fcvt */
int unk3[2];
void *unk4[3];
EXCEPTION_POINTERS *xcptinfo;
int fpecode;
struct MSVCRT_threadmbcinfostruct *mbcinfo;
struct MSVCRT_threadlocaleinfostruct *locinfo;
BOOL have_locale;
int unk5[1];
terminate_function terminate_handler;
unexpected_function unexpected_handler;
_se_translator_function se_translator;
void *unk6[3];
int unk7;
EXCEPTION_RECORD *exc_record;
void *unk8[100];
};
typedef struct __thread_data thread_data_t;
extern BOOL msvcrt_init_tls(void);
extern BOOL msvcrt_free_tls(void);
extern thread_data_t *msvcrt_get_thread_data(void);
extern void msvcrt_free_tls_mem(void);
#define MSVCRT_ENABLE_PER_THREAD_LOCALE 1
#define MSVCRT_DISABLE_PER_THREAD_LOCALE 2
#endif /* __MSVCRT_INTERNAL_TLS_H */
/* EOF */

View File

@@ -1,53 +0,0 @@
/*
* C++ exception handling facility
*
* Copyright 2000 Francois Gouget.
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __WINE_EH_H
#define __WINE_EH_H
#ifndef __WINE_USE_MSVCRT
#define __WINE_USE_MSVCRT
#endif
#if !defined(__cplusplus) && !defined(USE_MSVCRT_PREFIX)
#error "eh.h is meant only for C++ applications"
#endif
#ifndef MSVCRT
# ifdef USE_MSVCRT_PREFIX
# define MSVCRT(x) MSVCRT_##x
# else
# define MSVCRT(x) x
# endif
#endif
struct _EXCEPTION_POINTERS;
typedef void (*terminate_handler)();
typedef void (*terminate_function)();
typedef void (*unexpected_handler)();
typedef void (*unexpected_function)();
typedef void (*_se_translator_function)(unsigned int code, struct _EXCEPTION_POINTERS *info);
terminate_function MSVCRT(set_terminate)(terminate_function func);
unexpected_function MSVCRT(set_unexpected)(unexpected_function func);
_se_translator_function MSVCRT(_set_se_translator)(_se_translator_function func);
void MSVCRT(terminate)();
void MSVCRT(unexpected)();
#endif /* __WINE_EH_H */

View File

@@ -1,165 +0,0 @@
/*
* Copyright 2001 Jon Griffiths
* Copyright 2004 Dimitrie O. Paun
*
* 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
*
* NOTES
* Naming conventions
* - Symbols are prefixed with MSVCRT_ if they conflict
* with libc symbols
* - Internal symbols are usually prefixed by msvcrt_.
* - Exported symbols that are not present in the public
* headers are usually kept the same as the original.
* Other conventions
* - To avoid conflicts with the standard C library,
* no msvcrt headers are included in the implementation.
* - Instead, symbols are duplicated here, prefixed with
* MSVCRT_, as explained above.
* - To avoid inconsistencies, a test for each symbol is
* added into tests/headers.c. Please always add a
* corresponding test when you add a new symbol!
*/
#ifndef __WINE_MSVCRT_H
#define __WINE_MSVCRT_H
#include <stdarg.h>
#include <signal.h>
#include "windef.h"
#include "winbase.h"
extern unsigned int __lc_codepage;
extern int __lc_collate_cp;
extern int __mb_cur_max;
extern const unsigned short _ctype [257];
void __cdecl _purecall(void);
__declspec(noreturn) void __cdecl _amsg_exit(int errnum);
extern char **_environ;
extern wchar_t **_wenviron;
extern char ** SnapshotOfEnvironmentA(char **);
extern wchar_t ** SnapshotOfEnvironmentW(wchar_t **);
/* Application type flags */
#define _UNKNOWN_APP 0
#define _CONSOLE_APP 1
#define _GUI_APP 2
/* I/O Streamming flags missing from stdio.h */
#define _IOYOURBUF 0x0100
#define _IOAPPEND 0x0200
#define _IOSETVBUF 0x0400
#define _IOFEOF 0x0800
#define _IOFLRTN 0x1000
#define _IOCTRLZ 0x2000
#define _IOCOMMIT 0x4000
#define _IOFREE 0x10000
//wchar_t *wstrdupa(const char *);
//
///* FIXME: This should be declared in new.h but it's not an extern "C" so
// * it would not be much use anyway. Even for Winelib applications.
// */
//int __cdecl _set_new_mode(int mode);
//
void* __cdecl MSVCRT_operator_new(size_t);
void __cdecl MSVCRT_operator_delete(void*);
typedef void* (__cdecl *malloc_func_t)(size_t);
typedef void (__cdecl *free_func_t)(void*);
/* Setup and teardown multi threaded locks */
extern void msvcrt_init_mt_locks(void);
extern void msvcrt_free_mt_locks(void);
extern BOOL msvcrt_init_locale(void);
extern void msvcrt_init_math(void);
extern void msvcrt_init_io(void);
extern void msvcrt_free_io(void);
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);
extern void msvcrt_free_popen_data(void);
extern unsigned create_io_inherit_block(WORD*, BYTE**);
/* _set_abort_behavior codes */
#define MSVCRT__WRITE_ABORT_MSG 1
#define MSVCRT__CALL_REPORTFAULT 2
#define MSVCRT_LC_ALL LC_ALL
#define MSVCRT_LC_COLLATE LC_COLLATE
#define MSVCRT_LC_CTYPE LC_CTYPE
#define MSVCRT_LC_MONETARY LC_MONETARY
#define MSVCRT_LC_NUMERIC LC_NUMERIC
#define MSVCRT_LC_TIME LC_TIME
#define MSVCRT_LC_MIN LC_MIN
#define MSVCRT_LC_MAX LC_MAX
#define MSVCRT__OUT_TO_DEFAULT 0
#define MSVCRT__OUT_TO_STDERR 1
#define MSVCRT__OUT_TO_MSGBOX 2
#define MSVCRT__REPORT_ERRMODE 3
extern char* __cdecl __unDName(char *,const char*,int,malloc_func_t,free_func_t,unsigned short int);
/* __unDName/__unDNameEx flags */
#define UNDNAME_COMPLETE (0x0000)
#define UNDNAME_NO_LEADING_UNDERSCORES (0x0001) /* Don't show __ in calling convention */
#define UNDNAME_NO_MS_KEYWORDS (0x0002) /* Don't show calling convention at all */
#define UNDNAME_NO_FUNCTION_RETURNS (0x0004) /* Don't show function/method return value */
#define UNDNAME_NO_ALLOCATION_MODEL (0x0008)
#define UNDNAME_NO_ALLOCATION_LANGUAGE (0x0010)
#define UNDNAME_NO_MS_THISTYPE (0x0020)
#define UNDNAME_NO_CV_THISTYPE (0x0040)
#define UNDNAME_NO_THISTYPE (0x0060)
#define UNDNAME_NO_ACCESS_SPECIFIERS (0x0080) /* Don't show access specifier (public/protected/private) */
#define UNDNAME_NO_THROW_SIGNATURES (0x0100)
#define UNDNAME_NO_MEMBER_TYPE (0x0200) /* Don't show static/virtual specifier */
#define UNDNAME_NO_RETURN_UDT_MODEL (0x0400)
#define UNDNAME_32_BIT_DECODE (0x0800)
#define UNDNAME_NAME_ONLY (0x1000) /* Only report the variable/method name */
#define UNDNAME_NO_ARGUMENTS (0x2000) /* Don't show method arguments */
#define UNDNAME_NO_SPECIAL_SYMS (0x4000)
#define UNDNAME_NO_COMPLEX_TYPE (0x8000)
typedef void (*float_handler)(int, int);
void _default_handler(int signal);
typedef struct _sig_element
{
int signal;
char *signame;
__p_sig_fn_t handler;
}sig_element;
#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);
/* ioinfo structure size is different in msvcrXX.dll's */
typedef struct {
HANDLE handle;
unsigned char wxflag;
char lookahead[3];
int exflag;
CRITICAL_SECTION crit;
} ioinfo;
#endif /* __WINE_MSVCRT_H */

View File

@@ -1,100 +0,0 @@
exception * __thiscall MSVCRT_exception_ctor(exception * _this, const char ** name);
exception * __thiscall exception_ctor_noalloc(exception * _this, char ** name, int noalloc);
exception * __thiscall exception_copy_ctor(exception * _this, const exception * rhs);
exception * __thiscall exception_default_ctor(exception * _this);
void __thiscall exception_dtor(exception * _this);
exception * __thiscall exception_opequals(exception * _this, const exception * rhs);
void * __thiscall exception_vector_dtor(exception * _this, unsigned int flags);
void * __thiscall exception_scalar_dtor(exception * _this, unsigned int flags);
const char * __thiscall exception_what(exception * _this);
bad_typeid * __thiscall bad_typeid_copy_ctor(bad_typeid * _this, const bad_typeid * rhs);
bad_typeid * __thiscall bad_typeid_ctor(bad_typeid * _this, const char * name);
bad_typeid * __thiscall bad_typeid_default_ctor(bad_typeid * _this);
void __thiscall bad_typeid_dtor(bad_typeid * _this);
bad_typeid * __thiscall bad_typeid_opequals(bad_typeid * _this, const bad_typeid * rhs);
void * __thiscall bad_typeid_vector_dtor(bad_typeid * _this, unsigned int flags);
void * __thiscall bad_typeid_scalar_dtor(bad_typeid * _this, unsigned int flags);
__non_rtti_object * __thiscall __non_rtti_object_copy_ctor(__non_rtti_object * _this, const __non_rtti_object * rhs);
__non_rtti_object * __thiscall __non_rtti_object_ctor(__non_rtti_object * _this, const char * name);
void __thiscall __non_rtti_object_dtor(__non_rtti_object * _this);
__non_rtti_object * __thiscall __non_rtti_object_opequals(__non_rtti_object * _this, const __non_rtti_object *rhs);
void * __thiscall __non_rtti_object_vector_dtor(__non_rtti_object * _this, unsigned int flags);
void * __thiscall __non_rtti_object_scalar_dtor(__non_rtti_object * _this, unsigned int flags);
bad_cast * __thiscall bad_cast_ctor(bad_cast * _this, const char ** name);
bad_cast * __thiscall bad_cast_copy_ctor(bad_cast * _this, const bad_cast * rhs);
bad_cast * __thiscall bad_cast_ctor_charptr(bad_cast * _this, const char * name);
bad_cast * __thiscall bad_cast_default_ctor(bad_cast * _this);
void __thiscall bad_cast_dtor(bad_cast * _this);
bad_cast * __thiscall bad_cast_opequals(bad_cast * _this, const bad_cast * rhs);
void * __thiscall bad_cast_vector_dtor(bad_cast * _this, unsigned int flags);
void * __thiscall bad_cast_scalar_dtor(bad_cast * _this, unsigned int flags);
int __thiscall type_info_opequals_equals(type_info * _this, const type_info * rhs);
int __thiscall type_info_opnot_equals(type_info * _this, const type_info * rhs);
int __thiscall type_info_before(type_info * _this, const type_info * rhs);
void __thiscall type_info_dtor(type_info * _this);
const char * __thiscall type_info_name(type_info * _this);
const char * __thiscall type_info_raw_name(type_info * _this);
void * __thiscall type_info_vector_dtor(type_info * _this, unsigned int flags);
#if _MSVCR_VER >= 80
bad_alloc* __thiscall MSVCRT_bad_alloc_copy_ctor(bad_alloc* _this, const bad_alloc* rhs);
bad_alloc* __thiscall MSVCRT_bad_alloc_copy_ctor(bad_alloc* _this, const bad_alloc* rhs);
void __thiscall MSVCRT_bad_alloc_dtor(bad_alloc* _this);
#endif /* _MSVCR_VER >= 80 */
#if _MSVCR_VER >= 100
scheduler_resource_allocation_error* __thiscall scheduler_resource_allocation_error_ctor_name(
scheduler_resource_allocation_error* this, const char* name, HRESULT hr);
scheduler_resource_allocation_error* __thiscall scheduler_resource_allocation_error_ctor(
scheduler_resource_allocation_error* this, HRESULT hr);
scheduler_resource_allocation_error* __thiscall MSVCRT_scheduler_resource_allocation_error_copy_ctor(
scheduler_resource_allocation_error* this,
const scheduler_resource_allocation_error* rhs);
HRESULT __thiscall scheduler_resource_allocation_error_get_error_code(
const scheduler_resource_allocation_error* this);
void __thiscall MSVCRT_scheduler_resource_allocation_error_dtor(
scheduler_resource_allocation_error* this);
improper_lock* __thiscall improper_lock_ctor_str(improper_lock* this, const char* str);
improper_lock* __thiscall improper_lock_ctor(improper_lock* this);
improper_lock* __thiscall MSVCRT_improper_lock_copy_ctor(improper_lock* _this, const improper_lock* rhs);
void __thiscall MSVCRT_improper_lock_dtor(improper_lock* _this);
invalid_scheduler_policy_key* __thiscall invalid_scheduler_policy_key_ctor_str(
invalid_scheduler_policy_key* this, const char* str);
invalid_scheduler_policy_key* __thiscall invalid_scheduler_policy_key_ctor(
invalid_scheduler_policy_key* this);
invalid_scheduler_policy_key* __thiscall MSVCRT_invalid_scheduler_policy_key_copy_ctor(
invalid_scheduler_policy_key* _this, const invalid_scheduler_policy_key* rhs);
void __thiscall MSVCRT_invalid_scheduler_policy_key_dtor(
invalid_scheduler_policy_key* _this);
invalid_scheduler_policy_value* __thiscall invalid_scheduler_policy_value_ctor_str(
invalid_scheduler_policy_value* this, const char* str);
invalid_scheduler_policy_value* __thiscall invalid_scheduler_policy_value_ctor(
invalid_scheduler_policy_value* this);
invalid_scheduler_policy_value* __thiscall MSVCRT_invalid_scheduler_policy_value_copy_ctor(
invalid_scheduler_policy_value* _this, const invalid_scheduler_policy_value* rhs);
void __thiscall MSVCRT_invalid_scheduler_policy_value_dtor(
invalid_scheduler_policy_value* _this);
invalid_scheduler_policy_thread_specification* __thiscall invalid_scheduler_policy_thread_specification_ctor_str(
invalid_scheduler_policy_thread_specification* this, const char* str);
invalid_scheduler_policy_thread_specification* __thiscall invalid_scheduler_policy_thread_specification_ctor(
invalid_scheduler_policy_thread_specification* this);
invalid_scheduler_policy_thread_specification* __thiscall MSVCRT_invalid_scheduler_policy_thread_specification_copy_ctor(
invalid_scheduler_policy_thread_specification* _this, const invalid_scheduler_policy_thread_specification* rhs);
void __thiscall MSVCRT_invalid_scheduler_policy_thread_specification_dtor(
invalid_scheduler_policy_thread_specification* _this);
improper_scheduler_attach* __thiscall improper_scheduler_attach_ctor_str(
improper_scheduler_attach* this, const char* str);
improper_scheduler_attach* __thiscall improper_scheduler_attach_ctor(
improper_scheduler_attach* this);
improper_scheduler_attach* __thiscall MSVCRT_improper_scheduler_attach_copy_ctor(
improper_scheduler_attach* _this, const improper_scheduler_attach* rhs);
void __thiscall MSVCRT_improper_scheduler_attach_dtor(
improper_scheduler_attach* _this);
improper_scheduler_detach* __thiscall improper_scheduler_detach_ctor_str(
improper_scheduler_detach* this, const char* str);
improper_scheduler_detach* __thiscall improper_scheduler_detach_ctor(
improper_scheduler_detach* this);
improper_scheduler_detach* __thiscall MSVCRT_improper_scheduler_detach_copy_ctor(
improper_scheduler_detach* _this, const improper_scheduler_detach* rhs);
void __thiscall MSVCRT_improper_scheduler_detach_dtor(
improper_scheduler_detach* _this);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,222 +0,0 @@
/*
* msvcrt.dll mbcs functions
*
* Copyright 1999 Alexandre Julliard
* Copyright 2000 Jon Griffths
*
* 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
*
* FIXME
* Not currently binary compatible with win32. MSVCRT_mbctype must be
* populated correctly and the ismb* functions should reference it.
*/
#include <precomp.h>
#include <mbctype.h>
/* 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}},
{1361, {0x31, 0x7e, 0x81, 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 */
};
/*********************************************************************
* INTERNAL: _setmbcp_l
*/
int _setmbcp_l(int cp, LCID lcid, MSVCRT_pthreadmbcinfo mbcinfo)
{
const char format[] = ".%d";
int newcp;
CPINFO cpi;
BYTE *bytes;
WORD chartypes[256];
char bufA[256];
WCHAR bufW[256];
int charcount;
int ret;
int i;
if(!mbcinfo)
mbcinfo = get_mbcinfo();
switch (cp)
{
case _MB_CP_ANSI:
newcp = GetACP();
break;
case _MB_CP_OEM:
newcp = GetOEMCP();
break;
case _MB_CP_LOCALE:
newcp = get_locinfo()->lc_codepage;
if(newcp)
break;
/* fall through (C locale) */
case _MB_CP_SBCS:
newcp = 20127; /* ASCII */
break;
default:
newcp = cp;
break;
}
if(lcid == -1) {
sprintf(bufA, format, newcp);
mbcinfo->mblcid = MSVCRT_locale_to_LCID(bufA, NULL);
} else {
mbcinfo->mblcid = lcid;
}
if(mbcinfo->mblcid == -1)
{
WARN("Can't assign LCID to codepage (%d)\n", mbcinfo->mblcid);
mbcinfo->mblcid = 0;
}
if (!GetCPInfo(newcp, &cpi))
{
WARN("Codepage %d not found\n", newcp);
*_errno() = EINVAL;
return -1;
}
/* setup the _mbctype */
memset(mbcinfo->mbctype, 0, sizeof(unsigned char[257]));
memset(mbcinfo->mbcasemap, 0, sizeof(unsigned char[256]));
bytes = cpi.LeadByte;
while (bytes[0] || bytes[1])
{
for (i = bytes[0]; i <= bytes[1]; i++)
mbcinfo->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;
mbcinfo->ismbcodepage = 1;
while (TRUE)
{
if (cpextra->cp == 0 || cpextra->cp == newcp)
{
if (cpextra->cp == 0)
FIXME("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++)
mbcinfo->mbctype[i + 1] |= _M2;
bytes += 2;
}
break;
}
cpextra++;
}
}
else
mbcinfo->ismbcodepage = 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 (!(mbcinfo->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);
charcount = 0;
for (i = 0; i < 256; i++)
if (!(mbcinfo->mbctype[i + 1] & _M1))
{
if (chartypes[charcount] & C1_UPPER)
{
mbcinfo->mbctype[i + 1] |= _SBUP;
bufW[charcount] = tolowerW(bufW[charcount]);
}
else if (chartypes[charcount] & C1_LOWER)
{
mbcinfo->mbctype[i + 1] |= _SBLOW;
bufW[charcount] = toupperW(bufW[charcount]);
}
charcount++;
}
ret = WideCharToMultiByte(newcp, 0, bufW, charcount, bufA, charcount, NULL, NULL);
if (ret != charcount)
ERR("WideCharToMultiByte failed for cp %d, ret=%d (exp %d), error=%d\n", newcp, ret, charcount, GetLastError());
charcount = 0;
for (i = 0; i < 256; i++)
{
if(!(mbcinfo->mbctype[i + 1] & _M1))
{
if(mbcinfo->mbctype[i] & (C1_UPPER|C1_LOWER))
mbcinfo->mbcasemap[i] = bufA[charcount];
charcount++;
}
}
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++)
mbcinfo->mbctype[i + 1] |= _MP;
for (i = 166; i <= 223; i++)
mbcinfo->mbctype[i + 1] |= _MS;
}
mbcinfo->mbcodepage = newcp;
if(global_locale && mbcinfo == MSVCRT_locale->mbcinfo)
memcpy(_mbctype, MSVCRT_locale->mbcinfo->mbctype, sizeof(_mbctype));
return 0;
}
/*********************************************************************
* _setmbcp (MSVCRT.@)
*/
int CDECL _setmbcp(int cp)
{
return _setmbcp_l(cp, -1, NULL);
}

View File

@@ -1,99 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/hanzen.c
* PURPOSE: Multibyte conversion routines formerly called hantozen and zentohan
* PROGRAMER: Ariadne, Taiji Yamada
* UPDATE HISTORY:
Modified from Taiji Yamada japanese code system utilities
* 12/04/99: Created
*/
#include <precomp.h>
#include <mbstring.h>
#include <locale.h>
/* Maps cp932 single byte character to multi byte character */
static const unsigned char mbbtombc_932[] = {
0x40,0x49,0x68,0x94,0x90,0x93,0x95,0x66,0x69,0x6a,0x96,0x7b,0x43,0x7c,0x44,0x5e,
0x4f,0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x46,0x47,0x83,0x81,0x84,0x48,
0x97,0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,
0x6f,0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x6d,0x8f,0x6e,0x4f,0x76,
0x77,0x78,0x79,0x6d,0x8f,0x6e,0x4f,0x51,0x65,0x81,0x82,0x83,0x84,0x85,0x86,0x87,
0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,0x95,0x50,
0x42,0x75,0x76,0x41,0x45,0x92,0x40,0x42,0x44,0x46,0x48,0x83,0x85,0x87,0x62,
0x5b,0x41,0x43,0x45,0x47,0x49,0x4a,0x4c,0x4e,0x50,0x52,0x54,0x56,0x58,0x5a,0x5c,
0x5e,0x60,0x63,0x65,0x67,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x71,0x74,0x77,0x7a,0x7d,
0x7e,0x80,0x81,0x82,0x84,0x86,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8f,0x93,0x4a,0x4b };
/* Maps multibyte cp932 punctuation marks to single byte equivalents */
static const unsigned char mbctombb_932_punct[] = {
0x20,0xa4,0xa1,0x2c,0x2e,0xa5,0x3a,0x3b,0x3f,0x21,0xde,0xdf,0x00,0x00,0x00,0x5e,
0x7e,0x5f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x00,0x00,0x2f,0x00,
0x00,0x00,0x7c,0x00,0x00,0x60,0x27,0x00,0x22,0x28,0x29,0x00,0x00,0x5b,0x5d,0x7b,
0x7d,0x00,0x00,0x00,0x00,0xa2,0xa3,0x00,0x00,0x00,0x00,0x2b,0x2d,0x00,0x00,0x00,
0x00,0x3d,0x00,0x3c,0x3e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5c,
0x24,0x00,0x00,0x25,0x23,0x26,0x2a,0x40};
/* Maps multibyte cp932 hiragana/katakana to single-byte equivalents */
static const unsigned char mbctombb_932_kana[] = {
0xa7,0xb1,0xa8,0xb2,0xa9,0xb3,0xaa,0xb4,0xab,0xb5,0xb6,0xb6,0xb7,0xb7,0xb8,0xb8,
0xb9,0xb9,0xba,0xba,0xbb,0xbb,0xbc,0xbc,0xbd,0xbd,0xbe,0xbe,0xbf,0xbf,0xc0,0xc0,
0xc1,0xc1,0xaf,0xc2,0xc2,0xc3,0xc3,0xc4,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xca,
0xca,0xcb,0xcb,0xcb,0xcc,0xcc,0xcc,0xcd,0xcd,0xcd,0xce,0xce,0xce,0xcf,0xd0,0xd1,
0xd2,0xd3,0xac,0xd4,0xad,0xd5,0xae,0xd6,0xd7,0xd8,0xd9,0xda,0xdb,0xdc,0xdc,0xb2,
0xb4,0xa6,0xdd,0xb3,0xb6,0xb9};
/*********************************************************************
* _mbbtombc(MSVCRT.@)
*/
unsigned int __cdecl _mbbtombc(unsigned int c)
{
if(get_mbcinfo()->mbcodepage == 932)
{
if(c >= 0x20 && c <= 0x7e) {
if((c >= 0x41 && c <= 0x5a) || (c >= 0x61 && c <= 0x7a) || (c >= 0x30 && c <= 0x39))
return mbbtombc_932[c - 0x20] | 0x8200;
else
return mbbtombc_932[c - 0x20] | 0x8100;
}
else if(c >= 0xa1 && c <= 0xdf) {
if(c >= 0xa6 && c <= 0xdd && c != 0xb0)
return mbbtombc_932[c - 0xa1 + 0x5f] | 0x8300;
else
return mbbtombc_932[c - 0xa1 + 0x5f] | 0x8100;
}
}
return c; /* not Japanese or no MB char */
}
/*********************************************************************
* _mbctombb (MSVCRT.@)
*/
unsigned int CDECL _mbctombb(unsigned int c)
{
unsigned int value;
if(get_mbcinfo()->mbcodepage == 932)
{
if(c >= 0x829f && c <= 0x82f1) /* Hiragana */
return mbctombb_932_kana[c - 0x829f];
if(c >= 0x8340 && c <= 0x8396 && c != 0x837f) /* Katakana */
return mbctombb_932_kana[c - 0x8340 - (c >= 0x837f ? 1 : 0)];
if(c >= 0x8140 && c <= 0x8197) /* Punctuation */
{
value = mbctombb_932_punct[c - 0x8140];
return value ? value : c;
}
if((c >= 0x824f && c <= 0x8258) || /* Fullwidth digits */
(c >= 0x8260 && c <= 0x8279)) /* Fullwidth capitals letters */
return c - 0x821f;
if(c >= 0x8281 && c <= 0x829a) /* Fullwidth small letters */
return c - 0x8220;
/* all other cases return c */
}
return c;
}

View File

@@ -1,54 +0,0 @@
#include <precomp.h>
#include <mbctype.h>
/*********************************************************************
* _ismbchira(MSVCRT.@)
*/
int CDECL _ismbchira(unsigned int c)
{
if(get_mbcinfo()->mbcodepage == 932)
{
/* Japanese/Hiragana, CP 932 */
return (c >= 0x829f && c <= 0x82f1);
}
return 0;
}
/*********************************************************************
* _ismbckata(MSVCRT.@)
*/
int CDECL _ismbckata(unsigned int c)
{
if(get_mbcinfo()->mbcodepage == 932)
{
/* Japanese/Katakana, CP 932 */
return (c >= 0x8340 && c <= 0x8396 && c != 0x837f);
}
return 0;
}
/*********************************************************************
* _mbctohira (MSVCRT.@)
*
* Converts a sjis katakana character to hiragana.
*/
unsigned int CDECL _mbctohira(unsigned int c)
{
if(_ismbckata(c) && c <= 0x8393)
return (c - 0x8340 - (c >= 0x837f ? 1 : 0)) + 0x829f;
return c;
}
/*********************************************************************
* _mbctokata (MSVCRT.@)
*
* Converts a sjis hiragana character to katakana.
*/
unsigned int CDECL _mbctokata(unsigned int c)
{
if(_ismbchira(c))
return (c - 0x829f) + 0x8340 + (c >= 0x82de ? 1 : 0);
return c;
}

View File

@@ -1,21 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/iskana.c
* PURPOSE: Checks for kana character
* PROGRAMER:
* UPDATE HISTORY:
* 12/04/99: Ariadne, Taiji Yamada Created
* 05/30/08: Samuel Serapion adapted from PROJECT C Library
*
*/
#include <precomp.h>
/*
* @implemented
*/
int _ismbbkana(unsigned int c)
{
return (get_mbcinfo()->mbctype[c & 0xff] & _MBKANA);
}

View File

@@ -1,17 +0,0 @@
/*
* 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)
{
return (0xA7 <= c && c <= 0xDF);
}

View File

@@ -1,20 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/iskpun.c
* PURPOSE:
* PROGRAMER:
* UPDATE HISTORY:
* 12/04/99: Ariadne Created
* 05/30/08: Samuel Serapion adapted from PROJECT C Library
*
*/
#include <precomp.h>
/*
* @implemented
*/
int _ismbbkpunct( unsigned int c )
{
return (_mbctype[c & 0xff] & _MKPNCT);
}

View File

@@ -1,11 +0,0 @@
#include <precomp.h>
#include <mbstring.h>
/*
* @implemented
*/
int isleadbyte(int c)
{
return _isctype( c, _LEADBYTE );
}

View File

@@ -1,22 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/islwr.c
* PURPOSE:
* PROGRAMER:
* UPDATE HISTORY:
* 12/04/99: Ariadne Created
* 05/30/08: Samuel Serapion adapted from PROJECT C Library
*
*/
#include <precomp.h>
/*
* @implemented
*/
int _ismbclower( unsigned int c )
{
return ((c) >= 0x8281 && (c) <= 0x829a);
}

View File

@@ -1,20 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/ismbal.c
* PURPOSE: Checks for alphabetic multibyte character
* PROGRAMER: Ariadne
* UPDATE HISTORY:
* 12/04/99: Created
*/
#include <mbctype.h>
#include <ctype.h>
/*
* @implemented
*/
int _ismbbalpha(unsigned int c)
{
return (isalpha(c) || _ismbbkalnum(c));
}

View File

@@ -1,25 +0,0 @@
/*
* 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
*/
int _ismbbalnum(unsigned int c)
{
return (isalnum(c) || _ismbbkalnum(c));
}

View File

@@ -1,121 +0,0 @@
/*
* 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
*
*/
#include <precomp.h>
#include <mbstring.h>
#include <mbctype.h>
/*
* @implemented
*/
int _ismbcalnum( unsigned int c )
{
if ((c & 0xFF00) != 0) {
// true multibyte character
return 0;
}
else
return _ismbbalnum(c);
return 0;
}
/*
* @implemented
*/
int _ismbcalpha( unsigned int c )
{
return (_ismbcupper (c) || _ismbclower (c));
}
/*
* @implemented
*/
int _ismbcdigit( unsigned int c )
{
return ((c) >= 0x824f && (c) <= 0x8258);
}
/*
* @implemented
*/
int _ismbcprint( unsigned int c )
{
return (_MBHMASK (c) ? _ismbclegal (c) : (isprint (c) || _ismbbkana (c)));
}
/*
* @implemented
*/
int _ismbcsymbol( unsigned int c )
{
return (c >= 0x8141 && c <= 0x817e) || (c >= 0x8180 && c <= 0x81ac);
}
/*
* @implemented
*/
int _ismbcspace( unsigned int c )
{
return (c == 0x20 || (c >= 0x09 && c <= 0x0D ));
}
/*
* @implemented
*/
int _ismbclegal(unsigned int c)
{
return (_ismbblead (_MBGETH (c)) && _ismbbtrail (_MBGETL (c)));
}
/*
* @implemented
*/
int _ismbcl0(unsigned int c)
{
return (c >= 0x8140 && c <= 0x889e);
}
/*
* @implemented
*/
int _ismbcl1(unsigned int c)
{
return (c >= 0x889f && c <= 0x9872);
}
/*
* @implemented
*/
int _ismbcl2(unsigned int c)
{
return (c >= 0x989f && c <= 0xea9e);
}
/*
* @unimplemented
*/
int _ismbcgraph(unsigned int ch)
{
//wchar_t wch = msvcrt_mbc_to_wc( ch );
//return (get_char_typeW( wch ) & (C1_UPPER | C1_LOWER | C1_DIGIT | C1_PUNCT | C1_ALPHA));
return 0;
}
/*
* @unimplemented
*/
int _ismbcpunct(unsigned int ch)
{
//wchar_t wch = msvcrt_mbc_to_wc( ch );
//return (get_char_typeW( wch ) & C1_PUNCT);
return 0;
}

View File

@@ -1,11 +0,0 @@
#include <mbstring.h>
#include <mbctype.h>
#include <ctype.h>
/*
* @implemented
*/
int _ismbbgraph(unsigned int c)
{
return (isgraph(c) || _ismbbkana(c));
}

View File

@@ -1,20 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/ismbkaln.c
* PURPOSE:
* PROGRAMER:
* UPDATE HISTORY:
* 12/04/99: Ariadne Created
* 05/30/08: Samuel Serapion adapted from PROJECT C Library
*
*/
#include <precomp.h>
/*
* @implemented
*/
int _ismbbkalnum( unsigned int c )
{
return (get_mbcinfo()->mbctype[c & 0xff] & _MKMOJI);
}

View File

@@ -1,53 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/ismblead.c
* PURPOSE: Checks for a leading byte
* PROGRAMERS:
* Copyright 1999 Ariadne, Taiji Yamada
* Copyright 1999 Alexandre Julliard
* Copyright 2000 Jon Griffths
* Copyright 2008 Samuel Serapion adapted from PROJECT C Library
*
*/
#include <precomp.h>
#include <mbctype.h>
/*
* @implemented
*/
int _ismbblead(unsigned int c)
{
return (get_mbcinfo()->mbctype[(c&0xff) + 1] & _M1) != 0;
}
/*
* @implemented
*/
int _ismbslead( const unsigned char *start, const unsigned char *str)
{
int lead = 0;
/* Lead bytes can also be trail bytes so we need to analyse the string
*/
while (start <= str)
{
if (!*start)
return 0;
lead = !lead && _ismbblead(*start);
start++;
}
return lead ? -1 : 0;
}
/*
* @implemented
*/
unsigned char *__p__mbctype(void)
{
return get_mbcinfo()->mbctype;
}

View File

@@ -1,11 +0,0 @@
#include <mbstring.h>
#include <mbctype.h>
#include <ctype.h>
/*
* @implemented
*/
int _ismbbprint(unsigned int c)
{
return (isprint(c) || _ismbbkana(c));
}

View File

@@ -1,26 +0,0 @@
/*
* 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>
/*
* @implemented
*/
int _ismbbpunct(unsigned int c)
{
// (0xA1 <= c <= 0xA6)
return (get_mbcinfo()->mbctype[c & 0xff] & _MBPUNCT);
}
//iskana() :(0xA1 <= c <= 0xDF)
//iskpun() :(0xA1 <= c <= 0xA6)
//iskmoji() :(0xA7 <= c <= 0xDF)

View File

@@ -1,39 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/ismbtrl.c
* PURPOSE: Checks for a trailing byte
* PROGRAMERS:
* Copyright 1999 Ariadne
* Copyright 1999 Alexandre Julliard
* Copyright 2000 Jon Griffths
*
*/
#include <precomp.h>
#include <mbctype.h>
size_t _mbclen2(const unsigned int s);
// iskanji2() : (0x40 <= c <= 0x7E 0x80 <= c <= 0xFC)
/*
* @implemented
*/
int _ismbbtrail(unsigned int c)
{
return (get_mbcinfo()->mbctype[(c&0xff) + 1] & _M2) != 0;
}
/*
* @implemented
*/
int _ismbstrail( const unsigned char *start, const unsigned char *str)
{
/* Note: this function doesn't check _ismbbtrail */
if ((str > start) && _ismbslead(start, str-1))
return -1;
else
return 0;
}

View File

@@ -1,21 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/isuppr.c
* PURPOSE:
* PROGRAMER:
* UPDATE HISTORY:
* 12/04/99: Ariadne Created
* 05/30/08: Samuel Serapion adapted from PROJECT C Library
*
*/
#include <precomp.h>
/*
* @implemented
*/
int _ismbcupper( unsigned int c )
{
return ((c) >= 0x8260 && (c) <= 0x8279);
}

View File

@@ -1,60 +0,0 @@
/*
* MSVCRT string functions
*
* Copyright 1996,1998 Marcus Meissner
* Copyright 1996 Jukka Iivonen
* Copyright 1997,2000 Uwe Bonnes
* 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 <mbstring.h>
#include <locale.h>
/*
* @implemented
*/
unsigned int _mbcjistojms(unsigned int c)
{
/* Conversion takes place only when codepage is 932.
In all other cases, c is returned unchanged */
if(get_mbcinfo()->mbcodepage == 932)
{
if(HIBYTE(c) >= 0x21 && HIBYTE(c) <= 0x7e &&
LOBYTE(c) >= 0x21 && LOBYTE(c) <= 0x7e)
{
if(HIBYTE(c) % 2)
c += 0x1f;
else
c += 0x7d;
if(LOBYTE(c) >= 0x7F)
c += 0x1;
c = (((HIBYTE(c) - 0x21)/2 + 0x81) << 8) | LOBYTE(c);
if(HIBYTE(c) > 0x9f)
c += 0x4000;
}
else
return 0; /* Codepage is 932, but c can't be converted */
}
return c;
}

View File

@@ -1,34 +0,0 @@
#include <precomp.h>
#include <mbstring.h>
#include <locale.h>
/*
* @implemented
*/
unsigned int __cdecl _mbcjmstojis(unsigned int c)
{
/* Conversion takes place only when codepage is 932.
In all other cases, c is returned unchanged */
if(get_mbcinfo()->mbcodepage == 932)
{
if(_ismbclegal(c) && HIBYTE(c) < 0xf0)
{
if(HIBYTE(c) >= 0xe0)
c -= 0x4000;
c = (((HIBYTE(c) - 0x81)*2 + 0x21) << 8) | LOBYTE(c);
if(LOBYTE(c) > 0x7f)
c -= 0x1;
if(LOBYTE(c) > 0x9d)
c += 0x83;
else
c -= 0x1f;
}
else
return 0; /* Codepage is 932, but c can't be converted */
}
return c;
}

View File

@@ -1,77 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/mbbtype.c
* PURPOSE: Determines the type of a multibyte character
* PROGRAMERS:
* Copyright 1999 Ariadne
* Copyright 1999 Alexandre Julliard
* Copyright 2000 Jon Griffths
*
*/
#include <precomp.h>
#include <mbstring.h>
#include <mbctype.h>
/*
* @implemented
*/
int _mbbtype(unsigned char c , int type)
{
if ( type == 1 ) {
if ((c >= 0x40 && c <= 0x7e ) || (c >= 0x80 && c <= 0xfc ) )
{
return _MBC_TRAIL;
}
else if (( c >= 0x20 && c <= 0x7E ) || ( c >= 0xA1 && c <= 0xDF ) ||
( c >= 0x81 && c <= 0x9F ) || ( c >= 0xE0 && c <= 0xFC ) )
return _MBC_ILLEGAL;
else
return 0;
} else {
if (( c >= 0x20 && c <= 0x7E ) || ( c >= 0xA1 && c <= 0xDF )) {
return _MBC_SINGLE;
}
else if ( (c >= 0x81 && c <= 0x9F ) || ( c >= 0xE0 && c <= 0xFC) )
return _MBC_LEAD;
else if (( c >= 0x20 && c <= 0x7E ) || ( c >= 0xA1 && c <= 0xDF ) ||
( c >= 0x81 && c <= 0x9F ) || ( c >= 0xE0 && c <= 0xFC ) )
return _MBC_ILLEGAL;
else
return 0;
}
return 0;
}
/*
* @implemented
*/
int _mbsbtype( const unsigned char *str, size_t n )
{
int lead = 0;
const unsigned char *end = str + n;
/* Lead bytes can also be trail bytes so we need to analyse the string.
* Also we must return _MBC_ILLEGAL for chars past the end of the string
*/
while (str < end) /* Note: we skip the last byte - will check after the loop */
{
if (!*str)
return _MBC_ILLEGAL;
lead = !lead && _ismbblead(*str);
str++;
}
if (lead)
if (_ismbbtrail(*str))
return _MBC_TRAIL;
else
return _MBC_ILLEGAL;
else
if (_ismbblead(*str))
return _MBC_LEAD;
else
return _MBC_SINGLE;
}

View File

@@ -1,23 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/mbccpy.c
* PURPOSE: Copies a multi byte character
* PROGRAMERS:
* Copyright 1999 Alexandre Julliard
* Copyright 2000 Jon Griffths
*
*/
#include <mbstring.h>
#include <string.h>
/*
* @implemented
*/
void _mbccpy(unsigned char *dst, const unsigned char *src)
{
*dst = *src;
if(_ismbblead(*src))
*++dst = *++src; /* MB char */
}

View File

@@ -1,70 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/mbclen.c
* PURPOSE: Determines the length of a multi byte character
* PROGRAMERS:
* Copyright 1999 Alexandre Julliard
* Copyright 2000 Jon Griffths
*
*/
#include <precomp.h>
#include <mbstring.h>
/*
* @implemented
*/
size_t _mbclen(const unsigned char *s)
{
return _ismbblead(*s) ? 2 : 1;
}
size_t _mbclen2(const unsigned int s)
{
return (_ismbblead(s>>8) && _ismbbtrail(s&0x00FF)) ? 2 : 1;
}
/*
* assume MB_CUR_MAX == 2
*
* @implemented
*/
int mblen( const char *str, size_t size )
{
if (str && *str && size)
{
return !isleadbyte((unsigned char)*str) ? 1 : (size>1 ? 2 : -1);
}
return 0;
}
size_t __cdecl mbrlen(const char *str, size_t len, mbstate_t *state)
{
mbstate_t s = (state ? *state : 0);
size_t ret;
if(!len || !str || !*str)
return 0;
if(get_locinfo()->mb_cur_max == 1) {
return 1;
}else if(!s && isleadbyte((unsigned char)*str)) {
if(len == 1) {
s = (unsigned char)*str;
ret = -2;
}else {
ret = 2;
}
}else if(!s) {
ret = 1;
}else {
s = 0;
ret = 2;
}
if(state)
*state = s;
return ret;
}

View File

@@ -1,10 +0,0 @@
#include <precomp.h>
#include <string.h>
/*
* @implemented
*/
unsigned char * _mbscat(unsigned char *dst, const unsigned char *src)
{
return (unsigned char *)strcat((char*)dst,(const char*)src);
}

View File

@@ -1,9 +0,0 @@
#include <string.h>
/*
* @implemented
*/
unsigned char * _mbschr(const unsigned char *str, unsigned int c)
{
return (unsigned char *)strchr((const char*)str, c);
}

View File

@@ -1,14 +0,0 @@
#include <mbstring.h>
#include <string.h>
#include <precomp.h>
/*
* @implemented
*/
int _mbscmp(const unsigned char *str1, const unsigned char *str2)
{
if (!MSVCRT_CHECK_PMT(str1 && str2))
return _NLSCMPERROR;
return strcmp((const char*)str1, (char*)str2);
}

View File

@@ -1,100 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/mbscoll.c
* PURPOSE:
* PROGRAMER: Ariadne
* UPDATE HISTORY:
* 12/04/99: Created
*/
#include <mbstring.h>
int colldif(unsigned short c1, unsigned short c2);
/*
* @implemented
*/
int _mbscoll(const unsigned char *str1, const unsigned char *str2)
{
unsigned char *s1 = (unsigned char *)str1;
unsigned char *s2 = (unsigned char *)str2;
unsigned short *short_s1, *short_s2;
int l1, l2;
while ( *s1 != 0 ) {
if (*s1 == 0)
break;
l1 = _ismbblead(*s1);
l2 = _ismbblead(*s2);
if ( !l1 && !l2 ) {
if (*s1 != *s2)
return colldif(*s1, *s2);
else {
s1 += 1;
s2 += 1;
}
}
else if ( l1 && l2 ){
short_s1 = (unsigned short *)s1;
short_s2 = (unsigned short *)s2;
if ( *short_s1 != *short_s2 )
return colldif(*short_s1, *short_s2);
else {
s1 += 2;
s2 += 2;
}
}
else
return colldif(*s1, *s2);
} ;
return 0;
}
#if 0
int _mbsbcoll(const unsigned char *str1, const unsigned char *str2)
{
unsigned char *s1 = (unsigned char *)str1;
unsigned char *s2 = (unsigned char *)str2;
unsigned short *short_s1, *short_s2;
int l1, l2;
while ( *s1 != 0 ) {
l1 = _ismbblead(*s1);
l2 = _ismbblead(*s2);
if ( !l1 && !l2 ) {
if (*s1 != *s2)
return colldif(*s1, *s2);
else {
s1 += 1;
s2 += 1;
}
}
else if ( l1 && l2 ){
short_s1 = (unsigned short *)s1;
short_s2 = (unsigned short *)s2;
if ( *short_s1 != *short_s2 )
return colldif(*short_s1, *short_s2);
else {
s1 += 2;
s2 += 2;
}
}
else
return colldif(*s1, *s2);
} ;
return 0;
}
#endif

View File

@@ -1,11 +0,0 @@
#include <precomp.h>
#include <mbstring.h>
#include <string.h>
/*
* @implemented
*/
unsigned char * _mbscpy(unsigned char *dst, const unsigned char *str)
{
return (unsigned char*)strcpy((char*)dst,(const char*)str);
}

View File

@@ -1,33 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/mbscspn.c
* PURPOSE:
* PROGRAMER:
* UPDATE HISTORY:
* 05/30/08: Samuel Serapion adapted from PROJECT C Library
*
*/
#include <precomp.h>
#include <mbstring.h>
/*
* @implemented
*/
size_t _mbscspn (const unsigned char *str1, const unsigned char *str2)
{
int c;
const unsigned char *save = str1;
while ((c = _mbsnextc (str1))) {
if (_mbschr (str2, c))
break;
str1 = _mbsinc ((unsigned char *) str1);
}
return str1 - save;
}

View File

@@ -1,18 +0,0 @@
#include <precomp.h>
#include <mbstring.h>
/*
* @implemented
*/
unsigned char * _mbsdec(const unsigned char *str, const unsigned char *cur)
{
unsigned char *s = (unsigned char *)cur;
if ( str >= cur )
return NULL;
s--;
if (_ismbblead(*(s-1)) )
s--;
return s;
}

View File

@@ -1,29 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/mbsdup.c
* PURPOSE: Duplicates a multi byte string
* PROGRAMER: Ariadne
* UPDATE HISTORY:
Modified from DJGPP strdup
* 12/04/99: Created
*/
#include <precomp.h>
#include <mbstring.h>
#include <stdlib.h>
/*
* @implemented
*/
unsigned char * _mbsdup(const unsigned char *_s)
{
unsigned char *rv;
if (_s == 0)
return 0;
rv = (unsigned char *)malloc(_mbslen(_s) + 1);
if (rv == 0)
return 0;
_mbscpy(rv, _s);
return rv;
}

View File

@@ -1,64 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/mbsicmp.c
* PURPOSE: Duplicates a multi byte string
* PROGRAMER: Ariadne
* UPDATE HISTORY:
* 12/04/99: Created
*/
#include <precomp.h>
#include <mbstring.h>
/*
* @implemented
*/
int _mbsicmp(const unsigned char *str1, const unsigned char *str2)
{
unsigned char *s1 = (unsigned char *)str1;
unsigned char *s2 = (unsigned char *)str2;
unsigned short *short_s1, *short_s2;
int l1, l2;
do {
if (*s1 == 0)
break;
l1 = _ismbblead(*s1);
l2 = _ismbblead(*s2);
if ( !l1 && !l2 ) {
if (toupper(*s1) != toupper(*s2))
return toupper(*s1) - toupper(*s2);
else {
s1 += 1;
s2 += 1;
}
}
else if ( l1 && l2 ){
short_s1 = (unsigned short *)s1;
short_s2 = (unsigned short *)s2;
if ( _mbctoupper(*short_s1) != _mbctoupper(*short_s2 ))
return _mbctoupper(*short_s1) - _mbctoupper(*short_s2);
else {
s1 += 2;
s2 += 2;
}
}
else
return *s1 - *s2;
} while (*s1 != 0);
return 0;
while (toupper(*s1) == toupper(*s2))
{
if (*s1 == 0)
return 0;
s1++;
s2++;
}
return toupper(*(unsigned const char *)s1) - toupper(*(unsigned const char *)(s2));
}

View File

@@ -1,58 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/mbsicoll.c
* PURPOSE:
* PROGRAMER: Ariadne
* UPDATE HISTORY:
* 12/04/99: Created
*/
#include <mbstring.h>
#include <mbctype.h>
#include <ctype.h>
int colldif(unsigned short c1, unsigned short c2);
/*
* @implemented
*/
int _mbsicoll(const unsigned char *str1, const unsigned char *str2)
{
unsigned char *s1 = (unsigned char *)str1;
unsigned char *s2 = (unsigned char *)str2;
unsigned short *short_s1, *short_s2;
int l1, l2;
while ( *s1 != 0 ) {
if (*s1 == 0)
break;
l1 = _ismbblead(*s1);
l2 = _ismbblead(*s2);
if ( !l1 && !l2 ) {
if (toupper(*s1) != toupper(*s2))
return colldif(*s1, *s2);
else {
s1 += 1;
s2 += 1;
}
}
else if ( l1 && l2 ){
short_s1 = (unsigned short *)s1;
short_s2 = (unsigned short *)s2;
if ( _mbctoupper(*short_s1) != _mbctoupper(*short_s2 ))
return colldif(*short_s1, *short_s2);
else {
s1 += 2;
s2 += 2;
}
}
else
return colldif(*s1, *s2);
} ;
return 0;
}

View File

@@ -1,13 +0,0 @@
#include <mbstring.h>
/*
* @implemented
*/
unsigned char * _mbsinc(const unsigned char *s)
{
unsigned char *c = (unsigned char *)s;
if (_ismbblead(*s) )
c++;
c++;
return c;
}

View File

@@ -1,32 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/mbslen.c
* PURPOSE: Determines the length of a multi byte string
* PROGRAMERS:
* Copyright 1999 Alexandre Julliard
* Copyright 2000 Jon Griffths
*
*/
#include <mbstring.h>
/*
* @implemented
*/
size_t _mbslen(const unsigned char *str)
{
size_t len = 0;
while(*str)
{
if (_ismbblead(*str))
{
str++;
if (!*str) /* count only full chars */
break;
}
str++;
len++;
}
return len;
}

View File

@@ -1,55 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/mbslwr.c
* PURPOSE: Multibyte lowercase functions
* PROGRAMER: Eric Kohl
* Samuel Serapion, adapted from PROJECT C Library
*/
#include <precomp.h>
#include <mbstring.h>
#include <ctype.h>
unsigned int _mbbtolower(unsigned int c)
{
if (!_ismbblead(c) )
return tolower(c);
return c;
}
/*
* @implemented
*/
unsigned int _mbctolower(unsigned int c)
{
return _ismbcupper (c) ? c + 0x21 : c;
}
/*
* @implemented
*/
unsigned char * _mbslwr(unsigned char *x)
{
unsigned char *y=x;
if (x == NULL)
{
return NULL;
}
while (*y)
{
if (!_ismbblead(*y))
{
*y = tolower(*y);
y++;
}
else
{
*y = _mbctolower(*(unsigned short *)y);
y++;
}
}
return x;
}

View File

@@ -1,99 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/mbsncat.c
* PURPOSE: Concatenate two multi byte string to maximum of n characters or bytes
* PROGRAMER: Ariadne
* UPDATE HISTORY:
* 12/04/99: Created
* 11/10/2025 Somewhat synced with Wine 10.0 by Doug Lyons
*/
#include <precomp.h>
#include <mbstring.h>
#include <string.h>
static inline unsigned char* u_strncat( unsigned char* dst, const unsigned char* src, size_t len )
{
return (unsigned char*)strncat( (char*)dst, (const char*)src, len);
}
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)
{
MSVCRT_pthreadmbcinfo mbcinfo = get_mbcinfo();
if (!n)
return dst;
if (!dst || !src) ERR("Bad Parameter\n");
if (mbcinfo->ismbcodepage)
{
unsigned char *res = dst;
while (*dst)
{
if (_ismbblead(*dst++))
dst++;
}
while (*src && n--)
{
*dst++ = *src;
if (_ismbblead(*src++))
*dst++ = *src++;
}
*dst = '\0';
return res;
}
return u_strncat(dst, src, n); /* ASCII CP */
}
/*
* @implemented
*/
unsigned char * _mbsnbcat(unsigned char *dst, const unsigned char *src, size_t n)
{
MSVCRT_pthreadmbcinfo mbcinfo = get_mbcinfo();
unsigned char *s;
/* replace TRACE with ERR for debug output */
TRACE("Src %s\n", wine_dbgstr_an((const char*)src, n));
if (!dst || !src) ERR("Bad Parameter\n");
if (!src && !dst && !n && !MSVCRT_CHECK_PMT(dst && src))
return NULL;
if (mbcinfo->ismbcodepage)
{
unsigned char *res = dst;
while (*dst)
{
if (_ismbblead(*dst++))
{
if (*dst)
{
dst++;
}
else
{
/* as per msdn overwrite the lead byte in front of '\0' */
dst--;
break;
}
}
}
while (*src && n--) *dst++ = *src++;
*dst = '\0';
return res;
}
s = u_strncat(dst, src, n); /* ASCII CP */
/* replace TRACE with ERR for debug output */
TRACE("Dst %s\n", wine_dbgstr_an((const char*)dst, _mbslen(dst)));
return s;
}

View File

@@ -1,35 +0,0 @@
#include <mbstring.h>
/*
* @implemented
*/
size_t _mbsnccnt(const unsigned char *str, size_t n)
{
unsigned char *s = (unsigned char *)str;
size_t cnt = 0;
while(*s != 0 && n > 0) {
if (_ismbblead(*s) )
s++;
else
n--;
s++;
cnt++;
}
return cnt;
}
/*
* @implemented
*/
size_t _mbsnbcnt(const unsigned char *str, size_t n)
{
unsigned char *s = (unsigned char *)str;
while(*s != 0 && n > 0) {
if (!_ismbblead(*s) )
n--;
s++;
}
return (size_t)(s - str);
}

View File

@@ -1,109 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/mbsncmp.c
* PURPOSE: Compares two strings to a maximum of n bytes or characters
* PROGRAMER: Ariadne
* UPDATE HISTORY:
* 12/04/99: Created
*/
#include <mbstring.h>
/*
* @implemented
*/
int _mbsncmp(const unsigned char *str1, const unsigned char *str2, size_t n)
{
unsigned char *s1 = (unsigned char *)str1;
unsigned char *s2 = (unsigned char *)str2;
unsigned short *short_s1, *short_s2;
int l1, l2;
if (n == 0)
return 0;
do {
if (*s1 == 0)
break;
l1 = _ismbblead(*s1);
l2 = _ismbblead(*s2);
if ( !l1 && !l2 ) {
if (*s1 != *s2)
return *s1 - *s2;
else {
s1 += 1;
s2 += 1;
n--;
}
}
else if ( l1 && l2 ){
short_s1 = (unsigned short *)s1;
short_s2 = (unsigned short *)s2;
if ( *short_s1 != *short_s2 )
return *short_s1 - *short_s2;
else {
s1 += 2;
s2 += 2;
n--;
}
}
else
return *s1 - *s2;
} while (n > 0);
return 0;
}
/*
* @implemented
*/
int _mbsnbcmp(const unsigned char *str1, const unsigned char *str2, size_t n)
{
unsigned char *s1 = (unsigned char *)str1;
unsigned char *s2 = (unsigned char *)str2;
unsigned short *short_s1, *short_s2;
int l1, l2;
if (n == 0)
return 0;
do {
if (*s1 == 0)
break;
l1 = _ismbblead(*s1);
l2 = _ismbblead(*s2);
if ( !l1 && !l2 ) {
if (*s1 != *s2)
return *s1 - *s2;
else {
s1 += 1;
s2 += 1;
n--;
}
}
else if ( l1 && l2 ){
short_s1 = (unsigned short *)s1;
short_s2 = (unsigned short *)s2;
if ( *short_s1 != *short_s2 )
return *short_s1 - *short_s2;
else {
s1 += 2;
s2 += 2;
n-=2;
}
}
else
return *s1 - *s2;
} while (n > 0);
return 0;
}

View File

@@ -1,115 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/mbsncoll.c
* PURPOSE:
* PROGRAMER: Ariadne
* UPDATE HISTORY:
* 12/04/99: Created
*/
#include <mbstring.h>
int colldif(unsigned short c1, unsigned short c2)
{
return c1 - c2;
}
/*
* @implemented
*/
int _mbsncoll(const unsigned char *str1, const unsigned char *str2, size_t n)
{
unsigned char *s1 = (unsigned char *)str1;
unsigned char *s2 = (unsigned char *)str2;
unsigned short *short_s1, *short_s2;
int l1, l2;
if (n == 0)
return 0;
do {
if (*s1 == 0)
break;
l1 = _ismbblead(*s1);
l2 = _ismbblead(*s2);
if ( !l1 && !l2 ) {
if (*s1 != *s2)
return colldif(*s1, *s2);
else {
s1 += 1;
s2 += 1;
n--;
}
}
else if ( l1 && l2 ){
short_s1 = (unsigned short *)s1;
short_s2 = (unsigned short *)s2;
if ( *short_s1 != *short_s2 )
return colldif(*short_s1, *short_s2);
else {
s1 += 2;
s2 += 2;
n--;
}
}
else
return colldif(*s1, *s2);
} while (n > 0);
return 0;
}
/*
* @implemented
*/
int _mbsnbcoll(const unsigned char *str1, const unsigned char *str2, size_t n)
{
unsigned char *s1 = (unsigned char *)str1;
unsigned char *s2 = (unsigned char *)str2;
unsigned short *short_s1, *short_s2;
int l1, l2;
if (n == 0)
return 0;
do {
if (*s1 == 0)
break;
l1 = _ismbblead(*s1);
l2 = _ismbblead(*s2);
if ( !l1 && !l2 ) {
if (*s1 != *s2)
return colldif(*s1, *s2);
else {
s1 += 1;
s2 += 1;
n--;
}
}
else if ( l1 && l2 ){
short_s1 = (unsigned short *)s1;
short_s2 = (unsigned short *)s2;
if ( *short_s1 != *short_s2 )
return colldif(*short_s1, *short_s2);
else {
s1 += 2;
s2 += 2;
n-=2;
}
}
else
return colldif(*s1, *s2);
} while (n > 0);
return 0;
}

View File

@@ -1,159 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/mbsncpy.c
* PURPOSE: Copies a string to a maximum of n bytes or characters
* PROGRAMERS:
* Copyright 1999 Ariadne
* Copyright 1999 Alexandre Julliard
* Copyright 2000 Jon Griffths
*
*/
#include <precomp.h>
#include <mbstring.h>
/*********************************************************************
* _mbsncpy(MSVCRT.@)
* REMARKS
* The parameter n is the number or characters to copy, not the size of
* the buffer. Use _mbsnbcpy for a function analogical to strncpy
*/
unsigned char* CDECL _mbsncpy(unsigned char* dst, const unsigned char* src, size_t n)
{
unsigned char* ret = dst;
if(!n)
return dst;
if (get_mbcinfo()->ismbcodepage)
{
while (*src && n)
{
n--;
if (_ismbblead(*src))
{
if (!*(src+1))
{
*dst++ = 0;
*dst++ = 0;
break;
}
*dst++ = *src++;
}
*dst++ = *src++;
}
}
else
{
while (n)
{
n--;
if (!(*dst++ = *src++)) break;
}
}
while (n--) *dst++ = 0;
return ret;
}
/*********************************************************************
* _mbsnbcpy_s(MSVCRT.@)
* REMARKS
* Unlike _mbsnbcpy this function does not pad the rest of the dest
* string with 0
*/
int CDECL _mbsnbcpy_s(unsigned char* dst, size_t size, const unsigned char* src, size_t n)
{
size_t pos = 0;
if(!dst || size == 0)
return EINVAL;
if(!src)
{
dst[0] = '\0';
return EINVAL;
}
if(!n)
return 0;
if(get_mbcinfo()->ismbcodepage)
{
int is_lead = 0;
while (*src && n)
{
if(pos == size)
{
dst[0] = '\0';
return ERANGE;
}
is_lead = (!is_lead && _ismbblead(*src));
n--;
dst[pos++] = *src++;
}
if (is_lead) /* if string ends with a lead, remove it */
dst[pos - 1] = 0;
}
else
{
while (n)
{
n--;
if(pos == size)
{
dst[0] = '\0';
return ERANGE;
}
if(!(*src)) break;
dst[pos++] = *src++;
}
}
if(pos < size)
dst[pos] = '\0';
else
{
dst[0] = '\0';
return ERANGE;
}
return 0;
}
/*********************************************************************
* _mbsnbcpy(MSVCRT.@)
* REMARKS
* Like strncpy this function doesn't enforce the string to be
* NUL-terminated
*/
unsigned char* CDECL _mbsnbcpy(unsigned char* dst, const unsigned char* src, size_t n)
{
unsigned char* ret = dst;
if(!n)
return dst;
if(get_mbcinfo()->ismbcodepage)
{
int is_lead = 0;
while (*src && n)
{
is_lead = (!is_lead && _ismbblead(*src));
n--;
*dst++ = *src++;
}
if (is_lead) /* if string ends with a lead, remove it */
*(dst - 1) = 0;
}
else
{
while (n)
{
n--;
if (!(*dst++ = *src++)) break;
}
}
while (n--) *dst++ = 0;
return ret;
}

View File

@@ -1,23 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/mbsnextc.c
* PURPOSE: Finds the next character in a string
* PROGRAMERS:
* Copyright 1999 Alexandre Julliard
* Copyright 2000 Jon Griffths
*
*/
#include <precomp.h>
#include <mbstring.h>
/*
* @implemented
*/
unsigned int _mbsnextc (const unsigned char *str)
{
if(_ismbblead(*str))
return *str << 8 | str[1];
return *str;
}

View File

@@ -1,47 +0,0 @@
#include <mbstring.h>
size_t _mbclen2(const unsigned int s);
unsigned int _mbbtoupper(unsigned int c);
/*
* @implemented
*/
int _mbsnicmp(const unsigned char *s1, const unsigned char *s2, size_t n)
{
if (n == 0)
return 0;
do {
if (_mbbtoupper(*s1) != _mbbtoupper(*s2))
return _mbbtoupper(*(unsigned const char *)s1) - _mbbtoupper(*(unsigned const char *)s2);
s1 += _mbclen2(*s1);
s2 += _mbclen2(*s2);
if (*s1 == 0)
break;
if (!_ismbblead(*s1))
n--;
} while (n > 0);
return 0;
}
/*
* @implemented
*/
int _mbsnbicmp(const unsigned char *s1, const unsigned char *s2, size_t n)
{
if (n == 0)
return 0;
do {
if (_mbbtoupper(*s1) != _mbbtoupper(*s2))
return _mbbtoupper(*(unsigned const char *)s1) - _mbbtoupper(*(unsigned const char *)s2);
s1 += _mbclen2(*s1);
s2 += _mbclen2(*s2);
if (*s1 == 0)
break;
n--;
} while (n > 0);
return 0;
}

View File

@@ -1,21 +0,0 @@
#include <precomp.h>
#include <mbstring.h>
/*
* @unimplemented
*/
int _mbsnicoll(const unsigned char *s1, const unsigned char *s2, size_t n)
{
WARN("_mbsnicoll unimplemented\n");
return 0;
}
/*
* @unimplemented
*/
int _mbsnbicoll(const unsigned char *s1, const unsigned char *s2, size_t n)
{
WARN("_mbsnbicoll unimplemented\n");
return 0;
}

View File

@@ -1,37 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/mbsninc.c
* PURPOSE:
* PROGRAMERS:
* Copyright 1999 Alexandre Julliard
* Copyright 2000 Jon Griffths
*
*/
#include <precomp.h>
#include <mbstring.h>
/*
* @implemented
*/
unsigned char * _mbsninc(const unsigned char *str, size_t n)
{
if(!str)
return NULL;
while (n > 0 && *str)
{
if (_ismbblead(*str))
{
if (!*(str+1))
break;
str++;
}
str++;
n--;
}
return (unsigned char*)str;
}

View File

@@ -1,70 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/mbsnset.c
* PURPOSE: Fills a string with a multibyte character
* PROGRAMER: Ariadne
* UPDATE HISTORY:
* 12/04/99: Created
*/
#include <mbstring.h>
size_t _mbclen2(const unsigned int s);
/*
* @implemented
*/
unsigned char * _mbsnset(unsigned char *src, unsigned int val, size_t count)
{
unsigned char *char_src = (unsigned char *)src;
unsigned short *short_src = (unsigned short *)src;
if ( _mbclen2(val) == 1 ) {
while(count > 0) {
*char_src = val;
char_src++;
count--;
}
*char_src = 0;
}
else {
while(count > 0) {
*short_src = val;
short_src++;
count-=2;
}
*short_src = 0;
}
return src;
}
/*
* @implemented
*/
unsigned char * _mbsnbset(unsigned char *src, unsigned int val, size_t count)
{
unsigned char *char_src = (unsigned char *)src;
unsigned short *short_src = (unsigned short *)src;
if ( _mbclen2(val) == 1 ) {
while(count > 0) {
*char_src = val;
char_src++;
count--;
}
*char_src = 0;
}
else {
while(count > 0) {
*short_src = val;
short_src++;
count-=2;
}
*short_src = 0;
}
return src;
}

View File

@@ -1,26 +0,0 @@
#include <stdlib.h>
#include <mbstring.h>
int isleadbyte(int byte);
/*
* not correct
*
* @implemented
*/
unsigned char * _mbspbrk(const unsigned char *s1, const unsigned char *s2)
{
const unsigned char* p;
while (*s1)
{
for (p = s2; *p; p += (isleadbyte(*p) ? 2 : 1))
{
if (*p == *s1)
if (!isleadbyte(*p) || (*(p+1) == *(s1 + 1)))
return (unsigned char*)s1;
}
s1 += (isleadbyte(*s1) ? 2 : 1);
}
return NULL;
}

View File

@@ -1,33 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/mbsrchr.c
* PURPOSE: Searches for a character in reverse
* PROGRAMER: Ariadne
* UPDATE HISTORY:
* 12/04/99: Created
*/
#include <stdlib.h>
#include <mbstring.h>
/*
* @implemented
*/
unsigned char * _mbsrchr(const unsigned char *src, unsigned int val)
{
unsigned int c;
unsigned char *match = NULL;
if (!src)
return NULL;
while (1)
{
c = _mbsnextc(src);
if (c == val)
match = (unsigned char*)src;
if (!c)
return match;
src += (c > 255) ? 2 : 1;
}
}

View File

@@ -1,33 +0,0 @@
#include <mbstring.h>
/*
* @implemented
*/
unsigned char * _mbsrev(unsigned char *s)
{
unsigned char *e;
unsigned char a;
unsigned char *e2;
e=s;
while (*e) {
if ( _ismbblead(*e) ) {
a = *e;
e2 = e;
*e2 = *++e;
if ( *e == 0 )
break;
*e = a;
}
e++;
}
while (s<e) {
a=*s;
*s=*e;
*e=a;
s++;
e--;
}
return s;
}

View File

@@ -1,40 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/mbsset.c
* PURPOSE: Fills a string with a multibyte character
* PROGRAMER: Ariadne
* UPDATE HISTORY:
* 12/04/99: Created
*/
#include <mbstring.h>
size_t _mbclen2(const unsigned int s);
/*
* @implemented
*/
unsigned char * _mbsset(unsigned char *src, unsigned int c)
{
unsigned char *char_src = src;
unsigned short *short_src = (unsigned short *)src;
if ( _mbclen2(c) == 1 ) {
while(*char_src != 0) {
*char_src = c;
char_src++;
}
*char_src = 0;
}
else {
while(*short_src != 0) {
*short_src = c;
short_src++;
}
*short_src = 0;
}
return src;
}

View File

@@ -1,33 +0,0 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
* FILE: lib/sdk/crt/mbstring/mbsspn.c
* PURPOSE:
* PROGRAMER:
* UPDATE HISTORY:
* 05/30/08: Samuel Serapion adapted from PROJECT C Library
*
*/
#include <precomp.h>
#include <mbstring.h>
/*
* @implemented
*/
size_t _mbsspn (const unsigned char *str1, const unsigned char *str2)
{
int c;
const unsigned char *save = str1;
while ((c = _mbsnextc (str1))) {
if (_mbschr (str2, c) == 0)
break;
str1 = _mbsinc ((unsigned char *) str1);
}
return str1 - save;
}

View File

@@ -1,21 +0,0 @@
#include <precomp.h>
#include <mbstring.h>
/*
* @implemented
*/
unsigned char *_mbsspnp (const unsigned char *str1, const unsigned char *str2)
{
int c;
while ((c = _mbsnextc (str1))) {
if (_mbschr (str2, c) == 0)
return (unsigned char *) str1;
str1 = _mbsinc ((unsigned char *) str1);
}
return 0;
}

View File

@@ -1,23 +0,0 @@
#include <mbstring.h>
#include <stdlib.h>
/*
* @implemented
*/
unsigned char *_mbsstr(const unsigned char *src1,const unsigned char *src2)
{
size_t len;
if (src2 ==NULL || *src2 == 0)
return (unsigned char *)src1;
len = _mbslen(src2);
while(*src1)
{
if ((*src1 == *src2) && (_mbsncmp(src1,src2,len) == 0))
return (unsigned char *)src1;
src1 = (unsigned char *)_mbsinc(src1);
}
return NULL;
}

View File

@@ -1,57 +0,0 @@
#include <stdlib.h>
#include <mbstring.h>
/*
* @implemented
*/
unsigned char * _mbstok(unsigned char *s, const unsigned char *delim)
{
const unsigned char *spanp;
int c, sc;
unsigned char *tok;
static unsigned char *last;
if (s == NULL && (s = last) == NULL)
return (NULL);
/*
* Skip (span) leading delimiters (s += strspn(s, delim), sort of).
*/
cont:
c = *s;
s = _mbsinc(s);
for (spanp = delim; (sc = *spanp) != 0; spanp = _mbsinc(spanp)) {
if (c == sc)
goto cont;
}
if (c == 0) { /* no non-delimiter characters */
last = NULL;
return (NULL);
}
tok = s - 1;
/*
* Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
* Note that delim must have one NUL; we stop if we see that, too.
*/
for (;;) {
c = *s;
s = _mbsinc(s);
spanp = delim;
do {
if ((sc = *spanp) == c) {
if (c == 0)
s = NULL;
else
s[-1] = 0;
last = s;
return (tok);
}
spanp = _mbsinc(spanp);
} while (sc != 0);
}
/* NOTREACHED */
}

Some files were not shown because too many files have changed in this diff Show More