libwallaby
v23
The wallaby standard library
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
vtable.h
Go to the documentation of this file.
1
/*
2
* vtable.h
3
*
4
* Created on: Nov 13, 2015
5
* Author: Joshua Southerland
6
*/
7
8
#ifndef INCLUDE_WALLABY_VTABLE_H_
9
#define INCLUDE_WALLABY_VTABLE_H_
10
11
12
13
#ifdef __cplusplus
14
extern
"C"
{
15
#endif
16
17
#include "
export.h
"
18
19
#define VF
20
#define VFL
21
#define VI
22
#define VIL
23
#define VH
24
25
#ifdef __GNUC__
26
#define POSSIBLY_UNUSED __attribute__ ((unused))
27
#else
28
#define POSSIBLY_UNUSED
29
#endif
30
31
#ifndef SWIG
32
#define VTABLE_FUNC_VOID(name, signature, args) \
33
typedef void (*name##_func) signature; \
34
EXPORT_SYM extern name##_func g_##name##_func; \
35
EXPORT_SYM extern const name##_func g_##name##_func_default; \
36
static const char *const name##_signature = "void" #signature; \
37
POSSIBLY_UNUSED static void name signature { (*g_##name##_func) args; }
38
39
#define VTABLE_FUNC(name, returnType, signature, args) \
40
typedef returnType (*name##_func) signature; \
41
EXPORT_SYM extern name##_func g_##name##_func; \
42
EXPORT_SYM extern const name##_func g_##name##_func_default; \
43
static const char *const name##_signature = #returnType #signature; \
44
POSSIBLY_UNUSED static returnType name signature { return (*g_##name##_func) args; }
45
#else
46
#define VTABLE_FUNC_VOID(name, signature, args) \
47
typedef void (*name##_func) signature; \
48
static void name signature;
49
50
#define VTABLE_FUNC(name, returnType, signature, args) \
51
typedef returnType (*name##_func) signature; \
52
static returnType name signature;
53
#endif
54
55
#define VTABLE_SET_DEFAULT(name, impl) \
56
const name##_func g_##name##_func_default = &impl; \
57
name##_func g_##name##_func = g_##name##_func_default
58
59
#ifdef __cplusplus
60
}
61
#endif
62
63
64
#endif
/* INCLUDE_WALLABY_VTABLE_H_ */
export.h
include
wallaby
vtable.h
Generated on Fri Feb 10 2017 22:21:49 for libwallaby by
1.8.8