001: /*
002: * Constants.java Copyright (c) 2006,07 Swaroop Belur
003: *
004: * This program is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU General Public License
006: * as published by the Free Software Foundation; either version 2
007: * of the License, or (at your option) any later version.
008:
009: * This program is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012: * GNU General Public License for more details.
013:
014: * You should have received a copy of the GNU General Public License
015: * along with this program; if not, write to the Free Software
016: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
017: *
018: */
019:
020: package net.sf.jdec.util;
021:
022: public class Constants {
023:
024: public static final String tab = "\t";
025: public static final String newline = "\n";
026: public static final String carriageret = "\r";
027: public static final String backspace = "\b";
028: public static final String formfeed = "\f";
029: public static final String doubleQuote = "\"";
030: public static final String singleQuote = "\'";
031: public static final String dot = "\\.";
032: public static final String backslash = "\\";
033:
034: public static final String FILEMODE = "FILE";
035: public static final String CONSOLEMODE = "CONSOLE";
036: public static final String ZIPMODE = "ZIP";
037: public static final int CLASS_MAGIC_NUMBER = 0xCAFEBABE;
038:
039: // Constant Pool Constants
040: public static final int CONSTANT_UTF8 = 1;
041: public static final int CONSTANT_INTEGER = 3;
042: public static final int CONSTANT_FLOAT = 4;
043: public static final int CONSTANT_LONG = 5;
044: public static final int CONSTANT_DOUBLE = 6;
045: public static final int CONSTANT_CLASS = 7;
046: public static final int CONSTANT_STRING = 8;
047: public static final int CONSTANT_FIELDREF = 9;
048: public static final int CONSTANT_METHODREF = 10;
049: public static final int CONSTANT_INTERFACEMETHODREF = 11;
050: public static final int CONSTANT_NAMEANDTYPE = 12;
051:
052: // Access Specifiers
053: public static final int ACC_PUBLIC = 1;
054: public static final int ACC_FINAL = 10;
055: public static final int ACC_SUPER = 20;
056: public static final int ACC_INTERFACE = 200;
057: public static final int ACC_ABSTRACT = 400;
058: public static final int ACC_PRIVATE = 2;
059: public static final int ACC_PROTECTED = 4;
060: public static final int ACC_STATIC = 8;
061:
062: // Combinations For CLASS
063:
064: public static final int ACC_NPUB = 20;
065: public static final int ACC_NPUB_FINAL = 30;
066: public static final int ACC_NPUB_ABSTRACT = 420;
067:
068: public static final int ACC_PUB = 21;
069: public static final int ACC_PUB_FINAL = 31;
070: public static final int ACC_PUB_ABSTRACT = 421;
071:
072: // Combinations for Inner class
073: public static final int ACC_INNER_CLASS_NPVT = 20 + 1;
074: public static final int ACC_INNER_CLASS_NPVT_FINAL = 30 + 1;
075: public static final int ACC_INNER_CLASS_NPVT_ABSTRACT = 420 + 1;
076:
077: public static final int ACC_INNER_CLASS_NPVT_STATIC = 20 + 1 + 8;
078: public static final int ACC_INNER_CLASS_NPVT_FINAL_STATIC = 30 + 1 + 8;
079: public static final int ACC_INNER_CLASS_NPVT_ABSTRACT_STATIC = 420 + 1 + 8;
080:
081: public static final int ACC_INNER_CLASS_PVT = 21 + 1;
082: public static final int ACC_INNER_CLASS_PVT_FINAL = 31 + 1;
083: public static final int ACC_INNER_CLASS_PVT_ABSTRACT = 421 + 1;
084:
085: public static final int ACC_INNER_CLASS_NPRO = 20 + 1 + 2;
086: public static final int ACC_INNER_CLASS_NRO_FINAL = 30 + 1 + 2;
087: public static final int ACC_INNER_CLASS_NPRO_ABSTRACT = 420 + 1 + 2;
088:
089: public static final int ACC_INNER_CLASS_PRO = 21 + 1 + 2;
090: public static final int ACC_INNER_CLASS_PRO_FINAL = 31 + 1 + 2;
091: public static final int ACC_INNER_CLASS_PRO_ABSTRACT = 421 + 1 + 2;
092:
093: // Combinations For Interace
094: public static final int ACC_INT_PUB = 601;
095: public static final int ACC_INT_NPUB = 600;
096:
097: // Field Access Specifiers
098: public static final int ACC_FIELD_PUBLIC = 1;
099: public static final int ACC_FIELD_PRIVATE = 2;
100: public static final int ACC_FIELD_PROTECTED = 4;
101: public static final int ACC_FIELD_STATIC = 8;
102: public static final int ACC_FIELD_FINAL = 16;
103: public static final int ACC_FIELD_VOLATILE = 64;
104: public static final int ACC_FIELD_TRANSIENT = 128;
105:
106: public static final int ACC_PUB_F = 1;
107: public static final int ACC_PUB_STATIC = 9;
108: public static final int ACC_PUB_F_FINAL = 17;
109: public static final int ACC_PUB_STATIC_FINAL = 25;
110: public static final int ACC_PUB_STATIC_VOLATILE = 73;
111: public static final int ACC_PUB_STATIC_TRANSIENT = 137;
112: public static final int ACC_PUB_TRANSIENT = 129;
113: public static final int ACC_PUB_STATIC_FINAL_TRANSIENT = 153;
114: public static final int ACC_PUB_FINAL_TRANSIENT = 145;
115:
116: public static final int ACC_PRI = 2;
117: public static final int ACC_PRI_STATIC = 10;
118: public static final int ACC_PRI_FINAL = 18;
119: public static final int ACC_PRI_STATIC_FINAL = 26;
120: public static final int ACC_PRI_STATIC_VOLATILE = 74;
121: public static final int ACC_PRI_STATIC_TRANSIENT = 138;
122: public static final int ACC_PRI_TRANSIENT = 130;
123: public static final int ACC_PRI_STATIC_FINAL_TRANSIENT = 154;
124: public static final int ACC_PRI_FINAL_TRANSIENT = 146;
125:
126: public static final int ACC_PRO = 4;
127: public static final int ACC_PRO_STATIC = 12;
128: public static final int ACC_PRO_FINAL = 20;
129: public static final int ACC_PRO_STATIC_FINAL = 28;
130: public static final int ACC_PRO_STATIC_VOLATILE = 76;
131: public static final int ACC_PRO_STATIC_TRANSIENT = 140;
132: public static final int ACC_PRO_TRANSIENT = 132;
133: public static final int ACC_PRO_STATIC_FINAL_TRANSIENT = 156;
134: public static final int ACC_PRO_FINAL_TRANSIENT = 148;
135:
136: public static final int ACC_FINAL_VOLATILE = 80;
137: public static final int ACC_FINAL_TRANSIENT = 144;
138: public static final int ACC_FINAL_STATIC = 24;
139: public static final int ACC_FINAL_STATIC_VOLTILE = 88;
140: public static final int ACC_FINAL_STATIC_TRANSIENT = 152;
141: public static final int ACC_FINAL_VOLATILE_TRANSIENT = 208;
142:
143: public static final int ACC_STATIC_VOLATILE = 72;
144: public static final int ACC_STATIC_TRANSIENT = 136;
145:
146: public static final int ACC_VOLATILE_TRANSIENT = 192;
147:
148: public static final int ACC_F_STATIC = 8;
149: public static final int ACC_F_FINAL = 16;
150: public static final int ACC_VOLATILE = 64;
151: public static final int ACC_TRANSIENT = 128;
152:
153: public static final String ISINT = "I";
154: public static final String ISBYTE = "B";
155: public static final String ISCHAR = "C";
156: public static final String ISDOUBLE = "D";
157: public static final String ISFLOAT = "F";
158: public static final String ISLONG = "J";
159: public static final String ISREFERENCE = "L";
160: public static final String ISSHORT = "S";
161: public static final String ISBOOLEAN = "Z";
162: public static final String ISARRAY = "[";
163:
164: public static final int FIELD_ACC = 0;
165: public static final int METHOD_ACC = 1;
166: public static final int CLASS_ACC = 2;
167:
168: public static final String UNKNOWNTYPE = "Unknown Data Type";
169: public static final String UNKNOWNACCESSORS = "Unknown Accessor(s)";
170:
171: // Method Access Specifiers
172: public static final int M_ACC_PUBLIC = 1;
173: public static final int M_ACC_PRIVATE = 2;
174: public static final int M_ACC_PROTECTED = 4;
175: public static final int M_ACC_STATIC = 8;
176: public static final int M_ACC_FINAL = 16;
177: public static final int M_ACC_SYNCHRONIZED = 32;
178: public static final int M_ACC_NATIVE = 256;
179: public static final int M_ACC_ABSTRACT = 1024;
180: public static final int M_ACC_STRICT = 2048;
181:
182: // Combinations for public only
183: public static final int M_PUB = 1;
184: public static final int M_PUB_STATIC = 9;
185: public static final int M_PUB_FINAL = 17;
186: public static final int M_PUB_SYNCHRONIZED = 33;
187: public static final int M_PUB_NATIVE = 257;
188: public static final int M_PUB_ABS = 1025;
189: public static final int M_PUB_STRICT = 2049;
190:
191: // combinations for public and static(Apart from already covered)
192: public static final int M_PUB_STATIC_FINAL = 25;
193: public static final int M_PUB_STATIC_SYNCHRONIZED = 41;
194: public static final int M_PUB_STATIC_NATIVE = 9 + 257;
195: public static final int M_PUB_STATIC_STRICT = 2057;
196:
197: // combinations for public , static and final(Apart from already covered)
198: public static final int M_PUB_STATIC_FINAL_SYNCH = 57;
199: public static final int M_PUB_STATIC_FINAL_NATIVE = 256 + 25;
200: public static final int M_PUB_STATIC_FINAL_STRICT = 2048 + 25;
201:
202: // combinations for public , static ,syncronized and final(Apart from already covered)
203: public static final int M_PUB_STATIC_FINAL_SYNCH_NATIVE = 57 + 256;
204: public static final int M_PUB_STATIC_FINAL_SYNCH_STRICT = 57 + 2048;
205:
206: // All Combinations for private
207: // Combinations for private only
208: public static final int M_PRIVATE = 1 + 1;
209: public static final int M_PRIVATE_STATIC = 9 + 1;
210: public static final int M_PRIVATE_FINAL = 17 + 1;
211: public static final int M_PRIVATE_SYNCHRONIZED = 33 + 1;
212: public static final int M_PRIVATE_NATIVE = 257 + 1;
213: public static final int M_PRIVATE_STRICT = 2049 + 1;
214: // combinations for private and static(Apart from already covered)
215: public static final int M_PRIVATE_STATIC_FINAL = 25 + 1;
216: public static final int M_PRIVATE_STATIC_SYNCHRONIZED = 41 + 1;
217: public static final int M_PRIVATE_STATIC_NATIVE = 9 + 257 + 1;
218: public static final int M_PRIVATE_STATIC_STRICT = 2057 + 1;
219: // combinations for private , static and final(Apart from already covered)
220: public static final int M_PRIVATE_STATIC_FINAL_SYNCH = 57 + 1;
221: public static final int M_PRIVATE_STATIC_FINAL_NATIVE = 256 + 25 + 1;
222: public static final int M_PRIVATE_STATIC_FINAL_STRICT = 2048 + 25 + 1;
223: // combinations for private , static ,syncronized and final(Apart from already covered)
224: public static final int M_PRIVATE_STATIC_FINAL_SYNCH_NATIVE = 57 + 256 + 1;
225: public static final int M_PRIVATE_STATIC_FINAL_SYNCH_STRICT = 57 + 2048 + 1;
226:
227: //All combinations for protected
228: // Combinations for PROTCTED only
229: public static final int M_PROTECTED = 1 + 3;
230: public static final int M_PROTECTED_STATIC = 9 + 3;
231: public static final int M_PROTECTED_FINAL = 17 + 3;
232: public static final int M_PROTECTED_SYNCHRONIZED = 33 + 3;
233: public static final int M_PROTECTED_NATIVE = 257 + 3;
234: public static final int M_PROTECTED_ABS = 1025 + 3;
235: public static final int M_PROTECTED_STRICT = 2059 + 3;
236: // combinations for PROTCTED and static(Apart from already covered)
237: public static final int M_PROTECTED_STATIC_FINAL = 25 + 3;
238: public static final int M_PROTECTED_STATIC_SYNCHRONIZED = 41 + 3;
239: public static final int M_PROTECTED_STATIC_NATIVE = 9 + 257 + 3;
240: public static final int M_PROTECTED_STATIC_STRICT = 2057 + 3;
241: // combinations for PROTCTED , static and final(Apart from already covered)
242: public static final int M_PROTECTED_STATIC_FINAL_SYNCH = 57 + 3;
243: public static final int M_PROTECTED_STATIC_FINAL_NATIVE = 256 + 25 + 3;
244: public static final int M_PROTECTED_STATIC_FINAL_STRICT = 2048 + 25 + 3;
245: // combinations for PROTCTED , static ,syncronized and final(A3part from already covered)
246: public static final int M_PROTECTED_STATIC_FINAL_SYNCH_NATIVE = 57 + 256 + 3;
247: public static final int M_PROTECTED_STATIC_FINAL_SYNCH_STRICT = 57 + 2048 + 3;
248: // combinations for PROTCTED , static ,syncronized , native and final(Apart from already covered)
249:
250: //********************************
251: // COMBINATIONS For default access
252: //********************************
253:
254: public static final int M_STATIC = 9 - 1;
255: public static final int M_FINAL = 17 - 1;
256: public static final int M_SYNCHRONIZED = 33 - 1;
257: public static final int M_NATIVE = 257 - 1;
258: public static final int M_ABS = 1025 - 1;
259: public static final int M_STRICT = 2049 - 1;
260: public static final int M_STATIC_FINAL = 25 - 1;
261: public static final int M_STATIC_SYNCHRONIZED = 41 - 1;
262: public static final int M_STATIC_NATIVE = 9 + 257 - 1;
263: public static final int M_STATIC_STRICT = 2057 - 1;
264: // combinations for static and final(Apart from already covered)
265: public static final int M_STATIC_FINAL_SYNCH = 57 - 1;
266: public static final int M_STATIC_FINAL_NATIVE = 256 + 25 - 1;
267: public static final int M_STATIC_FINAL_STRICT = 2048 + 25 - 1;
268: // combinations for static ,syncronized and final(Apart from already covered)
269: public static final int M_STATIC_FINAL_SYNCH_NATIVE = 57 + 256 - 1;
270: public static final int M_STATIC_FINAL_SYNCH_STRICT = 57 + 2048 - 1;
271: // combinations for static ,syncronized , native and final(Apart from already covered)
272:
273: // Non Public combinations w/o static
274: public static final int M_FINAL_SYNCH = 57 - 1 - 8;
275: public static final int M_FINAL_NATIVE = 256 + 25 - 1 - 8;
276: public static final int M_FINAL_STRICT = 2048 + 25 - 1 - 8;
277: public static final int M_FINAL_SYNCH_NATIVE = 57 + 256 - 1 - 8;
278: public static final int M_FINAL_SYNCH_STRICT = 57 + 2048 - 1 - 8;
279:
280: // Non Public combinations w/o static and w/o final
281: public static final int M_SYNCH_NATIVE = 57 + 256 - 1 - 8 - 16;
282: public static final int M_SYNCH_STRICT = 57 + 2048 - 1 - 8 - 16;
283:
284: // For Operations involving Operand Stack
285: public static final int IS_CONSTANT_INT = 1;
286: public static final int IS_CONSTANT_FLOAT = 2;
287: public static final int IS_CONSTANT_DOUBLE = 3;
288: public static final int IS_CONSTANT_LONG = 4;
289: public static final int IS_CONSTANT_BYTE = 5;
290: public static final int IS_CONSTANT_SHORT = 6;
291: public static final int IS_CONSTANT_STRING = 7;
292: public static final int IS_CONSTANT_CHARACTER = 8;
293: public static final int IS_CONSTANT_BYTE_OR_BOOLEAN = 11;
294:
295: public static final int IS_NULL = -1;
296:
297: public static final int IS_ARRAY_REF = 8;
298: public static final int IS_OBJECT_REF = 9;
299: public static final int IS_RETURN_ADDRESS = 10;
300:
301: public static final int CATEGORY1 = 1;
302: public static final int CATEGORY2 = 2;
303:
304: }
|