renamed "inline" to "istruct" to represent inline struct; ref #3251

This commit is contained in:
Yukihiro "Matz" Matsumoto
2016-11-17 17:12:11 +09:00
parent 4cca8bac6b
commit 8438792d27
8 changed files with 77 additions and 77 deletions
-47
View File
@@ -1,47 +0,0 @@
/*
** mruby/inline.h - Inline structures
**
** See Copyright Notice in mruby.h
*/
#ifndef MRUBY_INLINE_H
#define MRUBY_INLINE_H
#include "common.h"
#include <string.h>
/**
* Inline structures that fit in RVALUE
*
* They cannot have finalizer, and cannot have instance variables.
*/
MRB_BEGIN_DECL
#define INLINE_DATA_SIZE (sizeof(void*) * 3)
struct RInline {
MRB_OBJECT_HEADER;
char inline_data[INLINE_DATA_SIZE];
};
#define RINLINE(obj) ((struct RInline*)(mrb_ptr(obj)))
#define INLINE_PTR(obj) (RINLINE(obj)->inline_data)
MRB_INLINE mrb_int mrb_inline_size()
{
return INLINE_DATA_SIZE;
}
MRB_INLINE void* mrb_inline_ptr(mrb_value object)
{
return INLINE_PTR(object);
}
MRB_INLINE void mrb_inline_copy(mrb_value dest, mrb_value src)
{
memcpy(INLINE_PTR(dest), INLINE_PTR(src), INLINE_DATA_SIZE);
}
MRB_END_DECL
#endif /* MRUBY_INLINE_H */
+47
View File
@@ -0,0 +1,47 @@
/*
** mruby/instruct.h - Inline structures
**
** See Copyright Notice in mruby.h
*/
#ifndef MRUBY_ISTRUCT_H
#define MRUBY_ISTRUCT_H
#include "common.h"
#include <string.h>
/**
* Inline structures that fit in RVALUE
*
* They cannot have finalizer, and cannot have instance variables.
*/
MRB_BEGIN_DECL
#define ISTRUCT_DATA_SIZE (sizeof(void*) * 3)
struct RIstruct {
MRB_OBJECT_HEADER;
char inline_data[ISTRUCT_DATA_SIZE];
};
#define RISTRUCT(obj) ((struct RIstruct*)(mrb_ptr(obj)))
#define ISTRUCT_PTR(obj) (RISTRUCT(obj)->inline_data)
MRB_INLINE mrb_int mrb_istruct_size()
{
return ISTRUCT_DATA_SIZE;
}
MRB_INLINE void* mrb_istruct_ptr(mrb_value object)
{
return ISTRUCT_PTR(object);
}
MRB_INLINE void mrb_istruct_copy(mrb_value dest, mrb_value src)
{
memcpy(ISTRUCT_PTR(dest), ISTRUCT_PTR(src), ISTRUCT_DATA_SIZE);
}
MRB_END_DECL
#endif /* MRUBY_ISTRUCT_H */
+1 -1
View File
@@ -116,7 +116,7 @@ enum mrb_vtype {
MRB_TT_ENV, /* 20 */
MRB_TT_DATA, /* 21 */
MRB_TT_FIBER, /* 22 */
MRB_TT_INLINE, /* 23 */
MRB_TT_ISTRUCT, /* 23 */
MRB_TT_MAXDEFINE /* 24 */
};