summaryrefslogtreecommitdiff
path: root/jni/ruby/id.h
blob: d6b50f2fc48c2514806ead5b132359aba1d3b4bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
/* DO NOT EDIT THIS FILE DIRECTLY */
/**********************************************************************

  id.h -

  $Author: nobu $
  created at: Sun Oct 19 21:12:51 2008

  Copyright (C) 2007 Koichi Sasada

**********************************************************************/

#ifndef RUBY_ID_H
#define RUBY_ID_H

enum ruby_id_types {
    RUBY_ID_STATIC_SYM  = 0x01,
    RUBY_ID_LOCAL       = 0x00,
    RUBY_ID_INSTANCE    = (0x01<<1),
    RUBY_ID_GLOBAL      = (0x03<<1),
    RUBY_ID_ATTRSET     = (0x04<<1),
    RUBY_ID_CONST       = (0x05<<1),
    RUBY_ID_CLASS       = (0x06<<1),
    RUBY_ID_JUNK        = (0x07<<1),
    RUBY_ID_INTERNAL    = RUBY_ID_JUNK,
    RUBY_ID_SCOPE_SHIFT = 4,
    RUBY_ID_SCOPE_MASK  = (~(~0U<<(RUBY_ID_SCOPE_SHIFT-1))<<1)
};

#define ID_STATIC_SYM  RUBY_ID_STATIC_SYM
#define ID_SCOPE_SHIFT RUBY_ID_SCOPE_SHIFT
#define ID_SCOPE_MASK  RUBY_ID_SCOPE_MASK
#define ID_LOCAL       RUBY_ID_LOCAL
#define ID_INSTANCE    RUBY_ID_INSTANCE
#define ID_GLOBAL      RUBY_ID_GLOBAL
#define ID_ATTRSET     RUBY_ID_ATTRSET
#define ID_CONST       RUBY_ID_CONST
#define ID_CLASS       RUBY_ID_CLASS
#define ID_JUNK        RUBY_ID_JUNK
#define ID_INTERNAL    RUBY_ID_INTERNAL

#define ID2ATTRSET(id) (((id)&~ID_SCOPE_MASK)|ID_ATTRSET)

#define symIFUNC ID2SYM(idIFUNC)
#define symCFUNC ID2SYM(idCFUNC)

#define RUBY_TOKEN_DOT2 128
#define RUBY_TOKEN_DOT3 129
#define RUBY_TOKEN_UPLUS 130
#define RUBY_TOKEN_UMINUS 131
#define RUBY_TOKEN_POW 132
#define RUBY_TOKEN_DSTAR 133
#define RUBY_TOKEN_CMP 134
#define RUBY_TOKEN_LSHFT 135
#define RUBY_TOKEN_RSHFT 136
#define RUBY_TOKEN_LEQ 137
#define RUBY_TOKEN_GEQ 138
#define RUBY_TOKEN_EQ 139
#define RUBY_TOKEN_EQQ 140
#define RUBY_TOKEN_NEQ 141
#define RUBY_TOKEN_MATCH 142
#define RUBY_TOKEN_NMATCH 143
#define RUBY_TOKEN_AREF 144
#define RUBY_TOKEN_ASET 145
#define RUBY_TOKEN_COLON2 146
#define RUBY_TOKEN_COLON3 147
#define RUBY_TOKEN_ANDOP 148
#define RUBY_TOKEN_OROP 149
#define RUBY_TOKEN(t) RUBY_TOKEN_##t

