1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* include/ruby/node.h: make node flags as VALUE type.

enum ruby_node_flags removed.

* ruby.c: define RUBY_NODE_* as const for gdb.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2007-10-07 13:03:05 +00:00
parent 9b2350e836
commit a6e5b6d660
4 changed files with 21 additions and 17 deletions

View file

@ -147,7 +147,7 @@ define rp
else
if ($flags & 0x1f) == 0x1f
printf "T_NODE("
output (enum node_type)(($flags&NODE_TYPEMASK)>>NODE_TYPESHIFT)
output (enum node_type)(($flags&RUBY_NODE_TYPEMASK)>>RUBY_NODE_TYPESHIFT)
printf "): "
print *(NODE *)$arg0
else
@ -190,7 +190,7 @@ document rp
end
define nd_type
print (enum node_type)((((NODE*)$arg0)->flags&NODE_TYPEMASK)>>NODE_TYPESHIFT)
print (enum node_type)((((NODE*)$arg0)->flags&RUBY_NODE_TYPEMASK)>>RUBY_NODE_TYPESHIFT)
end
document nd_type
Print a Ruby' node type.
@ -204,7 +204,7 @@ document nd_file
end
define nd_line
print ((unsigned int)((((NODE*)$arg0)->flags>>NODE_LSHIFT)&NODE_LMASK))
print ((unsigned int)((((NODE*)$arg0)->flags>>RUBY_NODE_LSHIFT)&RUBY_NODE_LMASK))
end
document nd_line
Print the source line number of a node.

View file

@ -1,3 +1,10 @@
Sun Oct 7 22:00:01 2007 Tanaka Akira <akr@fsij.org>
* include/ruby/node.h: make node flags as VALUE type.
enum ruby_node_flags removed.
* ruby.c: define RUBY_NODE_* as const for gdb.
Sun Oct 7 18:57:12 2007 Tanaka Akira <akr@fsij.org>
* include/ruby/ruby.h: enum ruby_value_flags removed. [ruby-dev:31959]

View file

@ -271,26 +271,18 @@ typedef struct RNode {
#define RNODE(obj) (R_CAST(RNode)(obj))
/* 0..4:T_TYPES, 5:FL_MARK, 6:reserved, 7:NODE_NEWLINE */
enum ruby_node_flags {
NODE_NEWLINE = (1<<7),
#define NODE_NEWLINE NODE_NEWLINE
#define NODE_NEWLINE (((VALUE)1)<<7)
NODE_TYPESHIFT = 8,
#define NODE_TYPESHIFT NODE_TYPESHIFT
NODE_TYPEMASK = (0x7f<<NODE_TYPESHIFT),
#define NODE_TYPEMASK NODE_TYPEMASK
NODE_LSHIFT = (NODE_TYPESHIFT+7),
#define NODE_LSHIFT NODE_LSHIFT
NODE_LMASK = (((SIGNED_VALUE)1<<(sizeof(VALUE)*CHAR_BIT-NODE_LSHIFT))-1),
#define NODE_LMASK NODE_LMASK
};
#define NODE_TYPESHIFT 8
#define NODE_TYPEMASK (((VALUE)0x7f)<<NODE_TYPESHIFT)
#define nd_type(n) ((int) (((RNODE(n))->flags & NODE_TYPEMASK)>>NODE_TYPESHIFT))
#define nd_set_type(n,t) \
RNODE(n)->flags=((RNODE(n)->flags&~NODE_TYPEMASK)|(((t)<<NODE_TYPESHIFT)&NODE_TYPEMASK))
#define NODE_LSHIFT (NODE_TYPESHIFT+7)
#define NODE_LMASK (((SIGNED_VALUE)1<<(sizeof(VALUE)*CHAR_BIT-NODE_LSHIFT))-1)
#define nd_line(n) ((VALUE)(((RNODE(n))->flags>>NODE_LSHIFT)&NODE_LMASK))
#define nd_set_line(n,l) \
RNODE(n)->flags=((RNODE(n)->flags&~(-1<<NODE_LSHIFT))|(((l)&NODE_LMASK)<<NODE_LSHIFT))

7
ruby.c
View file

@ -59,7 +59,6 @@ static const union {
enum ruby_special_consts special_consts;
enum ruby_value_type value_type;
enum node_type node_type;
enum ruby_node_flags node_flags;
} dummy_gdb_enums;
const VALUE RUBY_FL_MARK = FL_MARK;
@ -92,6 +91,12 @@ const VALUE RUBY_FL_USER19 = FL_USER19;
const VALUE RUBY_FL_USER20 = FL_USER20;
const int RUBY_FL_USHIFT = FL_USHIFT;
const VALUE RUBY_NODE_NEWLINE = NODE_NEWLINE;
const int RUBY_NODE_TYPESHIFT = NODE_TYPESHIFT;
const VALUE RUBY_NODE_TYPEMASK = NODE_TYPEMASK;
const int RUBY_NODE_LSHIFT = NODE_LSHIFT;
const VALUE RUBY_NODE_LMASK = NODE_LMASK;
#ifndef HAVE_STDLIB_H
char *getenv();
#endif