Ruby: id.h Source File

Ruby 4.0.5p0 (2026-05-20 revision 64336ffd0ee9e1f4c05891695a3d7b49cb709721)

id.h
1/* DO NOT EDIT THIS FILE DIRECTLY: source is at template/id.h.tmpl */
2/**********************************************************************
3
4 id.h -
5
6 $Author$
7 created at: Sun Oct 19 21:12:51 2008
8
9 Copyright (C) 2007 Koichi Sasada
10
11**********************************************************************/
12
13#ifndef RUBY_ID_H
14#define RUBY_ID_H
15
16enum ruby_id_types {
17 RUBY_ID_LOCAL = 0x00,
18 RUBY_ID_STATIC_SYM = 0x01,
19 RUBY_ID_INSTANCE = (0x01<<1),
20 RUBY_ID_GLOBAL = (0x03<<1),
21 RUBY_ID_ATTRSET = (0x04<<1),
22 RUBY_ID_CONST = (0x05<<1),
23 RUBY_ID_CLASS = (0x06<<1),
24 RUBY_ID_INTERNAL = (0x07<<1),
25 RUBY_ID_SCOPE_SHIFT = 4,
26 RUBY_ID_SCOPE_MASK = (~(~0U<<(RUBY_ID_SCOPE_SHIFT-1))<<1)
27};
28
29#define ID_STATIC_SYM RUBY_ID_STATIC_SYM
30#define ID_SCOPE_SHIFT RUBY_ID_SCOPE_SHIFT
31#define ID_SCOPE_MASK RUBY_ID_SCOPE_MASK
32#define ID_LOCAL RUBY_ID_LOCAL
33#define ID_INSTANCE RUBY_ID_INSTANCE
34#define ID_GLOBAL RUBY_ID_GLOBAL
35#define ID_ATTRSET RUBY_ID_ATTRSET
36#define ID_CONST RUBY_ID_CONST
37#define ID_CLASS RUBY_ID_CLASS
38#define ID_INTERNAL RUBY_ID_INTERNAL
39
40#define symIFUNC ID2SYM(idIFUNC)
41#define symCFUNC ID2SYM(idCFUNC)
42
43#define RUBY_TOKEN_DOT2 128
44#define RUBY_TOKEN_DOT3 129
45#define RUBY_TOKEN_BDOT2 130
46#define RUBY_TOKEN_BDOT3 131
47#define RUBY_TOKEN_UPLUS 132
48#define RUBY_TOKEN_UMINUS 133
49#define RUBY_TOKEN_POW 134
50#define RUBY_TOKEN_CMP 135
51#define RUBY_TOKEN_LSHFT 136
52#define RUBY_TOKEN_RSHFT 137
53#define RUBY_TOKEN_LEQ 138
54#define RUBY_TOKEN_GEQ 139
55#define RUBY_TOKEN_EQ 140
56#define RUBY_TOKEN_EQQ 141
57#define RUBY_TOKEN_NEQ 142
58#define RUBY_TOKEN_MATCH 143
59#define RUBY_TOKEN_NMATCH 144
60#define RUBY_TOKEN_AREF 145
61#define RUBY_TOKEN_ASET 146
62#define RUBY_TOKEN_COLON2 147
63#define RUBY_TOKEN_ANDOP 148
64#define RUBY_TOKEN_OROP 149
65#define RUBY_TOKEN_ANDDOT 150
66#define RUBY_TOKEN(t) RUBY_TOKEN_##t
67
68#define RUBY_TOKEN2ID_TYPE(tok, type) ((tok<<RUBY_ID_SCOPE_SHIFT)|type|RUBY_ID_STATIC_SYM)
69#define TOKEN2LOCALID(tok) RUBY_TOKEN2ID_TYPE(tok, RUBY_ID_LOCAL)
70#define TOKEN2INSTANCEID(tok) RUBY_TOKEN2ID_TYPE(tok, RUBY_ID_INSTANCE)
71#define TOKEN2GLOBALID(tok) RUBY_TOKEN2ID_TYPE(tok, RUBY_ID_GLOBAL)
72#define TOKEN2CONSTID(tok) RUBY_TOKEN2ID_TYPE(tok, RUBY_ID_CONST)
73#define TOKEN2CLASSID(tok) RUBY_TOKEN2ID_TYPE(tok, RUBY_ID_CLASS)
74#define TOKEN2ATTRSETID(tok) RUBY_TOKEN2ID_TYPE(tok, RUBY_ID_ATTRSET)
75
76enum ruby_method_ids {
77 idDot2 = RUBY_TOKEN(DOT2),
78 idDot3 = RUBY_TOKEN(DOT3),
79 idUPlus = RUBY_TOKEN(UPLUS),
80 idUMinus = RUBY_TOKEN(UMINUS),
81 idPow = RUBY_TOKEN(POW),
82 idCmp = RUBY_TOKEN(CMP),
83 idPLUS = '+',
84 idMINUS = '-',
85 idMULT = '*',
86 idDIV = '/',
87 idMOD = '%',
88 idLTLT = RUBY_TOKEN(LSHFT),
89 idGTGT = RUBY_TOKEN(RSHFT),
90 idLT = '<',
91 idLE = RUBY_TOKEN(LEQ),
92 idGT = '>',
93 idGE = RUBY_TOKEN(GEQ),
94 idEq = RUBY_TOKEN(EQ),
95 idEqq = RUBY_TOKEN(EQQ),
96 idNeq = RUBY_TOKEN(NEQ),
97 idNot = '!',
98 idAnd = '&',
99 idOr = '|',
100 idBackquote = '`',
101 idEqTilde = RUBY_TOKEN(MATCH),
102 idNeqTilde = RUBY_TOKEN(NMATCH),
103 idAREF = RUBY_TOKEN(AREF),
104 idASET = RUBY_TOKEN(ASET),
105 idCOLON2 = RUBY_TOKEN(COLON2),
106 idANDOP = RUBY_TOKEN(ANDOP),
107 idOROP = RUBY_TOKEN(OROP),
108 idANDDOT = RUBY_TOKEN(ANDDOT),
109 tPRESERVED_ID_BEGIN = 150,
110 idNilP,
111 idIncludeP,
112 idItImplicit,
113 idNULL,
114 idEmptyP,
115 idEqlP,
116 idRespond_to,
117 idRespond_to_missing,
118 idIFUNC,
119 idCFUNC,
120 id_core_set_method_alias,
121 id_core_set_variable_alias,
122 id_core_undef_method,
123 id_core_define_method,
124 id_core_define_singleton_method,
125 id_core_set_postexe,
126 id_core_hash_merge_ptr,
127 id_core_hash_merge_kwd,
128 id_core_raise,
129 id_core_sprintf,
130 id_debug_created_info,
131 tPRESERVED_ID_END,
132
133 /* LOCAL tokens {{{ */
134 tTOKEN_LOCAL_BEGIN = tPRESERVED_ID_END-1,
135 tMax,
136 tMin,
137 tHash,
138 tFreeze,
139 tInspect,
140 tIntern,
141 tObject_id,
142 t__id__,
143 tConst_added,
144 tConst_missing,
145 tMethodMissing,
146 tMethod_added,
147 tSingleton_method_added,
148 tMethod_removed,
149 tSingleton_method_removed,
150 tMethod_undefined,
151 tSingleton_method_undefined,
152 tLength,
153 tSize,
154 tGets,
155 tSucc,
156 tEach,
157 tProc,
158 tLambda,
159 tSend,
160 t__send__,
161 t__recursive_key__,
162 tInitialize,
163 tInitialize_copy,
164 tInitialize_clone,
165 tInitialize_dup,
166 tTo_int,
167 tTo_ary,
168 tTo_str,
169 tTo_sym,
170 tTo_hash,
171 tTo_proc,
172 tTo_io,
173 tTo_a,
174 tTo_s,
175 tTo_i,
176 tTo_f,
177 tTo_r,
178 tBt,
179 tBt_locations,
180 tCall,
181 tMesg,
182 tException,
183 tLocals,
184 tNOT,
185 tAND,
186 tOR,
187 tDiv,
188 tDivmod,
189 tFdiv,
190 tQuo,
191 tName,
192 tNil,
193 tPath,
194 tPack,
195 tBuffer,
196 tAborted,
197 tExited,
198 tUScore,
199 tNUMPARAM_1,
200 tNUMPARAM_2,
201 tNUMPARAM_3,
202 tNUMPARAM_4,
203 tNUMPARAM_5,
204 tNUMPARAM_6,
205 tNUMPARAM_7,
206 tNUMPARAM_8,
207 tNUMPARAM_9,
208 tIt,
209 tDefault,
210 tTOKEN_LOCAL_END,
211 /* LOCAL tokens }}} */
212
213 /* INSTANCE tokens {{{ */
214 tTOKEN_INSTANCE_BEGIN = tTOKEN_LOCAL_END-1,
215 tTOKEN_INSTANCE_END,
216 /* INSTANCE tokens }}} */
217
218 /* GLOBAL tokens {{{ */
219 tTOKEN_GLOBAL_BEGIN = tTOKEN_INSTANCE_END-1,
220 tLASTLINE,
221 tBACKREF,
222 tERROR_INFO,
223 tTOKEN_GLOBAL_END,
224 /* GLOBAL tokens }}} */
225
226 /* CONST tokens {{{ */
227 tTOKEN_CONST_BEGIN = tTOKEN_GLOBAL_END-1,
228 tRuby,
229 tTOKEN_CONST_END,
230 /* CONST tokens }}} */
231
232 /* CLASS tokens {{{ */
233 tTOKEN_CLASS_BEGIN = tTOKEN_CONST_END-1,
234 tTOKEN_CLASS_END,
235 /* CLASS tokens }}} */
236
237 /* ATTRSET tokens {{{ */
238 tTOKEN_ATTRSET_BEGIN = tTOKEN_CLASS_END-1,
239 tTOKEN_ATTRSET_END,
240 /* ATTRSET tokens }}} */
241
242 tNEXT_ID = tTOKEN_ATTRSET_END,
243
244 /* LOCAL IDs {{{ */
245#define DEFINE_LOCALID_FROM_TOKEN(n) id##n = TOKEN2LOCALID(t##n)
246 DEFINE_LOCALID_FROM_TOKEN(Max),
247 DEFINE_LOCALID_FROM_TOKEN(Min),
248 DEFINE_LOCALID_FROM_TOKEN(Hash),
249 DEFINE_LOCALID_FROM_TOKEN(Freeze),
250 DEFINE_LOCALID_FROM_TOKEN(Inspect),
251 DEFINE_LOCALID_FROM_TOKEN(Intern),
252 DEFINE_LOCALID_FROM_TOKEN(Object_id),
253 DEFINE_LOCALID_FROM_TOKEN(__id__),
254 DEFINE_LOCALID_FROM_TOKEN(Const_added),
255 DEFINE_LOCALID_FROM_TOKEN(Const_missing),
256 DEFINE_LOCALID_FROM_TOKEN(MethodMissing),
257 DEFINE_LOCALID_FROM_TOKEN(Method_added),
258 DEFINE_LOCALID_FROM_TOKEN(Singleton_method_added),
259 DEFINE_LOCALID_FROM_TOKEN(Method_removed),
260 DEFINE_LOCALID_FROM_TOKEN(Singleton_method_removed),
261 DEFINE_LOCALID_FROM_TOKEN(Method_undefined),
262 DEFINE_LOCALID_FROM_TOKEN(Singleton_method_undefined),
263 DEFINE_LOCALID_FROM_TOKEN(Length),
264 DEFINE_LOCALID_FROM_TOKEN(Size),
265 DEFINE_LOCALID_FROM_TOKEN(Gets),
266 DEFINE_LOCALID_FROM_TOKEN(Succ),
267 DEFINE_LOCALID_FROM_TOKEN(Each),
268 DEFINE_LOCALID_FROM_TOKEN(Proc),
269 DEFINE_LOCALID_FROM_TOKEN(Lambda),
270 DEFINE_LOCALID_FROM_TOKEN(Send),
271 DEFINE_LOCALID_FROM_TOKEN(__send__),
272 DEFINE_LOCALID_FROM_TOKEN(__recursive_key__),
273 DEFINE_LOCALID_FROM_TOKEN(Initialize),
274 DEFINE_LOCALID_FROM_TOKEN(Initialize_copy),
275 DEFINE_LOCALID_FROM_TOKEN(Initialize_clone),
276 DEFINE_LOCALID_FROM_TOKEN(Initialize_dup),
277 DEFINE_LOCALID_FROM_TOKEN(To_int),
278 DEFINE_LOCALID_FROM_TOKEN(To_ary),
279 DEFINE_LOCALID_FROM_TOKEN(To_str),
280 DEFINE_LOCALID_FROM_TOKEN(To_sym),
281 DEFINE_LOCALID_FROM_TOKEN(To_hash),
282 DEFINE_LOCALID_FROM_TOKEN(To_proc),
283 DEFINE_LOCALID_FROM_TOKEN(To_io),
284 DEFINE_LOCALID_FROM_TOKEN(To_a),
285 DEFINE_LOCALID_FROM_TOKEN(To_s),
286 DEFINE_LOCALID_FROM_TOKEN(To_i),
287 DEFINE_LOCALID_FROM_TOKEN(To_f),
288 DEFINE_LOCALID_FROM_TOKEN(To_r),
289 DEFINE_LOCALID_FROM_TOKEN(Bt),
290 DEFINE_LOCALID_FROM_TOKEN(Bt_locations),
291 DEFINE_LOCALID_FROM_TOKEN(Call),
292 DEFINE_LOCALID_FROM_TOKEN(Mesg),
293 DEFINE_LOCALID_FROM_TOKEN(Exception),
294 DEFINE_LOCALID_FROM_TOKEN(Locals),
295 DEFINE_LOCALID_FROM_TOKEN(NOT),
296 DEFINE_LOCALID_FROM_TOKEN(AND),
297 DEFINE_LOCALID_FROM_TOKEN(OR),
298 DEFINE_LOCALID_FROM_TOKEN(Div),
299 DEFINE_LOCALID_FROM_TOKEN(Divmod),
300 DEFINE_LOCALID_FROM_TOKEN(Fdiv),
301 DEFINE_LOCALID_FROM_TOKEN(Quo),
302 DEFINE_LOCALID_FROM_TOKEN(Name),
303 DEFINE_LOCALID_FROM_TOKEN(Nil),
304 DEFINE_LOCALID_FROM_TOKEN(Path),
305 DEFINE_LOCALID_FROM_TOKEN(Pack),
306 DEFINE_LOCALID_FROM_TOKEN(Buffer),
307 DEFINE_LOCALID_FROM_TOKEN(Aborted),
308 DEFINE_LOCALID_FROM_TOKEN(Exited),
309 DEFINE_LOCALID_FROM_TOKEN(UScore),
310 DEFINE_LOCALID_FROM_TOKEN(NUMPARAM_1),
311 DEFINE_LOCALID_FROM_TOKEN(NUMPARAM_2),
312 DEFINE_LOCALID_FROM_TOKEN(NUMPARAM_3),
313 DEFINE_LOCALID_FROM_TOKEN(NUMPARAM_4),
314 DEFINE_LOCALID_FROM_TOKEN(NUMPARAM_5),
315 DEFINE_LOCALID_FROM_TOKEN(NUMPARAM_6),
316 DEFINE_LOCALID_FROM_TOKEN(NUMPARAM_7),
317 DEFINE_LOCALID_FROM_TOKEN(NUMPARAM_8),
318 DEFINE_LOCALID_FROM_TOKEN(NUMPARAM_9),
319 DEFINE_LOCALID_FROM_TOKEN(It),
320 DEFINE_LOCALID_FROM_TOKEN(Default),
321#undef DEFINE_LOCALID_FROM_TOKEN
322 /* LOCAL IDs }}} */
323
324 /* INSTANCE IDs {{{ */
325#define DEFINE_INSTANCEID_FROM_TOKEN(n) id##n = TOKEN2INSTANCEID(t##n)
326#undef DEFINE_INSTANCEID_FROM_TOKEN
327 /* INSTANCE IDs }}} */
328
329 /* GLOBAL IDs {{{ */
330#define DEFINE_GLOBALID_FROM_TOKEN(n) id##n = TOKEN2GLOBALID(t##n)
331 DEFINE_GLOBALID_FROM_TOKEN(LASTLINE),
332 DEFINE_GLOBALID_FROM_TOKEN(BACKREF),
333 DEFINE_GLOBALID_FROM_TOKEN(ERROR_INFO),
334#undef DEFINE_GLOBALID_FROM_TOKEN
335 /* GLOBAL IDs }}} */
336
337 /* CONST IDs {{{ */
338#define DEFINE_CONSTID_FROM_TOKEN(n) id##n = TOKEN2CONSTID(t##n)
339 DEFINE_CONSTID_FROM_TOKEN(Ruby),
340#undef DEFINE_CONSTID_FROM_TOKEN
341 /* CONST IDs }}} */
342
343 /* CLASS IDs {{{ */
344#define DEFINE_CLASSID_FROM_TOKEN(n) id##n = TOKEN2CLASSID(t##n)
345#undef DEFINE_CLASSID_FROM_TOKEN
346 /* CLASS IDs }}} */
347
348 /* ATTRSET IDs {{{ */
349#define DEFINE_ATTRSETID_FROM_TOKEN(n) id##n = TOKEN2ATTRSETID(t##n)
350#undef DEFINE_ATTRSETID_FROM_TOKEN
351 /* ATTRSET IDs }}} */
352
353 tLAST_OP_ID = tPRESERVED_ID_END-1,
354 idLAST_OP_ID = tLAST_OP_ID >> ID_SCOPE_SHIFT
355};
356
357#endif /* RUBY_ID_H */
U
Definition dtoa.c:309