Lumiera  0.pre.03
»edit your freedom«
vcall.h
Go to the documentation of this file.
1 /*
2  vcall.h - helper macros for virtual (method) calls in C
3 
4  Copyright (C) Lumiera.org
5  2010, Christian Thaeter <ct@pipapo.org>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21 
22 #ifndef LUMIERA_VCALL_H
23 #define LUMIERA_VCALL_H
24 
25 #include <nobug.h>
26 
34 /*
35  TODO usage example, see btree.h
36 */
37 
43 #define LUMIERA_VCALL(self, function, ...) \
44  ({ \
45  REQUIRE (self); \
46  REQUIRE (self->vtable->function); \
47  self->vtable->function (self, ## __VA_ARGS__); \
48  })
49 
50 #ifndef VCALL
51 #define VCALL LUMIERA_VCALL
52 #else
53 #error "WTF! someone defined VCALL!"
54 #endif
55 
56 #endif
57 /*
58 // Local Variables:
59 // mode: C
60 // c-file-style: "gnu"
61 // indent-tabs-mode: nil
62 // End:
63 */