diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index d7d06ce629..88b67567ac 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -1,3 +1,4 @@ +- extra chars in completion! - set 'end' of artifacts/assets accurately - faster layout - faster repaint diff --git a/factor/jedit/AbstractCompletion.java b/factor/jedit/AbstractCompletion.java deleted file mode 100644 index 91a53223bd..0000000000 --- a/factor/jedit/AbstractCompletion.java +++ /dev/null @@ -1,89 +0,0 @@ -/* :folding=explicit:collapseFolds=1: */ - -/* - * $Id$ - * - * Copyright (C) 2004, 2005 Slava Pestov. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package factor.jedit; - -import factor.*; -import java.util.*; -import javax.swing.ListCellRenderer; -import org.gjt.sp.jedit.textarea.*; -import org.gjt.sp.jedit.*; -import sidekick.*; - -public abstract class AbstractCompletion extends SideKickCompletion -{ - protected View view; - protected JEditTextArea textArea; - protected FactorParsedData data; - - //{{{ AbstractCompletion constructor - public AbstractCompletion(View view, FactorParsedData data) - { - this.view = view; - textArea = view.getTextArea(); - this.data = data; - } //}}} - - //{{{ getLongestPrefix() method - public String getLongestPrefix() - { - return MiscUtilities.getLongestPrefix(items,false); - } //}}} - - //{{{ updateInPlace() method - /** - * @return If this returns false, then we create a new completion - * object after user input. - */ - public boolean updateInPlace(EditPane editPane, int caret) - { - return false; - } //}}} - - //{{{ handleKeystroke() method - public boolean handleKeystroke(int selectedIndex, char keyChar) - { - if(keyChar == '\t' || keyChar == '\n') - { - insert(selectedIndex); - return false; - } - else if(keyChar == ' ') - { - insert(selectedIndex); - textArea.userInput(' '); - return false; - } - else - { - textArea.userInput(keyChar); - return true; - } - } //}}} -} diff --git a/factor/jedit/FactorVocabCompletion.java b/factor/jedit/FactorVocabCompletion.java index e50d23574f..5869beeac5 100644 --- a/factor/jedit/FactorVocabCompletion.java +++ b/factor/jedit/FactorVocabCompletion.java @@ -36,57 +36,15 @@ import org.gjt.sp.jedit.textarea.*; import org.gjt.sp.jedit.*; import sidekick.*; -public class FactorVocabCompletion extends AbstractCompletion +public class FactorVocabCompletion extends SideKickCompletion { - private String vocab; + protected FactorParsedData data; //{{{ FactorVocabCompletion constructor public FactorVocabCompletion(View view, String vocab, FactorParsedData data) { - super(view,data); - String[] completions = FactorPlugin.getVocabCompletions( - vocab,false); - this.items = Arrays.asList(completions); - this.vocab = vocab; + super(view,vocab,Arrays.asList(FactorPlugin.getVocabCompletions( + vocab,false))); + this.data = data; } //}}} - - public String getLongestPrefix() - { - return MiscUtilities.getLongestPrefix(items,false); - } - - public void insert(int index) - { - String selected = ((String)get(index)); - String insert = selected.substring(vocab.length()); - - Buffer buffer = textArea.getBuffer(); - - textArea.setSelectedText(insert); - } - - public int getTokenLength() - { - return vocab.length(); - } - - public boolean handleKeystroke(int selectedIndex, char keyChar) - { - if(keyChar == '\t' || keyChar == '\n') - { - insert(selectedIndex); - return false; - } - else if(keyChar == ' ') - { - insert(selectedIndex); - textArea.userInput(' '); - return false; - } - else - { - textArea.userInput(keyChar); - return true; - } - } } diff --git a/factor/jedit/FactorWordCompletion.java b/factor/jedit/FactorWordCompletion.java index 0e4c9a7861..91a43c8073 100644 --- a/factor/jedit/FactorWordCompletion.java +++ b/factor/jedit/FactorWordCompletion.java @@ -36,20 +36,16 @@ import org.gjt.sp.jedit.textarea.*; import org.gjt.sp.jedit.*; import sidekick.*; -public class FactorWordCompletion extends AbstractCompletion +public class FactorWordCompletion extends SideKickCompletion { - private String word; + protected FactorParsedData data; //{{{ FactorWordCompletion constructor public FactorWordCompletion(View view, String word, FactorParsedData data) { - super(view,data); - - FactorWord[] completions = FactorPlugin.toWordArray( - FactorPlugin.getWordCompletions(word,false)); - - this.items = Arrays.asList(completions); - this.word = word; + super(view,word,FactorPlugin.toWordArray( + FactorPlugin.getWordCompletions(word,false))); + this.data = data; } //}}} /** @@ -58,14 +54,14 @@ public class FactorWordCompletion extends AbstractCompletion */ public boolean updateInPlace(EditPane editPane, int caret) { - String word = FactorSideKickParser.getCompletionWord(editPane,caret); + text = FactorSideKickParser.getCompletionWord(editPane,caret); List newItems = new ArrayList(); Iterator iter = items.iterator(); while(iter.hasNext()) { FactorWord w = (FactorWord)iter.next(); - if(w.name.startsWith(word)) + if(w.name.startsWith(text)) newItems.add(w); } @@ -76,27 +72,10 @@ public class FactorWordCompletion extends AbstractCompletion public void insert(int index) { + super.insert(index); FactorWord selected = ((FactorWord)get(index)); - String insert = selected.name.substring(word.length()); - - Buffer buffer = textArea.getBuffer(); - - try - { - buffer.beginCompoundEdit(); - textArea.setSelectedText(insert); - if(!FactorPlugin.isUsed(view,selected.vocabulary)) - FactorPlugin.insertUse(view,selected.vocabulary); - } - finally - { - buffer.endCompoundEdit(); - } - } - - public int getTokenLength() - { - return word.length(); + if(!FactorPlugin.isUsed(view,selected.vocabulary)) + FactorPlugin.insertUse(view,selected.vocabulary); } public ListCellRenderer getRenderer() diff --git a/library/syntax/parse-syntax.factor b/library/syntax/parse-syntax.factor index ed71bb8f32..ac820e90c9 100644 --- a/library/syntax/parse-syntax.factor +++ b/library/syntax/parse-syntax.factor @@ -58,6 +58,7 @@ BUILTIN: f 9 ; : f f swons ; parsing ! Do not execute parsing word : POSTPONE: ( -- ) scan-word swons ; parsing +! Word definitions : : #! Begin a word definition. Word name follows. CREATE [ define-compound ] [ ] "in-definition" on ; parsing diff --git a/library/tools/annotations.factor b/library/tools/annotations.factor index 3b65fa3b29..b09367a78f 100644 --- a/library/tools/annotations.factor +++ b/library/tools/annotations.factor @@ -9,7 +9,8 @@ IN: words USING: interpreter kernel lists stdio strings test ; : annotate ( word quot -- ) #! Quotation: ( word def -- def ) - >r dup dup word-def r> call (define-compound) ; inline + over >r >r dup word-def r> call r> swap (define-compound) ; + inline : (watch) >r "==> " swap word-name cat2 \ print r> cons cons ; diff --git a/library/unix/files.factor b/library/unix/files.factor index 175ccfe847..1d753f6000 100644 --- a/library/unix/files.factor +++ b/library/unix/files.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2005 Slava Pestov. ! See http://factor.sf.net/license.txt for BSD license. IN: files -USING: alien kernel math namespaces ; +USING: alien io-internals kernel math namespaces ; : cd ( dir -- ) "void" "libc" "chdir" [ "char*" ] alien-invoke ; diff --git a/library/unix/io.factor b/library/unix/io.factor index 2de29ae793..a76b180b6d 100644 --- a/library/unix/io.factor +++ b/library/unix/io.factor @@ -13,3 +13,6 @@ USING: errors kernel math ; : open-write ( path -- fd ) O_WRONLY O_CREAT bitor O_TRUNC bitor file-mode sys-open dup io-error ; + +: read-step ( fd buffer -- ) + ; diff --git a/native/arithmetic.h b/native/arithmetic.h index bd98828725..0fbe3ee915 100644 --- a/native/arithmetic.h +++ b/native/arithmetic.h @@ -1,3 +1 @@ -#include "factor.h" - void primitive_arithmetic_type(void);