summaryrefslogtreecommitdiffhomepage
path: root/include/mruby/struct.h
blob: cfe6df135c3660d1b47c13a58c3271e2e7471348 (plain)
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
/*
** mruby/struct.h - Struct class
**
** See Copyright Notice in mruby.h
*/

#ifndef MRUBY_STRUCT_H
#define MRUBY_STRUCT_H

#if defined(__cplusplus)
extern "C" {
#endif

struct RStruct {
    struct RBasic basic;
    long len;
    mrb_value *ptr;
};
#define RSTRUCT(st)     ((struct RStruct*)((st).value.p))
#define RSTRUCT_LEN(st) ((int)(RSTRUCT(st)->len))
#define RSTRUCT_PTR(st) (RSTRUCT(st)->ptr)

#if defined(__cplusplus)
}  /* extern "C" { */
#endif

#endif /* MRUBY_STRUCT_H */