--- /dev/null
+/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-\r
+ *\r
+ * The contents of this file are subject to the Netscape Public\r
+ * License Version 1.1 (the "License"); you may not use this file\r
+ * except in compliance with the License. You may obtain a copy of\r
+ * the License at http://www.mozilla.org/NPL/\r
+ *\r
+ * Software distributed under the License is distributed on an "AS\r
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express oqr\r
+ * implied. See the License for the specific language governing\r
+ * rights and limitations under the License.\r
+ *\r
+ * The Original Code is Rhino code, released\r
+ * May 6, 1999.\r
+ *\r
+ * The Initial Developer of the Original Code is Netscape\r
+ * Communications Corporation. Portions created by Netscape are\r
+ * Copyright (C) 1997-1999 Netscape Communications Corporation. All\r
+ * Rights Reserved.\r
+ *\r
+ * Contributor(s): \r
+ * Norris Boyd\r
+ *\r
+ * Alternatively, the contents of this file may be used under the\r
+ * terms of the GNU Public License (the "GPL"), in which case the\r
+ * provisions of the GPL are applicable instead of those above.\r
+ * If you wish to allow use of your version of this file only\r
+ * under the terms of the GPL and not to allow others to use your\r
+ * version of this file under the NPL, indicate your decision by\r
+ * deleting the provisions above and replace them with the notice\r
+ * and other provisions required by the GPL. If you do not delete\r
+ * the provisions above, a recipient may use your version of this\r
+ * file under either the NPL or the GPL.\r
+ */\r
+\r
+// API class\r
+\r
+package org.mozilla.javascript;\r
+\r
+/**\r
+ * This is interface that all functions in JavaScript must implement.\r
+ * The interface provides for calling functions and constructors.\r
+ *\r
+ * @see org.mozilla.javascript.Scriptable\r
+ * @author Norris Boyd\r
+ */\r
+\r
+public interface Function extends Scriptable {\r
+ /**\r
+ * Call the function.\r
+ *\r
+ * Note that the array of arguments is not guaranteed to have\r
+ * length greater than 0.\r
+ *\r
+ * @param cx the current Context for this thread\r
+ * @param scope the scope to execute the function relative to. This is\r
+ * set to the value returned by getParentScope() except\r
+ * when the function is called from a closure.\r
+ * @param thisObj the JavaScript <code>this</code> object\r
+ * @param args the array of arguments\r
+ * @return the result of the call\r
+ * @exception JavaScriptException if an uncaught exception\r
+ * occurred while executing the function\r
+ */\r
+ public Object call(Context cx, Scriptable scope, Scriptable thisObj,\r
+ Object[] args)\r
+ throws JavaScriptException;\r
+\r
+ /**\r
+ * Call the function as a constructor.\r
+ *\r
+ * This method is invoked by the runtime in order to satisfy a use\r
+ * of the JavaScript <code>new</code> operator. This method is\r
+ * expected to create a new object and return it.\r
+ *\r
+ * @param cx the current Context for this thread\r
+ * @param scope an enclosing scope of the caller except\r
+ * when the function is called from a closure.\r
+ * @param args the array of arguments\r
+ * @return the allocated object\r
+ * @exception JavaScriptException if an uncaught exception\r
+ * occurred while executing the constructor\r
+ */\r
+ public Scriptable construct(Context cx, Scriptable scope, Object[] args)\r
+ throws JavaScriptException;\r
+}\r