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