01: package sisc.nativefun;
02:
03: import sisc.data.*;
04: import sisc.interpreter.*;
05: import java.io.IOException;
06:
07: import sisc.io.ValueWriter;
08:
09: /**
10: * A Native Library is a collection of bindings that can be imported
11: * into any environment in SISC. This API provides for enumerating
12: * and fetching the bindings, as well as naming and versioning.
13: */
14: public abstract class NativeLibrary extends Value implements
15: java.io.Serializable, NamedValue {
16:
17: public abstract Symbol[] getLibraryBindingNames(Interpreter r);
18:
19: public abstract Value getBindingValue(Interpreter r, Symbol name)
20: throws NoSuchMethodError;
21:
22: public abstract String getLibraryName();
23:
24: public abstract float getLibraryVersion();
25:
26: public void display(ValueWriter w) throws IOException {
27: displayNamedOpaque(w, liMessage(SISCB, "nativelibrary"));
28: }
29:
30: public void bindAll(Interpreter r, sisc.env.SymbolicEnvironment env) {
31: Symbol[] syms = getLibraryBindingNames(r);
32: for (int i = 0; i < syms.length; i++) {
33: env.define(syms[i], getBindingValue(r, syms[i]));
34: }
35: }
36: }
37: /*
38: * The contents of this file are subject to the Mozilla Public
39: * License Version 1.1 (the "License"); you may not use this file
40: * except in compliance with the License. You may obtain a copy of
41: * the License at http://www.mozilla.org/MPL/
42: *
43: * Software distributed under the License is distributed on an "AS
44: * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
45: * implied. See the License for the specific language governing
46: * rights and limitations under the License.
47: *
48: * The Original Code is the Second Interpreter of Scheme Code (SISC).
49: *
50: * The Initial Developer of the Original Code is Scott G. Miller.
51: * Portions created by Scott G. Miller are Copyright (C) 2000-2007
52: * Scott G. Miller. All Rights Reserved.
53: *
54: * Contributor(s):
55: * Matthias Radestock
56: *
57: * Alternatively, the contents of this file may be used under the
58: * terms of the GNU General Public License Version 2 or later (the
59: * "GPL"), in which case the provisions of the GPL are applicable
60: * instead of those above. If you wish to allow use of your
61: * version of this file only under the terms of the GPL and not to
62: * allow others to use your version of this file under the MPL,
63: * indicate your decision by deleting the provisions above and
64: * replace them with the notice and other provisions required by
65: * the GPL. If you do not delete the provisions above, a recipient
66: * may use your version of this file under either the MPL or the
67: * GPL.
68: */
|