mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-07-06 15:34:10 +02:00
[svn r5] Initial commit. Most things are very rough.
This commit is contained in:
42
lphobos/std/c/stdarg.d
Normal file
42
lphobos/std/c/stdarg.d
Normal file
@@ -0,0 +1,42 @@
|
||||
|
||||
/**
|
||||
* C's <stdarg.h>
|
||||
* Authors: Hauke Duden and Walter Bright, Digital Mars, www.digitalmars.com
|
||||
* License: Public Domain
|
||||
* Macros:
|
||||
* WIKI=Phobos/StdCStdarg
|
||||
*/
|
||||
|
||||
/* This is for use with extern(C) variable argument lists. */
|
||||
|
||||
module std.c.stdarg;
|
||||
|
||||
alias void* va_list;
|
||||
|
||||
template va_start(T)
|
||||
{
|
||||
void va_start(out va_list ap, inout T parmn)
|
||||
{
|
||||
ap = cast(va_list)(cast(void*)&parmn + ((T.sizeof + int.sizeof - 1) & ~(int.sizeof - 1)));
|
||||
}
|
||||
}
|
||||
|
||||
template va_arg(T)
|
||||
{
|
||||
T va_arg(inout va_list ap)
|
||||
{
|
||||
T arg = *cast(T*)ap;
|
||||
ap = cast(va_list)(cast(void*)ap + ((T.sizeof + int.sizeof - 1) & ~(int.sizeof - 1)));
|
||||
return arg;
|
||||
}
|
||||
}
|
||||
|
||||
void va_end(va_list ap)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void va_copy(out va_list dest, va_list src)
|
||||
{
|
||||
dest = src;
|
||||
}
|
||||
Reference in New Issue
Block a user