[Nice-commit] Nice/src/gnu/expr ModuleBody.java,1.7,1.8
Brought to you by:
bonniot
From: <bo...@us...> - 2003-07-21 23:20:22
|
Update of /cvsroot/nice/Nice/src/gnu/expr In directory sc8-pr-cvs1:/tmp/cvs-serv31463/src/gnu/expr Modified Files: ModuleBody.java Log Message: Resynchronized with kawa, to remove most differences, which by the license allows redistribution without being subject to the GPL. This is important since those files are needed at runtime. Index: ModuleBody.java =================================================================== RCS file: /cvsroot/nice/Nice/src/gnu/expr/ModuleBody.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ModuleBody.java 8 Oct 2002 13:30:51 -0000 1.7 --- ModuleBody.java 21 Jul 2003 23:20:14 -0000 1.8 *************** *** 11,15 **** */ ! // NICE: Avoid being dependant of gnu.mapping.MethodProc. // NICE: This is bad because this class is needed at runtime. public class ModuleBody extends ProcedureN// implements Runnable --- 11,15 ---- */ ! // NICE: Avoid being dependent of gnu.mapping.MethodProc. // NICE: This is bad because this class is needed at runtime. public class ModuleBody extends ProcedureN// implements Runnable *************** *** 20,23 **** --- 20,32 ---- } + /** For backwards compatibily. + * Earlier versions of Kawa used this to initialize a module. + * Allows run(Consumer) to call those methods. */ + /* + public Object run (Environment env) + { + return Values.empty; + } + public void run () { *************** *** 27,40 **** public void run(Consumer out) { ! CallContext ctx = new CallContext(); ! ctx.consumer = out; ! ctx.values = Values.noArgs; ! ctx.proc = this; ! ctx.run(); } public Object apply0 () throws Throwable { ! CallContext ctx = new CallContext(); ctx.values = Values.noArgs; ctx.proc = this; --- 36,59 ---- public void run(Consumer out) { ! CallContext ctx = CallContext.getInstance(); ! // For backwards compatibility - see run(Environment). ! run(ctx.getEnvironment()); ! Consumer save = ctx.consumer; ! try ! { ! ctx.consumer = out; ! ctx.values = Values.noArgs; ! ctx.proc = this; ! ctx.run(); ! } ! finally ! { ! ctx.consumer = save; ! } } public Object apply0 () throws Throwable { ! CallContext ctx = CallContext.getInstance(); ctx.values = Values.noArgs; ctx.proc = this; *************** *** 61,76 **** public final void runAsMain (String[] args) { ! //NICE: removes spurious dependancy ! //kawa.repl.setArgs(args, 0); gnu.text.WriterManager.instance.registerShutdownHook(); try { ! CallContext ctx = new CallContext(); ctx.values = Values.noArgs; ctx.proc = this; if (getMainPrintValues()) { OutPort out = OutPort.outDefault(); ! ctx.consumer = Interpreter.getInterpreter().getOutputConsumer(out); ctx.runUntilDone(); out.freshLine(); --- 80,95 ---- public final void runAsMain (String[] args) { ! kawa.repl.setArgs(args, 0); gnu.text.WriterManager.instance.registerShutdownHook(); try { ! CallContext ctx = CallContext.getInstance(); ctx.values = Values.noArgs; ctx.proc = this; + ClassMemberConstraint.defineAll(this, ctx.getEnvironment()); if (getMainPrintValues()) { OutPort out = OutPort.outDefault(); ! ctx.consumer = kawa.Shell.getOutputConsumer(out); ctx.runUntilDone(); out.freshLine(); *************** *** 83,86 **** --- 102,106 ---- // Redundant if registerShutdownHook succeeded (e.g on JDK 1.3). gnu.mapping.OutPort.runCleanups(); + kawa.repl.exitDecrement(); } catch (Throwable ex) *************** *** 110,114 **** public Object apply0(ModuleMethod method) { ! return applyN(method, new Object[0]); } --- 130,134 ---- public Object apply0(ModuleMethod method) { ! return applyN(method, Values.noArgs); } |