diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 48a4af52ad..c7c527da70 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -27,12 +27,10 @@ + listener/plugin: - update plugin docs -- extract word puts stuff in the wrong place - extract word keeps indent - word preview for remote words - WordPreview calls markTokens() -> NPE - listener should be multithreaded -- compile all commands - faster completion - NPE in ErrorHighlight - maple-like: press enter at old commands to evaluate there diff --git a/actions.xml b/actions.xml index b70bc9b67c..654f989e9f 100644 --- a/actions.xml +++ b/actions.xml @@ -94,16 +94,12 @@ - InferBufferProcessor.createInferUnitTests(view,buffer, - FactorPlugin.getExternalInstance()); + InferBufferProcessor.createInferUnitTests(view,buffer); - wm.showDockableWindow("console"); - CompileBufferProcessor.compileWordsInBuffer(view,buffer, - FactorPlugin.getExternalInstance(), - wm.getDockableWindow("console")); + new CompileBufferProcessor(view,buffer); diff --git a/factor/jedit/CompileBufferProcessor.java b/factor/jedit/CompileBufferProcessor.java index 36f5f3d0d0..2272c56068 100644 --- a/factor/jedit/CompileBufferProcessor.java +++ b/factor/jedit/CompileBufferProcessor.java @@ -38,22 +38,11 @@ import org.gjt.sp.util.*; public class CompileBufferProcessor extends FactorBufferProcessor { - //{{{ compileWordsInBuffer() method - public static void compileWordsInBuffer(View view, - Buffer buffer, - ExternalFactor factor, - Output output) throws Exception - { - String results = new CompileBufferProcessor( - buffer,factor).getResults(); - output.print(null,results); - } //}}} - //{{{ CompileBufferProcessor constructor - public CompileBufferProcessor(Buffer buffer, ExternalFactor factor) + public CompileBufferProcessor(View view, Buffer buffer) throws Exception { - super(buffer,factor); + super(view,buffer,true); } //}}} //{{{ processWord() method diff --git a/factor/jedit/FactorBufferProcessor.java b/factor/jedit/FactorBufferProcessor.java index 9333c6e976..961586c208 100644 --- a/factor/jedit/FactorBufferProcessor.java +++ b/factor/jedit/FactorBufferProcessor.java @@ -31,6 +31,7 @@ package factor.jedit; import factor.*; import org.gjt.sp.jedit.Buffer; +import org.gjt.sp.jedit.View; /** * A class used to compile all words in a file, or infer stack effects of all @@ -41,8 +42,8 @@ public abstract class FactorBufferProcessor private String results; //{{{ FactorBufferProcessor constructor - public FactorBufferProcessor(Buffer buffer, ExternalFactor factor) - throws Exception + public FactorBufferProcessor(View view, Buffer buffer, + boolean evalInListener) throws Exception { StringBuffer buf = new StringBuffer(); @@ -56,7 +57,10 @@ public abstract class FactorBufferProcessor buf.append("! "); buf.append(expr); buf.append('\n'); - buf.append(factor.eval(expr)); + if(evalInListener) + FactorPlugin.evalInListener(view,expr); + else + buf.append(FactorPlugin.evalInWire(expr)); words = words.next(); } diff --git a/factor/jedit/InferBufferProcessor.java b/factor/jedit/InferBufferProcessor.java index f1042ae5ce..cccfcff160 100644 --- a/factor/jedit/InferBufferProcessor.java +++ b/factor/jedit/InferBufferProcessor.java @@ -44,11 +44,10 @@ public class InferBufferProcessor extends FactorBufferProcessor { //{{{ createInferUnitTests() method public static void createInferUnitTests(View view, - final Buffer buffer, - final ExternalFactor factor) + final Buffer buffer) throws Exception { - final String results = new InferBufferProcessor(buffer,factor) + final String results = new InferBufferProcessor(view,buffer) .getResults(); final Buffer newBuffer = jEdit.newFile(view); @@ -70,10 +69,10 @@ public class InferBufferProcessor extends FactorBufferProcessor } //}}} //{{{ InferBufferProcessor constructor - public InferBufferProcessor(Buffer buffer, ExternalFactor factor) + public InferBufferProcessor(View view, Buffer buffer) throws Exception { - super(buffer,factor); + super(view,buffer,false); } //}}} //{{{ processWord() method