diff --git a/basis/bootstrap/stage2.factor b/basis/bootstrap/stage2.factor index ffa878b326..301833a114 100644 --- a/basis/bootstrap/stage2.factor +++ b/basis/bootstrap/stage2.factor @@ -106,6 +106,7 @@ CONSTANT: default-components "stage2: deployment mode" print ] [ "debugger" require + os unix? [ "debugger.unix" require ] when "listener" require ] if diff --git a/basis/debugger/unix/unix.factor b/basis/debugger/unix/unix.factor index c82c45d7f3..1f27bc1dbb 100644 --- a/basis/debugger/unix/unix.factor +++ b/basis/debugger/unix/unix.factor @@ -1,25 +1,9 @@ ! Copyright (C) 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: debugger io kernel math prettyprint sequences system -io.launcher.unix accessors strings ; +USING: accessors debugger io kernel math prettyprint sequences +system unix.signals ; IN: debugger.unix -CONSTANT: signal-names -{ - "SIGHUP" "SIGINT" "SIGQUIT" "SIGILL" "SIGTRAP" "SIGABRT" - "SIGEMT" "SIGFPE" "SIGKILL" "SIGBUS" "SIGSEGV" "SIGSYS" - "SIGPIPE" "SIGALRM" "SIGTERM" "SIGURG" "SIGSTOP" "SIGTSIP" - "SIGCONT" "SIGCHLD" "SIGTTIN" "SIGTTOU" "SIGIO" "SIGXCPU" - "SIGXFSZ" "SIGVTALRM" "SIGPROF" "SIGWINCH" "SIGINFO" - "SIGUSR1" "SIGUSR2" -} - -GENERIC: signal-name ( obj -- str/f ) - -M: signal signal-name n>> signal-name ; - -M: integer signal-name ( n -- str/f ) 1 - signal-names ?nth ; - : signal-name. ( n -- ) signal-name [ " (" ")" surround write ] when* ; diff --git a/basis/io/backend/unix/unix.factor b/basis/io/backend/unix/unix.factor index 76d6773aa9..dcdc01061c 100644 --- a/basis/io/backend/unix/unix.factor +++ b/basis/io/backend/unix/unix.factor @@ -5,7 +5,7 @@ classes.struct combinators destructors destructors.private fry io.backend io.backend.unix.multiplexers io.buffers io.files io.ports io.timeouts kernel kernel.private libc locals make math namespaces sequences summary system threads unix unix.ffi -unix.stat unix.types ; +unix.signals unix.stat unix.types ; QUALIFIED: io IN: io.backend.unix @@ -185,8 +185,6 @@ M: stdin cancel-operation size-read-fd init-fd >>size data-read-fd >>data ; -INITIALIZED-SYMBOL: dispatch-signal-hook [ [ drop ] ] - : signal-pipe-fd ( -- n ) OBJ-SIGNAL-PIPE special-object ; inline diff --git a/basis/openssl/libcrypto/libcrypto.factor b/basis/openssl/libcrypto/libcrypto.factor index 5879aa338c..1273ba6a21 100644 --- a/basis/openssl/libcrypto/libcrypto.factor +++ b/basis/openssl/libcrypto/libcrypto.factor @@ -4,15 +4,14 @@ ! Tested with OpenSSL 0.9.8a_0 on Mac OS X 10.4.9 PowerPC ! ! export LD_LIBRARY_PATH=/opt/local/lib - USING: alien alien.c-types alien.destructors alien.libraries -alien.syntax classes.struct combinators system ; +alien.libraries.finder alien.syntax classes.struct combinators system ; IN: openssl.libcrypto << "libcrypto" { { [ os windows? ] [ "libcrypto-37.dll" ] } - { [ os macosx? ] [ "libcrypto.dylib" ] } + { [ os macosx? ] [ { "libcrypto.46.dylib" "libcrypto.44.dylib" } find-library-from-list ] } { [ os unix? ] [ "libcrypto.so" ] } } cond cdecl add-library >> diff --git a/basis/openssl/libssl/libssl.factor b/basis/openssl/libssl/libssl.factor index 0f7251ca6a..e1f76347f8 100644 --- a/basis/openssl/libssl/libssl.factor +++ b/basis/openssl/libssl/libssl.factor @@ -2,14 +2,14 @@ ! Portions copyright (C) 2008 Slava Pestov ! See http://factorcode.org/license.txt for BSD license. USING: alien alien.c-types alien.destructors alien.libraries -alien.parser alien.syntax classes.struct combinators kernel literals -namespaces openssl.libcrypto system ; +alien.libraries.finder alien.parser alien.syntax classes.struct +combinators kernel literals namespaces openssl.libcrypto system ; IN: openssl.libssl << "libssl" { { [ os windows? ] [ "libssl-38.dll" ] } - { [ os macosx? ] [ "libssl.dylib" ] } + { [ os macosx? ] [ { "libssl.44.dylib" "libssl.42.dylib" } find-library-from-list ] } { [ os unix? ] [ "libssl.so" ] } } cond cdecl add-library >> diff --git a/basis/peg/peg.factor b/basis/peg/peg.factor index e57b83e162..2b12da42e5 100644 --- a/basis/peg/peg.factor +++ b/basis/peg/peg.factor @@ -265,15 +265,14 @@ GENERIC: (compile) ( peg -- quot ) : execute-parser ( word -- result ) pos get apply-rule process-parser-result ; -: preset-parser-word ( parser -- parser word ) - gensym [ >>compiled ] keep ; +: preset-parser-word ( parser -- word parser ) + gensym swap over >>compiled ; -: define-parser-word ( parser word -- ) +: define-parser-word ( word parser -- ) ! Return the body of the word that is the compiled version ! of the parser. - - 2dup swap peg>> (compile) ( -- result ) define-declared - swap id>> "peg-id" set-word-prop ; + [ peg>> (compile) ( -- result ) define-declared ] + [ id>> "peg-id" set-word-prop ] 2bi ; : compile-parser ( parser -- word ) ! Look to see if the given parser has been compiled. @@ -285,7 +284,7 @@ GENERIC: (compile) ( peg -- quot ) dup compiled>> [ nip ] [ - preset-parser-word [ define-parser-word ] keep + preset-parser-word dupd define-parser-word ] if* ; : compile-parser-quot ( parser -- quot ) diff --git a/basis/unix/signals/signals.factor b/basis/unix/signals/signals.factor index 5880d3504a..ccf04fa967 100644 --- a/basis/unix/signals/signals.factor +++ b/basis/unix/signals/signals.factor @@ -1,9 +1,30 @@ ! Copyright (C) 2011 Joe Groff. ! See http://factorcode.org/license.txt for BSD license. -USING: assocs io.backend.unix kernel namespaces sequences -threads ; +USING: accessors assocs kernel math namespaces sequences threads ; IN: unix.signals +CONSTANT: signal-names +{ + "SIGHUP" "SIGINT" "SIGQUIT" "SIGILL" "SIGTRAP" "SIGABRT" + "SIGEMT" "SIGFPE" "SIGKILL" "SIGBUS" "SIGSEGV" "SIGSYS" + "SIGPIPE" "SIGALRM" "SIGTERM" "SIGURG" "SIGSTOP" "SIGTSIP" + "SIGCONT" "SIGCHLD" "SIGTTIN" "SIGTTOU" "SIGIO" "SIGXCPU" + "SIGXFSZ" "SIGVTALRM" "SIGPROF" "SIGWINCH" "SIGINFO" + "SIGUSR1" "SIGUSR2" +} + +TUPLE: signal n ; + +GENERIC: signal-name ( obj -- str/f ) + +M: signal signal-name n>> signal-name ; + +M: integer signal-name ( n -- str/f ) 1 - signal-names ?nth ; + +SYMBOL: dispatch-signal-hook + +dispatch-signal-hook [ [ drop ] ] initialize + > ] [ temporaries>> ] bi append ] [ body>> [ assigned-locals ] map concat fast-set ] bi '[ - dup dup _ in? - [ ] - [ ] - if + dup dup _ in? [ ] [ ] if ] H{ } map>assoc dup [ nip local-reader? ] assoc-filter diff --git a/extra/smalltalk/compiler/lexenv/lexenv.factor b/extra/smalltalk/compiler/lexenv/lexenv.factor index 3a7d29e6da..9d952bca34 100644 --- a/extra/smalltalk/compiler/lexenv/lexenv.factor +++ b/extra/smalltalk/compiler/lexenv/lexenv.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: assocs kernel accessors quotations slots words -sequences namespaces combinators combinators.short-circuit -summary smalltalk.classes ; +USING: accessors assocs combinators combinators.short-circuit +kernel namespaces quotations sequences slots smalltalk.classes +summary words ; IN: smalltalk.compiler.lexenv ! local-readers: assoc string => word diff --git a/extra/smalltalk/eval/eval.factor b/extra/smalltalk/eval/eval.factor index 56841beafd..545c1d933c 100644 --- a/extra/smalltalk/eval/eval.factor +++ b/extra/smalltalk/eval/eval.factor @@ -1,8 +1,7 @@ ! Copyright (C) 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: io.files io.encodings.utf8 -compiler.units smalltalk.parser smalltalk.compiler -smalltalk.library ; +USING: compiler.units io.encodings.utf8 io.files +smalltalk.compiler smalltalk.parser ; IN: smalltalk.eval : eval-smalltalk ( string -- result ) diff --git a/extra/smalltalk/parser/parser.factor b/extra/smalltalk/parser/parser.factor index 838ae9cafd..452fe8c9b5 100644 --- a/extra/smalltalk/parser/parser.factor +++ b/extra/smalltalk/parser/parser.factor @@ -1,7 +1,8 @@ ! Copyright (C) 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: peg peg.ebnf smalltalk.ast sequences sequences.deep strings -math.parser multiline kernel arrays byte-arrays math assocs accessors ; +USING: accessors arrays assocs byte-arrays kernel math +math.parser multiline peg.ebnf sequences sequences.deep +smalltalk.ast strings ; IN: smalltalk.parser ! :mode=text:noTabs=true: @@ -131,7 +132,7 @@ BinaryMessage = OptionalWhiteSpace OptionalWhiteSpace (UnaryMessageSend | Operand):rhs => [[ selector { rhs } ast-message boa ]] - + KeywordMessageSegment = Keyword:k OptionalWhiteSpace (BinaryMessageSend | UnaryMessageSend | Operand):arg => [[ { k arg } ]] KeywordMessage = OptionalWhiteSpace KeywordMessageSegment:h