01: /*
02: * @(#)defineTags.java 1.2 04/12/06
03: *
04: * Copyright (c) 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.xml;
10:
11: import pnuts.lang.*;
12: import pnuts.lang.Package;
13:
14: public class defineTags extends PnutsFunction {
15: final static PnutsFunction elementFunc = new element();
16:
17: public defineTags() {
18: super ("defineTags");
19: }
20:
21: public boolean defined(int args) {
22: return true;
23: }
24:
25: protected Object exec(Object[] args, Context context) {
26: Package pkg = context.getCurrentPackage();
27: for (int i = 0; i < args.length; i++) {
28: String name = ((String) args[i]).intern();
29: pkg.set(name, elementFunc.call(new String[] { name },
30: context), context);
31: }
32: return null;
33: }
34:
35: public String toString() {
36: return "function defineTags(tag1, tag2, ...)";
37: }
38: }
|