Cleanups and fixes

slava 2006-09-06 22:48:46 +00:00
parent 046f770b2d
commit b3960f56e9
10 changed files with 14 additions and 15 deletions

View File

@ -19,7 +19,6 @@
- we need to optimize [ dup array? [ array? ] [ array? ] if ] - we need to optimize [ dup array? [ array? ] [ array? ] if ]
- better way of dealing with compiler errors - better way of dealing with compiler errors
- track individual method usages - track individual method usages
- modularize core
- track module files and modification times, and a list of assets loaded - track module files and modification times, and a list of assets loaded
from that file from that file
- 'changes' word, asks if files changed on disk from loaded modules - 'changes' word, asks if files changed on disk from loaded modules

View File

@ -2,8 +2,6 @@ IN: vim
USING: definitions embedded io kernel parser prettyprint process USING: definitions embedded io kernel parser prettyprint process
sequences namespaces ; sequences namespaces ;
: file-modified stat fourth ;
: vim-location ( file line -- ) : vim-location ( file line -- )
>r [ file-modified ] keep r> >r [ file-modified ] keep r>
[ "vim \"" % over % "\" +" % # ] "" make system drop [ "vim \"" % over % "\" +" % # ] "" make system drop

View File

@ -55,7 +55,7 @@ PROVIDE: library/compiler {
"test/bail-out.factor" "test/bail-out.factor"
"test/intrinsics.factor" "test/intrinsics.factor"
"test/float.factor" "test/float.factor"
"test/identities" "test/identities.factor"
"test/optimizer.factor" "test/optimizer.factor"
"test/alien.factor" "test/alien.factor"
"test/callbacks.factor" "test/callbacks.factor"

View File

@ -19,6 +19,8 @@ strings styles ;
: file-length ( path -- n ) stat third ; : file-length ( path -- n ) stat third ;
: file-modified ( path -- n ) stat fourth ;
: parent-dir ( path -- parent ) : parent-dir ( path -- parent )
CHAR: / over last-index CHAR: \\ pick last-index max CHAR: / over last-index CHAR: \\ pick last-index max
dup -1 = [ 2drop "." ] [ head ] if ; dup -1 = [ 2drop "." ] [ head ] if ;

View File

@ -95,8 +95,7 @@ PROVIDE: library {
"tools/listener.factor" "tools/listener.factor"
"tools/inspector.factor" "tools/inspector.factor"
"tools/word-tools.factor" "tools/word-tools.factor"
"tools/test.factor"
"test/test.factor"
"tools/interpreter.factor" "tools/interpreter.factor"
@ -179,7 +178,6 @@ PROVIDE: library {
"syntax/parser.facts" "syntax/parser.facts"
"syntax/parse-syntax.facts" "syntax/parse-syntax.facts"
"syntax/prettyprint.facts" "syntax/prettyprint.facts"
"test/test.facts"
"tools/definitions.facts" "tools/definitions.facts"
"tools/word-tools.facts" "tools/word-tools.facts"
"tools/debugger.facts" "tools/debugger.facts"
@ -188,6 +186,7 @@ PROVIDE: library {
"tools/inspector.facts" "tools/inspector.facts"
"tools/listener.facts" "tools/listener.facts"
"tools/memory.facts" "tools/memory.facts"
"tools/test.facts"
} }
! Test files ! Test files
{ {
@ -231,5 +230,5 @@ PROVIDE: library {
"test/stream.factor" "test/stream.factor"
"test/threads.factor" "test/threads.factor"
"test/tuple.factor" "test/tuple.factor"
"test/words" "test/words.factor"
} ; } ;

View File

@ -49,10 +49,11 @@ SYMBOL: modules
[ module-files run-resources ] keep [ module-files run-resources ] keep
dup module-name modules get set-hash ; dup module-name modules get set-hash ;
: test ( name -- ) module module-tests run-tests ; : test-module ( name -- ) module module-tests run-tests ;
: tests ( -- ) : test-modules ( -- )
modules hash-keys [ module-tests ] map concat run-tests ; modules get hash-values
[ module-tests ] map concat run-tests ;
: modules. ( -- ) : modules. ( -- )
modules get hash-keys natural-sort [ print ] each ; modules get hash-keys natural-sort [ print ] each ;

View File

@ -45,9 +45,9 @@ HELP: provide
{ $values { "name" "a string" } { "files" "a sequence of strings" } { "tests" "a sequence of strings" } } { $values { "name" "a string" } { "files" "a sequence of strings" } { "tests" "a sequence of strings" } }
{ $description "Registers a module definition and loads its source files. Usually instead of calling this word, module definitions use the parsing word " { $link POSTPONE: PROVIDE: } " instead." } ; { $description "Registers a module definition and loads its source files. Usually instead of calling this word, module definitions use the parsing word " { $link POSTPONE: PROVIDE: } " instead." } ;
HELP: test HELP: test-module
{ $values { "name" "a module name string" } } { $values { "name" "a module name string" } }
{ $description "Runs the unit test files associated to the module by a previous call to " { $link provide } " or " { $link POSTPONE: PROVIDE: } "." } ; { $description "Runs the unit test files associated to the module by a previous call to " { $link provide } " or " { $link POSTPONE: PROVIDE: } "." } ;
HELP: tests HELP: test-modules
{ $description "Runs unit test files for all loaded modules." } ; { $description "Runs unit test files for all loaded modules." } ;

View File

@ -5,7 +5,7 @@ USING: arrays errors generic hashtables io kernel math
namespaces parser prettyprint sequences styles words ; namespaces parser prettyprint sequences styles words ;
: ?resource-path ( path -- path ) : ?resource-path ( path -- path )
"resource:/" ?head [ resource-path ] when ; "resource:" ?head [ resource-path ] when ;
: where ( defspec -- loc ) : where ( defspec -- loc )
where* dup [ first2 >r ?resource-path r> 2array ] when ; where* dup [ first2 >r ?resource-path r> 2array ] when ;

View File

@ -44,7 +44,7 @@ SYMBOL: failures
: test-handler ( name quot -- ? ) : test-handler ( name quot -- ? )
catch [ dup error. 2array failure f ] [ t ] if* ; catch [ dup error. 2array failure f ] [ t ] if* ;
: test ( path -- ? ) : run-test ( path -- ? )
[ [
"=====> " write dup write "..." print flush "=====> " write dup write "..." print flush
[ [