Merged difference between 7.12 and 7.15 into trunk.
[AROS.git] / external / openurl / include / SDI_stdarg.h
blobe9767a06bb3c067ed130b37eaafe0c664a86ab79
1 #ifndef SDI_STDARG_H
2 #define SDI_STDARG_H
4 /* Includeheader
6 Name: SDI_stdarg.h
7 Versionstring: $VER: SDI_stdarg.h 1.0 (05.07.2004)
8 Author: Jens Maus
9 Distribution: PD
10 Project page: http://sf.net/p/adtools/code/HEAD/tree/trunk/sdi/
11 Description: defines to hide OS specific variable arguments
12 function definitions
13 Id: $Id$
14 URL: $URL: https://svn.code.sf.net/p/adtools/code/trunk/sdi/SDI_stdarg.h $
16 1.0 05.07.04 : initial version
21 ** This is PD (Public Domain). This means you can do with it whatever you want
22 ** without any restrictions. I only ask you to tell me improvements, so I may
23 ** fix the main line of this files as well.
25 ** To keep confusion level low: When changing this file, please note it in
26 ** above history list and indicate that the change was not made by myself
27 ** (e.g. add your name or nick name).
29 ** Find the latest version of this file at:
30 ** http://sf.net/p/adtools/code/HEAD/tree/trunk/sdi/
32 ** Jens Maus <mail@jens-maus.de>
33 ** Dirk Stöcker <soft@dstoecker.de>
36 #include "SDI_compiler.h"
39 ** Variable arguments function macros to allow specification of the
40 ** variable arguments typical functions like va_list/va_start/va_end in
41 ** an operating system independent fashion.
43 ** With help of the following macro definition a developer might define
44 ** variable arguments functions for different types of operating
45 ** system implementations without having to clutter the sources with
46 ** multiple "#ifdef" defines just because all of these operating systems
47 ** come with different varable arguments support functions.
49 ** Example:
51 ** Instead of using the standard va_list, va_start and va_end functions
52 ** of <stdarg.h>, a developer might specify the following sprintf()
53 ** function to make it automatically compatible with AmigaOS3, AmigaOS4
54 ** and also MorphOS.
56 ** int VARARGS68K sprintf(char *buf, char *fmt, ...)
57 ** {
58 ** VA_LIST args;
60 ** VA_START(args, fmt);
61 ** RawDoFmt(fmt, VA_ARG(args, void *), NULL, buf);
62 ** VA_END(args);
64 ** return(strlen(buf));
65 ** }
67 ** Please note the uppercase letters of the macros in contrast to the
68 ** official varargs functions specified in <stdarg.h>.
70 ** By using this schema a developer might ensure full source code backward
71 ** compatibility to AmigaOS3 without having to introduce dozens of #ifdef
72 ** statements in his code.
75 #include <stdarg.h>
77 #ifdef VA_LIST
78 #undef VA_LIST
79 #endif
80 #ifdef VA_START
81 #undef VA_START
82 #endif
83 #ifdef VA_ARG
84 #undef VA_ARG
85 #endif
86 #ifdef VA_END
87 #undef VA_END
88 #endif
90 #if defined(__amigaos4__)
91 #define VA_LIST va_list
92 #define VA_START(va, start) va_startlinear((va), (start))
93 #define VA_ARG(va, type) va_getlinearva((va), type)
94 #define VA_END(va) va_end((va))
95 #elif defined(__MORPHOS__)
96 #define VA_LIST va_list
97 #define VA_START(va, start) va_start((va), (start))
98 #define VA_ARG(va, type) (va)->overflow_arg_area
99 #define VA_END(va) va_end((va))
100 #else
101 #define VA_LIST va_list
102 #define VA_START(va, start) va_start((va), (start))
103 #define VA_ARG(va, type) (va)
104 #define VA_END(va) va_end((va))
105 #endif
107 #endif /* SDI_STDARG_H */