01: /*
02: * Copyright (c) 2005 Advanced Micro Devices, Inc.
03: *
04: * See the file "license.amd" for information on usage and
05: * redistribution of this file, and for a DISCLAIMER OF ALL
06: * WARRANTIES.
07: *
08: * RCS: @(#) $Id: JaclLoadTJCCmd.java,v 1.2 2006/02/14 04:13:27 mdejong Exp $
09: *
10: */
11:
12: package tcl.lang;
13:
14: /**
15: * This class implements a small helper function that is used to
16: * load the TJC package into Jacl without requiring that the
17: * Java package be loaded into Jacl.
18: */
19:
20: class JaclLoadTJCCmd implements Command {
21:
22: public void cmdProc(Interp interp, // Current interpreter.
23: TclObject[] objv) // Arguments to "jaclloadtjc" cmd
24: throws TclException {
25: // This method takes no arguments
26: if (objv.length != 1) {
27: throw new TclNumArgsException(interp, 1, objv, "");
28: }
29:
30: // Init the namespace so commands can be created.
31: interp.eval("namespace eval TJC {}");
32:
33: // Load TJC class files as needed.
34: Extension.loadOnDemand(interp, "::TJC::command",
35: "tcl.lang.TJCCommandCmd");
36: Extension.loadOnDemand(interp, "::TJC::compile",
37: "tcl.lang.TJCCompileCmd");
38: Extension.loadOnDemand(interp, "::TJC::package",
39: "tcl.lang.TJCPackageCmd");
40:
41: // Now that we have loaded the TJC package we can delete this command
42: // from the interp.
43:
44: interp.deleteCommand(objv[0].toString());
45: }
46:
47: }
|