01: /*
02: * @(#)init.java 1.3 05/01/14
03: *
04: * Copyright (c) 2001-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 pnuts.text;
10:
11: import pnuts.lang.Runtime;
12: import pnuts.lang.Package;
13: import pnuts.lang.Context;
14: import pnuts.lang.PnutsFunction;
15: import pnuts.ext.ModuleBase;
16:
17: /**
18: * Initialization of the pnuts.text module
19: */
20: public class init extends ModuleBase {
21:
22: static String[] files = { "pnuts/text/template" };
23:
24: static String[][] functions = { { "template" } };
25:
26: static String[] javaFunctions = { "formatTemplate",
27: "applyTemplate", "textGrab", "printf", "sprintf",
28: "readLines", "readLine" };
29:
30: static String[] requiredModules = { "pnuts.lib", "pnuts.io",
31: "pnuts.regex" };
32:
33: protected String[] getRequiredModules() {
34: return requiredModules;
35: }
36:
37: protected String getPrefix() {
38: return "org";
39: }
40:
41: public Object execute(Context context) {
42: for (int i = 0; i < files.length; i++) {
43: autoload(functions[i], files[i], context);
44: }
45: for (int i = 0; i < javaFunctions.length; i++) {
46: autoloadFunction(javaFunctions[i], context);
47: }
48: return null;
49: }
50: }
|