01: /*
02: * @(#)run.java 1.2 04/12/06
03: *
04: * Copyright (c) 1997-2004 Sun Microsystems, Inc. All Rights Reserved.
05: *
06: * See the file "LICENSE.txt" for information on usage and redistribution
07: * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
08: */
09: package org.pnuts.lib;
10:
11: import pnuts.lang.*;
12:
13: public class run extends PnutsFunction {
14:
15: public run() {
16: super ("run");
17: }
18:
19: public boolean defined(int nargs) {
20: return nargs == 1;
21: }
22:
23: protected Object exec(Object args[], Context context) {
24: if (args.length == 1) {
25: return ((Executable) args[0]).run(context);
26: } else {
27: undefined(args, context);
28: return null;
29: }
30: }
31:
32: public String toString() {
33: return "function run(executable)";
34: }
35: }
|