mirror of
https://github.com/dlang/phobos.git
synced 2025-04-27 13:40:20 +03:00
Win64 fixes
This commit is contained in:
parent
2346ef9a68
commit
18f7d60f0d
3 changed files with 49 additions and 17 deletions
15
std/format.d
15
std/format.d
|
@ -30,7 +30,7 @@ version(unittest) {
|
|||
import core.exception;
|
||||
}
|
||||
|
||||
version (Windows) version (DigitalMars)
|
||||
version (Win32) version (DigitalMars)
|
||||
{
|
||||
version = DigitalMarsC;
|
||||
}
|
||||
|
@ -4656,6 +4656,8 @@ void doFormat(void delegate(dchar) putc, TypeInfo[] arguments, va_list argptr)
|
|||
//doFormat(putc, (&valti)[0 .. 1], p);
|
||||
version(X86)
|
||||
argptr = p;
|
||||
else version(Win64)
|
||||
argptr = p;
|
||||
else version(X86_64)
|
||||
{
|
||||
__va_list va;
|
||||
|
@ -4706,6 +4708,8 @@ void doFormat(void delegate(dchar) putc, TypeInfo[] arguments, va_list argptr)
|
|||
//doFormat(putc, (&keyti)[0..1], pkey);
|
||||
version (X86)
|
||||
argptr = pkey;
|
||||
else version (Win64)
|
||||
argptr = pkey;
|
||||
else version (X86_64)
|
||||
{ __va_list va;
|
||||
va.stack_args = pkey;
|
||||
|
@ -4721,6 +4725,8 @@ void doFormat(void delegate(dchar) putc, TypeInfo[] arguments, va_list argptr)
|
|||
//doFormat(putc, (&valti)[0..1], pvalue);
|
||||
version (X86)
|
||||
argptr = pvalue;
|
||||
else version (Win64)
|
||||
argptr = pvalue;
|
||||
else version (X86_64)
|
||||
{ __va_list va2;
|
||||
va2.stack_args = pvalue;
|
||||
|
@ -4874,6 +4880,8 @@ void doFormat(void delegate(dchar) putc, TypeInfo[] arguments, va_list argptr)
|
|||
case Mangle.Tsarray:
|
||||
version (X86)
|
||||
putArray(argptr, (cast(TypeInfo_StaticArray)ti).len, cast()(cast(TypeInfo_StaticArray)ti).next);
|
||||
else version (Win64)
|
||||
putArray(argptr, (cast(TypeInfo_StaticArray)ti).len, cast()(cast(TypeInfo_StaticArray)ti).next);
|
||||
else
|
||||
putArray((cast(__va_list*)argptr).stack_args, (cast(TypeInfo_StaticArray)ti).len, cast()(cast(TypeInfo_StaticArray)ti).next);
|
||||
return;
|
||||
|
@ -4973,6 +4981,11 @@ void doFormat(void delegate(dchar) putc, TypeInfo[] arguments, va_list argptr)
|
|||
s = tis.xtoString(argptr);
|
||||
argptr += (tis.tsize() + 3) & ~3;
|
||||
}
|
||||
else version(Win64)
|
||||
{
|
||||
s = tis.xtoString(argptr);
|
||||
argptr += (tis.tsize() + 3) & ~3;
|
||||
}
|
||||
else version (X86_64)
|
||||
{
|
||||
void[32] parmn = void; // place to copy struct if passed in regs
|
||||
|
|
|
@ -262,7 +262,7 @@ class OutBuffer
|
|||
auto psize = buffer.length;
|
||||
for (;;)
|
||||
{
|
||||
version(Win32)
|
||||
version(Windows)
|
||||
{
|
||||
count = _vsnprintf(p,psize,f,args);
|
||||
if (count != -1)
|
||||
|
@ -270,7 +270,7 @@ class OutBuffer
|
|||
psize *= 2;
|
||||
p = cast(char *) alloca(psize); // buffer too small, try again with larger size
|
||||
}
|
||||
version(Posix)
|
||||
else version(Posix)
|
||||
{
|
||||
count = vsnprintf(p,psize,f,args);
|
||||
if (count == -1)
|
||||
|
@ -286,6 +286,10 @@ class OutBuffer
|
|||
+/
|
||||
p = cast(char *) alloca(psize); // buffer too small, try again with larger size
|
||||
}
|
||||
else
|
||||
{
|
||||
static assert(0);
|
||||
}
|
||||
}
|
||||
write(cast(ubyte[]) p[0 .. count]);
|
||||
/+
|
||||
|
@ -301,21 +305,29 @@ class OutBuffer
|
|||
* Append output of C's printf() to internal buffer.
|
||||
*/
|
||||
|
||||
version (X86_64)
|
||||
void printf(string format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, __va_argsave);
|
||||
vprintf(format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
else
|
||||
void printf(string format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
ap = cast(va_list)&format;
|
||||
ap += format.sizeof;
|
||||
vprintf(format, ap);
|
||||
version (Win64)
|
||||
{
|
||||
va_list ap;
|
||||
ap = cast(va_list)&format;
|
||||
ap += format.sizeof;
|
||||
vprintf(format, ap);
|
||||
}
|
||||
else version (X86_64)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, __va_argsave);
|
||||
vprintf(format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
else
|
||||
{
|
||||
va_list ap;
|
||||
ap = cast(va_list)&format;
|
||||
ap += format.sizeof;
|
||||
vprintf(format, ap);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************
|
||||
|
|
|
@ -1164,7 +1164,14 @@ class Stream : InputStream, OutputStream {
|
|||
|
||||
// writes data to stream using printf() syntax,
|
||||
// returns number of bytes written
|
||||
version (X86_64)
|
||||
version (Win64)
|
||||
size_t printf(const(char)[] format, ...) {
|
||||
va_list ap;
|
||||
ap = cast(va_list) &format;
|
||||
ap += format.sizeof;
|
||||
return vprintf(format, ap);
|
||||
}
|
||||
else version (X86_64)
|
||||
size_t printf(const(char)[] format, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, __va_argsave);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue