diff --git a/extra/bootstrap/tools/tools.factor b/extra/bootstrap/tools/tools.factor old mode 100644 new mode 100755 index f3ec0a88e8..f94bf80bbf --- a/extra/bootstrap/tools/tools.factor +++ b/extra/bootstrap/tools/tools.factor @@ -1,4 +1,4 @@ -USING: kernel vocabs vocabs.loader sequences namespaces parser ; +USING: vocabs.loader sequences ; { "bootstrap.image" @@ -6,14 +6,9 @@ USING: kernel vocabs vocabs.loader sequences namespaces parser ; "tools.crossref" "tools.deploy" "tools.memory" + "tools.profiler" "tools.test" "tools.time" "tools.walker" "editors" -} dup [ require ] each - -global [ add-use ] bind - -"bootstrap.compiler" vocab [ - "tools.profiler" dup require use+ -] when +} [ require ] each diff --git a/extra/calendar/calendar.factor b/extra/calendar/calendar.factor old mode 100644 new mode 100755 index 55d632d245..63c7532b61 --- a/extra/calendar/calendar.factor +++ b/extra/calendar/calendar.factor @@ -3,9 +3,13 @@ USING: arrays hashtables io io.streams.string kernel math math.vectors math.functions math.parser namespaces sequences -strings tuples system debugger ; +strings tuples system debugger combinators vocabs.loader ; IN: calendar +SYMBOL: calendar-impl + +HOOK: gmt-offset calendar-impl ( -- n ) + TUPLE: timestamp year month day hour minute second gmt-offset ; C: timestamp @@ -14,8 +18,6 @@ TUPLE: dt year month day hour minute second ; C:
dt -DEFER: gmt-offset - : month-names { "Not a month" "January" "February" "March" "April" "May" "June" @@ -351,9 +353,7 @@ M: timestamp <=> ( ts1 ts2 -- n ) ] if ] string-out ; -SYMBOL: calendar-impl - -HOOK: gmt-offset calendar-impl ( -- n ) - -USE-IF: unix? calendar.unix -USE-IF: windows? calendar.windows +{ + { [ unix? ] [ "calendar.unix" ] } + { [ windows? ] [ "calendar.windows" ] } +} cond require diff --git a/extra/channels/sniffer/sniffer.factor b/extra/channels/sniffer/sniffer.factor old mode 100644 new mode 100755 index 7c97c2e244..8edd035cca --- a/extra/channels/sniffer/sniffer.factor +++ b/extra/channels/sniffer/sniffer.factor @@ -3,12 +3,11 @@ ! ! Wrap a sniffer in a channel USING: kernel channels concurrency io io.backend -io.sniffer system ; +io.sniffer system vocabs.loader ; : (sniff-channel) ( stream channel -- ) 4096 pick stream-read-partial over to (sniff-channel) ; HOOK: sniff-channel io-backend ( -- channel ) -USE-IF: bsd? channels.sniffer.bsd - +bsd? [ "channels.sniffer.bsd" require ] when diff --git a/extra/editors/gvim/gvim.factor b/extra/editors/gvim/gvim.factor old mode 100644 new mode 100755 index 7a1f939b5c..8b3573d03e --- a/extra/editors/gvim/gvim.factor +++ b/extra/editors/gvim/gvim.factor @@ -1,5 +1,6 @@ USING: io.backend io.files kernel math math.parser -namespaces editors.vim sequences system ; +namespaces editors.vim sequences system combinators +vocabs.loader ; IN: editors.gvim TUPLE: gvim ; @@ -14,5 +15,7 @@ t vim-detach set-global ! don't block the ui T{ gvim } vim-editor set-global -USE-IF: unix? editors.gvim.unix -USE-IF: windows? editors.gvim.windows +{ + { [ unix? ] [ "editors.gvim.unix" ] } + { [ windows? ] [ "editors.gvim.windows" ] } +} cond require diff --git a/extra/hardware-info/hardware-info.factor b/extra/hardware-info/hardware-info.factor old mode 100644 new mode 100755 index 521ec3d95f..9b3c969dc3 --- a/extra/hardware-info/hardware-info.factor +++ b/extra/hardware-info/hardware-info.factor @@ -1,4 +1,5 @@ -USING: alien.syntax math prettyprint system ; +USING: alien.syntax math prettyprint system combinators +vocabs.loader ; IN: hardware-info SYMBOL: os @@ -17,7 +18,9 @@ HOOK: available-virtual-extended-mem os ( -- n ) : megs. ( x -- ) 20 2^ /f . ; : gigs. ( x -- ) 30 2^ /f . ; -USE-IF: windows? hardware-info.windows -USE-IF: linux? hardware-info.linux -USE-IF: macosx? hardware-info.macosx +{ + { [ windows? ] [ "hardware-info.windows" ] } + { [ linux? ] [ "hardware-info.linux" ] } + { [ macosx? ] [ "hardware-info.macosx" ] } +} cond require diff --git a/extra/hardware-info/windows/windows.factor b/extra/hardware-info/windows/windows.factor old mode 100644 new mode 100755 index 88e9a8cfb5..5352d64698 --- a/extra/hardware-info/windows/windows.factor +++ b/extra/hardware-info/windows/windows.factor @@ -1,6 +1,6 @@ USING: alien alien.c-types kernel libc math namespaces windows windows.kernel32 windows.advapi32 hardware-info -words ; +words combinators vocabs.loader ; IN: hardware-info.windows TUPLE: wince ; @@ -70,6 +70,7 @@ M: windows cpus ( -- n ) : system-windows-directory ( -- str ) \ GetSystemWindowsDirectory get-directory ; -USE-IF: wince? hardware-info.windows.ce -USE-IF: winnt? hardware-info.windows.nt - +{ + { [ wince? ] [ "hardware-info.windows.ce" ] } + { [ winnt? ] [ "hardware-info.windows.nt" ] } +} cond require diff --git a/extra/help/syntax/syntax.factor b/extra/help/syntax/syntax.factor index 6d287de60f..7ffa83c0d7 100755 --- a/extra/help/syntax/syntax.factor +++ b/extra/help/syntax/syntax.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2005, 2007 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: arrays kernel parser sequences words help help.topics -namespaces vocabs ; +namespaces vocabs definitions ; IN: help.syntax : HELP: diff --git a/extra/io/launcher/launcher.factor b/extra/io/launcher/launcher.factor index 114a50597c..7de9d91bc7 100755 --- a/extra/io/launcher/launcher.factor +++ b/extra/io/launcher/launcher.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2007 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: io.backend system kernel namespaces strings hashtables -sequences assocs combinators ; +sequences assocs combinators vocabs.loader ; IN: io.launcher SYMBOL: +command+ @@ -57,6 +57,6 @@ HOOK: process-stream* io-backend ( desc -- stream ) : ( obj -- stream ) >descriptor process-stream* ; -USE-IF: unix? io.unix.launcher -USE-IF: windows? io.windows.launcher -USE-IF: winnt? io.windows.nt.launcher +unix? [ "io.unix.launcher" require ] when +windows? [ "io.windows.launcher" require ] when +winnt? [ "io.windows.nt.launcher" require ] when diff --git a/extra/io/mmap/mmap.factor b/extra/io/mmap/mmap.factor index aaa786f6a4..37ae0617f8 100755 --- a/extra/io/mmap/mmap.factor +++ b/extra/io/mmap/mmap.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2007 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: continuations io.backend kernel quotations sequences -system alien sequences.private ; +system alien sequences.private combinators vocabs.loader ; IN: io.mmap TUPLE: mapped-file length address handle closed? ; @@ -35,5 +35,7 @@ HOOK: (close-mapped-file) io-backend ( mmap -- ) [ keep ] curry [ close-mapped-file ] [ ] cleanup ; inline -USE-IF: unix? io.unix.mmap -USE-IF: windows? io.windows.mmap +{ + { [ unix? ] [ "io.unix.mmap" ] } + { [ windows? ] [ "io.windows.mmap" ] } +} cond require diff --git a/extra/io/sniffer/filter/filter.factor b/extra/io/sniffer/filter/filter.factor old mode 100644 new mode 100755 index 9a9a5be978..3240810e7f --- a/extra/io/sniffer/filter/filter.factor +++ b/extra/io/sniffer/filter/filter.factor @@ -1,6 +1,6 @@ -USING: alien.c-types byte-arrays combinators hexdump io io.backend -io.streams.string io.sockets.headers kernel math prettyprint -io.sniffer sequences system ; +USING: alien.c-types byte-arrays combinators hexdump io +io.backend io.streams.string io.sockets.headers kernel math +prettyprint io.sniffer sequences system vocabs.loader ; IN: io.sniffer.filter HOOK: sniffer-loop io-backend ( stream -- ) @@ -14,9 +14,6 @@ HOOK: packet. io-backend ( string -- ) ! HEX: 800 [ ] ! IP ! HEX: 806 [ ] ! ARP [ "Unknown type: " write .h ] - } case - - drop drop ; - -USE-IF: bsd? io.sniffer.filter.bsd + } case 2drop ; +bsd? [ "io.sniffer.filter.bsd" require ] when diff --git a/extra/io/sniffer/sniffer.factor b/extra/io/sniffer/sniffer.factor old mode 100644 new mode 100755 index 69ebc0bf5a..04491ca709 --- a/extra/io/sniffer/sniffer.factor +++ b/extra/io/sniffer/sniffer.factor @@ -1,4 +1,4 @@ -USING: io.backend kernel system ; +USING: io.backend kernel system vocabs.loader ; IN: io.sniffer SYMBOL: sniffer-type @@ -7,4 +7,4 @@ TUPLE: sniffer ; HOOK: io-backend ( obj -- sniffer ) -USE-IF: bsd? io.sniffer.bsd +bsd? [ "io.sniffer.bsd" require ] when diff --git a/extra/io/sockets/impl/impl.factor b/extra/io/sockets/impl/impl.factor old mode 100644 new mode 100755 index 426eda9c76..e490b9312b --- a/extra/io/sockets/impl/impl.factor +++ b/extra/io/sockets/impl/impl.factor @@ -2,11 +2,13 @@ ! See http://factorcode.org/license.txt for BSD license. USING: arrays byte-arrays io.backend io.binary io.sockets kernel math math.parser sequences splitting system -alien.c-types combinators namespaces alien ; +alien.c-types combinators namespaces alien parser ; IN: io.sockets.impl -USE-IF: windows? windows.winsock -USE-IF: unix? unix +<< { + { [ windows? ] [ "windows.winsock" ] } + { [ unix? ] [ "unix" ] } +} cond use+ >> GENERIC: protocol-family ( addrspec -- af ) diff --git a/extra/tools/annotations/annotations.factor b/extra/tools/annotations/annotations.factor index 87dd1ecd6b..018b91d219 100755 --- a/extra/tools/annotations/annotations.factor +++ b/extra/tools/annotations/annotations.factor @@ -1,15 +1,25 @@ ! Copyright (C) 2005, 2007 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: kernel words parser io inspector quotations sequences -prettyprint continuations effects ; +prettyprint continuations effects definitions ; IN: tools.annotations -: reset "not implemented yet" throw ; +r >r word-def r> call r> - swap define-compound do-parse-hook ; - inline + over check-compound + [ + >r dup word-def r> call define-compound + ] with-compilation-unit ; inline : entering ( str -- ) "/-- Entering: " write dup . @@ -32,11 +42,13 @@ IN: tools.annotations rot [ leaving ] curry swapd 3append ; +PRIVATE> + : watch ( word -- ) dup [ (watch) ] annotate ; : breakpoint ( word -- ) [ \ break add* ] annotate ; -: breakpoint-if ( quot word -- ) - [ [ [ break ] when ] swap 3append ] annotate ; +: breakpoint-if ( word quot -- ) + [ [ [ break ] when ] rot 3append ] curry annotate ; diff --git a/extra/tools/browser/browser.factor b/extra/tools/browser/browser.factor old mode 100644 new mode 100755 index 97d3c968cb..51c042d822 --- a/extra/tools/browser/browser.factor +++ b/extra/tools/browser/browser.factor @@ -117,7 +117,7 @@ M: vocab-link summary vocab-summary ; : load-everything ( -- ) all-vocabs-seq [ vocab-name dangerous? not ] subset - [ [ require ] each ] no-parse-hook ; + [ require ] each ; : unrooted-child-vocabs ( prefix -- seq ) dup empty? [ CHAR: . add ] unless @@ -137,7 +137,7 @@ M: vocab-link summary vocab-summary ; : load-children ( prefix -- ) all-child-vocabs values concat - [ [ require ] each ] no-parse-hook ; + [ require ] each ; : vocab-status-string ( vocab -- string ) { diff --git a/extra/tools/deploy/deploy.factor b/extra/tools/deploy/deploy.factor index dafe44dfad..7a3fbb8fdd 100755 --- a/extra/tools/deploy/deploy.factor +++ b/extra/tools/deploy/deploy.factor @@ -64,6 +64,5 @@ SYMBOL: deploy-implementation HOOK: deploy deploy-implementation ( vocab -- ) -USE-IF: macosx? tools.deploy.macosx - -USE-IF: winnt? tools.deploy.windows +macosx? [ "tools.deploy.macosx" require ] when +winnt? [ "tools.deploy.windows" require ] when diff --git a/extra/ui/tools/listener/listener.factor b/extra/ui/tools/listener/listener.factor old mode 100644 new mode 100755 index 7d7c7c1ea9..26910ac7b4 --- a/extra/ui/tools/listener/listener.factor +++ b/extra/ui/tools/listener/listener.factor @@ -74,8 +74,7 @@ M: listener-operation invoke-command ( target command -- ) dup empty? [ drop ] [ - [ [ [ run-file ] each ] no-parse-hook ] curry - call-listener + [ [ run-file ] each ] curry call-listener ] if ; : com-EOF ( listener -- ) diff --git a/extra/unix/unix.factor b/extra/unix/unix.factor old mode 100644 new mode 100755 index 10ff7a9efa..94bb598c25 --- a/extra/unix/unix.factor +++ b/extra/unix/unix.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. IN: unix USING: alien alien.c-types alien.syntax kernel libc structs -math namespaces system ; +math namespaces system combinators vocabs.loader ; ! ! ! Unix types TYPEDEF: int blksize_t @@ -24,10 +24,6 @@ TYPEDEF: ushort mode_t TYPEDEF: ushort nlink_t TYPEDEF: void* caddr_t -USE-IF: linux? unix.linux -USE-IF: bsd? unix.bsd -USE-IF: solaris? unix.solaris - C-STRUCT: tm { "int" "sec" } ! Seconds: 0-59 (K&R says 0-61?) { "int" "min" } ! Minutes: 0-59 @@ -204,3 +200,9 @@ FUNCTION: pid_t waitpid ( pid_t wpid, int* status, int options ) ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! FUNCTION: ssize_t write ( int fd, void* buf, size_t nbytes ) ; + +{ + { [ linux? ] [ "unix.linux" ] } + { [ bsd? ] [ "unix.bsd" ] } + { [ solaris? ] [ "unix.solaris" ] } +} cond require