home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue6 / SDL.ZIP / !gcc / include / libscl / h / stdarg < prev    next >
Encoding:
Text File  |  2006-09-17  |  2.9 KB  |  79 lines

  1. /* stdarg.h standard header for the RISC OS SharedCLibrary.
  2.    Copyright (c) 1997-2005 Nick Burrett
  3.    All rights reserved.
  4.  
  5.    Redistribution and use in source and binary forms, with or without
  6.    modification, are permitted provided that the following conditions
  7.    are met:
  8.    1. Redistributions of source code must retain the above copyright
  9.       notice, this list of conditions and the following disclaimer.
  10.    2. Redistributions in binary form must reproduce the above copyright
  11.       notice, this list of conditions and the following disclaimer in the
  12.       documentation and/or other materials provided with the distribution.
  13.    3. The name of the author may not be used to endorse or promote products
  14.       derived from this software without specific prior written permission.
  15.  
  16.    THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  17.    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  18.    OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  19.    IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  20.    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  21.    NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  22.    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  23.    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24.    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  25.    THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
  26.  
  27. #ifdef __GNUC__
  28. /* If we're GCC, then we really don't want to be using this file.
  29.    Luckily this only occurs when building the SDK.  */
  30. #include_next <stdarg.h>
  31.  
  32. #else /* ! __GNUC__ */
  33.  
  34. #ifndef __STDARG_H
  35. #ifndef __need___va_list
  36. #define __STDARG_H
  37. #endif
  38. #undef __need___va_list
  39.  
  40. #ifndef __GNUC_VA_LIST
  41. #define __GNUC_VA_LIST
  42. typedef char * __gnuc_va_list;
  43. #endif
  44.  
  45. #ifdef __STDARG_H
  46.  
  47. #if defined(__LCC__)
  48. /* Definition for the LCC compiler.  */
  49.  
  50. #define va_start(list, start) ((void)((list) = (sizeof(start)<4 ? \
  51.   (char *)((int *)&(start)+1) : (char *)(&(start)+1))))
  52. #define va_arg(list, mode) \
  53.   (*(mode *)(&(list += \
  54.     ((sizeof(mode)+3U)&~3U))[-(int)((sizeof(mode)+3U)&~3U)]))
  55. #define va_end(list) ((void)0)
  56.  
  57. #else
  58. /* Definitions for the Norcroft compiler.  */
  59.  
  60. #define va_align(x)     (((x) + (sizeof(int) - 1)) & (~(sizeof(int) - 1)))
  61. #define va_start(a,p)   ((void)((a) = ((char *)(&(p)) + va_align(sizeof(p)))))
  62. #define va_arg(a,t)     ((sizeof(t) > sizeof(int)) ? \
  63.         *(t *)(void *)(((a) += va_align(sizeof(t))) - va_align(sizeof(t))) : \
  64.         (t)(*(int *)(void *)(((a) += sizeof(int)) - sizeof(int))))
  65. #define va_end(a)       ((void)((a) = (char *)-1))
  66. #define va_copy(dest, src) (dest) = (src)
  67.  
  68. #endif
  69.  
  70. #endif /* __STDARG_H */
  71.  
  72. #ifndef _VA_LIST_
  73. typedef __gnuc_va_list va_list;
  74. #define _VA_LIST_
  75. #endif /* __va_list__ */
  76. #endif /* _VA_LIST_ */
  77.  
  78. #endif /* __GNUC__ */
  79.