enum ruby_method_ids {
    idDot2 = RUBY_TOKEN(DOT2),
    idDot3 = RUBY_TOKEN(DOT3),
    idUPlus = RUBY_TOKEN(UPLUS),
    idUMinus = RUBY_TOKEN(UMINUS),
    idPow = RUBY_TOKEN(POW),
    idCmp = RUBY_TOKEN(CMP),
    idPLUS = '+',
    idMINUS = '-',
    idMULT = '*',
    idDIV = '/',
    idMOD = '%',
    idLT = '<',
    idLTLT = RUBY_TOKEN(LSHFT),
    idLE = RUBY_TOKEN(LEQ),
    idGT = '>',
    idGTGT = RUBY_TOKEN(RSHFT),
    idGE = RUBY_TOKEN(GEQ),
    idEq = RUBY_TOKEN(EQ),
    idEqq = RUBY_TOKEN(EQQ),
    idNeq = RUBY_TOKEN(NEQ),
    idNot = '!',
    idBackquote = '`',
    idEqTilde = RUBY_TOKEN(MATCH),
    idNeqTilde = RUBY_TOKEN(NMATCH),
    idAREF = RUBY_TOKEN(AREF),
    idASET = RUBY_TOKEN(ASET),
    idCOLON2 = RUBY_TOKEN(COLON2),
    idANDOP = RUBY_TOKEN(ANDOP),
    idOROP = RUBY_TOKEN(OROP),
    tPRESERVED_ID_BEGIN = 149,
    idNULL,
    idEmptyP,
    idEqlP,
    idRespond_to,
    idRespond_to_missing,
    idIFUNC,
    idCFUNC,
    id_core_set_method_alias,
    id_core_set_variable_alias,
    id_core_undef_method,
    id_core_define_method,
    id_core_define_singleton_method,
    id_core_set_postexe,
    id_core_hash_from_ary,
    id_core_hash_merge_ary,
    id_core_hash_merge_ptr,
    id_core_hash_merge_kwd,
    tPRESERVED_ID_END,
    tFreeze,
    tInspect,
    tIntern,
    tObject_id,
    tConst_missing,
    tMethodMissing,
    tMethod_added,
    tSingleton_method_added,
    tMethod_removed,
    tSingleton_method_removed,
    tMethod_undefined,
    tSingleton_method_undefined,
    tLength,
    tSize,
    tGets,
    tSucc,
    tEach,
    tProc,
    tLambda,
    tSend,
    t__send__,
    t__attached__,
    tInitialize,
    tInitialize_copy,
    tInitialize_clone,
    tInitialize_dup,
    tTo_int,
    tTo_ary,
    tTo_str,
    tTo_sym,
    tTo_hash,
    tTo_proc,
    tTo_io,
    tTo_a,
    tTo_s,
    tTo_i,
    tBt,
    tBt_locations,
    tCall,
    tMesg,
    tException,
    tUScore,
    tNEXT_ID,
#define TOKEN2LOCALID(n) id##n = ((t##n<<ID_SCOPE_SHIFT)|ID_LOCAL|ID_STATIC_SYM)
    TOKEN2LOCALID(Freeze),
    TOKEN2LOCALID(Inspect),
    TOKEN2LOCALID(Intern),
    TOKEN2LOCALID(Object_id),
    TOKEN2LOCALID(Const_missing),
    TOKEN2LOCALID(MethodMissing),
    TOKEN2LOCALID(Method_added),
    TOKEN2LOCALID(Singleton_method_added),
    TOKEN2LOCALID(Method_removed),
    TOKEN2LOCALID(Singleton_method_removed),
    TOKEN2LOCALID(Method_undefined),
    TOKEN2LOCALID(Singleton_method_undefined),
    TOKEN2LOCALID(Length),
    TOKEN2LOCALID(Size),
    TOKEN2LOCALID(Gets),
    TOKEN2LOCALID(Succ),
    TOKEN2LOCALID(Each),
    TOKEN2LOCALID(Proc),
    TOKEN2LOCALID(Lambda),
    TOKEN2LOCALID(Send),
    TOKEN2LOCALID(__send__),
    TOKEN2LOCALID(__attached__),
    TOKEN2LOCALID(Initialize),
    TOKEN2LOCALID(Initialize_copy),
    TOKEN2LOCALID(Initialize_clone),
    TOKEN2LOCALID(Initialize_dup),
    TOKEN2LOCALID(To_int),
    TOKEN2LOCALID(To_ary),
    TOKEN2LOCALID(To_str),
    TOKEN2LOCALID(To_sym),
    TOKEN2LOCALID(To_hash),
    TOKEN2LOCALID(To_proc),
    TOKEN2LOCALID(To_io),
    TOKEN2LOCALID(To_a),
    TOKEN2LOCALID(To_s),
    TOKEN2LOCALID(To_i),
    TOKEN2LOCALID(Bt),
    TOKEN2LOCALID(Bt_locations),
    TOKEN2LOCALID(Call),
    TOKEN2LOCALID(Mesg),
    TOKEN2LOCALID(Exception),
    TOKEN2LOCALID(UScore),
    tLAST_OP_ID = tPRESERVED_ID_END-1,
    idLAST_OP_ID = tLAST_OP_ID >> ID_SCOPE_SHIFT
};

#endif /* RUBY_ID_H */