Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
renamed "inline" to "istruct" to represent inline struct; ref #3251
- Loading branch information
Showing
8 changed files
with
77 additions
and
77 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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 */ | ||
}; | ||
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -139,7 +139,7 @@ mrb_obj_id(mrb_value obj) | ||
case MRB_TT_EXCEPTION: | ||
case MRB_TT_FILE: | ||
case MRB_TT_DATA: | ||
case MRB_TT_INLINE: | ||
case MRB_TT_ISTRUCT: | ||
default: | ||
return MakeID(mrb_ptr(obj)); | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters