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"
@ -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

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

@ -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> timestamp
@ -14,8 +18,6 @@ TUPLE: dt year month day hour minute second ;
C: <dt> 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

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

@ -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

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
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

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
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

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
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

View File

@ -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:

View File

@ -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 )
: <process-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

View File

@ -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

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
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

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
SYMBOL: sniffer-type
@ -7,4 +7,4 @@ TUPLE: 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.
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 )

View File

@ -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 ;
<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 -- )
over >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 ;

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

@ -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 )
{

View File

@ -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

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? [
drop
] [
[ [ [ run-file ] each ] no-parse-hook ] curry
call-listener
[ [ run-file ] each ] curry call-listener
] if ;
: 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.
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