home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue2 / SDL.ARC / !gcc / include / libscl / h / stdarg < prev    next >
Encoding:
Text File  |  2004-09-05  |  1.5 KB  |  57 lines

  1. /* stdarg.h
  2.    Shared C Library support.
  3.    Written by Nick Burrett, 1997 and 1998, 2003.  */
  4.  
  5. #ifdef __GNUC__
  6. /* If we're GCC, then we really don't want to be using this file.
  7.    Luckily this only occurs when building the SDK.  */
  8. #include_next <stdarg.h>
  9.  
  10. #else /* ! __GNUC__ */
  11.  
  12. #ifndef __STDARG_H
  13. #ifndef __need___va_list
  14. #define __STDARG_H
  15. #endif
  16. #undef __need___va_list
  17.  
  18. #ifndef __GNUC_VA_LIST
  19. #define __GNUC_VA_LIST
  20. typedef char * __gnuc_va_list;
  21. #endif
  22.  
  23. #ifdef __STDARG_H
  24.  
  25. #if defined(__LCC__)
  26. /* Definition for the LCC compiler.  */
  27.  
  28. #define va_start(list, start) ((void)((list) = (sizeof(start)<4 ? \
  29.   (char *)((int *)&(start)+1) : (char *)(&(start)+1))))
  30. #define va_arg(list, mode) \
  31.   (*(mode *)(&(list += \
  32.     ((sizeof(mode)+3U)&~3U))[-(int)((sizeof(mode)+3U)&~3U)]))
  33. #define va_end(list) ((void)0)
  34.  
  35. #else
  36. /* Definitions for the Norcroft compiler.  */
  37.  
  38. #define va_align(x)     (((x) + (sizeof(int) - 1)) & (~(sizeof(int) - 1)))
  39. #define va_start(a,p)   ((void)((a) = ((char *)(&(p)) + va_align(sizeof(p)))))
  40. #define va_arg(a,t)     ((sizeof(t) > sizeof(int)) ? \
  41.         *(t *)(void *)(((a) += va_align(sizeof(t))) - va_align(sizeof(t))) : \
  42.         (t)(*(int *)(void *)(((a) += sizeof(int)) - sizeof(int))))
  43. #define va_end(a)       ((void)((a) = (char *)-1))
  44. #define va_copy(dest, src) (dest) = (src)
  45.  
  46. #endif
  47.  
  48. #endif /* __STDARG_H */
  49.  
  50. #ifndef _VA_LIST_
  51. typedef __gnuc_va_list va_list;
  52. #define _VA_LIST_
  53. #endif /* __va_list__ */
  54. #endif /* _VA_LIST_ */
  55.  
  56. #endif /* __GNUC__ */
  57.