1 package org.sentrysoftware.jawk.intermediate; 2 3 /*- 4 * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ 5 * Jawk 6 * ჻჻჻჻჻჻ 7 * Copyright (C) 2006 - 2023 Sentry Software 8 * ჻჻჻჻჻჻ 9 * This program is free software: you can redistribute it and/or modify 10 * it under the terms of the GNU Lesser General Public License as 11 * published by the Free Software Foundation, either version 3 of the 12 * License, or (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Lesser Public License for more details. 18 * 19 * You should have received a copy of the GNU General Lesser Public 20 * License along with this program. If not, see 21 * <http://www.gnu.org/licenses/lgpl-3.0.html>. 22 * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ 23 */ 24 25 /** 26 * A placeholder for an object which has a reference to 27 * a function address, but which may not be realized yet. 28 * This is particularly important for forward-referenced 29 * functions. For example: 30 * <blockquote> 31 * <pre> 32 * BEGIN { f(3) } 33 * function f(x) { print x*x } 34 * </pre> 35 * </blockquote> 36 * f() is referred to prior to its definition. Therefore, 37 * the getFunctionAddress() call within the BEGIN block 38 * will not return a meaningful address. However, anytime 39 * after f(x) is defined, getFunctionAddress() will return 40 * the correct function address. 41 * 42 * @author Danny Daglas 43 */ 44 public interface HasFunctionAddress { 45 46 /** 47 * Get an address to the tuple where this function is 48 * defined. 49 * <p> 50 * If getFunctionAddress() is called prior to defining 51 * the function address (prior to parsing the function 52 * block), the result is undefined. (As of this writing, 53 * a NullPointerException is thrown.) 54 * 55 * @return a {@link org.sentrysoftware.jawk.intermediate.Address} object 56 */ 57 Address getFunctionAddress(); 58 }