better plugin tools

cvs
Slava Pestov 2005-01-24 02:53:55 +00:00
parent af40535556
commit 4a6f404cc2
5 changed files with 15 additions and 29 deletions

View File

@ -27,12 +27,10 @@
+ listener/plugin: + listener/plugin:
- update plugin docs - update plugin docs
- extract word puts stuff in the wrong place
- extract word keeps indent - extract word keeps indent
- word preview for remote words - word preview for remote words
- WordPreview calls markTokens() -> NPE - WordPreview calls markTokens() -> NPE
- listener should be multithreaded - listener should be multithreaded
- compile all commands
- faster completion - faster completion
- NPE in ErrorHighlight - NPE in ErrorHighlight
- maple-like: press enter at old commands to evaluate there - maple-like: press enter at old commands to evaluate there

View File

@ -94,16 +94,12 @@
</ACTION> </ACTION>
<ACTION NAME="factor-infer-effects"> <ACTION NAME="factor-infer-effects">
<CODE> <CODE>
InferBufferProcessor.createInferUnitTests(view,buffer, InferBufferProcessor.createInferUnitTests(view,buffer);
FactorPlugin.getExternalInstance());
</CODE> </CODE>
</ACTION> </ACTION>
<ACTION NAME="factor-compile-all"> <ACTION NAME="factor-compile-all">
<CODE> <CODE>
wm.showDockableWindow("console"); new CompileBufferProcessor(view,buffer);
CompileBufferProcessor.compileWordsInBuffer(view,buffer,
FactorPlugin.getExternalInstance(),
wm.getDockableWindow("console"));
</CODE> </CODE>
</ACTION> </ACTION>
</ACTIONS> </ACTIONS>

View File

@ -38,22 +38,11 @@ import org.gjt.sp.util.*;
public class CompileBufferProcessor extends FactorBufferProcessor 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 //{{{ CompileBufferProcessor constructor
public CompileBufferProcessor(Buffer buffer, ExternalFactor factor) public CompileBufferProcessor(View view, Buffer buffer)
throws Exception throws Exception
{ {
super(buffer,factor); super(view,buffer,true);
} //}}} } //}}}
//{{{ processWord() method //{{{ processWord() method

View File

@ -31,6 +31,7 @@ package factor.jedit;
import factor.*; import factor.*;
import org.gjt.sp.jedit.Buffer; 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 * 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; private String results;
//{{{ FactorBufferProcessor constructor //{{{ FactorBufferProcessor constructor
public FactorBufferProcessor(Buffer buffer, ExternalFactor factor) public FactorBufferProcessor(View view, Buffer buffer,
throws Exception boolean evalInListener) throws Exception
{ {
StringBuffer buf = new StringBuffer(); StringBuffer buf = new StringBuffer();
@ -56,7 +57,10 @@ public abstract class FactorBufferProcessor
buf.append("! "); buf.append("! ");
buf.append(expr); buf.append(expr);
buf.append('\n'); buf.append('\n');
buf.append(factor.eval(expr)); if(evalInListener)
FactorPlugin.evalInListener(view,expr);
else
buf.append(FactorPlugin.evalInWire(expr));
words = words.next(); words = words.next();
} }

View File

@ -44,11 +44,10 @@ public class InferBufferProcessor extends FactorBufferProcessor
{ {
//{{{ createInferUnitTests() method //{{{ createInferUnitTests() method
public static void createInferUnitTests(View view, public static void createInferUnitTests(View view,
final Buffer buffer, final Buffer buffer)
final ExternalFactor factor)
throws Exception throws Exception
{ {
final String results = new InferBufferProcessor(buffer,factor) final String results = new InferBufferProcessor(view,buffer)
.getResults(); .getResults();
final Buffer newBuffer = jEdit.newFile(view); final Buffer newBuffer = jEdit.newFile(view);
@ -70,10 +69,10 @@ public class InferBufferProcessor extends FactorBufferProcessor
} //}}} } //}}}
//{{{ InferBufferProcessor constructor //{{{ InferBufferProcessor constructor
public InferBufferProcessor(Buffer buffer, ExternalFactor factor) public InferBufferProcessor(View view, Buffer buffer)
throws Exception throws Exception
{ {
super(buffer,factor); super(view,buffer,false);
} //}}} } //}}}
//{{{ processWord() method //{{{ processWord() method