Get bootstrap.tools to load, update extra/ for USE-IF: removal

db4
Slava Pestov 2007-12-28 21:46:06 -05:00
parent 52ae410cc5
commit ced9893a4e
17 changed files with 85 additions and 71 deletions

11
extra/bootstrap/tools/tools.factor Normal file → Executable file
View File

@ -1,4 +1,4 @@
USING: kernel vocabs vocabs.loader sequences namespaces parser ; USING: vocabs.loader sequences ;
{ {
"bootstrap.image" "bootstrap.image"
@ -6,14 +6,9 @@ USING: kernel vocabs vocabs.loader sequences namespaces parser ;
"tools.crossref" "tools.crossref"
"tools.deploy" "tools.deploy"
"tools.memory" "tools.memory"
"tools.profiler"
"tools.test" "tools.test"
"tools.time" "tools.time"
"tools.walker" "tools.walker"
"editors" "editors"
} dup [ require ] each } [ require ] each
global [ add-use ] bind
"bootstrap.compiler" vocab [
"tools.profiler" dup require use+
] when

18
extra/calendar/calendar.factor Normal file → Executable file
View File

@ -3,9 +3,13 @@
USING: arrays hashtables io io.streams.string kernel math USING: arrays hashtables io io.streams.string kernel math
math.vectors math.functions math.parser namespaces sequences math.vectors math.functions math.parser namespaces sequences
strings tuples system debugger ; strings tuples system debugger combinators vocabs.loader ;
IN: calendar IN: calendar
SYMBOL: calendar-impl
HOOK: gmt-offset calendar-impl ( -- n )
TUPLE: timestamp year month day hour minute second gmt-offset ; TUPLE: timestamp year month day hour minute second gmt-offset ;
C: <timestamp> timestamp C: <timestamp> timestamp
@ -14,8 +18,6 @@ TUPLE: dt year month day hour minute second ;
C: <dt> dt C: <dt> dt
DEFER: gmt-offset
: month-names : month-names
{ {
"Not a month" "January" "February" "March" "April" "May" "June" "Not a month" "January" "February" "March" "April" "May" "June"
@ -351,9 +353,7 @@ M: timestamp <=> ( ts1 ts2 -- n )
] if ] if
] string-out ; ] string-out ;
SYMBOL: calendar-impl {
{ [ unix? ] [ "calendar.unix" ] }
HOOK: gmt-offset calendar-impl ( -- n ) { [ windows? ] [ "calendar.windows" ] }
} cond require
USE-IF: unix? calendar.unix
USE-IF: windows? calendar.windows

5
extra/channels/sniffer/sniffer.factor Normal file → Executable file
View File

@ -3,12 +3,11 @@
! !
! Wrap a sniffer in a channel ! Wrap a sniffer in a channel
USING: kernel channels concurrency io io.backend USING: kernel channels concurrency io io.backend
io.sniffer system ; io.sniffer system vocabs.loader ;
: (sniff-channel) ( stream channel -- ) : (sniff-channel) ( stream channel -- )
4096 pick stream-read-partial over to (sniff-channel) ; 4096 pick stream-read-partial over to (sniff-channel) ;
HOOK: sniff-channel io-backend ( -- channel ) HOOK: sniff-channel io-backend ( -- channel )
USE-IF: bsd? channels.sniffer.bsd bsd? [ "channels.sniffer.bsd" require ] when

9
extra/editors/gvim/gvim.factor Normal file → Executable file
View File

@ -1,5 +1,6 @@
USING: io.backend io.files kernel math math.parser 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 IN: editors.gvim
TUPLE: gvim ; TUPLE: gvim ;
@ -14,5 +15,7 @@ t vim-detach set-global ! don't block the ui
T{ gvim } vim-editor set-global 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

11
extra/hardware-info/hardware-info.factor Normal file → Executable file
View File

@ -1,4 +1,5 @@
USING: alien.syntax math prettyprint system ; USING: alien.syntax math prettyprint system combinators
vocabs.loader ;
IN: hardware-info IN: hardware-info
SYMBOL: os SYMBOL: os
@ -17,7 +18,9 @@ HOOK: available-virtual-extended-mem os ( -- n )
: megs. ( x -- ) 20 2^ /f . ; : megs. ( x -- ) 20 2^ /f . ;
: gigs. ( x -- ) 30 2^ /f . ; : gigs. ( x -- ) 30 2^ /f . ;
USE-IF: windows? hardware-info.windows {
USE-IF: linux? hardware-info.linux { [ windows? ] [ "hardware-info.windows" ] }
USE-IF: macosx? hardware-info.macosx { [ linux? ] [ "hardware-info.linux" ] }
{ [ macosx? ] [ "hardware-info.macosx" ] }
} cond require

9
extra/hardware-info/windows/windows.factor Normal file → Executable file
View File

@ -1,6 +1,6 @@
USING: alien alien.c-types kernel libc math namespaces USING: alien alien.c-types kernel libc math namespaces
windows windows.kernel32 windows.advapi32 hardware-info windows windows.kernel32 windows.advapi32 hardware-info
words ; words combinators vocabs.loader ;
IN: hardware-info.windows IN: hardware-info.windows
TUPLE: wince ; TUPLE: wince ;
@ -70,6 +70,7 @@ M: windows cpus ( -- n )
: system-windows-directory ( -- str ) : system-windows-directory ( -- str )
\ GetSystemWindowsDirectory get-directory ; \ 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

View File

@ -1,7 +1,7 @@
! Copyright (C) 2005, 2007 Slava Pestov. ! Copyright (C) 2005, 2007 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: arrays kernel parser sequences words help help.topics USING: arrays kernel parser sequences words help help.topics
namespaces vocabs ; namespaces vocabs definitions ;
IN: help.syntax IN: help.syntax
: HELP: : HELP:

View File

@ -1,7 +1,7 @@
! Copyright (C) 2007 Slava Pestov. ! Copyright (C) 2007 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: io.backend system kernel namespaces strings hashtables USING: io.backend system kernel namespaces strings hashtables
sequences assocs combinators ; sequences assocs combinators vocabs.loader ;
IN: io.launcher IN: io.launcher
SYMBOL: +command+ SYMBOL: +command+
@ -57,6 +57,6 @@ HOOK: process-stream* io-backend ( desc -- stream )
: <process-stream> ( obj -- stream ) : <process-stream> ( obj -- stream )
>descriptor process-stream* ; >descriptor process-stream* ;
USE-IF: unix? io.unix.launcher unix? [ "io.unix.launcher" require ] when
USE-IF: windows? io.windows.launcher windows? [ "io.windows.launcher" require ] when
USE-IF: winnt? io.windows.nt.launcher winnt? [ "io.windows.nt.launcher" require ] when

View File

@ -1,7 +1,7 @@
! Copyright (C) 2007 Doug Coleman. ! Copyright (C) 2007 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: continuations io.backend kernel quotations sequences USING: continuations io.backend kernel quotations sequences
system alien sequences.private ; system alien sequences.private combinators vocabs.loader ;
IN: io.mmap IN: io.mmap
TUPLE: mapped-file length address handle closed? ; TUPLE: mapped-file length address handle closed? ;
@ -35,5 +35,7 @@ HOOK: (close-mapped-file) io-backend ( mmap -- )
[ keep ] curry [ keep ] curry
[ close-mapped-file ] [ ] cleanup ; inline [ 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

13
extra/io/sniffer/filter/filter.factor Normal file → Executable file
View File

@ -1,6 +1,6 @@
USING: alien.c-types byte-arrays combinators hexdump io io.backend USING: alien.c-types byte-arrays combinators hexdump io
io.streams.string io.sockets.headers kernel math prettyprint io.backend io.streams.string io.sockets.headers kernel math
io.sniffer sequences system ; prettyprint io.sniffer sequences system vocabs.loader ;
IN: io.sniffer.filter IN: io.sniffer.filter
HOOK: sniffer-loop io-backend ( stream -- ) HOOK: sniffer-loop io-backend ( stream -- )
@ -14,9 +14,6 @@ HOOK: packet. io-backend ( string -- )
! HEX: 800 [ ] ! IP ! HEX: 800 [ ] ! IP
! HEX: 806 [ ] ! ARP ! HEX: 806 [ ] ! ARP
[ "Unknown type: " write .h ] [ "Unknown type: " write .h ]
} case } case 2drop ;
drop drop ;
USE-IF: bsd? io.sniffer.filter.bsd
bsd? [ "io.sniffer.filter.bsd" require ] when

4
extra/io/sniffer/sniffer.factor Normal file → Executable file
View File

@ -1,4 +1,4 @@
USING: io.backend kernel system ; USING: io.backend kernel system vocabs.loader ;
IN: io.sniffer IN: io.sniffer
SYMBOL: sniffer-type SYMBOL: sniffer-type
@ -7,4 +7,4 @@ TUPLE: sniffer ;
HOOK: <sniffer> io-backend ( obj -- sniffer ) HOOK: <sniffer> io-backend ( obj -- sniffer )
USE-IF: bsd? io.sniffer.bsd bsd? [ "io.sniffer.bsd" require ] when

8
extra/io/sockets/impl/impl.factor Normal file → Executable file
View File

@ -2,11 +2,13 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: arrays byte-arrays io.backend io.binary io.sockets USING: arrays byte-arrays io.backend io.binary io.sockets
kernel math math.parser sequences splitting system kernel math math.parser sequences splitting system
alien.c-types combinators namespaces alien ; alien.c-types combinators namespaces alien parser ;
IN: io.sockets.impl 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 ) GENERIC: protocol-family ( addrspec -- af )

View File

@ -1,15 +1,25 @@
! Copyright (C) 2005, 2007 Slava Pestov. ! Copyright (C) 2005, 2007 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel words parser io inspector quotations sequences USING: kernel words parser io inspector quotations sequences
prettyprint continuations effects ; prettyprint continuations effects definitions ;
IN: tools.annotations IN: tools.annotations
: reset "not implemented yet" throw ; <PRIVATE
: check-compound ( word -- word )
compound? [
"Annotations can only be used with compound words" throw
] unless ;
: reset ( word -- )
dup check-compound
dup "unannotated-def" word-prop define-compound ;
: annotate ( word quot -- ) : annotate ( word quot -- )
over >r >r word-def r> call r> over check-compound
swap define-compound do-parse-hook ; [
inline >r dup word-def r> call define-compound
] with-compilation-unit ; inline
: entering ( str -- ) : entering ( str -- )
"/-- Entering: " write dup . "/-- Entering: " write dup .
@ -32,11 +42,13 @@ IN: tools.annotations
rot [ leaving ] curry rot [ leaving ] curry
swapd 3append ; swapd 3append ;
PRIVATE>
: watch ( word -- ) : watch ( word -- )
dup [ (watch) ] annotate ; dup [ (watch) ] annotate ;
: breakpoint ( word -- ) : breakpoint ( word -- )
[ \ break add* ] annotate ; [ \ break add* ] annotate ;
: breakpoint-if ( quot word -- ) : breakpoint-if ( word quot -- )
[ [ [ break ] when ] swap 3append ] annotate ; [ [ [ break ] when ] rot 3append ] curry annotate ;

4
extra/tools/browser/browser.factor Normal file → Executable file
View File

@ -117,7 +117,7 @@ M: vocab-link summary vocab-summary ;
: load-everything ( -- ) : load-everything ( -- )
all-vocabs-seq all-vocabs-seq
[ vocab-name dangerous? not ] subset [ vocab-name dangerous? not ] subset
[ [ require ] each ] no-parse-hook ; [ require ] each ;
: unrooted-child-vocabs ( prefix -- seq ) : unrooted-child-vocabs ( prefix -- seq )
dup empty? [ CHAR: . add ] unless dup empty? [ CHAR: . add ] unless
@ -137,7 +137,7 @@ M: vocab-link summary vocab-summary ;
: load-children ( prefix -- ) : load-children ( prefix -- )
all-child-vocabs values concat all-child-vocabs values concat
[ [ require ] each ] no-parse-hook ; [ require ] each ;
: vocab-status-string ( vocab -- string ) : vocab-status-string ( vocab -- string )
{ {

View File

@ -64,6 +64,5 @@ SYMBOL: deploy-implementation
HOOK: deploy deploy-implementation ( vocab -- ) HOOK: deploy deploy-implementation ( vocab -- )
USE-IF: macosx? tools.deploy.macosx macosx? [ "tools.deploy.macosx" require ] when
winnt? [ "tools.deploy.windows" require ] when
USE-IF: winnt? tools.deploy.windows

3
extra/ui/tools/listener/listener.factor Normal file → Executable file
View File

@ -74,8 +74,7 @@ M: listener-operation invoke-command ( target command -- )
dup empty? [ dup empty? [
drop drop
] [ ] [
[ [ [ run-file ] each ] no-parse-hook ] curry [ [ run-file ] each ] curry call-listener
call-listener
] if ; ] if ;
: com-EOF ( listener -- ) : com-EOF ( listener -- )

12
extra/unix/unix.factor Normal file → Executable file
View File

@ -2,7 +2,7 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
IN: unix IN: unix
USING: alien alien.c-types alien.syntax kernel libc structs USING: alien alien.c-types alien.syntax kernel libc structs
math namespaces system ; math namespaces system combinators vocabs.loader ;
! ! ! Unix types ! ! ! Unix types
TYPEDEF: int blksize_t TYPEDEF: int blksize_t
@ -24,10 +24,6 @@ TYPEDEF: ushort mode_t
TYPEDEF: ushort nlink_t TYPEDEF: ushort nlink_t
TYPEDEF: void* caddr_t TYPEDEF: void* caddr_t
USE-IF: linux? unix.linux
USE-IF: bsd? unix.bsd
USE-IF: solaris? unix.solaris
C-STRUCT: tm C-STRUCT: tm
{ "int" "sec" } ! Seconds: 0-59 (K&R says 0-61?) { "int" "sec" } ! Seconds: 0-59 (K&R says 0-61?)
{ "int" "min" } ! Minutes: 0-59 { "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 ) ; FUNCTION: ssize_t write ( int fd, void* buf, size_t nbytes ) ;
{
{ [ linux? ] [ "unix.linux" ] }
{ [ bsd? ] [ "unix.bsd" ] }
{ [ solaris? ] [ "unix.solaris" ] }
} cond require