|
1 /* |
|
2 * Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. Sun designates this |
|
8 * particular file as subject to the "Classpath" exception as provided |
|
9 * by Sun in the LICENSE file that accompanied this code. |
|
10 * |
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
|
15 * accompanied this code). |
|
16 * |
|
17 * You should have received a copy of the GNU General Public License version |
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 * |
|
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
22 * CA 95054 USA or visit www.sun.com if you need additional information or |
|
23 * have any questions. |
|
24 */ |
|
25 |
|
26 |
|
27 |
|
28 package sun.tools.javap; |
|
29 |
|
30 /** |
|
31 * This interface defines constant that are used |
|
32 * throughout the compiler. It inherits from RuntimeConstants, |
|
33 * which is an autogenerated class that contains contstants |
|
34 * defined in the interpreter. |
|
35 */ |
|
36 |
|
37 public |
|
38 interface Constants extends RuntimeConstants { |
|
39 |
|
40 /** |
|
41 * End of input |
|
42 */ |
|
43 public static final int EOF = -1; |
|
44 |
|
45 /* |
|
46 * Flags |
|
47 */ |
|
48 public static final int F_VERBOSE = 1 << 0; |
|
49 public static final int F_DUMP = 1 << 1; |
|
50 public static final int F_WARNINGS = 1 << 2; |
|
51 public static final int F_DEBUG = 1 << 3; |
|
52 public static final int F_OPTIMIZE = 1 << 4; |
|
53 public static final int F_DEPENDENCIES = 1 << 5; |
|
54 |
|
55 /* |
|
56 * Type codes |
|
57 */ |
|
58 public static final int TC_BOOLEAN = 0; |
|
59 public static final int TC_BYTE = 1; |
|
60 public static final int TC_CHAR = 2; |
|
61 public static final int TC_SHORT = 3; |
|
62 public static final int TC_INT = 4; |
|
63 public static final int TC_LONG = 5; |
|
64 public static final int TC_FLOAT = 6; |
|
65 public static final int TC_DOUBLE = 7; |
|
66 public static final int TC_NULL = 8; |
|
67 public static final int TC_ARRAY = 9; |
|
68 public static final int TC_CLASS = 10; |
|
69 public static final int TC_VOID = 11; |
|
70 public static final int TC_METHOD = 12; |
|
71 public static final int TC_ERROR = 13; |
|
72 |
|
73 /* |
|
74 * Type Masks |
|
75 */ |
|
76 public static final int TM_NULL = 1 << TC_NULL; |
|
77 public static final int TM_VOID = 1 << TC_VOID; |
|
78 public static final int TM_BOOLEAN = 1 << TC_BOOLEAN; |
|
79 public static final int TM_BYTE = 1 << TC_BYTE; |
|
80 public static final int TM_CHAR = 1 << TC_CHAR; |
|
81 public static final int TM_SHORT = 1 << TC_SHORT; |
|
82 public static final int TM_INT = 1 << TC_INT; |
|
83 public static final int TM_LONG = 1 << TC_LONG; |
|
84 public static final int TM_FLOAT = 1 << TC_FLOAT; |
|
85 public static final int TM_DOUBLE = 1 << TC_DOUBLE; |
|
86 public static final int TM_ARRAY = 1 << TC_ARRAY; |
|
87 public static final int TM_CLASS = 1 << TC_CLASS; |
|
88 public static final int TM_METHOD = 1 << TC_METHOD; |
|
89 public static final int TM_ERROR = 1 << TC_ERROR; |
|
90 |
|
91 public static final int TM_INT32 = TM_BYTE | TM_SHORT | TM_CHAR | TM_INT; |
|
92 public static final int TM_NUM32 = TM_INT32 | TM_FLOAT; |
|
93 public static final int TM_NUM64 = TM_LONG | TM_DOUBLE; |
|
94 public static final int TM_INTEGER = TM_INT32 | TM_LONG; |
|
95 public static final int TM_REAL = TM_FLOAT | TM_DOUBLE; |
|
96 public static final int TM_NUMBER = TM_INTEGER | TM_REAL; |
|
97 public static final int TM_REFERENCE = TM_ARRAY | TM_CLASS | TM_NULL; |
|
98 |
|
99 /* |
|
100 * Class status |
|
101 */ |
|
102 public static final int CS_UNDEFINED = 0; |
|
103 public static final int CS_UNDECIDED = 1; |
|
104 public static final int CS_BINARY = 2; |
|
105 public static final int CS_SOURCE = 3; |
|
106 public static final int CS_PARSED = 4; |
|
107 public static final int CS_COMPILED = 5; |
|
108 public static final int CS_NOTFOUND = 6; |
|
109 |
|
110 /* |
|
111 * Attributes |
|
112 */ |
|
113 public static final int ATT_ALL = -1; |
|
114 public static final int ATT_CODE = 1; |
|
115 |
|
116 /* |
|
117 * Number of bits used in file offsets |
|
118 */ |
|
119 public static final int OFFSETBITS = 19; |
|
120 public static final int MAXFILESIZE = (1 << OFFSETBITS) - 1; |
|
121 public static final int MAXLINENUMBER = (1 << (32 - OFFSETBITS)) - 1; |
|
122 |
|
123 /* |
|
124 * Operators |
|
125 */ |
|
126 public final int COMMA = 0; |
|
127 public final int ASSIGN = 1; |
|
128 |
|
129 public final int ASGMUL = 2; |
|
130 public final int ASGDIV = 3; |
|
131 public final int ASGREM = 4; |
|
132 public final int ASGADD = 5; |
|
133 public final int ASGSUB = 6; |
|
134 public final int ASGLSHIFT = 7; |
|
135 public final int ASGRSHIFT = 8; |
|
136 public final int ASGURSHIFT = 9; |
|
137 public final int ASGBITAND = 10; |
|
138 public final int ASGBITOR = 11; |
|
139 public final int ASGBITXOR = 12; |
|
140 |
|
141 public final int COND = 13; |
|
142 public final int OR = 14; |
|
143 public final int AND = 15; |
|
144 public final int BITOR = 16; |
|
145 public final int BITXOR = 17; |
|
146 public final int BITAND = 18; |
|
147 public final int NE = 19; |
|
148 public final int EQ = 20; |
|
149 public final int GE = 21; |
|
150 public final int GT = 22; |
|
151 public final int LE = 23; |
|
152 public final int LT = 24; |
|
153 public final int INSTANCEOF = 25; |
|
154 public final int LSHIFT = 26; |
|
155 public final int RSHIFT = 27; |
|
156 public final int URSHIFT = 28; |
|
157 public final int ADD = 29; |
|
158 public final int SUB = 30; |
|
159 public final int DIV = 31; |
|
160 public final int REM = 32; |
|
161 public final int MUL = 33; |
|
162 public final int CAST = 34; // (x)y |
|
163 public final int POS = 35; // +x |
|
164 public final int NEG = 36; // -x |
|
165 public final int NOT = 37; |
|
166 public final int BITNOT = 38; |
|
167 public final int PREINC = 39; // ++x |
|
168 public final int PREDEC = 40; // --x |
|
169 public final int NEWARRAY = 41; |
|
170 public final int NEWINSTANCE = 42; |
|
171 public final int NEWFROMNAME = 43; |
|
172 public final int POSTINC = 44; // x++ |
|
173 public final int POSTDEC = 45; // x-- |
|
174 public final int FIELD = 46; |
|
175 public final int METHOD = 47; // x(y) |
|
176 public final int ARRAYACCESS = 48; // x[y] |
|
177 public final int NEW = 49; |
|
178 public final int INC = 50; |
|
179 public final int DEC = 51; |
|
180 |
|
181 public final int CONVERT = 55; // implicit conversion |
|
182 public final int EXPR = 56; // (x) |
|
183 public final int ARRAY = 57; // {x, y, ...} |
|
184 public final int GOTO = 58; |
|
185 |
|
186 /* |
|
187 * Value tokens |
|
188 */ |
|
189 public final int IDENT = 60; |
|
190 public final int BOOLEANVAL = 61; |
|
191 public final int BYTEVAL = 62; |
|
192 public final int CHARVAL = 63; |
|
193 public final int SHORTVAL = 64; |
|
194 public final int INTVAL = 65; |
|
195 public final int LONGVAL = 66; |
|
196 public final int FLOATVAL = 67; |
|
197 public final int DOUBLEVAL = 68; |
|
198 public final int STRINGVAL = 69; |
|
199 |
|
200 /* |
|
201 * Type keywords |
|
202 */ |
|
203 public final int BYTE = 70; |
|
204 public final int CHAR = 71; |
|
205 public final int SHORT = 72; |
|
206 public final int INT = 73; |
|
207 public final int LONG = 74; |
|
208 public final int FLOAT = 75; |
|
209 public final int DOUBLE = 76; |
|
210 public final int VOID = 77; |
|
211 public final int BOOLEAN = 78; |
|
212 |
|
213 /* |
|
214 * Expression keywords |
|
215 */ |
|
216 public final int TRUE = 80; |
|
217 public final int FALSE = 81; |
|
218 public final int THIS = 82; |
|
219 public final int SUPER = 83; |
|
220 public final int NULL = 84; |
|
221 |
|
222 /* |
|
223 * Statement keywords |
|
224 */ |
|
225 public final int IF = 90; |
|
226 public final int ELSE = 91; |
|
227 public final int FOR = 92; |
|
228 public final int WHILE = 93; |
|
229 public final int DO = 94; |
|
230 public final int SWITCH = 95; |
|
231 public final int CASE = 96; |
|
232 public final int DEFAULT = 97; |
|
233 public final int BREAK = 98; |
|
234 public final int CONTINUE = 99; |
|
235 public final int RETURN = 100; |
|
236 public final int TRY = 101; |
|
237 public final int CATCH = 102; |
|
238 public final int FINALLY = 103; |
|
239 public final int THROW = 104; |
|
240 public final int STAT = 105; |
|
241 public final int EXPRESSION = 106; |
|
242 public final int DECLARATION = 107; |
|
243 public final int VARDECLARATION = 108; |
|
244 |
|
245 /* |
|
246 * Declaration keywords |
|
247 */ |
|
248 public final int IMPORT = 110; |
|
249 public final int CLASS = 111; |
|
250 public final int EXTENDS = 112; |
|
251 public final int IMPLEMENTS = 113; |
|
252 public final int INTERFACE = 114; |
|
253 public final int PACKAGE = 115; |
|
254 |
|
255 /* |
|
256 * Modifier keywords |
|
257 */ |
|
258 public final int PRIVATE = 120; |
|
259 public final int PUBLIC = 121; |
|
260 public final int PROTECTED = 122; |
|
261 public final int CONST = 123; |
|
262 public final int STATIC = 124; |
|
263 public final int TRANSIENT = 125; |
|
264 public final int SYNCHRONIZED = 126; |
|
265 public final int NATIVE = 127; |
|
266 public final int FINAL = 128; |
|
267 public final int VOLATILE = 129; |
|
268 public final int ABSTRACT = 130; |
|
269 public final int STRICT = 165; |
|
270 |
|
271 /* |
|
272 * Punctuation |
|
273 */ |
|
274 public final int SEMICOLON = 135; |
|
275 public final int COLON = 136; |
|
276 public final int QUESTIONMARK = 137; |
|
277 public final int LBRACE = 138; |
|
278 public final int RBRACE = 139; |
|
279 public final int LPAREN = 140; |
|
280 public final int RPAREN = 141; |
|
281 public final int LSQBRACKET = 142; |
|
282 public final int RSQBRACKET = 143; |
|
283 public final int THROWS = 144; |
|
284 |
|
285 /* |
|
286 * Special tokens |
|
287 */ |
|
288 public final int ERROR = 145; // an error |
|
289 public final int COMMENT = 146; // not used anymore. |
|
290 public final int TYPE = 147; |
|
291 public final int LENGTH = 148; |
|
292 public final int INLINERETURN = 149; |
|
293 public final int INLINEMETHOD = 150; |
|
294 public final int INLINENEWINSTANCE = 151; |
|
295 |
|
296 /* |
|
297 * Added for jasm |
|
298 */ |
|
299 public final int METHODREF = 152; |
|
300 public final int FIELDREF = 153; |
|
301 public final int STACK = 154; |
|
302 public final int LOCAL = 155; |
|
303 public final int CPINDEX = 156; |
|
304 public final int CPNAME = 157; |
|
305 public final int SIGN = 158; |
|
306 public final int BITS = 159; |
|
307 public final int INF = 160; |
|
308 public final int NAN = 161; |
|
309 public final int INNERCLASS = 162; |
|
310 public final int OF = 163; |
|
311 public final int SYNTHETIC = 164; |
|
312 // last used=165; |
|
313 |
|
314 /* |
|
315 * Operator precedence |
|
316 */ |
|
317 public static final int opPrecedence[] = { |
|
318 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, |
|
319 11, 11, 11, 12, 13, 14, 15, 16, 17, 18, |
|
320 18, 19, 19, 19, 19, 19, 20, 20, 20, 21, |
|
321 21, 22, 22, 22, 23, 24, 24, 24, 24, 24, |
|
322 24, 25, 25, 26, 26, 26, 26, 26, 26 |
|
323 }; |
|
324 |
|
325 /* |
|
326 * Operator names |
|
327 */ |
|
328 public static final String opNames[] = { |
|
329 ",", "=", "*=", "/=", "%=", |
|
330 "+=", "-=", "<<=", ">>=", "<<<=", |
|
331 "&=", "|=", "^=", "?:", "||", |
|
332 "&&", "|", "^", "&", "!=", |
|
333 "==", ">=", ">", "<=", "<", |
|
334 "instanceof", "<<", ">>", "<<<", "+", |
|
335 "-", "/", "%", "*", "cast", |
|
336 "+", "-", "!", "~", "++", |
|
337 "--", "new", "new", "new", "++", |
|
338 "--", "field", "method", "[]", "new", |
|
339 "++", "--", null, null, null, |
|
340 |
|
341 "convert", "expr", "array", "goto", null, |
|
342 |
|
343 "Identifier", "Boolean", "Byte", "Char", "Short", |
|
344 "Integer", "Long", "Float", "Double", "String", |
|
345 |
|
346 "byte", "char", "short", "int", "long", |
|
347 "float", "double", "void", "boolean", null, |
|
348 |
|
349 "true", "false", "this", "super", "null", |
|
350 null, null, null, null, null, |
|
351 |
|
352 "if", "else", "for", "while", "do", |
|
353 "switch", "case", "default", "break", "continue", |
|
354 "return", "try", "catch", "finally", "throw", |
|
355 "stat", "expression", "declaration", "declaration", null, |
|
356 |
|
357 "import", "class", "extends", "implements", "interface", |
|
358 "package", null, null, null, null, |
|
359 |
|
360 "private", "public", "protected", "const", "static", |
|
361 "transient", "synchronized", "native", "final", "volatile", |
|
362 "abstract", null, null, null, null, |
|
363 |
|
364 ";", ":", "?", "{", "}", |
|
365 "(", ")", "[", "]", "throws", |
|
366 "error", "comment", "type", "length", "inline-return", |
|
367 "inline-method", "inline-new", |
|
368 "method", "field", "stack", "locals", "CPINDEX", "CPName", "SIGN", |
|
369 "bits", "INF", "NaN", "InnerClass", "of", "synthetic" |
|
370 }; |
|
371 |
|
372 } |