Logo ROOT   6.14/05
Reference Guide
Varargs.h
Go to the documentation of this file.
1 /* @(#)root/base:$Id$ */
2 
3 /*************************************************************************
4  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
5  * All rights reserved. *
6  * *
7  * For the licensing terms see $ROOTSYS/LICENSE. *
8  * For the list of contributors see $ROOTSYS/README/CREDITS. *
9  *************************************************************************/
10 
11 #ifndef ROOT_Varargs
12 #define ROOT_Varargs
13 
14 #ifdef __CINT__
15 #include <stdarg.h>
16 #endif
17 
18 #if defined(sparc) && defined(__CC_ATT301__)
19 
20  extern "C" __builtin_va_arg_incr(...);
21  typedef char *va_list;
22 # define va_end(ap)
23 # define va_start(ap, parmN) ap= (char*)(&parmN+1)
24 # define va_arg(ap, mode) ((mode*) __builtin_va_arg_incr((mode*)ap))[0]
25 # define va_(arg) __builtin_va_alist
26 
27 # include <stdio.h>
28 
29  extern "C" {
30  int vfprintf(FILE*, const char *fmt, va_list ap);
31  char *vsprintf(char*, const char *fmt, va_list ap);
32  };
33 
34 #else
35 # ifndef __CINT__
36 # include <stdarg.h>
37 # endif
38 # if defined(sparc) && !defined(__GNUG__) && !defined(__CC_SUN21__) && !defined(__SVR4)
39 # define va_(arg) __builtin_va_alist
40 # else
41 # define va_(arg) arg
42 # endif
43 
44 #endif
45 
46 #if !defined(R__VA_COPY)
47 # if defined(__GNUC__) && !defined(__FreeBSD__)
48 # define R__VA_COPY(to, from) __va_copy((to), (from))
49 # elif defined(__va_copy)
50 # define R__VA_COPY(to, from) __va_copy((to), (from))
51 # elif defined(va_copy)
52 # define R__VA_COPY(to, from) va_copy((to), (from))
53 # elif defined (R__VA_COPY_AS_ARRAY)
54 # define R__VA_COPY(to, from) memmove((to), (from), sizeof(va_list))
55 # elif defined(_WIN32) && _MSC_VER < 1310
56 # define R__VA_COPY(to, from) (*(to) = *(from))
57 # else
58 # define R__VA_COPY(to, from) ((to) = (from))
59 # endif
60 #endif
61 
62 #endif