FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
mruby/include/mruby/data.h at master · esskar/mruby · GitHub
esskar
/
mruby
Public
forked from
mruby/mruby
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
mruby
/
include
/
mruby
/
data.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
50 lines (40 loc) · 1.23 KB
Breadcrumbs
mruby
/
include
/
mruby
/
data.h
Copy path
File metadata and controls
50 lines (40 loc) · 1.23 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
/*
** mruby/data.h - Data class
**
** See Copyright Notice in mruby.h
*/
#ifndef
MRUBY_DATA_H
#define
MRUBY_DATA_H
1
#if
defined(
__cplusplus
)
extern
"C"
{
#endif
struct
mrb_data_type
{
const
char
*
struct_name
;
void
(
*
dfree
)(
mrb_state
*
mrb
,
void
*
);
};
struct
RData
{
MRB_OBJECT_HEADER
;
struct
iv_tbl
*
iv
;
struct
mrb_data_type
*
type
;
void
*
data
;
};
struct
RData
*
mrb_data_object_alloc
(
mrb_state
*
mrb
,
struct
RClass
*
klass
,
void
*
datap
,
const
struct
mrb_data_type
*
type
);
#define
Data_Wrap_Struct
(
mrb
,
klass
,
type
,
ptr
)\
mrb_data_object_alloc(mrb,klass,ptr,type)
#define
Data_Make_Struct
(
mrb
,
klass
,
strct
,
type
,
sval
) (\
sval = mrb_malloc(mrb, sizeof(strct)),\
memset(sval, 0, sizeof(strct)),\
Data_Wrap_Struct(mrb,klass,type,sval)\
)
#define
RDATA
(
obj
) ((struct RData *)((obj).value.p))
#define
DATA_PTR
(
d
) (RDATA(d)->data)
#define
DATA_TYPE
(
d
) (RDATA(d)->type)
void
*
mrb_get_datatype
(
mrb_state
*
mrb
,
mrb_value
,
const
struct
mrb_data_type
*
);
void
*
mrb_check_datatype
(
mrb_state
*
mrb
,
mrb_value
,
const
struct
mrb_data_type
*
);
#define
Data_Get_Struct
(
mrb
,
obj
,
type
,
sval
) do {\
sval = mrb_check_datatype(mrb, obj, type); \
} while (0)
#if
defined(
__cplusplus
)
}
/* extern "C" { */
#endif
#endif
/* MRUBY_DATA_H */
Back
|
FazBrowse Home
|
New Git URL