ruby-changes:2163
From: ko1@a...
Date: 7 Oct 2007 22:28:51 +0900
Subject: [ruby-changes:2163] akr - Ruby:r13653 (trunk): * include/ruby/node.h: make node flags as VALUE type.
akr 2007-10-07 22:03:05 +0900 (Sun, 07 Oct 2007) New Revision: 13653 Modified files: trunk/.gdbinit trunk/ChangeLog trunk/include/ruby/node.h trunk/ruby.c Log: * include/ruby/node.h: make node flags as VALUE type. enum ruby_node_flags removed. * ruby.c: define RUBY_NODE_* as const for gdb. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/.gdbinit?r1=13653&r2=13652 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ruby.c?r1=13653&r2=13652 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=13653&r2=13652 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/include/ruby/node.h?r1=13653&r2=13652 Index: .gdbinit =================================================================== --- .gdbinit (revision 13652) +++ .gdbinit (revision 13653) @@ -147,7 +147,7 @@ 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 @@ 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 @@ 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. Index: include/ruby/node.h =================================================================== --- include/ruby/node.h (revision 13652) +++ include/ruby/node.h (revision 13653) @@ -271,26 +271,18 @@ #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)) Index: ChangeLog =================================================================== --- ChangeLog (revision 13652) +++ ChangeLog (revision 13653) @@ -1,3 +1,10 @@ +Sun Oct 7 22:00:01 2007 Tanaka Akira <akr@f...> + + * 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@f...> * include/ruby/ruby.h: enum ruby_value_flags removed. [ruby-dev:31959] Index: ruby.c =================================================================== --- ruby.c (revision 13652) +++ ruby.c (revision 13653) @@ -59,7 +59,6 @@ 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_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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml