Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

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