summaryrefslogtreecommitdiff
path: root/id.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-14 08:57:07 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-14 08:57:07 +0000
commitdc02325fd82602bc9f9e6d1b85b5b03425d6d43f (patch)
tree36639504d69b3a58522706e956fe7326d0011eb2 /id.c
parentc710140216e3fde8130d8a583a1e1c9582be20e9 (diff)
* include/ruby/encoding.h (rb_enc_ispunct): added.
* common.mk (COMMONOBJS), inits.c (rb_call_inits): id.c is now included from parse.c. * id.c (Init_id), id.h (ruby_method_ids): added IDs used by VM. * parse.y (global_symbols): added rooms for VM IDs. * parse.y (rb_intern3, rb_id2str): single puctuation symbol is now same as char code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'id.c')
-rw-r--r--id.c71
1 files changed, 31 insertions, 40 deletions
diff --git a/id.c b/id.c
index 5166309402..c34f0c8dd9 100644
--- a/id.c
+++ b/id.c
@@ -11,49 +11,40 @@
#include "ruby/ruby.h"
-#define YYSTYPE_IS_DECLARED
-#define extern
#include "id.h"
-#undef extern
-void
+static void
Init_id(void)
{
#undef rb_intern
-
- /* Symbols */
- symIFUNC = ID2SYM(rb_intern("<IFUNC>"));
- symCFUNC = ID2SYM(rb_intern("<CFUNC>"));
-
- /* IDs */
- idEach = rb_intern("each");
- idTimes = rb_intern("times");
- idLength = rb_intern("length");
- idLambda = rb_intern("lambda");
- idIntern = rb_intern("intern");
- idGets = rb_intern("gets");
- idSucc = rb_intern("succ");
- idEnd = rb_intern("end");
- idRangeEachLT = rb_intern("Range#each#LT");
- idRangeEachLE = rb_intern("Range#each#LE");
- idArrayEach = rb_intern("Array#each");
- idMethodMissing = rb_intern("method_missing");
-
- idThrowState = rb_intern("#__ThrowState__");
-
- idBitblt = rb_intern("bitblt");
- idAnswer = rb_intern("the_answer_to_life_the_universe_and_everything");
-
- idSend = rb_intern("send");
- id__send__ = rb_intern("__send__");
-
- idRespond_to = rb_intern("respond_to?");
- idInitialize = rb_intern("initialize");
-
- id_core_set_method_alias = rb_intern("core_set_method_alias");
- id_core_set_variable_alias = rb_intern("core_set_variable_alias");
- id_core_undef_method = rb_intern("core_undef_method");
- id_core_define_method = rb_intern("core_define_method");
- id_core_define_singleton_method = rb_intern("core_define_singleton_method");
- id_core_set_postexe = rb_intern("core_set_postexe");
+#define rb_intern(str) rb_intern2(str, strlen(str))
+ rb_encoding *enc = rb_usascii_encoding();
+
+ REGISTER_SYMID(idNULL, "");
+ REGISTER_SYMID(idIFUNC, "<IFUNC>"),
+ REGISTER_SYMID(idCFUNC, "<CFUNC>"),
+ REGISTER_SYMID(idRespond_to, "respond_to?"),
+ REGISTER_SYMID(idThrowState, "#__ThrowState__"),
+
+ REGISTER_SYMID(id_core_set_method_alias, "core#set_method_alias"),
+ REGISTER_SYMID(id_core_set_variable_alias, "core#set_variable_alias"),
+ REGISTER_SYMID(id_core_undef_method, "core#undef_method"),
+ REGISTER_SYMID(id_core_define_method, "core#define_method"),
+ REGISTER_SYMID(id_core_define_singleton_method, "core#define_singleton_method"),
+ REGISTER_SYMID(id_core_set_postexe, "core#set_postexe"),
+
+ REGISTER_SYMID(idEach, "each");
+ REGISTER_SYMID(idLength, "length");
+ REGISTER_SYMID(idLambda, "lambda");
+ REGISTER_SYMID(idIntern, "intern");
+ REGISTER_SYMID(idGets, "gets");
+ REGISTER_SYMID(idSucc, "succ");
+ REGISTER_SYMID(idMethodMissing, "method_missing");
+#if SUPPORT_JOKE
+ REGISTER_SYMID(idBitblt, "bitblt");
+ REGISTER_SYMID(idAnswer, "the_answer_to_life_the_universe_and_everything");
+#endif
+ REGISTER_SYMID(idSend, "send");
+ REGISTER_SYMID(id__send__, "__send__");
+ REGISTER_SYMID(idInitialize, "initialize");
}