2008-10-19 08:12:53 -04:00
|
|
|
%# -*- c -*-
|
|
|
|
/* DO NOT EDIT THIS FILE DIRECTLY */
|
|
|
|
/**********************************************************************
|
|
|
|
|
2008-12-09 02:14:13 -05:00
|
|
|
id.h -
|
2008-10-19 08:12:53 -04:00
|
|
|
|
|
|
|
$Author$
|
|
|
|
created at: Sun Oct 19 21:12:51 2008
|
|
|
|
|
|
|
|
Copyright (C) 2007 Koichi Sasada
|
|
|
|
|
|
|
|
**********************************************************************/
|
|
|
|
<%
|
|
|
|
require 'optparse'
|
2012-08-17 04:35:12 -04:00
|
|
|
|
2012-08-31 01:31:20 -04:00
|
|
|
op_id_offset = 128
|
2012-03-13 21:35:06 -04:00
|
|
|
|
|
|
|
method_ids = %w[
|
|
|
|
Intern
|
|
|
|
MethodMissing
|
|
|
|
Length
|
|
|
|
Size
|
2012-09-26 05:34:46 -04:00
|
|
|
EmptyP
|
2012-03-13 21:35:06 -04:00
|
|
|
Gets
|
|
|
|
Succ
|
|
|
|
Each
|
|
|
|
Lambda
|
|
|
|
Send
|
|
|
|
__send__
|
|
|
|
Initialize
|
|
|
|
UScore
|
2012-08-17 04:35:08 -04:00
|
|
|
Bitblt
|
|
|
|
Answer
|
2012-03-13 21:35:06 -04:00
|
|
|
]
|
2012-08-17 04:35:12 -04:00
|
|
|
|
2012-08-31 01:31:20 -04:00
|
|
|
token_op_ids = %w[
|
|
|
|
tDOT2 tDOT3 tUPLUS tUMINUS tPOW tDSTAR tCMP tLSHFT tRSHFT
|
|
|
|
tLEQ tGEQ tEQ tEQQ tNEQ tMATCH tNMATCH tAREF tASET
|
|
|
|
tCOLON2 tCOLON3
|
|
|
|
]
|
|
|
|
|
2012-08-17 04:35:12 -04:00
|
|
|
preserved_ids = %w[
|
|
|
|
NULL
|
|
|
|
Respond_to
|
|
|
|
IFUNC
|
|
|
|
CFUNC
|
|
|
|
_core_set_method_alias
|
|
|
|
_core_set_variable_alias
|
|
|
|
_core_undef_method
|
|
|
|
_core_define_method
|
|
|
|
_core_define_singleton_method
|
|
|
|
_core_set_postexe
|
|
|
|
_core_hash_from_ary
|
|
|
|
_core_hash_merge_ary
|
|
|
|
_core_hash_merge_ptr
|
|
|
|
_core_hash_merge_kwd
|
|
|
|
]
|
2008-10-19 08:12:53 -04:00
|
|
|
%>
|
|
|
|
#ifndef RUBY_ID_H
|
|
|
|
#define RUBY_ID_H
|
|
|
|
|
|
|
|
#define ID_SCOPE_SHIFT 3
|
|
|
|
#define ID_SCOPE_MASK 0x07
|
|
|
|
#define ID_LOCAL 0x00
|
|
|
|
#define ID_INSTANCE 0x01
|
|
|
|
#define ID_GLOBAL 0x03
|
|
|
|
#define ID_ATTRSET 0x04
|
|
|
|
#define ID_CONST 0x05
|
|
|
|
#define ID_CLASS 0x06
|
|
|
|
#define ID_JUNK 0x07
|
|
|
|
#define ID_INTERNAL ID_JUNK
|
|
|
|
|
|
|
|
#define symIFUNC ID2SYM(idIFUNC)
|
|
|
|
#define symCFUNC ID2SYM(idCFUNC)
|
|
|
|
|
2012-08-31 01:31:20 -04:00
|
|
|
% token_op_ids.each_with_index do |token, index|
|
|
|
|
#define RUBY_TOKEN_<%=token[/\At(.+)\z/, 1]%> <%=op_id_offset + index%>
|
|
|
|
% end
|
|
|
|
#define RUBY_TOKEN(t) RUBY_TOKEN_##t
|
2008-12-24 15:05:12 -05:00
|
|
|
|
2008-10-19 08:12:53 -04:00
|
|
|
enum ruby_method_ids {
|
2012-08-31 01:31:20 -04:00
|
|
|
idDot2 = RUBY_TOKEN(DOT2),
|
|
|
|
idDot3 = RUBY_TOKEN(DOT3),
|
|
|
|
idUPlus = RUBY_TOKEN(UPLUS),
|
|
|
|
idUMinus = RUBY_TOKEN(UMINUS),
|
|
|
|
idPow = RUBY_TOKEN(POW),
|
|
|
|
idCmp = RUBY_TOKEN(CMP),
|
2008-10-19 08:12:53 -04:00
|
|
|
idPLUS = '+',
|
|
|
|
idMINUS = '-',
|
|
|
|
idMULT = '*',
|
|
|
|
idDIV = '/',
|
|
|
|
idMOD = '%',
|
|
|
|
idLT = '<',
|
2012-08-31 01:31:20 -04:00
|
|
|
idLTLT = RUBY_TOKEN(LSHFT),
|
|
|
|
idLE = RUBY_TOKEN(LEQ),
|
2008-10-19 08:12:53 -04:00
|
|
|
idGT = '>',
|
2012-08-31 01:31:20 -04:00
|
|
|
idGE = RUBY_TOKEN(GEQ),
|
|
|
|
idEq = RUBY_TOKEN(EQ),
|
|
|
|
idEqq = RUBY_TOKEN(EQQ),
|
|
|
|
idNeq = RUBY_TOKEN(NEQ),
|
2008-10-19 08:12:53 -04:00
|
|
|
idNot = '!',
|
|
|
|
idBackquote = '`',
|
2012-08-31 01:31:20 -04:00
|
|
|
idEqTilde = RUBY_TOKEN(MATCH),
|
|
|
|
idNeqTilde = RUBY_TOKEN(NMATCH),
|
|
|
|
idAREF = RUBY_TOKEN(AREF),
|
|
|
|
idASET = RUBY_TOKEN(ASET),
|
|
|
|
tPRESERVED_ID_BEGIN = <%=op_id_offset + token_op_ids.size - 1%>,
|
2012-08-17 04:35:12 -04:00
|
|
|
% preserved_ids.each do |token|
|
|
|
|
id<%=token%>,
|
|
|
|
% end
|
|
|
|
tPRESERVED_ID_END,
|
2012-03-13 21:35:06 -04:00
|
|
|
% method_ids.each do |token|
|
|
|
|
t<%=token%>,
|
|
|
|
% end
|
2008-10-19 08:12:53 -04:00
|
|
|
#define TOKEN2ID(n) id##n = ((t##n<<ID_SCOPE_SHIFT)|ID_LOCAL)
|
2012-03-13 21:35:06 -04:00
|
|
|
% method_ids.each do |token|
|
|
|
|
TOKEN2ID(<%=token%>),
|
|
|
|
% end
|
2012-08-31 01:31:20 -04:00
|
|
|
tLAST_OP_ID = tPRESERVED_ID_END-1,
|
|
|
|
idLAST_OP_ID = tLAST_OP_ID >> ID_SCOPE_SHIFT
|
2008-12-24 15:53:06 -05:00
|
|
|
};
|
2008-12-24 15:05:12 -05:00
|
|
|
|
2008-10-19 08:12:53 -04:00
|
|
|
#endif /* RUBY_ID_H */
|