From 934525776f60171fff0c5453e795de051fc0ab15 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 24 Dec 2008 20:05:12 +0000 Subject: [PATCH] * template/id.h.tmpl, id.h (ruby_method_ids): not depend on if token are defined as macros. [ruby-dev:37553] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 ++ id.h | 111 ++++++++++++++++++--------------------------- template/id.h.tmpl | 18 ++++++-- 3 files changed, 62 insertions(+), 72 deletions(-) diff --git a/ChangeLog b/ChangeLog index 504c867ae5..ef74bf0848 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Dec 25 05:05:06 2008 Nobuyoshi Nakada + + * template/id.h.tmpl, id.h (ruby_method_ids): not depend on if + token are defined as macros. [ruby-dev:37553] + Thu Dec 25 01:52:34 2008 Nobuyoshi Nakada * thread.c (thread_start_func_2): sets native thread key. diff --git a/id.h b/id.h index 393f79d53a..67f1eeadf8 100644 --- a/id.h +++ b/id.h @@ -3,8 +3,8 @@ id.h - - $Author: ko1 $ - created at: Thu Jul 12 04:38:07 2007 + $Author: nobu $ + created at: Sun Oct 19 21:12:51 2008 Copyright (C) 2007 Koichi Sasada @@ -31,8 +31,12 @@ #define symIFUNC ID2SYM(idIFUNC) #define symCFUNC ID2SYM(idCFUNC) +#if !defined tLAST_TOKEN && defined YYTOKENTYPE +#define tLAST_TOKEN tLAST_TOKEN +#endif + enum ruby_method_ids { -#if !defined tLAST_TOKEN && !defined YYTOKENTYPE +#ifndef tLAST_TOKEN tUPLUS = 321, tUMINUS = 322, tPOW = 323, @@ -65,70 +69,6 @@ enum ruby_method_ids { id_core_define_singleton_method = 374, id_core_set_postexe = 375, tLAST_TOKEN = 376, -#elif tUPLUS != 321 -#error tUPLUS differs -#elif tUMINUS != 322 -#error tUMINUS differs -#elif tPOW != 323 -#error tPOW differs -#elif tCMP != 324 -#error tCMP differs -#elif tEQ != 325 -#error tEQ differs -#elif tEQQ != 326 -#error tEQQ differs -#elif tNEQ != 327 -#error tNEQ differs -#elif tGEQ != 328 -#error tGEQ differs -#elif tLEQ != 329 -#error tLEQ differs -#elif tANDOP != 330 -#error tANDOP differs -#elif tOROP != 331 -#error tOROP differs -#elif tMATCH != 332 -#error tMATCH differs -#elif tNMATCH != 333 -#error tNMATCH differs -#elif tDOT2 != 334 -#error tDOT2 differs -#elif tDOT3 != 335 -#error tDOT3 differs -#elif tAREF != 336 -#error tAREF differs -#elif tASET != 337 -#error tASET differs -#elif tLSHFT != 338 -#error tLSHFT differs -#elif tRSHFT != 339 -#error tRSHFT differs -#elif tLAMBDA != 352 -#error tLAMBDA differs -#elif idNULL != 365 -#error idNULL differs -#elif idRespond_to != 366 -#error idRespond_to differs -#elif idIFUNC != 367 -#error idIFUNC differs -#elif idCFUNC != 368 -#error idCFUNC differs -#elif idThrowState != 369 -#error idThrowState differs -#elif id_core_set_method_alias != 370 -#error id_core_set_method_alias differs -#elif id_core_set_variable_alias != 371 -#error id_core_set_variable_alias differs -#elif id_core_undef_method != 372 -#error id_core_undef_method differs -#elif id_core_define_method != 373 -#error id_core_define_method differs -#elif id_core_define_singleton_method != 374 -#error id_core_define_singleton_method differs -#elif id_core_set_postexe != 375 -#error id_core_set_postexe differs -#elif tLAST_TOKEN != 376 -#error tLAST_TOKEN differs #endif idPLUS = '+', idMINUS = '-', @@ -181,4 +121,41 @@ enum ruby_method_ids { TOKEN2ID(Initialize) }; +#ifdef tLAST_TOKEN +#define ruby_method_id_check_for(name, value) \ + typedef int ruby_method_id_check_for_##name[name == value ? 1 : -1] +ruby_method_id_check_for(tUPLUS, 321); +ruby_method_id_check_for(tUMINUS, 322); +ruby_method_id_check_for(tPOW, 323); +ruby_method_id_check_for(tCMP, 324); +ruby_method_id_check_for(tEQ, 325); +ruby_method_id_check_for(tEQQ, 326); +ruby_method_id_check_for(tNEQ, 327); +ruby_method_id_check_for(tGEQ, 328); +ruby_method_id_check_for(tLEQ, 329); +ruby_method_id_check_for(tANDOP, 330); +ruby_method_id_check_for(tOROP, 331); +ruby_method_id_check_for(tMATCH, 332); +ruby_method_id_check_for(tNMATCH, 333); +ruby_method_id_check_for(tDOT2, 334); +ruby_method_id_check_for(tDOT3, 335); +ruby_method_id_check_for(tAREF, 336); +ruby_method_id_check_for(tASET, 337); +ruby_method_id_check_for(tLSHFT, 338); +ruby_method_id_check_for(tRSHFT, 339); +ruby_method_id_check_for(tLAMBDA, 352); +ruby_method_id_check_for(idNULL, 365); +ruby_method_id_check_for(idRespond_to, 366); +ruby_method_id_check_for(idIFUNC, 367); +ruby_method_id_check_for(idCFUNC, 368); +ruby_method_id_check_for(idThrowState, 369); +ruby_method_id_check_for(id_core_set_method_alias, 370); +ruby_method_id_check_for(id_core_set_variable_alias, 371); +ruby_method_id_check_for(id_core_undef_method, 372); +ruby_method_id_check_for(id_core_define_method, 373); +ruby_method_id_check_for(id_core_define_singleton_method, 374); +ruby_method_id_check_for(id_core_set_postexe, 375); +ruby_method_id_check_for(tLAST_TOKEN, 376); +#endif + #endif /* RUBY_ID_H */ diff --git a/template/id.h.tmpl b/template/id.h.tmpl index c16137cb5a..22fe9ef467 100644 --- a/template/id.h.tmpl +++ b/template/id.h.tmpl @@ -53,15 +53,15 @@ end #define symIFUNC ID2SYM(idIFUNC) #define symCFUNC ID2SYM(idCFUNC) +#if !defined tLAST_TOKEN && defined YYTOKENTYPE +#define tLAST_TOKEN tLAST_TOKEN +#endif + enum ruby_method_ids { -#if !defined tLAST_TOKEN && !defined YYTOKENTYPE +#ifndef tLAST_TOKEN % tokens.each do |token, value| <%=token%> = <%=value%>, % end -% tokens.map do |token, value| -#elif <%=token%> != <%=value%> -#error <%=token%> differs -% end #endif idPLUS = '+', idMINUS = '-', @@ -114,4 +114,12 @@ enum ruby_method_ids { TOKEN2ID(Initialize) }; +#ifdef tLAST_TOKEN +#define ruby_method_id_check_for(name, value) \ + typedef int ruby_method_id_check_for_##name[name == value ? 1 : -1] +% tokens.map do |token, value| +ruby_method_id_check_for(<%=token%>, <%=value%>); +% end +#endif + #endif /* RUBY_ID_H */