[SHELL-EXPERIMENTS]

* Sync up to trunk head (r64124).

svn path=/branches/shell-experiments/; revision=64126
This commit is contained in:
Amine Khaldi 2014-09-12 19:21:19 +00:00
commit 18a81d5d1e
480 changed files with 54949 additions and 9004 deletions

View file

@ -510,6 +510,11 @@ endif()
set_source_files_properties(${CRT_ASM_SOURCE} PROPERTIES COMPILE_DEFINITIONS "__MINGW_IMPORT=extern;USE_MSVCRT_PREFIX;_MSVCRT_LIB_;_MSVCRT_;_MT;CRTDLL")
add_asm_files(crt_asm ${CRT_ASM_SOURCE})
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
#FIXME: http://llvm.org/bugs/show_bug.cgi?id=19027
set_property(SOURCE except/cpp.c APPEND_STRING PROPERTY COMPILE_FLAGS " -no-integrated-as")
endif()
add_library(crt ${CRT_SOURCE} ${crt_asm})
target_link_libraries(crt chkstk)
add_target_compile_definitions(crt

View file

@ -39,18 +39,10 @@ double ldexp (double value, int exp)
}
#ifdef __GNUC__
#if defined(__clang__)
asm ("fild %[exp]\n"
"fscale\n"
"fstp %%st(1)\n"
: [result] "=t" (result)
: [value] "0" (value), [exp] "m" (exp));
#else
asm ("fscale"
: "=t" (result)
: "0" (value), "u" ((double)exp)
: "1");
#endif
#else /* !__GNUC__ */
__asm
{

View file

@ -57,12 +57,6 @@ _sxprintf(
int result;
FILE stream;
/* Check trivial case */
if ((buffer == NULL) && (count == 0) && (sizeOfBuffer == 0))
{
return 0;
}
#if IS_SECAPI
/* Validate parameters */
if (MSVCRT_CHECK_PMT(((buffer == NULL) || (format == NULL) || (sizeOfBuffer <= 0))))
@ -118,7 +112,8 @@ _sxprintf(
buffer[result] = _T('\0');
#else
/* Only zero terminate if there is enough space left */
if (stream._cnt >= sizeof(TCHAR)) *(TCHAR*)stream._ptr = _T('\0');
if ((stream._cnt >= sizeof(TCHAR)) && (stream._ptr))
*(TCHAR*)stream._ptr = _T('\0');
#endif
return result;

View file

@ -227,6 +227,11 @@ static
int
streamout_char(FILE *stream, int chr)
{
#ifdef _LIBCNT_
if ((stream->_flag & _IOSTRG) && (!stream->_ptr))
return 1;
#endif
#if defined(_USER32_WSPRINTF) || defined(_LIBCNT_)
/* Check if the buffer is full */
if (stream->_cnt < sizeof(TCHAR))

View file

@ -21,6 +21,14 @@
int alloc_fd(HANDLE hand, int flag); //FIXME: Remove
unsigned split_oflags(unsigned oflags); //FIXME: Remove
#ifndef _UNICODE
static struct popen_handle {
FILE *f;
HANDLE proc;
} *popen_handles;
static DWORD popen_handles_size;
#endif
/*
* @implemented
*/
@ -130,16 +138,40 @@ FILE *_tpopen (const _TCHAR *cm, const _TCHAR *md) /* program name, pipe mode */
/*
* @implemented
*/
int _pclose (FILE *pp)
int CDECL _pclose(FILE* file)
{
TRACE("_pclose(%x)",pp);
HANDLE h;
DWORD i;
fclose(pp);
//if (!TerminateProcess(pp->_tmpfname ,0))
// return( -1 );
return( 0 );
if (!MSVCRT_CHECK_PMT(file != NULL)) return -1;
_mlock(_POPEN_LOCK);
for(i=0; i<popen_handles_size; i++)
{
if (popen_handles[i].f == file)
break;
}
if(i == popen_handles_size)
{
_munlock(_POPEN_LOCK);
*_errno() = EBADF;
return -1;
}
h = popen_handles[i].proc;
popen_handles[i].f = NULL;
_munlock(_POPEN_LOCK);
fclose(file);
if(WaitForSingleObject(h, INFINITE)==WAIT_FAILED || !GetExitCodeProcess(h, &i))
{
_dosmaperr(GetLastError());
CloseHandle(h);
return -1;
}
CloseHandle(h);
return i;
}
#endif