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   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 */
12 
13 #ifndef LUMIERA_VCALL_H
14 #define LUMIERA_VCALL_H
15 
16 #include <nobug.h>
17 
25 /*
26  TODO usage example, see btree.h
27 */
28 
34 #define LUMIERA_VCALL(self, function, ...) \
35  ({ \
36  REQUIRE (self); \
37  REQUIRE (self->vtable->function); \
38  self->vtable->function (self, ## __VA_ARGS__); \
39  })
40 
41 #ifndef VCALL
42 #define VCALL LUMIERA_VCALL
43 #else
44 #error "WTF! someone defined VCALL!"
45 #endif
46 
47 #endif
48 /*
49 // Local Variables:
50 // mode: C
51 // c-file-style: "gnu"
52 // indent-tabs-mode: nil
53 // End:
54 */