Skip to content

Commit

Permalink
symbol.c: symbol type predicate functions
Browse files Browse the repository at this point in the history
* symbol.h (is_{local,global,instance,attrset,const,class,junk}_sym):
  fix ID type names.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Nov 17, 2014
1 parent aed7a09 commit 4e48b64
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 7 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Tue Nov 18 03:20:19 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>

* symbol.h (is_{local,global,instance,attrset,const,class,junk}_sym):
fix ID type names.

Mon Nov 17 20:17:59 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>

* ext/win32ole/win32ole_event.c: use typed data.
Expand Down
8 changes: 8 additions & 0 deletions internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,14 @@ int rb_is_attrset_name(VALUE name);
int rb_is_local_name(VALUE name);
int rb_is_method_name(VALUE name);
int rb_is_junk_name(VALUE name);
int rb_is_const_sym(VALUE sym);
int rb_is_class_sym(VALUE sym);
int rb_is_global_sym(VALUE sym);
int rb_is_instance_sym(VALUE sym);
int rb_is_attrset_sym(VALUE sym);
int rb_is_local_sym(VALUE sym);
int rb_is_method_sym(VALUE sym);
int rb_is_junk_sym(VALUE sym);
ID rb_make_internal_id(void);
void rb_gc_free_dsymbol(VALUE);
ID rb_id_attrget(ID id);
Expand Down
42 changes: 42 additions & 0 deletions symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,48 @@ rb_is_junk_id(ID id)
return is_junk_id(id);
}

int
rb_is_const_sym(VALUE sym)
{
return is_const_sym(sym);
}

int
rb_is_class_sym(VALUE sym)
{
return is_class_sym(sym);
}

int
rb_is_global_sym(VALUE sym)
{
return is_global_sym(sym);
}

int
rb_is_instance_sym(VALUE sym)
{
return is_instance_sym(sym);
}

int
rb_is_attrset_sym(VALUE sym)
{
return is_attrset_sym(sym);
}

int
rb_is_local_sym(VALUE sym)
{
return is_local_sym(sym);
}

int
rb_is_junk_sym(VALUE sym)
{
return is_junk_sym(sym);
}

/**
* Returns ID for the given name if it is interned already, or 0.
*
Expand Down
14 changes: 7 additions & 7 deletions symbol.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ sym_type(VALUE sym)
return (int)(id&ID_SCOPE_MASK);
}

#define is_local_sym(sym) (sym_type(sym)==SYM_LOCAL)
#define is_global_sym(sym) (sym_type(sym)==SYM_GLOBAL)
#define is_instance_sym(sym) (sym_type(sym)==SYM_INSTANCE)
#define is_attrset_sym(sym) (sym_type(sym)==SYM_ATTRSET)
#define is_const_sym(sym) (sym_type(sym)==SYM_CONST)
#define is_class_sym(sym) (sym_type(sym)==SYM_CLASS)
#define is_junk_sym(sym) (sym_type(sym)==SYM_JUNK)
#define is_local_sym(sym) (sym_type(sym)==ID_LOCAL)
#define is_global_sym(sym) (sym_type(sym)==ID_GLOBAL)
#define is_instance_sym(sym) (sym_type(sym)==ID_INSTANCE)
#define is_attrset_sym(sym) (sym_type(sym)==ID_ATTRSET)
#define is_const_sym(sym) (sym_type(sym)==ID_CONST)
#define is_class_sym(sym) (sym_type(sym)==ID_CLASS)
#define is_junk_sym(sym) (sym_type(sym)==ID_JUNK)

RUBY_FUNC_EXPORTED const unsigned int ruby_global_name_punct_bits[(0x7e - 0x20 + 31) / 32];

Expand Down

0 comments on commit 4e48b64

Please sign in to comment.