Index: base/applications/calc/winmain.c =================================================================== --- base/applications/calc/winmain.c (Revision 37928) +++ base/applications/calc/winmain.c (Arbeitskopie) @@ -1581,7 +1581,7 @@ if (IsWindow(calc.hStatWnd)) break; calc.hStatWnd = CreateDialog(calc.hInstance, - MAKEINTRESOURCE(IDD_DIALOG_STAT), hWnd, (DLGPROC)DlgStatProc); + MAKEINTRESOURCE(IDD_DIALOG_STAT), hWnd, DlgStatProc); if (calc.hStatWnd != NULL) { enable_allowed_controls(hWnd, calc.base); SendMessage(calc.hStatWnd, WM_SETFOCUS, 0, 0); Index: base/applications/network/ftp/fake.c =================================================================== --- base/applications/network/ftp/fake.c (Revision 37928) +++ base/applications/network/ftp/fake.c (Arbeitskopie) @@ -1,5 +1,6 @@ #include -#include +//#include +#include #include #include "fake.h" #include "prototypes.h" @@ -307,12 +308,13 @@ #define EPOCHFILETIME (116444736000000000LL) #endif -int gettimeofday(struct timeval *tv, struct timezone *tz) +int gettimeofday(struct timeval *tv, void *tz0) { FILETIME ft; LARGE_INTEGER li; __int64 t; static int tzflag; + struct timezone *tz = tz0; if (tv) { Index: base/applications/network/ftp/fake.h =================================================================== --- base/applications/network/ftp/fake.h (Revision 37928) +++ base/applications/network/ftp/fake.h (Arbeitskopie) @@ -9,9 +9,4 @@ #define strcasecmp strcmp #define strncasecmp strnicmp -struct timezone { - int tz_minuteswest; /* minutes W of Greenwich */ - int tz_dsttime; /* type of dst correction */ -}; - -int gettimeofday(struct timeval *tv, struct timezone *tz); +void __cdecl _tzset(void); Index: base/applications/network/ftp/ftp_var.h =================================================================== --- base/applications/network/ftp/ftp_var.h (Revision 37928) +++ base/applications/network/ftp/ftp_var.h (Arbeitskopie) @@ -2,6 +2,7 @@ #include "fake.h" #include "prototypes.h" #include +#include //typedef void (*Sig_t)(int); Index: base/applications/network/ping/ping.c =================================================================== --- base/applications/network/ping/ping.c (Revision 37928) +++ base/applications/network/ping/ping.c (Arbeitskopie) @@ -220,7 +220,7 @@ DataSize = GetULONG2(&argv[i][2], argv[i + 1], &i); if (DataSize > ICMP_MAXSIZE - sizeof(ICMP_ECHO_PACKET)) { - printf("Bad value for option -l, valid range is from 0 to %d.\n", + printf("Bad value for option -l, valid range is from 0 to %I64d.\n", ICMP_MAXSIZE - sizeof(ICMP_ECHO_PACKET)); return FALSE; } @@ -453,7 +453,7 @@ } - printf("Reply from %s: bytes=%d time%s%s TTL=%d\n", inet_ntoa(from->sin_addr), + printf("Reply from %s: bytes=%I64d time%s%s TTL=%d\n", inet_ntoa(from->sin_addr), size - IphLength - sizeof(ICMP_ECHO_PACKET), Sign, Time, IpHeader->TTL); if (RelativeTime.QuadPart < MinRTT.QuadPart || !MinRTTSet) { Index: base/applications/network/ping/ping.rbuild =================================================================== --- base/applications/network/ping/ping.rbuild (Revision 37928) +++ base/applications/network/ping/ping.rbuild (Arbeitskopie) @@ -1,6 +1,6 @@ - + . kernel32 Index: base/applications/network/tracert/tracert.c =================================================================== --- base/applications/network/tracert/tracert.c (Revision 37928) +++ base/applications/network/tracert/tracert.c (Arbeitskopie) @@ -396,7 +396,11 @@ DebugPrint(_T("Rouge packet: header id, process id %d"), TTLExceedHdr->OrigIcmpHeader.id, GetCurrentProcessId()); return -1; } - _tprintf(_T("%3Ld ms"), (pInfo->lTimeEnd - pInfo->lTimeStart) / pInfo->TicksPerMs.QuadPart); +#ifndef _WIN64 + _tprintf(_T("%3lld ms"), (pInfo->lTimeEnd - pInfo->lTimeStart) / pInfo->TicksPerMs.QuadPart); +#else + _tprintf(_T("%3I64d ms"), (pInfo->lTimeEnd - pInfo->lTimeStart) / pInfo->TicksPerMs.QuadPart); +#endif return 0; case ECHO_REPLY : @@ -407,7 +411,11 @@ DebugPrint(_T("Rouge packet: header id %d, process id %d"), IcmpHdr->icmpheader.id, GetCurrentProcessId()); return -1; } - _tprintf(_T("%3Ld ms"), (pInfo->lTimeEnd - pInfo->lTimeStart) / pInfo->TicksPerMs.QuadPart); +#ifndef _WIN64 + _tprintf(_T("%3lld ms"), (pInfo->lTimeEnd - pInfo->lTimeStart) / pInfo->TicksPerMs.QuadPart); +#else + _tprintf(_T("%3I64d ms"), (pInfo->lTimeEnd - pInfo->lTimeStart) / pInfo->TicksPerMs.QuadPart); +#endif return 1; case DEST_UNREACHABLE : Index: base/applications/taskmgr/affinity.c =================================================================== --- base/applications/taskmgr/affinity.c (Revision 37928) +++ base/applications/taskmgr/affinity.c (Arbeitskopie) @@ -75,8 +75,8 @@ INT_PTR CALLBACK AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { - DWORD dwProcessAffinityMask = 0; - DWORD dwSystemAffinityMask = 0; + DWORD_PTR dwProcessAffinityMask = 0; + DWORD_PTR dwSystemAffinityMask = 0; WCHAR strErrorText[260]; WCHAR szTitle[256]; BYTE nCpu; Index: base/shell/explorer/shell/fatfs.cpp =================================================================== --- base/shell/explorer/shell/fatfs.cpp (Revision 37928) +++ base/shell/explorer/shell/fatfs.cpp (Arbeitskopie) @@ -148,8 +148,8 @@ w32fd.nFileSizeLow = e.size; // convert date/time attribute into FILETIME - const fdate& date = e.date; - const ftime& time = e.time; + const filedate& date = e.date; + const filetime& time = e.time; SYSTEMTIME stime; FILETIME ftime; Index: base/shell/explorer/shell/fatfs.h =================================================================== --- base/shell/explorer/shell/fatfs.h (Revision 37928) +++ base/shell/explorer/shell/fatfs.h (Arbeitskopie) @@ -118,13 +118,13 @@ }; -struct ftime { +struct filetime { WORD sec2 : 5; WORD min : 6; WORD hour : 5; }; -struct fdate { +struct filedate { WORD day : 5; WORD month : 4; WORD year : 7; @@ -150,15 +150,15 @@ char ext[3]; char attr; char rsrvd[10]; - struct ftime time; - struct fdate date; + struct filetime time; + struct filedate date; WORD fclus; DWORD size; }; union DEntry { DEntry_E E; - BYTE B[8+3+1+10+sizeof(struct ftime)+sizeof(struct fdate)+sizeof(WORD)+sizeof(DWORD)]; + BYTE B[8+3+1+10+sizeof(struct filetime)+sizeof(struct filedate)+sizeof(WORD)+sizeof(DWORD)]; }; #pragma pack(pop) Index: dll/directx/d3d8/d3d8.spec =================================================================== --- dll/directx/d3d8/d3d8.spec (Revision 0) +++ dll/directx/d3d8/d3d8.spec (Revision 0) @@ -0,0 +1,5 @@ +@ stdcall D3D8GetSWInfo() +@ stdcall DebugSetMute() +@ stdcall Direct3DCreate8(long) +@ stdcall ValidatePixelShader(ptr long long ptr) +@ stdcall ValidateVertexShader(ptr ptr ptr long ptr) \ No newline at end of file Index: dll/win32/crtdll/crtdll.rbuild =================================================================== --- dll/win32/crtdll/crtdll.rbuild (Revision 37928) +++ dll/win32/crtdll/crtdll.rbuild (Arbeitskopie) @@ -5,6 +5,7 @@ + Index: dll/win32/dbghelp/regex.c =================================================================== --- dll/win32/dbghelp/regex.c (Revision 37928) +++ dll/win32/dbghelp/regex.c (Arbeitskopie) @@ -5790,11 +5790,7 @@ from either regcomp or regexec. We don't use PREG here. */ size_t -regerror (errcode, preg, errbuf, errbuf_size) - int errcode; - const regex_t *preg; - char *errbuf; - size_t errbuf_size; +regerror (int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size) { const char *msg; size_t msg_size; Index: dll/win32/dbghelp/stabs.c =================================================================== --- dll/win32/dbghelp/stabs.c (Revision 37928) +++ dll/win32/dbghelp/stabs.c (Arbeitskopie) @@ -63,8 +63,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp_stabs); -UINT64 _strtoui64( const char *nptr, char **endptr, int base ); - #ifndef N_UNDF #define N_UNDF 0x00 #endif Index: dll/win32/msvcrt20/msvcrt20.spec =================================================================== --- dll/win32/msvcrt20/msvcrt20.spec (Revision 37928) +++ dll/win32/msvcrt20/msvcrt20.spec (Arbeitskopie) @@ -464,7 +464,7 @@ @ cdecl __dllonexit(ptr ptr ptr) msvcrt.__dllonexit @ cdecl __doserrno() msvcrt.__doserrno @ cdecl __fpecode() msvcrt.__fpecode -@ cdecl __getmainargs(ptr ptr ptr long long) MSVCRT20__getmainargs +@ cdecl __getmainargs(ptr ptr ptr ptr ptr) MSVCRT20__getmainargs @ extern __initenv msvcrt.__initenv @ cdecl __isascii(long) msvcrt.__isascii @ cdecl __iscsym(long) msvcrt.__iscsym Index: dll/win32/msvcrt40/msvcrt40.rbuild =================================================================== --- dll/win32/msvcrt40/msvcrt40.rbuild (Revision 37928) +++ dll/win32/msvcrt40/msvcrt40.rbuild (Arbeitskopie) @@ -8,7 +8,6 @@ msvcrt40.c wine - msvcrt kernel32 Index: dll/win32/msvcrt/msvcrt.def =================================================================== --- dll/win32/msvcrt/msvcrt.def (Revision 37928) +++ dll/win32/msvcrt/msvcrt.def (Arbeitskopie) @@ -120,7 +120,7 @@ __fpecode @115 __getmainargs @116 __initenv @117 - __iob_func=__p__iob @118 +; __iob_func @118 __isascii @119 __iscsym @120 __iscsymf @121 @@ -272,10 +272,10 @@ _findclose @266 _findfirst @267 ; _findfirst64 @268 - _findfirsti64 @269 + ;_findfirsti64 @269 _findnext @270 ; _findnext64 @271 - _findnexti64 @272 + ;_findnexti64 @272 _finite @273 _flsbuf @274 _flushall @275 @@ -288,8 +288,8 @@ _fsopen @282 _fstat @283 _fstat64 @284 - _fstati64 @285 - _ftime @286 + ;_fstati64 @285 + ;_ftime @286 ; _ftime64 @287 _ftol @288 _fullpath @289 @@ -513,7 +513,7 @@ _splitpath @507 _stat @508 _stat64 @509 - _stati64 @510 + ;_stati64 @510 _statusfp @511 _strcmpi @512 _strdate @513 @@ -593,12 +593,12 @@ _wexecvp @587 _wexecvpe @588 _wfdopen @589 - _wfindfirst @590 + ;_wfindfirst @590 ; _wfindfirst64 @591 - _wfindfirsti64 @592 - _wfindnext @593 + ;_wfindfirsti64 @592 + ;_wfindnext @593 ; _wfindnext64 @594 - _wfindnexti64 @595 + ;_wfindnexti64 @595 _wfopen @596 _wfreopen @597 _wfsopen @598 @@ -635,7 +635,7 @@ _wsplitpath @629 _wstat @630 _wstat64 @631 - _wstati64 @632 + ;_wstati64 @632 _wstrdate @633 _wstrtime @634 _wsystem @635 Index: dll/win32/msvcrt/msvcrt.rbuild =================================================================== --- dll/win32/msvcrt/msvcrt.rbuild (Revision 37928) +++ dll/win32/msvcrt/msvcrt.rbuild (Arbeitskopie) @@ -4,6 +4,7 @@ include + Index: dll/win32/opengl32/opengl32.h =================================================================== --- dll/win32/opengl32/opengl32.h (Revision 37928) +++ dll/win32/opengl32/opengl32.h (Arbeitskopie) @@ -11,9 +11,7 @@ #ifndef OPENGL32_PRIVATE_H #define OPENGL32_PRIVATE_H -#ifdef _MSC_VER #define snwprintf _snwprintf -#endif #ifdef __cplusplus extern "C" { Index: dll/win32/rpcrt4/rpcrt4.rbuild =================================================================== --- dll/win32/rpcrt4/rpcrt4.rbuild (Revision 37928) +++ dll/win32/rpcrt4/rpcrt4.rbuild (Arbeitskopie) @@ -3,7 +3,6 @@ . include/reactos/wine - Index: drivers/base/bootvid/bootvid_amd64.def =================================================================== --- drivers/base/bootvid/bootvid_amd64.def (Revision 0) +++ drivers/base/bootvid/bootvid_amd64.def (Revision 0) @@ -0,0 +1,15 @@ +LIBRARY BOOTVID.DLL + +EXPORTS +VidBitBlt +VidBufferToScreenBlt +VidCleanUp +VidDisplayString +VidDisplayStringXY +VidInitialize +VidResetDisplay +VidScreenToBufferBlt +VidSetScrollRegion +VidSetTextColor +VidSolidColorFill + Index: drivers/network/tdi/misc/tdi.spec =================================================================== --- drivers/network/tdi/misc/tdi.spec (Revision 0) +++ drivers/network/tdi/misc/tdi.spec (Revision 0) @@ -0,0 +1,39 @@ + @ stdcall CTEAllocateString(long long) + @ stdcall CTEBlock(long) + @ stdcall CTEInitEvent(long long) + @ stdcall CTEInitString(long long) + @ stdcall CTEInitTimer(long) + @ stdcall CTEInitialize() + @ stdcall CTELogEvent(long long long long long long long) + @ stdcall CTEScheduleEvent(long long) + @ stdcall CTESignal(long long) + @ stdcall CTEStartTimer(long long long long) + @ stdcall CTESystemUpTime() + @ stdcall TdiBuildNetbiosAddress(str long ptr) + @ stdcall TdiBuildNetbiosAddressEa(str long str) + @ stdcall TdiCopyBufferToMdl(ptr long long ptr long ptr) + @ stdcall TdiCopyMdlToBuffer(ptr long long ptr long ptr) + @ stdcall TdiDefaultChainedRcvDatagramHandler(ptr long ptr long ptr long long long ptr ptr) + @ stdcall TdiDefaultChainedRcvExpeditedHandler(ptr ptr long long long ptr ptr) + @ stdcall TdiDefaultChainedReceiveHandler(ptr ptr long long long ptr ptr) + @ stdcall TdiDefaultConnectHandler(ptr long ptr long ptr long ptr ptr ptr) + @ stdcall TdiDefaultDisconnectHandler(ptr ptr long ptr long ptr long) + @ stdcall TdiDefaultErrorHandler(ptr long) + @ stdcall TdiDefaultRcvDatagramHandler(ptr long ptr long ptr long long long ptr ptr ptr) + @ stdcall TdiDefaultRcvExpeditedHandler(ptr ptr long long long ptr ptr ptr) + @ stdcall TdiDefaultReceiveHandler(ptr ptr long long long ptr ptr ptr) + @ stdcall TdiDefaultSendPossibleHandler(ptr ptr long) + @ stdcall TdiDeregisterAddressChangeHandler(ptr) + @ stdcall TdiDeregisterDeviceObject(ptr) + @ stdcall TdiDeregisterNetAddress(ptr) + @ stdcall TdiDeregisterNotificationHandler(ptr) + @ stdcall TdiInitialize(ptr) + @ stdcall TdiMapBuffer(ptr) + @ stdcall TdiMapUserRequest(ptr ptr ptr) + @ stdcall TdiOpenNetbiosAddress(long long long long) + @ stdcall TdiRegisterAddressChangeHandler(long long long) + @ stdcall TdiRegisterDeviceObject(long long) + @ stdcall TdiRegisterNetAddress(long long) + @ stdcall TdiRegisterNotificationHandler(long long long) + @ stdcall TdiReturnChainedReceives(ptr long) + @ stdcall TdiUnmapBuffer(ptr) Index: drivers/setup/blue/font.c =================================================================== --- drivers/setup/blue/font.c (Revision 37928) +++ drivers/setup/blue/font.c (Arbeitskopie) @@ -68,7 +68,7 @@ CFFILE CabFile; ULONG CabFileOffset = 0; LARGE_INTEGER ByteOffset; - WCHAR SourceBuffer[MAX_PATH] = {L'\0'}; + WCHAR SourceBuffer[_MAX_PATH] = {L'\0'}; if(KeGetCurrentIrql() != PASSIVE_LEVEL) return STATUS_INVALID_DEVICE_STATE; @@ -90,7 +90,7 @@ return(Status); SourceName.Length = 0; - SourceName.MaximumLength = MAX_PATH * sizeof(WCHAR); + SourceName.MaximumLength = _MAX_PATH * sizeof(WCHAR); SourceName.Buffer = SourceBuffer; Status = ZwQuerySymbolicLinkObject(Handle, Index: drivers/storage/scsiport/scsiport.pspec =================================================================== --- drivers/storage/scsiport/scsiport.pspec (Revision 0) +++ drivers/storage/scsiport/scsiport.pspec (Revision 0) @@ -0,0 +1,51 @@ +#ifdef __x86_64__ +#define MAYBEFWD(x) +#else +#define MAYBEFWD(x) x +#endif + +@ cdecl ScsiDebugPrint() +@ stdcall ScsiPortCompleteRequest(ptr long long long long) +@ stdcall ScsiPortConvertPhysicalAddressToUlong(long long) +@ stdcall ScsiPortConvertUlongToPhysicalAddress(long) MAYBEFWD(NTOSKRNL.RtlConvertUlongToLargeInteger) +@ stdcall ScsiPortFlushDma(ptr) +@ stdcall ScsiPortFreeDeviceBase(ptr ptr) +@ stdcall ScsiPortGetBusData(ptr long long long ptr long) +@ stdcall ScsiPortGetDeviceBase(ptr long long long long long long) +@ stdcall ScsiPortGetLogicalUnit(ptr long long long) +@ stdcall ScsiPortGetPhysicalAddress(ptr ptr ptr long) +@ stdcall ScsiPortGetSrb(ptr long long long long) +@ stdcall ScsiPortGetUncachedExtension(ptr ptr long) +@ stdcall ScsiPortGetVirtualAddress(ptr long long) +@ stdcall ScsiPortInitialize(ptr ptr ptr ptr) +@ stdcall ScsiPortIoMapTransfer(ptr ptr long long) +@ stdcall ScsiPortLogError(ptr ptr long long long long long) +@ stdcall ScsiPortMoveMemory(ptr ptr long) +@ cdecl ScsiPortNotification() +@ stdcall ScsiPortReadPortBufferUchar(ptr ptr long) MAYBEFWD(HAL.READ_PORT_BUFFER_UCHAR) +@ stdcall ScsiPortReadPortBufferUshort(ptr ptr long) MAYBEFWD(HAL.READ_PORT_BUFFER_USHORT) +@ stdcall ScsiPortReadPortBufferUlong(ptr ptr long) MAYBEFWD(HAL.READ_PORT_BUFFER_ULONG) +@ stdcall ScsiPortReadPortUchar(ptr) MAYBEFWD(HAL.READ_PORT_UCHAR) +@ stdcall ScsiPortReadPortUshort(ptr) MAYBEFWD(HAL.READ_PORT_USHORT) +@ stdcall ScsiPortReadPortUlong(ptr) MAYBEFWD(HAL.READ_PORT_ULONG) +@ stdcall ScsiPortReadRegisterBufferUchar(ptr ptr long) MAYBEFWD(NTOSKRNL.READ_REGISTER_BUFFER_UCHAR) +@ stdcall ScsiPortReadRegisterBufferUshort(ptr ptr long) MAYBEFWD(NTOSKRNL.READ_REGISTER_BUFFER_USHORT) +@ stdcall ScsiPortReadRegisterBufferUlong(ptr ptr long) MAYBEFWD(NTOSKRNL.READ_REGISTER_BUFFER_ULONG) +@ stdcall ScsiPortReadRegisterUchar(ptr) MAYBEFWD(NTOSKRNL.READ_REGISTER_UCHAR) +@ stdcall ScsiPortReadRegisterUshort(ptr) MAYBEFWD(NTOSKRNL.READ_REGISTER_USHORT) +@ stdcall ScsiPortReadRegisterUlong(ptr) MAYBEFWD(NTOSKRNL.READ_REGISTER_ULONG) +@ stdcall ScsiPortSetBusDataByOffset(ptr long long long ptr long long) +@ stdcall ScsiPortStallExecution(long) HAL.KeStallExecutionProcessor +@ stdcall ScsiPortValidateRange(ptr long long long long long long) +@ stdcall ScsiPortWritePortBufferUchar(ptr ptr long) MAYBEFWD(HAL.WRITE_PORT_BUFFER_UCHAR) +@ stdcall ScsiPortWritePortBufferUshort(ptr ptr long) MAYBEFWD(HAL.WRITE_PORT_BUFFER_USHORT) +@ stdcall ScsiPortWritePortBufferUlong(ptr ptr long) MAYBEFWD(HAL.WRITE_PORT_BUFFER_ULONG) +@ stdcall ScsiPortWritePortUchar(ptr long) MAYBEFWD(HAL.WRITE_PORT_UCHAR) +@ stdcall ScsiPortWritePortUshort(ptr long) MAYBEFWD(HAL.WRITE_PORT_USHORT) +@ stdcall ScsiPortWritePortUlong(ptr long) MAYBEFWD(HAL.WRITE_PORT_ULONG) +@ stdcall ScsiPortWriteRegisterBufferUchar(ptr ptr long) MAYBEFWD(NTOSKRNL.WRITE_REGISTER_BUFFER_UCHAR) +@ stdcall ScsiPortWriteRegisterBufferUshort(ptr ptr long) MAYBEFWD(NTOSKRNL.WRITE_REGISTER_BUFFER_USHORT) +@ stdcall ScsiPortWriteRegisterBufferUlong(ptr ptr long) MAYBEFWD(NTOSKRNL.WRITE_REGISTER_BUFFER_ULONG) +@ stdcall ScsiPortWriteRegisterUchar(ptr long) MAYBEFWD(NTOSKRNL.WRITE_REGISTER_UCHAR) +@ stdcall ScsiPortWriteRegisterUshort(ptr long) MAYBEFWD(NTOSKRNL.WRITE_REGISTER_USHORT) +@ stdcall ScsiPortWriteRegisterUlong(ptr long) MAYBEFWD(NTOSKRNL.WRITE_REGISTER_ULONG) Index: drivers/storage/scsiport/stubs.c =================================================================== --- drivers/storage/scsiport/stubs.c (Revision 0) +++ drivers/storage/scsiport/stubs.c (Revision 0) @@ -0,0 +1,250 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Storage Stack + * FILE: drivers/storage/scsiport/stubs.c + * PURPOSE: SCSI port driver + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES *****************************************************************/ + +#include +#include + +#define NDEBUG +#include + +#ifdef _MSC_VER + #define DDKAPI +#endif + +SCSI_PHYSICAL_ADDRESS +DDKAPI +ScsiPortConvertUlongToPhysicalAddress( + IN ULONG UlongAddress) +{ + return RtlConvertUlongToLargeInteger(UlongAddress); +} + +VOID +DDKAPI +ScsiPortReadPortBufferUchar( + IN PUCHAR Port, + IN PUCHAR Buffer, + IN ULONG Count) +{ + READ_PORT_BUFFER_UCHAR(Port, Buffer, Count); +} + +VOID +DDKAPI +ScsiPortReadPortBufferUshort( + IN PUSHORT Port, + IN PUSHORT Buffer, + IN ULONG Count) +{ + READ_PORT_BUFFER_USHORT(Port, Buffer, Count); +} + +VOID +DDKAPI +ScsiPortReadPortBufferUlong( + IN PULONG Port, + IN PULONG Buffer, + IN ULONG Count) +{ + READ_PORT_BUFFER_ULONG(Port, Buffer, Count); +} + +UCHAR +DDKAPI +ScsiPortReadPortUchar( + IN PUCHAR Port) +{ + return READ_PORT_UCHAR(Port); +} + +USHORT +DDKAPI +ScsiPortReadPortUshort( + IN PUSHORT Port) +{ + return READ_PORT_USHORT(Port); +} + +ULONG +DDKAPI +ScsiPortReadPortUlong( + IN PULONG Port) +{ + return READ_PORT_ULONG(Port); +} + +VOID +DDKAPI +ScsiPortReadRegisterBufferUchar( + IN PUCHAR Register, + IN PUCHAR Buffer, + IN ULONG Count) +{ + READ_REGISTER_BUFFER_UCHAR(Register, Buffer, Count); +} + +VOID +DDKAPI +ScsiPortReadRegisterBufferUshort( + IN PUSHORT Register, + IN PUSHORT Buffer, + IN ULONG Count) +{ + READ_REGISTER_BUFFER_USHORT(Register, Buffer, Count); +} + +VOID +DDKAPI +ScsiPortReadRegisterBufferUlong( + IN PULONG Register, + IN PULONG Buffer, + IN ULONG Count) +{ + READ_REGISTER_BUFFER_ULONG(Register, Buffer, Count); +} + +UCHAR +DDKAPI +ScsiPortReadRegisterUchar( + IN PUCHAR Register) +{ + return READ_REGISTER_UCHAR(Register); +} + +USHORT +DDKAPI +ScsiPortReadRegisterUshort( + IN PUSHORT Register) +{ + return READ_REGISTER_USHORT(Register); +} + +ULONG +DDKAPI +ScsiPortReadRegisterUlong( + IN PULONG Register) +{ + return READ_REGISTER_ULONG(Register); +} + +VOID +DDKAPI +ScsiPortWritePortBufferUchar( + IN PUCHAR Port, + IN PUCHAR Buffer, + IN ULONG Count) +{ + WRITE_PORT_BUFFER_UCHAR(Port, Buffer, Count); +} + +VOID +DDKAPI +ScsiPortWritePortBufferUshort( + IN PUSHORT Port, + IN PUSHORT Buffer, + IN ULONG Count) +{ + WRITE_PORT_BUFFER_USHORT(Port, Buffer, Count); +} + +VOID +DDKAPI +ScsiPortWritePortBufferUlong( + IN PULONG Port, + IN PULONG Buffer, + IN ULONG Count) +{ + WRITE_PORT_BUFFER_ULONG(Port, Buffer, Count); +} + +VOID +DDKAPI +ScsiPortWritePortUchar( + IN PUCHAR Port, + IN UCHAR Value) +{ + WRITE_PORT_UCHAR(Port, Value); +} + +VOID +DDKAPI +ScsiPortWritePortUshort( + IN PUSHORT Port, + IN USHORT Value) +{ + WRITE_PORT_USHORT(Port, Value); +} + +VOID +DDKAPI +ScsiPortWritePortUlong( + IN PULONG Port, + IN ULONG Value) +{ + WRITE_PORT_ULONG(Port, Value); +} + +VOID +DDKAPI +ScsiPortWriteRegisterBufferUchar( + IN PUCHAR Register, + IN PUCHAR Buffer, + IN ULONG Count) +{ + WRITE_REGISTER_BUFFER_UCHAR(Register, Buffer, Count); +} + +VOID +DDKAPI +ScsiPortWriteRegisterBufferUshort( + IN PUSHORT Register, + IN PUSHORT Buffer, + IN ULONG Count) +{ + WRITE_REGISTER_BUFFER_USHORT(Register, Buffer, Count); +} + +VOID +DDKAPI +ScsiPortWriteRegisterBufferUlong( + IN PULONG Register, + IN PULONG Buffer, + IN ULONG Count) +{ + WRITE_REGISTER_BUFFER_ULONG(Register, Buffer, Count); +} + +VOID +DDKAPI +ScsiPortWriteRegisterUchar( + IN PUCHAR Register, + IN ULONG Value) +{ + WRITE_REGISTER_UCHAR(Register, Value); +} + +VOID +DDKAPI +ScsiPortWriteRegisterUshort( + IN PUSHORT Register, + IN USHORT Value) +{ + WRITE_REGISTER_USHORT(Register, Value); +} + +VOID +DDKAPI +ScsiPortWriteRegisterUlong( + IN PULONG Register, + IN ULONG Value) +{ + WRITE_REGISTER_ULONG(Register, Value); +} + Index: include/crt/_mingw.h =================================================================== --- include/crt/_mingw.h (Revision 37928) +++ include/crt/_mingw.h (Arbeitskopie) @@ -1,96 +1,79 @@ -/* - * _mingw.h - * - * Mingw specific macros included by ALL include files. - * - * This file is part of the Mingw32 package. - * - * Contributors: - * Created by Mumit Khan - * - * THIS SOFTWARE IS NOT COPYRIGHTED - * - * This source code is offered for use in the public domain. You may - * use, modify or distribute it freely. - * - * This code is distributed in the hope that it will be useful but - * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAIMED. This includes but is not limited to warranties of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ -#ifndef __MINGW_H -#define __MINGW_H +#ifndef _INC_CRTDEFS +#define _INC_CRTDEFS -#if __GNUC__ >= 3 -#pragma GCC system_header +#define _INTEGRAL_MAX_BITS 64 + +#ifndef _WIN64 + #ifndef _USE_32BIT_TIME_T + #define _USE_32BIT_TIME_T + #endif #endif -/* These are defined by the user (or the compiler) - to specify how identifiers are imported from a DLL. +#ifndef MINGW64 +#define MINGW64 +#define MINGW64_VERSION 1.0 +#define MINGW64_VERSION_MAJOR 1 +#define MINGW64_VERSION_MINOR 0 +#define MINGW64_VERSION_STATE "alpha" +#endif - __DECLSPEC_SUPPORTED Defined if dllimport attribute is supported. - __MINGW_IMPORT The attribute definition to specify imported - variables/functions. - _CRTIMP As above. For MS compatibility. - __MINGW32_VERSION Runtime version. - __MINGW32_MAJOR_VERSION Runtime major version. - __MINGW32_MINOR_VERSION Runtime minor version. - __MINGW32_BUILD_DATE Runtime build date. +#ifdef _WIN64 +#ifdef __stdcall +#undef __stdcall +#endif +#define __stdcall +#endif - Other macros: - - __int64 define to be long long. Using a typedef doesn't - work for "unsigned __int64" - - All headers should include this first, and then use __DECLSPEC_SUPPORTED - to choose between the old ``__imp__name'' style or __MINGW_IMPORT - style declarations. */ - -/* Try to avoid problems with outdated checks for GCC __attribute__ support. */ -#undef __attribute__ - #if defined(_MSC_VER) # ifdef _DLL -# ifndef __MINGW_IMPORT -# define __MINGW_IMPORT __declspec(dllimport) -# endif -# ifndef _CRTIMP -# define _CRTIMP __declspec(dllimport) -# endif +# ifndef __MINGW_IMPORT +# define __MINGW_IMPORT __declspec(dllimport) +# endif +# ifndef _CRTIMP +# define _CRTIMP __declspec(dllimport) +# endif # else # ifndef __MINGW_IMPORT # define __MINGW_IMPORT # endif -# ifndef _CRTIMP -# define _CRTIMP -# endif +# ifndef _CRTIMP +# define _CRTIMP # endif +#endif # define __DECLSPEC_SUPPORTED # define __attribute__(x) /* nothing */ -# define __restrict__ /* nothing */ +# define __restrict__/* nothing */ #elif defined(__GNUC__) # ifdef __declspec # ifndef __MINGW_IMPORT # ifdef _DLL - /* Note the extern. This is needed to work around GCC's - limitations in handling dllimport attribute. */ -# define __MINGW_IMPORT extern __attribute__ ((__dllimport__)) +/* Note the extern. This is needed to work around GCC's +limitations in handling dllimport attribute. */ +# define __MINGW_IMPORT extern __attribute__ ((__dllimport__)) # else -# define __MINGW_IMPORT extern +# define __MINGW_IMPORT extern # endif # endif # ifndef _CRTIMP -# ifdef __USE_CRTIMP -# ifdef _DLL -# define _CRTIMP __attribute__ ((dllimport)) +# undef __USE_CRTIMP +# if !defined (_CRTBLD) && !defined (_SYSCRT) +# define __USE_CRTIMP 1 +# endif +# ifdef __USE_CRTIMP +# ifdef _DLL +# define _CRTIMP __attribute__ ((dllimport)) # else +# define _CRTIMP +# endif +# else # define _CRTIMP # endif -# else -# define _CRTIMP -# endif # endif # define __DECLSPEC_SUPPORTED # else /* __declspec */ @@ -100,46 +83,16 @@ # define _CRTIMP # endif # endif /* __declspec */ - -/* - The next two defines can cause problems if user code adds the __cdecl attribute - like so: - void __attribute__ ((__cdecl)) foo(void); -*/ -# ifndef __cdecl -# define __cdecl __attribute__ ((__cdecl__)) -# endif -# ifndef __stdcall -# define __stdcall __attribute__ ((__stdcall__)) -# endif -# ifndef __int64 -# define __int64 long long -# endif -# ifndef __int32 -# define __int32 long -# endif -# ifndef __int16 -# define __int16 short -# endif -# ifndef __int8 -# define __int8 char -# endif -# ifndef __small -# define __small char -# endif -# ifndef __hyper -# define __hyper long long -# endif #else # ifndef __MINGW_IMPORT -# define __MINGW_IMPORT __declspec(dllimport) +# define __MINGW_IMPORT __declspec(dllimport) # endif # ifndef _CRTIMP -# define _CRTIMP __declspec(dllimport) +# define _CRTIMP __declspec(dllimport) # endif # define __DECLSPEC_SUPPORTED -# define __attribute__(x) /* nothing */ -#endif /* __GNUC__ */ +# define __attribute__(x)/* nothing */ +#endif #if defined (__GNUC__) && defined (__GNUC_MINOR__) #define __MINGW_GNUC_PREREQ(major, minor) \ @@ -150,19 +103,21 @@ #endif #if defined (_MSC_VER) -#define __MINGW_MSC_PREREQ(major, minor) \ - ((_MSC_VER / 100) > (major) \ - || ((_MSC_VER / 100) == (major) && (_MSC_VER % 100) >= (minor))) +#define __MINGW_MSC_PREREQ(major,minor) \ + ((_MSC_VER /100) > (major) \ + || ((_MSC)VER /100) == (major) && (_MSC_VER) % 100) >=(minor))) #else -#define __MINGW_MSC_PREREQ(major, minor) 0 +#define __MINGW_MSC_PREREQ(major, minor) 0 #endif +#define USE___UUIDOF 0 + #ifdef __cplusplus # define __CRT_INLINE inline #else # if defined(_MSC_VER) # define __CRT_INLINE __inline -# elif __GNUC_STDC_INLINE__ +# elif __GNUC_STDC_INLINE__ # define __CRT_INLINE extern inline __attribute__((__gnu_inline__)) # else # define __CRT_INLINE extern __inline__ @@ -190,24 +145,9 @@ #define __MINGW_ATTRIB_CONST #endif -#if defined(__GNUC__) -#define __mingw_va_start(v,l) __builtin_va_start(v,l) -#define __mingw_va_end(v) __builtin_va_end(v) -#define __mingw_va_arg(v,l) __builtin_va_arg(v,l) -#define __mingw_va_copy(d,s) __builtin_va_copy(d,s) -#elif defined(_MSC_VER) -#define __mingw_va_start(v,l) __msc_va_start(v,l) -#define __mingw_va_end(v) __msc_va_end(v) -#define __mingw_va_arg(v,l) __msc_va_arg(v,l) -#define __mingw_va_copy(d,s) __msc_va_copy(d,s) -#endif - #if __MINGW_GNUC_PREREQ (3, 0) #define __MINGW_ATTRIB_MALLOC __attribute__ ((__malloc__)) #define __MINGW_ATTRIB_PURE __attribute__ ((__pure__)) -#elif __MINGW_MSC_PREREQ (14, 0) -#define __MINGW_ATTRIB_MALLOC __declspec(noalias) __declspec(restrict) -#define __MINGW_ATTRIB_PURE #else #define __MINGW_ATTRIB_MALLOC #define __MINGW_ATTRIB_PURE @@ -224,16 +164,16 @@ #if __MINGW_GNUC_PREREQ (3, 1) #define __MINGW_ATTRIB_DEPRECATED __attribute__ ((__deprecated__)) -#elif __MINGW_MSC_PREREQ (12, 0) -#define __MINGW_ATTRIB_DEPRECATED __declspec (deprecated) +#elif __MINGW_MSC_PREREQ(12, 0) +#define __MINGW_ATTRIB_DEPRECATED __declspec(deprecated) #else #define __MINGW_ATTRIB_DEPRECATED #endif - + #if __MINGW_GNUC_PREREQ (3, 3) #define __MINGW_NOTHROW __attribute__ ((__nothrow__)) -#elif __MINGW_MSC_PREREQ (12, 0) && defined (__cplusplus) -#define __MINGW_NOTHROW __declspec (nothrow) +#elif __MINGW_MSC_PREREQ(12, 0) && defined (__cplusplus) +#define __MINGW_NOTHROW __declspec(nothrow) #else #define __MINGW_NOTHROW #endif @@ -243,11 +183,391 @@ #ifndef __MSVCRT_VERSION__ /* High byte is the major version, low byte is the minor. */ -# define __MSVCRT_VERSION__ 0x0600 +# define __MSVCRT_VERSION__ 0x0700 #endif -#define __MINGW32_VERSION 3.13 -#define __MINGW32_MAJOR_VERSION 3 -#define __MINGW32_MINOR_VERSION 13 +#if defined(__GNUC__) +#define __mingw_va_start(v,l) __builtin_va_start(v,l) +#define __mingw_va_end(v) __builtin_va_end(v) +#define __mingw_va_arg(v,l) __builtin_va_arg(v,l) +#define __mingw_va_copy(d,s) __builtin_va_copy(d,s) +#elif defined(_MSC_VER) +#define __mingw_va_start(v,l) __msc_va_start(v,l) +#define __mingw_va_end(v) __msc_va_end(v) +#define __mingw_va_arg(v,l) __msc_va_arg(v,l) +#define __mingw_va_copy(d,s) __msc_va_copy(d,s) +#endif -#endif /* __MINGW_H */ +//#ifndef WINVER +//#define WINVER 0x0502 +//#endif + +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x502 +#endif + +#ifndef _INT128_DEFINED +#define _INT128_DEFINED +#ifdef __GNUC__ +#define __int8 char +#define __int16 short +#define __int32 int +#define __int64 long long +#ifdef _WIN64 + +typedef int __int128 __attribute__ ((mode (TI))); + +#endif + +#define __ptr32 +#define __ptr64 +#define __unaligned __attribute ((packed)) +#define __forceinline extern __inline +#endif +#endif + +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif + +#ifdef __cplusplus +#ifndef __nothrow +#define __nothrow __declspec(nothrow) +#endif +#else +#ifndef __nothrow +#define __nothrow +#endif +#endif + +#undef _CRT_PACKING +#define _CRT_PACKING 8 + +#ifdef _WIN64 +#undef USE_MINGW_SETJMP_TWO_ARGS +#define USE_MINGW_SETJMP_TWO_ARGS +#endif + +#pragma pack(push,_CRT_PACKING) + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _CRT_STRINGIZE +#define __CRT_STRINGIZE(_Value) #_Value +#define _CRT_STRINGIZE(_Value) __CRT_STRINGIZE(_Value) +#endif + +#ifndef _CRT_WIDE +#define __CRT_WIDE(_String) L ## _String +#define _CRT_WIDE(_String) __CRT_WIDE(_String) +#endif +#ifndef _W64 +#define _W64 +#endif + +#ifndef _CRTIMP_NOIA64 +#ifdef __ia64__ +#define _CRTIMP_NOIA64 +#else +#define _CRTIMP_NOIA64 _CRTIMP +#endif +#endif + +#ifndef _CRTIMP2 +#define _CRTIMP2 _CRTIMP +#endif + +#ifndef _CRTIMP_ALTERNATIVE +#define _CRTIMP_ALTERNATIVE _CRTIMP +#define _CRT_ALTERNATIVE_IMPORTED +#endif + +#ifndef _MRTIMP2 +#define _MRTIMP2 _CRTIMP +#endif + +#ifndef _DLL +#define _DLL +#endif + +#ifndef _MT +#define _MT +#endif + +#ifndef _MCRTIMP +#define _MCRTIMP _CRTIMP +#endif + +#ifndef _CRTIMP_PURE +#define _CRTIMP_PURE _CRTIMP +#endif + +#ifndef _PGLOBAL +#define _PGLOBAL +#endif + +#ifndef _AGLOBAL +#define _AGLOBAL +#endif + +#define __STDC_SECURE_LIB__ 200411L +#define __GOT_SECURE_LIB__ __STDC_SECURE_LIB__ +#define _SECURECRT_FILL_BUFFER_PATTERN 0xFD +#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated) + +#ifndef _CRT_INSECURE_DEPRECATE_MEMORY +#define _CRT_INSECURE_DEPRECATE_MEMORY(_Replacement) +#endif +#ifndef _CRT_INSECURE_DEPRECATE_GLOBALS +#define _CRT_INSECURE_DEPRECATE_GLOBALS(_Replacement) +#endif +#ifndef _CRT_MANAGED_HEAP_DEPRECATE +#define _CRT_MANAGED_HEAP_DEPRECATE +#endif + +#ifndef _CRT_OBSOLETE +#define _CRT_OBSOLETE(_NewItem) +#endif + +#ifndef _SIZE_T_DEFINED +#define _SIZE_T_DEFINED +#undef size_t +#ifdef _WIN64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef unsigned int size_t __attribute__ ((mode (DI))); +#else + typedef unsigned __int64 size_t; +#endif +#else + typedef unsigned int size_t; +#endif +#endif + +#ifndef _SSIZE_T_DEFINED +#define _SSIZE_T_DEFINED +#undef ssize_t +#ifdef _WIN64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef int ssize_t __attribute__ ((mode (DI))); +#else + typedef __int64 ssize_t; +#endif +#else + typedef int ssize_t; +#endif +#endif + +#ifndef _INTPTR_T_DEFINED +#define _INTPTR_T_DEFINED +#ifndef __intptr_t_defined +#define __intptr_t_defined +#undef intptr_t +#ifdef _WIN64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef int intptr_t __attribute__ ((mode (DI))); +#else + typedef __int64 intptr_t; +#endif +#else + typedef int intptr_t; +#endif +#endif +#endif + +#ifndef _UINTPTR_T_DEFINED +#define _UINTPTR_T_DEFINED +#ifndef __uintptr_t_defined +#define __uintptr_t_defined +#undef uintptr_t +#ifdef _WIN64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef unsigned int uintptr_t __attribute__ ((mode (DI))); +#else + typedef unsigned __int64 uintptr_t; +#endif +#else + typedef unsigned int uintptr_t; +#endif +#endif +#endif + +#ifndef _PTRDIFF_T_DEFINED +#define _PTRDIFF_T_DEFINED +#ifndef _PTRDIFF_T_ +#undef ptrdiff_t +#ifdef _WIN64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef int ptrdiff_t __attribute__ ((mode (DI))); +#else + typedef __int64 ptrdiff_t; +#endif +#else + typedef int ptrdiff_t; +#endif +#endif +#endif + +#ifndef _WCHAR_T_DEFINED +#define _WCHAR_T_DEFINED +#ifndef __cplusplus + typedef unsigned short wchar_t; +#endif +#endif + +#ifndef _WCTYPE_T_DEFINED +#define _WCTYPE_T_DEFINED + typedef unsigned short wint_t; + typedef unsigned short wctype_t; +#endif + +#ifndef __GNUC_VA_LIST +#define __GNUC_VA_LIST + typedef __builtin_va_list __gnuc_va_list; +#endif + +#ifndef _VA_LIST_DEFINED +#define _VA_LIST_DEFINED + typedef __gnuc_va_list va_list; +#endif + +#ifdef _USE_32BIT_TIME_T +#ifdef _WIN64 +#error You cannot use 32-bit time_t (_USE_32BIT_TIME_T) with _WIN64 +#undef _USE_32BIT_TIME_T +#endif +#else +#if _INTEGRAL_MAX_BITS < 64 +#define _USE_32BIT_TIME_T +#endif +#endif + +#ifndef _ERRCODE_DEFINED +#define _ERRCODE_DEFINED + typedef int errcode; + typedef int errno_t; +#endif + +#ifndef _TIME32_T_DEFINED +#define _TIME32_T_DEFINED + typedef long __time32_t; +#endif + +#ifndef _TIME64_T_DEFINED +#define _TIME64_T_DEFINED +//#if _INTEGRAL_MAX_BITS >= 64 + typedef __int64 __time64_t; +#endif +//#endif + +#ifndef _TIME_T_DEFINED +#define _TIME_T_DEFINED +#ifdef _USE_32BIT_TIME_T + typedef __time32_t time_t; +#else + typedef __time64_t time_t; +#endif +#endif + +#ifndef _CONST_RETURN +#define _CONST_RETURN +#endif + +#ifndef __CRT_UNALIGNED +#define __CRT_UNALIGNED +#endif + +#ifndef UNALIGNED +#if defined(__ia64__) || defined(__x86_64) +//#define UNALIGNED __CRT_UNALIGNED +#else +#define UNALIGNED +#endif +#endif + +#ifndef _CRT_ALIGN +#define _CRT_ALIGN(x) __attribute__ ((aligned(x))) +#endif + +#ifndef _CRTNOALIAS +#define _CRTNOALIAS +#endif + +#ifndef _CRTRESTRICT +#define _CRTRESTRICT +#endif + +#ifndef __CRTDECL +#define __CRTDECL __cdecl +#endif + +#define _ARGMAX 100 + +#ifndef _TRUNCATE +#define _TRUNCATE ((size_t)-1) +#endif + struct threadlocaleinfostruct; + struct threadmbcinfostruct; + typedef struct threadlocaleinfostruct *pthreadlocinfo; + typedef struct threadmbcinfostruct *pthreadmbcinfo; + struct __lc_time_data; + + typedef struct localeinfo_struct { + pthreadlocinfo locinfo; + pthreadmbcinfo mbcinfo; + } _locale_tstruct,*_locale_t; + +#ifndef _TAGLC_ID_DEFINED +#define _TAGLC_ID_DEFINED + typedef struct tagLC_ID { + unsigned short wLanguage; + unsigned short wCountry; + unsigned short wCodePage; + } LC_ID,*LPLC_ID; +#endif + +#ifndef _THREADLOCALEINFO +#define _THREADLOCALEINFO + typedef struct threadlocaleinfostruct { + int refcount; + unsigned int lc_codepage; + unsigned int lc_collate_cp; + unsigned long lc_handle[6]; + LC_ID lc_id[6]; + struct { + char *locale; + wchar_t *wlocale; + int *refcount; + int *wrefcount; + } lc_category[6]; + int lc_clike; + int mb_cur_max; + int *lconv_intl_refcount; + int *lconv_num_refcount; + int *lconv_mon_refcount; + struct lconv *lconv; + int *ctype1_refcount; + unsigned short *ctype1; + const unsigned short *pctype; + const unsigned char *pclmap; + const unsigned char *pcumap; + struct __lc_time_data *lc_time_curr; + } threadlocinfo; +#endif + +#ifdef __cplusplus +} +#endif + +#define __crt_typefix(ctype) + +#ifndef _CRT_UNUSED +#define _CRT_UNUSED(x) (void)x +#endif + +#pragma pack(pop) +#endif + Index: include/crt/assert.h =================================================================== --- include/crt/assert.h (Revision 37928) +++ include/crt/assert.h (Arbeitskopie) @@ -1,51 +1,58 @@ -/* - * assert.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Define the assert macro for debug output. - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ +#ifndef __ASSERT_H_ +#define __ASSERT_H_ -/* We should be able to include this file multiple times to allow the assert - macro to be enabled/disabled for different parts of code. So don't add a - header guard. */ +#include <_mingw.h> +#ifdef __cplusplus +#include +#endif -#ifndef RC_INVOKED +#ifdef NDEBUG +#ifndef assert +#define assert(_Expression) ((void)0) +#endif +#else -/* All the headers include this file. */ -#include <_mingw.h> +#ifndef _CRT_TERMINATE_DEFINED +#define _CRT_TERMINATE_DEFINED +__declspec(noreturn) void __cdecl exit(int _Code); +_CRTIMP __declspec(noreturn) void __cdecl _exit(int _Code); +#if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */ +/* C99 function name */ +void __cdecl __declspec(noreturn) _Exit(int); /* Declare to get noreturn attribute. */ +__CRT_INLINE void __cdecl _Exit(int status) +{ _exit(status); } +#endif -#undef assert +#if __MINGW_GNUC_PREREQ(4,4) +#pragma push_macro("abort") +#undef abort +#endif + void __cdecl __declspec(noreturn) abort(void); +#if __MINGW_GNUC_PREREQ(4,4) +#pragma pop_macro("abort") +#endif -#ifdef __cplusplus +#endif + +#ifdef __cplusplus extern "C" { #endif -#ifdef NDEBUG -/* - * If not debugging, assert does nothing. - */ -#define assert(x) ((void)0) +//extern void __cdecl _wassert(const wchar_t *_Message,const wchar_t *_File,unsigned _Line); -#else /* debugging enabled */ +#ifdef __cplusplus +} +#endif -/* - * CRTDLL nicely supplies a function which does the actual output and - * call to abort. - */ -_CRTIMP void __cdecl __MINGW_NOTHROW _assert (const char*, const char*, int) __MINGW_ATTRIB_NORETURN; +#ifndef assert +#define assert(_Expression) (void)((!!(_Expression)))// || (_wassert(_CRT_WIDE(#_Expression),_CRT_WIDE(__FILE__),__LINE__),0)) +#endif -/* - * Definition of the assert macro. - */ -#define assert(e) ((e) ? (void)0 : _assert(#e, __FILE__, __LINE__)) +#endif -#endif /* NDEBUG */ - -#ifdef __cplusplus -} #endif - -#endif /* Not RC_INVOKED */ Index: include/crt/complex.h =================================================================== --- include/crt/complex.h (Revision 37928) +++ include/crt/complex.h (Arbeitskopie) @@ -1,3 +1,8 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ /* * complex.h * @@ -46,11 +51,11 @@ #ifndef RC_INVOKED -double __MINGW_ATTRIB_CONST creal (double _Complex); -double __MINGW_ATTRIB_CONST cimag (double _Complex); -double __MINGW_ATTRIB_CONST carg (double _Complex); -double __MINGW_ATTRIB_CONST cabs (double _Complex); -double _Complex __MINGW_ATTRIB_CONST conj (double _Complex); +double creal (double _Complex); +double cimag (double _Complex); +double carg (double _Complex); +double cabs (double _Complex); +double _Complex conj (double _Complex); double _Complex cacos (double _Complex); double _Complex casin (double _Complex); double _Complex catan (double _Complex); @@ -67,13 +72,13 @@ double _Complex clog (double _Complex); double _Complex cpow (double _Complex, double _Complex); double _Complex csqrt (double _Complex); -double _Complex __MINGW_ATTRIB_CONST cproj (double _Complex); +double _Complex cproj (double _Complex); -float __MINGW_ATTRIB_CONST crealf (float _Complex); -float __MINGW_ATTRIB_CONST cimagf (float _Complex); -float __MINGW_ATTRIB_CONST cargf (float _Complex); -float __MINGW_ATTRIB_CONST cabsf (float _Complex); -float _Complex __MINGW_ATTRIB_CONST conjf (float _Complex); +float crealf (float _Complex); +float cimagf (float _Complex); +float cargf (float _Complex); +float cabsf (float _Complex); +float _Complex conjf (float _Complex); float _Complex cacosf (float _Complex); float _Complex casinf (float _Complex); float _Complex catanf (float _Complex); @@ -90,13 +95,13 @@ float _Complex clogf (float _Complex); float _Complex cpowf (float _Complex, float _Complex); float _Complex csqrtf (float _Complex); -float _Complex __MINGW_ATTRIB_CONST cprojf (float _Complex); +float _Complex cprojf (float _Complex); -long double __MINGW_ATTRIB_CONST creall (long double _Complex); -long double __MINGW_ATTRIB_CONST cimagl (long double _Complex); -long double __MINGW_ATTRIB_CONST cargl (long double _Complex); -long double __MINGW_ATTRIB_CONST cabsl (long double _Complex); -long double _Complex __MINGW_ATTRIB_CONST conjl (long double _Complex); +long double creall (long double _Complex); +long double cimagl (long double _Complex); +long double cargl (long double _Complex); +long double cabsl (long double _Complex); +long double _Complex conjl (long double _Complex); long double _Complex cacosl (long double _Complex); long double _Complex casinl (long double _Complex); long double _Complex catanl (long double _Complex); @@ -113,27 +118,27 @@ long double _Complex clogl (long double _Complex); long double _Complex cpowl (long double _Complex, long double _Complex); long double _Complex csqrtl (long double _Complex); -long double _Complex __MINGW_ATTRIB_CONST cprojl (long double _Complex); +long double _Complex cprojl (long double _Complex); #ifdef __GNUC__ /* double */ -__CRT_INLINE double __MINGW_ATTRIB_CONST creal (double _Complex _Z) +__CRT_INLINE double creal (double _Complex _Z) { return __real__ _Z; } -__CRT_INLINE double __MINGW_ATTRIB_CONST cimag (double _Complex _Z) +__CRT_INLINE double cimag (double _Complex _Z) { return __imag__ _Z; } -__CRT_INLINE double _Complex __MINGW_ATTRIB_CONST conj (double _Complex _Z) +__CRT_INLINE double _Complex conj (double _Complex _Z) { return __extension__ ~_Z; } -__CRT_INLINE double __MINGW_ATTRIB_CONST carg (double _Complex _Z) +__CRT_INLINE double carg (double _Complex _Z) { double res; __asm__ ("fpatan;" @@ -143,22 +148,22 @@ /* float */ -__CRT_INLINE float __MINGW_ATTRIB_CONST crealf (float _Complex _Z) +__CRT_INLINE float crealf (float _Complex _Z) { return __real__ _Z; } -__CRT_INLINE float __MINGW_ATTRIB_CONST cimagf (float _Complex _Z) +__CRT_INLINE float cimagf (float _Complex _Z) { return __imag__ _Z; } -__CRT_INLINE float _Complex __MINGW_ATTRIB_CONST conjf (float _Complex _Z) +__CRT_INLINE float _Complex conjf (float _Complex _Z) { return __extension__ ~_Z; } -__CRT_INLINE float __MINGW_ATTRIB_CONST cargf (float _Complex _Z) +__CRT_INLINE float cargf (float _Complex _Z) { float res; __asm__ ("fpatan;" @@ -167,22 +172,22 @@ } /* long double */ -__CRT_INLINE long double __MINGW_ATTRIB_CONST creall (long double _Complex _Z) +__CRT_INLINE long double creall (long double _Complex _Z) { return __real__ _Z; } -__CRT_INLINE long double __MINGW_ATTRIB_CONST cimagl (long double _Complex _Z) +__CRT_INLINE long double cimagl (long double _Complex _Z) { return __imag__ _Z; } -__CRT_INLINE long double _Complex __MINGW_ATTRIB_CONST conjl (long double _Complex _Z) +__CRT_INLINE long double _Complex conjl (long double _Complex _Z) { return __extension__ ~_Z; } -__CRT_INLINE long double __MINGW_ATTRIB_CONST cargl (long double _Complex _Z) +__CRT_INLINE long double cargl (long double _Complex _Z) { long double res; __asm__ ("fpatan;" Index: include/crt/conio.h =================================================================== --- include/crt/conio.h (Revision 37928) +++ include/crt/conio.h (Arbeitskopie) @@ -1,53 +1,101 @@ -/* - * conio.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Low level console I/O functions. Pretty please try to use the ANSI - * standard ones if you are writing new code. - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ +#ifndef _INC_CONIO +#define _INC_CONIO -#ifndef _CONIO_H_ -#define _CONIO_H_ - -/* All the headers include this file. */ #include <_mingw.h> -#ifndef RC_INVOKED - -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif -_CRTIMP char* __cdecl __MINGW_NOTHROW _cgets (char*); -_CRTIMP int __cdecl __MINGW_NOTHROW _cprintf (const char*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW _cputs (const char*); -_CRTIMP int __cdecl __MINGW_NOTHROW _cscanf (char*, ...); + _CRTIMP char *_cgets(char *_Buffer); + _CRTIMP int __cdecl _cprintf(const char *_Format,...); + _CRTIMP int __cdecl _cputs(const char *_Str); + _CRTIMP int __cdecl _cscanf(const char *_Format,...); + _CRTIMP int __cdecl _cscanf_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _getch(void); + _CRTIMP int __cdecl _getche(void); + _CRTIMP int __cdecl _vcprintf(const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _cprintf_p(const char *_Format,...); + _CRTIMP int __cdecl _vcprintf_p(const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _cprintf_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcprintf_l(const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _cprintf_p_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcprintf_p_l(const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _kbhit(void); -_CRTIMP int __cdecl __MINGW_NOTHROW _getch (void); -_CRTIMP int __cdecl __MINGW_NOTHROW _getche (void); -_CRTIMP int __cdecl __MINGW_NOTHROW _kbhit (void); -_CRTIMP int __cdecl __MINGW_NOTHROW _putch (int); -_CRTIMP int __cdecl __MINGW_NOTHROW _ungetch (int); +#if defined(_X86_) && !defined(__x86_64) + int __cdecl _inp(unsigned short); + unsigned short __cdecl _inpw(unsigned short); + unsigned long __cdecl _inpd(unsigned short); + int __cdecl _outp(unsigned short,int); + unsigned short __cdecl _outpw(unsigned short,unsigned short); + unsigned long __cdecl _outpd(unsigned short,unsigned long); +#endif + _CRTIMP int __cdecl _putch(int _Ch); + _CRTIMP int __cdecl _ungetch(int _Ch); + _CRTIMP int __cdecl _getch_nolock(void); + _CRTIMP int __cdecl _getche_nolock(void); + _CRTIMP int __cdecl _putch_nolock(int _Ch); + _CRTIMP int __cdecl _ungetch_nolock(int _Ch); -#ifndef _NO_OLDNAMES +#ifndef _WCONIO_DEFINED +#define _WCONIO_DEFINED -_CRTIMP int __cdecl __MINGW_NOTHROW getch (void); -_CRTIMP int __cdecl __MINGW_NOTHROW getche (void); -_CRTIMP int __cdecl __MINGW_NOTHROW kbhit (void); -_CRTIMP int __cdecl __MINGW_NOTHROW putch (int); -_CRTIMP int __cdecl __MINGW_NOTHROW ungetch (int); +#ifndef WEOF +#define WEOF (wint_t)(0xFFFF) +#endif -#endif /* Not _NO_OLDNAMES */ + _CRTIMP wchar_t *_cgetws(wchar_t *_Buffer); + _CRTIMP wint_t __cdecl _getwch(void); + _CRTIMP wint_t __cdecl _getwche(void); + _CRTIMP wint_t __cdecl _putwch(wchar_t _WCh); + _CRTIMP wint_t __cdecl _ungetwch(wint_t _WCh); + _CRTIMP int __cdecl _cputws(const wchar_t *_String); + _CRTIMP int __cdecl _cwprintf(const wchar_t *_Format,...); + _CRTIMP int __cdecl _cwscanf(const wchar_t *_Format,...); + _CRTIMP int __cdecl _cwscanf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _cwprintf_p(const wchar_t *_Format,...); + _CRTIMP int __cdecl _vcwprintf_p(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _cwprintf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _cwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP wint_t __cdecl _putwch_nolock(wchar_t _WCh); + _CRTIMP wint_t __cdecl _getwch_nolock(void); + _CRTIMP wint_t __cdecl _getwche_nolock(void); + _CRTIMP wint_t __cdecl _ungetwch_nolock(wint_t _WCh); +#endif +#ifndef NO_OLDNAMES + char *__cdecl cgets(char *_Buffer); + int __cdecl cprintf(const char *_Format,...); + int __cdecl cputs(const char *_Str); + int __cdecl cscanf(const char *_Format,...); + int __cdecl getch(void); + int __cdecl getche(void); + int __cdecl kbhit(void); + int __cdecl putch(int _Ch); + int __cdecl ungetch(int _Ch); -#ifdef __cplusplus +#if (defined(_X86_) && !defined(__x86_64)) + int __cdecl inp(unsigned short); + unsigned short __cdecl inpw(unsigned short); + int __cdecl outp(unsigned short,int); + unsigned short __cdecl outpw(unsigned short,unsigned short); +#endif + +#endif +#ifdef __cplusplus } #endif -#endif /* Not RC_INVOKED */ +#include -#endif /* Not _CONIO_H_ */ +#endif Index: include/crt/ctype.h =================================================================== --- include/crt/ctype.h (Revision 37928) +++ include/crt/ctype.h (Arbeitskopie) @@ -1,280 +1,281 @@ -/* - * ctype.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Functions for testing character types and converting characters. - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ +#ifndef _INC_CTYPE +#define _INC_CTYPE -#ifndef _CTYPE_H_ -#define _CTYPE_H_ - -/* All the headers include this file. */ #include <_mingw.h> -#define __need_wchar_t -#define __need_wint_t -#ifndef RC_INVOKED -#include -#endif /* Not RC_INVOKED */ - - -/* - * The following flags are used to tell iswctype and _isctype what character - * types you are looking for. - */ -#define _UPPER 0x0001 -#define _LOWER 0x0002 -#define _DIGIT 0x0004 -#define _SPACE 0x0008 /* HT LF VT FF CR SP */ -#define _PUNCT 0x0010 -#define _CONTROL 0x0020 -/* _BLANK is set for SP and non-ASCII horizontal space chars (eg, - "no-break space", 0xA0, in CP1250) but not for HT. */ -#define _BLANK 0x0040 -#define _HEX 0x0080 -#define _LEADBYTE 0x8000 - -#define _ALPHA 0x0103 - -#ifndef RC_INVOKED - #ifdef __cplusplus extern "C" { #endif -_CRTIMP int __cdecl __MINGW_NOTHROW isalnum(int); -_CRTIMP int __cdecl __MINGW_NOTHROW isalpha(int); -_CRTIMP int __cdecl __MINGW_NOTHROW iscntrl(int); -_CRTIMP int __cdecl __MINGW_NOTHROW isdigit(int); -_CRTIMP int __cdecl __MINGW_NOTHROW isgraph(int); -_CRTIMP int __cdecl __MINGW_NOTHROW islower(int); -_CRTIMP int __cdecl __MINGW_NOTHROW isprint(int); -_CRTIMP int __cdecl __MINGW_NOTHROW ispunct(int); -_CRTIMP int __cdecl __MINGW_NOTHROW isspace(int); -_CRTIMP int __cdecl __MINGW_NOTHROW isupper(int); -_CRTIMP int __cdecl __MINGW_NOTHROW isxdigit(int); +#ifndef WEOF +#define WEOF (wint_t)(0xFFFF) +#endif -#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \ - || !defined __STRICT_ANSI__ -int __cdecl __MINGW_NOTHROW isblank (int); +#ifndef _CRT_CTYPEDATA_DEFINED +#define _CRT_CTYPEDATA_DEFINED +#ifndef _CTYPE_DISABLE_MACROS + +#ifndef __PCTYPE_FUNC +#define __PCTYPE_FUNC __pctype_func() +#ifdef _MSVCRT_ +#define __pctype_func() (_pctype) +#else +#define __pctype_func() (*_imp___pctype) #endif +#endif -#ifndef __STRICT_ANSI__ -_CRTIMP int __cdecl __MINGW_NOTHROW _isctype (int, int); +#ifndef _pctype +#ifdef _MSVCRT_ + extern const unsigned short *_pctype; +#else + extern const unsigned short **_imp___pctype; +#define _pctype (*_imp___pctype) #endif +#endif -/* These are the ANSI versions, with correct checking of argument */ -_CRTIMP int __cdecl __MINGW_NOTHROW tolower(int); -_CRTIMP int __cdecl __MINGW_NOTHROW toupper(int); +#endif +#endif -/* - * NOTE: The above are not old name type wrappers, but functions exported - * explicitly by MSVCRT/CRTDLL. However, underscored versions are also - * exported. - */ -#ifndef __STRICT_ANSI__ -/* - * These are the cheap non-std versions: The return values are undefined - * if the argument is not ASCII char or is not of appropriate case - */ -_CRTIMP int __cdecl __MINGW_NOTHROW _tolower(int); -_CRTIMP int __cdecl __MINGW_NOTHROW _toupper(int); +#ifndef _CRT_WCTYPEDATA_DEFINED +#define _CRT_WCTYPEDATA_DEFINED +#ifndef _CTYPE_DISABLE_MACROS +#ifndef _wctype +#ifdef _MSVCRT_ + extern unsigned short *_wctype; +#else + extern unsigned short **_imp___wctype; +#define _wctype (*_imp___wctype) #endif +#endif +#ifdef _MSVCRT_ +#define __pwctype_func() (_pwctype) +#ifndef _pwctype + extern const unsigned short *_pwctype; +#endif +#else +#define __pwctype_func() (*_imp___pwctype) +#ifndef _pwctype + extern const unsigned short **_imp___pwctype; +#define _pwctype (*_imp___pwctype) +#endif +#endif +#endif +#endif -/* Also defined in stdlib.h */ -#ifndef MB_CUR_MAX -#ifdef __DECLSPEC_SUPPORTED -# ifdef __MSVCRT__ -# define MB_CUR_MAX __mb_cur_max - __MINGW_IMPORT int __mb_cur_max; -# else /* not __MSVCRT */ -# define MB_CUR_MAX __mb_cur_max_dll - __MINGW_IMPORT int __mb_cur_max_dll; -# endif /* not __MSVCRT */ + /* CRT stuff */ +#if 1 + extern const unsigned char __newclmap[]; + extern const unsigned char __newcumap[]; + extern pthreadlocinfo __ptlocinfo; + extern pthreadmbcinfo __ptmbcinfo; + extern int __globallocalestatus; + extern int __locale_changed; + extern struct threadlocaleinfostruct __initiallocinfo; + extern _locale_tstruct __initiallocalestructinfo; + pthreadlocinfo __cdecl __updatetlocinfo(void); + pthreadmbcinfo __cdecl __updatetmbcinfo(void); +#endif -#else /* ! __DECLSPEC_SUPPORTED */ -# ifdef __MSVCRT__ - extern int* _imp____mbcur_max; -# define MB_CUR_MAX (*_imp____mb_cur_max) -# else /* not __MSVCRT */ - extern int* _imp____mbcur_max_dll; -# define MB_CUR_MAX (*_imp____mb_cur_max_dll) -# endif /* not __MSVCRT */ -#endif /* __DECLSPEC_SUPPORTED */ -#endif /* MB_CUR_MAX */ +#define _UPPER 0x1 +#define _LOWER 0x2 +#define _DIGIT 0x4 +#define _SPACE 0x8 -#ifndef _WCTYPE_H_ -#ifdef __DECLSPEC_SUPPORTED -# if __MSVCRT_VERSION__ <= 0x0700 - __MINGW_IMPORT unsigned short _ctype[]; -# endif -# ifdef __MSVCRT__ - __MINGW_IMPORT const unsigned short* _pctype; -# else /* CRTDLL */ - __MINGW_IMPORT const unsigned short* _pctype_dll; -# define _pctype _pctype_dll -# endif +#define _PUNCT 0x10 +#define _CONTROL 0x20 +#define _BLANK 0x40 +#define _HEX 0x80 -#else /* __DECLSPEC_SUPPORTED */ -# if __MSVCRT_VERSION__ <= 0x0700 - extern unsigned short** _imp___ctype; -# define _ctype (*_imp___ctype) -# endif -# ifdef __MSVCRT__ - extern unsigned short** _imp___pctype; -# define _pctype (*_imp___pctype) -# else /* CRTDLL */ - extern unsigned short** _imp___pctype_dll; -# define _pctype (*_imp___pctype_dll) -# endif /* CRTDLL */ -#endif /* __DECLSPEC_SUPPORTED */ -#endif +#define _LEADBYTE 0x8000 +#define _ALPHA (0x0100|_UPPER|_LOWER) -/* - * Use inlines here rather than macros, because macros will upset - * C++ usage (eg, ::isalnum), and so usually get undefined - * - * According to standard for SB chars, these function are defined only - * for input values representable by unsigned char or EOF. - * Thus, there is no range test. - * This reproduces behaviour of MSVCRT.dll lib implemention for SB chars. - * - * If no MB char support is needed, these can be simplified even - * more by command line define -DMB_CUR_MAX=1. The compiler will then - * optimise away the constant condition. - */ +#ifndef _CTYPE_DEFINED +#define _CTYPE_DEFINED -#if !(defined (__NO_INLINE__) || defined (__NO_CTYPE_INLINES) \ - || defined (__STRICT_ANSI__)) + _CRTIMP int __cdecl _isctype(int _C,int _Type); + _CRTIMP int __cdecl _isctype_l(int _C,int _Type,_locale_t _Locale); + _CRTIMP int __cdecl isalpha(int _C); + _CRTIMP int __cdecl _isalpha_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl isupper(int _C); + _CRTIMP int __cdecl _isupper_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl islower(int _C); + _CRTIMP int __cdecl _islower_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl isdigit(int _C); + _CRTIMP int __cdecl _isdigit_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl isxdigit(int _C); + _CRTIMP int __cdecl _isxdigit_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl isspace(int _C); + _CRTIMP int __cdecl _isspace_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl ispunct(int _C); + _CRTIMP int __cdecl _ispunct_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl isalnum(int _C); + _CRTIMP int __cdecl _isalnum_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl isprint(int _C); + _CRTIMP int __cdecl _isprint_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl isgraph(int _C); + _CRTIMP int __cdecl _isgraph_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl iscntrl(int _C); + _CRTIMP int __cdecl _iscntrl_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl toupper(int _C); + _CRTIMP int __cdecl tolower(int _C); + _CRTIMP int __cdecl _tolower(int _C); + _CRTIMP int __cdecl _tolower_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl _toupper(int _C); + _CRTIMP int __cdecl _toupper_l(int _C,_locale_t _Locale); + _CRTIMP int __cdecl __isascii(int _C); + _CRTIMP int __cdecl __toascii(int _C); + _CRTIMP int __cdecl __iscsymf(int _C); + _CRTIMP int __cdecl __iscsym(int _C); -/* use simple lookup if SB locale, else _isctype() */ -#define __ISCTYPE(c, mask) (MB_CUR_MAX == 1 ? (_pctype[c] & mask) : _isctype(c, mask)) -__CRT_INLINE int __cdecl __MINGW_NOTHROW isalnum(int c) {return __ISCTYPE(c, (_ALPHA|_DIGIT));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW isalpha(int c) {return __ISCTYPE(c, _ALPHA);} -__CRT_INLINE int __cdecl __MINGW_NOTHROW iscntrl(int c) {return __ISCTYPE(c, _CONTROL);} -__CRT_INLINE int __cdecl __MINGW_NOTHROW isdigit(int c) {return __ISCTYPE(c, _DIGIT);} -__CRT_INLINE int __cdecl __MINGW_NOTHROW isgraph(int c) {return __ISCTYPE(c, (_PUNCT|_ALPHA|_DIGIT));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW islower(int c) {return __ISCTYPE(c, _LOWER);} -__CRT_INLINE int __cdecl __MINGW_NOTHROW isprint(int c) {return __ISCTYPE(c, (_BLANK|_PUNCT|_ALPHA|_DIGIT));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW ispunct(int c) {return __ISCTYPE(c, _PUNCT);} -__CRT_INLINE int __cdecl __MINGW_NOTHROW isspace(int c) {return __ISCTYPE(c, _SPACE);} -__CRT_INLINE int __cdecl __MINGW_NOTHROW isupper(int c) {return __ISCTYPE(c, _UPPER);} -__CRT_INLINE int __cdecl __MINGW_NOTHROW isxdigit(int c) {return __ISCTYPE(c, _HEX);} - -#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \ - || !defined __STRICT_ANSI__ -__CRT_INLINE int __cdecl __MINGW_NOTHROW isblank (int c) - {return (__ISCTYPE(c, _BLANK) || c == '\t');} +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES) +int __cdecl isblank(int _C); #endif +#endif -/* these reproduce behaviour of lib underscored versions */ -__CRT_INLINE int __cdecl __MINGW_NOTHROW _tolower(int c) {return ( c -'A'+'a');} -__CRT_INLINE int __cdecl __MINGW_NOTHROW _toupper(int c) {return ( c -'a'+'A');} +#ifndef _WCTYPE_DEFINED +#define _WCTYPE_DEFINED -/* TODO? Is it worth inlining ANSI tolower, toupper? Probably only - if we only want C-locale. */ + int __cdecl iswalpha(wint_t _C); + _CRTIMP int __cdecl _iswalpha_l(wint_t _C,_locale_t _Locale); + int __cdecl iswupper(wint_t _C); + _CRTIMP int __cdecl _iswupper_l(wint_t _C,_locale_t _Locale); + int __cdecl iswlower(wint_t _C); + _CRTIMP int __cdecl _iswlower_l(wint_t _C,_locale_t _Locale); + int __cdecl iswdigit(wint_t _C); + _CRTIMP int __cdecl _iswdigit_l(wint_t _C,_locale_t _Locale); + int __cdecl iswxdigit(wint_t _C); + _CRTIMP int __cdecl _iswxdigit_l(wint_t _C,_locale_t _Locale); + int __cdecl iswspace(wint_t _C); + _CRTIMP int __cdecl _iswspace_l(wint_t _C,_locale_t _Locale); + int __cdecl iswpunct(wint_t _C); + _CRTIMP int __cdecl _iswpunct_l(wint_t _C,_locale_t _Locale); + int __cdecl iswalnum(wint_t _C); + _CRTIMP int __cdecl _iswalnum_l(wint_t _C,_locale_t _Locale); + int __cdecl iswprint(wint_t _C); + _CRTIMP int __cdecl _iswprint_l(wint_t _C,_locale_t _Locale); + int __cdecl iswgraph(wint_t _C); + _CRTIMP int __cdecl _iswgraph_l(wint_t _C,_locale_t _Locale); + int __cdecl iswcntrl(wint_t _C); + _CRTIMP int __cdecl _iswcntrl_l(wint_t _C,_locale_t _Locale); + int __cdecl iswascii(wint_t _C); + int __cdecl isleadbyte(int _C); + _CRTIMP int __cdecl _isleadbyte_l(int _C,_locale_t _Locale); + wint_t __cdecl towupper(wint_t _C); + _CRTIMP wint_t __cdecl _towupper_l(wint_t _C,_locale_t _Locale); + wint_t __cdecl towlower(wint_t _C); + _CRTIMP wint_t __cdecl _towlower_l(wint_t _C,_locale_t _Locale); + int __cdecl iswctype(wint_t _C,wctype_t _Type); + _CRTIMP int __cdecl _iswctype_l(wint_t _C,wctype_t _Type,_locale_t _Locale); + _CRTIMP int __cdecl __iswcsymf(wint_t _C); + _CRTIMP int __cdecl _iswcsymf_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl __iswcsym(wint_t _C); + _CRTIMP int __cdecl _iswcsym_l(wint_t _C,_locale_t _Locale); + int __cdecl is_wctype(wint_t _C,wctype_t _Type); -#endif /* _NO_CTYPE_INLINES */ - -/* Wide character equivalents */ - -#ifndef WEOF -#define WEOF (wchar_t)(0xFFFF) +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES) +int __cdecl iswblank(wint_t _C); #endif - -#ifndef _WCTYPE_T_DEFINED -typedef wchar_t wctype_t; -#define _WCTYPE_T_DEFINED #endif -_CRTIMP int __cdecl __MINGW_NOTHROW iswctype(wint_t, wctype_t); -_CRTIMP int __cdecl __MINGW_NOTHROW is_wctype(wint_t, wctype_t); /* Obsolete! */ +#ifndef _CTYPE_DISABLE_MACROS -#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \ - || !defined __STRICT_ANSI__ || defined __cplusplus -int __cdecl __MINGW_NOTHROW iswblank (wint_t); +#ifndef MB_CUR_MAX +#define MB_CUR_MAX ___mb_cur_max_func() +#ifndef __mb_cur_max +#ifdef _MSVCRT_ + extern int __mb_cur_max; +#else +#define __mb_cur_max (*_imp____mb_cur_max) + extern int *_imp____mb_cur_max; #endif +#endif +#ifdef _MSVCRT_ +#define ___mb_cur_max_func() (__mb_cur_max) +#else +#define ___mb_cur_max_func() (*_imp____mb_cur_max) +#endif +#endif -/* Older MS docs uses wchar_t for arg and return type, while newer - online MS docs say arg is wint_t and return is int. - ISO C uses wint_t for both. */ -_CRTIMP wint_t __cdecl __MINGW_NOTHROW towlower (wint_t); -_CRTIMP wint_t __cdecl __MINGW_NOTHROW towupper (wint_t); +#define __chvalidchk(a,b) (__PCTYPE_FUNC[(a)] & (b)) +#define _chvalidchk_l(_Char,_Flag,_Locale) (!_Locale ? __chvalidchk(_Char,_Flag) : ((_locale_t)_Locale)->locinfo->pctype[_Char] & (_Flag)) +#define _ischartype_l(_Char,_Flag,_Locale) (((_Locale)!=NULL && (((_locale_t)(_Locale))->locinfo->mb_cur_max) > 1) ? _isctype_l(_Char,(_Flag),_Locale) : _chvalidchk_l(_Char,_Flag,_Locale)) +#define _isalpha_l(_Char,_Locale) _ischartype_l(_Char,_ALPHA,_Locale) +#define _isupper_l(_Char,_Locale) _ischartype_l(_Char,_UPPER,_Locale) +#define _islower_l(_Char,_Locale) _ischartype_l(_Char,_LOWER,_Locale) +#define _isdigit_l(_Char,_Locale) _ischartype_l(_Char,_DIGIT,_Locale) +#define _isxdigit_l(_Char,_Locale) _ischartype_l(_Char,_HEX,_Locale) +#define _isspace_l(_Char,_Locale) _ischartype_l(_Char,_SPACE,_Locale) +#define _ispunct_l(_Char,_Locale) _ischartype_l(_Char,_PUNCT,_Locale) +#define _isalnum_l(_Char,_Locale) _ischartype_l(_Char,_ALPHA|_DIGIT,_Locale) +#define _isprint_l(_Char,_Locale) _ischartype_l(_Char,_BLANK|_PUNCT|_ALPHA|_DIGIT,_Locale) +#define _isgraph_l(_Char,_Locale) _ischartype_l(_Char,_PUNCT|_ALPHA|_DIGIT,_Locale) +#define _iscntrl_l(_Char,_Locale) _ischartype_l(_Char,_CONTROL,_Locale) +#define _tolower(_Char) ((_Char)-'A'+'a') +#define _toupper(_Char) ((_Char)-'a'+'A') +#define __isascii(_Char) ((unsigned)(_Char) < 0x80) +#define __toascii(_Char) ((_Char) & 0x7f) -_CRTIMP int __cdecl __MINGW_NOTHROW isleadbyte (int); +#ifndef _WCTYPE_INLINE_DEFINED +#define _WCTYPE_INLINE_DEFINED -/* Also in wctype.h */ -#if ! (defined (__NO_INLINE__) || defined(__NO_CTYPE_INLINES) \ - || defined(__WCTYPE_INLINES_DEFINED)) -#define __WCTYPE_INLINES_DEFINED -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswalnum(wint_t wc) {return (iswctype(wc,_ALPHA|_DIGIT));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswalpha(wint_t wc) {return (iswctype(wc,_ALPHA));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswascii(wint_t wc) {return ((wc & ~0x7F) ==0);} -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswcntrl(wint_t wc) {return (iswctype(wc,_CONTROL));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswdigit(wint_t wc) {return (iswctype(wc,_DIGIT));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswgraph(wint_t wc) {return (iswctype(wc,_PUNCT|_ALPHA|_DIGIT));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswlower(wint_t wc) {return (iswctype(wc,_LOWER));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswprint(wint_t wc) {return (iswctype(wc,_BLANK|_PUNCT|_ALPHA|_DIGIT));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswpunct(wint_t wc) {return (iswctype(wc,_PUNCT));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswspace(wint_t wc) {return (iswctype(wc,_SPACE));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswupper(wint_t wc) {return (iswctype(wc,_UPPER));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswxdigit(wint_t wc) {return (iswctype(wc,_HEX));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW isleadbyte(int c) {return (_pctype[(unsigned char)(c)] & _LEADBYTE);} -#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \ - || !defined __STRICT_ANSI__ || defined __cplusplus -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswblank (wint_t wc) - {return (iswctype(wc,_BLANK) || wc == L'\t');} +#undef _CRT_WCTYPE_NOINLINE +#ifndef __cplusplus +#define iswalpha(_c) (iswctype(_c,_ALPHA)) +#define iswupper(_c) (iswctype(_c,_UPPER)) +#define iswlower(_c) (iswctype(_c,_LOWER)) +#define iswdigit(_c) (iswctype(_c,_DIGIT)) +#define iswxdigit(_c) (iswctype(_c,_HEX)) +#define iswspace(_c) (iswctype(_c,_SPACE)) +#define iswpunct(_c) (iswctype(_c,_PUNCT)) +#define iswalnum(_c) (iswctype(_c,_ALPHA|_DIGIT)) +#define iswprint(_c) (iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT)) +#define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT)) +#define iswcntrl(_c) (iswctype(_c,_CONTROL)) +#define iswascii(_c) ((unsigned)(_c) < 0x80) +#define _iswalpha_l(_c,_p) (_iswctype_l(_c,_ALPHA,_p)) +#define _iswupper_l(_c,_p) (_iswctype_l(_c,_UPPER,_p)) +#define _iswlower_l(_c,_p) (_iswctype_l(_c,_LOWER,_p)) +#define _iswdigit_l(_c,_p) (_iswctype_l(_c,_DIGIT,_p)) +#define _iswxdigit_l(_c,_p) (_iswctype_l(_c,_HEX,_p)) +#define _iswspace_l(_c,_p) (_iswctype_l(_c,_SPACE,_p)) +#define _iswpunct_l(_c,_p) (_iswctype_l(_c,_PUNCT,_p)) +#define _iswalnum_l(_c,_p) (_iswctype_l(_c,_ALPHA|_DIGIT,_p)) +#define _iswprint_l(_c,_p) (_iswctype_l(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT,_p)) +#define _iswgraph_l(_c,_p) (_iswctype_l(_c,_PUNCT|_ALPHA|_DIGIT,_p)) +#define _iswcntrl_l(_c,_p) (_iswctype_l(_c,_CONTROL,_p)) #endif +#endif -#endif /* !(defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED)) */ +#define __iscsymf(_c) (isalpha(_c) || ((_c)=='_')) +#define __iscsym(_c) (isalnum(_c) || ((_c)=='_')) +#define __iswcsymf(_c) (iswalpha(_c) || ((_c)=='_')) +#define __iswcsym(_c) (iswalnum(_c) || ((_c)=='_')) +#define _iscsymf_l(_c,_p) (_isalpha_l(_c,_p) || ((_c)=='_')) +#define _iscsym_l(_c,_p) (_isalnum_l(_c,_p) || ((_c)=='_')) +#define _iswcsymf_l(_c,_p) (_iswalpha_l(_c,_p) || ((_c)=='_')) +#define _iswcsym_l(_c,_p) (_iswalnum_l(_c,_p) || ((_c)=='_')) +#endif -#ifndef __WCTYPE_INLINES_DEFINED -_CRTIMP int __cdecl __MINGW_NOTHROW iswalnum(wint_t); -_CRTIMP int __cdecl __MINGW_NOTHROW iswalpha(wint_t); -_CRTIMP int __cdecl __MINGW_NOTHROW iswascii(wint_t); -_CRTIMP int __cdecl __MINGW_NOTHROW iswcntrl(wint_t); -_CRTIMP int __cdecl __MINGW_NOTHROW iswdigit(wint_t); -_CRTIMP int __cdecl __MINGW_NOTHROW iswgraph(wint_t); -_CRTIMP int __cdecl __MINGW_NOTHROW iswlower(wint_t); -_CRTIMP int __cdecl __MINGW_NOTHROW iswprint(wint_t); -_CRTIMP int __cdecl __MINGW_NOTHROW iswpunct(wint_t); -_CRTIMP int __cdecl __MINGW_NOTHROW iswspace(wint_t); -_CRTIMP int __cdecl __MINGW_NOTHROW iswupper(wint_t); -_CRTIMP int __cdecl __MINGW_NOTHROW iswxdigit(wint_t); +#ifndef NO_OLDNAMES +#ifndef _CTYPE_DEFINED + int __cdecl isascii(int _C); + int __cdecl toascii(int _C); + int __cdecl iscsymf(int _C); + int __cdecl iscsym(int _C); +#else +#define isascii __isascii +#define toascii __toascii +#define iscsymf __iscsymf +#define iscsym __iscsym #endif +#endif -#ifndef __STRICT_ANSI__ -int __cdecl __MINGW_NOTHROW __isascii (int); -int __cdecl __MINGW_NOTHROW __toascii (int); -int __cdecl __MINGW_NOTHROW __iscsymf (int); /* Valid first character in C symbol */ -int __cdecl __MINGW_NOTHROW __iscsym (int); /* Valid character in C symbol (after first) */ - -#if !(defined (__NO_INLINE__) || defined (__NO_CTYPE_INLINES)) -__CRT_INLINE int __cdecl __MINGW_NOTHROW __isascii(int c) {return ((c & ~0x7F) == 0);} -__CRT_INLINE int __cdecl __MINGW_NOTHROW __toascii(int c) {return (c & 0x7F);} -__CRT_INLINE int __cdecl __MINGW_NOTHROW __iscsymf(int c) {return (isalpha(c) || (c == '_'));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW __iscsym(int c) {return (isalnum(c) || (c == '_'));} -#endif /* __NO_CTYPE_INLINES */ - -#ifndef _NO_OLDNAMES -/* Not _CRTIMP */ -int __cdecl __MINGW_NOTHROW isascii (int); -int __cdecl __MINGW_NOTHROW toascii (int); -int __cdecl __MINGW_NOTHROW iscsymf (int); -int __cdecl __MINGW_NOTHROW iscsym (int); -#endif /* Not _NO_OLDNAMES */ - -#endif /* Not __STRICT_ANSI__ */ - #ifdef __cplusplus } #endif - -#endif /* Not RC_INVOKED */ - -#endif /* Not _CTYPE_H_ */ - - +#endif Index: include/crt/direct.h =================================================================== --- include/crt/direct.h (Revision 37928) +++ include/crt/direct.h (Arbeitskopie) @@ -1,73 +1,68 @@ -/* - * direct.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Functions for manipulating paths and directories (included from io.h) - * plus functions for setting the current drive. - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ -#ifndef _DIRECT_H_ -#define _DIRECT_H_ +#ifndef _INC_DIRECT +#define _INC_DIRECT -/* All the headers include this file. */ #include <_mingw.h> - -#define __need_wchar_t -#ifndef RC_INVOKED -#include -#endif /* Not RC_INVOKED */ - #include -#ifndef RC_INVOKED +#pragma pack(push,_CRT_PACKING) -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif #ifndef _DISKFREE_T_DEFINED -/* needed by _getdiskfree (also in dos.h) */ -struct _diskfree_t { - unsigned total_clusters; - unsigned avail_clusters; - unsigned sectors_per_cluster; - unsigned bytes_per_sector; -}; #define _DISKFREE_T_DEFINED + struct _diskfree_t { + unsigned total_clusters; + unsigned avail_clusters; + unsigned sectors_per_cluster; + unsigned bytes_per_sector; + }; #endif -/* - * You really shouldn't be using these. Use the Win32 API functions instead. - * However, it does make it easier to port older code. - */ -_CRTIMP int __cdecl __MINGW_NOTHROW _getdrive (void); -_CRTIMP unsigned long __cdecl __MINGW_NOTHROW _getdrives(void); -_CRTIMP int __cdecl __MINGW_NOTHROW _chdrive (int); -_CRTIMP char* __cdecl __MINGW_NOTHROW _getdcwd (int, char*, int); -_CRTIMP unsigned __cdecl __MINGW_NOTHROW _getdiskfree (unsigned, struct _diskfree_t *); + _CRTIMP char *__cdecl _getcwd(char *_DstBuf,int _SizeInBytes); + _CRTIMP char *__cdecl _getdcwd(int _Drive,char *_DstBuf,int _SizeInBytes); + char *__cdecl _getdcwd_nolock(int _Drive,char *_DstBuf,int _SizeInBytes); + _CRTIMP int __cdecl _chdir(const char *_Path); + _CRTIMP int __cdecl _mkdir(const char *_Path); + _CRTIMP int __cdecl _rmdir(const char *_Path); + _CRTIMP int __cdecl _chdrive(int _Drive); + _CRTIMP int __cdecl _getdrive(void); + _CRTIMP unsigned long __cdecl _getdrives(void); -#ifndef _NO_OLDNAMES -# define diskfree_t _diskfree_t +#ifndef _GETDISKFREE_DEFINED +#define _GETDISKFREE_DEFINED + _CRTIMP unsigned __cdecl _getdiskfree(unsigned _Drive,struct _diskfree_t *_DiskFree); #endif #ifndef _WDIRECT_DEFINED -/* wide character versions. Also in wchar.h */ -#ifdef __MSVCRT__ -_CRTIMP int __cdecl __MINGW_NOTHROW _wchdir(const wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wgetcwd(wchar_t*, int); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wgetdcwd(int, wchar_t*, int); -_CRTIMP int __cdecl __MINGW_NOTHROW _wmkdir(const wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wrmdir(const wchar_t*); -#endif /* __MSVCRT__ */ #define _WDIRECT_DEFINED + _CRTIMP wchar_t *__cdecl _wgetcwd(wchar_t *_DstBuf,int _SizeInWords); + _CRTIMP wchar_t *__cdecl _wgetdcwd(int _Drive,wchar_t *_DstBuf,int _SizeInWords); + wchar_t *__cdecl _wgetdcwd_nolock(int _Drive,wchar_t *_DstBuf,int _SizeInWords); + _CRTIMP int __cdecl _wchdir(const wchar_t *_Path); + _CRTIMP int __cdecl _wmkdir(const wchar_t *_Path); + _CRTIMP int __cdecl _wrmdir(const wchar_t *_Path); #endif -#ifdef __cplusplus +#ifndef NO_OLDNAMES + +#define diskfree_t _diskfree_t + + char *__cdecl getcwd(char *_DstBuf,int _SizeInBytes); + int __cdecl chdir(const char *_Path); + int __cdecl mkdir(const char *_Path); + int __cdecl rmdir(const char *_Path); +#endif + +#ifdef __cplusplus } #endif -#endif /* Not RC_INVOKED */ - -#endif /* Not _DIRECT_H_ */ +#pragma pack(pop) +#endif Index: include/crt/dirent.h =================================================================== --- include/crt/dirent.h (Revision 37928) +++ include/crt/dirent.h (Arbeitskopie) @@ -1,16 +1,19 @@ -/* - * DIRENT.H (formerly DIRLIB.H) +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ +/* All the headers include this file. */ +#include <_mingw.h> + +#ifndef __STRICT_ANSI__ + #ifndef _DIRENT_H_ #define _DIRENT_H_ -/* All the headers include this file. */ -#include <_mingw.h> +#pragma pack(push,_CRT_PACKING) + #include #ifndef RC_INVOKED @@ -19,99 +22,102 @@ extern "C" { #endif -struct dirent -{ - long d_ino; /* Always zero. */ - unsigned short d_reclen; /* Always zero. */ - unsigned short d_namlen; /* Length of name in d_name. */ - char d_name[FILENAME_MAX]; /* File name. */ -}; + struct dirent + { + long d_ino; /* Always zero. */ + unsigned short d_reclen; /* Always zero. */ + unsigned short d_namlen; /* Length of name in d_name. */ + char* d_name; /* File name. */ + /* NOTE: The name in the dirent structure points to the name in the + * finddata_t structure in the DIR. */ + }; -/* - * This is an internal data structure. Good programmers will not use it - * except as an argument to one of the functions below. - * dd_stat field is now int (was short in older versions). - */ -typedef struct -{ - /* disk transfer area for this dir */ - struct _finddata_t dd_dta; + /* + * This is an internal data structure. Good programmers will not use it + * except as an argument to one of the functions below. + * dd_stat field is now int (was short in older versions). + */ + typedef struct + { + /* disk transfer area for this dir */ + struct _finddata_t dd_dta; - /* dirent struct to return from dir (NOTE: this makes this thread - * safe as long as only one thread uses a particular DIR struct at - * a time) */ - struct dirent dd_dir; + /* dirent struct to return from dir (NOTE: this makes this thread + * safe as long as only one thread uses a particular DIR struct at + * a time) */ + struct dirent dd_dir; - /* _findnext handle */ - long dd_handle; + /* _findnext handle */ + long dd_handle; - /* - * Status of search: - * 0 = not started yet (next entry to read is first entry) - * -1 = off the end - * positive = 0 based index of next entry - */ - int dd_stat; + /* + * Status of search: + * 0 = not started yet (next entry to read is first entry) + * -1 = off the end + * positive = 0 based index of next entry + */ + int dd_stat; - /* given path for dir with search pattern (struct is extended) */ - char dd_name[1]; -} DIR; + /* given path for dir with search pattern (struct is extended) */ + char dd_name[1]; + } DIR; -DIR* __cdecl __MINGW_NOTHROW opendir (const char*); -struct dirent* __cdecl __MINGW_NOTHROW readdir (DIR*); -int __cdecl __MINGW_NOTHROW closedir (DIR*); -void __cdecl __MINGW_NOTHROW rewinddir (DIR*); -long __cdecl __MINGW_NOTHROW telldir (DIR*); -void __cdecl __MINGW_NOTHROW seekdir (DIR*, long); + DIR* __cdecl opendir (const char*); + struct dirent* __cdecl readdir (DIR*); + int __cdecl closedir (DIR*); + void __cdecl rewinddir (DIR*); + long __cdecl telldir (DIR*); + void __cdecl seekdir (DIR*, long); -/* wide char versions */ + /* wide char versions */ -struct _wdirent -{ - long d_ino; /* Always zero. */ - unsigned short d_reclen; /* Always zero. */ - unsigned short d_namlen; /* Length of name in d_name. */ - wchar_t d_name[FILENAME_MAX]; /* File name. */ -}; + struct _wdirent + { + long d_ino; /* Always zero. */ + unsigned short d_reclen; /* Always zero. */ + unsigned short d_namlen; /* Length of name in d_name. */ + wchar_t* d_name; /* File name. */ + /* NOTE: The name in the dirent structure points to the name in the * wfinddata_t structure in the _WDIR. */ + }; -/* - * This is an internal data structure. Good programmers will not use it - * except as an argument to one of the functions below. - */ -typedef struct -{ - /* disk transfer area for this dir */ - struct _wfinddata_t dd_dta; + /* + * This is an internal data structure. Good programmers will not use it + * except as an argument to one of the functions below. + */ + typedef struct + { + /* disk transfer area for this dir */ + struct _wfinddata_t dd_dta; - /* dirent struct to return from dir (NOTE: this makes this thread - * safe as long as only one thread uses a particular DIR struct at - * a time) */ - struct _wdirent dd_dir; + /* dirent struct to return from dir (NOTE: this makes this thread + * safe as long as only one thread uses a particular DIR struct at + * a time) */ + struct _wdirent dd_dir; - /* _findnext handle */ - long dd_handle; + /* _findnext handle */ + long dd_handle; - /* - * Status of search: - * 0 = not started yet (next entry to read is first entry) - * -1 = off the end - * positive = 0 based index of next entry - */ - int dd_stat; + /* + * Status of search: + * 0 = not started yet (next entry to read is first entry) + * -1 = off the end + * positive = 0 based index of next entry + */ + int dd_stat; - /* given path for dir with search pattern (struct is extended) */ - wchar_t dd_name[1]; -} _WDIR; + /* given path for dir with search pattern (struct is extended) */ + wchar_t dd_name[1]; + } _WDIR; -_WDIR* __cdecl __MINGW_NOTHROW _wopendir (const wchar_t*); -struct _wdirent* __cdecl __MINGW_NOTHROW _wreaddir (_WDIR*); -int __cdecl __MINGW_NOTHROW _wclosedir (_WDIR*); -void __cdecl __MINGW_NOTHROW _wrewinddir (_WDIR*); -long __cdecl __MINGW_NOTHROW _wtelldir (_WDIR*); -void __cdecl __MINGW_NOTHROW _wseekdir (_WDIR*, long); + _WDIR* __cdecl _wopendir (const wchar_t*); + struct _wdirent* __cdecl _wreaddir (_WDIR*); + int __cdecl _wclosedir (_WDIR*); + void __cdecl _wrewinddir (_WDIR*); + long __cdecl _wtelldir (_WDIR*); + void __cdecl _wseekdir (_WDIR*, long); #ifdef __cplusplus @@ -120,4 +126,10 @@ #endif /* Not RC_INVOKED */ +#pragma pack(pop) + #endif /* Not _DIRENT_H_ */ + + +#endif /* Not __STRICT_ANSI__ */ + Index: include/crt/dos.h =================================================================== --- include/crt/dos.h (Revision 37928) +++ include/crt/dos.h (Arbeitskopie) @@ -1,89 +1,55 @@ -/* - * dos.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * DOS-specific functions and structures. - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ +#ifndef _INC_DOS +#define _INC_DOS -#ifndef _DOS_H_ -#define _DOS_H_ - -/* All the headers include this file. */ #include <_mingw.h> - -#define __need_wchar_t -#ifndef RC_INVOKED -#include -#endif /* Not RC_INVOKED */ - -/* For DOS file attributes */ #include -#ifndef RC_INVOKED +#pragma pack(push,_CRT_PACKING) #ifdef __cplusplus extern "C" { #endif -#ifndef __MSVCRT__ /* these are in CRTDLL, but not MSVCRT */ -#ifndef __DECLSPEC_SUPPORTED -extern unsigned int *_imp___basemajor_dll; -extern unsigned int *_imp___baseminor_dll; -extern unsigned int *_imp___baseversion_dll; -extern unsigned int *_imp___osmajor_dll; -extern unsigned int *_imp___osminor_dll; -extern unsigned int *_imp___osmode_dll; +#ifndef _DISKFREE_T_DEFINED +#define _DISKFREE_T_DEFINED -#define _basemajor (*_imp___basemajor_dll) -#define _baseminor (*_imp___baseminor_dll) -#define _baseversion (*_imp___baseversion_dll) -#define _osmajor (*_imp___osmajor_dll) -#define _osminor (*_imp___osminor_dll) -#define _osmode (*_imp___osmode_dll) + struct _diskfree_t { + unsigned total_clusters; + unsigned avail_clusters; + unsigned sectors_per_cluster; + unsigned bytes_per_sector; + }; +#endif -#else /* __DECLSPEC_SUPPORTED */ +#define _A_NORMAL 0x00 +#define _A_RDONLY 0x01 +#define _A_HIDDEN 0x02 +#define _A_SYSTEM 0x04 +#define _A_SUBDIR 0x10 +#define _A_ARCH 0x20 -__MINGW_IMPORT unsigned int _basemajor_dll; -__MINGW_IMPORT unsigned int _baseminor_dll; -__MINGW_IMPORT unsigned int _baseversion_dll; -__MINGW_IMPORT unsigned int _osmajor_dll; -__MINGW_IMPORT unsigned int _osminor_dll; -__MINGW_IMPORT unsigned int _osmode_dll; +#ifndef _GETDISKFREE_DEFINED +#define _GETDISKFREE_DEFINED + _CRTIMP unsigned __cdecl _getdiskfree(unsigned _Drive,struct _diskfree_t *_DiskFree); +#endif -#define _basemajor _basemajor_dll -#define _baseminor _baseminor_dll -#define _baseversion _baseversion_dll -#define _osmajor _osmajor_dll -#define _osminor _osminor_dll -#define _osmode _osmode_dll - -#endif /* __DECLSPEC_SUPPORTED */ -#endif /* ! __MSVCRT__ */ - -#ifndef _DISKFREE_T_DEFINED -/* needed by _getdiskfree (also in direct.h) */ -struct _diskfree_t { - unsigned total_clusters; - unsigned avail_clusters; - unsigned sectors_per_cluster; - unsigned bytes_per_sector; -}; -#define _DISKFREE_T_DEFINED +#if (defined(_X86_) && !defined(__x86_64)) + void __cdecl _disable(void); + void __cdecl _enable(void); #endif -_CRTIMP unsigned __cdecl __MINGW_NOTHROW _getdiskfree (unsigned, struct _diskfree_t *); - -#ifndef _NO_OLDNAMES -# define diskfree_t _diskfree_t +#ifndef NO_OLDNAMES +#define diskfree_t _diskfree_t #endif #ifdef __cplusplus } #endif -#endif /* Not RC_INVOKED */ - -#endif /* Not _DOS_H_ */ +#pragma pack(pop) +#endif Index: include/crt/errno.h =================================================================== --- include/crt/errno.h (Revision 37928) +++ include/crt/errno.h (Arbeitskopie) @@ -1,101 +1,75 @@ -/* - * errno.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Error numbers and access to error reporting. - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ +#ifndef _INC_ERRNO +#define _INC_ERRNO -#ifndef _ERRNO_H_ -#define _ERRNO_H_ - -/* All the headers include this file. */ #include <_mingw.h> -/* - * Error numbers. - * TODO: Can't be sure of some of these assignments, I guessed from the - * names given by strerror and the defines in the Cygnus errno.h. A lot - * of the names from the Cygnus errno.h are not represented, and a few - * of the descriptions returned by strerror do not obviously match - * their error naming. - */ -#define EPERM 1 /* Operation not permitted */ -#define ENOFILE 2 /* No such file or directory */ -#define ENOENT 2 -#define ESRCH 3 /* No such process */ -#define EINTR 4 /* Interrupted function call */ -#define EIO 5 /* Input/output error */ -#define ENXIO 6 /* No such device or address */ -#define E2BIG 7 /* Arg list too long */ -#define ENOEXEC 8 /* Exec format error */ -#define EBADF 9 /* Bad file descriptor */ -#define ECHILD 10 /* No child processes */ -#define EAGAIN 11 /* Resource temporarily unavailable */ -#define ENOMEM 12 /* Not enough space */ -#define EACCES 13 /* Permission denied */ -#define EFAULT 14 /* Bad address */ -/* 15 - Unknown Error */ -#define EBUSY 16 /* strerror reports "Resource device" */ -#define EEXIST 17 /* File exists */ -#define EXDEV 18 /* Improper link (cross-device link?) */ -#define ENODEV 19 /* No such device */ -#define ENOTDIR 20 /* Not a directory */ -#define EISDIR 21 /* Is a directory */ -#define EINVAL 22 /* Invalid argument */ -#define ENFILE 23 /* Too many open files in system */ -#define EMFILE 24 /* Too many open files */ -#define ENOTTY 25 /* Inappropriate I/O control operation */ -/* 26 - Unknown Error */ -#define EFBIG 27 /* File too large */ -#define ENOSPC 28 /* No space left on device */ -#define ESPIPE 29 /* Invalid seek (seek on a pipe?) */ -#define EROFS 30 /* Read-only file system */ -#define EMLINK 31 /* Too many links */ -#define EPIPE 32 /* Broken pipe */ -#define EDOM 33 /* Domain error (math functions) */ -#define ERANGE 34 /* Result too large (possibly too small) */ -/* 35 - Unknown Error */ -#define EDEADLOCK 36 /* Resource deadlock avoided (non-Cyg) */ -#define EDEADLK 36 -/* 37 - Unknown Error */ -#define ENAMETOOLONG 38 /* Filename too long (91 in Cyg?) */ -#define ENOLCK 39 /* No locks available (46 in Cyg?) */ -#define ENOSYS 40 /* Function not implemented (88 in Cyg?) */ -#define ENOTEMPTY 41 /* Directory not empty (90 in Cyg?) */ -#define EILSEQ 42 /* Illegal byte sequence */ - -/* - * NOTE: ENAMETOOLONG and ENOTEMPTY conflict with definitions in the - * sockets.h header provided with windows32api-0.1.2. - * You should go and put an #if 0 ... #endif around the whole block - * of errors (look at the comment above them). - */ - -#ifndef RC_INVOKED - -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif -/* - * Definitions of errno. For _doserrno, sys_nerr and * sys_errlist, see - * stdlib.h. - */ -#ifdef _UWIN -#undef errno -extern int errno; -#else -_CRTIMP int* __cdecl __MINGW_NOTHROW _errno(void); -#define errno (*_errno()) +#ifndef _CRT_ERRNO_DEFINED +#define _CRT_ERRNO_DEFINED + _CRTIMP extern int *__cdecl _errno(void); +#define errno (*_errno()) + + errno_t __cdecl _set_errno(int _Value); + errno_t __cdecl _get_errno(int *_Value); #endif -#ifdef __cplusplus -} +#define EPERM 1 +#define ENOENT 2 +#define ESRCH 3 +#define EINTR 4 +#define EIO 5 +#define ENXIO 6 +#define E2BIG 7 +#define ENOEXEC 8 +#define EBADF 9 +#define ECHILD 10 +#define EAGAIN 11 +#define ENOMEM 12 +#define EACCES 13 +#define EFAULT 14 +#define EBUSY 16 +#define EEXIST 17 +#define EXDEV 18 +#define ENODEV 19 +#define ENOTDIR 20 +#define EISDIR 21 +#define ENFILE 23 +#define EMFILE 24 +#define ENOTTY 25 +#define EFBIG 27 +#define ENOSPC 28 +#define ESPIPE 29 +#define EROFS 30 +#define EMLINK 31 +#define EPIPE 32 +#define EDOM 33 +#define EDEADLK 36 +#define ENAMETOOLONG 38 +#define ENOLCK 39 +#define ENOSYS 40 +#define ENOTEMPTY 41 + +#ifndef RC_INVOKED +#if !defined(_SECURECRT_ERRCODE_VALUES_DEFINED) +#define _SECURECRT_ERRCODE_VALUES_DEFINED +#define EINVAL 22 +#define ERANGE 34 +#define EILSEQ 42 +#define STRUNCATE 80 #endif +#endif -#endif /* Not RC_INVOKED */ +#define EDEADLOCK EDEADLK -#endif /* Not _ERRNO_H_ */ +#ifdef __cplusplus +} +#endif +#endif Index: include/crt/excpt.h =================================================================== --- include/crt/excpt.h (Revision 37928) +++ include/crt/excpt.h (Arbeitskopie) @@ -15,9 +15,7 @@ #define _EXCPT_H_ /* All the headers include this file. */ -#if defined(__MINGW32__) #include <_mingw.h> -#endif /* * NOTE: The constants structs and typedefs below should be defined in the Index: include/crt/fcntl.h =================================================================== --- include/crt/fcntl.h (Revision 37928) +++ include/crt/fcntl.h (Arbeitskopie) @@ -1,75 +1,52 @@ -/* - * fcntl.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Access constants for _open. Note that the permissions constants are - * in sys/stat.h (ick). - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ -#ifndef _FCNTL_H_ -#define _FCNTL_H_ - -/* All the headers include this file. */ #include <_mingw.h> -/* - * It appears that fcntl.h should include io.h for compatibility... - */ #include -/* Specifiy one of these flags to define the access mode. */ -#define _O_RDONLY 0 -#define _O_WRONLY 1 -#define _O_RDWR 2 +#ifndef _INC_FCNTL +#define _INC_FCNTL -/* Mask for access mode bits in the _open flags. */ -#define _O_ACCMODE (_O_RDONLY|_O_WRONLY|_O_RDWR) +#define _O_RDONLY 0x0000 +#define _O_WRONLY 0x0001 +#define _O_RDWR 0x0002 +#define _O_APPEND 0x0008 +#define _O_CREAT 0x0100 +#define _O_TRUNC 0x0200 +#define _O_EXCL 0x0400 +#define _O_TEXT 0x4000 +#define _O_BINARY 0x8000 +#define _O_WTEXT 0x10000 +#define _O_U16TEXT 0x20000 +#define _O_U8TEXT 0x40000 +#define _O_ACCMODE (_O_RDONLY|_O_WRONLY|_O_RDWR) -#define _O_APPEND 0x0008 /* Writes will add to the end of the file. */ +#define _O_RAW _O_BINARY +#define _O_NOINHERIT 0x0080 +#define _O_TEMPORARY 0x0040 +#define _O_SHORT_LIVED 0x1000 -#define _O_RANDOM 0x0010 -#define _O_SEQUENTIAL 0x0020 -#define _O_TEMPORARY 0x0040 /* Make the file dissappear after closing. - * WARNING: Even if not created by _open! */ -#define _O_NOINHERIT 0x0080 +#define _O_SEQUENTIAL 0x0020 +#define _O_RANDOM 0x0010 -#define _O_CREAT 0x0100 /* Create the file if it does not exist. */ -#define _O_TRUNC 0x0200 /* Truncate the file if it does exist. */ -#define _O_EXCL 0x0400 /* Open only if the file does not exist. */ - -#define _O_SHORT_LIVED 0x1000 - -/* NOTE: Text is the default even if the given _O_TEXT bit is not on. */ -#define _O_TEXT 0x4000 /* CR-LF in file becomes LF in memory. */ -#define _O_BINARY 0x8000 /* Input and output is not translated. */ -#define _O_RAW _O_BINARY - -#if (__MSVCRT_VERSION__ >= 0x0800) -#define _O_WTEXT 0x10000 -#define _O_U16TEXT 0x20000 -#define _O_U8TEXT 0x40000 +#if !defined(NO_OLDNAMES) || defined(_POSIX) +#define O_RDONLY _O_RDONLY +#define O_WRONLY _O_WRONLY +#define O_RDWR _O_RDWR +#define O_ACCMODE _O_ACCMODE +#define O_APPEND _O_APPEND +#define O_CREAT _O_CREAT +#define O_TRUNC _O_TRUNC +#define O_EXCL _O_EXCL +#define O_TEXT _O_TEXT +#define O_BINARY _O_BINARY +#define O_RAW _O_BINARY +#define O_TEMPORARY _O_TEMPORARY +#define O_NOINHERIT _O_NOINHERIT +#define O_SEQUENTIAL _O_SEQUENTIAL +#define O_RANDOM _O_RANDOM #endif - -#ifndef _NO_OLDNAMES - -/* POSIX/Non-ANSI names for increased portability */ -#define O_RDONLY _O_RDONLY -#define O_WRONLY _O_WRONLY -#define O_RDWR _O_RDWR -#define O_ACCMODE _O_ACCMODE -#define O_APPEND _O_APPEND -#define O_CREAT _O_CREAT -#define O_TRUNC _O_TRUNC -#define O_EXCL _O_EXCL -#define O_TEXT _O_TEXT -#define O_BINARY _O_BINARY -#define O_TEMPORARY _O_TEMPORARY -#define O_NOINHERIT _O_NOINHERIT -#define O_SEQUENTIAL _O_SEQUENTIAL -#define O_RANDOM _O_RANDOM - -#endif /* Not _NO_OLDNAMES */ - -#endif /* Not _FCNTL_H_ */ +#endif Index: include/crt/fenv.h =================================================================== --- include/crt/fenv.h (Revision 37928) +++ include/crt/fenv.h (Arbeitskopie) @@ -1,8 +1,11 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ #ifndef _FENV_H_ #define _FENV_H_ -#include <_mingw.h> - /* FPU status word exception flags */ #define FE_INVALID 0x01 #define FE_DENORMAL 0x02 @@ -24,10 +27,6 @@ #define __MXCSR_EXCEPT_FLAG_SHIFT 0 /* How much to shift FE status word exception flags - to get the MXCSR exeptions masks, */ -#define __MXCSR_EXCEPT_MASK_SHIFT 7 - -/* How much to shift FE control word rounding flags to get MXCSR rounding flags, */ #define __MXCSR_ROUND_FLAG_SHIFT 3 @@ -55,9 +54,9 @@ unsigned short __ip_selector; unsigned short __opcode; unsigned int __data_offset; - unsigned short __data_selector; - unsigned short __unused3; - unsigned int __mxcsr; /* contents of the MXCSR register */ + unsigned short __data_selector; + unsigned short __unused3; + unsigned int __mxcsr; /* contents of the MXCSR register */ } fenv_t; @@ -81,23 +80,23 @@ /*TODO: Some of these could be inlined */ /* 7.6.2 Exception */ -extern int __cdecl __MINGW_NOTHROW feclearexcept (int); -extern int __cdecl __MINGW_NOTHROW fegetexceptflag (fexcept_t * flagp, int excepts); -extern int __cdecl __MINGW_NOTHROW feraiseexcept (int excepts ); -extern int __cdecl __MINGW_NOTHROW fesetexceptflag (const fexcept_t *, int); -extern int __cdecl __MINGW_NOTHROW fetestexcept (int excepts); +extern int __cdecl feclearexcept (int); +extern int __cdecl fegetexceptflag (fexcept_t * flagp, int excepts); +extern int __cdecl feraiseexcept (int excepts ); +extern int __cdecl fesetexceptflag (const fexcept_t *, int); +extern int __cdecl fetestexcept (int excepts); /* 7.6.3 Rounding */ -extern int __cdecl __MINGW_NOTHROW fegetround (void); -extern int __cdecl __MINGW_NOTHROW fesetround (int mode); +extern int __cdecl fegetround (void); +extern int __cdecl fesetround (int mode); /* 7.6.4 Environment */ -extern int __cdecl __MINGW_NOTHROW fegetenv (fenv_t * envp); -extern int __cdecl __MINGW_NOTHROW fesetenv (const fenv_t * ); -extern int __cdecl __MINGW_NOTHROW feupdateenv (const fenv_t *); -extern int __cdecl __MINGW_NOTHROW feholdexcept (fenv_t *); +extern int __cdecl fegetenv(fenv_t * envp); +extern int __cdecl fesetenv(const fenv_t * ); +extern int __cdecl feupdateenv(const fenv_t *); +extern int __cdecl feholdexcept(fenv_t *); #ifdef __cplusplus } Index: include/crt/float.h =================================================================== --- include/crt/float.h (Revision 37928) +++ include/crt/float.h (Arbeitskopie) @@ -1,4 +1,4 @@ -/* +/* * float.h * This file has no copyright assigned and is placed in the Public Domain. * This file is a part of the mingw-runtime package. @@ -12,7 +12,7 @@ * NOTE: GCC provides float.h, but it doesn't include the non-standard * stuff for accessing the fp controller. We include_next the * GCC-supplied header and just define the MS-specific extensions - * here. + * here. * */ @@ -116,7 +116,7 @@ word to 0x37f (64 bit mantissa precison rather than 53 bit). By default, the mingw version of _fpreset sets fp control as per fninit. To use the MSVCRT.dll _fpreset, include CRT_fp8.o when - building your application. + building your application. */ void __cdecl __MINGW_NOTHROW _fpreset (void); void __cdecl __MINGW_NOTHROW fpreset (void); @@ -148,6 +148,4 @@ #endif /* Not __STRICT_ANSI__ */ -#endif /* _FLOAT_H_ */ - - +#endif /* _MINGW_FLOAT_H_ */ Index: include/crt/inttypes.h =================================================================== --- include/crt/inttypes.h (Revision 37928) +++ include/crt/inttypes.h (Arbeitskopie) @@ -1,3 +1,8 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ /* 7.8 Format conversion of integer types */ #ifndef _INTTYPES_H_ @@ -20,7 +25,7 @@ #if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) /* 7.8.1 Macros for format specifiers - * + * * MS runtime does not yet understand C9x standard "ll" * length specifier. It appears to treat "ll" as "l". * The non-standard I64 length specifier causes warning in GCC, @@ -44,7 +49,6 @@ #define PRIdFAST64 "I64d" #define PRIdMAX "I64d" -#define PRIdPTR "d" #define PRIi8 "i" #define PRIi16 "i" @@ -62,7 +66,6 @@ #define PRIiFAST64 "I64i" #define PRIiMAX "I64i" -#define PRIiPTR "i" #define PRIo8 "o" #define PRIo16 "o" @@ -81,8 +84,6 @@ #define PRIoMAX "I64o" -#define PRIoPTR "o" - /* fprintf macros for unsigned types */ #define PRIu8 "u" #define PRIu16 "u" @@ -101,7 +102,6 @@ #define PRIuFAST64 "I64u" #define PRIuMAX "I64u" -#define PRIuPTR "u" #define PRIx8 "x" #define PRIx16 "x" @@ -119,7 +119,6 @@ #define PRIxFAST64 "I64x" #define PRIxMAX "I64x" -#define PRIxPTR "x" #define PRIX8 "X" #define PRIX16 "X" @@ -137,7 +136,6 @@ #define PRIXFAST64 "I64X" #define PRIXMAX "I64X" -#define PRIXPTR "X" /* * fscanf macros for signed int types @@ -159,7 +157,6 @@ #define SCNdFAST64 "I64d" #define SCNdMAX "I64d" -#define SCNdPTR "d" #define SCNi16 "hi" #define SCNi32 "i" @@ -174,7 +171,6 @@ #define SCNiFAST64 "I64i" #define SCNiMAX "I64i" -#define SCNiPTR "i" #define SCNo16 "ho" #define SCNo32 "o" @@ -189,7 +185,6 @@ #define SCNoFAST64 "I64o" #define SCNoMAX "I64o" -#define SCNoPTR "o" #define SCNx16 "hx" #define SCNx32 "x" @@ -204,9 +199,7 @@ #define SCNxFAST64 "I64x" #define SCNxMAX "I64x" -#define SCNxPTR "x" - /* fscanf macros for unsigned int types */ #define SCNu16 "hu" @@ -222,12 +215,37 @@ #define SCNuFAST64 "I64u" #define SCNuMAX "I64u" -#define SCNuPTR "u" +#ifdef _WIN64 +#define PRIdPTR "I64d" +#define PRIiPTR "I64i" +#define PRIoPTR "I64o" +#define PRIuPTR "I64u" +#define PRIxPTR "I64x" +#define PRIXPTR "I64X" +#define SCNdPTR "I64d" +#define SCNiPTR "I64i" +#define SCNoPTR "I64o" +#define SCNxPTR "I64x" +#define SCNuPTR "I64u" +#else +#define PRIdPTR "d" +#define PRIiPTR "i" +#define PRIoPTR "o" +#define PRIuPTR "u" +#define PRIxPTR "x" +#define PRIXPTR "X" +#define SCNdPTR "d" +#define SCNiPTR "i" +#define SCNoPTR "o" +#define SCNxPTR "x" + #define SCNuPTR "u" +#endif + #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* * no length modifier for char types prior to C9x - * MS runtime scanf appears to treat "hh" as "h" + * MS runtime scanf appears to treat "hh" as "h" */ /* signed char */ @@ -255,20 +273,21 @@ #endif /* !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) */ -__CRT_INLINE intmax_t __cdecl __MINGW_NOTHROW imaxabs (intmax_t j) +intmax_t __cdecl imaxabs (intmax_t j); +__CRT_INLINE intmax_t __cdecl imaxabs (intmax_t j) {return (j >= 0 ? j : -j);} -imaxdiv_t __cdecl __MINGW_NOTHROW imaxdiv (intmax_t numer, intmax_t denom); +imaxdiv_t __cdecl imaxdiv (intmax_t numer, intmax_t denom); /* 7.8.2 Conversion functions for greatest-width integer types */ -intmax_t __cdecl __MINGW_NOTHROW strtoimax (const char* __restrict__ nptr, +intmax_t __cdecl strtoimax (const char* __restrict__ nptr, char** __restrict__ endptr, int base); -uintmax_t __cdecl __MINGW_NOTHROW strtoumax (const char* __restrict__ nptr, +uintmax_t __cdecl strtoumax (const char* __restrict__ nptr, char** __restrict__ endptr, int base); -intmax_t __cdecl __MINGW_NOTHROW wcstoimax (const wchar_t* __restrict__ nptr, +intmax_t __cdecl wcstoimax (const wchar_t* __restrict__ nptr, wchar_t** __restrict__ endptr, int base); -uintmax_t __cdecl __MINGW_NOTHROW wcstoumax (const wchar_t* __restrict__ nptr, +uintmax_t __cdecl wcstoumax (const wchar_t* __restrict__ nptr, wchar_t** __restrict__ endptr, int base); #ifdef __cplusplus Index: include/crt/io.h =================================================================== --- include/crt/io.h (Revision 37928) +++ include/crt/io.h (Arbeitskopie) @@ -1,337 +1,417 @@ -/* - * io.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * System level I/O functions and types. - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ -#ifndef _IO_H_ -#define _IO_H_ +#ifndef _IO_H_ +#define _IO_H_ -/* All the headers include this file. */ #include <_mingw.h> +#include -/* MSVC's io.h contains the stuff from dir.h, so I will too. - * NOTE: This also defines off_t, the file offset type, through - * an inclusion of sys/types.h */ +#pragma pack(push,_CRT_PACKING) -#include /* To get time_t. */ +#ifndef _POSIX_ -/* - * Attributes of files as returned by _findfirst et al. - */ -#define _A_NORMAL 0x00000000 -#define _A_RDONLY 0x00000001 -#define _A_HIDDEN 0x00000002 -#define _A_SYSTEM 0x00000004 -#define _A_VOLID 0x00000008 -#define _A_SUBDIR 0x00000010 -#define _A_ARCH 0x00000020 +#ifdef __cplusplus +extern "C" { +#endif +_CRTIMP char* __cdecl _getcwd (char*, int); +#ifndef _FSIZE_T_DEFINED + typedef unsigned long _fsize_t; +#define _FSIZE_T_DEFINED +#endif -#ifndef RC_INVOKED +#ifndef _FINDDATA_T_DEFINED -#ifndef _INTPTR_T_DEFINED -#define _INTPTR_T_DEFINED + struct _finddata32_t { + unsigned attrib; + __time32_t time_create; + __time32_t time_access; + __time32_t time_write; + _fsize_t size; + char name[260]; + }; + +/*#if _INTEGRAL_MAX_BITS >= 64*/ + + struct _finddata32i64_t { + unsigned attrib; + __time32_t time_create; + __time32_t time_access; + __time32_t time_write; + __int64 size; + char name[260]; + }; + + struct _finddata64i32_t { + unsigned attrib; + __time64_t time_create; + __time64_t time_access; + __time64_t time_write; + _fsize_t size; + char name[260]; + }; + + struct __finddata64_t { + unsigned attrib; + __time64_t time_create; + __time64_t time_access; + __time64_t time_write; + __int64 size; + char name[260]; + }; +/* #endif */ + +#ifdef _USE_32BIT_TIME_T +#define _finddata_t _finddata32_t +#define _finddatai64_t _finddata32i64_t + #ifdef _WIN64 - typedef __int64 intptr_t; +#define _findfirst _findfirst32 +#define _findnext _findnext32 #else - typedef int intptr_t; +#define _findfirst32 _findfirst +#define _findnext32 _findnext #endif -#endif +#define _findfirsti64 _findfirst32i64 +#define _findnexti64 _findnext32i64 +#else +#define _finddata_t _finddata64i32_t +#define _finddatai64_t __finddata64_t -#ifndef _FSIZE_T_DEFINED -typedef unsigned long _fsize_t; -#define _FSIZE_T_DEFINED +#define _findfirst _findfirst64i32 +#define _findnext _findnext64i32 +#define _findfirsti64 _findfirst64 +#define _findnexti64 _findnext64 #endif -/* - * The maximum length of a file name. You should use GetVolumeInformation - * instead of this constant. But hey, this works. - * Also defined in stdio.h. - */ -#ifndef FILENAME_MAX -#define FILENAME_MAX (260) +#define _FINDDATA_T_DEFINED #endif -/* - * The following structure is filled in by _findfirst or _findnext when - * they succeed in finding a match. - */ -struct _finddata_t -{ - unsigned attrib; /* Attributes, see constants above. */ - time_t time_create; - time_t time_access; /* always midnight local time */ - time_t time_write; - _fsize_t size; - char name[FILENAME_MAX]; /* may include spaces. */ -}; - -struct _finddatai64_t { - unsigned attrib; - time_t time_create; - time_t time_access; - time_t time_write; - __int64 size; - char name[FILENAME_MAX]; -}; - -struct __finddata64_t { - unsigned attrib; - __time64_t time_create; - __time64_t time_access; - __time64_t time_write; - _fsize_t size; - char name[FILENAME_MAX]; -}; - #ifndef _WFINDDATA_T_DEFINED -struct _wfinddata_t { - unsigned attrib; - time_t time_create; /* -1 for FAT file systems */ - time_t time_access; /* -1 for FAT file systems */ - time_t time_write; - _fsize_t size; - wchar_t name[FILENAME_MAX]; /* may include spaces. */ -}; -struct _wfinddatai64_t { - unsigned attrib; - time_t time_create; - time_t time_access; - time_t time_write; - __int64 size; - wchar_t name[FILENAME_MAX]; -}; + struct _wfinddata32_t { + unsigned attrib; + __time32_t time_create; + __time32_t time_access; + __time32_t time_write; + _fsize_t size; + wchar_t name[260]; + }; -struct __wfinddata64_t { - unsigned attrib; - __time64_t time_create; - __time64_t time_access; - __time64_t time_write; - _fsize_t size; - wchar_t name[FILENAME_MAX]; -}; +/* #if _INTEGRAL_MAX_BITS >= 64 */ -#define _WFINDDATA_T_DEFINED -#endif + struct _wfinddata32i64_t { + unsigned attrib; + __time32_t time_create; + __time32_t time_access; + __time32_t time_write; + __int64 size; + wchar_t name[260]; + }; -#ifdef __cplusplus -extern "C" { -#endif + struct _wfinddata64i32_t { + unsigned attrib; + __time64_t time_create; + __time64_t time_access; + __time64_t time_write; + _fsize_t size; + wchar_t name[260]; + }; -/* - * Functions for searching for files. _findfirst returns -1 if no match - * is found. Otherwise it returns a handle to be used in _findnext and - * _findclose calls. _findnext also returns -1 if no match could be found, - * and 0 if a match was found. Call _findclose when you are finished. - */ + struct _wfinddata64_t { + unsigned attrib; + __time64_t time_create; + __time64_t time_access; + __time64_t time_write; + __int64 size; + wchar_t name[260]; + }; +/* #endif */ -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _findfirst (const char*, struct _finddata_t*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _findnext (intptr_t, struct _finddata_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _findclose (intptr_t); +#ifdef _USE_32BIT_TIME_T +#define _wfinddata_t _wfinddata32_t +#define _wfinddatai64_t _wfinddata32i64_t -_CRTIMP int __cdecl __MINGW_NOTHROW _chdir (const char*); -_CRTIMP char* __cdecl __MINGW_NOTHROW _getcwd (char*, int); -_CRTIMP int __cdecl __MINGW_NOTHROW _mkdir (const char*); -_CRTIMP char* __cdecl __MINGW_NOTHROW _mktemp (char*); -_CRTIMP int __cdecl __MINGW_NOTHROW _rmdir (const char*); -_CRTIMP int __cdecl __MINGW_NOTHROW _chmod (const char*, int); +#define _wfindfirst _wfindfirst32 +#define _wfindnext _wfindnext32 +#define _wfindfirsti64 _wfindfirst32i64 +#define _wfindnexti64 _wfindnext32i64 +#else +#define _wfinddata_t _wfinddata64i32_t +#define _wfinddatai64_t _wfinddata64_t -#ifdef __MSVCRT__ -_CRTIMP __int64 __cdecl __MINGW_NOTHROW _filelengthi64(int); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _findfirsti64(const char*, struct _finddatai64_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _findnexti64(intptr_t, struct _finddatai64_t*); -_CRTIMP __int64 __cdecl __MINGW_NOTHROW _lseeki64(int, __int64, int); -_CRTIMP __int64 __cdecl __MINGW_NOTHROW _telli64(int); -/* These require newer versions of msvcrt.dll (6.1 or higher). */ -#if __MSVCRT_VERSION__ >= 0x0601 -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _findfirst64(const char*, struct __finddata64_t*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _findnext64(intptr_t, struct __finddata64_t*); -#endif /* __MSVCRT_VERSION__ >= 0x0601 */ +#define _wfindfirst _wfindfirst64i32 +#define _wfindnext _wfindnext64i32 +#define _wfindfirsti64 _wfindfirst64 +#define _wfindnexti64 _wfindnext64 +#endif -#ifndef __NO_MINGW_LFS -__CRT_INLINE off64_t lseek64 (int, off64_t, int); -__CRT_INLINE off64_t lseek64 (int fd, off64_t offset, int whence) -{ - return _lseeki64(fd, (__int64) offset, whence); -} +#define _WFINDDATA_T_DEFINED #endif -#endif /* __MSVCRT__ */ +#define _A_NORMAL 0x00 +#define _A_RDONLY 0x01 +#define _A_HIDDEN 0x02 +#define _A_SYSTEM 0x04 +#define _A_SUBDIR 0x10 +#define _A_ARCH 0x20 -#ifndef _NO_OLDNAMES +#ifndef _SIZE_T_DEFINED +#define _SIZE_T_DEFINED +#undef size_t +#ifdef _WIN64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef unsigned int size_t __attribute__ ((mode (DI))); +#else + typedef unsigned __int64 size_t; +#endif +#else + typedef unsigned int size_t; +#endif +#endif -#ifndef _UWIN -_CRTIMP int __cdecl __MINGW_NOTHROW chdir (const char*); -_CRTIMP char* __cdecl __MINGW_NOTHROW getcwd (char*, int); -_CRTIMP int __cdecl __MINGW_NOTHROW mkdir (const char*); -_CRTIMP char* __cdecl __MINGW_NOTHROW mktemp (char*); -_CRTIMP int __cdecl __MINGW_NOTHROW rmdir (const char*); -_CRTIMP int __cdecl __MINGW_NOTHROW chmod (const char*, int); -#endif /* _UWIN */ +#ifndef _SSIZE_T_DEFINED +#define _SSIZE_T_DEFINED +#undef ssize_t +#ifdef _WIN64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef int ssize_t __attribute__ ((mode (DI))); +#else + typedef __int64 ssize_t; +#endif +#else + typedef int ssize_t; +#endif +#endif -#endif /* Not _NO_OLDNAMES */ +#ifndef _OFF_T_DEFINED +#define _OFF_T_DEFINED +#ifndef _OFF_T_ +#define _OFF_T_ + typedef long _off_t; +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef long off_t; +#endif +#endif +#endif -#ifdef __cplusplus -} +#ifndef _OFF64_T_DEFINED +#define _OFF64_T_DEFINED +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef int _off64_t __attribute__ ((mode (DI))); +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef int off64_t __attribute__ ((mode (DI))); #endif +#else + typedef long long _off64_t; +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef long long off64_t; +#endif +#endif +#endif -#endif /* Not RC_INVOKED */ - -/* TODO: Maximum number of open handles has not been tested, I just set - * it the same as FOPEN_MAX. */ -#define HANDLE_MAX FOPEN_MAX - -/* Some defines for _access nAccessMode (MS doesn't define them, but - * it doesn't seem to hurt to add them). */ + /* Some defines for _access nAccessMode (MS doesn't define them, but + * it doesn't seem to hurt to add them). */ #define F_OK 0 /* Check for file existence */ -/* Well maybe it does hurt. On newer versions of MSVCRT, an access mode - of 1 causes invalid parameter error. */ -#define X_OK 1 /* MS access() doesn't check for execute permission. */ +#define X_OK 1 /* Check for execute permission. */ #define W_OK 2 /* Check for write permission */ #define R_OK 4 /* Check for read permission */ -#ifndef RC_INVOKED + _CRTIMP int __cdecl _access(const char *_Filename,int _AccessMode); + _CRTIMP int __cdecl _chmod(const char *_Filename,int _Mode); + _CRTIMP int __cdecl _chsize(int _FileHandle,long _Size); + _CRTIMP int __cdecl _close(int _FileHandle); + _CRTIMP int __cdecl _commit(int _FileHandle); + _CRTIMP int __cdecl _creat(const char *_Filename,int _PermissionMode); + _CRTIMP int __cdecl _dup(int _FileHandle); + _CRTIMP int __cdecl _dup2(int _FileHandleSrc,int _FileHandleDst); + _CRTIMP int __cdecl _eof(int _FileHandle); + _CRTIMP long __cdecl _filelength(int _FileHandle); + _CRTIMP intptr_t __cdecl _findfirst32(const char *_Filename,struct _finddata32_t *_FindData); + _CRTIMP int __cdecl _findnext32(intptr_t _FindHandle,struct _finddata32_t *_FindData); + _CRTIMP int __cdecl _findclose(intptr_t _FindHandle); + _CRTIMP int __cdecl _isatty(int _FileHandle); + _CRTIMP int __cdecl _locking(int _FileHandle,int _LockMode,long _NumOfBytes); + _CRTIMP long __cdecl _lseek(int _FileHandle,long _Offset,int _Origin); + _off64_t lseek64(int fd,_off64_t offset, int whence); + _CRTIMP char *__cdecl _mktemp(char *_TemplateName); + _CRTIMP int __cdecl _pipe(int *_PtHandles,unsigned int _PipeSize,int _TextMode); + _CRTIMP int __cdecl _read(int _FileHandle,void *_DstBuf,unsigned int _MaxCharCount); -#ifdef __cplusplus -extern "C" { +#ifndef _CRT_DIRECTORY_DEFINED +#define _CRT_DIRECTORY_DEFINED + int __cdecl remove(const char *_Filename); + int __cdecl rename(const char *_OldFilename,const char *_NewFilename); + _CRTIMP int __cdecl _unlink(const char *_Filename); +#ifndef NO_OLDNAMES + int __cdecl unlink(const char *_Filename); #endif +#endif -_CRTIMP int __cdecl __MINGW_NOTHROW _access (const char*, int); -_CRTIMP int __cdecl __MINGW_NOTHROW _chsize (int, long); -_CRTIMP int __cdecl __MINGW_NOTHROW _close (int); -_CRTIMP int __cdecl __MINGW_NOTHROW _commit(int); + _CRTIMP int __cdecl _setmode(int _FileHandle,int _Mode); + _CRTIMP long __cdecl _tell(int _FileHandle); + _CRTIMP int __cdecl _umask(int _Mode); + _CRTIMP int __cdecl _write(int _FileHandle,const void *_Buf,unsigned int _MaxCharCount); -/* NOTE: The only significant bit in unPermissions appears to be bit 7 (0x80), - * the "owner write permission" bit (on FAT). */ -_CRTIMP int __cdecl __MINGW_NOTHROW _creat (const char*, int); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP __int64 __cdecl _filelengthi64(int _FileHandle); + _CRTIMP intptr_t __cdecl _findfirst32i64(const char *_Filename,struct _finddata32i64_t *_FindData); + _CRTIMP intptr_t __cdecl _findfirst64(const char *_Filename,struct __finddata64_t *_FindData); +#ifdef __cplusplus +#include +#endif + intptr_t __cdecl _findfirst64i32(const char *_Filename,struct _finddata64i32_t *_FindData); + __CRT_INLINE intptr_t __cdecl _findfirst64i32(const char *_Filename,struct _finddata64i32_t *_FindData) + { + struct __finddata64_t fd; + intptr_t ret = _findfirst64(_Filename,&fd); + _FindData->attrib=fd.attrib; + _FindData->time_create=fd.time_create; + _FindData->time_access=fd.time_access; + _FindData->time_write=fd.time_write; + _FindData->size=(_fsize_t) fd.size; + strncpy(_FindData->name,fd.name,260); + return ret; + } + _CRTIMP int __cdecl _findnext32i64(intptr_t _FindHandle,struct _finddata32i64_t *_FindData); + _CRTIMP int __cdecl _findnext64(intptr_t _FindHandle,struct __finddata64_t *_FindData); + int __cdecl _findnext64i32(intptr_t _FindHandle,struct _finddata64i32_t *_FindData); + __CRT_INLINE int __cdecl _findnext64i32(intptr_t _FindHandle,struct _finddata64i32_t *_FindData) + { + struct __finddata64_t fd; + int ret = _findnext64(_FindHandle,&fd); + _FindData->attrib=fd.attrib; + _FindData->time_create=fd.time_create; + _FindData->time_access=fd.time_access; + _FindData->time_write=fd.time_write; + _FindData->size=(_fsize_t) fd.size; + strncpy(_FindData->name,fd.name,260); + return ret; + } + __int64 __cdecl _lseeki64(int _FileHandle,__int64 _Offset,int _Origin); + __int64 __cdecl _telli64(int _FileHandle); +#endif +#ifndef NO_OLDNAMES -_CRTIMP int __cdecl __MINGW_NOTHROW _dup (int); -_CRTIMP int __cdecl __MINGW_NOTHROW _dup2 (int, int); -_CRTIMP long __cdecl __MINGW_NOTHROW _filelength (int); -_CRTIMP long __cdecl __MINGW_NOTHROW _get_osfhandle (int); -_CRTIMP int __cdecl __MINGW_NOTHROW _isatty (int); +#ifndef _UWIN + int __cdecl chdir (const char *); + char *__cdecl getcwd (char *, int); + int __cdecl mkdir (const char *); + char *__cdecl mktemp(char *); + int __cdecl rmdir (const char*); + int __cdecl chmod (const char *, int); +#endif /* _UWIN */ -/* In a very odd turn of events this function is excluded from those - * files which define _STREAM_COMPAT. This is required in order to - * build GNU libio because of a conflict with _eof in streambuf.h - * line 107. Actually I might just be able to change the name of - * the enum member in streambuf.h... we'll see. TODO */ -#ifndef _STREAM_COMPAT -_CRTIMP int __cdecl __MINGW_NOTHROW _eof (int); +#endif /* Not NO_OLDNAMES */ + + _CRTIMP errno_t __cdecl _sopen_s(int *_FileHandle,const char *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionMode); + +#ifndef __cplusplus + _CRTIMP int __cdecl _open(const char *_Filename,int _OpenFlag,...); + _CRTIMP int __cdecl _sopen(const char *_Filename,int _OpenFlag,int _ShareFlag,...); +#else + extern "C++" _CRTIMP int __cdecl _open(const char *_Filename,int _Openflag,int _PermissionMode = 0); + extern "C++" _CRTIMP int __cdecl _sopen(const char *_Filename,int _Openflag,int _ShareFlag,int _PermissionMode = 0); #endif -/* LK_... locking commands defined in sys/locking.h. */ -_CRTIMP int __cdecl __MINGW_NOTHROW _locking (int, int, long); +#ifndef _WIO_DEFINED +#define _WIO_DEFINED + _CRTIMP int __cdecl _waccess(const wchar_t *_Filename,int _AccessMode); + _CRTIMP int __cdecl _wchmod(const wchar_t *_Filename,int _Mode); + _CRTIMP int __cdecl _wcreat(const wchar_t *_Filename,int _PermissionMode); + _CRTIMP intptr_t __cdecl _wfindfirst32(const wchar_t *_Filename,struct _wfinddata32_t *_FindData); + _CRTIMP int __cdecl _wfindnext32(intptr_t _FindHandle,struct _wfinddata32_t *_FindData); + _CRTIMP int __cdecl _wunlink(const wchar_t *_Filename); + _CRTIMP int __cdecl _wrename(const wchar_t *_NewFilename,const wchar_t *_OldFilename); + _CRTIMP wchar_t *__cdecl _wmktemp(wchar_t *_TemplateName); -_CRTIMP long __cdecl __MINGW_NOTHROW _lseek (int, long, int); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP intptr_t __cdecl _wfindfirst32i64(const wchar_t *_Filename,struct _wfinddata32i64_t *_FindData); + intptr_t __cdecl _wfindfirst64i32(const wchar_t *_Filename,struct _wfinddata64i32_t *_FindData); + _CRTIMP intptr_t __cdecl _wfindfirst64(const wchar_t *_Filename,struct _wfinddata64_t *_FindData); + _CRTIMP int __cdecl _wfindnext32i64(intptr_t _FindHandle,struct _wfinddata32i64_t *_FindData); + int __cdecl _wfindnext64i32(intptr_t _FindHandle,struct _wfinddata64i32_t *_FindData); + _CRTIMP int __cdecl _wfindnext64(intptr_t _FindHandle,struct _wfinddata64_t *_FindData); +#endif -/* Optional third argument is unsigned unPermissions. */ -_CRTIMP int __cdecl __MINGW_NOTHROW _open (const char*, int, ...); + _CRTIMP errno_t __cdecl _wsopen_s(int *_FileHandle,const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionFlag); -_CRTIMP int __cdecl __MINGW_NOTHROW _open_osfhandle (long, int); -_CRTIMP int __cdecl __MINGW_NOTHROW _pipe (int *, unsigned int, int); -_CRTIMP int __cdecl __MINGW_NOTHROW _read (int, void*, unsigned int); -_CRTIMP int __cdecl __MINGW_NOTHROW _setmode (int, int); -/* MS puts remove & rename (but not wide versions) in io.h as well - as in stdio.h. */ -_CRTIMP int __cdecl __MINGW_NOTHROW remove (const char*); -_CRTIMP int __cdecl __MINGW_NOTHROW rename (const char*, const char*); +#if !defined(__cplusplus) || !(defined(_X86_) && !defined(__x86_64)) + _CRTIMP int __cdecl _wopen(const wchar_t *_Filename,int _OpenFlag,...); + _CRTIMP int __cdecl _wsopen(const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,...); +#else + extern "C++" _CRTIMP int __cdecl _wopen(const wchar_t *_Filename,int _OpenFlag,int _PermissionMode = 0); + extern "C++" _CRTIMP int __cdecl _wsopen(const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionMode = 0); +#endif -/* SH_... flags for nShFlags defined in share.h - * Optional fourth argument is unsigned unPermissions */ -_CRTIMP int __cdecl __MINGW_NOTHROW _sopen (const char*, int, int, ...); +#endif -_CRTIMP long __cdecl __MINGW_NOTHROW _tell (int); -/* Should umask be in sys/stat.h and/or sys/types.h instead? */ -_CRTIMP int __cdecl __MINGW_NOTHROW _umask (int); -_CRTIMP int __cdecl __MINGW_NOTHROW _unlink (const char*); -_CRTIMP int __cdecl __MINGW_NOTHROW _write (int, const void*, unsigned int); + int __cdecl __lock_fhandle(int _Filehandle); + void __cdecl _unlock_fhandle(int _Filehandle); + _CRTIMP intptr_t __cdecl _get_osfhandle(int _FileHandle); + _CRTIMP int __cdecl _open_osfhandle(intptr_t _OSFileHandle,int _Flags); -/* Wide character versions. Also declared in wchar.h. */ -/* Not in crtdll.dll */ -#if !defined (_WIO_DEFINED) -#if defined (__MSVCRT__) -_CRTIMP int __cdecl __MINGW_NOTHROW _waccess(const wchar_t*, int); -_CRTIMP int __cdecl __MINGW_NOTHROW _wchmod(const wchar_t*, int); -_CRTIMP int __cdecl __MINGW_NOTHROW _wcreat(const wchar_t*, int); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindfirst(const wchar_t*, struct _wfinddata_t*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindnext(intptr_t, struct _wfinddata_t *); -_CRTIMP int __cdecl __MINGW_NOTHROW _wunlink(const wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wopen(const wchar_t*, int, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW _wsopen(const wchar_t*, int, int, ...); -_CRTIMP wchar_t * __cdecl __MINGW_NOTHROW _wmktemp(wchar_t*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindfirsti64(const wchar_t*, struct _wfinddatai64_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wfindnexti64(intptr_t, struct _wfinddatai64_t*); -#if __MSVCRT_VERSION__ >= 0x0601 -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindfirst64(const wchar_t*, struct __wfinddata64_t*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindnext64(intptr_t, struct __wfinddata64_t*); +#ifndef NO_OLDNAMES + int __cdecl access(const char *_Filename,int _AccessMode); + int __cdecl chmod(const char *_Filename,int _AccessMode); + int __cdecl chsize(int _FileHandle,long _Size); + int __cdecl close(int _FileHandle); + int __cdecl creat(const char *_Filename,int _PermissionMode); + int __cdecl dup(int _FileHandle); + int __cdecl dup2(int _FileHandleSrc,int _FileHandleDst); + int __cdecl eof(int _FileHandle); + long __cdecl filelength(int _FileHandle); + int __cdecl isatty(int _FileHandle); + int __cdecl locking(int _FileHandle,int _LockMode,long _NumOfBytes); + long __cdecl lseek(int _FileHandle,long _Offset,int _Origin); + char *__cdecl mktemp(char *_TemplateName); + int __cdecl open(const char *_Filename,int _OpenFlag,...); + int __cdecl read(int _FileHandle,void *_DstBuf,unsigned int _MaxCharCount); + int __cdecl setmode(int _FileHandle,int _Mode); + int __cdecl sopen(const char *_Filename,int _OpenFlag,int _ShareFlag,...); + long __cdecl tell(int _FileHandle); + int __cdecl umask(int _Mode); + int __cdecl write(int _Filehandle,const void *_Buf,unsigned int _MaxCharCount); #endif -#endif /* defined (__MSVCRT__) */ -#define _WIO_DEFINED -#endif /* _WIO_DEFINED */ -#ifndef _NO_OLDNAMES -/* - * Non-underscored versions of non-ANSI functions to improve portability. - * These functions live in libmoldname.a. - */ +#ifdef __cplusplus +} +#endif +#endif -#ifndef _UWIN -_CRTIMP int __cdecl __MINGW_NOTHROW access (const char*, int); -_CRTIMP int __cdecl __MINGW_NOTHROW chsize (int, long ); -_CRTIMP int __cdecl __MINGW_NOTHROW close (int); -_CRTIMP int __cdecl __MINGW_NOTHROW creat (const char*, int); -_CRTIMP int __cdecl __MINGW_NOTHROW dup (int); -_CRTIMP int __cdecl __MINGW_NOTHROW dup2 (int, int); -_CRTIMP int __cdecl __MINGW_NOTHROW eof (int); -_CRTIMP long __cdecl __MINGW_NOTHROW filelength (int); -_CRTIMP int __cdecl __MINGW_NOTHROW isatty (int); -_CRTIMP long __cdecl __MINGW_NOTHROW lseek (int, long, int); -_CRTIMP int __cdecl __MINGW_NOTHROW open (const char*, int, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW read (int, void*, unsigned int); -_CRTIMP int __cdecl __MINGW_NOTHROW setmode (int, int); -_CRTIMP int __cdecl __MINGW_NOTHROW sopen (const char*, int, int, ...); -_CRTIMP long __cdecl __MINGW_NOTHROW tell (int); -_CRTIMP int __cdecl __MINGW_NOTHROW umask (int); -_CRTIMP int __cdecl __MINGW_NOTHROW unlink (const char*); -_CRTIMP int __cdecl __MINGW_NOTHROW write (int, const void*, unsigned int); -#endif /* _UWIN */ +#ifdef __cplusplus +extern "C" { +#endif +/* Misc stuff */ +char *getlogin(void); +#ifdef __USE_MINGW_ALARM +unsigned int alarm(unsigned int seconds); +#endif + #ifdef __USE_MINGW_ACCESS /* Old versions of MSVCRT access() just ignored X_OK, while the version shipped with Vista, returns an error code. This will restore the old behaviour */ -static inline int __mingw_access (const char* __fname, int __mode) - { return _access (__fname, __mode & ~X_OK); } +static inline int __mingw_access (const char *__fname, int __mode) { + return _access (__fname, __mode & ~X_OK); +} + #define access(__f,__m) __mingw_access (__f, __m) #endif -/* Wide character versions. Also declared in wchar.h. */ -/* Where do these live? Not in libmoldname.a nor in libmsvcrt.a */ -#if 0 -int waccess(const wchar_t *, int); -int wchmod(const wchar_t *, int); -int wcreat(const wchar_t *, int); -long wfindfirst(wchar_t *, struct _wfinddata_t *); -int wfindnext(long, struct _wfinddata_t *); -int wunlink(const wchar_t *); -int wrename(const wchar_t *, const wchar_t *); -int wopen(const wchar_t *, int, ...); -int wsopen(const wchar_t *, int, int, ...); -wchar_t * wmktemp(wchar_t *); -#endif -#endif /* Not _NO_OLDNAMES */ - -#ifdef __cplusplus +#ifdef __cplusplus } #endif -#endif /* Not RC_INVOKED */ -#endif /* _IO_H_ not defined */ +#pragma pack(pop) + +#include + +#endif /* End _IO_H_ */ + Index: include/crt/limits.h =================================================================== --- include/crt/limits.h (Revision 37928) +++ include/crt/limits.h (Arbeitskopie) @@ -1,110 +1,111 @@ -/* - * limits.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Functions for manipulating paths and directories (included from io.h) - * plus functions for setting the current drive. - * - * Defines constants for the sizes of integral types. - * - * NOTE: GCC should supply a version of this header and it should be safe to - * use that version instead of this one (maybe safer). - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ - -#ifndef _LIMITS_H_ -#define _LIMITS_H_ - -/* All the headers include this file. */ #include <_mingw.h> -/* - * File system limits - * - * TODO: NAME_MAX and OPEN_MAX are file system limits or not? Are they the - * same as FILENAME_MAX and FOPEN_MAX from stdio.h? - * NOTE: Apparently the actual size of PATH_MAX is 260, but a space is - * required for the NUL. TODO: Test? - */ -#define PATH_MAX 259 +#ifndef _INC_LIMITS +#define _INC_LIMITS /* - * Characteristics of the char data type. - */ -#define CHAR_BIT 8 -#define MB_LEN_MAX 2 +* File system limits +* +* TODO: NAME_MAX and OPEN_MAX are file system limits or not? Are they the +* same as FILENAME_MAX and FOPEN_MAX from stdio.h? +* NOTE: Apparently the actual size of PATH_MAX is 260, but a space is +* required for the NUL. TODO: Test? +*/ +#define PATH_MAX (259) -#define SCHAR_MIN (-128) -#define SCHAR_MAX 127 +#define CHAR_BIT 8 +#define SCHAR_MIN (-128) +#define SCHAR_MAX 127 +#define UCHAR_MAX 0xff -#define UCHAR_MAX 255 +#define CHAR_MIN SCHAR_MIN +#define CHAR_MAX SCHAR_MAX -/* TODO: Is this safe? I think it might just be testing the preprocessor, - * not the compiler itself... */ -#if ('\x80' < 0) -#define CHAR_MIN SCHAR_MIN -#define CHAR_MAX SCHAR_MAX -#else -#define CHAR_MIN 0 -#define CHAR_MAX UCHAR_MAX +#define MB_LEN_MAX 5 +#define SHRT_MIN (-32768) +#define SHRT_MAX 32767 +#define USHRT_MAX 0xffff +#define INT_MIN (-2147483647 - 1) +#define INT_MAX 2147483647 +#define UINT_MAX 0xffffffff +#define LONG_MIN (-2147483647L - 1) +#define LONG_MAX 2147483647L +#define ULONG_MAX 0xffffffffUL +#define LLONG_MAX 9223372036854775807ll +#define LLONG_MIN (-9223372036854775807ll - 1) +#define ULLONG_MAX 0xffffffffffffffffull + +#if _INTEGRAL_MAX_BITS >= 8 +#define _I8_MIN (-127 - 1) +#define _I8_MAX 127i8 +#define _UI8_MAX 0xffu #endif -/* - * Maximum and minimum values for ints. - */ -#define INT_MAX 2147483647 -#define INT_MIN (-INT_MAX-1) +#if _INTEGRAL_MAX_BITS >= 16 +#define _I16_MIN (-32767 - 1) +#define _I16_MAX 32767i16 +#define _UI16_MAX 0xffffu +#endif -#define UINT_MAX 0xffffffff +#if _INTEGRAL_MAX_BITS >= 32 +#define _I32_MIN (-2147483647 - 1) +#define _I32_MAX 2147483647 +#define _UI32_MAX 0xffffffffu +#endif -/* - * Maximum and minimum values for shorts. - */ -#define SHRT_MAX 32767 -#define SHRT_MIN (-SHRT_MAX-1) +#if defined(__GNUC__) +#undef LONG_LONG_MAX +#define LONG_LONG_MAX 9223372036854775807ll +#undef LONG_LONG_MIN +#define LONG_LONG_MIN (-LONG_LONG_MAX-1) +#undef ULONG_LONG_MAX +#define ULONG_LONG_MAX (2ull * LONG_LONG_MAX + 1ull) +#endif -#define USHRT_MAX 0xffff +#if _INTEGRAL_MAX_BITS >= 64 +#define _I64_MIN (-9223372036854775807ll - 1) +#define _I64_MAX 9223372036854775807ll +#define _UI64_MAX 0xffffffffffffffffull +#endif -/* - * Maximum and minimum values for longs and unsigned longs. - * - * TODO: This is not correct for Alphas, which have 64 bit longs. - */ -#define LONG_MAX 2147483647L -#define LONG_MIN (-LONG_MAX-1) - -#define ULONG_MAX 0xffffffffUL - -#ifndef __STRICT_ANSI__ -/* POSIX wants this. */ -#define SSIZE_MAX LONG_MAX +#ifndef SIZE_MAX +#ifdef _WIN64 +#define SIZE_MAX _UI64_MAX +#else +#define SIZE_MAX UINT_MAX #endif +#endif -#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \ - || !defined(__STRICT_ANSI__) -/* ISO C9x macro names */ -#define LLONG_MAX 9223372036854775807LL -#define LLONG_MIN (-LLONG_MAX - 1) -#define ULLONG_MAX (2ULL * LLONG_MAX + 1) +#ifdef _POSIX_ +#define _POSIX_ARG_MAX 4096 +#define _POSIX_CHILD_MAX 6 +#define _POSIX_LINK_MAX 8 +#define _POSIX_MAX_CANON 255 +#define _POSIX_MAX_INPUT 255 +#define _POSIX_NAME_MAX 14 +#define _POSIX_NGROUPS_MAX 0 +#define _POSIX_OPEN_MAX 16 +#define _POSIX_PATH_MAX 255 +#define _POSIX_PIPE_BUF 512 +#define _POSIX_SSIZE_MAX 32767 +#define _POSIX_STREAM_MAX 8 +#define _POSIX_TZNAME_MAX 3 +#define ARG_MAX 14500 +#define LINK_MAX 1024 +#define MAX_CANON _POSIX_MAX_CANON +#define MAX_INPUT _POSIX_MAX_INPUT +#define NAME_MAX 255 +#define NGROUPS_MAX 16 +#define OPEN_MAX 32 +#define PATH_MAX 512 +#define PIPE_BUF _POSIX_PIPE_BUF +#define SSIZE_MAX _POSIX_SSIZE_MAX +#define STREAM_MAX 20 +#define TZNAME_MAX 10 #endif - -/* - * The GNU C compiler also allows 'long long int' - */ -#if !defined(__STRICT_ANSI__) && defined(__GNUC__) - -#define LONG_LONG_MAX 9223372036854775807LL -#define LONG_LONG_MIN (-LONG_LONG_MAX-1) -#define ULONG_LONG_MAX (2ULL * LONG_LONG_MAX + 1) - -/* MSVC compatibility */ -#define _I64_MIN LONG_LONG_MIN -#define _I64_MAX LONG_LONG_MAX -#define _UI64_MAX ULONG_LONG_MAX - -#endif /* Not Strict ANSI and GNU C compiler */ - - -#endif /* not _LIMITS_H_ */ +#endif Index: include/crt/locale.h =================================================================== --- include/crt/locale.h (Revision 37928) +++ include/crt/locale.h (Arbeitskopie) @@ -1,89 +1,91 @@ -/* - * locale.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Functions and types for localization (ie. changing the appearance of - * output based on the standards of a certain country). - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ +#ifndef _INC_LOCALE +#define _INC_LOCALE -#ifndef _LOCALE_H_ -#define _LOCALE_H_ - -/* All the headers include this file. */ #include <_mingw.h> -/* - * NOTE: I have tried to test this, but I am limited by my knowledge of - * locale issues. The structure does not bomb if you look at the - * values, and 'decimal_point' even seems to be correct. But the - * rest of the values are, by default, not particularly useful - * (read meaningless and not related to the international settings - * of the system). - */ +#pragma pack(push,_CRT_PACKING) -#define LC_ALL 0 -#define LC_COLLATE 1 -#define LC_CTYPE 2 -#define LC_MONETARY 3 -#define LC_NUMERIC 4 -#define LC_TIME 5 -#define LC_MIN LC_ALL -#define LC_MAX LC_TIME +#ifdef __cplusplus +extern "C" { +#endif -#ifndef RC_INVOKED +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif -/* According to C89 std, NULL is defined in locale.h too. */ -#define __need_NULL -#include +#define LC_ALL 0 +#define LC_COLLATE 1 +#define LC_CTYPE 2 +#define LC_MONETARY 3 +#define LC_NUMERIC 4 +#define LC_TIME 5 -/* - * The structure returned by 'localeconv'. - */ -struct lconv -{ - char* decimal_point; - char* thousands_sep; - char* grouping; - char* int_curr_symbol; - char* currency_symbol; - char* mon_decimal_point; - char* mon_thousands_sep; - char* mon_grouping; - char* positive_sign; - char* negative_sign; - char int_frac_digits; - char frac_digits; - char p_cs_precedes; - char p_sep_by_space; - char n_cs_precedes; - char n_sep_by_space; - char p_sign_posn; - char n_sign_posn; -}; +#define LC_MIN LC_ALL +#define LC_MAX LC_TIME -#ifdef __cplusplus -extern "C" { +#ifndef _LCONV_DEFINED +#define _LCONV_DEFINED + struct lconv { + char *decimal_point; + char *thousands_sep; + char *grouping; + char *int_curr_symbol; + char *currency_symbol; + char *mon_decimal_point; + char *mon_thousands_sep; + char *mon_grouping; + char *positive_sign; + char *negative_sign; + char int_frac_digits; + char frac_digits; + char p_cs_precedes; + char p_sep_by_space; + char n_cs_precedes; + char n_sep_by_space; + char p_sign_posn; + char n_sign_posn; + }; #endif -_CRTIMP char* __cdecl __MINGW_NOTHROW setlocale (int, const char*); -_CRTIMP struct lconv* __cdecl __MINGW_NOTHROW localeconv (void); +#ifndef _CONFIG_LOCALE_SWT +#define _CONFIG_LOCALE_SWT -#ifndef _WLOCALE_DEFINED /* also declared in wchar.h */ -# define __need_wchar_t -# include - _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wsetlocale(int, const wchar_t*); -# define _WLOCALE_DEFINED -#endif /* ndef _WLOCALE_DEFINED */ +#define _ENABLE_PER_THREAD_LOCALE 0x1 +#define _DISABLE_PER_THREAD_LOCALE 0x2 +#define _ENABLE_PER_THREAD_LOCALE_GLOBAL 0x10 +#define _DISABLE_PER_THREAD_LOCALE_GLOBAL 0x20 +#define _ENABLE_PER_THREAD_LOCALE_NEW 0x100 +#define _DISABLE_PER_THREAD_LOCALE_NEW 0x200 -#ifdef __cplusplus -} #endif -#endif /* Not RC_INVOKED */ + int __cdecl _configthreadlocale(int _Flag); + char *__cdecl setlocale(int _Category,const char *_Locale); + _CRTIMP struct lconv *__cdecl localeconv(void); + _locale_t __cdecl _get_current_locale(void); + _locale_t __cdecl _create_locale(int _Category,const char *_Locale); + void __cdecl _free_locale(_locale_t _Locale); + _locale_t __cdecl __get_current_locale(void); + _locale_t __cdecl __create_locale(int _Category,const char *_Locale); + void __cdecl __free_locale(_locale_t _Locale); -#endif /* Not _LOCALE_H_ */ +#ifndef _WLOCALE_DEFINED +#define _WLOCALE_DEFINED + _CRTIMP wchar_t *__cdecl _wsetlocale(int _Category,const wchar_t *_Locale); +#endif +#ifdef __cplusplus +} +#endif +#pragma pack(pop) +#endif Index: include/crt/malloc.h =================================================================== --- include/crt/malloc.h (Revision 37928) +++ include/crt/malloc.h (Arbeitskopie) @@ -1,98 +1,177 @@ -/* - * malloc.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Support for programs which want to use malloc.h to get memory management - * functions. Unless you absolutely need some of these functions and they are - * not in the ANSI headers you should use the ANSI standard header files - * instead. - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ - #ifndef _MALLOC_H_ #define _MALLOC_H_ -/* All the headers include this file. */ #include <_mingw.h> -#include +#pragma pack(push,_CRT_PACKING) -#ifndef RC_INVOKED +#ifndef _MM_MALLOC_H_INCLUDED +#define _MM_MALLOC_H_INCLUDED +#endif -/* - * The structure used to walk through the heap with _heapwalk. - */ -typedef struct _heapinfo -{ - int* _pentry; - size_t _size; - int _useflag; -} _HEAPINFO; +#ifdef __cplusplus +extern "C" { +#endif +#ifdef _WIN64 +#define _HEAP_MAXREQ 0xFFFFFFFFFFFFFFE0 +#else +#define _HEAP_MAXREQ 0xFFFFFFE0 +#endif + +#ifndef _STATIC_ASSERT +#define _STATIC_ASSERT(expr) typedef char __static_assert_t[(expr)] +#endif + +/* Return codes for _heapwalk() */ +#define _HEAPEMPTY (-1) +#define _HEAPOK (-2) +#define _HEAPBADBEGIN (-3) +#define _HEAPBADNODE (-4) +#define _HEAPEND (-5) +#define _HEAPBADPTR (-6) + /* Values for _heapinfo.useflag */ #define _FREEENTRY 0 #define _USEDENTRY 1 -/* Return codes for _heapwalk() */ -#define _HEAPEMPTY (-1) -#define _HEAPOK (-2) -#define _HEAPBADBEGIN (-3) -#define _HEAPBADNODE (-4) -#define _HEAPEND (-5) -#define _HEAPBADPTR (-6) +#ifndef _HEAPINFO_DEFINED +#define _HEAPINFO_DEFINED + /* The structure used to walk through the heap with _heapwalk. */ + typedef struct _heapinfo { + int *_pentry; + size_t _size; + int _useflag; + } _HEAPINFO; +#endif -#ifdef __cplusplus -extern "C" { + extern unsigned int _amblksiz; + +#define _mm_free(a) _aligned_free(a) +#define _mm_malloc(a,b) _aligned_malloc(a,b) + +#ifndef _CRT_ALLOCATION_DEFINED +#define _CRT_ALLOCATION_DEFINED + void *__cdecl calloc(size_t _NumOfElements,size_t _SizeOfElements); + void __cdecl free(void *_Memory); + void *__cdecl malloc(size_t _Size); + void *__cdecl realloc(void *_Memory,size_t _NewSize); + _CRTIMP void *__cdecl _recalloc(void *_Memory,size_t _Count,size_t _Size); + /* _CRTIMP void __cdecl _aligned_free(void *_Memory); + _CRTIMP void *__cdecl _aligned_malloc(size_t _Size,size_t _Alignment); */ + _CRTIMP void *__cdecl _aligned_offset_malloc(size_t _Size,size_t _Alignment,size_t _Offset); + _CRTIMP void *__cdecl _aligned_realloc(void *_Memory,size_t _Size,size_t _Alignment); + _CRTIMP void *__cdecl _aligned_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment); + _CRTIMP void *__cdecl _aligned_offset_realloc(void *_Memory,size_t _Size,size_t _Alignment,size_t _Offset); + _CRTIMP void *__cdecl _aligned_offset_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment,size_t _Offset); #endif -/* - The _heap* memory allocation functions are supported on NT - but not W9x. On latter, they always set errno to ENOSYS. -*/ -_CRTIMP int __cdecl __MINGW_NOTHROW _heapwalk (_HEAPINFO*); + +#define _MAX_WAIT_MALLOC_CRT 60000 + + _CRTIMP int __cdecl _resetstkoflw (void); + _CRTIMP unsigned long __cdecl _set_malloc_crt_max_wait(unsigned long _NewValue); + + _CRTIMP void *__cdecl _expand(void *_Memory,size_t _NewSize); + _CRTIMP size_t __cdecl _msize(void *_Memory); #ifdef __GNUC__ +#undef _alloca #define _alloca(x) __builtin_alloca((x)) +#else + void *__cdecl _alloca(size_t _Size); #endif + _CRTIMP size_t __cdecl _get_sbh_threshold(void); + _CRTIMP int __cdecl _set_sbh_threshold(size_t _NewValue); + _CRTIMP errno_t __cdecl _set_amblksiz(size_t _Value); + _CRTIMP errno_t __cdecl _get_amblksiz(size_t *_Value); + _CRTIMP int __cdecl _heapadd(void *_Memory,size_t _Size); + _CRTIMP int __cdecl _heapchk(void); + _CRTIMP int __cdecl _heapmin(void); + _CRTIMP int __cdecl _heapset(unsigned int _Fill); + _CRTIMP int __cdecl _heapwalk(_HEAPINFO *_EntryInfo); + _CRTIMP size_t __cdecl _heapused(size_t *_Used,size_t *_Commit); + _CRTIMP intptr_t __cdecl _get_heap_handle(void); -#ifndef _NO_OLDNAMES -_CRTIMP int __cdecl __MINGW_NOTHROW heapwalk (_HEAPINFO*); -#ifdef __GNUC__ -#define alloca(x) __builtin_alloca((x)) +#define _ALLOCA_S_THRESHOLD 1024 +#define _ALLOCA_S_STACK_MARKER 0xCCCC +#define _ALLOCA_S_HEAP_MARKER 0xDDDD + +#if(defined(_X86_) && !defined(__x86_64)) +#define _ALLOCA_S_MARKER_SIZE 8 +#elif defined(__ia64__) || defined(__x86_64) +#define _ALLOCA_S_MARKER_SIZE 16 #endif -#endif /* Not _NO_OLDNAMES */ -_CRTIMP int __cdecl __MINGW_NOTHROW _heapchk (void); /* Verify heap integrety. */ -_CRTIMP int __cdecl __MINGW_NOTHROW _heapmin (void); /* Return unused heap to the OS. */ -_CRTIMP int __cdecl __MINGW_NOTHROW _heapset (unsigned int); +#if !defined(RC_INVOKED) + static __inline void *_MarkAllocaS(void *_Ptr,unsigned int _Marker) { + if(_Ptr) { + *((unsigned int*)_Ptr) = _Marker; + _Ptr = (char*)_Ptr + _ALLOCA_S_MARKER_SIZE; + } + return _Ptr; + } +#endif -_CRTIMP size_t __cdecl __MINGW_NOTHROW _msize (void*); -_CRTIMP size_t __cdecl __MINGW_NOTHROW _get_sbh_threshold (void); -_CRTIMP int __cdecl __MINGW_NOTHROW _set_sbh_threshold (size_t); -_CRTIMP void* __cdecl __MINGW_NOTHROW _expand (void*, size_t); +#undef _malloca +#define _malloca(size) \ + ((((size) + _ALLOCA_S_MARKER_SIZE) <= _ALLOCA_S_THRESHOLD) ? \ + _MarkAllocaS(_alloca((size) + _ALLOCA_S_MARKER_SIZE),_ALLOCA_S_STACK_MARKER) : \ + _MarkAllocaS(malloc((size) + _ALLOCA_S_MARKER_SIZE),_ALLOCA_S_HEAP_MARKER)) +#undef _FREEA_INLINE +#define _FREEA_INLINE -/* These require msvcr70.dll or higher. */ -#if __MSVCRT_VERSION__ >= 0x0700 -_CRTIMP void * __cdecl __MINGW_NOTHROW _aligned_offset_malloc(size_t, size_t, size_t); -_CRTIMP void * __cdecl __MINGW_NOTHROW _aligned_offset_realloc(void*, size_t, size_t, size_t); +#ifndef RC_INVOKED +#undef _freea + static __inline void __cdecl _freea(void *_Memory) { + unsigned int _Marker; + if(_Memory) { + _Memory = (char*)_Memory - _ALLOCA_S_MARKER_SIZE; + _Marker = *(unsigned int *)_Memory; + if(_Marker==_ALLOCA_S_HEAP_MARKER) { + free(_Memory); + } +#ifdef _ASSERTE + else if(_Marker!=_ALLOCA_S_STACK_MARKER) { + _ASSERTE(("Corrupted pointer passed to _freea",0)); + } +#endif + } + } +#endif /* RC_INVOKED */ -_CRTIMP void * __cdecl __MINGW_NOTHROW _aligned_malloc (size_t, size_t); -_CRTIMP void * __cdecl __MINGW_NOTHROW _aligned_realloc (void*, size_t, size_t); -_CRTIMP void __cdecl __MINGW_NOTHROW _aligned_free (void*); -#endif /* __MSVCRT_VERSION__ >= 0x0700 */ +#ifndef NO_OLDNAMES +#undef alloca +#ifdef __GNUC__ +#define alloca(x) __builtin_alloca((x)) +#else +#define alloca _alloca +#endif +#endif -/* These require libmingwex.a. */ -void * __cdecl __MINGW_NOTHROW __mingw_aligned_offset_malloc (size_t, size_t, size_t); -void * __cdecl __MINGW_NOTHROW __mingw_aligned_offset_realloc (void*, size_t, size_t, size_t); +#ifdef HEAPHOOK +#ifndef _HEAPHOOK_DEFINED +#define _HEAPHOOK_DEFINED + typedef int (__cdecl *_HEAPHOOK)(int,size_t,void *,void **); +#endif -void * __cdecl __MINGW_NOTHROW __mingw_aligned_malloc (size_t, size_t); -void * __cdecl __MINGW_NOTHROW __mingw_aligned_realloc (void*, size_t, size_t); -void __cdecl __MINGW_NOTHROW __mingw_aligned_free (void*); + _CRTIMP _HEAPHOOK __cdecl _setheaphook(_HEAPHOOK _NewHook); +#define _HEAP_MALLOC 1 +#define _HEAP_CALLOC 2 +#define _HEAP_FREE 3 +#define _HEAP_REALLOC 4 +#define _HEAP_MSIZE 5 +#define _HEAP_EXPAND 6 +#endif + #ifdef __cplusplus } #endif -#endif /* RC_INVOKED */ +#pragma pack(pop) -#endif /* Not _MALLOC_H_ */ +#endif /* _MALLOC_H_ */ Index: include/crt/math.h =================================================================== --- include/crt/math.h (Revision 37928) +++ include/crt/math.h (Arbeitskopie) @@ -1,14 +1,8 @@ -/* - * math.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Mathematical functions. - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ - - #ifndef _MATH_H_ #define _MATH_H_ @@ -16,787 +10,723 @@ #pragma GCC system_header #endif -/* All the headers include this file. */ #include <_mingw.h> -/* - * Types for the _exception structure. - */ +struct exception; -#define _DOMAIN 1 /* domain error in argument */ -#define _SING 2 /* singularity */ -#define _OVERFLOW 3 /* range overflow */ -#define _UNDERFLOW 4 /* range underflow */ -#define _TLOSS 5 /* total loss of precision */ -#define _PLOSS 6 /* partial loss of precision */ +#pragma pack(push,_CRT_PACKING) -/* - * Exception types with non-ANSI names for compatibility. - */ - -#ifndef __STRICT_ANSI__ -#ifndef _NO_OLDNAMES - -#define DOMAIN _DOMAIN -#define SING _SING -#define OVERFLOW _OVERFLOW -#define UNDERFLOW _UNDERFLOW -#define TLOSS _TLOSS -#define PLOSS _PLOSS - -#endif /* Not _NO_OLDNAMES */ -#endif /* Not __STRICT_ANSI__ */ - - -/* Traditional/XOPEN math constants (double precison) */ -#ifndef __STRICT_ANSI__ -#define M_E 2.7182818284590452354 -#define M_LOG2E 1.4426950408889634074 -#define M_LOG10E 0.43429448190325182765 -#define M_LN2 0.69314718055994530942 -#define M_LN10 2.30258509299404568402 -#define M_PI 3.14159265358979323846 -#define M_PI_2 1.57079632679489661923 -#define M_PI_4 0.78539816339744830962 -#define M_1_PI 0.31830988618379067154 -#define M_2_PI 0.63661977236758134308 -#define M_2_SQRTPI 1.12837916709551257390 -#define M_SQRT2 1.41421356237309504880 -#define M_SQRT1_2 0.70710678118654752440 -#endif - -/* These are also defined in Mingw float.h; needed here as well to work - around GCC build issues. */ -#ifndef __STRICT_ANSI__ -#ifndef __MINGW_FPCLASS_DEFINED -#define __MINGW_FPCLASS_DEFINED 1 -/* IEEE 754 classication */ -#define _FPCLASS_SNAN 0x0001 /* Signaling "Not a Number" */ -#define _FPCLASS_QNAN 0x0002 /* Quiet "Not a Number" */ -#define _FPCLASS_NINF 0x0004 /* Negative Infinity */ -#define _FPCLASS_NN 0x0008 /* Negative Normal */ -#define _FPCLASS_ND 0x0010 /* Negative Denormal */ -#define _FPCLASS_NZ 0x0020 /* Negative Zero */ -#define _FPCLASS_PZ 0x0040 /* Positive Zero */ -#define _FPCLASS_PD 0x0080 /* Positive Denormal */ -#define _FPCLASS_PN 0x0100 /* Positive Normal */ -#define _FPCLASS_PINF 0x0200 /* Positive Infinity */ -#endif /* __MINGW_FPCLASS_DEFINED */ -#endif /* Not __STRICT_ANSI__ */ - -#ifndef RC_INVOKED - #ifdef __cplusplus extern "C" { #endif -/* - * HUGE_VAL is returned by strtod when the value would overflow the - * representation of 'double'. There are other uses as well. - * - * __imp__HUGE is a pointer to the actual variable _HUGE in - * MSVCRT.DLL. If we used _HUGE directly we would get a pointer - * to a thunk function. - * - * NOTE: The CRTDLL version uses _HUGE_dll instead. - */ +#ifndef _EXCEPTION_DEFINED +#define _EXCEPTION_DEFINED + struct _exception { + int type; + char *name; + double arg1; + double arg2; + double retval; + }; +#endif -#if __MINGW_GNUC_PREREQ(3, 3) -#define HUGE_VAL __builtin_huge_val() -#else +#ifndef _COMPLEX_DEFINED +#define _COMPLEX_DEFINED + struct _complex { + double x,y; + }; +#endif -#ifndef __DECLSPEC_SUPPORTED +#define _DOMAIN 1 +#define _SING 2 +#define _OVERFLOW 3 +#define _UNDERFLOW 4 +#define _TLOSS 5 +#define _PLOSS 6 -#ifdef __MSVCRT__ -extern double* _imp___HUGE; -#define HUGE_VAL (*_imp___HUGE) +#define EDOM 33 +#define ERANGE 34 + +#ifndef _HUGE +#ifdef _MSVCRT_ + extern double *_HUGE; #else -/* CRTDLL */ -extern double* _imp___HUGE_dll; -#define HUGE_VAL (*_imp___HUGE_dll) + extern double *_imp___HUGE; +#define _HUGE (*_imp___HUGE) #endif +#endif -#else /* __DECLSPEC_SUPPORTED */ +#define HUGE_VAL _HUGE -#ifdef __MSVCRT__ -__MINGW_IMPORT double _HUGE; -#define HUGE_VAL _HUGE -#else -/* CRTDLL */ -__MINGW_IMPORT double _HUGE_dll; -#define HUGE_VAL _HUGE_dll +#ifndef _CRT_ABS_DEFINED +#define _CRT_ABS_DEFINED + int __cdecl abs(int _X); + long __cdecl labs(long _X); #endif + double __cdecl acos(double _X); + double __cdecl asin(double _X); + double __cdecl atan(double _X); + double __cdecl atan2(double _Y,double _X); +#ifndef _SIGN_DEFINED +#define _SIGN_DEFINED + _CRTIMP double __cdecl _copysign (double _Number,double _Sign); + _CRTIMP double __cdecl _chgsign (double _X); +#endif + double __cdecl cos(double _X); + double __cdecl cosh(double _X); + double __cdecl exp(double _X); + double __cdecl fabs(double _X); + double __cdecl fmod(double _X,double _Y); + double __cdecl log(double _X); + double __cdecl log10(double _X); + double __cdecl pow(double _X,double _Y); + double __cdecl sin(double _X); + double __cdecl sinh(double _X); + double __cdecl tan(double _X); + double __cdecl tanh(double _X); + double __cdecl sqrt(double _X); +#ifndef _CRT_ATOF_DEFINED +#define _CRT_ATOF_DEFINED + double __cdecl atof(const char *_String); + double __cdecl _atof_l(const char *_String,_locale_t _Locale); +#endif -#endif /* __DECLSPEC_SUPPORTED */ -#endif /* __MINGW_GNUC_PREREQ(3, 3) */ + _CRTIMP double __cdecl _cabs(struct _complex _ComplexA); + double __cdecl ceil(double _X); + double __cdecl floor(double _X); + double __cdecl frexp(double _X,int *_Y); + double __cdecl _hypot(double _X,double _Y); + _CRTIMP double __cdecl _j0(double _X); + _CRTIMP double __cdecl _j1(double _X); + _CRTIMP double __cdecl _jn(int _X,double _Y); + double __cdecl ldexp(double _X,int _Y); +#ifndef _CRT_MATHERR_DEFINED +#define _CRT_MATHERR_DEFINED + int __cdecl _matherr(struct _exception *_Except); +#endif + double __cdecl modf(double _X,double *_Y); + _CRTIMP double __cdecl _y0(double _X); + _CRTIMP double __cdecl _y1(double _X); + _CRTIMP double __cdecl _yn(int _X,double _Y); +#if(defined(_X86_) && !defined(__x86_64)) + _CRTIMP int __cdecl _set_SSE2_enable(int _Flag); + /* from libmingwex */ + float __cdecl _hypotf(float _X,float _Y); +#endif -struct _exception -{ - int type; - char *name; - double arg1; - double arg2; - double retval; -}; + float frexpf(float _X,int *_Y); + float __cdecl ldexpf(float _X,int _Y); + long double __cdecl ldexpl(long double _X,int _Y); + float __cdecl acosf(float _X); + float __cdecl asinf(float _X); + float __cdecl atanf(float _X); + float __cdecl atan2f(float _X,float _Y); + float __cdecl cosf(float _X); + float __cdecl sinf(float _X); + float __cdecl tanf(float _X); + float __cdecl coshf(float _X); + float __cdecl sinhf(float _X); + float __cdecl tanhf(float _X); + float __cdecl expf(float _X); + float __cdecl logf(float _X); + float __cdecl log10f(float _X); + float __cdecl modff(float _X,float *_Y); + float __cdecl powf(float _X,float _Y); + float __cdecl sqrtf(float _X); + float __cdecl ceilf(float _X); + float __cdecl floorf(float _X); + float __cdecl fmodf(float _X,float _Y); + float __cdecl _hypotf(float _X,float _Y); + float __cdecl fabsf(float _X); +#if !defined(__ia64__) + /* from libmingwex */ + float __cdecl _copysignf (float _Number,float _Sign); + float __cdecl _chgsignf (float _X); + float __cdecl _logbf(float _X); + float __cdecl _nextafterf(float _X,float _Y); + int __cdecl _finitef(float _X); + int __cdecl _isnanf(float _X); + int __cdecl _fpclassf(float _X); +#endif -_CRTIMP double __cdecl sin (double); -_CRTIMP double __cdecl cos (double); -_CRTIMP double __cdecl tan (double); -_CRTIMP double __cdecl sinh (double); -_CRTIMP double __cdecl cosh (double); -_CRTIMP double __cdecl tanh (double); -_CRTIMP double __cdecl asin (double); -_CRTIMP double __cdecl acos (double); -_CRTIMP double __cdecl atan (double); -_CRTIMP double __cdecl atan2 (double, double); -_CRTIMP double __cdecl exp (double); -_CRTIMP double __cdecl log (double); -_CRTIMP double __cdecl log10 (double); -_CRTIMP double __cdecl pow (double, double); -_CRTIMP double __cdecl sqrt (double); -_CRTIMP double __cdecl ceil (double); -_CRTIMP double __cdecl floor (double); -_CRTIMP double __cdecl fabs (double); -_CRTIMP double __cdecl ldexp (double, int); -_CRTIMP double __cdecl frexp (double, int*); -_CRTIMP double __cdecl modf (double, double*); -_CRTIMP double __cdecl fmod (double, double); +#ifndef __cplusplus + __CRT_INLINE long double __cdecl fabsl (long double x) + { + long double res; + __asm__ ("fabs;" : "=t" (res) : "0" (x)); + return res; + } +#define _hypotl(x,y) ((long double)_hypot((double)(x),(double)(y))) +#define _matherrl _matherr + __CRT_INLINE long double _chgsignl(long double _Number) { return _chgsign((double)(_Number)); } + __CRT_INLINE long double _copysignl(long double _Number,long double _Sign) { return _copysign((double)(_Number),(double)(_Sign)); } + __CRT_INLINE float frexpf(float _X,int *_Y) { return ((float)frexp((double)_X,_Y)); } -/* Excess precision when using a 64-bit mantissa for FPU math ops can - cause unexpected results with some of the MSVCRT math functions. For - example, unless the function return value is stored (truncating to - 53-bit mantissa), calls to pow with both x and y as integral values - sometimes produce a non-integral result. - One workaround is to reset the FPU env to 53-bit mantissa - by a call to fesetenv (FE_PC53_ENV). Amother is to force storage - of the return value of individual math functions using wrappers. - NB, using these wrappers will disable builtin math functions and - hence disable the folding of function results at compile time when - arguments are constant. */ +#if !defined (__ia64__) + __CRT_INLINE float __cdecl fabsf (float x) + { + float res; + __asm__ ("fabs;" : "=t" (res) : "0" (x)); + return res; + } -#if 0 -#define __DEFINE_FLOAT_STORE_MATHFN_D1(fn1) \ -static __inline__ double \ -__float_store_ ## fn1 (double x) \ -{ \ - __volatile__ double res = (fn1) (x); \ - return res; \ -} - -#define __DEFINE_FLOAT_STORE_MATHFN_D2(fn2) \ -static __inline__ double \ -__float_store_ ## fn2 (double x, double y) \ -{ \ - __volatile__ double res = (fn2) (x, y); \ - return res; \ -} + __CRT_INLINE float __cdecl ldexpf (float x, int expn) { return (float) ldexp (x, expn); } #endif - -/* For example, here is how to force the result of the pow function - to be stored: */ -#if 0 -#undef pow -/* Define the ___float_store_pow function and use it instead of pow(). */ -__DEFINE_FLOAT_STORE_MATHFN_D2 (pow) -#define pow __float_store_pow +#else + // cplusplus + __CRT_INLINE long double __cdecl fabsl (long double x) + { + long double res; + __asm__ ("fabs;" : "=t" (res) : "0" (x)); + return res; + } + __CRT_INLINE long double modfl(long double _X,long double *_Y) { + double _Di,_Df = modf((double)_X,&_Di); + *_Y = (long double)_Di; + return (_Df); + } + __CRT_INLINE long double _chgsignl(long double _Number) { return _chgsign(static_cast(_Number)); } + __CRT_INLINE long double _copysignl(long double _Number,long double _Sign) { return _copysign(static_cast(_Number),static_cast(_Sign)); } + __CRT_INLINE float frexpf(float _X,int *_Y) { return ((float)frexp((double)_X,_Y)); } +#ifndef __ia64__ + __CRT_INLINE float __cdecl fabsf (float x) + { + float res; + __asm__ ("fabs;" : "=t" (res) : "0" (x)); + return res; + } + __CRT_INLINE float __cdecl ldexpf (float x, int expn) { return (float) ldexp (x, expn); } +#ifndef __x86_64 + __CRT_INLINE float acosf(float _X) { return ((float)acos((double)_X)); } + __CRT_INLINE float asinf(float _X) { return ((float)asin((double)_X)); } + __CRT_INLINE float atanf(float _X) { return ((float)atan((double)_X)); } + __CRT_INLINE float atan2f(float _X,float _Y) { return ((float)atan2((double)_X,(double)_Y)); } + __CRT_INLINE float ceilf(float _X) { return ((float)ceil((double)_X)); } + __CRT_INLINE float cosf(float _X) { return ((float)cos((double)_X)); } + __CRT_INLINE float coshf(float _X) { return ((float)cosh((double)_X)); } + __CRT_INLINE float expf(float _X) { return ((float)exp((double)_X)); } + __CRT_INLINE float floorf(float _X) { return ((float)floor((double)_X)); } + __CRT_INLINE float fmodf(float _X,float _Y) { return ((float)fmod((double)_X,(double)_Y)); } + __CRT_INLINE float logf(float _X) { return ((float)log((double)_X)); } + __CRT_INLINE float log10f(float _X) { return ((float)log10((double)_X)); } + __CRT_INLINE float modff(float _X,float *_Y) { + double _Di,_Df = modf((double)_X,&_Di); + *_Y = (float)_Di; + return ((float)_Df); + } + __CRT_INLINE float powf(float _X,float _Y) { return ((float)pow((double)_X,(double)_Y)); } + __CRT_INLINE float sinf(float _X) { return ((float)sin((double)_X)); } + __CRT_INLINE float sinhf(float _X) { return ((float)sinh((double)_X)); } + __CRT_INLINE float sqrtf(float _X) { return ((float)sqrt((double)_X)); } + __CRT_INLINE float tanf(float _X) { return ((float)tan((double)_X)); } + __CRT_INLINE float tanhf(float _X) { return ((float)tanh((double)_X)); } #endif +#endif +#endif -#ifndef __STRICT_ANSI__ +#ifndef NO_OLDNAMES +#define DOMAIN _DOMAIN +#define SING _SING +#define OVERFLOW _OVERFLOW +#define UNDERFLOW _UNDERFLOW +#define TLOSS _TLOSS +#define PLOSS _PLOSS +#define matherr _matherr -/* Complex number (for _cabs). This is the MS version. The ISO - C99 counterpart _Complex is an intrinsic type in GCC and - 'complex' is defined as a macro. See complex.h */ -struct _complex -{ - double x; /* Real part */ - double y; /* Imaginary part */ -}; +#define HUGE _HUGE + /* double __cdecl cabs(struct _complex _X); */ + double __cdecl hypot(double _X,double _Y); + _CRTIMP double __cdecl j0(double _X); + _CRTIMP double __cdecl j1(double _X); + _CRTIMP double __cdecl jn(int _X,double _Y); + _CRTIMP double __cdecl y0(double _X); + _CRTIMP double __cdecl y1(double _X); + _CRTIMP double __cdecl yn(int _X,double _Y); +#endif -_CRTIMP double __cdecl _cabs (struct _complex); - -_CRTIMP double __cdecl _hypot (double, double); -_CRTIMP double __cdecl _j0 (double); -_CRTIMP double __cdecl _j1 (double); -_CRTIMP double __cdecl _jn (int, double); -_CRTIMP double __cdecl _y0 (double); -_CRTIMP double __cdecl _y1 (double); -_CRTIMP double __cdecl _yn (int, double); -_CRTIMP int __cdecl _matherr (struct _exception *); - -/* These are also declared in Mingw float.h; needed here as well to work - around GCC build issues. */ -/* BEGIN FLOAT.H COPY */ -/* - * IEEE recommended functions - */ - -_CRTIMP double __cdecl _chgsign (double); -_CRTIMP double __cdecl _copysign (double, double); -_CRTIMP double __cdecl _logb (double); -_CRTIMP double __cdecl _nextafter (double, double); -_CRTIMP double __cdecl _scalb (double, long); - -_CRTIMP int __cdecl _finite (double); -_CRTIMP int __cdecl _fpclass (double); -_CRTIMP int __cdecl _isnan (double); - -/* END FLOAT.H COPY */ - - -/* - * Non-underscored versions of non-ANSI functions. - * These reside in liboldnames.a. - */ - -#if !defined (_NO_OLDNAMES) - -_CRTIMP double __cdecl j0 (double); -_CRTIMP double __cdecl j1 (double); -_CRTIMP double __cdecl jn (int, double); -_CRTIMP double __cdecl y0 (double); -_CRTIMP double __cdecl y1 (double); -_CRTIMP double __cdecl yn (int, double); - -_CRTIMP double __cdecl chgsign (double); -_CRTIMP double __cdecl scalb (double, long); -_CRTIMP int __cdecl finite (double); -_CRTIMP int __cdecl fpclass (double); - -#define FP_SNAN _FPCLASS_SNAN -#define FP_QNAN _FPCLASS_QNAN -#define FP_NINF _FPCLASS_NINF -#define FP_PINF _FPCLASS_PINF -#define FP_NDENORM _FPCLASS_ND -#define FP_PDENORM _FPCLASS_PD -#define FP_NZERO _FPCLASS_NZ -#define FP_PZERO _FPCLASS_PZ -#define FP_NNORM _FPCLASS_NN -#define FP_PNORM _FPCLASS_PN - -#endif /* Not _NO_OLDNAMES */ - -/* This require msvcr70.dll or higher. */ -#if __MSVCRT_VERSION__ >= 0x0700 -_CRTIMP int __cdecl _set_SSE2_enable (int); -#endif /* __MSVCRT_VERSION__ >= 0x0700 */ - - -#endif /* __STRICT_ANSI__ */ - - #ifndef __NO_ISOCEXT #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \ - || !defined __STRICT_ANSI__ || defined __cplusplus + || !defined __STRICT_ANSI__ || defined __GLIBCPP__ -#if __MINGW_GNUC_PREREQ(3, 3) -#define HUGE_VALF __builtin_huge_valf() -#define HUGE_VALL __builtin_huge_vall() -#define INFINITY __builtin_inf() -#define NAN __builtin_nan("") -#else -extern const float __INFF; -#define HUGE_VALF __INFF -extern const long double __INFL; -#define HUGE_VALL __INFL -#define INFINITY HUGE_VALF -extern const double __QNAN; -#define NAN __QNAN -#endif /* __MINGW_GNUC_PREREQ(3, 3) */ +#define NAN (0.0F/0.0F) +#define HUGE_VALF (1.0F/0.0F) +#define HUGE_VALL (1.0L/0.0L) +#define INFINITY (1.0F/0.0F) -/* 7.12.3.1 */ -/* - Return values for fpclassify. - These are based on Intel x87 fpu condition codes - in the high byte of status word and differ from - the return values for MS IEEE 754 extension _fpclass() -*/ + #define FP_NAN 0x0100 #define FP_NORMAL 0x0400 #define FP_INFINITE (FP_NAN | FP_NORMAL) #define FP_ZERO 0x4000 #define FP_SUBNORMAL (FP_NORMAL | FP_ZERO) -/* 0x0200 is signbit mask */ + /* 0x0200 is signbit mask */ -/* - We can't inline float or double, because we want to ensure truncation - to semantic type before classification. - (A normal long double value might become subnormal when + /* + We can't __CRT_INLINE float or double, because we want to ensure truncation + to semantic type before classification. + (A normal long double value might become subnormal when converted to double, and zero when converted to float.) -*/ + */ -extern int __cdecl __fpclassifyf (float); -extern int __cdecl __fpclassify (double); + extern int __cdecl __fpclassifyf (float); + extern int __cdecl __fpclassify (double); -__CRT_INLINE int __cdecl __fpclassifyl (long double x){ - unsigned short sw; - __asm__ ("fxam; fstsw %%ax;" : "=a" (sw): "t" (x)); - return sw & (FP_NAN | FP_NORMAL | FP_ZERO ); -} + __CRT_INLINE int __cdecl __fpclassifyl (long double x){ + unsigned short sw; + __asm__ ("fxam; fstsw %%ax;" : "=a" (sw): "t" (x)); + return sw & (FP_NAN | FP_NORMAL | FP_ZERO ); + } #define fpclassify(x) (sizeof (x) == sizeof (float) ? __fpclassifyf (x) \ - : sizeof (x) == sizeof (double) ? __fpclassify (x) \ - : __fpclassifyl (x)) + : sizeof (x) == sizeof (double) ? __fpclassify (x) \ + : __fpclassifyl (x)) -/* 7.12.3.2 */ + /* 7.12.3.2 */ #define isfinite(x) ((fpclassify(x) & FP_NAN) == 0) -/* 7.12.3.3 */ + /* 7.12.3.3 */ #define isinf(x) (fpclassify(x) == FP_INFINITE) -/* 7.12.3.4 */ -/* We don't need to worry about trucation here: - A NaN stays a NaN. */ + /* 7.12.3.4 */ + /* We don't need to worry about trucation here: + A NaN stays a NaN. */ -__CRT_INLINE int __cdecl __isnan (double _x) -{ - unsigned short sw; - __asm__ ("fxam;" - "fstsw %%ax": "=a" (sw) : "t" (_x)); - return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL)) - == FP_NAN; -} + __CRT_INLINE int __cdecl __isnan (double _x) + { + unsigned short sw; + __asm__ ("fxam;" + "fstsw %%ax": "=a" (sw) : "t" (_x)); + return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL)) + == FP_NAN; + } -__CRT_INLINE int __cdecl __isnanf (float _x) -{ - unsigned short sw; - __asm__ ("fxam;" - "fstsw %%ax": "=a" (sw) : "t" (_x)); - return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL)) - == FP_NAN; -} + __CRT_INLINE int __cdecl __isnanf (float _x) + { + unsigned short sw; + __asm__ ("fxam;" + "fstsw %%ax": "=a" (sw) : "t" (_x)); + return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL)) + == FP_NAN; + } -__CRT_INLINE int __cdecl __isnanl (long double _x) -{ - unsigned short sw; - __asm__ ("fxam;" - "fstsw %%ax": "=a" (sw) : "t" (_x)); - return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL)) - == FP_NAN; -} + __CRT_INLINE int __cdecl __isnanl (long double _x) + { + unsigned short sw; + __asm__ ("fxam;" + "fstsw %%ax": "=a" (sw) : "t" (_x)); + return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL)) + == FP_NAN; + } #define isnan(x) (sizeof (x) == sizeof (float) ? __isnanf (x) \ - : sizeof (x) == sizeof (double) ? __isnan (x) \ - : __isnanl (x)) + : sizeof (x) == sizeof (double) ? __isnan (x) \ + : __isnanl (x)) -/* 7.12.3.5 */ + /* 7.12.3.5 */ #define isnormal(x) (fpclassify(x) == FP_NORMAL) -/* 7.12.3.6 The signbit macro */ -__CRT_INLINE int __cdecl __signbit (double x) { - unsigned short stw; - __asm__ ( "fxam; fstsw %%ax;": "=a" (stw) : "t" (x)); - return (stw & 0x0200) != 0; -} + /* 7.12.3.6 The signbit macro */ + __CRT_INLINE int __cdecl __signbit (double x) { + unsigned short stw; + __asm__ ( "fxam; fstsw %%ax;": "=a" (stw) : "t" (x)); + return stw & 0x0200; + } -__CRT_INLINE int __cdecl __signbitf (float x) { - unsigned short stw; - __asm__ ("fxam; fstsw %%ax;": "=a" (stw) : "t" (x)); - return (stw & 0x0200) != 0; -} + __CRT_INLINE int __cdecl __signbitf (float x) { + unsigned short stw; + __asm__ ("fxam; fstsw %%ax;": "=a" (stw) : "t" (x)); + return stw & 0x0200; + } -__CRT_INLINE int __cdecl __signbitl (long double x) { - unsigned short stw; - __asm__ ("fxam; fstsw %%ax;": "=a" (stw) : "t" (x)); - return (stw & 0x0200) != 0; -} + __CRT_INLINE int __cdecl __signbitl (long double x) { + unsigned short stw; + __asm__ ("fxam; fstsw %%ax;": "=a" (stw) : "t" (x)); + return stw & 0x0200; + } #define signbit(x) (sizeof (x) == sizeof (float) ? __signbitf (x) \ - : sizeof (x) == sizeof (double) ? __signbit (x) \ - : __signbitl (x)) + : sizeof (x) == sizeof (double) ? __signbit (x) \ + : __signbitl (x)) -/* 7.12.4 Trigonometric functions: Double in C89 */ -extern float __cdecl sinf (float); -extern long double __cdecl sinl (long double); + extern double __cdecl exp2(double); + extern float __cdecl exp2f(float); + extern long double __cdecl exp2l(long double); -extern float __cdecl cosf (float); -extern long double __cdecl cosl (long double); +#define FP_ILOGB0 ((int)0x80000000) +#define FP_ILOGBNAN ((int)0x80000000) + extern int __cdecl ilogb (double); + extern int __cdecl ilogbf (float); + extern int __cdecl ilogbl (long double); -extern float __cdecl tanf (float); -extern long double __cdecl tanl (long double); + extern double __cdecl log1p(double); + extern float __cdecl log1pf(float); + extern long double __cdecl log1pl(long double); -extern float __cdecl asinf (float); -extern long double __cdecl asinl (long double); + extern double __cdecl log2 (double); + extern float __cdecl log2f (float); + extern long double __cdecl log2l (long double); -extern float __cdecl acosf (float); -extern long double __cdecl acosl (long double); + extern double __cdecl logb (double); + extern float __cdecl logbf (float); + extern long double __cdecl logbl (long double); -extern float __cdecl atanf (float); -extern long double __cdecl atanl (long double); + __CRT_INLINE double __cdecl logb (double x) + { + double res; + __asm__ ("fxtract\n\t" + "fstp %%st" : "=t" (res) : "0" (x)); + return res; + } -extern float __cdecl atan2f (float, float); -extern long double __cdecl atan2l (long double, long double); + __CRT_INLINE float __cdecl logbf (float x) + { + float res; + __asm__ ("fxtract\n\t" + "fstp %%st" : "=t" (res) : "0" (x)); + return res; + } -/* 7.12.5 Hyperbolic functions: Double in C89 */ -__CRT_INLINE float __cdecl sinhf (float x) - {return (float) sinh (x);} -extern long double __cdecl sinhl (long double); + __CRT_INLINE long double __cdecl logbl (long double x) + { + long double res; + __asm__ ("fxtract\n\t" + "fstp %%st" : "=t" (res) : "0" (x)); + return res; + } -__CRT_INLINE float __cdecl coshf (float x) - {return (float) cosh (x);} -extern long double __cdecl coshl (long double); + extern long double __cdecl modfl (long double, long double*); -__CRT_INLINE float __cdecl tanhf (float x) - {return (float) tanh (x);} -extern long double __cdecl tanhl (long double); + /* 7.12.6.13 */ + extern double __cdecl scalbn (double, int); + extern float __cdecl scalbnf (float, int); + extern long double __cdecl scalbnl (long double, int); -/* Inverse hyperbolic trig functions */ -/* 7.12.5.1 */ -extern double __cdecl acosh (double); -extern float __cdecl acoshf (float); -extern long double __cdecl acoshl (long double); + extern double __cdecl scalbln (double, long); + extern float __cdecl scalblnf (float, long); + extern long double __cdecl scalblnl (long double, long); -/* 7.12.5.2 */ -extern double __cdecl asinh (double); -extern float __cdecl asinhf (float); -extern long double __cdecl asinhl (long double); + /* 7.12.7.1 */ + /* Implementations adapted from Cephes versions */ + extern double __cdecl cbrt (double); + extern float __cdecl cbrtf (float); + extern long double __cdecl cbrtl (long double); -/* 7.12.5.3 */ -extern double __cdecl atanh (double); -extern float __cdecl atanf (float); -extern long double __cdecl atanhl (long double); + __CRT_INLINE float __cdecl hypotf (float x, float y) + { return (float) hypot (x, y);} + extern long double __cdecl hypotl (long double, long double); -/* Exponentials and logarithms */ -/* 7.12.6.1 Double in C89 */ -__CRT_INLINE float __cdecl expf (float x) - {return (float) exp (x);} -extern long double __cdecl expl (long double); + extern long double __cdecl powl (long double, long double); + extern long double __cdecl expl(long double); + extern long double __cdecl coshl(long double); + extern long double __cdecl fabsl (long double); + extern long double __cdecl acosl(long double); + extern long double __cdecl asinl(long double); + extern long double __cdecl atanl(long double); + extern long double __cdecl atan2l(long double,long double); + extern long double __cdecl sinhl(long double); + extern long double __cdecl tanhl(long double); -/* 7.12.6.2 */ -extern double __cdecl exp2(double); -extern float __cdecl exp2f(float); -extern long double __cdecl exp2l(long double); + /* 7.12.8.1 The erf functions */ + extern double __cdecl erf (double); + extern float __cdecl erff (float); + /* TODO + extern long double __cdecl erfl (long double); + */ -/* 7.12.6.3 The expm1 functions */ -/* TODO: These could be inlined */ -extern double __cdecl expm1(double); -extern float __cdecl expm1f(float); -extern long double __cdecl expm1l(long double); + /* 7.12.8.2 The erfc functions */ + extern double __cdecl erfc (double); + extern float __cdecl erfcf (float); + /* TODO + extern long double __cdecl erfcl (long double); + */ -/* 7.12.6.4 Double in C89 */ -__CRT_INLINE float __cdecl frexpf (float x, int* expn) - {return (float) frexp (x, expn);} -extern long double __cdecl frexpl (long double, int*); + /* 7.12.8.3 The lgamma functions */ + extern double __cdecl lgamma (double); + extern float __cdecl lgammaf (float); + extern long double __cdecl lgammal (long double); -/* 7.12.6.5 */ -#define FP_ILOGB0 ((int)0x80000000) -#define FP_ILOGBNAN ((int)0x80000000) -extern int __cdecl ilogb (double); -extern int __cdecl ilogbf (float); -extern int __cdecl ilogbl (long double); + /* 7.12.8.4 The tgamma functions */ + extern double __cdecl tgamma (double); + extern float __cdecl tgammaf (float); + extern long double __cdecl tgammal (long double); -/* 7.12.6.6 Double in C89 */ -__CRT_INLINE float __cdecl ldexpf (float x, int expn) - {return (float) ldexp (x, expn);} -extern long double __cdecl ldexpl (long double, int); + extern long double __cdecl ceill (long double); + extern long double __cdecl floorl (long double); + extern long double __cdecl frexpl(long double,int *); + extern long double __cdecl log10l(long double); + extern long double __cdecl logl(long double); + extern long double __cdecl cosl(long double); + extern long double __cdecl sinl(long double); + extern long double __cdecl tanl(long double); + extern long double sqrtl(long double); -/* 7.12.6.7 Double in C89 */ -extern float __cdecl logf (float); -extern long double __cdecl logl (long double); + /* 7.12.9.3 */ + extern double __cdecl nearbyint ( double); + extern float __cdecl nearbyintf (float); + extern long double __cdecl nearbyintl (long double); -/* 7.12.6.8 Double in C89 */ -extern float __cdecl log10f (float); -extern long double __cdecl log10l (long double); + /* 7.12.9.4 */ + /* round, using fpu control word settings */ + __CRT_INLINE double __cdecl rint (double x) + { + double retval; + __asm__ ("frndint;": "=t" (retval) : "0" (x)); + return retval; + } -/* 7.12.6.9 */ -extern double __cdecl log1p(double); -extern float __cdecl log1pf(float); -extern long double __cdecl log1pl(long double); + __CRT_INLINE float __cdecl rintf (float x) + { + float retval; + __asm__ ("frndint;" : "=t" (retval) : "0" (x) ); + return retval; + } -/* 7.12.6.10 */ -extern double __cdecl log2 (double); -extern float __cdecl log2f (float); -extern long double __cdecl log2l (long double); + __CRT_INLINE long double __cdecl rintl (long double x) + { + long double retval; + __asm__ ("frndint;" : "=t" (retval) : "0" (x) ); + return retval; + } -/* 7.12.6.11 */ -extern double __cdecl logb (double); -extern float __cdecl logbf (float); -extern long double __cdecl logbl (long double); + /* 7.12.9.5 */ + __CRT_INLINE long __cdecl lrint (double x) + { + long retval; + __asm__ __volatile__ \ + ("fistpl %0" : "=m" (retval) : "t" (x) : "st"); \ + return retval; + } -/* Inline versions. GCC-4.0+ can do a better fast-math optimization - with __builtins. */ -#if !(__MINGW_GNUC_PREREQ (4, 0) && defined __FAST_MATH__ ) -__CRT_INLINE double __cdecl logb (double x) -{ - double res; - __asm__ ("fxtract\n\t" - "fstp %%st" : "=t" (res) : "0" (x)); - return res; -} + __CRT_INLINE long __cdecl lrintf (float x) + { + long retval; + __asm__ __volatile__ \ + ("fistpl %0" : "=m" (retval) : "t" (x) : "st"); \ + return retval; + } -__CRT_INLINE float __cdecl logbf (float x) -{ - float res; - __asm__ ("fxtract\n\t" - "fstp %%st" : "=t" (res) : "0" (x)); - return res; -} + __CRT_INLINE long __cdecl lrintl (long double x) + { + long retval; + __asm__ __volatile__ \ + ("fistpl %0" : "=m" (retval) : "t" (x) : "st"); \ + return retval; + } -__CRT_INLINE long double __cdecl logbl (long double x) -{ - long double res; - __asm__ ("fxtract\n\t" - "fstp %%st" : "=t" (res) : "0" (x)); - return res; -} -#endif /* !defined __FAST_MATH__ || !__MINGW_GNUC_PREREQ (4, 0) */ + __CRT_INLINE long long __cdecl llrint (double x) + { + long long retval; + __asm__ __volatile__ \ + ("fistpll %0" : "=m" (retval) : "t" (x) : "st"); \ + return retval; + } -/* 7.12.6.12 Double in C89 */ -extern float __cdecl modff (float, float*); -extern long double __cdecl modfl (long double, long double*); + __CRT_INLINE long long __cdecl llrintf (float x) + { + long long retval; + __asm__ __volatile__ \ + ("fistpll %0" : "=m" (retval) : "t" (x) : "st"); \ + return retval; + } -/* 7.12.6.13 */ -extern double __cdecl scalbn (double, int); -extern float __cdecl scalbnf (float, int); -extern long double __cdecl scalbnl (long double, int); + __CRT_INLINE long long __cdecl llrintl (long double x) + { + long long retval; + __asm__ __volatile__ \ + ("fistpll %0" : "=m" (retval) : "t" (x) : "st"); \ + return retval; + } -extern double __cdecl scalbln (double, long); -extern float __cdecl scalblnf (float, long); -extern long double __cdecl scalblnl (long double, long); + /* 7.12.9.6 */ + /* round away from zero, regardless of fpu control word settings */ + extern double __cdecl round (double); + extern float __cdecl roundf (float); + extern long double __cdecl roundl (long double); -/* 7.12.7.1 */ -/* Implementations adapted from Cephes versions */ -extern double __cdecl cbrt (double); -extern float __cdecl cbrtf (float); -extern long double __cdecl cbrtl (long double); + /* 7.12.9.7 */ + extern long __cdecl lround (double); + extern long __cdecl lroundf (float); + extern long __cdecl lroundl (long double); -/* 7.12.7.2 The fabs functions: Double in C89 */ -extern float __cdecl fabsf (float x); -extern long double __cdecl fabsl (long double x); + extern long long __cdecl llround (double); + extern long long __cdecl llroundf (float); + extern long long __cdecl llroundl (long double); -/* 7.12.7.3 */ -extern double __cdecl hypot (double, double); /* in libmoldname.a */ -__CRT_INLINE float __cdecl hypotf (float x, float y) - { return (float) hypot (x, y);} -extern long double __cdecl hypotl (long double, long double); + /* 7.12.9.8 */ + /* round towards zero, regardless of fpu control word settings */ + extern double __cdecl trunc (double); + extern float __cdecl truncf (float); + extern long double __cdecl truncl (long double); -/* 7.12.7.4 The pow functions. Double in C89 */ -__CRT_INLINE float __cdecl powf (float x, float y) - {return (float) pow (x, y);} -extern long double __cdecl powl (long double, long double); + extern long double __cdecl fmodl (long double, long double); -/* 7.12.7.5 The sqrt functions. Double in C89. */ -extern float __cdecl sqrtf (float); -extern long double __cdecl sqrtl (long double); + /* 7.12.10.2 */ + extern double __cdecl remainder (double, double); + extern float __cdecl remainderf (float, float); + extern long double __cdecl remainderl (long double, long double); -/* 7.12.8.1 The erf functions */ -extern double __cdecl erf (double); -extern float __cdecl erff (float); -extern long double __cdecl erfl (long double); + /* 7.12.10.3 */ + extern double __cdecl remquo(double, double, int *); + extern float __cdecl remquof(float, float, int *); + extern long double __cdecl remquol(long double, long double, int *); -/* 7.12.8.2 The erfc functions */ -extern double __cdecl erfc (double); -extern float __cdecl erfcf (float); -extern long double __cdecl erfcl (long double); + /* 7.12.11.1 */ + extern double __cdecl copysign (double, double); /* in libmoldname.a */ + extern float __cdecl copysignf (float, float); + extern long double __cdecl copysignl (long double, long double); -/* 7.12.8.3 The lgamma functions */ -extern double __cdecl lgamma (double); -extern float __cdecl lgammaf (float); -extern long double __cdecl lgammal (long double); + /* 7.12.11.2 Return a NaN */ + extern double __cdecl nan(const char *tagp); + extern float __cdecl nanf(const char *tagp); + extern long double __cdecl nanl(const char *tagp); -/* 7.12.8.4 The tgamma functions */ -extern double __cdecl tgamma (double); -extern float __cdecl tgammaf (float); -extern long double __cdecl tgammal (long double); +#ifndef __STRICT_ANSI__ +#define _nan() nan("") +#define _nanf() nanf("") +#define _nanl() nanl("") +#endif -/* 7.12.9.1 Double in C89 */ -extern float __cdecl ceilf (float); -extern long double __cdecl ceill (long double); + /* 7.12.11.3 */ + extern double __cdecl nextafter (double, double); /* in libmoldname.a */ + extern float __cdecl nextafterf (float, float); + extern long double __cdecl nextafterl (long double, long double); -/* 7.12.9.2 Double in C89 */ -extern float __cdecl floorf (float); -extern long double __cdecl floorl (long double); + /* 7.12.11.4 The nexttoward functions: TODO */ -/* 7.12.9.3 */ -extern double __cdecl nearbyint ( double); -extern float __cdecl nearbyintf (float); -extern long double __cdecl nearbyintl (long double); + /* 7.12.12.1 */ + /* x > y ? (x - y) : 0.0 */ + extern double __cdecl fdim (double x, double y); + extern float __cdecl fdimf (float x, float y); + extern long double __cdecl fdiml (long double x, long double y); -/* 7.12.9.4 */ -/* round, using fpu control word settings */ -extern double __cdecl rint (double); -extern float __cdecl rintf (float); -extern long double __cdecl rintl (long double); + /* fmax and fmin. + NaN arguments are treated as missing data: if one argument is a NaN + and the other numeric, then these functions choose the numeric + value. */ -/* 7.12.9.5 */ -extern long __cdecl lrint (double); -extern long __cdecl lrintf (float); -extern long __cdecl lrintl (long double); + /* 7.12.12.2 */ + extern double __cdecl fmax (double, double); + extern float __cdecl fmaxf (float, float); + extern long double __cdecl fmaxl (long double, long double); -extern long long __cdecl llrint (double); -extern long long __cdecl llrintf (float); -extern long long __cdecl llrintl (long double); + /* 7.12.12.3 */ + extern double __cdecl fmin (double, double); + extern float __cdecl fminf (float, float); + extern long double __cdecl fminl (long double, long double); -/* Inline versions of above. - GCC 4.0+ can do a better fast-math job with __builtins. */ -#if !(__MINGW_GNUC_PREREQ (4, 0) && defined __FAST_MATH__ ) -__CRT_INLINE double __cdecl rint (double x) -{ - double retval; - __asm__ ("frndint;": "=t" (retval) : "0" (x)); - return retval; -} + /* 7.12.13.1 */ + /* return x * y + z as a ternary op */ + extern double __cdecl fma (double, double, double); + extern float __cdecl fmaf (float, float, float); + extern long double __cdecl fmal (long double, long double, long double); -__CRT_INLINE float __cdecl rintf (float x) -{ - float retval; - __asm__ ("frndint;" : "=t" (retval) : "0" (x) ); - return retval; -} -__CRT_INLINE long double __cdecl rintl (long double x) -{ - long double retval; - __asm__ ("frndint;" : "=t" (retval) : "0" (x) ); - return retval; -} + /* 7.12.14 */ + /* + * With these functions, comparisons involving quiet NaNs set the FP + * condition code to "unordered". The IEEE floating-point spec + * dictates that the result of floating-point comparisons should be + * false whenever a NaN is involved, with the exception of the != op, + * which always returns true: yes, (NaN != NaN) is true). + */ -__CRT_INLINE long __cdecl lrint (double x) -{ - long retval; - __asm__ __volatile__ - ("fistpl %0" : "=m" (retval) : "t" (x) : "st"); - return retval; -} +#if __GNUC__ >= 3 -__CRT_INLINE long __cdecl lrintf (float x) -{ - long retval; - __asm__ __volatile__ - ("fistpl %0" : "=m" (retval) : "t" (x) : "st"); - return retval; -} +#define isgreater(x, y) __builtin_isgreater(x, y) +#define isgreaterequal(x, y) __builtin_isgreaterequal(x, y) +#define isless(x, y) __builtin_isless(x, y) +#define islessequal(x, y) __builtin_islessequal(x, y) +#define islessgreater(x, y) __builtin_islessgreater(x, y) +#define isunordered(x, y) __builtin_isunordered(x, y) -__CRT_INLINE long __cdecl lrintl (long double x) -{ - long retval; - __asm__ __volatile__ - ("fistpl %0" : "=m" (retval) : "t" (x) : "st"); - return retval; -} +#else + /* helper */ + __CRT_INLINE int __cdecl + __fp_unordered_compare (long double x, long double y){ + unsigned short retval; + __asm__ ("fucom %%st(1);" + "fnstsw;": "=a" (retval) : "t" (x), "u" (y)); + return retval; + } -__CRT_INLINE long long __cdecl llrint (double x) -{ - long long retval; - __asm__ __volatile__ - ("fistpll %0" : "=m" (retval) : "t" (x) : "st"); - return retval; -} +#define isgreater(x, y) ((__fp_unordered_compare(x, y) \ + & 0x4500) == 0) +#define isless(x, y) ((__fp_unordered_compare (y, x) \ + & 0x4500) == 0) +#define isgreaterequal(x, y) ((__fp_unordered_compare (x, y) \ + & FP_INFINITE) == 0) +#define islessequal(x, y) ((__fp_unordered_compare(y, x) \ + & FP_INFINITE) == 0) +#define islessgreater(x, y) ((__fp_unordered_compare(x, y) \ + & FP_SUBNORMAL) == 0) +#define isunordered(x, y) ((__fp_unordered_compare(x, y) \ + & 0x4500) == 0x4500) -__CRT_INLINE long long __cdecl llrintf (float x) -{ - long long retval; - __asm__ __volatile__ - ("fistpll %0" : "=m" (retval) : "t" (x) : "st"); - return retval; -} +#endif -__CRT_INLINE long long __cdecl llrintl (long double x) -{ - long long retval; - __asm__ __volatile__ - ("fistpll %0" : "=m" (retval) : "t" (x) : "st"); - return retval; -} -#endif /* !__FAST_MATH__ || !__MINGW_GNUC_PREREQ (4,0) */ -/* 7.12.9.6 */ -/* round away from zero, regardless of fpu control word settings */ -extern double __cdecl round (double); -extern float __cdecl roundf (float); -extern long double __cdecl roundl (long double); +#endif /* __STDC_VERSION__ >= 199901L */ +#endif /* __NO_ISOCEXT */ -/* 7.12.9.7 */ -extern long __cdecl lround (double); -extern long __cdecl lroundf (float); -extern long __cdecl lroundl (long double); +#ifdef __cplusplus +} +extern "C++" { + template inline _Ty _Pow_int(_Ty _X,int _Y) { + unsigned int _N; + if(_Y >= 0) _N = (unsigned int)_Y; + else _N = (unsigned int)(-_Y); + for(_Ty _Z = _Ty(1);;_X *= _X) { + if((_N & 1)!=0) _Z *= _X; + if((_N >>= 1)==0) return (_Y < 0 ? _Ty(1) / _Z : _Z); + } + } +} +#endif -extern long long __cdecl llround (double); -extern long long __cdecl llroundf (float); -extern long long __cdecl llroundl (long double); +#pragma pack(pop) -/* 7.12.9.8 */ -/* round towards zero, regardless of fpu control word settings */ -extern double __cdecl trunc (double); -extern float __cdecl truncf (float); -extern long double __cdecl truncl (long double); +#if !defined(__STRICT_ANSI__) && !defined(_MATH_DEFINES_DEFINED) +#define _MATH_DEFINES_DEFINED -/* 7.12.10.1 Double in C89 */ -extern float __cdecl fmodf (float, float); -extern long double __cdecl fmodl (long double, long double); - -/* 7.12.10.2 */ -extern double __cdecl remainder (double, double); -extern float __cdecl remainderf (float, float); -extern long double __cdecl remainderl (long double, long double); - -/* 7.12.10.3 */ -extern double __cdecl remquo(double, double, int *); -extern float __cdecl remquof(float, float, int *); -extern long double __cdecl remquol(long double, long double, int *); - -/* 7.12.11.1 */ -extern double __cdecl copysign (double, double); /* in libmoldname.a */ -extern float __cdecl copysignf (float, float); -extern long double __cdecl copysignl (long double, long double); - -/* 7.12.11.2 Return a NaN */ -extern double __cdecl nan(const char *tagp); -extern float __cdecl nanf(const char *tagp); -extern long double __cdecl nanl(const char *tagp); - -#ifndef __STRICT_ANSI__ -#define _nan() nan("") -#define _nanf() nanf("") -#define _nanl() nanl("") +#define M_E 2.71828182845904523536 +#define M_LOG2E 1.44269504088896340736 +#define M_LOG10E 0.434294481903251827651 +#define M_LN2 0.693147180559945309417 +#define M_LN10 2.30258509299404568402 +#define M_PI 3.14159265358979323846 +#define M_PI_2 1.57079632679489661923 +#define M_PI_4 0.785398163397448309616 +#define M_1_PI 0.318309886183790671538 +#define M_2_PI 0.636619772367581343076 +#define M_2_SQRTPI 1.12837916709551257390 +#define M_SQRT2 1.41421356237309504880 +#define M_SQRT1_2 0.707106781186547524401 #endif -/* 7.12.11.3 */ -extern double __cdecl nextafter (double, double); /* in libmoldname.a */ -extern float __cdecl nextafterf (float, float); -extern long double __cdecl nextafterl (long double, long double); +#ifndef __MINGW_FPCLASS_DEFINED +#define __MINGW_FPCLASS_DEFINED 1 +#define _FPCLASS_SNAN 0x0001 /* Signaling "Not a Number" */ +#define _FPCLASS_QNAN 0x0002 /* Quiet "Not a Number" */ +#define _FPCLASS_NINF 0x0004 /* Negative Infinity */ +#define _FPCLASS_NN 0x0008 /* Negative Normal */ +#define _FPCLASS_ND 0x0010 /* Negative Denormal */ +#define _FPCLASS_NZ 0x0020 /* Negative Zero */ +#define _FPCLASS_PZ 0x0040 /* Positive Zero */ +#define _FPCLASS_PD 0x0080 /* Positive Denormal */ +#define _FPCLASS_PN 0x0100 /* Positive Normal */ +#define _FPCLASS_PINF 0x0200 /* Positive Infinity */ +#endif /* __MINGW_FPCLASS_DEFINED */ -/* 7.12.11.4 The nexttoward functions */ -extern double __cdecl nexttoward (double, long double); -extern float __cdecl nexttowardf (float, long double); -extern long double __cdecl nexttowardl (long double, long double); - -/* 7.12.12.1 */ -/* x > y ? (x - y) : 0.0 */ -extern double __cdecl fdim (double x, double y); -extern float __cdecl fdimf (float x, float y); -extern long double __cdecl fdiml (long double x, long double y); - -/* fmax and fmin. - NaN arguments are treated as missing data: if one argument is a NaN - and the other numeric, then these functions choose the numeric - value. */ - -/* 7.12.12.2 */ -extern double __cdecl fmax (double, double); -extern float __cdecl fmaxf (float, float); -extern long double __cdecl fmaxl (long double, long double); - -/* 7.12.12.3 */ -extern double __cdecl fmin (double, double); -extern float __cdecl fminf (float, float); -extern long double __cdecl fminl (long double, long double); - -/* 7.12.13.1 */ -/* return x * y + z as a ternary op */ -extern double __cdecl fma (double, double, double); -extern float __cdecl fmaf (float, float, float); -extern long double __cdecl fmal (long double, long double, long double); - - /* 7.12.14 */ -/* +/* * With these functions, comparisons involving quiet NaNs set the FP * condition code to "unordered". The IEEE floating-point spec * dictates that the result of floating-point comparisons should be - * false whenever a NaN is involved, with the exception of the != op, + * false whenever a NaN is involved, with the exception of the != op, * which always returns true: yes, (NaN != NaN) is true). */ @@ -834,15 +764,5 @@ #endif +#endif /* End _MATH_H_ */ -#endif /* __STDC_VERSION__ >= 199901L */ -#endif /* __NO_ISOCEXT */ - - -#ifdef __cplusplus -} -#endif -#endif /* Not RC_INVOKED */ - - -#endif /* Not _MATH_H_ */ Index: include/crt/mbctype.h =================================================================== --- include/crt/mbctype.h (Revision 37928) +++ include/crt/mbctype.h (Arbeitskopie) @@ -1,97 +1,109 @@ -/* - * mbctype.h - * - * Functions for testing multibyte character types and converting characters. - * - * This file is part of the Mingw32 package. - * - * - * THIS SOFTWARE IS NOT COPYRIGHTED - * - * This source code is offered for use in the public domain. You may - * use, modify or distribute it freely. - * - * This code is distributed in the hope that it will be useful but - * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAIMED. This includes but is not limited to warranties of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ +#ifndef _INC_MBCTYPE +#define _INC_MBCTYPE -#ifndef _MBCTYPE_H_ -#define _MBCTYPE_H_ - -/* All the headers include this file. */ #include <_mingw.h> +#include -/* return values for _mbsbtype and _mbbtype in mbstring.h */ -#define _MBC_SINGLE 0 -#define _MBC_LEAD 1 -#define _MBC_TRAIL 2 -#define _MBC_ILLEGAL (-1) - -/* args for setmbcp (in lieu of actual codepage) */ -#define _MB_CP_SBCS 0 -#define _MB_CP_OEM (-2) -#define _MB_CP_ANSI (-3) -#define _MB_CP_LOCALE (-4) - -#define _MS 0x01 -#define _MP 0x02 -#define _M1 0x04 -#define _M2 0x08 - -#define _SBUP 0x10 -#define _SBLOW 0x20 - - -#ifndef RC_INVOKED - #ifdef __cplusplus extern "C" { #endif -#ifndef __STRICT_ANSI__ + /* CRT stuff */ +#if 1 +#if defined (_DLL) && defined (_M_IX86) + /* Retained for compatibility with VC++ 5.0 and earlier versions */ + _CRTIMP unsigned char * __cdecl __p__mbctype(void); + _CRTIMP unsigned char * __cdecl __p__mbcasemap(void); +#endif /* defined (_DLL) && defined (_M_IX86) */ +#endif +#ifndef _mbctype +#ifdef _MSVCRT_ + extern unsigned char _mbctype[257]; +#else +#define _mbctype (*_imp___mbctype) + extern unsigned char **_imp___mbctype; +#endif +#endif +#ifndef _mbcasemap +#ifdef _MSVCRT_ + extern unsigned char *_mbcasemap; +#else +#define _mbcasemap (*_imp___mbcasemap) + extern unsigned char **_imp___mbcasemap; +#endif +#endif -_CRTIMP int __cdecl __MINGW_NOTHROW _setmbcp (int); -_CRTIMP int __cdecl __MINGW_NOTHROW _getmbcp (void); + /* CRT stuff */ +#if 1 + extern pthreadmbcinfo __ptmbcinfo; + extern int __globallocalestatus; + extern int __locale_changed; + extern struct threadmbcinfostruct __initialmbcinfo; + pthreadmbcinfo __cdecl __updatetmbcinfo(void); +#endif -/* byte classification */ -/* NB: Corresponding _ismbc* functions are in mbstring.h */ +#define _MS 0x01 +#define _MP 0x02 +#define _M1 0x04 +#define _M2 0x08 -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbbalpha (unsigned int); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbbalnum (unsigned int); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbbgraph (unsigned int); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbbprint (unsigned int); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbbpunct (unsigned int); +#define _SBUP 0x10 +#define _SBLOW 0x20 -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbbkana (unsigned int); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbbkalnum (unsigned int); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbbkprint (unsigned int); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbbkpunct (unsigned int); +#define _MBC_SINGLE 0 +#define _MBC_LEAD 1 +#define _MBC_TRAIL 2 +#define _MBC_ILLEGAL (-1) +#define _KANJI_CP 932 -/* these are also in mbstring.h */ -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbblead (unsigned int); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbbtrail (unsigned int); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbslead (const unsigned char*, const unsigned char*); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbstrail (const unsigned char*, const unsigned char*); +#define _MB_CP_SBCS 0 +#define _MB_CP_OEM -2 +#define _MB_CP_ANSI -3 +#define _MB_CP_LOCALE -4 -#ifdef __DECLSPEC_SUPPORTED -__MINGW_IMPORT unsigned char _mbctype[]; -__MINGW_IMPORT unsigned char _mbcasemap[]; +#ifndef _MBCTYPE_DEFINED +#define _MBCTYPE_DEFINED + + _CRTIMP int __cdecl _setmbcp(int _CodePage); + _CRTIMP int __cdecl _getmbcp(void); + _CRTIMP int __cdecl _ismbbkalnum(unsigned int _C); + _CRTIMP int __cdecl _ismbbkalnum_l(unsigned int _C,_locale_t _Locale); + _CRTIMP int __cdecl _ismbbkana(unsigned int _C); + _CRTIMP int __cdecl _ismbbkana_l(unsigned int _C,_locale_t _Locale); + _CRTIMP int __cdecl _ismbbkpunct(unsigned int _C); + _CRTIMP int __cdecl _ismbbkpunct_l(unsigned int _C,_locale_t _Locale); + _CRTIMP int __cdecl _ismbbkprint(unsigned int _C); + _CRTIMP int __cdecl _ismbbkprint_l(unsigned int _C,_locale_t _Locale); + _CRTIMP int __cdecl _ismbbalpha(unsigned int _C); + _CRTIMP int __cdecl _ismbbalpha_l(unsigned int _C,_locale_t _Locale); + _CRTIMP int __cdecl _ismbbpunct(unsigned int _C); + _CRTIMP int __cdecl _ismbbpunct_l(unsigned int _C,_locale_t _Locale); + _CRTIMP int __cdecl _ismbbalnum(unsigned int _C); + _CRTIMP int __cdecl _ismbbalnum_l(unsigned int _C,_locale_t _Locale); + _CRTIMP int __cdecl _ismbbprint(unsigned int _C); + _CRTIMP int __cdecl _ismbbprint_l(unsigned int _C,_locale_t _Locale); + _CRTIMP int __cdecl _ismbbgraph(unsigned int _C); + _CRTIMP int __cdecl _ismbbgraph_l(unsigned int _C,_locale_t _Locale); +#ifndef _MBLEADTRAIL_DEFINED +#define _MBLEADTRAIL_DEFINED + _CRTIMP int __cdecl _ismbblead(unsigned int _C); + _CRTIMP int __cdecl _ismbblead_l(unsigned int _C,_locale_t _Locale); + _CRTIMP int __cdecl _ismbbtrail(unsigned int _C); + _CRTIMP int __cdecl _ismbbtrail_l(unsigned int _C,_locale_t _Locale); + _CRTIMP int __cdecl _ismbslead(const unsigned char *_Str,const unsigned char *_Pos); + _CRTIMP int __cdecl _ismbslead_l(const unsigned char *_Str,const unsigned char *_Pos,_locale_t _Locale); + _CRTIMP int __cdecl _ismbstrail(const unsigned char *_Str,const unsigned char *_Pos); + _CRTIMP int __cdecl _ismbstrail_l(const unsigned char *_Str,const unsigned char *_Pos,_locale_t _Locale); #endif +#endif -/* TODO : _MBCS_ mappings go in tchar.h */ - -#endif /* Not strict ANSI */ - #ifdef __cplusplus } #endif - -#endif /* Not RC_INVOKED */ - -#endif /* Not _MCTYPE_H_ */ - - +#endif Index: include/crt/mbstring.h =================================================================== --- include/crt/mbstring.h (Revision 37928) +++ include/crt/mbstring.h (Arbeitskopie) @@ -1,133 +1,212 @@ -/* - * mbstring.h - * - * Protototypes for string functions supporting multibyte characters. - * - * This file is part of the Mingw32 package. - * - * - * THIS SOFTWARE IS NOT COPYRIGHTED - * - * This source code is offered for use in the public domain. You may - * use, modify or distribute it freely. - * - * This code is distributed in the hope that it will be useful but - * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAIMED. This includes but is not limited to warranties of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ +#ifndef _INC_MBSTRING +#define _INC_MBSTRING -#ifndef _MBSTRING_H_ -#define _MBSTRING_H_ - -/* All the headers include this file. */ #include <_mingw.h> -#ifndef RC_INVOKED +#pragma pack(push,_CRT_PACKING) -#define __need_size_t -#include - #ifdef __cplusplus extern "C" { #endif -#ifndef __STRICT_ANSI__ +#ifndef _FILE_DEFINED + struct _iobuf { + char *_ptr; + int _cnt; + char *_base; + int _flag; + int _file; + int _charbuf; + int _bufsiz; + char *_tmpfname; + }; + typedef struct _iobuf FILE; +#define _FILE_DEFINED +#endif -/* character classification */ -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbcalnum (unsigned int); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbcalpha (unsigned int); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbcdigit (unsigned int); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbcgraph (unsigned int); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbcprint (unsigned int); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbcpunct (unsigned int); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbcspace (unsigned int); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbclower (unsigned int); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbcupper (unsigned int); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbclegal (unsigned int); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbcsymbol (unsigned int); +#ifndef _MBSTRING_DEFINED +#define _MBSTRING_DEFINED + _CRTIMP unsigned char *__cdecl _mbsdup(const unsigned char *_Str); + _CRTIMP unsigned int __cdecl _mbbtombc(unsigned int _Ch); + _CRTIMP unsigned int __cdecl _mbbtombc_l(unsigned int _Ch,_locale_t _Locale); + _CRTIMP int __cdecl _mbbtype(unsigned char _Ch,int _CType); + _CRTIMP int __cdecl _mbbtype_l(unsigned char _Ch,int _CType,_locale_t _Locale); + _CRTIMP unsigned int __cdecl _mbctombb(unsigned int _Ch); + _CRTIMP unsigned int __cdecl _mbctombb_l(unsigned int _Ch,_locale_t _Locale); + _CRTIMP int __cdecl _mbsbtype(const unsigned char *_Str,size_t _Pos); + _CRTIMP int __cdecl _mbsbtype_l(const unsigned char *_Str,size_t _Pos,_locale_t _Locale); + _CRTIMP unsigned char *__cdecl _mbscat(unsigned char *_Dest,const unsigned char *_Source); + _CRTIMP unsigned char *_mbscat_l(unsigned char *_Dest,const unsigned char *_Source,_locale_t _Locale); + _CRTIMP _CONST_RETURN unsigned char *__cdecl _mbschr(const unsigned char *_Str,unsigned int _Ch); + _CRTIMP _CONST_RETURN unsigned char *__cdecl _mbschr_l(const unsigned char *_Str,unsigned int _Ch,_locale_t _Locale); + _CRTIMP int __cdecl _mbscmp(const unsigned char *_Str1,const unsigned char *_Str2); + _CRTIMP int __cdecl _mbscmp_l(const unsigned char *_Str1,const unsigned char *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _mbscoll(const unsigned char *_Str1,const unsigned char *_Str2); + _CRTIMP int __cdecl _mbscoll_l(const unsigned char *_Str1,const unsigned char *_Str2,_locale_t _Locale); + _CRTIMP unsigned char *__cdecl _mbscpy(unsigned char *_Dest,const unsigned char *_Source); + _CRTIMP unsigned char *_mbscpy_l(unsigned char *_Dest,const unsigned char *_Source,_locale_t _Locale); + _CRTIMP size_t __cdecl _mbscspn(const unsigned char *_Str,const unsigned char *_Control); + _CRTIMP size_t __cdecl _mbscspn_l(const unsigned char *_Str,const unsigned char *_Control,_locale_t _Locale); + _CRTIMP unsigned char *__cdecl _mbsdec(const unsigned char *_Start,const unsigned char *_Pos); + _CRTIMP unsigned char *__cdecl _mbsdec_l(const unsigned char *_Start,const unsigned char *_Pos,_locale_t _Locale); + _CRTIMP int __cdecl _mbsicmp(const unsigned char *_Str1,const unsigned char *_Str2); + _CRTIMP int __cdecl _mbsicmp_l(const unsigned char *_Str1,const unsigned char *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _mbsicoll(const unsigned char *_Str1,const unsigned char *_Str2); + _CRTIMP int __cdecl _mbsicoll_l(const unsigned char *_Str1,const unsigned char *_Str2,_locale_t _Locale); + _CRTIMP unsigned char *__cdecl _mbsinc(const unsigned char *_Ptr); + _CRTIMP unsigned char *__cdecl _mbsinc_l(const unsigned char *_Ptr,_locale_t _Locale); + _CRTIMP size_t __cdecl _mbslen(const unsigned char *_Str); + _CRTIMP size_t __cdecl _mbslen_l(const unsigned char *_Str,_locale_t _Locale); + _CRTIMP size_t __cdecl _mbsnlen(const unsigned char *_Str,size_t _MaxCount); + _CRTIMP size_t __cdecl _mbsnlen_l(const unsigned char *_Str,size_t _MaxCount,_locale_t _Locale); + _CRTIMP unsigned char *__cdecl _mbslwr(unsigned char *_String); + _CRTIMP unsigned char *_mbslwr_l(unsigned char *_String,_locale_t _Locale); + _CRTIMP unsigned char *__cdecl _mbsnbcat(unsigned char *_Dest,const unsigned char *_Source,size_t _Count); + _CRTIMP unsigned char *__cdecl _mbsnbcat_l(unsigned char *_Dest,const unsigned char *_Source,size_t _Count,_locale_t _Locale); + _CRTIMP int __cdecl _mbsnbcmp(const unsigned char *_Str1,const unsigned char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _mbsnbcmp_l(const unsigned char *_Str1,const unsigned char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _mbsnbcoll(const unsigned char *_Str1,const unsigned char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _mbsnbcoll_l(const unsigned char *_Str1,const unsigned char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP size_t __cdecl _mbsnbcnt(const unsigned char *_Str,size_t _MaxCount); + _CRTIMP size_t __cdecl _mbsnbcnt_l(const unsigned char *_Str,size_t _MaxCount,_locale_t _Locale); + _CRTIMP unsigned char *__cdecl _mbsnbcpy(unsigned char *_Dest,const unsigned char *_Source,size_t _Count); + _CRTIMP unsigned char *__cdecl _mbsnbcpy_l(unsigned char *_Dest,const unsigned char *_Source,size_t _Count,_locale_t _Locale); + _CRTIMP int __cdecl _mbsnbicmp(const unsigned char *_Str1,const unsigned char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _mbsnbicmp_l(const unsigned char *_Str1,const unsigned char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _mbsnbicoll(const unsigned char *_Str1,const unsigned char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _mbsnbicoll_l(const unsigned char *_Str1,const unsigned char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP unsigned char *__cdecl _mbsnbset(unsigned char *_Str,unsigned int _Ch,size_t _MaxCount); + _CRTIMP unsigned char *__cdecl _mbsnbset_l(unsigned char *_Str,unsigned int _Ch,size_t _MaxCount,_locale_t _Locale); + _CRTIMP unsigned char *__cdecl _mbsncat(unsigned char *_Dest,const unsigned char *_Source,size_t _Count); + _CRTIMP unsigned char *__cdecl _mbsncat_l(unsigned char *_Dest,const unsigned char *_Source,size_t _Count,_locale_t _Locale); + _CRTIMP size_t __cdecl _mbsnccnt(const unsigned char *_Str,size_t _MaxCount); + _CRTIMP size_t __cdecl _mbsnccnt_l(const unsigned char *_Str,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _mbsncmp(const unsigned char *_Str1,const unsigned char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _mbsncmp_l(const unsigned char *_Str1,const unsigned char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _mbsncoll(const unsigned char *_Str1,const unsigned char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _mbsncoll_l(const unsigned char *_Str1,const unsigned char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP unsigned char *__cdecl _mbsncpy(unsigned char *_Dest,const unsigned char *_Source,size_t _Count); + _CRTIMP unsigned char *__cdecl _mbsncpy_l(unsigned char *_Dest,const unsigned char *_Source,size_t _Count,_locale_t _Locale); + _CRTIMP unsigned int __cdecl _mbsnextc (const unsigned char *_Str); + _CRTIMP unsigned int __cdecl _mbsnextc_l(const unsigned char *_Str,_locale_t _Locale); + _CRTIMP int __cdecl _mbsnicmp(const unsigned char *_Str1,const unsigned char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _mbsnicmp_l(const unsigned char *_Str1,const unsigned char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _mbsnicoll(const unsigned char *_Str1,const unsigned char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _mbsnicoll_l(const unsigned char *_Str1,const unsigned char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP unsigned char *__cdecl _mbsninc(const unsigned char *_Str,size_t _Count); + _CRTIMP unsigned char *__cdecl _mbsninc_l(const unsigned char *_Str,size_t _Count,_locale_t _Locale); + _CRTIMP unsigned char *__cdecl _mbsnset(unsigned char *_Dst,unsigned int _Val,size_t _MaxCount); + _CRTIMP unsigned char *__cdecl _mbsnset_l(unsigned char *_Dst,unsigned int _Val,size_t _MaxCount,_locale_t _Locale); + _CRTIMP _CONST_RETURN unsigned char *__cdecl _mbspbrk(const unsigned char *_Str,const unsigned char *_Control); + _CRTIMP _CONST_RETURN unsigned char *__cdecl _mbspbrk_l(const unsigned char *_Str,const unsigned char *_Control,_locale_t _Locale); + _CRTIMP _CONST_RETURN unsigned char *__cdecl _mbsrchr(const unsigned char *_Str,unsigned int _Ch); + _CRTIMP _CONST_RETURN unsigned char *__cdecl _mbsrchr_l(const unsigned char *_Str,unsigned int _Ch,_locale_t _Locale); + _CRTIMP unsigned char *__cdecl _mbsrev(unsigned char *_Str); + _CRTIMP unsigned char *__cdecl _mbsrev_l(unsigned char *_Str,_locale_t _Locale); + _CRTIMP unsigned char *__cdecl _mbsset(unsigned char *_Str,unsigned int _Val); + _CRTIMP unsigned char *__cdecl _mbsset_l(unsigned char *_Str,unsigned int _Val,_locale_t _Locale); + _CRTIMP size_t __cdecl _mbsspn(const unsigned char *_Str,const unsigned char *_Control); + _CRTIMP size_t __cdecl _mbsspn_l(const unsigned char *_Str,const unsigned char *_Control,_locale_t _Locale); + _CRTIMP unsigned char *__cdecl _mbsspnp(const unsigned char *_Str1,const unsigned char *_Str2); + _CRTIMP unsigned char *__cdecl _mbsspnp_l(const unsigned char *_Str1,const unsigned char *_Str2,_locale_t _Locale); + _CRTIMP _CONST_RETURN unsigned char *__cdecl _mbsstr(const unsigned char *_Str,const unsigned char *_Substr); + _CRTIMP _CONST_RETURN unsigned char *__cdecl _mbsstr_l(const unsigned char *_Str,const unsigned char *_Substr,_locale_t _Locale); + _CRTIMP unsigned char *__cdecl _mbstok(unsigned char *_Str,const unsigned char *_Delim); + _CRTIMP unsigned char *__cdecl _mbstok_l(unsigned char *_Str,const unsigned char *_Delim,_locale_t _Locale); + _CRTIMP unsigned char *__cdecl _mbsupr(unsigned char *_String); + _CRTIMP unsigned char *_mbsupr_l(unsigned char *_String,_locale_t _Locale); + _CRTIMP size_t __cdecl _mbclen(const unsigned char *_Str); + _CRTIMP size_t __cdecl _mbclen_l(const unsigned char *_Str,_locale_t _Locale); + _CRTIMP void __cdecl _mbccpy(unsigned char *_Dst,const unsigned char *_Src); + _CRTIMP void __cdecl _mbccpy_l(unsigned char *_Dst,const unsigned char *_Src,_locale_t _Locale); +#define _mbccmp(_cpc1,_cpc2) _mbsncmp((_cpc1),(_cpc2),1) +#ifdef __cplusplus +#ifndef _CPP_MBCS_INLINES_DEFINED +#define _CPP_MBCS_INLINES_DEFINED + extern "C++" { + static inline unsigned char *__cdecl _mbschr(unsigned char *_String,unsigned int _Char) { return ((unsigned char *)_mbschr((const unsigned char *)_String,_Char)); } + static inline unsigned char *__cdecl _mbschr_l(unsigned char *_String,unsigned int _Char,_locale_t _Locale) { return ((unsigned char *)_mbschr_l((const unsigned char *)_String,_Char,_Locale)); } + static inline unsigned char *__cdecl _mbspbrk(unsigned char *_String,const unsigned char *_CharSet) { return ((unsigned char *)_mbspbrk((const unsigned char *)_String,_CharSet)); } + static inline unsigned char *__cdecl _mbspbrk_l(unsigned char *_String,const unsigned char *_CharSet,_locale_t _Locale) { return ((unsigned char *)_mbspbrk_l((const unsigned char *)_String,_CharSet,_Locale)); } + static inline unsigned char *__cdecl _mbsrchr(unsigned char *_String,unsigned int _Char) { return ((unsigned char *)_mbsrchr((const unsigned char *)_String,_Char)); } + static inline unsigned char *__cdecl _mbsrchr_l(unsigned char *_String,unsigned int _Char,_locale_t _Locale) { return ((unsigned char *)_mbsrchr_l((const unsigned char *)_String,_Char,_Locale)); } + static inline unsigned char *__cdecl _mbsstr(unsigned char *_String,const unsigned char *_Match) { return ((unsigned char *)_mbsstr((const unsigned char *)_String,_Match)); } + static inline unsigned char *__cdecl _mbsstr_l(unsigned char *_String,const unsigned char *_Match,_locale_t _Locale) { return ((unsigned char *)_mbsstr_l((const unsigned char *)_String,_Match,_Locale)); } + } +#endif +#endif -/* also in mbctype.h */ -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbblead (unsigned int ); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbbtrail (unsigned int ); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbslead ( const unsigned char*, const unsigned char*); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbstrail ( const unsigned char*, const unsigned char*); + _CRTIMP int __cdecl _ismbcalnum(unsigned int _Ch); + _CRTIMP int __cdecl _ismbcalnum_l(unsigned int _Ch,_locale_t _Locale); + _CRTIMP int __cdecl _ismbcalpha(unsigned int _Ch); + _CRTIMP int __cdecl _ismbcalpha_l(unsigned int _Ch,_locale_t _Locale); + _CRTIMP int __cdecl _ismbcdigit(unsigned int _Ch); + _CRTIMP int __cdecl _ismbcdigit_l(unsigned int _Ch,_locale_t _Locale); + _CRTIMP int __cdecl _ismbcgraph(unsigned int _Ch); + _CRTIMP int __cdecl _ismbcgraph_l(unsigned int _Ch,_locale_t _Locale); + _CRTIMP int __cdecl _ismbclegal(unsigned int _Ch); + _CRTIMP int __cdecl _ismbclegal_l(unsigned int _Ch,_locale_t _Locale); + _CRTIMP int __cdecl _ismbclower(unsigned int _Ch); + _CRTIMP int __cdecl _ismbclower_l(unsigned int _Ch,_locale_t _Locale); + _CRTIMP int __cdecl _ismbcprint(unsigned int _Ch); + _CRTIMP int __cdecl _ismbcprint_l(unsigned int _Ch,_locale_t _Locale); + _CRTIMP int __cdecl _ismbcpunct(unsigned int _Ch); + _CRTIMP int __cdecl _ismbcpunct_l(unsigned int _Ch,_locale_t _Locale); + _CRTIMP int __cdecl _ismbcspace(unsigned int _Ch); + _CRTIMP int __cdecl _ismbcspace_l(unsigned int _Ch,_locale_t _Locale); + _CRTIMP int __cdecl _ismbcupper(unsigned int _Ch); + _CRTIMP int __cdecl _ismbcupper_l(unsigned int _Ch,_locale_t _Locale); + _CRTIMP unsigned int __cdecl _mbctolower(unsigned int _Ch); + _CRTIMP unsigned int __cdecl _mbctolower_l(unsigned int _Ch,_locale_t _Locale); + _CRTIMP unsigned int __cdecl _mbctoupper(unsigned int _Ch); + _CRTIMP unsigned int __cdecl _mbctoupper_l(unsigned int _Ch,_locale_t _Locale); +#endif -_CRTIMP unsigned int __cdecl __MINGW_NOTHROW _mbctolower (unsigned int); -_CRTIMP unsigned int __cdecl __MINGW_NOTHROW _mbctoupper (unsigned int); +#ifndef _MBLEADTRAIL_DEFINED +#define _MBLEADTRAIL_DEFINED + _CRTIMP int __cdecl _ismbblead(unsigned int _Ch); + _CRTIMP int __cdecl _ismbblead_l(unsigned int _Ch,_locale_t _Locale); + _CRTIMP int __cdecl _ismbbtrail(unsigned int _Ch); + _CRTIMP int __cdecl _ismbbtrail_l(unsigned int _Ch,_locale_t _Locale); + _CRTIMP int __cdecl _ismbslead(const unsigned char *_Str,const unsigned char *_Pos); + _CRTIMP int __cdecl _ismbslead_l(const unsigned char *_Str,const unsigned char *_Pos,_locale_t _Locale); + _CRTIMP int __cdecl _ismbstrail(const unsigned char *_Str,const unsigned char *_Pos); + _CRTIMP int __cdecl _ismbstrail_l(const unsigned char *_Str,const unsigned char *_Pos,_locale_t _Locale); +#endif -_CRTIMP void __cdecl __MINGW_NOTHROW _mbccpy (unsigned char*, const unsigned char*); -_CRTIMP size_t __cdecl __MINGW_NOTHROW _mbclen (const unsigned char*); + _CRTIMP int __cdecl _ismbchira(unsigned int _Ch); + _CRTIMP int __cdecl _ismbchira_l(unsigned int _Ch,_locale_t _Locale); + _CRTIMP int __cdecl _ismbckata(unsigned int _Ch); + _CRTIMP int __cdecl _ismbckata_l(unsigned int _Ch,_locale_t _Locale); + _CRTIMP int __cdecl _ismbcsymbol(unsigned int _Ch); + _CRTIMP int __cdecl _ismbcsymbol_l(unsigned int _Ch,_locale_t _Locale); + _CRTIMP int __cdecl _ismbcl0(unsigned int _Ch); + _CRTIMP int __cdecl _ismbcl0_l(unsigned int _Ch,_locale_t _Locale); + _CRTIMP int __cdecl _ismbcl1(unsigned int _Ch); + _CRTIMP int __cdecl _ismbcl1_l(unsigned int _Ch,_locale_t _Locale); + _CRTIMP int __cdecl _ismbcl2(unsigned int _Ch); + _CRTIMP int __cdecl _ismbcl2_l(unsigned int _Ch,_locale_t _Locale); + _CRTIMP unsigned int __cdecl _mbcjistojms(unsigned int _Ch); + _CRTIMP unsigned int __cdecl _mbcjistojms_l(unsigned int _Ch,_locale_t _Locale); + _CRTIMP unsigned int __cdecl _mbcjmstojis(unsigned int _Ch); + _CRTIMP unsigned int __cdecl _mbcjmstojis_l(unsigned int _Ch,_locale_t _Locale); + _CRTIMP unsigned int __cdecl _mbctohira(unsigned int _Ch); + _CRTIMP unsigned int __cdecl _mbctohira_l(unsigned int _Ch,_locale_t _Locale); + _CRTIMP unsigned int __cdecl _mbctokata(unsigned int _Ch); + _CRTIMP unsigned int __cdecl _mbctokata_l(unsigned int _Ch,_locale_t _Locale); -_CRTIMP unsigned int __cdecl __MINGW_NOTHROW _mbbtombc (unsigned int); -_CRTIMP unsigned int __cdecl __MINGW_NOTHROW _mbctombb (unsigned int); - -/* Return value constants for these are defined in mbctype.h. */ -_CRTIMP int __cdecl __MINGW_NOTHROW _mbbtype (unsigned char, int); -_CRTIMP int __cdecl __MINGW_NOTHROW _mbsbtype (const unsigned char*, size_t); - -_CRTIMP unsigned char* __cdecl __MINGW_NOTHROW _mbscpy (unsigned char*, const unsigned char*); -_CRTIMP unsigned char* __cdecl __MINGW_NOTHROW _mbsncpy (unsigned char*, const unsigned char*, size_t); -_CRTIMP unsigned char* __cdecl __MINGW_NOTHROW _mbsnbcpy (unsigned char*, const unsigned char*, size_t); -_CRTIMP unsigned char* __cdecl __MINGW_NOTHROW _mbsset (unsigned char*, unsigned int); -_CRTIMP unsigned char* __cdecl __MINGW_NOTHROW _mbsnset (unsigned char*, unsigned int, size_t); -_CRTIMP unsigned char* __cdecl __MINGW_NOTHROW _mbsnbset (unsigned char*, unsigned int, size_t); -_CRTIMP unsigned char* __cdecl __MINGW_NOTHROW _mbsdup (const unsigned char*); -_CRTIMP unsigned char* __cdecl __MINGW_NOTHROW _mbsrev (unsigned char*); -_CRTIMP unsigned char* __cdecl __MINGW_NOTHROW _mbscat (unsigned char*, const unsigned char*); -_CRTIMP unsigned char* __cdecl __MINGW_NOTHROW _mbsncat (unsigned char*, const unsigned char*, size_t); -_CRTIMP unsigned char* __cdecl __MINGW_NOTHROW _mbsnbcat (unsigned char*, const unsigned char*, size_t); -_CRTIMP size_t __cdecl __MINGW_NOTHROW _mbslen (const unsigned char*); -_CRTIMP size_t __cdecl __MINGW_NOTHROW _mbsnbcnt (const unsigned char*, size_t); -_CRTIMP size_t __cdecl __MINGW_NOTHROW _mbsnccnt (const unsigned char*, size_t); -_CRTIMP unsigned char* __cdecl __MINGW_NOTHROW _mbschr (const unsigned char*, unsigned int); -_CRTIMP unsigned char* __cdecl __MINGW_NOTHROW _mbsrchr (const unsigned char*, unsigned int); -_CRTIMP size_t __cdecl __MINGW_NOTHROW _mbsspn (const unsigned char*, const unsigned char*); -_CRTIMP size_t __cdecl __MINGW_NOTHROW _mbscspn (const unsigned char*, const unsigned char*); -_CRTIMP unsigned char* __cdecl __MINGW_NOTHROW _mbsspnp (const unsigned char*, const unsigned char*); -_CRTIMP unsigned char* __cdecl __MINGW_NOTHROW _mbspbrk (const unsigned char*, const unsigned char*); -_CRTIMP int __cdecl __MINGW_NOTHROW _mbscmp (const unsigned char*, const unsigned char*); -_CRTIMP int __cdecl __MINGW_NOTHROW _mbsicmp (const unsigned char*, const unsigned char*); -_CRTIMP int __cdecl __MINGW_NOTHROW _mbsncmp (const unsigned char*, const unsigned char*, size_t); -_CRTIMP int __cdecl __MINGW_NOTHROW _mbsnicmp (const unsigned char*, const unsigned char*, size_t); -_CRTIMP int __cdecl __MINGW_NOTHROW _mbsnbcmp (const unsigned char*, const unsigned char*, size_t); -_CRTIMP int __cdecl __MINGW_NOTHROW _mbsnbicmp (const unsigned char*, const unsigned char*, size_t); -_CRTIMP int __cdecl __MINGW_NOTHROW _mbscoll (const unsigned char*, const unsigned char*); -_CRTIMP int __cdecl __MINGW_NOTHROW _mbsicoll (const unsigned char*, const unsigned char*); -_CRTIMP int __cdecl __MINGW_NOTHROW _mbsncoll (const unsigned char*, const unsigned char*, size_t); -_CRTIMP int __cdecl __MINGW_NOTHROW _mbsnicoll (const unsigned char*, const unsigned char*, size_t); -_CRTIMP int __cdecl __MINGW_NOTHROW _mbsnbcoll (const unsigned char*, const unsigned char*, size_t); -_CRTIMP int __cdecl __MINGW_NOTHROW _mbsnbicoll (const unsigned char*, const unsigned char*, size_t); - -_CRTIMP unsigned char* __cdecl __MINGW_NOTHROW _mbsinc (const unsigned char*); -_CRTIMP unsigned char* __cdecl __MINGW_NOTHROW _mbsninc (const unsigned char*, size_t); -_CRTIMP unsigned char* __cdecl __MINGW_NOTHROW _mbsdec (const unsigned char*, const unsigned char*); -_CRTIMP unsigned int __cdecl __MINGW_NOTHROW _mbsnextc (const unsigned char*); -_CRTIMP unsigned char* __cdecl __MINGW_NOTHROW _mbslwr (unsigned char*); -_CRTIMP unsigned char* __cdecl __MINGW_NOTHROW _mbsupr (unsigned char*); -_CRTIMP unsigned char* __cdecl __MINGW_NOTHROW _mbstok (unsigned char*, const unsigned char*); - -/* Kanji */ -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbchira (unsigned int); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbckata (unsigned int); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbcl0 (unsigned int); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbcl1 (unsigned int); -_CRTIMP int __cdecl __MINGW_NOTHROW _ismbcl2 (unsigned int); -_CRTIMP unsigned int __cdecl __MINGW_NOTHROW _mbcjistojms (unsigned int); -_CRTIMP unsigned int __cdecl __MINGW_NOTHROW _mbcjmstojis (unsigned int); -_CRTIMP unsigned int __cdecl __MINGW_NOTHROW _mbctohira (unsigned int); -_CRTIMP unsigned int __cdecl __MINGW_NOTHROW _mbctokata (unsigned int); - -#endif /* Not strict ANSI */ - #ifdef __cplusplus } #endif -#endif /* Not RC_INVOKED */ -#endif /* Not _MBSTRING_H_ */ +#pragma pack(pop) +#include - +#endif Index: include/crt/mem.h =================================================================== --- include/crt/mem.h (Revision 37928) +++ include/crt/mem.h (Arbeitskopie) @@ -1,3 +1,8 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ /* * This file is part of the Mingw32 package. * @@ -3,3 +8,5 @@ * mem.h maps to string.h */ +#ifndef __STRICT_ANSI__ #include +#endif Index: include/crt/memory.h =================================================================== --- include/crt/memory.h (Revision 37928) +++ include/crt/memory.h (Arbeitskopie) @@ -1,7 +1,40 @@ -/* - * This file is part of the Mingw32 package. - * - * memory.h maps to the standard string.h header. +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ +#ifndef _INC_MEMORY +#define _INC_MEMORY -#include +#include <_mingw.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _CONST_RETURN +#define _CONST_RETURN +#endif + +#define _WConst_return _CONST_RETURN + +#ifndef _CRT_MEMORY_DEFINED +#define _CRT_MEMORY_DEFINED + _CRTIMP void *__cdecl _memccpy(void *_Dst,const void *_Src,int _Val,size_t _MaxCount); + _CONST_RETURN void *__cdecl memchr(const void *_Buf ,int _Val,size_t _MaxCount); + _CRTIMP int __cdecl _memicmp(const void *_Buf1,const void *_Buf2,size_t _Size); + _CRTIMP int __cdecl _memicmp_l(const void *_Buf1,const void *_Buf2,size_t _Size,_locale_t _Locale); + int __cdecl memcmp(const void *_Buf1,const void *_Buf2,size_t _Size); + void *__cdecl memcpy(void *_Dst,const void *_Src,size_t _Size); + void *__cdecl memset(void *_Dst,int _Val,size_t _Size); + +#ifndef NO_OLDNAMES + void *__cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size); + int __cdecl memicmp(const void *_Buf1,const void *_Buf2,size_t _Size); +#endif +#endif + +#ifdef __cplusplus +} +#endif +#endif Index: include/crt/mingw32/crtdbg.h =================================================================== --- include/crt/mingw32/crtdbg.h (Revision 0) +++ include/crt/mingw32/crtdbg.h (Revision 0) @@ -0,0 +1,212 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#include <_mingw.h> + +#ifndef _INC_CRTDBG +#define _INC_CRTDBG + +#pragma pack(push,_CRT_PACKING) + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + typedef void *_HFILE; + +#define _CRT_WARN 0 +#define _CRT_ERROR 1 +#define _CRT_ASSERT 2 +#define _CRT_ERRCNT 3 + +#define _CRTDBG_MODE_FILE 0x1 +#define _CRTDBG_MODE_DEBUG 0x2 +#define _CRTDBG_MODE_WNDW 0x4 +#define _CRTDBG_REPORT_MODE -1 + +#define _CRTDBG_INVALID_HFILE ((_HFILE)-1) +#define _CRTDBG_HFILE_ERROR ((_HFILE)-2) +#define _CRTDBG_FILE_STDOUT ((_HFILE)-4) +#define _CRTDBG_FILE_STDERR ((_HFILE)-5) +#define _CRTDBG_REPORT_FILE ((_HFILE)-6) + + typedef int (__cdecl *_CRT_REPORT_HOOK)(int,char *,int *); + typedef int (__cdecl *_CRT_REPORT_HOOKW)(int,wchar_t *,int *); + +#define _CRT_RPTHOOK_INSTALL 0 +#define _CRT_RPTHOOK_REMOVE 1 + +#define _HOOK_ALLOC 1 +#define _HOOK_REALLOC 2 +#define _HOOK_FREE 3 + + typedef int (__cdecl *_CRT_ALLOC_HOOK)(int,void *,size_t,int,long,const unsigned char *,int); + +#define _CRTDBG_ALLOC_MEM_DF 0x01 +#define _CRTDBG_DELAY_FREE_MEM_DF 0x02 +#define _CRTDBG_CHECK_ALWAYS_DF 0x04 +#define _CRTDBG_RESERVED_DF 0x08 +#define _CRTDBG_CHECK_CRT_DF 0x10 +#define _CRTDBG_LEAK_CHECK_DF 0x20 + +#define _CRTDBG_CHECK_EVERY_16_DF 0x00100000 +#define _CRTDBG_CHECK_EVERY_128_DF 0x00800000 +#define _CRTDBG_CHECK_EVERY_1024_DF 0x04000000 + +#define _CRTDBG_CHECK_DEFAULT_DF 0 + +#define _CRTDBG_REPORT_FLAG -1 + +#define _BLOCK_TYPE(block) (block & 0xFFFF) +#define _BLOCK_SUBTYPE(block) (block >> 16 & 0xFFFF) + +#define _FREE_BLOCK 0 +#define _NORMAL_BLOCK 1 +#define _CRT_BLOCK 2 +#define _IGNORE_BLOCK 3 +#define _CLIENT_BLOCK 4 +#define _MAX_BLOCKS 5 + + typedef void (__cdecl *_CRT_DUMP_CLIENT)(void *,size_t); + + struct _CrtMemBlockHeader; + + typedef struct _CrtMemState { + struct _CrtMemBlockHeader *pBlockHeader; + size_t lCounts[_MAX_BLOCKS]; + size_t lSizes[_MAX_BLOCKS]; + size_t lHighWaterCount; + size_t lTotalCount; + } _CrtMemState; + +#ifndef _STATIC_ASSERT +#define _STATIC_ASSERT(expr) typedef char __static_assert_t[(expr)] +#endif + +#ifndef _ASSERT +#define _ASSERT(expr) ((void)0) +#endif + +#ifndef _ASSERTE +#define _ASSERTE(expr) ((void)0) +#endif + +#ifndef _ASSERT_EXPR +#define _ASSERT_EXPR(expr,expr_str) ((void)0) +#endif + +#ifndef _ASSERT_BASE +#define _ASSERT_BASE _ASSERT_EXPR +#endif + +#define _RPT0(rptno,msg) +#define _RPTW0(rptno,msg) + +#define _RPT1(rptno,msg,arg1) +#define _RPTW1(rptno,msg,arg1) +#define _RPT2(rptno,msg,arg1,arg2) +#define _RPTW2(rptno,msg,arg1,arg2) +#define _RPT3(rptno,msg,arg1,arg2,arg3) +#define _RPTW3(rptno,msg,arg1,arg2,arg3) +#define _RPT4(rptno,msg,arg1,arg2,arg3,arg4) +#define _RPTW4(rptno,msg,arg1,arg2,arg3,arg4) +#define _RPTF0(rptno,msg) +#define _RPTFW0(rptno,msg) +#define _RPTF1(rptno,msg,arg1) +#define _RPTFW1(rptno,msg,arg1) +#define _RPTF2(rptno,msg,arg1,arg2) +#define _RPTFW2(rptno,msg,arg1,arg2) +#define _RPTF3(rptno,msg,arg1,arg2,arg3) +#define _RPTFW3(rptno,msg,arg1,arg2,arg3) +#define _RPTF4(rptno,msg,arg1,arg2,arg3,arg4) +#define _RPTFW4(rptno,msg,arg1,arg2,arg3,arg4) + +#define _malloc_dbg(s,t,f,l) malloc(s) +#define _calloc_dbg(c,s,t,f,l) calloc(c,s) +#define _realloc_dbg(p,s,t,f,l) realloc(p,s) +#define _recalloc_dbg(p,c,s,t,f,l) _recalloc(p,c,s) +#define _expand_dbg(p,s,t,f,l) _expand(p,s) +#define _free_dbg(p,t) free(p) +#define _msize_dbg(p,t) _msize(p) + +#define _aligned_malloc_dbg(s,a,f,l) _aligned_malloc(s,a) +#define _aligned_realloc_dbg(p,s,a,f,l) _aligned_realloc(p,s,a) +#define _aligned_recalloc_dbg(p,c,s,a,f,l) _aligned_realloc(p,c,s,a) +#define _aligned_free_dbg(p) _aligned_free(p) +#define _aligned_offset_malloc_dbg(s,a,o,f,l) _aligned_offset_malloc(s,a,o) +#define _aligned_offset_realloc_dbg(p,s,a,o,f,l) _aligned_offset_realloc(p,s,a,o) +#define _aligned_offset_recalloc_dbg(p,c,s,a,o,f,l) _aligned_offset_recalloc(p,c,s,a,o) + +#define _malloca_dbg(s,t,f,l) _malloca(s) +#define _freea_dbg(p,t) _freea(p) + +#define _strdup_dbg(s,t,f,l) _strdup(s) +#define _wcsdup_dbg(s,t,f,l) _wcsdup(s) +#define _mbsdup_dbg(s,t,f,l) _mbsdup(s) +#define _tempnam_dbg(s1,s2,t,f,l) _tempnam(s1,s2) +#define _wtempnam_dbg(s1,s2,t,f,l) _wtempnam(s1,s2) +#define _fullpath_dbg(s1,s2,le,t,f,l) _fullpath(s1,s2,le) +#define _wfullpath_dbg(s1,s2,le,t,f,l) _wfullpath(s1,s2,le) +#define _getcwd_dbg(s,le,t,f,l) _getcwd(s,le) +#define _wgetcwd_dbg(s,le,t,f,l) _wgetcwd(s,le) +#define _getdcwd_dbg(d,s,le,t,f,l) _getdcwd(d,s,le) +#define _wgetdcwd_dbg(d,s,le,t,f,l) _wgetdcwd(d,s,le) +#define _getdcwd_lk_dbg(d,s,le,t,f,l) _getdcwd_nolock(d,s,le) +#define _wgetdcwd_lk_dbg(d,s,le,t,f,l) _wgetdcwd_nolock(d,s,le) + +#define _CrtSetReportHook(f) ((_CRT_REPORT_HOOK)0) +#define _CrtGetReportHook() ((_CRT_REPORT_HOOK)0) +#define _CrtSetReportHook2(t,f) ((int)0) +#define _CrtSetReportHookW2(t,f) ((int)0) +#define _CrtSetReportMode(t,f) ((int)0) +#define _CrtSetReportFile(t,f) ((_HFILE)0) + +#define _CrtDbgBreak() ((void)0) + +#define _CrtSetBreakAlloc(a) ((long)0) +#define _CrtSetAllocHook(f) ((_CRT_ALLOC_HOOK)0) +#define _CrtGetAllocHook() ((_CRT_ALLOC_HOOK)0) +#define _CrtCheckMemory() ((int)1) +#define _CrtSetDbgFlag(f) ((int)0) +#define _CrtDoForAllClientObjects(f,c) ((void)0) +#define _CrtIsValidPointer(p,n,r) ((int)1) +#define _CrtIsValidHeapPointer(p) ((int)1) +#define _CrtIsMemoryBlock(p,t,r,f,l) ((int)1) +#define _CrtReportBlockType(p) ((int)-1) +#define _CrtSetDumpClient(f) ((_CRT_DUMP_CLIENT)0) +#define _CrtGetDumpClient() ((_CRT_DUMP_CLIENT)0) +#define _CrtMemCheckpoint(s) ((void)0) +#define _CrtMemDifference(s1,s2,s3) ((int)0) +#define _CrtMemDumpAllObjectsSince(s) ((void)0) +#define _CrtMemDumpStatistics(s) ((void)0) +#define _CrtDumpMemoryLeaks() ((int)0) +#define _CrtSetDebugFillThreshold(t) ((size_t)0) +#define _CrtSetCheckCount(f) ((int)0) +#define _CrtGetCheckCount() ((int)0) + +#ifdef __cplusplus +} + + void *__cdecl operator new[](size_t _Size); + inline void *__cdecl operator new(size_t _Size,int,const char *,int) { return ::operator new(_Size); } + inline void *__cdecl operator new[](size_t _Size,int,const char *,int) { return ::operator new[](_Size); } + void __cdecl operator delete[](void *); + inline void __cdecl operator delete(void *_P,int,const char *,int) { ::operator delete(_P); } + inline void __cdecl operator delete[](void *_P,int,const char *,int) { ::operator delete[](_P); } +#endif + +#pragma pack(pop) + +#include + +#endif Index: include/crt/mingw32/intrin_x86.h =================================================================== --- include/crt/mingw32/intrin_x86.h (Revision 37928) +++ include/crt/mingw32/intrin_x86.h (Arbeitskopie) @@ -657,31 +657,26 @@ __asm__ __volatile__("incl %%gs:%a[Offset]" : : [Offset] "ir" (Offset) : "memory"); } -/* NOTE: the bizarre implementation of __addgsxxx mimics the broken Visual C++ behavior */ static __inline__ __attribute__((always_inline)) void __addgsbyte(const unsigned long Offset, const unsigned char Data) { - if(!__builtin_constant_p(Offset)) - __asm__ __volatile__("addb %k[Offset], %%gs:%a[Offset]" : : [Offset] "r" (Offset) : "memory"); - else - __asm__ __volatile__("addb %b[Data], %%gs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "iq" (Data) : "memory"); + __asm__ __volatile__("addb %b[Data], %%gs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "iq" (Data) : "memory"); } static __inline__ __attribute__((always_inline)) void __addgsword(const unsigned long Offset, const unsigned short Data) { - if(!__builtin_constant_p(Offset)) - __asm__ __volatile__("addw %k[Offset], %%gs:%a[Offset]" : : [Offset] "r" (Offset) : "memory"); - else - __asm__ __volatile__("addw %w[Data], %%gs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "iq" (Data) : "memory"); + __asm__ __volatile__("addw %w[Data], %%gs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "iq" (Data) : "memory"); } static __inline__ __attribute__((always_inline)) void __addgsdword(const unsigned long Offset, const unsigned int Data) { - if(!__builtin_constant_p(Offset)) - __asm__ __volatile__("addl %k[Offset], %%gs:%a[Offset]" : : [Offset] "r" (Offset) : "memory"); - else - __asm__ __volatile__("addl %k[Data], %%gs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "iq" (Data) : "memory"); + __asm__ __volatile__("addl %k[Data], %%gs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "iq" (Data) : "memory"); } +static __inline__ __attribute__((always_inline)) void __addgsqword(const unsigned long Offset, const unsigned __int64 Data) +{ + __asm__ __volatile__("addq %k[Data], %%gs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "iq" (Data) : "memory"); +} + #else /*** FS segment addressing ***/ static __inline__ __attribute__((always_inline)) void __writefsbyte(const unsigned long Offset, const unsigned char Data) @@ -1066,12 +1061,29 @@ static __inline__ __attribute__((always_inline)) unsigned long long __rdtsc(void) { +#ifdef _M_AMD64 + unsigned long long low, high; + __asm__ __volatile__("rdtsc" : "=a"(low), "=d"(high)); + return low | (high << 32); +#else unsigned long long retval; __asm__ __volatile__("rdtsc" : "=A"(retval)); return retval; +#endif } +static __inline__ __attribute__((always_inline)) void __writeeflags(uintptr_t Value) +{ + __asm__ __volatile__("push %0\n popf" : : "rim"(Value)); +} +static __inline__ __attribute__((always_inline)) uintptr_t __readeflags(void) +{ + uintptr_t retval; + __asm__ __volatile__("pushf\n pop %0" : "=rm"(retval)); + return retval; +} + /*** Interrupts ***/ static __inline__ __attribute__((always_inline)) void __debugbreak(void) { Index: include/crt/mingw32/stdarg.h =================================================================== --- include/crt/mingw32/stdarg.h (Revision 37928) +++ include/crt/mingw32/stdarg.h (Arbeitskopie) @@ -28,6 +28,12 @@ * ISO C Standard: 7.15 Variable arguments */ +#ifndef _INC_STDARG +#define _INC_STDARG +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif + #ifndef _STDARG_H #ifndef _ANSI_STDARG_H_ #ifndef __need___va_list @@ -58,7 +64,7 @@ /* Define va_list, if desired, from __gnuc_va_list. */ /* We deliberately do not define va_list when called from stdio.h, because ANSI C says that stdio.h is not supposed to define - va_list. stdio.h needs to have access to that data type, + va_list. stdio.h needs to have access to that data type, but must not use that name. It should use the name __gnuc_va_list, which is safe because it is reserved for the implementation. */ @@ -131,3 +137,17 @@ #endif /* not _ANSI_STDARG_H_ */ #endif /* not _STDARG_H */ + +#include + +#ifndef va_start +#define va_start _crt_va_start +#endif +#ifndef va_arg +#define va_arg _crt_va_arg +#endif +#ifndef va_end +#define va_end _crt_va_end +#endif + +#endif Index: include/crt/mingw32/stddef.h =================================================================== --- include/crt/mingw32/stddef.h (Revision 37928) +++ include/crt/mingw32/stddef.h (Arbeitskopie) @@ -1,30 +1,36 @@ -/* Copyright (C) 1989, 1997, 1998, 1999, 2000, 2002, 2004 - Free Software Foundation, Inc. +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ -This file is part of GCC. +#include <_mingw.h> -GCC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. +#ifndef _INC_STDDEF +#define _INC_STDDEF -GCC 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 General Public License for more details. +#ifdef __cplusplus +extern "C" { +#endif -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING. If not, write to -the Free Software Foundation, 51 Franklin Street, Fifth Floor, -Boston, MA 02110-1301, USA. */ +#ifndef _CRT_ERRNO_DEFINED +#define _CRT_ERRNO_DEFINED + _CRTIMP extern int *__cdecl _errno(void); +#define errno (*_errno()) + errno_t __cdecl _set_errno(int _Value); + errno_t __cdecl _get_errno(int *_Value); +#endif -/* As a special exception, if you include this header file into source - files compiled by GCC, this header file does not by itself cause - the resulting executable to be covered by the GNU General Public - License. This exception does not however invalidate any other - reasons why the executable file might be covered by the GNU General - Public License. */ + _CRTIMP extern unsigned long __cdecl __threadid(void); +#define _threadid (__threadid()) + _CRTIMP extern uintptr_t __cdecl __threadhandle(void); +#ifdef __cplusplus +} +#endif + +#endif + /* * ISO C Standard: 7.17 Common definitions */ @@ -49,19 +55,6 @@ #endif #ifndef __sys_stdtypes_h -/* This avoids lossage on SunOS but only if stdtypes.h comes first. - There's no way to win with the other order! Sun lossage. */ - -/* On 4.3bsd-net2, make sure ansi.h is included, so we have - one less case to deal with in the following. */ -#if defined (__BSD_NET2__) || defined (____386BSD____) || (defined (__FreeBSD__) && (__FreeBSD__ < 5)) || defined(__NetBSD__) -#include -#endif -/* On FreeBSD 5, machine/ansi.h does not exist anymore... */ -#if defined (__FreeBSD__) && (__FreeBSD__ >= 5) -#include -#endif - /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are defined if the corresponding type is *not* defined. FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_ */ @@ -147,9 +140,16 @@ #define ___int_ptrdiff_t_h #define _GCC_PTRDIFF_T #ifndef __PTRDIFF_TYPE__ -#define __PTRDIFF_TYPE__ long int +# ifdef _WIN64 + #define __PTRDIFF_TYPE__ long long int +# else +# #define __PTRDIFF_TYPE__ long int +# endif #endif +#ifndef _PTRDIFF_T_DEFINED +#define _PTRDIFF_T_DEFINED typedef __PTRDIFF_TYPE__ ptrdiff_t; +#endif #endif /* _GCC_PTRDIFF_T */ #endif /* ___int_ptrdiff_t_h */ #endif /* _BSD_PTRDIFF_T_ */ @@ -208,7 +208,11 @@ #define __size_t #endif #ifndef __SIZE_TYPE__ -#define __SIZE_TYPE__ long unsigned int +# ifdef _WIN64 +# define __SIZE_TYPE__ long long unsigned int +# else +# define __SIZE_TYPE__ long unsigned int +# endif #endif #if !(defined (__GNUG__) && defined (size_t)) typedef __SIZE_TYPE__ size_t; @@ -283,7 +287,7 @@ symbols in the _FOO_T_ family, stays defined even after its corresponding type is defined). If we define wchar_t, then we must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if - we undef _WCHAR_T_, then we must also define rune_t, since + we undef _WCHAR_T_, then we must also define rune_t, since headers like runetype.h assume that if machine/ansi.h is included, and _BSD_WCHAR_T_ is not defined, then rune_t is available. machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of @@ -305,22 +309,9 @@ #endif #endif #endif -/* FreeBSD 5 can't be handled well using "traditional" logic above - since it no longer defines _BSD_RUNE_T_ yet still desires to export - rune_t in some cases... */ -#if defined (__FreeBSD__) && (__FreeBSD__ >= 5) -#if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE) -#if __BSD_VISIBLE -#ifndef _RUNE_T_DECLARED -typedef __rune_t rune_t; -#define _RUNE_T_DECLARED -#endif -#endif -#endif -#endif #ifndef __WCHAR_TYPE__ -#define __WCHAR_TYPE__ int +#define __WCHAR_TYPE__ unsigned short #endif #ifndef __cplusplus typedef __WCHAR_TYPE__ wchar_t; @@ -345,18 +336,6 @@ #undef __need_wchar_t #endif /* _STDDEF_H or __need_wchar_t. */ -#if defined (__need_wint_t) -#ifndef _WINT_T -#define _WINT_T - -#ifndef __WINT_TYPE__ -#define __WINT_TYPE__ unsigned int -#endif -typedef __WINT_TYPE__ wint_t; -#endif -#undef __need_wint_t -#endif - /* In 4.3bsd-net2, leave these undefined to indicate that size_t, etc. are already defined. */ /* BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here. */ @@ -408,12 +387,12 @@ #endif /* NULL not defined and or need NULL. */ #undef __need_NULL -#ifdef _STDDEF_H +#ifndef offsetof /* Offset of member MEMBER in a struct of type TYPE. */ #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER) -#endif /* _STDDEF_H was defined this time */ +#endif /* !offsetof */ #endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__ || __need_XXX was not defined before */ Index: include/crt/mingw32/vadefs.h =================================================================== --- include/crt/mingw32/vadefs.h (Revision 0) +++ include/crt/mingw32/vadefs.h (Revision 0) @@ -0,0 +1,85 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_VADEFS +#define _INC_VADEFS + +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif + +#include <_mingw.h> + +#undef _CRT_PACKING +#define _CRT_PACKING 8 +#pragma pack(push,_CRT_PACKING) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _UINTPTR_T_DEFINED +#define _UINTPTR_T_DEFINED +#ifndef __uintptr_t_defined +#define __uintptr_t_defined +#undef uintptr_t +#ifdef _WIN64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef unsigned int uintptr_t __attribute__ ((mode (DI))); +#else + typedef unsigned __int64 uintptr_t; +#endif +#else + typedef unsigned long uintptr_t; +#endif +#endif +#endif + +#ifndef __GNUC_VA_LIST +#define __GNUC_VA_LIST + typedef __builtin_va_list __gnuc_va_list; +#endif + +#ifndef _VA_LIST_DEFINED +#define _VA_LIST_DEFINED + typedef __gnuc_va_list va_list; +#endif + +#ifdef __cplusplus +#define _ADDRESSOF(v) (&reinterpret_cast(v)) +#else +#define _ADDRESSOF(v) (&(v)) +#endif + +#if defined(__ia64__) +#define _VA_ALIGN 8 +#define _SLOTSIZEOF(t) ((sizeof(t) + _VA_ALIGN - 1) & ~(_VA_ALIGN - 1)) + +#define _VA_STRUCT_ALIGN 16 + +#define _ALIGNOF(ap) ((((ap)+_VA_STRUCT_ALIGN - 1) & ~(_VA_STRUCT_ALIGN -1)) - (ap)) +#define _APALIGN(t,ap) (__alignof(t) > 8 ? _ALIGNOF((uintptr_t) ap) : 0) +#else +#define _SLOTSIZEOF(t) (sizeof(t)) +#define _APALIGN(t,ap) (__alignof(t)) +#endif + +#if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L +#define va_copy(d,s) __builtin_va_copy(d,s) +#endif +#define __va_copy(d,s) __builtin_va_copy(d,s) + +#define _INTSIZEOF(n) ((sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1)) + +#define _crt_va_start(v,l) __builtin_va_start(v,l) +#define _crt_va_arg(v,l) __builtin_va_arg(v,l) +#define _crt_va_end(v) __builtin_va_end(v) + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) +#endif Index: include/crt/process.h =================================================================== --- include/crt/process.h (Revision 37928) +++ include/crt/process.h (Arbeitskopie) @@ -1,140 +1,180 @@ -/* - * process.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Function calls for spawning child processes. - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ +#ifndef _INC_PROCESS +#define _INC_PROCESS -#ifndef _PROCESS_H_ -#define _PROCESS_H_ - -/* All the headers include this file. */ #include <_mingw.h> /* Includes a definition of _pid_t and pid_t */ #include -#include +#ifndef _POSIX_ +#ifdef __cplusplus +extern "C" { +#endif -/* - * Constants for cwait actions. - * Obsolete for Win32. - */ -#define _WAIT_CHILD 0 -#define _WAIT_GRANDCHILD 1 +#define _P_WAIT 0 +#define _P_NOWAIT 1 +#define _OLD_P_OVERLAY 2 +#define _P_NOWAITO 3 +#define _P_DETACH 4 +#define _P_OVERLAY 2 -#ifndef _NO_OLDNAMES -#define WAIT_CHILD _WAIT_CHILD -#define WAIT_GRANDCHILD _WAIT_GRANDCHILD -#endif /* Not _NO_OLDNAMES */ +#define _WAIT_CHILD 0 +#define _WAIT_GRANDCHILD 1 -/* - * Mode constants for spawn functions. - */ -#define _P_WAIT 0 -#define _P_NOWAIT 1 -#define _P_OVERLAY 2 -#define _OLD_P_OVERLAY _P_OVERLAY -#define _P_NOWAITO 3 -#define _P_DETACH 4 + _CRTIMP uintptr_t __cdecl _beginthread(void (__cdecl *_StartAddress) (void *),unsigned _StackSize,void *_ArgList); + _CRTIMP void __cdecl _endthread(void); + _CRTIMP uintptr_t __cdecl _beginthreadex(void *_Security,unsigned _StackSize,unsigned (__stdcall *_StartAddress) (void *),void *_ArgList,unsigned _InitFlag,unsigned *_ThrdAddr); + _CRTIMP void __cdecl _endthreadex(unsigned _Retval); -#ifndef _NO_OLDNAMES -#define P_WAIT _P_WAIT -#define P_NOWAIT _P_NOWAIT -#define P_OVERLAY _P_OVERLAY -#define OLD_P_OVERLAY _OLD_P_OVERLAY -#define P_NOWAITO _P_NOWAITO -#define P_DETACH _P_DETACH -#endif /* Not _NO_OLDNAMES */ +#ifndef _CRT_TERMINATE_DEFINED +#define _CRT_TERMINATE_DEFINED + __declspec(noreturn) void __cdecl exit(int _Code); + _CRTIMP __declspec(noreturn) void __cdecl _exit(int _Code); +#if __MINGW_GNUC_PREREQ(4,4) +#pragma push_macro("abort") +#undef abort +#endif + void __cdecl __declspec(noreturn) abort(void); +#if __MINGW_GNUC_PREREQ(4,4) +#pragma pop_macro("abort") +#undef abort +#endif +#endif -#ifndef RC_INVOKED + _CRTIMP void __cdecl _cexit(void); + _CRTIMP void __cdecl _c_exit(void); + _CRTIMP int __cdecl _getpid(void); + _CRTIMP intptr_t __cdecl _cwait(int *_TermStat,intptr_t _ProcHandle,int _Action); + _CRTIMP intptr_t __cdecl _execl(const char *_Filename,const char *_ArgList,...); + _CRTIMP intptr_t __cdecl _execle(const char *_Filename,const char *_ArgList,...); + _CRTIMP intptr_t __cdecl _execlp(const char *_Filename,const char *_ArgList,...); + _CRTIMP intptr_t __cdecl _execlpe(const char *_Filename,const char *_ArgList,...); + _CRTIMP intptr_t __cdecl _execv(const char *_Filename,const char *const *_ArgList); + _CRTIMP intptr_t __cdecl _execve(const char *_Filename,const char *const *_ArgList,const char *const *_Env); + _CRTIMP intptr_t __cdecl _execvp(const char *_Filename,const char *const *_ArgList); + _CRTIMP intptr_t __cdecl _execvpe(const char *_Filename,const char *const *_ArgList,const char *const *_Env); + _CRTIMP intptr_t __cdecl _spawnl(int _Mode,const char *_Filename,const char *_ArgList,...); + _CRTIMP intptr_t __cdecl _spawnle(int _Mode,const char *_Filename,const char *_ArgList,...); + _CRTIMP intptr_t __cdecl _spawnlp(int _Mode,const char *_Filename,const char *_ArgList,...); + _CRTIMP intptr_t __cdecl _spawnlpe(int _Mode,const char *_Filename,const char *_ArgList,...); + _CRTIMP intptr_t __cdecl _spawnv(int _Mode,const char *_Filename,const char *const *_ArgList); + _CRTIMP intptr_t __cdecl _spawnve(int _Mode,const char *_Filename,const char *const *_ArgList,const char *const *_Env); + _CRTIMP intptr_t __cdecl _spawnvp(int _Mode,const char *_Filename,const char *const *_ArgList); + _CRTIMP intptr_t __cdecl _spawnvpe(int _Mode,const char *_Filename,const char *const *_ArgList,const char *const *_Env); -#ifdef __cplusplus -extern "C" { +#ifndef _CRT_SYSTEM_DEFINED +#define _CRT_SYSTEM_DEFINED + int __cdecl system(const char *_Command); #endif -_CRTIMP void __cdecl __MINGW_NOTHROW _cexit(void); -_CRTIMP void __cdecl __MINGW_NOTHROW _c_exit(void); +#ifndef _WPROCESS_DEFINED +#define _WPROCESS_DEFINED + _CRTIMP intptr_t __cdecl _wexecl(const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wexecle(const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wexeclp(const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wexeclpe(const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wexecv(const wchar_t *_Filename,const wchar_t *const *_ArgList); + _CRTIMP intptr_t __cdecl _wexecve(const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); + _CRTIMP intptr_t __cdecl _wexecvp(const wchar_t *_Filename,const wchar_t *const *_ArgList); + _CRTIMP intptr_t __cdecl _wexecvpe(const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); + _CRTIMP intptr_t __cdecl _wspawnl(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wspawnle(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wspawnlp(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wspawnlpe(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wspawnv(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList); + _CRTIMP intptr_t __cdecl _wspawnve(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); + _CRTIMP intptr_t __cdecl _wspawnvp(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList); + _CRTIMP intptr_t __cdecl _wspawnvpe(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); +#ifndef _CRT_WSYSTEM_DEFINED +#define _CRT_WSYSTEM_DEFINED + _CRTIMP int __cdecl _wsystem(const wchar_t *_Command); +#endif +#endif -_CRTIMP int __cdecl __MINGW_NOTHROW _cwait (int*, _pid_t, int); + void __cdecl __security_init_cookie(void); +#if (defined(_X86_) && !defined(__x86_64)) + void __fastcall __security_check_cookie(uintptr_t _StackCookie); + __declspec(noreturn) void __cdecl __report_gsfailure(void); +#else + void __cdecl __security_check_cookie(uintptr_t _StackCookie); + __declspec(noreturn) void __cdecl __report_gsfailure(uintptr_t _StackCookie); +#endif + extern uintptr_t __security_cookie; -_CRTIMP _pid_t __cdecl __MINGW_NOTHROW _getpid(void); + intptr_t __cdecl _loaddll(char *_Filename); + int __cdecl _unloaddll(intptr_t _Handle); + int (__cdecl *__cdecl _getdllprocaddr(intptr_t _Handle,char *_ProcedureName,intptr_t _Ordinal))(void); -_CRTIMP int __cdecl __MINGW_NOTHROW _execl (const char*, const char*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW _execle (const char*, const char*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW _execlp (const char*, const char*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW _execlpe (const char*, const char*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW _execv (const char*, const char* const*); -_CRTIMP int __cdecl __MINGW_NOTHROW _execve (const char*, const char* const*, const char* const*); -_CRTIMP int __cdecl __MINGW_NOTHROW _execvp (const char*, const char* const*); -_CRTIMP int __cdecl __MINGW_NOTHROW _execvpe (const char*, const char* const*, const char* const*); +#ifdef _DECL_DLLMAIN +#ifdef _WINDOWS_ + WINBOOL WINAPI DllMain(HANDLE _HDllHandle,DWORD _Reason,LPVOID _Reserved); + WINBOOL WINAPI _CRT_INIT(HANDLE _HDllHandle,DWORD _Reason,LPVOID _Reserved); + WINBOOL WINAPI _wCRT_INIT(HANDLE _HDllHandle,DWORD _Reason,LPVOID _Reserved); + extern WINBOOL (WINAPI *const _pRawDllMain)(HANDLE,DWORD,LPVOID); +#else + int __stdcall DllMain(void *_HDllHandle,unsigned _Reason,void *_Reserved); + int __stdcall _CRT_INIT(void *_HDllHandle,unsigned _Reason,void *_Reserved); + int __stdcall _wCRT_INIT(void *_HDllHandle,unsigned _Reason,void *_Reserved); + extern int (__stdcall *const _pRawDllMain)(void *,unsigned,void *); +#endif +#endif -_CRTIMP int __cdecl __MINGW_NOTHROW _spawnl (int, const char*, const char*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW _spawnle (int, const char*, const char*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW _spawnlp (int, const char*, const char*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW _spawnlpe (int, const char*, const char*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW _spawnv (int, const char*, const char* const*); -_CRTIMP int __cdecl __MINGW_NOTHROW _spawnve (int, const char*, const char* const*, const char* const*); -_CRTIMP int __cdecl __MINGW_NOTHROW _spawnvp (int, const char*, const char* const*); -_CRTIMP int __cdecl __MINGW_NOTHROW _spawnvpe (int, const char*, const char* const*, const char* const*); +#ifndef NO_OLDNAMES +#define P_WAIT _P_WAIT +#define P_NOWAIT _P_NOWAIT +#define P_OVERLAY _P_OVERLAY +#define OLD_P_OVERLAY _OLD_P_OVERLAY +#define P_NOWAITO _P_NOWAITO +#define P_DETACH _P_DETACH +#define WAIT_CHILD _WAIT_CHILD +#define WAIT_GRANDCHILD _WAIT_GRANDCHILD - -/* - * The functions _beginthreadex and _endthreadex are not provided by CRTDLL. - * They are provided by MSVCRT. - * - * NOTE: Apparently _endthread calls CloseHandle on the handle of the thread, - * making for race conditions if you are not careful. Basically you have to - * make sure that no-one is going to do *anything* with the thread handle - * after the thread calls _endthread or returns from the thread function. - * - * NOTE: No old names for these functions. Use the underscore. - */ -_CRTIMP uintptr_t __cdecl __MINGW_NOTHROW - _beginthread (void (*)(void *), unsigned, void*); -_CRTIMP void __cdecl __MINGW_NOTHROW _endthread (void); - -#ifdef __MSVCRT__ -_CRTIMP uintptr_t __cdecl __MINGW_NOTHROW - _beginthreadex (void *, unsigned, unsigned (__stdcall *) (void *), - void*, unsigned, unsigned*); -_CRTIMP void __cdecl __MINGW_NOTHROW _endthreadex (unsigned); + intptr_t __cdecl cwait(int *_TermStat,intptr_t _ProcHandle,int _Action); +#ifdef __GNUC__ + int __cdecl execl(const char *_Filename,const char *_ArgList,...); + int __cdecl execle(const char *_Filename,const char *_ArgList,...); + int __cdecl execlp(const char *_Filename,const char *_ArgList,...); + int __cdecl execlpe(const char *_Filename,const char *_ArgList,...); +#else + intptr_t __cdecl execl(const char *_Filename,const char *_ArgList,...); + intptr_t __cdecl execle(const char *_Filename,const char *_ArgList,...); + intptr_t __cdecl execlp(const char *_Filename,const char *_ArgList,...); + intptr_t __cdecl execlpe(const char *_Filename,const char *_ArgList,...); #endif + intptr_t __cdecl spawnl(int,const char *_Filename,const char *_ArgList,...); + intptr_t __cdecl spawnle(int,const char *_Filename,const char *_ArgList,...); + intptr_t __cdecl spawnlp(int,const char *_Filename,const char *_ArgList,...); + intptr_t __cdecl spawnlpe(int,const char *_Filename,const char *_ArgList,...); + int __cdecl getpid(void); +#ifdef __GNUC__ + /* Those methods are predefined by gcc builtins to return int. So to prevent + stupid warnings, define them in POSIX way. This is save, because those + methods do not return in success case, so that the return value is not + really dependent to its scalar width. */ + int __cdecl execv(const char *_Filename,char *const _ArgList[]); + int __cdecl execve(const char *_Filename,char *const _ArgList[],char *const _Env[]); + int __cdecl execvp(const char *_Filename,char *const _ArgList[]); + int __cdecl execvpe(const char *_Filename,char *const _ArgList[],char *const _Env[]); +#else + intptr_t __cdecl execv(const char *_Filename,char *const _ArgList[]); + intptr_t __cdecl execve(const char *_Filename,char *const _ArgList[],char *const _Env[]); + intptr_t __cdecl execvp(const char *_Filename,char *const _ArgList[]); + intptr_t __cdecl execvpe(const char *_Filename,char *const _ArgList[],char *const _Env[]); +#endif + intptr_t __cdecl spawnv(int,const char *_Filename,char *const _ArgList[]); + intptr_t __cdecl spawnve(int,const char *_Filename,char *const _ArgList[],char *const _Env[]); + intptr_t __cdecl spawnvp(int,const char *_Filename,char *const _ArgList[]); + intptr_t __cdecl spawnvpe(int,const char *_Filename,char *const _ArgList[],char *const _Env[]); +#endif - -#ifndef _NO_OLDNAMES -/* - * Functions without the leading underscore, for portability. These functions - * live in liboldnames.a. - */ -_CRTIMP int __cdecl __MINGW_NOTHROW cwait (int*, pid_t, int); -_CRTIMP pid_t __cdecl __MINGW_NOTHROW getpid (void); -_CRTIMP int __cdecl __MINGW_NOTHROW execl (const char*, const char*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW execle (const char*, const char*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW execlp (const char*, const char*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW execlpe (const char*, const char*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW execv (const char*, const char* const*); -_CRTIMP int __cdecl __MINGW_NOTHROW execve (const char*, const char* const*, const char* const*); -_CRTIMP int __cdecl __MINGW_NOTHROW execvp (const char*, const char* const*); -_CRTIMP int __cdecl __MINGW_NOTHROW execvpe (const char*, const char* const*, const char* const*); -_CRTIMP int __cdecl __MINGW_NOTHROW spawnl (int, const char*, const char*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW spawnle (int, const char*, const char*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW spawnlp (int, const char*, const char*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW spawnlpe (int, const char*, const char*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW spawnv (int, const char*, const char* const*); -_CRTIMP int __cdecl __MINGW_NOTHROW spawnve (int, const char*, const char* const*, const char* const*); -_CRTIMP int __cdecl __MINGW_NOTHROW spawnvp (int, const char*, const char* const*); -_CRTIMP int __cdecl __MINGW_NOTHROW spawnvpe (int, const char*, const char* const*, const char* const*); -#endif /* Not _NO_OLDNAMES */ - -#ifdef __cplusplus +#ifdef __cplusplus } #endif - -#endif /* Not RC_INVOKED */ - -#endif /* _PROCESS_H_ not defined */ +#endif +#endif Index: include/crt/search.h =================================================================== --- include/crt/search.h (Revision 37928) +++ include/crt/search.h (Arbeitskopie) @@ -1,106 +1,35 @@ -/* - * search.h - * - * Functions for searching and sorting. - * - * This file is part of the Mingw32 package. - * - * Contributors: - * Created by Danny Smith - * - * THIS SOFTWARE IS NOT COPYRIGHTED - * - * This source code is offered for use in the public domain. You may - * use, modify or distribute it freely. - * - * This code is distributed in the hope that it will be useful but - * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAIMED. This includes but is not limited to warranties of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ +#ifndef _INC_SEARCH +#define _INC_SEARCH -#ifndef _SEARCH_H_ -#define _SEARCH_H_ - -/* All the headers include this file. */ #include <_mingw.h> +#include -#ifndef RC_INVOKED - #ifdef __cplusplus extern "C" { #endif -#ifndef _SIZE_T_DEFINED -typedef unsigned int size_t; -#define _SIZE_T_DEFINED +#ifndef _CRT_ALGO_DEFINED +#define _CRT_ALGO_DEFINED + void *__cdecl bsearch(const void *_Key,const void *_Base,size_t _NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *)); + void __cdecl qsort(void *_Base,size_t _NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *)); #endif + _CRTIMP void *__cdecl _lfind(const void *_Key,const void *_Base,unsigned int *_NumOfElements,unsigned int _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *)); + _CRTIMP void *__cdecl _lsearch(const void *_Key,void *_Base,unsigned int *_NumOfElements,unsigned int _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *)); -/* bsearch and qsort are also declared in stdlib.h */ -_CRTIMP void* __cdecl bsearch (const void*, const void*, size_t, size_t, - int (*)(const void*, const void*)); -_CRTIMP void __cdecl qsort (void*, size_t, size_t, - int (*)(const void*, const void*)); - -_CRTIMP void* __cdecl _lfind (const void*, const void*, unsigned int*, - unsigned int, int (*)(const void*, const void*)); -_CRTIMP void* __cdecl _lsearch (const void*, void*, unsigned int*, unsigned int, - int (*)(const void*, const void*)); -/* -Documentation for these POSIX definitions and prototypes can be found in -The Open Group Base Specifications Issue 6 -IEEE Std 1003.1, 2004 Edition. -eg: http://www.opengroup.org/onlinepubs/009695399/functions/twalk.html -*/ - - -typedef struct entry { - char *key; - void *data; -} ENTRY; - -typedef enum { - FIND, - ENTER -} ACTION; - -typedef enum { - preorder, - postorder, - endorder, - leaf -} VISIT; - -#ifdef _SEARCH_PRIVATE -typedef struct node { - char *key; - struct node *llink, *rlink; -} node_t; +#ifndef NO_OLDNAMES + void *__cdecl lfind(const void *_Key,const void *_Base,unsigned int *_NumOfElements,unsigned int _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *)); + void *__cdecl lsearch(const void *_Key,void *_Base,unsigned int *_NumOfElements,unsigned int _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *)); #endif -void * __cdecl tdelete (const void * __restrict__, void ** __restrict__, - int (*)(const void *, const void *)) - __MINGW_ATTRIB_NONNULL (1) __MINGW_ATTRIB_NONNULL (3); -void * __cdecl tfind (const void *, void * const *, - int (*)(const void *, const void *)) - __MINGW_ATTRIB_NONNULL (1) __MINGW_ATTRIB_NONNULL (3); -void * __cdecl tsearch (const void *, void **, - int (*)(const void *, const void *)) - __MINGW_ATTRIB_NONNULL (1) __MINGW_ATTRIB_NONNULL (3); -void __cdecl twalk (const void *, void (*)(const void *, VISIT, int)); - -#ifndef _NO_OLDNAMES -_CRTIMP void* __cdecl lfind (const void*, const void*, unsigned int*, - unsigned int, int (*)(const void*, const void*)); -_CRTIMP void* __cdecl lsearch (const void*, void*, unsigned int*, unsigned int, - int (*)(const void*, const void*)); -#endif - #ifdef __cplusplus } #endif -#endif /* RC_INVOKED */ +#include -#endif /* _SEARCH_H_ */ +#endif Index: include/crt/sec_api/conio_s.h =================================================================== --- include/crt/sec_api/conio_s.h (Revision 0) +++ include/crt/sec_api/conio_s.h (Revision 0) @@ -0,0 +1,42 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ + +#ifndef _INC_CONIO_S +#define _INC_CONIO_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + + _CRTIMP errno_t __cdecl _cgets_s(char *_Buffer,size_t _Size,size_t *_SizeRead); + _CRTIMP int __cdecl _cprintf_s(const char *_Format,...); + _CRTIMP int __cdecl _cscanf_s(const char *_Format,...); + _CRTIMP int __cdecl _cscanf_s_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcprintf_s(const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _cprintf_s_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcprintf_s_l(const char *_Format,_locale_t _Locale,va_list _ArgList); + +#ifndef _WCONIO_DEFINED_S +#define _WCONIO_DEFINED_S + _CRTIMP errno_t __cdecl _cgetws_s(wchar_t *_Buffer,size_t _SizeInWords,size_t *_SizeRead); + _CRTIMP int __cdecl _cwprintf_s(const wchar_t *_Format,...); + _CRTIMP int __cdecl _cwscanf_s(const wchar_t *_Format,...); + _CRTIMP int __cdecl _cwscanf_s_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf_s(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _cwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); +#endif + +#ifdef __cplusplus +} +#endif + +#endif +#endif Index: include/crt/sec_api/crtdbg_s.h =================================================================== --- include/crt/sec_api/crtdbg_s.h (Revision 0) +++ include/crt/sec_api/crtdbg_s.h (Revision 0) @@ -0,0 +1,19 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ + +#ifndef _INC_CRTDBG_S +#define _INC_CRTDBG_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#define _dupenv_s_dbg(ps1,size,s2,t,f,l) _dupenv_s(ps1,size,s2) +#define _wdupenv_s_dbg(ps1,size,s2,t,f,l) _wdupenv_s(ps1,size,s2) + +#endif + +#endif Index: include/crt/sec_api/io_s.h =================================================================== --- include/crt/sec_api/io_s.h (Revision 0) +++ include/crt/sec_api/io_s.h (Revision 0) @@ -0,0 +1,33 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_IO_S +#define _INC_IO_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + + _CRTIMP errno_t __cdecl _access_s(const char *_Filename,int _AccessMode); + _CRTIMP errno_t __cdecl _chsize_s(int _FileHandle,__int64 _Size); + _CRTIMP errno_t __cdecl _mktemp_s(char *_TemplateName,size_t _Size); + _CRTIMP errno_t __cdecl _umask_s(int _NewMode,int *_OldMode); + +#ifndef _WIO_S_DEFINED +#define _WIO_S_DEFINED + _CRTIMP errno_t __cdecl _waccess_s(const wchar_t *_Filename,int _AccessMode); + _CRTIMP errno_t __cdecl _wmktemp_s(wchar_t *_TemplateName,size_t _SizeInWords); +#endif + +#ifdef __cplusplus +} +#endif + +#endif +#endif Index: include/crt/sec_api/mbstring_s.h =================================================================== --- include/crt/sec_api/mbstring_s.h (Revision 0) +++ include/crt/sec_api/mbstring_s.h (Revision 0) @@ -0,0 +1,52 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_MBSTRING_S +#define _INC_MBSTRING_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _MBSTRING_S_DEFINED +#define _MBSTRING_S_DEFINED + _CRTIMP errno_t __cdecl _mbscat_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src); + _CRTIMP errno_t __cdecl _mbscat_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbscpy_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src); + _CRTIMP errno_t __cdecl _mbscpy_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbslwr_s(unsigned char *_Str,size_t _SizeInBytes); + _CRTIMP errno_t __cdecl _mbslwr_s_l(unsigned char *_Str,size_t _SizeInBytes,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbsnbcat_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount); + _CRTIMP errno_t __cdecl _mbsnbcat_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbsnbcpy_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount); + _CRTIMP errno_t __cdecl _mbsnbcpy_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbsnbset_s(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Ch,size_t _MaxCount); + _CRTIMP errno_t __cdecl _mbsnbset_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Ch,size_t _MaxCount,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbsncat_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount); + _CRTIMP errno_t __cdecl _mbsncat_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbsncpy_s(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount); + _CRTIMP errno_t __cdecl _mbsncpy_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,const unsigned char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbsnset_s(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Val,size_t _MaxCount); + _CRTIMP errno_t __cdecl _mbsnset_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Val,size_t _MaxCount,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbsset_s(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Val); + _CRTIMP errno_t __cdecl _mbsset_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,unsigned int _Val,_locale_t _Locale); + _CRTIMP unsigned char *__cdecl _mbstok_s(unsigned char *_Str,const unsigned char *_Delim,unsigned char **_Context); + _CRTIMP unsigned char *__cdecl _mbstok_s_l(unsigned char *_Str,const unsigned char *_Delim,unsigned char **_Context,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbsupr_s(unsigned char *_Str,size_t _SizeInBytes); + _CRTIMP errno_t __cdecl _mbsupr_s_l(unsigned char *_Str,size_t _SizeInBytes,_locale_t _Locale); + _CRTIMP errno_t __cdecl _mbccpy_s(unsigned char *_Dst,size_t _DstSizeInBytes,int *_PCopied,const unsigned char *_Src); + _CRTIMP errno_t __cdecl _mbccpy_s_l(unsigned char *_Dst,size_t _DstSizeInBytes,int *_PCopied,const unsigned char *_Src,_locale_t _Locale); +#endif + +#ifdef __cplusplus +} +#endif + +#endif +#endif Index: include/crt/sec_api/search_s.h =================================================================== --- include/crt/sec_api/search_s.h (Revision 0) +++ include/crt/sec_api/search_s.h (Revision 0) @@ -0,0 +1,25 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_SEARCH_S +#define _INC_SEARCH_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + + _CRTIMP void *__cdecl _lfind_s(const void *_Key,const void *_Base,unsigned int *_NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(void *,const void *,const void *),void *_Context); + _CRTIMP void *__cdecl _lsearch_s(const void *_Key,void *_Base,unsigned int *_NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(void *,const void *,const void *),void *_Context); + +#ifdef __cplusplus +} +#endif + +#endif +#endif Index: include/crt/sec_api/stdio_s.h =================================================================== --- include/crt/sec_api/stdio_s.h (Revision 0) +++ include/crt/sec_api/stdio_s.h (Revision 0) @@ -0,0 +1,145 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_STDIO_S +#define _INC_STDIO_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _STDIO_S_DEFINED +#define _STDIO_S_DEFINED + _CRTIMP errno_t __cdecl clearerr_s(FILE *_File); + int __cdecl fprintf_s(FILE *_File,const char *_Format,...); + size_t __cdecl fread_s(void *_DstBuf,size_t _DstSize,size_t _ElementSize,size_t _Count,FILE *_File); + _CRTIMP int __cdecl _fscanf_s_l(FILE *_File,const char *_Format,_locale_t _Locale,...); + int __cdecl printf_s(const char *_Format,...); + _CRTIMP int __cdecl _scanf_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _scanf_s_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _snprintf_s(char *_DstBuf,size_t _DstSize,size_t _MaxCount,const char *_Format,...); + _CRTIMP int __cdecl _snprintf_c(char *_DstBuf,size_t _MaxCount,const char *_Format,...); + _CRTIMP int __cdecl _vsnprintf_c(char *_DstBuf,size_t _MaxCount,const char *_Format,va_list _ArgList); + int __cdecl sprintf_s(char *_DstBuf,size_t _DstSize,const char *_Format,...); + _CRTIMP int __cdecl _fscanf_l(FILE *_File,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _sscanf_l(const char *_Src,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _sscanf_s_l(const char *_Src,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _snscanf_s(const char *_Src,size_t _MaxCount,const char *_Format,...); + _CRTIMP int __cdecl _snscanf_l(const char *_Src,size_t _MaxCount,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _snscanf_s_l(const char *_Src,size_t _MaxCount,const char *_Format,_locale_t _Locale,...); + int __cdecl vfprintf_s(FILE *_File,const char *_Format,va_list _ArgList); + int __cdecl vprintf_s(const char *_Format,va_list _ArgList); + int __cdecl vsnprintf_s(char *_DstBuf,size_t _DstSize,size_t _MaxCount,const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _vsnprintf_s(char *_DstBuf,size_t _DstSize,size_t _MaxCount,const char *_Format,va_list _ArgList); + int __cdecl vsprintf_s(char *_DstBuf,size_t _Size,const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _fprintf_p(FILE *_File,const char *_Format,...); + _CRTIMP int __cdecl _printf_p(const char *_Format,...); + _CRTIMP int __cdecl _sprintf_p(char *_Dst,size_t _MaxCount,const char *_Format,...); + _CRTIMP int __cdecl _vfprintf_p(FILE *_File,const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _vprintf_p(const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _vsprintf_p(char *_Dst,size_t _MaxCount,const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _scprintf_p(const char *_Format,...); + _CRTIMP int __cdecl _vscprintf_p(const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _printf_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _printf_p_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vprintf_l(const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vprintf_p_l(const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fprintf_l(FILE *_File,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _fprintf_p_l(FILE *_File,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vfprintf_l(FILE *_File,const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vfprintf_p_l(FILE *_File,const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _sprintf_l(char *_DstBuf,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _sprintf_p_l(char *_DstBuf,size_t _MaxCount,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vsprintf_l(char *_DstBuf,const char *_Format,_locale_t,va_list _ArgList); + _CRTIMP int __cdecl _vsprintf_p_l(char *_DstBuf,size_t _MaxCount,const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _scprintf_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _scprintf_p_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vscprintf_l(const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vscprintf_p_l(const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _printf_s_l(const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vprintf_s_l(const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fprintf_s_l(FILE *_File,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vfprintf_s_l(FILE *_File,const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _sprintf_s_l(char *_DstBuf,size_t _DstSize,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vsprintf_s_l(char *_DstBuf,size_t _DstSize,const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _snprintf_s_l(char *_DstBuf,size_t _DstSize,size_t _MaxCount,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vsnprintf_s_l(char *_DstBuf,size_t _DstSize,size_t _MaxCount,const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _snprintf_l(char *_DstBuf,size_t _MaxCount,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _snprintf_c_l(char *_DstBuf,size_t _MaxCount,const char *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vsnprintf_l(char *_DstBuf,size_t _MaxCount,const char *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vsnprintf_c_l(char *_DstBuf,size_t _MaxCount,const char *,_locale_t _Locale,va_list _ArgList); + +#ifndef _WSTDIO_S_DEFINED +#define _WSTDIO_S_DEFINED + _CRTIMP wchar_t *__cdecl _getws_s(wchar_t *_Str,size_t _SizeInWords); + int __cdecl fwprintf_s(FILE *_File,const wchar_t *_Format,...); + int __cdecl wprintf_s(const wchar_t *_Format,...); + int __cdecl vwprintf_s(const wchar_t *_Format,va_list _ArgList); + int __cdecl swprintf_s(wchar_t *_Dst,size_t _SizeInWords,const wchar_t *_Format,...); + int __cdecl vswprintf_s(wchar_t *_Dst,size_t _SizeInWords,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _snwprintf_s(wchar_t *_DstBuf,size_t _DstSizeInWords,size_t _MaxCount,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vsnwprintf_s(wchar_t *_DstBuf,size_t _DstSizeInWords,size_t _MaxCount,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _wprintf_s_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fwprintf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vfwprintf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _swprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vswprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _snwprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vsnwprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fwscanf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _swscanf_s_l(const wchar_t *_Src,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _snwscanf_s(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,...); + _CRTIMP int __cdecl _snwscanf_s_l(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _wscanf_s_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP errno_t __cdecl _wfopen_s(FILE **_File,const wchar_t *_Filename,const wchar_t *_Mode); + _CRTIMP errno_t __cdecl _wfreopen_s(FILE **_File,const wchar_t *_Filename,const wchar_t *_Mode,FILE *_OldFile); + _CRTIMP errno_t __cdecl _wtmpnam_s(wchar_t *_DstBuf,size_t _SizeInWords); + _CRTIMP int __cdecl _fwprintf_p(FILE *_File,const wchar_t *_Format,...); + _CRTIMP int __cdecl _wprintf_p(const wchar_t *_Format,...); + _CRTIMP int __cdecl _vfwprintf_p(FILE *_File,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _vwprintf_p(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _swprintf_p(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vswprintf_p(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _scwprintf_p(const wchar_t *_Format,...); + _CRTIMP int __cdecl _vscwprintf_p(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _wprintf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _wprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fwprintf_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _fwprintf_p_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vfwprintf_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vfwprintf_p_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _swprintf_c_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _swprintf_p_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vswprintf_c_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vswprintf_p_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _scwprintf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _scwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vscwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _snwprintf_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vsnwprintf_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl __swprintf_l(wchar_t *_Dest,const wchar_t *_Format,_locale_t _Plocinfo,...); + _CRTIMP int __cdecl __vswprintf_l(wchar_t *_Dest,const wchar_t *_Format,_locale_t _Plocinfo,va_list _Args); + _CRTIMP int __cdecl _vscwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fwscanf_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _swscanf_l(const wchar_t *_Src,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _snwscanf_l(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _wscanf_l(const wchar_t *_Format,_locale_t _Locale,...); +#endif +#endif + + _CRTIMP size_t __cdecl _fread_nolock_s(void *_DstBuf,size_t _DstSize,size_t _ElementSize,size_t _Count,FILE *_File); + +#ifdef __cplusplus +} +#endif +#endif +#endif Index: include/crt/sec_api/stdlib_s.h =================================================================== --- include/crt/sec_api/stdlib_s.h (Revision 0) +++ include/crt/sec_api/stdlib_s.h (Revision 0) @@ -0,0 +1,67 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_STDLIB_S +#define _INC_STDLIB_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + + _CRTIMP errno_t __cdecl _dupenv_s(char **_PBuffer,size_t *_PBufferSizeInBytes,const char *_VarName); + _CRTIMP errno_t __cdecl _itoa_s(int _Value,char *_DstBuf,size_t _Size,int _Radix); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP errno_t __cdecl _i64toa_s(__int64 _Val,char *_DstBuf,size_t _Size,int _Radix); + _CRTIMP errno_t __cdecl _ui64toa_s(unsigned __int64 _Val,char *_DstBuf,size_t _Size,int _Radix); +#endif + _CRTIMP errno_t __cdecl _ltoa_s(long _Val,char *_DstBuf,size_t _Size,int _Radix); + _CRTIMP errno_t __cdecl mbstowcs_s(size_t *_PtNumOfCharConverted,wchar_t *_DstBuf,size_t _SizeInWords,const char *_SrcBuf,size_t _MaxCount); + _CRTIMP errno_t __cdecl _mbstowcs_s_l(size_t *_PtNumOfCharConverted,wchar_t *_DstBuf,size_t _SizeInWords,const char *_SrcBuf,size_t _MaxCount,_locale_t _Locale); + _CRTIMP errno_t __cdecl _ultoa_s(unsigned long _Val,char *_DstBuf,size_t _Size,int _Radix); + _CRTIMP errno_t __cdecl _wctomb_s_l(int *_SizeConverted,char *_MbCh,size_t _SizeInBytes,wchar_t _WCh,_locale_t _Locale); + _CRTIMP errno_t __cdecl wcstombs_s(size_t *_PtNumOfCharConverted,char *_Dst,size_t _DstSizeInBytes,const wchar_t *_Src,size_t _MaxCountInBytes); + _CRTIMP errno_t __cdecl _wcstombs_s_l(size_t *_PtNumOfCharConverted,char *_Dst,size_t _DstSizeInBytes,const wchar_t *_Src,size_t _MaxCountInBytes,_locale_t _Locale); + +#ifndef _WSTDLIB_S_DEFINED +#define _WSTDLIB_S_DEFINED + _CRTIMP errno_t __cdecl _itow_s (int _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); + _CRTIMP errno_t __cdecl _ltow_s (long _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); + _CRTIMP errno_t __cdecl _ultow_s (unsigned long _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); + _CRTIMP errno_t __cdecl _wgetenv_s(size_t *_ReturnSize,wchar_t *_DstBuf,size_t _DstSizeInWords,const wchar_t *_VarName); + _CRTIMP errno_t __cdecl _wdupenv_s(wchar_t **_Buffer,size_t *_BufferSizeInWords,const wchar_t *_VarName); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP errno_t __cdecl _i64tow_s(__int64 _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); + _CRTIMP errno_t __cdecl _ui64tow_s(unsigned __int64 _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); +#endif +#endif + +#ifndef _POSIX_ + _CRTIMP errno_t __cdecl _ecvt_s(char *_DstBuf,size_t _Size,double _Val,int _NumOfDights,int *_PtDec,int *_PtSign); + _CRTIMP errno_t __cdecl _fcvt_s(char *_DstBuf,size_t _Size,double _Val,int _NumOfDec,int *_PtDec,int *_PtSign); + _CRTIMP errno_t __cdecl _gcvt_s(char *_DstBuf,size_t _Size,double _Val,int _NumOfDigits); + _CRTIMP errno_t __cdecl _makepath_s(char *_PathResult,size_t _Size,const char *_Drive,const char *_Dir,const char *_Filename,const char *_Ext); + _CRTIMP errno_t __cdecl _putenv_s(const char *_Name,const char *_Value); + _CRTIMP errno_t __cdecl _searchenv_s(const char *_Filename,const char *_EnvVar,char *_ResultPath,size_t _SizeInBytes); + _CRTIMP errno_t __cdecl _splitpath_s(const char *_FullPath,char *_Drive,size_t _DriveSize,char *_Dir,size_t _DirSize,char *_Filename,size_t _FilenameSize,char *_Ext,size_t _ExtSize); + +#ifndef _WSTDLIBP_S_DEFINED +#define _WSTDLIBP_S_DEFINED + _CRTIMP errno_t __cdecl _wmakepath_s(wchar_t *_PathResult,size_t _SizeInWords,const wchar_t *_Drive,const wchar_t *_Dir,const wchar_t *_Filename,const wchar_t *_Ext); + _CRTIMP errno_t __cdecl _wputenv_s(const wchar_t *_Name,const wchar_t *_Value); + _CRTIMP errno_t __cdecl _wsearchenv_s(const wchar_t *_Filename,const wchar_t *_EnvVar,wchar_t *_ResultPath,size_t _SizeInWords); + _CRTIMP errno_t __cdecl _wsplitpath_s(const wchar_t *_FullPath,wchar_t *_Drive,size_t _DriveSizeInWords,wchar_t *_Dir,size_t _DirSizeInWords,wchar_t *_Filename,size_t _FilenameSizeInWords,wchar_t *_Ext,size_t _ExtSizeInWords); +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif +#endif Index: include/crt/sec_api/stralign_s.h =================================================================== --- include/crt/sec_api/stralign_s.h (Revision 0) +++ include/crt/sec_api/stralign_s.h (Revision 0) @@ -0,0 +1,30 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef __STRALIGN_H_S_ +#define __STRALIGN_H_S_ + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(I_X86_) && defined(_WSTRING_S_DEFINED) +#if defined(__cplusplus) && defined(_WConst_Return) + static __inline PUWSTR ua_wcscpy_s(PUWSTR Destination,size_t DestinationSize,PCUWSTR Source) { + if(WSTR_ALIGNED(Source) && WSTR_ALIGNED(Destination)) return (wcscpy_s((PWSTR)Destination,DestinationSize,(PCWSTR)Source)==0 ? Destination : NULL); + return uaw_wcscpy((PCUWSTR)String,Character); + } +#endif +#endif + +#ifdef __cplusplus +} +#endif +#endif +#endif Index: include/crt/sec_api/string_s.h =================================================================== --- include/crt/sec_api/string_s.h (Revision 0) +++ include/crt/sec_api/string_s.h (Revision 0) @@ -0,0 +1,41 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_STRING_S +#define _INC_STRING_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + + _CRTIMP errno_t __cdecl _strset_s(char *_Dst,size_t _DstSize,int _Value); + _CRTIMP errno_t __cdecl _strerror_s(char *_Buf,size_t _SizeInBytes,const char *_ErrMsg); + _CRTIMP errno_t __cdecl _strlwr_s(char *_Str,size_t _Size); + _CRTIMP errno_t __cdecl _strlwr_s_l(char *_Str,size_t _Size,_locale_t _Locale); + _CRTIMP errno_t __cdecl _strnset_s(char *_Str,size_t _Size,int _Val,size_t _MaxCount); + _CRTIMP errno_t __cdecl _strupr_s(char *_Str,size_t _Size); + _CRTIMP errno_t __cdecl _strupr_s_l(char *_Str,size_t _Size,_locale_t _Locale); +#ifndef _WSTRING_S_DEFINED +#define _WSTRING_S_DEFINED + _CRTIMP wchar_t *__cdecl wcstok_s(wchar_t *_Str,const wchar_t *_Delim,wchar_t **_Context); + _CRTIMP errno_t __cdecl _wcserror_s(wchar_t *_Buf,size_t _SizeInWords,int _ErrNum); + _CRTIMP errno_t __cdecl __wcserror_s(wchar_t *_Buffer,size_t _SizeInWords,const wchar_t *_ErrMsg); + _CRTIMP errno_t __cdecl _wcsnset_s(wchar_t *_Dst,size_t _DstSizeInWords,wchar_t _Val,size_t _MaxCount); + _CRTIMP errno_t __cdecl _wcsset_s(wchar_t *_Str,size_t _SizeInWords,wchar_t _Val); + _CRTIMP errno_t __cdecl _wcslwr_s(wchar_t *_Str,size_t _SizeInWords); + _CRTIMP errno_t __cdecl _wcslwr_s_l(wchar_t *_Str,size_t _SizeInWords,_locale_t _Locale); + _CRTIMP errno_t __cdecl _wcsupr_s(wchar_t *_Str,size_t _Size); + _CRTIMP errno_t __cdecl _wcsupr_s_l(wchar_t *_Str,size_t _Size,_locale_t _Locale); +#endif + +#ifdef __cplusplus +} +#endif +#endif +#endif Index: include/crt/sec_api/sys/timeb_s.h =================================================================== --- include/crt/sec_api/sys/timeb_s.h (Revision 0) +++ include/crt/sec_api/sys/timeb_s.h (Revision 0) @@ -0,0 +1,34 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ + +#ifndef _TIMEB_H_S +#define _TIMEB_H_S + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef _USE_32BIT_TIME_T +#define _ftime_s _ftime32_s +#else +#define _ftime_s _ftime64_s +#endif + + _CRTIMP errno_t __cdecl _ftime32_s(struct __timeb32 *_Time); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP errno_t __cdecl _ftime64_s(struct __timeb64 *_Time); +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif Index: include/crt/sec_api/tchar_s.h =================================================================== --- include/crt/sec_api/tchar_s.h (Revision 0) +++ include/crt/sec_api/tchar_s.h (Revision 0) @@ -0,0 +1,266 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_TCHAR_S +#define _INC_TCHAR_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _UNICODE + +#define _tprintf_s wprintf_s +#define _tprintf_s_l _wprintf_s_l +#define _tcprintf_s _cwprintf_s +#define _tcprintf_s_l _cwprintf_s_l +#define _vtcprintf_s _vcwprintf_s +#define _vtcprintf_s_l _vcwprintf_s_l +#define _ftprintf_s fwprintf_s +#define _ftprintf_s_l _fwprintf_s_l +#define _stprintf_s swprintf_s +#define _stprintf_s_l _swprintf_s_l +#define _sntprintf_s _snwprintf_s +#define _sntprintf_s_l _snwprintf_s_l +#define _vtprintf_s vwprintf_s +#define _vtprintf_s_l _vwprintf_s_l +#define _vftprintf_s vfwprintf_s +#define _vftprintf_s_l _vfwprintf_s_l +#define _vstprintf_s vswprintf_s +#define _vstprintf_s_l _vswprintf_s_l +#define _vsntprintf_s _vsnwprintf_s +#define _vsntprintf_s_l _vsnwprintf_s_l + +#define _tscanf_s wscanf_s +#define _tscanf_s_l _wscanf_s_l +#define _tcscanf_s _cwscanf_s +#define _tcscanf_s_l _cwscanf_s_l +#define _ftscanf_s fwscanf_s +#define _ftscanf_s_l _fwscanf_s_l +#define _stscanf_s swscanf_s +#define _stscanf_s_l _swscanf_s_l +#define _sntscanf_s _snwscanf_s +#define _sntscanf_s_l _snwscanf_s_l + +#define _cgetts_s _cgetws_s +#define _getts_s _getws_s + +#define _itot_s _itow_s +#define _ltot_s _ltow_s +#define _ultot_s _ultow_s +#define _i64tot_s _i64tow_s +#define _ui64tot_s _ui64tow_s + +#define _tcscat_s wcscat_s +#define _tcscpy_s wcscpy_s +#define _tcsncat_s wcsncat_s +#define _tcsncat_s_l _wcsncat_s_l +#define _tcsncpy_s wcsncpy_s +#define _tcsncpy_s_l _wcsncpy_s_l +#define _tcstok_s wcstok_s +#define _tcstok_s_l _wcstok_s_l +#define _tcserror_s _wcserror_s +#define __tcserror_s __wcserror_s + +#define _tcsnset_s _wcsnset_s +#define _tcsnset_s_l _wcsnset_s_l +#define _tcsset_s _wcsset_s +#define _tcsset_s_l _wcsset_s_l + +#define _tasctime_s _wasctime_s +#define _tctime_s _wctime_s +#define _tctime32_s _wctime32_s +#define _tctime64_s _wctime64_s +#define _tstrdate_s _wstrdate_s +#define _tstrtime_s _wstrtime_s + +#define _tgetenv_s _wgetenv_s +#define _tdupenv_s _wdupenv_s +#define _tmakepath_s _wmakepath_s +#define _tputenv_s _wputenv_s +#define _tsearchenv_s _wsearchenv_s +#define _tsplitpath_s _wsplitpath_s + +#define _tfopen_s _wfopen_s +#define _tfreopen_s _wfreopen_s +#define _ttmpnam_s _wtmpnam_s +#define _taccess_s _waccess_s +#define _tmktemp_s _wmktemp_s + +#define _tcsnccat_s wcsncat_s +#define _tcsnccat_s_l _wcsncat_s_l +#define _tcsnccpy_s wcsncpy_s +#define _tcsnccpy_s_l _wcsncpy_s_l + +#define _tcslwr_s _wcslwr_s +#define _tcslwr_s_l _wcslwr_s_l +#define _tcsupr_s _wcsupr_s +#define _tcsupr_s_l _wcsupr_s_l + +#define _wcstok_s_l(_String,_Delimiters,_Current_position,_Locale) (wcstok_s(_String,_Delimiters,_Current_position)) +#define _wcsnset_s_l(_Destination,_Destination_size_chars,_Value,_Count,_Locale) (_wcsnset_s(_Destination,_Destination_size_chars,_Value,_Count)) +#define _wcsset_s_l(_Destination,_Destination_size_chars,_Value,_Locale) (_wcsset_s(_Destination,_Destination_size_chars,_Value)) + +#else + +#define _tprintf_s printf_s +#define _tprintf_s_l _printf_s_l +#define _tcprintf_s _cprintf_s +#define _tcprintf_s_l _cprintf_s_l +#define _vtcprintf_s _vcprintf_s +#define _vtcprintf_s_l _vcprintf_s_l +#define _ftprintf_s fprintf_s +#define _ftprintf_s_l _fprintf_s_l +#define _stprintf_s sprintf_s +#define _stprintf_s_l _sprintf_s_l +#define _sntprintf_s _snprintf_s +#define _sntprintf_s_l _snprintf_s_l +#define _vtprintf_s vprintf_s +#define _vtprintf_s_l _vprintf_s_l +#define _vftprintf_s vfprintf_s +#define _vftprintf_s_l _vfprintf_s_l +#define _vstprintf_s vsprintf_s +#define _vstprintf_s_l _vsprintf_s_l +#define _vsntprintf_s _vsnprintf_s +#define _vsntprintf_s_l _vsnprintf_s_l +#define _tscanf_s scanf_s +#define _tscanf_s_l _scanf_s_l +#define _tcscanf_s _cscanf_s +#define _tcscanf_s_l _cscanf_s_l +#define _ftscanf_s fscanf_s +#define _ftscanf_s_l _fscanf_s_l +#define _stscanf_s sscanf_s +#define _stscanf_s_l _sscanf_s_l +#define _sntscanf_s _snscanf_s +#define _sntscanf_s_l _snscanf_s_l + +#define _getts_s gets_s +#define _cgetts_s _cgets_s +#define _itot_s _itoa_s +#define _ltot_s _ltoa_s +#define _ultot_s _ultoa_s +#define _i64tot_s _i64toa_s +#define _ui64tot_s _ui64toa_s + +#define _tcscat_s strcat_s +#define _tcscpy_s strcpy_s +#define _tcserror_s strerror_s +#define __tcserror_s _strerror_s + +#define _tasctime_s asctime_s +#define _tctime_s ctime_s +#define _tctime32_s _ctime32_s +#define _tctime64_s _ctime64_s +#define _tstrdate_s _strdate_s +#define _tstrtime_s _strtime_s + +#define _tgetenv_s getenv_s +#define _tdupenv_s _dupenv_s +#define _tmakepath_s _makepath_s +#define _tputenv_s _putenv_s +#define _tsearchenv_s _searchenv_s +#define _tsplitpath_s _splitpath_s + +#define _tfopen_s fopen_s +#define _tfreopen_s freopen_s +#define _ttmpnam_s tmpnam_s +#define _tmktemp_s _mktemp_s + +#ifndef _POSIX_ +#define _taccess_s _access_s +#endif + +#define _tsopen_s _sopen_s + +#ifdef _MBCS + +#ifdef _MB_MAP_DIRECT + +#define _tcsncat_s _mbsnbcat_s +#define _tcsncat_s_l _mbsnbcat_s_l +#define _tcsncpy_s _mbsnbcpy_s +#define _tcsncpy_s_l _mbsnbcpy_s_l +#define _tcstok_s _mbstok_s +#define _tcstok_s_l _mbstok_s_l + +#define _tcsnset_s _mbsnbset_s +#define _tcsnset_s_l _mbsnbset_s_l +#define _tcsset_s _mbsset_s +#define _tcsset_s_l _mbsset_s_l + +#define _tcsnccat_s _mbsncat_s +#define _tcsnccat_s_l _mbsncat_s_l +#define _tcsnccpy_s _mbsncpy_s +#define _tcsnccpy_s_l _mbsncpy_s_l +#define _tcsncset_s _mbsnset_s +#define _tcsncset_s_l _mbsnset_s_l + +#define _tcslwr_s _mbslwr_s +#define _tcslwr_s_l _mbslwr_s_l +#define _tcsupr_s _mbsupr_s +#define _tcsupr_s_l _mbsupr_s_l + +#define _tccpy_s _mbccpy_s +#define _tccpy_s_l _mbccpy_s_l +#else + + _CRTIMP char *__cdecl _tcsncat_s(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsncat_s_l(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsncpy_s(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsncpy_s_l(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP char *__cdecl _tcstok_s(char *_Str,const char *_Delim,char **_Context); + _CRTIMP char *__cdecl _tcstok_s_l(char *_Str,const char *_Delim,char **_Context,_locale_t _Locale); + _CRTIMP errno_t __cdecl _tcsset_s(char *_Str,size_t _SizeInChars,unsigned int _Val); + _CRTIMP errno_t __cdecl _tcsset_s_l(char *_Str,size_t _SizeInChars,unsigned int,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsnccat_s(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsnccat_s_l(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsnccpy_s(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsnccpy_s_l(char *_Dst,size_t _DstSizeInChars,const char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP char *__cdecl _tcslwr_s(char *_Str,size_t _SizeInChars); + _CRTIMP char *__cdecl _tcslwr_s_l(char *_Str,size_t _SizeInChars,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsupr_s(char *_Str,size_t _SizeInChars); + _CRTIMP char *__cdecl _tcsupr_s_l(char *_Str,size_t _SizeInChars,_locale_t _Locale); + +#endif + +#else + +#define _tcsncat_s strncat_s +#define _tcsncat_s_l _strncat_s_l +#define _tcsncpy_s strncpy_s +#define _tcsncpy_s_l _strncpy_s_l +#define _tcstok_s strtok_s +#define _tcstok_s_l _strtok_s_l + +#define _tcsnset_s _strnset_s +#define _tcsnset_s_l _strnset_s_l +#define _tcsset_s _strset_s +#define _tcsset_s _strset_s +#define _tcsset_s_l _strset_s_l + +#define _tcsnccat_s strncat_s +#define _tcsnccat_s_l _strncat_s_l +#define _tcsnccpy_s strncpy_s +#define _tcsnccpy_s_l _strncpy_s_l + +#define _tcslwr_s _strlwr_s +#define _tcslwr_s_l _strlwr_s_l +#define _tcsupr_s _strupr_s +#define _tcsupr_s_l _strupr_s_l + +#define _strnset_s_l(_Destination,_Destination_size_chars,_Value,_Count,_Locale) (_strnset_s(_Destination,_Destination_size_chars,_Value,_Count)) +#define _strset_s_l(_Destination,_Destination_size_chars,_Value,_Locale) (_strset_s(_Destination,_Destination_size_chars,_Value)) +#endif +#endif + +#ifdef __cplusplus +} +#endif +#endif +#endif Index: include/crt/sec_api/time_s.h =================================================================== --- include/crt/sec_api/time_s.h (Revision 0) +++ include/crt/sec_api/time_s.h (Revision 0) @@ -0,0 +1,61 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _TIME_H__S +#define _TIME_H__S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + + _CRTIMP errno_t __cdecl _ctime32_s(char *_Buf,size_t _SizeInBytes,const __time32_t *_Time); + _CRTIMP errno_t __cdecl _gmtime32_s(struct tm *_Tm,const __time32_t *_Time); + _CRTIMP errno_t __cdecl _localtime32_s(struct tm *_Tm,const __time32_t *_Time); + _CRTIMP errno_t __cdecl _strdate_s(char *_Buf,size_t _SizeInBytes); + _CRTIMP errno_t __cdecl _strtime_s(char *_Buf ,size_t _SizeInBytes); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP errno_t __cdecl _ctime64_s(char *_Buf,size_t _SizeInBytes,const __time64_t *_Time); + _CRTIMP errno_t __cdecl _gmtime64_s(struct tm *_Tm,const __time64_t *_Time); + _CRTIMP errno_t __cdecl _localtime64_s(struct tm *_Tm,const __time64_t *_Time); +#endif + +#ifndef _WTIME_S_DEFINED +#define _WTIME_S_DEFINED + _CRTIMP errno_t __cdecl _wasctime_s(wchar_t *_Buf,size_t _SizeInWords,const struct tm *_Tm); + _CRTIMP errno_t __cdecl _wctime32_s(wchar_t *_Buf,size_t _SizeInWords,const __time32_t *_Time); + _CRTIMP errno_t __cdecl _wstrdate_s(wchar_t *_Buf,size_t _SizeInWords); + _CRTIMP errno_t __cdecl _wstrtime_s(wchar_t *_Buf,size_t _SizeInWords); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP errno_t __cdecl _wctime64_s(wchar_t *_Buf,size_t _SizeInWords,const __time64_t *_Time); +#endif + +#if !defined (RC_INVOKED) && !defined (_INC_WTIME_S_INL) +#define _INC_WTIME_S_INL +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE errno_t __cdecl _wctime_s(wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime32_s(_Buffer,_SizeInWords,_Time); } +#else +__CRT_INLINE errno_t __cdecl _wctime_s(wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime64_s(_Buffer,_SizeInWords,_Time); } +#endif +#endif +#endif + +#ifndef RC_INVOKED +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time) { return _localtime32_s(_Tm,_Time); } +#else +__CRT_INLINE errno_t __cdecl localtime_s(struct tm *_Tm,const time_t *_Time) { return _localtime64_s(_Tm,_Time); } +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif +#endif Index: include/crt/sec_api/wchar_s.h =================================================================== --- include/crt/sec_api/wchar_s.h (Revision 0) +++ include/crt/sec_api/wchar_s.h (Revision 0) @@ -0,0 +1,128 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _INC_WCHAR_S +#define _INC_WCHAR_S + +#include + +#if defined(MINGW_HAS_SECURE_API) + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _WIO_S_DEFINED +#define _WIO_S_DEFINED + _CRTIMP errno_t __cdecl _waccess_s(const wchar_t *_Filename,int _AccessMode); + _CRTIMP errno_t __cdecl _wmktemp_s(wchar_t *_TemplateName,size_t _SizeInWords); +#endif + +#ifndef _WCONIO_S_DEFINED +#define _WCONIO_S_DEFINED + _CRTIMP errno_t __cdecl _cgetws_s(wchar_t *_Buffer,size_t _SizeInWords,size_t *_SizeRead); + _CRTIMP int __cdecl _cwprintf_s(const wchar_t *_Format,...); + _CRTIMP int __cdecl _cwscanf_s(const wchar_t *_Format,...); + _CRTIMP int __cdecl _cwscanf_s_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf_s(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _cwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); +#endif + +#ifndef _WSTDIO_S_DEFINED +#define _WSTDIO_S_DEFINED + _CRTIMP wchar_t *__cdecl _getws_s(wchar_t *_Str,size_t _SizeInWords); + int __cdecl fwprintf_s(FILE *_File,const wchar_t *_Format,...); + int __cdecl wprintf_s(const wchar_t *_Format,...); + int __cdecl vfwprintf_s(FILE *_File,const wchar_t *_Format,va_list _ArgList); + int __cdecl vwprintf_s(const wchar_t *_Format,va_list _ArgList); + int __cdecl swprintf_s(wchar_t *_Dst,size_t _SizeInWords,const wchar_t *_Format,...); + int __cdecl vswprintf_s(wchar_t *_Dst,size_t _SizeInWords,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _snwprintf_s(wchar_t *_DstBuf,size_t _DstSizeInWords,size_t _MaxCount,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vsnwprintf_s(wchar_t *_DstBuf,size_t _DstSizeInWords,size_t _MaxCount,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _wprintf_s_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vwprintf_s_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fwprintf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vfwprintf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _swprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vswprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _snwprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vsnwprintf_s_l(wchar_t *_DstBuf,size_t _DstSize,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fwscanf_s_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _swscanf_s_l(const wchar_t *_Src,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _snwscanf_s(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,...); + _CRTIMP int __cdecl _snwscanf_s_l(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _wscanf_s_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP errno_t __cdecl _wfopen_s(FILE **_File,const wchar_t *_Filename,const wchar_t *_Mode); + _CRTIMP errno_t __cdecl _wfreopen_s(FILE **_File,const wchar_t *_Filename,const wchar_t *_Mode,FILE *_OldFile); + _CRTIMP errno_t __cdecl _wtmpnam_s(wchar_t *_DstBuf,size_t _SizeInWords); +#endif + +#ifndef _WSTDLIB_S_DEFINED +#define _WSTDLIB_S_DEFINED + _CRTIMP errno_t __cdecl _itow_s (int _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); + _CRTIMP errno_t __cdecl _ltow_s (long _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); + _CRTIMP errno_t __cdecl _ultow_s (unsigned long _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); + _CRTIMP errno_t __cdecl _wgetenv_s(size_t *_ReturnSize,wchar_t *_DstBuf,size_t _DstSizeInWords,const wchar_t *_VarName); + _CRTIMP errno_t __cdecl _wdupenv_s(wchar_t **_Buffer,size_t *_BufferSizeInWords,const wchar_t *_VarName); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP errno_t __cdecl _i64tow_s(__int64 _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); + _CRTIMP errno_t __cdecl _ui64tow_s(unsigned __int64 _Val,wchar_t *_DstBuf,size_t _SizeInWords,int _Radix); +#endif +#endif + +#ifndef _POSIX_ +#ifndef _WSTDLIBP_S_DEFINED +#define _WSTDLIBP_S_DEFINED + _CRTIMP errno_t __cdecl _wmakepath_s(wchar_t *_PathResult,size_t _SizeInWords,const wchar_t *_Drive,const wchar_t *_Dir,const wchar_t *_Filename,const wchar_t *_Ext); + _CRTIMP errno_t __cdecl _wputenv_s(const wchar_t *_Name,const wchar_t *_Value); + _CRTIMP errno_t __cdecl _wsearchenv_s(const wchar_t *_Filename,const wchar_t *_EnvVar,wchar_t *_ResultPath,size_t _SizeInWords); + _CRTIMP errno_t __cdecl _wsplitpath_s(const wchar_t *_FullPath,wchar_t *_Drive,size_t _DriveSizeInWords,wchar_t *_Dir,size_t _DirSizeInWords,wchar_t *_Filename,size_t _FilenameSizeInWords,wchar_t *_Ext,size_t _ExtSizeInWords); +#endif +#endif + +#ifndef _WSTRING_S_DEFINED +#define _WSTRING_S_DEFINED + _CRTIMP wchar_t *__cdecl wcstok_s(wchar_t *_Str,const wchar_t *_Delim,wchar_t **_Context); + _CRTIMP errno_t __cdecl _wcserror_s(wchar_t *_Buf,size_t _SizeInWords,int _ErrNum); + _CRTIMP errno_t __cdecl __wcserror_s(wchar_t *_Buffer,size_t _SizeInWords,const wchar_t *_ErrMsg); + _CRTIMP errno_t __cdecl _wcsnset_s(wchar_t *_Dst,size_t _DstSizeInWords,wchar_t _Val,size_t _MaxCount); + _CRTIMP errno_t __cdecl _wcsset_s(wchar_t *_Str,size_t _SizeInWords,wchar_t _Val); + _CRTIMP errno_t __cdecl _wcslwr_s(wchar_t *_Str,size_t _SizeInWords); + _CRTIMP errno_t __cdecl _wcslwr_s_l(wchar_t *_Str,size_t _SizeInWords,_locale_t _Locale); + _CRTIMP errno_t __cdecl _wcsupr_s(wchar_t *_Str,size_t _Size); + _CRTIMP errno_t __cdecl _wcsupr_s_l(wchar_t *_Str,size_t _Size,_locale_t _Locale); +#endif + +#ifndef _WTIME_S_DEFINED +#define _WTIME_S_DEFINED + _CRTIMP errno_t __cdecl _wasctime_s(wchar_t *_Buf,size_t _SizeInWords,const struct tm *_Tm); + _CRTIMP errno_t __cdecl _wctime32_s(wchar_t *_Buf,size_t _SizeInWords,const __time32_t *_Time); + _CRTIMP errno_t __cdecl _wstrdate_s(wchar_t *_Buf,size_t _SizeInWords); + _CRTIMP errno_t __cdecl _wstrtime_s(wchar_t *_Buf,size_t _SizeInWords); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP errno_t __cdecl _wctime64_s(wchar_t *_Buf,size_t _SizeInWords,const __time64_t *_Time); +#endif + +#if !defined (RC_INVOKED) && !defined (_INC_WTIME_S_INL) +#define _INC_WTIME_S_INL +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE errno_t __cdecl _wctime_s(wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime32_s(_Buffer,_SizeInWords,_Time); } +#else +__CRT_INLINE errno_t __cdecl _wctime_s(wchar_t *_Buffer,size_t _SizeInWords,const time_t *_Time) { return _wctime64_s(_Buffer,_SizeInWords,_Time); } +#endif +#endif +#endif + + _CRTIMP errno_t __cdecl mbsrtowcs_s(size_t *_Retval,wchar_t *_Dst,size_t _SizeInWords,const char **_PSrc,size_t _N,mbstate_t *_State); + _CRTIMP errno_t __cdecl wcrtomb_s(size_t *_Retval,char *_Dst,size_t _SizeInBytes,wchar_t _Ch,mbstate_t *_State); + _CRTIMP errno_t __cdecl wcsrtombs_s(size_t *_Retval,char *_Dst,size_t _SizeInBytes,const wchar_t **_Src,size_t _Size,mbstate_t *_State); + +#ifdef __cplusplus +} +#endif + +#endif +#endif Index: include/crt/setjmp.h =================================================================== --- include/crt/setjmp.h (Revision 37928) +++ include/crt/setjmp.h (Arbeitskopie) @@ -1,57 +1,181 @@ -/* - * setjmp.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Declarations supporting setjmp and longjump, a method for avoiding - * the normal function call return sequence. (Bleah!) - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ +#ifndef _INC_SETJMP +#define _INC_SETJMP -#ifndef _SETJMP_H_ -#define _SETJMP_H_ - -/* All the headers include this file. */ #include <_mingw.h> -#ifndef RC_INVOKED +#pragma pack(push,_CRT_PACKING) #ifdef __cplusplus extern "C" { #endif -/* - * The buffer used by setjmp to store the information used by longjmp - * to perform it's evil goto-like work. The size of this buffer was - * determined through experimentation; it's contents are a mystery. - * NOTE: This was determined on an i386 (actually a Pentium). The - * contents could be different on an Alpha or something else. - */ +#if (defined(_X86_) && !defined(__x86_64)) + #define _JBLEN 16 #define _JBTYPE int -typedef _JBTYPE jmp_buf[_JBLEN]; -/* - * The function provided by CRTDLL which appears to do the actual work - * of setjmp. - */ -_CRTIMP int __cdecl __MINGW_NOTHROW _setjmp (jmp_buf); + typedef struct __JUMP_BUFFER { + unsigned long Ebp; + unsigned long Ebx; + unsigned long Edi; + unsigned long Esi; + unsigned long Esp; + unsigned long Eip; + unsigned long Registration; + unsigned long TryLevel; + unsigned long Cookie; + unsigned long UnwindFunc; + unsigned long UnwindData[6]; + } _JUMP_BUFFER; +#elif defined(__ia64__) + typedef _CRT_ALIGN(16) struct _SETJMP_FLOAT128 { + __int64 LowPart; + __int64 HighPart; + } SETJMP_FLOAT128; -#define setjmp(x) _setjmp(x) +#define _JBLEN 33 + typedef SETJMP_FLOAT128 _JBTYPE; -/* - * Return to the last setjmp call and act as if setjmp had returned - * nVal (which had better be non-zero!). - */ -_CRTIMP void __cdecl __MINGW_NOTHROW longjmp (jmp_buf, int) __MINGW_ATTRIB_NORETURN; + typedef struct __JUMP_BUFFER { -#ifdef __cplusplus + unsigned long iAReserved[6]; + + unsigned long Registration; + unsigned long TryLevel; + unsigned long Cookie; + unsigned long UnwindFunc; + + unsigned long UnwindData[6]; + + SETJMP_FLOAT128 FltS0; + SETJMP_FLOAT128 FltS1; + SETJMP_FLOAT128 FltS2; + SETJMP_FLOAT128 FltS3; + SETJMP_FLOAT128 FltS4; + SETJMP_FLOAT128 FltS5; + SETJMP_FLOAT128 FltS6; + SETJMP_FLOAT128 FltS7; + SETJMP_FLOAT128 FltS8; + SETJMP_FLOAT128 FltS9; + SETJMP_FLOAT128 FltS10; + SETJMP_FLOAT128 FltS11; + SETJMP_FLOAT128 FltS12; + SETJMP_FLOAT128 FltS13; + SETJMP_FLOAT128 FltS14; + SETJMP_FLOAT128 FltS15; + SETJMP_FLOAT128 FltS16; + SETJMP_FLOAT128 FltS17; + SETJMP_FLOAT128 FltS18; + SETJMP_FLOAT128 FltS19; + __int64 FPSR; + __int64 StIIP; + __int64 BrS0; + __int64 BrS1; + __int64 BrS2; + __int64 BrS3; + __int64 BrS4; + __int64 IntS0; + __int64 IntS1; + __int64 IntS2; + __int64 IntS3; + __int64 RsBSP; + __int64 RsPFS; + __int64 ApUNAT; + __int64 ApLC; + __int64 IntSp; + __int64 IntNats; + __int64 Preds; + + } _JUMP_BUFFER; +#elif defined(__x86_64) + typedef _CRT_ALIGN(16) struct _SETJMP_FLOAT128 { + unsigned __int64 Part[2]; + } SETJMP_FLOAT128; + +#define _JBLEN 16 + typedef SETJMP_FLOAT128 _JBTYPE; + + typedef struct _JUMP_BUFFER { + unsigned __int64 Frame; + unsigned __int64 Rbx; + unsigned __int64 Rsp; + unsigned __int64 Rbp; + unsigned __int64 Rsi; + unsigned __int64 Rdi; + unsigned __int64 R12; + unsigned __int64 R13; + unsigned __int64 R14; + unsigned __int64 R15; + unsigned __int64 Rip; + unsigned __int64 Spare; + SETJMP_FLOAT128 Xmm6; + SETJMP_FLOAT128 Xmm7; + SETJMP_FLOAT128 Xmm8; + SETJMP_FLOAT128 Xmm9; + SETJMP_FLOAT128 Xmm10; + SETJMP_FLOAT128 Xmm11; + SETJMP_FLOAT128 Xmm12; + SETJMP_FLOAT128 Xmm13; + SETJMP_FLOAT128 Xmm14; + SETJMP_FLOAT128 Xmm15; + } _JUMP_BUFFER; +#endif +#ifndef _JMP_BUF_DEFINED + typedef _JBTYPE jmp_buf[_JBLEN]; +#define _JMP_BUF_DEFINED +#endif + +__CRT_INLINE void * __cdecl __attribute__ ((__nothrow__)) mingw_getsp(void) +{ +#ifdef __GNUC__ +#ifdef __x86_64 + __int64 *ret; + __asm__ __volatile__("leaq 16(%%rsp),%0\n" + :"=r"(ret) + : + ); + return ret; +#elif __i386__ + __int32 *ret; + __asm__ __volatile__("lea 8(%esp),%0\n" + :"=r"(ret) + : + ); + return ret; +#endif +#else +#error Unsupported Compiler +#endif } + +#ifdef USE_MINGW_SETJMP_TWO_ARGS +#ifndef _INC_SETJMPEX +#define setjmp(BUF) _setjmp((BUF),mingw_getsp()) + int __cdecl __attribute__ ((__nothrow__)) _setjmp(jmp_buf _Buf,void *_Ctx); +#else +#undef setjmp +#define setjmp(BUF) _setjmpex((BUF),mingw_getsp()) +#define setjmpex(BUF) _setjmpex((BUF),mingw_getsp()) + int __cdecl __attribute__ ((__nothrow__)) _setjmpex(jmp_buf _Buf,void *_Ctx); #endif +#else +#ifndef _INC_SETJMPEX +#define setjmp _setjmp +#endif + int __cdecl __attribute__ ((__nothrow__)) setjmp(jmp_buf _Buf); +#endif -#endif /* Not RC_INVOKED */ + __declspec(noreturn) __attribute__ ((__nothrow__)) void __cdecl ms_longjmp(jmp_buf _Buf,int _Value)/* throw(...)*/; + __declspec(noreturn) __attribute__ ((__nothrow__)) void __cdecl longjmp(jmp_buf _Buf,int _Value); -#endif /* Not _SETJMP_H_ */ +#ifdef __cplusplus +} +#endif - +#pragma pack(pop) +#endif Index: include/crt/share.h =================================================================== --- include/crt/share.h (Revision 37928) +++ include/crt/share.h (Arbeitskopie) @@ -1,33 +1,28 @@ -/* - * share.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Constants for file sharing functions. - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ +#ifndef _INC_SHARE +#define _INC_SHARE -#ifndef _SHARE_H_ -#define _SHARE_H_ +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif -/* All the headers include this file. */ -#include <_mingw.h> - #define _SH_COMPAT 0x00 /* Compatibility */ -#define _SH_DENYRW 0x10 /* Deny read/write */ -#define _SH_DENYWR 0x20 /* Deny write */ -#define _SH_DENYRD 0x30 /* Deny read */ -#define _SH_DENYNO 0x40 /* Deny nothing */ +#define _SH_DENYRW 0x10 +#define _SH_DENYWR 0x20 +#define _SH_DENYRD 0x30 +#define _SH_DENYNO 0x40 +#define _SH_SECURE 0x80 -#ifndef _NO_OLDNAMES - -/* Non ANSI names */ +#ifndef NO_OLDNAMES +#define SH_COMPAT _SH_COMPAT #define SH_DENYRW _SH_DENYRW #define SH_DENYWR _SH_DENYWR #define SH_DENYRD _SH_DENYRD #define SH_DENYNO _SH_DENYNO +#endif -#endif /* Not _NO_OLDNAMES */ - -#endif /* Not _SHARE_H_ */ +#endif Index: include/crt/signal.h =================================================================== --- include/crt/signal.h (Revision 37928) +++ include/crt/signal.h (Arbeitskopie) @@ -1,99 +1,63 @@ -/* - * signal.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * A way to set handlers for exceptional conditions (also known as signals). - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ +#ifndef _INC_SIGNAL +#define _INC_SIGNAL -#ifndef _SIGNAL_H_ -#define _SIGNAL_H_ - -/* All the headers include this file. */ #include <_mingw.h> -/* - * The actual signal values. Using other values with signal - * produces a SIG_ERR return value. - * - * NOTE: SIGINT is produced when the user presses Ctrl-C. - * SIGILL has not been tested. - * SIGFPE doesn't seem to work? - * SIGSEGV does not catch writing to a NULL pointer (that shuts down - * your app; can you say "segmentation violation core dump"?). - * SIGTERM comes from what kind of termination request exactly? - * SIGBREAK is indeed produced by pressing Ctrl-Break. - * SIGABRT is produced by calling abort. - * TODO: The above results may be related to not installing an appropriate - * structured exception handling frame. Results may be better if I ever - * manage to get the SEH stuff down. - */ -#define SIGINT 2 /* Interactive attention */ -#define SIGILL 4 /* Illegal instruction */ -#define SIGFPE 8 /* Floating point error */ -#define SIGSEGV 11 /* Segmentation violation */ -#define SIGTERM 15 /* Termination request */ -#define SIGBREAK 21 /* Control-break */ -#define SIGABRT 22 /* Abnormal termination (abort) */ +#ifdef __cplusplus +extern "C" { +#endif -#define NSIG 23 /* maximum signal number + 1 */ - -#ifndef RC_INVOKED - #ifndef _SIG_ATOMIC_T_DEFINED -typedef int sig_atomic_t; #define _SIG_ATOMIC_T_DEFINED + typedef int sig_atomic_t; #endif -/* - * The prototypes (below) are the easy part. The hard part is figuring - * out what signals are available and what numbers they are assigned - * along with appropriate values of SIG_DFL and SIG_IGN. - */ +#define NSIG 23 -/* - * A pointer to a signal handler function. A signal handler takes a - * single int, which is the signal it handles. - */ -typedef void (*__p_sig_fn_t)(int); - -/* - * These are special values of signal handler pointers which are - * used to send a signal to the default handler (SIG_DFL), ignore - * the signal (SIG_IGN), indicate an error return (SIG_ERR), - * get an error (SIG_SGE), or acknowledge (SIG_ACK). - */ -#define SIG_DFL ((__p_sig_fn_t) 0) -#define SIG_IGN ((__p_sig_fn_t) 1) -#define SIG_ERR ((__p_sig_fn_t) -1) -#define SIG_SGE ((__p_sig_fn_t) 3) -#define SIG_ACK ((__p_sig_fn_t) 4) - -#ifdef __cplusplus -extern "C" { +#define SIGHUP 1 /* hangup */ +#define SIGINT 2 +#define SIGQUIT 3 /* quit */ +#define SIGILL 4 +#define SIGTRAP 5 /* trace trap (not reset when caught) */ +#define SIGIOT 6 /* IOT instruction */ +#define SIGABRT 6 /* used by abort, replace SIGIOT in the future */ +#define SIGEMT 7 /* EMT instruction */ +#define SIGFPE 8 +#define SIGKILL 9 /* kill (cannot be caught or ignored) */ +#define SIGBUS 10 /* bus error */ +#define SIGSEGV 11 +#define SIGSYS 12 /* bad argument to system call */ +#define SIGPIPE 13 /* write on a pipe with no one to read it */ +#ifdef __USE_MINGW_ALARM +#define SIGALRM 14 /* alarm clock */ #endif +#define SIGTERM 15 +#define SIGBREAK 21 +#define SIGABRT2 22 -/* - * Call signal to set the signal handler for signal sig to the - * function pointed to by handler. Returns a pointer to the - * previous handler, or SIG_ERR if an error occurs. Initially - * unhandled signals defined above will return SIG_DFL. - */ -_CRTIMP __p_sig_fn_t __cdecl __MINGW_NOTHROW signal(int, __p_sig_fn_t); +#define SIGABRT_COMPAT 6 -/* - * Raise the signal indicated by sig. Returns non-zero on success. - */ -_CRTIMP int __cdecl __MINGW_NOTHROW raise (int); + typedef void (*__p_sig_fn_t)(int); -#ifdef __cplusplus -} -#endif +#define SIG_DFL (__p_sig_fn_t)0 +#define SIG_IGN (__p_sig_fn_t)1 +#define SIG_GET (__p_sig_fn_t)2 +#define SIG_SGE (__p_sig_fn_t)3 +#define SIG_ACK (__p_sig_fn_t)4 +#define SIG_ERR (__p_sig_fn_t)-1 -#endif /* Not RC_INVOKED */ + extern void **__cdecl __pxcptinfoptrs(void); +#define _pxcptinfoptrs (*__pxcptinfoptrs()) -#endif /* Not _SIGNAL_H_ */ + __p_sig_fn_t __cdecl signal(int _SigNum,__p_sig_fn_t _Func); + int __cdecl raise(int _SigNum); - +#ifdef __cplusplus +} +#endif +#endif Index: include/crt/stdint.h =================================================================== --- include/crt/stdint.h (Revision 37928) +++ include/crt/stdint.h (Arbeitskopie) @@ -1,3 +1,8 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ /* ISO C9x 7.18 Integer types * Based on ISO/IEC SC22/WG14 9899 Committee draft (SC22 N2794) * @@ -19,9 +24,12 @@ #ifndef _STDINT_H #define _STDINT_H + +#include <_mingw.h> + #define __need_wint_t #define __need_wchar_t -#include +#include "stddef.h" /* 7.18.1.1 Exact-width integer types */ typedef signed char int8_t; @@ -43,9 +51,9 @@ typedef long long int_least64_t; typedef unsigned long long uint_least64_t; -/* 7.18.1.3 Fastest minimum-width integer types +/* 7.18.1.3 Fastest minimum-width integer types * Not actually guaranteed to be fastest for all purposes - * Here we use the exact-width types for 8 and 16-bit ints. + * Here we use the exact-width types for 8 and 16-bit ints. */ typedef char int_fast8_t; typedef unsigned char uint_fast8_t; @@ -56,35 +64,15 @@ typedef long long int_fast64_t; typedef unsigned long long uint_fast64_t; -/* 7.18.1.4 Integer types capable of holding object pointers */ - -#ifndef _INTPTR_T_DEFINED -#define _INTPTR_T_DEFINED -#ifdef _WIN64 - typedef __int64 intptr_t; -#else - typedef int intptr_t; -#endif -#endif - -#ifndef _UINTPTR_T_DEFINED -#define _UINTPTR_T_DEFINED -#ifdef _WIN64 - typedef unsigned __int64 uintptr_t; -#else - typedef unsigned int uintptr_t; -#endif -#endif - /* 7.18.1.5 Greatest-width integer types */ typedef long long intmax_t; -typedef unsigned long long uintmax_t; +typedef unsigned long long uintmax_t; /* 7.18.2 Limits of specified-width integer types */ #if !defined ( __cplusplus) || defined (__STDC_LIMIT_MACROS) /* 7.18.2.1 Limits of exact-width integer types */ -#define INT8_MIN (-128) +#define INT8_MIN (-128) #define INT16_MIN (-32768) #define INT32_MIN (-2147483647 - 1) #define INT64_MIN (-9223372036854775807LL - 1) @@ -149,24 +137,37 @@ #define UINTMAX_MAX UINT64_MAX /* 7.18.3 Limits of other integer types */ -#define PTRDIFF_MIN INTPTR_MIN -#define PTRDIFF_MAX INTPTR_MAX +#ifdef _WIN64 +#define PTRDIFF_MIN INT64_MIN +#define PTRDIFF_MAX INT64_MAX +#else +#define PTRDIFF_MIN INT32_MIN +#define PTRDIFF_MAX INT32_MAX +#endif -#define SIG_ATOMIC_MIN INTPTR_MIN -#define SIG_ATOMIC_MAX INTPTR_MAX +#define SIG_ATOMIC_MIN INT32_MIN +#define SIG_ATOMIC_MAX INT32_MAX -#define SIZE_MAX UINTPTR_MAX +#ifndef SIZE_MAX +#ifdef _WIN64 +#define SIZE_MAX UINT64_MAX +#else +#define SIZE_MAX UINT32_MAX +#endif +#endif -#ifndef WCHAR_MIN /* also in wchar.h */ +#ifndef WCHAR_MIN /* also in wchar.h */ #define WCHAR_MIN 0 -#define WCHAR_MAX 0xffff /* UINT16_MAX */ #endif +#ifndef WCHAR_MAX +#define WCHAR_MAX ((wchar_t)-1) /* UINT16_MAX */ +#endif /* * wint_t is unsigned short for compatibility with MS runtime */ #define WINT_MIN 0 -#define WINT_MAX 0xffff /* UINT16_MAX */ +#define WINT_MAX ((wint_t)-1) /* UINT16_MAX */ #endif /* !defined ( __cplusplus) || defined __STDC_LIMIT_MACROS */ @@ -185,21 +186,25 @@ an integer constant with width less than that of type int. TC1 changed this to require just an integer constant *expression* with *promoted* type." + + The trick used here is from Clive D W Feather. */ -#define INT8_C(val) ((int8_t) + (val)) -#define UINT8_C(val) ((uint8_t) + (val##U)) -#define INT16_C(val) ((int16_t) + (val)) -#define UINT16_C(val) ((uint16_t) + (val##U)) +#define INT8_C(val) (INT_LEAST8_MAX-INT_LEAST8_MAX+(val)) +#define INT16_C(val) (INT_LEAST16_MAX-INT_LEAST16_MAX+(val)) +#define INT32_C(val) (INT_LEAST32_MAX-INT_LEAST32_MAX+(val)) +/* The 'trick' doesn't work in C89 for long long because, without + suffix, (val) will be evaluated as int, not intmax_t */ +#define INT64_C(val) val##LL -#define INT32_C(val) val##L -#define UINT32_C(val) val##UL -#define INT64_C(val) val##LL +#define UINT8_C(val) (UINT_LEAST8_MAX-UINT_LEAST8_MAX+(val)) +#define UINT16_C(val) (UINT_LEAST16_MAX-UINT_LEAST16_MAX+(val)) +#define UINT32_C(val) (UINT_LEAST32_MAX-UINT_LEAST32_MAX+(val)) #define UINT64_C(val) val##ULL /* 7.18.4.2 Macros for greatest-width integer constants */ -#define INTMAX_C(val) INT64_C(val) -#define UINTMAX_C(val) UINT64_C(val) +#define INTMAX_C(val) val##LL +#define UINTMAX_C(val) val##ULL #endif /* !defined ( __cplusplus) || defined __STDC_CONSTANT_MACROS */ Index: include/crt/stdio.h =================================================================== --- include/crt/stdio.h (Revision 37928) +++ include/crt/stdio.h (Arbeitskopie) @@ -1,528 +1,453 @@ -/* - * stdio.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Definitions of types and prototypes of functions for standard input and - * output. - * - * NOTE: The file manipulation functions provided by Microsoft seem to - * work with either slash (/) or backslash (\) as the directory separator. - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ +#ifndef _INC_STDIO +#define _INC_STDIO -#ifndef _STDIO_H_ -#define _STDIO_H_ - -/* All the headers include this file. */ #include <_mingw.h> -#ifndef RC_INVOKED -#define __need_size_t -#define __need_NULL -#define __need_wchar_t -#define __need_wint_t -#include -#define __need___va_list -#include -#endif /* Not RC_INVOKED */ +#pragma pack(push,_CRT_PACKING) - -/* Flags for the iobuf structure */ -#define _IOREAD 0x0001 /* currently reading */ -#define _IOWRT 0x0002 /* currently writing */ -#define _IOMYBUF 0x0008 /* stdio malloc()'d buffer */ -#define _IOEOF 0x0010 /* EOF reached on read */ -#define _IOERR 0x0020 /* I/O error from system */ -#define _IOSTRG 0x0040 /* Strange or no file descriptor */ -#define _IORW 0x0080 /* opened as "r+w" */ -#ifdef _POSIX_SOURCE -# define _IOAPPEND 0x0200 +#ifdef __cplusplus +extern "C" { #endif +#define BUFSIZ 512 +#define _NFILE _NSTREAM_ +#define _NSTREAM_ 512 +#define _IOB_ENTRIES 20 +#define EOF (-1) -/* - * The three standard file pointers provided by the run time library. - * NOTE: These will go to the bit-bucket silently in GUI applications! - */ -#define STDIN_FILENO 0 -#define STDOUT_FILENO 1 -#define STDERR_FILENO 2 +#ifndef _FILE_DEFINED + struct _iobuf { + char *_ptr; + int _cnt; + char *_base; + int _flag; + int _file; + int _charbuf; + int _bufsiz; + char *_tmpfname; + }; + typedef struct _iobuf FILE; +#define _FILE_DEFINED +#endif -/* Returned by various functions on end of file condition or error. */ -#define EOF (-1) - -/* - * The maximum length of a file name. You should use GetVolumeInformation - * instead of this constant. But hey, this works. - * Also defined in io.h. - */ -#ifndef FILENAME_MAX -#define FILENAME_MAX (260) +#ifdef _POSIX_ +#define _P_tmpdir "/" +#define _wP_tmpdir L"/" +#else +#define _P_tmpdir "\\" +#define _wP_tmpdir L"\\" #endif -/* - * The maximum number of files that may be open at once. I have set this to - * a conservative number. The actual value may be higher. - */ -#define FOPEN_MAX (20) +#define L_tmpnam (sizeof(_P_tmpdir) + 12) -/* After creating this many names, tmpnam and tmpfile return NULL */ -#define TMP_MAX 32767 -/* - * Tmpnam, tmpfile and, sometimes, _tempnam try to create - * temp files in the root directory of the current drive - * (not in pwd, as suggested by some older MS doc's). - * Redefining these macros does not effect the CRT functions. - */ -#define _P_tmpdir "\\" -#ifndef __STRICT_ANSI__ -#define P_tmpdir _P_tmpdir +#ifdef _POSIX_ +#define L_ctermid 9 +#define L_cuserid 32 #endif -#define _wP_tmpdir L"\\" -/* - * The maximum size of name (including NUL) that will be put in the user - * supplied buffer caName for tmpnam. - * Inferred from the size of the static buffer returned by tmpnam - * when passed a NULL argument. May actually be smaller. - */ -#define L_tmpnam (16) - -#define _IOFBF 0x0000 /* full buffered */ -#define _IOLBF 0x0040 /* line buffered */ -#define _IONBF 0x0004 /* not buffered */ - -/* - * The buffer size as used by setbuf such that it is equivalent to - * (void) setvbuf(fileSetBuffer, caBuffer, _IOFBF, BUFSIZ). - */ -#define BUFSIZ 512 - -/* Constants for nOrigin indicating the position relative to which fseek - * sets the file position. Defined unconditionally since ISO and POSIX - * say they are defined here. */ -#define SEEK_SET 0 #define SEEK_CUR 1 #define SEEK_END 2 +#define SEEK_SET 0 -#ifndef RC_INVOKED +#define STDIN_FILENO 0 +#define STDOUT_FILENO 1 +#define STDERR_FILENO 2 -#ifndef __VALIST -#ifdef __GNUC__ -#define __VALIST __gnuc_va_list +#define FILENAME_MAX 260 +#define FOPEN_MAX 20 +#define _SYS_OPEN 20 +#define TMP_MAX 32767 + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 #else -#define __VALIST char* +#define NULL ((void *)0) #endif -#endif /* defined __VALIST */ +#endif -/* - * The structure underlying the FILE type. - * - * Some believe that nobody in their right mind should make use of the - * internals of this structure. Provided by Pedro A. Aranda Gutiirrez - * . - */ -#ifndef _FILE_DEFINED -#define _FILE_DEFINED -typedef struct _iobuf -{ - char* _ptr; - int _cnt; - char* _base; - int _flag; - int _file; - int _charbuf; - int _bufsiz; - char* _tmpfname; -} FILE; -#endif /* Not _FILE_DEFINED */ +#ifndef _OFF_T_DEFINED +#define _OFF_T_DEFINED +#ifndef _OFF_T_ +#define _OFF_T_ + typedef long _off_t; +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef long off_t; +#endif +#endif +#endif +#ifndef _OFF64_T_DEFINED +#define _OFF64_T_DEFINED + typedef long long _off64_t; +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef long long off64_t; +#endif +#endif -/* - * The standard file handles - */ -#ifndef __DECLSPEC_SUPPORTED - +#ifndef _STDIO_DEFINED +#ifdef _WIN64 + _CRTIMP FILE *__cdecl __iob_func(void); +#else +#ifdef _MSVCRT_ +extern FILE _iob[]; /* A pointer to an array of FILE */ +#define __iob_func() (_iob) +#else extern FILE (*_imp___iob)[]; /* A pointer to an array of FILE */ +#define __iob_func() (*_imp___iob) +#define _iob __iob_func() +#endif +#endif +#endif -#define _iob (*_imp___iob) /* An array of FILE */ +#ifndef _FPOS_T_DEFINED +#define _FPOS_T_DEFINED +#undef _FPOSOFF -#else /* __DECLSPEC_SUPPORTED */ - -__MINGW_IMPORT FILE _iob[]; /* An array of FILE imported from DLL. */ - -#endif /* __DECLSPEC_SUPPORTED */ - -#define stdin (&_iob[STDIN_FILENO]) -#define stdout (&_iob[STDOUT_FILENO]) -#define stderr (&_iob[STDERR_FILENO]) - -#ifdef __cplusplus -extern "C" { +#if (!defined(NO_OLDNAMES) || defined(__GNUC__)) && _INTEGRAL_MAX_BITS >= 64 + typedef __int64 fpos_t; +#define _FPOSOFF(fp) ((long)(fp)) +#else + typedef long long fpos_t; +#define _FPOSOFF(fp) ((long)(fp)) #endif -/* - * File Operations - */ -_CRTIMP FILE* __cdecl __MINGW_NOTHROW fopen (const char*, const char*); -_CRTIMP FILE* __cdecl __MINGW_NOTHROW freopen (const char*, const char*, FILE*); -_CRTIMP int __cdecl __MINGW_NOTHROW fflush (FILE*); -_CRTIMP int __cdecl __MINGW_NOTHROW fclose (FILE*); -/* MS puts remove & rename (but not wide versions) in io.h also */ -_CRTIMP int __cdecl __MINGW_NOTHROW remove (const char*); -_CRTIMP int __cdecl __MINGW_NOTHROW rename (const char*, const char*); -_CRTIMP FILE* __cdecl __MINGW_NOTHROW tmpfile (void); -_CRTIMP char* __cdecl __MINGW_NOTHROW tmpnam (char*); - -#ifndef __STRICT_ANSI__ -_CRTIMP char* __cdecl __MINGW_NOTHROW _tempnam (const char*, const char*); -_CRTIMP int __cdecl __MINGW_NOTHROW _rmtmp(void); -_CRTIMP int __cdecl __MINGW_NOTHROW _unlink (const char*); - -#ifndef NO_OLDNAMES -_CRTIMP char* __cdecl __MINGW_NOTHROW tempnam (const char*, const char*); -_CRTIMP int __cdecl __MINGW_NOTHROW rmtmp(void); -_CRTIMP int __cdecl __MINGW_NOTHROW unlink (const char*); #endif -#endif /* __STRICT_ANSI__ */ -_CRTIMP int __cdecl __MINGW_NOTHROW setvbuf (FILE*, char*, int, size_t); +#ifndef _STDSTREAM_DEFINED +#define _STDSTREAM_DEFINED -_CRTIMP void __cdecl __MINGW_NOTHROW setbuf (FILE*, char*); - -/* - * Formatted Output - */ - -_CRTIMP int __cdecl __MINGW_NOTHROW fprintf (FILE*, const char*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW printf (const char*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW sprintf (char*, const char*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW _snprintf (char*, size_t, const char*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW vfprintf (FILE*, const char*, __VALIST); -_CRTIMP int __cdecl __MINGW_NOTHROW vprintf (const char*, __VALIST); -_CRTIMP int __cdecl __MINGW_NOTHROW vsprintf (char*, const char*, __VALIST); -_CRTIMP int __cdecl __MINGW_NOTHROW _vsnprintf (char*, size_t, const char*, __VALIST); - -#ifndef __NO_ISOCEXT -__CRT_INLINE int __cdecl __MINGW_NOTHROW snprintf(char * s, size_t n, const char * f, ...) -{ - int r; - __VALIST a; - __mingw_va_start(a, f); - r = _vsnprintf (s, n, f, a); - __mingw_va_end(a); - return r; -} - -__CRT_INLINE int __cdecl __MINGW_NOTHROW vsnprintf (char * s, size_t n, const char * f, __VALIST a) -{ - return _vsnprintf (s, n, f, a); -} - -int __cdecl __MINGW_NOTHROW vscanf (const char * __restrict__ f, __VALIST a); -int __cdecl __MINGW_NOTHROW vfscanf (FILE * __restrict__ o, const char * __restrict__ f, - __VALIST a); -int __cdecl __MINGW_NOTHROW vsscanf (const char * __restrict__ s, - const char * __restrict__ f, __VALIST a); +#define stdin (&__iob_func()[0]) +#define stdout (&__iob_func()[1]) +#define stderr (&__iob_func()[2]) #endif -/* - * Formatted Input - */ +#define _IOREAD 0x0001 +#define _IOWRT 0x0002 -_CRTIMP int __cdecl __MINGW_NOTHROW fscanf (FILE*, const char*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW scanf (const char*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW sscanf (const char*, const char*, ...); -/* - * Character Input and Output Functions - */ +#define _IOFBF 0x0000 +#define _IOLBF 0x0040 +#define _IONBF 0x0004 -_CRTIMP int __cdecl __MINGW_NOTHROW fgetc (FILE*); -_CRTIMP char* __cdecl __MINGW_NOTHROW fgets (char*, int, FILE*); -_CRTIMP int __cdecl __MINGW_NOTHROW fputc (int, FILE*); -_CRTIMP int __cdecl __MINGW_NOTHROW fputs (const char*, FILE*); -_CRTIMP char* __cdecl __MINGW_NOTHROW gets (char*); -_CRTIMP int __cdecl __MINGW_NOTHROW puts (const char*); -_CRTIMP int __cdecl __MINGW_NOTHROW ungetc (int, FILE*); - -/* Traditionally, getc and putc are defined as macros. but the - standard doesn't say that they must be macros. - We use inline functions here to allow the fast versions - to be used in C++ with namespace qualification, eg., ::getc. - - _filbuf and _flsbuf are not thread-safe. */ -_CRTIMP int __cdecl __MINGW_NOTHROW _filbuf (FILE*); -_CRTIMP int __cdecl __MINGW_NOTHROW _flsbuf (int, FILE*); - -#if !defined _MT - -__CRT_INLINE int __cdecl __MINGW_NOTHROW getc (FILE* __F) -{ - return (--__F->_cnt >= 0) - ? (int) (unsigned char) *__F->_ptr++ - : _filbuf (__F); -} - -__CRT_INLINE int __cdecl __MINGW_NOTHROW putc (int __c, FILE* __F) -{ - return (--__F->_cnt >= 0) - ? (int) (unsigned char) (*__F->_ptr++ = (char)__c) - : _flsbuf (__c, __F); -} - -__CRT_INLINE int __cdecl __MINGW_NOTHROW getchar (void) -{ - return (--stdin->_cnt >= 0) - ? (int) (unsigned char) *stdin->_ptr++ - : _filbuf (stdin); -} - -__CRT_INLINE int __cdecl __MINGW_NOTHROW putchar(int __c) -{ - return (--stdout->_cnt >= 0) - ? (int) (unsigned char) (*stdout->_ptr++ = (char)__c) - : _flsbuf (__c, stdout);} - -#else /* Use library functions. */ - -_CRTIMP int __cdecl __MINGW_NOTHROW getc (FILE*); -_CRTIMP int __cdecl __MINGW_NOTHROW putc (int, FILE*); -_CRTIMP int __cdecl __MINGW_NOTHROW getchar (void); -_CRTIMP int __cdecl __MINGW_NOTHROW putchar (int); - +#define _IOMYBUF 0x0008 +#define _IOEOF 0x0010 +#define _IOERR 0x0020 +#define _IOSTRG 0x0040 +#define _IORW 0x0080 +#ifdef _POSIX_ +#define _IOAPPEND 0x0200 #endif -/* - * Direct Input and Output Functions - */ +#define _TWO_DIGIT_EXPONENT 0x1 -_CRTIMP size_t __cdecl __MINGW_NOTHROW fread (void*, size_t, size_t, FILE*); -_CRTIMP size_t __cdecl __MINGW_NOTHROW fwrite (const void*, size_t, size_t, FILE*); +#ifndef _STDIO_DEFINED -/* - * File Positioning Functions - */ - -_CRTIMP int __cdecl __MINGW_NOTHROW fseek (FILE*, long, int); -_CRTIMP long __cdecl __MINGW_NOTHROW ftell (FILE*); -_CRTIMP void __cdecl __MINGW_NOTHROW rewind (FILE*); - -#if __MSVCRT_VERSION__ >= 0x800 -_CRTIMP int __cdecl __MINGW_NOTHROW _fseek_nolock (FILE*, long, int); -_CRTIMP long __cdecl __MINGW_NOTHROW _ftell_nolock (FILE*); - -_CRTIMP int __cdecl __MINGW_NOTHROW _fseeki64 (FILE*, __int64, int); -_CRTIMP __int64 __cdecl __MINGW_NOTHROW _ftelli64 (FILE*); -_CRTIMP int __cdecl __MINGW_NOTHROW _fseeki64_nolock (FILE*, __int64, int); -_CRTIMP __int64 __cdecl __MINGW_NOTHROW _ftelli64_nolock (FILE*); + _CRTIMP int __cdecl _filbuf(FILE *_File); + _CRTIMP int __cdecl _flsbuf(int _Ch,FILE *_File); +#ifdef _POSIX_ + _CRTIMP FILE *__cdecl _fsopen(const char *_Filename,const char *_Mode); +#else + _CRTIMP FILE *__cdecl _fsopen(const char *_Filename,const char *_Mode,int _ShFlag); #endif + void __cdecl clearerr(FILE *_File); + int __cdecl fclose(FILE *_File); + _CRTIMP int __cdecl _fcloseall(void); +#ifdef _POSIX_ + FILE *__cdecl fdopen(int _FileHandle,const char *_Mode); +#else + _CRTIMP FILE *__cdecl _fdopen(int _FileHandle,const char *_Mode); +#endif + int __cdecl feof(FILE *_File); + int __cdecl ferror(FILE *_File); + int __cdecl fflush(FILE *_File); + int __cdecl fgetc(FILE *_File); + _CRTIMP int __cdecl _fgetchar(void); + int __cdecl fgetpos(FILE *_File ,fpos_t *_Pos); + char *__cdecl fgets(char *_Buf,int _MaxCount,FILE *_File); +#ifdef _POSIX_ + int __cdecl fileno(FILE *_File); +#else + _CRTIMP int __cdecl _fileno(FILE *_File); +#endif + _CRTIMP char *__cdecl _tempnam(const char *_DirName,const char *_FilePrefix); + _CRTIMP int __cdecl _flushall(void); + FILE *__cdecl fopen(const char *_Filename,const char *_Mode); + FILE *fopen64(const char *filename,const char *mode); + int __cdecl fprintf(FILE *_File,const char *_Format,...); + int __cdecl fputc(int _Ch,FILE *_File); + _CRTIMP int __cdecl _fputchar(int _Ch); + int __cdecl fputs(const char *_Str,FILE *_File); + size_t __cdecl fread(void *_DstBuf,size_t _ElementSize,size_t _Count,FILE *_File); + FILE *__cdecl freopen(const char *_Filename,const char *_Mode,FILE *_File); + int __cdecl fscanf(FILE *_File,const char *_Format,...); + int __cdecl fsetpos(FILE *_File,const fpos_t *_Pos); + int __cdecl fseek(FILE *_File,long _Offset,int _Origin); + int fseeko64(FILE* stream, _off64_t offset, int whence); + long __cdecl ftell(FILE *_File); + _off64_t ftello64(FILE * stream); + int __cdecl _fseeki64(FILE *_File,__int64 _Offset,int _Origin); + __int64 __cdecl _ftelli64(FILE *_File); + size_t __cdecl fwrite(const void *_Str,size_t _Size,size_t _Count,FILE *_File); + int __cdecl getc(FILE *_File); + int __cdecl getchar(void); + _CRTIMP int __cdecl _getmaxstdio(void); + char *__cdecl gets(char *_Buffer); + int __cdecl _getw(FILE *_File); +#ifndef _CRT_PERROR_DEFINED +#define _CRT_PERROR_DEFINED + void __cdecl perror(const char *_ErrMsg); +#endif + _CRTIMP int __cdecl _pclose(FILE *_File); + _CRTIMP FILE *__cdecl _popen(const char *_Command,const char *_Mode); +#if !defined(NO_OLDNAMES) && !defined(popen) +#define popen _popen +#define pclose _pclose +#endif + int __cdecl printf(const char *_Format,...); + int __cdecl putc(int _Ch,FILE *_File); + int __cdecl putchar(int _Ch); + int __cdecl puts(const char *_Str); + _CRTIMP int __cdecl _putw(int _Word,FILE *_File); +#ifndef _CRT_DIRECTORY_DEFINED +#define _CRT_DIRECTORY_DEFINED + int __cdecl remove(const char *_Filename); + int __cdecl rename(const char *_OldFilename,const char *_NewFilename); + _CRTIMP int __cdecl _unlink(const char *_Filename); +#ifndef NO_OLDNAMES + int __cdecl unlink(const char *_Filename); +#endif +#endif + void __cdecl rewind(FILE *_File); + _CRTIMP int __cdecl _rmtmp(void); + int __cdecl scanf(const char *_Format,...); + void __cdecl setbuf(FILE *_File,char *_Buffer); + _CRTIMP int __cdecl _setmaxstdio(int _Max); + _CRTIMP unsigned int __cdecl _set_output_format(unsigned int _Format); + _CRTIMP unsigned int __cdecl _get_output_format(void); + int __cdecl setvbuf(FILE *_File,char *_Buf,int _Mode,size_t _Size); + _CRTIMP int __cdecl _scprintf(const char *_Format,...); + int __cdecl sscanf(const char *_Src,const char *_Format,...); + _CRTIMP int __cdecl _snscanf(const char *_Src,size_t _MaxCount,const char *_Format,...); + FILE *__cdecl tmpfile(void); + char *__cdecl tmpnam(char *_Buffer); + int __cdecl ungetc(int _Ch,FILE *_File); + int __cdecl vfprintf(FILE *_File,const char *_Format,va_list _ArgList); + int __cdecl vprintf(const char *_Format,va_list _ArgList); + /* Make sure macros are not defined. */ +#if __MINGW_GNUC_PREREQ(4,4) +#pragma push_macro("vsnprintf") +#pragma push_macro("snprintf") +#endif + #undef vsnprintf + #undef snprintf -#ifdef __USE_MINGW_FSEEK /* These are in libmingwex.a */ -/* - * Workaround for limitations on win9x where a file contents are - * not zero'd out if you seek past the end and then write. - */ - -int __cdecl __MINGW_NOTHROW __mingw_fseek (FILE *, long, int); -size_t __cdecl __MINGW_NOTHROW __mingw_fwrite (const void*, size_t, size_t, FILE*); -#define fseek(fp, offset, whence) __mingw_fseek(fp, offset, whence) -#define fwrite(buffer, size, count, fp) __mingw_fwrite(buffer, size, count, fp) -#endif /* __USE_MINGW_FSEEK */ - -/* - * An opaque data type used for storing file positions... The contents of - * this type are unknown, but we (the compiler) need to know the size - * because the programmer using fgetpos and fsetpos will be setting aside - * storage for fpos_t structres. Actually I tested using a byte array and - * it is fairly evident that the fpos_t type is a long (in CRTDLL.DLL). - * Perhaps an unsigned long? TODO? It's definitely a 64-bit number in - * MSVCRT however, and for now `long long' will do. - */ -#ifdef __MSVCRT__ -typedef long long fpos_t; + extern +#ifdef gnu_printf + __attribute__((format(gnu_printf, 3, 0))) __attribute__((nonnull (3))) +#endif + int __mingw_vsnprintf(char *_DstBuf,size_t _MaxCount,const char *_Format,va_list _ArgList); + extern +#ifdef gnu_printf + __attribute__((format(gnu_printf, 3, 4))) __attribute__((nonnull (3))) +#endif + int __mingw_snprintf(char* s, size_t n, const char* format, ...); + int __cdecl vsnprintf(char *_DstBuf,size_t _MaxCount,const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _snprintf(char *_Dest,size_t _Count,const char *_Format,...); + _CRTIMP int __cdecl _vsnprintf(char *_Dest,size_t _Count,const char *_Format,va_list _Args); + int __cdecl sprintf(char *_Dest,const char *_Format,...); + int __cdecl vsprintf(char *_Dest,const char *_Format,va_list _Args); +#ifndef __NO_ISOCEXT /* externs in libmingwex.a */ + int __cdecl snprintf(char* s, size_t n, const char* format, ...); + __CRT_INLINE int __cdecl vsnprintf (char* s, size_t n, const char* format,va_list arg) { + return _vsnprintf ( s, n, format, arg); + } + int __cdecl vscanf(const char * __restrict__ Format, va_list argp); + int __cdecl vfscanf (FILE * __restrict__ fp, const char * Format,va_list argp); + int __cdecl vsscanf (const char * __restrict__ _Str,const char * __restrict__ Format,va_list argp); +#endif +/* Restore may prior defined macros snprintf/vsnprintf. */ +#if __MINGW_GNUC_PREREQ(4,4) +#pragma pop_macro("snprintf") +#pragma pop_macro("vsnprintf") +#endif +/* Check if vsnprintf and snprintf are defaulting to gnu-style. */ +#if defined(USE_MINGW_GNU_SNPRINTF) && USE_MINGW_GNU_SNPRINTF + #ifndef vsnprint + #define vsnprintf __mingw_vsnprintf + #endif + #ifndef snprintf + #define snprintf __mingw_snprintf + #endif #else -typedef long fpos_t; + #ifndef vsnprint + #define vsnprintf _vsnprintf + #endif + #ifndef snprintf + #define snprintf _snprintf + #endif #endif -_CRTIMP int __cdecl __MINGW_NOTHROW fgetpos (FILE*, fpos_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW fsetpos (FILE*, const fpos_t*); + _CRTIMP int __cdecl _vscprintf(const char *_Format,va_list _ArgList); + _CRTIMP int __cdecl _set_printf_count_output(int _Value); + _CRTIMP int __cdecl _get_printf_count_output(); -/* - * Error Functions - */ +#ifndef _WSTDIO_DEFINED -_CRTIMP int __cdecl __MINGW_NOTHROW feof (FILE*); -_CRTIMP int __cdecl __MINGW_NOTHROW ferror (FILE*); +#ifndef WEOF +#define WEOF (wint_t)(0xFFFF) +#endif -#ifdef __cplusplus -inline int __cdecl __MINGW_NOTHROW feof (FILE* __F) - { return __F->_flag & _IOEOF; } -inline int __cdecl __MINGW_NOTHROW ferror (FILE* __F) - { return __F->_flag & _IOERR; } +#ifdef _POSIX_ + _CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode); #else -#define feof(__F) ((__F)->_flag & _IOEOF) -#define ferror(__F) ((__F)->_flag & _IOERR) + _CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode,int _ShFlag); #endif + wint_t __cdecl fgetwc(FILE *_File); + _CRTIMP wint_t __cdecl _fgetwchar(void); + wint_t __cdecl fputwc(wchar_t _Ch,FILE *_File); + _CRTIMP wint_t __cdecl _fputwchar(wchar_t _Ch); + wint_t __cdecl getwc(FILE *_File); + wint_t __cdecl getwchar(void); + wint_t __cdecl putwc(wchar_t _Ch,FILE *_File); + wint_t __cdecl putwchar(wchar_t _Ch); + wint_t __cdecl ungetwc(wint_t _Ch,FILE *_File); + wchar_t *__cdecl fgetws(wchar_t *_Dst,int _SizeInWords,FILE *_File); + int __cdecl fputws(const wchar_t *_Str,FILE *_File); + _CRTIMP wchar_t *__cdecl _getws(wchar_t *_String); + _CRTIMP int __cdecl _putws(const wchar_t *_Str); + int __cdecl fwprintf(FILE *_File,const wchar_t *_Format,...); + int __cdecl wprintf(const wchar_t *_Format,...); + _CRTIMP int __cdecl _scwprintf(const wchar_t *_Format,...); + int __cdecl vfwprintf(FILE *_File,const wchar_t *_Format,va_list _ArgList); + int __cdecl vwprintf(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl swprintf(wchar_t*, const wchar_t*, ...); + _CRTIMP int __cdecl vswprintf(wchar_t*, const wchar_t*,va_list); + _CRTIMP int __cdecl _swprintf_c(wchar_t *_DstBuf,size_t _SizeInWords,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vswprintf_c(wchar_t *_DstBuf,size_t _SizeInWords,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _snwprintf(wchar_t *_Dest,size_t _Count,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest,size_t _Count,const wchar_t *_Format,va_list _Args); +#ifndef __NO_ISOCEXT /* externs in libmingwex.a */ + __CRT_INLINE int __cdecl snwprintf (wchar_t* s, size_t n, const wchar_t* format, ...) { + int r; + va_list a; + __mingw_va_start(a, format); + r = _vsnwprintf (s, n, format, a); + __mingw_va_end(a); + return r; + } + __CRT_INLINE int __cdecl vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, va_list arg) { return _vsnwprintf(s,n,format,arg); } + int __cdecl vwscanf (const wchar_t *, va_list); + int __cdecl vfwscanf (FILE *,const wchar_t *,va_list); + int __cdecl vswscanf (const wchar_t *,const wchar_t *,va_list); +#endif + _CRTIMP int __cdecl _swprintf(wchar_t *_Dest,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vswprintf(wchar_t *_Dest,const wchar_t *_Format,va_list _Args); -_CRTIMP void __cdecl __MINGW_NOTHROW clearerr (FILE*); -_CRTIMP void __cdecl __MINGW_NOTHROW perror (const char*); - - -#ifndef __STRICT_ANSI__ -/* - * Pipes - */ -_CRTIMP FILE* __cdecl __MINGW_NOTHROW _popen (const char*, const char*); -_CRTIMP int __cdecl __MINGW_NOTHROW _pclose (FILE*); - -#ifndef NO_OLDNAMES -_CRTIMP FILE* __cdecl __MINGW_NOTHROW popen (const char*, const char*); -_CRTIMP int __cdecl __MINGW_NOTHROW pclose (FILE*); +#ifndef RC_INVOKED +#include #endif -/* - * Other Non ANSI functions - */ -_CRTIMP int __cdecl __MINGW_NOTHROW _flushall (void); -_CRTIMP int __cdecl __MINGW_NOTHROW _fgetchar (void); -_CRTIMP int __cdecl __MINGW_NOTHROW _fputchar (int); -_CRTIMP FILE* __cdecl __MINGW_NOTHROW _fdopen (int, const char*); -_CRTIMP int __cdecl __MINGW_NOTHROW _fileno (FILE*); -_CRTIMP int __cdecl __MINGW_NOTHROW _fcloseall(void); -_CRTIMP FILE* __cdecl __MINGW_NOTHROW _fsopen(const char*, const char*, int); -#ifdef __MSVCRT__ -_CRTIMP int __cdecl __MINGW_NOTHROW _getmaxstdio(void); -_CRTIMP int __cdecl __MINGW_NOTHROW _setmaxstdio(int); +#ifdef _CRT_NON_CONFORMING_SWPRINTFS +#ifndef __cplusplus +#define swprintf _swprintf +#define vswprintf _vswprintf +#define _swprintf_l __swprintf_l +#define _vswprintf_l __vswprintf_l #endif +#endif -#if __MSVCRT_VERSION__ >= 0x800 -_CRTIMP int __cdecl __MINGW_NOTHROW _set_printf_count_output(int); -_CRTIMP int __cdecl __MINGW_NOTHROW _get_printf_count_output(void); + _CRTIMP wchar_t *__cdecl _wtempnam(const wchar_t *_Directory,const wchar_t *_FilePrefix); + _CRTIMP int __cdecl _vscwprintf(const wchar_t *_Format,va_list _ArgList); + int __cdecl fwscanf(FILE *_File,const wchar_t *_Format,...); + int __cdecl swscanf(const wchar_t *_Src,const wchar_t *_Format,...); + _CRTIMP int __cdecl _snwscanf(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,...); + int __cdecl wscanf(const wchar_t *_Format,...); + _CRTIMP FILE *__cdecl _wfdopen(int _FileHandle ,const wchar_t *_Mode); + _CRTIMP FILE *__cdecl _wfopen(const wchar_t *_Filename,const wchar_t *_Mode); + _CRTIMP FILE *__cdecl _wfreopen(const wchar_t *_Filename,const wchar_t *_Mode,FILE *_OldFile); +#ifndef _CRT_WPERROR_DEFINED +#define _CRT_WPERROR_DEFINED + _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg); #endif + _CRTIMP FILE *__cdecl _wpopen(const wchar_t *_Command,const wchar_t *_Mode); +#if !defined(NO_OLDNAMES) && !defined(wpopen) +#define wpopen _wpopen +#endif + _CRTIMP int __cdecl _wremove(const wchar_t *_Filename); + _CRTIMP wchar_t *__cdecl _wtmpnam(wchar_t *_Buffer); + _CRTIMP wint_t __cdecl _fgetwc_nolock(FILE *_File); + _CRTIMP wint_t __cdecl _fputwc_nolock(wchar_t _Ch,FILE *_File); + _CRTIMP wint_t __cdecl _ungetwc_nolock(wint_t _Ch,FILE *_File); -#ifndef _NO_OLDNAMES -_CRTIMP int __cdecl __MINGW_NOTHROW fgetchar (void); -_CRTIMP int __cdecl __MINGW_NOTHROW fputchar (int); -_CRTIMP FILE* __cdecl __MINGW_NOTHROW fdopen (int, const char*); -_CRTIMP int __cdecl __MINGW_NOTHROW fileno (FILE*); -#endif /* Not _NO_OLDNAMES */ +#undef _CRT_GETPUTWCHAR_NOINLINE -#define _fileno(__F) ((__F)->_file) -#ifndef _NO_OLDNAMES -#define fileno(__F) ((__F)->_file) +#if !defined(__cplusplus) || defined(_CRT_GETPUTWCHAR_NOINLINE) +#define getwchar() fgetwc(stdin) +#define putwchar(_c) fputwc((_c),stdout) +#else + __CRT_INLINE wint_t __cdecl getwchar() { return (fgetwc(stdin)); } + __CRT_INLINE wint_t __cdecl putwchar(wchar_t _C) { return (fputwc(_C,stdout)); } #endif -#if defined (__MSVCRT__) && !defined (__NO_MINGW_LFS) -#include -__CRT_INLINE FILE* __cdecl __MINGW_NOTHROW fopen64 (const char* filename, const char* mode) -{ - return fopen (filename, mode); -} +#define getwc(_stm) fgetwc(_stm) +#define putwc(_c,_stm) fputwc(_c,_stm) +#define _putwc_nolock(_c,_stm) _fputwc_nolock(_c,_stm) +#define _getwc_nolock(_stm) _fgetwc_nolock(_stm) -int __cdecl __MINGW_NOTHROW fseeko64 (FILE*, off64_t, int); +#define _WSTDIO_DEFINED +#endif -#ifdef __USE_MINGW_FSEEK -int __cdecl __MINGW_NOTHROW __mingw_fseeko64 (FILE *, off64_t, int); -#define fseeko64(fp, offset, whence) __mingw_fseeko64(fp, offset, whence) +#define _STDIO_DEFINED #endif -__CRT_INLINE off64_t __cdecl __MINGW_NOTHROW ftello64 (FILE * stream) -{ - fpos_t pos; - if (fgetpos(stream, &pos)) - return -1LL; - else - return ((off64_t) pos); -} -#endif /* __NO_MINGW_LFS */ +#define _fgetc_nolock(_stream) (--(_stream)->_cnt >= 0 ? 0xff & *(_stream)->_ptr++ : _filbuf(_stream)) +#define _fputc_nolock(_c,_stream) (--(_stream)->_cnt >= 0 ? 0xff & (*(_stream)->_ptr++ = (char)(_c)) : _flsbuf((_c),(_stream))) +#define _getc_nolock(_stream) _fgetc_nolock(_stream) +#define _putc_nolock(_c,_stream) _fputc_nolock(_c,_stream) +#define _getchar_nolock() _getc_nolock(stdin) +#define _putchar_nolock(_c) _putc_nolock((_c),stdout) +#define _getwchar_nolock() _getwc_nolock(stdin) +#define _putwchar_nolock(_c) _putwc_nolock((_c),stdout) -#endif /* Not __STRICT_ANSI__ */ + _CRTIMP void __cdecl _lock_file(FILE *_File); + _CRTIMP void __cdecl _unlock_file(FILE *_File); + _CRTIMP int __cdecl _fclose_nolock(FILE *_File); + _CRTIMP int __cdecl _fflush_nolock(FILE *_File); + _CRTIMP size_t __cdecl _fread_nolock(void *_DstBuf,size_t _ElementSize,size_t _Count,FILE *_File); + _CRTIMP int __cdecl _fseek_nolock(FILE *_File,long _Offset,int _Origin); + _CRTIMP long __cdecl _ftell_nolock(FILE *_File); + _CRTIMP int __cdecl _fseeki64_nolock(FILE *_File,__int64 _Offset,int _Origin); + _CRTIMP __int64 __cdecl _ftelli64_nolock(FILE *_File); + _CRTIMP size_t __cdecl _fwrite_nolock(const void *_DstBuf,size_t _Size,size_t _Count,FILE *_File); + _CRTIMP int __cdecl _ungetc_nolock(int _Ch,FILE *_File); -/* Wide versions */ +#if !defined(NO_OLDNAMES) || !defined(_POSIX) +#define P_tmpdir _P_tmpdir +#define SYS_OPEN _SYS_OPEN -#ifndef _WSTDIO_DEFINED -/* also in wchar.h - keep in sync */ -_CRTIMP int __cdecl __MINGW_NOTHROW fwprintf (FILE*, const wchar_t*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW wprintf (const wchar_t*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW swprintf (wchar_t*, const wchar_t*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW _snwprintf (wchar_t*, size_t, const wchar_t*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW vfwprintf (FILE*, const wchar_t*, __VALIST); -_CRTIMP int __cdecl __MINGW_NOTHROW vwprintf (const wchar_t*, __VALIST); -_CRTIMP int __cdecl __MINGW_NOTHROW vswprintf (wchar_t*, const wchar_t*, __VALIST); -_CRTIMP int __cdecl __MINGW_NOTHROW _vsnwprintf (wchar_t*, size_t, const wchar_t*, __VALIST); -_CRTIMP int __cdecl __MINGW_NOTHROW fwscanf (FILE*, const wchar_t*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW wscanf (const wchar_t*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW swscanf (const wchar_t*, const wchar_t*, ...); -_CRTIMP wint_t __cdecl __MINGW_NOTHROW fgetwc (FILE*); -_CRTIMP wint_t __cdecl __MINGW_NOTHROW fputwc (wchar_t, FILE*); -_CRTIMP wint_t __cdecl __MINGW_NOTHROW ungetwc (wchar_t, FILE*); - -#ifdef __MSVCRT__ -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW fgetws (wchar_t*, int, FILE*); -_CRTIMP int __cdecl __MINGW_NOTHROW fputws (const wchar_t*, FILE*); -_CRTIMP wint_t __cdecl __MINGW_NOTHROW getwc (FILE*); -_CRTIMP wint_t __cdecl __MINGW_NOTHROW getwchar (void); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _getws (wchar_t*); -_CRTIMP wint_t __cdecl __MINGW_NOTHROW putwc (wint_t, FILE*); -_CRTIMP int __cdecl __MINGW_NOTHROW _putws (const wchar_t*); -_CRTIMP wint_t __cdecl __MINGW_NOTHROW putwchar (wint_t); -_CRTIMP FILE* __cdecl __MINGW_NOTHROW _wfdopen(int, const wchar_t *); -_CRTIMP FILE* __cdecl __MINGW_NOTHROW _wfopen (const wchar_t*, const wchar_t*); -_CRTIMP FILE* __cdecl __MINGW_NOTHROW _wfreopen (const wchar_t*, const wchar_t*, FILE*); -_CRTIMP FILE* __cdecl __MINGW_NOTHROW _wfsopen (const wchar_t*, const wchar_t*, int); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wtmpnam (wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wtempnam (const wchar_t*, const wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wrename (const wchar_t*, const wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wremove (const wchar_t*); -_CRTIMP void __cdecl __MINGW_NOTHROW _wperror (const wchar_t*); -_CRTIMP FILE* __cdecl __MINGW_NOTHROW _wpopen (const wchar_t*, const wchar_t*); -#endif /* __MSVCRT__ */ - -#ifndef __NO_ISOCEXT /* externs in libmingwex.a */ -int __cdecl __MINGW_NOTHROW snwprintf (wchar_t* s, size_t n, const wchar_t* format, ...); -__CRT_INLINE int __cdecl __MINGW_NOTHROW -vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, __VALIST arg) - { return _vsnwprintf ( s, n, format, arg);} -int __cdecl __MINGW_NOTHROW vwscanf (const wchar_t * __restrict__, __VALIST); -int __cdecl __MINGW_NOTHROW vfwscanf (FILE * __restrict__, - const wchar_t * __restrict__, __VALIST); -int __cdecl __MINGW_NOTHROW vswscanf (const wchar_t * __restrict__, - const wchar_t * __restrict__, __VALIST); + char *__cdecl tempnam(const char *_Directory,const char *_FilePrefix); + int __cdecl fcloseall(void); + FILE *__cdecl fdopen(int _FileHandle,const char *_Format); + int __cdecl fgetchar(void); + int __cdecl fileno(FILE *_File); + int __cdecl flushall(void); + int __cdecl fputchar(int _Ch); + int __cdecl getw(FILE *_File); + int __cdecl putw(int _Ch,FILE *_File); + int __cdecl rmtmp(void); #endif -#define _WSTDIO_DEFINED -#endif /* _WSTDIO_DEFINED */ - -#ifndef __STRICT_ANSI__ -#ifdef __MSVCRT__ -#ifndef NO_OLDNAMES -_CRTIMP FILE* __cdecl __MINGW_NOTHROW wpopen (const wchar_t*, const wchar_t*); -#endif /* not NO_OLDNAMES */ -#endif /* MSVCRT runtime */ - -/* - * Other Non ANSI wide functions - */ -_CRTIMP wint_t __cdecl __MINGW_NOTHROW _fgetwchar (void); -_CRTIMP wint_t __cdecl __MINGW_NOTHROW _fputwchar (wint_t); -_CRTIMP int __cdecl __MINGW_NOTHROW _getw (FILE*); -_CRTIMP int __cdecl __MINGW_NOTHROW _putw (int, FILE*); - -#ifndef _NO_OLDNAMES -_CRTIMP wint_t __cdecl __MINGW_NOTHROW fgetwchar (void); -_CRTIMP wint_t __cdecl __MINGW_NOTHROW fputwchar (wint_t); -_CRTIMP int __cdecl __MINGW_NOTHROW getw (FILE*); -_CRTIMP int __cdecl __MINGW_NOTHROW putw (int, FILE*); -#endif /* Not _NO_OLDNAMES */ - -#endif /* __STRICT_ANSI */ - #ifdef __cplusplus } #endif -#endif /* Not RC_INVOKED */ +#pragma pack(pop) -#endif /* _STDIO_H_ */ +#include + +#endif Index: include/crt/stdlib.h =================================================================== --- include/crt/stdlib.h (Revision 37928) +++ include/crt/stdlib.h (Arbeitskopie) @@ -1,544 +1,587 @@ -/* - * stdlib.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Definitions for common types, variables, and functions. - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ +#ifndef _INC_STDLIB +#define _INC_STDLIB -#ifndef _STDLIB_H_ -#define _STDLIB_H_ - -/* All the headers include this file. */ #include <_mingw.h> +#include -#define __need_size_t -#define __need_wchar_t -#define __need_NULL -#ifndef RC_INVOKED -#include -#endif /* RC_INVOKED */ +#pragma pack(push,_CRT_PACKING) -/* - * RAND_MAX is the maximum value that may be returned by rand. - * The minimum is zero. - */ -#define RAND_MAX 0x7FFF +#ifdef __cplusplus +extern "C" { +#endif -/* - * These values may be used as exit status codes. - */ -#define EXIT_SUCCESS 0 -#define EXIT_FAILURE 1 +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif -/* - * Definitions for path name functions. - * NOTE: All of these values have simply been chosen to be conservatively high. - * Remember that with long file names we can no longer depend on - * extensions being short. - */ -#ifndef __STRICT_ANSI__ +#define EXIT_SUCCESS 0 +#define EXIT_FAILURE 1 -#ifndef MAX_PATH -#define MAX_PATH (260) -#endif +#ifndef _ONEXIT_T_DEFINED +#define _ONEXIT_T_DEFINED -#define _MAX_PATH MAX_PATH -#define _MAX_DRIVE (3) -#define _MAX_DIR 256 -#define _MAX_FNAME 256 -#define _MAX_EXT 256 + typedef int (__cdecl *_onexit_t)(void); -#endif /* Not __STRICT_ANSI__ */ +#ifndef NO_OLDNAMES +#define onexit_t _onexit_t +#endif +#endif +#ifndef _DIV_T_DEFINED +#define _DIV_T_DEFINED -#ifndef RC_INVOKED + typedef struct _div_t { + int quot; + int rem; + } div_t; -#ifdef __cplusplus -extern "C" { + typedef struct _ldiv_t { + long quot; + long rem; + } ldiv_t; #endif -#if !defined (__STRICT_ANSI__) +#ifndef _CRT_DOUBLE_DEC +#define _CRT_DOUBLE_DEC -/* - * This seems like a convenient place to declare these variables, which - * give programs using WinMain (or main for that matter) access to main-ish - * argc and argv. environ is a pointer to a table of environment variables. - * NOTE: Strings in _argv and environ are ANSI strings. - */ -extern int _argc; -extern char** _argv; +#pragma pack(4) + typedef struct { + unsigned char ld[10]; + } _LDOUBLE; +#pragma pack() -/* imports from runtime dll of the above variables */ -#ifdef __MSVCRT__ +#define _PTR_LD(x) ((unsigned char *)(&(x)->ld)) -extern int* __cdecl __MINGW_NOTHROW __p___argc(void); -extern char*** __cdecl __MINGW_NOTHROW __p___argv(void); -extern wchar_t*** __cdecl __MINGW_NOTHROW __p___wargv(void); + typedef struct { + double x; + } _CRT_DOUBLE; -#define __argc (*__p___argc()) -#define __argv (*__p___argv()) -#define __wargv (*__p___wargv()) + typedef struct { + float f; + } _CRT_FLOAT; +#if __MINGW_GNUC_PREREQ(4,4) +#pragma push_macro("long") +#undef long +#endif -#else /* !MSVCRT */ + typedef struct { + long double x; + } _LONGDOUBLE; -#ifndef __DECLSPEC_SUPPORTED +#if __MINGW_GNUC_PREREQ(4,4) +#pragma pop_macro("long") +#endif -extern int* _imp____argc_dll; -extern char*** _imp____argv_dll; -#define __argc (*_imp____argc_dll) -#define __argv (*_imp____argv_dll) +#pragma pack(4) + typedef struct { + unsigned char ld12[12]; + } _LDBL12; +#pragma pack() +#endif -#else /* __DECLSPEC_SUPPORTED */ +#define RAND_MAX 0x7fff -__MINGW_IMPORT int __argc_dll; -__MINGW_IMPORT char** __argv_dll; -#define __argc __argc_dll -#define __argv __argv_dll - -#endif /* __DECLSPEC_SUPPORTED */ - -#endif /* __MSVCRT */ -#endif /* __STRICT_ANSI__ */ -/* - * Also defined in ctype.h. - */ #ifndef MB_CUR_MAX -#ifdef __DECLSPEC_SUPPORTED -# ifdef __MSVCRT__ -# define MB_CUR_MAX __mb_cur_max - __MINGW_IMPORT int __mb_cur_max; -# else /* not __MSVCRT */ -# define MB_CUR_MAX __mb_cur_max_dll - __MINGW_IMPORT int __mb_cur_max_dll; -# endif /* not __MSVCRT */ - -#else /* ! __DECLSPEC_SUPPORTED */ -# ifdef __MSVCRT__ - extern int* _imp____mbcur_max; -# define MB_CUR_MAX (*_imp____mb_cur_max) -# else /* not __MSVCRT */ - extern int* _imp____mbcur_max_dll; -# define MB_CUR_MAX (*_imp____mb_cur_max_dll) -# endif /* not __MSVCRT */ -#endif /* __DECLSPEC_SUPPORTED */ -#endif /* MB_CUR_MAX */ - -/* - * MS likes to declare errno in stdlib.h as well. - */ - -#ifdef _UWIN -#undef errno -extern int errno; +#define MB_CUR_MAX ___mb_cur_max_func() +#ifndef __mb_cur_max +#ifdef _MSVCRT_ + extern int __mb_cur_max; #else - _CRTIMP int* __cdecl __MINGW_NOTHROW _errno(void); -#define errno (*_errno()) +#define __mb_cur_max (*_imp____mb_cur_max) + extern int *_imp____mb_cur_max; #endif - _CRTIMP int* __cdecl __MINGW_NOTHROW __doserrno(void); -#define _doserrno (*__doserrno()) +#endif +#ifdef _MSVCRT_ + extern int __mbcur_max; +#define ___mb_cur_max_func() (__mb_cur_max) +#else + extern int* _imp____mbcur_max; +#define ___mb_cur_max_func() (*_imp____mb_cur_max) +#endif +#endif -#if !defined (__STRICT_ANSI__) -/* - * Use environ from the DLL, not as a global. - */ +#define __max(a,b) (((a) > (b)) ? (a) : (b)) +#define __min(a,b) (((a) < (b)) ? (a) : (b)) -#ifdef __MSVCRT__ - extern _CRTIMP char *** __cdecl __MINGW_NOTHROW __p__environ(void); - extern _CRTIMP wchar_t *** __cdecl __MINGW_NOTHROW __p__wenviron(void); -# define _environ (*__p__environ()) -# define _wenviron (*__p__wenviron()) -#else /* ! __MSVCRT__ */ -# ifndef __DECLSPEC_SUPPORTED - extern char *** _imp___environ_dll; -# define _environ (*_imp___environ_dll) -# else /* __DECLSPEC_SUPPORTED */ - __MINGW_IMPORT char ** _environ_dll; -# define _environ _environ_dll -# endif /* __DECLSPEC_SUPPORTED */ -#endif /* ! __MSVCRT__ */ +#define _MAX_PATH 260 +#define _MAX_DRIVE 3 +#define _MAX_DIR 256 +#define _MAX_FNAME 256 +#define _MAX_EXT 256 -#define environ _environ +#define _OUT_TO_DEFAULT 0 +#define _OUT_TO_STDERR 1 +#define _OUT_TO_MSGBOX 2 +#define _REPORT_ERRMODE 3 -#ifdef __MSVCRT__ -/* One of the MSVCRTxx libraries */ +#define _WRITE_ABORT_MSG 0x1 +#define _CALL_REPORTFAULT 0x2 -#ifndef __DECLSPEC_SUPPORTED - extern int* _imp___sys_nerr; -# define sys_nerr (*_imp___sys_nerr) -#else /* __DECLSPEC_SUPPORTED */ - __MINGW_IMPORT int _sys_nerr; -# ifndef _UWIN -# define sys_nerr _sys_nerr -# endif /* _UWIN */ -#endif /* __DECLSPEC_SUPPORTED */ +#define _MAX_ENV 32767 -#else /* ! __MSVCRT__ */ + typedef void (__cdecl *_purecall_handler)(void); -/* CRTDLL run time library */ + _CRTIMP _purecall_handler __cdecl _set_purecall_handler(_purecall_handler _Handler); + _CRTIMP _purecall_handler __cdecl _get_purecall_handler(); -#ifndef __DECLSPEC_SUPPORTED - extern int* _imp___sys_nerr_dll; -# define sys_nerr (*_imp___sys_nerr_dll) -#else /* __DECLSPEC_SUPPORTED */ - __MINGW_IMPORT int _sys_nerr_dll; -# define sys_nerr _sys_nerr_dll -#endif /* __DECLSPEC_SUPPORTED */ + typedef void (__cdecl *_invalid_parameter_handler)(const wchar_t *,const wchar_t *,const wchar_t *,unsigned int,uintptr_t); + _invalid_parameter_handler __cdecl _set_invalid_parameter_handler(_invalid_parameter_handler _Handler); + _invalid_parameter_handler __cdecl _get_invalid_parameter_handler(void); -#endif /* ! __MSVCRT__ */ +#ifndef _CRT_ERRNO_DEFINED +#define _CRT_ERRNO_DEFINED + _CRTIMP extern int *__cdecl _errno(void); +#define errno (*_errno()) + errno_t __cdecl _set_errno(int _Value); + errno_t __cdecl _get_errno(int *_Value); +#endif + _CRTIMP unsigned long *__cdecl __doserrno(void); +#define _doserrno (*__doserrno()) + errno_t __cdecl _set_doserrno(unsigned long _Value); + errno_t __cdecl _get_doserrno(unsigned long *_Value); -#ifndef __DECLSPEC_SUPPORTED -extern char*** _imp__sys_errlist; -#define sys_errlist (*_imp___sys_errlist) -#else /* __DECLSPEC_SUPPORTED */ -__MINGW_IMPORT char* _sys_errlist[]; -#ifndef _UWIN -#define sys_errlist _sys_errlist -#endif /* _UWIN */ -#endif /* __DECLSPEC_SUPPORTED */ +#ifdef _MSVCRT_ + extern int* _imp___sys_nerr; + extern char*** _imp__sys_errlist; +#else + __MINGW_IMPORT int _sys_nerr; + __MINGW_IMPORT char* _sys_errlist[]; +#endif -/* - * OS version and such constants. - */ +//#if (defined(_X86_) && !defined(__x86_64)) + _CRTIMP int *__cdecl __p___argc(void); + _CRTIMP char ***__cdecl __p___argv(void); + _CRTIMP wchar_t ***__cdecl __p___wargv(void); + _CRTIMP char ***__cdecl __p__environ(void); + _CRTIMP wchar_t ***__cdecl __p__wenviron(void); + _CRTIMP char **__cdecl __p__pgmptr(void); + _CRTIMP wchar_t **__cdecl __p__wpgmptr(void); +//#endif +#ifndef __argc +#ifdef _MSVCRT_ + extern int __argc; +#else +#define __argc (*_imp____argc) + extern int *_imp____argc; +#endif +#endif +#ifndef __argv +#ifdef _MSVCRT_ + extern char **__argv; +#else +#define __argv (*_imp____argv) + extern char ***_imp____argv; +#endif +#endif +#ifndef __wargv +#ifdef _MSVCRT_ + extern wchar_t **__wargv; +#else +#define __wargv (*_imp____wargv) + extern wchar_t ***_imp____wargv; +#endif +#endif -#ifdef __MSVCRT__ -/* msvcrtxx.dll */ +#ifdef _POSIX_ + extern char **environ; +#else +#ifndef _environ +#ifdef _MSVCRT_ + extern char **_environ; +#else +#define _environ (*_imp___environ) + extern char ***_imp___environ; +#endif +#endif -extern _CRTIMP unsigned __cdecl __MINGW_NOTHROW int* __p__osver(void); -extern _CRTIMP unsigned __cdecl __MINGW_NOTHROW int* __p__winver(void); -extern _CRTIMP unsigned __cdecl __MINGW_NOTHROW int* __p__winmajor(void); -extern _CRTIMP unsigned __cdecl __MINGW_NOTHROW int* __p__winminor(void); +#ifndef _wenviron +#ifdef _MSVCRT_ + extern wchar_t **_wenviron; +#else +#define _wenviron (*_imp___wenviron) + extern wchar_t ***_imp___wenviron; +#endif +#endif +#endif +#ifndef _pgmptr +#ifdef _MSVCRT_ + extern char *_pgmptr; +#else +#define _pgmptr (*_imp___pgmptr) + extern char **_imp___pgmptr; +#endif +#endif -#ifndef __DECLSPEC_SUPPORTED -# define _osver (*__p__osver()) -# define _winver (*__p__winver()) -# define _winmajor (*__p__winmajor()) -# define _winminor (*__p__winminor()) +#ifndef _wpgmptr +#ifdef _MSVCRT_ + extern wchar_t *_wpgmptr; #else -__MINGW_IMPORT unsigned int _osver; -__MINGW_IMPORT unsigned int _winver; -__MINGW_IMPORT unsigned int _winmajor; -__MINGW_IMPORT unsigned int _winminor; -#endif /* __DECLSPEC_SUPPORTED */ +#define _wpgmptr (*_imp___wpgmptr) + extern wchar_t **_imp___wpgmptr; +#endif +#endif + errno_t __cdecl _get_pgmptr(char **_Value); + errno_t __cdecl _get_wpgmptr(wchar_t **_Value); +#ifndef _fmode +#ifdef _MSVCRT_ + extern int _fmode; +#else +#define _fmode (*_imp___fmode) + extern int *_imp___fmode; +#endif +#endif + _CRTIMP errno_t __cdecl _set_fmode(int _Mode); + _CRTIMP errno_t __cdecl _get_fmode(int *_PMode); +#ifndef _osplatform +#ifdef _MSVCRT_ + extern unsigned int _osplatform; #else -/* Not msvcrtxx.dll, thus crtdll.dll */ +#define _osplatform (*_imp___osplatform) + extern unsigned int *_imp___osplatform; +#endif +#endif -#ifndef __DECLSPEC_SUPPORTED +#ifndef _osver +#ifdef _MSVCRT_ + extern unsigned int _osver; +#else +#define _osver (*_imp___osver) + extern unsigned int *_imp___osver; +#endif +#endif -extern unsigned int* _imp___osver_dll; -extern unsigned int* _imp___winver_dll; -extern unsigned int* _imp___winmajor_dll; -extern unsigned int* _imp___winminor_dll; +#ifndef _winver +#ifdef _MSVCRT_ + extern unsigned int _winver; +#else +#define _winver (*_imp___winver) + extern unsigned int *_imp___winver; +#endif +#endif -#define _osver (*_imp___osver_dll) -#define _winver (*_imp___winver_dll) -#define _winmajor (*_imp___winmajor_dll) -#define _winminor (*_imp___winminor_dll) +#ifndef _winmajor +#ifdef _MSVCRT_ + extern unsigned int _winmajor; +#else +#define _winmajor (*_imp___winmajor) + extern unsigned int *_imp___winmajor; +#endif +#endif -#else /* __DECLSPEC_SUPPORTED */ - -__MINGW_IMPORT unsigned int _osver_dll; -__MINGW_IMPORT unsigned int _winver_dll; -__MINGW_IMPORT unsigned int _winmajor_dll; -__MINGW_IMPORT unsigned int _winminor_dll; - -#define _osver _osver_dll -#define _winver _winver_dll -#define _winmajor _winmajor_dll -#define _winminor _winminor_dll - -#endif /* __DECLSPEC_SUPPORTED */ - +#ifndef _winminor +#ifdef _MSVCRT_ + extern unsigned int _winminor; +#else +#define _winminor (*_imp___winminor) + extern unsigned int *_imp___winminor; #endif +#endif -#if defined __MSVCRT__ -/* although the _pgmptr is exported as DATA, - * be safe and use the access function __p__pgmptr() to get it. */ -_CRTIMP char** __cdecl __MINGW_NOTHROW __p__pgmptr(void); -#define _pgmptr (*__p__pgmptr()) -_CRTIMP wchar_t** __cdecl __MINGW_NOTHROW __p__wpgmptr(void); -#define _wpgmptr (*__p__wpgmptr()) -#else /* ! __MSVCRT__ */ -# ifndef __DECLSPEC_SUPPORTED - extern char** __imp__pgmptr_dll; -# define _pgmptr (*_imp___pgmptr_dll) -# else /* __DECLSPEC_SUPPORTED */ - __MINGW_IMPORT char* _pgmptr_dll; -# define _pgmptr _pgmptr_dll -# endif /* __DECLSPEC_SUPPORTED */ -/* no wide version in CRTDLL */ -#endif /* __MSVCRT__ */ - -/* - * This variable determines the default file mode. - * TODO: Which flags work? - */ -#if !defined (__DECLSPEC_SUPPORTED) || defined (__IN_MINGW_RUNTIME) - -#ifdef __MSVCRT__ -extern int* _imp___fmode; -#define _fmode (*_imp___fmode) + errno_t __cdecl _get_osplatform(unsigned int *_Value); + errno_t __cdecl _get_osver(unsigned int *_Value); + errno_t __cdecl _get_winver(unsigned int *_Value); + errno_t __cdecl _get_winmajor(unsigned int *_Value); + errno_t __cdecl _get_winminor(unsigned int *_Value); +#ifndef _countof +#ifndef __cplusplus +#define _countof(_Array) (sizeof(_Array) / sizeof(_Array[0])) #else -/* CRTDLL */ -extern int* _imp___fmode_dll; -#define _fmode (*_imp___fmode_dll) + extern "C++" { + template char (*__countof_helper(UNALIGNED _CountofType (&_Array)[_SizeOfArray]))[_SizeOfArray]; +#define _countof(_Array) sizeof(*__countof_helper(_Array)) + } #endif +#endif -#else /* __DECLSPEC_SUPPORTED */ +#ifndef _CRT_TERMINATE_DEFINED +#define _CRT_TERMINATE_DEFINED + __declspec(noreturn) void __cdecl exit(int _Code); + _CRTIMP __declspec(noreturn) void __cdecl _exit(int _Code); +#if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */ + /* C99 function name */ + void __cdecl __declspec(noreturn) _Exit(int); /* Declare to get noreturn attribute. */ + __CRT_INLINE void __cdecl _Exit(int status) + { _exit(status); } +#endif +#if __MINGW_GNUC_PREREQ(4,4) +#pragma push_macro("abort") +#undef abort +#endif + void __cdecl __declspec(noreturn) abort(void); +#if __MINGW_GNUC_PREREQ(4,4) +#pragma pop_macro("abort") +#endif +#endif -#ifdef __MSVCRT__ -__MINGW_IMPORT int _fmode; -#else /* ! __MSVCRT__ */ -__MINGW_IMPORT int _fmode_dll; -#define _fmode _fmode_dll -#endif /* ! __MSVCRT__ */ + _CRTIMP unsigned int __cdecl _set_abort_behavior(unsigned int _Flags,unsigned int _Mask); -#endif /* __DECLSPEC_SUPPORTED */ +#ifndef _CRT_ABS_DEFINED +#define _CRT_ABS_DEFINED + int __cdecl abs(int _X); + long __cdecl labs(long _X); +#endif -#endif /* Not __STRICT_ANSI__ */ - -_CRTIMP double __cdecl __MINGW_NOTHROW atof (const char*); -_CRTIMP int __cdecl __MINGW_NOTHROW atoi (const char*); -_CRTIMP long __cdecl __MINGW_NOTHROW atol (const char*); -#if !defined (__STRICT_ANSI__) -_CRTIMP int __cdecl __MINGW_NOTHROW _wtoi (const wchar_t *); -_CRTIMP long __cdecl __MINGW_NOTHROW _wtol (const wchar_t *); +#if _INTEGRAL_MAX_BITS >= 64 + __int64 __cdecl _abs64(__int64); #endif -_CRTIMP double __cdecl __MINGW_NOTHROW strtod (const char*, char**); -#if !defined __NO_ISOCEXT /* in libmingwex.a */ -float __cdecl __MINGW_NOTHROW strtof (const char * __restrict__, char ** __restrict__); -long double __cdecl __MINGW_NOTHROW strtold (const char * __restrict__, char ** __restrict__); + int __cdecl atexit(void (__cdecl *)(void)); +#ifndef _CRT_ATOF_DEFINED +#define _CRT_ATOF_DEFINED + double __cdecl atof(const char *_String); + double __cdecl _atof_l(const char *_String,_locale_t _Locale); +#endif + int __cdecl atoi(const char *_Str); + _CRTIMP int __cdecl _atoi_l(const char *_Str,_locale_t _Locale); + long __cdecl atol(const char *_Str); + _CRTIMP long __cdecl _atol_l(const char *_Str,_locale_t _Locale); +#ifndef _CRT_ALGO_DEFINED +#define _CRT_ALGO_DEFINED + void *__cdecl bsearch(const void *_Key,const void *_Base,size_t _NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *)); + void __cdecl qsort(void *_Base,size_t _NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *)); +#endif + /*unsigned short __cdecl _byteswap_ushort(unsigned short _Short); */ + /*unsigned long __cdecl _byteswap_ulong (unsigned long _Long); */ +#if _INTEGRAL_MAX_BITS >= 64 + /*unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64 _Int64);*/ +#endif + div_t __cdecl div(int _Numerator,int _Denominator); + char *__cdecl getenv(const char *_VarName); + _CRTIMP char *__cdecl _itoa(int _Value,char *_Dest,int _Radix); +/* #if _INTEGRAL_MAX_BITS >= 64 */ + _CRTIMP char *__cdecl _i64toa(__int64 _Val,char *_DstBuf,int _Radix); + _CRTIMP char *__cdecl _ui64toa(unsigned __int64 _Val,char *_DstBuf,int _Radix); + _CRTIMP __int64 __cdecl _atoi64(const char *_String); + _CRTIMP __int64 __cdecl _atoi64_l(const char *_String,_locale_t _Locale); + _CRTIMP __int64 __cdecl _strtoi64(const char *_String,char **_EndPtr,int _Radix); + _CRTIMP __int64 __cdecl _strtoi64_l(const char *_String,char **_EndPtr,int _Radix,_locale_t _Locale); + _CRTIMP unsigned __int64 __cdecl _strtoui64(const char *_String,char **_EndPtr,int _Radix); + _CRTIMP unsigned __int64 __cdecl _strtoui64_l(const char *_String,char **_EndPtr,int _Radix,_locale_t _Locale); +/* #endif */ + ldiv_t __cdecl ldiv(long _Numerator,long _Denominator); + _CRTIMP char *__cdecl _ltoa(long _Value,char *_Dest,int _Radix); + int __cdecl mblen(const char *_Ch,size_t _MaxCount); + _CRTIMP int __cdecl _mblen_l(const char *_Ch,size_t _MaxCount,_locale_t _Locale); + _CRTIMP size_t __cdecl _mbstrlen(const char *_Str); + _CRTIMP size_t __cdecl _mbstrlen_l(const char *_Str,_locale_t _Locale); + _CRTIMP size_t __cdecl _mbstrnlen(const char *_Str,size_t _MaxCount); + _CRTIMP size_t __cdecl _mbstrnlen_l(const char *_Str,size_t _MaxCount,_locale_t _Locale); + int __cdecl mbtowc(wchar_t *_DstCh,const char *_SrcCh,size_t _SrcSizeInBytes); + _CRTIMP int __cdecl _mbtowc_l(wchar_t *_DstCh,const char *_SrcCh,size_t _SrcSizeInBytes,_locale_t _Locale); + size_t __cdecl mbstowcs(wchar_t *_Dest,const char *_Source,size_t _MaxCount); + _CRTIMP size_t __cdecl _mbstowcs_l(wchar_t *_Dest,const char *_Source,size_t _MaxCount,_locale_t _Locale); + int __cdecl rand(void); + _CRTIMP int __cdecl _set_error_mode(int _Mode); + void __cdecl srand(unsigned int _Seed); + double __cdecl strtod(const char *_Str,char **_EndPtr); + float __cdecl strtof(const char *nptr, char **endptr); +#if !defined __NO_ISOCEXT /* in libmingwex.a */ + float __cdecl strtof (const char * __restrict__, char ** __restrict__); + long double __cdecl strtold(const char * __restrict__, char ** __restrict__); #endif /* __NO_ISOCEXT */ + _CRTIMP double __cdecl _strtod_l(const char *_Str,char **_EndPtr,_locale_t _Locale); + long __cdecl strtol(const char *_Str,char **_EndPtr,int _Radix); + _CRTIMP long __cdecl _strtol_l(const char *_Str,char **_EndPtr,int _Radix,_locale_t _Locale); + unsigned long __cdecl strtoul(const char *_Str,char **_EndPtr,int _Radix); + _CRTIMP unsigned long __cdecl _strtoul_l(const char *_Str,char **_EndPtr,int _Radix,_locale_t _Locale); +#ifndef _CRT_SYSTEM_DEFINED +#define _CRT_SYSTEM_DEFINED + int __cdecl system(const char *_Command); +#endif + _CRTIMP char *__cdecl _ultoa(unsigned long _Value,char *_Dest,int _Radix); + int __cdecl wctomb(char *_MbCh,wchar_t _WCh); + _CRTIMP int __cdecl _wctomb_l(char *_MbCh,wchar_t _WCh,_locale_t _Locale); + size_t __cdecl wcstombs(char *_Dest,const wchar_t *_Source,size_t _MaxCount); + _CRTIMP size_t __cdecl _wcstombs_l(char *_Dest,const wchar_t *_Source,size_t _MaxCount,_locale_t _Locale); -_CRTIMP long __cdecl __MINGW_NOTHROW strtol (const char*, char**, int); -_CRTIMP unsigned long __cdecl __MINGW_NOTHROW strtoul (const char*, char**, int); +#ifndef _CRT_ALLOCATION_DEFINED +#define _CRT_ALLOCATION_DEFINED + void *__cdecl calloc(size_t _NumOfElements,size_t _SizeOfElements); + void __cdecl free(void *_Memory); + void *__cdecl malloc(size_t _Size); + void *__cdecl realloc(void *_Memory,size_t _NewSize); + _CRTIMP void *__cdecl _recalloc(void *_Memory,size_t _Count,size_t _Size); + //_CRTIMP void __cdecl _aligned_free(void *_Memory); + //_CRTIMP void *__cdecl _aligned_malloc(size_t _Size,size_t _Alignment); + _CRTIMP void *__cdecl _aligned_offset_malloc(size_t _Size,size_t _Alignment,size_t _Offset); + _CRTIMP void *__cdecl _aligned_realloc(void *_Memory,size_t _Size,size_t _Alignment); + _CRTIMP void *__cdecl _aligned_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment); + _CRTIMP void *__cdecl _aligned_offset_realloc(void *_Memory,size_t _Size,size_t _Alignment,size_t _Offset); + _CRTIMP void *__cdecl _aligned_offset_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment,size_t _Offset); +#endif #ifndef _WSTDLIB_DEFINED -/* also declared in wchar.h */ -_CRTIMP long __cdecl __MINGW_NOTHROW wcstol (const wchar_t*, wchar_t**, int); -_CRTIMP unsigned long __cdecl __MINGW_NOTHROW wcstoul (const wchar_t*, wchar_t**, int); -_CRTIMP double __cdecl __MINGW_NOTHROW wcstod (const wchar_t*, wchar_t**); -#if !defined __NO_ISOCEXT /* in libmingwex.a */ -float __cdecl __MINGW_NOTHROW wcstof( const wchar_t * __restrict__, wchar_t ** __restrict__); -long double __cdecl __MINGW_NOTHROW wcstold (const wchar_t * __restrict__, wchar_t ** __restrict__); +#define _WSTDLIB_DEFINED + + _CRTIMP wchar_t *__cdecl _itow(int _Value,wchar_t *_Dest,int _Radix); + _CRTIMP wchar_t *__cdecl _ltow(long _Value,wchar_t *_Dest,int _Radix); + _CRTIMP wchar_t *__cdecl _ultow(unsigned long _Value,wchar_t *_Dest,int _Radix); + double __cdecl wcstod(const wchar_t *_Str,wchar_t **_EndPtr); + float __cdecl wcstof(const wchar_t *nptr, wchar_t **endptr); +#if !defined __NO_ISOCEXT /* in libmingwex.a */ + float __cdecl wcstof( const wchar_t * __restrict__, wchar_t ** __restrict__); + long double __cdecl wcstold(const wchar_t * __restrict__, wchar_t ** __restrict__); #endif /* __NO_ISOCEXT */ -#ifdef __MSVCRT__ -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wgetenv(const wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wputenv(const wchar_t*); -_CRTIMP void __cdecl __MINGW_NOTHROW _wsearchenv(const wchar_t*, const wchar_t*, wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wsystem(const wchar_t*); -_CRTIMP void __cdecl __MINGW_NOTHROW _wmakepath(wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*); -_CRTIMP void __cdecl __MINGW_NOTHROW _wsplitpath (const wchar_t*, wchar_t*, wchar_t*, wchar_t*, wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wfullpath (wchar_t*, const wchar_t*, size_t); + _CRTIMP double __cdecl _wcstod_l(const wchar_t *_Str,wchar_t **_EndPtr,_locale_t _Locale); + long __cdecl wcstol(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); + _CRTIMP long __cdecl _wcstol_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); + unsigned long __cdecl wcstoul(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); + _CRTIMP unsigned long __cdecl _wcstoul_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); + _CRTIMP wchar_t *__cdecl _wgetenv(const wchar_t *_VarName); +#ifndef _CRT_WSYSTEM_DEFINED +#define _CRT_WSYSTEM_DEFINED + _CRTIMP int __cdecl _wsystem(const wchar_t *_Command); #endif -#define _WSTDLIB_DEFINED + _CRTIMP double __cdecl _wtof(const wchar_t *_Str); + _CRTIMP double __cdecl _wtof_l(const wchar_t *_Str,_locale_t _Locale); + _CRTIMP int __cdecl _wtoi(const wchar_t *_Str); + _CRTIMP int __cdecl _wtoi_l(const wchar_t *_Str,_locale_t _Locale); + _CRTIMP long __cdecl _wtol(const wchar_t *_Str); + _CRTIMP long __cdecl _wtol_l(const wchar_t *_Str,_locale_t _Locale); + +/* #if _INTEGRAL_MAX_BITS >= 64 */ + _CRTIMP wchar_t *__cdecl _i64tow(__int64 _Val,wchar_t *_DstBuf,int _Radix); + _CRTIMP wchar_t *__cdecl _ui64tow(unsigned __int64 _Val,wchar_t *_DstBuf,int _Radix); + _CRTIMP __int64 __cdecl _wtoi64(const wchar_t *_Str); + _CRTIMP __int64 __cdecl _wtoi64_l(const wchar_t *_Str,_locale_t _Locale); + _CRTIMP __int64 __cdecl _wcstoi64(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); + _CRTIMP __int64 __cdecl _wcstoi64_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); + _CRTIMP unsigned __int64 __cdecl _wcstoui64(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); + _CRTIMP unsigned __int64 __cdecl _wcstoui64_l(const wchar_t *_Str ,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); +/* #endif */ #endif -_CRTIMP size_t __cdecl __MINGW_NOTHROW wcstombs (char*, const wchar_t*, size_t); -_CRTIMP int __cdecl __MINGW_NOTHROW wctomb (char*, wchar_t); +#ifndef _POSIX_ +#define _CVTBUFSIZE (309+40) + _CRTIMP char *__cdecl _fullpath(char *_FullPath,const char *_Path,size_t _SizeInBytes); + _CRTIMP char *__cdecl _ecvt(double _Val,int _NumOfDigits,int *_PtDec,int *_PtSign); + _CRTIMP char *__cdecl _fcvt(double _Val,int _NumOfDec,int *_PtDec,int *_PtSign); + _CRTIMP char *__cdecl _gcvt(double _Val,int _NumOfDigits,char *_DstBuf); + _CRTIMP int __cdecl _atodbl(_CRT_DOUBLE *_Result,char *_Str); + _CRTIMP int __cdecl _atoldbl(_LDOUBLE *_Result,char *_Str); + _CRTIMP int __cdecl _atoflt(_CRT_FLOAT *_Result,char *_Str); + _CRTIMP int __cdecl _atodbl_l(_CRT_DOUBLE *_Result,char *_Str,_locale_t _Locale); + _CRTIMP int __cdecl _atoldbl_l(_LDOUBLE *_Result,char *_Str,_locale_t _Locale); + _CRTIMP int __cdecl _atoflt_l(_CRT_FLOAT *_Result,char *_Str,_locale_t _Locale); + _CRTIMP unsigned long __cdecl __MINGW_NOTHROW _lrotl(unsigned long, int) __MINGW_ATTRIB_CONST; + _CRTIMP unsigned long __cdecl __MINGW_NOTHROW _lrotr(unsigned long, int) __MINGW_ATTRIB_CONST; + _CRTIMP void __cdecl _makepath(char *_Path,const char *_Drive,const char *_Dir,const char *_Filename,const char *_Ext); + _onexit_t __cdecl _onexit(_onexit_t _Func); -_CRTIMP int __cdecl __MINGW_NOTHROW mblen (const char*, size_t); -_CRTIMP size_t __cdecl __MINGW_NOTHROW mbstowcs (wchar_t*, const char*, size_t); -_CRTIMP int __cdecl __MINGW_NOTHROW mbtowc (wchar_t*, const char*, size_t); +#ifndef _CRT_PERROR_DEFINED +#define _CRT_PERROR_DEFINED + void __cdecl perror(const char *_ErrMsg); +#endif + _CRTIMP int __cdecl _putenv(const char *_EnvString); + //_CRTIMP unsigned int __cdecl _rotl(unsigned int, int) __MINGW_ATTRIB_CONST; +#if _INTEGRAL_MAX_BITS >= 64 + //_CRTIMP unsigned __int64 __cdecl _rotl64(unsigned __int64, int) __MINGW_ATTRIB_CONST; +#endif + //_CRTIMP unsigned int __cdecl _rotr(unsigned int, int) __MINGW_ATTRIB_CONST; +#if _INTEGRAL_MAX_BITS >= 64 + //_CRTIMP unsigned __int64 __cdecl _rotr64(unsigned __int64, int) __MINGW_ATTRIB_CONST; +#endif + _CRTIMP void __cdecl _searchenv(const char *_Filename,const char *_EnvVar,char *_ResultPath); + _CRTIMP void __cdecl _splitpath(const char *_FullPath,char *_Drive,char *_Dir,char *_Filename,char *_Ext); + _CRTIMP void __cdecl _swab(char *_Buf1,char *_Buf2,int _SizeInBytes); -_CRTIMP int __cdecl __MINGW_NOTHROW rand (void); -_CRTIMP void __cdecl __MINGW_NOTHROW srand (unsigned int); +#ifndef _WSTDLIBP_DEFINED +#define _WSTDLIBP_DEFINED + _CRTIMP wchar_t *__cdecl _wfullpath(wchar_t *_FullPath,const wchar_t *_Path,size_t _SizeInWords); + _CRTIMP void __cdecl _wmakepath(wchar_t *_ResultPath,const wchar_t *_Drive,const wchar_t *_Dir,const wchar_t *_Filename,const wchar_t *_Ext); +#ifndef _CRT_WPERROR_DEFINED +#define _CRT_WPERROR_DEFINED + _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg); +#endif + _CRTIMP int __cdecl _wputenv(const wchar_t *_EnvString); + _CRTIMP void __cdecl _wsearchenv(const wchar_t *_Filename,const wchar_t *_EnvVar,wchar_t *_ResultPath); + _CRTIMP void __cdecl _wsplitpath(const wchar_t *_FullPath,wchar_t *_Drive,wchar_t *_Dir,wchar_t *_Filename,wchar_t *_Ext); +#endif -_CRTIMP void* __cdecl __MINGW_NOTHROW calloc (size_t, size_t) __MINGW_ATTRIB_MALLOC; -_CRTIMP void* __cdecl __MINGW_NOTHROW malloc (size_t) __MINGW_ATTRIB_MALLOC; -_CRTIMP void* __cdecl __MINGW_NOTHROW realloc (void*, size_t); -_CRTIMP void __cdecl __MINGW_NOTHROW free (void*); -_CRTIMP void __cdecl __MINGW_NOTHROW abort (void) __MINGW_ATTRIB_NORETURN; -_CRTIMP void __cdecl __MINGW_NOTHROW exit (int) __MINGW_ATTRIB_NORETURN; + _CRTIMP void __cdecl _beep(unsigned _Frequency,unsigned _Duration) __MINGW_ATTRIB_DEPRECATED; + /* Not to be confused with _set_error_mode (int). */ + _CRTIMP void __cdecl _seterrormode(int _Mode) __MINGW_ATTRIB_DEPRECATED; + _CRTIMP void __cdecl _sleep(unsigned long _Duration) __MINGW_ATTRIB_DEPRECATED; +#endif -/* Note: This is in startup code, not imported directly from dll */ -int __cdecl __MINGW_NOTHROW atexit (void (*)(void)); +#ifndef NO_OLDNAMES +#ifndef _POSIX_ +#if 0 +#ifndef __cplusplus +#ifndef NOMINMAX +#ifndef max +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif +#ifndef min +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif +#endif +#endif +#endif -_CRTIMP int __cdecl __MINGW_NOTHROW system (const char*); -_CRTIMP char* __cdecl __MINGW_NOTHROW getenv (const char*); - -/* bsearch and qsort are also in non-ANSI header search.h */ -_CRTIMP void* __cdecl bsearch (const void*, const void*, size_t, size_t, - int (*)(const void*, const void*)); -_CRTIMP void __cdecl qsort(void*, size_t, size_t, - int (*)(const void*, const void*)); - -_CRTIMP int __cdecl __MINGW_NOTHROW abs (int) __MINGW_ATTRIB_CONST; -_CRTIMP long __cdecl __MINGW_NOTHROW labs (long) __MINGW_ATTRIB_CONST; - -/* - * div_t and ldiv_t are structures used to return the results of div and - * ldiv. - * - * NOTE: div and ldiv appear not to work correctly unless - * -fno-pcc-struct-return is specified. This is included in the - * mingw32 specs file. - */ -typedef struct { int quot, rem; } div_t; -typedef struct { long quot, rem; } ldiv_t; - -_CRTIMP div_t __cdecl __MINGW_NOTHROW div (int, int) __MINGW_ATTRIB_CONST; -_CRTIMP ldiv_t __cdecl __MINGW_NOTHROW ldiv (long, long) __MINGW_ATTRIB_CONST; - -#if !defined (__STRICT_ANSI__) - -/* - * NOTE: Officially the three following functions are obsolete. The Win32 API - * functions SetErrorMode, Beep and Sleep are their replacements. - */ -_CRTIMP void __cdecl __MINGW_NOTHROW _beep (unsigned int, unsigned int) __MINGW_ATTRIB_DEPRECATED; -/* Not to be confused with _set_error_mode (int). */ -_CRTIMP void __cdecl __MINGW_NOTHROW _seterrormode (int) __MINGW_ATTRIB_DEPRECATED; -_CRTIMP void __cdecl __MINGW_NOTHROW _sleep (unsigned long) __MINGW_ATTRIB_DEPRECATED; - -_CRTIMP void __cdecl __MINGW_NOTHROW _exit (int) __MINGW_ATTRIB_NORETURN; - -/* _onexit is MS extension. Use atexit for portability. */ -/* Note: This is in startup code, not imported directly from dll */ -typedef int (* _onexit_t)(void); -_onexit_t __cdecl __MINGW_NOTHROW _onexit( _onexit_t ); - -_CRTIMP int __cdecl __MINGW_NOTHROW _putenv (const char*); -_CRTIMP void __cdecl __MINGW_NOTHROW _searchenv (const char*, const char*, char*); - - -_CRTIMP char* __cdecl __MINGW_NOTHROW _ecvt (double, int, int*, int*); -_CRTIMP char* __cdecl __MINGW_NOTHROW _fcvt (double, int, int*, int*); -_CRTIMP char* __cdecl __MINGW_NOTHROW _gcvt (double, int, char*); - -_CRTIMP void __cdecl __MINGW_NOTHROW _makepath (char*, const char*, const char*, const char*, const char*); -_CRTIMP void __cdecl __MINGW_NOTHROW _splitpath (const char*, char*, char*, char*, char*); -_CRTIMP char* __cdecl __MINGW_NOTHROW _fullpath (char*, const char*, size_t); - -_CRTIMP char* __cdecl __MINGW_NOTHROW _itoa (int, char*, int); -_CRTIMP char* __cdecl __MINGW_NOTHROW _ltoa (long, char*, int); -_CRTIMP char* __cdecl __MINGW_NOTHROW _ultoa(unsigned long, char*, int); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _itow (int, wchar_t*, int); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _ltow (long, wchar_t*, int); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _ultow (unsigned long, wchar_t*, int); - -_CRTIMP __int64 __cdecl __MINGW_NOTHROW _atoi64(const char *); - -#ifdef __MSVCRT__ -_CRTIMP char* __cdecl __MINGW_NOTHROW _i64toa(__int64, char *, int); -_CRTIMP char* __cdecl __MINGW_NOTHROW _ui64toa(unsigned __int64, char *, int); -_CRTIMP __int64 __cdecl __MINGW_NOTHROW _wtoi64(const wchar_t *); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _i64tow(__int64, wchar_t *, int); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _ui64tow(unsigned __int64, wchar_t *, int); - - -_CRTIMP unsigned int __cdecl __MINGW_NOTHROW _rotl(unsigned int, int) __MINGW_ATTRIB_CONST; -_CRTIMP unsigned int __cdecl __MINGW_NOTHROW _rotr(unsigned int, int) __MINGW_ATTRIB_CONST; -_CRTIMP unsigned long __cdecl __MINGW_NOTHROW _lrotl(unsigned long, int) __MINGW_ATTRIB_CONST; -_CRTIMP unsigned long __cdecl __MINGW_NOTHROW _lrotr(unsigned long, int) __MINGW_ATTRIB_CONST; - -_CRTIMP int __cdecl __MINGW_NOTHROW _set_error_mode (int); -#define _OUT_TO_DEFAULT 0 -#define _OUT_TO_STDERR 1 -#define _OUT_TO_MSGBOX 2 -#define _REPORT_ERRMODE 3 - -#if __MSVCRT_VERSION__ >= 0x800 -#ifndef _INTPTR_T_DEFINED -#define _INTPTR_T_DEFINED -#ifdef _WIN64 - typedef __int64 intptr_t; -#else - typedef int intptr_t; +#define sys_errlist (*_imp___sys_errlist) +#define sys_nerr (*_imp___sys_nerr) +#define environ _environ + char *__cdecl ecvt(double _Val,int _NumOfDigits,int *_PtDec,int *_PtSign); + char *__cdecl fcvt(double _Val,int _NumOfDec,int *_PtDec,int *_PtSign); + char *__cdecl gcvt(double _Val,int _NumOfDigits,char *_DstBuf); + char *__cdecl itoa(int _Val,char *_DstBuf,int _Radix); + char *__cdecl ltoa(long _Val,char *_DstBuf,int _Radix); + int __cdecl putenv(const char *_EnvString); + void __cdecl swab(char *_Buf1,char *_Buf2,int _SizeInBytes); + char *__cdecl ultoa(unsigned long _Val,char *_Dstbuf,int _Radix); + onexit_t __cdecl onexit(onexit_t _Func); #endif #endif -_CRTIMP unsigned int __cdecl __MINGW_NOTHROW _set_abort_behavior (unsigned int, unsigned int); -/* These masks work with msvcr80.dll version 8.0.50215.44 (a beta release). */ -#define _WRITE_ABORT_MSG 1 -#define _CALL_REPORTFAULT 2 -typedef void (* _invalid_parameter_handler) (const wchar_t *, - const wchar_t *, - const wchar_t *, - unsigned int, - uintptr_t); -_invalid_parameter_handler _set_invalid_parameter_handler (_invalid_parameter_handler); -#endif /* __MSVCRT_VERSION__ >= 0x800 */ -#endif /* __MSVCRT__ */ - -#ifndef _NO_OLDNAMES - -_CRTIMP int __cdecl __MINGW_NOTHROW putenv (const char*); -_CRTIMP void __cdecl __MINGW_NOTHROW searchenv (const char*, const char*, char*); - -_CRTIMP char* __cdecl __MINGW_NOTHROW itoa (int, char*, int); -_CRTIMP char* __cdecl __MINGW_NOTHROW ltoa (long, char*, int); - -#ifndef _UWIN -_CRTIMP char* __cdecl __MINGW_NOTHROW ecvt (double, int, int*, int*); -_CRTIMP char* __cdecl __MINGW_NOTHROW fcvt (double, int, int*, int*); -_CRTIMP char* __cdecl __MINGW_NOTHROW gcvt (double, int, char*); -#endif /* _UWIN */ -#endif /* Not _NO_OLDNAMES */ - -#endif /* Not __STRICT_ANSI__ */ - -/* C99 names */ - #if !defined __NO_ISOCEXT /* externs in static libmingwex.a */ -/* C99 name for _exit */ -void __cdecl __MINGW_NOTHROW _Exit(int) __MINGW_ATTRIB_NORETURN; -#ifndef __STRICT_ANSI__ /* inline using non-ansi functions */ -__CRT_INLINE void __cdecl __MINGW_NOTHROW _Exit(int __status) - { _exit (__status); } -#endif + typedef struct { long long quot, rem; } lldiv_t; -typedef struct { long long quot, rem; } lldiv_t; + lldiv_t __cdecl lldiv(long long, long long); -lldiv_t __cdecl __MINGW_NOTHROW lldiv (long long, long long) __MINGW_ATTRIB_CONST; + __CRT_INLINE long long __cdecl llabs(long long _j) { return (_j >= 0 ? _j : -_j); } -long long __cdecl __MINGW_NOTHROW llabs(long long); -__CRT_INLINE long long __cdecl __MINGW_NOTHROW llabs(long long _j) - {return (_j >= 0 ? _j : -_j);} + long long __cdecl strtoll(const char* __restrict__, char** __restrict, int); + unsigned long long __cdecl strtoull(const char* __restrict__, char** __restrict__, int); -long long __cdecl __MINGW_NOTHROW strtoll (const char* __restrict__, char** __restrict, int); -unsigned long long __cdecl __MINGW_NOTHROW strtoull (const char* __restrict__, char** __restrict__, int); + /* these are stubs for MS _i64 versions */ + long long __cdecl atoll (const char *); -#if defined (__MSVCRT__) /* these are stubs for MS _i64 versions */ -long long __cdecl __MINGW_NOTHROW atoll (const char *); - -#if !defined (__STRICT_ANSI__) -long long __cdecl __MINGW_NOTHROW wtoll (const wchar_t *); -char* __cdecl __MINGW_NOTHROW lltoa (long long, char *, int); -char* __cdecl __MINGW_NOTHROW ulltoa (unsigned long long , char *, int); -wchar_t* __cdecl __MINGW_NOTHROW lltow (long long, wchar_t *, int); -wchar_t* __cdecl __MINGW_NOTHROW ulltow (unsigned long long, wchar_t *, int); - - /* inline using non-ansi functions */ -__CRT_INLINE long long __cdecl __MINGW_NOTHROW atoll (const char * _c) - { return _atoi64 (_c); } -__CRT_INLINE char* __cdecl __MINGW_NOTHROW lltoa (long long _n, char * _c, int _i) - { return _i64toa (_n, _c, _i); } -__CRT_INLINE char* __cdecl __MINGW_NOTHROW ulltoa (unsigned long long _n, char * _c, int _i) - { return _ui64toa (_n, _c, _i); } -__CRT_INLINE long long __cdecl __MINGW_NOTHROW wtoll (const wchar_t * _w) - { return _wtoi64 (_w); } -__CRT_INLINE wchar_t* __cdecl __MINGW_NOTHROW lltow (long long _n, wchar_t * _w, int _i) - { return _i64tow (_n, _w, _i); } -__CRT_INLINE wchar_t* __cdecl __MINGW_NOTHROW ulltow (unsigned long long _n, wchar_t * _w, int _i) - { return _ui64tow (_n, _w, _i); } +#ifndef __STRICT_ANSI__ + long long __cdecl wtoll (const wchar_t *); + char *__cdecl lltoa (long long, char *, int); + char *__cdecl ulltoa (unsigned long long , char *, int); + wchar_t *__cdecl lltow (long long, wchar_t *, int); + wchar_t *__cdecl ulltow (unsigned long long, wchar_t *, int); +#if _INTEGRAL_MAX_BITS >= 64 + /* __CRT_INLINE using non-ansi functions */ + __CRT_INLINE long long __cdecl atoll (const char * _c) { return _atoi64 (_c); } + __CRT_INLINE char *__cdecl lltoa (long long _n, char * _c, int _i) { return _i64toa (_n, _c, _i); } + __CRT_INLINE char *__cdecl ulltoa (unsigned long long _n, char * _c, int _i) { return _ui64toa (_n, _c, _i); } + __CRT_INLINE long long __cdecl wtoll (const wchar_t * _w) { return _wtoi64 (_w); } + __CRT_INLINE wchar_t *__cdecl lltow (long long _n, wchar_t * _w, int _i) { return _i64tow (_n, _w, _i); } + __CRT_INLINE wchar_t *__cdecl ulltow (unsigned long long _n, wchar_t * _w, int _i) { return _ui64tow (_n, _w, _i); } #endif /* (__STRICT_ANSI__) */ - -#endif /* __MSVCRT__ */ - +#endif #endif /* !__NO_ISOCEXT */ - #ifdef __cplusplus } #endif -#endif /* Not RC_INVOKED */ +#pragma pack(pop) -#endif /* Not _STDLIB_H_ */ +#include +#include - +#endif Index: include/crt/string.h =================================================================== --- include/crt/string.h (Revision 37928) +++ include/crt/string.h (Arbeitskopie) @@ -1,195 +1,169 @@ -/* - * string.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Definitions for memory and string functions. - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ +#ifndef _INC_STRING +#define _INC_STRING -#ifndef _STRING_H_ -#define _STRING_H_ - -/* All the headers include this file. */ #include <_mingw.h> -/* - * Define size_t, wchar_t and NULL - */ -#define __need_size_t -#define __need_wchar_t -#define __need_NULL -#ifndef RC_INVOKED -#include -#endif /* Not RC_INVOKED */ - -#ifndef RC_INVOKED - #ifdef __cplusplus extern "C" { #endif -/* - * Prototypes of the ANSI Standard C library string functions. - */ -_CRTIMP void* __cdecl __MINGW_NOTHROW memchr (const void*, int, size_t) __MINGW_ATTRIB_PURE; -_CRTIMP int __cdecl __MINGW_NOTHROW memcmp (const void*, const void*, size_t) __MINGW_ATTRIB_PURE; -_CRTIMP void* __cdecl __MINGW_NOTHROW memcpy (void*, const void*, size_t); -_CRTIMP void* __cdecl __MINGW_NOTHROW memmove (void*, const void*, size_t); -_CRTIMP void* __cdecl __MINGW_NOTHROW memset (void*, int, size_t); -_CRTIMP char* __cdecl __MINGW_NOTHROW strcat (char*, const char*); -_CRTIMP char* __cdecl __MINGW_NOTHROW strchr (const char*, int) __MINGW_ATTRIB_PURE; -_CRTIMP int __cdecl __MINGW_NOTHROW strcmp (const char*, const char*) __MINGW_ATTRIB_PURE; -_CRTIMP int __cdecl __MINGW_NOTHROW strcoll (const char*, const char*); /* Compare using locale */ -_CRTIMP char* __cdecl __MINGW_NOTHROW strcpy (char*, const char*); -_CRTIMP size_t __cdecl __MINGW_NOTHROW strcspn (const char*, const char*) __MINGW_ATTRIB_PURE; -_CRTIMP char* __cdecl __MINGW_NOTHROW strerror (int); /* NOTE: NOT an old name wrapper. */ +#ifndef _NLSCMP_DEFINED +#define _NLSCMP_DEFINED +#define _NLSCMPERROR 2147483647 +#endif -_CRTIMP size_t __cdecl __MINGW_NOTHROW strlen (const char*) __MINGW_ATTRIB_PURE; -_CRTIMP char* __cdecl __MINGW_NOTHROW strncat (char*, const char*, size_t); -_CRTIMP int __cdecl __MINGW_NOTHROW strncmp (const char*, const char*, size_t) __MINGW_ATTRIB_PURE; -_CRTIMP char* __cdecl __MINGW_NOTHROW strncpy (char*, const char*, size_t); -_CRTIMP char* __cdecl __MINGW_NOTHROW strpbrk (const char*, const char*) __MINGW_ATTRIB_PURE; -_CRTIMP char* __cdecl __MINGW_NOTHROW strrchr (const char*, int) __MINGW_ATTRIB_PURE; -_CRTIMP size_t __cdecl __MINGW_NOTHROW strspn (const char*, const char*) __MINGW_ATTRIB_PURE; -_CRTIMP char* __cdecl __MINGW_NOTHROW strstr (const char*, const char*) __MINGW_ATTRIB_PURE; -_CRTIMP char* __cdecl __MINGW_NOTHROW strtok (char*, const char*); -_CRTIMP size_t __cdecl __MINGW_NOTHROW strxfrm (char*, const char*, size_t); +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif -#ifndef __STRICT_ANSI__ -/* - * Extra non-ANSI functions provided by the CRTDLL library - */ -_CRTIMP char* __cdecl __MINGW_NOTHROW _strerror (const char *); -_CRTIMP void* __cdecl __MINGW_NOTHROW _memccpy (void*, const void*, int, size_t); -_CRTIMP int __cdecl __MINGW_NOTHROW _memicmp (const void*, const void*, size_t); -_CRTIMP char* __cdecl __MINGW_NOTHROW _strdup (const char*) __MINGW_ATTRIB_MALLOC; -_CRTIMP int __cdecl __MINGW_NOTHROW _strcmpi (const char*, const char*); -_CRTIMP int __cdecl __MINGW_NOTHROW _stricmp (const char*, const char*); -_CRTIMP int __cdecl __MINGW_NOTHROW _stricoll (const char*, const char*); -_CRTIMP char* __cdecl __MINGW_NOTHROW _strlwr (char*); -_CRTIMP int __cdecl __MINGW_NOTHROW _strnicmp (const char*, const char*, size_t); -_CRTIMP char* __cdecl __MINGW_NOTHROW _strnset (char*, int, size_t); -_CRTIMP char* __cdecl __MINGW_NOTHROW _strrev (char*); -_CRTIMP char* __cdecl __MINGW_NOTHROW _strset (char*, int); -_CRTIMP char* __cdecl __MINGW_NOTHROW _strupr (char*); -_CRTIMP void __cdecl __MINGW_NOTHROW _swab (const char*, char*, size_t); +#define _WConst_return _CONST_RETURN -#ifdef __MSVCRT__ -_CRTIMP int __cdecl __MINGW_NOTHROW _strncoll(const char*, const char*, size_t); -_CRTIMP int __cdecl __MINGW_NOTHROW _strnicoll(const char*, const char*, size_t); +#ifndef _CRT_MEMORY_DEFINED +#define _CRT_MEMORY_DEFINED + _CRTIMP void *__cdecl _memccpy(void *_Dst,const void *_Src,int _Val,size_t _MaxCount); + _CONST_RETURN void *__cdecl memchr(const void *_Buf ,int _Val,size_t _MaxCount); + _CRTIMP int __cdecl _memicmp(const void *_Buf1,const void *_Buf2,size_t _Size); + _CRTIMP int __cdecl _memicmp_l(const void *_Buf1,const void *_Buf2,size_t _Size,_locale_t _Locale); + int __cdecl memcmp(const void *_Buf1,const void *_Buf2,size_t _Size); + void *__cdecl memcpy(void *_Dst,const void *_Src,size_t _Size); + void *__cdecl memset(void *_Dst,int _Val,size_t _Size); +#ifndef NO_OLDNAMES + void *__cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size); + int __cdecl memicmp(const void *_Buf1,const void *_Buf2,size_t _Size); #endif +#endif + char *__cdecl _strset(char *_Str,int _Val); + char *__cdecl strcpy(char *_Dest,const char *_Source); + char *__cdecl strcat(char *_Dest,const char *_Source); + int __cdecl strcmp(const char *_Str1,const char *_Str2); + size_t __cdecl strlen(const char *_Str); +#if 0 + size_t __cdecl strnlen(const char *_Str,size_t _MaxCount); +#endif + void *__cdecl memmove(void *_Dst,const void *_Src,size_t _Size); + _CRTIMP char *__cdecl _strdup(const char *_Src); + _CONST_RETURN char *__cdecl strchr(const char *_Str,int _Val); + _CRTIMP int __cdecl _stricmp(const char *_Str1,const char *_Str2); + _CRTIMP int __cdecl _strcmpi(const char *_Str1,const char *_Str2); + _CRTIMP int __cdecl _stricmp_l(const char *_Str1,const char *_Str2,_locale_t _Locale); + int __cdecl strcoll(const char *_Str1,const char *_Str2); + _CRTIMP int __cdecl _strcoll_l(const char *_Str1,const char *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _stricoll(const char *_Str1,const char *_Str2); + _CRTIMP int __cdecl _stricoll_l(const char *_Str1,const char *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _strncoll (const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _strncoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _strnicoll (const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _strnicoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + size_t __cdecl strcspn(const char *_Str,const char *_Control); + _CRTIMP char *__cdecl _strerror(const char *_ErrMsg); + char *__cdecl strerror(int); + _CRTIMP char *__cdecl _strlwr(char *_String); + char *strlwr_l(char *_String,_locale_t _Locale); + char *__cdecl strncat(char *_Dest,const char *_Source,size_t _Count); + int __cdecl strncmp(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _strnicmp(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _strnicmp_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + char *strncpy(char *_Dest,const char *_Source,size_t _Count); + _CRTIMP char *__cdecl _strnset(char *_Str,int _Val,size_t _MaxCount); + _CONST_RETURN char *__cdecl strpbrk(const char *_Str,const char *_Control); + _CONST_RETURN char *__cdecl strrchr(const char *_Str,int _Ch); + _CRTIMP char *__cdecl _strrev(char *_Str); + size_t __cdecl strspn(const char *_Str,const char *_Control); + _CONST_RETURN char *__cdecl strstr(const char *_Str,const char *_SubStr); + char *__cdecl strtok(char *_Str,const char *_Delim); + _CRTIMP char *__cdecl _strupr(char *_String); + _CRTIMP char *_strupr_l(char *_String,_locale_t _Locale); + size_t __cdecl strxfrm(char *_Dst,const char *_Src,size_t _MaxCount); + _CRTIMP size_t __cdecl _strxfrm_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale); -#ifndef _NO_OLDNAMES -/* - * Non-underscored versions of non-ANSI functions. They live in liboldnames.a - * and provide a little extra portability. Also a few extra UNIX-isms like - * strcasecmp. - */ -_CRTIMP void* __cdecl __MINGW_NOTHROW memccpy (void*, const void*, int, size_t); -_CRTIMP int __cdecl __MINGW_NOTHROW memicmp (const void*, const void*, size_t); -_CRTIMP char* __cdecl __MINGW_NOTHROW strdup (const char*) __MINGW_ATTRIB_MALLOC; -_CRTIMP int __cdecl __MINGW_NOTHROW strcmpi (const char*, const char*); -_CRTIMP int __cdecl __MINGW_NOTHROW stricmp (const char*, const char*); -__CRT_INLINE int __cdecl __MINGW_NOTHROW strcasecmp (const char*, const char *); -__CRT_INLINE int __cdecl __MINGW_NOTHROW -strcasecmp (const char * __sz1, const char * __sz2) - {return _stricmp (__sz1, __sz2);} -_CRTIMP int __cdecl __MINGW_NOTHROW stricoll (const char*, const char*); -_CRTIMP char* __cdecl __MINGW_NOTHROW strlwr (char*); -_CRTIMP int __cdecl __MINGW_NOTHROW strnicmp (const char*, const char*, size_t); -__CRT_INLINE int __cdecl __MINGW_NOTHROW strncasecmp (const char *, const char *, size_t); -__CRT_INLINE int __cdecl __MINGW_NOTHROW -strncasecmp (const char * __sz1, const char * __sz2, size_t __sizeMaxCompare) - {return _strnicmp (__sz1, __sz2, __sizeMaxCompare);} -_CRTIMP char* __cdecl __MINGW_NOTHROW strnset (char*, int, size_t); -_CRTIMP char* __cdecl __MINGW_NOTHROW strrev (char*); -_CRTIMP char* __cdecl __MINGW_NOTHROW strset (char*, int); -_CRTIMP char* __cdecl __MINGW_NOTHROW strupr (char*); -#ifndef _UWIN -_CRTIMP void __cdecl __MINGW_NOTHROW swab (const char*, char*, size_t); -#endif /* _UWIN */ -#endif /* _NO_OLDNAMES */ +#ifndef NO_OLDNAMES + char *__cdecl strdup(const char *_Src); + int __cdecl strcmpi(const char *_Str1,const char *_Str2); + int __cdecl stricmp(const char *_Str1,const char *_Str2); + char *__cdecl strlwr(char *_Str); + int __cdecl strnicmp(const char *_Str1,const char *_Str,size_t _MaxCount); + __CRT_INLINE int __cdecl strncasecmp (const char *__sz1, const char *__sz2, size_t __sizeMaxCompare) { return _strnicmp (__sz1, __sz2, __sizeMaxCompare); } + __CRT_INLINE int __cdecl strcasecmp (const char *__sz1, const char *__sz2) { return _stricmp (__sz1, __sz2); } + char *__cdecl strnset(char *_Str,int _Val,size_t _MaxCount); + char *__cdecl strrev(char *_Str); + char *__cdecl strset(char *_Str,int _Val); + char *__cdecl strupr(char *_Str); +#endif -#endif /* Not __STRICT_ANSI__ */ - #ifndef _WSTRING_DEFINED -/* - * Unicode versions of the standard calls. - * Also in wchar.h, where they belong according to ISO standard. - */ -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcscat (wchar_t*, const wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcschr (const wchar_t*, wchar_t); -_CRTIMP int __cdecl __MINGW_NOTHROW wcscmp (const wchar_t*, const wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW wcscoll (const wchar_t*, const wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcscpy (wchar_t*, const wchar_t*); -_CRTIMP size_t __cdecl __MINGW_NOTHROW wcscspn (const wchar_t*, const wchar_t*); -/* Note: _wcserror requires __MSVCRT_VERSION__ >= 0x0700. */ -_CRTIMP size_t __cdecl __MINGW_NOTHROW wcslen (const wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsncat (wchar_t*, const wchar_t*, size_t); -_CRTIMP int __cdecl __MINGW_NOTHROW wcsncmp(const wchar_t*, const wchar_t*, size_t); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsncpy(wchar_t*, const wchar_t*, size_t); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcspbrk(const wchar_t*, const wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsrchr(const wchar_t*, wchar_t); -_CRTIMP size_t __cdecl __MINGW_NOTHROW wcsspn(const wchar_t*, const wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsstr(const wchar_t*, const wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcstok(wchar_t*, const wchar_t*); -_CRTIMP size_t __cdecl __MINGW_NOTHROW wcsxfrm(wchar_t*, const wchar_t*, size_t); +#define _WSTRING_DEFINED -#ifndef __STRICT_ANSI__ -/* - * Unicode versions of non-ANSI string functions provided by CRTDLL. - */ + _CRTIMP wchar_t *__cdecl _wcsdup(const wchar_t *_Str); + wchar_t *__cdecl wcscat(wchar_t *_Dest,const wchar_t *_Source); + _CONST_RETURN wchar_t *__cdecl wcschr(const wchar_t *_Str,wchar_t _Ch); + int __cdecl wcscmp(const wchar_t *_Str1,const wchar_t *_Str2); + wchar_t *__cdecl wcscpy(wchar_t *_Dest,const wchar_t *_Source); + size_t __cdecl wcscspn(const wchar_t *_Str,const wchar_t *_Control); + size_t __cdecl wcslen(const wchar_t *_Str); + size_t __cdecl wcsnlen(const wchar_t *_Src,size_t _MaxCount); + wchar_t *wcsncat(wchar_t *_Dest,const wchar_t *_Source,size_t _Count); + int __cdecl wcsncmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + wchar_t *wcsncpy(wchar_t *_Dest,const wchar_t *_Source,size_t _Count); + _CONST_RETURN wchar_t *__cdecl wcspbrk(const wchar_t *_Str,const wchar_t *_Control); + _CONST_RETURN wchar_t *__cdecl wcsrchr(const wchar_t *_Str,wchar_t _Ch); + size_t __cdecl wcsspn(const wchar_t *_Str,const wchar_t *_Control); + _CONST_RETURN wchar_t *__cdecl wcsstr(const wchar_t *_Str,const wchar_t *_SubStr); + wchar_t *__cdecl wcstok(wchar_t *_Str,const wchar_t *_Delim); + _CRTIMP wchar_t *__cdecl _wcserror(int _ErrNum); + _CRTIMP wchar_t *__cdecl __wcserror(const wchar_t *_Str); + _CRTIMP int __cdecl _wcsicmp(const wchar_t *_Str1,const wchar_t *_Str2); + _CRTIMP int __cdecl _wcsicmp_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _wcsnicmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _wcsnicmp_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP wchar_t *__cdecl _wcsnset(wchar_t *_Str,wchar_t _Val,size_t _MaxCount); + _CRTIMP wchar_t *__cdecl _wcsrev(wchar_t *_Str); + _CRTIMP wchar_t *__cdecl _wcsset(wchar_t *_Str,wchar_t _Val); + _CRTIMP wchar_t *__cdecl _wcslwr(wchar_t *_String); + _CRTIMP wchar_t *_wcslwr_l(wchar_t *_String,_locale_t _Locale); + _CRTIMP wchar_t *__cdecl _wcsupr(wchar_t *_String); + _CRTIMP wchar_t *_wcsupr_l(wchar_t *_String,_locale_t _Locale); + size_t __cdecl wcsxfrm(wchar_t *_Dst,const wchar_t *_Src,size_t _MaxCount); + _CRTIMP size_t __cdecl _wcsxfrm_l(wchar_t *_Dst,const wchar_t *_Src,size_t _MaxCount,_locale_t _Locale); + int __cdecl wcscoll(const wchar_t *_Str1,const wchar_t *_Str2); + _CRTIMP int __cdecl _wcscoll_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _wcsicoll(const wchar_t *_Str1,const wchar_t *_Str2); + _CRTIMP int __cdecl _wcsicoll_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _wcsncoll(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _wcsncoll_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _wcsnicoll(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _wcsnicoll_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); -/* NOTE: _wcscmpi not provided by CRTDLL, this define is for portability */ -#define _wcscmpi _wcsicmp +#ifndef NO_OLDNAMES + /* NOTE: There is no _wcscmpi, but this is for compatibility. */ + int __cdecl wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2); + __CRT_INLINE int __cdecl wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2) { return _wcsicmp (__ws1, __ws2); } + #define _wcscmpi _wcsicmp -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcsdup (const wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wcsicmp (const wchar_t*, const wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wcsicoll (const wchar_t*, const wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcslwr (wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wcsnicmp (const wchar_t*, const wchar_t*, size_t); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcsnset (wchar_t*, wchar_t, size_t); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcsrev (wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcsset (wchar_t*, wchar_t); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcsupr (wchar_t*); - -#ifdef __MSVCRT__ -_CRTIMP int __cdecl __MINGW_NOTHROW _wcsncoll(const wchar_t*, const wchar_t*, size_t); -_CRTIMP int __cdecl __MINGW_NOTHROW _wcsnicoll(const wchar_t*, const wchar_t*, size_t); -#if __MSVCRT_VERSION__ >= 0x0700 -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcserror(int); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW __wcserror(const wchar_t*); + wchar_t *__cdecl wcsdup(const wchar_t *_Str); +#define wcswcs wcsstr + int __cdecl wcsicmp(const wchar_t *_Str1,const wchar_t *_Str2); + int __cdecl wcsnicmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + wchar_t *__cdecl wcsnset(wchar_t *_Str,wchar_t _Val,size_t _MaxCount); + wchar_t *__cdecl wcsrev(wchar_t *_Str); + wchar_t *__cdecl wcsset(wchar_t *_Str,wchar_t _Val); + wchar_t *__cdecl wcslwr(wchar_t *_Str); + wchar_t *__cdecl wcsupr(wchar_t *_Str); + int __cdecl wcsicoll(const wchar_t *_Str1,const wchar_t *_Str2); #endif #endif -#ifndef _NO_OLDNAMES -/* NOTE: There is no _wcscmpi, but this is for compatibility. */ -int __cdecl __MINGW_NOTHROW wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2); -__CRT_INLINE int __cdecl __MINGW_NOTHROW -wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2) - {return _wcsicmp (__ws1, __ws2);} -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsdup (const wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW wcsicmp (const wchar_t*, const wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW wcsicoll (const wchar_t*, const wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcslwr (wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW wcsnicmp (const wchar_t*, const wchar_t*, size_t); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsnset (wchar_t*, wchar_t, size_t); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsrev (wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsset (wchar_t*, wchar_t); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsupr (wchar_t*); -#endif /* Not _NO_OLDNAMES */ - -#endif /* Not strict ANSI */ - -#define _WSTRING_DEFINED -#endif /* _WSTRING_DEFINED */ - #ifdef __cplusplus } #endif -#endif /* Not RC_INVOKED */ - -#endif /* Not _STRING_H_ */ +#include +#endif Index: include/crt/strings.h =================================================================== --- include/crt/strings.h (Revision 37928) +++ include/crt/strings.h (Arbeitskopie) @@ -1,3 +1,8 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ /* File: strings.h Copyright: Public Domain @@ -2,9 +7,9 @@ - This file is provided because non ANSI fuctions are described in string.h + This file is provided because non ANSI fuctions are described in string.h that belong in strings.h. These functions are provided for in the OLDNAME libraries. */ -#if !defined(_STRINGS_H_) -# define _STRINGS_H_ 1 -# include +#ifndef _STRINGS_H_ +#define _STRINGS_H_ 1 +#include #endif Index: include/crt/sys/cdefs.h =================================================================== --- include/crt/sys/cdefs.h (Revision 0) +++ include/crt/sys/cdefs.h (Revision 0) @@ -0,0 +1,17 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _SYS_CDEFS_H +#define _SYS_CDEFS_H +#ifdef __cplusplus +#define __BEGIN_DECLS extern "C" { +#define __END_DECLS } +#else +#define __BEGIN_DECLS +#define __END_DECLS +#endif +#define __P(protos) protos /* full-blown ANSI C */ +#endif + Index: include/crt/sys/fcntl.h =================================================================== --- include/crt/sys/fcntl.h (Revision 37928) +++ include/crt/sys/fcntl.h (Arbeitskopie) @@ -1,3 +1,8 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ /* * This file is part of the Mingw32 package. * @@ -3,4 +8,5 @@ * This fcntl.h maps to the root fcntl.h */ - +#ifndef __STRICT_ANSI__ #include +#endif Index: include/crt/sys/file.h =================================================================== --- include/crt/sys/file.h (Revision 37928) +++ include/crt/sys/file.h (Arbeitskopie) @@ -1,3 +1,8 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ /* * This file is part of the Mingw32 package. * @@ -4,4 +9,6 @@ * This file.h maps to the root fcntl.h * TODO? */ +#ifndef __STRICT_ANSI__ #include +#endif Index: include/crt/sys/ioctl.h =================================================================== --- include/crt/sys/ioctl.h (Revision 0) +++ include/crt/sys/ioctl.h (Revision 0) @@ -0,0 +1,21 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#ifndef _SYS_IOCTL_H +#define _SYS_IOCTL_H + +#include + +#define WINDOWS_POST 0 /* Set write() behavior to PostMessage() */ +#define WINDOWS_SEND 1 /* Set write() behavior to SendMessage() */ +#define WINDOWS_HWND 2 /* Set hWnd for read() calls */ + +__BEGIN_DECLS + +int ioctl (int __fd, int __cmd, ...); + +__END_DECLS + +#endif Index: include/crt/sys/locking.h =================================================================== --- include/crt/sys/locking.h (Revision 37928) +++ include/crt/sys/locking.h (Arbeitskopie) @@ -1,31 +1,30 @@ -/* - * locking.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Constants for the mode parameter of the locking function. - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ +#ifndef _INC_LOCKING +#define _INC_LOCKING -#ifndef _LOCKING_H_ -#define _LOCKING_H_ +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif /* All the headers include this file. */ #include <_mingw.h> -#define _LK_UNLCK 0 /* Unlock */ -#define _LK_LOCK 1 /* Lock */ -#define _LK_NBLCK 2 /* Non-blocking lock */ -#define _LK_RLCK 3 /* Lock for read only */ -#define _LK_NBRLCK 4 /* Non-blocking lock for read only */ +#define _LK_UNLCK 0 +#define _LK_LOCK 1 +#define _LK_NBLCK 2 +#define _LK_RLCK 3 +#define _LK_NBRLCK 4 #ifndef NO_OLDNAMES -#define LK_UNLCK _LK_UNLCK -#define LK_LOCK _LK_LOCK -#define LK_NBLCK _LK_NBLCK -#define LK_RLCK _LK_RLCK -#define LK_NBRLCK _LK_NBRLCK -#endif /* Not NO_OLDNAMES */ +#define LK_UNLCK _LK_UNLCK +#define LK_LOCK _LK_LOCK +#define LK_NBLCK _LK_NBLCK +#define LK_RLCK _LK_RLCK +#define LK_NBRLCK _LK_NBRLCK +#endif -#endif /* Not _LOCKING_H_ */ +#endif Index: include/crt/sys/param.h =================================================================== --- include/crt/sys/param.h (Revision 37928) +++ include/crt/sys/param.h (Arbeitskopie) @@ -1,9 +1,30 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ /* * param.h - * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Earnie Boyd + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision: 1.3 $ + * $Author: earnie $ + * $Date: 2003/05/03 13:48:47 $ + * */ #ifndef _SYS_PARAM_H @@ -12,6 +33,7 @@ #include #include +#ifndef __STRICT_ANSI__ /* These are useful for cross-compiling */ #define BIG_ENDIAN 4321 #define LITTLE_ENDIAN 1234 @@ -20,3 +42,5 @@ #define MAXPATHLEN PATH_MAX #endif + +#endif Index: include/crt/sys/stat.h =================================================================== --- include/crt/sys/stat.h (Revision 37928) +++ include/crt/sys/stat.h (Arbeitskopie) @@ -1,125 +1,91 @@ -/* - * stat.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Symbolic constants for opening and creating files, also stat, fstat and - * chmod functions. - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ +#ifndef _INC_STAT +#define _INC_STAT -#ifndef _STAT_H_ -#define _STAT_H_ +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif -/* All the headers include this file. */ #include <_mingw.h> +#include -#define __need_size_t -#define __need_wchar_t -#ifndef RC_INVOKED -#include -#endif /* Not RC_INVOKED */ +#pragma pack(push,_CRT_PACKING) -#include +#ifdef __cplusplus +extern "C" { +#endif -/* - * Constants for the stat st_mode member. - */ -#define _S_IFIFO 0x1000 /* FIFO */ -#define _S_IFCHR 0x2000 /* Character */ -#define _S_IFBLK 0x3000 /* Block: Is this ever set under w32? */ -#define _S_IFDIR 0x4000 /* Directory */ -#define _S_IFREG 0x8000 /* Regular */ +#ifndef _CRTIMP +#define _CRTIMP __declspec(dllimport) +#endif -#define _S_IFMT 0xF000 /* File type mask */ +#include -#define _S_IEXEC 0x0040 -#define _S_IWRITE 0x0080 -#define _S_IREAD 0x0100 +#ifdef _USE_32BIT_TIME_T +#ifdef _WIN64 +#undef _USE_32BIT_TIME_T +#endif +#else +#if _INTEGRAL_MAX_BITS < 64 +#define _USE_32BIT_TIME_T +#endif +#endif -#define _S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC) -#define _S_IXUSR _S_IEXEC -#define _S_IWUSR _S_IWRITE -#define _S_IRUSR _S_IREAD +#ifndef _TIME32_T_DEFINED + typedef long __time32_t; +#define _TIME32_T_DEFINED +#endif -#define _S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) -#define _S_ISFIFO(m) (((m) & _S_IFMT) == _S_IFIFO) -#define _S_ISCHR(m) (((m) & _S_IFMT) == _S_IFCHR) -#define _S_ISBLK(m) (((m) & _S_IFMT) == _S_IFBLK) -#define _S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG) +#ifndef _TIME64_T_DEFINED +#if _INTEGRAL_MAX_BITS >= 64 + typedef __int64 __time64_t; +#endif +#define _TIME64_T_DEFINED +#endif -#ifndef _NO_OLDNAMES +#ifndef _TIME_T_DEFINED +#ifdef _USE_32BIT_TIME_T + typedef __time32_t time_t; +#else + typedef __time64_t time_t; +#endif +#define _TIME_T_DEFINED +#endif -#define S_IFIFO _S_IFIFO -#define S_IFCHR _S_IFCHR -#define S_IFBLK _S_IFBLK -#define S_IFDIR _S_IFDIR -#define S_IFREG _S_IFREG -#define S_IFMT _S_IFMT -#define S_IEXEC _S_IEXEC -#define S_IWRITE _S_IWRITE -#define S_IREAD _S_IREAD -#define S_IRWXU _S_IRWXU -#define S_IXUSR _S_IXUSR -#define S_IWUSR _S_IWUSR -#define S_IRUSR _S_IRUSR +#ifndef _WCHAR_T_DEFINED + typedef unsigned short wchar_t; +#define _WCHAR_T_DEFINED +#endif -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) -#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) -#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) -#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) - -#endif /* Not _NO_OLDNAMES */ - -#ifndef RC_INVOKED - #ifndef _STAT_DEFINED -/* - * The structure manipulated and returned by stat and fstat. - * - * NOTE: If called on a directory the values in the time fields are not only - * invalid, they will cause localtime et. al. to return NULL. And calling - * asctime with a NULL pointer causes an Invalid Page Fault. So watch it! - */ -struct _stat -{ - _dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */ - _ino_t st_ino; /* Always zero ? */ - _mode_t st_mode; /* See above constants */ - short st_nlink; /* Number of links. */ - short st_uid; /* User: Maybe significant on NT ? */ - short st_gid; /* Group: Ditto */ - _dev_t st_rdev; /* Seems useless (not even filled in) */ - _off_t st_size; /* File size in bytes */ - time_t st_atime; /* Accessed date (always 00:00 hrs local - * on FAT) */ - time_t st_mtime; /* Modified time */ - time_t st_ctime; /* Creation time */ -}; -#ifndef _NO_OLDNAMES -/* NOTE: Must be the same as _stat above. */ -struct stat -{ - _dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */ - _ino_t st_ino; /* Always zero ? */ - _mode_t st_mode; /* See above constants */ - short st_nlink; /* Number of links. */ - short st_uid; /* User: Maybe significant on NT ? */ - short st_gid; /* Group: Ditto */ - _dev_t st_rdev; /* Seems useless (not even filled in) */ - _off_t st_size; /* File size in bytes */ - time_t st_atime; /* Accessed date (always 00:00 hrs local - * on FAT) */ - time_t st_mtime; /* Modified time */ - time_t st_ctime; /* Creation time */ -}; -#endif /* _NO_OLDNAMES */ +#ifdef _USE_32BIT_TIME_T +#ifndef _WIN64 +#define _fstat32 _fstat +#define _stat32 _stat +#define _wstat32 _wstat +#else +#define _fstat _fstat32 +#define _stat _stat32 +#define _wstat _wstat32 +#endif +#define _fstati64 _fstat32i64 +#define _stati64 _stat32i64 +#define _wstati64 _wstat32i64 +#else +#define _fstat _fstat64i32 +#define _fstati64 _fstat64 +#define _stat _stat64i32 +#define _stati64 _stat64 +#define _wstat _wstat64i32 +#define _wstati64 _wstat64 +#endif -#if defined (__MSVCRT__) -struct _stati64 { + struct _stat32 { _dev_t st_dev; _ino_t st_ino; unsigned short st_mode; @@ -127,69 +93,196 @@ short st_uid; short st_gid; _dev_t st_rdev; - __int64 st_size; + _off_t st_size; + __time32_t st_atime; + __time32_t st_mtime; + __time32_t st_ctime; + }; + +#ifndef NO_OLDNAMES + struct stat { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + _off_t st_size; time_t st_atime; time_t st_mtime; time_t st_ctime; -}; + }; +#endif -struct __stat64 -{ +/* #if _INTEGRAL_MAX_BITS >= 64 */ + struct _stat32i64 { _dev_t st_dev; _ino_t st_ino; - _mode_t st_mode; + unsigned short st_mode; short st_nlink; short st_uid; short st_gid; _dev_t st_rdev; __int64 st_size; + __time32_t st_atime; + __time32_t st_mtime; + __time32_t st_ctime; + }; + + struct _stat64i32 { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + _off_t st_size; __time64_t st_atime; __time64_t st_mtime; __time64_t st_ctime; -}; -#endif /* __MSVCRT__ */ + }; + + struct _stat64 { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + __int64 st_size; + __time64_t st_atime; + __time64_t st_mtime; + __time64_t st_ctime; + }; +/* #endif */ + +#define __stat64 _stat64 + #define _STAT_DEFINED -#endif /* _STAT_DEFINED */ +#endif -#ifdef __cplusplus -extern "C" { +#define _S_IFMT 0xF000 +#define _S_IFDIR 0x4000 +#define _S_IFCHR 0x2000 +#define _S_IFIFO 0x1000 +#define _S_IFREG 0x8000 +#define _S_IREAD 0x0100 +#define _S_IWRITE 0x0080 +#define _S_IEXEC 0x0040 + + _CRTIMP int __cdecl _fstat32(int _FileDes,struct _stat32 *_Stat); + _CRTIMP int __cdecl _stat32(const char *_Name,struct _stat32 *_Stat); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP int __cdecl _fstat64(int _FileDes,struct _stat64 *_Stat); + _CRTIMP int __cdecl _fstat32i64(int _FileDes,struct _stat32i64 *_Stat); + int __cdecl _fstat64i32(int _FileDes,struct _stat64i32 *_Stat); + __CRT_INLINE int __cdecl _fstat64i32(int _FileDes,struct _stat64i32 *_Stat) + { + struct _stat64 st; + int ret=_fstat64(_FileDes,&st); + _Stat->st_dev=st.st_dev; + _Stat->st_ino=st.st_ino; + _Stat->st_mode=st.st_mode; + _Stat->st_nlink=st.st_nlink; + _Stat->st_uid=st.st_uid; + _Stat->st_gid=st.st_gid; + _Stat->st_rdev=st.st_rdev; + _Stat->st_size=(_off_t) st.st_size; + _Stat->st_atime=st.st_atime; + _Stat->st_mtime=st.st_mtime; + _Stat->st_ctime=st.st_ctime; + return ret; + } + _CRTIMP int __cdecl _stat64(const char *_Name,struct _stat64 *_Stat); + _CRTIMP int __cdecl _stat32i64(const char *_Name,struct _stat32i64 *_Stat); + int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat); + __CRT_INLINE int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat) + { + struct _stat64 st; + int ret=_stat64(_Name,&st); + _Stat->st_dev=st.st_dev; + _Stat->st_ino=st.st_ino; + _Stat->st_mode=st.st_mode; + _Stat->st_nlink=st.st_nlink; + _Stat->st_uid=st.st_uid; + _Stat->st_gid=st.st_gid; + _Stat->st_rdev=st.st_rdev; + _Stat->st_size=(_off_t) st.st_size; + _Stat->st_atime=st.st_atime; + _Stat->st_mtime=st.st_mtime; + _Stat->st_ctime=st.st_ctime; + return ret; + } #endif -_CRTIMP int __cdecl __MINGW_NOTHROW _fstat (int, struct _stat*); -_CRTIMP int __cdecl __MINGW_NOTHROW _chmod (const char*, int); -_CRTIMP int __cdecl __MINGW_NOTHROW _stat (const char*, struct _stat*); +#ifndef _WSTAT_DEFINED +#define _WSTAT_DEFINED + _CRTIMP int __cdecl _wstat32(const wchar_t *_Name,struct _stat32 *_Stat); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP int __cdecl _wstat32i64(const wchar_t *_Name,struct _stat32i64 *_Stat); + int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat); + _CRTIMP int __cdecl _wstat64(const wchar_t *_Name,struct _stat64 *_Stat); +#endif +#endif -#ifndef _NO_OLDNAMES +#ifndef NO_OLDNAMES +#define _S_IFBLK 0x3000 /* Block: Is this ever set under w32? */ -/* These functions live in liboldnames.a. */ -_CRTIMP int __cdecl __MINGW_NOTHROW fstat (int, struct stat*); -_CRTIMP int __cdecl __MINGW_NOTHROW chmod (const char*, int); -_CRTIMP int __cdecl __MINGW_NOTHROW stat (const char*, struct stat*); +#define S_IFMT _S_IFMT +#define S_IFDIR _S_IFDIR +#define S_IFCHR _S_IFCHR +#define S_IFREG _S_IFREG +#define S_IREAD _S_IREAD +#define S_IWRITE _S_IWRITE +#define S_IEXEC _S_IEXEC +#define S_IFIFO _S_IFIFO +#define S_IFBLK _S_IFBLK -#endif /* Not _NO_OLDNAMES */ +#define _S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC) +#define _S_IXUSR _S_IEXEC +#define _S_IWUSR _S_IWRITE -#if defined (__MSVCRT__) -_CRTIMP int __cdecl __MINGW_NOTHROW _fstati64(int, struct _stati64 *); -_CRTIMP int __cdecl __MINGW_NOTHROW _stati64(const char *, struct _stati64 *); -/* These require newer versions of msvcrt.dll (6.10 or higher). */ -#if __MSVCRT_VERSION__ >= 0x0601 -_CRTIMP int __cdecl __MINGW_NOTHROW _fstat64 (int, struct __stat64*); -_CRTIMP int __cdecl __MINGW_NOTHROW _stat64 (const char*, struct __stat64*); -#endif /* __MSVCRT_VERSION__ >= 0x0601 */ -#if !defined ( _WSTAT_DEFINED) /* also declared in wchar.h */ -_CRTIMP int __cdecl __MINGW_NOTHROW _wstat(const wchar_t*, struct _stat*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wstati64 (const wchar_t*, struct _stati64*); -#if __MSVCRT_VERSION__ >= 0x0601 -_CRTIMP int __cdecl __MINGW_NOTHROW _wstat64 (const wchar_t*, struct __stat64*); -#endif /* __MSVCRT_VERSION__ >= 0x0601 */ -#define _WSTAT_DEFINED -#endif /* _WSTAT_DEFIND */ -#endif /* __MSVCRT__ */ +#define S_IRWXU _S_IRWXU +#define S_IXUSR _S_IXUSR +#define S_IWUSR _S_IWUSR +#define S_IRUSR _S_IRUSR +#define _S_IRUSR _S_IREAD -#ifdef __cplusplus +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) + +#endif + +#if !defined (RC_INVOKED) && !defined (NO_OLDNAMES) +int __cdecl stat(const char *_Filename,struct stat *_Stat); +int __cdecl fstat(int _Desc,struct stat *_Stat); +int __cdecl wstat(const wchar_t *_Filename,struct stat *_Stat); +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE int __cdecl fstat(int _Desc,struct stat *_Stat) { + return _fstat32(_Desc,(struct _stat32 *)_Stat); } +__CRT_INLINE int __cdecl stat(const char *_Filename,struct stat *_Stat) { + return _stat32(_Filename,(struct _stat32 *)_Stat); +} +#else +__CRT_INLINE int __cdecl fstat(int _Desc,struct stat *_Stat) { + return _fstat64i32(_Desc,(struct _stat64i32 *)_Stat); +} +__CRT_INLINE int __cdecl stat(const char *_Filename,struct stat *_Stat) { + return _stat64i32(_Filename,(struct _stat64i32 *)_Stat); +} #endif +#endif -#endif /* Not RC_INVOKED */ +#ifdef __cplusplus +} +#endif -#endif /* Not _STAT_H_ */ +#pragma pack(pop) +#endif Index: include/crt/sys/time.h =================================================================== --- include/crt/sys/time.h (Revision 37928) +++ include/crt/sys/time.h (Arbeitskopie) @@ -1,11 +1,19 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ + #ifndef _SYS_TIME_H_ #define _SYS_TIME_H_ + #include -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif +#ifndef __STRICT_ANSI__ #ifndef _TIMEVAL_DEFINED /* also in winsock[2].h */ #define _TIMEVAL_DEFINED struct timeval { @@ -14,12 +22,14 @@ }; #define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) #define timercmp(tvp, uvp, cmp) \ - (((tvp)->tv_sec != (uvp)->tv_sec) ? \ - ((tvp)->tv_sec cmp (uvp)->tv_sec) : \ - ((tvp)->tv_usec cmp (uvp)->tv_usec)) + (((tvp)->tv_sec != (uvp)->tv_sec) ? \ + ((tvp)->tv_sec cmp (uvp)->tv_sec) : \ + ((tvp)->tv_usec cmp (uvp)->tv_usec)) #define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 #endif /* _TIMEVAL_DEFINED */ +#ifndef _TIMEZONE_DEFINED /* also in sys/time.h */ +#define _TIMEZONE_DEFINED /* Provided for compatibility with code that assumes that the presence of gettimeofday function implies a definition of struct timezone. */ @@ -29,6 +39,10 @@ int tz_dsttime; /* type of dst correction to apply */ }; + extern int __cdecl mingw_gettimeofday (struct timeval *p, struct timezone *z); + +#endif + /* Implementation as per: The Open Group Base Specifications, Issue 6 @@ -36,12 +50,20 @@ The timezone pointer arg is ignored. Errors are ignored. */ -int __cdecl __MINGW_NOTHROW gettimeofday(struct timeval *__restrict__, - void *__restrict__ /* tzp (unused) */); +#ifndef _GETTIMEOFDAY_DEFINED +#define _GETTIMEOFDAY_DEFINED +int __cdecl gettimeofday(struct timeval *__restrict__, + void *__restrict__ /* tzp (unused) */); +#endif -#ifdef __cplusplus +#endif /* __STRICT_ANSI__ */ + +#ifdef __cplusplus } #endif +/* Adding timespec definition. */ +#include + #endif /* _SYS_TIME_H_ */ Index: include/crt/sys/timeb.h =================================================================== --- include/crt/sys/timeb.h (Revision 37928) +++ include/crt/sys/timeb.h (Arbeitskopie) @@ -1,74 +1,130 @@ -/* - * timeb.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Support for the UNIX System V ftime system call. - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ +#ifndef _TIMEB_H_ +#define _TIMEB_H_ -#ifndef _TIMEB_H_ -#define _TIMEB_H_ - -/* All the headers include this file. */ #include <_mingw.h> -#include -#ifndef RC_INVOKED +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif -/* - * TODO: Structure not tested. - */ -struct _timeb -{ - long time; - short millitm; - short timezone; - short dstflag; -}; +#pragma pack(push,_CRT_PACKING) -#ifndef _NO_OLDNAMES -/* - * TODO: Structure not tested. - */ -struct timeb -{ - long time; - short millitm; - short timezone; - short dstflag; -}; +#ifdef __cplusplus +extern "C" { #endif -struct __timeb64 -{ - __time64_t time; - short millitm; - short timezone; - short dstflag; -}; +#ifndef _CRTIMP +#define _CRTIMP __declspec(dllimport) +#endif -#ifdef __cplusplus -extern "C" { +#ifdef _USE_32BIT_TIME_T +#ifdef _WIN64 +#undef _USE_32BIT_TIME_T #endif +#else +#if _INTEGRAL_MAX_BITS < 64 +#define _USE_32BIT_TIME_T +#endif +#endif -/* TODO: Not tested. */ -_CRTIMP void __cdecl __MINGW_NOTHROW _ftime (struct _timeb*); +#ifndef _TIME32_T_DEFINED + typedef long __time32_t; +#define _TIME32_T_DEFINED +#endif -#ifndef _NO_OLDNAMES -_CRTIMP void __cdecl __MINGW_NOTHROW ftime (struct timeb*); -#endif /* Not _NO_OLDNAMES */ +#ifndef _TIME64_T_DEFINED +#if _INTEGRAL_MAX_BITS >= 64 + typedef __int64 __time64_t; +#endif +#define _TIME64_T_DEFINED +#endif -/* This requires newer versions of msvcrt.dll (6.10 or higher). */ -#if __MSVCRT_VERSION__ >= 0x0601 -_CRTIMP void __cdecl __MINGW_NOTHROW _ftime64 (struct __timeb64*); -#endif /* __MSVCRT_VERSION__ >= 0x0601 */ +#ifndef _TIME_T_DEFINED +#ifdef _USE_32BIT_TIME_T + typedef __time32_t time_t; +#else + typedef __time64_t time_t; +#endif +#define _TIME_T_DEFINED +#endif -#ifdef __cplusplus +#ifndef _TIMEB_DEFINED +#define _TIMEB_DEFINED + + struct __timeb32 { + __time32_t time; + unsigned short millitm; + short timezone; + short dstflag; + }; + +#ifndef NO_OLDNAMES + struct timeb { + time_t time; + unsigned short millitm; + short timezone; + short dstflag; + }; +#endif + +#if _INTEGRAL_MAX_BITS >= 64 + struct __timeb64 { + __time64_t time; + unsigned short millitm; + short timezone; + short dstflag; + }; +#endif + +#ifdef _USE_32BIT_TIME_T +#define _timeb __timeb32 +#define _ftime _ftime32 +#else +#define _timeb __timeb64 +#define _ftime _ftime64 +#endif +#endif + + _CRTIMP void __cdecl _ftime32(struct __timeb32 *_Time); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP void __cdecl _ftime64(struct __timeb64 *_Time); +#endif + +#ifndef TIMESPEC_DEFINED +#define TIMESPEC_DEFINED +struct timespec { + time_t tv_sec; /* Seconds */ + long tv_nsec; /* Nanoseconds */ +}; + +struct itimerspec { + struct timespec it_interval; /* Timer period */ + struct timespec it_value; /* Timer expiration */ +}; +#endif + +#if !defined (RC_INVOKED) && !defined (NO_OLDNAMES) +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE void __cdecl ftime(struct timeb *_Tmb) { + _ftime32((struct __timeb32 *)_Tmb); } +#else +__CRT_INLINE void __cdecl ftime(struct timeb *_Tmb) { + _ftime64((struct __timeb64 *)_Tmb); +} #endif +#endif -#endif /* Not RC_INVOKED */ +#ifdef __cplusplus +} +#endif -#endif /* Not _TIMEB_H_ */ +#pragma pack(pop) + +#include +#endif Index: include/crt/sys/types.h =================================================================== --- include/crt/sys/types.h (Revision 37928) +++ include/crt/sys/types.h (Arbeitskopie) @@ -1,120 +1,116 @@ -/* - * types.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * The definition of constants, data types and global variables. - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ +#ifndef _INC_TYPES +#define _INC_TYPES -#ifndef _TYPES_H_ -#define _TYPES_H_ +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif -/* All the headers include this file. */ #include <_mingw.h> -#define __need_wchar_t -#define __need_size_t -#define __need_ptrdiff_t -#ifndef RC_INVOKED -#include -#endif /* Not RC_INVOKED */ +#ifdef _USE_32BIT_TIME_T +#ifdef _WIN64 +#undef _USE_32BIT_TIME_T +#endif +#else +#if _INTEGRAL_MAX_BITS < 64 +#define _USE_32BIT_TIME_T +#endif +#endif -#ifndef RC_INVOKED - -#ifndef _TIME_T_DEFINED -typedef long time_t; -#define _TIME_T_DEFINED +#ifndef _TIME32_T_DEFINED +#define _TIME32_T_DEFINED +typedef long __time32_t; #endif #ifndef _TIME64_T_DEFINED -typedef __int64 __time64_t; #define _TIME64_T_DEFINED +#if _INTEGRAL_MAX_BITS >= 64 +typedef __int64 __time64_t; #endif - -#ifndef _OFF_T_ -#define _OFF_T_ -typedef long _off_t; - -#ifndef _NO_OLDNAMES -typedef _off_t off_t; #endif -#endif /* Not _OFF_T_ */ - -#ifndef _DEV_T_ -#define _DEV_T_ -#ifdef __MSVCRT__ -typedef unsigned int _dev_t; +#ifndef _TIME_T_DEFINED +#define _TIME_T_DEFINED +#ifdef _USE_32BIT_TIME_T +typedef __time32_t time_t; #else -typedef short _dev_t; +typedef __time64_t time_t; #endif +#endif -#ifndef _NO_OLDNAMES -typedef _dev_t dev_t; +#ifndef _INO_T_DEFINED +#define _INO_T_DEFINED +typedef unsigned short _ino_t; +#ifndef NO_OLDNAMES +typedef unsigned short ino_t; #endif -#endif /* Not _DEV_T_ */ +#endif - -#ifndef _INO_T_ -#define _INO_T_ -typedef short _ino_t; - -#ifndef _NO_OLDNAMES -typedef _ino_t ino_t; +#ifndef _DEV_T_DEFINED +#define _DEV_T_DEFINED +typedef unsigned int _dev_t; +#ifndef NO_OLDNAMES +typedef unsigned int dev_t; #endif -#endif /* Not _INO_T_ */ +#endif - #ifndef _PID_T_ #define _PID_T_ +#ifndef _WIN64 typedef int _pid_t; +#else +typedef __int64 _pid_t; +#endif -#ifndef _NO_OLDNAMES +#ifndef NO_OLDNAMES typedef _pid_t pid_t; #endif #endif /* Not _PID_T_ */ - #ifndef _MODE_T_ #define _MODE_T_ typedef unsigned short _mode_t; -#ifndef _NO_OLDNAMES +#ifndef NO_OLDNAMES typedef _mode_t mode_t; #endif #endif /* Not _MODE_T_ */ - -#ifndef _SIGSET_T_ -#define _SIGSET_T_ -typedef int _sigset_t; - -#ifndef _NO_OLDNAMES -typedef _sigset_t sigset_t; +#ifndef _OFF_T_DEFINED +#define _OFF_T_DEFINED +#ifndef _OFF_T_ +#define _OFF_T_ + typedef long _off_t; +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef long off_t; #endif -#endif /* Not _SIGSET_T_ */ - -#ifndef _SSIZE_T_ -#define _SSIZE_T_ -typedef long _ssize_t; - -#ifndef _NO_OLDNAMES -typedef _ssize_t ssize_t; #endif -#endif /* Not _SSIZE_T_ */ - -#ifndef _FPOS64_T_ -#define _FPOS64_T_ -typedef long long fpos64_t; #endif -#ifndef _OFF64_T_ -#define _OFF64_T_ -typedef long long off64_t; +#ifndef _OFF64_T_DEFINED +#define _OFF64_T_DEFINED + typedef long long _off64_t; +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef long long off64_t; #endif +#endif -#endif /* Not RC_INVOKED */ +#ifndef TIMESPEC_DEFINED +#define TIMESPEC_DEFINED +struct timespec { + time_t tv_sec; /* Seconds */ + long tv_nsec; /* Nanoseconds */ +}; -#endif /* Not _TYPES_H_ */ +struct itimerspec { + struct timespec it_interval; /* Timer period */ + struct timespec it_value; /* Timer expiration */ +}; +#endif + +#endif Index: include/crt/sys/unistd.h =================================================================== --- include/crt/sys/unistd.h (Revision 37928) +++ include/crt/sys/unistd.h (Arbeitskopie) @@ -1,3 +1,8 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ /* * This file is part of the Mingw32 package. * @@ -3,3 +8,6 @@ * unistd.h maps (roughly) to io.h */ +#ifndef __STRICT_ANSI__ #include +#endif + Index: include/crt/sys/utime.h =================================================================== --- include/crt/sys/utime.h (Revision 37928) +++ include/crt/sys/utime.h (Arbeitskopie) @@ -1,82 +1,144 @@ -/* - * utime.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Support for the utime function. - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ -#ifndef _UTIME_H_ -#define _UTIME_H_ +#ifndef _INC_UTIME +#define _INC_UTIME -/* All the headers include this file. */ +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif + #include <_mingw.h> -#define __need_wchar_t -#define __need_size_t -#ifndef RC_INVOKED -#include -#endif /* Not RC_INVOKED */ -#include +#pragma pack(push,_CRT_PACKING) -#ifndef RC_INVOKED +#ifdef __cplusplus +extern "C" { +#endif -/* - * Structure used by _utime function. - */ -struct _utimbuf -{ - time_t actime; /* Access time */ - time_t modtime; /* Modification time */ -}; +#ifndef _CRTIMP +#define _CRTIMP __declspec(dllimport) +#endif +#ifndef _WCHAR_T_DEFINED + typedef unsigned short wchar_t; +#define _WCHAR_T_DEFINED +#endif -#ifndef _NO_OLDNAMES -/* NOTE: Must be the same as _utimbuf above. */ -struct utimbuf -{ - time_t actime; - time_t modtime; -}; -#endif /* Not _NO_OLDNAMES */ +#ifdef _USE_32BIT_TIME_T +#ifdef _WIN64 +#undef _USE_32BIT_TIME_T +#endif +#else +#if _INTEGRAL_MAX_BITS < 64 +#define _USE_32BIT_TIME_T +#endif +#endif -struct __utimbuf64 -{ - __time64_t actime; - __time64_t modtime; -}; +#ifndef _TIME32_T_DEFINED +#define _TIME32_T_DEFINED + typedef long __time32_t; +#endif +#ifndef _TIME64_T_DEFINED +#define _TIME64_T_DEFINED +#if _INTEGRAL_MAX_BITS >= 64 + typedef __int64 __time64_t; +#endif +#endif -#ifdef __cplusplus -extern "C" { +#ifndef _TIME_T_DEFINED +#define _TIME_T_DEFINED +#ifdef _USE_32BIT_TIME_T + typedef __time32_t time_t; +#else + typedef __time64_t time_t; #endif +#endif -_CRTIMP int __cdecl __MINGW_NOTHROW _utime (const char*, struct _utimbuf*); +#ifndef _UTIMBUF_DEFINED +#define _UTIMBUF_DEFINED -#ifndef _NO_OLDNAMES -_CRTIMP int __cdecl __MINGW_NOTHROW utime (const char*, struct utimbuf*); -#endif /* Not _NO_OLDNAMES */ + struct _utimbuf { + time_t actime; + time_t modtime; + }; -_CRTIMP int __cdecl __MINGW_NOTHROW _futime (int, struct _utimbuf*); + struct __utimbuf32 { + __time32_t actime; + __time32_t modtime; + }; -/* The wide character version, only available for MSVCRT versions of the - * C runtime library. */ -#ifdef __MSVCRT__ -_CRTIMP int __cdecl __MINGW_NOTHROW _wutime (const wchar_t*, struct _utimbuf*); -#endif /* MSVCRT runtime */ +#if _INTEGRAL_MAX_BITS >= 64 + struct __utimbuf64 { + __time64_t actime; + __time64_t modtime; + }; +#endif -/* These require newer versions of msvcrt.dll (6.10 or higher). */ -#if __MSVCRT_VERSION__ >= 0x0601 -_CRTIMP int __cdecl __MINGW_NOTHROW _utime64 (const char*, struct __utimbuf64*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wutime64 (const wchar_t*, struct __utimbuf64*); -_CRTIMP int __cdecl __MINGW_NOTHROW _futime64 (int, struct __utimbuf64*); -#endif /* __MSVCRT_VERSION__ >= 0x0601 */ +#ifndef NO_OLDNAMES + struct utimbuf { + time_t actime; + time_t modtime; + }; -#ifdef __cplusplus + struct utimbuf32 { + __time32_t actime; + __time32_t modtime; + }; +#endif +#endif + + _CRTIMP int __cdecl _utime32(const char *_Filename,struct __utimbuf32 *_Time); + _CRTIMP int __cdecl _futime32(int _FileDes,struct __utimbuf32 *_Time); + _CRTIMP int __cdecl _wutime32(const wchar_t *_Filename,struct __utimbuf32 *_Time); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP int __cdecl _utime64(const char *_Filename,struct __utimbuf64 *_Time); + _CRTIMP int __cdecl _futime64(int _FileDes,struct __utimbuf64 *_Time); + _CRTIMP int __cdecl _wutime64(const wchar_t *_Filename,struct __utimbuf64 *_Time); +#endif + +#ifndef RC_INVOKED +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE int __cdecl _utime(const char *_Filename,struct _utimbuf *_Utimbuf) { + return _utime32(_Filename,(struct __utimbuf32 *)_Utimbuf); } +__CRT_INLINE int __cdecl _futime(int _Desc,struct _utimbuf *_Utimbuf) { + return _futime32(_Desc,(struct __utimbuf32 *)_Utimbuf); +} +__CRT_INLINE int __cdecl _wutime(const wchar_t *_Filename,struct _utimbuf *_Utimbuf) { + return _wutime32(_Filename,(struct __utimbuf32 *)_Utimbuf); +} +#else +__CRT_INLINE int __cdecl _utime(const char *_Filename,struct _utimbuf *_Utimbuf) { + return _utime64(_Filename,(struct __utimbuf64 *)_Utimbuf); +} +__CRT_INLINE int __cdecl _futime(int _Desc,struct _utimbuf *_Utimbuf) { + return _futime64(_Desc,(struct __utimbuf64 *)_Utimbuf); +} +__CRT_INLINE int __cdecl _wutime(const wchar_t *_Filename,struct _utimbuf *_Utimbuf) { + return _wutime64(_Filename,(struct __utimbuf64 *)_Utimbuf); +} #endif -#endif /* Not RC_INVOKED */ +#ifndef NO_OLDNAMES +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE int __cdecl utime(const char *_Filename,struct utimbuf *_Utimbuf) { + return _utime32(_Filename,(struct __utimbuf32 *)_Utimbuf); +} +#else +__CRT_INLINE int __cdecl utime(const char *_Filename,struct utimbuf *_Utimbuf) { + return _utime64(_Filename,(struct __utimbuf64 *)_Utimbuf); +} +#endif +#endif +#endif -#endif /* Not _UTIME_H_ */ +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) +#endif Index: include/crt/tchar.h =================================================================== --- include/crt/tchar.h (Revision 0) +++ include/crt/tchar.h (Revision 0) @@ -0,0 +1,1102 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ +#include <_mingw.h> + +#ifndef _INC_TCHAR +#define _INC_TCHAR + +#ifdef _STRSAFE_H_INCLUDED_ +#error Need to include strsafe.h after tchar.h +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define _ftcscat _tcscat +#define _ftcschr _tcschr +#define _ftcscpy _tcscpy +#define _ftcscspn _tcscspn +#define _ftcslen _tcslen +#define _ftcsncat _tcsncat +#define _ftcsncpy _tcsncpy +#define _ftcspbrk _tcspbrk +#define _ftcsrchr _tcsrchr +#define _ftcsspn _tcsspn +#define _ftcsstr _tcsstr +#define _ftcstok _tcstok + +#define _ftcsdup _tcsdup +#define _ftcsnset _tcsnset +#define _ftcsrev _tcsrev +#define _ftcsset _tcsset + +#define _ftcscmp _tcscmp +#define _ftcsicmp _tcsicmp +#define _ftcsnccmp _tcsnccmp +#define _ftcsncmp _tcsncmp +#define _ftcsncicmp _tcsncicmp +#define _ftcsnicmp _tcsnicmp + +#define _ftcscoll _tcscoll +#define _ftcsicoll _tcsicoll +#define _ftcsnccoll _tcsnccoll +#define _ftcsncoll _tcsncoll +#define _ftcsncicoll _tcsncicoll +#define _ftcsnicoll _tcsnicoll + +#define _ftcsclen _tcsclen +#define _ftcsnccat _tcsnccat +#define _ftcsnccpy _tcsnccpy +#define _ftcsncset _tcsncset + +#define _ftcsdec _tcsdec +#define _ftcsinc _tcsinc +#define _ftcsnbcnt _tcsnbcnt +#define _ftcsnccnt _tcsnccnt +#define _ftcsnextc _tcsnextc +#define _ftcsninc _tcsninc +#define _ftcsspnp _tcsspnp + +#define _ftcslwr _tcslwr +#define _ftcsupr _tcsupr + +#define _ftclen _tclen +#define _ftccpy _tccpy +#define _ftccmp _tccmp + +#ifndef _CONST_RETURN +#ifdef __cplusplus +#define _CONST_RETURN const +#define _CRT_CONST_CORRECT_OVERLOADS +#else +#define _CONST_RETURN +#endif +#endif + +#define _WConst_return _CONST_RETURN + +#ifdef _UNICODE + +#ifdef __cplusplus +} +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _WCTYPE_T_DEFINED +#define _WCTYPE_T_DEFINED + typedef unsigned short wint_t; + typedef unsigned short wctype_t; +#endif + +#ifndef __TCHAR_DEFINED +#define __TCHAR_DEFINED + typedef wchar_t _TCHAR; + typedef wchar_t _TSCHAR; + typedef wchar_t _TUCHAR; + typedef wchar_t _TXCHAR; + typedef wint_t _TINT; +#endif + +#ifndef _TCHAR_DEFINED +#define _TCHAR_DEFINED +#ifndef NO_OLDNAMES + typedef wchar_t TCHAR; +#endif +#endif + +#define _TEOF WEOF + +#define __T(x) L##x + +#define _tmain wmain +#define _tWinMain wWinMain +#define _tenviron _wenviron +#define __targv __wargv + +#define _tprintf wprintf +#define _tprintf_l _wprintf_l +#define _tprintf_p _wprintf_p +#define _tprintf_p_l _wprintf_p_l +#define _tcprintf _cwprintf +#define _tcprintf_l _cwprintf_l +#define _tcprintf_p _cwprintf_p +#define _tcprintf_p_l _cwprintf_p_l +#define _vtcprintf _vcwprintf +#define _vtcprintf_l _vcwprintf_l +#define _vtcprintf_p _vcwprintf_p +#define _vtcprintf_p_l _vcwprintf_p_l +#define _ftprintf fwprintf +#define _ftprintf_l _fwprintf_l +#define _ftprintf_p _fwprintf_p +#define _ftprintf_p_l _fwprintf_p_l +#define _stprintf swprintf +#define _stprintf_l __swprintf_l +#define _stprintf_p _swprintf_p +#define _stprintf_p_l _swprintf_p_l +#define _sctprintf _scwprintf +#define _sctprintf_l _scwprintf_l +#define _sctprintf_p _scwprintf_p +#define _sctprintf_p_l _scwprintf_p_l +#define _sntprintf _snwprintf +#define _sntprintf_l _snwprintf_l +#define _vtprintf vwprintf +#define _vtprintf_l _vwprintf_l +#define _vtprintf_p _vwprintf_p +#define _vtprintf_p_l _vwprintf_p_l +#define _vftprintf vfwprintf +#define _vftprintf_l _vfwprintf_l +#define _vftprintf_p _vfwprintf_p +#define _vftprintf_p_l _vfwprintf_p_l +#define _vstprintf vswprintf +#define _vstprintf_l _vswprintf_l +#define _vstprintf_p _vswprintf_p +#define _vstprintf_p_l _vswprintf_p_l +#define _vsctprintf _vscwprintf +#define _vsctprintf_l _vscwprintf_l +#define _vsctprintf_p _vscwprintf_p +#define _vsctprintf_p_l _vscwprintf_p_l +#define _vsntprintf _vsnwprintf +#define _vsntprintf_l _vsnwprintf_l + +#define _tscanf wscanf +#define _tscanf_l _wscanf_l +#define _tcscanf _cwscanf +#define _tcscanf_l _cwscanf_l +#define _ftscanf fwscanf +#define _ftscanf_l _fwscanf_l +#define _stscanf swscanf +#define _stscanf_l _swscanf_l +#define _sntscanf _snwscanf +#define _sntscanf_l _snwscanf_l + +#define _fgettc fgetwc +#define _fgettc_nolock _fgetwc_nolock +#define _fgettchar _fgetwchar +#define _fgetts fgetws +#define _fputtc fputwc +#define _fputtc_nolock _fputwc_nolock +#define _fputtchar _fputwchar +#define _fputts fputws +#define _cputts _cputws +#define _cgetts _cgetws +#define _gettc getwc +#define _gettc_nolock _getwc_nolock +#define _gettch _getwch +#define _gettch_nolock _getwch_nolock +#define _gettche _getwche +#define _gettche_nolock _getwche_nolock +#define _gettchar getwchar +#define _gettchar_nolock _getwchar_nolock +#define _getts _getws +#define _puttc putwc +#define _puttc_nolock _putwc_nolock +#define _puttchar putwchar +#define _puttchar_nolock _putwchar_nolock +#define _puttch _putwch +#define _puttch_nolock _putwch_nolock +#define _putts _putws +#define _ungettc ungetwc +#define _ungettc_nolock _ungetwc_nolock +#define _ungettch _ungetwch +#define _ungettch_nolock _ungetwch_nolock + +#define _tcstod wcstod +#define _tcstol wcstol +#define _tcstoul wcstoul +#define _tcstoi64 _wcstoi64 +#define _tcstoui64 _wcstoui64 +#define _tstof _wtof +#define _tstol _wtol +#define _tstoi _wtoi +#define _tstoi64 _wtoi64 +#define _tcstod_l _wcstod_l +#define _tcstol_l _wcstol_l +#define _tcstoul_l _wcstoul_l +#define _tcstoi64_l _wcstoi64_l +#define _tcstoui64_l _wcstoui64_l +#define _tstof_l _wtof_l +#define _tstol_l _wtol_l +#define _tstoi_l _wtoi_l +#define _tstoi64_l _wtoi64_l + +#define _itot _itow +#define _ltot _ltow +#define _ultot _ultow +#define _ttoi _wtoi +#define _ttol _wtol + +#define _ttoi64 _wtoi64 +#define _i64tot _i64tow +#define _ui64tot _ui64tow + +#define _tcscat wcscat +#define _tcschr wcschr +#define _tcscpy wcscpy +#define _tcscspn wcscspn +#define _tcslen wcslen +#define _tcsnlen wcsnlen +#define _tcsncat wcsncat +#define _tcsncat_l _wcsncat_l +#define _tcsncpy wcsncpy +#define _tcsncpy_l _wcsncpy_l +#define _tcspbrk wcspbrk +#define _tcsrchr wcsrchr +#define _tcsspn wcsspn +#define _tcsstr wcsstr +#define _tcstok wcstok +#define _tcstok_l _wcstok_l +#define _tcserror _wcserror +#define __tcserror __wcserror + +#define _tcsdup _wcsdup +#define _tcsnset _wcsnset +#define _tcsnset_l _wcsnset_l +#define _tcsrev _wcsrev +#define _tcsset _wcsset +#define _tcsset_l _wcsset_l + +#define _tcscmp wcscmp +#define _tcsicmp _wcsicmp +#define _tcsicmp_l _wcsicmp_l +#define _tcsnccmp wcsncmp +#define _tcsncmp wcsncmp +#define _tcsncicmp _wcsnicmp +#define _tcsncicmp_l _wcsnicmp_l +#define _tcsnicmp _wcsnicmp +#define _tcsnicmp_l _wcsnicmp_l + +#define _tcscoll wcscoll +#define _tcscoll_l _wcscoll_l +#define _tcsicoll _wcsicoll +#define _tcsicoll_l _wcsicoll_l +#define _tcsnccoll _wcsncoll +#define _tcsnccoll_l _wcsncoll_l +#define _tcsncoll _wcsncoll +#define _tcsncoll_l _wcsncoll_l +#define _tcsncicoll _wcsnicoll +#define _tcsncicoll_l _wcsnicoll_l +#define _tcsnicoll _wcsnicoll +#define _tcsnicoll_l _wcsnicoll_l + +#define _texecl _wexecl +#define _texecle _wexecle +#define _texeclp _wexeclp +#define _texeclpe _wexeclpe +#define _texecv _wexecv +#define _texecve _wexecve +#define _texecvp _wexecvp +#define _texecvpe _wexecvpe + +#define _tspawnl _wspawnl +#define _tspawnle _wspawnle +#define _tspawnlp _wspawnlp +#define _tspawnlpe _wspawnlpe +#define _tspawnv _wspawnv +#define _tspawnve _wspawnve +#define _tspawnvp _wspawnvp +#define _tspawnvp _wspawnvp +#define _tspawnvpe _wspawnvpe + +#define _tsystem _wsystem + +#define _tasctime _wasctime +#define _tctime _wctime +#define _tctime32 _wctime32 +#define _tctime64 _wctime64 +#define _tstrdate _wstrdate +#define _tstrtime _wstrtime +#define _tutime _wutime +#define _tutime32 _wutime32 +#define _tutime64 _wutime64 +#define _tcsftime wcsftime +#define _tcsftime_l _wcsftime_l + +#define _tchdir _wchdir +#define _tgetcwd _wgetcwd +#define _tgetdcwd _wgetdcwd +#define _tgetdcwd_nolock _wgetdcwd_nolock +#define _tmkdir _wmkdir +#define _trmdir _wrmdir + +#define _tfullpath _wfullpath +#define _tgetenv _wgetenv +#define _tmakepath _wmakepath +#define _tpgmptr _wpgmptr +#define _get_tpgmptr _get_wpgmptr +#define _tputenv _wputenv +#define _tsearchenv _wsearchenv +#define _tsplitpath _wsplitpath + +#define _tfdopen _wfdopen +#define _tfsopen _wfsopen +#define _tfopen _wfopen +#define _tfreopen _wfreopen +#define _tperror _wperror +#define _tpopen _wpopen +#define _ttempnam _wtempnam +#define _ttmpnam _wtmpnam + +#define _taccess _waccess +#define _tchmod _wchmod +#define _tcreat _wcreat +#define _tfindfirst _wfindfirst +#define _tfindfirst32 _wfindfirst32 +#define _tfindfirst64 _wfindfirst64 +#define _tfindfirsti64 _wfindfirsti64 +#define _tfindfirst32i64 _wfindfirst32i64 +#define _tfindfirst64i32 _wfindfirst64i32 +#define _tfindnext _wfindnext +#define _tfindnext32 _wfindnext32 +#define _tfindnext64 _wfindnext64 +#define _tfindnexti64 _wfindnexti64 +#define _tfindnext32i64 _wfindnext32i64 +#define _tfindnext64i32 _wfindnext64i32 +#define _tmktemp _wmktemp +#define _topen _wopen +#define _tremove _wremove +#define _trename _wrename +#define _tsopen _wsopen +#define _tunlink _wunlink + +#define _tfinddata_t _wfinddata_t +#define _tfinddata32_t _wfinddata32_t +#define _tfinddata64_t _wfinddata64_t +#define _tfinddatai64_t _wfinddatai64_t +#define _tfinddata32i64_t _wfinddata32i64_t +#define _tfinddata64i32_t _wfinddata64i32_t + +#define _tstat _wstat +#define _tstat32 _wstat32 +#define _tstat32i64 _wstat32i64 +#define _tstat64 _wstat64 +#define _tstat64i32 _wstat64i32 +#define _tstati64 _wstati64 + +#define _tsetlocale _wsetlocale + +#define _tcsclen wcslen +#define _tcscnlen wcsnlen +#define _tcsclen_l(_String,_Locale) wcslen(_String) +#define _tcscnlen_l(_String,_Max_count,_Locale) wcsnlen_l((_String),(_Max_count)) +#define _tcsnccat wcsncat +#define _tcsnccat_l _wcsncat_l +#define _tcsnccpy wcsncpy +#define _tcsnccpy_l _wcsncpy_l +#define _tcsncset _wcsnset + +#define _tcsdec _wcsdec +#define _tcsinc _wcsinc +#define _tcsnbcnt _wcsncnt +#define _tcsnccnt _wcsncnt +#define _tcsnextc _wcsnextc +#define _tcsninc _wcsninc +#define _tcsspnp _wcsspnp + +#define _tcslwr _wcslwr +#define _tcslwr_l _wcslwr_l +#define _tcsupr _wcsupr +#define _tcsupr_l _wcsupr_l +#define _tcsxfrm wcsxfrm +#define _tcsxfrm_l _wcsxfrm_l + +#define _tclen(_pc) (1) +#define _tccpy(_pc1,_cpc2) ((*(_pc1) = *(_cpc2))) +#define _tccmp(_cpc1,_cpc2) ((*(_cpc1))-(*(_cpc2))) + +#define _istalnum iswalnum +#define _istalnum_l _iswalnum_l +#define _istalpha iswalpha +#define _istalpha_l _iswalpha_l +#define _istascii iswascii +#define _istcntrl iswcntrl +#define _istcntrl_l _iswcntrl_l +#define _istdigit iswdigit +#define _istdigit_l _iswdigit_l +#define _istgraph iswgraph +#define _istgraph_l _iswgraph_l +#define _istlower iswlower +#define _istlower_l _iswlower_l +#define _istprint iswprint +#define _istprint_l _iswprint_l +#define _istpunct iswpunct +#define _istpunct_l _iswpunct_l +#define _istspace iswspace +#define _istspace_l _iswspace_l +#define _istupper iswupper +#define _istupper_l _iswupper_l +#define _istxdigit iswxdigit +#define _istxdigit_l _iswxdigit_l + +#define _totupper towupper +#define _totupper_l _towupper_l +#define _totlower towlower +#define _totlower_l _towlower_l + +#define _istlegal(_Char) (1) +#define _istlead(_Char) (0) +#define _istleadbyte(_Char) (0) +#define _istleadbyte_l(_Char,_Locale) (0) + +#define _wcsdec(_cpc1,_cpc2) ((_cpc1)>=(_cpc2) ? NULL : (_cpc2)-1) +#define _wcsinc(_pc) ((_pc)+1) +#define _wcsnextc(_cpc) ((unsigned int) *(_cpc)) +#define _wcsninc(_pc,_sz) (((_pc)+(_sz))) + _CRTIMP size_t __cdecl __wcsncnt(const wchar_t *_Str,size_t _MaxCount); +#define _wcsncnt(_cpc,_sz) (__wcsncnt(_cpc,_sz)) +#define _wcsspnp(_cpc1,_cpc2) (!_cpc1 ? NULL : ((*((_cpc1)+wcsspn(_cpc1,_cpc2))) ? ((_cpc1)+wcsspn(_cpc1,_cpc2)) : NULL)) +#define _wcsncpy_l(_Destination,_Source,_Count,_Locale) (wcsncpy(_Destination,_Source,_Count)) +#define _wcsncat_l(_Destination,_Source,_Count,_Locale) (wcsncat(_Destination,_Source,_Count)) +#define _wcstok_l(_String,_Delimiters,_Locale) (wcstok(_String,_Delimiters)) +#define _wcsnset_l(_Destination,_Value,_Count,_Locale) (_wcsnset(_Destination,_Value,_Count)) +#define _wcsset_l(_Destination,_Value,_Locale) (_wcsset(_Destination,_Value)) + + /* dirent structures and functions */ +#define _tdirent _wdirent +#define _TDIR _WDIR +#define _topendir _wopendir +#define _tclosedir _wclosedir +#define _treaddir _wreaddir +#define _trewinddir _wrewinddir +#define _ttelldir _wtelldir +#define _tseekdir _wseekdir + +#else + +#ifdef __cplusplus +} +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define _TEOF EOF + +#define __T(x) x + +#define _tmain main +#define _tWinMain WinMain +#ifdef _POSIX_ +#define _tenviron environ +#else +#define _tenviron _environ +#endif +#define __targv __argv + +#define _tprintf printf +#define _tprintf_l _printf_l +#define _tprintf_p _printf_p +#define _tprintf_p_l _printf_p_l +#define _tcprintf _cprintf +#define _tcprintf_l _cprintf_l +#define _tcprintf_p _cprintf_p +#define _tcprintf_p_l _cprintf_p_l +#define _vtcprintf _vcprintf +#define _vtcprintf_l _vcprintf_l +#define _vtcprintf_p _vcprintf_p +#define _vtcprintf_p_l _vcprintf_p_l +#define _ftprintf fprintf +#define _ftprintf_l _fprintf_l +#define _ftprintf_p _fprintf_p +#define _ftprintf_p_l _fprintf_p_l +#define _stprintf sprintf +#define _stprintf_l _sprintf_l +#define _stprintf_p _sprintf_p +#define _stprintf_p_l _sprintf_p_l +#define _sctprintf _scprintf +#define _sctprintf_l _scprintf_l +#define _sctprintf_p _scprintf_p +#define _sctprintf_p_l _scprintf_p_l +#define _sntprintf _snprintf +#define _sntprintf_l _snprintf_l +#define _vtprintf vprintf +#define _vtprintf_l _vprintf_l +#define _vtprintf_p _vprintf_p +#define _vtprintf_p_l _vprintf_p_l +#define _vftprintf vfprintf +#define _vftprintf_l _vfprintf_l +#define _vftprintf_p _vfprintf_p +#define _vftprintf_p_l _vfprintf_p_l +#define _vstprintf vsprintf +#define _vstprintf_l _vsprintf_l +#define _vstprintf_p _vsprintf_p +#define _vstprintf_p_l _vsprintf_p_l +#define _vsctprintf _vscprintf +#define _vsctprintf_l _vscprintf_l +#define _vsctprintf_p _vscprintf_p +#define _vsctprintf_p_l _vscprintf_p_l +#define _vsntprintf _vsnprintf +#define _vsntprintf_l _vsnprintf_l + +#define _tscanf scanf +#define _tscanf_l _scanf_l +#define _tcscanf _cscanf +#define _tcscanf_l _cscanf_l +#define _ftscanf fscanf +#define _ftscanf_l _fscanf_l +#define _stscanf sscanf +#define _stscanf_l _sscanf_l +#define _sntscanf _snscanf +#define _sntscanf_l _snscanf_l + +#define _fgettc fgetc +#define _fgettc_nolock _fgetc_nolock +#define _fgettchar _fgetchar +#define _fgetts fgets +#define _fputtc fputc +#define _fputtc_nolock _fputc_nolock +#define _fputtchar _fputchar +#define _fputts fputs +#define _cputts _cputs +#define _gettc getc +#define _gettc_nolock _getc_nolock +#define _gettch _getch +#define _gettch_nolock _getch_nolock +#define _gettche _getche +#define _gettche_nolock _getche_nolock +#define _gettchar getchar +#define _gettchar_nolock _getchar_nolock +#define _getts gets +#define _cgetts _cgets +#define _puttc putc +#define _puttc_nolock _putc_nolock +#define _puttchar putchar +#define _puttchar_nolock _putchar_nolock +#define _puttch _putch +#define _puttch_nolock _putch_nolock +#define _putts puts +#define _ungettc ungetc +#define _ungettc_nolock _ungetc_nolock +#define _ungettch _ungetch +#define _ungettch_nolock _ungetch_nolock + +#define _tcstod strtod +#define _tcstol strtol +#define _tcstoul strtoul +#define _tstof atof +#define _tstol atol +#define _tstoi atoi +#define _tstoi64 _atoi64 +#define _tcstod_l _strtod_l +#define _tcstol_l _strtol_l +#define _tcstoul_l _strtoul_l +#define _tstof_l _atof_l +#define _tstol_l _atol_l +#define _tstoi_l _atoi_l +#define _tstoi64_l _atoi64_l + +#define _itot _itoa +#define _ltot _ltoa +#define _ultot _ultoa +#define _ttoi atoi +#define _ttol atol + +#define _ttoi64 _atoi64 +#define _tcstoi64 _strtoi64 +#define _tcstoi64_l _strtoi64_l +#define _tcstoui64 _strtoui64 +#define _tcstoui64_l _strtoui64_l +#define _i64tot _i64toa +#define _ui64tot _ui64toa + +#define _tcscat strcat +#define _tcscpy strcpy +#define _tcsdup _strdup +#define _tcslen strlen +#if 0 +#define _tcsnlen strnlen +#endif +#define _tcsxfrm strxfrm +#define _tcsxfrm_l _strxfrm_l +#define _tcserror strerror +#define __tcserror _strerror + +#define _texecl _execl +#define _texecle _execle +#define _texeclp _execlp +#define _texeclpe _execlpe +#define _texecv _execv +#define _texecve _execve +#define _texecvp _execvp +#define _texecvpe _execvpe + +#define _tspawnl _spawnl +#define _tspawnle _spawnle +#define _tspawnlp _spawnlp +#define _tspawnlpe _spawnlpe +#define _tspawnv _spawnv +#define _tspawnve _spawnve +#define _tspawnvp _spawnvp +#define _tspawnvpe _spawnvpe + +#define _tsystem system + +#define _tasctime asctime +#define _tctime ctime +#define _tctime32 _ctime32 +#define _tctime64 _ctime64 +#define _tstrdate _strdate +#define _tstrtime _strtime +#define _tutime _utime +#define _tutime32 _utime32 +#define _tutime64 _utime64 +#define _tcsftime strftime +#define _tcsftime_l _strftime_l + +#define _tchdir _chdir +#define _tgetcwd _getcwd +#define _tgetdcwd _getdcwd +#define _tgetdcwd_nolock _getdcwd_nolock +#define _tmkdir _mkdir +#define _trmdir _rmdir + +#define _tfullpath _fullpath +#define _tgetenv getenv +#define _tmakepath _makepath +#define _tpgmptr _pgmptr +#define _get_tpgmptr _get_pgmptr +#define _tputenv _putenv +#define _tsearchenv _searchenv +#define _tsplitpath _splitpath + +#ifdef _POSIX_ +#define _tfdopen fdopen +#else +#define _tfdopen _fdopen +#endif +#define _tfsopen _fsopen +#define _tfopen fopen +#define _tfreopen freopen +#define _tperror perror +#define _tpopen _popen +#define _ttempnam _tempnam +#define _ttmpnam tmpnam + +#define _tchmod _chmod +#define _tcreat _creat +#define _tfindfirst _findfirst +#define _tfindfirst32 _findfirst32 +#define _tfindfirst64 _findfirst64 +#define _tfindfirsti64 _findfirsti64 +#define _tfindfirst32i64 _findfirst32i64 +#define _tfindfirst64i32 _findfirst64i32 +#define _tfindnext _findnext +#define _tfindnext32 _findnext32 +#define _tfindnext64 _findnext64 +#define _tfindnexti64 _findnexti64 +#define _tfindnext32i64 _findnext32i64 +#define _tfindnext64i32 _findnext64i32 +#define _tmktemp _mktemp + +#ifdef _POSIX_ +#define _topen open +#define _taccess access +#else +#define _topen _open +#define _taccess _access +#endif + +#define _tremove remove +#define _trename rename +#define _tsopen _sopen +#define _tunlink _unlink + +#define _tfinddata_t _finddata_t +#define _tfinddata32_t _finddata32_t +#define _tfinddata64_t __finddata64_t +#define _tfinddatai64_t _finddatai64_t +#define _tfinddata32i64_t _finddata32i64_t +#define _tfinddata64i32_t _finddata64i32_t + +#define _istascii __isascii +#define _istcntrl iscntrl +#define _istcntrl_l _iscntrl_l +#define _istxdigit isxdigit +#define _istxdigit_l _isxdigit_l + +#define _tstat _stat +#define _tstat32 _stat32 +#define _tstat32i64 _stat32i64 +#define _tstat64 _stat64 +#define _tstat64i32 _stat64i32 +#define _tstati64 _stati64 + +#define _tsetlocale setlocale + +#ifdef _MBCS + +#ifdef __cplusplus +} +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __TCHAR_DEFINED + typedef char _TCHAR; + typedef signed char _TSCHAR; + typedef unsigned char _TUCHAR; + typedef unsigned char _TXCHAR; + typedef unsigned int _TINT; +#define __TCHAR_DEFINED +#endif + +#ifndef _TCHAR_DEFINED +#ifndef NO_OLDNAMES + typedef char TCHAR; +#endif +#define _TCHAR_DEFINED +#endif + +#ifdef _MB_MAP_DIRECT + +#define _tcschr _mbschr +#define _tcscspn _mbscspn +#define _tcsncat _mbsnbcat +#define _tcsncat_l _mbsnbcat_l +#define _tcsncpy _mbsnbcpy +#define _tcsncpy_l _mbsnbcpy_l +#define _tcspbrk _mbspbrk +#define _tcsrchr _mbsrchr +#define _tcsspn _mbsspn +#define _tcsstr _mbsstr +#define _tcstok _mbstok +#define _tcstok_l _mbstok_l + +#define _tcsnset _mbsnbset +#define _tcsnset_l _mbsnbset_l +#define _tcsrev _mbsrev +#define _tcsset _mbsset +#define _tcsset_l _mbsset_l + +#define _tcscmp _mbscmp +#define _tcsicmp _mbsicmp +#define _tcsicmp_l _mbsicmp_l +#define _tcsnccmp _mbsncmp +#define _tcsncmp _mbsnbcmp +#define _tcsncicmp _mbsnicmp +#define _tcsncicmp_l _mbsnicmp_l +#define _tcsnicmp _mbsnbicmp +#define _tcsnicmp_l _mbsnbicmp_l + +#define _tcscoll _mbscoll +#define _tcscoll_l _mbscoll_l +#define _tcsicoll _mbsicoll +#define _tcsicoll_l _mbsicoll_l +#define _tcsnccoll _mbsncoll +#define _tcsnccoll_l _mbsncoll_l +#define _tcsncoll _mbsnbcoll +#define _tcsncoll_l _mbsnbcoll_l +#define _tcsncicoll _mbsnicoll +#define _tcsncicoll_l _mbsnicoll_l +#define _tcsnicoll _mbsnbicoll +#define _tcsnicoll_l _mbsnbicoll_l + +#define _tcsclen _mbslen +#define _tcscnlen _mbsnlen +#define _tcsclen_l _mbslen_l +#define _tcscnlen_l _mbsnlen_l +#define _tcsnccat _mbsncat +#define _tcsnccat_l _mbsncat_l +#define _tcsnccpy _mbsncpy +#define _tcsnccpy_l _mbsncpy_l +#define _tcsncset _mbsnset +#define _tcsncset_l _mbsnset_l + +#define _tcsdec _mbsdec +#define _tcsinc _mbsinc +#define _tcsnbcnt _mbsnbcnt +#define _tcsnccnt _mbsnccnt +#define _tcsnextc _mbsnextc +#define _tcsninc _mbsninc +#define _tcsspnp _mbsspnp + +#define _tcslwr _mbslwr +#define _tcslwr_l _mbslwr_l +#define _tcsupr _mbsupr +#define _tcsupr_l _mbsupr_l + +#define _tclen _mbclen +#define _tccpy _mbccpy +#define _tccpy_l _mbccpy_l +#else + + _CRTIMP _CONST_RETURN char *__cdecl _tcschr(const char *_Str,unsigned int _Val); + _CRTIMP size_t __cdecl _tcscspn(const char *_Str,const char *_Control); + _CRTIMP char *__cdecl _tcsncat(char *_Dst,const char *_Src,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsncat_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsncpy(char *_Dst,const char *_Src,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsncpy_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP _CONST_RETURN char *__cdecl _tcspbrk(const char *_Str,const char *_Control); + _CRTIMP _CONST_RETURN char *__cdecl _tcsrchr(const char *_Str,unsigned int _Ch); + _CRTIMP size_t __cdecl _tcsspn(const char *_Str,const char *_Control); + _CRTIMP _CONST_RETURN char *__cdecl _tcsstr(const char *_Str,const char *_Substr); + _CRTIMP char *__cdecl _tcstok(char *_Str,const char *_Delim); + _CRTIMP char *__cdecl _tcstok_l(char *_Str,const char *_Delim,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsnset(char *_Str,unsigned int _Val,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsrev(char *_Str); + _CRTIMP char *__cdecl _tcsset(char *_Str,unsigned int _Val); + _CRTIMP char *__cdecl _tcsset_l(char *_Str,unsigned int _Val,_locale_t _Locale); + _CRTIMP int __cdecl _tcscmp(const char *_Str1,const char *_Str); + _CRTIMP int __cdecl _tcsicmp(const char *_Str1,const char *_Str2); + _CRTIMP int __cdecl _tcsicmp_l(const char *_Str1,const char *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _tcsnccmp(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _tcsncmp(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _tcsncicmp(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _tcsncicmp_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _tcsnicmp(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _tcsnicmp_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _tcscoll(const char *_Str1,const char *_Str2); + _CRTIMP int __cdecl _tcscoll_l(const char *_Str1,const char *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _tcsicoll(const char *_Str1,const char *_Str2); + _CRTIMP int __cdecl _tcsicoll_l(const char *_Str1,const char *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _tcsnccoll(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _tcsnccoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _tcsncoll(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _tcsncoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _tcsncicoll(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _tcsncicoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _tcsnicoll(const char *_Str1,const char *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _tcsnicoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP size_t __cdecl _tcsclen(const char *_Str); + _CRTIMP size_t __cdecl _tcscnlen(const char *_Str,size_t _MaxCount); + _CRTIMP size_t __cdecl _tcsclen_l(const char *_Str,_locale_t _Locale); + _CRTIMP size_t __cdecl _tcscnlen_l(const char *_Str,size_t _MaxCount,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsnccat(char *_Dst,const char *_Src,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsnccat_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsnccpy(char *_Dst,const char *_Src,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsnccpy_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsncset(char *_Str,unsigned int _Val,size_t _MaxCount); + _CRTIMP char *__cdecl _tcsdec(const char *_Start,const char *_Pos); + _CRTIMP char *__cdecl _tcsinc(const char *_Ptr); + _CRTIMP size_t __cdecl _tcsnbcnt(const char *_Str,size_t _MaxCount); + _CRTIMP size_t __cdecl _tcsnccnt(const char *_Str,size_t _MaxCount); + _CRTIMP unsigned int __cdecl _tcsnextc (const char *_Str); + _CRTIMP char *__cdecl _tcsninc(const char *_Ptr,size_t _Count); + _CRTIMP char *__cdecl _tcsspnp(const char *_Str1,const char *_Str2); + _CRTIMP char *__cdecl _tcslwr(char *_Str); + _CRTIMP char *__cdecl _tcslwr_l(char *_Str,_locale_t _Locale); + _CRTIMP char *__cdecl _tcsupr(char *_Str); + _CRTIMP char *__cdecl _tcsupr_l(char *_Str,_locale_t _Locale); + _CRTIMP size_t __cdecl _tclen(const char *_Str); + _CRTIMP void __cdecl _tccpy(char *_DstCh,const char *_SrcCh); + +#ifdef __cplusplus +#ifndef _CPP_TCHAR_INLINES_DEFINED +#define _CPP_TCHAR_INLINES_DEFINED + extern "C++" { + extern inline char *__cdecl _tcschr(char *_S,unsigned int _C) { return ((char *)_tcschr((const char *)_S,_C)); } + extern inline char *__cdecl _tcspbrk(char *_S,const char *_P) { return ((char *)_tcspbrk((const char *)_S,_P)); } + extern inline char *__cdecl _tcsrchr(char *_S,unsigned int _C) { return ((char *)_tcsrchr((const char *)_S,_C)); } + extern inline char *__cdecl _tcsstr(char *_S,const char *_P) { return ((char *)_tcsstr((const char *)_S,_P)); } + } +#endif +#endif +#endif + +#define _tccmp(_cp1,_cp2) _tcsnccmp(_cp1,_cp2,1) + +#define _istalnum _ismbcalnum +#define _istalnum_l _ismbcalnum_l +#define _istalpha _ismbcalpha +#define _istalpha_l _ismbcalpha_l +#define _istdigit _ismbcdigit +#define _istdigit_l _ismbcdigit_l +#define _istgraph _ismbcgraph +#define _istgraph_l _ismbcgraph_l +#define _istlegal _ismbclegal +#define _istlegal_l _ismbclegal_l +#define _istlower _ismbclower +#define _istlower_l _ismbclower_l +#define _istprint _ismbcprint +#define _istprint_l _ismbcprint_l +#define _istpunct _ismbcpunct +#define _istpunct_l _ismbcpunct_l +#define _istspace _ismbcspace +#define _istspace_l _ismbcspace_l +#define _istupper _ismbcupper +#define _istupper_l _ismbcupper_l + +#define _totupper _mbctoupper +#define _totupper_l _mbctoupper_l +#define _totlower _mbctolower +#define _totlower_l _mbctolower_l + +#define _istlead _ismbblead +#define _istleadbyte isleadbyte +#define _istleadbyte_l _isleadbyte_l +#else + +#ifndef __TCHAR_DEFINED +#define __TCHAR_DEFINED + typedef char _TCHAR; + typedef signed char _TSCHAR; + typedef unsigned char _TUCHAR; + typedef char _TXCHAR; + typedef int _TINT; +#endif + +#ifndef _TCHAR_DEFINED +#define _TCHAR_DEFINED +#ifndef NO_OLDNAMES + typedef char TCHAR; +#endif +#endif + +#define _tcschr strchr +#define _tcscspn strcspn +#define _tcsncat strncat +#define _tcsncat_l _strncat_l +#define _tcsncpy strncpy +#define _tcsncpy_l _strncpy_l +#define _tcspbrk strpbrk +#define _tcsrchr strrchr +#define _tcsspn strspn +#define _tcsstr strstr +#define _tcstok strtok +#define _tcstok_l _strtok_l + +#define _tcsnset _strnset +#define _tcsnset_l _strnset_l +#define _tcsrev _strrev +#define _tcsset _strset + +#define _tcscmp strcmp +#define _tcsicmp _stricmp +#define _tcsicmp_l _stricmp_l +#define _tcsnccmp strncmp +#define _tcsncmp strncmp +#define _tcsncicmp _strnicmp +#define _tcsncicmp_l _strnicmp_l +#define _tcsnicmp _strnicmp +#define _tcsnicmp_l _strnicmp_l + +#define _tcscoll strcoll +#define _tcscoll_l _strcoll_l +#define _tcsicoll _stricoll +#define _tcsicoll_l _stricoll_l +#define _tcsnccoll _strncoll +#define _tcsnccoll_l _strncoll_l +#define _tcsncoll _strncoll +#define _tcsncoll_l _strncoll_l +#define _tcsncicoll _strnicoll +#define _tcsncicoll_l _strnicoll_l +#define _tcsnicoll _strnicoll +#define _tcsnicoll_l _strnicoll_l + +#define _tcsclen strlen +#define _tcscnlen strnlen +#define _tcsclen_l(_String,_Locale) strlen(_String) +#define _tcscnlen_l(_String,_Max_count,_Locale) strnlen_l((_String),(_Max_count)) +#define _tcsnccat strncat +#define _tcsnccat_l _strncat_l +#define _tcsnccpy strncpy +#define _tcsnccpy_l _strncpy_l +#define _tcsncset _strnset + +#define _tcsdec _strdec +#define _tcsinc _strinc +#define _tcsnbcnt _strncnt +#define _tcsnccnt _strncnt +#define _tcsnextc _strnextc +#define _tcsninc _strninc +#define _tcsspnp _strspnp + +#define _tcslwr _strlwr +#define _tcslwr_l _strlwr_l +#define _tcsupr _strupr +#define _tcsupr_l _strupr_l +#define _tcsxfrm strxfrm +#define _tcsxfrm_l _strxfrm_l + +#define _istlead(_Char) (0) +#define _istleadbyte(_Char) (0) +#define _istleadbyte_l(_Char,_Locale) (0) + +#define _tclen(_pc) (1) +#define _tccpy(_pc1,_cpc2) (*(_pc1) = *(_cpc2)) +#define _tccmp(_cpc1,_cpc2) (((unsigned char)*(_cpc1))-((unsigned char)*(_cpc2))) + + /* dirent structures and functions */ +#define _tdirent dirent +#define _TDIR DIR +#define _topendir opendir +#define _tclosedir closedir +#define _treaddir readdir +#define _trewinddir rewinddir +#define _ttelldir telldir +#define _tseekdir seekdir + +#define _istalnum isalnum +#define _istalnum_l _isalnum_l +#define _istalpha isalpha +#define _istalpha_l _isalpha_l +#define _istdigit isdigit +#define _istdigit_l _isdigit_l +#define _istgraph isgraph +#define _istgraph_l _isgraph_l +#define _istlower islower +#define _istlower_l _islower_l +#define _istprint isprint +#define _istprint_l _isprint_l +#define _istpunct ispunct +#define _istpunct_l _ispunct_l +#define _istspace isspace +#define _istspace_l _isspace_l +#define _istupper isupper +#define _istupper_l _isupper_l + +#define _totupper toupper +#define _totupper_l _toupper_l +#define _totlower tolower +#define _totlower_l _tolower_l + +#define _istlegal(_c) (1) + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +#define _strdec(_cpc1,_cpc2) ((_cpc1)>=(_cpc2) ? NULL : (_cpc2)-1) +#define _strinc(_pc) ((_pc)+1) +#define _strnextc(_cpc) ((unsigned int) *(const unsigned char *)(_cpc)) +#define _strninc(_pc,_sz) (((_pc)+(_sz))) + _CRTIMP size_t __cdecl __strncnt(const char *_Str,size_t _Cnt); +#define _strncnt(_cpc,_sz) (__strncnt(_cpc,_sz)) +#define _strspnp(_cpc1,_cpc2) (!_cpc1 ? NULL : ((*((_cpc1)+strspn(_cpc1,_cpc2))) ? ((_cpc1)+strspn(_cpc1,_cpc2)) : NULL)) + +#define _strncpy_l(_Destination,_Source,_Count,_Locale) (strncpy(_Destination,_Source,_Count)) +#define _strncat_l(_Destination,_Source,_Count,_Locale) (strncat(_Destination,_Source,_Count)) +#define _strtok_l(_String,_Delimiters,_Locale) (strtok(_String,_Delimiters)) +#define _strnset_l(_Destination,_Value,_Count,_Locale) (_strnset(_Destination,_Value,_Count)) +#define _strset_l(_Destination,_Value,_Locale) (_strset(_Destination,_Value)) +#endif +#endif + +#define _T(x) __T(x) +#define _TEXT(x) __T(x) + +#ifdef __cplusplus +} +#endif + +#include +#endif Index: include/crt/time.h =================================================================== --- include/crt/time.h (Revision 37928) +++ include/crt/time.h (Arbeitskopie) @@ -1,219 +1,263 @@ -/* - * time.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Date and time functions and types. - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ +#ifndef _TIME_H_ +#define _TIME_H_ -#ifndef _TIME_H_ -#define _TIME_H_ - -/* All the headers include this file. */ #include <_mingw.h> -#define __need_wchar_t -#define __need_size_t -#define __need_NULL -#ifndef RC_INVOKED -#include -#endif /* Not RC_INVOKED */ +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif -/* - * Number of clock ticks per second. A clock tick is the unit by which - * processor time is measured and is returned by 'clock'. - */ -#define CLOCKS_PER_SEC ((clock_t)1000) -#define CLK_TCK CLOCKS_PER_SEC +#pragma pack(push,_CRT_PACKING) +#ifdef __cplusplus +extern "C" { +#endif -#ifndef RC_INVOKED +#ifndef _CRTIMP +#define _CRTIMP __declspec(dllimport) +#endif -/* - * A type for storing the current time and date. This is the number of - * seconds since midnight Jan 1, 1970. - * NOTE: This is also defined in non-ISO sys/types.h. - */ -#ifndef _TIME_T_DEFINED -typedef long time_t; -#define _TIME_T_DEFINED +#ifndef _WCHAR_T_DEFINED +#define _WCHAR_T_DEFINED + typedef unsigned short wchar_t; #endif -#ifndef __STRICT_ANSI__ -/* A 64-bit time_t to get to Y3K */ +#ifndef _TIME32_T_DEFINED +#define _TIME32_T_DEFINED + typedef long __time32_t; +#endif + #ifndef _TIME64_T_DEFINED -typedef __int64 __time64_t; #define _TIME64_T_DEFINED +#if _INTEGRAL_MAX_BITS >= 64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef int _time64_t __attribute__ ((mode (DI))); +#else + typedef __int64 __time64_t; #endif #endif -/* - * A type for measuring processor time (in clock ticks). - */ +#endif + +#ifndef _TIME_T_DEFINED +#define _TIME_T_DEFINED +#ifdef _USE_32BIT_TIME_T + typedef __time32_t time_t; +#else + typedef __time64_t time_t; +#endif +#endif + #ifndef _CLOCK_T_DEFINED -typedef long clock_t; #define _CLOCK_T_DEFINED + typedef long clock_t; #endif -#ifndef _TM_DEFINED -/* - * A structure for storing all kinds of useful information about the - * current (or another) time. - */ -struct tm -{ - int tm_sec; /* Seconds: 0-59 (K&R says 0-61?) */ - int tm_min; /* Minutes: 0-59 */ - int tm_hour; /* Hours since midnight: 0-23 */ - int tm_mday; /* Day of the month: 1-31 */ - int tm_mon; /* Months *since* january: 0-11 */ - int tm_year; /* Years since 1900 */ - int tm_wday; /* Days since Sunday (0-6) */ - int tm_yday; /* Days since Jan. 1: 0-365 */ - int tm_isdst; /* +1 Daylight Savings Time, 0 No DST, - * -1 don't know */ -}; -#define _TM_DEFINED +#ifndef _SIZE_T_DEFINED +#define _SIZE_T_DEFINED +#undef size_t +#ifdef _WIN64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef unsigned int size_t __attribute__ ((mode (DI))); +#else + typedef unsigned __int64 size_t; #endif +#else + typedef unsigned int size_t; +#endif +#endif -#ifdef __cplusplus -extern "C" { +#ifndef _SSIZE_T_DEFINED +#define _SSIZE_T_DEFINED +#undef ssize_t +#ifdef _WIN64 +#if defined(__GNUC__) && defined(__STRICT_ANSI__) + typedef int ssize_t __attribute__ ((mode (DI))); +#else + typedef __int64 ssize_t; #endif +#else + typedef int ssize_t; +#endif +#endif -_CRTIMP clock_t __cdecl __MINGW_NOTHROW clock (void); -_CRTIMP time_t __cdecl __MINGW_NOTHROW time (time_t*); -_CRTIMP double __cdecl __MINGW_NOTHROW difftime (time_t, time_t); -_CRTIMP time_t __cdecl __MINGW_NOTHROW mktime (struct tm*); +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif /* - * These functions write to and return pointers to static buffers that may - * be overwritten by other function calls. Yikes! - * - * NOTE: localtime, and perhaps the others of the four functions grouped - * below may return NULL if their argument is not 'acceptable'. Also note - * that calling asctime with a NULL pointer will produce an Invalid Page - * Fault and crap out your program. Guess how I know. Hint: stat called on - * a directory gives 'invalid' times in st_atime etc... - */ -_CRTIMP char* __cdecl __MINGW_NOTHROW asctime (const struct tm*); -_CRTIMP char* __cdecl __MINGW_NOTHROW ctime (const time_t*); -_CRTIMP struct tm* __cdecl __MINGW_NOTHROW gmtime (const time_t*); -_CRTIMP struct tm* __cdecl __MINGW_NOTHROW localtime (const time_t*); +#ifdef _USE_32BIT_TIME_T +#define _localtime32 localtime +#define _difftime32 difftime +#define _ctime32 ctime +#define _gmtime32 gmtime +#define _mktime32 mktime +#define _time32 time +#endif +*/ -_CRTIMP size_t __cdecl __MINGW_NOTHROW strftime (char*, size_t, const char*, const struct tm*); +#ifndef _TM_DEFINED +#define _TM_DEFINED + struct tm { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + }; +#endif -#ifndef __STRICT_ANSI__ +#define CLOCKS_PER_SEC 1000 -extern _CRTIMP void __cdecl __MINGW_NOTHROW _tzset (void); + __MINGW_IMPORT int _daylight; + __MINGW_IMPORT long _dstbias; + __MINGW_IMPORT long _timezone; + __MINGW_IMPORT char * _tzname[2]; -#ifndef _NO_OLDNAMES -extern _CRTIMP void __cdecl __MINGW_NOTHROW tzset (void); + _CRTIMP errno_t __cdecl _get_daylight(int *_Daylight); + _CRTIMP errno_t __cdecl _get_dstbias(long *_Daylight_savings_bias); + _CRTIMP errno_t __cdecl _get_timezone(long *_Timezone); + _CRTIMP errno_t __cdecl _get_tzname(size_t *_ReturnValue,char *_Buffer,size_t _SizeInBytes,int _Index); + char *__cdecl asctime(const struct tm *_Tm); + _CRTIMP char *__cdecl _ctime32(const __time32_t *_Time); + clock_t __cdecl clock(void); + _CRTIMP double __cdecl _difftime32(__time32_t _Time1,__time32_t _Time2); + _CRTIMP struct tm *__cdecl _gmtime32(const __time32_t *_Time); + _CRTIMP struct tm *__cdecl _localtime32(const __time32_t *_Time); + size_t __cdecl strftime(char *_Buf,size_t _SizeInBytes,const char *_Format,const struct tm *_Tm); + _CRTIMP size_t __cdecl _strftime_l(char *_Buf,size_t _Max_size,const char *_Format,const struct tm *_Tm,_locale_t _Locale); + _CRTIMP char *__cdecl _strdate(char *_Buffer); + _CRTIMP char *__cdecl _strtime(char *_Buffer); + _CRTIMP __time32_t __cdecl _time32(__time32_t *_Time); + _CRTIMP __time32_t __cdecl _mktime32(struct tm *_Tm); + _CRTIMP __time32_t __cdecl _mkgmtime32(struct tm *_Tm); +#if defined (_POSIX_) || defined(__GNUC__) + void __cdecl tzset(void); +#else + _CRTIMP void __cdecl _tzset(void); #endif -_CRTIMP char* __cdecl __MINGW_NOTHROW _strdate(char*); -_CRTIMP char* __cdecl __MINGW_NOTHROW _strtime(char*); +#if _INTEGRAL_MAX_BITS >= 64 + double __cdecl _difftime64(__time64_t _Time1,__time64_t _Time2); + _CRTIMP char *__cdecl _ctime64(const __time64_t *_Time); + _CRTIMP struct tm *__cdecl _gmtime64(const __time64_t *_Time); + _CRTIMP struct tm *__cdecl _localtime64(const __time64_t *_Time); + _CRTIMP __time64_t __cdecl _mktime64(struct tm *_Tm); + _CRTIMP __time64_t __cdecl _mkgmtime64(struct tm *_Tm); + _CRTIMP __time64_t __cdecl _time64(__time64_t *_Time); +#endif + unsigned __cdecl _getsystime(struct tm *_Tm); + unsigned __cdecl _setsystime(struct tm *_Tm,unsigned _MilliSec); -/* These require newer versions of msvcrt.dll (6.10 or higher). */ -#if __MSVCRT_VERSION__ >= 0x0601 -_CRTIMP __time64_t __cdecl __MINGW_NOTHROW _time64( __time64_t*); -_CRTIMP __time64_t __cdecl __MINGW_NOTHROW _mktime64 (struct tm*); -_CRTIMP char* __cdecl __MINGW_NOTHROW _ctime64 (const __time64_t*); -_CRTIMP struct tm* __cdecl __MINGW_NOTHROW _gmtime64 (const __time64_t*); -_CRTIMP struct tm* __cdecl __MINGW_NOTHROW _localtime64 (const __time64_t*); -#endif /* __MSVCRT_VERSION__ >= 0x0601 */ +#ifndef _WTIME_DEFINED + _CRTIMP wchar_t *__cdecl _wasctime(const struct tm *_Tm); + _CRTIMP wchar_t *__cdecl _wctime32(const __time32_t *_Time); + size_t __cdecl wcsftime(wchar_t *_Buf,size_t _SizeInWords,const wchar_t *_Format,const struct tm *_Tm); + _CRTIMP size_t __cdecl _wcsftime_l(wchar_t *_Buf,size_t _SizeInWords,const wchar_t *_Format,const struct tm *_Tm,_locale_t _Locale); + _CRTIMP wchar_t *__cdecl _wstrdate(wchar_t *_Buffer); + _CRTIMP wchar_t *__cdecl _wstrtime(wchar_t *_Buffer); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP wchar_t *__cdecl _wctime64(const __time64_t *_Time); +#endif -/* - * _daylight: non zero if daylight savings time is used. - * _timezone: difference in seconds between GMT and local time. - * _tzname: standard/daylight savings time zone names (an array with two - * elements). - */ -#ifdef __MSVCRT__ +#if !defined (RC_INVOKED) && !defined (_INC_WTIME_INL) +#define _INC_WTIME_INL +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime32(_Time); } +#else +__CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime64(_Time); } +#endif +#endif -/* These are for compatibility with pre-VC 5.0 suppied MSVCRT. */ -extern _CRTIMP int* __cdecl __MINGW_NOTHROW __p__daylight (void); -extern _CRTIMP long* __cdecl __MINGW_NOTHROW __p__timezone (void); -extern _CRTIMP char** __cdecl __MINGW_NOTHROW __p__tzname (void); +#define _WTIME_DEFINED +#endif -__MINGW_IMPORT int _daylight; -__MINGW_IMPORT long _timezone; -__MINGW_IMPORT char *_tzname[2]; +#ifndef RC_INVOKED +double __cdecl difftime(time_t _Time1,time_t _Time2); +char *__cdecl ctime(const time_t *_Time); +struct tm *__cdecl gmtime(const time_t *_Time); +struct tm *__cdecl localtime(const time_t *_Time); +struct tm *__cdecl localtime_r(const time_t *_Time,struct tm *); -#else /* not __MSVCRT (ie. crtdll) */ +_CRTIMP time_t __cdecl mktime(struct tm *_Tm); +_CRTIMP time_t __cdecl _mkgmtime(struct tm *_Tm); +_CRTIMP time_t __cdecl time(time_t *_Time); -#ifndef __DECLSPEC_SUPPORTED +#ifdef _USE_32BIT_TIME_T +#if 0 +__CRT_INLINE double __cdecl difftime(time_t _Time1,time_t _Time2) { return _difftime32(_Time1,_Time2); } +__CRT_INLINE char *__cdecl ctime(const time_t *_Time) { return _ctime32(_Time); } +__CRT_INLINE struct tm *__cdecl gmtime(const time_t *_Time) { return _gmtime32(_Time); } +__CRT_INLINE struct tm *__cdecl localtime(const time_t *_Time) { return _localtime32(_Time); } +__CRT_INLINE time_t __cdecl mktime(struct tm *_Tm) { return _mktime32(_Tm); } +__CRT_INLINE time_t __cdecl _mkgmtime(struct tm *_Tm) { return _mkgmtime32(_Tm); } +__CRT_INLINE time_t __cdecl time(time_t *_Time) { return _time32(_Time); } +#endif +#else +__CRT_INLINE double __cdecl difftime(time_t _Time1,time_t _Time2) { return _difftime64(_Time1,_Time2); } +__CRT_INLINE char *__cdecl ctime(const time_t *_Time) { return _ctime64(_Time); } +__CRT_INLINE struct tm *__cdecl gmtime(const time_t *_Time) { return _gmtime64(_Time); } +__CRT_INLINE struct tm *__cdecl localtime(const time_t *_Time) { return _localtime64(_Time); } +__CRT_INLINE time_t __cdecl mktime(struct tm *_Tm) { return _mktime64(_Tm); } +__CRT_INLINE time_t __cdecl _mkgmtime(struct tm *_Tm) { return _mkgmtime64(_Tm); } +__CRT_INLINE time_t __cdecl time(time_t *_Time) { return _time64(_Time); } +#endif +#endif -extern int* _imp___daylight_dll; -extern long* _imp___timezone_dll; -extern char** _imp___tzname; +#if !defined(NO_OLDNAMES) || defined(_POSIX) +#define CLK_TCK CLOCKS_PER_SEC -#define _daylight (*_imp___daylight_dll) -#define _timezone (*_imp___timezone_dll) -#define _tzname (*_imp___tzname) + _CRTIMP extern int daylight; + _CRTIMP extern long timezone; + _CRTIMP extern char *tzname[2]; + void __cdecl tzset(void); +#endif -#else /* __DECLSPEC_SUPPORTED */ +#ifndef _TIMEVAL_DEFINED /* also in winsock[2].h */ +#define _TIMEVAL_DEFINED +struct timeval { + long tv_sec; + long tv_usec; +}; +#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) +#define timercmp(tvp,uvp,cmp) ((tvp)->tv_sec cmp (uvp)->tv_sec || (tvp)->tv_sec==(uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec) +#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 +#endif /* _TIMEVAL_DEFINED */ -__MINGW_IMPORT int _daylight_dll; -__MINGW_IMPORT long _timezone_dll; -__MINGW_IMPORT char* _tzname[2]; +#ifndef __STRICT_ANSI__ +#ifndef _TIMEZONE_DEFINED /* also in sys/time.h */ +#define _TIMEZONE_DEFINED +struct timezone { + int tz_minuteswest; + int tz_dsttime; +}; -#define _daylight _daylight_dll -#define _timezone _timezone_dll - -#endif /* __DECLSPEC_SUPPORTED */ - -#endif /* not __MSVCRT__ */ - -#ifndef _NO_OLDNAMES - -#ifdef __MSVCRT__ - -/* These go in the oldnames import library for MSVCRT. */ -__MINGW_IMPORT int daylight; -__MINGW_IMPORT long timezone; -__MINGW_IMPORT char *tzname[2]; - -#else /* not __MSVCRT__ */ - -/* CRTDLL is royally messed up when it comes to these macros. - TODO: import and alias these via oldnames import library instead - of macros. */ - -#define daylight _daylight -/* NOTE: timezone not defined as macro because it would conflict with - struct timezone in sys/time.h. - Also, tzname used to a be macro, but now it's in moldname. */ -__MINGW_IMPORT char *tzname[2]; - -#endif /* not __MSVCRT__ */ - -#endif /* Not _NO_OLDNAMES */ -#endif /* Not __STRICT_ANSI__ */ - -#ifndef _WTIME_DEFINED -/* wide function prototypes, also declared in wchar.h */ -#ifndef __STRICT_ANSI__ -#ifdef __MSVCRT__ -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wasctime(const struct tm*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wctime(const time_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wstrdate(wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wstrtime(wchar_t*); -#if __MSVCRT_VERSION__ >= 0x0601 -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wctime64 (const __time64_t*); + extern int __cdecl mingw_gettimeofday (struct timeval *p, struct timezone *z); #endif -#endif /* __MSVCRT__ */ #endif /* __STRICT_ANSI__ */ -_CRTIMP size_t __cdecl __MINGW_NOTHROW wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*); -#define _WTIME_DEFINED -#endif /* _WTIME_DEFINED */ -#ifdef __cplusplus +#ifdef __cplusplus } #endif -#endif /* Not RC_INVOKED */ +#pragma pack(pop) -#endif /* Not _TIME_H_ */ +#include +/* Adding timespec definition. */ +#include +#endif /* End _TIME_H_ */ + Index: include/crt/unistd.h =================================================================== --- include/crt/unistd.h (Revision 37928) +++ include/crt/unistd.h (Arbeitskopie) @@ -1,3 +1,8 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ /* * This file is part of the Mingw32 package. * @@ -4,8 +9,7 @@ * unistd.h maps (roughly) to io.h */ -#ifndef _UNISTD_H -#define _UNISTD_H +#ifndef __STRICT_ANSI__ #include #include @@ -14,24 +18,12 @@ #include #undef __UNISTD_GETOPT__ -/* These are also defined in stdio.h. */ -#ifndef SEEK_SET -#define SEEK_SET 0 -#endif - -#ifndef SEEK_CUR -#define SEEK_CUR 1 -#endif - -#ifndef SEEK_END -#define SEEK_END 2 -#endif - #ifdef __cplusplus extern "C" { #endif - +#ifndef FTRUNCATE_DEFINED +#define FTRUNCATE_DEFINED /* This is defined as a real library function to allow autoconf to verify its existence. */ int ftruncate(int, off_t); @@ -39,9 +31,10 @@ { return _chsize (__fd, __length); } +#endif #ifdef __cplusplus } #endif -#endif /* _UNISTD_H */ +#endif Index: include/crt/utime.h =================================================================== --- include/crt/utime.h (Revision 37928) +++ include/crt/utime.h (Arbeitskopie) @@ -1 +1,6 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. + */ #include Index: include/crt/wchar.h =================================================================== --- include/crt/wchar.h (Revision 37928) +++ include/crt/wchar.h (Arbeitskopie) @@ -1,427 +1,433 @@ -/* - * wchar.h +/** * This file has no copyright assigned and is placed in the Public Domain. - * This file is a part of the mingw-runtime package. - * No warranty is given; refer to the file DISCLAIMER within the package. - * - * Defines of all functions for supporting wide characters. Actually it - * just includes all those headers, which is not a good thing to do from a - * processing time point of view, but it does mean that everything will be - * in sync. - * + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ +#ifndef _INC_WCHAR +#define _INC_WCHAR -#ifndef _WCHAR_H_ -#define _WCHAR_H_ - -/* All the headers include this file. */ #include <_mingw.h> -#ifndef RC_INVOKED +#pragma pack(push,_CRT_PACKING) -#define __need_size_t -#define __need_wint_t -#define __need_wchar_t -#define __need_NULL -#include +#ifdef __cplusplus +extern "C" { +#endif -#ifndef __VALIST -#if defined __GNUC__ && __GNUC__ >= 3 -#define __need___va_list -#include -#define __VALIST __builtin_va_list -#else -#define __VALIST char* +#ifndef WCHAR_MIN +#define WCHAR_MIN 0 #endif +#ifndef WCHAR_MAX +#define WCHAR_MAX ((wchar_t)-1) /* UINT16_MAX */ #endif -#endif /* Not RC_INVOKED */ +#ifndef __GNUC_VA_LIST +#define __GNUC_VA_LIST + typedef __builtin_va_list __gnuc_va_list; +#endif -/* - * MSDN says that isw* char classifications are in wchar.h and wctype.h. - * Although the wctype names are ANSI, their exposure in this header is - * not. - */ -#include +#ifndef _VA_LIST_DEFINED +#define _VA_LIST_DEFINED + typedef __gnuc_va_list va_list; +#endif -#ifndef __STRICT_ANSI__ -/* This is necessary to support the the non-ANSI wchar declarations - here. */ -#include -#endif /* __STRICT_ANSI__ */ - -#define WCHAR_MIN 0 -#define WCHAR_MAX 0xffff - #ifndef WEOF -#define WEOF (wchar_t)(0xFFFF) +#define WEOF (wint_t)(0xFFFF) #endif -#ifndef RC_INVOKED +#ifndef _FILE_DEFINED + struct _iobuf { + char *_ptr; + int _cnt; + char *_base; + int _flag; + int _file; + int _charbuf; + int _bufsiz; + char *_tmpfname; + }; + typedef struct _iobuf FILE; +#define _FILE_DEFINED +#endif -#ifdef __cplusplus -extern "C" { +#ifndef _STDIO_DEFINED +#ifdef _WIN64 + _CRTIMP FILE *__cdecl __iob_func(void); +#else +#ifdef _MSVCRT_ +extern FILE _iob[]; /* A pointer to an array of FILE */ +#define __iob_func() (_iob) +#else +extern FILE (*_imp___iob)[]; /* A pointer to an array of FILE */ +#define __iob_func() (*_imp___iob) +#define _iob __iob_func() #endif +#endif -#ifndef _FILE_DEFINED /* Also in stdio.h */ -#define _FILE_DEFINED -typedef struct _iobuf -{ - char* _ptr; - int _cnt; - char* _base; - int _flag; - int _file; - int _charbuf; - int _bufsiz; - char* _tmpfname; -} FILE; -#endif /* Not _FILE_DEFINED */ +#define _iob __iob_func() +#endif -#ifndef _TIME_T_DEFINED /* Also in time.h */ -typedef long time_t; -#define _TIME_T_DEFINED +#ifndef _STDSTREAM_DEFINED +#define stdin (&__iob_func()[0]) +#define stdout (&__iob_func()[1]) +#define stderr (&__iob_func()[2]) +#define _STDSTREAM_DEFINED #endif -#ifndef _TM_DEFINED /* Also in time.h */ -struct tm { - int tm_sec; /* seconds after the minute - [0,59] */ - int tm_min; /* minutes after the hour - [0,59] */ - int tm_hour; /* hours since midnight - [0,23] */ - int tm_mday; /* day of the month - [1,31] */ - int tm_mon; /* months since January - [0,11] */ - int tm_year; /* years since 1900 */ - int tm_wday; /* days since Sunday - [0,6] */ - int tm_yday; /* days since January 1 - [0,365] */ - int tm_isdst; /* daylight savings time flag */ - }; -#define _TM_DEFINED +#ifndef _FSIZE_T_DEFINED + typedef unsigned long _fsize_t; +#define _FSIZE_T_DEFINED #endif -#ifndef _WSTDIO_DEFINED -/* Also in stdio.h - keep in sync */ -_CRTIMP int __cdecl __MINGW_NOTHROW fwprintf (FILE*, const wchar_t*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW wprintf (const wchar_t*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW swprintf (wchar_t*, const wchar_t*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW _snwprintf (wchar_t*, size_t, const wchar_t*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW vfwprintf (FILE*, const wchar_t*, __VALIST); -_CRTIMP int __cdecl __MINGW_NOTHROW vwprintf (const wchar_t*, __VALIST); -_CRTIMP int __cdecl __MINGW_NOTHROW vswprintf (wchar_t*, const wchar_t*, __VALIST); -_CRTIMP int __cdecl __MINGW_NOTHROW _vsnwprintf (wchar_t*, size_t, const wchar_t*, __VALIST); -_CRTIMP int __cdecl __MINGW_NOTHROW fwscanf (FILE*, const wchar_t*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW wscanf (const wchar_t*, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW swscanf (const wchar_t*, const wchar_t*, ...); -_CRTIMP wint_t __cdecl __MINGW_NOTHROW fgetwc (FILE*); -_CRTIMP wint_t __cdecl __MINGW_NOTHROW fputwc (wchar_t, FILE*); -_CRTIMP wint_t __cdecl __MINGW_NOTHROW ungetwc (wchar_t, FILE*); +#ifndef _WFINDDATA_T_DEFINED + struct _wfinddata32_t { + unsigned attrib; + __time32_t time_create; + __time32_t time_access; + __time32_t time_write; + _fsize_t size; + wchar_t name[260]; + }; -#ifdef __MSVCRT__ -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW fgetws (wchar_t*, int, FILE*); -_CRTIMP int __cdecl __MINGW_NOTHROW fputws (const wchar_t*, FILE*); -_CRTIMP wint_t __cdecl __MINGW_NOTHROW getwc (FILE*); -_CRTIMP wint_t __cdecl __MINGW_NOTHROW getwchar (void); -_CRTIMP wint_t __cdecl __MINGW_NOTHROW putwc (wint_t, FILE*); -_CRTIMP wint_t __cdecl __MINGW_NOTHROW putwchar (wint_t); -#ifndef __STRICT_ANSI__ -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _getws (wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _putws (const wchar_t*); -_CRTIMP FILE* __cdecl __MINGW_NOTHROW _wfdopen(int, wchar_t *); -_CRTIMP FILE* __cdecl __MINGW_NOTHROW _wfopen (const wchar_t*, const wchar_t*); -_CRTIMP FILE* __cdecl __MINGW_NOTHROW _wfreopen (const wchar_t*, const wchar_t*, FILE*); -_CRTIMP FILE* __cdecl __MINGW_NOTHROW _wfsopen (const wchar_t*, const wchar_t*, int); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wtmpnam (wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wtempnam (const wchar_t*, const wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wrename (const wchar_t*, const wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wremove (const wchar_t*); -_CRTIMP void __cdecl __MINGW_NOTHROW _wperror (const wchar_t*); -_CRTIMP FILE* __cdecl __MINGW_NOTHROW _wpopen (const wchar_t*, const wchar_t*); -#endif /* __STRICT_ANSI__ */ -#endif /* __MSVCRT__ */ +/* #if _INTEGRAL_MAX_BITS >= 64 */ -#ifndef __NO_ISOCEXT /* externs in libmingwex.a */ -int __cdecl __MINGW_NOTHROW snwprintf (wchar_t* s, size_t n, const wchar_t* format, ...); -__CRT_INLINE int __cdecl __MINGW_NOTHROW -vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, __VALIST arg) - { return _vsnwprintf ( s, n, format, arg);} -int __cdecl __MINGW_NOTHROW vwscanf (const wchar_t * __restrict__, __VALIST); -int __cdecl __MINGW_NOTHROW vfwscanf (FILE * __restrict__, - const wchar_t * __restrict__, __VALIST); -int __cdecl __MINGW_NOTHROW vswscanf (const wchar_t * __restrict__, - const wchar_t * __restrict__, __VALIST); + struct _wfinddata32i64_t { + unsigned attrib; + __time32_t time_create; + __time32_t time_access; + __time32_t time_write; + __int64 size; + wchar_t name[260]; + }; + + struct _wfinddata64i32_t { + unsigned attrib; + __time64_t time_create; + __time64_t time_access; + __time64_t time_write; + _fsize_t size; + wchar_t name[260]; + }; + + struct _wfinddata64_t { + unsigned attrib; + __time64_t time_create; + __time64_t time_access; + __time64_t time_write; + __int64 size; + wchar_t name[260]; + }; +/* #endif */ + +#ifdef _USE_32BIT_TIME_T +#define _wfinddata_t _wfinddata32_t +#define _wfinddatai64_t _wfinddata32i64_t + +#define _wfindfirst _wfindfirst32 +#define _wfindnext _wfindnext32 +#define _wfindfirsti64 _wfindfirst32i64 +#define _wfindnexti64 _wfindnext32i64 +#else +#define _wfinddata_t _wfinddata64i32_t +#define _wfinddatai64_t _wfinddata64_t + +#define _wfindfirst _wfindfirst64i32 +#define _wfindnext _wfindnext64i32 +#define _wfindfirsti64 _wfindfirst64 +#define _wfindnexti64 _wfindnext64 #endif -#define _WSTDIO_DEFINED -#endif /* _WSTDIO_DEFINED */ -#ifndef _WSTDLIB_DEFINED /* also declared in stdlib.h */ -_CRTIMP long __cdecl __MINGW_NOTHROW wcstol (const wchar_t*, wchar_t**, int); -_CRTIMP unsigned long __cdecl __MINGW_NOTHROW wcstoul (const wchar_t*, wchar_t**, int); -_CRTIMP double __cdecl __MINGW_NOTHROW wcstod (const wchar_t*, wchar_t**); -#if !defined __NO_ISOCEXT /* in libmingwex.a */ -float __cdecl __MINGW_NOTHROW wcstof (const wchar_t * __restrict__, wchar_t ** __restrict__); -long double __cdecl __MINGW_NOTHROW wcstold (const wchar_t * __restrict__, wchar_t ** __restrict__); -#endif /* __NO_ISOCEXT */ -#ifdef __MSVCRT__ -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wgetenv(const wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wputenv(const wchar_t*); -_CRTIMP void __cdecl __MINGW_NOTHROW _wsearchenv(const wchar_t*, const wchar_t*, wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wsystem(const wchar_t*); -_CRTIMP void __cdecl __MINGW_NOTHROW _wmakepath(wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*); -_CRTIMP void __cdecl __MINGW_NOTHROW _wsplitpath (const wchar_t*, wchar_t*, wchar_t*, wchar_t*, wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wfullpath (wchar_t*, const wchar_t*, size_t); +#define _WFINDDATA_T_DEFINED #endif -#define _WSTDLIB_DEFINED -#endif /* _WSTDLIB_DEFINED */ -#ifndef _WTIME_DEFINED -#ifndef __STRICT_ANSI__ -#ifdef __MSVCRT__ -/* wide function prototypes, also declared in time.h */ -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wasctime (const struct tm*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wctime (const time_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wstrdate (wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wstrtime (wchar_t*); -#if __MSVCRT_VERSION__ >= 0x601 -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wctime64 (const __time64_t*); +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) #endif -#endif /* __MSVCRT__ */ -#endif /* __STRICT_ANSI__ */ -_CRTIMP size_t __cdecl __MINGW_NOTHROW wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*); -#define _WTIME_DEFINED -#endif /* _WTIME_DEFINED */ +#endif +#ifndef _CONST_RETURN +#define _CONST_RETURN +#endif -#ifndef _WSTRING_DEFINED -/* - * Unicode versions of the standard string calls. - * Also in string.h. - */ -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcscat (wchar_t*, const wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcschr (const wchar_t*, wchar_t); -_CRTIMP int __cdecl __MINGW_NOTHROW wcscmp (const wchar_t*, const wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW wcscoll (const wchar_t*, const wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcscpy (wchar_t*, const wchar_t*); -_CRTIMP size_t __cdecl __MINGW_NOTHROW wcscspn (const wchar_t*, const wchar_t*); -/* Note: _wcserror requires __MSVCRT_VERSION__ >= 0x0700. */ -_CRTIMP size_t __cdecl __MINGW_NOTHROW wcslen (const wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsncat (wchar_t*, const wchar_t*, size_t); -_CRTIMP int __cdecl __MINGW_NOTHROW wcsncmp(const wchar_t*, const wchar_t*, size_t); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsncpy(wchar_t*, const wchar_t*, size_t); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcspbrk(const wchar_t*, const wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsrchr(const wchar_t*, wchar_t); -_CRTIMP size_t __cdecl __MINGW_NOTHROW wcsspn(const wchar_t*, const wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsstr(const wchar_t*, const wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcstok(wchar_t*, const wchar_t*); -_CRTIMP size_t __cdecl __MINGW_NOTHROW wcsxfrm(wchar_t*, const wchar_t*, size_t); +#define _WConst_return _CONST_RETURN -#ifndef __STRICT_ANSI__ -/* - * Unicode versions of non-ANSI functions provided by CRTDLL. - */ +#ifndef _CRT_CTYPEDATA_DEFINED +#define _CRT_CTYPEDATA_DEFINED +#ifndef _CTYPE_DISABLE_MACROS -/* NOTE: _wcscmpi not provided by CRTDLL, this define is for portability */ -#define _wcscmpi _wcsicmp +#ifndef __PCTYPE_FUNC +#define __PCTYPE_FUNC __pctype_func() +#ifdef _MSVCRT_ +#define __pctype_func() (_pctype) +#else +#define __pctype_func() (*_imp___pctype) +#endif +#endif -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcsdup (const wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wcsicmp (const wchar_t*, const wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wcsicoll (const wchar_t*, const wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcslwr (wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wcsnicmp (const wchar_t*, const wchar_t*, size_t); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcsnset (wchar_t*, wchar_t, size_t); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcsrev (wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcsset (wchar_t*, wchar_t); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcsupr (wchar_t*); +#ifndef _pctype +#ifdef _MSVCRT_ + extern unsigned short *_pctype; +#else + extern unsigned short **_imp___pctype; +#define _pctype (*_imp___pctype) +#endif +#endif +#endif +#endif -#ifdef __MSVCRT__ -_CRTIMP int __cdecl __MINGW_NOTHROW _wcsncoll(const wchar_t*, const wchar_t*, size_t); -_CRTIMP int __cdecl __MINGW_NOTHROW _wcsnicoll(const wchar_t*, const wchar_t*, size_t); -#if __MSVCRT_VERSION__ >= 0x0700 -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wcserror(int); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW __wcserror(const wchar_t*); +#ifndef _CRT_WCTYPEDATA_DEFINED +#define _CRT_WCTYPEDATA_DEFINED +#ifndef _CTYPE_DISABLE_MACROS +#ifndef _wctype +#ifdef _MSVCRT_ + extern unsigned short *_wctype; +#else + extern unsigned short **_imp___wctype; +#define _wctype (*_imp___wctype) #endif #endif -#ifndef _NO_OLDNAMES -/* NOTE: There is no _wcscmpi, but this is for compatibility. */ -__CRT_INLINE int __cdecl __MINGW_NOTHROW -wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2) - {return _wcsicmp (__ws1, __ws2);} -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsdup (const wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW wcsicmp (const wchar_t*, const wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW wcsicoll (const wchar_t*, const wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcslwr (wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW wcsnicmp (const wchar_t*, const wchar_t*, size_t); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsnset (wchar_t*, wchar_t, size_t); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsrev (wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsset (wchar_t*, wchar_t); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsupr (wchar_t*); -#endif /* Not _NO_OLDNAMES */ +#ifdef _MSVCRT_ +#define __pwctype_func() (_pwctype) +#else +#define __pwctype_func() (*_imp___pwctype) +#endif -#endif /* Not strict ANSI */ +#ifndef _pwctype +#ifdef _MSVCRT_ + extern unsigned short *_pwctype; +#else + extern unsigned short **_imp___pwctype; +#define _pwctype (*_imp___pwctype) +#endif +#endif -#define _WSTRING_DEFINED -#endif /* _WSTRING_DEFINED */ - -/* These are resolved by -lmingwex. Alternatively, they can be resolved by - adding -lmsvcp60 to your command line, which will give you the VC++ - versions of these functions. If you want the latter and don't have - msvcp60.dll in your windows system directory, you can easily obtain - it with a search from your favorite search engine. */ -#ifndef __STRICT_ANSI__ -typedef wchar_t _Wint_t; #endif +#endif -typedef int mbstate_t; +#define _UPPER 0x1 +#define _LOWER 0x2 +#define _DIGIT 0x4 +#define _SPACE 0x8 -wint_t __cdecl __MINGW_NOTHROW btowc(int); -size_t __cdecl __MINGW_NOTHROW mbrlen(const char * __restrict__, size_t, - mbstate_t * __restrict__); -size_t __cdecl __MINGW_NOTHROW mbrtowc(wchar_t * __restrict__, const char * __restrict__, - size_t, mbstate_t * __restrict__); -size_t __cdecl __MINGW_NOTHROW mbsrtowcs(wchar_t * __restrict__, const char ** __restrict__, - size_t, mbstate_t * __restrict__); -size_t __cdecl __MINGW_NOTHROW wcrtomb(char * __restrict__, wchar_t, - mbstate_t * __restrict__); -size_t __cdecl __MINGW_NOTHROW wcsrtombs(char * __restrict__, const wchar_t ** __restrict__, - size_t, mbstate_t * __restrict__); -int __cdecl __MINGW_NOTHROW wctob(wint_t); +#define _PUNCT 0x10 +#define _CONTROL 0x20 +#define _BLANK 0x40 +#define _HEX 0x80 -#ifndef __NO_ISOCEXT /* these need static lib libmingwex.a */ -__CRT_INLINE int __cdecl __MINGW_NOTHROW fwide(FILE* __UNUSED_PARAM(stream), - int __UNUSED_PARAM(mode)) - {return -1;} /* limited to byte orientation */ -__CRT_INLINE int __cdecl __MINGW_NOTHROW mbsinit(const mbstate_t* __UNUSED_PARAM(ps)) - {return 1;} -wchar_t* __cdecl __MINGW_NOTHROW wmemset(wchar_t *, wchar_t, size_t); -wchar_t* __cdecl __MINGW_NOTHROW wmemchr(const wchar_t*, wchar_t, size_t); -int wmemcmp(const wchar_t*, const wchar_t *, size_t); -wchar_t* __cdecl __MINGW_NOTHROW wmemcpy(wchar_t* __restrict__, - const wchar_t* __restrict__, - size_t); -wchar_t* __cdecl __MINGW_NOTHROW wmemmove(wchar_t* s1, const wchar_t *, size_t); -long long __cdecl __MINGW_NOTHROW wcstoll(const wchar_t * __restrict__, - wchar_t** __restrict__, int); -unsigned long long __cdecl __MINGW_NOTHROW wcstoull(const wchar_t * __restrict__, - wchar_t ** __restrict__, int); -#endif /* __NO_ISOCEXT */ +#define _LEADBYTE 0x8000 +#define _ALPHA (0x0100|_UPPER|_LOWER) -#ifndef __STRICT_ANSI__ -/* non-ANSI wide char functions from io.h, direct.h, sys/stat.h and locale.h. */ +#ifndef _WCTYPE_DEFINED +#define _WCTYPE_DEFINED -#ifndef _FSIZE_T_DEFINED -typedef unsigned long _fsize_t; -#define _FSIZE_T_DEFINED + int __cdecl iswalpha(wint_t _C); + _CRTIMP int __cdecl _iswalpha_l(wint_t _C,_locale_t _Locale); + int __cdecl iswupper(wint_t _C); + _CRTIMP int __cdecl _iswupper_l(wint_t _C,_locale_t _Locale); + int __cdecl iswlower(wint_t _C); + _CRTIMP int __cdecl _iswlower_l(wint_t _C,_locale_t _Locale); + int __cdecl iswdigit(wint_t _C); + _CRTIMP int __cdecl _iswdigit_l(wint_t _C,_locale_t _Locale); + int __cdecl iswxdigit(wint_t _C); + _CRTIMP int __cdecl _iswxdigit_l(wint_t _C,_locale_t _Locale); + int __cdecl iswspace(wint_t _C); + _CRTIMP int __cdecl _iswspace_l(wint_t _C,_locale_t _Locale); + int __cdecl iswpunct(wint_t _C); + _CRTIMP int __cdecl _iswpunct_l(wint_t _C,_locale_t _Locale); + int __cdecl iswalnum(wint_t _C); + _CRTIMP int __cdecl _iswalnum_l(wint_t _C,_locale_t _Locale); + int __cdecl iswprint(wint_t _C); + _CRTIMP int __cdecl _iswprint_l(wint_t _C,_locale_t _Locale); + int __cdecl iswgraph(wint_t _C); + _CRTIMP int __cdecl _iswgraph_l(wint_t _C,_locale_t _Locale); + int __cdecl iswcntrl(wint_t _C); + _CRTIMP int __cdecl _iswcntrl_l(wint_t _C,_locale_t _Locale); + int __cdecl iswascii(wint_t _C); + int __cdecl isleadbyte(int _C); + _CRTIMP int __cdecl _isleadbyte_l(int _C,_locale_t _Locale); + wint_t __cdecl towupper(wint_t _C); + _CRTIMP wint_t __cdecl _towupper_l(wint_t _C,_locale_t _Locale); + wint_t __cdecl towlower(wint_t _C); + _CRTIMP wint_t __cdecl _towlower_l(wint_t _C,_locale_t _Locale); + int __cdecl iswctype(wint_t _C,wctype_t _Type); + _CRTIMP int __cdecl _iswctype_l(wint_t _C,wctype_t _Type,_locale_t _Locale); + _CRTIMP int __cdecl __iswcsymf(wint_t _C); + _CRTIMP int __cdecl _iswcsymf_l(wint_t _C,_locale_t _Locale); + _CRTIMP int __cdecl __iswcsym(wint_t _C); + _CRTIMP int __cdecl _iswcsym_l(wint_t _C,_locale_t _Locale); + int __cdecl is_wctype(wint_t _C,wctype_t _Type); #endif -#ifndef _WFINDDATA_T_DEFINED -struct _wfinddata_t { - unsigned attrib; - time_t time_create; /* -1 for FAT file systems */ - time_t time_access; /* -1 for FAT file systems */ - time_t time_write; - _fsize_t size; - wchar_t name[260]; /* may include spaces. */ -}; -struct _wfinddatai64_t { - unsigned attrib; - time_t time_create; - time_t time_access; - time_t time_write; - __int64 size; - wchar_t name[260]; -}; -struct __wfinddata64_t { - unsigned attrib; - __time64_t time_create; - __time64_t time_access; - __time64_t time_write; - _fsize_t size; - wchar_t name[260]; -}; -#define _WFINDDATA_T_DEFINED +#ifndef _WDIRECT_DEFINED +#define _WDIRECT_DEFINED + + _CRTIMP wchar_t *__cdecl _wgetcwd(wchar_t *_DstBuf,int _SizeInWords); + _CRTIMP wchar_t *__cdecl _wgetdcwd(int _Drive,wchar_t *_DstBuf,int _SizeInWords); + wchar_t *__cdecl _wgetdcwd_nolock(int _Drive,wchar_t *_DstBuf,int _SizeInWords); + _CRTIMP int __cdecl _wchdir(const wchar_t *_Path); + _CRTIMP int __cdecl _wmkdir(const wchar_t *_Path); + _CRTIMP int __cdecl _wrmdir(const wchar_t *_Path); #endif -/* Wide character versions. Also defined in io.h. */ -/* CHECK: I believe these only exist in MSVCRT, and not in CRTDLL. Also - applies to other wide character versions? */ -#if !defined (_WIO_DEFINED) -#if defined (__MSVCRT__) -#include /* For intptr_t. */ -_CRTIMP int __cdecl __MINGW_NOTHROW _waccess (const wchar_t*, int); -_CRTIMP int __cdecl __MINGW_NOTHROW _wchmod (const wchar_t*, int); -_CRTIMP int __cdecl __MINGW_NOTHROW _wcreat (const wchar_t*, int); -_CRTIMP long __cdecl __MINGW_NOTHROW _wfindfirst (const wchar_t*, struct _wfinddata_t *); -_CRTIMP int __cdecl __MINGW_NOTHROW _wfindnext (long, struct _wfinddata_t *); -_CRTIMP int __cdecl __MINGW_NOTHROW _wunlink (const wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wopen (const wchar_t*, int, ...); -_CRTIMP int __cdecl __MINGW_NOTHROW _wsopen (const wchar_t*, int, int, ...); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wmktemp (wchar_t*); -_CRTIMP long __cdecl __MINGW_NOTHROW _wfindfirsti64 (const wchar_t*, struct _wfinddatai64_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wfindnexti64 (long, struct _wfinddatai64_t*); -#if __MSVCRT_VERSION__ >= 0x0601 -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindfirst64(const wchar_t*, struct __wfinddata64_t*); -_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wfindnext64(intptr_t, struct __wfinddata64_t*); -#endif /* __MSVCRT_VERSION__ >= 0x0601 */ -#endif /* defined (__MSVCRT__) */ +#ifndef _WIO_DEFINED #define _WIO_DEFINED -#endif /* _WIO_DEFINED */ -#ifndef _WDIRECT_DEFINED -/* Also in direct.h */ -#ifdef __MSVCRT__ -_CRTIMP int __cdecl __MINGW_NOTHROW _wchdir (const wchar_t*); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wgetcwd (wchar_t*, int); -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wgetdcwd (int, wchar_t*, int); -_CRTIMP int __cdecl __MINGW_NOTHROW _wmkdir (const wchar_t*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wrmdir (const wchar_t*); -#endif /* __MSVCRT__ */ -#define _WDIRECT_DEFINED -#endif /* _WDIRECT_DEFINED */ + _CRTIMP int __cdecl _waccess(const wchar_t *_Filename,int _AccessMode); + _CRTIMP int __cdecl _wchmod(const wchar_t *_Filename,int _Mode); + _CRTIMP int __cdecl _wcreat(const wchar_t *_Filename,int _PermissionMode); + _CRTIMP intptr_t __cdecl _wfindfirst32(const wchar_t *_Filename,struct _wfinddata32_t *_FindData); + _CRTIMP int __cdecl _wfindnext32(intptr_t _FindHandle,struct _wfinddata32_t *_FindData); + _CRTIMP int __cdecl _wunlink(const wchar_t *_Filename); + _CRTIMP int __cdecl _wrename(const wchar_t *_NewFilename,const wchar_t *_OldFilename); + _CRTIMP wchar_t *__cdecl _wmktemp(wchar_t *_TemplateName); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP intptr_t __cdecl _wfindfirst32i64(const wchar_t *_Filename,struct _wfinddata32i64_t *_FindData); + intptr_t __cdecl _wfindfirst64i32(const wchar_t *_Filename,struct _wfinddata64i32_t *_FindData); + _CRTIMP intptr_t __cdecl _wfindfirst64(const wchar_t *_Filename,struct _wfinddata64_t *_FindData); + _CRTIMP int __cdecl _wfindnext32i64(intptr_t _FindHandle,struct _wfinddata32i64_t *_FindData); + int __cdecl _wfindnext64i32(intptr_t _FindHandle,struct _wfinddata64i32_t *_FindData); + _CRTIMP int __cdecl _wfindnext64(intptr_t _FindHandle,struct _wfinddata64_t *_FindData); +#endif + _CRTIMP errno_t __cdecl _wsopen_s(int *_FileHandle,const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionFlag); +#if !defined(__cplusplus) || !(defined(_X86_) && !defined(__x86_64)) + _CRTIMP int __cdecl _wopen(const wchar_t *_Filename,int _OpenFlag,...); + _CRTIMP int __cdecl _wsopen(const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,...); +#else + extern "C++" _CRTIMP int __cdecl _wopen(const wchar_t *_Filename,int _OpenFlag,int _PermissionMode = 0); + extern "C++" _CRTIMP int __cdecl _wsopen(const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,int _PermissionMode = 0); +#endif +#endif +#ifndef _WLOCALE_DEFINED +#define _WLOCALE_DEFINED + _CRTIMP wchar_t *__cdecl _wsetlocale(int _Category,const wchar_t *_Locale); +#endif + +#ifndef _WPROCESS_DEFINED +#define _WPROCESS_DEFINED + + _CRTIMP intptr_t __cdecl _wexecl(const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wexecle(const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wexeclp(const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wexeclpe(const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wexecv(const wchar_t *_Filename,const wchar_t *const *_ArgList); + _CRTIMP intptr_t __cdecl _wexecve(const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); + _CRTIMP intptr_t __cdecl _wexecvp(const wchar_t *_Filename,const wchar_t *const *_ArgList); + _CRTIMP intptr_t __cdecl _wexecvpe(const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); + _CRTIMP intptr_t __cdecl _wspawnl(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wspawnle(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wspawnlp(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wspawnlpe(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); + _CRTIMP intptr_t __cdecl _wspawnv(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList); + _CRTIMP intptr_t __cdecl _wspawnve(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); + _CRTIMP intptr_t __cdecl _wspawnvp(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList); + _CRTIMP intptr_t __cdecl _wspawnvpe(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); +#ifndef _CRT_WSYSTEM_DEFINED +#define _CRT_WSYSTEM_DEFINED + _CRTIMP int __cdecl _wsystem(const wchar_t *_Command); +#endif +#endif + +#ifndef _WCTYPE_INLINE_DEFINED +#undef _CRT_WCTYPE_NOINLINE +#if !defined(__cplusplus) || defined(_CRT_WCTYPE_NOINLINE) +#define iswalpha(_c) (iswctype(_c,_ALPHA)) +#define iswupper(_c) (iswctype(_c,_UPPER)) +#define iswlower(_c) (iswctype(_c,_LOWER)) +#define iswdigit(_c) (iswctype(_c,_DIGIT)) +#define iswxdigit(_c) (iswctype(_c,_HEX)) +#define iswspace(_c) (iswctype(_c,_SPACE)) +#define iswpunct(_c) (iswctype(_c,_PUNCT)) +#define iswalnum(_c) (iswctype(_c,_ALPHA|_DIGIT)) +#define iswprint(_c) (iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT)) +#define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT)) +#define iswcntrl(_c) (iswctype(_c,_CONTROL)) +#define iswascii(_c) ((unsigned)(_c) < 0x80) + +#define _iswalpha_l(_c,_p) (_iswctype_l(_c,_ALPHA,_p)) +#define _iswupper_l(_c,_p) (_iswctype_l(_c,_UPPER,_p)) +#define _iswlower_l(_c,_p) (_iswctype_l(_c,_LOWER,_p)) +#define _iswdigit_l(_c,_p) (_iswctype_l(_c,_DIGIT,_p)) +#define _iswxdigit_l(_c,_p) (_iswctype_l(_c,_HEX,_p)) +#define _iswspace_l(_c,_p) (_iswctype_l(_c,_SPACE,_p)) +#define _iswpunct_l(_c,_p) (_iswctype_l(_c,_PUNCT,_p)) +#define _iswalnum_l(_c,_p) (_iswctype_l(_c,_ALPHA|_DIGIT,_p)) +#define _iswprint_l(_c,_p) (_iswctype_l(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT,_p)) +#define _iswgraph_l(_c,_p) (_iswctype_l(_c,_PUNCT|_ALPHA|_DIGIT,_p)) +#define _iswcntrl_l(_c,_p) (_iswctype_l(_c,_CONTROL,_p)) +#ifndef _CTYPE_DISABLE_MACROS +#define isleadbyte(_c) (__PCTYPE_FUNC[(unsigned char)(_c)] & _LEADBYTE) +#endif +#endif +#define _WCTYPE_INLINE_DEFINED +#endif + +#if !defined(_POSIX_) || defined(__GNUC__) +#ifndef _INO_T_DEFINED +#define _INO_T_DEFINED + typedef unsigned short _ino_t; +#ifndef NO_OLDNAMES + typedef unsigned short ino_t; +#endif +#endif + +#ifndef _DEV_T_DEFINED +#define _DEV_T_DEFINED + typedef unsigned int _dev_t; +#ifndef NO_OLDNAMES + typedef unsigned int dev_t; +#endif +#endif + +#ifndef _OFF_T_DEFINED +#define _OFF_T_DEFINED +#ifndef _OFF_T_ +#define _OFF_T_ + typedef long _off_t; +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef long off_t; +#endif +#endif +#endif + +#ifndef _OFF64_T_DEFINED +#define _OFF64_T_DEFINED + typedef long long _off64_t; +#if !defined(NO_OLDNAMES) || defined(_POSIX) + typedef long long off64_t; +#endif +#endif + #ifndef _STAT_DEFINED -/* - * The structure manipulated and returned by stat and fstat. - * - * NOTE: If called on a directory the values in the time fields are not only - * invalid, they will cause localtime et. al. to return NULL. And calling - * asctime with a NULL pointer causes an Invalid Page Fault. So watch it! - */ -struct _stat -{ - _dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */ - _ino_t st_ino; /* Always zero ? */ - _mode_t st_mode; /* See above constants */ - short st_nlink; /* Number of links. */ - short st_uid; /* User: Maybe significant on NT ? */ - short st_gid; /* Group: Ditto */ - _dev_t st_rdev; /* Seems useless (not even filled in) */ - _off_t st_size; /* File size in bytes */ - time_t st_atime; /* Accessed date (always 00:00 hrs local - * on FAT) */ - time_t st_mtime; /* Modified time */ - time_t st_ctime; /* Creation time */ -}; +#define _STAT_DEFINED -#ifndef _NO_OLDNAMES -/* NOTE: Must be the same as _stat above. */ -struct stat -{ - _dev_t st_dev; /* Equivalent to drive number 0=A 1=B ... */ - _ino_t st_ino; /* Always zero ? */ - _mode_t st_mode; /* See above constants */ - short st_nlink; /* Number of links. */ - short st_uid; /* User: Maybe significant on NT ? */ - short st_gid; /* Group: Ditto */ - _dev_t st_rdev; /* Seems useless (not even filled in) */ - _off_t st_size; /* File size in bytes */ - time_t st_atime; /* Accessed date (always 00:00 hrs local - * on FAT) */ - time_t st_mtime; /* Modified time */ - time_t st_ctime; /* Creation time */ -}; -#endif /* _NO_OLDNAMES */ +#ifdef _USE_32BIT_TIME_T +#ifdef WIN64 +#define _fstat _fstat32 +#define _stat _stat32 +#define _wstat _wstat32 +#else +#define _fstat32 _fstat +#define _stat32 _stat +#define _wstat32 _wstat +#endif +#define _fstati64 _fstat32i64 +#define _stati64 _stat32i64 +#define _wstati64 _wstat32i64 +#else +#define _fstat _fstat64i32 +#define _fstati64 _fstat64 +#define _stat _stat64i32 +#define _stati64 _stat64 +#define _wstat _wstat64i32 +#define _wstati64 _wstat64 +#endif -#if defined (__MSVCRT__) -struct _stati64 { + struct _stat32 { _dev_t st_dev; _ino_t st_ino; unsigned short st_mode; @@ -429,55 +435,446 @@ short st_uid; short st_gid; _dev_t st_rdev; - __int64 st_size; + _off_t st_size; + __time32_t st_atime; + __time32_t st_mtime; + __time32_t st_ctime; + }; + +#ifndef NO_OLDNAMES + struct stat { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + _off_t st_size; time_t st_atime; time_t st_mtime; time_t st_ctime; - }; + }; +#endif -struct __stat64 -{ +/* #if _INTEGRAL_MAX_BITS >= 64 */ + + struct _stat32i64 { _dev_t st_dev; _ino_t st_ino; - _mode_t st_mode; + unsigned short st_mode; short st_nlink; short st_uid; short st_gid; _dev_t st_rdev; __int64 st_size; + __time32_t st_atime; + __time32_t st_mtime; + __time32_t st_ctime; + }; + + struct _stat64i32 { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + _off_t st_size; __time64_t st_atime; __time64_t st_mtime; __time64_t st_ctime; -}; -#endif /* __MSVCRT__ */ -#define _STAT_DEFINED -#endif /* _STAT_DEFINED */ + }; -#if !defined ( _WSTAT_DEFINED) -/* also declared in sys/stat.h */ -#if defined __MSVCRT__ -_CRTIMP int __cdecl __MINGW_NOTHROW _wstat (const wchar_t*, struct _stat*); -_CRTIMP int __cdecl __MINGW_NOTHROW _wstati64 (const wchar_t*, struct _stati64*); -#if __MSVCRT_VERSION__ >= 0x0601 -_CRTIMP int __cdecl __MINGW_NOTHROW _wstat64 (const wchar_t*, struct __stat64*); -#endif /* __MSVCRT_VERSION__ >= 0x0601 */ -#endif /* __MSVCRT__ */ + struct _stat64 { + _dev_t st_dev; + _ino_t st_ino; + unsigned short st_mode; + short st_nlink; + short st_uid; + short st_gid; + _dev_t st_rdev; + __int64 st_size; + __time64_t st_atime; + __time64_t st_mtime; + __time64_t st_ctime; + }; +/* #endif */ + +#define __stat64 _stat64 + +#endif + +#ifndef _WSTAT_DEFINED #define _WSTAT_DEFINED -#endif /* ! _WSTAT_DEFIND */ -#ifndef _WLOCALE_DEFINED /* also declared in locale.h */ -_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wsetlocale (int, const wchar_t*); -#define _WLOCALE_DEFINED + _CRTIMP int __cdecl _wstat32(const wchar_t *_Name,struct _stat32 *_Stat); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP int __cdecl _wstat32i64(const wchar_t *_Name,struct _stat32i64 *_Stat); + int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat); + _CRTIMP int __cdecl _wstat64(const wchar_t *_Name,struct _stat64 *_Stat); #endif +#endif +#endif -#endif /* not __STRICT_ANSI__ */ +#ifndef _WCONIO_DEFINED +#define _WCONIO_DEFINED -#ifdef __cplusplus -} /* end of extern "C" */ +#ifndef WEOF +#define WEOF (wint_t)(0xFFFF) #endif -#endif /* Not RC_INVOKED */ + _CRTIMP wchar_t *_cgetws(wchar_t *_Buffer); + _CRTIMP wint_t __cdecl _getwch(void); + _CRTIMP wint_t __cdecl _getwche(void); + _CRTIMP wint_t __cdecl _putwch(wchar_t _WCh); + _CRTIMP wint_t __cdecl _ungetwch(wint_t _WCh); + _CRTIMP int __cdecl _cputws(const wchar_t *_String); + _CRTIMP int __cdecl _cwprintf(const wchar_t *_Format,...); + _CRTIMP int __cdecl _cwscanf(const wchar_t *_Format,...); + _CRTIMP int __cdecl _cwscanf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _cwprintf_p(const wchar_t *_Format,...); + _CRTIMP int __cdecl _vcwprintf_p(const wchar_t *_Format,va_list _ArgList); -#endif /* not _WCHAR_H_ */ + _CRTIMP int __cdecl _cwprintf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _cwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vcwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + wint_t __cdecl _putwch_nolock(wchar_t _WCh); + wint_t __cdecl _getwch_nolock(void); + wint_t __cdecl _getwche_nolock(void); + wint_t __cdecl _ungetwch_nolock(wint_t _WCh); +#endif +#ifndef _WSTDIO_DEFINED +#define _WSTDIO_DEFINED +#ifndef WEOF +#define WEOF (wint_t)(0xFFFF) +#endif + +#ifdef _POSIX_ + _CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode); +#else + _CRTIMP FILE *__cdecl _wfsopen(const wchar_t *_Filename,const wchar_t *_Mode,int _ShFlag); +#endif + + wint_t __cdecl fgetwc(FILE *_File); + _CRTIMP wint_t __cdecl _fgetwchar(void); + wint_t __cdecl fputwc(wchar_t _Ch,FILE *_File); + _CRTIMP wint_t __cdecl _fputwchar(wchar_t _Ch); + wint_t __cdecl getwc(FILE *_File); + wint_t __cdecl getwchar(void); + wint_t __cdecl putwc(wchar_t _Ch,FILE *_File); + wint_t __cdecl putwchar(wchar_t _Ch); + wint_t __cdecl ungetwc(wint_t _Ch,FILE *_File); + wchar_t *__cdecl fgetws(wchar_t *_Dst,int _SizeInWords,FILE *_File); + int __cdecl fputws(const wchar_t *_Str,FILE *_File); + _CRTIMP wchar_t *__cdecl _getws(wchar_t *_String); + _CRTIMP int __cdecl _putws(const wchar_t *_Str); + int __cdecl fwprintf(FILE *_File,const wchar_t *_Format,...); + int __cdecl wprintf(const wchar_t *_Format,...); + _CRTIMP int __cdecl _scwprintf(const wchar_t *_Format,...); + int __cdecl vfwprintf(FILE *_File,const wchar_t *_Format,va_list _ArgList); + int __cdecl vwprintf(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl swprintf(wchar_t*, const wchar_t*, ...); + _CRTIMP int __cdecl vswprintf(wchar_t*, const wchar_t*,va_list); + _CRTIMP int __cdecl _swprintf_c(wchar_t *_DstBuf,size_t _SizeInWords,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vswprintf_c(wchar_t *_DstBuf,size_t _SizeInWords,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _snwprintf(wchar_t *_Dest,size_t _Count,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vsnwprintf(wchar_t *_Dest,size_t _Count,const wchar_t *_Format,va_list _Args); +#ifndef __NO_ISOCEXT /* externs in libmingwex.a */ + int __cdecl snwprintf (wchar_t *s, size_t n, const wchar_t * format, ...); + __CRT_INLINE int __cdecl vsnwprintf (wchar_t *s, size_t n, const wchar_t *format, va_list arg) { return _vsnwprintf(s,n,format,arg); } + int __cdecl vwscanf (const wchar_t *, va_list); + int __cdecl vfwscanf (FILE *,const wchar_t *,va_list); + int __cdecl vswscanf (const wchar_t *,const wchar_t *,va_list); +#endif + _CRTIMP int __cdecl _fwprintf_p(FILE *_File,const wchar_t *_Format,...); + _CRTIMP int __cdecl _wprintf_p(const wchar_t *_Format,...); + _CRTIMP int __cdecl _vfwprintf_p(FILE *_File,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _vwprintf_p(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _swprintf_p(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vswprintf_p(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _scwprintf_p(const wchar_t *_Format,...); + _CRTIMP int __cdecl _vscwprintf_p(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _wprintf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _wprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _fwprintf_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _fwprintf_p_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vfwprintf_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vfwprintf_p_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _swprintf_c_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _swprintf_p_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vswprintf_c_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _vswprintf_p_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _scwprintf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _scwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vscwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _snwprintf_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _vsnwprintf_l(wchar_t *_DstBuf,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + _CRTIMP int __cdecl _swprintf(wchar_t *_Dest,const wchar_t *_Format,...); + _CRTIMP int __cdecl _vswprintf(wchar_t *_Dest,const wchar_t *_Format,va_list _Args); + _CRTIMP int __cdecl __swprintf_l(wchar_t *_Dest,const wchar_t *_Format,_locale_t _Plocinfo,...); + _CRTIMP int __cdecl __vswprintf_l(wchar_t *_Dest,const wchar_t *_Format,_locale_t _Plocinfo,va_list _Args); +#ifndef RC_INVOKED +#include +#endif + +#ifdef _CRT_NON_CONFORMING_SWPRINTFS +#ifndef __cplusplus +#define swprintf _swprintf +#define vswprintf _vswprintf +#define _swprintf_l __swprintf_l +#define _vswprintf_l __vswprintf_l +#endif +#endif + + _CRTIMP wchar_t *__cdecl _wtempnam(const wchar_t *_Directory,const wchar_t *_FilePrefix); + _CRTIMP int __cdecl _vscwprintf(const wchar_t *_Format,va_list _ArgList); + _CRTIMP int __cdecl _vscwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList); + int __cdecl fwscanf(FILE *_File,const wchar_t *_Format,...); + _CRTIMP int __cdecl _fwscanf_l(FILE *_File,const wchar_t *_Format,_locale_t _Locale,...); + int __cdecl swscanf(const wchar_t *_Src,const wchar_t *_Format,...); + _CRTIMP int __cdecl _swscanf_l(const wchar_t *_Src,const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP int __cdecl _snwscanf(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,...); + _CRTIMP int __cdecl _snwscanf_l(const wchar_t *_Src,size_t _MaxCount,const wchar_t *_Format,_locale_t _Locale,...); + int __cdecl wscanf(const wchar_t *_Format,...); + _CRTIMP int __cdecl _wscanf_l(const wchar_t *_Format,_locale_t _Locale,...); + _CRTIMP FILE *__cdecl _wfdopen(int _FileHandle ,const wchar_t *_Mode); + _CRTIMP FILE *__cdecl _wfopen(const wchar_t *_Filename,const wchar_t *_Mode); + _CRTIMP FILE *__cdecl _wfreopen(const wchar_t *_Filename,const wchar_t *_Mode,FILE *_OldFile); + +#ifndef _CRT_WPERROR_DEFINED +#define _CRT_WPERROR_DEFINED + _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg); +#endif + _CRTIMP FILE *__cdecl _wpopen(const wchar_t *_Command,const wchar_t *_Mode); +#if !defined(NO_OLDNAMES) && !defined(wpopen) +#define wpopen _wpopen +#endif + _CRTIMP int __cdecl _wremove(const wchar_t *_Filename); + _CRTIMP wchar_t *__cdecl _wtmpnam(wchar_t *_Buffer); + _CRTIMP wint_t __cdecl _fgetwc_nolock(FILE *_File); + _CRTIMP wint_t __cdecl _fputwc_nolock(wchar_t _Ch,FILE *_File); + _CRTIMP wint_t __cdecl _ungetwc_nolock(wint_t _Ch,FILE *_File); + +#undef _CRT_GETPUTWCHAR_NOINLINE + +#if !defined(__cplusplus) || defined(_CRT_GETPUTWCHAR_NOINLINE) +#define getwchar() fgetwc(stdin) +#define putwchar(_c) fputwc((_c),stdout) +#else + __CRT_INLINE wint_t __cdecl getwchar() {return (fgetwc(stdin)); } + __CRT_INLINE wint_t __cdecl putwchar(wchar_t _C) {return (fputwc(_C,stdout)); } +#endif + +#define getwc(_stm) fgetwc(_stm) +#define putwc(_c,_stm) fputwc(_c,_stm) +#define _putwc_nolock(_c,_stm) _fputwc_nolock(_c,_stm) +#define _getwc_nolock(_c) _fgetwc_nolock(_c) +#endif + +#ifndef _WSTDLIB_DEFINED +#define _WSTDLIB_DEFINED + + _CRTIMP wchar_t *__cdecl _itow(int _Value,wchar_t *_Dest,int _Radix); + _CRTIMP wchar_t *__cdecl _ltow(long _Value,wchar_t *_Dest,int _Radix); + _CRTIMP wchar_t *__cdecl _ultow(unsigned long _Value,wchar_t *_Dest,int _Radix); + double __cdecl wcstod(const wchar_t *_Str,wchar_t **_EndPtr); + _CRTIMP double __cdecl _wcstod_l(const wchar_t *_Str,wchar_t **_EndPtr,_locale_t _Locale); + float __cdecl wcstof( const wchar_t *nptr, wchar_t **endptr); +#if !defined __NO_ISOCEXT /* in libmingwex.a */ + float __cdecl wcstof (const wchar_t * __restrict__, wchar_t ** __restrict__); + long double __cdecl wcstold (const wchar_t * __restrict__, wchar_t ** __restrict__); +#endif /* __NO_ISOCEXT */ + long __cdecl wcstol(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); + _CRTIMP long __cdecl _wcstol_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); + unsigned long __cdecl wcstoul(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); + _CRTIMP unsigned long __cdecl _wcstoul_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); + _CRTIMP wchar_t *__cdecl _wgetenv(const wchar_t *_VarName); +#ifndef _CRT_WSYSTEM_DEFINED +#define _CRT_WSYSTEM_DEFINED + _CRTIMP int __cdecl _wsystem(const wchar_t *_Command); +#endif + _CRTIMP double __cdecl _wtof(const wchar_t *_Str); + _CRTIMP double __cdecl _wtof_l(const wchar_t *_Str,_locale_t _Locale); + _CRTIMP int __cdecl _wtoi(const wchar_t *_Str); + _CRTIMP int __cdecl _wtoi_l(const wchar_t *_Str,_locale_t _Locale); + _CRTIMP long __cdecl _wtol(const wchar_t *_Str); + _CRTIMP long __cdecl _wtol_l(const wchar_t *_Str,_locale_t _Locale); + +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP wchar_t *__cdecl _i64tow(__int64 _Val,wchar_t *_DstBuf,int _Radix); + _CRTIMP wchar_t *__cdecl _ui64tow(unsigned __int64 _Val,wchar_t *_DstBuf,int _Radix); + _CRTIMP __int64 __cdecl _wtoi64(const wchar_t *_Str); + _CRTIMP __int64 __cdecl _wtoi64_l(const wchar_t *_Str,_locale_t _Locale); + _CRTIMP __int64 __cdecl _wcstoi64(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); + _CRTIMP __int64 __cdecl _wcstoi64_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); + _CRTIMP unsigned __int64 __cdecl _wcstoui64(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix); + _CRTIMP unsigned __int64 __cdecl _wcstoui64_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale); +#endif +#endif + +#ifndef _POSIX_ +#ifndef _WSTDLIBP_DEFINED +#define _WSTDLIBP_DEFINED + _CRTIMP wchar_t *__cdecl _wfullpath(wchar_t *_FullPath,const wchar_t *_Path,size_t _SizeInWords); + _CRTIMP void __cdecl _wmakepath(wchar_t *_ResultPath,const wchar_t *_Drive,const wchar_t *_Dir,const wchar_t *_Filename,const wchar_t *_Ext); +#ifndef _CRT_WPERROR_DEFINED +#define _CRT_WPERROR_DEFINED + _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg); +#endif + _CRTIMP int __cdecl _wputenv(const wchar_t *_EnvString); + _CRTIMP void __cdecl _wsearchenv(const wchar_t *_Filename,const wchar_t *_EnvVar,wchar_t *_ResultPath); + _CRTIMP void __cdecl _wsplitpath(const wchar_t *_FullPath,wchar_t *_Drive,wchar_t *_Dir,wchar_t *_Filename,wchar_t *_Ext); +#endif +#endif + +#ifndef _WSTRING_DEFINED +#define _WSTRING_DEFINED + _CRTIMP wchar_t *__cdecl _wcsdup(const wchar_t *_Str); + wchar_t *__cdecl wcscat(wchar_t *_Dest,const wchar_t *_Source); + _CONST_RETURN wchar_t *__cdecl wcschr(const wchar_t *_Str,wchar_t _Ch); + int __cdecl wcscmp(const wchar_t *_Str1,const wchar_t *_Str2); + wchar_t *__cdecl wcscpy(wchar_t *_Dest,const wchar_t *_Source); + size_t __cdecl wcscspn(const wchar_t *_Str,const wchar_t *_Control); + size_t __cdecl wcslen(const wchar_t *_Str); + size_t __cdecl wcsnlen(const wchar_t *_Src,size_t _MaxCount); + wchar_t *__cdecl wcsncat(wchar_t *_Dest,const wchar_t *_Source,size_t _Count); + int __cdecl wcsncmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + wchar_t *__cdecl wcsncpy(wchar_t *_Dest,const wchar_t *_Source,size_t _Count); + _CONST_RETURN wchar_t *__cdecl wcspbrk(const wchar_t *_Str,const wchar_t *_Control); + _CONST_RETURN wchar_t *__cdecl wcsrchr(const wchar_t *_Str,wchar_t _Ch); + size_t __cdecl wcsspn(const wchar_t *_Str,const wchar_t *_Control); + _CONST_RETURN wchar_t *__cdecl wcsstr(const wchar_t *_Str,const wchar_t *_SubStr); + wchar_t *__cdecl wcstok(wchar_t *_Str,const wchar_t *_Delim); + _CRTIMP wchar_t *__cdecl _wcserror(int _ErrNum); + _CRTIMP wchar_t *__cdecl __wcserror(const wchar_t *_Str); + _CRTIMP int __cdecl _wcsicmp(const wchar_t *_Str1,const wchar_t *_Str2); + _CRTIMP int __cdecl _wcsicmp_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _wcsnicmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _wcsnicmp_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP wchar_t *__cdecl _wcsnset(wchar_t *_Str,wchar_t _Val,size_t _MaxCount); + _CRTIMP wchar_t *__cdecl _wcsrev(wchar_t *_Str); + _CRTIMP wchar_t *__cdecl _wcsset(wchar_t *_Str,wchar_t _Val); + _CRTIMP wchar_t *__cdecl _wcslwr(wchar_t *_String); + _CRTIMP wchar_t *_wcslwr_l(wchar_t *_String,_locale_t _Locale); + _CRTIMP wchar_t *__cdecl _wcsupr(wchar_t *_String); + _CRTIMP wchar_t *_wcsupr_l(wchar_t *_String,_locale_t _Locale); + size_t __cdecl wcsxfrm(wchar_t *_Dst,const wchar_t *_Src,size_t _MaxCount); + _CRTIMP size_t __cdecl _wcsxfrm_l(wchar_t *_Dst,const wchar_t *_Src,size_t _MaxCount,_locale_t _Locale); + int __cdecl wcscoll(const wchar_t *_Str1,const wchar_t *_Str2); + _CRTIMP int __cdecl _wcscoll_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _wcsicoll(const wchar_t *_Str1,const wchar_t *_Str2); + _CRTIMP int __cdecl _wcsicoll_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale); + _CRTIMP int __cdecl _wcsncoll(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _wcsncoll_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); + _CRTIMP int __cdecl _wcsnicoll(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + _CRTIMP int __cdecl _wcsnicoll_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale); + +#ifndef NO_OLDNAMES + /* NOTE: There is no _wcscmpi, but this is for compatibility. */ + int __cdecl wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2); + __CRT_INLINE int __cdecl wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2) { return _wcsicmp (__ws1, __ws2); } + #define _wcscmpi _wcsicmp + + wchar_t *__cdecl wcsdup(const wchar_t *_Str); +#define wcswcs wcsstr + int __cdecl wcsicmp(const wchar_t *_Str1,const wchar_t *_Str2); + int __cdecl wcsnicmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount); + wchar_t *__cdecl wcsnset(wchar_t *_Str,wchar_t _Val,size_t _MaxCount); + wchar_t *__cdecl wcsrev(wchar_t *_Str); + wchar_t *__cdecl wcsset(wchar_t *_Str,wchar_t _Val); + wchar_t *__cdecl wcslwr(wchar_t *_Str); + wchar_t *__cdecl wcsupr(wchar_t *_Str); + int __cdecl wcsicoll(const wchar_t *_Str1,const wchar_t *_Str2); +#endif +#endif + +#ifndef _TM_DEFINED +#define _TM_DEFINED + struct tm { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + }; +#endif + +#ifndef _WTIME_DEFINED +#define _WTIME_DEFINED + + _CRTIMP wchar_t *__cdecl _wasctime(const struct tm *_Tm); + _CRTIMP wchar_t *__cdecl _wctime32(const __time32_t *_Time); + size_t __cdecl wcsftime(wchar_t *_Buf,size_t _SizeInWords,const wchar_t *_Format,const struct tm *_Tm); + _CRTIMP size_t __cdecl _wcsftime_l(wchar_t *_Buf,size_t _SizeInWords,const wchar_t *_Format,const struct tm *_Tm,_locale_t _Locale); + _CRTIMP wchar_t *__cdecl _wstrdate(wchar_t *_Buffer); + _CRTIMP wchar_t *__cdecl _wstrtime(wchar_t *_Buffer); +#if _INTEGRAL_MAX_BITS >= 64 + _CRTIMP wchar_t *__cdecl _wctime64(const __time64_t *_Time); +#endif + +#if !defined (RC_INVOKED) && !defined (_INC_WTIME_INL) +#define _INC_WTIME_INL +#ifdef _USE_32BIT_TIME_T +__CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime32(_Time); } +#else +__CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime64(_Time); } +#endif +#endif +#endif + + typedef int mbstate_t; + typedef wchar_t _Wint_t; + + wint_t __cdecl btowc(int); + size_t __cdecl mbrlen(const char *_Ch,size_t _SizeInBytes,mbstate_t *_State); + size_t __cdecl mbrtowc(wchar_t *_DstCh,const char *_SrcCh,size_t _SizeInBytes,mbstate_t *_State); + size_t __cdecl mbsrtowcs(wchar_t *_Dest,const char **_PSrc,size_t _Count,mbstate_t *_State); + size_t __cdecl wcrtomb(char *_Dest,wchar_t _Source,mbstate_t *_State); + size_t __cdecl wcsrtombs(char *_Dest,const wchar_t **_PSource,size_t _Count,mbstate_t *_State); + int __cdecl wctob(wint_t _WCh); + +#ifndef __NO_ISOCEXT /* these need static lib libmingwex.a */ + wchar_t *__cdecl wmemset(wchar_t *s, wchar_t c, size_t n); + _CONST_RETURN wchar_t *__cdecl wmemchr(const wchar_t *s, wchar_t c, size_t n); + int wmemcmp(const wchar_t *s1, const wchar_t *s2,size_t n); + wchar_t *__cdecl wmemcpy(wchar_t *s1,const wchar_t *s2,size_t n); + wchar_t *__cdecl wmemmove(wchar_t *s1, const wchar_t *s2, size_t n); + long long __cdecl wcstoll(const wchar_t *nptr,wchar_t **endptr, int base); + unsigned long long __cdecl wcstoull(const wchar_t *nptr,wchar_t **endptr, int base); +#endif /* __NO_ISOCEXT */ + + void *__cdecl memmove(void *_Dst,const void *_Src,size_t _MaxCount); + void *__cdecl memcpy(void *_Dst,const void *_Src,size_t _MaxCount); + __CRT_INLINE int __cdecl fwide(FILE *_F,int _M) { (void)_F; return (_M); } + __CRT_INLINE int __cdecl mbsinit(const mbstate_t *_P) { return (!_P || *_P==0); } + __CRT_INLINE _CONST_RETURN wchar_t *__cdecl wmemchr(const wchar_t *_S,wchar_t _C,size_t _N) { for (;0<_N;++_S,--_N) if (*_S==_C) return (_CONST_RETURN wchar_t *)(_S); return (0); } + __CRT_INLINE int __cdecl wmemcmp(const wchar_t *_S1,const wchar_t *_S2,size_t _N) { for (; 0 < _N; ++_S1,++_S2,--_N) if (*_S1!=*_S2) return (*_S1 < *_S2 ? -1 : +1); return (0); } + __CRT_INLINE wchar_t *__cdecl wmemcpy(wchar_t *_S1,const wchar_t *_S2,size_t _N) { return (wchar_t *)memcpy(_S1,_S2,_N*sizeof(wchar_t)); } + __CRT_INLINE wchar_t *__cdecl wmemmove(wchar_t *_S1,const wchar_t *_S2,size_t _N) { return (wchar_t *)memmove(_S1,_S2,_N*sizeof(wchar_t)); } + __CRT_INLINE wchar_t *__cdecl wmemset(wchar_t *_S,wchar_t _C,size_t _N) { + wchar_t *_Su = _S; + for (;0<_N;++_Su,--_N) { + *_Su = _C; + } + return (_S); + } +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) + +#include +#endif Index: include/crt/wctype.h =================================================================== --- include/crt/wctype.h (Revision 37928) +++ include/crt/wctype.h (Arbeitskopie) @@ -1,173 +1,172 @@ -/* - * wctype.h - * - * Functions for testing wide character types and converting characters. - * - * This file is part of the Mingw32 package. - * - * Contributors: - * Created by Mumit Khan - * - * THIS SOFTWARE IS NOT COPYRIGHTED - * - * This source code is offered for use in the public domain. You may - * use, modify or distribute it freely. - * - * This code is distributed in the hope that it will be useful but - * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAIMED. This includes but is not limited to warranties of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER within this package. */ +#ifndef _INC_WCTYPE +#define _INC_WCTYPE -#ifndef _WCTYPE_H_ -#define _WCTYPE_H_ +#ifndef _WIN32 +#error Only Win32 target is supported! +#endif -/* All the headers include this file. */ #include <_mingw.h> -#define __need_wchar_t -#define __need_wint_t -#ifndef RC_INVOKED -#include -#endif /* Not RC_INVOKED */ +#pragma pack(push,_CRT_PACKING) -/* - * The following flags are used to tell iswctype and _isctype what character - * types you are looking for. - */ -#define _UPPER 0x0001 -#define _LOWER 0x0002 -#define _DIGIT 0x0004 -#define _SPACE 0x0008 -#define _PUNCT 0x0010 -#define _CONTROL 0x0020 -#define _BLANK 0x0040 -#define _HEX 0x0080 -#define _LEADBYTE 0x8000 - -#define _ALPHA 0x0103 - -#ifndef RC_INVOKED - #ifdef __cplusplus extern "C" { #endif -#ifndef WEOF -#define WEOF (wchar_t)(0xFFFF) +#ifndef _CRTIMP +#define _CRTIMP __declspec(dllimport) #endif +#ifndef _WCHAR_T_DEFINED + typedef unsigned short wchar_t; +#define _WCHAR_T_DEFINED +#endif + #ifndef _WCTYPE_T_DEFINED -typedef wchar_t wctype_t; + typedef unsigned short wint_t; + typedef unsigned short wctype_t; #define _WCTYPE_T_DEFINED #endif -/* Wide character equivalents - also in ctype.h */ -_CRTIMP int __cdecl __MINGW_NOTHROW iswctype(wint_t, wctype_t); -_CRTIMP int __cdecl __MINGW_NOTHROW is_wctype(wint_t, wctype_t); /* Obsolete! */ - -#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \ - || !defined __STRICT_ANSI__ || defined __cplusplus -int __cdecl __MINGW_NOTHROW iswblank (wint_t); +#ifndef WEOF +#define WEOF (wint_t)(0xFFFF) #endif -/* Older MS docs uses wchar_t for arg and return type, while newer - online MS docs say arg is wint_t and return is int. - ISO C uses wint_t for both. */ -_CRTIMP wint_t __cdecl __MINGW_NOTHROW towlower (wint_t); -_CRTIMP wint_t __cdecl __MINGW_NOTHROW towupper (wint_t); +#ifndef _CRT_CTYPEDATA_DEFINED +#define _CRT_CTYPEDATA_DEFINED +#ifndef _CTYPE_DISABLE_MACROS -_CRTIMP int __cdecl __MINGW_NOTHROW isleadbyte (int); +#ifndef __PCTYPE_FUNC +#define __PCTYPE_FUNC __pctype_func() +#ifdef _MSVCRT_ +#define __pctype_func() (_pctype) +#else +#define __pctype_func() (*_imp___pctype) +#endif +#endif -/* Also in ctype.h */ +#ifndef _pctype +#ifdef _MSVCRT_ + extern unsigned short *_pctype; +#else + extern unsigned short **_imp___pctype; +#define _pctype (*_imp___pctype) +#endif +#endif -#ifndef _CTYPE_H_ -#ifdef __DECLSPEC_SUPPORTED -# if __MSVCRT_VERSION__ <= 0x0700 - __MINGW_IMPORT unsigned short _ctype[]; -# endif -# ifdef __MSVCRT__ - __MINGW_IMPORT const unsigned short* _pctype; -# else /* CRTDLL */ - __MINGW_IMPORT const unsigned short* _pctype_dll; -# define _pctype _pctype_dll -# endif +#endif +#endif -#else /* ! __DECLSPEC_SUPPORTED */ -# if __MSVCRT_VERSION__ <= 0x0700 - extern unsigned short** _imp___ctype; -# define _ctype (*_imp___ctype) -# endif -# ifdef __MSVCRT__ - extern unsigned short** _imp___pctype; -# define _pctype (*_imp___pctype) -# else /* CRTDLL */ - extern unsigned short** _imp___pctype_dll; -# define _pctype (*_imp___pctype_dll) -# endif /* CRTDLL */ -#endif /* __DECLSPEC_SUPPORTED */ +#ifndef _CRT_WCTYPEDATA_DEFINED +#define _CRT_WCTYPEDATA_DEFINED +#ifndef _CTYPE_DISABLE_MACROS +#ifndef _wctype +#ifdef _MSVCRT_ + extern unsigned short *_wctype; +#else + extern unsigned short **_imp___wctype; +#define _wctype (*_imp___wctype) #endif +#endif -#if !(defined (__NO_INLINE__) || defined(__NO_CTYPE_INLINES) \ - || defined(__WCTYPE_INLINES_DEFINED)) -#define __WCTYPE_INLINES_DEFINED -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswalnum(wint_t wc) {return (iswctype(wc,_ALPHA|_DIGIT));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswalpha(wint_t wc) {return (iswctype(wc,_ALPHA));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswascii(wint_t wc) {return ((wc & ~0x7F) ==0);} -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswcntrl(wint_t wc) {return (iswctype(wc,_CONTROL));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswdigit(wint_t wc) {return (iswctype(wc,_DIGIT));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswgraph(wint_t wc) {return (iswctype(wc,_PUNCT|_ALPHA|_DIGIT));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswlower(wint_t wc) {return (iswctype(wc,_LOWER));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswprint(wint_t wc) {return (iswctype(wc,_BLANK|_PUNCT|_ALPHA|_DIGIT));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswpunct(wint_t wc) {return (iswctype(wc,_PUNCT));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswspace(wint_t wc) {return (iswctype(wc,_SPACE));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswupper(wint_t wc) {return (iswctype(wc,_UPPER));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswxdigit(wint_t wc) {return (iswctype(wc,_HEX));} -__CRT_INLINE int __cdecl __MINGW_NOTHROW isleadbyte(int c) {return (_pctype[(unsigned char)(c)] & _LEADBYTE);} - -#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \ - || !defined __STRICT_ANSI__ || defined __cplusplus -__CRT_INLINE int __cdecl __MINGW_NOTHROW iswblank (wint_t wc) - {return (iswctype(wc, _BLANK) || wc == L'\t');} +#ifndef _pwctype +#ifdef _MSVCRT_ + extern unsigned short *_pwctype; +#else + extern unsigned short **_imp___pwctype; +#define _pwctype (*_imp___pwctype) +#define __pwctype_func() (*_imp___pwctype) #endif +#endif +#endif +#endif -#endif /* !(defined(__NO_CTYPE_INLINES) || defined(__WCTYPE_INLINES_DEFINED)) */ +#define _UPPER 0x1 +#define _LOWER 0x2 +#define _DIGIT 0x4 +#define _SPACE 0x8 -#ifndef __WCTYPE_INLINES_DEFINED -_CRTIMP int __cdecl __MINGW_NOTHROW iswalnum(wint_t); -_CRTIMP int __cdecl __MINGW_NOTHROW iswalpha(wint_t); -_CRTIMP int __cdecl __MINGW_NOTHROW iswascii(wint_t); -_CRTIMP int __cdecl __MINGW_NOTHROW iswcntrl(wint_t); -_CRTIMP int __cdecl __MINGW_NOTHROW iswdigit(wint_t); -_CRTIMP int __cdecl __MINGW_NOTHROW iswgraph(wint_t); -_CRTIMP int __cdecl __MINGW_NOTHROW iswlower(wint_t); -_CRTIMP int __cdecl __MINGW_NOTHROW iswprint(wint_t); -_CRTIMP int __cdecl __MINGW_NOTHROW iswpunct(wint_t); -_CRTIMP int __cdecl __MINGW_NOTHROW iswspace(wint_t); -_CRTIMP int __cdecl __MINGW_NOTHROW iswupper(wint_t); -_CRTIMP int __cdecl __MINGW_NOTHROW iswxdigit(wint_t); -#endif +#define _PUNCT 0x10 +#define _CONTROL 0x20 +#define _BLANK 0x40 +#define _HEX 0x80 -typedef wchar_t wctrans_t; +#define _LEADBYTE 0x8000 +#define _ALPHA (0x0100|_UPPER|_LOWER) -/* These are resolved by libmingwex.a. Note, that they are also exported - by the MS C++ runtime lib (msvcp60.dll). The msvcp60.dll implementations - of wctrans and towctrans are not C99 compliant in that wctrans("tolower") - returns 0, while std specifies that a non-zero value should be returned - for a valid string descriptor. If you want the MS behaviour (and you have - msvcp60.dll in your path) add -lmsvcp60 to your command line. */ +#ifndef _WCTYPE_DEFINED +#define _WCTYPE_DEFINED -wint_t __cdecl __MINGW_NOTHROW towctrans(wint_t, wctrans_t); -wctrans_t __cdecl __MINGW_NOTHROW wctrans(const char*); -wctype_t __cdecl __MINGW_NOTHROW wctype(const char*); + int __cdecl iswalpha(wint_t); + int __cdecl iswupper(wint_t); + int __cdecl iswlower(wint_t); + int __cdecl iswdigit(wint_t); + int __cdecl iswxdigit(wint_t); + int __cdecl iswspace(wint_t); + int __cdecl iswpunct(wint_t); + int __cdecl iswalnum(wint_t); + int __cdecl iswprint(wint_t); + int __cdecl iswgraph(wint_t); + int __cdecl iswcntrl(wint_t); + int __cdecl iswascii(wint_t); + int __cdecl isleadbyte(int); + wint_t __cdecl towupper(wint_t); + wint_t __cdecl towlower(wint_t); + int __cdecl iswctype(wint_t,wctype_t); + _CRTIMP int __cdecl __iswcsymf(wint_t); + _CRTIMP int __cdecl __iswcsym(wint_t); + int __cdecl is_wctype(wint_t,wctype_t); +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || !defined (NO_OLDNAMES) +int __cdecl isblank(int _C); +#endif +#endif +#ifndef _WCTYPE_INLINE_DEFINED +#define _WCTYPE_INLINE_DEFINED +#ifndef __cplusplus +#define iswalpha(_c) (iswctype(_c,_ALPHA)) +#define iswupper(_c) (iswctype(_c,_UPPER)) +#define iswlower(_c) (iswctype(_c,_LOWER)) +#define iswdigit(_c) (iswctype(_c,_DIGIT)) +#define iswxdigit(_c) (iswctype(_c,_HEX)) +#define iswspace(_c) (iswctype(_c,_SPACE)) +#define iswpunct(_c) (iswctype(_c,_PUNCT)) +#define iswalnum(_c) (iswctype(_c,_ALPHA|_DIGIT)) +#define iswprint(_c) (iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT)) +#define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT)) +#define iswcntrl(_c) (iswctype(_c,_CONTROL)) +#define iswascii(_c) ((unsigned)(_c) < 0x80) +#define isleadbyte(c) (__pctype_func()[(unsigned char)(c)] & _LEADBYTE) +#else + __CRT_INLINE int __cdecl iswalpha(wint_t _C) {return (iswctype(_C,_ALPHA)); } + __CRT_INLINE int __cdecl iswupper(wint_t _C) {return (iswctype(_C,_UPPER)); } + __CRT_INLINE int __cdecl iswlower(wint_t _C) {return (iswctype(_C,_LOWER)); } + __CRT_INLINE int __cdecl iswdigit(wint_t _C) {return (iswctype(_C,_DIGIT)); } + __CRT_INLINE int __cdecl iswxdigit(wint_t _C) {return (iswctype(_C,_HEX)); } + __CRT_INLINE int __cdecl iswspace(wint_t _C) {return (iswctype(_C,_SPACE)); } + __CRT_INLINE int __cdecl iswpunct(wint_t _C) {return (iswctype(_C,_PUNCT)); } + __CRT_INLINE int __cdecl iswalnum(wint_t _C) {return (iswctype(_C,_ALPHA|_DIGIT)); } + __CRT_INLINE int __cdecl iswprint(wint_t _C) {return (iswctype(_C,_BLANK|_PUNCT|_ALPHA|_DIGIT)); } + __CRT_INLINE int __cdecl iswgraph(wint_t _C) {return (iswctype(_C,_PUNCT|_ALPHA|_DIGIT)); } + __CRT_INLINE int __cdecl iswcntrl(wint_t _C) {return (iswctype(_C,_CONTROL)); } + __CRT_INLINE int __cdecl iswascii(wint_t _C) {return ((unsigned)(_C) < 0x80); } + __CRT_INLINE int __cdecl isleadbyte(int _C) {return (__pctype_func()[(unsigned char)(_C)] & _LEADBYTE); } +#endif +#endif + + typedef wchar_t wctrans_t; + wint_t __cdecl towctrans(wint_t,wctrans_t); + wctrans_t __cdecl wctrans(const char *); + wctype_t __cdecl wctype(const char *); + #ifdef __cplusplus } #endif -#endif /* Not RC_INVOKED */ - -#endif /* Not _WCTYPE_H_ */ - - +#pragma pack(pop) +#endif Index: include/psdk/strsafe.h =================================================================== --- include/psdk/strsafe.h (Revision 0) +++ include/psdk/strsafe.h (Revision 0) @@ -0,0 +1,472 @@ +#ifndef __STRSAFE_H_ +#define __STRSAFE_H_ + +#include +#include + +#if defined(STRSAFE_NO_CCH_FUNCTIONS) && defined(STRSAFE_NO_CB_FUNCTIONS) +#error Both STRSAFE_NO_CCH_FUNCTIONS and STRSAFE_NO_CB_FUNCTIONS are defined +#endif + +#ifndef SUCCEEDED +#define SUCCEEDED(Status) ((HRESULT)(Status) >= 0) +#endif +#define STRSAFE_MAX_CCH 2147483647 +#define STRSAFE_E_INVALID_PARAMETER ((HRESULT)0x80070057L) +#define STRSAFE_E_INSUFFICIENT_BUFFER ((HRESULT)0x8007007AL) +#define STRSAFE_E_END_OF_FILE ((HRESULT)0x80070026L) + +#define STRSAFE_FILL_BEHIND_NULL 0x00000200 +#define STRSAFE_IGNORE_NULLS 0x00000200 +#define STRSAFE_FILL_ON_FAILURE 0x00000400 +#define STRSAFE_NULL_ON_FAILURE 0x00000800 +#define STRSAFE_NO_TRUNCATION 0x00001000 + +#ifndef S_OK +#define S_OK ((HRESULT)0x00000000L) +#endif + +#define STRSAFE_MIN(a,b) (((a) < (b))?(a):(b)) + +#ifndef _HRESULT_DEFINED +#define _HRESULT_DEFINED +typedef long HRESULT; +#endif + +typedef char * STRSAFE_LPSTR; +typedef const char * STRSAFE_LPCSTR; +typedef wchar_t * STRSAFE_LPWSTR; +typedef const wchar_t * STRSAFE_LPCWSTR; +typedef unsigned long STRSAFE_DWORD; + +#define STRSAFE_PASS2 + +/* Implement Cb functions for ansi and unicode */ +#ifndef STRSAFE_NO_CB_FUNCTIONS +#define STRSAFE_CB +#define STRSAFE_UNICODE 0 +# include +#undef STRSAFE_UNICODE +#define STRSAFE_UNICODE 1 +# include +#undef STRSAFE_UNICODE +#undef STRSAFE_CB +#endif // !STRSAFE_NO_CB_FUNCTIONS + +/* Implement Cch functions for ansi and unicode */ +#ifndef STRSAFE_NO_CCH_FUNCTIONS +#define STRSAFE_UNICODE 0 +# include +#undef STRSAFE_UNICODE +#define STRSAFE_UNICODE 1 +# include +#undef STRSAFE_UNICODE +#endif // !STRSAFE_NO_CCH_FUNCTIONS + +#undef STRSAFE_PASS2 + +/* Now define the functions depending on UNICODE */ +#if defined(UNICODE) +# define STRSAFE_UNICODE 1 +#else +# define STRSAFE_UNICODE 0 +#endif +#include +#undef STRSAFE_UNICODE + +#endif // !__STRSAFE_H_ + +/*****************************************************************************/ + +#if defined(STRSAFE_UNICODE) +#if (STRSAFE_UNICODE == 1) + +#define STRSAFE_LPTSTR STRSAFE_LPWSTR +#define STRSAFE_LPCTSTR STRSAFE_LPCWSTR +#define STRSAFE_TCHAR wchar_t + +#define StringCbCat StringCbCatW +#define StringCbCatEx StringCbCatExW +#define StringCbCatN StringCbCatNW +#define StringCbCatNEx StringCbCatNExW +#define StringCbCatWorker StringCxxCatWorkerW +#define StringCbCopy StringCbCopyW +#define StringCbCopyEx StringCbCopyExW +#define StringCbCopyN StringCbCopyNW +#define StringCbCopyNEx StringCbCopyNExW +#define StringCbGets StringCbGetsW +#define StringCbGetsEx StringCbGetsExW +#define StringCbLength StringCbLengthW +#define StringCbPrintf StringCbPrintfW +#define StringCbPrintfEx StringCbPrintfExW +#define StringCbVPrintf StringCbVPrintfW +#define StringCbVPrintfEx StringCbVPrintfExW +#define StringCchCat StringCchCatW +#define StringCchCatEx StringCchCatExW +#define StringCchCatN StringCchCatNW +#define StringCchCatNEx StringCchCatNExW +#define StringCchCatWorker StringCchCatWorkerW +#define StringCchCopy StringCchCopyW +#define StringCchCopyEx StringCchCopyExW +#define StringCchCopyN StringCchCopyNW +#define StringCchCopyNEx StringCchCopyNExW +#define StringCchGets StringCchGetsW +#define StringCchGetsEx StringCchGetsExW +#define StringCchLength StringCchLengthW +#define StringCchPrintf StringCchPrintfW +#define StringCchPrintfEx StringCchPrintfExW +#define StringCchVPrintf StringCchVPrintfW +#define StringCchVPrintfEx StringCchVPrintfExW + +#else // (STRSAFE_UNICODE != 1) + +#define STRSAFE_LPTSTR STRSAFE_LPSTR +#define STRSAFE_LPCTSTR STRSAFE_LPCSTR +#define STRSAFE_TCHAR char + +#define StringCbCat StringCbCatA +#define StringCbCatEx StringCbCatExA +#define StringCbCatN StringCbCatNA +#define StringCbCatNEx StringCbCatNExA +#define StringCbCatWorker StringCxxCatWorkerA +#define StringCbCopy StringCbCopyA +#define StringCbCopyEx StringCbCopyExA +#define StringCbCopyN StringCbCopyNA +#define StringCbCopyNEx StringCbCopyNExA +#define StringCbGets StringCbGetsA +#define StringCbGetsEx StringCbGetsExA +#define StringCbLength StringCbLengthA +#define StringCbPrintf StringCbPrintfA +#define StringCbPrintfEx StringCbPrintfExA +#define StringCbVPrintf StringCbVPrintfA +#define StringCbVPrintfEx StringCbVPrintfExA +#define StringCchCat StringCchCatA +#define StringCchCatEx StringCchCatExA +#define StringCchCatN StringCchCatNA +#define StringCchCatNEx StringCchCatNExA +#define StringCchCatWorker StringCchCatWorkerA +#define StringCchCopy StringCchCopyA +#define StringCchCopyEx StringCchCopyExA +#define StringCchCopyN StringCchCopyNA +#define StringCchCopyNEx StringCchCopyNExA +#define StringCchGets StringCchGetsA +#define StringCchGetsEx StringCchGetsExA +#define StringCchLength StringCchLengthA +#define StringCchPrintf StringCchPrintfA +#define StringCchPrintfEx StringCchPrintfExA +#define StringCchVPrintf StringCchVPrintfA +#define StringCchVPrintfEx StringCchVPrintfExA + +#endif // (STRSAFE_UNICODE != 1) +#endif // defined(STRSAFE_UNICODE) + +/*****************************************************************************/ + +#if defined (STRSAFE_PASS2) + +#if defined(STRSAFE_CB) + +#define STRSAFE_CXXtoCB(x) (x) +#define STRSAFE_CBtoCXX(x) (x) +#define STRSAFE_CXXtoCCH(x) (x)*sizeof(STRSAFE_TCHAR) +#define STRSAFE_CCHtoCXX(x) (x)/sizeof(STRSAFE_TCHAR) +#define StringCxxCat StringCbCat +#define StringCxxCatEx StringCbCatEx +#define StringCxxCatN StringCbCatN +#define StringCxxCatNEx StringCbCatNEx +#define StringCxxCatWorker StringCbCatWorker +#define StringCxxCopy StringCbCopy +#define StringCxxCopyEx StringCbCopyEx +#define StringCxxCopyN StringCbCopyN +#define StringCxxCopyNEx StringCbCopyNEx +#define StringCxxGets StringCbGets +#define StringCxxGetsEx StringCbGetsEx +#define StringCxxLength StringCbLength +#define StringCxxPrintf StringCbPrintf +#define StringCxxPrintfEx StringCbPrintfEx +#define StringCxxVPrintf StringCbVPrintf +#define StringCxxVPrintfEx StringCbVPrintfEx + +#else // !STRSAFE_CB + +#define STRSAFE_CXXtoCB(x) (x)/sizeof(STRSAFE_TCHAR) +#define STRSAFE_CBtoCXX(x) (x)*sizeof(STRSAFE_TCHAR) +#define STRSAFE_CXXtoCCH(x) (x) +#define STRSAFE_CCHtoCXX(x) (x) +#define StringCxxCat StringCchCat +#define StringCxxCatEx StringCchCatEx +#define StringCxxCatN StringCchCatN +#define StringCxxCatNEx StringCchCatNEx +#define StringCxxCatWorker StringCchCatWorker +#define StringCxxCopy StringCchCopy +#define StringCxxCopyEx StringCchCopyEx +#define StringCxxCopyN StringCchCopyN +#define StringCxxCopyNEx StringCchCopyNEx +#define StringCxxGets StringCchGets +#define StringCxxGetsEx StringCchGetsEx +#define StringCxxLength StringCchLength +#define StringCxxPrintf StringCchPrintf +#define StringCxxPrintfEx StringCchPrintfEx +#define StringCxxVPrintf StringCchVPrintf +#define StringCxxVPrintfEx StringCchVPrintfEx + +#endif // !STRSAFE_CB + +#ifdef STRSAFE_LIB + +/* Normal function prototypes only */ +#define STRSAFEAPI HRESULT __stdcall + +STRSAFEAPI StringCxxCat(STRSAFE_LPTSTR pszDest, size_t cxDest, STRSAFE_LPCTSTR pszSrc); +STRSAFEAPI StringCxxCatEx(STRSAFE_LPTSTR pszDest, size_t cxDest, STRSAFE_LPCTSTR pszSrc, STRSAFE_LPTSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags); +STRSAFEAPI StringCxxCatN(STRSAFE_LPTSTR pszDest, size_t cxDest, STRSAFE_LPCTSTR pszSrc, size_t cbMaxAppend); +STRSAFEAPI StringCxxCatNEx(STRSAFE_LPTSTR pszDest, size_t cxDest, STRSAFE_LPCTSTR pszSrc, size_t cbMaxAppend, STRSAFE_LPTSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags); +STRSAFEAPI StringCxxCopy(STRSAFE_LPTSTR pszDest, size_t cxDest, STRSAFE_LPCTSTR pszSrc); +STRSAFEAPI StringCxxCopyEx(STRSAFE_LPTSTR pszDest, size_t cxDest, STRSAFE_LPCTSTR pszSrc, STRSAFE_LPTSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags); +STRSAFEAPI StringCxxCopyN(STRSAFE_LPTSTR pszDest, size_t cxDest, STRSAFE_LPCTSTR pszSrc, size_t cbSrc); +STRSAFEAPI StringCxxCopyNEx(STRSAFE_LPTSTR pszDest, size_t cxDest, STRSAFE_LPCTSTR pszSrc, size_t cbSrc, STRSAFE_LPTSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags); +STRSAFEAPI StringCxxGets(STRSAFE_LPTSTR pszDest, size_t cxDest); +STRSAFEAPI StringCxxGetsEx(STRSAFE_LPTSTR pszDest, size_t cxDest, STRSAFE_LPTSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags); +STRSAFEAPI StringCxxLength(STRSAFE_LPCTSTR psz, size_t cxMax, size_t *pcb); +STRSAFEAPI StringCxxPrintf(STRSAFE_LPTSTR pszDest, size_t cxDest, STRSAFE_LPCTSTR pszFormat, ...); +STRSAFEAPI StringCxxPrintfEx(STRSAFE_LPTSTR pszDest, size_t cxDest, STRSAFE_LPTSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags, STRSAFE_LPCTSTR pszFormat, ...); +STRSAFEAPI StringCxxVPrintf(STRSAFE_LPTSTR pszDest, size_t cxDest, STRSAFE_LPCTSTR pszFormat, va_list args); +STRSAFEAPI StringCxxVPrintfEx(STRSAFE_LPTSTR pszDest, size_t cxDest, STRSAFE_LPTSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags, LPCTSTR pszFormat, va_list args); + +#else // !STRSAFE_LIB + +/* Create inlined versions */ +#define STRSAFEAPI HRESULT static __inline__ + +STRSAFEAPI StringCxxCatWorker(STRSAFE_LPTSTR pszDest, size_t cxDest, STRSAFE_LPCTSTR pszSrc, size_t cxMaxAppend, STRSAFE_LPTSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags, int UseN) +{ + HRESULT result; + STRSAFE_LPTSTR psz = pszDest; + size_t cch = STRSAFE_CXXtoCCH(cxDest); + + if (!pszDest || !pszSrc || cch > STRSAFE_MAX_CCH || cch == 0) + { + return STRSAFE_E_INVALID_PARAMETER; + } + + for (--psz; *(++psz) != 0 && --cch > 0;); + if (cch == 0) + { + return STRSAFE_E_INSUFFICIENT_BUFFER; + } + + if (UseN) + { + cch = STRSAFE_MIN(cxDest, STRSAFE_CXXtoCCH(cxMaxAppend)); + } + + for (--pszSrc, --psz; (*(++psz) = *(++pszSrc)) != 0 && --cch > 0;); + if (cch == 0) + { + result = STRSAFE_E_INSUFFICIENT_BUFFER; + } + else + result = S_OK; + + if (ppszDestEnd) + { + *ppszDestEnd = psz; + } + + if (pcbRemaining) + { + *pcbRemaining = STRSAFE_CCHtoCXX(cch); + } + + if (dwFlags & STRSAFE_FILL_BEHIND_NULL) + { + for (--psz, ++cch; --cch; *(++psz) = dwFlags & 0xff); + } + + if (!SUCCEEDED(result)) + { + if (dwFlags & STRSAFE_FILL_ON_FAILURE) + { + cch = STRSAFE_CXXtoCCH(cxDest); + for (--pszDest, ++cch; --cch; *(++pszDest) = dwFlags & 0xff); + } + + if (dwFlags & STRSAFE_NULL_ON_FAILURE) + { + *pszDest = 0; + } + } + + return result; +} + +STRSAFEAPI StringCxxCatEx(STRSAFE_LPTSTR pszDest, size_t cxDest, STRSAFE_LPCTSTR pszSrc, STRSAFE_LPTSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags) +{ + return StringCxxCatWorker(pszDest, cxDest, pszSrc, 0, ppszDestEnd, pcbRemaining, dwFlags, 0); +} + +STRSAFEAPI StringCxxCat(STRSAFE_LPTSTR pszDest, size_t cxDest, STRSAFE_LPCTSTR pszSrc) +{ + return StringCxxCatWorker(pszDest, cxDest, pszSrc, 0, NULL, NULL, 0, 0); +} + +STRSAFEAPI StringCxxCatN(STRSAFE_LPTSTR pszDest, size_t cxDest, STRSAFE_LPCTSTR pszSrc, size_t cbMaxAppend) +{ + return StringCxxCatWorker(pszDest, cxDest, pszSrc, cbMaxAppend, NULL, NULL, 0, 1); +} + +STRSAFEAPI StringCxxCatNEx(STRSAFE_LPTSTR pszDest, size_t cxDest, STRSAFE_LPCTSTR pszSrc, size_t cbMaxAppend, STRSAFE_LPTSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags) +{ + return StringCxxCatWorker(pszDest, cxDest, pszSrc, cbMaxAppend, ppszDestEnd, pcbRemaining, dwFlags, 1); +} + +STRSAFEAPI StringCxxCopy(STRSAFE_LPTSTR pszDest, size_t cbDest, STRSAFE_LPCTSTR pszSrc) +{ + return 0; // FIXME +} + +STRSAFEAPI StringCxxCopyEx(STRSAFE_LPTSTR pszDest, size_t cbDest, STRSAFE_LPCTSTR pszSrc, STRSAFE_LPTSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags) +{ + return 0; // FIXME +} + +STRSAFEAPI StringCxxCopyN(STRSAFE_LPTSTR pszDest, size_t cbDest, STRSAFE_LPCTSTR pszSrc, size_t cbSrc) +{ + return 0; // FIXME +} + +STRSAFEAPI StringCxxCopyNEx(STRSAFE_LPTSTR pszDest, size_t cbDest, STRSAFE_LPCTSTR pszSrc, size_t cbSrc, STRSAFE_LPTSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags) +{ + return 0; // FIXME +} + +STRSAFEAPI StringCxxGets(STRSAFE_LPTSTR pszDest, size_t cbDest) +{ + return 0; // FIXME +} + +STRSAFEAPI StringCxxGetsEx(STRSAFE_LPTSTR pszDest, size_t cbDest, STRSAFE_LPTSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags) +{ + return 0; // FIXME +} + +STRSAFEAPI StringCxxLength(STRSAFE_LPCTSTR psz, size_t cxMax, size_t *pcx) +{ + size_t cch = STRSAFE_CXXtoCCH(cxMax); + + /* Default return on error */ + if (pcx) + *pcx = 0; + + if (!psz || cch > STRSAFE_MAX_CCH || cch == 0) + { + return STRSAFE_E_INVALID_PARAMETER; + } + + for (--psz; *(++psz) != 0 && --cch > 0;); + + if (cch == 0) + { + return STRSAFE_E_INVALID_PARAMETER; + } + + if (pcx) + *pcx = cxMax - STRSAFE_CCHtoCXX(cch); + + return S_OK; +} + +STRSAFEAPI StringCxxVPrintf(STRSAFE_LPTSTR pszDest, size_t cbDest, STRSAFE_LPCTSTR pszFormat, va_list args) +{ + return 0; // FIXME +} + +STRSAFEAPI StringCxxVPrintfEx(STRSAFE_LPTSTR pszDest, size_t cbDest, STRSAFE_LPTSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags, STRSAFE_LPCTSTR pszFormat, va_list args) +{ + return 0; // FIXME +} + +STRSAFEAPI StringCxxPrintf(STRSAFE_LPTSTR pszDest, size_t cbDest, STRSAFE_LPCTSTR pszFormat, ...) +{ + HRESULT result; + va_list args; + va_start(args, pszFormat); + result = StringCxxVPrintf(pszDest, cbDest, pszFormat, args); + va_end(args); + return result; +} + +STRSAFEAPI StringCxxPrintfEx(STRSAFE_LPTSTR pszDest, size_t cbDest, STRSAFE_LPTSTR *ppszDestEnd, size_t *pcbRemaining, STRSAFE_DWORD dwFlags, STRSAFE_LPCTSTR pszFormat, ...) +{ + HRESULT result; + va_list args; + va_start(args, pszFormat); + result = StringCxxVPrintfEx(pszDest, cbDest, ppszDestEnd, pcbRemaining, dwFlags, pszFormat, args); + va_end(args); + return result; +} + +#endif // !STRSAFE_LIB + +/* Functions are implemented or defined, clear #defines for next pass */ +#undef StringCxxCat +#undef StringCxxCatEx +#undef StringCxxCatN +#undef StringCxxCatNEx +#undef StringCxxCatWorker +#undef StringCxxCopy +#undef StringCxxCopyEx +#undef StringCxxCopyN +#undef StringCxxCopyNEx +#undef StringCxxGets +#undef StringCxxGetsEx +#undef StringCxxLength +#undef StringCxxPrintf +#undef StringCxxPrintfEx +#undef StringCxxVPrintf +#undef StringCxxVPrintfEx + +#undef StringCbCat +#undef StringCbCatEx +#undef StringCbCatN +#undef StringCbCatNEx +#undef StringCbCatWorker +#undef StringCbCopy +#undef StringCbCopyEx +#undef StringCbCopyN +#undef StringCbCopyNEx +#undef StringCbGets +#undef StringCbGetsEx +#undef StringCbLength +#undef StringCbPrintf +#undef StringCbPrintfEx +#undef StringCbVPrintf +#undef StringCbVPrintfEx +#undef StringCchCat +#undef StringCchCatEx +#undef StringCchCatN +#undef StringCchCatNEx +#undef StringCchCatWorker +#undef StringCchCopy +#undef StringCchCopyEx +#undef StringCchCopyN +#undef StringCchCopyNEx +#undef StringCchGets +#undef StringCchGetsEx +#undef StringCchLength +#undef StringCchPrintf +#undef StringCchPrintfEx +#undef StringCchVPrintf +#undef StringCchVPrintfEx + +#undef STRSAFE_LPTSTR +#undef STRSAFE_LPCTSTR +#undef STRSAFE_TCHAR + +#undef STRSAFE_CXXtoCB +#undef STRSAFE_CBtoCXX +#undef STRSAFE_CXXtoCCH +#undef STRSAFE_CCHtoCXX + +#endif // defined (STRSAFE_PASS2) + Index: include/psdk/winnt.h =================================================================== --- include/psdk/winnt.h (Revision 37928) +++ include/psdk/winnt.h (Arbeitskopie) @@ -35,6 +35,7 @@ extern "C" { #endif +#include #include #include @@ -131,41 +132,39 @@ typedef CONST WCHAR *LPCWCH,*PCWCH,*LPCWSTR,*PCWSTR; typedef CHAR *PCHAR,*LPCH,*PCH,*NPSTR,*LPSTR,*PSTR; typedef CONST CHAR *LPCCH,*PCCH,*PCSTR,*LPCSTR; +typedef PWSTR *PZPWSTR; +typedef CONST PWSTR *PCZPWSTR; +typedef WCHAR UNALIGNED *LPUWSTR,*PUWSTR; +typedef PCWSTR *PZPCWSTR; +typedef CONST WCHAR UNALIGNED *LPCUWSTR,*PCUWSTR; +typedef PSTR *PZPSTR; +typedef CONST PSTR *PCZPSTR; +typedef PCSTR *PZPCSTR; + +#ifdef UNICODE #ifndef _TCHAR_DEFINED #define _TCHAR_DEFINED -#ifdef UNICODE -/* - * NOTE: This tests UNICODE, which is different from the _UNICODE define - * used to differentiate standard C runtime calls. - */ -typedef WCHAR TCHAR; -typedef WCHAR _TCHAR; -#else -typedef CHAR TCHAR; -typedef CHAR _TCHAR; + typedef WCHAR TCHAR,*PTCHAR; + typedef WCHAR TBYTE ,*PTBYTE; #endif -#endif -typedef TCHAR TBYTE,*PTCH,*PTBYTE; -typedef TCHAR *LPTCH,*PTSTR,*LPTSTR,*LP,*PTCHAR; -typedef const TCHAR *LPCTSTR; -#ifdef UNICODE -/* - * __TEXT is a private macro whose specific use is to force the expansion of a - * macro passed as an argument to the macro TEXT. DO NOT use this - * macro within your programs. It's name and function could change without - * notice. - */ -#define __TEXT(q) L##q + typedef LPWSTR LPTCH,PTCH,PTSTR,LPTSTR,LP; + typedef LPCWSTR PCTSTR,LPCTSTR; + typedef LPUWSTR PUTSTR,LPUTSTR; + typedef LPCUWSTR PCUTSTR,LPCUTSTR; +#define __TEXT(quote) L##quote #else -#define __TEXT(q) q +#ifndef _TCHAR_DEFINED +#define _TCHAR_DEFINED + typedef char TCHAR,*PTCHAR; + typedef unsigned char TBYTE ,*PTBYTE; #endif -/* - * UNICODE a constant string when UNICODE is defined, else returns the string - * unmodified. - * The corresponding macros _TEXT() and _T() for mapping _UNICODE strings - * passed to C runtime functions are defined in mingw/tchar.h - */ -#define TEXT(q) __TEXT(q) + typedef LPSTR LPTCH,PTCH,PTSTR,LPTSTR,PUTSTR,LPUTSTR; + typedef LPCSTR PCTSTR,LPCTSTR,PCUTSTR,LPCUTSTR; +#define __TEXT(quote) quote +#endif + +#define TEXT(quote) __TEXT(quote) + typedef SHORT *PSHORT; typedef LONG *PLONG; #ifdef STRICT Index: lib/3rdparty/bzip2/unbzip2.spec =================================================================== --- lib/3rdparty/bzip2/unbzip2.spec (Revision 0) +++ lib/3rdparty/bzip2/unbzip2.spec (Revision 0) @@ -0,0 +1 @@ + @ stdcall BZ2_bzBuffToBuffDecompress(str ptr str long long long) Index: lib/3rdparty/mingw/_newmode.c =================================================================== --- lib/3rdparty/mingw/_newmode.c (Revision 0) +++ lib/3rdparty/mingw/_newmode.c (Revision 0) @@ -0,0 +1 @@ +int _newmode = 0; Index: lib/3rdparty/mingw/argv.c =================================================================== --- lib/3rdparty/mingw/argv.c (Revision 0) +++ lib/3rdparty/mingw/argv.c (Revision 0) @@ -0,0 +1,19 @@ +#ifdef CRTDLL +#undef CRTDLL +#endif + +#include "internal.h" + +extern int _dowildcard; + +#ifdef WPRFLAG +int __CRTDECL +__wsetargv (void) +#else +int __CRTDECL +__setargv (void) +#endif +{ + _dowildcard = 1; + return 0; +} Index: lib/3rdparty/mingw/atonexit.c =================================================================== --- lib/3rdparty/mingw/atonexit.c (Revision 0) +++ lib/3rdparty/mingw/atonexit.c (Revision 0) @@ -0,0 +1,50 @@ +#undef CRTDLL +#ifndef _DLL +#define _DLL +#endif + +#include "oscalls.h" +#include "internal.h" +#include +#include +#include + +#define _EXIT_LOCK1 8 + + void __cdecl _lock (int _File); + void __cdecl _unlock (int _File); + +_PVFV *__onexitbegin; +_PVFV *__onexitend; + +extern _CRTIMP _onexit_t __dllonexit (_onexit_t, _PVFV**, _PVFV**); +extern _onexit_t (__cdecl *_imp___onexit) (_onexit_t func); + +/* Choose a different name to prevent name conflicts. The CRT one works fine. */ +_onexit_t __cdecl mingw_onexit(_onexit_t func) +{ + _PVFV *onexitbegin; + _PVFV *onexitend; + _onexit_t retval; + + onexitbegin = (_PVFV *) _decode_pointer (__onexitbegin); + + if (onexitbegin == (_PVFV *) -1) + return (*_imp___onexit) (func); + _lock (_EXIT_LOCK1); + onexitbegin = (_PVFV *) _decode_pointer (__onexitbegin); + onexitend = (_PVFV *) _decode_pointer (__onexitend); + + retval = __dllonexit (func, &onexitbegin, &onexitend); + + __onexitbegin = (_PVFV *) _encode_pointer (onexitbegin); + __onexitend = (_PVFV *) _encode_pointer (onexitend); + _unlock (_EXIT_LOCK1); + return retval; +} + +int __cdecl +atexit (_PVFV func) +{ + return (mingw_onexit((_onexit_t)func) == NULL) ? -1 : 0; +} Index: lib/3rdparty/mingw/binmode.c =================================================================== --- lib/3rdparty/mingw/binmode.c (Revision 37928) +++ lib/3rdparty/mingw/binmode.c (Arbeitskopie) @@ -1,5 +1,4 @@ -#include +#define SPECIAL_CRTEXE -/* Set default file mode to binary */ - -int _fmode = _O_BINARY; +#include +#include Index: lib/3rdparty/mingw/charmax.c =================================================================== --- lib/3rdparty/mingw/charmax.c (Revision 0) +++ lib/3rdparty/mingw/charmax.c (Revision 0) @@ -0,0 +1,9 @@ +#include "internal.h" + +int __lconv_init (void); + +int mingw_initcharmax = 0; + +int _charmax = 255; + +_CRTALLOC(".CRT$XIC") _PIFV __mingw_pinit = __lconv_init; Index: lib/3rdparty/mingw/cinitexe.c =================================================================== --- lib/3rdparty/mingw/cinitexe.c (Revision 0) +++ lib/3rdparty/mingw/cinitexe.c (Revision 0) @@ -0,0 +1,7 @@ +#include +#include "internal.h" + +_CRTALLOC(".CRT$XIA") _PVFV __xi_a[] = { NULL }; +_CRTALLOC(".CRT$XIZ") _PVFV __xi_z[] = { NULL }; +_CRTALLOC(".CRT$XCA") _PVFV __xc_a[] = { NULL }; +_CRTALLOC(".CRT$XCZ") _PVFV __xc_z[] = { NULL }; Index: lib/3rdparty/mingw/crt0_c.c =================================================================== --- lib/3rdparty/mingw/crt0_c.c (Revision 0) +++ lib/3rdparty/mingw/crt0_c.c (Revision 0) @@ -0,0 +1,6 @@ +#include + +int main (int flags, char **cmdline, char **inst) +{ + return (int) WinMain ((HINSTANCE) inst, NULL, (LPSTR) cmdline,(DWORD) flags); +} Index: lib/3rdparty/mingw/crt0_w.c =================================================================== --- lib/3rdparty/mingw/crt0_w.c (Revision 0) +++ lib/3rdparty/mingw/crt0_w.c (Revision 0) @@ -0,0 +1,14 @@ +#include + +int WINAPI wWinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPWSTR lpCmdLine,int nShowCmd); + +void __main(void); +int wmain (int flags, wchar_t **cmdline, wchar_t **inst) +{ +#ifdef __GNUC__ + /* C++ initialization. (gcc inserts this call automatically for + * a function called "main", but not for "wmain") */ + __main(); +#endif + return (int) wWinMain ((HINSTANCE) inst, NULL, (LPWSTR) cmdline,(DWORD) flags); +} Index: lib/3rdparty/mingw/CRT_fp10.c =================================================================== --- lib/3rdparty/mingw/CRT_fp10.c (Revision 0) +++ lib/3rdparty/mingw/CRT_fp10.c (Revision 0) @@ -0,0 +1,4 @@ +void _fpreset (void) + { __asm__ ("fninit" ) ;} + +void __attribute__ ((alias ("_fpreset"))) fpreset(void); Index: lib/3rdparty/mingw/CRT_fp8.c =================================================================== --- lib/3rdparty/mingw/CRT_fp8.c (Revision 0) +++ lib/3rdparty/mingw/CRT_fp8.c (Revision 0) @@ -0,0 +1,5 @@ +extern void (*_imp___fpreset)(void) ; +void _fpreset (void) +{ (*_imp___fpreset)(); } + +void __attribute__ ((alias ("_fpreset"))) fpreset(void); Index: lib/3rdparty/mingw/crtdll.c =================================================================== --- lib/3rdparty/mingw/crtdll.c (Revision 0) +++ lib/3rdparty/mingw/crtdll.c (Revision 0) @@ -0,0 +1,201 @@ +#ifdef CRTDLL +#undef CRTDLL +#define _DLL + +#include +#include +#include +#include +#define _DECL_DLLMAIN +#include +#include + +#ifndef _CRTIMP +#ifdef CRTDLL +#define _CRTIMP __declspec(dllexport) +#else +#ifdef _DLL +#define _CRTIMP __declspec(dllimport) +#else +#define _CRTIMP +#endif +#endif +#endif +#include +#include + +extern void __cdecl _initterm(_PVFV *,_PVFV *); +extern void __main (); +extern void _pei386_runtime_relocator (void); +extern _CRTALLOC(".CRT$XIA") _PIFV __xi_a[]; +extern _CRTALLOC(".CRT$XIZ") _PIFV __xi_z[]; +extern _CRTALLOC(".CRT$XCA") _PVFV __xc_a[]; +extern _CRTALLOC(".CRT$XCZ") _PVFV __xc_z[]; + +extern const PIMAGE_TLS_CALLBACK __dyn_tls_init_callback; + +static int __proc_attached = 0; + +extern _PVFV *__onexitbegin; +extern _PVFV *__onexitend; + +extern int mingw_app_type; + +extern BOOL WINAPI DllMain (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved); + +extern BOOL WINAPI DllEntryPoint (HANDLE, DWORD, LPVOID); + +static int pre_c_init (void); + +_CRTALLOC(".CRT$XIAA") _PIFV pcinit = pre_c_init; + +static int +pre_c_init (void) +{ + _PVFV *onexitbegin; + + onexitbegin = (_PVFV *) malloc (32 * sizeof (_PVFV)); + __onexitend = __onexitbegin = (_PVFV *) _encode_pointer (onexitbegin); + + if (onexitbegin == NULL) + return 1; + *onexitbegin = (_PVFV) NULL; + return 0; +} + +BOOL WINAPI _CRT_INIT (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) +{ + if (dwReason == DLL_PROCESS_DETACH) + { + if (__proc_attached > 0) + __proc_attached--; + else + return FALSE; + } + if (dwReason == DLL_PROCESS_ATTACH) + { + void *lock_free = NULL; + void *fiberid = ((PNT_TIB)NtCurrentTeb ())->StackBase; + int nested = FALSE; + + while ((lock_free = InterlockedCompareExchangePointer ((volatile PVOID *) &__native_startup_lock, + fiberid, 0)) != 0) + { + if (lock_free == fiberid) + { + nested = TRUE; + break; + } + Sleep(1000); + } + if (__native_startup_state != __uninitialized) + { + _amsg_exit(31); + } + else + { + __native_startup_state = __initializing; + + _initterm ((_PVFV *) (void *) __xi_a, (_PVFV *) (void *) __xi_z); + _initterm (__xc_a,__xc_z); + __native_startup_state = __initialized; + } + if (! nested) + { + InterlockedExchangePointer ((volatile PVOID *) &__native_startup_lock, 0); + } + if (__dyn_tls_init_callback != NULL && + _IsNonwritableInCurrentImage ((PBYTE) &__dyn_tls_init_callback)) + { + __dyn_tls_init_callback (hDllHandle, DLL_THREAD_ATTACH, lpreserved); + } + __proc_attached++; + } + else if (dwReason == DLL_PROCESS_DETACH) + { + void *lock_free = NULL; + while ((lock_free = InterlockedCompareExchangePointer ((volatile PVOID *) &__native_startup_lock,(PVOID) 1, 0)) != 0) + { + Sleep(1000); + } + if(__native_startup_state!=__initialized) + { + _amsg_exit (31); + } + else + { + _PVFV * onexitbegin = (_PVFV *) _decode_pointer (__onexitbegin); + if (onexitbegin) + { + _PVFV *onexitend = (_PVFV *) _decode_pointer (__onexitend); + while (--onexitend >= onexitbegin) + if (*onexitend != NULL) + (**onexitend) (); + free (onexitbegin); + __onexitbegin = __onexitend = (_PVFV *) NULL; + } + __native_startup_state = __uninitialized; + InterlockedExchangePointer ((volatile PVOID *) &__native_startup_lock, 0); + } + } + return TRUE; +} + +static BOOL __DllMainCRTStartup (HANDLE, DWORD, LPVOID); + +BOOL WINAPI +DllMainCRTStartup(HANDLE hDllHandle,DWORD dwReason,LPVOID lpreserved) +{ + mingw_app_type = 0; + if (dwReason == DLL_PROCESS_ATTACH) + { + __security_init_cookie (); + } + return __DllMainCRTStartup (hDllHandle, dwReason, lpreserved); +} + +__declspec(noinline) BOOL +__DllMainCRTStartup (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) +{ + BOOL retcode = TRUE; + + __native_dllmain_reason = dwReason; + if (dwReason == DLL_PROCESS_DETACH && __proc_attached == 0) + { + retcode = FALSE; + goto i__leave; + } + if (dwReason == DLL_PROCESS_ATTACH || dwReason == DLL_THREAD_ATTACH) + { + retcode = DllEntryPoint (hDllHandle, dwReason, lpreserved); + if (retcode) + retcode = _CRT_INIT (hDllHandle, dwReason, lpreserved); + if (! retcode) + goto i__leave; + } + _pei386_runtime_relocator (); + if (retcode && dwReason == DLL_PROCESS_ATTACH) + __main (); + retcode = DllMain(hDllHandle,dwReason,lpreserved); + if ((dwReason == DLL_PROCESS_ATTACH) && ! retcode) + { + DllMain (hDllHandle, DLL_PROCESS_DETACH, lpreserved); + _CRT_INIT (hDllHandle, DLL_PROCESS_DETACH, lpreserved); + DllEntryPoint (hDllHandle, DLL_PROCESS_DETACH, lpreserved); + } + if (dwReason == DLL_PROCESS_DETACH || dwReason == DLL_THREAD_DETACH) + { + if (_CRT_INIT (hDllHandle, dwReason, lpreserved) == FALSE) + { + retcode = FALSE; + } + if (retcode) + { + retcode = DllEntryPoint (hDllHandle, dwReason, lpreserved); + } + } +i__leave: + __native_dllmain_reason = UINT_MAX; + return retcode ; +} +#endif Index: lib/3rdparty/mingw/crtexe.c =================================================================== --- lib/3rdparty/mingw/crtexe.c (Revision 0) +++ lib/3rdparty/mingw/crtexe.c (Revision 0) @@ -0,0 +1,473 @@ +#undef CRTDLL +//#define _DLL + +#define SPECIAL_CRTEXE + +#include "oscalls.h" +#include "internal.h" +#include +#include +#include +#include +#include +#include + +#ifndef __winitenv +extern wchar_t ***_imp____winitenv; +#define __winitenv (*_imp____winitenv) +#endif + +#ifndef __initenv +extern char ***_imp____initenv; +#define __initenv (*_imp____initenv) +#endif + +/* Hack, for bug in ld. Will be removed soon. */ +#define __ImageBase _image_base__ +/* This symbol is defined by ld. */ +extern IMAGE_DOS_HEADER __ImageBase; + +extern void _fpreset (void); +#define SPACECHAR _T(' ') +#define DQUOTECHAR _T('\"') + +__declspec(dllimport) void __setusermatherr(int (__cdecl *)(struct _exception *)); + +extern int *_imp___fmode; +extern int *_imp___commode; + +#undef _fmode +extern int _fmode; +extern int *_imp___commode; +#define _commode (*_imp___commode) +extern int _dowildcard; + +extern int __defaultmatherr; +extern _CRTIMP void __cdecl _initterm(_PVFV *, _PVFV *); + +static int __cdecl check_managed_app (void); + +extern _CRTALLOC(".CRT$XIA") _PIFV __xi_a[]; +extern _CRTALLOC(".CRT$XIZ") _PIFV __xi_z[]; +extern _CRTALLOC(".CRT$XCA") _PVFV __xc_a[]; +extern _CRTALLOC(".CRT$XCZ") _PVFV __xc_z[]; + +extern const PIMAGE_TLS_CALLBACK __dyn_tls_init_callback; + +extern _PVFV *__onexitbegin; +extern _PVFV *__onexitend; + +extern int mingw_app_type; + +static int argc; +#ifdef WPRFLAG +static wchar_t **argv; +static wchar_t **envp; +#else +static char **argv; +static char **envp; +#endif + +static int argret; +static int mainret=0; +static int managedapp; +static int has_cctor = 0; +static _startupinfo startinfo; + +extern void _pei386_runtime_relocator (void); +static CALLBACK long _gnu_exception_handler (EXCEPTION_POINTERS * exception_data); +//static LONG __mingw_vex(EXCEPTION_POINTERS * exception_data); +#ifdef WPRFLAG +static void duplicate_ppstrings (int ac, wchar_t ***av); +#else +static void duplicate_ppstrings (int ac, char ***av); +#endif + +static int __cdecl pre_c_init (void); +static void __cdecl pre_cpp_init (void); + +_CRTALLOC(".CRT$XIAA") _PIFV mingw_pcinit = pre_c_init; +_CRTALLOC(".CRT$XCAA") _PVFV mingw_pcppinit = pre_cpp_init; + +static int __cdecl +pre_c_init (void) +{ + managedapp = check_managed_app (); + if (mingw_app_type) + __set_app_type(_GUI_APP); + else + __set_app_type (_CONSOLE_APP); + __onexitbegin = __onexitend = (_PVFV *) _encode_pointer ((_PVFV *)(-1)); + + *_imp___fmode = _fmode; + *_imp___commode = _commode; + +#ifdef WPRFLAG + _wsetargv(); +#else + _setargv(); +#endif + + if (! __defaultmatherr) + __setusermatherr (_matherr); + + if (__globallocalestatus == -1) + { + } + return 0; +} + +static void __cdecl +pre_cpp_init (void) +{ + startinfo.newmode = _newmode; + +#ifdef WPRFLAG + argret = __wgetmainargs(&argc,&argv,&envp,_dowildcard,&startinfo); +#else + argret = __getmainargs(&argc,&argv,&envp,_dowildcard,&startinfo); +#endif +} + +static int __tmainCRTStartup (void); + +#ifdef WPRFLAG +int wWinMainCRTStartup (void) +#else +int WinMainCRTStartup (void) +#endif +{ + mingw_app_type = 1; + __security_init_cookie (); + return __tmainCRTStartup (); +} + +#ifdef WPRFLAG +int wmainCRTStartup (void) +#else +int mainCRTStartup (void) +#endif +{ + mingw_app_type = 0; + __security_init_cookie (); + return __tmainCRTStartup (); +} + + +__declspec(noinline) int +__tmainCRTStartup (void) +{ + _TCHAR *lpszCommandLine = NULL; + STARTUPINFO StartupInfo; + BOOL inDoubleQuote = FALSE; + memset (&StartupInfo, 0, sizeof (STARTUPINFO)); + + if (mingw_app_type) + GetStartupInfo (&StartupInfo); + { + void *lock_free = NULL; + void *fiberid = ((PNT_TIB)NtCurrentTeb())->StackBase; + int nested = FALSE; + while((lock_free = InterlockedCompareExchangePointer ((volatile PVOID *) &__native_startup_lock, + fiberid, 0)) != 0) + { + if (lock_free == fiberid) + { + nested = TRUE; + break; + } + Sleep(1000); + } + if (__native_startup_state == __initializing) + { + _amsg_exit (31); + } + else if (__native_startup_state == __uninitialized) + { + __native_startup_state = __initializing; + _initterm ((_PVFV *)(void *)__xi_a, (_PVFV *)(void *) __xi_z); + } + else + has_cctor = 1; + + if (__native_startup_state == __initializing) + { + _initterm (__xc_a, __xc_z); + __native_startup_state = __initialized; + } + _ASSERTE(__native_startup_state == __initialized); + if (! nested) + (VOID)InterlockedExchangePointer ((volatile PVOID *) &__native_startup_lock, 0); + + if (__dyn_tls_init_callback != NULL && _IsNonwritableInCurrentImage ((PBYTE) &__dyn_tls_init_callback)) + __dyn_tls_init_callback (NULL, DLL_THREAD_ATTACH, NULL); + +#if defined(__i386__) || defined(__x86_64__) + _pei386_runtime_relocator (); +#endif + + #if defined(__x86_64__) + __asm__ __volatile__ ( + "xorq %rax,%rax\n\t" + "decq %rax\n\t" + "movq %rax,%gs:0" "\n"); + #elif defined(__i386__) + __asm__ __volatile__ ( + "xorl %eax,%eax\n\t" + "decl %eax\n\t" + "movl %eax,%fs:0" "\n"); + #endif + //AddVectoredExceptionHandler (0, (PVECTORED_EXCEPTION_HANDLER)__mingw_vex); + SetUnhandledExceptionFilter (_gnu_exception_handler); + + if (mingw_app_type) + { +#ifdef WPRFLAG + if (_wcmdln == NULL) + return 255; + lpszCommandLine = (_TCHAR *) _wcmdln; +#else + lpszCommandLine = (char *) _acmdln; +#endif + while (*lpszCommandLine > SPACECHAR || (*lpszCommandLine && inDoubleQuote)) + { + if (*lpszCommandLine == DQUOTECHAR) + inDoubleQuote = TRUE; +#ifdef _MBCS + if (_ismbblead (*lpszCommandLine)) + { + if (lpszCommandLine) + lpszCommandLine++; + } +#endif + ++lpszCommandLine; + } + while (*lpszCommandLine && (*lpszCommandLine <= SPACECHAR)) + lpszCommandLine++; + +#ifdef WPRFLAG + mainret = wmain ( + (int) (StartupInfo.dwFlags & STARTF_USESHOWWINDOW ? StartupInfo.wShowWindow : SW_SHOWDEFAULT), + (wchar_t **) lpszCommandLine, (wchar_t **) (HINSTANCE) &__ImageBase); +#else + mainret = main ( + (int) (StartupInfo.dwFlags & STARTF_USESHOWWINDOW ? StartupInfo.wShowWindow : SW_SHOWDEFAULT), + (char **) lpszCommandLine, (char **) (HINSTANCE) &__ImageBase); +#endif + } + else + { + duplicate_ppstrings (argc, &argv); +#ifdef WPRFLAG + __winitenv = envp; + mainret = wmain (argc, argv, envp); +#else + __initenv = envp; + mainret = main (argc, argv, envp); +#endif + } + if (!managedapp) + exit (mainret); + + if (has_cctor == 0) + _cexit (); + } + return mainret; +} + +extern int mingw_initltsdrot_force; +extern int mingw_initltsdyn_force; +extern int mingw_initltssuo_force; +extern int mingw_initcharmax; + +static int __cdecl +check_managed_app (void) +{ + PIMAGE_DOS_HEADER pDOSHeader; + PIMAGE_NT_HEADERS pPEHeader; + PIMAGE_OPTIONAL_HEADER32 pNTHeader32; + PIMAGE_OPTIONAL_HEADER64 pNTHeader64; + + /* Force to be linked. */ + //TLS sections + //mingw_initltsdrot_force=1; + //mingw_initltsdyn_force=1; + //mingw_initltssuo_force=1; + mingw_initcharmax=1; + + pDOSHeader = (PIMAGE_DOS_HEADER) &__ImageBase; + if (pDOSHeader->e_magic != IMAGE_DOS_SIGNATURE) + return 0; + + pPEHeader = (PIMAGE_NT_HEADERS)((char *)pDOSHeader + pDOSHeader->e_lfanew); + if (pPEHeader->Signature != IMAGE_NT_SIGNATURE) + return 0; + + pNTHeader32 = (PIMAGE_OPTIONAL_HEADER32) &pPEHeader->OptionalHeader; + switch (pNTHeader32->Magic) + { + case IMAGE_NT_OPTIONAL_HDR32_MAGIC: + if (pNTHeader32->NumberOfRvaAndSizes <= IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR) + return 0; + return !! pNTHeader32->DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].VirtualAddress; + case IMAGE_NT_OPTIONAL_HDR64_MAGIC: + pNTHeader64 = (PIMAGE_OPTIONAL_HEADER64)pNTHeader32; + if (pNTHeader64->NumberOfRvaAndSizes <= IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR) + return 0; + return !! pNTHeader64->DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].VirtualAddress; + } + return 0; +} + +int __defaultmatherr; + +static CALLBACK long +_gnu_exception_handler (EXCEPTION_POINTERS * exception_data) +{ + void (*old_handler) (int); + long action = EXCEPTION_CONTINUE_SEARCH; + int reset_fpu = 0; + + switch (exception_data->ExceptionRecord->ExceptionCode) + { + case EXCEPTION_ACCESS_VIOLATION: + /* test if the user has set SIGSEGV */ + old_handler = signal (SIGSEGV, SIG_DFL); + if (old_handler == SIG_IGN) + { + /* this is undefined if the signal was raised by anything other + than raise (). */ + signal (SIGSEGV, SIG_IGN); + action = EXCEPTION_CONTINUE_EXECUTION; + } + else if (old_handler != SIG_DFL) + { + /* This means 'old' is a user defined function. Call it */ + (*old_handler) (SIGSEGV); + action = EXCEPTION_CONTINUE_EXECUTION; + } + break; + + case EXCEPTION_ILLEGAL_INSTRUCTION: + case EXCEPTION_PRIV_INSTRUCTION: + /* test if the user has set SIGILL */ + old_handler = signal (SIGILL, SIG_DFL); + if (old_handler == SIG_IGN) + { + /* this is undefined if the signal was raised by anything other + than raise (). */ + signal (SIGILL, SIG_IGN); + action = EXCEPTION_CONTINUE_EXECUTION; + } + else if (old_handler != SIG_DFL) + { + /* This means 'old' is a user defined function. Call it */ + (*old_handler) (SIGILL); + action = EXCEPTION_CONTINUE_EXECUTION; + } + break; + + case EXCEPTION_FLT_INVALID_OPERATION: + case EXCEPTION_FLT_DIVIDE_BY_ZERO: + case EXCEPTION_FLT_DENORMAL_OPERAND: + case EXCEPTION_FLT_OVERFLOW: + case EXCEPTION_FLT_UNDERFLOW: + case EXCEPTION_FLT_INEXACT_RESULT: + reset_fpu = 1; + /* fall through. */ + + case EXCEPTION_INT_DIVIDE_BY_ZERO: + /* test if the user has set SIGFPE */ + old_handler = signal (SIGFPE, SIG_DFL); + if (old_handler == SIG_IGN) + { + signal (SIGFPE, SIG_IGN); + if (reset_fpu) + _fpreset (); + action = EXCEPTION_CONTINUE_EXECUTION; + } + else if (old_handler != SIG_DFL) + { + /* This means 'old' is a user defined function. Call it */ + (*old_handler) (SIGFPE); + action = EXCEPTION_CONTINUE_EXECUTION; + } + break; + + default: + break; + } + return action; +} + +#if 0 +static LONG __mingw_vex(EXCEPTION_POINTERS * exception_data) +{ + /* TODO this is not chainablem, therefore need rewrite. Disabled the ill code. */ + #if 0 + #ifdef _WIN64 + __asm__ __volatile__ ( + "movq %gs:0,%rax" "\n\t" + "orq %rax,%rax\n\t" + "jz l1\n\t" + "jmp *8(%rax)\n\r" + "l1:\n\t" + "nop\n"); +#else + __asm__ __volatile__ ( + "movl %fs:0,%eax" "\n\t" + "orl %eax,%eax\n\t" + "jz l1\n\t" + "jmp *4(%eax)\n\r" + "l1:\n\t" + "nop\n"); +#endif +#endif + return _gnu_exception_handler(exception_data); +} +#endif + +#ifdef WPRFLAG + +static size_t wbytelen(const wchar_t *p) +{ + size_t ret = 1; + while (*p!=0) { + ret++,++p; + } + return ret*2; +} +static void duplicate_ppstrings (int ac, wchar_t ***av) +{ + wchar_t **avl; + int i; + wchar_t **n = (wchar_t **) malloc (sizeof (wchar_t *) * (ac + 1)); + + avl=*av; + for (i=0; i < ac; i++) + { + int l = wbytelen (avl[i]); + n[i] = (wchar_t *) malloc (l); + memcpy (n[i], avl[i], l); + } + n[i] = NULL; + *av = n; +} +#else +static void duplicate_ppstrings (int ac, char ***av) +{ + char **avl; + int i; + char **n = (char **) malloc (sizeof (char *) * (ac + 1)); + + avl=*av; + for (i=0; i < ac; i++) + { + int l = strlen (avl[i]) + 1; + n[i] = (char *) malloc (l); + memcpy (n[i], avl[i], l); + } + n[i] = NULL; + *av = n; +} +#endif Index: lib/3rdparty/mingw/dllargv.c =================================================================== --- lib/3rdparty/mingw/dllargv.c (Revision 0) +++ lib/3rdparty/mingw/dllargv.c (Revision 0) @@ -0,0 +1,30 @@ +#ifdef CRTDLL +#undef CRTDLL +#endif + +#include "internal.h" + +extern int _dowildcard; + +#ifdef WPRFLAG +int __CRTDECL +_wsetargv (void) +#else +int __CRTDECL +_setargv (void) +#endif +{ + return 0; +} + +#ifdef WPRFLAG +int __CRTDECL +__wsetargv (void) +#else +int __CRTDECL +__setargv (void) +#endif +{ + _dowildcard = 1; + return 0; +} Index: lib/3rdparty/mingw/dllentry.c =================================================================== --- lib/3rdparty/mingw/dllentry.c (Revision 0) +++ lib/3rdparty/mingw/dllentry.c (Revision 0) @@ -0,0 +1,8 @@ +#define _DECL_DLLMAIN +#include +#include + +BOOL WINAPI DllEntryPoint(HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) +{ + return TRUE; +} Index: lib/3rdparty/mingw/dllmain.c =================================================================== --- lib/3rdparty/mingw/dllmain.c (Revision 0) +++ lib/3rdparty/mingw/dllmain.c (Revision 0) @@ -0,0 +1,9 @@ +#define _DECL_DLLMAIN +#define _WINDOWS_ +#include +#include + +BOOL WINAPI DllMain(HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) +{ + return TRUE; +} Index: lib/3rdparty/mingw/gccmain.c =================================================================== --- lib/3rdparty/mingw/gccmain.c (Revision 37928) +++ lib/3rdparty/mingw/gccmain.c (Arbeitskopie) @@ -10,29 +10,35 @@ * __do_global_ctors. * */ - -/* Needed for the atexit prototype. */ +#include #include -#include +#include typedef void (*func_ptr) (void); extern func_ptr __CTOR_LIST__[]; extern func_ptr __DTOR_LIST__[]; +static HMODULE hMsvcrt = NULL; + +typedef void __cdecl flongjmp(jmp_buf _Buf,int _Value); + +flongjmp *fctMsvcrtLongJmp = NULL; + void __do_global_dtors (void) { static func_ptr *p = __DTOR_LIST__ + 1; - /* - * Call each destructor in the destructor list until a null pointer - * is encountered. - */ while (*p) { (*(p)) (); p++; } + if (hMsvcrt) + { + FreeLibrary (hMsvcrt); + hMsvcrt = NULL; + } } void @@ -41,27 +47,21 @@ unsigned long nptrs = (unsigned long) (ptrdiff_t) __CTOR_LIST__[0]; unsigned long i; - /* - * If the first entry in the constructor list is -1 then the list - * is terminated with a null entry. Otherwise the first entry was - * the number of pointers in the list. - */ + if (!hMsvcrt) { + hMsvcrt = LoadLibrary ("msvcrt.dll"); + fctMsvcrtLongJmp = (flongjmp *) GetProcAddress( hMsvcrt, "longjmp"); + } + if (nptrs == (unsigned long) -1) { for (nptrs = 0; __CTOR_LIST__[nptrs + 1] != 0; nptrs++); } - /* - * Go through the list backwards calling constructors. - */ for (i = nptrs; i >= 1; i--) { __CTOR_LIST__[i] (); } - /* - * Register the destructors for processing on exit. - */ atexit (__do_global_dtors); } @@ -76,5 +76,3 @@ __do_global_ctors (); } } - - Index: lib/3rdparty/mingw/getopt.c =================================================================== --- lib/3rdparty/mingw/getopt.c (Revision 37928) +++ lib/3rdparty/mingw/getopt.c (Arbeitskopie) @@ -82,7 +82,7 @@ ++ s_nArgChar; /* unrecognized option */ - if((_toptopt == _T(':')) || ((pcOptChar = _tcschr(optstring, (_TCHAR)_toptopt)) == NULL)) + if(_toptopt == _T(':') || (pcOptChar = _tcschr(optstring, _toptopt)) == NULL) { /* print an error message */ if(_topterr && optstring[0] != _T(':')) Index: lib/3rdparty/mingw/gs_support.c =================================================================== --- lib/3rdparty/mingw/gs_support.c (Revision 0) +++ lib/3rdparty/mingw/gs_support.c (Revision 0) @@ -0,0 +1,129 @@ +#include +#ifdef _WIN64 +#include +#endif + +#ifdef _WIN64 +#define DEFAULT_SECURITY_COOKIE 0x00002B992DDFA232ll +#else +#define DEFAULT_SECURITY_COOKIE 0xBB40E64E +#endif + +/* Externals. */ +#ifdef _WIN64 +PRUNTIME_FUNCTION RtlLookupFunctionEntry (ULONG64, PULONG64, PVOID); +PVOID RtlVirtualUnwind (ULONG HandlerType, ULONG64, ULONG64, PRUNTIME_FUNCTION, + PCONTEXT, PVOID *, PULONG64, PKNONVOLATILE_CONTEXT_POINTERS); +#endif + +typedef LONG NTSTATUS; + +#define STATUS_STACK_BUFFER_OVERRUN ((NTSTATUS)0xC0000409L) + +typedef union +{ + unsigned __int64 ft_scalar; + FILETIME ft_struct; +} FT; + +static EXCEPTION_RECORD GS_ExceptionRecord; +static CONTEXT GS_ContextRecord; + +static const EXCEPTION_POINTERS GS_ExceptionPointers = { + &GS_ExceptionRecord,&GS_ContextRecord +}; + +__declspec(selectany) UINT_PTR __security_cookie = DEFAULT_SECURITY_COOKIE; +__declspec(selectany) UINT_PTR __security_cookie_complement = ~(DEFAULT_SECURITY_COOKIE); + +void __cdecl +__security_init_cookie (void) +{ + UINT_PTR cookie; + FT systime = { 0, }; + LARGE_INTEGER perfctr; + + if (__security_cookie != DEFAULT_SECURITY_COOKIE) + { + __security_cookie_complement = ~__security_cookie; + return; + } + + GetSystemTimeAsFileTime (&systime.ft_struct); +#ifdef _WIN64 + cookie = systime.ft_scalar; +#else + cookie = systime.ft_struct.dwLowDateTime; + cookie ^= systime.ft_struct.dwHighDateTime; +#endif + + cookie ^= GetCurrentProcessId (); + cookie ^= GetCurrentThreadId (); + cookie ^= GetTickCount (); + + QueryPerformanceCounter (&perfctr); +#ifdef _WIN64 + cookie ^= perfctr.QuadPart; +#else + cookie ^= perfctr.LowPart; + cookie ^= perfctr.HighPart; +#endif + +#ifdef _WIN64 + cookie &= 0x0000ffffffffffffll; +#endif + + if (cookie == DEFAULT_SECURITY_COOKIE) + cookie = DEFAULT_SECURITY_COOKIE + 1; + __security_cookie = cookie; + __security_cookie_complement = ~cookie; +} + +__declspec(noreturn) void __cdecl +__report_gsfailure (ULONGLONG StackCookie) +{ + volatile UINT_PTR cookie[2]; +#ifdef _WIN64 + ULONG64 controlPC, imgBase, establisherFrame; + PRUNTIME_FUNCTION fctEntry; + PVOID hndData; +#endif + + +#ifdef _WIN64 + RtlCaptureContext (&GS_ContextRecord); + controlPC = GS_ContextRecord.Rip; + fctEntry = RtlLookupFunctionEntry (controlPC, &imgBase, NULL); + if (fctEntry != NULL) + { + RtlVirtualUnwind (UNW_FLAG_NHANDLER, imgBase, controlPC, fctEntry, + &GS_ContextRecord, &hndData, &establisherFrame, NULL); + } + else +#endif + { +#ifdef _WIN64 + GS_ContextRecord.Rip = (ULONGLONG) __builtin_return_address (0); + GS_ContextRecord.Rsp = (ULONGLONG) __builtin_frame_address (0) + 8; +#else + GS_ContextRecord.Eip = (DWORD) __builtin_return_address (0); + GS_ContextRecord.Esp = (DWORD) __builtin_frame_address (0) + 4; +#endif + } + +#ifdef _WIN64 + GS_ExceptionRecord.ExceptionAddress = (PVOID) GS_ContextRecord.Rip; + GS_ContextRecord.Rcx = StackCookie; +#else + GS_ExceptionRecord.ExceptionAddress = (PVOID) GS_ContextRecord.Eip; + GS_ContextRecord.Ecx = StackCookie; +#endif + GS_ExceptionRecord.ExceptionCode = STATUS_STACK_BUFFER_OVERRUN; + GS_ExceptionRecord.ExceptionFlags = EXCEPTION_NONCONTINUABLE; + cookie[0] = __security_cookie; + cookie[1] = __security_cookie_complement; + SetUnhandledExceptionFilter (NULL); + UnhandledExceptionFilter ((EXCEPTION_POINTERS *) &GS_ExceptionPointers); + TerminateProcess (GetCurrentProcess (), STATUS_STACK_BUFFER_OVERRUN); + abort(); +} Index: lib/3rdparty/mingw/internal.h =================================================================== --- lib/3rdparty/mingw/internal.h (Revision 0) +++ lib/3rdparty/mingw/internal.h (Revision 0) @@ -0,0 +1,171 @@ +#ifndef _INC_INTERNAL +#define _INC_INTERNAL + +#include <_mingw.h> +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#define _CRTALLOC(x) __attribute__ ((section (x) )) + +#pragma pack(push,_CRT_PACKING) + + typedef void (__cdecl *_PVFV)(void); + typedef int (__cdecl *_PIFV)(void); + typedef void (__cdecl *_PVFI)(int); + +#if defined (SPECIAL_CRTEXE) && defined (_DLL) + extern int _commode; +#else + _CRTIMP extern int _commode; +#endif + +#define __IOINFO_TM_ANSI 0 +#define __IOINFO_TM_UTF8 1 +#define __IOINFO_TM_UTF16LE 2 + + typedef struct { + intptr_t osfhnd; + char osfile; + char pipech; + int lockinitflag; + CRITICAL_SECTION lock; + char textmode : 7; + char unicode : 1; + char pipech2[2]; + } ioinfo; + +#define IOINFO_ARRAY_ELTS (1 << 5) + +#define _pioinfo(i) (__pioinfo[(i) >> 5] + ((i) & (IOINFO_ARRAY_ELTS - 1))) +#define _osfile(i) (_pioinfo(i)->osfile) +#define _pipech2(i) (_pioinfo(i)->pipech2) +#define _textmode(i) (_pioinfo(i)->textmode) +#define _tm_unicode(i) (_pioinfo(i)->unicode) +#define _pioinfo_safe(i) ((((i) != -1) && ((i) != -2)) ? _pioinfo(i) : &__badioinfo) +#define _osfhnd_safe(i) (_pioinfo_safe(i)->osfhnd) +#define _osfile_safe(i) (_pioinfo_safe(i)->osfile) +#define _pipech_safe(i) (_pioinfo_safe(i)->pipech) +#define _pipech2_safe(i) (_pioinfo_safe(i)->pipech2) +#define _textmode_safe(i) (_pioinfo_safe(i)->textmode) +#define _tm_unicode_safe(i) (_pioinfo_safe(i)->unicode) + +#ifndef __badioinfo + extern ioinfo ** _imp____badioinfo[]; +#define __badioinfo (*_imp____badioinfo) +#endif + +#ifndef __pioinfo + extern ioinfo ** _imp____pioinfo[]; +#define __pioinfo (*_imp____pioinfo) +#endif + +#define _NO_CONSOLE_FILENO (intptr_t)-2 + +#ifndef _FILE_DEFINED +#define _FILE_DEFINED + struct _iobuf { + char *_ptr; + int _cnt; + char *_base; + int _flag; + int _file; + int _charbuf; + int _bufsiz; + char *_tmpfname; + }; + typedef struct _iobuf FILE; +#endif + +#if !defined (_FILEX_DEFINED) && defined (_WINDOWS_) +#define _FILEX_DEFINED + typedef struct { + FILE f; + CRITICAL_SECTION lock; + } _FILEX; +#endif + + extern int _dowildcard; + extern int _newmode; + +#ifndef __winitenv +extern wchar_t ***_imp____winitenv; +#define __winitenv (*_imp____winitenv) +#endif + +#ifndef __initenv +extern char ***_imp____initenv; +#define __initenv (*_imp____initenv) +#endif + +#ifndef _acmdln +extern char **_imp___acmdln; +#define _acmdln (*_imp___acmdln) +/* _CRTIMP extern char *_acmdln; */ +#endif + +#ifndef _wcmdln +extern char **_imp___wcmdln; +#define _wcmdln (*_imp___wcmdln) +/* __CRTIMP extern wchar_t *_wcmdln; */ +#endif + + _CRTIMP void __cdecl _amsg_exit(int); + + int __CRTDECL _setargv(void); + int __CRTDECL __setargv(void); + int __CRTDECL _wsetargv(void); + int __CRTDECL __wsetargv(void); + + int __CRTDECL main(int _Argc, char **_Argv, char **_Env); + int __CRTDECL wmain(int _Argc, wchar_t **_Argv, wchar_t **_Env); + +#ifndef _STARTUP_INFO_DEFINED +#define _STARTUP_INFO_DEFINED + typedef struct { + int newmode; + } _startupinfo; +#endif + + _CRTIMP int __cdecl __getmainargs(int * _Argc, char *** _Argv, char ***_Env, int _DoWildCard, _startupinfo *_StartInfo); + _CRTIMP int __cdecl __wgetmainargs(int * _Argc, wchar_t ***_Argv, wchar_t ***_Env, int _DoWildCard, _startupinfo *_StartInfo); + +#define _CONSOLE_APP 1 +#define _GUI_APP 2 + + typedef enum __enative_startup_state { + __uninitialized, __initializing, __initialized + } __enative_startup_state; + + extern volatile __enative_startup_state __native_startup_state; + extern volatile void *__native_startup_lock; + + extern volatile unsigned int __native_dllmain_reason; + extern volatile unsigned int __native_vcclrit_reason; + + _CRTIMP void __cdecl __set_app_type (int); + + typedef LONG NTSTATUS; + +#include +#include + + void * __cdecl _encode_pointer(void *); + void * __cdecl _encoded_null(); + void * __cdecl _decode_pointer(void *); + + BOOL __cdecl _ValidateImageBase (PBYTE pImageBase); + PIMAGE_SECTION_HEADER __cdecl _FindPESection (PBYTE pImageBase, DWORD_PTR rva); + BOOL __cdecl _IsNonwritableInCurrentImage (PBYTE pTarget); + +#ifdef __cplusplus +} +#endif + +#pragma pack(pop) +#endif Index: lib/3rdparty/mingw/merr.c =================================================================== --- lib/3rdparty/mingw/merr.c (Revision 0) +++ lib/3rdparty/mingw/merr.c (Revision 0) @@ -0,0 +1,12 @@ +#include "internal.h" +#include + +int __defaultmatherr = 1; + +int __CRTDECL +_matherr (struct _exception *pexcept) +{ + /* Make compiler happy. */ + pexcept = pexcept; + return 0; +} Index: lib/3rdparty/mingw/mingw.rbuild =================================================================== --- lib/3rdparty/mingw/mingw.rbuild (Revision 37928) +++ lib/3rdparty/mingw/mingw.rbuild (Arbeitskopie) @@ -4,35 +4,48 @@ include - cpu_features.c - CRTfmode.c - CRTglob.c - CRTinit.c + kernel32 + _newmode.c + _wgetopt.c + argv.c + atonexit.c + binmode.c + charmax.c + cinitexe.c + CRT_fp10.c + CRT_fp8.c + dllentry.c gccmain.c getopt.c - isascii.c - iscsym.c - iscsymf.c - toascii.c - _wgetopt.c - - pseudo-reloc.c - + gs_support.c + merr.c + mingw_helpers.c + natstart.c + pesect.c + pseudo-reloc.c + pseudo-reloc-list.c + tlssup.c + wildcard.c + xncommod.c + xthdloc.c + xtxtmode.c include - binmode.c - crt1.c - main.c + crt0_c.c + crtexe.c + dllargv.c - + include - wbinmode.c - wcrt1.c - wmain.c + + crt0_w.c + crtexe.c + dllargv.c include - dllcrt1.c + dllargv.c + crtdll.c Index: lib/3rdparty/mingw/mingw_helpers.c =================================================================== --- lib/3rdparty/mingw/mingw_helpers.c (Revision 0) +++ lib/3rdparty/mingw/mingw_helpers.c (Revision 0) @@ -0,0 +1,25 @@ +#include "oscalls.h" +#include "internal.h" +#include +#include +#include +#include +#include + +const PIMAGE_TLS_CALLBACK __dyn_tls_init_callback; + +void * __cdecl +_decode_pointer (void *codedptr) +{ + return (void *) codedptr; +} + +void * __cdecl +_encode_pointer (void *ptr) +{ + return ptr; +} + +/* 0:console, 1:windows. */ +int mingw_app_type = 0; + Index: lib/3rdparty/mingw/moldname-msvcrt.def =================================================================== --- lib/3rdparty/mingw/moldname-msvcrt.def (Revision 37928) +++ lib/3rdparty/mingw/moldname-msvcrt.def (Arbeitskopie) @@ -1,5 +1,3 @@ - - ; ; moldname-msvcrt.def ; @@ -58,7 +56,6 @@ ; fpreset fputchar fputwchar -fstat ftime gcvt getch @@ -98,7 +95,6 @@ spawnve spawnvp spawnvpe -stat strcmpi strdup stricmp @@ -151,9 +147,3 @@ hypot logb nextafter - -; Additional definitions for ReactOS: -snwprintf -snprintf -strtoull=_strtoui64 -vsnprintf Index: lib/3rdparty/mingw/natstart.c =================================================================== --- lib/3rdparty/mingw/natstart.c (Revision 0) +++ lib/3rdparty/mingw/natstart.c (Revision 0) @@ -0,0 +1,7 @@ +#include "internal.h" + +_PGLOBAL +volatile unsigned int __native_dllmain_reason = UINT_MAX; +volatile unsigned int __native_vcclrit_reason = UINT_MAX; +volatile __enative_startup_state __native_startup_state; +volatile void *__native_startup_lock; Index: lib/3rdparty/mingw/oscalls.h =================================================================== --- lib/3rdparty/mingw/oscalls.h (Revision 0) +++ lib/3rdparty/mingw/oscalls.h (Revision 0) @@ -0,0 +1,41 @@ +#ifndef _INC_OSCALLS +#define _INC_OSCALLS + +#include <_mingw.h> + +#ifdef NULL +#undef NULL +#endif + +#define NOMINMAX + +#define _WIN32_FUSION 0x0100 +#include + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +typedef struct _FTIME +{ + unsigned short twosecs : 5; + unsigned short minutes : 6; + unsigned short hours : 5; +} FTIME; + +typedef FTIME *PFTIME; + +typedef struct _FDATE +{ + unsigned short day : 5; + unsigned short month : 4; + unsigned short year : 7; +} FDATE; + +typedef FDATE *PFDATE; + +#endif Index: lib/3rdparty/mingw/pesect.c =================================================================== --- lib/3rdparty/mingw/pesect.c (Revision 0) +++ lib/3rdparty/mingw/pesect.c (Revision 0) @@ -0,0 +1,66 @@ +#include + +#if defined (_WIN64) && defined (__ia64__) +#error FIXME: Unsupported __ImageBase implementation. +#else +/* Hack, for bug in ld. Will be removed soon. */ +#define __ImageBase _image_base__ +/* This symbol is defined by the linker. */ +extern IMAGE_DOS_HEADER __ImageBase; +#endif + +BOOL +_ValidateImageBase (PBYTE pImageBase) +{ + PIMAGE_DOS_HEADER pDOSHeader; + PIMAGE_NT_HEADERS pNTHeader; + PIMAGE_OPTIONAL_HEADER pOptHeader; + + pDOSHeader = (PIMAGE_DOS_HEADER) pImageBase; + if (pDOSHeader->e_magic != IMAGE_DOS_SIGNATURE) + return FALSE; + pNTHeader = (PIMAGE_NT_HEADERS) ((PBYTE) pDOSHeader + pDOSHeader->e_lfanew); + if (pNTHeader->Signature != IMAGE_NT_SIGNATURE) + return FALSE; + pOptHeader = (PIMAGE_OPTIONAL_HEADER) &pNTHeader->OptionalHeader; + if (pOptHeader->Magic != IMAGE_NT_OPTIONAL_HDR_MAGIC) + return FALSE; + return TRUE; +} + +PIMAGE_SECTION_HEADER +_FindPESection (PBYTE pImageBase, DWORD_PTR rva) +{ + PIMAGE_NT_HEADERS pNTHeader; + PIMAGE_SECTION_HEADER pSection; + unsigned int iSection; + + pNTHeader = (PIMAGE_NT_HEADERS) (pImageBase + ((PIMAGE_DOS_HEADER) pImageBase)->e_lfanew); + + for (iSection = 0, pSection = IMAGE_FIRST_SECTION (pNTHeader); + iSection < pNTHeader->FileHeader.NumberOfSections; + ++iSection,++pSection) + { + if (rva >= pSection->VirtualAddress + && rva < pSection->VirtualAddress + pSection->Misc.VirtualSize) + return pSection; + } + return NULL; +} + +BOOL +_IsNonwritableInCurrentImage (PBYTE pTarget) +{ + PBYTE pImageBase; + DWORD_PTR rvaTarget; + PIMAGE_SECTION_HEADER pSection; + + pImageBase = (PBYTE) &__ImageBase; + if (! _ValidateImageBase (pImageBase)) + return FALSE; + rvaTarget = pTarget - pImageBase; + pSection = _FindPESection (pImageBase, rvaTarget); + if (pSection == NULL) + return FALSE; + return (pSection->Characteristics & IMAGE_SCN_MEM_WRITE) == 0; +} Index: lib/3rdparty/mingw/pseudo-reloc-list.c =================================================================== --- lib/3rdparty/mingw/pseudo-reloc-list.c (Revision 0) +++ lib/3rdparty/mingw/pseudo-reloc-list.c (Revision 0) @@ -0,0 +1,2 @@ +char __RUNTIME_PSEUDO_RELOC_LIST_END__ = 0; +char __RUNTIME_PSEUDO_RELOC_LIST__ = 0; Index: lib/3rdparty/mingw/pseudo-reloc.c =================================================================== --- lib/3rdparty/mingw/pseudo-reloc.c (Revision 37928) +++ lib/3rdparty/mingw/pseudo-reloc.c (Arbeitskopie) @@ -1,46 +1,127 @@ -/* pseudo-reloc.c - - Written by Egor Duda - THIS SOFTWARE IS NOT COPYRIGHTED - - This source code is offered for use in the public domain. You may - use, modify or distribute it freely. - - This code is distributed in the hope that it will be useful but - WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY - DISCLAMED. This includes but is not limited to warrenties of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -*/ - +/* Only necesary on x86 and amd64 targets */ +#if defined(__i386__) || defined(__x86_64__) #include +#include extern char __RUNTIME_PSEUDO_RELOC_LIST__; extern char __RUNTIME_PSEUDO_RELOC_LIST_END__; extern char _image_base__; -typedef struct - { - DWORD addend; - DWORD target; - } -runtime_pseudo_reloc; +typedef struct { + DWORD addend; + DWORD target; +} runtime_pseudo_reloc_item_v1; +typedef struct { + DWORD sym; + DWORD target; + DWORD flags; +} runtime_pseudo_reloc_item_v2; + +typedef struct { + DWORD magic1; + DWORD magic2; + DWORD version; +} runtime_pseudo_reloc_v2; + +#define RP_VERSION_V1 0 +#define RP_VERSION_V2 1 + static void -do_pseudo_reloc (void* start, void* end, void* base) +do_pseudo_reloc (void* start,void *end,void *base) { - ptrdiff_t reloc_target; - runtime_pseudo_reloc* r; - for (r = (runtime_pseudo_reloc*) start; r < (runtime_pseudo_reloc*) end; r++) + ptrdiff_t addr_imp, reldata; + ptrdiff_t reloc_target = (ptrdiff_t) ((char *)end - (char*)start); + runtime_pseudo_reloc_v2 *v2_hdr = (runtime_pseudo_reloc_v2 *) start; + runtime_pseudo_reloc_item_v2 *r; + + if (reloc_target < 8) + return; + /* Check if this is old version pseudo relocation version. */ + if (reloc_target >= 12 + && v2_hdr->magic1 == 0 && v2_hdr->magic2 == 0 + && v2_hdr->version == RP_VERSION_V1) + v2_hdr++; + if (v2_hdr->magic1 != 0 || v2_hdr->magic2 != 0) { + runtime_pseudo_reloc_item_v1 *o; + for (o = (runtime_pseudo_reloc_item_v1 *) v2_hdr; o < (runtime_pseudo_reloc_item_v1 *)end; o++) + { + reloc_target = (ptrdiff_t) base + o->target; + *((DWORD*) reloc_target) += o->addend; + } + return; + } + /* Check if this is a known version. */ + if (v2_hdr->version != RP_VERSION_V2) + { + fprintf (stderr, "pseudo_relocation protocol version %d is unknown to this runtime.\n", + (int) v2_hdr->version); + return; + } + /* Walk over header. */ + r = (runtime_pseudo_reloc_item_v2 *) &v2_hdr[1]; + + for (; r < (runtime_pseudo_reloc_item_v2 *) end; r++) + { reloc_target = (ptrdiff_t) base + r->target; - *((ptrdiff_t*) reloc_target) += r->addend; + addr_imp = (ptrdiff_t) base + r->sym; + addr_imp = *((ptrdiff_t *) addr_imp); + + switch ((r->flags&0xff)) + { + case 8: + reldata = (ptrdiff_t) (*((unsigned char *)reloc_target)); + if ((reldata&0x80) != 0) + reldata |= ~((ptrdiff_t) 0xff); + break; + case 16: + reldata = (ptrdiff_t) (*((unsigned short *)reloc_target)); + if ((reldata&0x8000) != 0) + reldata |= ~((ptrdiff_t) 0xffff); + break; + case 32: + reldata = (ptrdiff_t) (*((unsigned int *)reloc_target)); +#ifdef _WIN64 + if ((reldata&0x80000000) != 0) + reldata |= ~((ptrdiff_t) 0xffffffff); +#endif + break; +#ifdef _WIN64 + case 64: + reldata = (ptrdiff_t) (*((unsigned long long *)reloc_target)); + break; +#endif + default: + reldata=0; + fprintf(stderr, "Unknown pseudo relocation bit size %d\n",(int) (r->flags & 0xff)); + break; + } + reldata -= ((ptrdiff_t) base + r->sym); + reldata += addr_imp; + switch ((r->flags & 0xff)) + { + case 8: + *((unsigned char*)reloc_target)=(unsigned char) reldata; + break; + case 16: + *((unsigned short*)reloc_target)=(unsigned short) reldata; + break; + case 32: + *((unsigned int*)reloc_target)=(unsigned int) reldata; + break; +#ifdef _WIN64 + case 64: + *((unsigned long long*)reloc_target)=(unsigned long long) reldata; + break; +#endif + } } } void _pei386_runtime_relocator () { - do_pseudo_reloc (&__RUNTIME_PSEUDO_RELOC_LIST__, - &__RUNTIME_PSEUDO_RELOC_LIST_END__, - &_image_base__); + do_pseudo_reloc (&__RUNTIME_PSEUDO_RELOC_LIST__,&__RUNTIME_PSEUDO_RELOC_LIST_END__,&_image_base__); } +#endif Index: lib/3rdparty/mingw/tlssup.c =================================================================== --- lib/3rdparty/mingw/tlssup.c (Revision 0) +++ lib/3rdparty/mingw/tlssup.c (Revision 0) @@ -0,0 +1,129 @@ +#ifdef CRTDLL +#undef CRTDLL +#endif + +#include "internal.h" +#include +#include +#include + +#define FUNCS_PER_NODE 30 + +typedef struct TlsDtorNode { + int count; + struct TlsDtorNode *next; + _PVFV funcs[FUNCS_PER_NODE]; +} TlsDtorNode; + +ULONG _tls_index = 0; + +_CRTALLOC(".tls") char _tls_start = 0; +_CRTALLOC(".tls$ZZZ") char _tls_end = 0; + +_CRTALLOC(".CRT$XLA") PIMAGE_TLS_CALLBACK __xl_a = 0; +_CRTALLOC(".CRT$XLZ") PIMAGE_TLS_CALLBACK __xl_z = 0; + +#ifdef _WIN64 +_CRTALLOC(".rdata$T") const IMAGE_TLS_DIRECTORY64 _tls_used = { + (ULONGLONG) &_tls_start, (ULONGLONG) &_tls_end, (ULONGLONG) &_tls_index, + (ULONGLONG) (&__xl_a+1), (ULONG) 0, (ULONG) 0 +}; +#else +_CRTALLOC(".rdata$T") const IMAGE_TLS_DIRECTORY _tls_used = { + (ULONG)(ULONG_PTR) &_tls_start, (ULONG)(ULONG_PTR) &_tls_end, + (ULONG)(ULONG_PTR) &_tls_index, (ULONG)(ULONG_PTR) (&__xl_a+1), + (ULONG) 0, (ULONG) 0 +}; +#endif + +#ifndef __CRT_THREAD +#ifdef HAVE_ATTRIBUTE_THREAD +#define __CRT_THREAD __declspec(thread) +#else +#define __CRT_THREAD +#endif +#endif + +static _CRTALLOC(".CRT$XDA") _PVFV __xd_a = 0; +static _CRTALLOC(".CRT$XDZ") _PVFV __xd_z = 0; +static __CRT_THREAD TlsDtorNode *dtor_list; +static __CRT_THREAD TlsDtorNode dtor_list_head; + +BOOL WINAPI +__dyn_tls_init (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) +{ + _PVFV *pfunc; + + //DbgPrint("__dyn_tls_init: hDllHandle %p, dwReason %d\n", hDllHandle,dwReason); + if (dwReason != DLL_THREAD_ATTACH) + return TRUE; + + for (pfunc = &__xd_a + 1; pfunc != &__xd_z; ++pfunc) + { + //DbgPrint("pfunc at %p\n",pfunc); + if (*pfunc != NULL) + (*pfunc)(); + } + + return TRUE; +} + +const PIMAGE_TLS_CALLBACK __dyn_tls_init_callback = (const PIMAGE_TLS_CALLBACK) __dyn_tls_init; +_CRTALLOC(".CRT$XLC") PIMAGE_TLS_CALLBACK __xl_c = (PIMAGE_TLS_CALLBACK) __dyn_tls_init; + +int __cdecl +__tlregdtor (_PVFV func) +{ + //DbgPrint("__tlregdtor: func %p\n",func); + + if (dtor_list == NULL) + { + dtor_list = &dtor_list_head; + dtor_list_head.count = 0; + } + else if (dtor_list->count == FUNCS_PER_NODE) + { + TlsDtorNode *pnode = (TlsDtorNode *) malloc (sizeof (TlsDtorNode)); + if (pnode == NULL) + return -1; + pnode->count = 0; + pnode->next = dtor_list; + dtor_list = pnode; + + dtor_list->count = 0; + } + dtor_list->funcs[dtor_list->count++] = func; + return 0; +} + +static BOOL WINAPI +__dyn_tls_dtor (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) +{ + + TlsDtorNode *pnode, *pnext; + int i; + + //DbgPrint("__dyn_tls_dtor: hDllHandle %p, dwReason %d\n"); + if (dwReason != DLL_THREAD_DETACH && dwReason != DLL_PROCESS_DETACH) + return TRUE; + + for (pnode = dtor_list; pnode != NULL; pnode = pnext) + { + for (i = pnode->count - 1; i >= 0; --i) + { + if (pnode->funcs[i] != NULL) + (*pnode->funcs[i])(); + } + pnext = pnode->next; + if (pnext != NULL) + free ((void *) pnode); + } + return TRUE; +} + +_CRTALLOC(".CRT$XLD") PIMAGE_TLS_CALLBACK __xl_d = (PIMAGE_TLS_CALLBACK) __dyn_tls_dtor; + + +int mingw_initltsdrot_force = 0; +int mingw_initltsdyn_force=0; +int mingw_initltssuo_force = 0; Index: lib/3rdparty/mingw/wildcard.c =================================================================== --- lib/3rdparty/mingw/wildcard.c (Revision 0) +++ lib/3rdparty/mingw/wildcard.c (Revision 0) @@ -0,0 +1 @@ +int _dowildcard = 0; Index: lib/3rdparty/mingw/xncommod.c =================================================================== --- lib/3rdparty/mingw/xncommod.c (Revision 0) +++ lib/3rdparty/mingw/xncommod.c (Revision 0) @@ -0,0 +1 @@ +int _commode = 0; Index: lib/3rdparty/mingw/xthdloc.c =================================================================== --- lib/3rdparty/mingw/xthdloc.c (Revision 0) +++ lib/3rdparty/mingw/xthdloc.c (Revision 0) @@ -0,0 +1 @@ +int __globallocalestatus = ~0x1; Index: lib/3rdparty/mingw/xtxtmode.c =================================================================== --- lib/3rdparty/mingw/xtxtmode.c (Revision 0) +++ lib/3rdparty/mingw/xtxtmode.c (Revision 0) @@ -0,0 +1 @@ +int _fmode = 0; Index: lib/drivers/oskittcp/include/freebsd/src/sys/machine/endian.h =================================================================== --- lib/drivers/oskittcp/include/freebsd/src/sys/machine/endian.h (Revision 37928) +++ lib/drivers/oskittcp/include/freebsd/src/sys/machine/endian.h (Arbeitskopie) @@ -56,7 +56,6 @@ #include #endif -#ifdef _MSC_VER static inline unsigned long __byte_swap_long ( unsigned long i ) { char dst[4]; @@ -76,41 +75,6 @@ dst[1] = src[0]; return *(unsigned short*)&dst[0]; } -#else/*_MSC_VER*/ -#define __word_swap_long(x) \ -({ register u_long __X = (x); \ - __asm ("rorl $16, %1" \ - : "=r" (__X) \ - : "0" (__X)); \ - __X; }) -#if __GNUC__ >= 2 -#define __byte_swap_long(x) \ -__extension__ ({ register u_long __X = (x); \ - __asm ("xchgb %h1, %b1\n\trorl $16, %1\n\txchgb %h1, %b1" \ - : "=q" (__X) \ - : "0" (__X)); \ - __X; }) -#define __byte_swap_word(x) \ -__extension__ ({ register u_short __X = (x); \ - __asm ("xchgb %h1, %b1" \ - : "=q" (__X) \ - : "0" (__X)); \ - __X; }) -#else /* __GNUC__ >= 2 */ -#define __byte_swap_long(x) \ -({ register u_long __X = (x); \ - __asm ("rorw $8, %w1\n\trorl $16, %1\n\trorw $8, %w1" \ - : "=r" (__X) \ - : "0" (__X)); \ - __X; }) -#define __byte_swap_word(x) \ -({ register u_short __X = (x); \ - __asm ("rorw $8, %w1" \ - : "=r" (__X) \ - : "0" (__X)); \ - __X; }) -#endif /* __GNUC__ >= 2 */ -#endif /* _MSC_VER */ /* * Macros for network/external number representation conversion. Index: lib/drivers/oskittcp/include/freebsd/src/sys/sys/types.h =================================================================== --- lib/drivers/oskittcp/include/freebsd/src/sys/sys/types.h (Revision 37928) +++ lib/drivers/oskittcp/include/freebsd/src/sys/sys/types.h (Arbeitskopie) @@ -126,6 +126,7 @@ #ifdef _BSD_SSIZE_T_ typedef _BSD_SSIZE_T_ ssize_t; +#define _SSIZE_T_DEFINED #undef _BSD_SSIZE_T_ #endif Index: lib/inflib/builddep.h =================================================================== --- lib/inflib/builddep.h (Revision 37928) +++ lib/inflib/builddep.h (Arbeitskopie) @@ -28,6 +28,8 @@ #define INF_SUCCESS(x) (0 == (x)) typedef char TCHAR, *PTCHAR, *PTSTR; +typedef const TCHAR *PCTSTR; + #define _T(x) x #define _tcsicmp strcasecmp #define _tcslen strlen @@ -46,11 +48,11 @@ #define UNICODE #define _UNICODE -#include #define WIN32_NO_STATUS #include #define NTOS_MODE_USER #include +#include extern PVOID InfpHeap; @@ -70,6 +72,4 @@ #endif /* INFLIB_HOST */ -typedef const TCHAR *PCTSTR; - /* EOF */ Index: lib/sdk/crt/conio/getch.c =================================================================== --- lib/sdk/crt/conio/getch.c (Revision 37928) +++ lib/sdk/crt/conio/getch.c (Arbeitskopie) @@ -31,7 +31,7 @@ * ENABLE_ECHO_INPUT and ENABLE_LINE_INPUT if they're currently * switched on. */ - ConsoleHandle = (HANDLE) _get_osfhandle(stdin->_file); + ConsoleHandle = (HANDLE)(ULONG_PTR) _get_osfhandle(stdin->_file); RestoreMode = GetConsoleMode(ConsoleHandle, &ConsoleMode) && (0 != (ConsoleMode & (ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT))); @@ -39,7 +39,7 @@ SetConsoleMode(ConsoleHandle, ConsoleMode & (~ (ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT))); } - ReadConsoleA((HANDLE)_get_osfhandle(stdin->_file), + ReadConsoleA((HANDLE)(ULONG_PTR)_get_osfhandle(stdin->_file), &c, 1, &NumberOfCharsRead, Index: lib/sdk/crt/crt.rbuild =================================================================== --- lib/sdk/crt/crt.rbuild (Revision 37928) +++ lib/sdk/crt/crt.rbuild (Arbeitskopie) @@ -15,7 +15,7 @@ - + chkstk . include @@ -69,6 +69,12 @@ seh.s + + + seh.s + chkstk_asm.s + + xcptfil.c @@ -88,6 +94,14 @@ statfp.c + + + clearfp.c + cntrlfp.c + logb.c + statfp.c + + locale.c @@ -146,6 +160,14 @@ ldexp.c + + + atan2.c + exp.c + fmod.c + ldexp.c + + stubs.c @@ -272,13 +294,17 @@ access.c file.c find.c + find64.c fmode.c lnx_sprintf.c perror.c popen.c + stat.c + stat64.c waccess.c wfind.c wpopen.c + wstat.c _exit.c Index: lib/sdk/crt/include/internal/file.h =================================================================== --- lib/sdk/crt/include/internal/file.h (Revision 37928) +++ lib/sdk/crt/include/internal/file.h (Arbeitskopie) @@ -127,10 +127,10 @@ #define MB_CUR_MAX __mb_cur_max -int _isnanl(long double x); -int _isinfl(long double x); -int _isnan(double x); -int _isinf(double x); +//int _isnanl(long double x); +//int _isinfl(long double x); +//int _isnan(double x); +//int _isinf(double x); /* Flags for the iobuf structure (for reference) */ #if 0 @@ -172,10 +172,9 @@ wint_t _filwbuf(FILE *f); -#if __MINGW32_MAJOR_VERSION < 3 || __MINGW32_MINOR_VERSION < 2 - int __cdecl _filbuf (FILE*); - int __cdecl _flsbuf (int, FILE*); -#endif +//#if __MINGW32_MAJOR_VERSION < 3 || __MINGW32_MINOR_VERSION < 2 +// int __cdecl _filbuf (FILE*); +// int __cdecl _flsbuf (int, FILE*); +//#endif #endif /* __dj_include_libc_file_h__ */ - Index: lib/sdk/crt/process/process.c =================================================================== --- lib/sdk/crt/process/process.c (Revision 37928) +++ lib/sdk/crt/process/process.c (Arbeitskopie) @@ -323,7 +323,7 @@ /* * @implemented */ -int _tspawnl(int mode, const _TCHAR *cmdname, const _TCHAR* arg0, ...) +intptr_t _tspawnl(int mode, const _TCHAR *cmdname, const _TCHAR* arg0, ...) { va_list argp; _TCHAR* args; @@ -345,7 +345,7 @@ /* * @implemented */ -int _tspawnv(int mode, const _TCHAR *cmdname, const _TCHAR* const* argv) +intptr_t _tspawnv(int mode, const _TCHAR *cmdname, const _TCHAR* const* argv) { _TCHAR* args; int ret = -1; @@ -365,7 +365,7 @@ /* * @implemented */ -int _tspawnle(int mode, const _TCHAR *cmdname, const _TCHAR* arg0, ... /*, NULL, const char* const* envp*/) +intptr_t _tspawnle(int mode, const _TCHAR *cmdname, const _TCHAR* arg0, ... /*, NULL, const char* const* envp*/) { va_list argp; _TCHAR* args; @@ -400,7 +400,7 @@ /* * @implemented */ -int _tspawnve(int mode, const _TCHAR *cmdname, const _TCHAR* const* argv, const _TCHAR* const* envp) +intptr_t _tspawnve(int mode, const _TCHAR *cmdname, const _TCHAR* const* argv, const _TCHAR* const* envp) { _TCHAR *args; _TCHAR *envs; @@ -426,7 +426,7 @@ /* * @implemented */ -int _tspawnvp(int mode, const _TCHAR* cmdname, const _TCHAR* const* argv) +intptr_t _tspawnvp(int mode, const _TCHAR* cmdname, const _TCHAR* const* argv) { _TCHAR pathname[FILENAME_MAX]; @@ -438,7 +438,7 @@ /* * @implemented */ -int _tspawnlp(int mode, const _TCHAR* cmdname, const _TCHAR* arg0, .../*, NULL*/) +intptr_t _tspawnlp(int mode, const _TCHAR* cmdname, const _TCHAR* arg0, .../*, NULL*/) { va_list argp; _TCHAR* args; @@ -461,7 +461,7 @@ /* * @implemented */ -int _tspawnlpe(int mode, const _TCHAR* cmdname, const _TCHAR* arg0, .../*, NULL, const char* const* envp*/) +intptr_t _tspawnlpe(int mode, const _TCHAR* cmdname, const _TCHAR* arg0, .../*, NULL, const char* const* envp*/) { va_list argp; _TCHAR* args; @@ -496,7 +496,7 @@ /* * @implemented */ -int _tspawnvpe(int mode, const _TCHAR* cmdname, const _TCHAR* const* argv, const _TCHAR* const* envp) +intptr_t _tspawnvpe(int mode, const _TCHAR* cmdname, const _TCHAR* const* argv, const _TCHAR* const* envp) { _TCHAR pathname[FILENAME_MAX]; @@ -508,7 +508,7 @@ /* * @implemented */ -int _texecl(const _TCHAR* cmdname, const _TCHAR* arg0, ...) +intptr_t _texecl(const _TCHAR* cmdname, const _TCHAR* arg0, ...) { _TCHAR* args; va_list argp; @@ -530,7 +530,7 @@ /* * @implemented */ -int _texecv(const _TCHAR* cmdname, const _TCHAR* const* argv) +intptr_t _texecv(const _TCHAR* cmdname, const _TCHAR* const* argv) { TRACE(MK_STR(_texecv)"('%"sT"')\n", cmdname); return _tspawnv(P_OVERLAY, cmdname, argv); @@ -539,7 +539,7 @@ /* * @implemented */ -int _texecle(const _TCHAR* cmdname, const _TCHAR* arg0, ... /*, NULL, char* const* envp */) +intptr_t _texecle(const _TCHAR* cmdname, const _TCHAR* arg0, ... /*, NULL, char* const* envp */) { va_list argp; _TCHAR* args; @@ -573,7 +573,7 @@ /* * @implemented */ -int _texecve(const _TCHAR* cmdname, const _TCHAR* const* argv, const _TCHAR* const* envp) +intptr_t _texecve(const _TCHAR* cmdname, const _TCHAR* const* argv, const _TCHAR* const* envp) { TRACE(MK_STR(_texecve)"('%"sT"')\n", cmdname); return _tspawnve(P_OVERLAY, cmdname, argv, envp); @@ -582,7 +582,7 @@ /* * @implemented */ -int _texeclp(const _TCHAR* cmdname, const _TCHAR* arg0, ...) +intptr_t _texeclp(const _TCHAR* cmdname, const _TCHAR* arg0, ...) { _TCHAR* args; va_list argp; @@ -605,7 +605,7 @@ /* * @implemented */ -int _texecvp(const _TCHAR* cmdname, const _TCHAR* const* argv) +intptr_t _texecvp(const _TCHAR* cmdname, const _TCHAR* const* argv) { TRACE(MK_STR(_texecvp)"('%"sT"')\n", cmdname); return _tspawnvp(P_OVERLAY, cmdname, argv); @@ -614,7 +614,7 @@ /* * @implemented */ -int _texeclpe(const _TCHAR* cmdname, const _TCHAR* arg0, ... /*, NULL, char* const* envp */) +intptr_t _texeclpe(const _TCHAR* cmdname, const _TCHAR* arg0, ... /*, NULL, char* const* envp */) { va_list argp; _TCHAR* args; @@ -649,7 +649,7 @@ /* * @implemented */ -int _texecvpe(const _TCHAR* cmdname, const _TCHAR* const* argv, const _TCHAR* const* envp) +intptr_t _texecvpe(const _TCHAR* cmdname, const _TCHAR* const* argv, const _TCHAR* const* envp) { TRACE(MK_STR(_texecvpe)"('%"sT"')\n", cmdname); return _tspawnvpe(P_OVERLAY, cmdname, argv, envp); Index: lib/sdk/crt/stdio/file.c =================================================================== --- lib/sdk/crt/stdio/file.c (Revision 37928) +++ lib/sdk/crt/stdio/file.c (Arbeitskopie) @@ -69,11 +69,6 @@ #undef vprintf #undef vwprintf -/* for stat mode, permissions apply to all,owner and group */ -#define ALL_S_IREAD (_S_IREAD | (_S_IREAD >> 3) | (_S_IREAD >> 6)) -#define ALL_S_IWRITE (_S_IWRITE | (_S_IWRITE >> 3) | (_S_IWRITE >> 6)) -#define ALL_S_IEXEC (_S_IEXEC | (_S_IEXEC >> 3) | (_S_IEXEC >> 6)) - /* _access() bit flags FIXME: incomplete */ /* defined in crt/io.h */ @@ -95,7 +90,7 @@ DWORD unkn[7]; /* critical section and init flag */ } ioinfo; -/*static */ioinfo fdesc[MAX_FILES]; +ioinfo fdesc[MAX_FILES]; FILE _iob[3] = { { 0 } }; @@ -111,17 +106,6 @@ /* INTERNAL: Static buffer for temp file name */ static char tmpname[MAX_PATH]; -static const unsigned int EXE = 'e' << 16 | 'x' << 8 | 'e'; -static const unsigned int BAT = 'b' << 16 | 'a' << 8 | 't'; -static const unsigned int CMD = 'c' << 16 | 'm' << 8 | 'd'; -static const unsigned int COM = 'c' << 16 | 'o' << 8 | 'm'; - -#define TOUL(x) (ULONGLONG)(x) -static const ULONGLONG WCEXE = TOUL('e') << 32 | TOUL('x') << 16 | TOUL('e'); -static const ULONGLONG WCBAT = TOUL('b') << 32 | TOUL('a') << 16 | TOUL('t'); -static const ULONGLONG WCCMD = TOUL('c') << 32 | TOUL('m') << 16 | TOUL('d'); -static const ULONGLONG WCCOM = TOUL('c') << 32 | TOUL('o') << 16 | TOUL('m'); - /* This critical section protects the tables fdesc and fstreams, * and their related indexes, fdstart, fdend, * and stream_idx, from race conditions. @@ -133,36 +117,21 @@ #define LOCK_FILES() do { EnterCriticalSection(&FILE_cs); } while (0) #define UNLOCK_FILES() do { LeaveCriticalSection(&FILE_cs); } while (0) -static void stat64_to_stat(const struct __stat64 *buf64, struct _stat *buf) -{ - buf->st_dev = buf64->st_dev; - buf->st_ino = buf64->st_ino; - buf->st_mode = buf64->st_mode; - buf->st_nlink = buf64->st_nlink; - buf->st_uid = buf64->st_uid; - buf->st_gid = buf64->st_gid; - buf->st_rdev = buf64->st_rdev; - buf->st_size = buf64->st_size; - buf->st_atime = buf64->st_atime; - buf->st_mtime = buf64->st_mtime; - buf->st_ctime = buf64->st_ctime; -} +//void stat64_to_stati64(const struct __stat64 *buf64, struct _stati64 *buf) +//{ +// buf->st_dev = buf64->st_dev; +// buf->st_ino = buf64->st_ino; +// buf->st_mode = buf64->st_mode; +// buf->st_nlink = buf64->st_nlink; +// buf->st_uid = buf64->st_uid; +// buf->st_gid = buf64->st_gid; +// buf->st_rdev = buf64->st_rdev; +// buf->st_size = buf64->st_size; +// buf->st_atime = buf64->st_atime; +// buf->st_mtime = buf64->st_mtime; +// buf->st_ctime = buf64->st_ctime; +//} -static void stat64_to_stati64(const struct __stat64 *buf64, struct _stati64 *buf) -{ - buf->st_dev = buf64->st_dev; - buf->st_ino = buf64->st_ino; - buf->st_mode = buf64->st_mode; - buf->st_nlink = buf64->st_nlink; - buf->st_uid = buf64->st_uid; - buf->st_gid = buf64->st_gid; - buf->st_rdev = buf64->st_rdev; - buf->st_size = buf64->st_size; - buf->st_atime = buf64->st_atime; - buf->st_mtime = buf64->st_mtime; - buf->st_ctime = buf64->st_ctime; -} - static inline BOOL is_valid_fd(int fd) { return fd >= 0 && fd < fdend && (fdesc[fd].wxflag & WX_OPEN); @@ -174,7 +143,7 @@ * it returns a valid handle which is about to be closed, a subsequent call * will fail, most likely in a sane way. */ -static HANDLE fdtoh(int fd) +HANDLE fdtoh(int fd) { if (!is_valid_fd(fd)) { @@ -495,7 +464,7 @@ */ FILE * CDECL __p__iob(void) { - return &_iob[0]; + return _iob; } /********************************************************************* @@ -1169,92 +1138,6 @@ } /********************************************************************* - * _fstat64 (MSVCRT.@) - */ -int CDECL _fstat64(int fd, struct __stat64* buf) -{ - DWORD dw; - DWORD type; - BY_HANDLE_FILE_INFORMATION hfi; - HANDLE hand = fdtoh(fd); - - TRACE(":fd (%d) stat (%p)\n",fd,buf); - if (hand == INVALID_HANDLE_VALUE) - return -1; - - if (!buf) - { - WARN(":failed-NULL buf\n"); - __set_errno(ERROR_INVALID_PARAMETER); - return -1; - } - - memset(&hfi, 0, sizeof(hfi)); - memset(buf, 0, sizeof(struct __stat64)); - type = GetFileType(hand); - if (type == FILE_TYPE_PIPE) - { - buf->st_dev = buf->st_rdev = fd; - buf->st_mode = S_IFIFO; - buf->st_nlink = 1; - } - else if (type == FILE_TYPE_CHAR) - { - buf->st_dev = buf->st_rdev = fd; - buf->st_mode = S_IFCHR; - buf->st_nlink = 1; - } - else /* FILE_TYPE_DISK etc. */ - { - if (!GetFileInformationByHandle(hand, &hfi)) - { - WARN(":failed-last error (%d)\n",GetLastError()); - __set_errno(ERROR_INVALID_PARAMETER); - return -1; - } - buf->st_mode = S_IFREG | S_IREAD; - if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) - buf->st_mode |= S_IWRITE; - buf->st_size = ((__int64)hfi.nFileSizeHigh << 32) + hfi.nFileSizeLow; - RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastAccessTime, &dw); - buf->st_atime = dw; - RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw); - buf->st_mtime = buf->st_ctime = dw; - buf->st_nlink = hfi.nNumberOfLinks; - } - TRACE(":dwFileAttributes = 0x%x, mode set to 0x%x\n",hfi.dwFileAttributes, - buf->st_mode); - return 0; -} - -/********************************************************************* - * _fstati64 (MSVCRT.@) - */ -int CDECL _fstati64(int fd, struct _stati64* buf) -{ - int ret; - struct __stat64 buf64; - - ret = _fstat64(fd, &buf64); - if (!ret) - stat64_to_stati64(&buf64, buf); - return ret; -} - -/********************************************************************* - * _fstat (MSVCRT.@) - */ -int CDECL _fstat(int fd, struct _stat* buf) -{ int ret; - struct __stat64 buf64; - - ret = _fstat64(fd, &buf64); - if (!ret) - stat64_to_stat(&buf64, buf); - return ret; -} - -/********************************************************************* * _futime (MSVCRT.@) */ int CDECL _futime(int fd, struct _utimbuf *t) @@ -1292,12 +1175,12 @@ /********************************************************************* * _get_osfhandle (MSVCRT.@) */ -long CDECL _get_osfhandle(int fd) +intptr_t CDECL _get_osfhandle(int fd) { HANDLE hand = fdtoh(fd); TRACE(":fd (%d) handle (%p)\n",fd,hand); - return (long)hand; + return (long)(LONG_PTR)hand; } /********************************************************************* @@ -1647,7 +1530,7 @@ /********************************************************************* * _open_osfhandle (MSVCRT.@) */ -int CDECL _open_osfhandle(long handle, int oflags) +int CDECL _open_osfhandle(intptr_t handle, int oflags) { int fd; @@ -1660,7 +1543,7 @@ if (!(oflags & (_O_BINARY | _O_TEXT))) oflags |= _O_BINARY; - fd = alloc_fd((HANDLE)handle, split_oflags(oflags)); + fd = alloc_fd((HANDLE)(LONG_PTR)handle, split_oflags(oflags)); TRACE(":handle (%ld) fd (%d) flags 0x%08x\n", handle, fd, oflags); return fd; } @@ -1803,188 +1686,6 @@ } /********************************************************************* - * _stat64 (MSVCRT.@) - */ -int CDECL _stat64(const char* path, struct __stat64 * buf) -{ - DWORD dw; - WIN32_FILE_ATTRIBUTE_DATA hfi; - unsigned short mode = ALL_S_IREAD; - int plen; - - TRACE(":file (%s) buf(%p)\n",path,buf); - - if (!GetFileAttributesExA(path, GetFileExInfoStandard, &hfi)) - { - TRACE("failed (%d)\n",GetLastError()); - __set_errno(ERROR_FILE_NOT_FOUND); - return -1; - } - - memset(buf,0,sizeof(struct __stat64)); - - /* FIXME: rdev isn't drive num, despite what the docs say-what is it? - Bon 011120: This FIXME seems incorrect - Also a letter as first char isn't enough to be classified - as a drive letter - */ - if (isalpha(*path)&& (*(path+1)==':')) - buf->st_dev = buf->st_rdev = toupper(*path) - 'A'; /* drive num */ - else - buf->st_dev = buf->st_rdev = _getdrive() - 1; - - plen = strlen(path); - - /* Dir, or regular file? */ - if ((hfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || - (path[plen-1] == '\\')) - mode |= (_S_IFDIR | ALL_S_IEXEC); - else - { - mode |= _S_IFREG; - /* executable? */ - if (plen > 6 && path[plen-4] == '.') /* shortest exe: "\x.exe" */ - { - unsigned int ext = tolower(path[plen-1]) | (tolower(path[plen-2]) << 8) | - (tolower(path[plen-3]) << 16); - if (ext == EXE || ext == BAT || ext == CMD || ext == COM) - mode |= ALL_S_IEXEC; - } - } - - if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) - mode |= ALL_S_IWRITE; - - buf->st_mode = mode; - buf->st_nlink = 1; - buf->st_size = ((__int64)hfi.nFileSizeHigh << 32) + hfi.nFileSizeLow; - RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastAccessTime, &dw); - buf->st_atime = dw; - RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw); - buf->st_mtime = buf->st_ctime = dw; - TRACE("%d %d 0x%08lx%08lx %ld %ld %ld\n", buf->st_mode,buf->st_nlink, - (long)(buf->st_size >> 32),(long)buf->st_size, - (long)buf->st_atime,(long)buf->st_mtime,(long)buf->st_ctime); - return 0; -} - -/********************************************************************* - * _stati64 (MSVCRT.@) - */ -int CDECL _stati64(const char* path, struct _stati64 * buf) -{ - int ret; - struct __stat64 buf64; - - ret = _stat64(path, &buf64); - if (!ret) - stat64_to_stati64(&buf64, buf); - return ret; -} - -/********************************************************************* - * _stat (MSVCRT.@) - */ -int CDECL _stat(const char* path, struct _stat * buf) -{ int ret; - struct __stat64 buf64; - - ret = _stat64( path, &buf64); - if (!ret) - stat64_to_stat(&buf64, buf); - return ret; -} - -/********************************************************************* - * _wstat64 (MSVCRT.@) - */ -int CDECL _wstat64(const wchar_t* path, struct __stat64 * buf) -{ - DWORD dw; - WIN32_FILE_ATTRIBUTE_DATA hfi; - unsigned short mode = ALL_S_IREAD; - int plen; - - TRACE(":file (%s) buf(%p)\n",debugstr_w(path),buf); - - if (!GetFileAttributesExW(path, GetFileExInfoStandard, &hfi)) - { - TRACE("failed (%d)\n",GetLastError()); - __set_errno(ERROR_FILE_NOT_FOUND); - return -1; - } - - memset(buf,0,sizeof(struct __stat64)); - - /* FIXME: rdev isn't drive num, despite what the docs says-what is it? */ - if (iswalpha(*path)) - buf->st_dev = buf->st_rdev = toupperW(*path - 'A'); /* drive num */ - else - buf->st_dev = buf->st_rdev = _getdrive() - 1; - - plen = strlenW(path); - - /* Dir, or regular file? */ - if ((hfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || - (path[plen-1] == '\\')) - mode |= (_S_IFDIR | ALL_S_IEXEC); - else - { - mode |= _S_IFREG; - /* executable? */ - if (plen > 6 && path[plen-4] == '.') /* shortest exe: "\x.exe" */ - { - ULONGLONG ext = tolowerW(path[plen-1]) | (tolowerW(path[plen-2]) << 16) | - ((ULONGLONG)tolowerW(path[plen-3]) << 32); - if (ext == WCEXE || ext == WCBAT || ext == WCCMD || ext == WCCOM) - mode |= ALL_S_IEXEC; - } - } - - if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) - mode |= ALL_S_IWRITE; - - buf->st_mode = mode; - buf->st_nlink = 1; - buf->st_size = ((__int64)hfi.nFileSizeHigh << 32) + hfi.nFileSizeLow; - RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastAccessTime, &dw); - buf->st_atime = dw; - RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw); - buf->st_mtime = buf->st_ctime = dw; - TRACE("%d %d 0x%08lx%08lx %ld %ld %ld\n", buf->st_mode,buf->st_nlink, - (long)(buf->st_size >> 32),(long)buf->st_size, - (long)buf->st_atime,(long)buf->st_mtime,(long)buf->st_ctime); - return 0; -} - -/********************************************************************* - * _wstati64 (MSVCRT.@) - */ -int CDECL _wstati64(const wchar_t* path, struct _stati64 * buf) -{ - int ret; - struct __stat64 buf64; - - ret = _wstat64(path, &buf64); - if (!ret) - stat64_to_stati64(&buf64, buf); - return ret; -} - -/********************************************************************* - * _wstat (MSVCRT.@) - */ -int CDECL _wstat(const wchar_t* path, struct _stat * buf) -{ - int ret; - struct __stat64 buf64; - - ret = _wstat64( path, &buf64 ); - if (!ret) stat64_to_stat(&buf64, buf); - return ret; -} - -/********************************************************************* * _tell (MSVCRT.@) */ long CDECL _tell(int fd) Index: lib/sdk/crt/stdio/find.c =================================================================== --- lib/sdk/crt/stdio/find.c (Revision 37928) +++ lib/sdk/crt/stdio/find.c (Arbeitskopie) @@ -1,110 +1,9 @@ -#include -#include +#define _USE_FIND64 0 +#include "find64.c" /* * @implemented */ -intptr_t -_tfindfirst(const _TCHAR* _name, struct _tfinddata_t* result) -{ - WIN32_FIND_DATA FindFileData; - long hFindFile; - - hFindFile = (intptr_t)FindFirstFile(_name, &FindFileData); - if (hFindFile == -1) { - _dosmaperr(GetLastError()); - return -1; - } - - result->attrib = FindFileData.dwFileAttributes; - result->time_create = FileTimeToUnixTime(&FindFileData.ftCreationTime,NULL); - result->time_access = FileTimeToUnixTime(&FindFileData.ftLastAccessTime,NULL); - result->time_write = FileTimeToUnixTime(&FindFileData.ftLastWriteTime,NULL); - result->size = FindFileData.nFileSizeLow; - _tcsncpy(result->name,FindFileData.cFileName,MAX_PATH); - - return hFindFile; -} - -/* - * @implemented - */ -intptr_t _tfindnext(intptr_t handle, struct _tfinddata_t* result) -{ - WIN32_FIND_DATA FindFileData; - - if (!FindNextFile((void*)handle, &FindFileData)) { - _dosmaperr(GetLastError()); - return -1; - } - - result->attrib = FindFileData.dwFileAttributes; - result->time_create = FileTimeToUnixTime(&FindFileData.ftCreationTime,NULL); - result->time_access = FileTimeToUnixTime(&FindFileData.ftLastAccessTime,NULL); - result->time_write = FileTimeToUnixTime(&FindFileData.ftLastWriteTime,NULL); - result->size = FindFileData.nFileSizeLow; - _tcsncpy(result->name,FindFileData.cFileName, MAX_PATH); - - return 0; -} - - -/* - * @implemented - */ -intptr_t _tfindfirsti64(const _TCHAR *_name, struct _tfinddatai64_t *result) -{ - WIN32_FIND_DATA FindFileData; - long hFindFile; - - hFindFile = (intptr_t)FindFirstFile(_name, &FindFileData); - if (hFindFile == -1) - { - _dosmaperr(GetLastError()); - return -1; - } - - result->attrib = FindFileData.dwFileAttributes; - result->time_create = FileTimeToUnixTime(&FindFileData.ftCreationTime,NULL); - result->time_access = FileTimeToUnixTime(&FindFileData.ftLastAccessTime,NULL); - result->time_write = FileTimeToUnixTime(&FindFileData.ftLastWriteTime,NULL); - result->size = - (((__int64)FindFileData.nFileSizeLow)<<32) + FindFileData.nFileSizeLow; - _tcsncpy(result->name,FindFileData.cFileName,MAX_PATH); - - return hFindFile; -} - -/* - * @implemented - */ -int _tfindnexti64(intptr_t handle, struct _tfinddatai64_t *result) -{ - WIN32_FIND_DATA FindFileData; - - if (!FindNextFile((HANDLE)handle, &FindFileData)) { - _dosmaperr(GetLastError()); - return -1; - } - - result->attrib = FindFileData.dwFileAttributes; - result->time_create = FileTimeToUnixTime(&FindFileData.ftCreationTime,NULL); - result->time_access = FileTimeToUnixTime(&FindFileData.ftLastAccessTime,NULL); - result->time_write = FileTimeToUnixTime(&FindFileData.ftLastWriteTime,NULL); - result->size = - (((__int64)FindFileData.nFileSizeLow)<<32) + FindFileData.nFileSizeLow; - _tcsncpy(result->name,FindFileData.cFileName,MAX_PATH); - - return 0; -} - - - -#ifndef _UNICODE - -/* - * @implemented - */ int _findclose(intptr_t handle) { if (!FindClose((HANDLE)handle)) { @@ -114,5 +13,3 @@ return 0; } - -#endif Index: lib/sdk/crt/stdio/find64.c =================================================================== --- lib/sdk/crt/stdio/find64.c (Revision 0) +++ lib/sdk/crt/stdio/find64.c (Revision 0) @@ -0,0 +1,119 @@ +#include +#include +#include + +#ifndef _USE_FIND64 +#define _USE_FIND64 1 +#endif + +/* + * @implemented + */ +#if _USE_FIND64 +intptr_t _tfindfirst32i64(const _TCHAR* _name, struct _tfinddata32i64_t* result) +#else +intptr_t _tfindfirst32(const _TCHAR* _name, struct _tfinddata32_t* result) +#endif +{ + WIN32_FIND_DATA FindFileData; + HANDLE hFindFile; + + hFindFile = FindFirstFile(_name, &FindFileData); + if (hFindFile == INVALID_HANDLE_VALUE) { + _dosmaperr(GetLastError()); + return -1; + } + + result->attrib = FindFileData.dwFileAttributes; + result->time_create = FileTimeToUnixTime(&FindFileData.ftCreationTime,NULL); + result->time_access = FileTimeToUnixTime(&FindFileData.ftLastAccessTime,NULL); + result->time_write = FileTimeToUnixTime(&FindFileData.ftLastWriteTime,NULL); + result->size = FindFileData.nFileSizeLow; + _tcsncpy(result->name,FindFileData.cFileName,MAX_PATH); + + return (intptr_t)hFindFile; +} + +/* + * @implemented + */ +#if _USE_FIND64 +int _tfindnext32i64(intptr_t handle, struct _tfinddata32i64_t* result) +#else +int _tfindnext32(intptr_t handle, struct _tfinddata32_t* result) +#endif +{ + WIN32_FIND_DATA FindFileData; + + if (!FindNextFile((HANDLE)handle, &FindFileData)) { + _dosmaperr(GetLastError()); + return -1; + } + + result->attrib = FindFileData.dwFileAttributes; + result->time_create = FileTimeToUnixTime(&FindFileData.ftCreationTime,NULL); + result->time_access = FileTimeToUnixTime(&FindFileData.ftLastAccessTime,NULL); + result->time_write = FileTimeToUnixTime(&FindFileData.ftLastWriteTime,NULL); + result->size = FindFileData.nFileSizeLow; + _tcsncpy(result->name,FindFileData.cFileName, MAX_PATH); + + return 0; +} + + +/* + * @implemented + */ +#if _USE_FIND64 +intptr_t _tfindfirst64(const _TCHAR *_name, struct _tfinddata64_t *result) +#else +intptr_t _tfindfirst64i32(const _TCHAR *_name, struct _tfinddata64i32_t *result) +#endif +{ + WIN32_FIND_DATA FindFileData; + HANDLE hFindFile; + + hFindFile = FindFirstFile(_name, &FindFileData); + if (hFindFile == INVALID_HANDLE_VALUE) { + _dosmaperr(GetLastError()); + return -1; + } + + result->attrib = FindFileData.dwFileAttributes; + result->time_create = FileTimeToUnixTime(&FindFileData.ftCreationTime,NULL); + result->time_access = FileTimeToUnixTime(&FindFileData.ftLastAccessTime,NULL); + result->time_write = FileTimeToUnixTime(&FindFileData.ftLastWriteTime,NULL); + result->size = + (((__int64)FindFileData.nFileSizeLow)<<32) + FindFileData.nFileSizeLow; + _tcsncpy(result->name,FindFileData.cFileName,MAX_PATH); + + return (intptr_t)hFindFile; +} + +/* + * @implemented + */ +#if _USE_FIND64 +int _tfindnext64(intptr_t handle, struct _tfinddata64_t *result) +#else +int _tfindnext64i32(intptr_t handle, struct _tfinddata64i32_t *result) +#endif +{ + WIN32_FIND_DATA FindFileData; + + if (!FindNextFile((HANDLE)handle, &FindFileData)) { + _dosmaperr(GetLastError()); + return -1; + } + + result->attrib = FindFileData.dwFileAttributes; + result->time_create = FileTimeToUnixTime(&FindFileData.ftCreationTime,NULL); + result->time_access = FileTimeToUnixTime(&FindFileData.ftLastAccessTime,NULL); + result->time_write = FileTimeToUnixTime(&FindFileData.ftLastWriteTime,NULL); + result->size = + (((__int64)FindFileData.nFileSizeLow)<<32) + FindFileData.nFileSizeLow; + _tcsncpy(result->name,FindFileData.cFileName,MAX_PATH); + + return 0; +} + Index: lib/sdk/crt/stdio/lnx_sprintf.c =================================================================== --- lib/sdk/crt/stdio/lnx_sprintf.c (Revision 37928) +++ lib/sdk/crt/stdio/lnx_sprintf.c (Arbeitskopie) @@ -679,7 +679,7 @@ flags |= ZEROPAD; } str = number(str, end, - (unsigned long) va_arg(args, void *), 16, + (uintptr_t) va_arg(args, void *), 16, field_width, precision, flags); continue; Index: lib/sdk/crt/stdio/stat.c =================================================================== --- lib/sdk/crt/stdio/stat.c (Revision 0) +++ lib/sdk/crt/stdio/stat.c (Revision 0) @@ -0,0 +1,15 @@ +#define _USE_STAT64 0 +#include "stat64.c" + + +//only version needed +//int CDECL _fstati64(int fd, struct _stati64* buf) +//{ +// int ret; +// struct __stat64 buf64; +// +// ret = _fstat64(fd, &buf64); +// if (!ret) +// stat64_to_stati64(&buf64, buf); +// return ret; +//} Index: lib/sdk/crt/stdio/stat64.c =================================================================== --- lib/sdk/crt/stdio/stat64.c (Revision 0) +++ lib/sdk/crt/stdio/stat64.c (Revision 0) @@ -0,0 +1,353 @@ +#include +#include "wine/unicode.h" + +#include +#include +#include + +#ifndef _UNICODE +#include +#endif + +#ifndef _USE_STAT64 +#define _USE_STAT64 1 +#endif + +/* for stat mode, permissions apply to all,owner and group */ +#define ALL_S_IREAD (_S_IREAD | (_S_IREAD >> 3) | (_S_IREAD >> 6)) +#define ALL_S_IWRITE (_S_IWRITE | (_S_IWRITE >> 3) | (_S_IWRITE >> 6)) +#define ALL_S_IEXEC (_S_IEXEC | (_S_IEXEC >> 3) | (_S_IEXEC >> 6)) + +#define EXE ('e' << 16 | 'x' << 8 | 'e') +#define BAT ('b' << 16 | 'a' << 8 | 't') +#define CMD ('c' << 16 | 'm' << 8 | 'd') +#define COM ('c' << 16 | 'o' << 8 | 'm') + +#define TOUL(x) (ULONGLONG)(x) +#define WCEXE (TOUL('e') << 32 | TOUL('x') << 16 | TOUL('e')) +#define WCBAT (TOUL('b') << 32 | TOUL('a') << 16 | TOUL('t')) +#define WCCMD (TOUL('c') << 32 | TOUL('m') << 16 | TOUL('d')) +#define WCCOM (TOUL('c') << 32 | TOUL('o') << 16 | TOUL('m')) + +HANDLE fdtoh(int fd); +void stat64_to_stati64(const struct __stat64 *buf64, struct _stati64 *buf); + +#if _USE_STAT64 + +//int _tstati64(const TCHAR* path, struct _stati64 * buf) +//{ +// int ret; +// struct __stat64 buf64; +// +// ret = _tstat64(path, &buf64); +// if (!ret) +// stat64_to_stati64(&buf64, buf); +// return ret; +//} + +#endif + + +#if _USE_STAT64 +int CDECL _tstat64(const _TCHAR *path, struct _stat64 *buf) +#else +int CDECL _tstat64i32(const _TCHAR *path, struct _stat64i32 *buf) +#endif +{ + DWORD dw; + WIN32_FILE_ATTRIBUTE_DATA hfi; + unsigned short mode = ALL_S_IREAD; + int plen; + + TRACE(":file (%s) buf(%p)\n",path,buf); + + if (!GetFileAttributesEx(path, GetFileExInfoStandard, &hfi)) + { + TRACE("failed (%d)\n",GetLastError()); + __set_errno(ERROR_FILE_NOT_FOUND); + return -1; + } + + memset(buf,0,sizeof(struct __stat64)); + + /* FIXME: rdev isn't drive num, despite what the docs say-what is it? + Bon 011120: This FIXME seems incorrect + Also a letter as first char isn't enough to be classified + as a drive letter + */ +#ifndef _UNICODE + if (isalpha(*path)&& (*(path+1)==':')) + buf->st_dev = buf->st_rdev = toupper(*path) - 'A'; /* drive num */ +#else + if (iswalpha(*path)) + buf->st_dev = buf->st_rdev = toupperW(*path - 'A'); /* drive num */ +#endif + else + buf->st_dev = buf->st_rdev = _getdrive() - 1; + +#ifndef _UNICODE + plen = strlen(path); +#else + plen = strlenW(path); +#endif + + /* Dir, or regular file? */ + if ((hfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || + (path[plen-1] == '\\')) + mode |= (_S_IFDIR | ALL_S_IEXEC); + else + { + mode |= _S_IFREG; + /* executable? */ + if (plen > 6 && path[plen-4] == '.') /* shortest exe: "\x.exe" */ + { +#ifndef _UNICODE + unsigned int ext = tolower(path[plen-1]) | (tolower(path[plen-2]) << 8) | + (tolower(path[plen-3]) << 16); + if (ext == EXE || ext == BAT || ext == CMD || ext == COM) + mode |= ALL_S_IEXEC; +#else + ULONGLONG ext = tolowerW(path[plen-1]) | (tolowerW(path[plen-2]) << 16) | + ((ULONGLONG)tolowerW(path[plen-3]) << 32); + if (ext == WCEXE || ext == WCBAT || ext == WCCMD || ext == WCCOM) + mode |= ALL_S_IEXEC; +#endif + } + } + + if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) + mode |= ALL_S_IWRITE; + + buf->st_mode = mode; + buf->st_nlink = 1; +#if _USE_STAT64 + buf->st_size = buf->st_size = ((__int64)hfi.nFileSizeHigh << 32) + hfi.nFileSizeLow; +#else + buf->st_size = hfi.nFileSizeLow; +#endif + RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastAccessTime, &dw); + buf->st_atime = dw; + RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw); + buf->st_mtime = buf->st_ctime = dw; + TRACE("%d %d 0x%08lx%08lx %ld %ld %ld\n", buf->st_mode,buf->st_nlink, + (long)(buf->st_size >> 16),(long)buf->st_size, + (long)buf->st_atime,(long)buf->st_mtime,(long)buf->st_ctime); + return 0; +} + +/********************************************************************* + * _stat (MSVCRT.@) + */ +#if _USE_STAT64 +int CDECL _tstat32i64(const _TCHAR *path,struct _stat32i64 *buf) +#else +int CDECL _tstat32(const _TCHAR *path,struct _stat32 *buf) +#endif +{ + DWORD dw; + WIN32_FILE_ATTRIBUTE_DATA hfi; + unsigned short mode = ALL_S_IREAD; + int plen; + + TRACE(":file (%s) buf(%p)\n",path,buf); + + if (!GetFileAttributesEx(path, GetFileExInfoStandard, &hfi)) + { + TRACE("failed (%d)\n",GetLastError()); + __set_errno(ERROR_FILE_NOT_FOUND); + return -1; + } + + memset(buf,0,sizeof(*buf)); + + /* FIXME: rdev isn't drive num, despite what the docs say-what is it? + Bon 011120: This FIXME seems incorrect + Also a letter as first char isn't enough to be classified + as a drive letter + */ +#ifndef _UNICODE + if (isalpha(*path)&& (*(path+1)==':')) + buf->st_dev = buf->st_rdev = toupper(*path) - 'A'; /* drive num */ +#else + if (iswalpha(*path)) + buf->st_dev = buf->st_rdev = toupperW(*path - 'A'); /* drive num */ +#endif + else + buf->st_dev = buf->st_rdev = _getdrive() - 1; + +#ifndef _UNICODE + plen = strlen(path); +#else + plen = strlenW(path); +#endif + + /* Dir, or regular file? */ + if ((hfi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || + (path[plen-1] == '\\')) + mode |= (_S_IFDIR | ALL_S_IEXEC); + else + { + mode |= _S_IFREG; + /* executable? */ + if (plen > 6 && path[plen-4] == '.') /* shortest exe: "\x.exe" */ + { +#ifndef _UNICODE + unsigned int ext = tolower(path[plen-1]) | (tolower(path[plen-2]) << 8) | + (tolower(path[plen-3]) << 16); + if (ext == EXE || ext == BAT || ext == CMD || ext == COM) + mode |= ALL_S_IEXEC; +#else + ULONGLONG ext = tolowerW(path[plen-1]) | (tolowerW(path[plen-2]) << 16) | + ((ULONGLONG)tolowerW(path[plen-3]) << 32); + if (ext == WCEXE || ext == WCBAT || ext == WCCMD || ext == WCCOM) + mode |= ALL_S_IEXEC; +#endif + } + } + + if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) + mode |= ALL_S_IWRITE; + + buf->st_mode = mode; + buf->st_nlink = 1; +#if _USE_STAT64 + buf->st_size = ((__int32)hfi.nFileSizeHigh << 16) + hfi.nFileSizeLow; +#else + buf->st_size = hfi.nFileSizeLow; +#endif + RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastAccessTime, &dw); + buf->st_atime = dw; + RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw); + buf->st_mtime = buf->st_ctime = dw; + TRACE("%d %d 0x%08lx%08lx %ld %ld %ld\n", buf->st_mode,buf->st_nlink, + (long)(buf->st_size >> 16),(long)buf->st_size, + (long)buf->st_atime,(long)buf->st_mtime,(long)buf->st_ctime); + return 0; +} + +#ifndef _UNICODE //No wide versions needed + +#if _USE_STAT64 +int CDECL _fstat64(int fd, struct _stat64* buf) +#else +int CDECL _fstat64i32(int fd, struct _stat64i32* buf) +#endif +{ + DWORD dw; + DWORD type; + BY_HANDLE_FILE_INFORMATION hfi; + HANDLE hand = fdtoh(fd); + + TRACE(":fd (%d) stat (%p)\n",fd,buf); + if (hand == INVALID_HANDLE_VALUE) + return -1; + + if (!buf) + { + WARN(":failed-NULL buf\n"); + __set_errno(ERROR_INVALID_PARAMETER); + return -1; + } + + memset(&hfi, 0, sizeof(hfi)); + memset(buf, 0, sizeof(struct __stat64)); + type = GetFileType(hand); + if (type == FILE_TYPE_PIPE) + { + buf->st_dev = buf->st_rdev = fd; + buf->st_mode = S_IFIFO; + buf->st_nlink = 1; + } + else if (type == FILE_TYPE_CHAR) + { + buf->st_dev = buf->st_rdev = fd; + buf->st_mode = S_IFCHR; + buf->st_nlink = 1; + } + else /* FILE_TYPE_DISK etc. */ + { + if (!GetFileInformationByHandle(hand, &hfi)) + { + WARN(":failed-last error (%d)\n",GetLastError()); + __set_errno(ERROR_INVALID_PARAMETER); + return -1; + } + buf->st_mode = S_IFREG | S_IREAD; + if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) + buf->st_mode |= S_IWRITE; + buf->st_size = ((__int64)hfi.nFileSizeHigh << 32) + hfi.nFileSizeLow; + RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastAccessTime, &dw); + buf->st_atime = dw; + RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw); + buf->st_mtime = buf->st_ctime = dw; + buf->st_nlink = hfi.nNumberOfLinks; + } + TRACE(":dwFileAttributes = 0x%x, mode set to 0x%x\n",hfi.dwFileAttributes, + buf->st_mode); + return 0; +} + +/********************************************************************* + * _fstat (MSVCRT.@) + */ +#if _USE_STAT64 +int CDECL _fstat32(int fd, struct _stat32* buf) +#else +int CDECL _fstat32i64(int fd, struct _stat32i64* buf) +#endif +{ + DWORD dw; + DWORD type; + BY_HANDLE_FILE_INFORMATION hfi; + HANDLE hand = fdtoh(fd); + + TRACE(":fd (%d) stat (%p)\n",fd,buf); + if (hand == INVALID_HANDLE_VALUE) + return -1; + + if (!buf) + { + WARN(":failed-NULL buf\n"); + __set_errno(ERROR_INVALID_PARAMETER); + return -1; + } + + memset(&hfi, 0, sizeof(hfi)); + memset(buf, 0, sizeof(struct _stat32)); + type = GetFileType(hand); + if (type == FILE_TYPE_PIPE) + { + buf->st_dev = buf->st_rdev = fd; + buf->st_mode = S_IFIFO; + buf->st_nlink = 1; + } + else if (type == FILE_TYPE_CHAR) + { + buf->st_dev = buf->st_rdev = fd; + buf->st_mode = S_IFCHR; + buf->st_nlink = 1; + } + else /* FILE_TYPE_DISK etc. */ + { + if (!GetFileInformationByHandle(hand, &hfi)) + { + WARN(":failed-last error (%d)\n",GetLastError()); + __set_errno(ERROR_INVALID_PARAMETER); + return -1; + } + buf->st_mode = S_IFREG | S_IREAD; + if (!(hfi.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) + buf->st_mode |= S_IWRITE; + buf->st_size = ((__int32)hfi.nFileSizeHigh << 16) + hfi.nFileSizeLow; + RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastAccessTime, &dw); + buf->st_atime = dw; + RtlTimeToSecondsSince1970((LARGE_INTEGER *)&hfi.ftLastWriteTime, &dw); + buf->st_mtime = buf->st_ctime = dw; + buf->st_nlink = hfi.nNumberOfLinks; + } + TRACE(":dwFileAttributes = 0x%x, mode set to 0x%x\n",hfi.dwFileAttributes, + buf->st_mode); + return 0; +} + +#endif Index: lib/sdk/crt/stdio/wfind.c =================================================================== --- lib/sdk/crt/stdio/wfind.c (Revision 37928) +++ lib/sdk/crt/stdio/wfind.c (Arbeitskopie) @@ -1,5 +1,8 @@ #define UNICODE #define _UNICODE - -#include "find.c" +#define _USE_FIND64 0 +#include +#include "find64.c" +#undef _USE_FIND64 +#include "find64.c" Index: lib/sdk/crt/stdio/wstat.c =================================================================== --- lib/sdk/crt/stdio/wstat.c (Revision 0) +++ lib/sdk/crt/stdio/wstat.c (Revision 0) @@ -0,0 +1,7 @@ +#define _UNICODE +#define UNICODE +#define _USE_STAT64 0 +#include +#include "stat64.c" +#undef _USE_STAT64 +#include "stat64.c" Index: lib/sdk/crt/stdlib/errno.c =================================================================== --- lib/sdk/crt/stdlib/errno.c (Revision 37928) +++ lib/sdk/crt/stdlib/errno.c (Arbeitskopie) @@ -13,9 +13,9 @@ /* * @implemented */ -int* __doserrno(void) +unsigned long* __doserrno(void) { - return (int*)(&GetThreadData()->tdoserrno); + return (unsigned long*)(&GetThreadData()->tdoserrno); } /* Index: lib/sdk/crt/stdlib/getenv.c =================================================================== --- lib/sdk/crt/stdlib/getenv.c (Revision 37928) +++ lib/sdk/crt/stdlib/getenv.c (Arbeitskopie) @@ -9,7 +9,7 @@ */ #include -#undef environ +//#undef environ /* * @implemented Index: lib/sdk/crt/stdlib/rot.c =================================================================== --- lib/sdk/crt/stdlib/rot.c (Revision 37928) +++ lib/sdk/crt/stdlib/rot.c (Arbeitskopie) @@ -10,6 +10,7 @@ #include +unsigned int _rotr( unsigned int value, int shift ); /* * @implemented */ Index: lib/sdk/crt/stdlib/swab.c =================================================================== --- lib/sdk/crt/stdlib/swab.c (Revision 37928) +++ lib/sdk/crt/stdlib/swab.c (Arbeitskopie) @@ -15,8 +15,7 @@ * * copy this swab from wine cvs 2006-05-24 */ -void _swab (const char * src, char * dst, size_t sizeToCopy - ) +void _swab (char * src, char * dst, int sizeToCopy) { if (sizeToCopy > 1) Index: lib/sdk/crt/string/atol.c =================================================================== --- lib/sdk/crt/string/atol.c (Revision 37928) +++ lib/sdk/crt/string/atol.c (Arbeitskopie) @@ -11,9 +11,9 @@ return (long)_ttoi64(str); } -int _atoldbl(long double *value, const char *str) +int _atoldbl(_LDOUBLE *value, char *str) { /* FIXME needs error checking for huge/small values */ //*value = strtold(str,0); - return 0; + return -1; } Index: lib/sdk/crt/string/ctype.c =================================================================== --- lib/sdk/crt/string/ctype.c (Revision 37928) +++ lib/sdk/crt/string/ctype.c (Arbeitskopie) @@ -4,6 +4,7 @@ #include #undef _pctype +#undef _pwctype /* MS's CRT header defines all that, and we actually implement that */ #undef iswalnum @@ -22,11 +23,13 @@ #undef iswspace #undef iswxdigit #undef __toascii +#undef _tolower +#undef _toupper #define upalpha ('A' - 'a') -unsigned short _ctype[] = { +const unsigned short _ctype[] = { 0, /* , 0xFFFF */ _CONTROL, /* CTRL+@, 0x00 */ _CONTROL, /* CTRL+A, 0x01 */ @@ -545,7 +548,7 @@ */ int __toascii(int c) { - return((unsigned)(c) & 0x7f); + return((unsigned int)(c) & 0x7f); } /* Index: lib/sdk/crt/string/scanf.c =================================================================== --- lib/sdk/crt/string/scanf.c (Revision 37928) +++ lib/sdk/crt/string/scanf.c (Arbeitskopie) @@ -24,8 +24,6 @@ */ #include - -#include #include // HACK for LIBCNT @@ -183,7 +181,7 @@ /********************************************************************* * _cscanf (MSVCRT.@) */ -int _cscanf(/*const*/ char *format, ...) +int _cscanf(const char *format, ...) { va_list valist; int res; Index: lib/sdk/crt/string/tcsnlen.h =================================================================== --- lib/sdk/crt/string/tcsnlen.h (Revision 37928) +++ lib/sdk/crt/string/tcsnlen.h (Arbeitskopie) @@ -4,7 +4,7 @@ #include #include -int _tcsnlen(const _TCHAR * str, size_t count) +size_t _tcsnlen(const _TCHAR * str, size_t count) { const _TCHAR * s; Index: lib/sdk/crt/time/ctime.c =================================================================== --- lib/sdk/crt/time/ctime.c (Revision 37928) +++ lib/sdk/crt/time/ctime.c (Arbeitskopie) @@ -1452,12 +1452,12 @@ /********************************************************************* * _dstbias (MSVCRT.@) */ -int _dstbias = 0; +long _dstbias = 0; /********************************************************************* * __p_dstbias (MSVCRT.@) */ -int * __p__dstbias(void) +long * __p__dstbias(void) { return &_dstbias; } Index: lib/sdk/crt/time/difftime.c =================================================================== --- lib/sdk/crt/time/difftime.c (Revision 37928) +++ lib/sdk/crt/time/difftime.c (Arbeitskopie) @@ -5,7 +5,7 @@ * @implemented */ double -difftime(time_t time1, time_t time0) +difftime(time_t time1, time_t time2) { - return time1-time0; + return (double)(time1 - time2); } Index: lib/sdk/crt/time/ftime.c =================================================================== --- lib/sdk/crt/time/ftime.c (Revision 37928) +++ lib/sdk/crt/time/ftime.c (Arbeitskopie) @@ -17,6 +17,7 @@ /* * @implemented */ +#undef _ftime void _ftime( struct _timeb *tm ) { int ret = 0; Index: lib/sdk/crt/time/strdate.c =================================================================== --- lib/sdk/crt/time/strdate.c (Revision 37928) +++ lib/sdk/crt/time/strdate.c (Arbeitskopie) @@ -12,18 +12,12 @@ /* * @implemented */ -char* _strdate(char* datestr) +char* _strdate(char* date) { - time_t t; - struct tm* d; - char* dt = (char*)datestr; + static const char format[] = "MM'/'dd'/'yy"; - if (datestr == NULL) { - __set_errno(EINVAL); - return NULL; - } - t = time(NULL); - d = localtime(&t); - sprintf(dt,"%d/%d/%d",d->tm_mday,d->tm_mon+1,d->tm_year); - return dt; + GetDateFormatA(LOCALE_NEUTRAL, 0, NULL, format, date, 9); + + return date; + } Index: lib/sdk/crt/time/strtime.c =================================================================== --- lib/sdk/crt/time/strtime.c (Revision 37928) +++ lib/sdk/crt/time/strtime.c (Arbeitskopie) @@ -12,18 +12,11 @@ /* * @implemented */ -char* _strtime(char* buf) +char* _strtime(char* time) { - time_t t; - struct tm *d; - char* dt = (char*)buf; + static const char format[] = "HH':'mm':'ss"; - if ( buf == NULL ) { - __set_errno(EINVAL); - return NULL; - } - t = time(NULL); - d = localtime(&t); - sprintf(dt,"%d:%d:%d",d->tm_hour,d->tm_min,d->tm_sec); - return dt; + GetTimeFormatA(LOCALE_NEUTRAL, 0, NULL, format, time, 9); + + return time; } Index: lib/sdk/crt/time/wstrdate.c =================================================================== --- lib/sdk/crt/time/wstrdate.c (Revision 37928) +++ lib/sdk/crt/time/wstrdate.c (Arbeitskopie) @@ -12,18 +12,12 @@ /* * @implemented */ -wchar_t* _wstrdate(wchar_t* datestr) +wchar_t* _wstrdate(wchar_t* date) { - time_t t; - struct tm* d; - wchar_t* dt = (wchar_t*)datestr; + static const WCHAR format[] = { 'M','M','\'','/','\'','d','d','\'','/','\'','y','y',0 }; - if (datestr == NULL) { - __set_errno(EINVAL); - return NULL; - } - t = time(NULL); - d = localtime(&t); - swprintf(dt,L"%d/%d/%d",d->tm_mday,d->tm_mon+1,d->tm_year); - return dt; + GetDateFormatW(LOCALE_NEUTRAL, 0, NULL, format, (LPWSTR)date, 9); + + return date; + } Index: lib/sdk/crt/time/wstrtime.c =================================================================== --- lib/sdk/crt/time/wstrtime.c (Revision 37928) +++ lib/sdk/crt/time/wstrtime.c (Arbeitskopie) @@ -12,18 +12,11 @@ /* * @implemented */ -wchar_t* _wstrtime(wchar_t* buf) +wchar_t* _wstrtime(wchar_t* time) { - time_t t; - struct tm* d; - wchar_t* dt = (wchar_t*)buf; + static const WCHAR format[] = { 'H','H','\'',':','\'','m','m','\'',':','\'','s','s',0 }; - if ( buf == NULL ) { - __set_errno(EINVAL); - return NULL; - } - t = time(NULL); - d = localtime(&t); - swprintf(dt,L"%d:%d:%d",d->tm_hour,d->tm_min,d->tm_sec); - return dt; + GetTimeFormatW(LOCALE_NEUTRAL, 0, NULL, format, (LPWSTR)time, 9); + + return time; } Index: ntoskrnl/kdbg/i386/i386-dis.c =================================================================== --- ntoskrnl/kdbg/i386/i386-dis.c (Revision 37928) +++ ntoskrnl/kdbg/i386/i386-dis.c (Arbeitskopie) @@ -38,6 +38,7 @@ extern int sprintf(char *str, const char *format, ...); #define sprintf_vma(BUF, VMA) sprintf(BUF, "0x%X", VMA) #define _setjmp setjmp +#define _INC_SETJMPEX struct disassemble_info; int Index: tools/rbuild/backend/mingw/mingw.cpp =================================================================== --- tools/rbuild/backend/mingw/mingw.cpp (Revision 37928) +++ tools/rbuild/backend/mingw/mingw.cpp (Arbeitskopie) @@ -532,7 +532,7 @@ fprintf ( fMakefile, "PROJECT_RCFLAGS := $(PROJECT_CINCLUDES) $(PROJECT_CDEFINES)\n" ); fprintf ( fMakefile, "PROJECT_WIDLFLAGS := $(PROJECT_CINCLUDES) $(PROJECT_CDEFINES)\n" ); fprintf ( fMakefile, "PROJECT_LFLAGS := '$(shell ${TARGET_CC} -print-libgcc-file-name)' %s\n", GenerateProjectLFLAGS ().c_str () ); - fprintf ( fMakefile, "PROJECT_LPPFLAGS := '$(shell ${TARGET_CPP} -print-file-name=libstdc++.a)' '$(shell ${TARGET_CPP} -print-file-name=libgcc.a)' '$(shell ${TARGET_CPP} -print-file-name=libmingw32.a)' '$(shell ${TARGET_CPP} -print-file-name=libmingwex.a)'\n" ); + fprintf ( fMakefile, "PROJECT_LPPFLAGS := '$(shell ${TARGET_CPP} -print-file-name=libstdc++.a)' '$(shell ${TARGET_CPP} -print-file-name=libgcc.a)' '$(shell ${TARGET_CPP} -print-file-name=libmingw32.a)' '$(shell ${TARGET_CPP} -print-file-name=libmingwex.a)' '$(shell ${TARGET_CPP} -print-file-name=libcoldname.a)'\n" ); fprintf ( fMakefile, "PROJECT_GCCOPTIONS += -Wall\n" ); fprintf ( fMakefile, "ifneq ($(OARCH),)\n" ); fprintf ( fMakefile, "PROJECT_GCCOPTIONS += -march=$(OARCH)\n" ); Index: tools/rbuild/backend/mingw/modulehandler.cpp =================================================================== --- tools/rbuild/backend/mingw/modulehandler.cpp (Revision 37928) +++ tools/rbuild/backend/mingw/modulehandler.cpp (Arbeitskopie) @@ -1913,8 +1913,7 @@ { if ( module.cplusplus ) { - // HACK: use host headers when building C++ - globalCflags += " $(HOST_CPPFLAGS)"; + globalCflags += " $(TARGET_CPPFLAGS)"; } else globalCflags += " -nostdinc";