01: package using;
02:
03: import jscheme.JScheme;
04:
05: /*
06: This is an example of how a Java program can use JScheme code. It
07: provides static methods you can use to interatively manipulate Java
08: Objects. It beats debugging with print statements and backtraces.
09:
10: <p>Much of what you need to access JScheme from Java is in the class
11: jscheme.JScheme, the Java Scheme interface.
12: */
13: public class Active {
14: /** The JScheme instance we will use/ */
15: private static JScheme js = new JScheme();
16:
17: /** Load the JScheme code you need when the class is first referenced. **/
18: static {
19: js.evalOrLoad("elf/basic.scm");
20: }
21:
22: /** Describe the contents of Object x. **/
23: public static void describe(Object x) {
24: js.call("describe", x);
25: }
26:
27: /** Start a detatched garbage collection panel **/
28: public static void gcMonitor() {
29: js.evalOrLoad("elf/GCMonitor.scm");
30: }
31:
32: /** Inspect the object, x using a JTable. **/
33: public static void inspect(Object x) {
34: js.call("inspect", x);
35: }
36:
37: /** Interact with, object it in an interactive JScheme window. **/
38: public static void interact(Object it) {
39: new interact.Interactor(it);
40: }
41: }
|