2 * Amanda, The Advanced Maryland Automatic Network Disk Archiver
3 * Copyright (c) 1991-1998 University of Maryland at College Park
6 * Permission to use, copy, modify, distribute, and sell this software and its
7 * documentation for any purpose is hereby granted without fee, provided that
8 * the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation, and that the name of U.M. not be used in advertising or
11 * publicity pertaining to distribution of the software without specific,
12 * written prior permission. U.M. makes no representations about the
13 * suitability of this software for any purpose. It is provided "as is"
14 * without express or implied warranty.
16 * U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M.
18 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
19 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
20 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
21 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 * Authors: the Amanda Development Team. Its members are listed in a
24 * file named AUTHORS, in the root directory of this distribution.
27 * $Id: arglist.h,v 1.7 2002/12/03 21:36:39 martinea Exp $
29 * support macros for variable argument list declaration and definition
39 #define printf_arglist_function(fdecl, \
40 hook_type, hook_name) \
41 __attribute__ ((format (printf, 1, 0))) \
42 fdecl(hook_type hook_name, ...)
44 #define printf_arglist_function1(fdecl, \
45 arg1_type, arg1_name, \
46 hook_type, hook_name) \
47 __attribute__ ((format (printf, 2, 0))) \
48 fdecl(arg1_type arg1_name, \
49 hook_type hook_name, ...)
51 #define printf_arglist_function2(fdecl, \
52 arg1_type, arg1_name, \
53 arg2_type, arg2_name, \
54 hook_type, hook_name) \
55 __attribute__ ((format (printf, 3, 0))) \
56 fdecl(arg1_type arg1_name, \
57 arg2_type arg2_name, \
58 hook_type hook_name, ...)
60 #define arglist_function(fdecl, \
61 hook_type, hook_name) \
62 fdecl(hook_type hook_name, ...)
64 #define arglist_function1(fdecl, \
65 arg1_type, arg1_name, \
66 hook_type, hook_name) \
67 fdecl(arg1_type arg1_name, \
68 hook_type hook_name, ...)
70 #define arglist_function2(fdecl, \
71 arg1_type, arg1_name, \
72 arg2_type, arg2_name, \
73 hook_type, hook_name) \
74 fdecl(arg1_type arg1_name, \
75 arg2_type arg2_name, \
76 hook_type hook_name, ...)
78 #define arglist_function3(fdecl, arg1_type, arg1_name, arg2_type, arg2_name, \
79 arg3_type, arg3_name, hook_type, hook_name) \
80 fdecl(arg1_type arg1_name, arg2_type arg2_name, \
81 arg3_type arg3_name, hook_type hook_name, ...)
83 #define arglist_start(arg,hook_name) va_start(arg,hook_name)
89 #define printf_arglist_function(fdecl, hook_type, hook_name) \
90 fdecl(hook_name, va_alist) \
91 hook_type hook_name; \
94 #define printf_arglist_function1(fdecl, arg1_type, arg1_name, hook_type, hook_name) \
95 fdecl(arg1_name, hook_name, va_alist) \
96 arg1_type arg1_name; \
97 hook_type hook_name; \
100 #define printf_arglist_function2(fdecl, arg1_type, arg1_name, arg2_type, arg2_name, hook_type, hook_name) \
101 fdecl(arg1_name, arg2_name, hook_name, va_alist) \
102 arg1_type arg1_name; \
103 arg2_type arg2_name; \
104 hook_type hook_name; \
107 #define arglist_function(fdecl, hook_type, hook_name) \
108 fdecl(hook_name, va_alist) \
109 hook_type hook_name; \
112 #define arglist_function1(fdecl, arg1_type, arg1_name, hook_type, hook_name) \
113 fdecl(arg1_name, hook_name, va_alist) \
114 arg1_type arg1_name; \
115 hook_type hook_name; \
118 #define arglist_function2(fdecl, arg1_type, arg1_name, arg2_type, arg2_name, hook_type, hook_name) \
119 fdecl(arg1_name, arg2_name, hook_name, va_alist) \
120 arg1_type arg1_name; \
121 arg2_type arg2_name; \
122 hook_type hook_name; \
125 #define arglist_function3(fdecl, arg1_type, arg1_name, arg2_type, arg2_name, \
126 arg3_type, arg3_name, hook_type, hook_name) \
127 fdecl(arg1_name, arg2_name, arg3_name, hook_name, va_alist) \
128 arg1_type arg1_name; \
129 arg2_type arg2_name; \
130 arg3_type arg3_name; \
131 hook_type hook_name; \
134 #define arglist_start(arg,hook_name) va_start(arg)
138 #define arglist_val(arg,type) va_arg(arg,type)
139 #define arglist_end(arg) va_end(arg)
141 #endif /* !ARGLIST_H */