1579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson/* 2579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * Copyright (C) 2011 The Android Open Source Project 3579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * 4579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * Licensed under the Apache License, Version 2.0 (the "License"); 5579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * you may not use this file except in compliance with the License. 6579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * You may obtain a copy of the License at 7579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * 8579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * http://www.apache.org/licenses/LICENSE-2.0 9579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * 10579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * Unless required by applicable law or agreed to in writing, software 11579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * distributed under the License is distributed on an "AS IS" BASIS, 12579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * See the License for the specific language governing permissions and 14579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * limitations under the License. 15579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson */ 16579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson 17579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilsonpackage com.android.dx.io.instructions; 18579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson 19579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson/** 20579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * Cursor over code units, for reading or writing out Dalvik bytecode. 21579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson */ 22579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilsonpublic interface CodeCursor { 23579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson /** 24579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * Gets the cursor. The cursor is the offset in code units from 25579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * the start of the input of the next code unit to be read or 26579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * written, where the input generally consists of the code for a 27579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * single method. 28579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson */ 29579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson public int cursor(); 30579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson 31579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson /** 32579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * Gets the base address associated with the current cursor. This 33579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * differs from the cursor value when explicitly set (by {@link 34579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * #setBaseAddress). This is used, in particular, to convey base 35579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * addresses to switch data payload instructions, whose relative 36579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * addresses are relative to the address of a dependant switch 37579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * instruction. 38579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson */ 39579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson public int baseAddressForCursor(); 40579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson 41579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson /** 42579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * Sets the base address for the given target address to be as indicated. 43579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * 44579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson * @see #baseAddressForCursor 45579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson */ 46579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson public void setBaseAddress(int targetAddress, int baseAddress); 47579d7739c53a2707ad711a2d2cae46d7d782f06Jesse Wilson} 48