1 /* 2 * [The "BSD licence"] 3 * Copyright (c) 2010 Ben Gruver (JesusFreke) 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. The name of the author may not be used to endorse or promote products 15 * derived from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 package org.jf.dexlib.Code.Format; 30 31 import org.jf.dexlib.Code.Instruction; 32 33 public enum Format { 34 Format10t(Instruction10t.Factory, 2), 35 Format10x(Instruction10x.Factory, 2), 36 Format11n(Instruction11n.Factory, 2), 37 Format11x(Instruction11x.Factory, 2), 38 Format12x(Instruction12x.Factory, 2), 39 Format20bc(Instruction20bc.Factory, 4), 40 Format20t(Instruction20t.Factory, 4), 41 Format21c(Instruction21c.Factory, 4), 42 Format21h(Instruction21h.Factory, 4), 43 Format21s(Instruction21s.Factory, 4), 44 Format21t(Instruction21t.Factory, 4), 45 Format22b(Instruction22b.Factory, 4), 46 Format22c(Instruction22c.Factory, 4), 47 Format22cs(Instruction22cs.Factory, 4), 48 Format22s(Instruction22s.Factory, 4), 49 Format22t(Instruction22t.Factory, 4), 50 Format22x(Instruction22x.Factory, 4), 51 Format23x(Instruction23x.Factory, 4), 52 Format30t(Instruction30t.Factory, 6), 53 Format31c(Instruction31c.Factory, 6), 54 Format31i(Instruction31i.Factory, 6), 55 Format31t(Instruction31t.Factory, 6), 56 Format32x(Instruction32x.Factory, 6), 57 Format35c(Instruction35c.Factory, 6), 58 Format35s(Instruction35s.Factory, 6), 59 Format35ms(Instruction35ms.Factory, 6), 60 Format3rc(Instruction3rc.Factory, 6), 61 Format3rms(Instruction3rms.Factory, 6), 62 Format51l(Instruction51l.Factory, 10), 63 ArrayData(null, -1, true), 64 PackedSwitchData(null, -1, true), 65 SparseSwitchData(null, -1, true), 66 UnresolvedOdexInstruction(null, -1, false), 67 ; 68 69 public final Instruction.InstructionFactory Factory; 70 public final int size; 71 public final boolean variableSizeFormat; 72 73 private Format(Instruction.InstructionFactory factory, int size) { 74 this(factory, size, false); 75 } 76 77 private Format(Instruction.InstructionFactory factory, int size, boolean variableSizeFormat) { 78 this.Factory = factory; 79 this.size = size; 80 this.variableSizeFormat = variableSizeFormat; 81 } 82 } 83