Back to index

im-sdk  12.3.91
Xvarargs.h
Go to the documentation of this file.
00001 /* $XConsortium: Xvarargs.h,v 1.4 94/04/17 20:21:57 rws Exp $ */
00002 /*
00003 
00004 Copyright (c) 1985, 1986, 1987, 1988, 1989  X Consortium
00005 
00006 Permission is hereby granted, free of charge, to any person obtaining
00007 a copy of this software and associated documentation files (the
00008 "Software"), to deal in the Software without restriction, including
00009 without limitation the rights to use, copy, modify, merge, publish,
00010 distribute, sublicense, and/or sell copies of the Software, and to
00011 permit persons to whom the Software is furnished to do so, subject to
00012 the following conditions:
00013 
00014 The above copyright notice and this permission notice shall be included
00015 in all copies or substantial portions of the Software.
00016 
00017 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00018 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00019 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00020 IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
00021 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00022 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00023 OTHER DEALINGS IN THE SOFTWARE.
00024 
00025 Except as contained in this notice, the name of the X Consortium shall
00026 not be used in advertising or otherwise to promote the sale, use or
00027 other dealings in this Software without prior written authorization
00028 from the X Consortium.
00029 
00030 */
00031 
00032 #ifndef _XVARARGS_H_
00033 #define _XVARARGS_H_
00034 
00035 #ifdef __HIGHC__
00036 #ifndef _STDARG_H
00037 #define _STDARG_H
00038 
00039 typedef char *va_list;
00040 
00041 /* Amount of space required in an argument list for an arg of type TYPE.
00042    TYPE may alternatively be an expression whose type is used.  */
00043 
00044 #define __va_rounded_size(TYPE)  \
00045   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
00046 
00047 #define va_start(AP, LASTARG)                                           \
00048  (AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG)))
00049 
00050 #define va_end(AP)
00051 
00052 #define va_arg(AP, TYPE)                                                \
00053  (AP += __va_rounded_size (TYPE),                                       \
00054   *((TYPE *) (AP - __va_rounded_size (TYPE))))
00055 
00056 #endif /* _STDARG_H */
00057 
00058 #define Va_start(a,b) va_start(a,b)
00059 
00060 #else /* !__HIGHC__ */
00061 
00062 #if NeedVarargsPrototypes
00063 # include <stdarg.h>
00064 # define Va_start(a,b) va_start(a,b)
00065 #else
00066 # include <varargs.h>
00067 # define Va_start(a,b) va_start(a)
00068 #endif
00069 
00070 #endif /* __HIGHC__ */
00071 
00072 #endif /* _XVARARGS_H_ */