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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
#include "libtest.h"
typedef struct _color {
uint8_t red, green, blue;
} color;
EXTERN color *
color_new(int red, int green, int blue)
{
static color _self;
color *self = &_self;
self->red = red;
self->green = green;
self->blue = blue;
return self;
}
EXTERN int
color_get_red(color *self)
{
return self->red;
}
EXTERN void
color_set_red(color *self, int value)
{
self->red = value;
}
EXTERN int
color_get_green(color *self)
{
return self->green;
}
EXTERN void
color_set_green(color *self, int value)
{
self->green = value;
}
EXTERN int
color_get_blue(color *self)
{
return self->blue;
}
EXTERN void
color_set_blue(color *self, int value)
{
self->blue = value;
}
EXTERN void
color_DESTROY(color *self)
{
free(self);
}
EXTERN size_t
color_ffi_record_size()
{
return sizeof(color);
}
|