Skip to content

Commit

Permalink
Normalize RUBY_T_xxx definitions with MRI.
Browse files Browse the repository at this point in the history
Taken from github.com/ruby/ruby commit 4b1fbbe92a758416294c3f336bb8e22bab3f1ff0
  • Loading branch information
brixen committed Jul 7, 2018
1 parent 75086f2 commit 737556c
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 72 deletions.
2 changes: 0 additions & 2 deletions machine/capi/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ extern "C" {
{T_SYMBOL, "Symbol"}, /* :symbol */
{T_DATA, "Data"}, /* internal use: wrapped C pointers */
{T_MATCH, "MatchData"}, /* data of $~ */
{T_VARMAP, "Varmap"}, /* internal use: dynamic variables */
{T_SCOPE, "Scope"}, /* internal use: variable scope */
{T_NODE, "Node"}, /* internal use: syntax tree node */
{T_UNDEF, "undef"}, /* internal use: #undef; should not happen */
{T_RATIONAL, "Rational" },
Expand Down
133 changes: 63 additions & 70 deletions machine/include/capi/ruby/ruby.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,76 +291,69 @@ typedef void (*RUBY_DATA_FUNC)(void*);
* cases.
*/

#define RUBY_T_ARRAY 0x00
#define RUBY_T_NONE 0x01
#define RUBY_T_NIL 0x02
#define RUBY_T_OBJECT 0x03
#define RUBY_T_CLASS 0x04
#define RUBY_T_ICLASS 0x05
#define RUBY_T_MODULE 0x06
#define RUBY_T_FLOAT 0x07
#define RUBY_T_STRING 0x08
#define RUBY_T_REGEXP 0x09
#define RUBY_T_FIXNUM 0x0a
#define RUBY_T_HASH 0x0b
#define RUBY_T_STRUCT 0x0c
#define RUBY_T_BIGNUM 0x0d
#define RUBY_T_FILE 0x0e

#define RUBY_T_TRUE 0x0f
#define RUBY_T_FALSE 0x10
#define RUBY_T_DATA 0x11
#define RUBY_T_MATCH 0x12
#define RUBY_T_SYMBOL 0x13

#define RUBY_T_BLKTAG 0x14
#define RUBY_T_UNDEF 0x15
#define RUBY_T_VARMAP 0x16
#define RUBY_T_SCOPE 0x17
#define RUBY_T_NODE 0x18

#define RUBY_T_MASK 0x19

#define RUBY_T_RATIONAL 0x20
#define RUBY_T_COMPLEX 0x21

#define RUBY_T_ENCODING 0x22

/* for backward Rubinius capi compatibility. */
#define T_ARRAY RUBY_T_ARRAY
#define T_NONE RUBY_T_NODE
#define T_NIL RUBY_T_NIL
#define T_OBJECT RUBY_T_OBJECT
#define T_CLASS RUBY_T_CLASS
#define T_ICLASS RUBY_T_ICLASS
#define T_MODULE RUBY_T_MODULE
#define T_FLOAT RUBY_T_FLOAT
#define T_STRING RUBY_T_STRING
#define T_REGEXP RUBY_T_REGEXP
#define T_FIXNUM RUBY_T_FIXNUM
#define T_HASH RUBY_T_HASH
#define T_STRUCT RUBY_T_STRUCT
#define T_BIGNUM RUBY_T_BIGNUM
#define T_FILE RUBY_T_FILE

#define T_TRUE RUBY_T_TRUE
#define T_FALSE RUBY_T_FALSE
#define T_DATA RUBY_T_DATA
#define T_MATCH RUBY_T_MATCH
#define T_SYMBOL RUBY_T_SYMBOL

#define T_BLKTAG RUBY_T_BLKTAG
#define T_UNDEF RUBY_T_UNDEF
#define T_VARMAP RUBY_T_VARMAP
#define T_SCOPE RUBY_T_SCOPE
#define T_NODE RUBY_T_NODE

#define T_MASK RUBY_T_MASK

#define T_RATIONAL RUBY_T_RATIONAL
#define T_COMPLEX RUBY_T_COMPLEX

#define T_ENCODING RUBY_T_ENCODING
enum ruby_value_type {
RUBY_T_NONE = 0x00,

RUBY_T_OBJECT = 0x01,
RUBY_T_CLASS = 0x02,
RUBY_T_MODULE = 0x03,
RUBY_T_FLOAT = 0x04,
RUBY_T_STRING = 0x05,
RUBY_T_REGEXP = 0x06,
RUBY_T_ARRAY = 0x07,
RUBY_T_HASH = 0x08,
RUBY_T_STRUCT = 0x09,
RUBY_T_BIGNUM = 0x0a,
RUBY_T_FILE = 0x0b,
RUBY_T_DATA = 0x0c,
RUBY_T_MATCH = 0x0d,
RUBY_T_COMPLEX = 0x0e,
RUBY_T_RATIONAL = 0x0f,
RUBY_T_ENCODING = 0x10,

RUBY_T_NIL = 0x11,
RUBY_T_TRUE = 0x12,
RUBY_T_FALSE = 0x13,
RUBY_T_SYMBOL = 0x14,
RUBY_T_FIXNUM = 0x15,
RUBY_T_UNDEF = 0x16,

RUBY_T_IMEMO = 0x1a, /*!< @see imemo_type */
RUBY_T_NODE = 0x1b,
RUBY_T_ICLASS = 0x1c,
RUBY_T_ZOMBIE = 0x1d,

RUBY_T_MASK = 0x1f
};

#define T_NONE RUBY_T_NONE
#define T_NIL RUBY_T_NIL
#define T_OBJECT RUBY_T_OBJECT
#define T_CLASS RUBY_T_CLASS
#define T_ICLASS RUBY_T_ICLASS
#define T_MODULE RUBY_T_MODULE
#define T_FLOAT RUBY_T_FLOAT
#define T_STRING RUBY_T_STRING
#define T_REGEXP RUBY_T_REGEXP
#define T_ARRAY RUBY_T_ARRAY
#define T_HASH RUBY_T_HASH
#define T_STRUCT RUBY_T_STRUCT
#define T_BIGNUM RUBY_T_BIGNUM
#define T_FILE RUBY_T_FILE
#define T_FIXNUM RUBY_T_FIXNUM
#define T_TRUE RUBY_T_TRUE
#define T_FALSE RUBY_T_FALSE
#define T_DATA RUBY_T_DATA
#define T_MATCH RUBY_T_MATCH
#define T_SYMBOL RUBY_T_SYMBOL
#define T_RATIONAL RUBY_T_RATIONAL
#define T_COMPLEX RUBY_T_COMPLEX
#define T_ENCODING RUBY_T_ENCODING
#define T_IMEMO RUBY_T_IMEMO
#define T_UNDEF RUBY_T_UNDEF
#define T_NODE RUBY_T_NODE
#define T_ZOMBIE RUBY_T_ZOMBIE
#define T_MASK RUBY_T_MASK

struct RString {
ssize_t len;
Expand Down

0 comments on commit 737556c

Please sign in to comment.