diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 14dc94dbfe..6212d76b46 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -1,7 +1,5 @@ -- move from parser - quit responder breaks with multithreading - nicer way to combine two paths -- -1.1 3 ^ shouldn't give a complex number - don't show listener on certain commands - plugin should not exit jEdit on fatal errors - wordpreview: don't show for string literals and comments @@ -11,7 +9,6 @@ - introduce ifte* and ?str-head/?str-tail where appropriate - namespace clone drops static var bindings - solaris: -lsocket -lnsl -- unparsing: \u000c + bignums: @@ -49,8 +46,6 @@ - NPE in activate()/deactivate() - NPE in ErrorHighlight -- caret at start of word: problem -- don't use jEdit's word finding API - some way to not have previous definitions from a source file clutter the namespace - use inferior.factor for everything not just listener diff --git a/factor/ReadTable.java b/factor/ReadTable.java index 4fe180cf2a..10233fbcba 100644 --- a/factor/ReadTable.java +++ b/factor/ReadTable.java @@ -43,10 +43,6 @@ public class ReadTable DEFAULT_READTABLE.setCharacterType('\t',ReadTable.WHITESPACE); DEFAULT_READTABLE.setCharacterType('\n',ReadTable.WHITESPACE); - - // ^L - DEFAULT_READTABLE.setCharacterType((char)12,ReadTable.WHITESPACE); - DEFAULT_READTABLE.setCharacterType('\r',ReadTable.WHITESPACE); DEFAULT_READTABLE.setCharacterType(' ',ReadTable.WHITESPACE); diff --git a/factor/jedit/FactorPlugin.java b/factor/jedit/FactorPlugin.java index 656d551760..cffd7927d8 100644 --- a/factor/jedit/FactorPlugin.java +++ b/factor/jedit/FactorPlugin.java @@ -210,13 +210,40 @@ public class FactorPlugin extends EditPlugin if(caret == line.length()) caret--; - String noWordSep = textArea.getBuffer().getStringProperty( - "noWordSep"); - int wordStart = TextUtilities.findWordStart(line,caret, - noWordSep); - int wordEnd = TextUtilities.findWordEnd(line,caret, - noWordSep); - return line.substring(wordStart,wordEnd); + ReadTable readtable = ReadTable.DEFAULT_READTABLE; + + if(readtable.getCharacterType(line.charAt(caret)) + == ReadTable.WHITESPACE) + { + return null; + } + + int start = caret; + while(start > 0) + { + if(readtable.getCharacterType(line.charAt(start - 1)) + == ReadTable.WHITESPACE) + { + break; + } + else + start--; + } + + int end = caret; + do + { + if(readtable.getCharacterType(line.charAt(end)) + == ReadTable.WHITESPACE) + { + break; + } + else + end++; + } + while(end < line.length()); + + return line.substring(start,end); } //}}} //{{{ showStatus() method diff --git a/library/math/pow.factor b/library/math/pow.factor index d4e3abc302..a8ffae1d47 100644 --- a/library/math/pow.factor +++ b/library/math/pow.factor @@ -34,6 +34,7 @@ USE: stack ! Power-related functions: ! exp log sqrt pow +USE: logic : exp >rect swap fexp swap polar> ; : log >polar swap flog swap rect> ; @@ -52,4 +53,8 @@ USE: stack [ [ >rect ] dip flog * swap ] dip * + ; : ^ ( z w -- z^w ) - swap >polar 3dup ^theta [ ^mag ] dip polar> ; + over real? over integer? and [ + fpow + ] [ + swap >polar 3dup ^theta >r ^mag r> polar> + ] ifte ; diff --git a/library/platform/jvm/parser.factor b/library/platform/jvm/parser.factor index be49b87a94..013db28674 100644 --- a/library/platform/jvm/parser.factor +++ b/library/platform/jvm/parser.factor @@ -39,13 +39,10 @@ USE: strings : run-file ( path -- ) parse-file call ; -: ( path -- stream ) - f ; - : parse-resource* ( resource -- list ) dup swap "resource:" swap cat2 swap parse-stream ; -: parse-resource ( file -- ) +: parse-resource ( resource -- list ) #! Override this to be slightly more useful for development. global [ "resource-path" get ] bind dup [ swap cat2 parse-file diff --git a/library/platform/jvm/stream.factor b/library/platform/jvm/stream.factor index 89063534e6..12eac0509c 100644 --- a/library/platform/jvm/stream.factor +++ b/library/platform/jvm/stream.factor @@ -254,3 +254,6 @@ USE: strings #! Accept a connection from a server socket. [ "socket" get ] bind [ ] "java.net.ServerSocket" "accept" jinvoke ; + +: ( path -- stream ) + f ; diff --git a/library/platform/native/parse-stream.factor b/library/platform/native/parse-stream.factor index cdbe65b249..63acdef74e 100644 --- a/library/platform/native/parse-stream.factor +++ b/library/platform/native/parse-stream.factor @@ -96,12 +96,6 @@ USE: strings #! the current interactive interpreter. (parse-file) call ; -: resource-path ( -- path ) - "resource-path" get [ "." ] unless* ; - -: ( path -- stream ) - resource-path swap cat2 ; - : parse-resource ( path -- quot ) #! Resources are loaded from the resource-path variable, or #! the current directory if it is not set. Words defined in diff --git a/library/platform/native/stream.factor b/library/platform/native/stream.factor index fef1fa3e39..3b6959d462 100644 --- a/library/platform/native/stream.factor +++ b/library/platform/native/stream.factor @@ -90,3 +90,9 @@ USE: namespaces #! Copy the contents of the fd-stream 'from' to the #! fd-stream 'to'. [ 2dup (fcopy) ] [ -rot fclose fclose rethrow ] catch ; + +: resource-path ( -- path ) + "resource-path" get [ "." ] unless* ; + +: ( path -- stream ) + resource-path swap cat2 ; diff --git a/native/misc.c b/native/misc.c index 636e6dbd67..ddc6bf1bc7 100644 --- a/native/misc.c +++ b/native/misc.c @@ -24,8 +24,8 @@ void primitive_millis(void) { struct timeval t; gettimeofday(&t,NULL); - dpush(tag_object(s48_long_to_bignum( - t.tv_sec * 1000 + t.tv_usec/1000))); + dpush(tag_object(s48_long_long_to_bignum( + (long long)t.tv_sec * 1000 + t.tv_usec/1000))); } void primitive_init_random(void)