Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
  2. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  3. #ifndef __dj_include_stdarg_h_
  4. #define __dj_include_stdarg_h_
  5.  
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9.  
  10. #ifndef __dj_ENFORCE_ANSI_FREESTANDING
  11.  
  12. #ifdef __dj_include_varargs_h_
  13. #error stdarg.h and varargs.h are mutually exclusive
  14. #endif
  15.  
  16. #include <sys/djtypes.h>
  17.  
  18. __DJ_va_list
  19. #undef __DJ_va_list
  20. #define __DJ_va_list
  21.  
  22. #define __dj_va_rounded_size(T)  \
  23.   (((sizeof (T) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
  24.  
  25. #define va_arg(ap, T) \
  26.     (ap = (va_list) ((char *) (ap) + __dj_va_rounded_size (T)), \
  27.      *((T *) (void *) ((char *) (ap) - __dj_va_rounded_size (T))))
  28.  
  29. #define va_end(ap)
  30.  
  31. #ifdef __GNUC__
  32. #define va_start(ap, last_arg) \
  33.  (ap = ((va_list) __builtin_next_arg (last_arg)))
  34. #else
  35. #define va_start(ap, last_arg) \
  36.  (ap = (va_list) ((char*) &(last_arg) + __dj_va_rounded_size (last_arg)))
  37. #endif
  38.  
  39. #ifndef __STRICT_ANSI__
  40.  
  41. #ifndef _POSIX_SOURCE
  42.  
  43. #endif /* !_POSIX_SOURCE */
  44. #endif /* !__STRICT_ANSI__ */
  45. #endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
  46.  
  47. #ifndef __dj_ENFORCE_FUNCTION_CALLS
  48. #endif /* !__dj_ENFORCE_FUNCTION_CALLS */
  49.  
  50. #ifdef __cplusplus
  51. }
  52. #endif
  53.  
  54. #endif /* !__dj_include_stdarg_h_ */
  55.