home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / gnu / g__lib / stdarg.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-23  |  1.6 KB  |  53 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2.  
  3. /* 
  4. Copyright (C) 1988 Free Software Foundation
  5.  
  6. This file is part of GNU CC.
  7.  
  8. GNU CC is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY.  No author or distributor
  10. accepts responsibility to anyone for the consequences of using it
  11. or for whether it serves any particular purpose or works at all,
  12. unless he says so in writing.  Refer to the GNU CC General Public
  13. License for full details.
  14.  
  15. Everyone is granted permission to copy, modify and redistribute
  16. GNU CC, but only under the conditions described in the
  17. GNU CC General Public License.   A copy of this license is
  18. supposed to have been given to you along with GNU CC so you
  19. can know your rights and responsibilities.  It should be in a
  20. file named COPYING.  Among other things, the copyright notice
  21. and this notice must be preserved on all copies.  
  22. */
  23.  
  24. #ifndef _stdarg_h
  25. #pragma once
  26. #define _stdarg_h 1
  27.  
  28. typedef char *va_list;
  29.  
  30. /* Amount of space required in an argument list for an arg of type TYPE.
  31.    TYPE may alternatively be an expression whose type is used.  */
  32.  
  33. #define __va_rounded_size(TYPE)  \
  34.   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
  35.  
  36. #ifndef sparc
  37. #define va_start(AP, LASTARG)                         \
  38.  (AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG)))
  39. #else
  40. #define va_start(AP, LASTARG)                         \
  41.  (__builtin_saveregs (), AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG)))
  42. #endif
  43.  
  44. void va_end (va_list);        /* Defined in gnulib */
  45. #define va_end(AP)
  46.  
  47. #define va_arg(AP, TYPE)                        \
  48.  (AP += __va_rounded_size (TYPE),                    \
  49.   *((TYPE *) (AP - __va_rounded_size (TYPE))))
  50.  
  51. #endif
  52.  
  53.