]> gitweb.factorcode.org Git - factor.git/commitdiff
better plugin tools
authorSlava Pestov <slava@factorcode.org>
Mon, 24 Jan 2005 02:53:55 +0000 (02:53 +0000)
committerSlava Pestov <slava@factorcode.org>
Mon, 24 Jan 2005 02:53:55 +0000 (02:53 +0000)
TODO.FACTOR.txt
actions.xml
factor/jedit/CompileBufferProcessor.java
factor/jedit/FactorBufferProcessor.java
factor/jedit/InferBufferProcessor.java

index 48a4af52add495f8481571196bc8454fbd1469f5..c7c527da708e5e8233254dc805c92bea2db8d22d 100644 (file)
 + listener/plugin:\r
 \r
 - update plugin docs\r
-- extract word puts stuff in the wrong place\r
 - extract word keeps indent\r
 - word preview for remote words\r
 - WordPreview calls markTokens() -> NPE\r
 - listener should be multithreaded\r
-- compile all commands\r
 - faster completion\r
 - NPE in ErrorHighlight\r
 - maple-like: press enter at old commands to evaluate there\r
index b70bc9b67c285924c6d69bdc132ac1738a206bfc..654f989e9f924f54a803e44098fc64f87e255c80 100644 (file)
        </ACTION>
        <ACTION NAME="factor-infer-effects">
                <CODE>
-                       InferBufferProcessor.createInferUnitTests(view,buffer,
-                               FactorPlugin.getExternalInstance());
+                       InferBufferProcessor.createInferUnitTests(view,buffer);
                </CODE>
        </ACTION>
        <ACTION NAME="factor-compile-all">
                <CODE>
-                       wm.showDockableWindow("console");
-                       CompileBufferProcessor.compileWordsInBuffer(view,buffer,
-                               FactorPlugin.getExternalInstance(),
-                               wm.getDockableWindow("console"));
+                       new CompileBufferProcessor(view,buffer);
                </CODE>
        </ACTION>
 </ACTIONS>
index 36f5f3d0d05d3284367d4dbbfdbe1fbd617ba741..2272c56068f977afb8fe37d3ee0604f454e09216 100644 (file)
@@ -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
index 9333c6e976689316697448c98c2c9c76095df832..961586c208996b897a3d5918e837c9697cbaccb3 100644 (file)
@@ -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();
                }
                
index f1042ae5ce236301c7513960a986137e6b1c99c5..cccfcff160423cbc71d4b4a2c086cebacba55594 100644 (file)
@@ -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