-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.h
33 lines (26 loc) · 1.63 KB
/
common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#pragma once
#include "point.h"
#define __DATA__
#define __FUNCTION__
#define __VIRTUAL__
#define __OVERRIDE__
#define CTOR(type) \
type* type##_new() { \
struct type *self; \
self = (struct type*)malloc(sizeof(struct type)); \
if(!self) \
{ \
return 0; \
} \
type##_init(self); \
return self; \
} \
#define DTOR(type) \
void type##_delete(type* cthis) \
{ \
if(type##_exit(cthis)) \
{ \
free(cthis); \
} \
} \
#define SUPER_PTR(cthis, father) ((father*)(&(cthis->##father)))