view tango/tango/stdc/stdarg.d @ 132:1700239cab2e trunk

[svn r136] MAJOR UNSTABLE UPDATE!!! Initial commit after moving to Tango instead of Phobos. Lots of bugfixes... This build is not suitable for most things.
author lindquist
date Fri, 11 Jan 2008 17:57:40 +0100
parents
children a27941d00351
line wrap: on
line source

/**
 * D header file for C99.
 *
 * Copyright: Public Domain
 * License:   Public Domain
 * Authors:   Hauke Duden, Walter Bright
 * Standards: ISO/IEC 9899:1999 (E)
 */
module tango.stdc.stdarg;


version( GNU )
{
    public import std.c.stdarg;
}
else
{
    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;
    }
}