1 21 22 package org.armedbear.lisp; 23 24 public class CompiledClosure extends Function 25 { 26 private final ClosureTemplateFunction ctf; 27 private final LispObject[][] context; 28 29 public CompiledClosure(ClosureTemplateFunction ctf, LispObject[][] context) 30 { 31 this.ctf = ctf; 32 this.context = context; 33 } 34 35 protected final LispObject[] processArgs(LispObject[] args, int extra) 36 throws ConditionThrowable 37 { 38 return ctf.processArgs(args, extra); 39 } 40 41 public LispObject execute() throws ConditionThrowable 42 { 43 LispObject[] args = new LispObject[0]; 44 return ctf.execute(args, context); 45 } 46 47 public LispObject execute(LispObject arg) throws ConditionThrowable 48 { 49 LispObject[] args = new LispObject[1]; 50 args[0] = arg; 51 return ctf.execute(args, context); 52 } 53 54 public LispObject execute(LispObject first, LispObject second) 55 throws ConditionThrowable 56 { 57 LispObject[] args = new LispObject[2]; 58 args[0] = first; 59 args[1] = second; 60 return ctf.execute(args, context); 61 } 62 63 public LispObject execute(LispObject first, LispObject second, 64 LispObject third) 65 throws ConditionThrowable 66 { 67 LispObject[] args = new LispObject[3]; 68 args[0] = first; 69 args[1] = second; 70 args[2] = third; 71 return ctf.execute(args, context); 72 } 73 74 public LispObject execute(LispObject first, LispObject second, 75 LispObject third, LispObject fourth) 76 throws ConditionThrowable 77 { 78 LispObject[] args = new LispObject[4]; 79 args[0] = first; 80 args[1] = second; 81 args[2] = third; 82 args[3] = fourth; 83 return ctf.execute(args, context); 84 } 85 86 public LispObject execute(LispObject[] args) throws ConditionThrowable 87 { 88 return ctf.execute(args, context); 89 } 90 } 91 | Popular Tags |