fix millis; fix <resource-stream>

cvs
Slava Pestov 2004-09-06 00:14:37 +00:00
parent fa29a1cbad
commit 9d9643850e
9 changed files with 52 additions and 29 deletions

View File

@ -1,7 +1,5 @@
- move <resource-stream> from parser
- quit responder breaks with multithreading - quit responder breaks with multithreading
- nicer way to combine two paths - nicer way to combine two paths
- -1.1 3 ^ shouldn't give a complex number
- don't show listener on certain commands - don't show listener on certain commands
- plugin should not exit jEdit on fatal errors - plugin should not exit jEdit on fatal errors
- wordpreview: don't show for string literals and comments - wordpreview: don't show for string literals and comments
@ -11,7 +9,6 @@
- introduce ifte* and ?str-head/?str-tail where appropriate - introduce ifte* and ?str-head/?str-tail where appropriate
- namespace clone drops static var bindings - namespace clone drops static var bindings
- solaris: -lsocket -lnsl - solaris: -lsocket -lnsl
- unparsing: \u000c
+ bignums: + bignums:
@ -49,8 +46,6 @@
- NPE in activate()/deactivate() - NPE in activate()/deactivate()
- NPE in ErrorHighlight - 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 - some way to not have previous definitions from a source file
clutter the namespace clutter the namespace
- use inferior.factor for everything not just listener - use inferior.factor for everything not just listener

View File

@ -43,10 +43,6 @@ public class ReadTable
DEFAULT_READTABLE.setCharacterType('\t',ReadTable.WHITESPACE); DEFAULT_READTABLE.setCharacterType('\t',ReadTable.WHITESPACE);
DEFAULT_READTABLE.setCharacterType('\n',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('\r',ReadTable.WHITESPACE);
DEFAULT_READTABLE.setCharacterType(' ',ReadTable.WHITESPACE); DEFAULT_READTABLE.setCharacterType(' ',ReadTable.WHITESPACE);

View File

@ -210,13 +210,40 @@ public class FactorPlugin extends EditPlugin
if(caret == line.length()) if(caret == line.length())
caret--; caret--;
String noWordSep = textArea.getBuffer().getStringProperty( ReadTable readtable = ReadTable.DEFAULT_READTABLE;
"noWordSep");
int wordStart = TextUtilities.findWordStart(line,caret, if(readtable.getCharacterType(line.charAt(caret))
noWordSep); == ReadTable.WHITESPACE)
int wordEnd = TextUtilities.findWordEnd(line,caret, {
noWordSep); return null;
return line.substring(wordStart,wordEnd); }
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 //{{{ showStatus() method

View File

@ -34,6 +34,7 @@ USE: stack
! Power-related functions: ! Power-related functions:
! exp log sqrt pow ! exp log sqrt pow
USE: logic
: exp >rect swap fexp swap polar> ; : exp >rect swap fexp swap polar> ;
: log >polar swap flog swap rect> ; : log >polar swap flog swap rect> ;
@ -52,4 +53,8 @@ USE: stack
[ [ >rect ] dip flog * swap ] dip * + ; [ [ >rect ] dip flog * swap ] dip * + ;
: ^ ( z w -- z^w ) : ^ ( 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 ;

View File

@ -39,13 +39,10 @@ USE: strings
: run-file ( path -- ) : run-file ( path -- )
parse-file call ; parse-file call ;
: <resource-stream> ( path -- stream )
<rreader> f <char-stream> ;
: parse-resource* ( resource -- list ) : parse-resource* ( resource -- list )
dup <rreader> swap "resource:" swap cat2 swap parse-stream ; dup <rreader> swap "resource:" swap cat2 swap parse-stream ;
: parse-resource ( file -- ) : parse-resource ( resource -- list )
#! Override this to be slightly more useful for development. #! Override this to be slightly more useful for development.
global [ "resource-path" get ] bind dup [ global [ "resource-path" get ] bind dup [
swap cat2 parse-file swap cat2 parse-file

View File

@ -254,3 +254,6 @@ USE: strings
#! Accept a connection from a server socket. #! Accept a connection from a server socket.
[ "socket" get ] bind [ "socket" get ] bind
[ ] "java.net.ServerSocket" "accept" jinvoke <socket-stream> ; [ ] "java.net.ServerSocket" "accept" jinvoke <socket-stream> ;
: <resource-stream> ( path -- stream )
<rreader> f <char-stream> ;

View File

@ -96,12 +96,6 @@ USE: strings
#! the current interactive interpreter. #! the current interactive interpreter.
(parse-file) call ; (parse-file) call ;
: resource-path ( -- path )
"resource-path" get [ "." ] unless* ;
: <resource-stream> ( path -- stream )
resource-path swap cat2 <filecr> ;
: parse-resource ( path -- quot ) : parse-resource ( path -- quot )
#! Resources are loaded from the resource-path variable, or #! Resources are loaded from the resource-path variable, or
#! the current directory if it is not set. Words defined in #! the current directory if it is not set. Words defined in

View File

@ -90,3 +90,9 @@ USE: namespaces
#! Copy the contents of the fd-stream 'from' to the #! Copy the contents of the fd-stream 'from' to the
#! fd-stream 'to'. #! fd-stream 'to'.
[ 2dup (fcopy) ] [ -rot fclose fclose rethrow ] catch ; [ 2dup (fcopy) ] [ -rot fclose fclose rethrow ] catch ;
: resource-path ( -- path )
"resource-path" get [ "." ] unless* ;
: <resource-stream> ( path -- stream )
resource-path swap cat2 <filecr> ;

View File

@ -24,8 +24,8 @@ void primitive_millis(void)
{ {
struct timeval t; struct timeval t;
gettimeofday(&t,NULL); gettimeofday(&t,NULL);
dpush(tag_object(s48_long_to_bignum( dpush(tag_object(s48_long_long_to_bignum(
t.tv_sec * 1000 + t.tv_usec/1000))); (long long)t.tv_sec * 1000 + t.tv_usec/1000)));
} }
void primitive_init_random(void) void primitive_init_random(void)