7 Versionstring: $VER: SDI_stdarg.h 1.0 (05.07.2004)
10 Description: defines to hide OS specific variable arguments
13 1.0 05.07.04 : initial version
18 ** This is PD (Public Domain). This means you can do with it whatever you want
19 ** without any restrictions. I only ask you to tell me improvements, so I may
20 ** fix the main line of this files as well.
22 ** To keep confusion level low: When changing this file, please note it in
23 ** above history list and indicate that the change was not made by myself
24 ** (e.g. add your name or nick name).
26 ** Jens Langner <Jens.Langner@light-speed.de> and
27 ** Dirk Stöcker <stoecker@epost.de>
30 #include "SDI_compiler.h"
33 ** Variable arguments function macros to allow specification of the
34 ** variable arguments typical functions like va_list/va_start/va_end in
35 ** an operating system independent fashion.
37 ** With help of the following macro definition a developer might define
38 ** variable arguments functions for different types of operating
39 ** system implementations without having to clutter the sources with
40 ** multiple "#ifdef" defines just because all of these operating systems
41 ** come with different varable arguments support functions.
45 ** Instead of using the standard va_list, va_start and va_end functions
46 ** of <stdarg.h>, a developer might specify the following sprintf()
47 ** function to make it automatically compatible with AmigaOS3, AmigaOS4
50 ** int VARARGS68K sprintf(char *buf, char *fmt, ...)
54 ** VA_START(args, fmt);
55 ** RawDoFmt(fmt, VA_ARG(args, void *), NULL, buf);
58 ** return(strlen(buf));
61 ** Please note the uppercase letters of the macros in contrast to the
62 ** official varargs functions specified in <stdarg.h>.
64 ** By using this schema a developer might ensure full source code backward
65 ** compatibility to AmigaOS3 without having to introduce dozens of #ifdef
66 ** statements in his code.
84 #if defined(__amigaos4__)
85 #define VA_LIST va_list
86 #define VA_START(va, start) va_startlinear((va), (start))
87 #define VA_ARG(va, type) va_getlinearva((va), type)
88 #define VA_END(va) va_end((va))
89 #elif defined(__MORPHOS__)
90 #define VA_LIST va_list
91 #define VA_START(va, start) va_start((va), (start))
92 #define VA_ARG(va, type) (va)->overflow_arg_area
93 #define VA_END(va) va_end((va))
95 #define VA_LIST va_list
96 #define VA_START(va, start) va_start((va), (start))
97 #define VA_ARG(va, type) (va)
98 #define VA_END(va) va_end((va))
101 #endif /* SDI_STDARG_H */