libkovan
1
The kovan standard library
vtable.h
Go to the documentation of this file.
1
#ifndef __KOVAN_VTABLE_H__
2
#define __KOVAN_VTABLE_H__
3
4
#ifdef __cplusplus
5
extern
"C"
{
6
#endif
7
8
#include "
export.h
"
9
10
#define VF
11
#define VFL
12
#define VI
13
#define VIL
14
#define VH
15
16
#ifdef __GNUC__
17
#define POSSIBLY_UNUSED __attribute__ ((unused))
18
#else
19
#define POSSIBLY_UNUSED
20
#endif
21
22
#ifndef SWIG
23
#define VTABLE_FUNC_VOID(name, signature, args) \
24
typedef void (*name##_func) signature; \
25
EXPORT_SYM extern name##_func g_##name##_func; \
26
EXPORT_SYM extern const name##_func g_##name##_func_default; \
27
static const char *const name##_signature = "void" #signature; \
28
POSSIBLY_UNUSED static void name signature { (*g_##name##_func) args; }
29
30
#define VTABLE_FUNC(name, returnType, signature, args) \
31
typedef returnType (*name##_func) signature; \
32
EXPORT_SYM extern name##_func g_##name##_func; \
33
EXPORT_SYM extern const name##_func g_##name##_func_default; \
34
static const char *const name##_signature = #returnType #signature; \
35
POSSIBLY_UNUSED static returnType name signature { return (*g_##name##_func) args; }
36
#else
37
#define VTABLE_FUNC_VOID(name, signature, args) \
38
typedef void (*name##_func) signature; \
39
static void name signature;
40
41
#define VTABLE_FUNC(name, returnType, signature, args) \
42
typedef returnType (*name##_func) signature; \
43
static returnType name signature;
44
#endif
45
46
#define VTABLE_SET_DEFAULT(name, impl) \
47
const name##_func g_##name##_func_default = &impl; \
48
name##_func g_##name##_func = g_##name##_func_default
49
50
#ifdef __cplusplus
51
}
52
#endif
53
54
#endif
export.h
include
kovan
vtable.h
Generated on Tue Aug 30 2016 08:52:43 for libkovan by
1.8.9.1