1 /**
2  * The vararg module is intended to facilitate vararg manipulation in D.
3  * It should be interface compatible with the C module "stdarg," and the
4  * two modules may share a common implementation if possible (as is done
5  * here).
6  *
7  * Copyright: Public Domain
8  * License:   Public Domain
9  * Authors:   Hauke Duden, Walter Bright
10  */
11 module tango.core.Vararg;
12 
13 public import core.vararg;
14 
15 /+
16 /**
17 
18   Gdc 
19 
20 
21 **/
22 
23 
24 version( GNU )
25 {
26     // GDC doesn't need va_start/va_end
27     // If the va_arg template version is used,  
28 
29     public import std.stdarg;
30 
31     version( X86_64 )
32     {
33         alias va_list __va_argsave_t;
34          //__va_argsave_t __va_argsave;
35     }
36 
37     // va_start and va_end is not needed for gdc, stubs only exist for eased
38     // cross-compiler programming
39     void va_start(T)( va_list ap, T parmn)   {   }
40     void va_end(va_list ap)    {    }
41 }
42 else version( LDC )
43 {
44     public import ldc.vararg;
45 }
46 else
47 {
48     version (DigitalMars) version (X86_64) version = DigitalMarsX64;
49     version (X86)
50     {
51         alias void* va_list;
52 
53         template va_arg(T)
54         {
55             T va_arg(ref va_list _argptr)
56             {
57                 T arg = *cast(T*)_argptr;
58                 _argptr = _argptr + ((T.sizeof + int.sizeof - 1) & ~(int.sizeof - 1));
59                 return arg;
60             }
61         }
62     }
63     else
64     {
65         public import tango.stdc.stdarg;
66     }
67 }
68 +/