01: /*
02: * @(#)print.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: import java.io.*;
13:
14: public class print extends PnutsFunction {
15:
16: public print() {
17: super ("print");
18: }
19:
20: public boolean defined(int narg) {
21: return true;
22: }
23:
24: public Object exec(Object[] args, Context context) {
25: PrintWriter output = context.getWriter();
26: if (output != null) {
27: for (int i = 0; i < args.length; i++) {
28: output.print(args[i]);
29: }
30: }
31: return null;
32: }
33:
34: public String toString() {
35: return "function print(args[])";
36: }
37: }
|