01: /*
02: * CompiledClosure.java
03: *
04: * Copyright (C) 2004 Peter Graves
05: * $Id: CompiledClosure.java,v 1.2 2004/07/21 18:10:05 piso Exp $
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License
09: * as published by the Free Software Foundation; either version 2
10: * of the License, or (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public License
18: * along with this program; if not, write to the Free Software
19: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20: */
21:
22: package org.armedbear.lisp;
23:
24: public class CompiledClosure extends Function {
25: private final ClosureTemplateFunction ctf;
26: private final LispObject[][] context;
27:
28: public CompiledClosure(ClosureTemplateFunction ctf,
29: LispObject[][] context) {
30: this .ctf = ctf;
31: this .context = context;
32: }
33:
34: protected final LispObject[] processArgs(LispObject[] args,
35: int extra) throws ConditionThrowable {
36: return ctf.processArgs(args, extra);
37: }
38:
39: public LispObject execute() throws ConditionThrowable {
40: LispObject[] args = new LispObject[0];
41: return ctf.execute(args, context);
42: }
43:
44: public LispObject execute(LispObject arg) throws ConditionThrowable {
45: LispObject[] args = new LispObject[1];
46: args[0] = arg;
47: return ctf.execute(args, context);
48: }
49:
50: public LispObject execute(LispObject first, LispObject second)
51: throws ConditionThrowable {
52: LispObject[] args = new LispObject[2];
53: args[0] = first;
54: args[1] = second;
55: return ctf.execute(args, context);
56: }
57:
58: public LispObject execute(LispObject first, LispObject second,
59: LispObject third) throws ConditionThrowable {
60: LispObject[] args = new LispObject[3];
61: args[0] = first;
62: args[1] = second;
63: args[2] = third;
64: return ctf.execute(args, context);
65: }
66:
67: public LispObject execute(LispObject first, LispObject second,
68: LispObject third, LispObject fourth)
69: throws ConditionThrowable {
70: LispObject[] args = new LispObject[4];
71: args[0] = first;
72: args[1] = second;
73: args[2] = third;
74: args[3] = fourth;
75: return ctf.execute(args, context);
76: }
77:
78: public LispObject execute(LispObject[] args)
79: throws ConditionThrowable {
80: return ctf.execute(args, context);
81: }
82: }
|